luowei 1 年之前
父節點
當前提交
6f6938df72

+ 27 - 0
project_data/sql/0.0.3/soc/soc.sql

@@ -1286,6 +1286,33 @@ INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2, '已过期', '2', 'letter_status', NULL, 'default', 'N', '0', '超级管理员', '2023-10-13 15:31:17', 'zlsls01', '2023-11-08 11:04:41', NULL);
 
 UPDATE sys_dict_data set dict_label='待整改' WHERE dict_type='question_reform_status' and dict_value=10;
+
+update sys_dict_data SET dict_label='报警控制器' WHERE dict_label='报警主机';
+
+delete  from sys_dict_data where dict_type= 'sys_device_type';
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (5, '硬盘录像机', '0', 'sys_device_type', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (4, '报警控制器', '1', 'sys_device_type', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (3, '摄像机', '2', 'sys_device_type', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (1, '灭火器', '3', 'sys_device_type', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (2, '过滤式消防自助呼吸器', '4', 'sys_device_type', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+
+delete from sys_dict_data where dict_type='science_protection';
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (3, '硬盘录像机', '0', 'science_protection', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (2, '报警控制器', '1', 'science_protection', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (1, '摄像机', '2', 'science_protection', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+delete from sys_dict_data where dict_type='fire_fighting';
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (1, '过滤式消防自助呼吸器', '4', 'fire_fighting', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
+INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
+VALUES (2, '灭火器', '3', 'fire_fighting', null, 'default', 'N', '0', '超级管理员', now(), '', null, null);
 -- 删除多余的表
 drop TABLE if EXISTS sys_bank_physical_defense_construction;
 -- 新增演练项目字典,及修改字典排序

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/safetyInspect/dto/SafetyInspectDTO.java

@@ -16,4 +16,5 @@ public class SafetyInspectDTO extends BaseEntity {
     private Long orgId;
     private String year;
     private String orgPath;
+    private Integer orgType;
 }

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

@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author :LuoWei
@@ -22,4 +23,19 @@ public interface SafetyInspectMapper {
     Page<SafetyInspectVO> report(@Param("page") Page<SafetyInspectVO> page, @Param("safetyInspectDTO") SafetyInspectDTO safetyInspectDTO);
 
     List<SysOrg> selectAllOrg();
+
+    /**
+     * 机构维度
+     * @return
+     */
+    Map orgDimension(@Param("orgPath") String orgPath,@Param("year") String year,@Param("orgType") Integer orgType);
+
+    /**
+     * 隐患维度
+     * @param orgPath
+     * @param year
+     * @param orgType
+     * @return
+     */
+    Map pitfallDimension (@Param("orgPath") String orgPath,@Param("year") String year,@Param("orgType") Integer orgType);
 }

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

@@ -21,10 +21,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * @author :LuoWei
@@ -67,15 +64,23 @@ public class SafetyInspectServiceImpl implements SafetyInspectService {
             }
             safetyInspectVO.setCity(sysOrg1.getShortName().split("地区行社")[0]);
             safetyInspectVO.setOrgName(s.getShortName());
-
+            //次数
             SafetyInspectVO safetyInspectVOS = safetyInspectMapper.selectAllByPath(s.getPath());
-            Integer integer = monitorAccessReportMapper.selectNetworkNumberByPath(s.getPath());
+            //机构维度
+            Map map = safetyInspectMapper.orgDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType());
+            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());
-        //    safetyInspectVO.setNetworkNumber(integer);
+            Map map1 = safetyInspectMapper.pitfallDimension(s.getPath(), safetyInspectDTO.getYear(), safetyInspectDTO.getOrgType());
+            safetyInspectVO.setPitfallNumber(Integer.valueOf(map1.get("pitfallNumber").toString()));
+            safetyInspectVO.setRectificationNumber(Integer.valueOf(map1.get("rectificationNumber").toString()));
+            safetyInspectVO.setRectificationRate(map1.get("rectificationRate").toString());
+
             safetyInspectVO.setPlanInspectNumber(safetyInspectVOS.getPlanInspectNumber());
             safetyInspectVO.setRealityInspectNumber(safetyInspectVOS.getRealityInspectNumber());
             safetyInspectVO.setInspectRate(safetyInspectVOS.getInspectRate());
-            safetyInspectVO.setPitfallNumber(safetyInspectVOS.getPitfallNumber());
+          //  safetyInspectVO.setPitfallNumber(safetyInspectVOS.getPitfallNumber());
             safetyInspectVOList.add(safetyInspectVO);
         });
         return safetyInspectVOList;

+ 78 - 3
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/SafetyInspectMapper.xml

@@ -72,12 +72,87 @@
                         ( a.`status` = 3, 1, 0 )),0) AS realityInspectNumber,
             IFNULL( SUM( a.exception_count ), 0 ) AS pitfallNumber,
 
-            IF(COUNT( a.id )=0 OR SUM( IF ( a.`status` = 3, 1, 0 ))=0,'0%',IFNULL(CONCAT(ROUND(SUM( IF ( a.`status` = 3, 1, 0 ))/ COUNT( a.id )* 100,2) , '%' ),'0%'))
-                AS inspectRate
+            CONCAT(
+                    ROUND(
+                                    IFNULL( SUM( IF ( a.`status` = 1, 1, 0 )), 0 ) / IFNULL( COUNT( a.id ), 0 )* 100,
+                                    2
+                        ),
+                    '%'
+                ) AS inspectRate
+        FROM
+            core_safety_task a LEFT JOIN sys_org b ON a.org_id=b.id
+        WHERE
+            a.deleted = 0
+        <if test="orgPath !=null and orgPath !=''">
+            and a.org_path like concat(#{orgPath},'%')
+        </if>
+        <if test="year !=null and year !=''">
+            AND a.ymd_year = #{year}
+        </if>
+        <if test="orgType !=null">
+            AND b.type = #{orgType}
+        </if>
+    </select>
+    <select id="orgDimension" resultType="java.util.Map">
+        SELECT
+            COUNT( a.id ) AS planInspectOrg,
+            IFNULL( SUM( IF ( a.`status` = 1, 1, 0 )), 0 ) AS realityInspectOrg,
+            IFNULL(
+                    CONCAT(
+                            ROUND( SUM( IF ( a.`status` = 1, 1, 0 ))/ COUNT( a.id )* 100, 2 ),
+                            '%'
+                        ),
+                    '0%'
+                ) AS inspectCoverRate
         FROM
             core_safety_task a
+                LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
+                LEFT JOIN sys_org c ON a.org_id = c.id
         WHERE
             a.deleted = 0
-          and a.org_path  like concat(#{orgPath},'%')
+          <if test="orgPath !=null and orgPath !=''">
+              and a.org_path like concat(#{orgPath},'%')
+          </if>
+          <if test="year !=null and year !=''">
+              AND a.ymd_year = #{year}
+          </if>
+         <if test="orgType !=null">
+             AND c.type = #{orgType}
+         </if>
+
+    </select>
+    <select id="pitfallDimension" resultType="java.util.Map">
+        SELECT
+            IFNULL( SUM( IF ( a.confirm_status >= 2, 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, 1, 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
+        WHERE
+            a.src_type = 2
+        <if test="orgPath !=null and orgPath !=''">
+            and a.org_path like concat(#{orgPath},'%')
+        </if>
+        <if test="year !=null and year !=''">
+            AND c.ymd_year = #{year}
+        </if>
+        <if test="orgType !=null">
+            AND b.type = #{orgType}
+        </if>
     </select>
 </mapper>

+ 2 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDictTypeServiceImpl.java

@@ -113,10 +113,11 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
         String type;
         if (assetType.equals("0")) {
             type = "fire_fighting";
+        } else if (assetType.equals("1")) {
+            type = "sys_device_type";
         } else {
             type = "science_protection";
         }
-        //  deviceTypeByAssetType = dictDataMapper.getDeviceTypeByAssetType(v);
         deviceTypeByAssetType = dictDataMapper.selectDictDataByType(type);
         return deviceTypeByAssetType;
     }