From 890dc4c47912cab5b7b69ffef6a7b7f4ff4ddda6 Mon Sep 17 00:00:00 2001 From: "feng.li" Date: Wed, 19 Jul 2023 18:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=A2=E8=AF=95=E7=A8=BD=E6=A0=B8=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=90=88=E6=A0=BC=E4=B8=8D=E5=90=88=E6=A0=BC=E5=8F=8A?= =?UTF-8?q?=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cool/store/enums/ErrorCodeEnum.java | 1 + .../enums/InspectionOperationTypeEnum.java | 33 ++++++++ .../store/enums/InspectionStatusEnum.java | 32 +++++++ .../cool/store/enums/InspectionTyeEnum.java | 29 +++++++ .../resources/mapper/HyInspectionMapper.xml | 18 ++-- .../interview/InspectionRevocationDTO.java | 25 ++++++ .../interview/InspectionSubmissionDTO.java | 29 +++++++ .../com/cool/store/entity/HyInspection.java | 26 +++--- .../entity/HyInterviewInspectionLog.java | 22 +++-- .../service/InterviewInspectionService.java | 15 ++++ .../impl/InterviewInspectionServiceImpl.java | 83 ++++++++++++++++++- .../InterviewInspectionController.java | 10 ++- 12 files changed, 286 insertions(+), 37 deletions(-) create mode 100644 coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionOperationTypeEnum.java create mode 100644 coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionStatusEnum.java create mode 100644 coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionTyeEnum.java create mode 100644 coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionRevocationDTO.java create mode 100644 coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionSubmissionDTO.java diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java index 81a9779bb..34a46bbcf 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java @@ -83,6 +83,7 @@ public enum ErrorCodeEnum { GET_ACCESSTOKEN_ERROR(600001, "获取小程序TOKEN错误!", null), NEW_MOBILE_HAS_EXIST(600002,"加盟商用户信息已存在",null), INSPECTION_USER_OCCUPY(600002,"当前稽核人已经配置其他战区",null), + INSPECTION_INFO_NOT_EXIST(600005, "稽核信息不存在!", null) ; diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionOperationTypeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionOperationTypeEnum.java new file mode 100644 index 000000000..2656b91e1 --- /dev/null +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionOperationTypeEnum.java @@ -0,0 +1,33 @@ +package com.cool.store.enums; + +/** + * @author Fun Li + * @version 1.0 + * @date 2023/7/19 17:55 + */ +//稽核操作类型 +public enum InspectionOperationTypeEnum { + + PASS(0, "合格"), + NOT_PASS(1, "不合格"), + REVOCATION(2, "撤销"); + + private Integer code; + + private String type; + + InspectionOperationTypeEnum(Integer code, String type) { + this.code = code; + this.type = type; + } + + public Integer getCode() { + return code; + } + + public String getType() { + return type; + } + + +} diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionStatusEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionStatusEnum.java new file mode 100644 index 000000000..b86464259 --- /dev/null +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionStatusEnum.java @@ -0,0 +1,32 @@ +package com.cool.store.enums; + +/** + * @author Fun Li + * @version 1.0 + * @date 2023/7/19 17:22 + */ +//稽核信息状态 +public enum InspectionStatusEnum { + + NOT_INSPECT(0, "未稽核"), + PASS(1, "合格"), + NOT_PASS(2, "不合格"); + + private Integer code; + + private String type; + + InspectionStatusEnum(Integer code, String type) { + this.code = code; + this.type = type; + } + + public Integer getCode() { + return code; + } + + public String getType() { + return type; + } + +} diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionTyeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionTyeEnum.java new file mode 100644 index 000000000..712db6357 --- /dev/null +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/InspectionTyeEnum.java @@ -0,0 +1,29 @@ +package com.cool.store.enums; + +/** + * @author Fun Li + * @version 1.0 + * @date 2023/7/19 17:16 + */ +//稽核类型 +public enum InspectionTyeEnum { + + INTERVIEW_INSPECTION(0, "面试稽核"); + + private Integer code; + + private String type; + + InspectionTyeEnum(Integer code, String type) { + this.code = code; + this.type = type; + } + + public Integer getCode() { + return code; + } + + public String getType() { + return type; + } +} diff --git a/coolstore-partner-dao/src/main/resources/mapper/HyInspectionMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/HyInspectionMapper.xml index 2155a6589..c577270c4 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/HyInspectionMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/HyInspectionMapper.xml @@ -27,11 +27,11 @@ select from hy_inspection - where id = #{id,jdbcType=BIGINT} + where id = #{id} delete from hy_inspection - where id = #{id,jdbcType=BIGINT} + where id = #{id} insert into hy_inspection (id, interview_plan_id, operator_user_id, @@ -39,7 +39,7 @@ description, inspection_time, creator, updator, remark, deleted, create_time, update_time) - values (#{id,jdbcType=BIGINT}, #{interviewPlanId,jdbcType=BIGINT}, #{operatorUserId,jdbcType=VARCHAR}, + values (#{id}, #{interviewPlanId}, #{operatorUserId,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{status,jdbcType=TINYINT}, #{files,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{inspectionTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR}, #{updator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, @@ -93,10 +93,10 @@ - #{id,jdbcType=BIGINT}, + #{id}, - #{interviewPlanId,jdbcType=BIGINT}, + #{interviewPlanId}, #{operatorUserId,jdbcType=VARCHAR}, @@ -140,7 +140,7 @@ update hy_inspection - interview_plan_id = #{interviewPlanId,jdbcType=BIGINT}, + interview_plan_id = #{interviewPlanId}, operator_user_id = #{operatorUserId,jdbcType=VARCHAR}, @@ -179,11 +179,11 @@ update_time = #{updateTime,jdbcType=TIMESTAMP}, - where id = #{id,jdbcType=BIGINT} + where id = #{id} update hy_inspection - set interview_plan_id = #{interviewPlanId,jdbcType=BIGINT}, + set interview_plan_id = #{interviewPlanId}, operator_user_id = #{operatorUserId,jdbcType=VARCHAR}, type = #{type,jdbcType=TINYINT}, status = #{status,jdbcType=TINYINT}, @@ -196,6 +196,6 @@ deleted = #{deleted,jdbcType=BIT}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} + where id = #{id} \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionRevocationDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionRevocationDTO.java new file mode 100644 index 000000000..8e960b269 --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionRevocationDTO.java @@ -0,0 +1,25 @@ +package com.cool.store.dto.inspection.interview; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author Fun Li + * @version 1.0 + * @date 2023/7/19 17:47 + */ +@Data +public class InspectionRevocationDTO { + + @ApiModelProperty("稽核信息Id") + private Long inspectionId; + + @ApiModelProperty("操作说明") + private String description; + + @ApiModelProperty("多凭证文件链接集合") + private List files; + +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionSubmissionDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionSubmissionDTO.java new file mode 100644 index 000000000..398bd3741 --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/inspection/interview/InspectionSubmissionDTO.java @@ -0,0 +1,29 @@ +package com.cool.store.dto.inspection.interview; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author Fun Li + * @version 1.0 + * @date 2023/7/19 17:05 + */ +@Data +public class InspectionSubmissionDTO { + + @ApiModelProperty(value = "稽核信息表id", required = true) + private Long inspectionId; + + @ApiModelProperty(value = "是否合格,0为不合格,1为合格", required = true) + private Integer whetherPass; + + @ApiModelProperty("稽核说明,仅当不合格时为必传项") + private String description; + + @ApiModelProperty("稽核多凭证文件链接") + private List files; + +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInspection.java b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInspection.java index 0751ffc09..d463b5570 100644 --- a/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInspection.java +++ b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInspection.java @@ -9,15 +9,15 @@ public class HyInspection { private String operatorUserId; - private Byte type; + private Integer type; - private Byte status; + private Integer status; private String files; private String description; - private LocalDateTime inspectionTime; + private String inspectionTime; private String creator; @@ -29,9 +29,9 @@ public class HyInspection { private String createTime; - private LocalDateTime updateTime; + private String updateTime; - public HyInspection(Long id, Long interviewPlanId, String operatorUserId, Byte type, Byte status, String files, String description, LocalDateTime inspectionTime, String creator, String updator, String remark, Boolean deleted, String createTime, LocalDateTime updateTime) { + public HyInspection(Long id, Long interviewPlanId, String operatorUserId, Integer type, Integer status, String files, String description, String inspectionTime, String creator, String updator, String remark, Boolean deleted, String createTime, String updateTime) { this.id = id; this.interviewPlanId = interviewPlanId; this.operatorUserId = operatorUserId; @@ -76,19 +76,19 @@ public class HyInspection { this.operatorUserId = operatorUserId == null ? null : operatorUserId.trim(); } - public Byte getType() { + public Integer getType() { return type; } - public void setType(Byte type) { + public void setType(Integer type) { this.type = type; } - public Byte getStatus() { + public Integer getStatus() { return status; } - public void setStatus(Byte status) { + public void setStatus(Integer status) { this.status = status; } @@ -108,11 +108,11 @@ public class HyInspection { this.description = description == null ? null : description.trim(); } - public LocalDateTime getInspectionTime() { + public String getInspectionTime() { return inspectionTime; } - public void setInspectionTime(LocalDateTime inspectionTime) { + public void setInspectionTime(String inspectionTime) { this.inspectionTime = inspectionTime; } @@ -156,11 +156,11 @@ public class HyInspection { this.createTime = createTime == null ? null : createTime.trim(); } - public LocalDateTime getUpdateTime() { + public String getUpdateTime() { return updateTime; } - public void setUpdateTime(LocalDateTime updateTime) { + public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } } \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewInspectionLog.java b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewInspectionLog.java index bfe3f1921..9742533cc 100644 --- a/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewInspectionLog.java +++ b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyInterviewInspectionLog.java @@ -1,7 +1,5 @@ package com.cool.store.entity; -import java.time.LocalDateTime; - public class HyInterviewInspectionLog { private Long id; @@ -9,21 +7,21 @@ public class HyInterviewInspectionLog { private Long inspectionId; - private Byte operationType; + private Integer operationType; private String description; private String files; - private LocalDateTime operationTime; + private String operationTime; private String remark; private String createTime; - private LocalDateTime updateTime; + private String updateTime; - public HyInterviewInspectionLog(Long id, String operatorUserId, Long inspectionId, Byte operationType, String description, String files, LocalDateTime operationTime, String remark, String createTime, LocalDateTime updateTime) { + public HyInterviewInspectionLog(Long id, String operatorUserId, Long inspectionId, Integer operationType, String description, String files, String operationTime, String remark, String createTime, String updateTime) { this.id = id; this.operatorUserId = operatorUserId; this.inspectionId = inspectionId; @@ -64,11 +62,11 @@ public class HyInterviewInspectionLog { this.inspectionId = inspectionId; } - public Byte getOperationType() { + public Integer getOperationType() { return operationType; } - public void setOperationType(Byte operationType) { + public void setOperationType(Integer operationType) { this.operationType = operationType; } @@ -88,11 +86,11 @@ public class HyInterviewInspectionLog { this.files = files == null ? null : files.trim(); } - public LocalDateTime getOperationTime() { + public String getOperationTime() { return operationTime; } - public void setOperationTime(LocalDateTime operationTime) { + public void setOperationTime(String operationTime) { this.operationTime = operationTime; } @@ -112,11 +110,11 @@ public class HyInterviewInspectionLog { this.createTime = createTime == null ? null : createTime.trim(); } - public LocalDateTime getUpdateTime() { + public String getUpdateTime() { return updateTime; } - public void setUpdateTime(LocalDateTime updateTime) { + public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } } \ No newline at end of file diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/InterviewInspectionService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/InterviewInspectionService.java index 9f3ebe7a6..b32075bee 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/InterviewInspectionService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/InterviewInspectionService.java @@ -1,9 +1,24 @@ package com.cool.store.service; +import com.cool.store.dto.inspection.interview.InspectionRevocationDTO; +import com.cool.store.dto.inspection.interview.InspectionSubmissionDTO; +import com.cool.store.exception.ApiException; + /** * @author Fun Li * @version 1.0 * @date 2023/7/19 16:50 */ public interface InterviewInspectionService { + + /** + * 提交稽核结果 + */ + void submit(InspectionSubmissionDTO dto); + + /** + * 撤销稽核结果 + */ + void revoke(InspectionRevocationDTO dto) throws ApiException; + } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/InterviewInspectionServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/InterviewInspectionServiceImpl.java index c95807c77..bacc530f1 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/InterviewInspectionServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/InterviewInspectionServiceImpl.java @@ -1,11 +1,27 @@ package com.cool.store.service.impl; +import cn.hutool.core.date.DateUtil; +import com.cool.store.context.CurrentUserHolder; +import com.cool.store.dto.inspection.interview.InspectionRevocationDTO; +import com.cool.store.dto.inspection.interview.InspectionSubmissionDTO; +import com.cool.store.entity.HyInspection; import com.cool.store.entity.HyInterviewInspectionLog; +import com.cool.store.enums.ErrorCodeEnum; +import com.cool.store.enums.InspectionOperationTypeEnum; +import com.cool.store.enums.InspectionStatusEnum; +import com.cool.store.enums.InspectionTyeEnum; +import com.cool.store.exception.ApiException; import com.cool.store.mapper.HyInspectionMapper; +import com.cool.store.mapper.HyInterviewInspectionLogMapper; import com.cool.store.service.InterviewInspectionService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + /** * @author Fun Li * @version 1.0 @@ -18,6 +34,71 @@ public class InterviewInspectionServiceImpl implements InterviewInspectionServic private HyInspectionMapper inspectionMapper; @Autowired - private HyInterviewInspectionLog interviewInspectionLog; + private HyInterviewInspectionLogMapper interviewInspectionLogMapper; + + @Override + public void submit(InspectionSubmissionDTO dto) { + HyInspection hyInspection = new HyInspection(); + //稽核结果和说明及文件等 + hyInspection.setId(dto.getInspectionId()); + if (dto.getWhetherPass().equals(0)) { + hyInspection.setStatus(InspectionStatusEnum.NOT_PASS.getCode()); + } else if (dto.getWhetherPass().equals(1)) { + hyInspection.setStatus(InspectionStatusEnum.PASS.getCode()); + } + hyInspection.setDescription(dto.getDescription()); + String filesStr = spliceFiles(dto.getFiles()); + hyInspection.setFiles(filesStr); + //稽核人,稽核时间 + hyInspection.setOperatorUserId(CurrentUserHolder.getUserId()); + hyInspection.setUpdator(CurrentUserHolder.getUserId()); + hyInspection.setInspectionTime(DateUtil.now()); + inspectionMapper.updateByPrimaryKeySelective(hyInspection); + } + + @Override + public void revoke(InspectionRevocationDTO dto) throws ApiException { + //2.1 查询之前的一次操作 + HyInspection hyInspection = inspectionMapper.selectByPrimaryKey(dto.getInspectionId()); + if (Objects.isNull(hyInspection)) { + throw new ApiException(ErrorCodeEnum.INSPECTION_INFO_NOT_EXIST); + } + //1. 撤销操作记录写入数据库面试稽核操作记录表 + HyInterviewInspectionLog inspectionLog = new HyInterviewInspectionLog(); + inspectionLog.setOperatorUserId(CurrentUserHolder.getUserId()); + inspectionLog.setInspectionId(dto.getInspectionId()); + inspectionLog.setOperationType(InspectionOperationTypeEnum.REVOCATION.getCode()); + inspectionLog.setDescription(dto.getDescription()); + String filesStr = spliceFiles(dto.getFiles()); + inspectionLog.setOperationTime(DateUtil.now()); + inspectionLog.setFiles(filesStr); + interviewInspectionLogMapper.updateByPrimaryKeySelective(inspectionLog); + //2. 撤销操作之前的一次操作写入面试稽核操作记录表 + inspectionLog.setOperatorUserId(hyInspection.getOperatorUserId()); + inspectionLog.setInspectionId(hyInspection.getId()); + if (hyInspection.getStatus().equals(1)) { + inspectionLog.setOperationType(InspectionOperationTypeEnum.PASS.getCode()); + } else if (hyInspection.getStatus().equals(2)) { + inspectionLog.setOperationType(InspectionOperationTypeEnum.NOT_PASS.getCode()); + } + inspectionLog.setDescription(hyInspection.getDescription()); + inspectionLog.setFiles(hyInspection.getFiles()); + inspectionLog.setOperationTime(DateUtil.now()); + //3. 撤销操作之前的一次操作稽核信息状态修改为未稽核,并且将数据状态(其他字段)也恢复到未稽核时的状态 + hyInspection.setOperatorUserId(null); + hyInspection.setStatus(InspectionStatusEnum.NOT_INSPECT.getCode()); + hyInspection.setFiles(null); + hyInspection.setDescription(null); + hyInspection.setInspectionTime(null); + hyInspection.setUpdator(null); + inspectionMapper.updateByPrimaryKey(hyInspection); + } + + private String spliceFiles(List files) { + if (files == null || files.size() == 0) { + return null; + } + return files.stream().map(String::valueOf).collect(Collectors.joining(",")); + } } diff --git a/coolstore-partner-webb/src/main/java/com/cool/store/controller/InterviewInspectionController.java b/coolstore-partner-webb/src/main/java/com/cool/store/controller/InterviewInspectionController.java index 484ee3785..60dd772af 100644 --- a/coolstore-partner-webb/src/main/java/com/cool/store/controller/InterviewInspectionController.java +++ b/coolstore-partner-webb/src/main/java/com/cool/store/controller/InterviewInspectionController.java @@ -1,10 +1,14 @@ package com.cool.store.controller; +import com.cool.store.dto.inspection.interview.InspectionRevocationDTO; +import com.cool.store.dto.inspection.interview.InspectionSubmissionDTO; +import com.cool.store.exception.ApiException; import com.cool.store.response.ResponseResult; import com.cool.store.service.InterviewInspectionService; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,12 +26,14 @@ public class InterviewInspectionController { private InterviewInspectionService interviewInspectionService; @PostMapping("/submission") - public ResponseResult interviewInspectionSubmit() { + public ResponseResult interviewInspectionSubmit(@RequestBody InspectionSubmissionDTO dto) { + interviewInspectionService.submit(dto); return ResponseResult.success(); } @PostMapping("/revocation") - public ResponseResult interviewInspectionRevoke() { + public ResponseResult interviewInspectionRevoke(@RequestBody InspectionRevocationDTO dto) throws ApiException { + interviewInspectionService.revoke(dto); return ResponseResult.success(); }