ソースを参照

新增报表详情

Administrator 3 年 前
コミット
1c92f13d58

+ 3 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/entity/StatisticReportPersonnel.java

@@ -1,5 +1,7 @@
 package com.boman.domain.entity;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import lombok.Builder;
 import lombok.Data;
 
@@ -20,5 +22,6 @@ public class StatisticReportPersonnel {
   private java.sql.Timestamp createTime;
   private String updateBy;
   private java.sql.Timestamp updateTime;
+  private String uploadFile;
 
 }

+ 1 - 0
boman-report/src/main/java/com/boman/report/service/impl/ImportServiceImpl.java

@@ -58,6 +58,7 @@ public class ImportServiceImpl implements IImportServcie {
         dto.setDataList(list);
         dto.setTableName(tableName);
         remoteObjService.importCommonData(dto);
+        
         return AjaxResult.success();
     }
 

+ 36 - 3
boman-report/src/main/java/com/boman/report/service/impl/StatisticReportServiceImpl.java

@@ -1,5 +1,10 @@
 package com.boman.report.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.boman.domain.SysFile;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.domain.entity.StatisticReport;
 import com.boman.domain.entity.StatisticReportPersonnel;
@@ -7,11 +12,13 @@ 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 com.google.gson.JsonObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.lang.ref.ReferenceQueue;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -41,6 +48,7 @@ public class StatisticReportServiceImpl implements StatisticReportService {
         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())));
+            Map<String, List<StatisticReportPersonnel>> filledInMap = statisticReportPersonnels.stream().filter(e -> "2".equals(e.getStatus())).collect(Collectors.groupingBy(StatisticReportPersonnel::getDeptName));
             //参与人员
             List<Map<String,Object>> personnelList = new ArrayList<>();
             //已填报
@@ -55,7 +63,6 @@ public class StatisticReportServiceImpl implements StatisticReportService {
                     personnelList.add(map);
                 });
             }
-
             if (filledOutMap != null && filledOutMap.size() > 0){
                 filledOutMap.forEach((key, value) -> {
                     Map<String,Object> map= new HashMap<>();
@@ -64,9 +71,35 @@ public class StatisticReportServiceImpl implements StatisticReportService {
                     filledOutList.add(map);
                 });
             }
-
+            if (filledInMap != null && filledInMap.size() > 0){
+                Set<String> strings = filledInMap.keySet();
+                for (String deptName : strings) {
+                    List<StatisticReportPersonnel> statisticReportPersonnelList = filledInMap.get(deptName);
+                    if (statisticReportPersonnelList != null && statisticReportPersonnelList.size() > 0){
+                        for (StatisticReportPersonnel statisticReportPersonnel : statisticReportPersonnelList) {
+                            Map<String,Object> map = new HashMap<>();
+                            map.put("deptName",deptName);
+                            map.put("userNameList",statisticReportPersonnel.getUserName());
+                            String uploadFile = statisticReportPersonnel.getUploadFile();
+                            //[{"name":"1627634606200.pdf","url":"http://192.168.101.11:9300/statics/2021/07/30/1627634606200.pdf","status":"success","uid":1627634606225}]
+                            List<SysFile> sysFileList = JSON.parseObject(uploadFile, new TypeReference<List<SysFile>>() {}.getType());
+                            List<String> fileName = new ArrayList<>();
+                            List<String> fileUrl = new ArrayList<>();
+                            if (sysFileList != null && sysFileList.size() > 0){
+                                for (SysFile sysFile : sysFileList) {
+                                    fileName.add(sysFile.getName());
+                                    fileUrl.add(sysFile.getUrl());
+                                }
+                            }
+                            map.put("fileNameList",fileName);
+                            map.put("fileUrlList",fileUrl);
+                            filledInList.add(map);
+                        }
+                    }
+                }
+            }
             reportInfo.setPersonnelList(personnelList);
-            //reportInfo.setFilledInList();
+            reportInfo.setFilledInList(filledInList);
             reportInfo.setFilledOutList(filledOutList);
         }
         return AjaxResult.success(reportInfo);

+ 2 - 1
boman-report/src/main/resources/mapper/StatisticReportPersonnelMapper.xml

@@ -13,6 +13,7 @@
         <result property="userId" column="user_id"/>
         <result property="userName" column="user_name"/>
         <result property="status" column="status"/>
+        <result property="uploadFile" column="upload_file"/>
         <result property="isDel" column="is_del"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
@@ -21,7 +22,7 @@
     </resultMap>
 
     <sql id="selectStatisticReportPersonnelVo">
-        select id, report_name, statistic_id, dept_id, dept_name, user_id, user_name, is_del, status, create_by, create_time, update_by, update_time
+        select id, report_name, statistic_id, dept_id, dept_name, user_id, user_name,upload_file, is_del, status, create_by, create_time, update_by, update_time
         from statistic_report_personnel
     </sql>