Commit 75dc8216 authored by hongguangwu's avatar hongguangwu

EKP1.7.8-薪酬人员更新、导入、批量更新,加银行卡校验

parent 8eb9739e
......@@ -614,6 +614,12 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (Common.isNotNull(excel.getEmpName())) {
emp.setEmpName(excel.getEmpName());
}
// 2024-2-4 16:05:56 hgw 银行卡需要校验
String pre = getCheckBankNo(emp, old);
if (pre != null) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), pre));
continue;
}
// 变更日志 fxj 2023-10-24
logService.initModLog(old,emp,CommonConstants.ONE_STRING,user.getNickname(),util);
baseMapper.updateById(emp);
......@@ -749,6 +755,12 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
List<TSalaryEmployee> updateList = new ArrayList<>();
TSettleDomain dept = vo.getDept();
Map<String, String> bankMap = tBankSetService.getBankMap(null);
// 校验卡号所用的
Map<String, Boolean> bankCheckMap = new HashMap<>();
List<TCheckBankNo> bankList = new ArrayList<>();
TCheckBankNo checkBankNo;
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if (excel != null) {
......@@ -818,6 +830,15 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
emp.setDeptName(dept.getDepartName());
emp.setDeptNo(dept.getDepartNo());
emp.setInvoiceTitle(dept.getInvoiceTitleSalary());
if (Common.isNotNull(excel.getBankNo())) {
checkBankNo = new TCheckBankNo();
emp.setLineNums((i + 2));
checkBankNo.setName(excel.getEmpName());
checkBankNo.setBankNo(excel.getBankNo());
bankList.add(checkBankNo);
}
updateList.add(emp);
if (curTaxMonth) {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.CUR_TAX_INFO));
......@@ -878,6 +899,13 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
excel.setDeptName(dept.getDepartName());
excel.setDeptNo(dept.getDepartNo());
excel.setInvoiceTitle(dept.getInvoiceTitleSalary());
if (Common.isNotNull(excel.getBankNo())) {
checkBankNo = new TCheckBankNo();
excel.setLineNums((i + 2));
checkBankNo.setName(excel.getEmpName());
checkBankNo.setBankNo(excel.getBankNo());
bankList.add(checkBankNo);
}
saveList.add(excel);
errorMessageList.add(new ErrorMessage((i + 2), CommonConstants.SAVE_SUCCESS));
}
......@@ -890,11 +918,42 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
errorMessageList.add(new ErrorMessage(CommonConstants.ZERO_INT, SalaryConstants.DATA_MUST));
}
}
if (bankList != null && !bankList.isEmpty()) {
R<CheckBatchVo> checkListR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckbankno/inner/checkBankNoBatch", bankList, CheckBatchVo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
bankCheckMap = checkListR.getData().getCheckMap();
}
}
if (!updateList.isEmpty()) {
this.updateBatchById(updateList);
List<TSalaryEmployee> newUpdateList = new ArrayList<>();
for (TSalaryEmployee employee : updateList) {
if (bankCheckMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankCheckMap.get(employee.getBankNo()))) {
errorMessageList.add(new ErrorMessage(employee.getLineNums(), "第" + employee.getLineNums()
+ "行:-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!"));
} else {
employee.setIssueStatus(CommonConstants.ZERO_INT);
employee.setLineNums(null);
newUpdateList.add(employee);
}
}
this.updateBatchById(newUpdateList);
}
if (!saveList.isEmpty()) {
this.saveBatch(saveList);
List<TSalaryEmployee> newSaveList = new ArrayList<>();
for (TSalaryEmployee employee : saveList) {
if (bankCheckMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankCheckMap.get(employee.getBankNo()))) {
errorMessageList.add(new ErrorMessage(employee.getLineNums(), "第" + employee.getLineNums()
+ "行:-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!"));
} else {
employee.setIssueStatus(CommonConstants.ZERO_INT);
employee.setLineNums(null);
newSaveList.add(employee);
}
}
this.saveBatch(newSaveList);
}
boolean isTrue = true;
for (ErrorMessage message : errorMessageList) {
......@@ -958,8 +1017,13 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 变更日志 fxj 2023-10-24
TSalaryEmployee old = baseMapper.selectById(tSalaryEmployee.getId());
// 2024-2-4 16:05:56 hgw 银行卡需要校验
String pre = getCheckBankNo(tSalaryEmployee, old);
if (pre != null) return R.failed(pre);
// 变更日志 fxj 2023-10-24
logService.initModLog(old,tSalaryEmployee,CommonConstants.ZERO_STRING,user.getNickname(),null);
int res = baseMapper.updateById(tSalaryEmployee);
if (res >= CommonConstants.ZERO_INT){
......@@ -968,4 +1032,36 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
return R.failed(CommonConstants.UPDATE_DATA_FAIL);
}
}
/**
* @Description: 单个校验通用方法
* @Author: hgw
* @Date: 2024/2/4 17:15
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
private String getCheckBankNo(TSalaryEmployee tSalaryEmployee, TSalaryEmployee old) {
if (old != null && Common.isNotNull(tSalaryEmployee.getBankNo()) && !tSalaryEmployee.getBankNo().equals(old.getBankNo())) {
// 调用校验服务
TCheckBankNo checkBankNo = new TCheckBankNo();
checkBankNo.setName(tSalaryEmployee.getEmpName());
checkBankNo.setBankNo(tSalaryEmployee.getBankNo());
R<CheckBankNoVo> checkListR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", checkBankNo, CheckBankNoVo.class, SecurityConstants.FROM_IN);
String pre = "姓名与卡号验证:";
if (checkListR != null && checkListR.getData() != null) {
CheckBankNoVo vo = checkListR.getData();
TCheckBankNo check = (null == vo.getRes()) ? null : vo.getRes().getData();
if (Common.isEmpty(vo)) {
return pre + SalaryConstants.CHECK_NO_RESPONSE;
} else if (!CommonConstants.SUCCESS.equals(vo.getRes().getCode())) {
return pre + vo.getRes().getMsg();
} else if (check != null && !check.getResult().equals(CommonConstants.ZERO_ONE)) {
return pre + check.getRemark();
}
} else {
return pre + SalaryConstants.CHECK_NO_RESPONSE;
}
}
return null;
}
}
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