Przeglądaj źródła

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc into V0.0.2

jiawuxian 1 rok temu
rodzic
commit
7c10e65515

+ 11 - 0
project_data/sql/0.0.3/升级说明.txt

@@ -0,0 +1,11 @@
+
+nacos-中feign配置修改
+1、
+  compression:
+    request:
+      enabled: false
+      min-request-size: 8192
+    response:
+      enabled: false
+2、
+file模块:添加redis连接信息配置

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/mapper/CoreDrillPlanMapper.java

@@ -73,6 +73,7 @@ public interface CoreDrillPlanMapper extends BaseMapper<CoreDrillPlan> {
     CoreDrillPlanDataVo getDetailPlanData(@Param("id") Long id);
 
     List<Long> selectIdByParentId(@Param("planId") Long planId);
+    List<Long> selectIdByParentIdOrId(@Param("planId") Long planId);
 
     List<Long> selectAllIdByParentId(@Param("planId") Long planId);
 

+ 27 - 6
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillPlanServiceImpl.java

@@ -271,8 +271,8 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             doUpdatePlan(plan, request);
             return;
         }
-        final SysOrg sysOrg = orgService.selectTopOrg(SecurityConstants.INNER);
-        if (plan.getStandard() == 1 && ObjectUtil.equal(plan.getCreateOrgId(), sysOrg.getId())) {
+      /*  final SysOrg sysOrg = orgService.selectTopOrg(SecurityConstants.INNER);*/
+        if (plan.getStandard() == 1) {
             //标准计划 且是省联社创建的
             updateStandardPlan(plan, request, range);
         } else {
@@ -317,13 +317,16 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             coreDrillTaskMapper.updateTaskNameByParentPlanId(planId, plan.getPlanName(), range.getStartTime(), range.getEndTime());
         } else {
             doUpdatePlan(plan, request);
-            delAllByParentPlanId(plan.getId());
+            delAllByParentPlanId(plan);
             List<CoreDrillPlan> planList = null;
             if (plan.getIssue() == 1) {
                 planList = buildPlanData(plan, null, false);
             } else {
                 planList = ListUtil.list(true, plan);
             }
+            if (checkOrgType(plan.getExecOrgType())){
+                planList.add(plan);
+            }
             List<CoreDrillPlan> finalPlanList = planList;
             TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
                 @Override
@@ -428,12 +431,23 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
     }
 
 
-    private void delAllByParentPlanId(Long planId) {
-        List<Long> planIdList = coreDrillPlanMapper.selectIdByParentId(planId);
+    private void delAllByParentPlanId(CoreDrillPlan plan) {
+        List<Long> planIdList = coreDrillPlanMapper.selectIdByParentIdOrId(plan.getId());
         if (ObjectUtil.isEmpty(planIdList)) {
             return;
         }
-        coreDrillPlanMapper.deleteBatchIds(planIdList);
+        if (plan.getId().equals(plan.getParentId())){
+            ArrayList<Long> list = new ArrayList<>(planIdList);
+            list.remove(plan.getId());
+            if (!list.isEmpty()){
+                coreDrillPlanMapper.deleteBatchIds(planIdList);
+                coreDrillPlanToRoleMapper.delete(new LambdaQueryWrapper<CoreDrillPlanToRole>()
+                        .in(CoreDrillPlanToRole::getPlanId, planIdList));
+                coreDrillPlanToExecOrgMapper.delete(new LambdaQueryWrapper<CoreDrillPlanToExecOrg>()
+                        .in(CoreDrillPlanToExecOrg::getPlanId, planIdList));
+
+            }
+        }
         coreDrillPlanToRoleMapper.delete(new LambdaQueryWrapper<CoreDrillPlanToRole>()
                 .in(CoreDrillPlanToRole::getPlanId, planIdList));
         coreDrillPlanToExecOrgMapper.delete(new LambdaQueryWrapper<CoreDrillPlanToExecOrg>()
@@ -589,6 +603,10 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             List<Long> collect = planList.stream().map(CoreDrillPlan::getId).collect(Collectors.toList());
             coreDrillPlanMapper.updatePlanStatusByIdList(collect, EduTrainingPlanStatus.USING.getCode());
         }
+        if (checkOrgType(plan.getExecOrgType())){
+            planList.add(plan);
+            plan.setParentId(plan.getId());
+        }
         //下发后修改为使用中
         plan.setPlanStatus(DrillPlanStatus.USING.getCode());
         plan.setIssue(1);
@@ -693,6 +711,9 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
         List<CoreDrillPlanToExecOrg> planToExecOrgs = new ArrayList<>();
         List<CoreDrillPlan> list = new ArrayList<>();
         for (SysOrgVO sysOrg : publishOrgList) {
+            if (checkOrgType(plan.getExecOrgType())){
+                continue;
+            }
             CoreDrillPlan drillPlan = new CoreDrillPlan();
             BeanUtils.copyProperties(plan, drillPlan);
             drillPlan.setId(IdWorker.getId());

+ 21 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillTaskServiceImpl.java

@@ -409,7 +409,18 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
         // List<CoreDrillTaskToRole> taskRoleList = new ArrayList<>();
         List<CoreDrillTask> taskList = new ArrayList<>();
         Map<Integer, DateRange> dateRangeMap = DateUtils.splitDateRange(start, end, plan.getExecTimes());
-
+        //获取dateRangeMap中最大和最小的时间
+        Date maxDateRange = dateRangeMap.get(dateRangeMap.size()).getEndTime();
+        Date minDateRange = dateRangeMap.get(1).getStartTime();
+        final List<Long> collect = orgList.stream().map(SysOrg::getId).collect(Collectors.toList());
+        Date date = new Date();
+        final List<CoreDrillTask> trainingTaskList = baseMapper.selectList(new LambdaQueryWrapper<CoreDrillTask>()
+                .in(CoreDrillTask::getOrgId, collect)
+                .ge(CoreDrillTask::getStartDate, minDateRange)
+                .le(CoreDrillTask::getEndDate, maxDateRange)
+                .eq(CoreDrillTask::getPlanId, plan.getId())
+                .select(CoreDrillTask::getId,CoreDrillTask::getOrgId, CoreDrillTask::getStartDate, CoreDrillTask::getEndDate, CoreDrillTask::getPlanId)
+        );
         for (SysOrg org : orgList) {
             for (int i = 1; i <= plan.getExecTimes(); i++) {
                 final LocalDateTime time = DateUtils.toLocalDateTime(DateUtils.getPreciseTime(dateRangeMap.get(i).getEndTime()));
@@ -448,7 +459,15 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
                 trainingTask.setUpdateTime(new Date());
                 trainingTask.setComment(null);
 
-                taskList.add(trainingTask);
+                final Optional<CoreDrillTask> any = trainingTaskList.stream()
+                        .filter(task -> task.getOrgId().equals(org.getId()))
+                        .filter(task -> task.getStartDate().equals(trainingTask.getStartDate()))
+                        .filter(task -> task.getEndDate().equals(trainingTask.getEndDate()))
+                        .filter(task -> task.getPlanId().equals(trainingTask.getPlanId()))
+                        .findAny();
+                if (!any.isPresent()) {
+                    taskList.add(trainingTask);
+                }
                /* for (CoreDrillPlanToRole planToRole : planRoleList) {
                     CoreDrillTaskToRole coreDrillTaskToRole = new CoreDrillTaskToRole();
                     coreDrillTaskToRole.setDrillTaskId(trainingTask.getId());

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/mapper/CoreEduTrainingPlanMapper.java

@@ -77,6 +77,7 @@ public interface CoreEduTrainingPlanMapper extends BaseMapper<CoreEduTrainingPla
     List<CoreEduTrainingPlanPageVo> selectChildrenPlan(@Param("request") CoreEduTrainingPlanPageDto request);
 
     List<Long> selectIdByParentId(@Param("planId") Long planId);
+    List<Long> selectIdByParentIdOrId(@Param("planId") Long planId);
     List<Long> selectAllIdByParentId(@Param("planId") Long planId);
 
     int updatePlanStatus(@Param("planId") Long planId, @Param("status") int status);

+ 29 - 8
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingPlanServiceImpl.java

@@ -265,7 +265,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
             doUpdatePlan(plan, request);
         }
         final SysOrg sysOrg = orgService.selectTopOrg(SecurityConstants.INNER);
-        if (plan.getStandard() == 1 && ObjectUtil.equal(plan.getCreateOrgId(), sysOrg.getId())) {
+        if (plan.getStandard() == 1) {
             //标准计划 且是省联社创建的
             updateStandardPlan(plan, request, range);
         } else {
@@ -360,7 +360,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
             coreEduTrainingTaskMapper.updateTaskNameByParentPlanId(planId, plan.getPlanName(), range.getStartTime(), range.getEndTime());
         } else {
             doUpdatePlan(plan, request);
-            delAllByParentPlanId(planId);
+            delAllByParentPlanId(plan);
 
             List<CoreEduTrainingPlan> planList = null;
             if (plan.getIssue() == 1) {
@@ -368,6 +368,9 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
             } else {
                 planList = ListUtil.list(true, plan);
             }
+            if (checkOrgType(plan.getExecOrgType())) {
+                planList.add(plan);
+            }
             //List<CoreEduTrainingPlan> planList = buildPlanData(plan, null, false);
             List<CoreEduTrainingPlan> finalPlanList = planList;
             TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@@ -392,20 +395,31 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 
     }
 
-    private void delAllByParentPlanId(Long planId) {
-        List<Long> planIdList = coreEduTrainingPlanMapper.selectIdByParentId(planId);
+    private void delAllByParentPlanId(CoreEduTrainingPlan plan) {
+        List<Long> planIdList = coreEduTrainingPlanMapper.selectIdByParentIdOrId(plan.getId());
         if (ObjectUtil.isEmpty(planIdList)) {
             return;
         }
-        coreEduTrainingPlanMapper.deleteBatchIds(planIdList);
+        // 下发给省联社/办事处/行社的计划 在下发时会把id设置为parentId,所以这里不需要删除
+        if (plan.getId().equals(plan.getParentId())) {
+            List<Long> list = new ArrayList<>(planIdList);
+            list.remove(plan.getId());
+            if (!list.isEmpty()) {
+                coreEduTrainingPlanMapper.deleteBatchIds(list);
+
+                coreEduTrainingPlanToRoleMapper.delete(new LambdaQueryWrapper<CoreEduTrainingPlanToRole>()
+                        .in(CoreEduTrainingPlanToRole::getPlanId, list));
+                coreEduTrainingPlanToExecOrgMapper.delete(new LambdaQueryWrapper<CoreEduTrainingPlanToExecOrg>()
+                        .in(CoreEduTrainingPlanToExecOrg::getPlanId, list));
+            }
+        }
+
         coreEduTrainingPlanToRoleMapper.delete(new LambdaQueryWrapper<CoreEduTrainingPlanToRole>()
                 .in(CoreEduTrainingPlanToRole::getPlanId, planIdList));
         coreEduTrainingPlanToExecOrgMapper.delete(new LambdaQueryWrapper<CoreEduTrainingPlanToExecOrg>()
                 .in(CoreEduTrainingPlanToExecOrg::getPlanId, planIdList));
 
         coreEduTrainingTaskService.delByStartTimeAndEndTimeAndPlanIdList(planIdList, null, null);
-
-
     }
 
     private void populateProperties(CoreEduTrainingPlan source, CoreEduTrainingPlan target) {
@@ -598,7 +612,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
             return all.stream().filter(org -> collect.contains(org.getType())).collect(Collectors.toList());*/
 
 
-            return all.stream().filter(org->ObjectUtil.isNotNull(org.getType())).filter(org -> org.getType().equals(plan.getExecOrgType())).collect(Collectors.toList());
+            return all.stream().filter(org -> ObjectUtil.isNotNull(org.getType())).filter(org -> org.getType().equals(plan.getExecOrgType())).collect(Collectors.toList());
         }
     }
 
@@ -620,6 +634,10 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
             List<Long> collect = planList.stream().map(CoreEduTrainingPlan::getId).collect(Collectors.toList());
             coreEduTrainingPlanMapper.updatePlanStatusByIdList(collect, EduTrainingPlanStatus.USING.getCode());
         }
+        if (checkOrgType(plan.getExecOrgType())) {
+            planList.add(plan);
+            plan.setParentId(planId);
+        }
         //下发后修改为使用中
         plan.setPlanStatus(EduTrainingPlanStatus.USING.getCode());
         plan.setIssue(1);
@@ -676,6 +694,9 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         List<CoreEduTrainingPlanToExecOrg> planToExecOrgs = new ArrayList<>();
         List<CoreEduTrainingPlan> list = new ArrayList<>();
         for (SysOrgVO sysOrg : planPublishOrgList) {
+            if (checkOrgType(plan.getExecOrgType())) {
+                continue;
+            }
             CoreEduTrainingPlan coreEduTrainingPlan = new CoreEduTrainingPlan();
             BeanUtils.copyProperties(plan, coreEduTrainingPlan);
             coreEduTrainingPlan.setId(IdWorker.getId());

+ 2 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingTaskServiceImpl.java

@@ -476,7 +476,7 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
                 .ge(CoreEduTrainingTask::getStartDate, minDateRange)
                 .le(CoreEduTrainingTask::getEndDate, maxDateRange)
                 .eq(CoreEduTrainingTask::getPlanId, plan.getId())
-                .select(CoreEduTrainingTask::getId, CoreEduTrainingTask::getStartDate, CoreEduTrainingTask::getEndDate, CoreEduTrainingTask::getPlanId)
+                .select(CoreEduTrainingTask::getId,CoreEduTrainingTask::getOrgId, CoreEduTrainingTask::getStartDate, CoreEduTrainingTask::getEndDate, CoreEduTrainingTask::getPlanId)
         );
         for (SysOrg org : orgList) {
             for (int i = 1; i <= plan.getExecTimes(); i++) {
@@ -490,6 +490,7 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
                 DateRange dateRange = dateRangeMap.get(i);
                 CoreEduTrainingTask trainingTask = new CoreEduTrainingTask();
                 trainingTask.setId(IdWorker.getId());
+                trainingTask.setOrgId(org.getId());
                 trainingTask.setType(plan.getType());
                 trainingTask.setPlanId(plan.getId());
                 trainingTask.setPlanCycle(plan.getPlanCycle());

+ 14 - 6
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/controller/ResumptionReportController.java

@@ -60,10 +60,18 @@ public class ResumptionReportController {
         ajaxResult.put("title", "报警测试报表(" + resumptionDTO.getSearchTime() + ")");
         return ajaxResult;
     }
-//    @ApiOperation(value = "备用电源维护报表")
-//    @RequiresPermissions("core:resumptionReport:list")
-//    @GetMapping("/standbyPower")
-//    public AjaxResult standbyPower(ResumptionDTO resumptionDTO) {
-//
-//    }
+    @ApiOperation(value = "备用电源维护报表")
+    @RequiresPermissions("core:resumptionReport:list")
+    @GetMapping("/standbyPower")
+    public AjaxResult standbyPower(ResumptionDTO resumptionDTO) {
+        if (null == resumptionDTO.getSearchTime()) {
+            LocalDate currentDate = LocalDate.now();
+            resumptionDTO.setSearchTime(currentDate.getYear()+"-"+currentDate.getMonthValue());
+        }
+        AjaxResult ajaxResult = AjaxResult.success();
+        List<IntrusionTestReportVO> intrusionTestReportVOList = resumptionReportService.standbyPower(resumptionDTO);
+        ajaxResult.put(AjaxResult.DATA_TAG, intrusionTestReportVOList);
+        ajaxResult.put("title", "备用电源维护报表(" + resumptionDTO.getSearchTime() + ")");
+        return ajaxResult;
+    }
 }

+ 8 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/service/impl/ResumptionReportServiceImpl.java

@@ -164,7 +164,14 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
             } else {
                 sysOrg1 = orgService.selectOrgById(orgService.selectOrgById(o.getParentId(), SecurityConstants.INNER).getParentId(), SecurityConstants.INNER);
             }
+            IntrusionTestReportVO intrusionTestReportVO1 = resumptionReportMapper.selectStandbyPower(resumptionDTO.getSearchTime(), o.getPath());
+            BeanUtils.copyProperties(intrusionTestReportVO1, intrusionTestReportVO);
+            intrusionTestReportVO.setCity(sysOrg1.getShortName().split("地区行社")[0]);
+            intrusionTestReportVO.setOrgName(o.getShortName());
+            Integer integer = monitorAccessReportMapper.selectNetworkNumberByPath(o.getPath());
+            intrusionTestReportVO.setNetworkNumber(integer);
+            intrusionTestReportVOList.add(intrusionTestReportVO);
         });
-        return null;
+        return intrusionTestReportVOList;
     }
 }

+ 6 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillPlanMapper.xml

@@ -625,6 +625,12 @@
           and deleted = 0
     </select>
 
+    <select id="selectIdByParentIdOrId" resultType="java.lang.Long">
+        select id
+        from core_drill_plan
+        where (parent_id = #{planId} or id = #{planId})
+          and deleted = 0
+    </select>
     <select id="selectPlanRole" resultType="com.xunmei.common.core.domain.drill.vo.CoreDrillPlanRoleVo">
         SELECT distinct r.role_id    as roleId,
                         sr.role_name as roleName

+ 6 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingPlanMapper.xml

@@ -575,6 +575,12 @@
         where parent_id = #{planId}
           and deleted = 0
     </select>
+    <select id="selectIdByParentIdOrId" resultType="java.lang.Long">
+        select id
+        from core_edu_training_plan
+        where (parent_id = #{planId} or id=#{planId})
+          and deleted = 0
+    </select>
 
     <select id="selectAllIdByParentId" resultType="java.lang.Long">
         select id

+ 33 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/ResumptionReportMapper.xml

@@ -83,6 +83,38 @@
     </select>
     <select id="selectStandbyPower"
             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
+        FROM
+            core_resumption a
+                LEFT JOIN core_resumption_plan b ON a.plan_id = b.id
+                LEFT JOIN core_question c ON c.src_task_id = a.id
+                AND reform_status = 11
+        WHERE
+            b.plan_type =5
+        <if test="date !=null">
+            AND a.ymd_date like concat(#{date},'%')
+        </if>
+        <if test="orgPath !=null">
+            and a.org_path  like concat(#{orgPath},'%')
+        </if>
     </select>
 </mapper>

+ 4 - 4
soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/CoreSafecheckPlanMapper.xml

@@ -9,7 +9,7 @@
         <result property="planName" column="plan_name"/>
         <result property="planCycle" column="plan_cycle"/>
         <result property="execOrgType" column="exec_org_type"/>
-        <result property="checkOrgType" column="check_org_type"/>
+<!--        <result property="checkOrgType" column="check_org_type"/>-->
         <result property="planStatus" column="plan_status"/>
         <result property="startDate" column="start_date"/>
         <result property="endDate" column="end_date"/>
@@ -40,7 +40,7 @@
         <result property="planCreateOrgName" column="plan_create_org_name"/>
         <result property="planOfOrgName" column="plan_of_org_name"/>
         <result property="execOrg" column="exec_org"/>
-        <result property="checkOrg" column="check_org"/>
+<!--        <result property="checkOrg" column="check_org"/>-->
         <!-- 角色关系映射 -->
         <collection property="roleList" ofType="com.xunmei.system.api.domain.SysRole">
             <result column="role_name" property="roleName"/>
@@ -192,9 +192,9 @@
     <select id="selectCoreSafecheckPlanPage" resultMap="CoreSafecheckPlanResult">
         SELECT
         GROUP_CONCAT(DISTINCT role_name) as role_names,
-        GROUP_CONCAT( tem.check_org_name) as check_org,
+#         GROUP_CONCAT( tem.check_org_name) as check_org,
         GROUP_CONCAT( tem.exec_org_name) as exec_org,
-        GROUP_CONCAT( tem.dict_label) as type_names,
+        GROUP_CONCAT(DISTINCT tem.dict_label) as type_names,
         tem.*
         FROM
         (