Commit 30815819 authored by huyuchen's avatar huyuchen

生成收入接口修改

parent 36c83011
...@@ -380,7 +380,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -380,7 +380,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTPaymentSocialInfo(cachedDataList, errorMessageList, random, user, rowNumber); importTPaymentSocialInfo(cachedDataList, errorMessageList, user, rowNumber);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -392,7 +392,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -392,7 +392,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
private void importTPaymentSocialInfo(List<TPaymentInfoVo> list, List<ErrorMessage> errorMessageList, private void importTPaymentSocialInfo(List<TPaymentInfoVo> list, List<ErrorMessage> errorMessageList,
String random, YifuUser user, Integer rowNumber) { YifuUser user, Integer rowNumber) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
HashMap<String, String> areaMap = new HashMap<>(); HashMap<String, String> areaMap = new HashMap<>();
...@@ -404,7 +404,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -404,7 +404,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (SysArea area : areaList.getSysAreaList()) { for (SysArea area : areaList.getSysAreaList()) {
areaMap.put(Integer.toString(area.getId()), area.getAreaName()); areaMap.put(Integer.toString(area.getId()), area.getAreaName());
areaMap2.put(area.getAreaName() + CommonConstants.DOWN_LINE_STRING + ( areaMap2.put(area.getAreaName() + CommonConstants.DOWN_LINE_STRING + (
null == area.getParentId() ? "null" : (0 == area.getParentId().intValue() ? "null" : Integer.toString( null == area.getParentId() ? "null" : (0 == area.getParentId() ? "null" : Integer.toString(
area.getParentId()))), Integer.toString(area.getId())); area.getParentId()))), Integer.toString(area.getId()));
} }
} }
...@@ -523,10 +523,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -523,10 +523,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
} }
// -----------------------------生成paymentInfoMap本段结束-------------------------------- // -----------------------------生成paymentInfoMap本段结束--------------------------------
/**
* 修改批量导入社保为线程池的方式。逻辑分析,根据前端传入的list,将list分成每份partSize个。
* 有以下3种情况。1.list数量不足partSize,直接进行处理;2.list数量正好可以根据partSize等分,循环处理;3.不能等分有剩余的情况
*/
// -----------------------------线程池处理list,批量保存社保信息开始-------------------------------- // -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentInfoVo> tempList = new ArrayList<>(); List<TPaymentInfoVo> tempList = new ArrayList<>();
...@@ -544,15 +540,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -544,15 +540,15 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String sumNumKey = user.getId() + CommonConstants.DOWN_LINE_STRING + "sum_key"; String sumNumKey = user.getId() + CommonConstants.DOWN_LINE_STRING + "sum_key";
Integer bfInt = (Integer) redisUtil.get(sumNumKey); Integer bfInt = (Integer) redisUtil.get(sumNumKey);
if (Common.isNotNull(bfInt)) { if (Common.isNotNull(bfInt)) {
if (bfInt <= rowNumber.intValue()) { if (rowNumber >= bfInt) {
maerialRatio = numberFormat.format((float) bfInt.intValue() / (float) rowNumber.intValue() * 100); maerialRatio = numberFormat.format(((float) bfInt / (float) rowNumber) * 100);
bfInt = bfInt + 100; bfInt = bfInt + 100;
} else { } else {
maerialRatio = "100"; maerialRatio = "100";
} }
}else { }else {
if (100 <= rowNumber.intValue()) { if (rowNumber >= 100) {
maerialRatio = numberFormat.format((float) 100 / (float) rowNumber.intValue() * 100); maerialRatio = numberFormat.format(((float) 100 / (float) rowNumber) * 100);
bfInt = 100; bfInt = 100;
} else { } else {
maerialRatio = "100"; maerialRatio = "100";
...@@ -756,25 +752,24 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -756,25 +752,24 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
continue; continue;
} }
//无对应员工的社保数据 //无对应员工的社保数据
if (null != socialMap) { //采用客服导入的地址
//采用客服导入的地址 areaArray = infoVo.getSocialPayAddr().split(CommonConstants.CENTER_SPLIT_LINE_STRING);
areaArray = infoVo.getSocialPayAddr().split(CommonConstants.CENTER_SPLIT_LINE_STRING); infoVo = initAddress(areaArray, areaMap2, infoVo);
infoVo = initAddress(areaArray, areaMap2, infoVo); socialInfo = socialMap.get(infoVo.getEmpIdcard()
socialInfo = socialMap.get(infoVo.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + infoVo.getSocialProvince()
+ CommonConstants.DOWN_LINE_STRING + infoVo.getSocialProvince() + CommonConstants.DOWN_LINE_STRING + infoVo.getSocialCity()
+ CommonConstants.DOWN_LINE_STRING + infoVo.getSocialCity() + CommonConstants.DOWN_LINE_STRING + (null == infoVo.getSocialTown()
+ CommonConstants.DOWN_LINE_STRING + (null == infoVo.getSocialTown() ? "null" : infoVo.getSocialTown()));
? "null" : infoVo.getSocialTown())); //对身份证与人员姓名的对应关系进行校验
//对身份证与人员姓名的对应关系进行校验 if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) {
if (socialInfo != null && !socialInfo.getEmpName().equals(infoVo.getEmpName())) { errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!"));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "姓名与身份证信息不一致,请核实后再次尝试!")); continue;
continue; }
} if (socialInfo != null && socialInfo.getSocialStartDate() == null) {
if (socialInfo != null && socialInfo.getSocialStartDate() == null) { errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!"));
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpIdcard() + "的社保起缴日期为空!")); continue;
continue;
}
} }
if (null == socialInfo) { if (null == socialInfo) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "无对应员工" + errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "无对应员工" +
infoVo.getEmpIdcard() + "的社保数据(请查验社保缴纳地)")); infoVo.getEmpIdcard() + "的社保数据(请查验社保缴纳地)"));
...@@ -945,21 +940,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -945,21 +940,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
.eq(TSocialInfo::getEmpIdcard, infoVo.getEmpIdcard()).groupBy(TSocialInfo::getCreateTime) .eq(TSocialInfo::getEmpIdcard, infoVo.getEmpIdcard()).groupBy(TSocialInfo::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (null == paymentInfo) { paymentInfo = new TPaymentInfo();
paymentInfo = new TPaymentInfo(); paymentInfo.setLockStatus(CommonConstants.ZERO_STRING);
paymentInfo.setLockStatus(CommonConstants.ZERO_STRING); paymentInfo.setEmpId(socialInfo.getEmpId());
paymentInfo.setEmpId(socialInfo.getEmpId()); paymentInfo.setEmpIdcard(socialInfo.getEmpIdcard());
paymentInfo.setEmpIdcard(socialInfo.getEmpIdcard()); paymentInfo.setEmpName(socialInfo.getEmpName());
paymentInfo.setEmpName(socialInfo.getEmpName()); paymentInfo.setSettleDomainId(socialInfo.getSettleDomain());
paymentInfo.setSettleDomainId(socialInfo.getSettleDomain()); paymentInfo.setSettleDomainName(socialInfo.getSettleDomainName());
paymentInfo.setSettleDomainName(socialInfo.getSettleDomainName()); paymentInfo.setSettleDomainCode(socialInfo.getSettleDomainCode());
paymentInfo.setSettleDomainCode(socialInfo.getSettleDomainCode()); paymentInfo.setUnitId(socialInfo.getUnitId());
paymentInfo.setUnitId(socialInfo.getUnitId()); paymentInfo.setUnitName(socialInfo.getUnitName());
paymentInfo.setUnitName(socialInfo.getUnitName()); if (Common.isNotNull(tSocialInfo)) {
if (Common.isNotNull(tSocialInfo)) { paymentInfo.setInauguralTeam(tSocialInfo.getInauguralTeam());
paymentInfo.setInauguralTeam(tSocialInfo.getInauguralTeam()); paymentInfo.setEmpNo(tSocialInfo.getEmpNo());
paymentInfo.setEmpNo(tSocialInfo.getEmpNo());
}
} }
paymentInfo.setSocialProvince(socialInfo.getSocialProvince()); paymentInfo.setSocialProvince(socialInfo.getSocialProvince());
paymentInfo.setSocialCity(socialInfo.getSocialCity()); paymentInfo.setSocialCity(socialInfo.getSocialCity());
...@@ -1033,20 +1026,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1033,20 +1026,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setSumAll(paymentInfo.getSocialSum()); paymentInfo.setSumAll(paymentInfo.getSocialSum());
paymentInfo.setCreateBy(user.getId()); paymentInfo.setCreateBy(user.getId());
paymentInfo.setCreateName(user.getNickname()); paymentInfo.setCreateName(user.getNickname());
if (null != paymentInfo && Common.isEmpty(paymentInfo.getSocialId())) { if (Common.isEmpty(paymentInfo.getSocialId())) {
paymentInfo.setSocialId(UUID.randomUUID().toString()); paymentInfo.setSocialId(UUID.randomUUID().toString());
} }
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) { if (Common.isNotNull(paymentInfo.getId())) {
res = baseMapper.updateById(paymentInfo); res = baseMapper.updateById(paymentInfo);
if (res < 0) { if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库更新失败!")); errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库更新失败!"));
continue;
} }
} else { } else {
res = insertAndSTimestamp(paymentInfo); res = insertAndSTimestamp(paymentInfo);
if (res < 0) { if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库保存失败!")); errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + "_缴费库保存失败!"));
continue;
} }
} }
} }
...@@ -1175,7 +1166,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1175,7 +1166,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTPaymentSocialHeFei(cachedDataList, errorMessageList, random, user, type,rowNumber); importTPaymentSocialHeFei(cachedDataList, errorMessageList, user, type,rowNumber);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -1188,7 +1179,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1188,7 +1179,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override @Override
public R<List<ErrorMessage>> batchImportPaymentFundInfo(InputStream inputStream) { public R<List<ErrorMessage>> batchImportPaymentFundInfo(InputStream inputStream) {
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TPaymentInfoVo> util1 = new ExcelUtil<>(TPaymentInfoVo.class); ExcelUtil<TPaymentInfoVo> util1 = new ExcelUtil<>(TPaymentInfoVo.class);
// 写法2: // 写法2:
...@@ -1233,7 +1223,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1233,7 +1223,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
batchSavePaymentFundInfo(cachedDataList, errorMessageList, user); batchSavePaymentFundInfo(cachedDataList, errorMessageList);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -1244,7 +1234,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1244,7 +1234,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return R.ok(errorMessageList); return R.ok(errorMessageList);
} }
private void batchSavePaymentFundInfo(List<TPaymentInfoVo> list, List<ErrorMessage> errorMessageList, YifuUser user) { private void batchSavePaymentFundInfo(List<TPaymentInfoVo> list, List<ErrorMessage> errorMessageList) {
HashMap<String, String> areaMap = new HashMap<String, String>(); HashMap<String, String> areaMap = new HashMap<String, String>();
R<AreaVo> areaListR = upmsDaprUtils.getAreaListR(); R<AreaVo> areaListR = upmsDaprUtils.getAreaListR();
...@@ -1382,22 +1372,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1382,22 +1372,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
TProvidentFund tProvidentFund = providentFundMapper.selectOne(Wrappers.<TProvidentFund>query().lambda() TProvidentFund tProvidentFund = providentFundMapper.selectOne(Wrappers.<TProvidentFund>query().lambda()
.eq(TProvidentFund::getEmpIdcard, infoVo.getEmpIdcard()).groupBy(TProvidentFund::getCreateTime) .eq(TProvidentFund::getEmpIdcard, infoVo.getEmpIdcard()).groupBy(TProvidentFund::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (null == paymentInfo) { paymentInfo = new TPaymentInfo();
paymentInfo = new TPaymentInfo(); paymentInfo.setLockStatus(CommonConstants.ZERO_STRING);
paymentInfo.setLockStatus(CommonConstants.ZERO_STRING); paymentInfo.setEmpId(fund.getEmpId());
paymentInfo.setEmpId(fund.getEmpId()); paymentInfo.setEmpIdcard(fund.getEmpIdcard());
paymentInfo.setEmpIdcard(fund.getEmpIdcard()); paymentInfo.setEmpName(fund.getEmpName());
paymentInfo.setEmpName(fund.getEmpName()); paymentInfo.setSettleDomainId(fund.getSettleDomainFund());
paymentInfo.setSettleDomainId(fund.getSettleDomainFund()); paymentInfo.setSettleDomainName(fund.getSettleDomainNameFund());
paymentInfo.setSettleDomainName(fund.getSettleDomainNameFund()); paymentInfo.setSettleDomainCode(fund.getSettleDomainCodeFund());
paymentInfo.setSettleDomainCode(fund.getSettleDomainCodeFund()); paymentInfo.setUnitId(fund.getUnitIdFund());
paymentInfo.setUnitId(fund.getUnitIdFund()); paymentInfo.setUnitName(fund.getUnitNameFund());
paymentInfo.setUnitName(fund.getUnitNameFund());
if (Common.isNotNull(tProvidentFund)) {
if (Common.isNotNull(tProvidentFund)) { paymentInfo.setInauguralTeam(tProvidentFund.getInauguralTeam());
paymentInfo.setInauguralTeam(tProvidentFund.getInauguralTeam()); paymentInfo.setEmpNo(tProvidentFund.getEmpNo());
paymentInfo.setEmpNo(tProvidentFund.getEmpNo());
}
} }
paymentInfo.setProvidentPayMonth(infoVo.getProvidentPayMonth()); paymentInfo.setProvidentPayMonth(infoVo.getProvidentPayMonth());
paymentInfo.setFundProvince(fund.getFundProvince()); paymentInfo.setFundProvince(fund.getFundProvince());
...@@ -1434,10 +1422,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1434,10 +1422,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setUnitProvidentSum(null == infoVo.getUnitProvidentSum() ? BigDecimal.ZERO : infoVo.getUnitProvidentSum()); paymentInfo.setUnitProvidentSum(null == infoVo.getUnitProvidentSum() ? BigDecimal.ZERO : infoVo.getUnitProvidentSum());
paymentInfo.setProvidentSum(null == infoVo.getProvidentSum() ? BigDecimal.ZERO : infoVo.getProvidentSum()); paymentInfo.setProvidentSum(null == infoVo.getProvidentSum() ? BigDecimal.ZERO : infoVo.getProvidentSum());
paymentInfo.setSumAll(paymentInfo.getProvidentSum()); paymentInfo.setSumAll(paymentInfo.getProvidentSum());
if (null != paymentInfo && Common.isEmpty(paymentInfo.getFundId())) { if (Common.isEmpty(paymentInfo.getFundId())) {
paymentInfo.setFundId(UUID.randomUUID().toString()); paymentInfo.setFundId(UUID.randomUUID().toString());
} }
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) { if (Common.isNotNull(paymentInfo.getId())) {
res = baseMapper.updateById(paymentInfo); res = baseMapper.updateById(paymentInfo);
if (res < 0) { if (res < 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() + errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), infoVo.getEmpName() +
...@@ -1452,7 +1440,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1452,7 +1440,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
continue; continue;
} }
} }
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId()) && Common.isNotNull(paymentInfo.getFundId())) { if (Common.isNotNull(paymentInfo.getId()) && Common.isNotNull(paymentInfo.getFundId())) {
paymentInfoMap.put(paymentInfo.getProvidentPayAddr() paymentInfoMap.put(paymentInfo.getProvidentPayAddr()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+ paymentInfo.getEmpIdcard().trim() + paymentInfo.getEmpIdcard().trim()
...@@ -1474,7 +1462,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1474,7 +1462,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
private void importTPaymentSocialHeFei(List<TPaymentHeFeiVo> list, List<ErrorMessage> errorMessageList, private void importTPaymentSocialHeFei(List<TPaymentHeFeiVo> list, List<ErrorMessage> errorMessageList,
String random, YifuUser user, String type, Integer rowNumber) { YifuUser user, String type, Integer rowNumber) {
HashMap<String, String> areaMap = new HashMap<>(); HashMap<String, String> areaMap = new HashMap<>();
HashMap<String, String> areaMap2 = new HashMap<>(); HashMap<String, String> areaMap2 = new HashMap<>();
...@@ -1586,11 +1574,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1586,11 +1574,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
// -----------------------------生成paymentInfoMap本段结束-------------------------------- // -----------------------------生成paymentInfoMap本段结束--------------------------------
/**
* 修改批量导入社保为线程池的方式。逻辑分析,根据前端传入的list,将list分成每份partSize个。
* 有以下3种情况。1.list数量不足partSize,直接进行处理;2.list数量正好可以根据partSize等分,循环处理;3.不能等分有剩余的情况
*/
// -----------------------------线程池处理list,批量保存社保信息开始-------------------------------- // -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentHeFeiVo> tempList = new ArrayList<>(); List<TPaymentHeFeiVo> tempList = new ArrayList<>();
AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT); AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT);
...@@ -1627,7 +1610,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1627,7 +1610,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// 1.list.size()不足partSize,直接执行 // 1.list.size()不足partSize,直接执行
if (list.size() < partSize) { if (list.size() < partSize) {
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2, -> executeImportSocialListThree(user, atomicLine, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
paymentInfoBigMap,CommonConstants.ONE_INT, type, errorMessageList), paymentInfoBigMap,CommonConstants.ONE_INT, type, errorMessageList),
yfSocialImportThreadPoolExecutor); yfSocialImportThreadPoolExecutor);
...@@ -1640,7 +1623,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1640,7 +1623,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// 处理第一个0位元素 // 处理第一个0位元素
final List<TPaymentHeFeiVo> finalList = list.subList(0, 1); final List<TPaymentHeFeiVo> finalList = list.subList(0, 1);
CompletableFuture<List<ErrorMessage>> oneCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> oneCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap, -> executeImportSocialListThree(user, atomicLine, finalList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, paymentInfoBigMap,CommonConstants.ONE_INT, type, paymentInfoInjuryMap, paymentInfoBigMap,CommonConstants.ONE_INT, type,
errorMessageList), yfSocialImportThreadPoolExecutor); errorMessageList), yfSocialImportThreadPoolExecutor);
...@@ -1654,7 +1637,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1654,7 +1637,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
final int idx = i - partSize + 2; final int idx = i - partSize + 2;
List<TPaymentHeFeiVo> finalTempList1 = tempList; List<TPaymentHeFeiVo> finalTempList1 = tempList;
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList1 -> executeImportSocialListThree(user, atomicLine, finalTempList1
, areaMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, , areaMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap,
paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoBigMap,idx, type, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoBigMap,idx, type,
errorMessageList), yfSocialImportThreadPoolExecutor); errorMessageList), yfSocialImportThreadPoolExecutor);
...@@ -1681,7 +1664,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1681,7 +1664,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentHeFeiVo> finalTempList = tempList; List<TPaymentHeFeiVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1; int finalLastIdx = lastIdx + 1;
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap, -> executeImportSocialListThree(user, atomicLine, finalTempList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, paymentInfoBigMap,finalLastIdx, type, errorMessageList) paymentInfoInjuryMap, paymentInfoBigMap,finalLastIdx, type, errorMessageList)
, yfSocialImportThreadPoolExecutor); , yfSocialImportThreadPoolExecutor);
...@@ -1713,7 +1696,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1713,7 +1696,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
private List<ErrorMessage> executeImportSocialListThree(YifuUser user, AtomicInteger atomicLine, private List<ErrorMessage> executeImportSocialListThree(YifuUser user, AtomicInteger atomicLine,
String random,
List<TPaymentHeFeiVo> list, List<TPaymentHeFeiVo> list,
HashMap<String, String> areaMap, HashMap<String, String> areaMap,
HashMap<String, String> areaMap2, HashMap<String, String> areaMap2,
...@@ -2257,31 +2239,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2257,31 +2239,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override @Override
public void createPaymentInfoIncome() { public void createPaymentInfoIncome() {
BigDecimal sumSocial = BigDecimal.ZERO;
//判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入 //判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda() List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.between(TPaymentInfo::getCreateTime,LocalDateTimeUtils.getThatDayStartTime(LocalDateTime.now().plusDays(-1)), .between(TPaymentInfo::getCreateTime,LocalDateTimeUtils.getThatDayStartTime(LocalDateTime.now().plusDays(-1)),
LocalDateTimeUtils.getDayStart(LocalDateTime.now())) LocalDateTimeUtils.getDayStart(LocalDateTime.now()))
.isNotNull(TPaymentInfo::getSocialId)); .isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(sumList)) { if (Common.isNotNull(sumList)) {
List<TPaymentInfo> updateList = new ArrayList<>();
for (TPaymentInfo paymentInfo: sumList) {
//获取员工当前缴纳月总合计
List<TPaymentInfo> payInfoList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TPaymentInfo::getSocialPayMonth, paymentInfo.getSocialPayMonth())
.eq(TPaymentInfo::getSettleDomainId, paymentInfo.getSettleDomainId()));
if (Common.isNotNull(payInfoList)) {
for (TPaymentInfo payInfo:payInfoList)
sumSocial = BigDecimalUtils.safeAdd(sumSocial,payInfo.getSocialSum());
}
if (sumSocial.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT) {
continue;
}
updateList.add(paymentInfo);
}
//生成收入 //生成收入
createIncomeInfo(updateList,CommonConstants.ONE_STRING); createIncomeInfo(sumList,CommonConstants.ONE_STRING);
} }
} }
...@@ -2322,31 +2287,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2322,31 +2287,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
public void createPaymentInfoIncomeReal(YifuUser user) { public void createPaymentInfoIncomeReal(YifuUser user) {
BigDecimal sumSocial = BigDecimal.ZERO;
//判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入 //判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda() List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getCreateBy, user.getId()) .eq(TPaymentInfo::getCreateBy, user.getId())
.eq(TPaymentInfo::getIncomeStatus, CommonConstants.ONE_STRING) .eq(TPaymentInfo::getIncomeStatus, CommonConstants.ONE_STRING)
.isNotNull(TPaymentInfo::getSocialId)); .isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(sumList)) { if (Common.isNotNull(sumList)) {
List<TPaymentInfo> updateList = new ArrayList<>();
for (TPaymentInfo paymentInfo: sumList) {
//获取员工当前缴纳月总合计
List<TPaymentInfo> payInfoList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TPaymentInfo::getSocialPayMonth, paymentInfo.getSocialPayMonth())
.eq(TPaymentInfo::getSettleDomainId, paymentInfo.getSettleDomainId()));
if (Common.isNotNull(payInfoList)) {
for (TPaymentInfo payInfo:payInfoList)
sumSocial = BigDecimalUtils.safeAdd(sumSocial,payInfo.getSocialSum());
}
if (sumSocial.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT) {
continue;
}
updateList.add(paymentInfo);
}
//生成收入 //生成收入
createIncomeInfo(updateList,CommonConstants.ONE_STRING); createIncomeInfo(sumList,CommonConstants.ONE_STRING);
} }
} }
...@@ -2854,7 +2802,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2854,7 +2802,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (exitFlag) { if (exitFlag) {
continue; continue;
} }
if (sumMoney.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT) { if (sumMoney.compareTo(BigDecimal.ZERO) > 0) {
exitFlag = true; exitFlag = true;
} }
} }
......
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