feat(examine): 实现考核评分功能
- 新增考核评分相关字段和方法 - 实现了根据考核详情计算分数的功能 - 更新了用户考核状态和分数- 优化了考核列表查询条件dev_1.1.0
parent
86015a72ff
commit
ccd5cf3deb
|
@ -1,24 +1,24 @@
|
||||||
package tech.unissense.pms.web.controller.business.examine.detail;
|
package tech.unissense.pms.web.controller.business.examine.detail;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||||
|
import tech.unissense.pms.business.examine.config.enums.ReviewTypeEnum;
|
||||||
import tech.unissense.pms.business.examine.config.service.ExamineConfigService;
|
import tech.unissense.pms.business.examine.config.service.ExamineConfigService;
|
||||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
||||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||||
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||||
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
|
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
|
||||||
import tech.unissense.pms.common.core.controller.BaseController;
|
import tech.unissense.pms.common.core.controller.BaseController;
|
||||||
import tech.unissense.pms.common.core.domain.AjaxResult;
|
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考核人员详情表(ExamineDetail)表控制层
|
* 考核人员详情表(ExamineDetail)表控制层
|
||||||
|
@ -65,15 +65,19 @@ public class ExamineDetailController extends BaseController {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public AjaxResult list(ExamineDetailRequestDto dto) {
|
public AjaxResult list(ExamineDetailRequestDto dto) {
|
||||||
Assert.notNull(dto.getExamineTaskId(), "考核任务ID不能为空");
|
Assert.notNull(dto.getExamineTaskId(), "考核任务ID不能为空");
|
||||||
Assert.notNull(dto.getExamineId(), "考核ID不能为空");
|
// Assert.notNull(dto.getExamineId(), "考核ID不能为空");
|
||||||
Assert.notEmpty(dto.getReviewType(), "任务类型不能为空");
|
Assert.notEmpty(dto.getReviewType(), "任务类型不能为空");
|
||||||
|
if (dto.getExamineId() == null) {
|
||||||
|
Assert.notNull(dto.getUserId(), "用户ID不能为空");
|
||||||
|
ExamineUser examineUser = examineUserService.queryByTaskIdAndUserId(dto.getExamineTaskId(), dto.getUserId());
|
||||||
|
dto.setExamineId(examineUser.getId());
|
||||||
|
}
|
||||||
|
Assert.notNull(dto.getExamineId(), "考核ID不能为空");
|
||||||
|
//查询配置
|
||||||
ExamineConfig examineConfig = new ExamineConfig();
|
ExamineConfig examineConfig = new ExamineConfig();
|
||||||
examineConfig.setExamineTaskId(dto.getExamineTaskId());
|
examineConfig.setExamineTaskId(dto.getExamineTaskId());
|
||||||
examineConfig.setReviewType(dto.getReviewType());
|
examineConfig.setReviewType(dto.getReviewType());
|
||||||
List<ExamineConfig> configList = configService.list(examineConfig);
|
List<ExamineConfig> configList = configService.list(examineConfig);
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success(examineDetailService.formatData(configList,dto));
|
return AjaxResult.success(examineDetailService.formatData(configList,dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,13 +91,22 @@ public class ExamineDetailController extends BaseController {
|
||||||
public AjaxResult addBatch(@RequestBody ExamineDto examineDto) {
|
public AjaxResult addBatch(@RequestBody ExamineDto examineDto) {
|
||||||
Assert.notEmpty(examineDto.getExamineDetailList(), "考核详情不能为空");
|
Assert.notEmpty(examineDto.getExamineDetailList(), "考核详情不能为空");
|
||||||
Assert.notNull(examineDto.getExamineId(), "考核ID不能为空");
|
Assert.notNull(examineDto.getExamineId(), "考核ID不能为空");
|
||||||
|
Assert.notNull(examineDto.getTaskId(), "考核任务ID不能为空");
|
||||||
|
Assert.notNull(examineDto.getManageScore(), "考核分数不能为空");
|
||||||
for (ExamineDetail examineDetail : examineDto.getExamineDetailList()) {
|
for (ExamineDetail examineDetail : examineDto.getExamineDetailList()) {
|
||||||
examineDetail.setExamineId(examineDto.getExamineId());
|
examineDetail.setExamineId(examineDto.getExamineId());
|
||||||
}
|
}
|
||||||
|
Map<Integer, BigDecimal> scoreMap = examineDetailService.calculateScoreByDetail(examineDto.getTaskId()
|
||||||
|
, examineDto.getExamineDetailList(), ReviewTypeEnum.MANAGE);
|
||||||
|
BigDecimal bigDecimal = scoreMap.get(examineDto.getExamineId());
|
||||||
|
if (examineDto.getManageScore().compareTo(bigDecimal) != 0) {
|
||||||
|
return AjaxResult.error("总分与明细分数不一致");
|
||||||
|
}
|
||||||
|
|
||||||
//保存detail详情
|
//保存detail详情
|
||||||
this.examineDetailService.insertBatch(examineDto.getExamineDetailList());
|
this.examineDetailService.insertBatch(examineDto.getExamineDetailList());
|
||||||
//保存总体评价
|
//保存总体评价
|
||||||
examineUserService.updateContent(examineDto);
|
examineUserService.access(examineDto);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package tech.unissense.pms.business.examine.config.domain;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考核配置表(ExamineConfig)实体类
|
* 考核配置表(ExamineConfig)实体类
|
||||||
|
@ -34,7 +35,7 @@ public class ExamineConfig implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 权重
|
* 权重
|
||||||
*/
|
*/
|
||||||
private Double weight;
|
private BigDecimal weight;
|
||||||
/**
|
/**
|
||||||
* 考核id
|
* 考核id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package tech.unissense.pms.business.examine.config.enums;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : ch
|
||||||
|
* @version : 1.0
|
||||||
|
* @ClassName : ReviewTypeEnum
|
||||||
|
* @Description :
|
||||||
|
* @DATE : Created in 17:36 2025/1/2
|
||||||
|
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||||
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
* Modification History:
|
||||||
|
* Date Author Version Discription
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 2025/1/2 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum ReviewTypeEnum {
|
||||||
|
|
||||||
|
MANAGE("0","管理"),
|
||||||
|
SELF("1","管理"),
|
||||||
|
SYSTEM("2","管理"),
|
||||||
|
ALL("-1","管理"),
|
||||||
|
;
|
||||||
|
private final String type;
|
||||||
|
private final String remark;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ReviewTypeEnum(String type, String remark) {
|
||||||
|
this.type = type;
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package tech.unissense.pms.business.examine.detail.domain;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考核人员详情表(ExamineDetail)实体类
|
* 考核人员详情表(ExamineDetail)实体类
|
||||||
|
@ -19,6 +20,7 @@ public class ExamineDetail implements Serializable {
|
||||||
* 考核id
|
* 考核id
|
||||||
*/
|
*/
|
||||||
private Integer examineId;
|
private Integer examineId;
|
||||||
|
private List<Integer> examineIdList;
|
||||||
/**
|
/**
|
||||||
* 考核分数(原始分数)
|
* 考核分数(原始分数)
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +35,8 @@ public class ExamineDetail implements Serializable {
|
||||||
private Integer configId;
|
private Integer configId;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
private Integer taskId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,5 +19,6 @@ import lombok.Data;
|
||||||
public class ExamineDetailRequestDto {
|
public class ExamineDetailRequestDto {
|
||||||
private Integer examineTaskId;
|
private Integer examineTaskId;
|
||||||
private Integer examineId;
|
private Integer examineId;
|
||||||
|
private Integer userId;
|
||||||
private String reviewType;
|
private String reviewType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package tech.unissense.pms.business.examine.detail.dto;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,4 +24,14 @@ public class ExamineDto {
|
||||||
private List<ExamineDetail> examineDetailList;
|
private List<ExamineDetail> examineDetailList;
|
||||||
private Integer examineId;
|
private Integer examineId;
|
||||||
private String judgeContent;
|
private String judgeContent;
|
||||||
|
private BigDecimal manageScore;
|
||||||
|
private Integer taskId;
|
||||||
|
/**
|
||||||
|
* 主管评分状态 0:待完成 1:已完成
|
||||||
|
*/
|
||||||
|
private String examineStatus;
|
||||||
|
/**
|
||||||
|
* 个人评分状态 0:待完成 1:已完成
|
||||||
|
*/
|
||||||
|
private String examineStatusSelf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
package tech.unissense.pms.business.examine.detail.service;
|
package tech.unissense.pms.business.examine.detail.service;
|
||||||
|
|
||||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||||
|
import tech.unissense.pms.business.examine.config.enums.ReviewTypeEnum;
|
||||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
||||||
import tech.unissense.pms.business.examine.detail.vo.ExamineDetailVo;
|
import tech.unissense.pms.business.examine.detail.vo.ExamineDetailVo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考核人员详情表(ExamineDetail)表服务接口
|
* 考核人员详情表(ExamineDetail)表服务接口
|
||||||
|
@ -53,4 +56,18 @@ public interface ExamineDetailService {
|
||||||
void insertBatch(List<ExamineDetail> list);
|
void insertBatch(List<ExamineDetail> list);
|
||||||
|
|
||||||
List<ExamineDetailVo> formatData(List<ExamineConfig> configList, ExamineDetailRequestDto dto);
|
List<ExamineDetailVo> formatData(List<ExamineConfig> configList, ExamineDetailRequestDto dto);
|
||||||
|
/**
|
||||||
|
* 计算分数
|
||||||
|
* @param taskId 任务id
|
||||||
|
* @param examineIdList 考核id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<Integer,BigDecimal> calculateScoreByExamineId(Integer taskId, List<Integer> examineIdList, ReviewTypeEnum typeEnum);
|
||||||
|
/**
|
||||||
|
* 计算分数
|
||||||
|
* @param taskId 任务id
|
||||||
|
* @param examineIdList 考核id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<Integer,BigDecimal> calculateScoreByDetail(Integer taskId,List<ExamineDetail> examineList,ReviewTypeEnum typeEnum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
package tech.unissense.pms.business.examine.detail.service.impl;
|
package tech.unissense.pms.business.examine.detail.service.impl;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||||
|
import tech.unissense.pms.business.examine.config.enums.ReviewTypeEnum;
|
||||||
|
import tech.unissense.pms.business.examine.config.mapper.ExamineConfigMapper;
|
||||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
||||||
import tech.unissense.pms.business.examine.detail.mapper.ExamineDetailMapper;
|
import tech.unissense.pms.business.examine.detail.mapper.ExamineDetailMapper;
|
||||||
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import tech.unissense.pms.business.examine.detail.vo.ExamineDetailVo;
|
import tech.unissense.pms.business.examine.detail.vo.ExamineDetailVo;
|
||||||
|
import tech.unissense.pms.common.exception.ServiceException;
|
||||||
import tech.unissense.pms.common.utils.bean.BeanUtils;
|
import tech.unissense.pms.common.utils.bean.BeanUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -21,9 +27,12 @@ import java.util.stream.Collectors;
|
||||||
* @since 2025-01-02 10:18:06
|
* @since 2025-01-02 10:18:06
|
||||||
*/
|
*/
|
||||||
@Service("examineDetailService")
|
@Service("examineDetailService")
|
||||||
|
@Slf4j
|
||||||
public class ExamineDetailServiceImpl implements ExamineDetailService {
|
public class ExamineDetailServiceImpl implements ExamineDetailService {
|
||||||
@Resource
|
@Resource
|
||||||
private ExamineDetailMapper examineDetailMapper;
|
private ExamineDetailMapper examineDetailMapper;
|
||||||
|
@Resource
|
||||||
|
private ExamineConfigMapper configMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
|
@ -99,4 +108,42 @@ public class ExamineDetailServiceImpl implements ExamineDetailService {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, BigDecimal> calculateScoreByExamineId(Integer taskId, List<Integer> examineIdList, ReviewTypeEnum typeEnum) {
|
||||||
|
ExamineDetail examineDetailQueryDto = new ExamineDetail();
|
||||||
|
examineDetailQueryDto.setExamineIdList(examineIdList);
|
||||||
|
List<ExamineDetail> list = examineDetailMapper.list(examineDetailQueryDto);
|
||||||
|
return this.calculateScoreByDetail(taskId, list, typeEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, BigDecimal> calculateScoreByDetail(Integer taskId, List<ExamineDetail> examineList, ReviewTypeEnum typeEnum) {
|
||||||
|
ExamineConfig examineConfigQueryDto = new ExamineConfig();
|
||||||
|
examineConfigQueryDto.setExamineTaskId(taskId);
|
||||||
|
if (!ReviewTypeEnum.ALL.getType().equals(typeEnum.getType())) {
|
||||||
|
examineConfigQueryDto.setReviewType(typeEnum.getType());
|
||||||
|
}
|
||||||
|
List<ExamineConfig> configList = configMapper.list(examineConfigQueryDto);
|
||||||
|
Map<Integer, ExamineConfig> configMap = configList.stream().collect(Collectors.toMap(ExamineConfig::getId, Function.identity()));
|
||||||
|
Map<Integer, BigDecimal> scoreMap = new HashMap<>();
|
||||||
|
for (ExamineDetail detail : examineList) {
|
||||||
|
ExamineConfig examineConfig = configMap.get(detail.getConfigId());
|
||||||
|
if (examineConfig == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BigDecimal score = BigDecimal.valueOf(detail.getScore()).multiply(BigDecimal.TEN);
|
||||||
|
BigDecimal weight = examineConfig.getWeight() == null ?
|
||||||
|
BigDecimal.ZERO : examineConfig.getWeight().divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
||||||
|
BigDecimal multiply = score.multiply(weight);
|
||||||
|
scoreMap.compute(detail.getExamineId(), (k, v) -> {
|
||||||
|
if (v == null) {
|
||||||
|
return multiply;
|
||||||
|
}
|
||||||
|
return v.add(multiply);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return scoreMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package tech.unissense.pms.business.examine.user.domain;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考核人员表(ExamineUser)实体类
|
* 考核人员表(ExamineUser)实体类
|
||||||
|
@ -26,7 +27,7 @@ public class ExamineUser implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 考核分数(权重后分数)
|
* 考核分数(权重后分数)
|
||||||
*/
|
*/
|
||||||
private Integer score;
|
private BigDecimal score;
|
||||||
/**
|
/**
|
||||||
* 总体评价
|
* 总体评价
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +35,7 @@ public class ExamineUser implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 主管评分(权重计算后)
|
* 主管评分(权重计算后)
|
||||||
*/
|
*/
|
||||||
private Integer manageScore;
|
private BigDecimal manageScore;
|
||||||
/**
|
/**
|
||||||
* 个人评分状态 0:待完成 1:已完成
|
* 个人评分状态 0:待完成 1:已完成
|
||||||
*/
|
*/
|
||||||
|
@ -44,6 +45,7 @@ public class ExamineUser implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String examineStatus;
|
private String examineStatus;
|
||||||
|
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,5 +73,7 @@ public interface ExamineUserMapper {
|
||||||
int deleteById(Integer id);
|
int deleteById(Integer id);
|
||||||
|
|
||||||
List<ExamineUser> list(ExamineUser examineUser);
|
List<ExamineUser> list(ExamineUser examineUser);
|
||||||
|
|
||||||
|
ExamineUser queryByTaskIdAndUserId(@Param("taskId") Integer examineTaskId,@Param("userId") Integer userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@ package tech.unissense.pms.business.examine.user.service;
|
||||||
|
|
||||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -50,5 +48,13 @@ public interface ExamineUserService {
|
||||||
|
|
||||||
List<ExamineUser> list(ExamineUser examineUser);
|
List<ExamineUser> list(ExamineUser examineUser);
|
||||||
|
|
||||||
void updateContent(ExamineDto examineDto);
|
void access(ExamineDto examineDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过任务id和用户id查询
|
||||||
|
* @param examineTaskId
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ExamineUser queryByTaskIdAndUserId(Integer examineTaskId, Integer userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
package tech.unissense.pms.business.examine.user.service.impl;
|
package tech.unissense.pms.business.examine.user.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import tech.unissense.pms.business.examine.config.enums.ReviewTypeEnum;
|
||||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||||
|
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
||||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||||
import tech.unissense.pms.business.examine.user.mapper.ExamineUserMapper;
|
import tech.unissense.pms.business.examine.user.mapper.ExamineUserMapper;
|
||||||
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
|
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考核人员表(ExamineUser)表服务实现类
|
* 考核人员表(ExamineUser)表服务实现类
|
||||||
|
@ -19,6 +28,8 @@ import java.util.List;
|
||||||
public class ExamineUserServiceImpl implements ExamineUserService {
|
public class ExamineUserServiceImpl implements ExamineUserService {
|
||||||
@Resource
|
@Resource
|
||||||
private ExamineUserMapper examineUserMapper;
|
private ExamineUserMapper examineUserMapper;
|
||||||
|
@Autowired
|
||||||
|
private ExamineDetailService detailService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
|
@ -74,10 +85,29 @@ public class ExamineUserServiceImpl implements ExamineUserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateContent(ExamineDto examineDto) {
|
public void access(ExamineDto examineDto) {
|
||||||
|
ExamineUser user = examineUserMapper.queryById(examineDto.getExamineId());
|
||||||
ExamineUser examineUser = new ExamineUser();
|
ExamineUser examineUser = new ExamineUser();
|
||||||
examineUser.setId(examineDto.getExamineId());
|
examineUser.setId(examineDto.getExamineId());
|
||||||
examineUser.setJudgeContent(examineDto.getJudgeContent());
|
examineUser.setJudgeContent(examineDto.getJudgeContent());
|
||||||
|
examineUser.setExamineStatus(examineDto.getExamineStatus());
|
||||||
|
examineUser.setExamineStatusSelf(examineDto.getExamineStatusSelf());
|
||||||
|
examineUser.setManageScore(examineDto.getManageScore());
|
||||||
|
String examineStatus = StrUtil.isNotEmpty(examineDto.getExamineStatus()) ? examineDto.getExamineStatus() : user.getExamineStatus();
|
||||||
|
String examineStatusSelf = StrUtil.isNotEmpty(examineDto.getExamineStatusSelf()) ? examineDto.getExamineStatusSelf() : user.getExamineStatusSelf();
|
||||||
|
//均已完成 计算总分数
|
||||||
|
boolean flag = "1".equals(examineStatus) && "1".equals(examineStatusSelf);
|
||||||
|
if (flag) {
|
||||||
|
Map<Integer, BigDecimal> scoreMap = detailService.calculateScoreByExamineId(examineDto.getTaskId()
|
||||||
|
, Collections.singletonList(examineDto.getExamineId()), ReviewTypeEnum.ALL);
|
||||||
|
examineUser.setScore(scoreMap.get(examineDto.getExamineId()));
|
||||||
|
}
|
||||||
examineUserMapper.update(examineUser);
|
examineUserMapper.update(examineUser);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExamineUser queryByTaskIdAndUserId(Integer examineTaskId, Integer userId) {
|
||||||
|
return examineUserMapper.queryByTaskIdAndUserId(examineTaskId, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,13 @@
|
||||||
<if test="configId != null">
|
<if test="configId != null">
|
||||||
and config_id = #{configId}
|
and config_id = #{configId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="examineIdList != null and examineIdList.size>0">
|
||||||
|
and examine_id in
|
||||||
|
<foreach collection="examineIdList" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
<result property="taskId" column="task_id" jdbcType="INTEGER"/>
|
<result property="taskId" column="task_id" jdbcType="INTEGER"/>
|
||||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||||
<result property="score" column="score" jdbcType="INTEGER"/>
|
<result property="score" column="score" jdbcType="NUMERIC"/>
|
||||||
<result property="judgeContent" column="judge_content" jdbcType="VARCHAR"/>
|
<result property="judgeContent" column="judge_content" jdbcType="VARCHAR"/>
|
||||||
<result property="manageScore" column="manage_score" jdbcType="INTEGER"/>
|
<result property="manageScore" column="manage_score" jdbcType="NUMERIC"/>
|
||||||
<result property="examineStatus" column="examine_status" jdbcType="VARCHAR"/>
|
<result property="examineStatus" column="examine_status" jdbcType="VARCHAR"/>
|
||||||
<result property="examineStatusSelf" column="examine_status_self" jdbcType="VARCHAR"/>
|
<result property="examineStatusSelf" column="examine_status_self" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
@ -79,14 +79,21 @@
|
||||||
<if test="manageScore != null">
|
<if test="manageScore != null">
|
||||||
and manage_score = #{manageScore}
|
and manage_score = #{manageScore}
|
||||||
</if>
|
</if>
|
||||||
<if test="examineStatus != null and examineStatus != ''">
|
<if test="examineStatus != null and examineStatus != ''">
|
||||||
and examine_status = #{examineStatus}
|
and examine_status = #{examineStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="examineStatusSelf != null and examineStatusSelf != ''">
|
<if test="examineStatusSelf != null and examineStatusSelf != ''">
|
||||||
and examine_status_self = #{examineStatusSelf}
|
and examine_status_self = #{examineStatusSelf}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="deptId != null and deptId != ''">
|
||||||
|
and user_id in (select id from sys_user where dept_id = #{deptId})
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryByTaskIdAndUserId" resultMap="ExamineUserMap">
|
||||||
|
<include refid="base_query"/>
|
||||||
|
where task_id = #{taskId} and user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--新增所有列-->
|
<!--新增所有列-->
|
||||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
@ -135,6 +142,12 @@
|
||||||
<if test="manageScore != null">
|
<if test="manageScore != null">
|
||||||
manage_score = #{manageScore},
|
manage_score = #{manageScore},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="examineStatus != null and examineStatus != ''">
|
||||||
|
and examine_status = #{examineStatus}
|
||||||
|
</if>
|
||||||
|
<if test="examineStatusSelf != null and examineStatusSelf != ''">
|
||||||
|
and examine_status_self = #{examineStatusSelf}
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
Loading…
Reference in New Issue