feat: 店员昵称及性别修改纳入资料审核
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.starry.admin.modules.clerk.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserQueryVo;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserReturnVo;
|
||||
@@ -216,6 +218,9 @@ public class PlayClerkUserInfoController {
|
||||
@PostMapping(value = "/update")
|
||||
public R update(@ApiParam(value = "店员信息", required = true) @Validated @RequestBody PlayClerkUserEditVo vo) {
|
||||
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
||||
if (StrUtil.isNotBlank(vo.getSex())) {
|
||||
throw new CustomException("性别修改需要提交资料审核");
|
||||
}
|
||||
boolean success = playClerkUserInfoService.update(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
@@ -233,6 +238,9 @@ public class PlayClerkUserInfoController {
|
||||
@PostMapping(value = "/updateState")
|
||||
public R updateState(
|
||||
@ApiParam(value = "店员状态信息", required = true) @Validated @RequestBody PlayClerkUserStateEditVo vo) {
|
||||
if (StrUtil.isNotBlank(vo.getSex())) {
|
||||
throw new CustomException("性别修改需要提交资料审核");
|
||||
}
|
||||
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
||||
boolean success = playClerkUserInfoService.update(entity);
|
||||
if (success) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PlayClerkDataReviewInfoEntity extends BaseEntity<PlayClerkDataRevie
|
||||
private String clerkId;
|
||||
|
||||
/**
|
||||
* 资料类型[0:昵称;1:头像;2:相册;3:录音]
|
||||
* 资料类型[0:昵称;1:头像;2:相册;3:录音;4:性别]
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ public enum ClerkDataType {
|
||||
NICKNAME("0", "昵称"),
|
||||
AVATAR("1", "头像"),
|
||||
PHOTO_ALBUM("2", "相册"),
|
||||
RECORDING("3", "录音");
|
||||
RECORDING("3", "录音"),
|
||||
GENDER("4", "性别");
|
||||
|
||||
private final String code;
|
||||
private final String description;
|
||||
|
||||
@@ -25,9 +25,9 @@ public class PlayClerkDataReviewQueryVo extends BasePageEntity {
|
||||
private String clerkId;
|
||||
|
||||
/**
|
||||
* 资料类型[0:昵称;1:头像;2:相册;3:录音]
|
||||
* 资料类型[0:昵称;1:头像;2:相册;3:录音;4:性别]
|
||||
*/
|
||||
@ApiModelProperty(value = "资料类型", example = "1", notes = "0:昵称;1:头像;2:相册;3:录音")
|
||||
@ApiModelProperty(value = "资料类型", example = "1", notes = "0:昵称;1:头像;2:相册;3:录音;4:性别")
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,15 +43,15 @@ public class PlayClerkDataReviewReturnVo {
|
||||
private String clerkAvatar;
|
||||
|
||||
/**
|
||||
* 资料类型[0:昵称;1:头像;2:相册;3:录音]
|
||||
* 资料类型[0:昵称;1:头像;2:相册;3:录音;4:性别]
|
||||
*/
|
||||
@ApiModelProperty(value = "资料类型", example = "1", notes = "0:昵称;1:头像;2:相册;3:录音")
|
||||
@ApiModelProperty(value = "资料类型", example = "1", notes = "0:昵称;1:头像;2:相册;3:录音;4:性别")
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 资料类型枚举(新增字段,用于类型安全)
|
||||
*/
|
||||
@ApiModelProperty(value = "资料类型枚举", example = "AVATAR", notes = "NICKNAME:昵称, AVATAR:头像, PHOTO_ALBUM:相册, RECORDING:录音")
|
||||
@ApiModelProperty(value = "资料类型枚举", example = "AVATAR", notes = "NICKNAME:昵称, AVATAR:头像, PHOTO_ALBUM:相册, RECORDING:录音, GENDER:性别")
|
||||
private ClerkDataType dataTypeEnum;
|
||||
|
||||
/**
|
||||
|
||||
@@ -140,6 +140,9 @@ public class PlayClerkDataReviewInfoServiceImpl
|
||||
if (ClerkReviewState.APPROVED.equals(reviewState)) {
|
||||
PlayClerkUserInfoEntity userInfo = new PlayClerkUserInfoEntity();
|
||||
userInfo.setId(entity.getClerkId());
|
||||
if ("0".equals(entity.getDataType())) {
|
||||
userInfo.setNickname(entity.getDataContent().isEmpty() ? null : entity.getDataContent().get(0));
|
||||
}
|
||||
if ("1".equals(entity.getDataType())) {
|
||||
userInfo.setAvatar(entity.getDataContent().get(0));
|
||||
}
|
||||
@@ -149,6 +152,9 @@ public class PlayClerkDataReviewInfoServiceImpl
|
||||
if ("3".equals(entity.getDataType())) {
|
||||
userInfo.setAudio(entity.getDataContent().get(0));
|
||||
}
|
||||
if ("4".equals(entity.getDataType())) {
|
||||
userInfo.setSex(entity.getDataContent().isEmpty() ? null : entity.getDataContent().get(0));
|
||||
}
|
||||
playClerkUserInfoService.update(userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.starry.admin.common.domain.LoginUser;
|
||||
import com.starry.admin.common.exception.CustomException;
|
||||
import com.starry.admin.modules.clerk.mapper.PlayClerkUserInfoMapper;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkCommodityEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkDataReviewInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserQueryVo;
|
||||
@@ -21,6 +22,7 @@ import com.starry.admin.modules.clerk.module.vo.PlayClerkCommodityQueryVo;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkUnsettledWagesInfoQueryVo;
|
||||
import com.starry.admin.modules.clerk.module.vo.PlayClerkUnsettledWagesInfoReturnVo;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkCommodityService;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkDataReviewInfoService;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
||||
import com.starry.admin.modules.custom.entity.PlayCustomFollowInfoEntity;
|
||||
@@ -50,6 +52,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -71,6 +74,8 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
||||
@Resource
|
||||
private IPlayClerkCommodityService playClerkCommodityService;
|
||||
@Resource
|
||||
private IPlayClerkDataReviewInfoService playClerkDataReviewInfoService;
|
||||
@Resource
|
||||
private IPlayCustomFollowInfoService customFollowInfoService;
|
||||
@Resource
|
||||
private IPlayBalanceDetailsInfoService playBalanceDetailsInfoService;
|
||||
@@ -150,21 +155,29 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
||||
@Override
|
||||
public PlayClerkUserLoginResponseVo getVo(PlayClerkUserInfoEntity userInfo) {
|
||||
PlayClerkUserLoginResponseVo result = ConvertUtil.entityToVo(userInfo, PlayClerkUserLoginResponseVo.class);
|
||||
// List<PlayClerkDataReviewInfoEntity> list =
|
||||
// playClerkDataReviewInfoService.queryByClerkId(userInfo.getId(),"0");
|
||||
// // 判断头像、音频、相册是否可以编辑,如果存在未审核的数据,则不允许编辑
|
||||
// Map<String, PlayClerkDataReviewInfoEntity> map =
|
||||
// list.stream().collect(Collectors.toMap(PlayClerkDataReviewInfoEntity::getDataType,
|
||||
// account -> account, (entity1, entity2) -> entity1));
|
||||
// if (map.containsKey("1")) {
|
||||
// result.setAvatarAllowEdit(false);
|
||||
// }
|
||||
// if (map.containsKey("2")) {
|
||||
// result.setAlbumAllowEdit(false);
|
||||
// }
|
||||
// if (map.containsKey("3")) {
|
||||
// result.setAudioAllowEdit(false);
|
||||
// }
|
||||
List<PlayClerkDataReviewInfoEntity> pendingReviews = playClerkDataReviewInfoService
|
||||
.queryByClerkId(userInfo.getId(), "0");
|
||||
if (pendingReviews != null && !pendingReviews.isEmpty()) {
|
||||
Set<String> pendingTypes = pendingReviews.stream()
|
||||
.map(PlayClerkDataReviewInfoEntity::getDataType)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
if (pendingTypes.contains("0")) {
|
||||
result.setNicknameAllowEdit(false);
|
||||
}
|
||||
if (pendingTypes.contains("1")) {
|
||||
result.setAvatarAllowEdit(false);
|
||||
}
|
||||
if (pendingTypes.contains("2")) {
|
||||
result.setAlbumAllowEdit(false);
|
||||
}
|
||||
if (pendingTypes.contains("3")) {
|
||||
result.setAudioAllowEdit(false);
|
||||
}
|
||||
if (pendingTypes.contains("4")) {
|
||||
result.setSexAllowEdit(false);
|
||||
}
|
||||
}
|
||||
// 是店员之后,判断是否可以登录
|
||||
if ("1".equals(result.getClerkState())) {
|
||||
// 设置店员是否运行登录
|
||||
|
||||
@@ -46,6 +46,7 @@ import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -242,6 +243,36 @@ public class WxClerkController {
|
||||
return R.ok("申请成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新昵称", notes = "店员更新昵称")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
|
||||
@ClerkUserLogin
|
||||
@PostMapping("/user/updateNickname")
|
||||
public R updateNickname(@ApiParam(value = "昵称信息", required = true) @Validated @RequestBody PlayClerkUserNicknameVo vo) {
|
||||
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
||||
PlayClerkDataReviewInfoEntity entity = new PlayClerkDataReviewInfoEntity();
|
||||
entity.setClerkId(userInfo.getId());
|
||||
entity.setDataType("0");
|
||||
entity.setReviewState("0");
|
||||
entity.setDataContent(Collections.singletonList(vo.getNickname()));
|
||||
playClerkDataReviewInfoService.create(entity);
|
||||
return R.ok("提交成功,等待审核~");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新性别", notes = "店员更新性别")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
|
||||
@ClerkUserLogin
|
||||
@PostMapping("/user/updateSex")
|
||||
public R updateSex(@ApiParam(value = "性别信息", required = true) @Validated @RequestBody PlayClerkUserSexVo vo) {
|
||||
PlayClerkUserInfoEntity userInfo = ThreadLocalRequestDetail.getClerkUserInfo();
|
||||
PlayClerkDataReviewInfoEntity entity = new PlayClerkDataReviewInfoEntity();
|
||||
entity.setClerkId(userInfo.getId());
|
||||
entity.setDataType("4");
|
||||
entity.setReviewState("0");
|
||||
entity.setDataContent(Collections.singletonList(String.valueOf(vo.getSex())));
|
||||
playClerkDataReviewInfoService.create(entity);
|
||||
return R.ok("提交成功,等待审核~");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新头像", notes = "店员更新头像")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
|
||||
@ClerkUserLogin
|
||||
@@ -324,6 +355,10 @@ public class WxClerkController {
|
||||
@ClerkUserLogin
|
||||
@PostMapping("/user/updateOther")
|
||||
public R updateOther(@Validated @RequestBody PlayClerkUserOtherVo vo) {
|
||||
if (vo.getSex() != null) {
|
||||
throw new CustomException("性别修改需要提交资料审核");
|
||||
}
|
||||
vo.setSex(null);
|
||||
PlayClerkUserInfoEntity userInfo = ConvertUtil.entityToVo(vo, PlayClerkUserInfoEntity.class);
|
||||
userInfo.setId(ThreadLocalRequestDetail.getClerkUserInfo().getId());
|
||||
playClerkUserInfoService.update(userInfo);
|
||||
|
||||
@@ -35,6 +35,11 @@ public class PlayClerkUserLoginResponseVo {
|
||||
*/
|
||||
private boolean avatarAllowEdit = true;
|
||||
|
||||
/**
|
||||
* 昵称是否可编辑
|
||||
*/
|
||||
private boolean nicknameAllowEdit = true;
|
||||
|
||||
/**
|
||||
* 相册
|
||||
*/
|
||||
@@ -55,6 +60,11 @@ public class PlayClerkUserLoginResponseVo {
|
||||
*/
|
||||
private boolean audioAllowEdit = true;
|
||||
|
||||
/**
|
||||
* 性别是否可编辑
|
||||
*/
|
||||
private boolean sexAllowEdit = true;
|
||||
|
||||
/**
|
||||
* 店员性别(0:未知;1:男;2:女)
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 店员昵称修改请求
|
||||
*/
|
||||
@Data
|
||||
public class PlayClerkUserNicknameVo {
|
||||
|
||||
/**
|
||||
* 店员昵称
|
||||
*/
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
private String nickname;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.starry.admin.modules.weichat.entity;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 店员性别修改请求
|
||||
*/
|
||||
@Data
|
||||
public class PlayClerkUserSexVo {
|
||||
|
||||
/**
|
||||
* 店员性别(0:未知;1:男;2:女)
|
||||
*/
|
||||
@NotNull(message = "性别不能为空")
|
||||
@Min(value = 0, message = "性别参数错误")
|
||||
@Max(value = 2, message = "性别参数错误")
|
||||
private Integer sex;
|
||||
}
|
||||
Reference in New Issue
Block a user