Quellcode durchsuchen

给任务传计划id

luowei vor 2 Jahren
Ursprung
Commit
3356a93a7d

+ 18 - 15
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/impl/TMonitoringRetrievalPlanServiceImpl.java

@@ -22,6 +22,7 @@ import com.xunmei.system.api.domain.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
@@ -36,8 +37,8 @@ import java.util.List;
 @Lazy
 @Service
 public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoringRetrievalPlanMapper, TMonitoringRetrievalPlan> implements ITMonitoringRetrievalPlanService {
-    private static final Long MINUS_ONE = -1L;
-    private static final Long ZERO = 0L;
+    private static final Integer MINUS_ONE = -1;
+    private static final Integer ZERO = 0;
     @Autowired
     private TMonitoringRetrievalPlanMapper tMonitoringRetrievalPlanMapper;
     @Autowired
@@ -53,7 +54,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
     @Override
     public TableDataInfo<TMonitoringRetrievalPlan> selectPage(TMonitoringRetrievalPlan tMonitoringRetrievalPlan) {
         //未删除
-        tMonitoringRetrievalPlan.setIsDeleted(ZERO);
+        tMonitoringRetrievalPlan.setIsDeleted(ZERO.longValue());
         Page<TMonitoringRetrievalPlan> page;
         //分页
         if (tMonitoringRetrievalPlan.getPageNum() != null && tMonitoringRetrievalPlan.getPageSize() != null) {
@@ -68,7 +69,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         QueryWrapper<TMonitoringRetrievalPlan> query = new QueryWrapper<>(tMonitoringRetrievalPlan);
         //下穿
         tMonitoringRetrievalPlan.setCheckSub(true);
-        List<SysOrg> data = remoteOrgService.selectSysOrgByParentId(MINUS_ONE, SecurityConstants.INNER);
+        List<SysOrg> data = remoteOrgService.selectSysOrgByParentId(MINUS_ONE.longValue(), SecurityConstants.INNER);
         if (null == tMonitoringRetrievalPlan.getOrgId()) {
             tMonitoringRetrievalPlan.setOrgId(data.get(0).getId());
         }
@@ -112,10 +113,10 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
     public int distribute(Long id) {
         //查询
         TMonitoringRetrievalPlan tMonitoringRetrievalPlan = tMonitoringRetrievalPlanMapper.selectById(id);
-        tMonitoringRetrievalPlan.setPlanStatus(0);
+        tMonitoringRetrievalPlan.setPlanStatus(ZERO);
         tMonitoringRetrievalPlanMapper.updateById(tMonitoringRetrievalPlan);
-        List<SysOrg> list = remoteOrgService.selectSysOrgByParentId(MINUS_ONE, SecurityConstants.INNER);
-        Integer i = 0;
+        List<SysOrg> list = remoteOrgService.selectSysOrgByParentId(MINUS_ONE.longValue(), SecurityConstants.INNER);
+        Integer i = ZERO;
         List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
         for (SysOrg l : list) {
             TMonitoringRetrievalPlan monitoringRetrievalPlan = new TMonitoringRetrievalPlan();
@@ -129,20 +130,21 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
             monitoringRetrievalPlan.setRoleId(tMonitoringRetrievalPlan.getRoleId());
             monitoringRetrievalPlan.setPlanCycle(tMonitoringRetrievalPlan.getPlanCycle());
             monitoringRetrievalPlan.setPlanFrequency(tMonitoringRetrievalPlan.getPlanFrequency());
-            monitoringRetrievalPlan.setPlanStatus(0);
+            monitoringRetrievalPlan.setPlanStatus(ZERO);
             monitoringRetrievalPlan.setCreateBy(SecurityUtils.getUsername());
             monitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
             monitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
             monitoringRetrievalPlan.setCreateTime(DateUtils.getNowDate());
             monitoringRetrievalPlan.setDescription(tMonitoringRetrievalPlan.getDescription());
             monitoringRetrievalPlan.setCreateType(1);
+            monitoringRetrievalPlan.setId(IdWorker.getId());
             i = tMonitoringRetrievalPlanMapper.insert(monitoringRetrievalPlan);
             tMonitoringRetrievalPlans.add(monitoringRetrievalPlan);
-            if (i < 0) {
+            if (i < ZERO) {
                 return i;
             }
         }
-        if (tMonitoringRetrievalPlan.getPlanCycle().equals("0")) {
+        if (tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) {
             iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
         }
         return i;
@@ -177,20 +179,21 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         tMonitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
         SysRole sysRole = remoteRoleService.getRoleById(tMonitoringRetrievalPlan.getRoleId(), SecurityConstants.INNER);
         tMonitoringRetrievalPlan.setRoleName(sysRole.getRoleName());
+        long id = IdWorker.getId();
+        tMonitoringRetrievalPlan.setId(id);
         if (tMonitoringRetrievalPlan.getOrgType().equals("1")) {
             tMonitoringRetrievalPlan.setPlanStatus(1);
-            tMonitoringRetrievalPlan.setCreateType(0);
+            tMonitoringRetrievalPlan.setCreateType(ZERO);
         } else {
-            tMonitoringRetrievalPlan.setPlanStatus(0);
+            tMonitoringRetrievalPlan.setPlanStatus(ZERO);
             tMonitoringRetrievalPlan.setCreateType(1);
             //无周期调用
-            if (tMonitoringRetrievalPlan.getPlanCycle().equals("0")) {
+            if (tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) {
                 List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
                 tMonitoringRetrievalPlans.add(tMonitoringRetrievalPlan);
                 iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
             }
         }
-        tMonitoringRetrievalPlan.setId(IdWorker.getId());
         return tMonitoringRetrievalPlanMapper.insert(tMonitoringRetrievalPlan);
     }
 
@@ -214,7 +217,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
      */
     @Override
     public int deleteTMonitoringRetrievalPlanByIds(Long[] ids) {
-        int i = 0;
+        int i = ZERO;
         for (Long id : ids) {
             TMonitoringRetrievalPlan tMonitoringRetrievalPlan = new TMonitoringRetrievalPlan();
             tMonitoringRetrievalPlan.setIsDeleted(2L);