Commit 419e8dc5 authored by fangxinjiang's avatar fangxinjiang

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

parents f7b78d28 8aaf0c4c
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Set;
/**
* 封装-返回给前端的错误信息
*
* @author hgw
* @date 2022-6-28 11:27:08
*/
@Data
public class ErrorMessageVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "行号")
private int lineNum;
@Schema(description = "姓名")
private String empName;
@Schema(description = "身份证号")
private String empIdCard;
@Schema(description = "结果:0错误;1正确(例如:是否允许删除:0否;1是)")
private int result;
@Schema(description = "错误信息Set(多重错误合并返回,给Set,前端按需组装)")
private Set<String> errorSet;
}
...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; ...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; 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.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
...@@ -236,7 +237,7 @@ public class TEmployeeInfoController { ...@@ -236,7 +237,7 @@ public class TEmployeeInfoController {
@SysLog("通过ids批量删除人员档案表") @SysLog("通过ids批量删除人员档案表")
@GetMapping("/batchDeleteEmployee") @GetMapping("/batchDeleteEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_batch_del')") @PreAuthorize("@pms.hasPermission('temployeeinfo_batch_del')")
public R<List<ErrorMessage>> batchDeleteEmployee(@RequestBody List<String> idList) { public R<List<ErrorMessageVO>> batchDeleteEmployee(@RequestBody List<String> idList) {
return tEmployeeInfoService.batchDeleteEmployee(idList); return tEmployeeInfoService.batchDeleteEmployee(idList);
} }
......
...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; ...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeLeaveVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
...@@ -101,7 +102,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -101,7 +102,7 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/6/23 16:45 * @Date: 2022/6/23 16:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
R<List<ErrorMessage>> batchDeleteEmployee(List<String> idList); R<List<ErrorMessageVO>> batchDeleteEmployee(List<String> idList);
/** /**
* @param id * @param id
......
...@@ -204,50 +204,71 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -204,50 +204,71 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} }
@Override @Override
public R<List<ErrorMessage>> batchDeleteEmployee(List<String> idList) { public R<List<ErrorMessageVO>> batchDeleteEmployee(List<String> idList) {
if (idList == null || idList.isEmpty()) { if (idList == null || idList.isEmpty()) {
return R.failed("请选择!"); return R.failed("请选择!");
} }
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessageVO> errorMessageList = new ArrayList<>();
TEmployeeInfo employee; TEmployeeInfo employee;
String id; String id;
List<TEmployeeInfo> canDeleteList = new ArrayList<>(); List<TEmployeeInfo> canDeleteList = new ArrayList<>();
ErrorMessageVO errorMessageVO;
Set<String> errorMsg; Set<String> errorMsg;
boolean isTrue = true;
for (int i = 0; i < idList.size(); i++) { for (int i = 0; i < idList.size(); i++) {
errorMsg = new HashSet<>(); errorMsg = new HashSet<>();
id = idList.get(i); id = idList.get(i);
employee = this.getById(id); employee = this.getById(id);
if (employee != null) { if (employee != null) {
if (employee.getStatus() != CommonConstants.ZERO_INT) { if (employee.getStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:非草稿状态,无法删除"); errorMsg.add("非草稿状态!");
} }
if (employee.getContractStatus() != CommonConstants.ZERO_INT) { if (employee.getContractStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:合同状态非初始,无法删除"); errorMsg.add("合同状态非初始!");
} }
if (employee.getInsuranceStatus() != CommonConstants.ZERO_INT) { if (employee.getInsuranceStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:商险状态非初始,无法删除"); errorMsg.add("商险状态非初始!");
} }
if (employee.getSocialStatus() != CommonConstants.ZERO_INT) { if (employee.getSocialStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:社保状态非初始,无法删除"); errorMsg.add("社保状态非初始!");
} }
if (employee.getFundStatus() != CommonConstants.ZERO_INT) { if (employee.getFundStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:公积金状态非初始,无法删除"); errorMsg.add("公积金状态非初始!");
} }
if (employee.getSalaryStatus() != CommonConstants.ZERO_INT) { if (employee.getSalaryStatus() != CommonConstants.ZERO_INT) {
errorMsg.add("身份证【" + employee.getEmpIdcard() + "】的人员:工资状态非初始,无法删除"); errorMsg.add("工资状态非初始!");
} }
// 数据合法情况 // 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) { if (!CollUtil.isEmpty(errorMsg)) {
isTrue = false;
errorMessageVO = new ErrorMessageVO();
errorMessageVO.setLineNum(i+2);
errorMessageVO.setResult(CommonConstants.ZERO_INT);
errorMessageVO.setEmpName(employee.getEmpName());
errorMessageVO.setEmpIdCard(employee.getEmpIdcard());
errorMessageVO.setErrorSet(errorMsg);
// 数据不合法 // 数据不合法
errorMessageList.add(new ErrorMessage((i + 1L), errorMsg)); errorMessageList.add(errorMessageVO);
} else { } else {
errorMessageVO = new ErrorMessageVO();
errorMessageVO.setLineNum(i+2);
errorMessageVO.setResult(CommonConstants.ONE_INT);
errorMessageVO.setEmpName(employee.getEmpName());
errorMessageVO.setEmpIdCard(employee.getEmpIdcard());
errorMessageList.add(errorMessageVO);
canDeleteList.add(employee); canDeleteList.add(employee);
} }
} else { } else {
errorMessageList.add(new ErrorMessage((i + 1L), errorMsg)); isTrue = false;
errorMsg.add("未找到人员!");
errorMessageVO = new ErrorMessageVO();
errorMessageVO.setLineNum(i+2);
errorMessageVO.setResult(CommonConstants.ZERO_INT);
errorMessageVO.setErrorSet(errorMsg);
errorMessageList.add(errorMessageVO);
} }
} }
if (CollUtil.isNotEmpty(errorMessageList)) { if (!isTrue && CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList); return R.failed(errorMessageList);
} else { } else {
List<TEmployeeProject> projectList; List<TEmployeeProject> projectList;
......
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