Ver código fonte

安全指数代码提交

jingyuanchao 1 ano atrás
pai
commit
496005d94d

+ 4 - 5
project_data/sql/0.0.3/soc/soc.sql

@@ -112,7 +112,6 @@ CREATE TABLE if not exists `core_safety_deduct_data` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='安全指数扣分表';
 
 
-
 -- 新增安全指数字典表
 delete from core_safety_dict;
 INSERT ignore INTO core_safety_dict (id, code, parent_code, name) VALUES (52, '1004', '-1', '安保履职');
@@ -171,10 +170,10 @@ INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator
 -- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846720301350913, 3846720300892160, '两次整改问题数', 3, null, 3, 3, null, now(), null, now(), null);
 -- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846720301350914, 3846720300892160, '三次或三次以上整改问题数', 3, null, 4, 5, null, now(), null, now(), null);
 -- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846720301350915, 3846720300892160, '超期整改问题数', 3, null, 1, 0.6, null, now(), null, now(), null);
-INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180032, 3846721706754048, '超期整改问题数', 3, null, 1, 0.6, null, now(), null, now(), null);
-INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180033, 3846721706754048, '三次或三次以上整改问题数', 3, null, 4, 5, null, now(), null, now(), null);
-INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180034, 3846721706754048, '超期未整改问题数量', 3, null, 2, 1, null, now(), null, now(), null);
-INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180035, 3846721706754048, ' 两次整改问题数', 3, null, 3, 3, null, now(), null, now(), null);
+INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180032, 3846721706754048, '超期整改问题数', 1, null, 1, 0.6, null, now(), null, now(), null);
+-- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180033, 3846721706754048, '三次或三次以上整改问题数', 3, null, 4, 5, null, now(), null, now(), null);
+-- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180034, 3846721706754048, '超期未整改问题数量', 3, null, 2, 1, null, now(), null, now(), null);
+-- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846721707180035, 3846721706754048, ' 两次整改问题数', 3, null, 3, 3, null, now(), null, now(), null);
 -- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846723149578240, 3846723149234176, '超期整改问题数', 3, null, 1, 0.6, null, now(), null, now(), null);
 -- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846723149578241, 3846723149234176, '三次或三次以上整改问题数', 3, null, 4, 5, null,now(), null, now(), null);
 -- INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator_note, calculate_type, indicator_days, item_type, item_value, order_num, create_time, create_by, update_time, update_by) VALUES (3846723149578242, 3846723149234176, '超期未整改问题数量', 3, null, 2, 1, null, now(), null, now(), null);

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

@@ -372,8 +372,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
 
     private void updateCommonPlan(CoreDrillPlan plan, CoreDrillPlanUpdateDto request, DateRange range) {
         CoreDrillPlan parentPlan = coreDrillPlanMapper.selectOne(new LambdaQueryWrapper<CoreDrillPlan>()
-                .eq(CoreDrillPlan::getId, plan.getParentId())
-                .select(CoreDrillPlan::getExecTimes));
+                .eq(CoreDrillPlan::getId, plan.getParentId()));
         //使用中的普通计划
         if (parentPlan.getExecTimes() > request.getExecTimes()) {
             throw new RuntimeException("执行次数不能小于基准计划执行次数!");
@@ -387,7 +386,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             } else {
                 errorMsg = "当前用户身份仅允许修改子任务的任务次数!";
             }
-            validatePlanForStandard(request, plan, errorMsg, sysOrg.getType());
+            validatePlanForStandard(request, parentPlan, errorMsg, sysOrg.getType());
         }
         doUpdatePlan(plan, request);
         final long done = coreDrillTaskMapper.selectCount(new LambdaQueryWrapper<CoreDrillTask>()
@@ -442,7 +441,10 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
         validateListForStandard(execOrgIdList, request.getPlanExecOrgIdList(), errorMsg);
         validateFieldForStandard(request.getRemark(), plan.getRemark(), errorMsg);
         validateFileListForStandard(request.getFileList(), JSON.parseArray(plan.getFileList(), String.class), errorMsg);
-
+        if (plan.getPlanCycle().equals(EduTrainingPlanCycleEnum.NONE.getCode())){
+            validateFieldForStandard(request.getStartDate(), plan.getPlanStartDate(), errorMsg);
+            validateFieldForStandard(request.getEndDate(), plan.getPlanEndDate(), errorMsg);
+        }
         if (OrgTypeEnum.HANG_SHE.equals(OrgTypeEnum.getOrgTypeEnum(type))) {
             //标准计划可以修改名称,行社不允许修改名称
             validateFieldForStandard(request.getPlanName(), plan.getPlanName(), errorMsg);

+ 15 - 14
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyExceptionDataServiceImpl.java

@@ -339,6 +339,10 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
                     CoreSafetySourceData safeSourceData = doNewSafetySourceData(config, orgId, deductScore, year, month, count);
                     sourceDataList.add(safeSourceData);
                 });
+        if (1 == 1) {
+            //下面的代码暂时不用
+            return sourceDataList;
+        }
 
         //获取连续数的配置,并根据配置的连续数日期进行倒序
         List<SafeIndexRuleCountVo> monitoringContinuousNums = orgMonitoringIndexList.stream()
@@ -417,7 +421,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
                 List<CoreSafetyExceptionData> safetyExceptionData = questionExceptionDataList.get(orgId);
                 //未确认的数据
-                long unConfirmDataCount = safetyExceptionData.stream().filter(data -> ObjectUtil.equal(data.getExtraField2(), 2)).count();
+                long unConfirmDataCount = safetyExceptionData.stream().filter(data -> ObjectUtil.equal(data.getExtraField2(), 0)).count();
                 //未整改的数据
                 long unRectifyDataCount = safetyExceptionData.stream().filter(data -> ObjectUtil.notEqual(data.getExtraField2(), 2)).count();
                 List<CoreSafetySourceData> sourceDataList = new ArrayList<>();
@@ -796,10 +800,9 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
     @Override
     public void deleteAndUpdateByOrgIdAndDataTime(List<Long> orgIds, DateTime startTime, DateTime endTime, CoreSafetyIndexReCalculateDto request) {
-        startTime = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"));
-        endTime = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"));
+
         //删除异常数据
-        baseMapper.deleteAndUpdateByOrgIdAndDataTime(orgIds, startTime, endTime);
+        coreSafetyExceptionDataMapper.deleteAndUpdateByOrgIdAndDataTime(orgIds, startTime, endTime);
         //重新拉起数据
         //安保履职
         doResumptionExceptionData(orgIds, startTime, endTime, request);
@@ -815,12 +818,10 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
 
     @Override
     public void reCalculate(CoreSafetyIndexReCalculateDto request) {
-
-        List<SysOrg> sysOrgList = orgService.selectSysOrgByParentId(request.getOrgId(), SecurityConstants.INNER);
-        DateTime time = new DateTime();
-        DateTime startTime = time.setField(DateField.YEAR, request.getYear())
-                .setField(DateField.MONTH, request.getMonth() - 1)
-                .setField(DateField.DAY_OF_MONTH, 1);
+        List<SysOrg> sysOrgList = orgService.selectOrgTreeListByCurOrgId(request.getOrgId(), SecurityConstants.INNER);
+        //List<SysOrg> sysOrgList = orgService.selectSysOrgByParentId(request.getOrgId(), SecurityConstants.INNER);
+        DateTime time = DateUtil.offsetMonth(new Date(), -1);
+        DateTime startTime = DateUtil.beginOfMonth(time);
         DateTime endTime = DateUtil.endOfMonth(startTime);
         request.setQuarter(startTime.quarter());
         //删除现有的异常数据,并重新拉取数据计算
@@ -829,17 +830,17 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
     }
 
 
-    private String getOrgName(Long orgId){
+    private String getOrgName(Long orgId) {
         Optional<SysOrgVO> optional = orgList.stream().filter(org -> ObjectUtil.equal(org.getId(), orgId)).findFirst();
-        if (optional.isPresent()){
+        if (optional.isPresent()) {
             return optional.get().getShortName();
         }
         return StringUtil.EMPTY_STRING;
     }
 
-    private String getOrgPath(Long orgId){
+    private String getOrgPath(Long orgId) {
         Optional<SysOrgVO> optional = orgList.stream().filter(org -> ObjectUtil.equal(org.getId(), orgId)).findFirst();
-        if (optional.isPresent()){
+        if (optional.isPresent()) {
             return optional.get().getPath();
         }
         return StringUtil.EMPTY_STRING;

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafeMonthScoreMapper.xml

@@ -209,7 +209,7 @@
         insert into core_safe_month_score(id,org_id, level_id, data_year, data_month, org_score, release_status, org_path)
             values (#{id},#{orgId},#{levelId},#{dataYear},#{dataMonth},#{orgScore},#{releaseStatus},#{orgPath})
         ON DUPLICATE KEY UPDATE id = VALUES(id), level_id = VALUES(level_id), org_score = VALUES(org_score),
-                                release_status = VALUES(release_status), org_path = VALUES(org_path);
+                                release_status = VALUES(release_status), org_path = VALUES(org_path),org_name=VALUES(org_name);
     </insert>
 
     <select id="selectDetailVoData"