Commit 1a8391d0 authored by huyuchen's avatar huyuchen

项目档案批量操作速度优化

parent 36b3972a
......@@ -30,8 +30,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
......@@ -705,6 +703,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
String idCard;
String deptNo;
TSettleDomain tSettleDomain;
TEmployeeInfo tEmployeeInfo;
TEmployeeProject tEmployeeProject;
// 执行数据插入操作 组装 PostDto
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeProjectVO excel = excelVOList.get(i);
......@@ -732,7 +733,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
//项目编码校验
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, excel.getDeptNo())
.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING));
......@@ -741,18 +742,18 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
//根据身份证获取人员档案
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
tEmployeeInfo= tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//根据身份证和项目编码获取项目档案
TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
tEmployeeProject = baseMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//状态为草稿、已审核
if (Common.isNotNull(tEmployeeProject) && (CommonConstants.dingleDigitIntArray[0] == tEmployeeProject.getStatus() ||
CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getStatus())) {
if (Common.isNotNull(tEmployeeProject) && (CommonConstants.ZERO_INT == tEmployeeProject.getStatus() ||
CommonConstants.ONE_INT == tEmployeeProject.getStatus())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.EXIT_PRIJECT_STATUS));
}
//不存在复档或复项的情况
......@@ -761,87 +762,47 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EXIT_EMPPROJECT_ERROR)));
//档案有(在档人员),项目无
} else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)
&& CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
/*if (Common.isNotNull(excel.getBankNo())) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<CheckBankNoVo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, CheckBankNoVo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
CheckBankNoVo vo = checkListR.getData();
check = (null == vo.getRes()) ? null : vo.getRes().getData();
if (Common.isEmpty(vo)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (!CommonConstants.SUCCESS.equals(vo.getRes().getCode())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), vo.getRes().getMsg()));
} else if (null != check && !check.getResult().equals(CommonConstants.ZERO_ONE)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getRemark()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
}
}*/
&& CommonConstants.ZERO_INT == tEmployeeInfo.getFileStatus()) {
updateExcelPost(updateList, tEmployeeInfo);
insertExcelPro(excel, proInsList, tEmployeeInfo);
insertExcelPro(excel, proInsList, tEmployeeInfo,tSettleDomain);
//档案有(在档人员),项目有(草稿/已审核);
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[0] == tEmployeeProject.getProjectStatus()) {
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.ZERO_INT == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.ZERO_INT == tEmployeeProject.getProjectStatus()) {
updateExcelPost(updateList, tEmployeeInfo);
updateExcelPro(excel, proupdateList, tEmployeeProject);
}
//存在复档或复项的情况,允许复档复项
if (CommonConstants.ONE_STRING.equals(idAdd)) {
//档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPro(excel, proupdateList, tEmployeeProject);
//档案有(离职库),项目无;
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
/*if (Common.isNotNull(excel.getBankNo())) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<CheckBankNoVo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, CheckBankNoVo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
CheckBankNoVo vo = checkListR.getData();
check = (null == vo.getRes()) ? null : vo.getRes().getData();
if (Common.isEmpty(vo)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (!CommonConstants.SUCCESS.equals(vo.getRes().getCode())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), vo.getRes().getMsg()));
} else if (null != check && !check.getResult().equals(CommonConstants.ZERO_ONE)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getRemark()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
}
}*/
insertExcelPro(excel, proInsList, tEmployeeInfo);
//档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPro(excel, proupdateList, tEmployeeProject);
}
updateExcelPost(updateList, tEmployeeInfo);
//不允许复档复项
} else {
//档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_PROJECT_ERROR)));
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_EMP_ERROR)));
//档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_PROJECT_ERROR)));
if (Common.isNotNull(tEmployeeInfo)) {
if (CommonConstants.ONE_STRING.equals(idAdd)) {
//档案有(离职库),项目(已减档)
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus() && Common.isNotNull(tEmployeeProject)
&& CommonConstants.ONE_INT == tEmployeeProject.getProjectStatus()) {
updateExcelPro(excel, proupdateList, tEmployeeProject);
//档案有(离职库),项目无;
} else if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
insertExcelPro(excel, proInsList, tEmployeeInfo, tSettleDomain);
//档案有(在档人员),项目(已减档)
} else if (CommonConstants.ZERO_INT == tEmployeeInfo.getFileStatus() && Common.isNotNull(
tEmployeeProject) && CommonConstants.ONE_INT == tEmployeeProject.getProjectStatus()) {
updateExcelPro(excel, proupdateList, tEmployeeProject);
}
updateExcelPost(updateList, tEmployeeInfo);
//不允许复档复项
} else {
//档案有(离职库),项目(已减档)
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.ONE_INT == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_PROJECT_ERROR)));
} else if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_EMP_ERROR)));
//档案有(在档人员),项目(已减档)
} else if (CommonConstants.ZERO_INT == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.ONE_INT == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_PROJECT_ERROR)));
}
}
}
}
......@@ -1027,18 +988,16 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/**
* 插入excel Pro
*/
private void insertExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proInsList, TEmployeeInfo tEmployeeInfo) {
private void insertExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proInsList, TEmployeeInfo tEmployeeInfo,
TSettleDomain tSettleDomain) {
TEmployeeProject insTEmployeePro = new TEmployeeProject();
BeanUtil.copyProperties(excel, insTEmployeePro);
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
insTEmployeePro.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeePro.setStatus(CommonConstants.dingleDigitIntArray[0]);
insTEmployeePro.setStatus(CommonConstants.ZERO_INT);
//获取项目和单位信息
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, insTEmployeePro.getDeptNo()).eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tSettleDomain)) {
insTEmployeePro.setDeptId(tSettleDomain.getId());
insTEmployeePro.setDeptName(tSettleDomain.getDepartName());
......@@ -1058,7 +1017,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setEmpName(tEmployeeInfo.getEmpName());
insTEmployeePro.setCreateName(user.getNickname());
insTEmployeePro.setProjectSource(CommonConstants.dingleDigitStrArray[6]);
insTEmployeePro.setProjectSource(CommonConstants.SIX_STRING);
insTEmployeePro.setEmpId(tEmployeeInfo.getId());
proInsList.add(insTEmployeePro);
}
......
......@@ -350,9 +350,15 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
sumDeductSalary = BigDecimalUtils.safeAdd(isTax,infoVo.getDeductTaxSalary());
}
//最优解计算区间
BigDecimal oneBecimal = new BigDecimal("36000");
BigDecimal twoBecimal = new BigDecimal("144000");
BigDecimal subOneBecimal = BigDecimalUtils.safeSubtract(wSalary,oneBecimal);
BigDecimal subTwoBecimal1 = BigDecimalUtils.safeSubtract(wSalary,twoBecimal);
if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("36000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) {
compareTo(oneBecimal) <= 0) {
if (wSalary.compareTo(oneBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -361,15 +367,15 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
minSalary = subOneBecimal;
} else {
minSalary = socialFundTax;
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
maxAnualSalary = new BigDecimal("36000");
maxAnualSalary = oneBecimal;
}
} else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("72000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) {
if (wSalary.compareTo(oneBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -378,15 +384,15 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
minSalary = subOneBecimal;
} else {
minSalary = socialFundTax;
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
maxAnualSalary = new BigDecimal("36000");
maxAnualSalary = oneBecimal;
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("203100")) <= 0) {
if (wSalary.compareTo(new BigDecimal("36000")) <= 0) {
if (wSalary.compareTo(oneBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -395,15 +401,15 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
minSalary = subOneBecimal;
} else {
minSalary = socialFundTax;
minSalary = subOneBecimal.compareTo(socialFundTax) >0 ? subOneBecimal : socialFundTax;
}
maxAnualSalary = new BigDecimal("36000");
maxAnualSalary = oneBecimal;
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("288000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("144000")) <= 0) {
if (wSalary.compareTo(twoBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -412,15 +418,15 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("144000"));
minSalary = subTwoBecimal1;
} else {
minSalary = socialFundTax;
minSalary = subTwoBecimal1.compareTo(socialFundTax) >0 ? subTwoBecimal1 : socialFundTax;
}
maxAnualSalary = new BigDecimal("144000");
maxAnualSalary = twoBecimal;
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("672000")) <= 0) {
if (wSalary.compareTo(new BigDecimal("144000")) <= 0) {
if (wSalary.compareTo(twoBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -429,15 +435,17 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("144000"));
minSalary = subTwoBecimal1;
} else {
minSalary = socialFundTax;
minSalary = subTwoBecimal1.compareTo(socialFundTax) >0 ? subTwoBecimal1 : socialFundTax;
}
maxAnualSalary = new BigDecimal("144000");
maxAnualSalary = twoBecimal;
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1277500")) <= 0) {
if (wSalary.compareTo(new BigDecimal("300000")) <= 0) {
BigDecimal threeBecimal = new BigDecimal("300000");
BigDecimal subThreeBecimal = BigDecimalUtils.safeSubtract(wSalary,threeBecimal);
if (wSalary.compareTo(threeBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -446,15 +454,17 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("300000"));
minSalary = subThreeBecimal;
} else {
minSalary = socialFundTax;
minSalary = subThreeBecimal.compareTo(socialFundTax) >0 ? subThreeBecimal : socialFundTax;
}
maxAnualSalary = new BigDecimal("300000");
maxAnualSalary = threeBecimal;
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1452500")) <= 0) {
if (wSalary.compareTo(new BigDecimal("420000")) <= 0) {
BigDecimal fourBecimal = new BigDecimal("420000");
BigDecimal subFourBecimal = BigDecimalUtils.safeSubtract(wSalary,fourBecimal);
if (wSalary.compareTo(fourBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -463,15 +473,17 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("420000"));
minSalary = subFourBecimal;
} else {
minSalary = socialFundTax;
minSalary = subFourBecimal.compareTo(socialFundTax) >0 ? subFourBecimal : socialFundTax;
}
maxAnualSalary = new BigDecimal("420000");
maxAnualSalary = fourBecimal;
}
}else if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
compareTo(new BigDecimal("1452500")) > 0) {
if (wSalary.compareTo(new BigDecimal("660000")) <= 0) {
BigDecimal fiveBecimal = new BigDecimal("660000");
BigDecimal subFiveBecimal = BigDecimalUtils.safeSubtract(wSalary,fiveBecimal);
if (wSalary.compareTo(fiveBecimal) <= 0) {
if (isSend) {
maxAnualSalary = wSalary;
} else {
......@@ -480,11 +492,11 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}else {
if (isSend) {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("660000"));
minSalary = subFiveBecimal;
} else {
minSalary = socialFundTax;
minSalary = subFiveBecimal.compareTo(socialFundTax) >0 ? subFiveBecimal : socialFundTax;
}
maxAnualSalary = new BigDecimal("660000");
maxAnualSalary = fiveBecimal;
}
}
......
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