Commit 1455e78c authored by hongguangwu's avatar hongguangwu

MVP1.6.2-工资原表识别-优化

parent 4e68f989
......@@ -48,5 +48,11 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-check-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardIssueRes;
import lombok.Getter;
import lombok.Setter;
......@@ -35,4 +36,6 @@ public class SalaryUploadParamVo {
// 代发户的配置list
List<TSalaryStandardIssueRes> resList;
List<TCheckIdCard> checkList;
}
......@@ -34,6 +34,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalDetailS
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelSheetVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadOriginalParamVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadParamVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -262,7 +263,7 @@ public class TSalaryStandardOriginalController {
@SysLog("新版原表识别导入")
@Operation(description = "新版原表识别导入")
@PostMapping("/salaryUploadByOriginal")
public R<List<ErrorMessage>> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo vo) {
public R<SalaryUploadParamVo> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo vo) {
return tSalaryStandardOriginalService.salaryUploadByOriginal(file, vo);
}
......
......@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginal;
import com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelSheetVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadOriginalParamVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadParamVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
......@@ -62,6 +63,6 @@ public interface TSalaryStandardOriginalService extends IService<TSalaryStandard
* @Date: 2024/4/8 18:05
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
R<List<ErrorMessage>> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo excelVo);
R<SalaryUploadParamVo> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo excelVo);
}
......@@ -622,25 +622,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
@Override
public R<List<ErrorMessage>> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo excelVo) {
R<String> contR = this.getExcelContent(file, excelVo);
if (contR != null) {
if (CommonConstants.SUCCESS.equals(contR.getCode())) {
SalaryUploadParamVo vo = new SalaryUploadParamVo();
vo.setJsonString(contR.getData());
vo.setSalaryType(excelVo.getSalaryType());
vo.setConfigId(excelVo.getConfigId());
vo.setIsIssue(excelVo.getIsIssue());
vo.setOrderId(excelVo.getOrderId());
vo.setResList(excelVo.getResList());
vo.setSettleDepart(excelVo.getSettleDepart());
return salaryUploadService.salaryUpload(vo);
} else {
return R.failed(contR.getMsg());
}
} else {
return R.failed("原表识别无数据!请准备原表,联系管理员");
}
public R<SalaryUploadParamVo> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo excelVo) {
return this.getExcelContent(file, excelVo);
}
/**
......@@ -650,14 +633,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @Date: 2024-4-8 18:20:22
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo>
**/
private R<String> getExcelContent(MultipartFile file, SalaryUploadOriginalParamVo excelVo) {
String sheetName = excelVo.getSheetName();
// 配置
String originalId = excelVo.getOriginalId();
// 特殊身份证允许识别为数据行
List<String> specialIdCardList = baseMapper.getSpecialIdCardList();
private R<SalaryUploadParamVo> getExcelContent(MultipartFile file, SalaryUploadOriginalParamVo excelVo) {
try {
String sheetName = excelVo.getSheetName();
// 配置
String originalId = excelVo.getOriginalId();
// 特殊身份证允许识别为数据行
List<String> specialIdCardList = baseMapper.getSpecialIdCardList();
//对前端传递的文件进行校验
if (Common.isEmpty(originalId)) {
return R.failed("识别配置为空,请选择识别配置!");
......@@ -743,7 +726,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
int i = 0;
List<TCheckIdCard> checkList = new ArrayList<>();
TCheckIdCard check;
StringBuilder errMsg = new StringBuilder();
// StringBuilder errMsg = new StringBuilder()
for (Map<String, String> rowMap : vo.getContentList()) {
i++;
newRowMap = new HashMap<>();
......@@ -781,7 +764,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
// 调用校验服务
String pre = "姓名与身份证验证:";
/*String pre = "姓名与身份证验证:";
R<TCheckIdCard> checkListR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckidcard/inner/checkIdCardSingle", check, TCheckIdCard.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
......@@ -793,14 +776,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
} else {
errMsg.append("第 ").append(i).append(" 行:").append(check.getIdCard()).append(pre).append("校验服务器未返回,请联系管理员!!");
}
}*/
checkList.add(check);
contentList.add(newRowMap);
}
if (Common.isNotNull(errMsg) && Common.isNotNull(errMsg.toString())) {
/*if (Common.isNotNull(errMsg) && Common.isNotNull(errMsg.toString())) {
return R.failed(errMsg.toString());
}
}*/
/*// 调用校验服务
CheckIdCardListVo checkVo = new CheckIdCardListVo();
......@@ -830,13 +813,24 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 最后转化为jsonString
jsonString = JSON.toJSON(contentList).toString();
SalaryUploadParamVo returnVo = new SalaryUploadParamVo();
returnVo.setCheckList(checkList);
returnVo.setJsonString(jsonString);
returnVo.setSalaryType(excelVo.getSalaryType());
returnVo.setConfigId(excelVo.getConfigId());
returnVo.setIsIssue(excelVo.getIsIssue());
returnVo.setOrderId(excelVo.getOrderId());
returnVo.setResList(excelVo.getResList());
returnVo.setSettleDepart(excelVo.getSettleDepart());
//数据保存
return R.ok(returnVo);
}
//数据保存
return R.ok(jsonString);
return R.failed("无法识别数据!请联系管理员");
} catch (IOException e) {
e.printStackTrace();
}
return null;
return R.failed("无法识别数据!请联系管理员!");
}
}
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