Commit 92f2bcb4 authored by hongguangwu's avatar hongguangwu

1.7.21-优化

parent 8852a331
......@@ -89,7 +89,7 @@ public class TSalaryZeroVo extends RowIndex implements Serializable {
@ExcelAttribute(name = "减除费用", isNotEmpty = true, errorInfo = "减除费用不能为空")
@Schema(description = "减除费用")
@ExcelProperty("减除费用")
private BigDecimal costReduction;
private String costReduction;
/**
* 计税月份
*/
......
......@@ -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.CheckDaprUtil;
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.entity.TSalaryZero;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryZeroMapper;
......@@ -61,6 +62,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 0申报
......@@ -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;
/**
*临时存储
......@@ -314,15 +317,17 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
codeList.add(data.getDeptNo());
}
if (Common.isNotNull(data.getEmpPhone())) {
if (!ValidityUtil.validateEmpPhone(data.getEmpPhone())) {
errorMessageList.add(new ErrorMessage(data.getRowIndex(), "手机号码格式错误,请检查并修改后重新导入", data));
} else {
phoneList.add(data.getEmpPhone());
}
if (Common.isNotNull(data.getEmpIdcard())) {
if (regIdCard(data.getEmpIdcard())) {
cardList.add(data.getEmpIdcard());
if (cardRepeatMap.get(data.getEmpIdcard()) != null) {
errorMessageList.add(new ErrorMessage(data.getRowIndex(), "该身份证在本次导入表中有重复,请检查并修改后重新导入", data));
} else {
cardRepeatMap.put(data.getEmpIdcard(), CommonConstants.ONE_INT);
idCardCheck = new TCheckIdCard();
idCardCheck.setIdCard(data.getEmpIdcard());
idCardCheck.setName(data.getEmpName());
......@@ -331,6 +336,11 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
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
}
}
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
, String settleMonth, String invoiceTitle, String userName, Map<String, ProjectSetInfoVo> projectVoMap
, Map<String, Integer> accountMap, Map<String, Boolean> idCardMap, Map<String, Boolean> phoneMap
......@@ -444,10 +464,19 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
}
String idCard;
Boolean resultB;
BigDecimal costReduction;
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if (Common.isEmpty(excel.getCostReduction())
|| excel.getCostReduction().remainder(SalaryConstants.COST_MONEY).compareTo(BigDecimal.ZERO) != CommonConstants.ZERO_INT) {
if (Common.isNotNull(excel.getCostReduction())) {
try {
costReduction = new BigDecimal(excel.getCostReduction());
} catch (Exception e) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.MONEY_NUM_ERROR, excel));
continue;
}
if (costReduction.compareTo(SalaryConstants.COST_MONEY) < CommonConstants.ZERO_INT
|| costReduction.compareTo(SalaryConstants.MAX_COST_MONEY) > CommonConstants.ZERO_INT
|| 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) {
......@@ -515,6 +544,7 @@ public class TSalaryZeroServiceImpl extends ServiceImpl<TSalaryZeroMapper, TSala
}
}
}
}
if (!insertList.isEmpty()) {
this.saveBatchWithTableName(insertList, tableName);
}
......
......@@ -208,6 +208,7 @@ public class SalaryConstants {
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_NUM_ERROR = "减除费用只能是金额,不能是汉字等其他字符";
public static final String DEPT_ERROR = "根据项目编码未找到项目信息";
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