面试稽核操作合格不合格及撤销

This commit is contained in:
feng.li
2023-07-19 18:37:03 +08:00
parent bc5d10ac26
commit 890dc4c479
12 changed files with 286 additions and 37 deletions

View File

@@ -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)
;

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -27,11 +27,11 @@
select
<include refid="Base_Column_List" />
from hy_inspection
where id = #{id,jdbcType=BIGINT}
where id = #{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from hy_inspection
where id = #{id,jdbcType=BIGINT}
where id = #{id}
</delete>
<insert id="insert" parameterType="com.cool.store.entity.HyInspection">
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 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
#{id},
</if>
<if test="interviewPlanId != null">
#{interviewPlanId,jdbcType=BIGINT},
#{interviewPlanId},
</if>
<if test="operatorUserId != null">
#{operatorUserId,jdbcType=VARCHAR},
@@ -140,7 +140,7 @@
update hy_inspection
<set>
<if test="interviewPlanId != null">
interview_plan_id = #{interviewPlanId,jdbcType=BIGINT},
interview_plan_id = #{interviewPlanId},
</if>
<if test="operatorUserId != null">
operator_user_id = #{operatorUserId,jdbcType=VARCHAR},
@@ -179,11 +179,11 @@
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
where id = #{id}
</update>
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyInspection">
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}
</update>
</mapper>

View File

@@ -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<String> files;
}

View File

@@ -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<String> files;
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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<String> files) {
if (files == null || files.size() == 0) {
return null;
}
return files.stream().map(String::valueOf).collect(Collectors.joining(","));
}
}

View File

@@ -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();
}