wangliang 9 месяцев назад
Родитель
Сommit
0da385e247

+ 35 - 27
sop-api/src/main/java/com/qmth/sop/server/api/QualityAnalyseReportController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 @Api(tags = "质量监控分析Controller")
@@ -46,8 +47,30 @@ public class QualityAnalyseReportController {
     @RequestMapping(value = "/area_manager/report", method = RequestMethod.POST)
     @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
     public Result areaManagerReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
-        List<QualityAnalyseReportBean> qualityAnalyseReportBeanList = qualityAnalyseReportService.areaQualityReport(
-                serviceId);
+        return ResultUtil.ok(this.calculateRate(qualityAnalyseReportService.areaQualityReport(serviceId)));
+    }
+
+    @ApiOperation(value = "人力商质量问题统计")
+    @RequestMapping(value = "/human_supplier/report", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
+    public Result humanSupplierReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
+        return ResultUtil.ok(this.calculateRate(qualityAnalyseReportService.humanSupplierQualityReport(serviceId)));
+    }
+
+    @ApiOperation(value = "质量问题原因分类")
+    @RequestMapping(value = "/type/report", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
+    public Result typeReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
+        return ResultUtil.ok();
+    }
+
+    /**
+     * 计算比率
+     *
+     * @param qualityAnalyseReportBeanList
+     * @return
+     */
+    protected Map<String, Object> calculateRate(List<QualityAnalyseReportBean> qualityAnalyseReportBeanList) {
         Integer total = qualityAnalyseReportBeanList.stream().mapToInt(s -> s.getSum()).sum();
         Integer influenceDegreeATotal = qualityAnalyseReportBeanList.stream().mapToInt(s -> s.getInfluenceDegreeA())
                 .sum();
@@ -72,30 +95,15 @@ public class QualityAnalyseReportController {
             influenceDegreeDRateTotal = influenceDegreeDRateTotal.divide(new BigDecimal(total), 2,
                     BigDecimal.ROUND_HALF_UP).multiply(SystemConstant.RATE).setScale(2, BigDecimal.ROUND_HALF_UP);
         }
-        return ResultUtil.ok(
-                new ImmutableMap.Builder<String, Object>().put(ResourceSecurityReportController.TOTAL, total)
-                        .put(IN_FLUENCE_DEGREE_A_TOTAL, influenceDegreeATotal)
-                        .put(IN_FLUENCE_DEGREE_B_TOTAL, influenceDegreeBTotal)
-                        .put(IN_FLUENCE_DEGREE_C_TOTAL, influenceDegreeCTotal)
-                        .put(IN_FLUENCE_DEGREE_D_TOTAL, influenceDegreeDTotal)
-                        .put(IN_FLUENCE_DEGREE_A_RATE_TOTAL, influenceDegreeARateTotal)
-                        .put(IN_FLUENCE_DEGREE_B_RATE_TOTAL, influenceDegreeBRateTotal)
-                        .put(IN_FLUENCE_DEGREE_C_RATE_TOTAL, influenceDegreeCRateTotal)
-                        .put(IN_FLUENCE_DEGREE_D_RATE_TOTAL, influenceDegreeDRateTotal)
-                        .put(ResourceSecurityReportController.RECORDS, qualityAnalyseReportBeanList).build());
-    }
-
-    @ApiOperation(value = "人力商质量问题统计")
-    @RequestMapping(value = "/human_supplier/report", method = RequestMethod.POST)
-    @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
-    public Result humanSupplierReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
-        return ResultUtil.ok();
-    }
-
-    @ApiOperation(value = "质量问题原因分类")
-    @RequestMapping(value = "/type/report", method = RequestMethod.POST)
-    @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表", response = QualityAnalyseReportBean.class) })
-    public Result typeReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
-        return ResultUtil.ok();
+        return new ImmutableMap.Builder<String, Object>().put(ResourceSecurityReportController.TOTAL, total)
+                .put(IN_FLUENCE_DEGREE_A_TOTAL, influenceDegreeATotal)
+                .put(IN_FLUENCE_DEGREE_B_TOTAL, influenceDegreeBTotal)
+                .put(IN_FLUENCE_DEGREE_C_TOTAL, influenceDegreeCTotal)
+                .put(IN_FLUENCE_DEGREE_D_TOTAL, influenceDegreeDTotal)
+                .put(IN_FLUENCE_DEGREE_A_RATE_TOTAL, influenceDegreeARateTotal)
+                .put(IN_FLUENCE_DEGREE_B_RATE_TOTAL, influenceDegreeBRateTotal)
+                .put(IN_FLUENCE_DEGREE_C_RATE_TOTAL, influenceDegreeCRateTotal)
+                .put(IN_FLUENCE_DEGREE_D_RATE_TOTAL, influenceDegreeDRateTotal)
+                .put(ResourceSecurityReportController.RECORDS, qualityAnalyseReportBeanList).build();
     }
 }

+ 8 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/QualityAnalyseReportMapper.java

@@ -23,4 +23,12 @@ public interface QualityAnalyseReportMapper extends BaseMapper<TBService> {
      * @return
      */
     List<QualityAnalyseReportBean> areaQualityReport(@Param("serviceId") Long serviceId);
+
+    /**
+     * 人力商质量问题统计
+     *
+     * @param serviceId
+     * @return
+     */
+    List<QualityAnalyseReportBean> humanSupplierQualityReport(@Param("serviceId") Long serviceId);
 }

+ 8 - 0
sop-business/src/main/java/com/qmth/sop/business/service/QualityAnalyseReportService.java

@@ -22,4 +22,12 @@ public interface QualityAnalyseReportService extends IService<TBService> {
      * @return
      */
     List<QualityAnalyseReportBean> areaQualityReport(Long serviceId);
+
+    /**
+     * 人力商质量问题统计
+     *
+     * @param serviceId
+     * @return
+     */
+    List<QualityAnalyseReportBean> humanSupplierQualityReport(Long serviceId);
 }

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/QualityAnalyseReportServiceImpl.java

@@ -30,4 +30,15 @@ public class QualityAnalyseReportServiceImpl extends ServiceImpl<QualityAnalyseR
     public List<QualityAnalyseReportBean> areaQualityReport(Long serviceId) {
         return this.baseMapper.areaQualityReport(serviceId);
     }
+
+    /**
+     * 人力商质量问题统计
+     *
+     * @param serviceId
+     * @return
+     */
+    @Override
+    public List<QualityAnalyseReportBean> humanSupplierQualityReport(Long serviceId) {
+        return this.baseMapper.humanSupplierQualityReport(serviceId);
+    }
 }

+ 1 - 1
sop-business/src/main/resources/mapper/FlowMsgReferReportMapper.xml

@@ -15,6 +15,6 @@
                join sys_user su on su.id = sm.receive_user_id
            where sm.service_id = #{serviceId} and sm.type = #{messageTypeEnum}
            group by su.real_name) t
-        order by sum
+        order by sum desc
     </select>
 </mapper>

+ 5 - 1
sop-business/src/main/resources/mapper/QualityAnalyseReportMapper.xml

@@ -28,6 +28,10 @@
         and tffa.status <![CDATA[ <> ]]> 'END'
         and tbqpa.Influence_degree is not null
         group by su.real_name) t
-        order by t.name
+        order by t.sum desc
+    </select>
+
+    <select id="humanSupplierQualityReport" resultType="com.qmth.sop.business.bean.report.QualityAnalyseReportBean">
+
     </select>
 </mapper>

+ 5 - 5
sop-business/src/main/resources/mapper/ResourceSecurityReportMapper.xml

@@ -16,7 +16,7 @@
     </select>
 
     <select id="humanSupplierReport" resultType="com.qmth.sop.business.bean.report.SupplierCountReportBean">
-        select ss.name as humanSupplierName,count(distinct tbuas.user_archives_id) as count from t_b_service tbs
+        select * from(select ss.name as humanSupplierName,count(distinct tbuas.user_archives_id) as count from t_b_service tbs
         join t_b_sop_info tbsi on tbsi.service_id = tbs.id
         join t_b_crm_detail tbcd on tbcd.sop_no = tbsi.sop_no
         join t_f_custom_flow_entity tfcfe on tfcfe.code = tbcd.sop_no
@@ -28,8 +28,8 @@
         and ss.`type` = 'HUMAN' and tbcd.status = 'PUBLISH'
         and tbs.status <![CDATA[ <> ]]> 'CANCEL'
         and tffa.status <![CDATA[ <> ]]> 'END'
-        group by ss.name
-        order by ss.name
+        group by ss.name) t
+        order by count desc
     </select>
 
     <select id="areaDingExceptionReport" resultType="com.qmth.sop.business.bean.report.DingExceptionCountReportBean">
@@ -45,7 +45,7 @@
         and tbs.status <![CDATA[ <> ]]> 'CANCEL'
         and tffa.status <![CDATA[ <> ]]> 'END'
         group by su.real_name) t where t.count > 0
-        order by t.areaManagerName
+        order by count desc
     </select>
 
     <select id="humanDingExceptionReport" resultType="com.qmth.sop.business.bean.report.DingExceptionCountReportBean">
@@ -63,6 +63,6 @@
             and tbs.status <![CDATA[ <> ]]> 'CANCEL'
             and tffa.status <![CDATA[ <> ]]> 'END'
           group by ss.name) t where t.count > 0
-        order by t.humanSupplierName
+        order by count desc
     </select>
 </mapper>