Commit d3a25173 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 70e94711 1aae2b0b
...@@ -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;
......
...@@ -1125,12 +1125,12 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1125,12 +1125,12 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
if (Common.isEmpty(tPreDispatchInfo.getPensionAddress()) if (Common.isEmpty(tPreDispatchInfo.getPensionAddress())
&& Common.isEmpty(tPreDispatchInfo.getFundAddress()) && Common.isEmpty(tPreDispatchInfo.getFundAddress())
&& CommonConstants.ZERO_STRING.equals(tPreDispatchInfo.getType())) { && CommonConstants.ZERO_STRING.equals(tPreDispatchInfo.getType())) {
return "派增的社保缴纳地与公积金缴纳地不可同时为空!"; return "派增的养老数据和公积金数据不能同时为空,请完善!";
} }
if (Common.isEmpty(tPreDispatchInfo.getPensionAddressReduce()) if (Common.isEmpty(tPreDispatchInfo.getPensionAddressReduce())
&& Common.isEmpty(tPreDispatchInfo.getFundAddressReduce()) && Common.isEmpty(tPreDispatchInfo.getFundAddressReduce())
&& CommonConstants.ONE_STRING.equals(tPreDispatchInfo.getType())) { && CommonConstants.ONE_STRING.equals(tPreDispatchInfo.getType())) {
return "派减的社保缴纳地与公积金缴纳地不可同时为空!"; return "派减的养老数据和公积金数据不能同时为空,请完善!";
} }
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
......
...@@ -771,202 +771,6 @@ ...@@ -771,202 +771,6 @@
where id = #{id} where id = #{id}
</update> </update>
<update id="updateBatchPreDispatchById" parameterType="com.yifu.cloud.plus.v1.yifu.social.entity.TPreDispatchInfo">
update t_pre_dispatch_info
<trim prefix="SET" suffixOverrides=",">
<if test="date != null ">date = #{date},</if>
<if test="company != null and company != ''">company = #{company},</if>
<if test="payAddress != null and payAddress != ''">pay_address = #{payAddress},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
<if test="empName != null and empName != ''">emp_name = #{empName},</if>
<if test="empIdcard != null and empIdcard != ''">emp_idcard = #{empIdcard},</if>
<if test="telOne != null and telOne != ''">tel_one = #{telOne},</if>
<if test="telTwo != null and telTwo != ''">tel_two = #{telTwo},</if>
<if test="entryDate != null ">entry_date = #{entryDate},</if>
<if test="formalSalary != null and formalSalary != ''">formal_salary = #{formalSalary},</if>
<if test="dispatchStart != null and dispatchStart != ''">dispatch_start = #{dispatchStart},</if>
<if test="dispatchEnd != null and dispatchEnd != ''">dispatch_end = #{dispatchEnd},</if>
<if test="contractType != null and contractType != ''">contract_type = #{contractType},</if>
<if test="contractStart != null and contractStart != ''">contract_start = #{contractStart},</if>
<if test="contractEnd != null and contractEnd != ''">contract_end = #{contractEnd},</if>
<if test="contractNameAdd != null and contractNameAdd != ''">
contract_name_add = #{contractNameAdd},
</if>
<if test="contractTypeAdd != null and contractTypeAdd != ''">
contract_type_add = #{contractTypeAdd},
</if>
<if test="contractStartAdd != null and contractStartAdd != ''">
contract_start_add = #{contractStartAdd},
</if>
<if test="contractEndAdd != null and contractEndAdd != ''">
contract_end_add = #{contractEndAdd},
</if>
<if test="contractTermAdd != null and contractTermAdd != ''">
contract_term_add = #{contractTermAdd},
</if>
<if test="contractNameAdd == null or contractNameAdd == ''">
contract_name_add = null,
</if>
<if test="contractTypeAdd == null or contractTypeAdd == ''">
contract_type_add = null,
</if>
<if test="contractStartAdd == null or contractStartAdd == ''">
contract_start_add = null,
</if>
<if test="contractEndAdd == null or contractEndAdd == ''">
contract_end_add = null,
</if>
<if test="contractTermAdd == null or contractTermAdd == ''">
contract_term_add = null,
</if>
<if test="trialStart != null and trialStart != ''">trial_start = #{trialStart},</if>
<if test="trialEnd != null and trialEnd != ''">trial_end = #{trialEnd},</if>
<if test="trialSalary != null and trialSalary !='' ">trial_salary = #{trialSalary},</if>
<if test="workingSystem != null and workingSystem != ''">working_system = #{workingSystem},</if>
<if test="contractVersion != null and contractVersion != ''">contract_version = #{contractVersion},</if>
<if test="telNotice != null and telNotice != ''">tel_notice = #{telNotice},</if>
<if test="workingAddress != null and workingAddress != ''">working_address = #{workingAddress},</if>
<if test="remarkOne != null and remarkOne != ''">remark_one = #{remarkOne},</if>
<if test="remarkTwo != null and remarkTwo != ''">remark_two = #{remarkTwo},</if>
<if test='type == "0"'>
<if test="pensionAddress != null and pensionAddress != ''">
pension_address = #{pensionAddress},
<if test="socialProvince != null and socialProvince != ''">social_province = #{socialProvince},</if>
<if test="socialCity != null and socialCity != ''">social_city = #{socialCity},</if>
<if test="socialTown != null and socialTown != ''">social_town = #{socialTown},</if>
</if>
<if test='pensionAddress == null || pensionAddress == ""'>
pension_address = null,
social_province = null,
social_city = null,
social_town = null,
</if>
<if test="fundAddress != null and fundAddress != ''">
fund_address = #{fundAddress},
<if test="fundProvince != null and fundProvince != ''">
fund_province = #{fundProvince},
<if test="fundCity == null">fund_city = null,</if>
<if test="fundTown == null">fund_town = null,</if>
</if>
<if test="fundCity != null and fundCity != ''">fund_city = #{fundCity},</if>
<if test="fundTown != null and fundTown != ''">fund_town = #{fundTown},</if>
</if>
<if test='fundAddress == null || fundAddress == ""'>
fund_address = null,
fund_province = null,
fund_city = null,
fund_town = null,
</if>
</if>
<if test='type == "1"'>
<if test="pensionAddressReduce != null and pensionAddressReduce != ''">
pension_address_reduce = #{pensionAddressReduce},
pension_address = #{pensionAddressReduce},
<if test="socialProvince != null and socialProvince != ''">social_province = #{socialProvince},</if>
<if test="socialCity != null and socialCity != ''">social_city = #{socialCity},</if>
<if test="socialTown != null and socialTown != ''">social_town = #{socialTown},</if>
</if>
<if test='pensionAddressReduce == null || pensionAddressReduce ==""'>
pension_address_reduce = null,
pension_end_reduce = null,
pension_address = null,
social_province = null,
social_city = null,
social_town = null,
</if>
<if test="fundAddressReduce != null and fundAddressReduce != ''">
fund_address_reduce = #{fundAddressReduce},
fund_address = #{fundAddressReduce},
<if test="fundProvince != null and fundProvince != ''">
fund_province = #{fundProvince},
<if test="fundCity == null">fund_city = null,</if>
<if test="fundTown == null">fund_town = null,</if>
</if>
<if test="fundCity != null and fundCity != ''">fund_city = #{fundCity},</if>
<if test="fundTown != null and fundTown != ''">fund_town = #{fundTown},</if>
</if>
<if test='fundAddressReduce == null || fundAddressReduce == ""'>
fund_address_reduce = null,
fund_address = null,
fund_end_reduce = null,
fund_province = null,
fund_city = null,
fund_town = null,
</if>
</if>
<if test="pensionBase != null ">pension_base = #{pensionBase},</if>
<if test="pensionStart != null and pensionStart != ''">pension_start = #{pensionStart},</if>
<if test="medicalAddress != null and medicalAddress != ''">medical_address = #{medicalAddress},</if>
<if test="medicalBase != null ">medical_base = #{medicalBase},</if>
<if test="medicalStart != null and medicalStart != ''">medical_start = #{medicalStart},</if>
<if test="injuryAddress != null and injuryAddress != ''">injury_address = #{injuryAddress},</if>
<if test="injuryBase != null ">injury_base = #{injuryBase},</if>
<if test="injuryStart != null and injuryStart != ''">injury_start = #{injuryStart},</if>
<if test="birthAddress != null and birthAddress != ''">birth_address = #{birthAddress},</if>
<if test="birthBase != null ">birth_base = #{birthBase},</if>
<if test="birthStart != null and birthStart != ''">birth_start = #{birthStart},</if>
<if test="unemploymentAddress != null and unemploymentAddress != ''">unemployment_address = #{unemploymentAddress},</if>
<if test="unemploymentBase != null ">unemployment_base = #{unemploymentBase},</if>
<if test="unemploymentStart != null and unemploymentStart != ''">unemployment_start = #{unemploymentStart},</if>
<if test="pensionBase == null ">pension_base = null,</if>
<if test="pensionStart == null">pension_start = null,</if>
<if test="medicalAddress == null or medicalAddress == ''">medical_address = null,</if>
<if test="medicalBase == null ">medical_base = null,</if>
<if test="medicalStart == null">medical_start = null,</if>
<if test="injuryAddress == null or injuryAddress == ''">injury_address = null,</if>
<if test="injuryBase == null ">injury_base = null,</if>
<if test="injuryStart == null">injury_start = null,</if>
<if test="birthAddress == null or birthAddress == ''">birth_address = null,</if>
<if test="birthBase == null ">birth_base = null,</if>
<if test="birthStart == null">birth_start = null,</if>
<if test="unemploymentAddress == null or unemploymentAddress == ''">unemployment_address = null,</if>
<if test="unemploymentBase == null ">unemployment_base = null,</if>
<if test="unemploymentStart == null">unemployment_start = null,</if>
<if test="fundBase != null ">fund_base = #{fundBase},</if>
<if test="fundStart != null and fundStart != ''">fund_start = #{fundStart},</if>
<if test="fundPersonalPer != null ">fund_personal_per = #{fundPersonalPer},</if>
<if test="fundCompanyPer != null ">fund_company_per = #{fundCompanyPer},</if>
<if test="fundBase == null ">fund_base = null,</if>
<if test="fundStart == null">fund_start = null,</if>
<if test="fundPersonalPer == null ">fund_personal_per = null,</if>
<if test="fundCompanyPer == null ">fund_company_per = null,</if>
<if test="dispatchCompany != null and dispatchCompany != ''">dispatch_company = #{dispatchCompany},</if>
<if test="customerService != null and customerService != ''">customer_service = #{customerService},</if>
<if test="contractMinorName != null and contractMinorName != ''">contract_minor_name = #{contractMinorName},</if>
<if test="uniqueNumber != null and uniqueNumber != ''">unique_number = #{uniqueNumber},</if>
<if test="customerNumber != null and customerNumber != ''">customer_number = #{customerNumber},</if>
<if test="serviceType != null and serviceType != ''">service_type = #{serviceType},</if>
<if test="pensionEndReduce != null and pensionEndReduce != ''">pension_end_reduce = #{pensionEndReduce},</if>
<if test="medicalAddressReduce != null and medicalAddressReduce != ''">medical_address_reduce = #{medicalAddressReduce},</if>
<if test="medicalEndReduce != null and medicalEndReduce != ''">medical_end_reduce = #{medicalEndReduce},</if>
<if test="injuryAddressReduce != null and injuryAddressReduce != ''">injury_address_reduce = #{injuryAddressReduce},</if>
<if test="injuryEndReduce != null and injuryEndReduce != ''">injury_end_reduce = #{injuryEndReduce},</if>
<if test="birthAddressReduce != null and birthAddressReduce != ''">birth_address_reduce = #{birthAddressReduce},</if>
<if test="birthEndReduce != null and birthEndReduce != ''">birth_end_reduce = #{birthEndReduce},</if>
<if test="unemploymentAddressReduce != null and unemploymentAddressReduce != ''">unemployment_address_reduce = #{unemploymentAddressReduce},</if>
<if test="unemploymentEndReduce != null and unemploymentEndReduce != ''">unemployment_end_reduce = #{unemploymentEndReduce},</if>
<if test="fundEndReduce != null and fundEndReduce != ''">fund_end_reduce = #{fundEndReduce},</if>
<if test="leaveDate != null ">leave_date = #{leaveDate},</if>
<if test="leaveReason != null and leaveReason != ''">leave_reason = #{leaveReason},</if>
<if test="leaveReasonAdd != null and leaveReasonAdd != ''">leave_reason_add = #{leaveReasonAdd},</if>
<if test="empTypeAdd != null and empTypeAdd != ''">emp_type_add = #{empTypeAdd},</if>
<if test="unitIdAdd != null and unitIdAdd != ''">unit_id_add = #{unitIdAdd},</if>
<if test="departIdAdd != null and departIdAdd != ''">depart_id_add = #{departIdAdd},</if>
<if test="socialHouseAdd != null and socialHouseAdd != ''">social_house_add = #{socialHouseAdd},</if>
<if test="fundHouseAdd != null and fundHouseAdd != ''">fund_house_add = #{fundHouseAdd},</if>
<if test="preStatus != null and preStatus != ''">pre_status = #{preStatus},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="exceptionContent != null">exception_content = #{exceptionContent},</if>
<if test="dataSubStatus != null and dataSubStatus != ''">data_sub_status = #{dataSubStatus},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="dispatchFlag != null and dispatchFlag != ''">dispatch_flag = #{dispatchFlag},</if>
<if test="cancelRemark != null and cancelRemark != ''">cancel_remark = #{cancelRemark},</if>
</trim>
where id = #{id}
</update>
<!-- 批量更新资料提交状态--> <!-- 批量更新资料提交状态-->
<update id="modifyDataSubmitStatus"> <update id="modifyDataSubmitStatus">
update t_pre_dispatch_info update t_pre_dispatch_info
......
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