Forráskód Böngészése

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

jingyuanchao 1 éve
szülő
commit
82e8653702

+ 3 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToExecOrgMapper.java

@@ -2,6 +2,7 @@ package com.xunmei.core.resumption.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.xunmei.core.resumption.domain.AppPlanToExecOrg;
+import com.xunmei.core.resumption.domain.AppPlanToPoint;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -20,4 +21,6 @@ import java.util.List;
 public interface AppPlanToExecOrgMapper extends BaseMapper<AppPlanToExecOrg> {
 
     List<AppPlanToExecOrg> selectByPlanId(@Param("planId") Long planId);
+
+    void batchInsertData(@Param("list") List<AppPlanToExecOrg> list);
 }

+ 3 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToItemMapper.java

@@ -2,6 +2,7 @@ package com.xunmei.core.resumption.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.xunmei.core.resumption.domain.AppPlanToPoint;
+import com.xunmei.core.resumption.domain.AppPlanToRole;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -20,4 +21,6 @@ import java.util.List;
 public interface AppPlanToItemMapper extends BaseMapper<AppPlanToPoint> {
 
     List<Long> selectItemIdsByPlanId(@Param("planId") Long planId);
+
+    void batchInsertData(@Param("list") List<AppPlanToPoint> list);
 }

+ 5 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppPlanToRoleMapper.java

@@ -2,9 +2,13 @@ package com.xunmei.core.resumption.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.xunmei.core.resumption.domain.AppPlanToRole;
+import com.xunmei.core.resumption.domain.AppResumptionData;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * 执行角色关联表(core_resumption_plan_to_role)数据Mapper
  *
@@ -15,5 +19,5 @@ import org.springframework.stereotype.Repository;
 @Mapper
 @Repository
 public interface AppPlanToRoleMapper extends BaseMapper<AppPlanToRole> {
-
+    void batchInsertData(@Param("list") List<AppPlanToRole> list);
 }

+ 29 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -72,6 +72,8 @@ import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.support.TransactionSynchronization;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
@@ -268,15 +270,21 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 
                     List<Long> roleList = appPlanToRoleMapper.selectList(new LambdaQueryWrapper<AppPlanToRole>().eq(AppPlanToRole::getPlanId, dto.getId())).stream().map(AppPlanToRole::getRoleId).collect(Collectors.toList());
                     AppPlanToRole atr = null;
+                    List<AppPlanToRole> planToRoles=new ArrayList<>();
                     for (Long roleId : roleList) {
                         atr = new AppPlanToRole();
                         atr.setRoleId(roleId);
                         atr.setPlanId(id);
-                        appPlanToRoleMapper.insert(atr);
+                        planToRoles.add(atr);
+//                        appPlanToRoleMapper.insert(atr);
+                    }
+                    if(planToRoles.size()!=0){
+                        appPlanToRoleMapper.batchInsertData(planToRoles);
                     }
 
                     List<AppPlanToPoint> itemList = appPlanToItemMapper.selectList(new LambdaQueryWrapper<AppPlanToPoint>().eq(AppPlanToPoint::getPlanId, dto.getId()));
                     AppPlanToPoint item = null;
+                    List<AppPlanToPoint> planToPoints =new ArrayList<>();
                     for (AppPlanToPoint ruleItemVo : itemList) {
                         item = new AppPlanToPoint();
                         item.setPointId(ruleItemVo.getPointId());
@@ -284,16 +292,28 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                         item.setPointScan(ruleItemVo.isPointScan());
                         item.setRequired(ruleItemVo.isRequired());
                         item.setOfOrgId(ruleItemVo.getOfOrgId());
+                        planToPoints.add(item);
 //                        item.setEffectiveDate(ruleItemVo.getEffectiveDate());
-                        appPlanToItemMapper.insert(item);
+//                        appPlanToItemMapper.insert(item);
+                    }
+                    if(planToPoints.size()!=0)
+                    {
+                        appPlanToItemMapper.batchInsertData(planToPoints);
                     }
 
+
                     List<AppPlanToExecOrg> execOrgs = appPlanToExecOrgMapper.selectList(new LambdaQueryWrapper<AppPlanToExecOrg>().eq(AppPlanToExecOrg::getPlanId, dto.getId()));
+                    List<AppPlanToExecOrg> planToExecOrgs=new ArrayList<>();
                     for (AppPlanToExecOrg execOrg : execOrgs) {
                         AppPlanToExecOrg n = new AppPlanToExecOrg();
                         n.setPlanId(id);
                         n.setOrgId(execOrg.getOrgId());
-                        appPlanToExecOrgMapper.insert(n);
+                        planToExecOrgs.add(n);
+//                        appPlanToExecOrgMapper.insert(n);
+                    }
+                    if(planToExecOrgs.size()!=0)
+                    {
+                        appPlanToExecOrgMapper.batchInsertData(planToExecOrgs);
                     }
                 }
             }
@@ -321,7 +341,12 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         }
 
         if (immediateEffect) {
-            resumptionTaskBusiness.rebuildCurrentCycleTask(hsPlans, dto.getId());
+            TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
+                @Override
+                public void afterCommit() {
+                    resumptionTaskBusiness.rebuildCurrentCycleTask(hsPlans, dto.getId());
+                }
+            });
         }
     }
 

+ 14 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppPlanToExecOrgMapper.xml

@@ -12,4 +12,18 @@
     <select id="selectByPlanId" resultType="com.xunmei.core.resumption.domain.AppPlanToExecOrg">
         select * from core_resumption_plan_to_exec_org where plan_id = #{planId}
     </select>
+
+    <insert id="batchInsertData" parameterType="java.util.List">
+        INSERT INTO `core_resumption_plan_to_exec_org` (
+        `plan_id`,
+        `org_id`
+        )
+        VALUES
+        <foreach collection="list" item="item" index="index"  separator="," >
+            (
+            #{item.planId},
+            #{item.orgId}
+            )
+        </foreach>
+    </insert>
 </mapper>

+ 20 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppPlanToItemMapper.xml

@@ -14,4 +14,24 @@
         from core_resumption_plan_to_point
         where plan_id = #{planId}
     </select>
+
+    <insert id="batchInsertData" parameterType="java.util.List">
+        INSERT INTO `core_resumption_plan_to_point` (
+        `plan_id`,
+        `point_id`,
+        `point_scan`,
+        `required`,
+        `of_org_id`
+        )
+        VALUES
+        <foreach collection="list" item="item" index="index"  separator="," >
+        (
+            #{item.planId},
+            #{item.pointId},
+            #{item.pointScan},
+            #{item.required},
+            #{item.ofOrgId}
+        )
+        </foreach>
+    </insert>
 </mapper>

+ 14 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppPlanToRoleMapper.xml

@@ -9,4 +9,18 @@
         plan_id,role_id
     </sql>
 
+    <insert id="batchInsertData" parameterType="java.util.List">
+        INSERT INTO `core_resumption_plan_to_role` (
+        `plan_id`,
+        `role_id`
+        )
+        VALUES
+        <foreach collection="list" item="item" index="index"  separator="," >
+            (
+            #{item.planId},
+            #{item.roleId}
+            )
+        </foreach>
+    </insert>
+
 </mapper>

+ 11 - 10
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/api/service/impl/VideoDiagnosisRecordServiceImpl.java

@@ -292,15 +292,16 @@ public class VideoDiagnosisRecordServiceImpl extends ServiceImpl<VideoDiagnosisR
             throw new RuntimeException(e.getMessage());
         }
 
-        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
-            @Override
-            public void afterCommit() {
-                try {
-                    iotAlarmDataService.dealVideoDiagnosisData(videoDiagnosis);
-                } catch (Exception e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        });
+        // TODO 25号版本先关闭视频类告警, 523版本通过 系统参数控制
+//        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
+//            @Override
+//            public void afterCommit() {
+//                try {
+//                    iotAlarmDataService.dealVideoDiagnosisData(videoDiagnosis);
+//                } catch (Exception e) {
+//                    throw new RuntimeException(e);
+//                }
+//            }
+//        });
     }
 }