Browse Source

纠错周和月任务与提醒调整

guozx 3 years ago
parent
commit
234b666c5e

+ 15 - 0
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/init/OnsiteRemindJob.java

@@ -28,6 +28,9 @@ public class OnsiteRemindJob implements Job {
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         ConcurrentMap<String, Object> paramMap = (ConcurrentMap<String, Object>) jobExecutionContext.getJobDetail().getJobDataMap().get(QuartzManager.JOB_PARAM_NAME);
         try {
+            OnsiteTaskService onsiteTaskService = (OnsiteTaskService) paramMap.get("onsiteTaskService");
+            onsiteTaskService.delTaskOld(null);
+          //  week_day month_day
             createTask(paramMap);// 执行任务
         } catch (Throwable e) {
             e.printStackTrace();
@@ -217,6 +220,18 @@ public class OnsiteRemindJob implements Job {
                     min=0;
                 }
                 boolean flag = CommonUtil.getDateCompare(CommonUtil.getStrDate(day, format, min), new Date(),true);
+                if(cal.getType_flag()==1){
+                    flag=false;
+                    if(CommonUtil.getWeekOfDate(CommonUtil.getStrDate(day, format, min))>=cal.getWeek_day()){
+                        flag=true;
+                    }
+                }
+                if(cal.getType_flag()==2){
+                    flag=false;
+                    if(CommonUtil.getWeekOfDate(CommonUtil.getStrDate(day, format, min))>=cal.getMonth_day()){
+                        flag=true;
+                    }
+                }
                 if (flag) {
                     Map map=new HashMap();
                     map.put("type",type);

+ 1 - 1
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/service/OnsiteTaskService.java

@@ -8,7 +8,7 @@ import java.util.List;
 import java.util.Map;
 
 public interface OnsiteTaskService {
-
+    public int delTaskOld(Map map);
     /**
      * 添加不工作提醒信息
      * @param map

+ 4 - 0
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/service/impl/OnsiteTaskServiceImp.java

@@ -22,6 +22,10 @@ public class OnsiteTaskServiceImp implements OnsiteTaskService {
     @Autowired
     OnsiteTaskMapper mapper;
 
+    public int delTaskOld(Map map){
+        return mapper.delTaskOld(map);
+    }
+
     @Override
     @Transactional(rollbackFor = Throwable.class)
     public int insertOnsiteTask(OnsiteTask task) {

+ 1 - 1
application-task/src/main/resources/mappers/FirstTaskMapper.xml

@@ -90,7 +90,7 @@
         <if test="remind_task_flag != null">
             and a.remind_task_flag = ${remind_task_flag}
         </if>
-        <if test="remind_nowork_flag">
+        <if test="remind_nowork_flag != null">
             and a.remind_nowork_flag = ${remind_nowork_flag}
         </if>
     </select>

+ 9 - 3
application-task/src/main/resources/mappers/OnsiteTaskMapper.xml

@@ -78,10 +78,10 @@
         a.id=b.benteler_plan_id and a.pause_flag=0 and a.deleted=0 and a.effective_date &lt;= now()
         and b.type_flag=${type_flag}
         <if test="week_day != null and week_day != ''">
-            and  b.week_day = ${week_day}
+            and  b.week_day &gt;= ${week_day}
         </if>
         <if test="month_day != null and month_day != ''">
-            and  b.month_day = ${month_day}
+            and  b.month_day &gt;= ${month_day}
         </if>
         and a.id = oap.benteler_plan_id
         and a.plan_type = 2
@@ -90,6 +90,12 @@
 
     </select>
 
+   <delete id="delTaskOld">
+       delete from onsite_task where status=0
+       and onsite_calendar_id in (select id from  onsite_calendar where  type_flag in (1,2) )
+       and  ADDDATE(task_time, interval 1 day) &lt; now()
+   </delete>
+
     <select id="getRemindWork" resultMap="calendarOnsite">
         select b.*,a.task_time ,a.id onsite_task_id
         from onsite_task a,onsite_calendar b
@@ -97,7 +103,7 @@
         <if test="remind_task_flag != null">
             and  a.remind_task_flag = ${remind_task_flag}
         </if>
-        <if test="remind_nowork_flag">
+        <if test="remind_nowork_flag != null">
             and  a.remind_nowork_flag = ${remind_nowork_flag}
         </if>
     </select>