Commit 5e125b03 authored by huyuchen's avatar huyuchen

缴费库 代码修改

parent 99796814
...@@ -86,12 +86,4 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> { ...@@ -86,12 +86,4 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
* */ * */
List<TPaymentInfo> selectListForPaymentImport(@Param("months")List<String> months, @Param("idcards")List<String> idcards); List<TPaymentInfo> selectListForPaymentImport(@Param("months")List<String> months, @Param("idcards")List<String> idcards);
/*
* 已存在社保缴费库数据 非删除状态
* @param months
* @param idcards
* @return
* */
List<TPaymentInfoVo> selectPaymentAllInfoByMonthAndIdCard(@Param("months")List<String> months, @Param("idcards")List<String> idcards);
} }
...@@ -46,6 +46,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo; ...@@ -46,6 +46,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
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;
...@@ -53,7 +54,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -53,7 +54,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
...@@ -136,7 +136,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -136,7 +136,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfo.class).includeColumnFiledNames(searchVo.getExportFields()).build();; ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
;
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) { for (int i = 0; i <= count; ) {
...@@ -202,7 +203,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -202,7 +203,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override @Override
public R<Boolean> removeAllInfoById(String ids) { public R<Boolean> removeAllInfoById(String ids) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(ids)){ if (Common.isEmpty(ids)) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE); return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
} }
List<String> idList = Common.initStrToList(ids, CommonConstants.COMMA_STRING); List<String> idList = Common.initStrToList(ids, CommonConstants.COMMA_STRING);
...@@ -341,7 +342,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -341,7 +342,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList()); List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList());
//已存在社保缴费库数据 非删除状态 //已存在社保缴费库数据 非删除状态
List<TPaymentInfo> paymentInfos = baseMapper.selectListForPaymentImport(monthList, Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD)); List<TPaymentInfo> paymentInfos = baseMapper.selectListForPaymentImport(monthList, Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD));
//社保唯一性检验条件:身份证+社保缴纳月份+生成月份
//养老 //养老
ConcurrentHashMap<String, TPaymentInfo> paymentInfoPensionMap = new ConcurrentHashMap<>(); ConcurrentHashMap<String, TPaymentInfo> paymentInfoPensionMap = new ConcurrentHashMap<>();
//大病救助金 //大病救助金
...@@ -358,7 +358,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -358,7 +358,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (TPaymentInfo info : paymentInfos) { for (TPaymentInfo info : paymentInfos) {
if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getUnitPensionMoney()), if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getUnitPensionMoney()),
BigDecimalUtils.isNullToZero(info.getPersonalPensionMoney())).compareTo(BigDecimal.ZERO) != 0) { BigDecimalUtils.isNullToZero(info.getPersonalPensionMoney())).compareTo(BigDecimal.ZERO) != 0) {
paymentInfoBigMap.put(info.getSocialPayAddr() paymentInfoPensionMap.put(info.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+ info.getEmpIdcard() + info.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
...@@ -371,7 +371,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -371,7 +371,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getPersonalBigmailmentMoney()), if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getPersonalBigmailmentMoney()),
BigDecimalUtils.isNullToZero(info.getUnitBigmailmentMoney())).compareTo(BigDecimal.ZERO) != 0) { BigDecimalUtils.isNullToZero(info.getUnitBigmailmentMoney())).compareTo(BigDecimal.ZERO) != 0) {
paymentInfoPensionMap.put(info.getSocialPayAddr() paymentInfoBigMap.put(info.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+ info.getEmpIdcard() + info.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
...@@ -667,10 +667,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -667,10 +667,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
String[] areaArray; String[] areaArray;
List<TPaymentInfo> paymentInfoListTemp;
BigDecimal cTemp;
String result = null;
String lockKey;
String checkRes; String checkRes;
for (TPaymentInfoVo infoVo : list) { for (TPaymentInfoVo infoVo : list) {
atomicLine.incrementAndGet(); atomicLine.incrementAndGet();
...@@ -1587,15 +1583,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1587,15 +1583,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
getErrorMessageHashMapThree(user, random, errorMessageList, key, listMap); getErrorMessageHashMapThree(user, random, errorMessageList, key, listMap);
} }
// 导入前做队列空闲判断,防止队列不足出现数据丢失的场景
if (CollUtil.isNotEmpty(list)) {
int taskSize = list.size() / partSize + CommonConstants.ONE_INT;
int residualCapacity = yfSocialImportThreadPoolExecutor.getResidualCapacity();
if (taskSize > residualCapacity) {
errorMessageList.add(new ErrorMessage(-1, MsgUtils.getMessage(ErrorCodes.SOCIALINFO_LIST_NUM_LARGE)));
}
}
// 将以下代码提取出来,使用paymentInfoMap提升性能,避免list多次循环查询数据库浪费性能 // 将以下代码提取出来,使用paymentInfoMap提升性能,避免list多次循环查询数据库浪费性能
// 导入前做队列空闲判断,防止队列不足出现数据丢失的场景 // 导入前做队列空闲判断,防止队列不足出现数据丢失的场景
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
...@@ -1610,19 +1597,72 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1610,19 +1597,72 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//已存在的档案数据 //已存在的档案数据
List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList()); List<String> monthList = Common.listObjectToStrList(list, ExcelAttributeConstants.SOCIAL_PAY_MONTH).stream().distinct().collect(Collectors.toList());
//已存在社保缴费库数据 非删除状态 //已存在社保缴费库数据 非删除状态
List<TPaymentInfoVo> paymentInfos = baseMapper.selectPaymentAllInfoByMonthAndIdCard(monthList, List<TPaymentInfo> paymentInfos = baseMapper.selectListForPaymentImport(monthList,
Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD)); Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD));
//社保唯一性检验条件:身份证+社保缴纳月份+生成月份 //养老
ConcurrentHashMap<String, TPaymentInfoVo> paymentInfoMap = new ConcurrentHashMap<>(); ConcurrentHashMap<String, TPaymentInfo> paymentInfoPensionMap = new ConcurrentHashMap<>();
//大病救助金
ConcurrentHashMap<String, TPaymentInfo> paymentInfoBigMap = new ConcurrentHashMap<>();
//失业
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap = new ConcurrentHashMap<>();
//工伤
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap = new ConcurrentHashMap<>();
//医保
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap = new ConcurrentHashMap<>();
if (Common.isNotNull(paymentInfos)) { if (Common.isNotNull(paymentInfos)) {
for (TPaymentInfoVo info : paymentInfos) { for (TPaymentInfo info : paymentInfos) {
paymentInfoMap.putIfAbsent(info.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getUnitPensionMoney()),
+ info.getEmpIdcard() BigDecimalUtils.isNullToZero(info.getPersonalPensionMoney())).compareTo(BigDecimal.ZERO) != 0) {
+ CommonConstants.DOWN_LINE_STRING paymentInfoPensionMap.put(info.getSocialPayAddr()
+ info.getSocialPayMonth() + CommonConstants.DOWN_LINE_STRING
+ CommonConstants.DOWN_LINE_STRING + info.getEmpIdcard()
+ info.getSocialCreateMonth(), info); + CommonConstants.DOWN_LINE_STRING
+ info.getSocialPayMonth()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialCreateMonth()
+ CommonConstants.DOWN_LINE_STRING
+ PaymentConstants.PENSION_RISK
, info);
}
if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getUnitUnemploymentMoney()),
BigDecimalUtils.isNullToZero(info.getPersonalUnemploymentMoney())).compareTo(BigDecimal.ZERO) != 0) {
paymentInfoUnEmpMap.put(info.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ info.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialPayMonth()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialCreateMonth()
+ CommonConstants.DOWN_LINE_STRING
+ PaymentConstants.UNEMPLOYEEMENT_RISK
, info);
}
if (BigDecimalUtils.isNullToZero(info.getUnitInjuryMoney()).compareTo(BigDecimal.ZERO) != 0) {
paymentInfoInjuryMap.put(info.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ info.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialPayMonth()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialCreateMonth()
+ CommonConstants.DOWN_LINE_STRING
+ PaymentConstants.INJURY_RISK
, info);
}
if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(info.getPersonalMedicalMoney())).compareTo(BigDecimal.ZERO) != 0) {
paymentInfoMedicalMap.put(info.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ info.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialPayMonth()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialCreateMonth()
+ CommonConstants.DOWN_LINE_STRING
+ PaymentConstants.MEDICAL
, info);
}
} }
} }
// -----------------------------生成paymentInfoMap本段结束-------------------------------- // -----------------------------生成paymentInfoMap本段结束--------------------------------
...@@ -1641,7 +1681,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1641,7 +1681,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (list.size() < partSize) { if (list.size() < partSize) {
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2, -> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor) paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> { .whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) { if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result); this.tPaymentInfoImportLogService.saveBatch(result);
...@@ -1659,7 +1700,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1659,7 +1700,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
final List<TPaymentHeFeiVo> finalList = list.subList(0, 1); final List<TPaymentHeFeiVo> finalList = list.subList(0, 1);
CompletableFuture<List<TPaymentInfoImportLog>> oneCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<TPaymentInfoImportLog>> oneCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap, areaMap2, -> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap, areaMap2,
paymentInfoMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor) paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, CommonConstants.ONE_INT, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> { .whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) { if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result); this.tPaymentInfoImportLogService.saveBatch(result);
...@@ -1677,7 +1719,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1677,7 +1719,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentHeFeiVo> finalTempList1 = tempList; List<TPaymentHeFeiVo> finalTempList1 = tempList;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList1, areaMap, -> executeImportSocialListThree(user, atomicLine, random, finalTempList1, areaMap,
areaMap2, paymentInfoMap, idx, type), yfSocialImportThreadPoolExecutor) areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, idx, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> { .whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) { if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result); this.tPaymentInfoImportLogService.saveBatch(result);
...@@ -1708,7 +1751,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1708,7 +1751,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
int finalLastIdx = lastIdx + 1; int finalLastIdx = lastIdx + 1;
CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<TPaymentInfoImportLog>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap, -> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap,
areaMap2, paymentInfoMap, finalLastIdx, type), yfSocialImportThreadPoolExecutor) areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, finalLastIdx, type), yfSocialImportThreadPoolExecutor)
.whenComplete((result, e) -> { .whenComplete((result, e) -> {
if (CollectionUtils.isNotEmpty(result)) { if (CollectionUtils.isNotEmpty(result)) {
this.tPaymentInfoImportLogService.saveBatch(result); this.tPaymentInfoImportLogService.saveBatch(result);
...@@ -1737,7 +1781,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1737,7 +1781,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
redisUtil.remove(key); redisUtil.remove(key);
errorMessageList.add(new ErrorMessage(-1, "数据批量导入异常:" + e)); errorMessageList.add(new ErrorMessage(-1, "数据批量导入异常:" + e));
} finally { } finally {
paymentInfoMap.clear(); paymentInfoPensionMap.clear();
paymentInfoBigMap.clear();
paymentInfoMedicalMap.clear();
paymentInfoUnEmpMap.clear();
paymentInfoInjuryMap.clear();
} }
} }
...@@ -1776,16 +1824,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1776,16 +1824,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentHeFeiVo> list, List<TPaymentHeFeiVo> list,
HashMap<String, String> areaMap, HashMap<String, String> areaMap,
HashMap<String, String> areaMap2, HashMap<String, String> areaMap2,
ConcurrentHashMap<String, TPaymentInfoVo> paymentInfoMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoPensionMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap,
int idx, int idx,
String type) { String type) {
int i = idx; int i = idx;
List<TPaymentInfoImportLog> logList = new ArrayList<>(); List<TPaymentInfoImportLog> logList = new ArrayList<>();
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
TPaymentInfoVo payExists = null; TPaymentInfo payExists = null;
TSocialInfo socialInfo = null; TSocialInfo socialInfo = null;
String temp; String temp;
TPaymentInfo tempPay;
int res = -1; int res = -1;
List<String> idcards = Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD); List<String> idcards = Common.listObjectToStrList(list, ExcelAttributeConstants.EMPIDCARD);
// 全部办理成功 和 部分办理失败 // 全部办理成功 和 部分办理失败
...@@ -1824,8 +1874,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1824,8 +1874,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String[] areaArray; String[] areaArray;
String checkRes; String checkRes;
String result = null;
String lockKey;
for (TPaymentHeFeiVo infoVo : list) { for (TPaymentHeFeiVo infoVo : list) {
atomicLine.incrementAndGet(); atomicLine.incrementAndGet();
++i; ++i;
...@@ -1907,185 +1955,237 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1907,185 +1955,237 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
, CommonConstants.ERROR_MSG_PRFIX + "必填项校验失败:社保缴纳月份不可为空!", i, random)); , CommonConstants.ERROR_MSG_PRFIX + "必填项校验失败:社保缴纳月份不可为空!", i, random));
continue; continue;
} }
// 判重 此处代码块要同步,否则无法保证导入数据的重复性
lockKey = infoVo.getSocialPayAddr() //判断是否存在养老缴费数据
+ CommonConstants.DOWN_LINE_STRING if (PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())) {
+ infoVo.getEmpIdcard().trim() payExists = paymentInfoPensionMap.get(infoVo.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialPayMonth().trim() + infoVo.getEmpIdcard().trim()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialCreateMonth().trim(); + infoVo.getSocialPayMonth().trim()
try { + CommonConstants.DOWN_LINE_STRING
result = RedisDistributedLock.tryLock(lockKey, CommonConstants.ONE_STRING, 500, null); + infoVo.getSocialCreateMonth().trim()
} catch (InterruptedException e) { + CommonConstants.DOWN_LINE_STRING
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() + PaymentConstants.PENSION_RISK);
, CommonConstants.ERROR_MSG_PRFIX + "竞争导入异常,请重新导入!", i, random)); //存在社保缴费数据
RedisDistributedLock.unlock(lockKey, result); if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd(
continue; BigDecimalUtils.isNullToZero(infoVo.getPersonalMoney()),
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitPensionMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的养老缴费数据,请勿重复导入!", i, random));
continue;
} else {
payExists = null;
}
} }
if (Common.isNotNull(result)) {
try {
if (null != paymentInfoMap) {
payExists = paymentInfoMap.get(lockKey);
}
//存在社保缴费数据
if (Common.isNotNull(payExists)) {
// 校验每种险种是否可以导入
if (checkImportInfo(random, i, logList, payExists, infoVo, type)) {
continue;
}
} else {
payExists = null;
}
if (null == payExists) {
payExists = new TPaymentInfoVo();
payExists.setLockStatus(CommonConstants.ZERO_STRING);
payExists.setEmpId(socialInfo.getEmpId());
payExists.setEmpIdcard(socialInfo.getEmpIdcard());
payExists.setEmpName(socialInfo.getEmpName());
payExists.setEmpNo(socialInfo.getEmpNo());
payExists.setSettleDomainId(socialInfo.getSettleDomain());
payExists.setUnitId(socialInfo.getBelongUnit());
payExists.setInauguralTeam(socialInfo.getInauguralTeam());
payExists.setTelecomNumber(socialInfo.getTelecomNumber());
}
payExists.setSocialProvince(socialInfo.getSocialProvince());
payExists.setSocialCity(socialInfo.getSocialCity());
payExists.setSocialTown(socialInfo.getSocialTown());
payExists.setSocialHousehold(socialInfo.getSocialHousehold()); //判断是否存在失业缴费数据
payExists.setSocialPayMonth(infoVo.getSocialPayMonth()); if (PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType())) {
// 同时设置公积金缴纳日期方便导入处理 payExists = paymentInfoUnEmpMap.get(infoVo.getSocialPayAddr()
payExists.setProvidentPayMonth(infoVo.getSocialPayMonth()); + CommonConstants.DOWN_LINE_STRING
+ infoVo.getEmpIdcard().trim()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialPayMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialCreateMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ PaymentConstants.UNEMPLOYEEMENT_RISK);
//存在社保缴费数据
if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(infoVo.getPersonalMoney()),
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitUnemploymentMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的失业缴费数据,请勿重复导入!", i, random));
continue;
} else {
payExists = null;
}
}
if (null != payExists.getSocialProvince()) { //判断是否存在医保缴费数据
temp = areaMap.get(payExists.getSocialProvince()); if (CommonConstants.ONE_STRING.equals(type)) {
if (Common.isNotNull(temp)) { payExists = paymentInfoMedicalMap.get(infoVo.getSocialPayAddr()
payExists.setSocialPayAddr(temp); + CommonConstants.DOWN_LINE_STRING
} + infoVo.getEmpIdcard().trim()
} + CommonConstants.DOWN_LINE_STRING
if (null != payExists.getSocialCity()) { + infoVo.getSocialPayMonth().trim()
temp = areaMap.get(payExists.getSocialCity()); + CommonConstants.DOWN_LINE_STRING
if (Common.isNotNull(temp)) { + infoVo.getSocialCreateMonth().trim()
payExists.setSocialPayAddr(payExists.getSocialPayAddr() + CommonConstants.CENTER_SPLIT_LINE_STRING + temp); + CommonConstants.DOWN_LINE_STRING
} + PaymentConstants.MEDICAL);
}
if (null != payExists.getSocialTown()) { //存在社保缴费数据
temp = areaMap.get(payExists.getSocialTown()); if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd(
if (Common.isNotNull(temp)) { BigDecimalUtils.isNullToZero(infoVo.getUnitMedicalMoney()),
payExists.setSocialPayAddr(payExists.getSocialPayAddr() + CommonConstants.CENTER_SPLIT_LINE_STRING + temp); BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())), BigDecimalUtils.safeAdd(
} BigDecimalUtils.isNullToZero(payExists.getUnitMedicalMoney()),
} BigDecimalUtils.isNullToZero(payExists.getPersonalMedicalMoney()))).compareTo(BigDecimal.ZERO) > 0) {
payExists.setSocialSecurityNo(infoVo.getSocialSecurityNo()); logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
payExists.setSocialCreateMonth(infoVo.getSocialCreateMonth()); , CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
if (PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())) { + "的医保缴费数据,请勿重复导入!", i, random));
payExists.setUnitPensionMoney(infoVo.getUnitMoney()); continue;
payExists.setPersonalPensionMoney(infoVo.getPersonalMoney()); } else {
payExists.setUnitPensionSet(infoVo.getUnitSet()); payExists = null;
payExists.setPersonalPensionSet(infoVo.getPersonalSet()); }
payExists.setUnitPensionMoney(infoVo.getUnitMoney()); }
payExists.setPersonalPensionMoney(infoVo.getPersonalMoney());
payExists.setUnitPensionSet(infoVo.getUnitSet());
payExists.setPersonalPensionSet(infoVo.getPersonalSet());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitPensionMoney()
, payExists.getUnitSocialSum()));
payExists.setSocialSecurityPersonalSum(BigDecimalUtils.safeAdd(payExists.getPersonalPensionMoney()
, payExists.getSocialSecurityPersonalSum()));
}
if (PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitUnemploymentMoney(infoVo.getUnitMoney());
payExists.setPersonalUnemploymentMoney(infoVo.getPersonalMoney());
payExists.setUnitUnemploymentSet(infoVo.getUnitSet());
payExists.setPersonalUnemploymentSet(infoVo.getPersonalSet());
payExists.setUnitUnemploymentMoney(infoVo.getUnitMoney());
payExists.setPersonalUnemploymentMoney(infoVo.getPersonalMoney());
payExists.setUnitUnemploymentSet(infoVo.getUnitSet());
payExists.setPersonalUnemploymentSet(infoVo.getPersonalSet());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitUnemploymentMoney()
, payExists.getUnitSocialSum()));
payExists.setSocialSecurityPersonalSum(BigDecimalUtils.safeAdd(payExists.getPersonalUnemploymentMoney()
, payExists.getSocialSecurityPersonalSum()));
}
if (PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitInjuryMoney(infoVo.getUnitMoney());
payExists.setUnitInjurySet(infoVo.getUnitSet());
payExists.setUnitInjuryMoney(infoVo.getUnitMoney());
payExists.setUnitInjurySet(infoVo.getUnitSet());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitInjuryMoney()
, payExists.getUnitSocialSum()));
}
if (CommonConstants.ONE_STRING.equals(type)) {
payExists.setUnitMedicalMoney(infoVo.getUnitMedicalMoney());
payExists.setUnitMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalMedicalMoney(infoVo.getPersonalMedicalMoney());
payExists.setPersonalMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalBigmailmentMoney(infoVo.getPersonalBigailmentMoney());
payExists.setUnitBigmailmentMoney(infoVo.getUnitBigailmentMoney());
payExists.setUnitMedicalMoney(infoVo.getUnitMedicalMoney());
payExists.setUnitMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalMedicalMoney(infoVo.getPersonalMedicalMoney());
payExists.setPersonalMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalBigmailmentMoney(infoVo.getPersonalBigailmentMoney());
payExists.setUnitBigmailmentMoney(infoVo.getUnitBigailmentMoney());
payExists.setSocialSecurityNo(infoVo.getSocialSecurityNo());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitMedicalMoney()
, payExists.getUnitBigmailmentMoney()
, payExists.getUnitSocialSum()));
payExists.setSocialSecurityPersonalSum(BigDecimalUtils.safeAdd(payExists.getPersonalMedicalMoney()
, payExists.getPersonalBigmailmentMoney()
, payExists.getSocialSecurityPersonalSum()));
}
payExists.setSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitSocialSum(), payExists.getSocialSecurityPersonalSum()));
payExists.setSumAll(payExists.getSocialSum());
if (null != payExists && Common.isEmpty(payExists.getSocialId())) {
payExists.setSocialId(UUID.randomUUID().toString());
}
tempPay = reflectionPaymentInfo(payExists);
if (null != payExists && Common.isNotNull(payExists.getId())) {
res = baseMapper.updateById(tempPay);
if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "_缴费库更新失败!", i, random));
continue;
} else {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + infoVo.getEmpIdcard() + "_缴费库更新成功!", i, random));
paymentInfoMap.putIfAbsent(payExists.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ payExists.getEmpIdcard().trim()
+ CommonConstants.DOWN_LINE_STRING
+ payExists.getSocialPayMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ payExists.getSocialCreateMonth().trim(), payExists);
continue;
}
} else {
res = insertAndSTimestamp(tempPay);
if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "_缴费库保存失败!", i, random));
continue;
}
payExists.setId(tempPay.getId());
paymentInfoMap.putIfAbsent(payExists.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ payExists.getEmpIdcard().trim()
+ CommonConstants.DOWN_LINE_STRING
+ payExists.getSocialPayMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ payExists.getSocialCreateMonth().trim(), payExists);
}
//判断是否存在工伤缴费数据
if (PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) {
payExists = paymentInfoInjuryMap.get(infoVo.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getEmpIdcard().trim()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialPayMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialCreateMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ PaymentConstants.INJURY_RISK);
//存在社保缴费数据
if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(infoVo.getUnitMedicalMoney()),
BigDecimalUtils.isNullToZero(infoVo.getPersonalMedicalMoney())),
BigDecimalUtils.isNullToZero(payExists.getUnitInjuryMoney())).compareTo(BigDecimal.ZERO) > 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的单位工伤缴费数据,请勿重复导入!", i, random));
continue;
} else {
payExists = null;
}
}
if (null == payExists) {
payExists = new TPaymentInfo();
payExists.setLockStatus(CommonConstants.ZERO_STRING);
payExists.setEmpId(socialInfo.getEmpId());
payExists.setEmpIdcard(socialInfo.getEmpIdcard());
payExists.setEmpName(socialInfo.getEmpName());
payExists.setEmpNo(socialInfo.getEmpNo());
payExists.setSettleDomainId(socialInfo.getSettleDomain());
payExists.setUnitId(socialInfo.getBelongUnit());
payExists.setInauguralTeam(socialInfo.getInauguralTeam());
payExists.setTelecomNumber(socialInfo.getTelecomNumber());
}
payExists.setSocialProvince(socialInfo.getSocialProvince());
payExists.setSocialCity(socialInfo.getSocialCity());
payExists.setSocialTown(socialInfo.getSocialTown());
payExists.setSocialHousehold(socialInfo.getSocialHousehold());
payExists.setSocialPayMonth(infoVo.getSocialPayMonth());
// 同时设置公积金缴纳日期方便导入处理
payExists.setProvidentPayMonth(infoVo.getSocialPayMonth());
if (null != payExists.getSocialProvince()) {
temp = areaMap.get(payExists.getSocialProvince());
if (Common.isNotNull(temp)) {
payExists.setSocialPayAddr(temp);
}
}
if (null != payExists.getSocialCity()) {
temp = areaMap.get(payExists.getSocialCity());
if (Common.isNotNull(temp)) {
payExists.setSocialPayAddr(payExists.getSocialPayAddr() + CommonConstants.CENTER_SPLIT_LINE_STRING + temp);
}
}
if (null != payExists.getSocialTown()) {
temp = areaMap.get(payExists.getSocialTown());
if (Common.isNotNull(temp)) {
payExists.setSocialPayAddr(payExists.getSocialPayAddr() + CommonConstants.CENTER_SPLIT_LINE_STRING + temp);
}
}
payExists.setSocialSecurityNo(infoVo.getSocialSecurityNo());
payExists.setSocialCreateMonth(infoVo.getSocialCreateMonth());
if (PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitPensionMoney(infoVo.getUnitMoney());
payExists.setPersonalPensionMoney(infoVo.getPersonalMoney());
payExists.setUnitPensionSet(infoVo.getUnitSet());
payExists.setPersonalPensionSet(infoVo.getPersonalSet());
payExists.setUnitPensionMoney(infoVo.getUnitMoney());
payExists.setPersonalPensionMoney(infoVo.getPersonalMoney());
payExists.setUnitPensionSet(infoVo.getUnitSet());
payExists.setPersonalPensionSet(infoVo.getPersonalSet());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitPensionMoney()
, payExists.getUnitSocialSum()));
payExists.setSocialSecurityPersonalSum(BigDecimalUtils.safeAdd(payExists.getPersonalPensionMoney()
, payExists.getSocialSecurityPersonalSum()));
}
if (PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitUnemploymentMoney(infoVo.getUnitMoney());
payExists.setPersonalUnemploymentMoney(infoVo.getPersonalMoney());
payExists.setUnitUnemploymentSet(infoVo.getUnitSet());
payExists.setPersonalUnemploymentSet(infoVo.getPersonalSet());
payExists.setUnitUnemploymentMoney(infoVo.getUnitMoney());
payExists.setPersonalUnemploymentMoney(infoVo.getPersonalMoney());
payExists.setUnitUnemploymentSet(infoVo.getUnitSet());
payExists.setPersonalUnemploymentSet(infoVo.getPersonalSet());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitUnemploymentMoney()
, payExists.getUnitSocialSum()));
payExists.setSocialSecurityPersonalSum(BigDecimalUtils.safeAdd(payExists.getPersonalUnemploymentMoney()
, payExists.getSocialSecurityPersonalSum()));
}
if (PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitInjuryMoney(infoVo.getUnitMoney());
payExists.setUnitInjurySet(infoVo.getUnitSet());
payExists.setUnitInjuryMoney(infoVo.getUnitMoney());
payExists.setUnitInjurySet(infoVo.getUnitSet());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitInjuryMoney()
, payExists.getUnitSocialSum()));
}
if (CommonConstants.ONE_STRING.equals(type)) {
payExists.setUnitMedicalMoney(infoVo.getUnitMedicalMoney());
payExists.setUnitMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalMedicalMoney(infoVo.getPersonalMedicalMoney());
payExists.setPersonalMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalBigmailmentMoney(infoVo.getPersonalBigailmentMoney());
payExists.setUnitBigmailmentMoney(infoVo.getUnitBigailmentMoney());
payExists.setUnitMedicalMoney(infoVo.getUnitMedicalMoney());
payExists.setUnitMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalMedicalMoney(infoVo.getPersonalMedicalMoney());
payExists.setPersonalMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalBigmailmentMoney(infoVo.getPersonalBigailmentMoney());
payExists.setUnitBigmailmentMoney(infoVo.getUnitBigailmentMoney());
payExists.setSocialSecurityNo(infoVo.getSocialSecurityNo());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitMedicalMoney()
, payExists.getUnitBigmailmentMoney()
, payExists.getUnitSocialSum()));
payExists.setSocialSecurityPersonalSum(BigDecimalUtils.safeAdd(payExists.getPersonalMedicalMoney()
, payExists.getPersonalBigmailmentMoney()
, payExists.getSocialSecurityPersonalSum()));
}
payExists.setSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitSocialSum(), payExists.getSocialSecurityPersonalSum()));
payExists.setSumAll(payExists.getSocialSum());
if (null != payExists && Common.isEmpty(payExists.getSocialId())) {
payExists.setSocialId(UUID.randomUUID().toString());
}
if (null != payExists && Common.isNotNull(payExists.getId())) {
res = baseMapper.updateById(payExists);
if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + "保存成功!", i, random)); , CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "_缴费库更新失败!", i, random));
} finally { continue;
RedisDistributedLock.unlock(lockKey, result); } else {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + infoVo.getEmpIdcard() + "_缴费库更新成功!", i, random));
continue;
} }
} else { } else {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() res = insertAndSTimestamp(payExists);
, CommonConstants.ERROR_MSG_PRFIX + "竞争导入失败,请重新导入!", i, random)); if (res < 0) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + infoVo.getEmpIdcard() + "_缴费库保存失败!", i, random));
continue;
}
} }
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.SUCCESS_MSG_PREFIX + "保存成功!", i, random));
} }
} else { } else {
return null; return null;
...@@ -2096,7 +2196,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2096,7 +2196,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
/** /**
* 导入校验 * 导入校验
**/ **/
private boolean socialThreeCheckBase(String random, int i, List<TPaymentInfoImportLog> logList, TPaymentHeFeiVo infoVo, String type) { private boolean socialThreeCheckBase(String random, int i, List<TPaymentInfoImportLog> logList, TPaymentHeFeiVo
infoVo, String type) {
if (!Common.isNotNull(infoVo.getSocialPayMonth())) { if (!Common.isNotNull(infoVo.getSocialPayMonth())) {
logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard() logList.add(new TPaymentInfoImportLog(null, infoVo.getEmpName(), infoVo.getEmpIdcard()
, CommonConstants.ERROR_MSG_PRFIX + "社保缴纳月份不可为空!", i, random)); , CommonConstants.ERROR_MSG_PRFIX + "社保缴纳月份不可为空!", i, random));
...@@ -2122,54 +2223,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2122,54 +2223,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return false; return false;
} }
/**
* 字段对应
**/
private TPaymentInfo reflectionPaymentInfo(TPaymentInfoVo from) {
TPaymentInfo to = new TPaymentInfo();
if (Common.isNotNull(from)) {
to.setId(from.getId());
to.setEmpName(from.getEmpName());
to.setEmpNo(from.getEmpNo());
to.setEmpId(from.getEmpId());
to.setEmpIdcard(from.getEmpIdcard());
to.setUnitId(from.getUnitId());
to.setSettleDomainId(from.getSettleDomainId());
to.setSocialHousehold(from.getSocialHousehold());
to.setSocialSecurityNo(from.getSocialSecurityNo());
to.setSocialPayAddr(from.getSocialPayAddr());
to.setSocialProvince(from.getSocialProvince());
to.setSocialCity(from.getSocialCity());
to.setSocialTown(from.getSocialTown());
to.setSocialCreateMonth(from.getSocialCreateMonth());
to.setSocialPayMonth(from.getSocialPayMonth());
to.setLockStatus(from.getLockStatus());
to.setProvidentPayMonth(from.getProvidentPayMonth());
to.setProvidentCreateMonth(from.getProvidentCreateMonth());
to.setProvidentHousehold(from.getProvidentHousehold());
to.setProvidentPayAddr(from.getProvidentPayAddr());
to.setFundProvince(from.getFundProvince());
to.setFundCity(from.getFundCity());
to.setFundTown(from.getFundTown());
to.setSumAll(from.getSumAll());
to.setSocialId(from.getSocialId());
to.setFundId(from.getFundId());
to.setSocialSum(from.getSocialSum());
to.setUnitSocialSum(from.getUnitSocialSum());
to.setSocialSecurityPersonalSum(from.getSocialSecurityPersonalSum());
to.setProvidentSum(from.getProvidentSum());
to.setSocialSettlementId(from.getSocialSettlementId());
to.setFundSettlementId(from.getFundSettlementId());
to.setInauguralTeam(from.getInauguralTeam());
to.setTelecomNumber(from.getTelecomNumber());
}
return to;
}
/** /**
* 转换缴纳地址为省市县ID * 转换缴纳地址为省市县ID
**/ **/
private TPaymentHeFeiVo initAddressThree(String[] areaArray, HashMap<String, String> areaMap2, TPaymentHeFeiVo s) { private TPaymentHeFeiVo initAddressThree(String[]
areaArray, HashMap<String, String> areaMap2, TPaymentHeFeiVo s) {
if (null == areaArray || null == areaMap2 || null == s) { if (null == areaArray || null == areaMap2 || null == s) {
return s; return s;
} }
...@@ -2208,7 +2266,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2208,7 +2266,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
* @Author huyc * @Author huyc
* @Date 2022-07-27 * @Date 2022-07-27
**/ **/
private boolean checkImportInfo(String random, int i, List<TPaymentInfoImportLog> logList, TPaymentInfoVo payExists private boolean checkImportInfo(String random, int i, List<TPaymentInfoImportLog> logList, TPaymentInfoVo
payExists
, TPaymentHeFeiVo infoVo, String type) { , TPaymentHeFeiVo infoVo, String type) {
boolean flag; boolean flag;
if (CommonConstants.ZERO_STRING.equals(type)) { if (CommonConstants.ZERO_STRING.equals(type)) {
...@@ -2318,17 +2377,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2318,17 +2377,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
} }
}else { } else {
return null; return null;
} }
}else if (areaArray.length == 1) { } else if (areaArray.length == 1) {
if (null != s.getFundProvince() && null == s.getFundCity()) { if (null != s.getFundProvince() && null == s.getFundCity()) {
if (areaArray[0].equals(areaMap.get(String.valueOf(s.getFundProvince())))) { if (areaArray[0].equals(areaMap.get(String.valueOf(s.getFundProvince())))) {
return s; return s;
} }
}else { } else {
return null; return null;
} }
} }
return null; return null;
......
...@@ -1190,7 +1190,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1190,7 +1190,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
return "公积金基数不可为空!"; return "公积金基数不可为空!";
} }
if (Common.isNullOrZero(tPreDispatchInfo.getFundCompanyPer())) { if (Common.isNullOrZero(tPreDispatchInfo.getFundCompanyPer())) {
return "公积金单位比例不可为空!"; return "公积金企业比例不可为空!";
} }
if (Common.isNullOrZero(tPreDispatchInfo.getFundPersonalPer())) { if (Common.isNullOrZero(tPreDispatchInfo.getFundPersonalPer())) {
return "公积个人比例不可为空!"; return "公积个人比例不可为空!";
......
...@@ -958,15 +958,10 @@ ...@@ -958,15 +958,10 @@
FROM t_payment_info a FROM t_payment_info a
where 1=1 where 1=1
<if test="months != null and months.size > 0"> <if test="months != null and months.size > 0">
AND (a.SOCIAL_PAY_MONTH in AND a.SOCIAL_PAY_MONTH in
<foreach item="item" index="index" collection="months" open="(" separator="," close=")"> <foreach item="item" index="index" collection="months" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
or a.PROVIDENT_PAY_MONTH in
<foreach item="item" index="index" collection="months" open="(" separator="," close=")">
#{item}
</foreach>
)
</if> </if>
<if test="idcards != null and idcards.size > 0"> <if test="idcards != null and idcards.size > 0">
AND a.EMP_IDCARD IN AND a.EMP_IDCARD IN
...@@ -976,31 +971,6 @@ ...@@ -976,31 +971,6 @@
</if> </if>
</select> </select>
<!--tPaymentInfo 按ID查收缴费库包含社保和公积金明细的数据查询-->
<select id="selectPaymentAllInfoByMonthAndIdCard" resultMap="tPaymentAllInfoMap">
SELECT
<include refid="base_column_list_all"/>,
FROM t_payment_info a
where 1=1
<if test="months != null and months.size > 0">
AND (a.SOCIAL_PAY_MONTH in
<foreach item="item" index="index" collection="months" open="(" separator="," close=")">
#{item}
</foreach>
or a.PROVIDENT_PAY_MONTH in
<foreach item="item" index="index" collection="months" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
<if test="idcards != null and idcards.size > 0">
AND A.EMP_IDCARD IN
<foreach item="item" index="index" collection="idcards" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<!--tPaymentInfo 查询缴费库要删除的数据--> <!--tPaymentInfo 查询缴费库要删除的数据-->
<select id="selectListForDelete" resultType="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo"> <select id="selectListForDelete" resultType="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo">
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