|
@@ -194,6 +194,9 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
financeConfig.setField3Calculate(cusColList.get(2).getNeedCalculate());
|
|
financeConfig.setField3Calculate(cusColList.get(2).getNeedCalculate());
|
|
}
|
|
}
|
|
List<String> userNameList=new ArrayList<>();
|
|
List<String> userNameList=new ArrayList<>();
|
|
|
|
+ List<String> jobNumberList = new ArrayList<>();
|
|
|
|
+ //是否配置了工号模式的模板
|
|
|
|
+ boolean includeJobNumber = (timeType.getFinanceJobnumEnabled() == 1);
|
|
for (int rowIndex = 0; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
|
for (int rowIndex = 0; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
|
Row row = sheet.getRow(rowIndex);
|
|
Row row = sheet.getRow(rowIndex);
|
|
if (row == null) {
|
|
if (row == null) {
|
|
@@ -203,15 +206,16 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
//(工号-可配置) 姓名 工资 奖金 津贴 养老保险 医疗保险 失业保险 (新增工伤保险) 住房公积金 其他; 可能有自定义的项
|
|
//(工号-可配置) 姓名 工资 奖金 津贴 养老保险 医疗保险 失业保险 (新增工伤保险) 住房公积金 其他; 可能有自定义的项
|
|
-
|
|
|
|
Cell jobNumberCell = null;
|
|
Cell jobNumberCell = null;
|
|
int nameStartIndex = 0;
|
|
int nameStartIndex = 0;
|
|
- //是否配置了工号模式的模板
|
|
|
|
- boolean includeJobNumber = (timeType.getFinanceJobnumEnabled() == 1);
|
|
|
|
|
|
+
|
|
|
|
+ //工号有了,就按工号匹配,没有工号需要按姓名匹配
|
|
|
|
+ String jobNumber = null;
|
|
if (includeJobNumber) {
|
|
if (includeJobNumber) {
|
|
jobNumberCell = row.getCell(0);
|
|
jobNumberCell = row.getCell(0);
|
|
if (jobNumberCell != null) {
|
|
if (jobNumberCell != null) {
|
|
jobNumberCell.setCellType(CellType.STRING);
|
|
jobNumberCell.setCellType(CellType.STRING);
|
|
|
|
+ jobNumber = jobNumberCell.getStringCellValue();
|
|
}
|
|
}
|
|
nameStartIndex = 1;
|
|
nameStartIndex = 1;
|
|
}
|
|
}
|
|
@@ -220,24 +224,50 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
if(name.equals("姓名")){
|
|
if(name.equals("姓名")){
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- if(!userNameList.contains(name)&&!name.equals("")){
|
|
|
|
- userNameList.add(name);
|
|
|
|
- }else {
|
|
|
|
- if(includeJobNumber){
|
|
|
|
- msg.setError("姓名为["+name+"]的人员存在重复,请完善工号信息!");
|
|
|
|
- }else {
|
|
|
|
- msg.setError("姓名为["+name+"]的人员存在重复,请联系服务商开启工号模式!");
|
|
|
|
|
|
+ //判断工号是否填写
|
|
|
|
+ if (StringUtils.isEmpty(jobNumber)) {
|
|
|
|
+ //没有工号,需要判断姓名是否存在重名
|
|
|
|
+ if (!StringUtils.isEmpty(name)) {
|
|
|
|
+ if (userNameList.contains(name)) {
|
|
|
|
+ if(includeJobNumber){
|
|
|
|
+ msg.setError("上传的数据中["+name+"]的存在重复,请完善工号信息!");
|
|
|
|
+ }else {
|
|
|
|
+ msg.setError("上传的数据中["+name+"]的存在重复,请确认是否有误。如确实为重名人员请联系服务商开启工号模式!");
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ } else {
|
|
|
|
+ userNameList.add(name);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //有工号的情况,判断工号是否有重复录入的
|
|
|
|
+ if (jobNumberList.contains(jobNumber)) {
|
|
|
|
+ msg.setError("上传的数据中工号为["+jobNumber+"]的存在重复数据。");
|
|
|
|
+ return msg;
|
|
}
|
|
}
|
|
- return msg;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
- if(userNameList.size() > 0 && wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
|
|
- System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
|
|
- respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
|
|
- if(respMsg.code.equals("0")){
|
|
|
|
- msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请完善工号信息!");
|
|
|
|
- return msg;
|
|
|
|
|
|
+ if(userNameList.size() > 0){
|
|
|
|
+ if (wxCorpInfo != null&&wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
|
+ System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
|
|
+ respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
|
|
+ if(respMsg.code.equals("0")){
|
|
|
|
+ msg.setError("["+String.valueOf(respMsg.data)+"]在系统中为重名人员,请完善工号信息!");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //不需要转译的情况
|
|
|
|
+ for (String name : userNameList) {
|
|
|
|
+ long count = userList.stream().filter(u -> u.getName().equals(name)).count();
|
|
|
|
+ if (count == 0) {
|
|
|
|
+ msg.setError(MessageUtils.message("group.userNull",name));
|
|
|
|
+ return msg;
|
|
|
|
+ } else if (count > 1) {
|
|
|
|
+ msg.setError("["+name+"]在系统中为重名人员,请完善工号信息!");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<User> targetUserList= (List<User>) respMsg.data;
|
|
List<User> targetUserList= (List<User>) respMsg.data;
|
|
@@ -255,7 +285,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
Cell jobNumberCell = null;
|
|
Cell jobNumberCell = null;
|
|
int nameStartIndex = 0;
|
|
int nameStartIndex = 0;
|
|
//是否配置了工号模式的模板
|
|
//是否配置了工号模式的模板
|
|
- boolean includeJobNumber = (timeType.getFinanceJobnumEnabled() == 1);
|
|
|
|
|
|
+
|
|
if (includeJobNumber) {
|
|
if (includeJobNumber) {
|
|
jobNumberCell = row.getCell(0);
|
|
jobNumberCell = row.getCell(0);
|
|
if (jobNumberCell != null) {
|
|
if (jobNumberCell != null) {
|
|
@@ -299,18 +329,30 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
|
|
if(userOp.isPresent()){
|
|
if(userOp.isPresent()){
|
|
finance.setName(userOp.get().getName());
|
|
finance.setName(userOp.get().getName());
|
|
}
|
|
}
|
|
|
|
+ //工号模式下,工号也不是必填,有工号优先按工号匹配
|
|
if (includeJobNumber) {
|
|
if (includeJobNumber) {
|
|
finance.setJobNumber(jobNumberCell!=null?jobNumberCell.getStringCellValue():null);
|
|
finance.setJobNumber(jobNumberCell!=null?jobNumberCell.getStringCellValue():null);
|
|
- if (StringUtils.isEmpty(finance.getJobNumber())) {
|
|
|
|
- msg.setError(MessageUtils.message("staff.jobNoNull"));
|
|
|
|
- return msg;
|
|
|
|
|
|
+ }
|
|
|
|
+ Optional<User> first = null;
|
|
|
|
+ if (!StringUtils.isEmpty(finance.getJobNumber())) {
|
|
|
|
+ first = userList.stream().filter(u -> finance.getJobNumber().equals(u.getJobNumber())).findFirst();
|
|
|
|
+ } else {
|
|
|
|
+ //按照姓名匹配,需区分是否是转译的方式
|
|
|
|
+ if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
|
|
|
|
+ //去转译后的名单中匹配
|
|
|
|
+ Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(name)).findFirst();
|
|
|
|
+ if (optional.isPresent()) {
|
|
|
|
+ first = userList.stream().filter(u->u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid())).findFirst();
|
|
|
|
+ } else {
|
|
|
|
+ //转译后的名单中也没有
|
|
|
|
+ System.out.println("转译后的名单中没有:"+name);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ first = userList.stream().filter(u -> u.getName().equals(name)).findFirst();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- Optional<User> first = userList.stream().filter(u -> includeJobNumber?
|
|
|
|
- u.getJobNumber() != null && u.getJobNumber().equals(finance.getJobNumber())
|
|
|
|
- :u.getName().equals(userOp.isPresent()?userOp.get().getName():name)).findFirst();
|
|
|
|
- if (first.isPresent()) {
|
|
|
|
|
|
+ if (first != null && first.isPresent()) {
|
|
finance.setUserId(first.get().getId());
|
|
finance.setUserId(first.get().getId());
|
|
BigDecimal total = new BigDecimal(0);
|
|
BigDecimal total = new BigDecimal(0);
|
|
if (salaryCell != null) {
|
|
if (salaryCell != null) {
|