luowei vor 1 Jahr
Ursprung
Commit
db68fb3888

+ 5 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/controller/TMonitoringRetrievalPlanController.java

@@ -12,6 +12,7 @@ import com.xunmei.common.security.annotation.RequiresPermissions;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.access.domain.TMonitoringRetrievalPlan;
 import com.xunmei.core.access.service.ITMonitoringRetrievalPlanService;
+import com.xunmei.core.access.vo.TMonitoringRetrievalPlanVO;
 import com.xunmei.core.reportForms.monitor.dto.MonitoringAccessDTO;
 import com.xunmei.core.reportForms.monitor.service.MonitorAccessReportService;
 import com.xunmei.system.api.RemoteOrgService;
@@ -53,7 +54,7 @@ public class TMonitoringRetrievalPlanController extends BaseController {
     @GetMapping("/list")
     public AjaxResult list(TMonitoringRetrievalPlan tMonitoringRetrievalPlan) {
         AjaxResult ajax = AjaxResult.success();
-        TableDataInfo<TMonitoringRetrievalPlan> tMonitoringRetrievalPlanTableDataInfo = tMonitoringRetrievalPlanService.selectPage(tMonitoringRetrievalPlan);
+        TableDataInfo<TMonitoringRetrievalPlanVO> tMonitoringRetrievalPlanTableDataInfo = tMonitoringRetrievalPlanService.selectPage(tMonitoringRetrievalPlan);
         ajax.put("data", tMonitoringRetrievalPlanTableDataInfo);
         boolean admin = false;
         R<String> r = remoteRoleService.selectRoleNameByUserId(SecurityUtils.getUserId(), SecurityConstants.INNER);
@@ -85,9 +86,9 @@ public class TMonitoringRetrievalPlanController extends BaseController {
      */
     @ApiOperation(value = "下发")
     @RequiresPermissions("core:accessPlan:add")
-    @GetMapping(value = "/distribute/{id}")
-    public AjaxResult distribute(@PathVariable(value = "id", required = false) Long id) throws ParseException {
-        return success(tMonitoringRetrievalPlanService.distribute(id));
+    @GetMapping(value = "/distribute/{id}/{immediateEffect}")
+    public AjaxResult distribute(@PathVariable(value = "id", required = false) Long id, @PathVariable Boolean immediateEffect) throws ParseException {
+        return success(tMonitoringRetrievalPlanService.distribute(id,immediateEffect));
     }
 
     /**

+ 4 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/ITMonitoringRetrievalPlanService.java

@@ -30,10 +30,12 @@ public interface ITMonitoringRetrievalPlanService extends IService<TMonitoringRe
      * @param id
      * @return
      */
-    int distribute(Long id) throws ParseException;
+    int distribute(Long id, Boolean immediateEffect) throws ParseException;
 
     int withdraw(Long id);
 
+    boolean getIsComplete(Long id);
+
     /**
      * 查询监控调阅计划列表
      *
@@ -80,5 +82,5 @@ public interface ITMonitoringRetrievalPlanService extends IService<TMonitoringRe
      * @param tMonitoringRetrievalPlan 查询条件对象
      * @return Page
      */
-    TableDataInfo<TMonitoringRetrievalPlan> selectPage(TMonitoringRetrievalPlan tMonitoringRetrievalPlan);
+    TableDataInfo<TMonitoringRetrievalPlanVO> selectPage(TMonitoringRetrievalPlan tMonitoringRetrievalPlan);
 }

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

@@ -113,6 +113,9 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         //获取数据
 
         page = tMonitoringRetrievalPlanMapper.selectPageList(page, tMonitoringRetrievalPlan);
+        page.getRecords().forEach(p->{
+            boolean isComplete = this.getIsComplete(p.getId());p.setIsComplete(isComplete);
+        });
         return TableDataInfo.build(page);
     }
 
@@ -159,9 +162,10 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
 
     @Transactional
     @Override
-    public int distribute(Long id) throws ParseException {
+    public int distribute(Long id,Boolean immediateEffect) throws ParseException {
         //查询
         TMonitoringRetrievalPlan tMonitoringRetrievalPlan = tMonitoringRetrievalPlanMapper.selectById(id);
+        tMonitoringRetrievalPlan.setImmediately(immediateEffect);
         tMonitoringRetrievalPlan.setIsDistribute("1");
         tMonitoringRetrievalPlan.setPlanStatus(1);
         tMonitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
@@ -491,8 +495,6 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
 
     @Override
     public int withdraw(Long id) {
-
-        DateRange startAndEnd;
         TMonitoringRetrievalPlan plan = baseMapper.selectById(id);
         QueryWrapper queryWrapper = new QueryWrapper();
         queryWrapper.eq(PARENT_ID, id);
@@ -568,6 +570,41 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         return baseMapper.updateById(plan);
     }
 
+    @Override
+    public boolean getIsComplete(Long id) {
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq(PARENT_ID, id);
+        List<TMonitoringRetrievalPlan> list1 = tMonitoringRetrievalPlanMapper.selectList(queryWrapper);
+        List<Long> collect = new ArrayList<>();
+        //如果有子计划
+        Boolean isComplete=false;
+        if (CollectionUtils.isNotEmpty(list1)) {
+            collect = list1.stream().map(TMonitoringRetrievalPlan::getId).collect(Collectors.toList());
+            List<String>status=new ArrayList<>();
+            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(collect, null);
+            status.add("0");
+            status.add("1");
+            status.add("3");
+            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks1 = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(collect, status);
+            if (coreMonitoringRetrievalTasks.size()==coreMonitoringRetrievalTasks1.size()){
+                isComplete=true;
+            }
+        }else {
+            List<String>status=new ArrayList<>();
+            List<Long>ids=new ArrayList<>();
+            ids.add(id);
+            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(ids, null);
+            status.add("0");
+            status.add("1");
+            status.add("3");
+            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks1 = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(ids, status);
+            if (coreMonitoringRetrievalTasks.size()==coreMonitoringRetrievalTasks1.size()){
+                isComplete=true;
+            }
+        }
+        return isComplete;
+    }
+
     private int getDayNum(int monthsToAdd) {
         LocalDate lastDayOfMonth;
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -667,7 +704,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                 SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
                 List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
                 if (sysOrg1.getType() == 1 && plan.getIsDistribute().equals("1")) {
-                    distribute(plan.getId());
+                    distribute(plan.getId(),false);
                 } else {
                     SysOrg sysOrg = new SysOrg();
                     sysOrg.setPath(plan.getOrgPath());

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/vo/TMonitoringRetrievalPlanVO.java

@@ -19,4 +19,5 @@ public class TMonitoringRetrievalPlanVO extends TMonitoringRetrievalPlan {
     private Boolean isComplete;
     @ApiModelProperty(value = "父类调阅频次")
     private Long parentFrequency;
+
 }