luowei 1 year ago
parent
commit
b872f3cd81

+ 4 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/safetyInspect/mapper/SafetyInspectMapper.java

@@ -27,17 +27,17 @@ public interface SafetyInspectMapper {
     List<SysOrg> selectAllOrg();
 
     /**
-     * 机构维度
+     * zic机构维度
      * @return
      */
-    Map orgDimension(@Param("orgPath") String orgPath,@Param("year") String year,@Param("orgType") Integer orgType);
+    Map orgDimension(@Param("orgPath") String orgPath,@Param("year") String year,@Param("orgType") Integer orgType,@Param("type")Integer type);
 
     /**
-     * 隐患维度
+     * zic隐患维度
      * @param orgPath
      * @param year
      * @param orgType
      * @return
      */
-    Map pitfallDimension (@Param("orgPath") String orgPath,@Param("year") String year,@Param("orgType") Integer orgType);
+    Map pitfallDimension (@Param("orgPath") String orgPath,@Param("year") String year,@Param("orgType") Integer orgType,@Param("type")Integer type);
 }

+ 8 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/safetyInspect/service/impl/SafetyInspectServiceImpl.java

@@ -61,18 +61,22 @@ public class SafetyInspectServiceImpl implements SafetyInspectService {
                 sysOrg1 = orgService.selectOrgById(s.getParentId(), SecurityConstants.INNER);
             } else {
                 sysOrg1 = orgService.selectOrgById(orgService.selectOrgById(s.getParentId(), SecurityConstants.INNER).getParentId(), SecurityConstants.INNER);
+                if (-1 == sysOrg1.getShortName().indexOf("地区行社")) {
+                    sysOrg1 = orgService.selectOrgById(orgService.selectOrgById(orgService.selectOrgById(s.getParentId(), SecurityConstants.INNER).getParentId(), SecurityConstants.INNER).getParentId(), SecurityConstants.INNER);
+                }
             }
             safetyInspectVO.setCity(sysOrg1.getShortName().split("地区行社")[0]);
             safetyInspectVO.setOrgName(s.getShortName());
             //次数
             SafetyInspectVO safetyInspectVOS = safetyInspectMapper.selectAllByPath(s.getPath(),safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType());
             //机构维度
-            Map map = safetyInspectMapper.orgDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType());
+            Map map = safetyInspectMapper.orgDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType(),4);
             safetyInspectVO.setPlanInspectOrg(Integer.valueOf(map.get("planInspectOrg").toString()));
             safetyInspectVO.setRealityInspectOrg(Integer.valueOf(map.get("realityInspectOrg").toString()));
             safetyInspectVO.setInspectCoverRate(map.get("inspectCoverRate").toString());
             safetyInspectVO.setOrgName(s.getShortName());
-            Map map1 = safetyInspectMapper.pitfallDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType());
+            Map map1 = safetyInspectMapper.pitfallDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType(),4);
+
             safetyInspectVO.setPitfallNumber(Integer.valueOf(map1.get("pitfallNumber").toString()));
             safetyInspectVO.setRectificationNumber(Integer.valueOf(map1.get("rectificationNumber").toString()));
             safetyInspectVO.setRectificationRate(map1.get("rectificationRate").toString());
@@ -117,12 +121,12 @@ public class SafetyInspectServiceImpl implements SafetyInspectService {
             //次数
             SafetyInspectVO safetyInspectVOS = safetyInspectMapper.selectSelfByPath(safetyInspectDTO.getCycle(),s.getPath(),safetyInspectDTO.getYear(),safetyInspectDTO.getOrgType());
             //机构维度
-            Map map = safetyInspectMapper.orgDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType());
+            Map map = safetyInspectMapper.orgDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType(),3);
             safetyInspectVO.setPlanInspectOrg(Integer.valueOf(map.get("planInspectOrg").toString()));
             safetyInspectVO.setRealityInspectOrg(Integer.valueOf(map.get("realityInspectOrg").toString()));
             safetyInspectVO.setInspectCoverRate(map.get("inspectCoverRate").toString());
             safetyInspectVO.setOrgName(s.getShortName());
-            Map map1 = safetyInspectMapper.pitfallDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType());
+            Map map1 = safetyInspectMapper.pitfallDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType(),3);
             safetyInspectVO.setPitfallNumber(Integer.valueOf(map1.get("pitfallNumber").toString()));
             safetyInspectVO.setRectificationNumber(Integer.valueOf(map1.get("rectificationNumber").toString()));
             safetyInspectVO.setRectificationRate(map1.get("rectificationRate").toString());

+ 30 - 16
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/ResumptionReportMapper.xml

@@ -17,11 +17,17 @@
         OR COUNT( a.id )= 0,
         '0%',
         IFNULL(
-        CONCAT( SUM( IF ( a.`status` = 3, 1, 0 ))/ COUNT( a.id )* 100, '%' ),
+        CONCAT(
+        ROUND( SUM( IF ( a.`status` = 3, 1, 0 ))/ COUNT( a.id )* 100, 2 ),
+        '%'
+        ),
         '0%'
         )) AS frontRate,
         IFNULL( SUM( a.exception_count ), 0 ) AS frontAbnormalNumber,
-        IFNULL( COUNT( d.id )/ IFNULL( SUM( a.exception_count ), 0 )* 100, '0%' ) AS totalRealityRectificationRate
+        IFNULL(
+        CONCAT( ROUND( COUNT( d.id )/ IFNULL( SUM( a.exception_count ), 0 )* 100, 2 ), '%' ),
+        '0%'
+        ) AS totalRealityRectificationRate
         FROM
         core_resumption a
         LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
@@ -56,20 +62,28 @@
     <select id="selectIntrusionTestReport"
             resultType="com.xunmei.core.reportForms.resumption.vo.IntrusionTestReportVO">
         SELECT
-            IFNULL(a.exception_count,0) AS abnormalNumber,
-            COUNT( a.id ) AS planNumber,
-            IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 ) AS realityNumber,
-            IF
-                (
-                            IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 )= 0
-                        OR COUNT( a.id )= 0,
-                            '0%',
-                            CONCAT(
-                                            IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 )/ COUNT( a.id )* 100,
-                                            '%'
-                                )) AS realityRate,
-            COUNT( c.id ) AS realityRectificationNumber,
-            IF(COUNT( c.id )=0 OR IFNULL(a.exception_count,0)=0,'0%',CONCAT(COUNT( c.id )/IFNULL(a.exception_count,0)*100,'%'))	 AS realityRectificationRate
+        IFNULL( a.exception_count, 0 ) AS abnormalNumber,
+        COUNT( a.id ) AS planNumber,
+        IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 ) AS realityNumber,
+        IF
+        (
+        IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 )= 0
+        OR COUNT( a.id )= 0,
+        '0%',
+        CONCAT(
+        ROUND(
+        IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 )/ COUNT( a.id )* 100,
+        2
+        ),
+        '%'
+        )) AS realityRate,
+        COUNT( c.id ) AS realityRectificationNumber,
+        IF
+        (
+        COUNT( c.id )= 0
+        OR IFNULL( a.exception_count, 0 )= 0,
+        '0%',
+        CONCAT( COUNT( c.id )/ IFNULL( a.exception_count, 0 )* 100, '%' )) AS realityRectificationRate
         FROM
             core_resumption a
                 LEFT JOIN core_resumption_plan b ON a.plan_id = b.id

+ 16 - 18
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/SafetyInspectMapper.xml

@@ -135,30 +135,28 @@
     </select>
     <select id="pitfallDimension" resultType="java.util.Map">
         SELECT
-            IFNULL( SUM( IF ( a.confirm_status >= 2 and a.reform_status in (10,11), 1, 0 )), 0 ) AS pitfallNumber,
-            IFNULL( SUM( IF ( a.reform_status = 11, 1, 0 )), 0 ) AS rectificationNumber,
-            IFNULL(
-                    CONCAT(
-                            ROUND(
-                                            SUM(
-                                                    IF
-                                                        ( a.reform_status = 11, 1, 0 ))/ SUM(
-                                                    IF
-                                                        ( a.confirm_status >= 2 and a.reform_status in (10,11), 1, 0 ))* 100,
-                                            2
-                                ),
-                            '%'
-                        ),
-                    '0%'
-                ) AS rectificationRate
+        IFNULL( SUM( IF ( a.confirm_status >= 2 AND a.reform_status IN ( 10, 11 ), 1, 0 ) ), 0 ) AS pitfallNumber,
+        IFNULL( SUM( IF ( a.reform_status = 11, 1, 0 )), 0 ) AS rectificationNumber,
+        IFNULL(
+        CONCAT(
+        ROUND(
+        SUM(
+        IF
+        ( a.reform_status = 11, 1, 0 ))/ IFNULL( SUM( IF ( a.confirm_status >= 2 AND a.reform_status IN ( 10, 11 ), 1, 0 ) ), 0 )* 100,
+        2
+        ),
+        '%'
+        ),
+        '0%'
+        ) AS rectificationRate
         FROM
         core_question a
         LEFT JOIN sys_org b ON a.org_id = b.id
         LEFT JOIN core_safety_task c ON c.id = a.src_task_id
         LEFT JOIN core_safecheck_plan d ON c.plan_id=d.id
         WHERE
-        a.src_type = 2
-        AND d.check_type =3
+            a.src_type = 2
+        AND d.check_type =#{type}
         <if test="orgPath !=null and orgPath !=''">
             and a.org_path like concat(#{orgPath},'%')
         </if>