Compare commits

...

3 Commits

Author SHA1 Message Date
irving
82b86ae86e feat: 引入店员资料审核状态枚举
Some checks failed
Build and Push Backend / docker (push) Failing after 8s
2025-10-19 17:37:51 -04:00
irving
3e079850e6 fix: 店员申请查询支持精准筛选 2025-10-19 16:25:17 -04:00
irving
62001fbd5f clean and fmt 2025-10-18 21:36:09 -04:00
6 changed files with 104 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
package com.starry.admin.modules.clerk.module.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.starry.admin.modules.clerk.module.enums.ClerkDataType;
import com.starry.common.enums.ClerkReviewState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
@@ -66,6 +66,12 @@ public class PlayClerkDataReviewReturnVo {
@ApiModelProperty(value = "审核状态", example = "0", notes = "0未审核:1审核通过2审核不通过")
private String reviewState;
/**
* 审核状态枚举
*/
@ApiModelProperty(value = "审核状态枚举", example = "APPROVED", notes = "PENDING:未审核, APPROVED:审核通过, REJECTED:审核不通过")
private ClerkReviewState reviewStateEnum;
/**
* 资料添加时间
*/
@@ -123,4 +129,29 @@ public class PlayClerkDataReviewReturnVo {
return dataTypeEnum;
}
public void setReviewState(String reviewState) {
this.reviewState = reviewState;
try {
this.reviewStateEnum = ClerkReviewState.fromCode(reviewState);
} catch (Exception e) {
this.reviewStateEnum = null;
}
}
public void setReviewStateEnum(ClerkReviewState reviewStateEnum) {
this.reviewStateEnum = reviewStateEnum;
this.reviewState = reviewStateEnum != null ? reviewStateEnum.getCode() : null;
}
public ClerkReviewState getReviewStateEnum() {
if (reviewStateEnum == null && reviewState != null) {
try {
reviewStateEnum = ClerkReviewState.fromCode(reviewState);
} catch (Exception e) {
// ignore invalid code
}
}
return reviewStateEnum;
}
}

View File

@@ -1,10 +1,11 @@
package com.starry.admin.modules.clerk.module.vo;
import com.starry.common.enums.ClerkReviewState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.NotNull;
import lombok.Data;
/**
@@ -21,10 +22,14 @@ public class PlayClerkDataReviewStateEditVo {
/**
* 审核状态0未审核:1审核通过2审核不通过
*/
@NotBlank(message = "审核状态不能为空")
@Pattern(regexp = "[12]", message = "审核状态必须为1或2")
@ApiModelProperty(value = "审核状态", required = true, example = "1", notes = "1审核通过2审核不通过")
private String reviewState;
@NotNull(message = "审核状态不能为空")
@ApiModelProperty(
value = "审核状态",
required = true,
example = "1",
allowableValues = "1,2",
notes = "1审核通过2审核不通过")
private ClerkReviewState reviewState;
/**
* 审核内容

View File

@@ -16,12 +16,12 @@ import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewReturnVo;
import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewStateEditVo;
import com.starry.admin.modules.clerk.service.IPlayClerkDataReviewInfoService;
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
import com.starry.common.enums.ClerkReviewState;
import com.starry.common.utils.IdUtils;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
/**
@@ -132,9 +132,12 @@ public class PlayClerkDataReviewInfoServiceImpl
@Override
public void updateDataReviewState(PlayClerkDataReviewStateEditVo vo) {
PlayClerkDataReviewInfoEntity entity = this.selectPlayClerkDataReviewInfoById(vo.getId());
BeanUtils.copyProperties(vo, entity);
ClerkReviewState reviewState = vo.getReviewState();
entity.setReviewState(reviewState != null ? reviewState.getCode() : null);
entity.setReviewCon(vo.getReviewCon());
entity.setReviewTime(vo.getReviewTime() != null ? vo.getReviewTime() : LocalDateTime.now());
this.update(entity);
if ("1".equals(vo.getReviewState())) {
if (ClerkReviewState.APPROVED.equals(reviewState)) {
PlayClerkUserInfoEntity userInfo = new PlayClerkUserInfoEntity();
userInfo.setId(entity.getClerkId());
if ("1".equals(entity.getDataType())) {

View File

@@ -1,5 +1,6 @@
package com.starry.admin.modules.clerk.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -91,11 +92,19 @@ public class PlayClerkUserReviewInfoServiceImpl
lambdaQueryWrapper.like(PlayClerkUserReviewInfoEntity::getPhone, vo.getPhone());
}
if (StrUtil.isNotBlank(vo.getReviewState())) {
lambdaQueryWrapper.like(PlayClerkUserReviewInfoEntity::getReviewState, vo.getReviewState());
lambdaQueryWrapper.eq(PlayClerkUserReviewInfoEntity::getReviewState, vo.getReviewState());
}
if (StrUtil.isNotBlank(vo.getWeiChatCode())) {
lambdaQueryWrapper.like(PlayClerkUserReviewInfoEntity::getWeiChatCode, vo.getWeiChatCode());
}
if (CollUtil.isNotEmpty(vo.getAddTime())) {
if (vo.getAddTime().size() >= 2) {
lambdaQueryWrapper.between(PlayClerkUserReviewInfoEntity::getAddTime, vo.getAddTime().get(0),
vo.getAddTime().get(1));
} else if (vo.getAddTime().size() == 1) {
lambdaQueryWrapper.ge(PlayClerkUserReviewInfoEntity::getAddTime, vo.getAddTime().get(0));
}
}
// 加入组员的筛选
// List<String> clerkIdList =
// playClerkGroupInfoService.getValidClerkIdList(SecurityUtils.getLoginUser(),

View File

@@ -15,11 +15,9 @@ import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
import com.starry.admin.utils.SecurityUtils;
import com.starry.common.utils.ConvertUtil;
import com.starry.common.utils.IdUtils;
import java.io.InputStream;
import java.util.Date;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;

View File

@@ -0,0 +1,46 @@
package com.starry.common.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
/**
* 店员资料审核状态枚举,集中维护状态代码及含义。
*/
@ApiModel(value = "店员资料审核状态", description = "店员资料审核状态枚举,避免魔法值")
public enum ClerkReviewState {
PENDING("0", "未审核"),
APPROVED("1", "审核通过"),
REJECTED("2", "审核不通过");
private final String code;
private final String description;
ClerkReviewState(String code, String description) {
this.code = code;
this.description = description;
}
@JsonValue
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
@JsonCreator
public static ClerkReviewState fromCode(String code) {
if (code == null) {
return null;
}
for (ClerkReviewState state : ClerkReviewState.values()) {
if (state.code.equals(code)) {
return state;
}
}
throw new IllegalArgumentException("Unknown ClerkReviewState code: " + code);
}
}