Commit 0156dce1 authored by fangxinjiang's avatar fangxinjiang

划转相关调整

parent ff1c4e56
/*
* 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 com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 档案划转日志表
*
* @author huyc
* @date 2022-06-22
*/
@Data
public class TEmpChangeInfoNewVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工姓名
*/
@Schema(description ="员工姓名")
private String empName;
/**
* 原单位名称
*/
@Schema(description ="原单位名称")
private String oldUnitName;
/**
* 新单位名称
*/
@Schema(description ="新单位名称")
private String newUnitName;
/**
* 原项目
*/
@Schema(description ="原项目名称")
private String oldDeptName;
/**
* 新项目
*/
@Schema(description ="新项目名称")
private String newDeptName;
/**
* 项目档案id
*/
@Schema(description ="项目档案id")
private String proId;
/**
* 项目id
*/
@Schema(description ="项目id")
@TableField(exist = false)
private String oldDepartId;
/**
* 项目id
*/
@Schema(description ="项目id")
@TableField(exist = false)
private String oldDepartNo;
/**
* 客户id
*/
@Schema(description ="客户id")
@TableField(exist = false)
private String OldCustomerId;
/**
* 身份证号码
*/
@Schema(description ="身份证号码")
private String empIdcard;
/**
* 客户id
*/
@Schema(description ="客户id")
@TableField(exist = false)
private String newUnitId;
/**
* 客户编码
*/
@Schema(description ="客户编码")
@TableField(exist = false)
private String NewUnitNo;
/**
* 项目id
*/
@Schema(description ="项目id")
@TableField(exist = false)
private String newDeptId;
/**
* 项目编码
*/
@Schema(description ="项目编码")
@TableField(exist = false)
private String newDeptNo;
/**
* 划转项:0 员工合同 1 社保 2 公积金
*/
@Schema(description = "划转项:0 员工合同 1 社保 2 公积金")
private String changeItems;
/**
* 原项目处理:0 不处理 1 同步减项
*/
@Schema(description = "原项目处理:0 不处理 1 同步减项")
private String changeType;
}
......@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpChangeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoNewVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
......@@ -184,5 +185,18 @@ public class TEmpChangeInfoController {
public R<List<ErrorMessage>> batchChangeArc(@RequestExcel List<TEmpChangeInfoVO> excelVOList, BindingResult bindingResult) {
return tEmpChangeInfoService.batchChangeArc(excelVOList,bindingResult);
}
/**
* @Author fxj
* @Description 员工档案划转---新
* @Date 15:28 2023/5/5
* @Param
* @return
**/
@Operation(summary = "员工档案划转-新", description = "员工档案划转-新")
@SysLog("员工档案划转-新" )
@PostMapping("/empProArcChangeNew" )
@PreAuthorize("@pms.hasPermission('archives_tempchangeinfo_change')")
public R<Boolean> empProArcChangeNew(@RequestBody TEmpChangeInfoNewVO changeVo) {
return tEmpChangeInfoService.changeEmpProArcNew(changeVo);
}
}
......@@ -24,6 +24,7 @@ import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoNewVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
......@@ -71,4 +72,6 @@ public interface TEmpChangeInfoService extends IService<TEmpChangeInfo> {
R<List<TCustomerInfo>> getAllUint(String customerName);
IPage<TSettleDomain> getAllDeptPage(Page page, String deptName, String nameOrNo, String customerId,String flag);
R<Boolean> changeEmpProArcNew(TEmpChangeInfoNewVO changeVo);
}
......@@ -16,6 +16,7 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -30,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TSettleDomainMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCustomerInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpChangeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoNewVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpChangeInfoVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
......@@ -350,4 +352,125 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
}
return wrapper;
}
/**
* @Author huyc
* @Description 档案划转
* @Date 2022/6/22
**/
@Override
public R<Boolean> changeEmpProArcNew(TEmpChangeInfoNewVO vo) {
if (Common.isEmpty(vo)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
if (Common.isEmpty(vo.getChangeItems())){
return R.failed("划转项不可为空!");
}
//待划转员工已在目标项目下不可划转
TEmployeeProject newEmpProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, vo.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,vo.getNewDeptNo())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
//社保公积金派单处需要直接修改为最新的项目
//社保预估库、缴费库、对比库、代理差额库,需要同步修改未结算(并且满足这个条件:数据 生成月≥此处划转起始月)的数据,已结算数据不变更;
//划转,更新项目信息
TEmployeeProject updateTEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, vo.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,vo.getOldDepartNo())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL).eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_INT));
if (Common.isNotNull(updateTEmployeeProject)) {
if (updateTEmployeeProject.getSocialStatus() == CommonConstants.dingleDigitIntArray[1] ||
updateTEmployeeProject.getFundStatus() == CommonConstants.dingleDigitIntArray[1]) {
return R.failed("人员在原项目中存在在途的服务(社保或公积金在途),请先终止后,再进行划转");
}
TSettleDomain tSettleDomain = tSettleDomainMapper.selectOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, vo.getNewDeptNo())
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING));
if (Common.isEmpty(tSettleDomain)) {
return R.failed("对应项目编码的项目已停止合作");
}
TEmployeeProject oldEmpProject = tEmployeeProjectService.getById(updateTEmployeeProject.getId());
if (Common.isEmpty(newEmpProject)){
newEmpProject = new TEmployeeProject();
BeanUtil.copyProperties(oldEmpProject,newEmpProject);
newEmpProject.setEmpId(null);
newEmpProject.setDeptId(vo.getNewDeptId());
newEmpProject.setDeptName(vo.getNewDeptName());
newEmpProject.setDeptNo(vo.getNewDeptNo());
newEmpProject.setUnitNo(vo.getNewUnitNo());
newEmpProject.setUnitId(vo.getNewUnitId());
newEmpProject.setUnitName(vo.getNewUnitName());
newEmpProject.setBusinessPrimaryType(tSettleDomain.getBusinessPrimaryType());
newEmpProject.setBusinessSecondType(tSettleDomain.getBusinessSecondType());
newEmpProject.setBusinessThirdType(tSettleDomain.getBusinessThirdType());
updateTEmployeeProject.setDeptName(vo.getNewDeptName());
updateTEmployeeProject.setDeptNo(vo.getNewDeptNo());
updateTEmployeeProject.setDeptId(vo.getNewDeptId());
updateTEmployeeProject.setUnitNo(vo.getNewUnitNo());
updateTEmployeeProject.setUnitId(vo.getNewUnitId());
updateTEmployeeProject.setUnitName(vo.getNewUnitName());
updateTEmployeeProject.setBusinessPrimaryType(tSettleDomain.getBusinessPrimaryType());
updateTEmployeeProject.setBusinessSecondType(tSettleDomain.getBusinessSecondType());
updateTEmployeeProject.setBusinessThirdType(tSettleDomain.getBusinessThirdType());
}
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", updateTEmployeeProject.getId(), oldEmpProject, updateTEmployeeProject);
updateTEmployeeProject.setOdlDeptId(oldEmpProject.getDeptId());
updateTEmployeeProject.setOldDeptNo(oldEmpProject.getDeptNo());
UpdateSocialFoundVo updatesf = new UpdateSocialFoundVo();
updatesf.setOldDeptId(updateTEmployeeProject.getOdlDeptId());
updatesf.setEmpIdcard(updateTEmployeeProject.getEmpIdcard());
updatesf.setSettleDomainCode(updateTEmployeeProject.getDeptNo());
updatesf.setSettleDomainId(updateTEmployeeProject.getDeptId());
updatesf.setSettleDomainName(updateTEmployeeProject.getDeptName());
updatesf.setUnitId(updateTEmployeeProject.getUnitId());
updatesf.setUnitName(updateTEmployeeProject.getUnitName());
// 处理社保
if (vo.getChangeItems().indexOf(CommonConstants.ONE_STRING) >= CommonConstants.ZERO_INT
&& CommonConstants.ZERO_INT != updateTEmployeeProject.getSocialStatus()) {
if (Common.isNotNull(newEmpProject.getId())){
newEmpProject.setSocialStatus(oldEmpProject.getSocialStatus());
newEmpProject.setSocialProvince(oldEmpProject.getSocialProvince());
newEmpProject.setSocialCity(oldEmpProject.getSocialCity());
newEmpProject.setSocialTown(oldEmpProject.getSocialTown());
}
updatesf.setFlag(CommonConstants.ZERO_STRING);
socialDaprUtils.updateSocialAndFoundInfo(updatesf);
oldEmpProject.setSocialStatus(CommonConstants.ZERO_INT);
oldEmpProject.setSocialProvince(null);
oldEmpProject.setSocialCity(null);
oldEmpProject.setSocialTown(null);
}
// 处理公积金
if (vo.getChangeItems().indexOf(CommonConstants.TWO_STRING) >= CommonConstants.ZERO_INT
&& CommonConstants.ZERO_INT != updateTEmployeeProject.getFundStatus()) {
if (Common.isNotNull(newEmpProject.getId())){
newEmpProject.setFundStatus(oldEmpProject.getFundStatus());
}
updatesf.setFlag(CommonConstants.ONE_STRING);
socialDaprUtils.updateSocialAndFoundInfo(updatesf);
oldEmpProject.setFundStatus(CommonConstants.ZERO_INT);
}
// 处理員工合同
if (vo.getChangeItems().indexOf(CommonConstants.ZERO_STRING) >= CommonConstants.ZERO_INT){
if (Common.isNotNull(newEmpProject.getId())){
newEmpProject.setContractStatus(oldEmpProject.getContractStatus());
newEmpProject.setContractType(oldEmpProject.getContractType());
}
// 合同同步划转---只划转在用合同 fxj 2023-03-06
contractInfoMapper.updateContractChange(updateTEmployeeProject.getEmpIdcard(),updateTEmployeeProject.getDeptNo(),updateTEmployeeProject.getOldDeptNo());
oldEmpProject.setContractStatus(CommonConstants.ZERO_INT);
oldEmpProject.setContractType(null);
}
}
TEmpChangeInfo tEmpChangeInfo= new TEmpChangeInfo();
tEmpChangeInfo.setProId(updateTEmployeeProject.getId());
//保存档案划转记录
this.save(tEmpChangeInfo);
return R.ok();
}
}
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