diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BPlanEnterpriseMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BPlanEnterpriseMapper.java index 1881635..dfd4497 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BPlanEnterpriseMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/mapper/BPlanEnterpriseMapper.java @@ -133,5 +133,10 @@ public interface BPlanEnterpriseMapper extends BaseMapper { */ List selectUpdateAll(); + + /** + * 批量更新最新检查时间字段 + */ + void updateEndTime(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/quartz/EnterpristQuartz.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/quartz/EnterpristQuartz.java index 85f320f..7107042 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/quartz/EnterpristQuartz.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/quartz/EnterpristQuartz.java @@ -37,16 +37,20 @@ public class EnterpristQuartz { private IBEnterpriseNewService bEnterpriseNewService; - // 每周一早上五点5点执行一次任务 生成企业新表 - @Scheduled(cron = "0 0 17 ? * SUN") + // 每天早上5点执行一次任务 更新企业新表的最新检查时间字段 + @Scheduled(cron = "0 0 5 * * ?") // @GetMapping("/getList") // @ApiOperation(value = "定时任务") public AjaxResult updateInformationData() { //三表关联查询数据 List list = bEnterpriseNewMapper.seletAll(); //清空企业新表中的数据 - bEnterpriseNewMapper.deletAll(); - bEnterpriseNewService.saveBatch(list); + // bEnterpriseNewMapper.deletAll(); + // bEnterpriseNewService.saveBatch(list); + + // 改成只更新最新检查时间字段 + bPlanEnterpriseService.updateEndTime() + return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/BPlanEnterpriseService.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/BPlanEnterpriseService.java index 79ef9c1..b8e7834 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/BPlanEnterpriseService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/BPlanEnterpriseService.java @@ -120,5 +120,11 @@ public interface BPlanEnterpriseService extends IService { * @return */ List selectUpdateAll(); + + + /** + * 批量更新最新检查时间字段 + */ + void updateEndTime(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BPlanEnterpriseServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BPlanEnterpriseServiceImpl.java index 590a335..3be5572 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BPlanEnterpriseServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/programManagement/service/impl/BPlanEnterpriseServiceImpl.java @@ -124,6 +124,9 @@ public class BPlanEnterpriseServiceImpl extends ServiceImpl - order by isPoint desc + order by law_sort,planned_month+0 delete @@ -349,6 +349,20 @@ ) e ON a.enterprise_id = e.USC_CODE + + UPDATE b_enterprise_new a + INNER JOIN ( + SELECT + USC_CODE, + MAX_EXAMINE_END_TIME + FROM + ( SELECT ROW_NUMBER ( ) over ( PARTITION BY USC_CODE ORDER BY EXAMINE_END_TIME DESC ) rowId, USC_CODE, EXAMINE_END_TIME AS MAX_EXAMINE_END_TIME FROM sz_enfor_examine ) S + WHERE + rowId = 1 + ) c ON a.enterprise_id = c.USC_CODE + SET a.EXAMINE_END_TIME = c.MAX_EXAMINE_END_TIME + + UPDATE b_plan_enterprise