Explorar o código

新增报表详情

Administrator %!s(int64=3) %!d(string=hai) anos
pai
achega
125164847e

+ 1 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/entity/StatisticReport.java

@@ -21,6 +21,7 @@ public class StatisticReport {
   private java.sql.Timestamp createTime;
   private String updateBy;
   private java.sql.Timestamp updateTime;
+  private String isDel;
 
 
 }

+ 41 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/entity/vo/StatisticReportVo.java

@@ -0,0 +1,41 @@
+package com.boman.domain.entity.vo;
+
+import lombok.Builder;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author tjf
+ * @Date: 2021/08/24/14:26
+ */
+@Getter
+@Setter
+@ToString
+@Builder
+public class StatisticReportVo {
+    private Long id;
+    private String reportName;
+    private String reportId;
+    private String templateName;
+    private java.sql.Date startTime;
+    private java.sql.Date endTime;
+    private String reportStatus;
+    private String status;
+    private String repUploadFile;
+    private String remark;
+    private String createBy;
+    private java.sql.Timestamp createTime;
+    private String updateBy;
+    private java.sql.Timestamp updateTime;
+    private String isDel;
+    //参与人员
+    private List<Map<String,Object>> personnelList;
+    //已填报单位
+    private List<Map<String,Object>> filledInList;
+    //未填报单位
+    private List<Map<String,Object>> filledOutList;
+}

+ 19 - 0
boman-report/src/main/java/com/boman/report/controller/StatisticReportController.java

@@ -2,6 +2,10 @@ package com.boman.report.controller;
 
 import com.boman.common.core.web.controller.BaseController;
 import com.boman.domain.dto.AjaxResult;
+import com.boman.report.service.StatisticReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -9,6 +13,8 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/statistic/report")
 public class StatisticReportController extends BaseController {
 
+    @Autowired
+    private StatisticReportService statisticReportService;
     /**
      * 获取报表id集合
      *
@@ -29,4 +35,17 @@ public class StatisticReportController extends BaseController {
 
         return AjaxResult.success();
     }
+
+
+    /**
+     * 获取报表详情
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getReportInfo(@PathVariable Long id)
+    {
+        statisticReportService.getReportInfo(id);
+        return AjaxResult.success();
+    }
 }

+ 9 - 0
boman-report/src/main/java/com/boman/report/mapper/StatisticReportMapper.java

@@ -1,5 +1,7 @@
 package com.boman.report.mapper;
 
+import com.boman.domain.entity.StatisticReport;
+import com.boman.domain.entity.vo.StatisticReportVo;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -9,4 +11,11 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface StatisticReportMapper {
 
+    /**
+     * 获取表报详情
+     * @param id
+     * @return
+     */
+    StatisticReportVo getReportInfo(Long id);
+
 }

+ 4 - 0
boman-report/src/main/java/com/boman/report/mapper/StatisticReportPersonnelMapper.java

@@ -1,11 +1,15 @@
 package com.boman.report.mapper;
 
+import com.boman.domain.entity.StatisticReportPersonnel;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * @author shiqian
  * @date 2021年08月24日 11:09
  **/
 @Repository
 public interface StatisticReportPersonnelMapper {
+    List<StatisticReportPersonnel> selectByStatisticId(Long id);
 }

+ 9 - 1
boman-report/src/main/java/com/boman/report/service/StatisticReportService.java

@@ -1,8 +1,16 @@
 package com.boman.report.service;
 
+import com.boman.domain.dto.AjaxResult;
+
 /**
  * @author shiqian
  * @date 2021年08月24日 11:10
  **/
-public interface StatisticReportService {
+public interface StatisticReportService{
+    /**
+     * 获取表报详情
+     * @param id
+     * @return
+     */
+    AjaxResult getReportInfo (Long id);
 }

+ 60 - 1
boman-report/src/main/java/com/boman/report/service/impl/StatisticReportServiceImpl.java

@@ -1,15 +1,74 @@
 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.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.*;
+import java.util.stream.Collectors;
+
 /**
  * @author shiqian
  * @date 2021年08月24日 11:10
  **/
 @Service
-public class StatisticReportServiceImpl {
+public class StatisticReportServiceImpl implements StatisticReportService {
 
     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);
+    }
 }

+ 10 - 0
boman-report/src/main/resources/mapper/StatisticReportMapper.xml

@@ -19,6 +19,16 @@
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
+        <result property="isDel" column="is_del"/>
     </resultMap>
 
+    <sql id="selectStatisticReportVo">
+        select id, report_name, report_id, template_name, start_time, end_time, report_status, status, rep_upload_file, remark, create_by, create_time, update_by, update_time, is_del
+        from statistic_report
+    </sql>
+
+    <select id="getReportInfo" parameterType="Long" resultMap="StatisticReportResult">
+        <include refid="selectStatisticReportVo"/>
+        where id = #{id} and is_del = "N"
+    </select>
 </mapper> 

+ 9 - 0
boman-report/src/main/resources/mapper/StatisticReportPersonnelMapper.xml

@@ -20,4 +20,13 @@
         <result property="updateTime" column="update_time"/>
     </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
+        from statistic_report_personnel
+    </sql>
+
+    <select id="selectByStatisticId" parameterType="Long" resultMap="StatisticReportPersonnelResult">
+        <include refid="selectStatisticReportPersonnelVo"/>
+        where statistic_id = #{id} and is_del = "N"
+    </select>
 </mapper>