From 04a2d2280190f1a8131a217ce9e25de99c250649 Mon Sep 17 00:00:00 2001 From: lroyia Date: Fri, 3 Apr 2026 11:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=94=80=E8=87=AA=E5=8A=A8=E7=A7=BB?= =?UTF-8?q?=E5=87=BA=E5=90=8D=E5=BD=95=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/CancelEntRemoveSchedule.java | 35 ++++++++++++------- src/main/resources/application-prod129.yml | 1 + src/main/resources/application-prod73.yml | 1 + 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/chinaweal/aiccs/schedule/CancelEntRemoveSchedule.java b/src/main/java/com/chinaweal/aiccs/schedule/CancelEntRemoveSchedule.java index 360ad9b..e28f622 100644 --- a/src/main/java/com/chinaweal/aiccs/schedule/CancelEntRemoveSchedule.java +++ b/src/main/java/com/chinaweal/aiccs/schedule/CancelEntRemoveSchedule.java @@ -1,11 +1,12 @@ package com.chinaweal.aiccs.schedule; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.chinaweal.aiccs.aicbizqy.entity.datamove.*; import com.chinaweal.aiccs.aicbizqy.mapper.datamove.*; +import com.chinaweal.aiccs.aiccs.system.entity.TRBaseCode; +import com.chinaweal.aiccs.aiccs.system.service.TRBaseCodeService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -17,6 +18,7 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; +import java.util.Map; /** * 注销主体自动移出定时任务 @@ -46,6 +48,8 @@ public class CancelEntRemoveSchedule { @Autowired private CaseCreInformationDataMoveMapper caseCreInformationMapper; + @Autowired + private TRBaseCodeService trBaseCodeService; /** * 移出原因码值 - 其他 @@ -58,7 +62,7 @@ public class CancelEntRemoveSchedule { /** * 默认移出机关代码 */ - private static final String DEFAULT_REMOVE_ORG = "15000000"; + private static final String DEFAULT_REMOVE_ORG = "150000"; /** * 默认移出机关名称 */ @@ -67,7 +71,7 @@ public class CancelEntRemoveSchedule { /** * 每天凌晨2点执行注销主体自动移出任务 */ - @Scheduled(cron = "${scheduling.cron.cancelEntRemove:0 0 2 * * ?}") + @Scheduled(cron = "${scheduling.cron.cancelEntRemove:-}") @Transactional(rollbackFor = Exception.class) public void executeCancelEntRemove() { log.info("==========开始执行注销主体自动移出任务=========="); @@ -75,7 +79,7 @@ public class CancelEntRemoveSchedule { try { // 获取当天日期 - LocalDate today = LocalDate.now(ZoneId.systemDefault()); + LocalDate today = LocalDate.now().minusDays(1); String todayStr = today.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); log.info("查询日期: {}", todayStr); @@ -133,11 +137,12 @@ public class CancelEntRemoveSchedule { */ private List queryCancelledEntities(LocalDate today) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(EBaseInfo::getRegstate, "注销"); + wrapper.in(EBaseInfo::getRegstate, "3", "4"); // 核准日期(REGDATE)或最后更新日期包含当天 + String todayStr = today.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 由于注销日期可能在不同字段,这里查询所有状态为注销的主体,再在业务层筛选 - wrapper.last("AND (TO_CHAR(REGDATE, 'YYYY-MM-DD') = '" + today.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "' " + - "OR TO_CHAR(APPRDATE, 'YYYY-MM-DD') = '" + today.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "')"); + wrapper.last("AND (TO_CHAR(REGDATE, 'YYYY-MM-DD') = '" + todayStr + "' " + + "OR TO_CHAR(APPRDATE, 'YYYY-MM-DD') = '" + todayStr + "')"); return eBaseInfoMapper.selectList(wrapper); } @@ -160,6 +165,9 @@ public class CancelEntRemoveSchedule { return 0; } + Map cd72 = trBaseCodeService.getBaseCodeMapFormCache("CD72"); + TRBaseCode cd727 = cd72.get("CD72"); + Date removeDate = Date.from(today.atStartOfDay(ZoneId.systemDefault()).toInstant()); for (AoOpaDetail abnormal : abnormalList) { @@ -167,8 +175,8 @@ public class CancelEntRemoveSchedule { updateWrapper.eq(AoOpaDetail::getBusexclist, abnormal.getBusexclist()); updateWrapper.set(AoOpaDetail::getIsmove, "1"); // 已移出 updateWrapper.set(AoOpaDetail::getRemdate, removeDate); - updateWrapper.set(AoOpaDetail::getRemexcpres, REMOVE_REASON_CODE); - updateWrapper.set(AoOpaDetail::getRemexcpresCn, REMOVE_REASON_CN); + updateWrapper.set(AoOpaDetail::getRemexcpres, cd727.getCode()); + updateWrapper.set(AoOpaDetail::getRemexcpresCn, cd727.getName()); // 移出机关使用原列入机关或默认值 String removeOrg = abnormal.getDecorg() != null ? abnormal.getDecorg() : DEFAULT_REMOVE_ORG; String removeOrgCn = abnormal.getDecorgCn() != null ? abnormal.getDecorgCn() : DEFAULT_REMOVE_ORG_CN; @@ -209,12 +217,15 @@ public class CancelEntRemoveSchedule { Date removeDate = Date.from(today.atStartOfDay(ZoneId.systemDefault()).toInstant()); + Map cd74 = trBaseCodeService.getBaseCodeMapFormCache("CD74"); + TRBaseCode cd743 = cd74.get("3"); + for (ELiIlldisdetail illegal : illegalList) { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.eq(ELiIlldisdetail::getIllid, illegal.getIllid()); updateWrapper.set(ELiIlldisdetail::getRemdate, removeDate); - updateWrapper.set(ELiIlldisdetail::getRemexcpres, REMOVE_REASON_CODE); - updateWrapper.set(ELiIlldisdetail::getRemexcpresCn, REMOVE_REASON_CN); + updateWrapper.set(ELiIlldisdetail::getRemexcpres, cd743.getCode()); + updateWrapper.set(ELiIlldisdetail::getRemexcpresCn, cd743.getName()); // 移出机关使用原列入机关或默认值 String removeOrg = illegal.getDecorg() != null ? illegal.getDecorg() : DEFAULT_REMOVE_ORG; String removeOrgCn = illegal.getDecorgCn() != null ? illegal.getDecorgCn() : DEFAULT_REMOVE_ORG_CN; @@ -263,7 +274,7 @@ public class CancelEntRemoveSchedule { LambdaQueryWrapper existWrapper = new LambdaQueryWrapper<>(); existWrapper.eq(CaseCreInformation::getCaseid, penalty.getCaseid()); existWrapper.eq(CaseCreInformation::getPripid, ent.getPripid()); - Long existCount = caseCreInformationMapper.selectCount(existWrapper); + int existCount = caseCreInformationMapper.selectCount(existWrapper); if (existCount > 0) { log.debug("信用修复记录已存在, 跳过: CASEID={}", penalty.getCaseid()); diff --git a/src/main/resources/application-prod129.yml b/src/main/resources/application-prod129.yml index feba521..0ab5ad9 100644 --- a/src/main/resources/application-prod129.yml +++ b/src/main/resources/application-prod129.yml @@ -164,6 +164,7 @@ scheduling: moveOutData: '-' #迁出省局数据定时任务 moveInData: '-' #迁入省局数据定时任务 forceDeregisterNoticeExpired: '0 0 1 * * ?' #拟强制注销公告期满更新定时任务 + cancelEntRemove: '0 0 1 * * ?' #注销企业自动移出 ot: bakCseDownloadPath: /ot/download/case diff --git a/src/main/resources/application-prod73.yml b/src/main/resources/application-prod73.yml index e1bbceb..1ce8ecd 100644 --- a/src/main/resources/application-prod73.yml +++ b/src/main/resources/application-prod73.yml @@ -164,6 +164,7 @@ scheduling: moveOutData: '0 59 15 * * ?' #迁出省局数据定时任务 moveInData: '0 31 00 * * ?' #迁入省局数据定时任务 forceDeregisterNoticeExpired: '0 0 1 * * ?' #拟强制注销公告期满更新定时任务 + cancelEntRemove: '0 0 1 * * ?' #注销企业自动移出 ot: bakCseDownloadPath: /ot/download/case