Commit 0720e636 authored by 李灿灿's avatar 李灿灿

定时任务逻辑补充

parent 047d2a16
...@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils; ...@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil; import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil; import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*; import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -52,6 +53,7 @@ import java.util.stream.Collectors; ...@@ -52,6 +53,7 @@ import java.util.stream.Collectors;
* @date 2022-07-18 16:20:16 * @date 2022-07-18 16:20:16
*/ */
@Service @Service
@Slf4j
public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMapper, TInsuranceDetail> implements TInsuranceDetailService { public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMapper, TInsuranceDetail> implements TInsuranceDetailService {
@Resource @Resource
@Lazy @Lazy
...@@ -92,7 +94,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -92,7 +94,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/ */
@Override @Override
public void updateOverdueByTask() { public void updateOverdueByTask() {
//todo // 获取未失效的所有明细数据
List<TInsuranceDetail> list = this.baseMapper.selectList(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getIsEffect, CommonConstants.ZERO_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (CollectionUtils.isNotEmpty(list)){
log.info("定时任务扫描到的有效数据是:{}条",list.size());
list.stream().forEach(e -> {
if (!LocalDateUtil.isFutureDate(e.getPolicyEnd().toString())){
e.setIsEffect(CommonConstants.ONE_INT);
e.setUpdateTime(LocalDateTime.now());
}
});
List<TInsuranceDetail> collect = list.stream().filter(e -> e.getIsEffect() == CommonConstants.ONE_INT).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)){
log.info("定时任务扫描到的已失效数据是:{}条",collect.size());
this.updateBatchById(collect);
}
}
} }
/** /**
......
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