Commit c996743e authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 569ed22e f3af0bd9
...@@ -64,7 +64,7 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -64,7 +64,7 @@ public class TEmployeeInfo extends BaseEntity {
*/ */
@Schema(description = "员工类型(字典值,0外包1派遣2代理)") @Schema(description = "员工类型(字典值,0外包1派遣2代理)")
@NotNull( message = "员工类型不可为空") @NotNull( message = "员工类型不可为空")
@Max(value = 1, message = "员工类型不可超过1位") @Size(max = 1, message = "员工类型不可超过1位")
private String empNatrue; private String empNatrue;
/** /**
...@@ -137,7 +137,7 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -137,7 +137,7 @@ public class TEmployeeInfo extends BaseEntity {
* 邮箱 * 邮箱
*/ */
@Schema(description = "邮箱") @Schema(description = "邮箱")
@Size(max = 32, message = "邮箱不可超过32位") @Size(max = 50, message = "邮箱不可超过50位")
private String empEmail; private String empEmail;
/** /**
......
...@@ -258,7 +258,6 @@ public class TEmployeeInfoController { ...@@ -258,7 +258,6 @@ public class TEmployeeInfoController {
} }
/** /**
* @param idList
* @Description: 通过ids批量减档人员档案表 * @Description: 通过ids批量减档人员档案表
* @Author: hgw * @Author: hgw
* @Date: 2022/6/21 19:42 * @Date: 2022/6/21 19:42
...@@ -268,7 +267,7 @@ public class TEmployeeInfoController { ...@@ -268,7 +267,7 @@ public class TEmployeeInfoController {
@SysLog("批量减档人员档案表") @SysLog("批量减档人员档案表")
@GetMapping("/batchMinusEmployee") @GetMapping("/batchMinusEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_batch_minus')") @PreAuthorize("@pms.hasPermission('temployeeinfo_batch_minus')")
public R<List<ErrorMessage>> batchMinusEmployee(@RequestExcel List<EmployeeLeaveVO> excelList, BindingResult bindingResult) { public R<List<ErrorMessageVO>> batchMinusEmployee(@RequestExcel List<EmployeeLeaveVO> excelList, BindingResult bindingResult) {
return tEmployeeInfoService.batchMinusEmployee(excelList, bindingResult); return tEmployeeInfoService.batchMinusEmployee(excelList, bindingResult);
} }
......
...@@ -22,6 +22,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -22,6 +22,8 @@ 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.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
...@@ -30,6 +32,8 @@ import lombok.RequiredArgsConstructor; ...@@ -30,6 +32,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 档案变更日志表 * 档案变更日志表
...@@ -115,4 +119,30 @@ public class TEmployeeLogController { ...@@ -115,4 +119,30 @@ public class TEmployeeLogController {
return R.ok(tEmployeeLogService.removeById(id)); return R.ok(tEmployeeLogService.removeById(id));
} }
/**
* @Description: 通过EMP_ID查询人员档案变更日志
* @Author: hgw
* @Date: 2022/6/28 16:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog>>
**/
@Operation(summary = "通过EMP_ID查询人员档案变更日志", description = "通过EMP_ID查询人员档案变更日志")
@GetMapping("/getByEmpId")
public R<List<TEmployeeLog>> getByEmpId(@RequestParam String empId) {
return R.ok(tEmployeeLogService.list(Wrappers.<TEmployeeLog>query().eq("EMP_ID", empId)
.eq("TYPE", CommonConstants.ZERO_INT)));
}
/**
* @Description: 通过PROJECT_ID查询项目档案变更日志
* @Author: hgw
* @Date: 2022/6/28 16:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog>>
**/
@Operation(summary = "通过PROJECT_ID查询项目档案变更日志", description = "通过PROJECT_ID查询项目档案变更日志")
@GetMapping("/getByProjectId")
public R<List<TEmployeeLog>> getByProjectId(@RequestParam String projectId) {
return R.ok(tEmployeeLogService.list(Wrappers.<TEmployeeLog>query().eq("PROJECT_ID", projectId)
.eq("TYPE", CommonConstants.ONE_INT)));
}
} }
...@@ -128,7 +128,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -128,7 +128,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/6/23 17:12 * @Date: 2022/6/23 17:12
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/ **/
R<List<ErrorMessage>> batchMinusEmployee(List<EmployeeLeaveVO> excelVOList, BindingResult bindingResult); R<List<ErrorMessageVO>> batchMinusEmployee(List<EmployeeLeaveVO> excelVOList, BindingResult bindingResult);
/** /**
* @param employeeInfo 档案信息 * @param employeeInfo 档案信息
......
...@@ -40,6 +40,7 @@ import org.apache.commons.fileupload.FileItemFactory; ...@@ -40,6 +40,7 @@ import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
...@@ -84,21 +85,26 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -84,21 +85,26 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
* @date: 2022/6/27 * @date: 2022/6/27
*/ */
@Override @Override
public R<Boolean> importZip(MultipartFile zipFile) { public R<Boolean> importZip(MultipartFile zipFile){
//C:\Users\登录用户~1\AppData\Local\Temp\ try {
String pathName = System.getProperty("java.io.tmpdir") + "shpFileCache/"; String pathName = ResourceUtils.getURL("classpath:").getPath() + "unloap/";
String dec = System.getProperty("java.io.tmpdir") + "shpFileCache/"; String dec = ResourceUtils.getURL("classpath:").getPath() + "unloap/";
File file1 = new File(pathName);
//如果文件夹不存在 创建文件夹
if (!file1.exists()) {
file1.mkdir();
}
//获取文件名(包括后缀) //获取文件名(包括后缀)
String pname = zipFile.getOriginalFilename(); String pname = zipFile.getOriginalFilename();
pathName = pathName + pname; pathName = pathName + pname;
try {
File file = new File(pathName); File file = new File(pathName);
zipFile.transferTo(file); zipFile.transferTo(file);
// 获取解压出来的文件名 不带后缀 // 获取解压出来的文件名 不带后缀
unZip(file, dec); unZip(file, dec);
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件 //解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFile(dec); deleteFolder(dec);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -136,8 +142,6 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -136,8 +142,6 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
elecTypeMapData = dictMap.get("data"); elecTypeMapData = dictMap.get("data");
elecTypeMap = elecTypeMapData.get("elec_archives_type"); elecTypeMap = elecTypeMapData.get("elec_archives_type");
} }
//记录解压出来的所有文件名
List<String> filesName = new ArrayList<>();
// 判断源文件是否存在 // 判断源文件是否存在
if (!srcFile.exists()) { if (!srcFile.exists()) {
throw new RuntimeException(srcFile.getPath() + "所指文件不存在"); throw new RuntimeException(srcFile.getPath() + "所指文件不存在");
...@@ -244,40 +248,72 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -244,40 +248,72 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
return multipartFile; return multipartFile;
} }
/** /**
* 删除文件 * 根据路径删除指定的目录或文件,无论存在与否
* * @param path 要删除的目录或文件路径
* @param filePath * @return 删除成功返回 true,否则返回 false
* @return
*/ */
public static boolean deleteFile(String filePath) { public static boolean deleteFolder(String path) {
boolean flag = false; File file = new File(path);
File file = new File(filePath); // 判断目录或文件是否存在
if (!file.exists()) { if (!file.exists()) {
return flag; return false;
} else {
// 判断是否为文件
if (file.isFile()) { // 为文件时调用删除文件方法
return deleteFile(path);
} else { // 为目录时调用删除目录方法
return deleteDirectory(path);
} }
if (!file.isDirectory()) {
return flag;
} }
String[] tempList = file.list();
File temp;
for (int i = 0; i < tempList.length; i++) {
if (filePath.endsWith(File.separator)) {
temp = new File(filePath + tempList[i]);
} else {
temp = new File(filePath + File.separator + tempList[i]);
} }
if (temp.isFile()) {
temp.delete(); /**
* 删除单个文件
*/
private static boolean deleteFile(String path) {
File file = new File(path);
// 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) {
file.delete();
return true;
}
return false;
}
/**
* 删除目录(文件夹)以及目录下的文件
*/
private static boolean deleteDirectory(String path) {
//如果path不以文件分隔符结尾,自动添加文件分隔符
if (!path.endsWith(File.separator)) {
path = path + File.separator;
}
File dirFile = new File(path);
//如果dir对应的文件不存在,或者不是一个目录,则退出
if (!dirFile.exists() || !dirFile.isDirectory()) {
return false;
}
boolean flag = true;
//删除文件夹下的所有文件(包括子目录)
File[] files = dirFile.listFiles();
for (File file : files) {
//删除子文件
if (file.isFile()) {
flag = deleteFile(file.getAbsolutePath());
} //删除子目录
else {
flag = deleteDirectory(file.getAbsolutePath());
}
if (!flag) {
break;
} }
if (temp.isDirectory()) {
// 先删除文件夹里面的文件
deleteFile(filePath + "/" + tempList[i]);
// 再删除空文件夹
deleteFile(filePath + "/" + tempList[i]);
flag = true;
} }
if (!flag) {
return false;
} }
return flag; //删除当前目录
return dirFile.delete();
} }
} }
...@@ -108,17 +108,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -108,17 +108,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
TCheckIdCard checkIdCard = new TCheckIdCard(); TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(employeeInfo.getEmpName()); checkIdCard.setName(employeeInfo.getEmpName());
checkIdCard.setIdCard(employeeInfo.getEmpIdcard()); checkIdCard.setIdCard(employeeInfo.getEmpIdcard());
List<TCheckIdCard> checkList = new ArrayList<>(); R<TCheckIdCard> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
checkList.add(checkIdCard); , "/tcheckidcard/inner/checkIdCardSingle", checkIdCard, TCheckIdCard.class, SecurityConstants.FROM_IN);
R<List<TCheckIdCard>> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckidcard/inner/checkIdCard", checkList, TCheckIdCard.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) { if (checkListR != null && checkListR.getData() != null) {
for (TCheckIdCard check : checkListR.getData()) { TCheckIdCard check = checkListR.getData();
if (check.getIsTrue() == CommonConstants.ZERO_INT) { if (check.getIsTrue() == CommonConstants.ZERO_INT) {
return R.failed(check.getReason()); return R.failed(check.getReason());
} }
} }
}
return R.ok(); return R.ok();
} }
} }
...@@ -241,30 +238,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -241,30 +238,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 数据合法情况 // 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) { if (!CollUtil.isEmpty(errorMsg)) {
isTrue = false; isTrue = false;
errorMessageVO = new ErrorMessageVO(); errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ZERO_INT, employee.getEmpName()
errorMessageVO.setLineNum(i+2); , employee.getEmpIdcard(), errorMsg);
errorMessageVO.setResult(CommonConstants.ZERO_INT);
errorMessageVO.setEmpName(employee.getEmpName());
errorMessageVO.setEmpIdCard(employee.getEmpIdcard());
errorMessageVO.setErrorSet(errorMsg);
// 数据不合法 // 数据不合法
errorMessageList.add(errorMessageVO);
} else { } else {
errorMessageVO = new ErrorMessageVO(); errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ONE_INT, employee.getEmpName()
errorMessageVO.setLineNum(i+2); , employee.getEmpIdcard(), errorMsg);
errorMessageVO.setResult(CommonConstants.ONE_INT);
errorMessageVO.setEmpName(employee.getEmpName());
errorMessageVO.setEmpIdCard(employee.getEmpIdcard());
errorMessageList.add(errorMessageVO);
canDeleteList.add(employee); canDeleteList.add(employee);
} }
errorMessageList.add(errorMessageVO);
} else { } else {
isTrue = false; isTrue = false;
errorMsg.add("未找到人员!"); errorMsg.add("未找到人员!");
errorMessageVO = new ErrorMessageVO(); errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ZERO_INT, null, null, errorMsg);
errorMessageVO.setLineNum(i+2);
errorMessageVO.setResult(CommonConstants.ZERO_INT);
errorMessageVO.setErrorSet(errorMsg);
errorMessageList.add(errorMessageVO); errorMessageList.add(errorMessageVO);
} }
} }
...@@ -288,6 +274,17 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -288,6 +274,17 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} }
} }
private ErrorMessageVO getErrorMessageVO(int i, int result, String empName, String idCard, Set<String> errorMsg) {
ErrorMessageVO errorMessageVO = new ErrorMessageVO();
errorMessageVO.setLineNum(i + 2);
// 结果:0错误;1正确
errorMessageVO.setResult(result);
errorMessageVO.setEmpName(empName);
errorMessageVO.setEmpIdCard(idCard);
errorMessageVO.setErrorSet(errorMsg);
return errorMessageVO;
}
@Override @Override
public R<String> restoreEmployee(String id, String projectIds) { public R<String> restoreEmployee(String id, String projectIds) {
TEmployeeInfo employee = this.getById(id); TEmployeeInfo employee = this.getById(id);
...@@ -324,7 +321,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -324,7 +321,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} }
@Override @Override
public R<List<ErrorMessage>> batchMinusEmployee(List<EmployeeLeaveVO> excelVOList, BindingResult bindingResult) { public R<List<ErrorMessageVO>> batchMinusEmployee(List<EmployeeLeaveVO> excelVOList, BindingResult bindingResult) {
if (excelVOList == null || excelVOList.isEmpty()) { if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY); return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
} }
...@@ -332,8 +329,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -332,8 +329,9 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (user == null || Common.isEmpty(user.getId())) { if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN); return R.failed(CommonConstants.PLEASE_LOG_IN);
} }
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessageVO> errorMessageList = new ArrayList<>();
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>(); ErrorMessageVO errorMessageVO;
Map<Integer, Integer> errorMsgMap = new HashMap<>();
TEmployeeInfo employee; TEmployeeInfo employee;
List<TEmployeeInfo> canDeleteList = new ArrayList<>(); List<TEmployeeInfo> canDeleteList = new ArrayList<>();
...@@ -342,6 +340,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -342,6 +340,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
List<String> idCardList = new ArrayList<>(); List<String> idCardList = new ArrayList<>();
String idCard; String idCard;
boolean isTrue = true;
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
errorMsg = new HashSet<>(); errorMsg = new HashSet<>();
excel = excelVOList.get(i); excel = excelVOList.get(i);
...@@ -349,18 +348,24 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -349,18 +348,24 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
idCard = excel.getEmpIdcard(); idCard = excel.getEmpIdcard();
if (Common.isEmpty(idCard)) { if (Common.isEmpty(idCard)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_MUST, excel.getEmpIdcard())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_MUST, excel.getEmpIdcard()));
errorMsgMap.put((i + 2L), new ErrorMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_MUST)); errorMsgMap.put(i + 2, CommonConstants.ZERO_INT);
} else { } else {
idCardList.add(idCard); idCardList.add(idCard);
} }
if (Common.isEmpty(excel.getLeaveReason())) { if (Common.isEmpty(excel.getLeaveReason())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_LEAVEREASON_MUST, excel.getEmpIdcard())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_LEAVEREASON_MUST, excel.getEmpIdcard()));
errorMsgMap.put((i + 2L), new ErrorMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_IDCARD_MUST)); errorMsgMap.put(i + 2, CommonConstants.ZERO_INT);
} }
// 数据不合法 // 数据不合法
if (!CollUtil.isEmpty(errorMsg)) { if (!CollUtil.isEmpty(errorMsg)) {
errorMessageList.add(new ErrorMessage((i + 2L), errorMsg)); isTrue = false;
errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ZERO_INT, excel.getEmpName()
, idCard, errorMsg);
} else {
errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ONE_INT, excel.getEmpName()
, idCard, errorMsg);
} }
errorMessageList.add(errorMessageVO);
} }
// 查找档案库 // 查找档案库
Map<String, TEmployeeInfo> existEmpMap = new HashMap<>(); Map<String, TEmployeeInfo> existEmpMap = new HashMap<>();
...@@ -373,7 +378,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -373,7 +378,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 执行数据插入操作 组装 // 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个 // 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get((i + 2L)))) { if (Common.isNotNull(errorMsgMap.get(i + 2))) {
continue; continue;
} }
errorMsg = new HashSet<>(); errorMsg = new HashSet<>();
...@@ -398,10 +403,16 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -398,10 +403,16 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} }
// 数据不合法 // 数据不合法
if (!CollUtil.isEmpty(errorMsg)) { if (!CollUtil.isEmpty(errorMsg)) {
errorMessageList.add(new ErrorMessage((i + 2L), errorMsg)); isTrue = false;
errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ZERO_INT, excel.getEmpName()
, excel.getEmpIdcard(), errorMsg);
} else {
errorMessageVO = this.getErrorMessageVO(i, CommonConstants.ONE_INT, excel.getEmpName()
, excel.getEmpIdcard(), errorMsg);
} }
errorMessageList.add(errorMessageVO);
} }
if (CollUtil.isNotEmpty(errorMessageList)) { if (!isTrue && CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList); return R.failed(errorMessageList);
} else { } else {
// 仅更新自己 // 仅更新自己
...@@ -602,6 +613,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -602,6 +613,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>(); Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)) { if (Common.isNotNull(errorMessageList)) {
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), errorMessage)); errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), errorMessage));
} else {
errorMessageList = new ArrayList<>();
} }
// 获取身份证、手机号列表,批量查询档案 // 获取身份证、手机号列表,批量查询档案
...@@ -720,19 +733,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -720,19 +733,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
TCheckIdCard checkIdCard = new TCheckIdCard(); TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(excel.getEmpName()); checkIdCard.setName(excel.getEmpName());
checkIdCard.setIdCard(excel.getEmpIdcard()); checkIdCard.setIdCard(excel.getEmpIdcard());
List<TCheckIdCard> checkList = new ArrayList<>(); R<TCheckIdCard> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
checkList.add(checkIdCard); , "/tcheckidcard/inner/checkIdCardSingle", checkIdCard, TCheckIdCard.class, SecurityConstants.FROM_IN);
R<List<TCheckIdCard>> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckidcard/inner/checkIdCard", checkList, TCheckIdCard.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) { if (checkListR != null && checkListR.getData() != null) {
for (TCheckIdCard check : checkListR.getData()) { TCheckIdCard check = checkListR.getData();
if (check.getIsTrue() == CommonConstants.ZERO_INT) { if (check.getIsTrue() == CommonConstants.ZERO_INT) {
errorMsg.add(check.getReason()); errorMsg.add(check.getReason());
break;
}
} }
} }
saveEmp.setEmpName(excel.getEmpName()); saveEmp.setEmpName(excel.getEmpName());
saveEmp.setEmpIdcard(excel.getEmpIdcard()); saveEmp.setEmpIdcard(excel.getEmpIdcard());
......
...@@ -159,7 +159,7 @@ public class TCheckIdCardController { ...@@ -159,7 +159,7 @@ public class TCheckIdCardController {
@SysLog("校验姓名身份证 --- 单个") @SysLog("校验姓名身份证 --- 单个")
@Inner @Inner
@PostMapping("/inner/checkIdCardSingle") @PostMapping("/inner/checkIdCardSingle")
public R<TCheckIdCard> checkIdCardSingle(String idCard, String name) { public R<TCheckIdCard> checkIdCardSingle(@RequestBody TCheckIdCard tCheckIdCard) {
return tCheckIdCardService.checkIdCardSingle(idCard, name); return tCheckIdCardService.checkIdCardSingle(tCheckIdCard);
} }
} }
...@@ -45,5 +45,5 @@ public interface TCheckIdCardService extends IService<TCheckIdCard> { ...@@ -45,5 +45,5 @@ public interface TCheckIdCardService extends IService<TCheckIdCard> {
**/ **/
R<List<TCheckIdCard>> checkIdCard(List<TCheckIdCard> checkList); R<List<TCheckIdCard>> checkIdCard(List<TCheckIdCard> checkList);
R<TCheckIdCard> checkIdCardSingle(String idCard, String name); R<TCheckIdCard> checkIdCardSingle(TCheckIdCard tCheckIdCard);
} }
...@@ -226,7 +226,9 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -226,7 +226,9 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
} }
@Override @Override
public R<TCheckIdCard> checkIdCardSingle(String idCard, String name) { public R<TCheckIdCard> checkIdCardSingle(TCheckIdCard tCheckIdCard) {
String idCard = tCheckIdCard.getIdCard();
String name = tCheckIdCard.getName();
if (Common.isEmpty(idCard) || Common.isEmpty(name)){ if (Common.isEmpty(idCard) || Common.isEmpty(name)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY); return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
} }
...@@ -237,6 +239,16 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -237,6 +239,16 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(checkIdCard)){ if (Common.isNotNull(checkIdCard)){
return R.ok(checkIdCard); return R.ok(checkIdCard);
} else {
// 没找到正确的,再去找有没有错误的,如果还没有,再查
List<TCheckIdCard> checkList = baseMapper.selectList(Wrappers.<TCheckIdCard>query().lambda()
.eq(TCheckIdCard::getIdCard,idCard));
if (checkList != null && !checkList.isEmpty()) {
for (TCheckIdCard c : checkList) {
if (idCard.equals(c.getIdCard()) && name.equals(c.getName())) {
return R.ok(c);
}
}
} }
TCheckIdCard c = new TCheckIdCard(); TCheckIdCard c = new TCheckIdCard();
c.setIdCard(idCard); c.setIdCard(idCard);
...@@ -246,5 +258,6 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh ...@@ -246,5 +258,6 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
return R.ok(c); return R.ok(c);
} }
} }
}
} }
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