注销自动移出名录细节调整

This commit is contained in:
黎润豪 2026-04-03 11:04:22 +08:00
parent 3834d97d16
commit 04a2d22801
3 changed files with 25 additions and 12 deletions

View File

@ -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<EBaseInfo> queryCancelledEntities(LocalDate today) {
LambdaQueryWrapper<EBaseInfo> 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<String, TRBaseCode> 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<String, TRBaseCode> cd74 = trBaseCodeService.getBaseCodeMapFormCache("CD74");
TRBaseCode cd743 = cd74.get("3");
for (ELiIlldisdetail illegal : illegalList) {
LambdaUpdateWrapper<ELiIlldisdetail> 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<CaseCreInformation> 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());

View File

@ -164,6 +164,7 @@ scheduling:
moveOutData: '-' #迁出省局数据定时任务
moveInData: '-' #迁入省局数据定时任务
forceDeregisterNoticeExpired: '0 0 1 * * ?' #拟强制注销公告期满更新定时任务
cancelEntRemove: '0 0 1 * * ?' #注销企业自动移出
ot:
bakCseDownloadPath: /ot/download/case

View File

@ -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