Преглед изворни кода

Merge remote-tracking branch 'origin/V0.0.4' into V0.0.4

ouyang пре 1 година
родитељ
комит
2ec43b384f

+ 11 - 0
project_data/sql/0.0.4/soc/soc.sql

@@ -5,3 +5,14 @@ DELETE FROM `sys_dict_data` WHERE dict_type='rule_status';
 INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231113157, '手册状态', 'rule_status', '0', 'jwx', '2023-11-27 14:55:51', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_code`, `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 (20231114641, 0, '启用', '0', 'rule_status', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:36', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_code`, `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 (20231114643, 1, '停用', '1', 'rule_status', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:44', '', NULL, NULL);
+
+delete from sys_menu where id in (1729308502301728769);
+INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark)
+VALUES (1729308502301728769, '导出全省农信系统物防建设达标情况', 103, 5, '', null, null, 1, 0, 'F', '0', '0', 'system:dept:exportConstruction', '1', null, null, null, now(), '', null, '');
+delete from sys_role_menu where menu_id=1729308502301728769;
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1729308502301728769);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1729308502301728769);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1729308502301728769);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1729308502301728769);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1729308502301728769);
+INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1729308502301728769);

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/monitor/vo/MonitoringAccessVO.java

@@ -18,7 +18,7 @@ public class MonitoringAccessVO {
      */
     @ExcelProperty("序号")
     private Integer orderNum;
-private String city;
+    private String city;
 
     @ExcelProperty("单位名称")
     @ApiModelProperty(value = "机构名称")
@@ -37,7 +37,7 @@ private String city;
     private Integer realityAccessNumber;
     @ExcelProperty("平均调阅时长")
     @ApiModelProperty(value = "平均调阅时长(小时)")
-private String duration;
+    private String duration;
     @ExcelProperty("完成率")
     @ApiModelProperty(value = "完成率")
     private String accessRate;

+ 37 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysDeptController.java

@@ -1,6 +1,8 @@
 package com.xunmei.system.controller;
 
 import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.domain.OrgTreeReq;
@@ -26,13 +28,18 @@ import com.xunmei.system.api.vo.SysOrgVO;
 import com.xunmei.system.service.ISysDeptService;
 import com.xunmei.system.service.ISysOrgService;
 import com.xunmei.system.service.ISysUserService;
+import com.xunmei.system.util.OrgPhysicalDefenseConstructionExport;
+import com.xunmei.system.util.SecurityUserExport;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * 机构信息
@@ -57,7 +64,37 @@ public class SysDeptController extends BaseController {
     public TableDataInfo<SysOrg> list(SysOrg dept) {
         return orgService.selectPage(dept);
     }
+    @RequiresPermissions("system:dept:exportConstruction")
+    @PostMapping("/exportConstruction")
+    public void exportConstruction(SysOrg dept, HttpServletResponse response) {
+        List<OrgPhysicalDefenseConstructionExport> excel = orgService.excel(dept);
+        if (ObjectUtil.isEmpty(excel)) {
+            throw new RuntimeException("导出数据为空!");
+        }
+        AtomicInteger xh = new AtomicInteger();
+        xh.getAndIncrement();
+        excel.forEach(e -> {
+            e.setXh(String.valueOf(xh.getAndIncrement()));
+        });
+        if (excel.size() > 10000) {
+            throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
+        }
+        try {
+            // 设置响应头
+            response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("用户数据", "utf-8"));
+            response.setContentType("application/octet-stream;charset=UTF-8");
+            response.setCharacterEncoding("utf-8");
+            // 数据导出
+            EasyExcel.write(response.getOutputStream(), OrgPhysicalDefenseConstructionExport.class)
+                    .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("用户数据").doWrite(excel);
+        } catch (Exception e) {
+            // 重置response
+            response.reset();
+            response.setContentType("application/json");
+            response.setCharacterEncoding("utf-8");
+        }
 
+    }
     /**
      * 查询机构列表(排除节点)
      */

+ 1 - 5
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysOrgController.java

@@ -149,11 +149,7 @@ public class SysOrgController extends BaseController {
     @InnerAuth
     @GetMapping("/selectSysOrgByPathAndType")
     public List<SysOrg> selectSysOrgByPathAndType(String path,Integer type) {
-        QueryWrapper queryWrapper = new QueryWrapper();
-        queryWrapper.likeRight("path", path);
-        queryWrapper.eq("type",type);
-        queryWrapper.eq("deleted",0);
-        return sysOrgMapper.selectList(queryWrapper);
+        return sysOrgService.selectSysOrgByPathAndType(path,type);
     }
     /**
      * 通过父类查询子集合

+ 31 - 4
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysOrgMapper.java

@@ -6,6 +6,7 @@ import com.xunmei.common.core.vo.IdNameVo;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.vo.FindOrgTypes;
 import com.xunmei.system.api.vo.SysOrgVO;
+import com.xunmei.system.util.OrgPhysicalDefenseConstructionExport;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Component;
 
@@ -19,7 +20,8 @@ import java.util.List;
  */
 @Component
 public interface SysOrgMapper extends BaseMapper<SysOrg> {
-  List<SysOrg>   selectByShortName(String name);
+    List<SysOrg> selectByShortName(String name);
+
     /**
      * 查询【请填写功能名称】
      *
@@ -27,8 +29,11 @@ public interface SysOrgMapper extends BaseMapper<SysOrg> {
      * @return 【请填写功能名称】
      */
     SysOrg selectSysOrgById(Long id);
+
     List<Long> selectOrgTypeByIdList(@Param("orgIdList") List<Long> execOrgIdList);
+
     Long getOrgIdByTaskId(Long taskId);
+
     /**
      * 查询【请填写功能名称】列表
      *
@@ -46,7 +51,8 @@ public interface SysOrgMapper extends BaseMapper<SysOrg> {
     int insertSysOrg(SysOrg sysOrg);
 
     List<Long> selectCheckSubOrgIdList(@Param("orgId") Long orgId);
-    Page<SysOrg> selectOrgList(Page<SysOrg> page,@Param("org") SysOrg org);
+
+    Page<SysOrg> selectOrgList(Page<SysOrg> page, @Param("org") SysOrg org);
 
     /**
      * 修改【请填写功能名称】
@@ -88,7 +94,28 @@ public interface SysOrgMapper extends BaseMapper<SysOrg> {
      */
     List<IdNameVo> getParentName(@Param("ids") List<Long> ids);
 
-    List<SysOrg> findByOrgTypeAndParent(@Param("orgType")Integer orgType, @Param("path")String path);
+    List<SysOrg> findByOrgTypeAndParent(@Param("orgType") Integer orgType, @Param("path") String path);
+
+    List<SysOrg> findByOrgTypesAndParent(@Param("types") List<Integer> types, @Param("path") String path);
+
+    Integer selectNetworkNumberByPath(String orgPath);
+
+    /**
+     * 物防达标情况
+     *
+     * @param orgPath
+     * @return
+     */
+    OrgPhysicalDefenseConstructionExport complianceStatus(@Param("orgPath") String orgPath);
+
+    /**
+     * @param orgPath
+     * @param year
+     * @return
+     */
+    Integer rectificationStatus(@Param("orgPath") String orgPath, @Param("year") String year);
+
+    Integer oldRectificationStatus(@Param("orgPath") String orgPath, @Param("year") String year);
 
-    List<SysOrg> findByOrgTypesAndParent(@Param("types")List<Integer> types,@Param("path") String path);
+    Integer noRectificationStatus(@Param("orgPath") String orgPath, @Param("year") String year);
 }

+ 9 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java

@@ -7,6 +7,7 @@ import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.vo.FindOrgTypes;
 import com.xunmei.system.api.vo.SysOrgVO;
+import com.xunmei.system.util.OrgPhysicalDefenseConstructionExport;
 
 import java.util.List;
 
@@ -81,6 +82,14 @@ public interface ISysOrgService extends IService<SysOrg> {
      */
     TableDataInfo<SysOrg> selectPage(SysOrg sysOrg);
 
+    /**
+     * 物防导出查询
+     * @param dept
+     * @return
+     */
+    List<OrgPhysicalDefenseConstructionExport>excel(SysOrg dept);
+    List<SysOrg> selectSysOrgByPathAndType(String path,Integer type);
+
     String selectPathById(Long orgId);
 
     SysOrg selectByParentId(Long orgId);

+ 59 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.CacheConstants;
 import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.ErrorMsgConstants;
+import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.OrgTreeReq;
 import com.xunmei.common.core.domain.OrgTreeResp;
 import com.xunmei.common.core.enums.OrgTypeEnum;
@@ -26,7 +27,9 @@ import com.xunmei.system.api.vo.SysOrgVO;
 import com.xunmei.system.mapper.SysOrgMapper;
 import com.xunmei.system.mapper.SysUserMapper;
 import com.xunmei.system.service.ISysOrgService;
+import com.xunmei.system.util.OrgPhysicalDefenseConstructionExport;
 import io.netty.util.internal.StringUtil;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
@@ -93,6 +96,62 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
     }
 
     @Override
+    public List<OrgPhysicalDefenseConstructionExport> excel(SysOrg dept) {
+        if (null==dept.getId()){
+            dept.setId(SecurityUtils.getLoginUser().getOrgId());
+        }
+        SysOrg sysOrg = baseMapper.selectSysOrgById(dept.getId());
+        List<SysOrg> sysOrgs;
+        if (sysOrg.getType() < 3 || sysOrg.getShortName().endsWith("地区行社") || sysOrg.getType() == 9) {
+            sysOrgs = this.selectSysOrgByPathAndType(sysOrg.getPath(), 3);
+        }else if (sysOrg.getType() == 3) {
+            sysOrgs = this.selectSysOrgByPathAndType(sysOrg.getPath(), 4);
+        }else {
+            return Collections.emptyList();
+        }
+        List<OrgPhysicalDefenseConstructionExport>orgPhysicalDefenseConstructionExports=new ArrayList<>();
+        sysOrgs.forEach(s->{
+            OrgPhysicalDefenseConstructionExport orgPhysicalDefenseConstructionExport=new OrgPhysicalDefenseConstructionExport();
+            SysOrg sysOrg1;
+            if (sysOrg.getType() < 3 || sysOrg.getShortName().endsWith("地区行社") || sysOrg.getType() == 9) {
+                 sysOrg1 = sysOrgMapper.selectSysOrgById(s.getParentId());
+            } else {
+                sysOrg1 = sysOrgMapper.selectSysOrgById(sysOrgMapper.selectSysOrgById(s.getParentId()).getParentId());
+                if (-1 == sysOrg1.getShortName().indexOf("地区行社")) {
+                    sysOrg1 = sysOrgMapper.selectSysOrgById(sysOrgMapper.selectSysOrgById(sysOrgMapper.selectSysOrgById(s.getParentId()).getParentId()).getParentId());
+                }
+            }
+            OrgPhysicalDefenseConstructionExport orgPhysicalDefenseConstructionExport1 = baseMapper.complianceStatus(s.getPath());
+            BeanUtils.copyProperties(orgPhysicalDefenseConstructionExport1,orgPhysicalDefenseConstructionExport);
+            orgPhysicalDefenseConstructionExport.setCity(sysOrg1.getShortName().indexOf("地区行社")==-1?sysOrg1.getShortName().substring(0,2):sysOrg1.getShortName().split("地区行社")[0]);
+            Integer integer = baseMapper.selectNetworkNumberByPath(s.getPath());
+            orgPhysicalDefenseConstructionExport.setNetworkNumber(integer);
+            orgPhysicalDefenseConstructionExport.setOrgName(s.getShortName());
+
+            //年度完成
+            Integer s1 = baseMapper.rectificationStatus(s.getPath(), "2023");
+            //2015改造
+            Integer s2 = baseMapper.oldRectificationStatus(s.getPath(), "2023");
+            //未完成改造
+            Integer s3 = baseMapper.noRectificationStatus(s.getPath(), "2023");
+            orgPhysicalDefenseConstructionExport.setNewYearReachNumber(s1);
+            orgPhysicalDefenseConstructionExport.setNewYeaTransformOldReachNumber(s2);
+            orgPhysicalDefenseConstructionExport.setNewYeaTransformInconformityNumber(s3);
+            orgPhysicalDefenseConstructionExports.add(orgPhysicalDefenseConstructionExport);
+        });
+        return orgPhysicalDefenseConstructionExports;
+    }
+
+    @Override
+    public List<SysOrg> selectSysOrgByPathAndType(String path, Integer type) {
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.likeRight("path", path);
+        queryWrapper.eq("type",type);
+        queryWrapper.eq("deleted",0);
+        return sysOrgMapper.selectList(queryWrapper);
+    }
+
+    @Override
     public List<Long> selectCheckSubOrgIdList(Long orgId) {
         return sysOrgMapper.selectCheckSubOrgIdList(orgId);
     }

+ 58 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgPhysicalDefenseConstructionExport.java

@@ -0,0 +1,58 @@
+package com.xunmei.system.util;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author :LuoWei
+ * @date : 2023/11/27
+ */
+@Data
+@ColumnWidth(15) //列宽,最大值为255
+@HeadRowHeight(16) //表头行高
+@ContentRowHeight(16) //数据行高
+public class OrgPhysicalDefenseConstructionExport {
+    @ExcelProperty(value = "序号", index = 0)
+    @TableField(exist = false)
+    private String xh;
+    @ExcelProperty(value = "地区", index = 1)
+    private String city;
+    @ExcelProperty(value = "行社", index = 2)
+    private String orgName;
+    @ExcelProperty(value = "网点数量", index = 3)
+    @ApiModelProperty(value = "网点数量")
+    private Integer networkNumber;
+    @ExcelProperty(value = "营业网点达标率", index = 4)
+
+    @ApiModelProperty(value = "营业网点达标率")
+    private String reachRate;
+    @ExcelProperty(value = {"符合GA38-2015,GA38-2021网点合计数量","符合GA38-2015,GA38-2021网点合计数量","符合GA38-2015,GA38-2021网点合计数量","符合GA38-2015,GA38-2021网点合计数量"}, index = 5)
+
+    @ApiModelProperty(value = "符合GA38-2015,GA38-2021网点合计数量")
+    private Integer reachNumber;
+    @ExcelProperty(value = "其中,符合GA38-2015网点数量", index = 6)
+
+    @ApiModelProperty(value = "其中,符合GA38-2015网点数量")
+    private Integer oldReachNumber;
+    @ExcelProperty(value = "其中,符合GA38-2021网点数量", index = 7)
+
+    @ApiModelProperty(value = "其中,符合GA38-2021网点数量")
+    private Integer newReachNumber;
+    @ExcelProperty(value = "已完成GA38-2021达标改造网点合计数量", index = 8)
+
+    @ApiModelProperty(value = "已完成GA38-2021达标改造网点合计数量")
+    private Integer newYearReachNumber;
+    @ExcelProperty(value = "其中,改造原有符合GA38-2015网点数量", index = 9)
+
+    @ApiModelProperty(value = "其中,改造原有符合GA38-2015网点数量")
+    private Integer newYeaTransformOldReachNumber;
+    @ExcelProperty(value = "其中,改造未符合GA38-2015网点数量", index = 10)
+
+    @ApiModelProperty(value = "其中,改造未符合GA38-2015网点数量")
+    private Integer newYeaTransformInconformityNumber;
+}

+ 2 - 2
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/SecurityUserExport.java

@@ -50,9 +50,9 @@ public class SecurityUserExport {
     private Date entryTime;
     @ExcelProperty(value = "工作年限", index = 12)
     private String workDuration;
-    @ExcelProperty(value="最高学历", index = 13)
+    @ExcelProperty(value= {"学历","最高学历"}, index = 13)
     private String highestEducation;
-    @ExcelProperty(value = "取得方式", index = 14)
+    @ExcelProperty(value = {"学历","取得方式"}, index = 14)
     private String educationType;
     @ExcelProperty(value = "初级以上(含初级)相关专业技术职业资格", index = 15)
     private String professionalQualifications;

+ 76 - 0
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysOrgMapper.xml

@@ -698,5 +698,81 @@ and
             #{type}
         </foreach>
     </select>
+    <select id="selectNetworkNumberByPath" resultType="java.lang.Integer">
+        SELECT COUNT(1) FROM sys_org WHERE path LIKE  concat( #{orgPath}, '%') AND type=4 AND deleted=0
+    </select>
+    <select id="complianceStatus" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionExport">
+        SELECT
+            IFNULL( SUM( IF ( a.standard IN ( 1, 2 ), 1, 0 )), 0 ) AS reachNumber,
+            IFNULL( SUM( IF ( a.standard = 2, 1, 0 )), 0 ) AS oldReachNumber,
+            IFNULL( SUM( IF ( a.standard = 1, 1, 0 )), 0 ) AS newReachNumber,
+            IFNULL(
+                    CONCAT(
+                            ROUND( SUM( IF ( a.standard IN ( 1, 2 ), 1, 0 ))/ COUNT( b.id )* 100, 2 ),
+                            '%'
+                        ),
+                    '0%'
+                ) AS reachRate
+        FROM
+            sys_org_physical_defense_construction a
+                LEFT JOIN sys_org b ON a.org_id = b.id
+        WHERE
+            b.path LIKE concat(#{orgPath}, '%')
+    </select>
+
+    <select id="rectificationStatus" resultType="java.lang.Integer">
+        SELECT
+       IFNULL(SUM(IF(a.standard=1,1,0)),0)
+        FROM
+            sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
+        WHERE
+            a.date_of_compliance LIKE concat(#{year}, '%') AND b.path LIKE concat(#{orgPath}, '%')
+    </select>
+    <select id="oldRectificationStatus" resultType="java.lang.Integer">
+        SELECT
+            COUNT( DISTINCT a.org_id )
+        FROM
+            sys_org_physical_defense_construction a
+                INNER JOIN sys_org b ON a.org_id = b.id
+        WHERE
+                a.org_id IN (
+                SELECT
+                    org_id
+                FROM
+                    sys_org_physical_defense_construction
+                GROUP BY
+                    org_id
+                HAVING
+                        (
+                                IF
+                                    ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
+                                IF
+                                    ( LOCATE( 2, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
+                   AND date_of_compliance LIKE concat(#{year}, '%')
+            )AND b.path LIKE concat(#{orgPath}, '%')
+    </select>
+    <select id="noRectificationStatus" resultType="java.lang.Integer">
+        SELECT
+            COUNT( DISTINCT org_id )
+        FROM
+            sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
+        WHERE
+                org_id IN (
+                SELECT
+                    GROUP_CONCAT( DISTINCT org_id )
+                FROM
+                    sys_org_physical_defense_construction
+                GROUP BY
+                    org_id
+                HAVING
+                        (
+                                IF
+                                    ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
+                                IF
+                                    ( LOCATE( 3, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
+                   AND date_of_compliance LIKE concat(#{year}, '%')
+            ) AND b.path LIKE concat(#{orgPath}, '%')
+    </select>
+
 
 </mapper>