浏览代码

新增:添加分析结果报告结果,查询接口

chenhongyan1989 10 月之前
父节点
当前提交
aad93174d0

+ 2 - 1
energy-manage-service/src/main/java/com/energy/manage/service/controller/analysisresultreport/AnalysisResultReportController.java

@@ -6,6 +6,7 @@ import com.energy.manage.service.domain.dto.analysis.AnalysisResultReportDto;
 import com.energy.manage.service.service.analysis.AnalysisResultReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -25,7 +26,7 @@ public class AnalysisResultReportController extends BaseServiceController {
     private AnalysisResultReportService analysisResultReportService;
 
     @PostMapping("/saveReportBatch")
-    public ResultResp saveReportBatch(List<AnalysisResultReportDto> reportDtoList)
+    public ResultResp saveReportBatch(@RequestBody List<AnalysisResultReportDto> reportDtoList)
     {
         return success(analysisResultReportService.saveReportBatch(reportDtoList));
     }

+ 5 - 0
energy-manage-service/src/main/java/com/energy/manage/service/domain/vo/analysis/AnalysisDetailVo.java

@@ -44,4 +44,9 @@ public class AnalysisDetailVo {
      */
     private List<AnalysisCommentDescriptionVo> commentDescriptionVos;
 
+    /**
+     * 分析结果报告
+     */
+    private List<AnalysisResultReportVo> reportVos;
+
 }

+ 2 - 2
energy-manage-service/src/main/java/com/energy/manage/service/mappers/analysis/AnalysisResultReportMapper.java

@@ -1,6 +1,6 @@
 package com.energy.manage.service.mappers.analysis;
 
-import com.energy.manage.common.po.analysis.AnalysisResultReportPo;
+import com.energy.manage.common.mapper.MyMapper;
 import com.energy.manage.service.domain.dto.analysis.AnalysisResultReportDto;
 import com.energy.manage.service.domain.vo.analysis.AnalysisResultReportVo;
 import org.apache.ibatis.annotations.Param;
@@ -14,7 +14,7 @@ import java.util.List;
  * @desc
  */
 @Repository
-public interface AnalysisResultReportMapper {
+public interface AnalysisResultReportMapper extends MyMapper<AnalysisResultReportVo> {
 
     /**
      * 保存报表

+ 16 - 3
energy-manage-service/src/main/java/com/energy/manage/service/service/analysis/impl/AnalysisServiceImpl.java

@@ -23,6 +23,7 @@ import com.energy.manage.service.mappers.analysis.*;
 import com.energy.manage.service.mappers.windenginegroup.WindEngineGroupMapper;
 import com.energy.manage.service.mappers.windfieldbatch.WindFieldBatchMapper;
 import com.energy.manage.service.property.analysis.AlgorithmProperties;
+import com.energy.manage.service.service.analysis.AnalysisResultReportService;
 import com.energy.manage.service.service.analysis.AnalysisService;
 import com.energy.manage.service.util.BatchDownloadUtil;
 import com.energy.manage.service.util.BeanMapUtils;
@@ -99,6 +100,9 @@ public class AnalysisServiceImpl implements AnalysisService {
     private WindEngineGroupMapper windEngineGroupMapper;
 
     @Autowired
+    private AnalysisResultReportMapper resultReportMapper;
+
+    @Autowired
     private AlgorithmProperties algorithmProperties;
 
     @Autowired
@@ -252,10 +256,16 @@ public class AnalysisServiceImpl implements AnalysisService {
         List<AnalysisDiagramRelationVo> newDiagramRelationVos = getNewDiagramRelations(batchCode, analysisTypeCode, fieldEngineCode,isIntranet);
         //查询评论
         List<AnalysisCommentDescriptionVo> commentDescriptionVos = commentDescriptionMapper.selecByBatchCodeAndAnalysisTypeCode(batchCode,analysisTypeCode);
+        //查询分析报告
+        List<AnalysisResultReportVo> reportVos = resultReportMapper.selectByBatchCode(batchCode);
         //根据分析类型设置分析结果
         analysisTypeVos.forEach(analysisTypeVo -> {
             //设置相应参数
-            AnalysisDetailVo analysisDetailVo = getAnalysisDetailVo(analysisTypeVo, newGeneralFileVos,newDiagramRelationVos,commentDescriptionVos);
+            AnalysisDetailVo analysisDetailVo = getAnalysisDetailVo(analysisTypeVo,
+                                                                    newGeneralFileVos,
+                                                                    newDiagramRelationVos,
+                                                                    commentDescriptionVos,
+                                                                    reportVos);
             if(analysisDetailVo != null){
                 analysisDetailVos.add(analysisDetailVo);
             }
@@ -264,6 +274,7 @@ public class AnalysisServiceImpl implements AnalysisService {
         if(StringUtils.isNotBlank(analysisTypeCode) && CollectionUtils.isNotEmpty(analysisDetailVos)){
             analysisDetailVos.get(0).setCommentTypeRelations(commentTypeRelationMapper.selectByAnalysisTypeCode(batchCode,analysisTypeCode));
         }
+
         return analysisDetailVos;
     }
 
@@ -615,7 +626,8 @@ public class AnalysisServiceImpl implements AnalysisService {
     private AnalysisDetailVo getAnalysisDetailVo(AnalysisTypeVo analysisTypeVo,
                                                  List<AnalysisGeneralFileVo> newGeneralFileVos,
                                                  List<AnalysisDiagramRelationVo> newDiagramRelationVos,
-                                                 List<AnalysisCommentDescriptionVo> commentDescriptionVos){
+                                                 List<AnalysisCommentDescriptionVo> commentDescriptionVos,
+                                                 List<AnalysisResultReportVo> reportVos){
         List<AnalysisGeneralFileVo> generalFileVos = null;
         if(CollectionUtils.isNotEmpty(newGeneralFileVos)) {
             generalFileVos = newGeneralFileVos.stream().filter(analysisGeneralFileVo -> analysisGeneralFileVo.getAnalysisTypeCode().equals(analysisTypeVo.getTypeCode())).collect(Collectors.toList());
@@ -632,7 +644,8 @@ public class AnalysisServiceImpl implements AnalysisService {
                 .setAnalysisTypeName(analysisTypeVo.getTypeName())
                 .setGeneralFiles(generalFileVos)
                 .setDiagramRelations(diagramRelationVos)
-                .setCommentDescriptionVos(commentDescriptionVos);
+                .setCommentDescriptionVos(commentDescriptionVos)
+                .setReportVos(reportVos);
     }
 
     /**

+ 15 - 32
energy-manage-service/src/main/resources/mybatis/analysis/AnalysisResultReportMapper.xml

@@ -14,38 +14,21 @@
 
     <insert id="saveReportBatch" parameterType="com.energy.manage.service.domain.dto.analysis.AnalysisOptionRecordsDto">
         insert into analysis_result_report
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="batchCode != null">
-                batch_code,
-            </if>
-            <if test="reportName != null and reportName != ''">
-                report_name,
-            </if>
-            <if test="reportType != null">
-                report_type,
-            </if>
-            <if test="reportAddr != null and reportAddr != ''">
-                report_addr
-            </if>
-        </trim>
-        <trim prefix="values">
-            <foreach collection="list"  item="record" separator=",">
-                (
-                <if test="batchCode != null">
-                    #{record.batchCode,jdbcType=VARCHAR},
-                </if>
-                <if test="reportName != null and reportName != ''">
-                    #{record.reportName,jdbcType=VARCHAR},
-                </if>
-                <if test="reportType != null">
-                    #{record.reportType,jdbcType=INTEGER},
-                </if>
-                <if test="reportAddr != null and reportAddr != ''">
-                    #{record.reportAddr,jdbcType=VARCHAR}
-                </if>
-                )
-            </foreach>
-        </trim>
+            (
+                 batch_code,
+                 report_type,
+                 report_name,
+                 report_addr
+             )
+             values
+        <foreach collection="list" separator="," item="record">
+            (
+                #{record.batchCode,jdbcType=VARCHAR},
+                #{record.reportType,jdbcType=INTEGER},
+                #{record.reportName,jdbcType=VARCHAR},
+                #{record.reportAddr,jdbcType=VARCHAR}
+            )
+        </foreach>
     </insert>
 
     <select id="selectByBatchCode" parameterType="string" resultType="com.energy.manage.service.domain.vo.analysis.AnalysisResultReportVo">