|
@@ -1,15 +1,74 @@
|
|
package com.boman.report.service.impl;
|
|
package com.boman.report.service.impl;
|
|
|
|
|
|
|
|
+import com.boman.domain.dto.AjaxResult;
|
|
|
|
+import com.boman.domain.entity.StatisticReport;
|
|
|
|
+import com.boman.domain.entity.StatisticReportPersonnel;
|
|
|
|
+import com.boman.domain.entity.vo.StatisticReportVo;
|
|
|
|
+import com.boman.report.mapper.StatisticReportMapper;
|
|
|
|
+import com.boman.report.mapper.StatisticReportPersonnelMapper;
|
|
|
|
+import com.boman.report.service.StatisticReportService;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author shiqian
|
|
* @author shiqian
|
|
* @date 2021年08月24日 11:10
|
|
* @date 2021年08月24日 11:10
|
|
**/
|
|
**/
|
|
@Service
|
|
@Service
|
|
-public class StatisticReportServiceImpl {
|
|
|
|
|
|
+public class StatisticReportServiceImpl implements StatisticReportService {
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(ImportServiceImpl.class);
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(ImportServiceImpl.class);
|
|
|
|
+ @Autowired
|
|
|
|
+ private StatisticReportMapper statisticReportMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private StatisticReportPersonnelMapper statisticReportPersonnelMapper;
|
|
|
|
+ /**
|
|
|
|
+ * 获取表报详情
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult getReportInfo(Long id) {
|
|
|
|
+ StatisticReportVo reportInfo = statisticReportMapper.getReportInfo(id);
|
|
|
|
+ //获取参与人员信息
|
|
|
|
+ List<StatisticReportPersonnel> statisticReportPersonnels = statisticReportPersonnelMapper.selectByStatisticId(id);
|
|
|
|
+ if (statisticReportPersonnels != null && statisticReportPersonnels.size() > 0){
|
|
|
|
+ Map<String, List<String>> personnelMap = statisticReportPersonnels.stream().collect(Collectors.groupingBy(StatisticReportPersonnel::getDeptName, Collectors.mapping(StatisticReportPersonnel::getUserName, Collectors.toList())));
|
|
|
|
+ Map<String, List<String>> filledOutMap = statisticReportPersonnels.stream().filter(e -> "1".equals(e.getStatus())).collect(Collectors.groupingBy(StatisticReportPersonnel::getDeptName, Collectors.mapping(StatisticReportPersonnel::getUserName, Collectors.toList())));
|
|
|
|
+ //参与人员
|
|
|
|
+ List<Map<String,Object>> personnelList = new ArrayList<>();
|
|
|
|
+ //已填报
|
|
|
|
+ List<Map<String,Object>> filledInList = new ArrayList<>();
|
|
|
|
+ //未填报
|
|
|
|
+ List<Map<String,Object>> filledOutList = new ArrayList<>();
|
|
|
|
+ if (personnelMap != null && personnelMap.size() > 0){
|
|
|
|
+ personnelMap.forEach((key, value) -> {
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("deptName",key);
|
|
|
|
+ map.put("userNameList",value);
|
|
|
|
+ personnelList.add(map);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (filledOutMap != null && filledOutMap.size() > 0){
|
|
|
|
+ filledOutMap.forEach((key, value) -> {
|
|
|
|
+ Map<String,Object> map= new HashMap<>();
|
|
|
|
+ map.put("deptName",key);
|
|
|
|
+ map.put("userNameList",value);
|
|
|
|
+ filledOutList.add(map);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ reportInfo.setPersonnelList(personnelList);
|
|
|
|
+ //reportInfo.setFilledInList();
|
|
|
|
+ reportInfo.setFilledOutList(filledOutList);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(reportInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|