Commit a17fd9aa authored by fangxinjiang's avatar fangxinjiang

项目配置新增同步合同及商险待续签数据-fxj

parent 1bbada55
...@@ -28,6 +28,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TAutoMainRelExportVo; ...@@ -28,6 +28,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TAutoMainRelExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TAutoMainRelRestrictVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TAutoMainRelRestrictVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TAutoMainRelSearchVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TAutoMainRelSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectAutoSetParam; import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectAutoSetParam;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
...@@ -133,7 +135,16 @@ public class TAutoMainRelController { ...@@ -133,7 +135,16 @@ public class TAutoMainRelController {
@SysLog("新增项目配置表" ) @SysLog("新增项目配置表" )
@PostMapping("/save") @PostMapping("/save")
public R<Boolean> save(@RequestBody TAutoMainRelAddVo entity) { public R<Boolean> save(@RequestBody TAutoMainRelAddVo entity) {
return tAutoMainRelService.saveAsso(entity); R<Boolean> result = tAutoMainRelService.saveAsso(entity);
// ✅ 如果保存成功,异步刷新续签数据(不阻塞主流程)
if (null != result
&& result.getCode() == CommonConstants.SUCCESS.intValue()
&& Common.isNotNull(entity.getAutoMainRel())) {
tAutoMainRelService.asyncRefreshRenewalDataAfterSave(entity.getAutoMainRel());
}
return result;
} }
/** /**
......
...@@ -252,8 +252,8 @@ public class TEmpContractAlertController { ...@@ -252,8 +252,8 @@ public class TEmpContractAlertController {
} }
/** /**
* 定时任务生成合同续签代码信息 * 定时任务生成合同续签代码信息(支持按项目过滤)
* @return R<List> * @return R<Boolean>
* @Author FXJ * @Author FXJ
* @Date 2022-07-4 * @Date 2022-07-4
**/ **/
...@@ -261,7 +261,7 @@ public class TEmpContractAlertController { ...@@ -261,7 +261,7 @@ public class TEmpContractAlertController {
@PostMapping("/taskCreateContractAlert") @PostMapping("/taskCreateContractAlert")
@Inner @Inner
public R taskCreateContractAlert() { public R taskCreateContractAlert() {
return tEmpContractAlertService.taskCreateContractAlert(); return tEmpContractAlertService.taskCreateContractAlert(null);
} }
/** /**
......
...@@ -60,7 +60,7 @@ public interface TEmpContractAlertMapper extends BaseMapper<TEmpContractAlert> { ...@@ -60,7 +60,7 @@ public interface TEmpContractAlertMapper extends BaseMapper<TEmpContractAlert> {
List<TEmpContractAlertExportVo> listExport(@Param("tEmpContractAlert") ContractAlertSearchVo searchVo); List<TEmpContractAlertExportVo> listExport(@Param("tEmpContractAlert") ContractAlertSearchVo searchVo);
void updateProcessStatus(); void updateProcessStatus(@Param("deptNo") String deptNo);
List<ContractAlertConfirmVo> getAutoRenewForConfirm(@Param("tEmpContractAlert")ContractAlertSearchVo tEmpContractAlert); List<ContractAlertConfirmVo> getAutoRenewForConfirm(@Param("tEmpContractAlert")ContractAlertSearchVo tEmpContractAlert);
......
...@@ -96,4 +96,10 @@ public interface TAutoMainRelService extends IService<TAutoMainRel> { ...@@ -96,4 +96,10 @@ public interface TAutoMainRelService extends IService<TAutoMainRel> {
* @param entity 项目配置实体 * @param entity 项目配置实体
*/ */
void generateAutoConfigItems(TAutoMainRel entity); void generateAutoConfigItems(TAutoMainRel entity);
/**
* 项目配置保存后异步刷新续签数据(仅新增时触发)
* @param tAutoMainRel 项目配置对象
*/
void asyncRefreshRenewalDataAfterSave(TAutoMainRel tAutoMainRel);
} }
...@@ -56,12 +56,13 @@ public interface TEmpContractAlertService extends IService<TEmpContractAlert> { ...@@ -56,12 +56,13 @@ public interface TEmpContractAlertService extends IService<TEmpContractAlert> {
void listExport(HttpServletResponse response, ContractAlertSearchVo searchVo); void listExport(HttpServletResponse response, ContractAlertSearchVo searchVo);
/** /**
* 定时任务生成合同续签代码信息 * 定时任务生成合同续签代码信息(支持按项目过滤)
* @return R<List> * @param deptNo 项目编码(可选,为null时全局刷新)
* @return R<Boolean>
* @Author FXJ * @Author FXJ
* @Date 2022-07-4 * @Date 2022-07-4
**/ **/
R<Boolean> taskCreateContractAlert(); R<Boolean> taskCreateContractAlert(String deptNo);
boolean changeFeedBackAll(ChangeFeedBackAllVo changeFeedBackAllVo); boolean changeFeedBackAll(ChangeFeedBackAllVo changeFeedBackAllVo);
......
...@@ -380,16 +380,17 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -380,16 +380,17 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
return wrapper; return wrapper;
} }
/** /**
* 定时任务生成合同续签代码信息 * 定时任务生成合同续签代码信息(支持按项目过滤)
* @return R<List> * @param deptNo 项目编码(可选,为null时全局刷新)
* @return R<Boolean>
* @Author FXJ * @Author FXJ
* @Date 2022-07-4 * @Date 2022-07-4
**/ **/
@Override @Override
public R<Boolean> taskCreateContractAlert() { public R<Boolean> taskCreateContractAlert(String deptNo) {
// 获取合同为在档、员工类型为“0外包”、“1派遣”、最近一次合同审核通过、过期或离过期还有3个月的数据 // 构建查询条件
List<TEmployeeContractInfo> alertList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query() LambdaQueryWrapper<TEmployeeContractInfo> wrapper = Wrappers.<TEmployeeContractInfo>query().lambda()
.lambda().eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.TWO_STRING) .eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.TWO_STRING)
.isNotNull(TEmployeeContractInfo::getAuditTimeLast) .isNotNull(TEmployeeContractInfo::getAuditTimeLast)
.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getContractType,CommonConstants.ONE_STRING) .eq(TEmployeeContractInfo::getContractType,CommonConstants.ONE_STRING)
...@@ -399,21 +400,46 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -399,21 +400,46 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
.le(TEmployeeContractInfo::getContractEnd,DateUtil.dateIncreaseByDay( .le(TEmployeeContractInfo::getContractEnd,DateUtil.dateIncreaseByDay(
DateUtil.dateIncreaseByMonth(DateUtil.getCurrentDateTime(), DateUtil.dateIncreaseByMonth(DateUtil.getCurrentDateTime(),
CommonConstants.dingleDigitIntArray[3]), CommonConstants.dingleDigitIntArray[1])) CommonConstants.dingleDigitIntArray[3]), CommonConstants.dingleDigitIntArray[1]))
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING)); .eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING);
// 获取所有未审核通过的合同数据
List<TEmployeeContractInfo> notAccessList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query().lambda() // ✅ 如果传入了项目编码,则按项目过滤
if (Common.isNotNull(deptNo)) {
wrapper.eq(TEmployeeContractInfo::getDeptNo, deptNo);
log.info("按项目刷新合同续签待办,项目编码: {}", deptNo);
} else {
log.info("全局刷新合同续签待办");
}
// 获取符合条件的合同列表
List<TEmployeeContractInfo> alertList = contractInfoMapper.selectList(wrapper);
// 获取所有未审核通过的合同数据(支持按项目过滤)
LambdaQueryWrapper<TEmployeeContractInfo> notAccessWrapper = Wrappers.<TEmployeeContractInfo>query().lambda()
.and(obj->obj.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING) .and(obj->obj.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING)
.or().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING) .or().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING)
.or().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.FOUR_STRING)) .or().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.FOUR_STRING))
.eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)); .eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING);
if (Common.isNotNull(deptNo)) {
notAccessWrapper.eq(TEmployeeContractInfo::getDeptNo, deptNo);
}
List<TEmployeeContractInfo> notAccessList = contractInfoMapper.selectList(notAccessWrapper);
Map<String,TEmpContractAlert> alertMap = new HashMap<>(); Map<String,TEmpContractAlert> alertMap = new HashMap<>();
Map<String,TEmpContractAlert> existMap = new HashMap<>(); Map<String,TEmpContractAlert> existMap = new HashMap<>();
initExistMap(existMap); initExistMap(existMap, deptNo);
if (Common.isNotNull(alertList)) { if (Common.isNotNull(alertList)) {
List<TSettleDomain> projects = settleDomainMapper.selectList(Wrappers.<TSettleDomain>query().lambda() // 如果项目编码不为空,查询对应项目的数据;否则查询所有数据
.eq(TSettleDomain::getDeleteFlag,CommonConstants.ZERO_STRING)); LambdaQueryWrapper<TSettleDomain> projectWrapper = Wrappers.<TSettleDomain>query().lambda()
List<TAutoMainRel> ruleInfos = autoMainRelMapper.selectList(Wrappers.<TAutoMainRel>query().lambda()); .eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING);
if (Common.isNotNull(deptNo)) {
projectWrapper.eq(TSettleDomain::getDepartNo, deptNo);
}
List<TSettleDomain> projects = settleDomainMapper.selectList(projectWrapper);
LambdaQueryWrapper<TAutoMainRel> ruleWrapper = Wrappers.<TAutoMainRel>query().lambda();
if (Common.isNotNull(deptNo)) {
ruleWrapper.eq(TAutoMainRel::getDeptNo, deptNo);
}
List<TAutoMainRel> ruleInfos = autoMainRelMapper.selectList(ruleWrapper);
//判空、判重,处理重复键和null值 //判空、判重,处理重复键和null值
Map<String,TSettleDomain> projectMap= null; Map<String,TSettleDomain> projectMap= null;
if (Common.isNotNull(projects)){ if (Common.isNotNull(projects)){
...@@ -462,18 +488,29 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -462,18 +488,29 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
} }
} }
} }
baseMapper.truncate(); // 如果项目编码不为空 删除对应项目的提醒数据 否则全部删除
if (Common.isNotNull(deptNo)) {
baseMapper.delete(Wrappers.<TEmpContractAlert>query().lambda()
.eq(TEmpContractAlert::getProjectNo,deptNo));
}else {
baseMapper.truncate();
}
if (Common.isNotNull(alertMap)){ if (Common.isNotNull(alertMap)){
this.saveBatch(alertMap.values()); this.saveBatch(alertMap.values());
} }
//更新自动化的所有的合同办理状态 //更新自动化的所有的合同办理状态--这里如果项目编码不为空要传参
baseMapper.updateProcessStatus(); baseMapper.updateProcessStatus(deptNo);
return R.ok(); return R.ok();
} }
private void initExistMap(Map<String, TEmpContractAlert> existMap) { private void initExistMap(Map<String, TEmpContractAlert> existMap, String deptNo) {
List<TEmpContractAlert> exists = baseMapper.selectList(Wrappers.<TEmpContractAlert>query()); LambdaQueryWrapper<TEmpContractAlert> wrapper = Wrappers.<TEmpContractAlert>query().lambda();
// 如果项目编码不为空,只查询对应项目的已存在记录
if (Common.isNotNull(deptNo)) {
wrapper.eq(TEmpContractAlert::getProjectNo, deptNo);
}
List<TEmpContractAlert> exists = baseMapper.selectList(wrapper);
if (Common.isNotNull(exists)){ if (Common.isNotNull(exists)){
for (TEmpContractAlert alert:exists){ for (TEmpContractAlert alert:exists){
existMap.put(alert.getContractId(),alert); existMap.put(alert.getContractId(),alert);
......
...@@ -422,9 +422,12 @@ ...@@ -422,9 +422,12 @@
WHEN b.process_status = '9' THEN '2' WHEN b.process_status = '9' THEN '2'
WHEN b.process_status IN ('6', '8', '2', '4') THEN '1' WHEN b.process_status IN ('6', '8', '2', '4') THEN '1'
ELSE a.HANDLE_STATUS -- 保持不变 ELSE a.HANDLE_STATUS -- 保持不变
END END
WHERE a.AUTO_FLAG = '0' WHERE a.AUTO_FLAG = '0'
AND b.process_status IN ('9', '6', '8', '2', '4') -- 只处理这些状态 AND b.process_status IN ('9', '6', '8', '2', '4') -- 只处理这些状态
<if test="deptNo != null and deptNo.trim() != ''">
AND a.PROJECT_NO = #{deptNo}
</if>
</update> </update>
<!--tEmpContractAlert简单分页查询--> <!--tEmpContractAlert简单分页查询-->
......
...@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.core.config; ...@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.core.config;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
...@@ -21,7 +22,6 @@ import java.util.concurrent.ThreadPoolExecutor; ...@@ -21,7 +22,6 @@ import java.util.concurrent.ThreadPoolExecutor;
@Slf4j @Slf4j
public class AsyncConfig implements AsyncConfigurer { public class AsyncConfig implements AsyncConfigurer {
// todo 幂等性如何保证
@Override @Override
public Executor getAsyncExecutor() { public Executor getAsyncExecutor() {
//定义线程池 //定义线程池
...@@ -69,4 +69,58 @@ public class AsyncConfig implements AsyncConfigurer { ...@@ -69,4 +69,58 @@ public class AsyncConfig implements AsyncConfigurer {
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return null; return null;
} }
/**
* 续签刷新专用线程池(集群环境固定配置)
*
* 配置说明:
* - 集群环境中 Runtime.getRuntime().availableProcessors() 获取的是容器CPU核数,不准确
* - 采用固定值配置,按 CPU核数=2 计算
* - 核心线程数 = 2 + 1 = 3(IO密集型任务)
* - 最大线程数 = 3 × 2 = 6
* - 队列容量 = 50(平衡内存和缓冲)
*/
@Bean("renewalRefreshExecutor")
public Executor renewalRefreshExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// ✅ 集群环境固定配置(按CPU核数=2计算)
int corePoolSize = 3; // CPU核数(2) + 1
int maxPoolSize = 6; // 核心线程数 × 2
int queueCapacity = 50; // 队列容量
// 核心线程数:3(适合IO密集型任务)
executor.setCorePoolSize(corePoolSize);
// 最大线程数:6(应对突发流量)
executor.setMaxPoolSize(maxPoolSize);
// 队列容量:50(平衡内存使用和任务缓冲)
executor.setQueueCapacity(queueCapacity);
// 线程名前缀:便于日志追踪
executor.setThreadNamePrefix("renewal-refresh-");
// 线程存活时间:60秒
executor.setKeepAliveSeconds(60);
// 允许核心线程超时回收(节省资源)
executor.setAllowCoreThreadTimeOut(true);
// 拒绝策略:由调用线程执行,避免任务丢失
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// 等待所有任务结束后再关闭线程池
executor.setWaitForTasksToCompleteOnShutdown(true);
// 等待时间:60秒
executor.setAwaitTerminationSeconds(60);
executor.initialize();
log.info("续签刷新线程池初始化完成(集群固定配置) - 核心线程: {}, 最大线程: {}, 队列容量: {}",
corePoolSize, maxPoolSize, queueCapacity);
return executor;
}
} }
...@@ -288,4 +288,28 @@ public class InsuranceDaprUtil { ...@@ -288,4 +288,28 @@ public class InsuranceDaprUtil {
return res; return res;
} }
/**
* @Description: 按项目生成商险续签待办(供项目配置新增时调用)
* @Author: system
* @Date: 2026-05-19
* @param deptNo 项目编码
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
public R<Boolean> createInsuranceAlertByDeptNo(String deptNo) {
BaseSearchVO paramVo = new BaseSearchVO();
paramVo.setDeptNo(deptNo);
R<Boolean> res = HttpDaprUtil.invokeMethodPost(
daprInsurancesProperties.getAppUrl(),
daprInsurancesProperties.getAppId(),
"/tinsurancewarn/inner/createInsuranceAlert",
paramVo,
Boolean.class,
SecurityConstants.FROM_IN
);
if (Common.isEmpty(res)) {
return R.failed("按项目生成商险续签待办失败!");
}
return res;
}
} }
...@@ -6,6 +6,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; ...@@ -6,6 +6,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
...@@ -209,8 +210,9 @@ public class TInsurancesWarnController { ...@@ -209,8 +210,9 @@ public class TInsurancesWarnController {
@Operation(description = "每天刷新商险到期提醒信息") @Operation(description = "每天刷新商险到期提醒信息")
@Inner @Inner
@PostMapping("/inner/createInsuranceAlert") @PostMapping("/inner/createInsuranceAlert")
public void createInsuranceAlert() { public void createInsuranceAlert(@RequestBody(required = false) BaseSearchVO paramVo) {
insuranceWarnService.createInsuranceAlert(); String deptNo = Common.isNotNull(paramVo) ? paramVo.getDeptNo() : null;
insuranceWarnService.createInsuranceAlert(deptNo);
} }
/** /**
......
...@@ -37,10 +37,26 @@ public interface TInsuranceWarnMapper extends BaseMapper<TInsuranceAlert> { ...@@ -37,10 +37,26 @@ public interface TInsuranceWarnMapper extends BaseMapper<TInsuranceAlert> {
*/ */
List<TInsuranceAlert> selectInsuranceAlert(); List<TInsuranceAlert> selectInsuranceAlert();
/**
* 按项目查询商险到期提醒信息
*
* @param deptNo 项目编码
* @return {@link List < TInsuranceAlert >}
*/
List<TInsuranceAlert> selectInsuranceAlertByDeptNo(@Param("deptNo") String deptNo);
List<InsuranceAlertWx> getInsuranceAlertToWx(); List<InsuranceAlertWx> getInsuranceAlertToWx();
List<TInsuranceAlert> selectInsuranceAlertIgnore(); List<TInsuranceAlert> selectInsuranceAlertIgnore();
/**
* 按项目查询已忽略的商险提醒数据
*
* @param deptNo 项目编码
* @return {@link List < TInsuranceAlert >}
*/
List<TInsuranceAlert> selectInsuranceAlertIgnoreByDeptNo(@Param("deptNo") String deptNo);
// 查找ID与状态,用作忽略等 // 查找ID与状态,用作忽略等
List<TInsuranceAlert> selectInsuranceAlertList(@Param("idList") List<String> idList); List<TInsuranceAlert> selectInsuranceAlertList(@Param("idList") List<String> idList);
// 查找ID与状态,用作确认等(与忽略不同的地方:返回的ID不同,更新不同的表数据 // 查找ID与状态,用作确认等(与忽略不同的地方:返回的ID不同,更新不同的表数据
......
...@@ -26,7 +26,8 @@ public interface TInsuranceWarnService extends IService<TInsuranceAlert> { ...@@ -26,7 +26,8 @@ public interface TInsuranceWarnService extends IService<TInsuranceAlert> {
// 商险待续保导出 // 商险待续保导出
void exportTInsuranceAlert(TInsuranceAlertSearchVo searchVo, HttpServletResponse response); void exportTInsuranceAlert(TInsuranceAlertSearchVo searchVo, HttpServletResponse response);
void createInsuranceAlert(); // 生成商险续签待办(支持按项目过滤)
void createInsuranceAlert(String deptNo);
void pushInsuranceAlertToWx(); void pushInsuranceAlertToWx();
......
...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.impl; ...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.impl;
import com.alibaba.excel.EasyExcelFactory; import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -181,12 +182,27 @@ public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper, ...@@ -181,12 +182,27 @@ public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper,
} }
@Override @Override
public void createInsuranceAlert() { public void createInsuranceAlert(String deptNo) {
//批量删除所有未忽略的提醒数据 // 批量删除所有未忽略的提醒数据
baseMapper.delete(Wrappers.<TInsuranceAlert>query().lambda() LambdaQueryWrapper<TInsuranceAlert> deleteWrapper = Wrappers.<TInsuranceAlert>query().lambda()
.eq(TInsuranceAlert::getExpireIgnoreFlag, CommonConstants.ONE_STRING)); .eq(TInsuranceAlert::getExpireIgnoreFlag, CommonConstants.ONE_STRING);
//批量生成或者更新商险到期提醒数据
List<TInsuranceAlert> list = baseMapper.selectInsuranceAlert(); // ✅ 如果传入了项目编码,则只删除该项目的数据
if (Common.isNotNull(deptNo)) {
deleteWrapper.eq(TInsuranceAlert::getDeptNo, deptNo);
}
baseMapper.delete(deleteWrapper);
// 批量生成或者更新商险到期提醒数据
List<TInsuranceAlert> list;
if (Common.isNotNull(deptNo)) {
// ✅ 按项目查询(需要新增查询方法)
list = baseMapper.selectInsuranceAlertByDeptNo(deptNo);
} else {
// 全局查询(原逻辑)
list = baseMapper.selectInsuranceAlert();
}
//获取所有在用的(未删除未锁定)MVP的用户信息 //获取所有在用的(未删除未锁定)MVP的用户信息
String userIds; String userIds;
R<Set<String>> onlineSetTemp; R<Set<String>> onlineSetTemp;
...@@ -295,13 +311,25 @@ public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper, ...@@ -295,13 +311,25 @@ public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper,
} }
//批量删除已忽略且人员离职的数据 //批量删除已忽略且人员离职的数据
List<TInsuranceAlert> listIgnore = baseMapper.selectInsuranceAlertIgnore(); List<TInsuranceAlert> listIgnore;
if (Common.isNotNull(deptNo)) {
// ✅ 按项目查询已忽略的提醒数据
listIgnore = baseMapper.selectInsuranceAlertIgnoreByDeptNo(deptNo);
} else {
// 全局查询(原逻辑)
listIgnore = baseMapper.selectInsuranceAlertIgnore();
}
onlineSetTemp = new R<>(); onlineSetTemp = new R<>();
onlineSetTemp = getSetR(listIgnore, onlineSetTemp); onlineSetTemp = getSetR(listIgnore, onlineSetTemp);
if (Common.isNotKong(onlineSetTemp.getData())){ if (Common.isNotKong(onlineSetTemp.getData())){
//批量删除已忽略且人员离职的数据 //批量删除已忽略且人员离职的数据
baseMapper.delete(Wrappers.<TInsuranceAlert>query().lambda() LambdaQueryWrapper<TInsuranceAlert> deleteIgnoreWrapper = Wrappers.<TInsuranceAlert>query().lambda()
.in(TInsuranceAlert::getEmpIdcardNo, onlineSetTemp.getData())); .in(TInsuranceAlert::getEmpIdcardNo, onlineSetTemp.getData());
// ✅ 如果传入了项目编码,则只删除该项目的数据
if (Common.isNotNull(deptNo)) {
deleteIgnoreWrapper.eq(TInsuranceAlert::getDeptNo, deptNo);
}
baseMapper.delete(deleteIgnoreWrapper);
} }
} }
......
...@@ -584,6 +584,119 @@ ...@@ -584,6 +584,119 @@
AND a.IS_EFFECT = 0 AND a.IS_EFFECT = 0
</select> </select>
<!-- 按项目查询商险到期提醒 -->
<select id="selectInsuranceAlertByDeptNo" resultMap="BaseResultMap">
SELECT
a.ID,
a.EMP_NAME,
a.EMP_IDCARD_NO,
a.DEPT_NO,
a.DEPT_NAME,
a.POST,
a.INSURANCE_COMPANY_NAME,
a.INSURANCE_TYPE_NAME,
a.INSURANCE_CITY_NAME,
a.INSURANCE_HANDLE_CITY_NAME,
a.INSURANCE_HANDLE_PROVINCE_NAME,
a.INSURANCE_PROVINCE_NAME,
a.BUY_STANDARD,
a.UNIT_NAME,
a.UNIT_NO,
a.SETTLE_TYPE,
a.POLICY_EFFECT,
a.EXPIRE_REMARK,
a.EXPIRE_IGNORE_FLAG,
a.SETTLE_MONTH,
a.POLICY_START,
a.POLICY_END,
a.ACTUAL_PREMIUM,
a.ESTIMATE_PREMIUM,
a.INVOICE_NO,
a.MEDICAL_QUOTA,
a.DIE_DISABLE_QUOTA,
a.DEPT_ID,
a.POLICY_NO,
IF( a.POLICY_END >= curdate(), 0, 1 ) IS_OVERDUE,
a.REMARK,
a.CREATE_BY,
a.DELETE_FLAG,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME,
a.IS_EFFECT,
a.CREATE_USER_DEPT_NAME
,d.ID INSURANCES_PRE_RENEW_DETAIL_ID
,a.BUY_TYPE
,ep.config_id
,ep.config_name
,a.IS_ADRESS,a.REPLACE_TAG
FROM
t_insurance_detail a
INNER JOIN (
SELECT
h.endTime,
max( l.POLICY_START ) POLICY_START,
l.EMP_IDCARD_NO,
l.INSURANCE_COMPANY_NAME,
l.INSURANCE_TYPE_NAME
FROM
(
SELECT
b.EMP_IDCARD_NO,
max( b.POLICY_END ) endTime
FROM
t_insurance_detail b
WHERE
b.POLICY_START BETWEEN date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND curdate()
AND b.IS_EFFECT = 0
AND b.DELETE_FLAG = '0'
AND b.DEPT_NO = #{deptNo}
AND NOT EXISTS (
SELECT
1
FROM
t_insurance_detail ea
WHERE
ea.POLICY_START >= date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND ea.IS_EFFECT = 0
AND ea.DELETE_FLAG = '0'
AND ea.POLICY_END >= date_add( curdate(), INTERVAL 1 MONTH )
AND ea.EMP_IDCARD_NO = b.EMP_IDCARD_NO
AND ea.INSURANCE_COMPANY_NAME = b.INSURANCE_COMPANY_NAME
AND ea.INSURANCE_TYPE_NAME = b.INSURANCE_TYPE_NAME
)
GROUP BY
b.EMP_IDCARD_NO,
b.INSURANCE_COMPANY_NAME,
b.INSURANCE_TYPE_NAME
) h
INNER JOIN t_insurance_detail l ON h.EMP_IDCARD_NO = l.EMP_IDCARD_NO
AND l.DELETE_FLAG = '0'
AND h.endTime = l.POLICY_END
AND l.POLICY_START BETWEEN date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND curdate()
WHERE
l.EXPIRE_IGNORE_FLAG = '1'
GROUP BY
l.EMP_IDCARD_NO,
l.INSURANCE_COMPANY_NAME,
l.INSURANCE_TYPE_NAME,
l.POLICY_END
) ll ON ll.EMP_IDCARD_NO = a.EMP_IDCARD_NO
AND ll.POLICY_START = a.POLICY_START
AND ll.endTime = a.POLICY_END
AND ll.INSURANCE_COMPANY_NAME = a.INSURANCE_COMPANY_NAME
AND ll.INSURANCE_TYPE_NAME = a.INSURANCE_TYPE_NAME
LEFT JOIN t_insurance_pre_renew_detail d on d.INSURANCES_ID = a.id
LEFT JOIN t_employee_insurance_pre ep on ep.INSURANCES_ID = a.id
where a.DELETE_FLAG = '0'
AND a.EXPIRE_IGNORE_FLAG = '1'
AND a.IS_EFFECT = 0
AND a.DEPT_NO = #{deptNo}
</select>
<resultMap id="PushWxResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAlertWx"> <resultMap id="PushWxResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAlertWx">
<result property="projectName" column="DEPT_NAME" jdbcType="VARCHAR"/> <result property="projectName" column="DEPT_NAME" jdbcType="VARCHAR"/>
<result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/> <result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
...@@ -607,6 +720,18 @@ ...@@ -607,6 +720,18 @@
where a.DELETE_FLAG = '0' and a.EXPIRE_IGNORE_FLAG = '0' where a.DELETE_FLAG = '0' and a.EXPIRE_IGNORE_FLAG = '0'
</select> </select>
<!-- 按项目查询已忽略的商险提醒数据 -->
<select id="selectInsuranceAlertIgnoreByDeptNo" resultMap="BaseResultMap">
SELECT
a.ID,
a.EMP_NAME,
a.EMP_IDCARD_NO
FROM
t_insurance_alert a
where a.DELETE_FLAG = '0' and a.EXPIRE_IGNORE_FLAG = '0'
AND a.DEPT_NO = #{deptNo}
</select>
<select id="selectInsuranceAlertList" resultMap="BaseResultMap"> <select id="selectInsuranceAlertList" resultMap="BaseResultMap">
SELECT SELECT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment