Commit 3043a0ac authored by hongguangwu's avatar hongguangwu

工资-checkMap

parent 135cebfe
...@@ -48,4 +48,14 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> { ...@@ -48,4 +48,14 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> {
void listExport(HttpServletResponse response, TSalaryEmployeeSearchVo searchVo); void listExport(HttpServletResponse response, TSalaryEmployeeSearchVo searchVo);
List<TSalaryEmployee> noPageDiy(TSalaryEmployeeSearchVo searchVo); List<TSalaryEmployee> noPageDiy(TSalaryEmployeeSearchVo searchVo);
/**
* @param employee
* @Description: 新建薪资员工,返回值为null,保存成功。其余都是失败原因
* @Author: hgw
* @Date: 2022/8/17 16:03
* @return: java.lang.String
**/
String saveNewSalaryEmployee(TSalaryEmployee employee);
} }
...@@ -30,8 +30,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -30,8 +30,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryEmployeeMapper; import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryEmployeeMapper;
...@@ -39,6 +44,8 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmployeeService; ...@@ -39,6 +44,8 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmployeeService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeSearchVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
...@@ -57,7 +64,12 @@ import java.util.List; ...@@ -57,7 +64,12 @@ import java.util.List;
*/ */
@Log4j2 @Log4j2
@Service @Service
@EnableConfigurationProperties({DaprCheckProperties.class})
public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMapper, TSalaryEmployee> implements TSalaryEmployeeService { public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMapper, TSalaryEmployee> implements TSalaryEmployeeService {
@Autowired
private DaprCheckProperties checkProperties;
/** /**
* 薪酬人员表简单分页查询 * 薪酬人员表简单分页查询
* *
...@@ -180,7 +192,6 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -180,7 +192,6 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
public R<List<ErrorMessage>> importDiy(InputStream inputStream) { public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TSalaryEmployeeVo> util1 = new ExcelUtil<>(TSalaryEmployeeVo.class); ExcelUtil<TSalaryEmployeeVo> util1 = new ExcelUtil<>(TSalaryEmployeeVo.class);
;
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
...@@ -235,12 +246,10 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -235,12 +246,10 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
} }
private void importTSalaryEmployee(List<TSalaryEmployeeVo> excelVOList, List<ErrorMessage> errorMessageList) { private void importTSalaryEmployee(List<TSalaryEmployeeVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装 // 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
TSalaryEmployeeVo excel = excelVOList.get(i); TSalaryEmployeeVo excel = excelVOList.get(i);
// 数据合法情况 TODO // 数据合法情况
// 插入 // 插入
insertExcel(excel); insertExcel(excel);
...@@ -256,4 +265,54 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -256,4 +265,54 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
BeanUtil.copyProperties(excel, insert); BeanUtil.copyProperties(excel, insert);
this.save(insert); this.save(insert);
} }
/**
* @param employee
* @Description: 新建薪资员工,返回值为null,保存成功。其余都是失败原因
* @Author: hgw
* @Date: 2022/8/17 16:17
* @return: java.lang.String
**/
@Override
public String saveNewSalaryEmployee(TSalaryEmployee employee) {
if (Common.isNotNull(employee.getEmpName()) && Common.isNotNull(employee.getEmpIdcard())) {
// 银行卡
if (Common.isNotNull(employee.getBankNo())) {
// 调用校验服务
TCheckBankNo checkIdCard = new TCheckBankNo();
checkIdCard.setName(employee.getEmpName());
checkIdCard.setBankNo(employee.getBankNo());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", checkIdCard, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
TCheckBankNo check = checkListR.getData();
if (!CommonConstants.ONE_STRING.equals(check.getResult())) {
return check.getMessage();
}
} else {
return "未找到";
}
}
// 手机号
if (Common.isNotNull(employee.getEmpPhone())) {
// 调用校验服务-校验手机号
TCheckMobile checkMobile = new TCheckMobile();
checkMobile.setMobile(employee.getEmpPhone());
R<TCheckMobile> a = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", checkMobile, TCheckMobile.class, SecurityConstants.FROM_IN);
if (a != null && a.getData() != null) {
checkMobile = a.getData();
if (checkMobile != null && Common.isNotNull(checkMobile.getStatus())) {
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
return checkMobile.getMessage();
}
} else {
return "校验服务错误,请联系管理员!";
}
}
}
}
this.save(employee);
return null;
}
} }
...@@ -123,6 +123,8 @@ public class SalaryAccountUtil implements Serializable { ...@@ -123,6 +123,8 @@ public class SalaryAccountUtil implements Serializable {
String minTaxMonth; String minTaxMonth;
// 开户行省市的区域暂存 // 开户行省市的区域暂存
String areaStr; String areaStr;
// 员工新建保存的反馈,null 保存成功,其他,保存失败,反馈原因
String saveNewEmpReturn;
for (int i = 0; i < rows; i++) { for (int i = 0; i < rows; i++) {
error = ""; error = "";
temp = list.get(i); temp = list.get(i);
...@@ -429,7 +431,12 @@ public class SalaryAccountUtil implements Serializable { ...@@ -429,7 +431,12 @@ public class SalaryAccountUtil implements Serializable {
continue; continue;
} }
} }
tSalaryEmployeeService.save(newEmp); saveNewEmpReturn = tSalaryEmployeeService.saveNewSalaryEmployee(newEmp);
if (Common.isNotNull(saveNewEmpReturn)) {
error = "第" + (i + 2) + "行:该员工新建失败:【" + saveNewEmpReturn + "】" ;
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
emp = newEmp; emp = newEmp;
} else { } else {
error = "第" + (i + 2) + "行:薪酬人员档案中,该客户下无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!!"; error = "第" + (i + 2) + "行:薪酬人员档案中,该客户下无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!!";
......
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