Commit 3e59a93d authored by chenyuxi's avatar chenyuxi

feat: 存瓜子的合同信息

parent efcf6d58
......@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.TGzOfferInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzOfferInfoVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
......@@ -124,5 +125,12 @@ public interface TGzOfferInfoService extends IService<TGzOfferInfo> {
*/
R batchUpdateStatus(TGzOfferInfoVo tGzOfferInfo);
/**
* 生成瓜子档案里的合同信息
* @param contractInfo 合同信息
* @param offerId offerId
* @param workLocation 工作地点
*/
void saveContractInfoToGzEmpInfo(TEmployeeContractInfo contractInfo, Integer offerId, String workLocation);
}
......@@ -105,6 +105,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
private final LGuaziOfferRecordService lGuaziOfferRecordService;
private final TGzOfferInfoService gzOfferInfoService;
/**
* 员工合同信息表简单分页查询
*
......@@ -535,7 +537,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
// 瓜子项目编码:皖A694302
if (CommonConstants.GZ_DEPT_NO.equals(tEmployeeContractInfo.getDeptNo())) {
//合同申请瓜子合同状态更新成待签署
updateGzOfferStatus(tEmployeeContractInfo.getEmpIdcard(),"97",CommonConstants.THIRTEEN_STRING,user.getId(),user.getNickname());
updateGzOfferStatus(tEmployeeContractInfo,"97",CommonConstants.THIRTEEN_STRING,user.getId(),user.getNickname());
}
} else {
// 标准合同、劳动派遣合同、其他。————社保公积金都派减,自动审核通过
......@@ -882,7 +884,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
//瓜子项目编码:皖A694302
if (CommonConstants.GZ_DEPT_NO.equals(contractInfo.getDeptNo())) {
//审核通过瓜子合同状态更新合同审核通过
updateGzOfferStatus(contractInfo.getEmpIdcard(),CommonConstants.THIRTEEN_STRING,CommonConstants.EIGHT_STRING,user.getId(),user.getNickname());
updateGzOfferStatus(contractInfo,CommonConstants.THIRTEEN_STRING,CommonConstants.EIGHT_STRING,user.getId(),user.getNickname());
}
}
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[3]) {
......@@ -1008,7 +1010,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
//瓜子项目编码:皖A694302
if (CommonConstants.GZ_DEPT_NO.equals(tEmployeeContractInfo.getDeptNo())) {
//合同归档瓜子合同状态更新已归档
updateGzOfferStatus(tEmployeeContractInfo.getEmpIdcard(),CommonConstants.EIGHT_STRING,CommonConstants.NINETY_NINE,"0","系统自动触发");
updateGzOfferStatus(tEmployeeContractInfo,CommonConstants.EIGHT_STRING,CommonConstants.NINETY_NINE,"0","系统自动触发");
}
return R.ok();
}
......@@ -1950,7 +1952,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
//瓜子项目编码:皖A694302
if (CommonConstants.GZ_DEPT_NO.equals(contract.getDeptNo())) {
//审核通过瓜子合同状态更新成合同审核通过
updateGzOfferStatus(contract.getEmpIdcard(),CommonConstants.THIRTEEN_STRING,CommonConstants.EIGHT_STRING,user.getId(),user.getNickname());
updateGzOfferStatus(contract,CommonConstants.THIRTEEN_STRING,CommonConstants.EIGHT_STRING,user.getId(),user.getNickname());
}
}
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[3]) {
......@@ -2210,9 +2212,12 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
//更新瓜子offer状态
public void updateGzOfferStatus(String idCard,String preStatus,String updStatus, String userId, String nickname) {
public void updateGzOfferStatus(TEmployeeContractInfo contractInfo,String preStatus,String updStatus, String userId, String nickname) {
if(Common.isEmpty(contractInfo)){
return;
}
TGzOfferInfo gzOfferInfo = gzOfferInfoMapper.selectOne(Wrappers.<TGzOfferInfo>query()
.lambda().eq(TGzOfferInfo::getNationalId, idCard)
.lambda().eq(TGzOfferInfo::getNationalId, contractInfo.getEmpIdcard())
.eq(TGzOfferInfo::getOfferStatus, preStatus)
.eq(TGzOfferInfo::getDelFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
......@@ -2222,9 +2227,10 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
gzOfferInfo.setUpdateTime(LocalDateTime.now());
gzOfferInfoMapper.updateById(gzOfferInfo);
// todo updStatus == 待签署的 生成合同
// updStatus == 8:合同审核通过 生成瓜子档案里的合同信息
if(CommonConstants.EIGHT_STRING.equals(updStatus)){
gzOfferInfoService.saveContractInfoToGzEmpInfo(contractInfo, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation());
}
// 瓜子状态变更增加操作日志
// 13:待签署,8:合同审核通过,99:已归档
......
......@@ -146,6 +146,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final TGzOfferInfoMapper gzOfferInfoMapper;
private final TGzOfferInfoService gzOfferInfoService;
@Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo) {
return baseMapper.getPage(page, employeeInfo);
......@@ -2631,6 +2633,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
gzOfferInfo.setOfferStatus(CommonConstants.EIGHT_STRING);
gzOfferInfoMapper.updateById(gzOfferInfo);
// 合同审核通过 生成瓜子档案里的合同信息
gzOfferInfoService.saveContractInfoToGzEmpInfo(c, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation());
// 瓜子状态变更增加操作日志
LGuaziOfferRecordVo lGuaziOfferRecordVo = new LGuaziOfferRecordVo();
// 存变更前后的状态到 状态数组里
......@@ -2767,8 +2773,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
gzOfferInfo.setOfferStatus(CommonConstants.THIRTEEN_STRING);
gzOfferInfoMapper.updateById(gzOfferInfo);
// todo updStatus == 待签署的 生成合同
// 瓜子状态变更增加操作日志
LGuaziOfferRecordVo lGuaziOfferRecordVo = new LGuaziOfferRecordVo();
// 存变更前后的状态到 状态数组里
......
......@@ -31,9 +31,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TRegisteWarningEmployee;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.EmployeeRegistrationPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzEmpInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzOfferInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.LGuaziOfferRecordService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService;
......@@ -59,11 +63,10 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -84,6 +87,8 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
private final LGuaziOfferRecordService lGuaziOfferRecordService;
private final TEmployeeContractInfoMapper employeeContractInfoMapper;
@Autowired
private UpmsDaprUtils upmsDaprUtils;
......@@ -93,6 +98,8 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
// 当前Offer更新状态,无法再发起更新:5:拒绝Offer、10:取消offer、8:合同审核通过、99:已归档
private final String[] failStatusArr = {"5", "10", "8", "99"};
private final TGzEmpInfoMapper gzEmpInfoMapper;
/**
* 瓜子offer信息接收表简单分页查询
* @param tGzOfferInfo 瓜子offer信息接收表
......@@ -268,19 +275,11 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
if("97".equals(tGzOfferInfo.getOfferStatus())){
// todo 1、生成人员档案信息、项目档案信息
// 获取瓜子和皖信的字典映射
// Map<String, Map<String,String>> relDictMap = new HashMap<>();
// R<Map<String, Map<String,String>>> relDictMapR = upmsDaprUtils.getRelValueMapByOutDictType();
// if (null != relDictMapR
// && relDictMapR.getCode() == CommonConstants.SUCCESS
// && Common.isNotNull(relDictMapR.getData())) {
// relDictMap = relDictMapR.getData();
// }
// 2、检查 该项目该人员是否有在途或审核通过或已归档的状态为“可用”的合同,
// 若有则根据当前状态更新Offer状态,合同未审核通过:存【13:待签署】;合同审核通过:存【8:合同审核通过】;合同已归档:存【99:已归档】,
// 存合同信息;
String changeStatus = this.checkSaveContract(findInfo.getNationalId());
String changeStatus = this.checkSaveContract(findInfo.getNationalId(),findInfo.getId(), findInfo.getWorkLocation());
tGzOfferInfo.setOfferStatus(changeStatus);
}
......@@ -300,19 +299,106 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
}
/**
* todo 检查 瓜子档案审核通过后,是否需要再生成合同信息
* 检查 瓜子档案审核通过后,是否需要再生成合同信息
* 该项目该人员是否有在途或审核通过或已归档的状态为“可用”的合同,
* 若有则根据当前状态更新Offer状态,合同未审核通过:存【13:待签署】;合同审核通过:存【8:合同审核通过】;合同已归档:存【99:已归档】
* @param nationalId 人员身份证号
* @param offerId offerId
* @param workLocation 工作地点
* @return String 后续offer要更新的状态
*/
private String checkSaveContract(String nationalId){
private String checkSaveContract(String nationalId,Integer offerId, String workLocation){
// 默认是审核通过
String changeStatus = "97";
TEmployeeContractInfo contractInfo = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getDeptNo, CommonConstants.GZ_DEPT_NO)
.eq(TEmployeeContractInfo::getEmpIdcard, nationalId)
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if(Common.isNotNull(contractInfo)){
// 合同已归档
if(CommonConstants.ZERO_STRING.equals(contractInfo.getIsFile())){
// 生成瓜子档案里的合同信息
this.saveContractInfoToGzEmpInfo(contractInfo, offerId, workLocation);
return "99";
}
// 合同审核通过
if(CommonConstants.TWO_INTEGER.equals(contractInfo.getAuditStatus())){
// 生成瓜子档案里的合同信息
this.saveContractInfoToGzEmpInfo(contractInfo, offerId, workLocation);
return CommonConstants.EIGHT_STRING;
}
// 合同已提交待审核
if(CommonConstants.ONE_INTEGER.equals(contractInfo.getAuditStatus())){
return CommonConstants.THIRTEEN_STRING;
}
}
return changeStatus;
}
/**
* 生成瓜子档案里的合同信息
* @param contractInfo 合同信息
* @param offerId offerId
* @param workLocation 工作地点
*/
@Override
public void saveContractInfoToGzEmpInfo(TEmployeeContractInfo contractInfo, Integer offerId, String workLocation){
// 获取档案信息
TGzEmpInfo gzEmpInfo = gzEmpInfoMapper.selectOne(Wrappers.<TGzEmpInfo>query().lambda()
.eq(TGzEmpInfo::getOfferId, offerId)
.eq(TGzEmpInfo::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if(Common.isNotNull(gzEmpInfo)){
gzEmpInfo.setContractNum(contractInfo.getContractName());
// 客服申请处选择“标准合同”传“外签-劳动合同 ”;“实习协议”传“外签-实习协议 ”
if(CommonConstants.ONE_STRING.equals(contractInfo.getContractType())){
gzEmpInfo.setContractType("1E");
}
if(CommonConstants.FIVE_STRING.equals(contractInfo.getContractType())){
gzEmpInfo.setContractType("1F");
}
gzEmpInfo.setSginatureMethod("E");
gzEmpInfo.setSginatureType("01");
gzEmpInfo.setSginatureDt(contractInfo.getContractStart());
gzEmpInfo.setContractBeginDt(contractInfo.getContractStart());
gzEmpInfo.setContractExpEndDt(contractInfo.getContractEnd());
gzEmpInfo.setContractEndDt(contractInfo.getContractEnd());
// 合同申请处选择“无”传给瓜子为“0”;合同申请选择“六个月”,传给瓜子为“6”
if("无".equals(contractInfo.getTryPeriod())){
gzEmpInfo.setProbation(CommonConstants.ZERO_STRING);
}
if("六个月".equals(contractInfo.getTryPeriod())){
gzEmpInfo.setProbation(CommonConstants.SIX_STRING);
// 按照“合同起始日期”及“试用周期”进行推测
// 合同起始日期为20250603,试用期为6,试用期预计结束日期为20251202
// 将Date转换为LocalDate
LocalDate localDate = contractInfo.getContractStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate prcExpLocalDate = localDate.plusMonths(6); // 加上6个月
// 将LocalDate转换回Date对象
Date prcExpDt = Date.from(prcExpLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
// 试用期预计结束日期
gzEmpInfo.setPrcExpDt(prcExpDt);
// 默认等于试用期预计结束日期+1日(自然日),eg:”试用期预计结束日期“为20251202,”预计转正日期“为20251203“
LocalDate probationDtLocalDate = prcExpLocalDate.plusDays(1); // 加上+1日(自然日)
// 将LocalDate转换回Date对象
Date probationDt = Date.from(probationDtLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
// 预计转正日期
gzEmpInfo.setProbationDt(probationDt);
}
gzEmpInfo.setNeeProviderId(CommonConstants.GZ_NEE_PROVIDER_ID);
gzEmpInfo.setWorkLocation(workLocation);
gzEmpInfo.setContractState("A");
// 存合同信息
gzEmpInfoMapper.updateById(gzEmpInfo);
}
}
/**
* 获取当前状态下,允许更新的状态列表
*
......
......@@ -675,4 +675,6 @@ public interface CommonConstants {
String GZ_DEPT_NO = "皖A694302";
String NINETY_NINE = "99";
String GZ_NEE_PROVIDER_ID = "V59";
}
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