This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* 审核内容
|
||||
|
||||
@@ -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())) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user