Commit c6e32398 authored by fangxinjiang's avatar fangxinjiang

MVP1.2:合同审核添加创建人条件

parent 86091ae6
......@@ -384,6 +384,12 @@ public class TEmployeeContractInfo extends BaseEntity {
@Schema(description = "审核状态(0:待提交;1:待审核;2审核通过;3审核不通过)")
private Integer auditStatus;
/**
* 审核人
*/
@Schema(description = "审核人")
private String auditUserName;
/**
* 最新审核通过时间
*/
......
......@@ -221,13 +221,17 @@ public class TEmployeeContractInfoController {
@PostMapping("/auditContract")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_audit')")
public R<String> auditContract(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
if (Common.isEmpty(tEmployeeContractInfo.getAuditStatus())) {
return R.failed(ArchivesConstants.CONTRACT_AUDIT_STATUS_NOT_EMPTY);
}
if (Common.isNotNull(tEmployeeContractInfo.getAuditRemark()) && tEmployeeContractInfo.getAuditRemark().length() > 200) {
return R.failed(ArchivesConstants.CONTRACT_AUDIT_REMARK_TOO_LONG);
}
return tEmployeeContractInfoService.auditContract(tEmployeeContractInfo);
return tEmployeeContractInfoService.auditContract(tEmployeeContractInfo,user);
}
/**
* @Author fxj
......@@ -239,6 +243,10 @@ public class TEmployeeContractInfoController {
@PostMapping("/auditContractBatch")
@PreAuthorize("@pms.hasPermission('temployeecontractinfo_audit')")
public R<List<ErrorMessage>> auditContractBatch(@RequestBody EmpContractAuditVo contractAuditVo) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
if (Common.isEmpty(contractAuditVo.getIds())) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
......@@ -248,7 +256,7 @@ public class TEmployeeContractInfoController {
if (Common.isNotNull(contractAuditVo.getAuditRemark()) && contractAuditVo.getAuditRemark().length() > 200) {
return R.failed(ArchivesConstants.CONTRACT_AUDIT_REMARK_TOO_LONG);
}
return tEmployeeContractInfoService.auditContractBatch(contractAuditVo);
return tEmployeeContractInfoService.auditContractBatch(contractAuditVo,user);
}
/**
* 审核员工合同
......
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractSearchVo;
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.vo.YifuUser;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
......@@ -99,12 +100,13 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
/**
* @param tEmployeeContractInfo
* @param user
* @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);
R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user);
/**
* @param id
......@@ -177,5 +179,5 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
**/
void exportAuditContractInfo(TEmployeeContractSearchVo contractInfo, HttpServletResponse response);
R<List<ErrorMessage>> auditContractBatch(EmpContractAuditVo contractAuditVo);
R<List<ErrorMessage>> auditContractBatch(EmpContractAuditVo contractAuditVo, YifuUser user);
}
......@@ -272,6 +272,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
if (null == employeeContractInfo) {
//新增合同
TEmployeeContractInfo newEmployeeContractInfo = new TEmployeeContractInfo();
newEmployeeContractInfo.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo);
......@@ -281,6 +282,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
employeeContractInfoMapper.updateById(employeeContractInfo);
//新增合同
TEmployeeContractInfo newEmployeeContractInfo2 = new TEmployeeContractInfo();
newEmployeeContractInfo2.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo2, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo2);
......@@ -308,6 +310,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
newEmployeeContractInfo1.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, project);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
......@@ -345,6 +348,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
newEmployeeContractInfo1.setAuditUserName(user.getNickname());
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo, tCustomerInfo, newTEmpProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
......
......@@ -67,7 +67,6 @@ import java.math.BigDecimal;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
......@@ -171,7 +170,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return R.failed(validity.getErrorInfo(), ResultConstants.VALIDITY_FAIL);
}
return this.saveContractAndAtta(tEmployeeContractInfo);
return this.saveContractAndAtta(tEmployeeContractInfo,user);
}
@Override
......@@ -198,7 +197,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if (null != validity.getErrorInfo() && !validity.getErrorInfo().isEmpty()) {
return R.failed(validity.getErrorInfo(), ResultConstants.VALIDITY_FAIL);
}
return this.saveContractAndAtta(tEmployeeContractInfo);
return this.saveContractAndAtta(tEmployeeContractInfo, user);
} catch (Exception e) {
log.error("员工合同保存异常:" + e.getMessage());
return R.failed("员工合同保存系统异常!");
......@@ -294,11 +293,12 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
* 保存员工合同表及附件关系表
*
* @param tEmployeeContractInfo
* @param user
* @return
* @Author fxj
* @Date 2019-09-09
**/
private R<List<ErrorMessage>> saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo) {
private R<List<ErrorMessage>> saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user) {
//档案柜存在就自动归档
if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) {
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
......@@ -325,7 +325,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
initType(tEmployeeContractInfo);
// 标准合同、劳动派遣合同、其他。————社保公积金都派减,自动审核通过
this.judgeAuditStatus(tEmployeeContractInfo);
this.judgeAuditStatus(tEmployeeContractInfo,user);
if (Common.isEmpty(tEmployeeContractInfo.getId())) {
// 针对编码再做一次重复性校验
......@@ -509,7 +509,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return baseMapper.updateInUseStatusById(empId, deptNo, ContractId, CommonConstants.ONE_STRING) >0;
}
@Override
public R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo) {
public R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo, YifuUser user) {
if (tEmployeeContractInfo != null) {
if (Common.isEmpty(tEmployeeContractInfo.getId()) || Common.isEmpty(tEmployeeContractInfo.getAuditStatus())) {
return R.failed("id、意见必填");
......@@ -598,6 +598,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
}
tEmployeeContractInfo.setAuditUserName(user.getNickname());
// 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
this.updateById(tEmployeeContractInfo);
......@@ -1021,7 +1022,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
* @Date: 2022/11/28 10:05
* @return: void
**/
private void judgeAuditStatus(TEmployeeContractInfo insert) {
private void judgeAuditStatus(TEmployeeContractInfo insert, YifuUser user) {
if (insert.getAuditStatus() == CommonConstants.ONE_INT
&& (EmployeeConstants.CONTRACT_NAME[0].equals(insert.getContractName())
|| EmployeeConstants.CONTRACT_NAME[1].equals(insert.getContractName())
......@@ -1034,6 +1035,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
, "/tsocialfundinfo/inner/selectSocialFoundByContract", sf, Integer.class, SecurityConstants.FROM_IN);
if (socialFundR != null && socialFundR.getData() != null && socialFundR.getData() > 0) {
insert.setAuditStatus(CommonConstants.TWO_INT);
insert.setAuditUserName(user.getNickname());
}
}
}
......@@ -1199,7 +1201,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
* @Date 16:45 2022/12/12
**/
@Override
public R<List<ErrorMessage>> auditContractBatch(EmpContractAuditVo contractAuditVo) {
public R<List<ErrorMessage>> auditContractBatch(EmpContractAuditVo contractAuditVo, YifuUser user) {
List<TEmployeeContractInfo> contractInfos = baseMapper.selectBatchIds(contractAuditVo.getIds());
if (Common.isEmpty(contractInfos)){
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
......@@ -1219,6 +1221,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
tEmployeeContractInfo = new TEmployeeContractInfo();
tEmployeeContractInfo.setAuditRemark(contractAuditVo.getAuditRemark());
tEmployeeContractInfo.setAuditStatus(contractAuditVo.getAuditStatus());
tEmployeeContractInfo.setAuditUserName(user.getNickname());
tEmployeeContractInfo.setId(contract.getId());
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[2]) {
// 非作废、终止,本条变为在用
......
......@@ -2186,6 +2186,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
**/
@Override
public Boolean updateEmpInfo(UpdateEmpVo vo) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return false;
}
if (Common.isNotNull(vo)){
TEmployeeInfo employeeInfo;
TEmployeeProject p = null;
......@@ -2229,6 +2233,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
contractAudit.setCreateName(c.getCreateName());
contractAudit.setCreateTime(LocalDateTime.now());
//审核通过
c.setAuditUserName(c.getCreateBy());
if (CommonConstants.ZERO_STRING.equals(vo.getType())){
c.setAuditStatus(CommonConstants.TWO_INT);
c.setInUse(CommonConstants.ZERO_STRING);
......
......@@ -238,6 +238,9 @@
#{idStr}
</foreach>
</if>
<if test="tEmployeeContractInfo.auditUserName != null and tEmployeeContractInfo.auditUserName.trim() != ''">
AND a.AUDIT_USER_NAME like concat('%',#{tEmployeeContractInfo.auditUserName},'%')
</if>
<if test="tEmployeeContractInfo.id != null and tEmployeeContractInfo.id.trim() != ''">
AND a.ID = #{tEmployeeContractInfo.id}
</if>
......
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