Compare commits
34 Commits
Author | SHA1 | Date |
---|---|---|
|
91658c71a7 | |
|
16ef200d39 | |
|
30c63b8c10 | |
|
db51747dc7 | |
|
a8692d640f | |
|
64ef5730bf | |
|
fe71d980b8 | |
|
7013bc82e6 | |
|
76b99571a4 | |
|
7702c20b66 | |
|
a02fdc81aa | |
|
37408313a3 | |
|
1154b11ab5 | |
|
4057e9abf7 | |
|
8c70789814 | |
|
0b0116ef6e | |
|
b527936b30 | |
|
e9e7fc15ad | |
|
b4764d6f8d | |
|
534dbf1a8d | |
|
134597b64d | |
|
fade049c9d | |
|
1c2fc2bcc0 | |
|
ab2844e5bd | |
|
fadadde6f1 | |
|
4075b24b8d | |
|
ccd5cf3deb | |
|
86015a72ff | |
|
4e74ff5200 | |
|
bd05550939 | |
|
e2884835f0 | |
|
d28f35e328 | |
|
f67aafa7ec | |
|
dc09c7f5e0 |
|
@ -0,0 +1,74 @@
|
|||
package tech.unissense.pms.web.controller.business.examine.config;
|
||||
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.config.service.ExamineConfigService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 考核配置表(ExamineConfig)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:17:37
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("examineConfig")
|
||||
public class ExamineConfigController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private ExamineConfigService examineConfigService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<ExamineConfig> queryById(@PathVariable("id") Integer id) {
|
||||
return ResponseEntity.ok(this.examineConfigService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineConfig 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<ExamineConfig> add(ExamineConfig examineConfig) {
|
||||
return ResponseEntity.ok(this.examineConfigService.insert(examineConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param examineConfig 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<ExamineConfig> edit(ExamineConfig examineConfig) {
|
||||
return ResponseEntity.ok(this.examineConfigService.update(examineConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Integer id) {
|
||||
return ResponseEntity.ok(this.examineConfigService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
package tech.unissense.pms.web.controller.business.examine.detail;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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.detail.domain.ExamineDetail;
|
||||
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.service.ExamineDetailService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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.common.core.controller.BaseController;
|
||||
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("examine/detail")
|
||||
public class ExamineDetailController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private ExamineDetailService examineDetailService;
|
||||
@Autowired
|
||||
private ExamineUserService examineUserService;
|
||||
|
||||
@Autowired
|
||||
private ExamineConfigService configService;
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<ExamineDetail> queryById(@PathVariable("id") Integer id) {
|
||||
return ResponseEntity.ok(this.examineDetailService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineDetail 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<ExamineDetail> add(ExamineDetail examineDetail) {
|
||||
return ResponseEntity.ok(this.examineDetailService.insert(examineDetail));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public AjaxResult list(ExamineDetailRequestDto dto) {
|
||||
Assert.notNull(dto.getExamineTaskId(), "考核任务ID不能为空");
|
||||
// Assert.notNull(dto.getExamineId(), "考核ID不能为空");
|
||||
Assert.notEmpty(dto.getReviewType(), "任务类型不能为空");
|
||||
if (dto.getExamineId() == null) {
|
||||
Assert.notNull(dto.getUserId(), "用户ID不能为空");
|
||||
ExamineUser examineUser = examineUserService.queryByTaskIdAndUserId(dto.getExamineTaskId(), dto.getUserId());
|
||||
Assert.notNull(examineUser, "考核人员不存在");
|
||||
dto.setExamineId(examineUser.getId());
|
||||
}
|
||||
Assert.notNull(dto.getExamineId(), "考核ID不能为空");
|
||||
//查询配置
|
||||
ExamineConfig examineConfig = new ExamineConfig();
|
||||
examineConfig.setExamineTaskId(dto.getExamineTaskId());
|
||||
examineConfig.setReviewType(dto.getReviewType());
|
||||
List<ExamineConfig> configList = configService.list(examineConfig);
|
||||
return AjaxResult.success(examineDetailService.formatData(configList,dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineDetail 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("/batch")
|
||||
public AjaxResult addBatch(@RequestBody ExamineDto examineDto) {
|
||||
Assert.notEmpty(examineDto.getExamineDetailList(), "考核详情不能为空");
|
||||
Assert.notNull(examineDto.getExamineId(), "考核ID不能为空");
|
||||
Assert.notNull(examineDto.getTaskId(), "考核任务ID不能为空");
|
||||
for (ExamineDetail examineDetail : examineDto.getExamineDetailList()) {
|
||||
examineDetail.setExamineId(examineDto.getExamineId());
|
||||
}
|
||||
if (ReviewTypeEnum.MANAGE.getType().equals(examineDto.getReviewType())) {
|
||||
Assert.notNull(examineDto.getManageScore(), "考核分数不能为空");
|
||||
//主管才需要计算分数
|
||||
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("总分与明细分数不一致");
|
||||
}
|
||||
} else {
|
||||
//非主管需要计算个人分数
|
||||
Map<Integer, BigDecimal> scoreMap = examineDetailService.calculateScoreByDetail(examineDto.getTaskId()
|
||||
, examineDto.getExamineDetailList(), ReviewTypeEnum.SELF);
|
||||
BigDecimal bigDecimal = scoreMap.get(examineDto.getExamineId());
|
||||
examineDto.setSelfScore(bigDecimal);
|
||||
}
|
||||
|
||||
//保存detail详情
|
||||
this.examineDetailService.saveBatch(examineDto.getExamineDetailList());
|
||||
//保存总体评价
|
||||
examineUserService.access(examineDto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param examineDetail 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<ExamineDetail> edit(ExamineDetail examineDetail) {
|
||||
return ResponseEntity.ok(this.examineDetailService.update(examineDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Integer id) {
|
||||
return ResponseEntity.ok(this.examineDetailService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package tech.unissense.pms.web.controller.business.examine.task;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||
import tech.unissense.pms.business.examine.task.dto.ConfigUpdateDto;
|
||||
import tech.unissense.pms.business.examine.task.service.TaskService;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.common.core.controller.BaseController;
|
||||
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||
import tech.unissense.pms.common.core.page.TableDataInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static tech.unissense.pms.common.utils.PageUtils.startPage;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/task")
|
||||
public class TaskSetUpController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
// 新增任务
|
||||
@PostMapping("/add")
|
||||
public AjaxResult addTask(@RequestBody ExamineTask task) {
|
||||
return AjaxResult.success(taskService.addTask(task));
|
||||
}
|
||||
|
||||
// 分页查询+模糊查询
|
||||
@GetMapping("/get")
|
||||
public TableDataInfo getTasks(TaskQueryDto queryDto) {
|
||||
startPage();
|
||||
List<ExamineTask> tasks = taskService.getTasks(queryDto);
|
||||
return getDataTable(tasks);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult listTask(TaskQueryDto queryDto) {
|
||||
return success(taskService.listTask(queryDto));
|
||||
}
|
||||
|
||||
@GetMapping("/listSelf")
|
||||
public AjaxResult listTaskSelf(TaskQueryDto queryDto) {
|
||||
if (queryDto.getUserId() == null) {
|
||||
queryDto.setUserId(getUserId().intValue());
|
||||
}
|
||||
return success(taskService.listTaskSelf(queryDto));
|
||||
}
|
||||
|
||||
// 编辑任务
|
||||
@PutMapping("/update")
|
||||
public AjaxResult updateTask( @RequestBody ExamineTask updatedTask) {
|
||||
Integer id = updatedTask.getId();
|
||||
if (id == null) {
|
||||
return AjaxResult.error("任务 ID 不能为空");
|
||||
}
|
||||
return AjaxResult.success(taskService.updateTask(updatedTask));
|
||||
}
|
||||
|
||||
// 编辑任务
|
||||
@PutMapping("/config/update")
|
||||
public AjaxResult updateConfigTask(@RequestBody ConfigUpdateDto dto) {
|
||||
return AjaxResult.success(taskService.updateConfigTask(dto));
|
||||
}
|
||||
|
||||
// 删除任务
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteTask(@PathVariable Integer id) {
|
||||
taskService.deleteTask(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
//获取指标配置
|
||||
@GetMapping("/target/{id}")
|
||||
public AjaxResult getTarget(@PathVariable Integer id){
|
||||
return AjaxResult.success(taskService.getTarget(id));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package tech.unissense.pms.web.controller.business.examine.user;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.unissense.pms.common.core.controller.BaseController;
|
||||
import tech.unissense.pms.common.core.page.TableDataInfo;
|
||||
import tech.unissense.pms.common.exception.ServiceException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 考核人员表(ExamineUser)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("examine/user")
|
||||
public class ExamineUserController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private ExamineUserService examineUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseEntity<ExamineUser> queryById(@PathVariable("id") Integer id) {
|
||||
return ResponseEntity.ok(this.examineUserService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param examineUser
|
||||
* @return tech.unissense.pms.common.core.page.TableDataInfo
|
||||
* @author ch
|
||||
* @date 2025/01/02 10:36
|
||||
*/
|
||||
@GetMapping
|
||||
@PreAuthorize("@ss.hasPermi('examine:manager:list')")
|
||||
public TableDataInfo queryPage(ExamineUser examineUser) {
|
||||
if (StrUtil.isNotEmpty(examineUser.getIsAsc())) {
|
||||
//判断参数是否合法
|
||||
if (!"ASC".equalsIgnoreCase(examineUser.getIsAsc()) && !"DESC".equalsIgnoreCase(examineUser.getIsAsc())) {
|
||||
throw new ServiceException("参数不合法");
|
||||
}
|
||||
}
|
||||
startPage();
|
||||
return getDataTable(examineUserService.list(examineUser));
|
||||
}
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineUser 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<ExamineUser> add(ExamineUser examineUser) {
|
||||
return ResponseEntity.ok(this.examineUserService.insert(examineUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param examineUser 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseEntity<ExamineUser> edit(ExamineUser examineUser) {
|
||||
return ResponseEntity.ok(this.examineUserService.update(examineUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Boolean> deleteById(Integer id) {
|
||||
return ResponseEntity.ok(this.examineUserService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -137,8 +137,8 @@ public class ProjectController extends BaseController {
|
|||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@PostMapping("/executionInfo")
|
||||
public AjaxResult executionInfo(@RequestBody WorkLogger workLogger) {
|
||||
return success(service.executionInfo(workLogger));
|
||||
public AjaxResult executionInfo(@RequestBody ProjectQueryDto queryDto) {
|
||||
return success(service.executionInfo(queryDto));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,7 +63,7 @@ spring:
|
|||
multi-statement-allow: true
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.124.103
|
||||
host: 192.168.124.202
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
|
|
|
@ -71,7 +71,7 @@ spring:
|
|||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.124.103
|
||||
host: 192.168.124.202
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.unissense</groupId>
|
||||
<artifactId>pms-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package tech.unissense.pms.business.examine.config.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 考核配置表(ExamineConfig)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:17:38
|
||||
*/
|
||||
@Data
|
||||
public class ExamineConfig implements Serializable {
|
||||
private static final long serialVersionUID = 580184465217250056L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 评审类型 0:组长评审 1:个人评估 2:系统核算
|
||||
*/
|
||||
private String reviewType;
|
||||
/**
|
||||
* 评审类别
|
||||
*/
|
||||
private String reviewCategory;
|
||||
/**
|
||||
* 评审项
|
||||
*/
|
||||
private String reviewItem;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 考核id
|
||||
*/
|
||||
private Integer examineTaskId;
|
||||
private Integer sortNum;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package tech.unissense.pms.business.examine.config.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核配置表(ExamineConfig)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:17:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExamineConfigMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineConfig queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param examineConfig 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<ExamineConfig> queryAllByLimit(ExamineConfig examineConfig, @Param("pageable") Pageable pageable);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param examineConfig 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(ExamineConfig examineConfig);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineConfig 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(ExamineConfig examineConfig);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ExamineConfig> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<ExamineConfig> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ExamineConfig> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<ExamineConfig> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineConfig 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(ExamineConfig examineConfig);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
List<ExamineConfig> list(ExamineConfig examineConfig);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package tech.unissense.pms.business.examine.config.service;
|
||||
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核配置表(ExamineConfig)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:17:39
|
||||
*/
|
||||
public interface ExamineConfigService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineConfig queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineConfig insert(ExamineConfig examineConfig);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineConfig update(ExamineConfig examineConfig);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
List<ExamineConfig> list(ExamineConfig examineConfig);
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package tech.unissense.pms.business.examine.config.service.impl;
|
||||
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.config.mapper.ExamineConfigMapper;
|
||||
import tech.unissense.pms.business.examine.config.service.ExamineConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核配置表(ExamineConfig)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:17:39
|
||||
*/
|
||||
@Service("examineConfigService")
|
||||
public class ExamineConfigServiceImpl implements ExamineConfigService {
|
||||
@Resource
|
||||
private ExamineConfigMapper examineConfigMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineConfig queryById(Integer id) {
|
||||
return this.examineConfigMapper.queryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineConfig insert(ExamineConfig examineConfig) {
|
||||
this.examineConfigMapper.insert(examineConfig);
|
||||
return examineConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineConfig 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineConfig update(ExamineConfig examineConfig) {
|
||||
this.examineConfigMapper.update(examineConfig);
|
||||
return this.queryById(examineConfig.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.examineConfigMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineConfig> list(ExamineConfig examineConfig) {
|
||||
return examineConfigMapper.list(examineConfig);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package tech.unissense.pms.business.examine.detail.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:05
|
||||
*/
|
||||
@Data
|
||||
public class ExamineDetail implements Serializable {
|
||||
private static final long serialVersionUID = -30214803434515215L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 考核id
|
||||
*/
|
||||
private Integer examineId;
|
||||
private List<Integer> examineIdList;
|
||||
/**
|
||||
* 考核分数(原始分数)
|
||||
*/
|
||||
private Integer score;
|
||||
/**
|
||||
* 评价备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 考核标准id
|
||||
*/
|
||||
private Integer configId;
|
||||
|
||||
|
||||
private Integer userId;
|
||||
private Integer taskId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package tech.unissense.pms.business.examine.detail.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ExamineDetailRequestDto
|
||||
* @Description :
|
||||
* @DATE : Created in 14:46 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: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class ExamineDetailRequestDto {
|
||||
private Integer examineTaskId;
|
||||
private Integer examineId;
|
||||
private Integer userId;
|
||||
private String reviewType;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package tech.unissense.pms.business.examine.detail.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ExamineDto
|
||||
* @Description :
|
||||
* @DATE : Created in 14:21 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: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class ExamineDto {
|
||||
private List<ExamineDetail> examineDetailList;
|
||||
private Integer examineId;
|
||||
private String judgeContent;
|
||||
private BigDecimal manageScore;
|
||||
private BigDecimal selfScore;
|
||||
private Integer taskId;
|
||||
private String reviewType;
|
||||
/**
|
||||
* 主管评分状态 0:待完成 1:已完成
|
||||
*/
|
||||
private String examineStatus;
|
||||
/**
|
||||
* 个人评分状态 0:待完成 1:已完成
|
||||
*/
|
||||
private String examineStatusSelf;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package tech.unissense.pms.business.examine.detail.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:05
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExamineDetailMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineDetail queryById(Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param examineDetail 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(ExamineDetail examineDetail);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineDetail 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(ExamineDetail examineDetail);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ExamineDetail> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<ExamineDetail> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ExamineDetail> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<ExamineDetail> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineDetail 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(ExamineDetail examineDetail);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
List<ExamineDetail> list(ExamineDetail examineDetail);
|
||||
|
||||
void deleteByExamineId(List<Integer> collect);
|
||||
|
||||
List<ExamineDetail> listByExamineId(List<Integer> idList);
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package tech.unissense.pms.business.examine.detail.service;
|
||||
|
||||
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.dto.ExamineDetailRequestDto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:05
|
||||
*/
|
||||
public interface ExamineDetailService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineDetail queryById(Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineDetail insert(ExamineDetail examineDetail);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineDetail update(ExamineDetail examineDetail);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
void insertBatch(List<ExamineDetail> list);
|
||||
|
||||
Map<String,Object> 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);
|
||||
|
||||
void saveBatch(List<ExamineDetail> examineDetailList);
|
||||
|
||||
|
||||
void deleteByExamineId( List<Integer> collect);
|
||||
|
||||
List<ExamineDetail> listByExamineId(List<Integer> taskId);
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package tech.unissense.pms.business.examine.detail.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.dto.ExamineDetailRequestDto;
|
||||
import tech.unissense.pms.business.examine.detail.mapper.ExamineDetailMapper;
|
||||
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.business.examine.detail.vo.ExamineConfigDetailVo;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import tech.unissense.pms.business.examine.task.mapper.ExamineTaskMapper;
|
||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||
import tech.unissense.pms.business.examine.user.mapper.ExamineUserMapper;
|
||||
import tech.unissense.pms.business.work.logger.service.IWorkLoggerService;
|
||||
import tech.unissense.pms.common.exception.ServiceException;
|
||||
import tech.unissense.pms.common.utils.bean.BeanUtils;
|
||||
import tech.unissense.pms.system.service.ISysDictDataService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:06
|
||||
*/
|
||||
@Service("examineDetailService")
|
||||
@Slf4j
|
||||
public class ExamineDetailServiceImpl implements ExamineDetailService {
|
||||
@Resource
|
||||
private ExamineDetailMapper examineDetailMapper;
|
||||
@Resource
|
||||
private ExamineConfigMapper configMapper;
|
||||
@Resource
|
||||
private ExamineUserMapper userMapper;
|
||||
@Autowired
|
||||
private IWorkLoggerService workLoggerService;
|
||||
@Autowired
|
||||
private ISysDictDataService sysDictDataService;
|
||||
@Autowired
|
||||
private ExamineTaskMapper examineTaskMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineDetail queryById(Integer id) {
|
||||
return this.examineDetailMapper.queryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineDetail insert(ExamineDetail examineDetail) {
|
||||
this.examineDetailMapper.insert(examineDetail);
|
||||
return examineDetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineDetail 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineDetail update(ExamineDetail examineDetail) {
|
||||
this.examineDetailMapper.update(examineDetail);
|
||||
return this.queryById(examineDetail.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.examineDetailMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertBatch(List<ExamineDetail> list) {
|
||||
examineDetailMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> formatData(List<ExamineConfig> configList, ExamineDetailRequestDto dto) {
|
||||
List<ExamineConfigDetailVo> examineConfigDetailVoList = new ArrayList<>();
|
||||
ExamineDetail examineDetail = new ExamineDetail();
|
||||
examineDetail.setExamineId(dto.getExamineId());
|
||||
List<ExamineDetail> list = examineDetailMapper.list(examineDetail);
|
||||
Map<Integer, ExamineDetail> scoreMap = list.stream().collect(Collectors.toMap(ExamineDetail::getConfigId
|
||||
, Function.identity(), (v1, v2) -> v1));
|
||||
for (ExamineConfig examineConfig : configList) {
|
||||
ExamineConfigDetailVo examineConfigDetailVo = new ExamineConfigDetailVo();
|
||||
BeanUtils.copyProperties(examineConfig, examineConfigDetailVo);
|
||||
ExamineDetail detail = scoreMap.get(examineConfig.getId());
|
||||
examineConfigDetailVo.setExamineId(dto.getExamineId());
|
||||
examineConfigDetailVo.setScore(detail == null ? 0 : detail.getScore());
|
||||
examineConfigDetailVo.setRemark(detail == null ? "" : detail.getRemark());
|
||||
examineConfigDetailVoList.add(examineConfigDetailVo);
|
||||
}
|
||||
examineConfigDetailVoList.sort(Comparator.comparing(ExamineConfigDetailVo::getSortNum));
|
||||
|
||||
|
||||
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
result.put("examineConfigDetailVoList",examineConfigDetailVoList);
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setId(dto.getExamineId());
|
||||
List<ExamineUser> list1 = userMapper.list(examineUser);
|
||||
if (CollUtil.isEmpty(list1)){
|
||||
throw new ServiceException("未在考核任务中");
|
||||
}
|
||||
result.put("examineUser",list1.get(0));
|
||||
result.put("examineTask",examineTaskMapper.queryById(dto.getExamineTaskId()));
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void saveBatch(List<ExamineDetail> examineDetailList) {
|
||||
examineDetailMapper.insertOrUpdateBatch(examineDetailList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByExamineId(List<Integer> collect) {
|
||||
examineDetailMapper.deleteByExamineId(collect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineDetail> listByExamineId(List<Integer> idList) {
|
||||
return examineDetailMapper.listByExamineId(idList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package tech.unissense.pms.business.examine.detail.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ExamineConfigDetailVo
|
||||
* @Description :
|
||||
* @DATE : Created in 14:59 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: <修改原因描述> *
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ExamineConfigDetailVo extends ExamineConfig {
|
||||
|
||||
private Integer score;
|
||||
private Integer examineId;
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package tech.unissense.pms.business.examine.task.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核任务表 (ExamineTask)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:29
|
||||
*/
|
||||
@Data
|
||||
public class ExamineTask implements Serializable {
|
||||
private static final long serialVersionUID = -72205614757391876L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 考核任务名
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
private Integer peopleNumber;
|
||||
|
||||
private String peopleNumberDetail;
|
||||
/**
|
||||
* 考核任务状态 0:进行中 2:已过期
|
||||
*/
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 截止时间
|
||||
*/
|
||||
private Date endTime;
|
||||
private Boolean taskEditFlag;
|
||||
|
||||
|
||||
private List<Integer> userIdList;
|
||||
|
||||
private Integer year;
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package tech.unissense.pms.business.examine.task.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核任务表 (ExamineTask)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:29
|
||||
*/
|
||||
@Data
|
||||
public class ExamineTaskDto implements Serializable {
|
||||
private static final long serialVersionUID = -72205614757391876L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 考核任务名
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
private Integer peopleNumber;
|
||||
|
||||
private String peopleNumberDetail;
|
||||
/**
|
||||
* 考核任务状态 0:进行中 2:已过期
|
||||
*/
|
||||
private Integer taskStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 截止时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
|
||||
private List<Integer> userIdList;
|
||||
|
||||
private Integer year;
|
||||
private Integer examineStatusSelf;
|
||||
private Integer examineId;
|
||||
private Boolean taskEditFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package tech.unissense.pms.business.examine.task.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.common.core.domain.BaseEntity;
|
||||
|
||||
@Data
|
||||
public class TaskQueryDto extends BaseEntity {
|
||||
private String taskName;
|
||||
|
||||
private Integer taskStatus;
|
||||
|
||||
private Integer year;
|
||||
private Integer userId;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package tech.unissense.pms.business.examine.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ConfigUpdateDto
|
||||
* @Description :
|
||||
* @DATE : Created in 14:27 2025/1/8
|
||||
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2025/1/8 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class ConfigUpdateDto {
|
||||
private List<ExamineConfig> examineConfigList;
|
||||
private Integer taskId;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package tech.unissense.pms.business.examine.task.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTaskDto;
|
||||
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核任务表 (ExamineTask)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:28
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExamineTaskMapper {
|
||||
|
||||
void addTask(ExamineTask task);
|
||||
|
||||
List<ExamineTask> getTasks(TaskQueryDto queryDto);
|
||||
|
||||
void updateTask(ExamineTask updatedTask);
|
||||
|
||||
void deleteTask(Integer id);
|
||||
|
||||
List<ExamineTask> listTask(TaskQueryDto queryDto);
|
||||
|
||||
ExamineTask queryById(Integer taskId);
|
||||
|
||||
void updateTaskEditFlag(@Param("flag") boolean b, @Param("id") Integer taskId);
|
||||
|
||||
List<ExamineTaskDto> listTaskSelf(TaskQueryDto queryDto);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package tech.unissense.pms.business.examine.task.service;
|
||||
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTaskDto;
|
||||
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||
import tech.unissense.pms.business.examine.task.dto.ConfigUpdateDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface TaskService {
|
||||
ExamineTask addTask(ExamineTask task);
|
||||
|
||||
List<ExamineTask> getTasks(TaskQueryDto queryDto);
|
||||
|
||||
ExamineTask updateTask(ExamineTask updatedTask);
|
||||
|
||||
void deleteTask(Integer id);
|
||||
|
||||
List<ExamineConfig> getTarget(Integer id);
|
||||
|
||||
Map<Integer,List<ExamineTask>> listTask(TaskQueryDto queryDto);
|
||||
Map<Integer,List<ExamineTaskDto>> listTaskSelf(TaskQueryDto queryDto);
|
||||
|
||||
List<ExamineConfig> updateConfigTask(ConfigUpdateDto dto);
|
||||
}
|
|
@ -0,0 +1,239 @@
|
|||
package tech.unissense.pms.business.examine.task.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.service.ExamineDetailService;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTaskDto;
|
||||
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||
import tech.unissense.pms.business.examine.task.dto.ConfigUpdateDto;
|
||||
import tech.unissense.pms.business.examine.task.mapper.ExamineTaskMapper;
|
||||
import tech.unissense.pms.business.examine.task.service.TaskService;
|
||||
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.service.impl.ExamineUserServiceImpl;
|
||||
import tech.unissense.pms.common.annotation.DataScope;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TaskServiceImpl implements TaskService {
|
||||
|
||||
@Autowired
|
||||
private ExamineTaskMapper examineTaskDao;
|
||||
|
||||
@Autowired
|
||||
private ExamineConfigMapper examineConfigMapper;
|
||||
|
||||
@Resource
|
||||
private ExamineUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private ExamineUserServiceImpl examineUserService;
|
||||
@Autowired
|
||||
private ExamineDetailService detailService;
|
||||
|
||||
@Override
|
||||
public ExamineTask addTask(ExamineTask task) {
|
||||
task.setCreateTime(new Date());
|
||||
examineTaskDao.addTask(task);
|
||||
|
||||
ExamineConfig examineConfig = new ExamineConfig();
|
||||
examineConfig.setExamineTaskId(-1);
|
||||
List<ExamineConfig> list = examineConfigMapper.list(examineConfig);
|
||||
list.forEach(item -> {
|
||||
item.setExamineTaskId(task.getId());
|
||||
});
|
||||
examineConfigMapper.insertBatch(list);
|
||||
//生成考核人员信息
|
||||
List<Integer> userIdList = task.getUserIdList();
|
||||
Assert.notEmpty(userIdList, "考核人员不能为空");
|
||||
List<ExamineUser> userList = new ArrayList<>();
|
||||
for (Integer userId : userIdList) {
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setTaskId(task.getId());
|
||||
examineUser.setUserId(userId);
|
||||
userList.add(examineUser);
|
||||
}
|
||||
userMapper.insertBatch(userList);
|
||||
return task;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineTask> getTasks(TaskQueryDto queryDto) {
|
||||
List<ExamineTask> tasks = examineTaskDao.getTasks(queryDto);
|
||||
|
||||
Date currentTime = new Date();
|
||||
|
||||
tasks.forEach(item -> {
|
||||
if (item.getEndTime() != null && item.getEndTime().before(currentTime)) {
|
||||
item.setTaskStatus(2);
|
||||
} else {
|
||||
item.setTaskStatus(0);
|
||||
}
|
||||
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setTaskId(item.getId());
|
||||
List<ExamineUser> existingUsers = userMapper.list(examineUser);
|
||||
List<Integer> existingUserIds = existingUsers.stream()
|
||||
.map(ExamineUser::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
item.setUserIdList(existingUserIds);
|
||||
});
|
||||
return tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamineTask updateTask(ExamineTask updatedTask) {
|
||||
examineTaskDao.updateTask(updatedTask);
|
||||
|
||||
List<Integer> userIdList = updatedTask.getUserIdList();
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setTaskId(updatedTask.getId());
|
||||
List<ExamineUser> existingUsers = userMapper.list(examineUser);
|
||||
List<Integer> existingUserIds = existingUsers.stream()
|
||||
.map(ExamineUser::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 1. 删除与任务相关的已经不在 userIdList 中的用户记录
|
||||
existingUsers.stream()
|
||||
.filter(user -> !userIdList.contains(user.getUserId()))
|
||||
.forEach(user -> userMapper.deleteById(user.getId()));
|
||||
|
||||
// 2. 添加新的用户记录(只插入那些不在现有用户中的用户)
|
||||
userIdList.stream()
|
||||
.filter(userId -> !existingUserIds.contains(userId))
|
||||
.forEach(userId -> {
|
||||
ExamineUser newExamineUser = new ExamineUser();
|
||||
newExamineUser.setTaskId(updatedTask.getId());
|
||||
newExamineUser.setUserId(userId);
|
||||
userMapper.insert(newExamineUser);
|
||||
});
|
||||
|
||||
return updatedTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTask(Integer id) {
|
||||
examineTaskDao.deleteTask(id);
|
||||
examineUserService.deleteUserByTaskId(id);
|
||||
ExamineConfig examineConfig = new ExamineConfig();
|
||||
examineConfig.setExamineTaskId(id);
|
||||
List<ExamineConfig> list = examineConfigMapper.list(examineConfig);
|
||||
for (ExamineConfig config : list) {
|
||||
examineConfigMapper.deleteById(config.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineConfig> getTarget(Integer id) {
|
||||
ExamineConfig examineConfig = new ExamineConfig();
|
||||
examineConfig.setExamineTaskId(id);
|
||||
return examineConfigMapper.list(examineConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "t3", userAlias = "t2")
|
||||
public Map<Integer, List<ExamineTask>> listTask(TaskQueryDto queryDto) {
|
||||
List<ExamineTask> examineTasks = examineTaskDao.listTask(queryDto);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (ExamineTask examineTask : examineTasks) {
|
||||
// 获取endTime那一天的最大时间
|
||||
LocalDateTime endTime = examineTask.getEndTime().toInstant().atZone(ZoneId.systemDefault())
|
||||
.toLocalDate().atTime(LocalTime.MAX);
|
||||
|
||||
// 比较当前时间与localDateTime
|
||||
if (now.isAfter(endTime)) {
|
||||
// 当前时间大于localDateTime,已过期
|
||||
examineTask.setTaskStatus(2);
|
||||
} else {
|
||||
// 当前时间小于localDateTime,进行中
|
||||
examineTask.setTaskStatus(0);
|
||||
}
|
||||
}
|
||||
return examineTasks.stream().collect(Collectors.groupingBy(ExamineTask::getTaskStatus));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, List<ExamineTaskDto>> listTaskSelf(TaskQueryDto queryDto) {
|
||||
List<ExamineTaskDto> examineTasks = examineTaskDao.listTaskSelf(queryDto);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (ExamineTaskDto examineTask : examineTasks) {
|
||||
// 获取endTime那一天的最大时间
|
||||
LocalDateTime endTime = examineTask.getEndTime().toInstant().atZone(ZoneId.systemDefault())
|
||||
.toLocalDate().atTime(LocalTime.MAX);
|
||||
|
||||
// 比较当前时间与localDateTime
|
||||
if (now.isAfter(endTime)) {
|
||||
// 当前时间大于localDateTime,已过期
|
||||
examineTask.setTaskStatus(2);
|
||||
} else {
|
||||
// 当前时间小于localDateTime,进行中
|
||||
examineTask.setTaskStatus(0);
|
||||
}
|
||||
}
|
||||
return examineTasks.stream().collect(Collectors.groupingBy(ExamineTaskDto::getTaskStatus));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineConfig> updateConfigTask(ConfigUpdateDto dto) {
|
||||
for (ExamineConfig examineConfig : dto.getExamineConfigList()) {
|
||||
if (examineConfig.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
examineConfigMapper.update(examineConfig);
|
||||
}
|
||||
//重新计算分数 修改task
|
||||
examineTaskDao.updateTaskEditFlag(false, dto.getTaskId());
|
||||
CompletableFuture.runAsync(() -> {
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setTaskId(dto.getTaskId());
|
||||
List<ExamineUser> list = userMapper.list(examineUser);
|
||||
List<ExamineUser> completeList = new ArrayList<>();
|
||||
List<Integer> idList = new ArrayList<>();
|
||||
for (ExamineUser user : list) {
|
||||
if (!"1".equals(user.getExamineStatus())) {
|
||||
continue;
|
||||
}
|
||||
idList.add(user.getId());
|
||||
completeList.add(user);
|
||||
}
|
||||
List<ExamineDetail> examineDetails = detailService.listByExamineId(idList);
|
||||
Map<Integer, BigDecimal> manageScoreMap = detailService.calculateScoreByDetail(dto.getTaskId(), examineDetails, ReviewTypeEnum.MANAGE);
|
||||
Map<Integer, BigDecimal> allScoreMap = detailService.calculateScoreByDetail(dto.getTaskId(), examineDetails, ReviewTypeEnum.ALL);
|
||||
for (ExamineUser user : completeList) {
|
||||
if ("1".equals(user.getExamineStatus())) {
|
||||
//计算管理人员分数
|
||||
BigDecimal manageScore = manageScoreMap.get(user.getId());
|
||||
user.setManageScore(manageScore);
|
||||
if ("1".equals(user.getExamineStatusSelf())) {
|
||||
//计算总分数
|
||||
BigDecimal allScore = allScoreMap.get(user.getId());
|
||||
user.setScore(allScore);
|
||||
}
|
||||
}
|
||||
}
|
||||
userMapper.insertOrUpdateBatch(completeList);
|
||||
examineTaskDao.updateTaskEditFlag(true, dto.getTaskId());
|
||||
}).exceptionally(e -> {
|
||||
log.error("update task edit flag error", e);
|
||||
examineTaskDao.updateTaskEditFlag(true, dto.getTaskId());
|
||||
return null;
|
||||
});
|
||||
return dto.getExamineConfigList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package tech.unissense.pms.business.examine.user.domain;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.*;
|
||||
import tech.unissense.pms.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核人员表(ExamineUser)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:52
|
||||
*/
|
||||
@Data
|
||||
public class ExamineUser extends BaseEntity {
|
||||
private static final long serialVersionUID = -48380572616355554L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 考核任务名
|
||||
*/
|
||||
private Integer taskId;
|
||||
/**
|
||||
* 考核人
|
||||
*/
|
||||
private Integer userId;
|
||||
private String userName;
|
||||
/**
|
||||
* 考核分数(权重后分数)
|
||||
*/
|
||||
private BigDecimal score;
|
||||
/**
|
||||
* 总体评价
|
||||
*/
|
||||
private String judgeContent;
|
||||
/**
|
||||
* 主管评分(权重计算后)
|
||||
*/
|
||||
private BigDecimal manageScore;
|
||||
private BigDecimal selfScore;
|
||||
/**
|
||||
* 个人评分状态 0:待完成 1:已完成
|
||||
*/
|
||||
private String examineStatusSelf;
|
||||
/**
|
||||
* 主管评分状态 0:待完成 1:已完成
|
||||
*/
|
||||
private String examineStatus;
|
||||
private Integer manageUserId;
|
||||
private String manageUserName;
|
||||
|
||||
private String deptId;
|
||||
|
||||
private String isAsc;
|
||||
private String sortFiled;
|
||||
@Setter(value = AccessLevel.NONE)
|
||||
@Getter(value = AccessLevel.NONE)
|
||||
private String orderBySql;
|
||||
|
||||
|
||||
private List<Integer> userIdList;
|
||||
|
||||
public String getOrderBySql() {
|
||||
//对排序字段的替换
|
||||
if (StrUtil.isEmpty(sortFiled)) {
|
||||
return null;
|
||||
} else if ("all".equalsIgnoreCase(sortFiled)) {
|
||||
//评分排序规则 总分->主管评分(需主管提交)->个人评分(需个人提交)
|
||||
return (StrUtil.format("order by IFNULL(score,if(examine_status=1,manage_score,if(examine_status_self=1,ifnull(self_score,-1),-1))) {}", StrUtil.isNotEmpty(isAsc) ? isAsc : ""));
|
||||
} else if ("manageScore".equalsIgnoreCase(sortFiled)) {
|
||||
return (StrUtil.format("order by ifnull(manage_score,-1) {}", StrUtil.isNotEmpty(isAsc) ? isAsc : ""));
|
||||
} else if ("selfScore".equalsIgnoreCase(sortFiled)) {
|
||||
return (StrUtil.format("order by ifnull(self_score,-1) {}", StrUtil.isNotEmpty(isAsc) ? isAsc : ""));
|
||||
}else if ("score".equalsIgnoreCase(sortFiled)) {
|
||||
return (StrUtil.format("order by ifnull(score,-1) {}", StrUtil.isNotEmpty(isAsc) ? isAsc : ""));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package tech.unissense.pms.business.examine.user.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核人员表(ExamineUser)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:52
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExamineUserMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineUser queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param examineUser 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(ExamineUser examineUser);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineUser 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(ExamineUser examineUser);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ExamineUser> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<ExamineUser> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<ExamineUser> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<ExamineUser> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineUser 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(ExamineUser examineUser);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
List<ExamineUser> list(ExamineUser examineUser);
|
||||
|
||||
ExamineUser queryByTaskIdAndUserId(@Param("taskId") Integer examineTaskId,@Param("userId") Integer userId);
|
||||
|
||||
void deleteByIdList(List<Integer> idList);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package tech.unissense.pms.business.examine.user.service;
|
||||
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核人员表(ExamineUser)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:53
|
||||
*/
|
||||
public interface ExamineUserService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineUser queryById(Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineUser 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineUser insert(ExamineUser examineUser);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineUser 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
ExamineUser update(ExamineUser examineUser);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
List<ExamineUser> list(ExamineUser examineUser);
|
||||
|
||||
void access(ExamineDto examineDto);
|
||||
|
||||
/**
|
||||
* 通过任务id和用户id查询
|
||||
* @param examineTaskId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
ExamineUser queryByTaskIdAndUserId(Integer examineTaskId, Integer userId);
|
||||
void deleteUserByTaskId(Integer taskId);
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package tech.unissense.pms.business.examine.user.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.impl.ExamineConfigServiceImpl;
|
||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import tech.unissense.pms.business.examine.task.mapper.ExamineTaskMapper;
|
||||
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.service.ExamineUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.business.work.logger.service.IWorkLoggerService;
|
||||
import tech.unissense.pms.common.annotation.DataScope;
|
||||
import tech.unissense.pms.common.core.domain.entity.SysUser;
|
||||
import tech.unissense.pms.common.utils.SecurityUtils;
|
||||
import tech.unissense.pms.common.utils.StringUtils;
|
||||
import tech.unissense.pms.system.service.ISysDictDataService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 考核人员表(ExamineUser)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2025-01-02 10:18:53
|
||||
*/
|
||||
@Service("examineUserService")
|
||||
public class ExamineUserServiceImpl implements ExamineUserService {
|
||||
@Resource
|
||||
private ExamineUserMapper examineUserMapper;
|
||||
@Autowired
|
||||
private ExamineDetailService detailService;
|
||||
@Autowired
|
||||
private ExamineConfigServiceImpl examineConfigService;
|
||||
@Resource
|
||||
private ExamineTaskMapper taskMapper;
|
||||
@Autowired
|
||||
private IWorkLoggerService workLoggerService;
|
||||
@Autowired
|
||||
private ISysDictDataService sysDictDataService;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineUser queryById(Integer id) {
|
||||
return this.examineUserMapper.queryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineUser 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineUser insert(ExamineUser examineUser) {
|
||||
this.examineUserMapper.insert(examineUser);
|
||||
return examineUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param examineUser 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public ExamineUser update(ExamineUser examineUser) {
|
||||
this.examineUserMapper.update(examineUser);
|
||||
return this.queryById(examineUser.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.examineUserMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "t2", userAlias = "t2")
|
||||
public List<ExamineUser> list(ExamineUser examineUser) {
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
if (!user.getDeptId().equals(200L)) {
|
||||
String sqlPermission = StringUtils.format(
|
||||
" and ({}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) ))"
|
||||
, "t2", user.getDeptId(), user.getDeptId());
|
||||
|
||||
examineUser.setParams(new HashMap<String, Object>() {{
|
||||
put("dataScope", sqlPermission);
|
||||
}});
|
||||
}
|
||||
return examineUserMapper.list(examineUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void access(ExamineDto examineDto) {
|
||||
ExamineUser user = examineUserMapper.queryById(examineDto.getExamineId());
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setId(examineDto.getExamineId());
|
||||
examineUser.setJudgeContent(examineDto.getJudgeContent());
|
||||
examineUser.setExamineStatus(examineDto.getExamineStatus());
|
||||
examineUser.setExamineStatusSelf(examineDto.getExamineStatusSelf());
|
||||
examineUser.setManageScore(examineDto.getManageScore());
|
||||
examineUser.setSelfScore(examineDto.getSelfScore());
|
||||
String examineStatus = StrUtil.isNotEmpty(examineDto.getExamineStatus()) ? examineDto.getExamineStatus() : user.getExamineStatus();
|
||||
String examineStatusSelf = StrUtil.isNotEmpty(examineDto.getExamineStatusSelf()) ? examineDto.getExamineStatusSelf() : user.getExamineStatusSelf();
|
||||
if ("1".equals(examineStatus) && user.getManageUserId() == null) {
|
||||
examineUser.setManageUserId(SecurityUtils.getUserId().intValue());
|
||||
}
|
||||
//均已完成 计算总分数
|
||||
boolean flag = "1".equals(examineStatus) && "1".equals(examineStatusSelf);
|
||||
if (flag) {
|
||||
//保存系统核算分数
|
||||
detailService.insert(dealSystemBusinessAccount(examineDto.getExamineId(), examineDto.getTaskId()));
|
||||
Map<Integer, BigDecimal> scoreMap = detailService.calculateScoreByExamineId(examineDto.getTaskId()
|
||||
, Collections.singletonList(examineDto.getExamineId()), ReviewTypeEnum.ALL);
|
||||
examineUser.setScore(scoreMap.get(examineDto.getExamineId()));
|
||||
}
|
||||
examineUserMapper.update(examineUser);
|
||||
|
||||
}
|
||||
|
||||
private ExamineDetail dealSystemBusinessAccount(Integer examineId, Integer taskId) {
|
||||
ExamineTask examineTask = taskMapper.queryById(taskId);
|
||||
//如有系统核算才处理
|
||||
String workDay = sysDictDataService.selectDictLabel("pms_work_day", examineTask.getYear().toString());
|
||||
workDay = StrUtil.isNotEmpty(workDay) ? workDay : "251";
|
||||
BigDecimal configWorkDay = new BigDecimal(workDay);
|
||||
|
||||
Map<Integer, BigDecimal> workTimeByExamineDetail = workLoggerService.getWorkTimeByExamineDetail(Collections.singletonList(examineId));
|
||||
ExamineDetail examineDetail = new ExamineDetail();
|
||||
examineDetail.setExamineId(examineId);
|
||||
ExamineConfig examineConfig = new ExamineConfig();
|
||||
examineConfig.setExamineTaskId(taskId);
|
||||
examineConfig.setReviewType(ReviewTypeEnum.SYSTEM.getType());
|
||||
List<ExamineConfig> configList = examineConfigService.list(examineConfig);
|
||||
examineDetail.setConfigId(configList.get(0).getId());
|
||||
BigDecimal bigDecimal = workTimeByExamineDetail.get(examineDetail.getExamineId());
|
||||
if (bigDecimal == null) {
|
||||
examineDetail.setScore(0);
|
||||
return examineDetail;
|
||||
}
|
||||
BigDecimal max = configWorkDay.multiply(new BigDecimal("0.9"));
|
||||
BigDecimal min = configWorkDay.multiply(new BigDecimal("0.8"));
|
||||
if (bigDecimal.compareTo(max) >= 0) {
|
||||
//比90%大 满分
|
||||
examineDetail.setScore(10);
|
||||
} else if (bigDecimal.compareTo(min) >= 0) {
|
||||
//比80%大 比90%小 6分
|
||||
examineDetail.setScore(6);
|
||||
} else {
|
||||
//比80%小 0分
|
||||
examineDetail.setScore(0);
|
||||
}
|
||||
return examineDetail;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ExamineUser queryByTaskIdAndUserId(Integer examineTaskId, Integer userId) {
|
||||
return examineUserMapper.queryByTaskIdAndUserId(examineTaskId, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserByTaskId(Integer taskId) {
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setTaskId(taskId);
|
||||
List<ExamineUser> list = examineUserMapper.list(examineUser);
|
||||
List<Integer> idList = list.stream().map(ExamineUser::getId).collect(Collectors.toList());
|
||||
detailService.deleteByExamineId(idList);
|
||||
examineUserMapper.deleteByIdList(idList);
|
||||
// examineUserMapper.
|
||||
}
|
||||
}
|
|
@ -56,7 +56,9 @@ public class Project extends BaseEntity {
|
|||
private String state;
|
||||
/**
|
||||
* 数据状态 0-待启动 1-进行中 2-已完成
|
||||
* 暂不展示
|
||||
*/
|
||||
@Deprecated
|
||||
private String dataState;
|
||||
/**
|
||||
* 项目状态 0-待启动 1-进行中 2-已完成
|
||||
|
|
|
@ -22,4 +22,6 @@ public class ProjectQueryDto {
|
|||
private Integer projectId;
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private Integer userId;
|
||||
private String projectState;
|
||||
}
|
||||
|
|
|
@ -60,10 +60,9 @@ public interface IProjectService {
|
|||
|
||||
List<Project> listProjectByUser(String createBy);
|
||||
|
||||
List<TeamStaticsVo> getTeamInfo(Integer projectId);
|
||||
|
||||
List<ProjectExecutionVo> executionInfo(WorkLogger workLogger);
|
||||
List<TeamStaticsVo> getTeamInfo(Integer projectId);
|
||||
|
||||
List<ProjectExecutionVo> executionInfo(ProjectQueryDto ProjectQueryDto);
|
||||
|
||||
ProjectWorkInfoVo workInfo(ProjectQueryDto project);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package tech.unissense.pms.business.project.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -73,6 +74,7 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
* @param project 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public List<Project> permissisonList(Project project) {
|
||||
dataPermissions(project);
|
||||
List<Project> list = this.projectMapper.list(project);
|
||||
|
@ -243,11 +245,14 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectExecutionVo> executionInfo(WorkLogger workLogger) {
|
||||
public List<ProjectExecutionVo> executionInfo(ProjectQueryDto queryDto) {
|
||||
|
||||
Project projectQueryDto = new Project();
|
||||
if (workLogger.getUserId() != null) {
|
||||
projectQueryDto.setQueryUserId(Long.valueOf(workLogger.getUserId()));
|
||||
if (queryDto.getUserId() != null) {
|
||||
projectQueryDto.setQueryUserId(Long.valueOf(queryDto.getUserId()));
|
||||
}
|
||||
if (queryDto.getProjectState() != null) {
|
||||
projectQueryDto.setProjectState(queryDto.getProjectState());
|
||||
}
|
||||
List<Project> projects = this.permissisonList(projectQueryDto);
|
||||
List<Integer> projectIdList = projects.stream()
|
||||
|
@ -259,9 +264,26 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
.map(item -> item.getProjectId() + "_" + item.getUserId())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
WorkLogger workLogger = new WorkLogger();
|
||||
workLogger.setProjectIdList(projectIdList);
|
||||
List<WorkLogger> allWorkLoggerList = workLoggerService.list(workLogger);
|
||||
Map<Integer, BigDecimal> workTimeAllMap = allWorkLoggerList.stream().filter(item-> StrUtil.isNotEmpty(item.getWorkTime())).collect(Collectors.groupingBy(WorkLogger::getProjectId, Collectors.reducing(BigDecimal.ZERO
|
||||
, item -> new BigDecimal(item.getWorkTime()), BigDecimal::add)));
|
||||
// BeanUtils.copyBeanProp(workLogger,queryDto);
|
||||
|
||||
Map<String, BigDecimal> workTimeMap = workLoggerService.list(workLogger).stream()
|
||||
List<WorkLogger> workLoggerList = allWorkLoggerList.stream()
|
||||
.filter(item -> {
|
||||
Date date = item.getLoggerDate();
|
||||
Integer userId = item.getUserId();
|
||||
boolean flag=(date != null && !date.before(queryDto.getStartDate()) && !date.after(queryDto.getEndDate()));
|
||||
if (queryDto.getUserId() != null){
|
||||
flag=flag&&queryDto.getUserId().equals(userId);
|
||||
}
|
||||
return flag;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<String, BigDecimal> workTimeMap = workLoggerList.stream()
|
||||
.filter(item -> teamSet.contains(item.getProjectId() + "_" + item.getUserId()))
|
||||
.collect(Collectors.toMap(
|
||||
item -> item.getProjectId() + "_"
|
||||
|
@ -269,8 +291,8 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
item -> new BigDecimal(item.getWorkTime()),
|
||||
BigDecimal::add));
|
||||
|
||||
LocalDate startDate = workLogger.getStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate endDate = workLogger.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate startDate = queryDto.getStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate endDate = queryDto.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
return projects.stream().map(project -> {
|
||||
List<BigDecimal> tempList = Stream.iterate(startDate, date -> date.plusDays(1))
|
||||
|
@ -290,6 +312,7 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
BeanUtils.copyBeanProp(vo, project);
|
||||
vo.setDetailList(tempList);
|
||||
vo.setAllWorkTime(tempList.stream().reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
vo.setAllDateWorkTime(workTimeAllMap.getOrDefault(project.getProjectId(), BigDecimal.ZERO));
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
@ -25,5 +25,6 @@ public class ProjectExecutionVo {
|
|||
private String projectState;
|
||||
private Integer budgetDate;
|
||||
private BigDecimal allWorkTime;
|
||||
private BigDecimal allDateWorkTime;
|
||||
private List<BigDecimal> detailList;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class WorkLogger extends BaseEntity {
|
|||
private Date endDate;
|
||||
private List<Integer> projectIdList;
|
||||
|
||||
private Integer examineId;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -82,5 +82,8 @@ public interface WorkLoggerMapper {
|
|||
List<WorkLogger> calendar(WorkLogger workLogger);
|
||||
|
||||
List<WorkLogger> listUser(WorkLogger workLogger);
|
||||
|
||||
List<WorkLogger> listWorkTimeByExamineDetail(@Param("examineIdList") List<Integer> collect);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@ import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
|||
import tech.unissense.pms.business.work.logger.vo.CalendarVo;
|
||||
import tech.unissense.pms.business.work.logger.vo.StaticsHourVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (WorkLogger)表服务接口
|
||||
|
@ -68,4 +70,5 @@ public interface IWorkLoggerService {
|
|||
String getRemaining(WorkLogger workLogger);
|
||||
|
||||
|
||||
Map<Integer, BigDecimal> getWorkTimeByExamineDetail(List<Integer> collect);
|
||||
}
|
||||
|
|
|
@ -11,15 +11,13 @@ import tech.unissense.pms.business.work.logger.vo.CalendarVo;
|
|||
import tech.unissense.pms.business.work.logger.vo.StaticsHourVo;
|
||||
import tech.unissense.pms.common.utils.DateUtils;
|
||||
import tech.unissense.pms.common.utils.SecurityUtils;
|
||||
import java.util.Objects;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -116,6 +114,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
WorkLogger temp = calendarMap.get(key);
|
||||
calendarVo.setDate(DateUtils.toDate(localDate));
|
||||
calendarVo.setState(temp != null ? temp.getState() : "-1");
|
||||
calendarVo.setWorkTime(temp != null ? temp.getWorkTime() : "0");
|
||||
result.add(calendarVo);
|
||||
}
|
||||
|
||||
|
@ -221,6 +220,12 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
return BigDecimal.ONE.subtract(totalWorkTime).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, BigDecimal> getWorkTimeByExamineDetail(List<Integer> collect) {
|
||||
List<WorkLogger> workLoggers = workLoggerMapper.listWorkTimeByExamineDetail(collect);
|
||||
return workLoggers.stream().collect(Collectors.toMap(WorkLogger::getExamineId, item -> new BigDecimal(item.getWorkTime()), BigDecimal::add));
|
||||
}
|
||||
|
||||
// 泛型方法,用于生成统计工时的列表,适用于项目统计
|
||||
private <T> List<StaticsHourVo> generateStaticsHourVoList(List<T> items, Map<Integer, BigDecimal> workDayMap,
|
||||
Function<T, Integer> idExtractor, Function<T, String> nameExtractor) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package tech.unissense.pms.business.work.logger.vo;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
@ -22,4 +23,5 @@ public class CalendarVo {
|
|||
private Date date;
|
||||
|
||||
private String state;
|
||||
private String workTime;
|
||||
}
|
||||
|
|
|
@ -99,18 +99,18 @@
|
|||
and t1.state = #{state}
|
||||
</if>
|
||||
<if test="projectState != null and projectState != ''">
|
||||
<!-- and t1.project_state = #{projectState} -->
|
||||
<choose>
|
||||
<when test="projectState=='0'.toString()">
|
||||
and t1.start_date <![CDATA[ > ]]> sysdate()
|
||||
</when>
|
||||
<when test="projectState=='1'.toString()">
|
||||
and sysdate() between t1.start_date and t1.end_date
|
||||
</when>
|
||||
<when test="projectState=='2'.toString()">
|
||||
and t1.end_date <![CDATA[ < ]]> sysdate()
|
||||
</when>
|
||||
</choose>
|
||||
and t1.project_state = #{projectState}
|
||||
<!-- <choose>-->
|
||||
<!-- <when test="projectState=='0'.toString()">-->
|
||||
<!-- and t1.start_date <![CDATA[ > ]]> sysdate()-->
|
||||
<!-- </when>-->
|
||||
<!-- <when test="projectState=='1'.toString()">-->
|
||||
<!-- and sysdate() between t1.start_date and t1.end_date-->
|
||||
<!-- </when>-->
|
||||
<!-- <when test="projectState=='2'.toString()">-->
|
||||
<!-- and t1.end_date <![CDATA[ < ]]> sysdate()-->
|
||||
<!-- </when>-->
|
||||
<!-- </choose>-->
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and t1.create_by = #{createBy}
|
||||
|
|
|
@ -254,6 +254,16 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="listWorkTimeByExamineDetail"
|
||||
resultType="tech.unissense.pms.business.work.logger.domain.WorkLogger">
|
||||
SELECT w.work_time, e.id
|
||||
FROM ( select sum(work_time) as work_time,user_id from pms_work_logger group by user_id) w
|
||||
JOIN pms_examine_user e ON w.user_id = e.user_id
|
||||
WHERE e.id IN
|
||||
<foreach collection="examineIdList" item="examineId" open="(" separator="," close=")">
|
||||
#{examineId}
|
||||
</foreach>
|
||||
</select>
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_work_logger
|
||||
|
|
|
@ -0,0 +1,183 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="tech.unissense.pms.business.examine.config.mapper.ExamineConfigMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.examine.config.domain.ExamineConfig" id="ExamineConfigMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="reviewType" column="review_type" jdbcType="VARCHAR"/>
|
||||
<result property="reviewCategory" column="review_category" jdbcType="VARCHAR"/>
|
||||
<result property="reviewItem" column="review_item" jdbcType="VARCHAR"/>
|
||||
<result property="remarks" column="remarks" jdbcType="VARCHAR"/>
|
||||
<result property="weight" column="weight" jdbcType="NUMERIC"/>
|
||||
<result property="examineTaskId" column="examine_task_id" jdbcType="INTEGER"/>
|
||||
<result property="sortNum" column="sort_num" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="base_query">
|
||||
select id,
|
||||
review_type,
|
||||
review_category,
|
||||
review_item,
|
||||
remarks,
|
||||
weight,
|
||||
examine_task_id,
|
||||
sort_num
|
||||
from pms_examine_config
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExamineConfigMap">
|
||||
<include refid="base_query"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="ExamineConfigMap">
|
||||
<include refid="base_query"/>
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="reviewType != null and reviewType != ''">
|
||||
and review_type = #{reviewType}
|
||||
</if>
|
||||
<if test="reviewCategory != null and reviewCategory != ''">
|
||||
and review_category = #{reviewCategory}
|
||||
</if>
|
||||
<if test="reviewItem != null and reviewItem != ''">
|
||||
and review_item = #{reviewItem}
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
and remarks = #{remarks}
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
and weight = #{weight}
|
||||
</if>
|
||||
<if test="examineTaskId != null">
|
||||
and examine_task_id = #{examineTaskId}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from pms_examine_config
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="reviewType != null and reviewType != ''">
|
||||
and review_type = #{reviewType}
|
||||
</if>
|
||||
<if test="reviewCategory != null and reviewCategory != ''">
|
||||
and review_category = #{reviewCategory}
|
||||
</if>
|
||||
<if test="reviewItem != null and reviewItem != ''">
|
||||
and review_item = #{reviewItem}
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
and remarks = #{remarks}
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
and weight = #{weight}
|
||||
</if>
|
||||
<if test="examineTaskId != null">
|
||||
and examine_task_id = #{examineTaskId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="list" resultMap="ExamineConfigMap">
|
||||
<include refid="base_query"/>
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="reviewType != null and reviewType != ''">
|
||||
and review_type = #{reviewType}
|
||||
</if>
|
||||
<if test="reviewCategory != null and reviewCategory != ''">
|
||||
and review_category = #{reviewCategory}
|
||||
</if>
|
||||
<if test="reviewItem != null and reviewItem != ''">
|
||||
and review_item = #{reviewItem}
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
and remarks = #{remarks}
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
and weight = #{weight}
|
||||
</if>
|
||||
<if test="examineTaskId != null">
|
||||
and examine_task_id = #{examineTaskId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_config(review_type, review_category, review_item, remarks, weight, examine_task_id, sort_num)
|
||||
values (#{reviewType}, #{reviewCategory}, #{reviewItem}, #{remarks}, #{weight}, #{examineTaskId}, #{sortNum})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_config(review_type, review_category, review_item, remarks, weight, examine_task_id, sort_num)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.reviewType}, #{entity.reviewCategory}, #{entity.reviewItem}, #{entity.remarks}, #{entity.weight},
|
||||
#{entity.examineTaskId}, #{entity.sortNum})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_config(review_type, review_category, review_item, remarks, weight, examine_task_id, sort_num)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.reviewType}, #{entity.reviewCategory}, #{entity.reviewItem}, #{entity.remarks}, #{entity.weight},
|
||||
#{entity.examineTaskId}, #{entity.sortNum})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
review_type = values(review_type),
|
||||
review_category = values(review_category),
|
||||
review_item = values(review_item),
|
||||
remarks = values(remarks),
|
||||
weight = values(weight),
|
||||
examine_task_id = values(examine_task_id)
|
||||
sort_num = values(sort_num)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_examine_config
|
||||
<set>
|
||||
<if test="reviewType != null and reviewType != ''">
|
||||
review_type = #{reviewType},
|
||||
</if>
|
||||
<if test="reviewCategory != null and reviewCategory != ''">
|
||||
review_category = #{reviewCategory},
|
||||
</if>
|
||||
<if test="reviewItem != null and reviewItem != ''">
|
||||
review_item = #{reviewItem},
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
remarks = #{remarks},
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
weight = #{weight},
|
||||
</if>
|
||||
<if test="examineTaskId != null">
|
||||
examine_task_id = #{examineTaskId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from pms_examine_config
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="tech.unissense.pms.business.examine.detail.mapper.ExamineDetailMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.examine.detail.domain.ExamineDetail" id="ExamineDetailMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="examineId" column="examine_id" jdbcType="INTEGER"/>
|
||||
<result property="score" column="score" jdbcType="INTEGER"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="configId" column="config_id" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="base_query">
|
||||
select id,
|
||||
examine_id,
|
||||
score,
|
||||
remark,
|
||||
config_id
|
||||
from pms_examine_detail
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExamineDetailMap">
|
||||
<include refid="base_query"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="list" resultMap="ExamineDetailMap">
|
||||
<include refid="base_query"/>
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="examineId != null">
|
||||
and examine_id = #{examineId}
|
||||
</if>
|
||||
<if test="score != null">
|
||||
and score = #{score}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark = #{remark}
|
||||
</if>
|
||||
<if test="configId != null">
|
||||
and config_id = #{configId}
|
||||
</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>
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from pms_examine_detail
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="examineId != null">
|
||||
and examine_id = #{examineId}
|
||||
</if>
|
||||
<if test="score != null">
|
||||
and score = #{score}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark = #{remark}
|
||||
</if>
|
||||
<if test="configId != null">
|
||||
and config_id = #{configId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="listByExamineId" resultMap="ExamineDetailMap">
|
||||
<include refid="base_query"/>
|
||||
where examine_id in
|
||||
<foreach collection="idList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_detail(examine_id, score, remark, config_id)
|
||||
values (#{examineId}, #{score}, #{remark}, #{configId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_detail(examine_id, score, remark, config_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.examineId}, #{entity.score}, #{entity.remark}, #{entity.configId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_detail(examine_id, score, remark, config_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.examineId}, #{entity.score}, #{entity.remark}, #{entity.configId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
score = values(score),
|
||||
remark = values(remark)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_examine_detail
|
||||
<set>
|
||||
<if test="examineId != null">
|
||||
examine_id = #{examineId},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score = #{score},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="configId != null">
|
||||
config_id = #{configId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from pms_examine_detail
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteByExamineId">
|
||||
delete
|
||||
from pms_examine_detail
|
||||
where examine_id in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="tech.unissense.pms.business.examine.task.mapper.ExamineTaskMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.examine.task.domain.ExamineTask" id="ExamineTaskMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
|
||||
<result property="peopleNumber" column="people_number" jdbcType="INTEGER"/>
|
||||
<result property="peopleNumberDetail" column="people_number_detail" jdbcType="VARCHAR"/>
|
||||
<result property="taskStatus" column="task_status" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="taskEditFlag" column="task_edit_flag" jdbcType="BOOLEAN"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 新增任务 -->
|
||||
<insert id="addTask" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
INSERT INTO pms_examine_task (task_name, people_number, people_number_detail, task_status, create_time, end_time, year)
|
||||
VALUES (#{taskName}, #{peopleNumber}, #{peopleNumberDetail}, #{taskStatus}, #{createTime}, #{endTime}, #{year})
|
||||
</insert>
|
||||
|
||||
<select id="getTasks" resultMap="ExamineTaskMap">
|
||||
SELECT * FROM pms_examine_task
|
||||
<where>
|
||||
<if test="taskName != null and taskName != ''">
|
||||
AND task_name LIKE CONCAT('%', #{taskName}, '%')
|
||||
</if>
|
||||
<if test="taskStatus != null">
|
||||
<choose>
|
||||
<when test="taskStatus == 2">
|
||||
AND end_time < NOW()
|
||||
</when>
|
||||
<when test="taskStatus == 0">
|
||||
AND end_time > CURRENT_TIMESTAMP
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="year != null">
|
||||
AND year = #{year}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
<select id="listTask" resultMap="ExamineTaskMap">
|
||||
select distinct t1.id,t1.task_name, t1.people_number,t1.task_edit_flag, t1.people_number_detail, t1.task_status, t1.create_time, t1.end_time
|
||||
from pms_examine_task t1
|
||||
left join pms_examine_user t2 on t1.id = t2.task_id
|
||||
left join sys_user t3 on t2.user_id = t3.user_id
|
||||
<where>
|
||||
<if test="taskName != null and taskName != ''">
|
||||
AND task_name LIKE CONCAT('%', #{taskName}, '%')
|
||||
</if>
|
||||
<if test="taskStatus != null">
|
||||
<choose>
|
||||
<when test="taskStatus == 2">
|
||||
AND end_time < NOW()
|
||||
</when>
|
||||
<when test="taskStatus == 0">
|
||||
AND end_time > CURRENT_TIMESTAMP
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="year != null">
|
||||
AND year = #{year}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
<select id="queryById" resultMap="ExamineTaskMap">
|
||||
SELECT * FROM pms_examine_task
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
<select id="listTaskSelf" resultType="tech.unissense.pms.business.examine.task.domain.ExamineTaskDto">
|
||||
select t1.examine_status_self,t1.id as examine_id,
|
||||
t2.* from pms_examine_user t1
|
||||
left join pms_examine_task t2
|
||||
on t1.task_id=t2.id
|
||||
where user_id=#{userId}
|
||||
</select>
|
||||
|
||||
<update id="updateTask">
|
||||
UPDATE pms_examine_task
|
||||
<set>
|
||||
<if test="taskName != null">task_name = #{taskName},</if>
|
||||
<if test="peopleNumber != null">people_number = #{peopleNumber},</if>
|
||||
<if test="peopleNumberDetail != null">people_number_detail = #{peopleNumberDetail},</if>
|
||||
<if test="taskStatus != null">task_status = #{taskStatus},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="year != null">year = #{year},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<update id="updateTaskEditFlag">
|
||||
update pms_examine_task
|
||||
set task_edit_flag=#{flag}
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTask">
|
||||
DELETE FROM pms_examine_task
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="tech.unissense.pms.business.examine.user.mapper.ExamineUserMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.examine.user.domain.ExamineUser" id="ExamineUserMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="taskId" column="task_id" jdbcType="INTEGER"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="score" column="score" jdbcType="NUMERIC"/>
|
||||
<result property="judgeContent" column="judge_content" jdbcType="VARCHAR"/>
|
||||
<result property="manageScore" column="manage_score" jdbcType="NUMERIC"/>
|
||||
<result property="examineStatus" column="examine_status" jdbcType="VARCHAR"/>
|
||||
<result property="examineStatusSelf" column="examine_status_self" jdbcType="VARCHAR"/>
|
||||
<result property="manageUserId" column="manage_user_id" jdbcType="INTEGER"/>
|
||||
<result property="selfScore" column="self_score" jdbcType="NUMERIC"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="base_query">
|
||||
select id,
|
||||
task_id,
|
||||
user_id,
|
||||
score,
|
||||
judge_content,
|
||||
manage_score,
|
||||
examine_status,
|
||||
examine_status_self,
|
||||
manage_user_id,
|
||||
self_score
|
||||
from pms_examine_user
|
||||
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExamineUserMap">
|
||||
<include refid="base_query"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from pms_examine_user
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="taskId != null">
|
||||
and task_id = #{taskId}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="score != null">
|
||||
and score = #{score}
|
||||
</if>
|
||||
<if test="judgeContent != null and judgeContent != ''">
|
||||
and judge_content = #{judgeContent}
|
||||
</if>
|
||||
<if test="manageScore != null">
|
||||
and manage_score = #{manageScore}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="list" resultType="ExamineUser">
|
||||
select t1.id,
|
||||
t1.task_id,
|
||||
t1.user_id,
|
||||
t1.score,
|
||||
t1.judge_content,
|
||||
t1.manage_score,
|
||||
t1.examine_status,
|
||||
t1.examine_status_self,
|
||||
t1.manage_user_id,
|
||||
t1.self_score,
|
||||
t2.nick_name as userName,
|
||||
t3.nick_name as manageUserName
|
||||
from pms_examine_user t1 left join sys_user t2 on t1.user_id = t2.user_id
|
||||
left join sys_user t3 on t1.manage_user_id = t3.user_id
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and t1.id = #{id}
|
||||
</if>
|
||||
<if test="taskId != null">
|
||||
and t1.task_id = #{taskId}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and t1.user_id = #{userId}
|
||||
</if>
|
||||
<if test="userIdList != null and userIdList.size>0">
|
||||
and t1.user_id in
|
||||
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="score != null">
|
||||
and t1.score = #{score}
|
||||
</if>
|
||||
<if test="judgeContent != null and judgeContent != ''">
|
||||
and t1.judge_content = #{judgeContent}
|
||||
</if>
|
||||
<if test="manageScore != null">
|
||||
and t1.manage_score = #{manageScore}
|
||||
</if>
|
||||
<if test="examineStatus != null and examineStatus != ''">
|
||||
and t1.examine_status = #{examineStatus}
|
||||
</if>
|
||||
<if test="examineStatusSelf != null and examineStatusSelf != ''">
|
||||
and t1.examine_status_self = #{examineStatusSelf}
|
||||
</if>
|
||||
<if test="deptId != null and deptId != ''">
|
||||
and t2.dept_id = #{deptId}
|
||||
</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
${orderBySql}
|
||||
</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 into pms_examine_user(task_id, user_id, score, judge_content, manage_score)
|
||||
values (#{taskId}, #{userId}, #{score}, #{judgeContent}, #{manageScore})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_user(task_id, user_id, score, judge_content, manage_score)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.taskId}, #{entity.userId}, #{entity.score}, #{entity.judgeContent}, #{entity.manageScore})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into pms_examine_user(task_id, user_id, score, judge_content, manage_score)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.taskId}, #{entity.userId}, #{entity.score}, #{entity.judgeContent}, #{entity.manageScore})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
task_id = values(task_id),
|
||||
user_id = values(user_id),
|
||||
score = values(score),
|
||||
judge_content = values(judge_content),
|
||||
manage_score = values(manage_score)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_examine_user
|
||||
<set>
|
||||
<if test="taskId != null">
|
||||
task_id = #{taskId},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="score != null">
|
||||
score = #{score},
|
||||
</if>
|
||||
<if test="judgeContent != null and judgeContent != ''">
|
||||
judge_content = #{judgeContent},
|
||||
</if>
|
||||
<if test="manageScore != null">
|
||||
manage_score = #{manageScore},
|
||||
</if>
|
||||
<if test="selfScore != null">
|
||||
self_score = #{selfScore},
|
||||
</if>
|
||||
<if test="examineStatus != null and examineStatus != ''">
|
||||
examine_status = #{examineStatus},
|
||||
</if>
|
||||
<if test="examineStatusSelf != null and examineStatusSelf != ''">
|
||||
examine_status_self = #{examineStatusSelf},
|
||||
</if>
|
||||
<if test="manageUserId != null">
|
||||
manage_user_id = #{manageUserId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from pms_examine_user
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteByIdList">
|
||||
delete
|
||||
from pms_examine_user
|
||||
where id in
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue