Merge remote-tracking branch 'origin/dev_1.1.0' into dev_1.1.0
# Conflicts: # pms-business/src/main/java/tech/unissense/pms/business/examine/task/service/impl/TaskServiceImpl.javadev_1.1.0
commit
8c70789814
|
@ -31,6 +31,10 @@
|
|||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.unissense</groupId>
|
||||
<artifactId>pms-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -75,5 +75,7 @@ public interface ExamineDetailMapper {
|
|||
int deleteById(Integer id);
|
||||
|
||||
List<ExamineDetail> list(ExamineDetail examineDetail);
|
||||
|
||||
void deleteByExamineId(List<Integer> collect);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,4 +71,6 @@ public interface ExamineDetailService {
|
|||
|
||||
void saveBatch(List<ExamineDetail> examineDetailList);
|
||||
|
||||
|
||||
void deleteByExamineId( List<Integer> collect);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
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;
|
||||
|
@ -11,7 +14,10 @@ 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.user.mapper.ExamineUserMapper;
|
||||
import tech.unissense.pms.business.examine.user.service.impl.ExamineUserServiceImpl;
|
||||
import tech.unissense.pms.business.work.logger.service.IWorkLoggerService;
|
||||
import tech.unissense.pms.common.utils.bean.BeanUtils;
|
||||
import tech.unissense.pms.system.service.ISysDictDataService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -35,6 +41,10 @@ public class ExamineDetailServiceImpl implements ExamineDetailService {
|
|||
private ExamineConfigMapper configMapper;
|
||||
@Resource
|
||||
private ExamineUserMapper userMapper;
|
||||
@Autowired
|
||||
private IWorkLoggerService workLoggerService;
|
||||
@Autowired
|
||||
private ISysDictDataService sysDictDataService;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
|
@ -134,6 +144,8 @@ public class ExamineDetailServiceImpl implements ExamineDetailService {
|
|||
examineConfigQueryDto.setReviewType(typeEnum.getType());
|
||||
}
|
||||
List<ExamineConfig> configList = configMapper.list(examineConfigQueryDto);
|
||||
//系统核算单独处理
|
||||
dealSystemBusinessAccount(examineList, configList);
|
||||
Map<Integer, ExamineConfig> configMap = configList.stream().collect(Collectors.toMap(ExamineConfig::getId, Function.identity()));
|
||||
Map<Integer, BigDecimal> scoreMap = new HashMap<>();
|
||||
for (ExamineDetail detail : examineList) {
|
||||
|
@ -156,8 +168,45 @@ public class ExamineDetailServiceImpl implements ExamineDetailService {
|
|||
return scoreMap;
|
||||
}
|
||||
|
||||
private void dealSystemBusinessAccount(List<ExamineDetail> examineList, List<ExamineConfig> configList) {
|
||||
Map<Integer, ExamineConfig> systemExamineConfigMap = configList.stream().filter(item ->
|
||||
ReviewTypeEnum.SYSTEM.getType().equals(item.getReviewType())).collect(Collectors.toMap(ExamineConfig::getId, Function.identity()));
|
||||
//如有系统核算才处理
|
||||
if (CollUtil.isNotEmpty(systemExamineConfigMap)) {
|
||||
String workDay = sysDictDataService.selectDictLabel("pms_work_day", "2024");
|
||||
workDay = StrUtil.isNotEmpty(workDay) ? workDay : "251";
|
||||
BigDecimal configWorkDay = new BigDecimal(workDay);
|
||||
List<ExamineDetail> collect = examineList.stream().filter(item -> systemExamineConfigMap.containsKey(item.getConfigId())).collect(Collectors.toList());
|
||||
Map<Integer, BigDecimal> workTimeByExamineDetail = workLoggerService.getWorkTimeByExamineDetail(collect.stream().map(ExamineDetail::getExamineId).collect(Collectors.toList()));
|
||||
for (ExamineDetail examineDetail : collect) {
|
||||
BigDecimal bigDecimal = workTimeByExamineDetail.get(examineDetail.getExamineId());
|
||||
if (bigDecimal == null) {
|
||||
examineDetail.setScore(0);
|
||||
continue;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveBatch(List<ExamineDetail> examineDetailList) {
|
||||
examineDetailMapper.insertOrUpdateBatch(examineDetailList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByExamineId(List<Integer> collect) {
|
||||
examineDetailMapper.deleteByExamineId(collect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ 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;
|
||||
|
@ -33,6 +34,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
@Resource
|
||||
private ExamineUserMapper userMapper;
|
||||
private ExamineUserServiceImpl examineUserService;
|
||||
|
||||
@Override
|
||||
public ExamineTask addTask(ExamineTask task) {
|
||||
|
@ -107,6 +109,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
@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);
|
||||
|
|
|
@ -75,5 +75,8 @@ public interface ExamineUserMapper {
|
|||
List<ExamineUser> list(ExamineUser examineUser);
|
||||
|
||||
ExamineUser queryByTaskIdAndUserId(@Param("taskId") Integer examineTaskId,@Param("userId") Integer userId);
|
||||
|
||||
void deleteByIdList(List<Integer> idList);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,4 +57,5 @@ public interface ExamineUserService {
|
|||
* @return
|
||||
*/
|
||||
ExamineUser queryByTaskIdAndUserId(Integer examineTaskId, Integer userId);
|
||||
void deleteUserByTaskId(Integer taskId);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 考核人员表(ExamineUser)表服务实现类
|
||||
|
@ -112,4 +113,15 @@ public class ExamineUserServiceImpl implements ExamineUserService {
|
|||
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.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -222,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) {
|
||||
|
|
|
@ -254,6 +254,17 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="listWorkTimeByExamineDetail"
|
||||
resultType="tech.unissense.pms.business.work.logger.domain.WorkLogger">
|
||||
SELECT SUM(w.work_time) AS work_time, e.id
|
||||
FROM pms_work_logger 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>
|
||||
GROUP BY w.user_id
|
||||
</select>
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update pms_work_logger
|
||||
|
|
|
@ -127,6 +127,14 @@
|
|||
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>
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
</where>
|
||||
</select>
|
||||
<select id="listTask" resultType="ExamineTask">
|
||||
select t1.id,t1.task_name, t1.people_number, t1.people_number_detail, t1.task_status, t1.create_time, t1.end_time
|
||||
select distinct t1.id,t1.task_name, t1.people_number, 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
|
||||
|
|
|
@ -175,6 +175,14 @@
|
|||
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