Commit 9c61a15d authored by hongguangwu's avatar hongguangwu

合同批量删除

parent c0c54e02
...@@ -29,6 +29,8 @@ import lombok.EqualsAndHashCode; ...@@ -29,6 +29,8 @@ import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -91,12 +93,15 @@ public class TEmployeeContractInfo extends BaseEntity { ...@@ -91,12 +93,15 @@ public class TEmployeeContractInfo extends BaseEntity {
@Schema(description = "合同类型", name = "contractName") @Schema(description = "合同类型", name = "contractName")
private String contractName; private String contractName;
/** /**
* 合同类型 * 签订期限employee_contract_type
* 0 已完成一定工作任务为期限
* 1 固定期限
* 2 无固定期限
*/ */
@NotBlank(message = "合同类型不能为空") @NotBlank(message = "签订期限不能为空")
@Length(max = 32, message = "合同类型不能超过32个字符") @Length(max = 32, message = "签订期限不能超过32个字符")
@ExcelAttribute(name = "合同类型", isNotEmpty = true, errorInfo = "合同类型不能为空", maxLength = 32,isDataId = true, dataType = ExcelAttributeConstants.EMPLOYEE_CONTRACT_TYPE,needExport = true) @ExcelAttribute(name = "签订期限", isNotEmpty = true, errorInfo = "签订期限不能为空", maxLength = 32,isDataId = true, dataType = ExcelAttributeConstants.EMPLOYEE_CONTRACT_TYPE,needExport = true)
@Schema(description = "合同类型", name = "contractType") @Schema(description = "签订期限", name = "contractType")
private String contractType; private String contractType;
/** /**
* 合同起始时间 * 合同起始时间
...@@ -387,6 +392,32 @@ public class TEmployeeContractInfo extends BaseEntity { ...@@ -387,6 +392,32 @@ public class TEmployeeContractInfo extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String auditRemark; private String auditRemark;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@ExcelAttribute(name = "员工类型", isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE)
@Schema(description = "员工类型(字典值,0外包1派遣2代理)")
@Size(max = 1, message = "员工类型不可超过1位")
private String empNatrue;
/**
* 合同甲方
*/
@ExcelAttribute(name = "合同甲方")
@Schema(description = "合同甲方")
@Size(max = 50, message = "合同甲方不可超过50位")
private String contractParty;
/**
* 业务细分
*/
@NotBlank(message = "业务细分不能为空")
@Length(max = 32, message = "业务细分不能超过32个字符")
@ExcelAttribute(name = "业务细分", maxLength = 32, needExport = true)
@Schema(description = "业务细分(存lable)", name = "contractName")
private String contractSubName;
@Schema(description ="附件idList") @Schema(description ="附件idList")
@TableField(exist = false) @TableField(exist = false)
private List<String> attaList; private List<String> attaList;
......
...@@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
...@@ -61,6 +63,7 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -61,6 +63,7 @@ public class TEmployeeInfo extends BaseEntity {
/** /**
* 员工类型(字典值,0外包1派遣2代理) * 员工类型(字典值,0外包1派遣2代理)
*/ */
@ExcelAttribute(name = "员工类型", isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE)
@Schema(description = "员工类型(字典值,0外包1派遣2代理)") @Schema(description = "员工类型(字典值,0外包1派遣2代理)")
@NotNull(message = "员工类型不可为空") @NotNull(message = "员工类型不可为空")
@Size(max = 1, message = "员工类型不可超过1位") @Size(max = 1, message = "员工类型不可超过1位")
......
/*
* 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 ErrorVO 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 = "错误信息-直接显示")
private String errorInfo;
}
...@@ -2,6 +2,13 @@ package com.yifu.cloud.plus.v1.yifu.archives.Constants; ...@@ -2,6 +2,13 @@ package com.yifu.cloud.plus.v1.yifu.archives.Constants;
public class EmployeeContractConstants { public class EmployeeContractConstants {
public static final String NO_INFO = "未找到记录";
public static final String NOT_CREATE_USER = "不是创建人,无法删除";
public static final String NOT_AUDIT_STATUS = "不是待审核或审核不通过,无法删除";
public static final String searchEmpContractInfo = " 查询对应的员工合同信息!"; public static final String searchEmpContractInfo = " 查询对应的员工合同信息!";
public static final String sameEmpOnlyOneStandContract= "同一员工只允许一个在用标准合同,请按员工编码:"; public static final String sameEmpOnlyOneStandContract= "同一员工只允许一个在用标准合同,请按员工编码:";
......
...@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
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.TEmployeeContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
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.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
...@@ -152,25 +154,21 @@ public class TEmployeeContractInfoController { ...@@ -152,25 +154,21 @@ public class TEmployeeContractInfoController {
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_del')") @PreAuthorize("@pms.hasPermission('temployeecontractinfo_del')")
public R<String> removeById(@PathVariable String id) { public R<String> removeById(@PathVariable String id) {
YifuUser user = SecurityUtils.getUser(); return tEmployeeContractInfoService.deleteContract(id);
if (user == null || Common.isEmpty(user.getId())) { }
return R.failed(CommonConstants.PLEASE_LOG_IN);
} /**
TEmployeeContractInfo contractInfo = tEmployeeContractInfoService.getById(id); * 通过idList删除员工合同
if (contractInfo == null) { *
return R.failed("未找到记录"); * @param idList idList
} else { * @return R
if (!user.getId().equals(contractInfo.getCreateBy())) { */
return R.failed("不是合同创建人,无法删除"); @Operation(summary = "通过idList假删除员工合同temployeecontractinfo_del", description = "通过id删除员工合同:hasPermission('temployeecontractinfo_del')")
} @SysLog("通过idList假删除员工合同")
if (contractInfo.getAuditStatus() != CommonConstants.ZERO_INT @DeleteMapping("/batchDeleteContract")
&& contractInfo.getAuditStatus() != CommonConstants.dingleDigitIntArray[3]) { @PreAuthorize("@pms.hasPermission('temployeecontractinfo_del')")
return R.failed("不是待审核或审核不通过,无法删除"); public R<List<ErrorVO>> batchDeleteContract(@RequestBody List<String> idList) {
} return tEmployeeContractInfoService.batchDeleteContract(idList);
contractInfo.setDeleteFlag(CommonConstants.ONE_INT);
tEmployeeContractInfoService.updateById(contractInfo);
return R.ok();
}
} }
/** /**
......
...@@ -22,6 +22,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -22,6 +22,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...@@ -70,6 +72,24 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract ...@@ -70,6 +72,24 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
**/ **/
R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo); R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo);
/**
* @param id
* @Description: 单个删除
* @Author: hgw
* @Date: 2022/7/1 11:56
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> deleteContract(String id);
/**
* @param idList
* @Description: 批量删除
* @Author: hgw
* @Date: 2022/7/1 11:40
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO>>
**/
R<List<ErrorVO>> batchDeleteContract(List<String> idList);
/** /**
* @param tEmployeeContractInfo * @param tEmployeeContractInfo
* @Description: 归档 * @Description: 归档
...@@ -79,4 +99,5 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract ...@@ -79,4 +99,5 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
**/ **/
R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo); R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo);
} }
...@@ -16,13 +16,17 @@ ...@@ -16,13 +16,17 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.yifu.archives.Constants.EmployeeContractConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorMessageVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
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.ResultConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
...@@ -35,9 +39,13 @@ import org.springframework.cache.CacheManager; ...@@ -35,9 +39,13 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 员工合同 * 员工合同
...@@ -331,6 +339,69 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -331,6 +339,69 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return R.failed("参数不可为空"); return R.failed("参数不可为空");
} }
@Override
public R<String> deleteContract(@RequestParam String id) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
TEmployeeContractInfo contractInfo = this.getById(id);
if (contractInfo == null) {
return R.failed("未找到记录");
} else {
if (!user.getId().equals(contractInfo.getCreateBy())) {
return R.failed("不是合同创建人,无法删除");
}
if (contractInfo.getAuditStatus() != CommonConstants.ZERO_INT
&& contractInfo.getAuditStatus() != CommonConstants.dingleDigitIntArray[3]) {
return R.failed("不是待审核或审核不通过,无法删除");
}
contractInfo.setDeleteFlag(CommonConstants.ONE_INT);
this.updateById(contractInfo);
}
return R.ok();
}
@Override
public R<List<ErrorVO>> batchDeleteContract(List<String> idList) {
if (idList == null || idList.isEmpty()) {
return R.failed("请选择!");
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<ErrorVO> returnList = new ArrayList<>();
TEmployeeContractInfo contractInfo;
String id;
ErrorVO errorVo;
for (int i = 0; i < idList.size(); i++) {
errorVo = new ErrorVO();
errorVo.setResult(CommonConstants.ZERO_INT);
errorVo.setLineNum(i+1);
id = idList.get(i);
contractInfo = this.getById(id);
if (contractInfo == null) {
errorVo.setErrorInfo(EmployeeContractConstants.NO_INFO);
} else {
errorVo.setEmpName(contractInfo.getEmpName());
errorVo.setEmpIdCard(contractInfo.getEmpIdcard());
if (!user.getId().equals(contractInfo.getCreateBy())) {
errorVo.setErrorInfo(EmployeeContractConstants.NOT_CREATE_USER);
} else if (contractInfo.getAuditStatus() != CommonConstants.ZERO_INT
&& contractInfo.getAuditStatus() != CommonConstants.dingleDigitIntArray[3]) {
errorVo.setErrorInfo(EmployeeContractConstants.NOT_AUDIT_STATUS);
} else {
errorVo.setResult(CommonConstants.ONE_INT);
contractInfo.setDeleteFlag(CommonConstants.ONE_INT);
this.updateById(contractInfo);
}
}
returnList.add(errorVo);
}
return R.ok(returnList);
}
@Override @Override
public R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo) { public R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo) {
if (tEmployeeContractInfo != null) { if (tEmployeeContractInfo != null) {
......
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