Commit 5b31cd4c authored by hongguangwu's avatar hongguangwu

合同优化

parent db5c4786
...@@ -141,12 +141,12 @@ public class TEmployeeContractInfo extends BaseEntity { ...@@ -141,12 +141,12 @@ public class TEmployeeContractInfo extends BaseEntity {
@Schema(description = "合同年限", name = "contractTerm") @Schema(description = "合同年限", name = "contractTerm")
private Double contractTerm; private Double contractTerm;
/** /**
* 合同编 * 合同编
*/ */
@NotBlank(message = "合同编不能为空") @NotBlank(message = "合同编不能为空")
@Length(max = 128, message = "合同编不能超过128个字符") @Length(max = 128, message = "合同编不能超过128个字符")
@ExcelAttribute(name = "合同编", maxLength = 128) @ExcelAttribute(name = "合同编", maxLength = 128)
@Schema(description = "合同编", name = "contractNo") @Schema(description = "合同编", name = "contractNo")
private String contractNo; private String contractNo;
/** /**
* 备注 * 备注
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller; package com.yifu.cloud.plus.v1.yifu.archives.controller;
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;
...@@ -53,6 +54,39 @@ public class TEmployeeContractInfoController { ...@@ -53,6 +54,39 @@ public class TEmployeeContractInfoController {
private final TEmployeeContractInfoService tEmployeeContractInfoService; private final TEmployeeContractInfoService tEmployeeContractInfoService;
/**
* 申请、归档分页查询
* @param page 分页对象
* @param tEmployeeContractInfo 员工合同
* @return
*/
@Operation(summary = "申请分页查询(全部的数据(后面加上权限:自己创建的))", description = "申请分页查询")
@GetMapping("/applyPage")
public R<IPage<TEmployeeContractInfo>> getApplyPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
}
@Operation(summary = "归档分页查询(审核通过的数据(后面加上权限:自己创建的))", description = "归档分页查询")
@GetMapping("/filingPage")
public R<IPage<TEmployeeContractInfo>> getFilingPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
tEmployeeContractInfo.setAuditStatus(CommonConstants.dingleDigitIntArray[2]);
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
}
/**
* 合同审核分页查询
*
* @param page 分页对象
* @param tEmployeeContractInfo 员工合同
* @return
*/
@Operation(summary = "合同审核分页查询(待审核的数据)", description = "合同审核分页查询")
@GetMapping("/auditPage")
public R<IPage<TEmployeeContractInfo>> getAuditPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
tEmployeeContractInfo.setAuditStatus(CommonConstants.ONE_INT);
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
}
/** /**
* 分页查询 * 分页查询
* *
...@@ -60,9 +94,9 @@ public class TEmployeeContractInfoController { ...@@ -60,9 +94,9 @@ public class TEmployeeContractInfoController {
* @param tEmployeeContractInfo 员工合同 * @param tEmployeeContractInfo 员工合同
* @return * @return
*/ */
@Operation(summary = "分页查询", description = "分页查询") @Operation(summary = "合同查询(全部的数据)", description = "合同查询")
@GetMapping("/page") @GetMapping("/page")
public R gettemployeecontractinfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) { public R<IPage<TEmployeeContractInfo>> gettemployeecontractinfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo)); return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
} }
...@@ -75,7 +109,7 @@ public class TEmployeeContractInfoController { ...@@ -75,7 +109,7 @@ public class TEmployeeContractInfoController {
*/ */
@Operation(summary = "通过id查询", description = "通过id查询") @Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}") @GetMapping("/{id}")
public R getById(@PathVariable("id") String id) { public R<TEmployeeContractInfo> getById(@PathVariable("id") String id) {
return R.ok(tEmployeeContractInfoService.getById(id)); return R.ok(tEmployeeContractInfoService.getById(id));
} }
...@@ -85,7 +119,7 @@ public class TEmployeeContractInfoController { ...@@ -85,7 +119,7 @@ public class TEmployeeContractInfoController {
* @param tEmployeeContractInfo 员工合同 * @param tEmployeeContractInfo 员工合同
* @return R * @return R
*/ */
@Operation(summary = "新增员工合同auditStatus审核状态,前端传参(0:保存为待提交;1:提交为待审核)temployeecontractinfo_add附件传参attaList", description = "新增员工合同:hasPermission('temployeecontractinfo_add')") @Operation(summary = "新增-员工合同auditStatus审核状态,前端传参(0:保存为待提交;1:提交为待审核)temployeecontractinfo_add附件传参attaList", description = "新增员工合同:hasPermission('temployeecontractinfo_add')")
@SysLog("新增员工合同") @SysLog("新增员工合同")
@PostMapping("/saveNewContract") @PostMapping("/saveNewContract")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_add')") @PreAuthorize("@pms.hasPermission('temployeecontractinfo_add')")
...@@ -99,7 +133,7 @@ public class TEmployeeContractInfoController { ...@@ -99,7 +133,7 @@ public class TEmployeeContractInfoController {
* @param tEmployeeContractInfo 员工合同 * @param tEmployeeContractInfo 员工合同
* @return R * @return R
*/ */
@Operation(summary = "编辑员工合同auditStatus审核状态,前端传参(0:保存为待提交;1:提交为待审核)temployeecontractinfo_edit编辑的附件,前端操作,可以不传参attaList", description = "修改员工合同:hasPermission('temployeecontractinfo_edit')") @Operation(summary = "编辑-员工合同auditStatus审核状态,前端传参(0:保存为待提交;1:提交为待审核)temployeecontractinfo_edit编辑的附件,前端操作,要传参attaList", description = "修改员工合同:hasPermission('temployeecontractinfo_edit')")
@SysLog("修改员工合同") @SysLog("修改员工合同")
@PostMapping("/updateContract") @PostMapping("/updateContract")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_edit')") @PreAuthorize("@pms.hasPermission('temployeecontractinfo_edit')")
...@@ -139,6 +173,38 @@ public class TEmployeeContractInfoController { ...@@ -139,6 +173,38 @@ public class TEmployeeContractInfoController {
} }
} }
/**
* 审核员工合同
* 审核通过后,变为在用,项目内其他的合同不再用
* @param tEmployeeContractInfo 员工合同
* @return R
*/
@Operation(summary = "审核-员工合同(主键:ID;审核意见auditStatus(2审核通过;3审核不通过);审核说明auditRemark;)权限temployeecontractinfo_audit", description = "审核-员工合同")
@SysLog("审核员工合同")
@PostMapping("/auditContract")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_audit')")
public R<String> auditContract(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) {
if (Common.isEmpty(tEmployeeContractInfo.getAuditStatus())) {
return R.failed("审核意见必填!");
}
if (Common.isNotNull(tEmployeeContractInfo.getAuditRemark()) && tEmployeeContractInfo.getAuditRemark().length() > 200) {
return R.failed("审核说明不可超过200字!");
}
return tEmployeeContractInfoService.auditContract(tEmployeeContractInfo);
}
/**
* 审核员工合同
* 审核通过后,变为在用,项目内其他的合同不再用
* @param tEmployeeContractInfo 员工合同
* @return R
*/
@Operation(summary = "归档-员工合同(主键:ID;合同编号contractNo;档案柜号fileCabinetNo;附件List<String> attaList)权限temployeecontractinfo_filing", description = "归档-员工合同")
@SysLog("审核员工合同")
@PostMapping("/filingContract")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_filing')")
public R<String> filingContract(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) {
return tEmployeeContractInfoService.filingContract(tEmployeeContractInfo);
}
} }
...@@ -39,17 +39,20 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac ...@@ -39,17 +39,20 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
* @param tEmployeeContractInfo 员工合同信息表 * @param tEmployeeContractInfo 员工合同信息表
* @return * @return
*/ */
IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, @Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo); IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page
, @Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo);
/** /**
* 更新合同在用状态 * 更新项目内的其他的合同在用状态
* @Author fxj * @Author fxj
* @Date 2019-10-17 * @Date 2019-10-17
* @param empId * @param empId
* @param deptId
* @param id * @param id
* @param status * @param status
* @return * @return
**/ **/
int updateInUseStatusById(@Param("empId")String empId, @Param("id")String id,@Param("status")String status); int updateInUseStatusById(@Param("empId")String empId, @Param("deptId")String deptId
, @Param("id")String id, @Param("status")String status);
} }
...@@ -62,12 +62,21 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract ...@@ -62,12 +62,21 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
R<List<ErrorMessage>> updateContract(TEmployeeContractInfo tEmployeeContractInfo); R<List<ErrorMessage>> updateContract(TEmployeeContractInfo tEmployeeContractInfo);
/** /**
* 保存员工合同表及附件关系表
* @Author fxj
* @Date 2019-09-09
* @param tEmployeeContractInfo * @param tEmployeeContractInfo
* @return * @Description: 审核
* @Author: hgw
* @Date: 2022/7/1 10:23
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo);
/**
* @param tEmployeeContractInfo
* @Description: 归档
* @Author: hgw
* @Date: 2022/7/1 10:32
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
boolean saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo); R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo);
} }
...@@ -234,9 +234,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -234,9 +234,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
* @Author fxj * @Author fxj
* @Date 2019-09-09 * @Date 2019-09-09
**/ **/
@Transactional private boolean saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo) {
@Override
public boolean saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo) {
//档案柜存在就自动归档 //档案柜存在就自动归档
if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) { if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) {
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING); tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
...@@ -267,7 +265,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -267,7 +265,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
TAttaInfo contractAtta; TAttaInfo contractAtta;
for (String attaId : attaList) { for (String attaId : attaList) {
contractAtta = tAttaInfoService.getById(attaId); contractAtta = tAttaInfoService.getById(attaId);
if (contractAtta != null) { if (contractAtta != null && Common.isEmpty(contractAtta.getDomainId())) {
contractAtta.setDomainId(tEmployeeContractInfo.getId()); contractAtta.setDomainId(tEmployeeContractInfo.getId());
tAttaInfoService.updateById(contractAtta); tAttaInfoService.updateById(contractAtta);
} }
...@@ -278,8 +276,23 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -278,8 +276,23 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
baseMapper.updateById(tEmployeeContractInfo); baseMapper.updateById(tEmployeeContractInfo);
} }
// 不是待提交,记录审核记录 // 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
// 更新档案合同状态
this.updateEmployeeContractStatus(tEmployeeContractInfo.getEmpId());
return true;
}
/**
* @param tEmployeeContractInfo
* @Description: 保存审核操作记录
* @Author: hgw
* @Date: 2022/7/1 10:16
* @return: void
**/
private void setAuditInfo(TEmployeeContractInfo tEmployeeContractInfo) {
if (Common.isNotNull(tEmployeeContractInfo.getAuditStatus()) if (Common.isNotNull(tEmployeeContractInfo.getAuditStatus())
&& CommonConstants.ZERO_INT != tEmployeeContractInfo.getAuditStatus()) { && CommonConstants.ZERO_INT != tEmployeeContractInfo.getAuditStatus()) {
TEmployeeContractAudit audit = new TEmployeeContractAudit(); TEmployeeContractAudit audit = new TEmployeeContractAudit();
audit.setAuditStatus(tEmployeeContractInfo.getAuditStatus()); audit.setAuditStatus(tEmployeeContractInfo.getAuditStatus());
audit.setLinkId(tEmployeeContractInfo.getId()); audit.setLinkId(tEmployeeContractInfo.getId());
...@@ -287,12 +300,6 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -287,12 +300,6 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
audit.setRemark(tEmployeeContractInfo.getAuditRemark()); audit.setRemark(tEmployeeContractInfo.getAuditRemark());
tEmployeeContractAuditService.save(audit); tEmployeeContractAuditService.save(audit);
} }
//先停用所有在用的员工合同
baseMapper.updateInUseStatusById(tEmployeeContractInfo.getEmpId(), tEmployeeContractInfo.getId(), CommonConstants.ONE_STRING);
// 更新档案合同状态
this.updateEmployeeContractStatus(tEmployeeContractInfo.getEmpId());
return true;
} }
private void updateEmployeeContractStatus(String empId) { private void updateEmployeeContractStatus(String empId) {
...@@ -303,5 +310,47 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -303,5 +310,47 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} }
} }
@Override
public R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo) {
if (tEmployeeContractInfo != null) {
if (Common.isEmpty(tEmployeeContractInfo.getId()) || Common.isEmpty(tEmployeeContractInfo.getAuditStatus())) {
return R.failed("id、意见必填");
}
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[2]) {
TEmployeeContractInfo contractInfo = this.getById(tEmployeeContractInfo.getId());
tEmployeeContractInfo.setInUse(CommonConstants.ZERO_STRING);
//先停用项目内的其他的员工合同
baseMapper.updateInUseStatusById(contractInfo.getEmpId(), contractInfo.getSettleDomain()
, contractInfo.getId(), CommonConstants.ONE_STRING);
}
// 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
this.updateById(tEmployeeContractInfo);
return R.ok();
}
return R.failed("参数不可为空");
}
@Override
public R<String> filingContract(TEmployeeContractInfo tEmployeeContractInfo) {
if (tEmployeeContractInfo != null) {
if (Common.isEmpty(tEmployeeContractInfo.getContractNo())
|| Common.isEmpty(tEmployeeContractInfo.getFileCabinetNo())) {
return R.failed("合同编号、档案柜号必填!");
}
if (tEmployeeContractInfo.getContractNo().length() > 50
|| tEmployeeContractInfo.getContractNo().length() > 50) {
return R.failed("合同编号、档案柜号不可超过50字!");
}
//档案柜存在就自动归档
if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) {
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
} else {
tEmployeeContractInfo.setIsFile(CommonConstants.ONE_STRING);
}
this.updateById(tEmployeeContractInfo);
return R.ok();
}
return R.failed("参数不可为空");
}
} }
...@@ -310,7 +310,9 @@ ...@@ -310,7 +310,9 @@
<!-- 根据员工ID更新合同在用状态 --> <!-- 根据员工ID更新合同在用状态 -->
<update id="updateInUseStatusById"> <update id="updateInUseStatusById">
update t_employee_contract_info set IN_USE = #{status} where EMP_ID = #{empId} and ID != #{id} update t_employee_contract_info
set IN_USE = #{status}
where EMP_ID = #{empId} and SETTLE_DOMAIN = #{deptId} and ID != #{id}
</update> </update>
</mapper> </mapper>
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