Commit 92f2bcb4 authored by hongguangwu's avatar hongguangwu

1.7.21-优化

parent 8852a331
...@@ -89,7 +89,7 @@ public class TSalaryZeroVo extends RowIndex implements Serializable { ...@@ -89,7 +89,7 @@ public class TSalaryZeroVo extends RowIndex implements Serializable {
@ExcelAttribute(name = "减除费用", isNotEmpty = true, errorInfo = "减除费用不能为空") @ExcelAttribute(name = "减除费用", isNotEmpty = true, errorInfo = "减除费用不能为空")
@Schema(description = "减除费用") @Schema(description = "减除费用")
@ExcelProperty("减除费用") @ExcelProperty("减除费用")
private BigDecimal costReduction; private String costReduction;
/** /**
* 计税月份 * 计税月份
*/ */
......
...@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; ...@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.CheckDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.CheckDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.salary.config.WxConfig; import com.yifu.cloud.plus.v1.yifu.salary.config.WxConfig;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryZero; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryZero;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryZeroMapper; import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryZeroMapper;
...@@ -61,6 +62,8 @@ import java.util.ArrayList; ...@@ -61,6 +62,8 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* 0申报 * 0申报
...@@ -273,7 +276,7 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala ...@@ -273,7 +276,7 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
/** /**
* 单次缓存的数据量 * 单次缓存的数据量
*/ */
public static final int MAX_ROWS = 5; public static final int MAX_ROWS = 500;
private int rowCount = CommonConstants.ZERO_INT; private int rowCount = CommonConstants.ZERO_INT;
/** /**
*临时存储 *临时存储
...@@ -314,22 +317,29 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala ...@@ -314,22 +317,29 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
codeList.add(data.getDeptNo()); codeList.add(data.getDeptNo());
} }
if (Common.isNotNull(data.getEmpPhone())) { if (Common.isNotNull(data.getEmpPhone())) {
phoneList.add(data.getEmpPhone()); if (!ValidityUtil.validateEmpPhone(data.getEmpPhone())) {
} errorMessageList.add(new ErrorMessage(data.getRowIndex(), "手机号码格式错误,请检查并修改后重新导入", data));
if (Common.isNotNull(data.getEmpIdcard())) {
cardList.add(data.getEmpIdcard());
if (cardRepeatMap.get(data.getEmpIdcard()) != null) {
errorMessageList.add(new ErrorMessage(data.getRowIndex(), "该身份证在本次导入表中有重复,请检查并修改后重新导入", data));
} else { } else {
cardRepeatMap.put(data.getEmpIdcard(), CommonConstants.ONE_INT); phoneList.add(data.getEmpPhone());
if (Common.isNotNull(data.getEmpIdcard())) {
idCardCheck = new TCheckIdCard(); if (regIdCard(data.getEmpIdcard())) {
idCardCheck.setIdCard(data.getEmpIdcard()); cardList.add(data.getEmpIdcard());
idCardCheck.setName(data.getEmpName()); if (cardRepeatMap.get(data.getEmpIdcard()) != null) {
idCardCheck.setCreateUser(userId); errorMessageList.add(new ErrorMessage(data.getRowIndex(), "该身份证在本次导入表中有重复,请检查并修改后重新导入", data));
idCardCheck.setReason(nickName); } else {
checkList.add(idCardCheck); cardRepeatMap.put(data.getEmpIdcard(), CommonConstants.ONE_INT);
cachedDataList.add(data); idCardCheck = new TCheckIdCard();
idCardCheck.setIdCard(data.getEmpIdcard());
idCardCheck.setName(data.getEmpName());
idCardCheck.setCreateUser(userId);
idCardCheck.setReason(nickName);
checkList.add(idCardCheck);
cachedDataList.add(data);
}
} else {
errorMessageList.add(new ErrorMessage(data.getRowIndex(), "该身份证号基本格式不正确,请检查并修改后重新导入", data));
}
}
} }
} }
} }
...@@ -416,6 +426,16 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala ...@@ -416,6 +426,16 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
} }
} }
private static boolean regIdCard(String content) {
boolean flag = false;
Pattern p = Pattern.compile("\\d{18}|\\d{17}X|\\d{15}|\\d{14}X");
Matcher m = p.matcher(content);
if (m.matches()) {
flag = true;
}
return flag;
}
private void importTSalaryZero(List<TSalaryZeroVo> excelVOList, List<ErrorMessage> errorMessageList private void importTSalaryZero(List<TSalaryZeroVo> excelVOList, List<ErrorMessage> errorMessageList
, String settleMonth, String invoiceTitle, String userName, Map<String, ProjectSetInfoVo> projectVoMap , String settleMonth, String invoiceTitle, String userName, Map<String, ProjectSetInfoVo> projectVoMap
, Map<String, Integer> accountMap, Map<String, Boolean> idCardMap, Map<String, Boolean> phoneMap , Map<String, Integer> accountMap, Map<String, Boolean> idCardMap, Map<String, Boolean> phoneMap
...@@ -444,74 +464,84 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala ...@@ -444,74 +464,84 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
} }
String idCard; String idCard;
Boolean resultB; Boolean resultB;
BigDecimal costReduction;
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i); excel = excelVOList.get(i);
if (Common.isEmpty(excel.getCostReduction()) if (Common.isNotNull(excel.getCostReduction())) {
|| excel.getCostReduction().remainder(SalaryConstants.COST_MONEY).compareTo(BigDecimal.ZERO) != CommonConstants.ZERO_INT) { try {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.MONEY_ERROR, excel)); costReduction = new BigDecimal(excel.getCostReduction());
} else { } catch (Exception e) {
if (Common.isNotNull(excel.getDeptNo()) && projectVoMap.get(excel.getDeptNo()) != null) { errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.MONEY_NUM_ERROR, excel));
if (accountMap.get(excel.getEmpIdcard()) != null) { continue;
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.HAVE_ACCOUNT, excel)); }
} else { if (costReduction.compareTo(SalaryConstants.COST_MONEY) < CommonConstants.ZERO_INT
if (zeroMap.get(excel.getEmpIdcard()) != null) { || costReduction.compareTo(SalaryConstants.MAX_COST_MONEY) > CommonConstants.ZERO_INT
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.HAVE_ZERO, excel)); || costReduction.remainder(SalaryConstants.COST_MONEY).compareTo(BigDecimal.ZERO) != 0) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.MONEY_ERROR, excel));
} else {
if (Common.isNotNull(excel.getDeptNo()) && projectVoMap.get(excel.getDeptNo()) != null) {
if (accountMap.get(excel.getEmpIdcard()) != null) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.HAVE_ACCOUNT, excel));
} else { } else {
idCard = excel.getEmpIdcard(); if (zeroMap.get(excel.getEmpIdcard()) != null) {
if (idCardFlag == 0) { errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.HAVE_ZERO, excel));
if (Common.isNotNull(idCard)) { } else {
resultB = idCardMap.get(idCard + CommonConstants.DOWN_LINE_STRING + excel.getEmpName()); idCard = excel.getEmpIdcard();
if (resultB != null) { if (idCardFlag == 0) {
if (Boolean.FALSE.equals(resultB)) { if (Common.isNotNull(idCard)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "姓名&身份证号不一致,请检查并修改后重新导入", excel)); resultB = idCardMap.get(idCard + CommonConstants.DOWN_LINE_STRING + excel.getEmpName());
if (resultB != null) {
if (Boolean.FALSE.equals(resultB)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "姓名&身份证号不一致,请检查并修改后重新导入", excel));
continue;
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "姓名&身份证号不一致,请检查并修改后重新导入!", excel));
continue; continue;
} }
} else { }
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "姓名&身份证号不一致,请检查并修改后重新导入!", excel)); } else if (idCardFlag == 2) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "姓名&身份证号不一致,请检查并修改后重新导入!!", excel));
continue;
}
resultB = phoneMap.get(excel.getEmpPhone());
if (resultB != null) {
if (Boolean.FALSE.equals(resultB)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "手机号校验不通过,请更改手机号后重试", excel));
continue; continue;
} }
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "手机号校验不通过,请更改手机号后重试!", excel));
continue;
} }
} else if (idCardFlag == 2) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "姓名&身份证号不一致,请检查并修改后重新导入!!", excel)); if (judgeTaxMonth(excel.getTaxMonth())) {
continue; errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "计税月份格式不正确!", excel));
}
resultB = phoneMap.get(excel.getEmpPhone());
if (resultB != null) {
if (Boolean.FALSE.equals(resultB)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "手机号校验不通过,请更改手机号后重试", excel));
continue; continue;
} }
} else { insert = new TSalaryZero();
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "手机号校验不通过,请更改手机号后重试!", excel)); BeanUtil.copyProperties(excel, insert);
continue; insert.setSettleMonth(settleMonth);
} insert.setInvoiceTitle(invoiceTitle);
insert.setDataSource(CommonConstants.THREE_STRING);
insert.setImporterName(userName);
insert.setCreateTime(now);
dept = projectVoMap.get(excel.getDeptNo());
if (dept != null) {
insert.setDeptId(dept.getId());
insert.setDeptName(dept.getDepartName());
insert.setDeleteFlag(CommonConstants.ZERO_INT);
insertList.add(insert);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS, excel));
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.DEPT_ERROR, excel));
}
if (judgeTaxMonth(excel.getTaxMonth())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "计税月份格式不正确!", excel));
continue;
}
insert = new TSalaryZero();
BeanUtil.copyProperties(excel, insert);
insert.setSettleMonth(settleMonth);
insert.setInvoiceTitle(invoiceTitle);
insert.setDataSource(CommonConstants.THREE_STRING);
insert.setImporterName(userName);
insert.setCreateTime(now);
dept = projectVoMap.get(excel.getDeptNo());
if (dept != null) {
insert.setDeptId(dept.getId());
insert.setDeptName(dept.getDepartName());
insert.setDeleteFlag(CommonConstants.ZERO_INT);
insertList.add(insert);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS, excel));
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.DEPT_ERROR, excel));
} }
} }
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.DEPT_ERROR, excel));
} }
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.DEPT_ERROR, excel));
} }
} }
} }
......
...@@ -208,6 +208,7 @@ public class SalaryConstants { ...@@ -208,6 +208,7 @@ public class SalaryConstants {
public static final String VIEW_DAY_NAME_PRE = "view_salary_zero_day_"; public static final String VIEW_DAY_NAME_PRE = "view_salary_zero_day_";
public static final String MONEY_ERROR = "减除费用金额仅限5000~60000且是5000的倍数"; public static final String MONEY_ERROR = "减除费用金额仅限5000~60000且是5000的倍数";
public static final String MONEY_NUM_ERROR = "减除费用只能是金额,不能是汉字等其他字符";
public static final String DEPT_ERROR = "根据项目编码未找到项目信息"; public static final String DEPT_ERROR = "根据项目编码未找到项目信息";
public static final BigDecimal COST_MONEY = new BigDecimal("5000"); public static final BigDecimal COST_MONEY = new BigDecimal("5000");
// 最大减除费用 // 最大减除费用
......
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