Browse Source

修改需求

luowei 2 years ago
parent
commit
335f306783

+ 1 - 1
project_data/sql/0.0.2/soc/soc.sql

@@ -1031,7 +1031,7 @@ IF
 	-- 调阅计划是否立即生成任务
 	-- 调阅计划是否立即生成任务
     IF
     IF
 NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'core_monitoring_retrieval_plan' AND COLUMN_NAME = 'immediately' ) THEN
 NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'core_monitoring_retrieval_plan' AND COLUMN_NAME = 'immediately' ) THEN
-ALTER TABLE `core_monitoring_retrieval_plan` ADD COLUMN `immediately` VARCHAR ( 2 ) DEFAULT NULL COMMENT '是否立即生成任务1是2否';
+ALTER TABLE `core_monitoring_retrieval_plan` ADD COLUMN `immediately` bit(1) NULL DEFAULT NULL COMMENT '立即生成任务';
 
 
 END IF;
 END IF;
 	-- 履职计划是否下发标识
 	-- 履职计划是否下发标识

+ 3 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/domain/TMonitoringRetrievalPlan.java

@@ -51,8 +51,9 @@ public class TMonitoringRetrievalPlan extends BaseEntity {
     private String planName;
     private String planName;
     @ApiModelProperty(value = "是否显示下发")
     @ApiModelProperty(value = "是否显示下发")
     private String isDistribute;
     private String isDistribute;
-    @ApiModelProperty(value = "是否立即下发")
-    private String immediately;
+    @ApiModelProperty(value = "是否立即生效", notes = "0:否,1:是")
+    private Boolean immediately = Boolean.FALSE;
+
     /**
     /**
      * 计划归属机构
      * 计划归属机构
      */
      */

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

@@ -172,7 +172,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
             i = insertTMonitoringRetrievalPlan(tMonitoringRetrievalPlan1);
             i = insertTMonitoringRetrievalPlan(tMonitoringRetrievalPlan1);
             if (tMonitoringRetrievalPlan.getOrgType().equals("3")) {
             if (tMonitoringRetrievalPlan.getOrgType().equals("3")) {
                 if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
                 if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
-                        tMonitoringRetrievalPlan.getImmediately().equals("1")) {
+                        tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
                     tMonitoringRetrievalPlan1.setStartTime(new Date());
                     tMonitoringRetrievalPlan1.setStartTime(new Date());
                     int amount = 0;
                     int amount = 0;
                     LocalDate lastDayOfMonth;
                     LocalDate lastDayOfMonth;
@@ -232,7 +232,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                     plan.setParentId(tMonitoringRetrievalPlan.getId());
                     plan.setParentId(tMonitoringRetrievalPlan.getId());
                     plan.setIsDistribute("1");
                     plan.setIsDistribute("1");
                     if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
                     if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
-                            tMonitoringRetrievalPlan.getImmediately().equals("1")) {
+                            tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
                         plan.setStartTime(new Date());
                         plan.setStartTime(new Date());
                         int amount = 0;
                         int amount = 0;
                         LocalDate lastDayOfMonth;
                         LocalDate lastDayOfMonth;
@@ -268,7 +268,8 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                 }
                 }
             }
             }
         }
         }
-        if ((tMonitoringRetrievalPlan.getImmediately().equals("1") || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
+        SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
+        if (sysOrg1.getType() == 1 && (tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
             try {
             try {
                 iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
                 iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
             } catch (Exception e) {
             } catch (Exception e) {
@@ -369,7 +370,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                 plan.setParentId(tMonitoringRetrievalPlan.getId());
                 plan.setParentId(tMonitoringRetrievalPlan.getId());
                 plan.setIsDistribute("1");
                 plan.setIsDistribute("1");
                 if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
                 if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
-                        tMonitoringRetrievalPlan.getImmediately().equals("1")) {
+                        tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
                     plan.setStartTime(new Date());
                     plan.setStartTime(new Date());
                     int amount = 0;
                     int amount = 0;
                     LocalDate lastDayOfMonth;
                     LocalDate lastDayOfMonth;
@@ -403,7 +404,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                 }
                 }
                 tMonitoringRetrievalPlans.add(plan);
                 tMonitoringRetrievalPlans.add(plan);
             }
             }
-            if ((tMonitoringRetrievalPlan.getImmediately().equals("1") || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
+            if ((tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
                 try {
                 try {
                     iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
                     iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
                 } catch (Exception e) {
                 } catch (Exception e) {
@@ -446,7 +447,80 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
             QueryWrapper queryWrapper = new QueryWrapper();
             QueryWrapper queryWrapper = new QueryWrapper();
             queryWrapper.eq("parent_id", plan.getId());
             queryWrapper.eq("parent_id", plan.getId());
             baseMapper.delete(queryWrapper);
             baseMapper.delete(queryWrapper);
-            distribute(plan.getId());
+            SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
+            List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
+            if (sysOrg1.getType() == 1) {
+                distribute(plan.getId());
+            } else {
+                SysOrg sysOrg = new SysOrg();
+                sysOrg.setPath(plan.getOrgPath());
+                sysOrg.setType(Integer.valueOf(tMonitoringRetrievalPlan.getOrgType()));
+                List<SysOrg> sysOrgs = remoteOrgService.listByParentIdAndType(sysOrg, SecurityConstants.INNER);
+                for (SysOrg s : sysOrgs) {
+                    TMonitoringRetrievalPlan plan1 = new TMonitoringRetrievalPlan();
+                    BeanUtils.copyProperties(tMonitoringRetrievalPlan, plan1);
+                    plan1.setPlanName(tMonitoringRetrievalPlan.getPlanName());
+                    plan1.setOrgId(s.getId());
+                    plan1.setOrgName(s.getShortName());
+                    plan1.setRoleId(tMonitoringRetrievalPlan.getRoleId());
+                    plan1.setRoleName(tMonitoringRetrievalPlan.getRoleName());
+                    plan1.setOrgPath(s.getPath());
+                    plan1.setOrgType(tMonitoringRetrievalPlan.getOrgType());
+                    plan1.setPlanCycle(tMonitoringRetrievalPlan.getPlanCycle());
+                    plan1.setPlanFrequency(tMonitoringRetrievalPlan.getPlanFrequency());
+                    plan1.setPlanStatus(ZERO);
+                    plan1.setCreateBy(SecurityUtils.getUsername());
+                    plan1.setUpdateTime(DateUtils.getNowDate());
+                    plan1.setUpdateBy(SecurityUtils.getUsername());
+                    plan1.setCreateTime(DateUtils.getNowDate());
+                    plan1.setDescription(tMonitoringRetrievalPlan.getDescription());
+                    plan1.setCreateType(1);
+                    plan1.setParentId(tMonitoringRetrievalPlan.getId());
+                    plan1.setIsDistribute("1");
+                    if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
+                            tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
+                        plan1.setStartTime(new Date());
+                        int amount = 0;
+                        LocalDate lastDayOfMonth;
+                        switch (tMonitoringRetrievalPlan.getPlanCycle()) {
+                            case "1":
+                                amount = 1;
+                                break;
+                            case "2":
+                                amount = 7;
+                                break;
+                            case "3":
+                                LocalDate currentDate = LocalDate.now();
+                                lastDayOfMonth = currentDate.withDayOfMonth(currentDate.lengthOfMonth());
+                                amount = lastDayOfMonth.getDayOfMonth() - currentDate.getDayOfMonth();
+                                break;
+                            case "4":
+                                amount = getDayNum(3);
+                                break;
+                            case "5":
+                                amount = getDayNum(6);
+                                break;
+                            case "6":
+                                amount = getDayNum(12);
+                                break;
+                        }
+                        Calendar cal = Calendar.getInstance();
+                        cal.setTime(new Date());
+                        cal.add(Calendar.DATE, amount);
+                        Date time = cal.getTime();
+                        plan1.setEndTime(time);
+                    }
+                    tMonitoringRetrievalPlans.add(plan1);
+                }
+                if ((tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
+                    try {
+                        iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
+                    } catch (Exception e) {
+                        throw new ServiceException("下发任务异常,请联系管理员");
+                    }
+                }
+            }
+
         } catch (Exception e) {
         } catch (Exception e) {
             e.getMessage();
             e.getMessage();
         }
         }

+ 9 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/controller/CoreMonitoringRetrievalTaskController.java

@@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.IOException;
 import java.time.LocalDate;
 import java.time.LocalDate;
@@ -47,7 +48,7 @@ public class CoreMonitoringRetrievalTaskController extends BaseController {
      * 查询监控调阅任务列表app
      * 查询监控调阅任务列表app
      */
      */
     @ApiOperation(value = "app查询调阅任务列表")
     @ApiOperation(value = "app查询调阅任务列表")
-  //  @RequiresPermissions("core:task:list")
+    //  @RequiresPermissions("core:task:list")
     @GetMapping("/selectListApp")
     @GetMapping("/selectListApp")
     public TableDataInfo<CoreMonitoringRetrievalTask> selectListApp(CoreMonitoringTaskRegistrationDTO coreMonitoringTaskRegistrationDTO) {
     public TableDataInfo<CoreMonitoringRetrievalTask> selectListApp(CoreMonitoringTaskRegistrationDTO coreMonitoringTaskRegistrationDTO) {
         return coreMonitoringRetrievalTaskService.selectListApp(coreMonitoringTaskRegistrationDTO);
         return coreMonitoringRetrievalTaskService.selectListApp(coreMonitoringTaskRegistrationDTO);
@@ -75,6 +76,13 @@ public class CoreMonitoringRetrievalTaskController extends BaseController {
         return success(coreMonitoringRetrievalTaskService.selectCoreMonitoringRetrievalTaskOneVoById(id));
         return success(coreMonitoringRetrievalTaskService.selectCoreMonitoringRetrievalTaskOneVoById(id));
     }
     }
 
 
+    @ApiOperation(value = "手动初始化")
+    @RequiresPermissions("core:task:edit")
+    @GetMapping(value = "initialization/{id}")
+    public AjaxResult initialization(@PathVariable("id") Long id) {
+        return success(coreMonitoringRetrievalTaskService.initializationTask(id));
+    }
+
     /**
     /**
      * 新增监控调阅任务
      * 新增监控调阅任务
      */
      */

+ 7 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/mapper/CoreMonitoringRetrievalTaskMapper.java

@@ -87,19 +87,25 @@ public interface CoreMonitoringRetrievalTaskMapper extends BaseMapper<CoreMonito
 
 
     /**
     /**
      * 初始化任务
      * 初始化任务
+     *
      * @param dateTime
      * @param dateTime
      */
      */
     void initializationTask(String dateTime);
     void initializationTask(String dateTime);
 
 
+    int initializationTaskByHand(Long id);
+
     /**
     /**
      * 查询当天未完成任务
      * 查询当天未完成任务
+     *
      * @param dateTime
      * @param dateTime
      * @return
      * @return
      */
      */
-    List<Long>selectTaskByTime(String dateTime);
+    List<Long> selectTaskByTime(String dateTime);
+
     void deleteTaskByPlanId(@Param("planId") Long planId);
     void deleteTaskByPlanId(@Param("planId") Long planId);
 
 
     List<CoreMonitoringRetrievalTask> selectCompleteByPlanId(Long planId);
     List<CoreMonitoringRetrievalTask> selectCompleteByPlanId(Long planId);
+
     void deleteWaitTaskByPlanId(@Param("planId") Long planId);
     void deleteWaitTaskByPlanId(@Param("planId") Long planId);
 
 
     void updateDeleteTaskByPlanId(@Param("planId") Long planId, @Param("isDeleted") Integer isDeleted);
     void updateDeleteTaskByPlanId(@Param("planId") Long planId, @Param("isDeleted") Integer isDeleted);

+ 5 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/ICoreMonitoringRetrievalTaskService.java

@@ -34,10 +34,12 @@ public interface ICoreMonitoringRetrievalTaskService extends IService<CoreMonito
 
 
     /**
     /**
      * 根据计划id查询已完成任务
      * 根据计划id查询已完成任务
+     *
      * @param planId
      * @param planId
      * @return
      * @return
      */
      */
-    public List<CoreMonitoringRetrievalTask>selectComplete(Long planId);
+    public List<CoreMonitoringRetrievalTask> selectComplete(Long planId);
+
     /**
     /**
      * 查询监控调阅任务列表
      * 查询监控调阅任务列表
      *
      *
@@ -102,6 +104,8 @@ public interface ICoreMonitoringRetrievalTaskService extends IService<CoreMonito
 
 
     void initializationTask();
     void initializationTask();
 
 
+    int initializationTask(Long id);
+
     void deleteTaskByPlanId(Long planId);
     void deleteTaskByPlanId(Long planId);
 
 
     void deleteWaitTaskByPlanId(Long planId);
     void deleteWaitTaskByPlanId(Long planId);

+ 11 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java

@@ -375,6 +375,14 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
     }
     }
 
 
     @Override
     @Override
+    public int initializationTask(Long id) {
+        int i = 0;
+        i = coreMonitoringRetrievalTaskMapper.initializationTaskByHand(id);
+        i = coreMonitoringTaskRegistrationMapper.deleteByTaskId(id);
+        return i;
+    }
+
+    @Override
     public void deleteTaskByPlanId(Long planId) {
     public void deleteTaskByPlanId(Long planId) {
         coreMonitoringRetrievalTaskMapper.deleteTaskByPlanId(planId);
         coreMonitoringRetrievalTaskMapper.deleteTaskByPlanId(planId);
     }
     }
@@ -502,10 +510,10 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
         }*/
         }*/
         CoreMonitoringRetrievalTask task = new CoreMonitoringRetrievalTask();
         CoreMonitoringRetrievalTask task = new CoreMonitoringRetrievalTask();
         task.setId(IdWorker.getId());
         task.setId(IdWorker.getId());
-        if (frequency>1){
+        if (frequency > 1) {
             task.setTaskName(plan.getPlanName() + "第" + frequency + "次调阅");
             task.setTaskName(plan.getPlanName() + "第" + frequency + "次调阅");
-        }else {
-            task.setTaskName(plan.getPlanName() +"调阅任务");
+        } else {
+            task.setTaskName(plan.getPlanName() + "调阅任务");
         }
         }
         task.setCycle(plan.getPlanCycle());
         task.setCycle(plan.getPlanCycle());
         task.setOrgId(sysOrg.getId());
         task.setOrgId(sysOrg.getId());

+ 7 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/retrieval/CoreMonitoringRetrievalTaskMapper.xml

@@ -145,7 +145,9 @@
         <if test="request.moth !=null">
         <if test="request.moth !=null">
             and ymd_date like concat('%', #{request.moth}, '%')
             and ymd_date like concat('%', #{request.moth}, '%')
         </if>
         </if>
-        ORDER BY create_time DESC ,status
+        ORDER BY
+        `status` desc,
+        create_time DESC
     </select>
     </select>
     <select id="selectTaskDataVoListByRetrievalTaskId"
     <select id="selectTaskDataVoListByRetrievalTaskId"
             resultType="com.xunmei.common.core.domain.retrieval.vo.TaskDataVo">
             resultType="com.xunmei.common.core.domain.retrieval.vo.TaskDataVo">
@@ -425,6 +427,7 @@
           and status in (0, 3)
           and status in (0, 3)
     </delete>
     </delete>
 
 
+
     <update id="updateDeleteTaskByPlanId">
     <update id="updateDeleteTaskByPlanId">
         update core_monitoring_retrieval_task
         update core_monitoring_retrieval_task
         set is_deleted = #{isDeleted}
         set is_deleted = #{isDeleted}
@@ -433,6 +436,9 @@
     <update id="initializationTask">
     <update id="initializationTask">
         update core_monitoring_retrieval_task SET `status`=0, start_time=null WHERE `status`=1 AND start_time LIKE  concat(#{dateTime}, '%')
         update core_monitoring_retrieval_task SET `status`=0, start_time=null WHERE `status`=1 AND start_time LIKE  concat(#{dateTime}, '%')
     </update>
     </update>
+    <update id="initializationTaskByHand">
+        update core_monitoring_retrieval_task SET `status`=0, start_time=null WHERE `status`=1 AND id=#{id}
+    </update>
 
 
     <select id="selectCurUserTaskList" resultType="com.xunmei.common.core.domain.panel.vo.PanelListVo">
     <select id="selectCurUserTaskList" resultType="com.xunmei.common.core.domain.panel.vo.PanelListVo">
      select distinct t.id as id, task_name as taskName,t.plan_start_time as startTime,t.plan_end_time as endTime,t.status
      select distinct t.id as id, task_name as taskName,t.plan_start_time as startTime,t.plan_end_time as endTime,t.status