Commit d0d21995 authored by huyuchen's avatar huyuchen

huych-社保自动化相关提交

parent 9ef521e5
......@@ -175,34 +175,45 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
.eq(TSocialPreDetail::getRegisterId, registrationPreVo.getExitSocialInfoList()
.get(0).getRegisterId()));
//批量新增
for (TSocialPreDetailVo vo :registrationPreVo.getExitSocialInfoList()) {
for (TSocialPreDetailVo vo : registrationPreVo.getExitSocialInfoList()) {
TSocialPreDetail preDetal = new TSocialPreDetail();
BeanUtils.copyProperties(vo, preDetal);
socialPreDetailService.save(preDetal);
}
//批量删除社保待购买列表中的待确认、待派单、派单失败、审核、办理失败的数据
baseMapper.delete(Wrappers.<TDispatchInfoPre>query().lambda().in(
TDispatchInfoPre::getProcessStatus,Arrays.asList("0", "1", "2", "4","8"))
.eq(TDispatchInfoPre::getRegisterId,registrationPreVo.getExitSocialInfoList()
TDispatchInfoPre::getProcessStatus, Arrays.asList("0", "1", "2", "4", "8"))
.eq(TDispatchInfoPre::getRegisterId, registrationPreVo.getExitSocialInfoList()
.get(0).getRegisterId()));
} else {
//删除已存在的入职确认信息对应的社保明细
TDispatchInfoPreVo preVo = registrationPreVo.getDispatchInfoPreVo();
socialPreDetailService.remove(Wrappers.<TSocialPreDetail>lambdaQuery()
.eq(TSocialPreDetail::getRegisterId, preVo.getRegisterId()));
if (Common.isNotNull(preVo) && Common.isNotNull(preVo.getId())) {
//更新逻辑
TDispatchInfoPre pre = new TDispatchInfoPre();
BeanUtils.copyProperties(preVo, pre);
baseMapper.updateById(pre);
}
if (Common.isNotNull(preVo) && Common.isEmpty(preVo.getId())) {
try {
try {
if (Common.isNotNull(preVo) && Common.isNotNull(preVo.getId())) {
//更新逻辑
TDispatchInfoPre pre = new TDispatchInfoPre();
BeanUtils.copyProperties(preVo, pre);
//时间格式转化
if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 15:20", DateUtil.DATETIME_PATTERN_MINUTE));
pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
}
if (Common.isNotNull(preVo.getExpectedConfirmTime())) {
preVo.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 09:00", DateUtil.DATETIME_PATTERN_MINUTE));
pre.setExpectedConfirmTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedConfirmTime()));
}
baseMapper.updateById(pre);
}
if (Common.isNotNull(preVo) && Common.isEmpty(preVo.getId())) {
//判断是否存在社保待购买信息
TDispatchInfoPre preExit = baseMapper.selectOne(Wrappers.<TDispatchInfoPre>query().lambda()
.eq(TDispatchInfoPre::getRegisterId, preVo.getRegisterId())
.eq(TDispatchInfoPre::getEmpIdcard, preVo.getEmpIdcard())
.in(TDispatchInfoPre::getProcessStatus, Arrays.asList("0", "1", "2", "4","8"))
.in(TDispatchInfoPre::getProcessStatus, Arrays.asList("0", "1", "2", "4", "8"))
.last(CommonConstants.LAST_ONE_SQL));
TDispatchInfoPre pre = new TDispatchInfoPre();
BeanUtils.copyProperties(preVo, pre);
......@@ -252,10 +263,10 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
baseMapper.deleteById(preExit);
}
baseMapper.insert(pre);
} catch (Exception e) {
log.error("执行异常", e);
return false;
}
} catch (Exception e) {
log.error("执行异常", e);
return false;
}
}
return true;
......@@ -575,13 +586,20 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
.atZone(ZoneId.systemDefault())
.toLocalDate();
// 添加年数和月数
localDate = localDate
.plusYears(vo.getYearAfter())
.plusMonths(vo.getMonthAfter())
.minusDays(1);
// 转回Date类型
return Date.from(localDate.atStartOfDay()
.atZone(ZoneId.systemDefault())
.toInstant());
if (vo.getMonthAfter() == 0 && vo.getYearAfter() == 0) {
// 转回Date类型
return Date.from(localDate.atStartOfDay()
.atZone(ZoneId.systemDefault())
.toInstant());
} else {
localDate = localDate
.plusYears(vo.getYearAfter())
.plusMonths(vo.getMonthAfter())
.minusDays(1);
// 转回Date类型
return Date.from(localDate.atStartOfDay()
.atZone(ZoneId.systemDefault())
.toInstant());
}
}
}
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