Commit 1f1541e8 authored by fangxinjiang's avatar fangxinjiang

入职确认接收优化-fxj

parent ba0234cb
......@@ -114,6 +114,9 @@ public class EmployeeRegistrationPre extends BaseEntity {
@Schema(description = "公积金是否已参保 0 是 1 否")
private String fundIsBuy;
@Schema(description = "是否已签署合同 0 是 1 否")
private String contractIsBuy;
@Schema(description = "档案所在地-县编号")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String townCode;
......
......@@ -134,6 +134,9 @@ public class EmployeeRegistrationPreVo implements Serializable {
@Schema(description = "公积金是否已参保 0 是 1 否")
private String fundIsBuy;
@Schema(description = "是否已签署合同 0 是 1 否")
private String contractIsBuy;
@Schema(description = "身份证合集")
private List<String> idcardList;
......
......@@ -195,6 +195,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
PRE_IGNORE_FIELD.add("isLeave");
PRE_IGNORE_FIELD.add("isRefuse");
PRE_IGNORE_FIELD.add("configId");
PRE_IGNORE_FIELD.add("contractIsBuy");
}
......@@ -334,6 +335,12 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
oldInfo.setExitFundInfoList(newInfo.getExitFundInfoList());
oldInfo.setFundIsBuy(newInfo.getFundIsBuy());
//记录合同是否已签署日志
String isContractBuyOld = oldInfo.getContractIsBuy();
String isContractBuyNew = newInfo.getContractIsBuy();
//合同是否已签署list不做比较
oldInfo.setExitContractInfoList(newInfo.getExitContractInfoList());
//比较差异
String differenceKey = HrEquator.comparisonValueIgnoreField(oldInfo, newInfo, PRE_IGNORE_FIELD);
//如果有差异保存差异
......@@ -477,6 +484,27 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
String differenceContractKey = null;
TEmployeeContractPre employeeContractPre = newInfo.getEmployeeContractPre();
// 单独记录合同是否已签署的变更记录
if ((isContractBuyOld == null && isContractBuyNew != null) ||
(isContractBuyOld != null && !isContractBuyOld.equals(isContractBuyNew))) {
differenceContractKey = "contractIsBuy";
TEmployeePreLogDetail detailContractLog = new TEmployeePreLogDetail();
detailContractLog.setModelType(CommonConstants.TWO_STRING);
detailContractLog.setType(CommonConstants.THREE_STRING);
Map<String,Object> old = new HashMap<>();
old.put("contractIsBuy", isContractBuyOld);
Map<String,Object> simNew = new HashMap<>();
simNew.put("contractIsBuy", isContractBuyNew);
this.setLogBaseInfo(empPreId, old, simNew, user, differenceContractKey, logId, detailContractLog);
detailList.add(detailContractLog);
if (Common.isNotNull(diffTitle)) {
diffTitle += "、合同信息";
} else {
diffTitle = "合同信息";
}
}
differenceContractKey ="";
// 新增:如果之前不包含合同,现在包含合同,记录新增日志
if (!oldInfo.getServerItem().contains("合同") && newInfo.getServerItem().contains("合同")
&& Common.isNotNull(employeeContractPre)
......@@ -489,7 +517,9 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
this.setLogBaseInfo(empPreId, null, employeeContractPre, user, differenceContractKey, logId, detailEmpLog);
detailList.add(detailEmpLog);
if (Common.isNotNull(diffTitle)) {
diffTitle += "、合同信息";
if (!diffTitle.contains("合同信息")){
diffTitle += "、合同信息";
}
} else {
diffTitle = "合同信息";
}
......@@ -503,7 +533,9 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
this.setLogBaseInfo(empPreId, contractOld, null, user, differenceContractKey, logId, detailEmpLog);
detailList.add(detailEmpLog);
if (Common.isNotNull(diffTitle)) {
diffTitle += "、合同信息";
if (!diffTitle.contains("合同信息")){
diffTitle += "、合同信息";
}
} else {
diffTitle = "合同信息";
}
......@@ -519,7 +551,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
.in(TEmployeeContractPre::getProcessStatus, Arrays.asList("0","1","3","5","7","10","11"))
.eq(TEmployeeContractPre::getId,contractOld.getId()));
}
//是的场景删除合同待购买数据
//否变是的场景删除合同待购买数据
if (newInfo.getServerItem().contains("合同") && Common.isNotNull(contractOld)
&& Common.isEmpty(employeeContractPre) && null != newInfo.getContractUpdateFlag()
&& newInfo.getContractUpdateFlag()) {
......@@ -531,7 +563,9 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
this.setLogBaseInfo(empPreId, contractOld, null, user, differenceContractKey, logId, detailEmpLog);
detailList.add(detailEmpLog);
if (Common.isNotNull(diffTitle)) {
diffTitle += "、合同信息";
if (!diffTitle.contains("合同信息")){
diffTitle += "、合同信息";
}
} else {
diffTitle = "合同信息";
}
......@@ -560,7 +594,9 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
differenceContractKey = HrEquator.comparisonValueIgnoreField(contractOld, employeeContractPre, CONTRACT_IGNORE_FIELD);
if (differenceContractKey.length() > 0) {
if (Common.isNotNull(diffTitle)) {
diffTitle += "、合同信息";
if (!diffTitle.contains("合同信息")){
diffTitle += "、合同信息";
}
} else {
diffTitle = "合同信息";
}
......@@ -571,7 +607,28 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
detailList.add(detailEmpLog);
}
}
//由是切换成否新增 (含合同,但是是否已签署为是,所以contractOld=null)
if ( oldInfo.getServerItem().contains("合同")
&& contractOld == null
&& newInfo.getServerItem().contains("合同")
&& Common.isNotNull(employeeContractPre)
&& null != newInfo.getContractUpdateFlag() && newInfo.getContractUpdateFlag()) {
//1.9.11 huych 附件类型不比较差异
employeeContractPre.setAttaList(null);
detailEmpLog = new TEmployeePreLogDetail();
detailEmpLog.setModelType(CommonConstants.ONE_STRING);
detailEmpLog.setType(CommonConstants.THREE_STRING);
this.setLogBaseInfo(empPreId, null, employeeContractPre, user, differenceContractKey, logId, detailEmpLog);
detailList.add(detailEmpLog);
if (Common.isNotNull(diffTitle)) {
if (!diffTitle.contains("合同信息")){
diffTitle += "、合同信息";
}
} else {
diffTitle = "合同信息";
}
//删除旧合同
}
String differenceSocialKey;
// 查询老的社保明细
R<EmployeePreSocialListVo> socialSdr = socialDaprUtils.getSocialPreInfoList(empPreId);
......@@ -582,7 +639,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
TDispatchInfoPreVo dispatchInfoPreVo = newInfo.getDispatchInfoPreVo();
// 新增:如果之前不包含社保,现在包含社保,记录新增日志
if (!oldInfo.getServerItem().contains("社保") && newInfo.getServerItem().contains("社保")
if (!oldInfo.getServerItem().contains("社保") && newInfo.getServerItem().contains("社保")
&& null != newInfo.getSocialUpdateFlag() && newInfo.getSocialUpdateFlag()) {
// 单独记录是否已购买社保的变更记录
if (Common.isEmpty(isSocailBuyOld) || (Common.isNotNull(isSocailBuyOld) && !isSocailBuyOld.equals(isSocailBuyNew))) {
......@@ -669,7 +726,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
detailList.add(detailEmpLog);
}
}
// 公积金处理逻辑
String differenceFundKey;
// 查询老的公积金明细
......@@ -885,7 +942,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
}
public Date addYearsMonths(TEmployeeContractDateVo vo) {
if (vo == null || vo.getRegistDate() == null) return null;
// 转换为 LocalDate(自动处理时区)
LocalDate localDate = vo.getRegistDate().toInstant()
.atZone(ZoneId.systemDefault())
......@@ -907,7 +964,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
.toInstant());
}
}
/**
* @Description: 添加年数和月数,如果结果为月份 1 号则不减 1 天
* @Author: system
......@@ -917,7 +974,7 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
**/
public Date addYearsMonthsKeepFirstDay(TEmployeeContractDateVo vo) {
if (vo == null || vo.getRegistDate() == null) return null;
// 转换为 LocalDate(自动处理时区)
LocalDate localDate = vo.getRegistDate().toInstant()
.atZone(ZoneId.systemDefault())
......@@ -933,12 +990,12 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
localDate = localDate
.plusYears(vo.getYearAfter())
.plusMonths(vo.getMonthAfter());
// 如果计算后的日期不是月份 1 号,则减 1 天;如果是 1 号则保持不变
if (localDate.getDayOfMonth() != 1) {
localDate = localDate.minusDays(1);
}
// 转回 Date 类型
return Date.from(localDate.atStartOfDay()
.atZone(ZoneId.systemDefault())
......
......@@ -9,6 +9,9 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import static com.alibaba.fastjson.serializer.SerializerFeature.*;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -122,6 +125,12 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
@Autowired
private ContractTermCalculator calculator = new ContractTermCalculator();
// JSON序列化特性配置(日期格式化为 yyyy-MM-dd HH:mm:ss)
private static final SerializerFeature[] JSON_FEATURES = new SerializerFeature[]{
WriteMapNullValue, WriteNullNumberAsZero, WriteNullListAsEmpty,
WriteNullStringAsEmpty, WriteDateUseDateFormat
};
// 社保/公积金派单信息比较时忽略的字段
private static final List<String> SOCIAL_IGNORE_FIELD = new ArrayList<>();
static {
......@@ -746,6 +755,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
R<Boolean> flag = archivesDaprUtil.selectExitEmpCopntract(cardVo);
if (preVo.getServerItem().contains("合同") && null != preVo.getEmployeeContractPreVos()) {
TEmployeeContractPreVo employeeContractPreVo = preVo.getEmployeeContractPreVos();
preVo.setContractIsBuy(employeeContractPreVo.getContractFlag());
//根据身份证号码和项目编号查询合同
//是否已签署为是需要判断合同是否在用或者流程中
if (CommonConstants.ZERO_STRING.equals(employeeContractPreVo.getContractFlag()) &&
......@@ -1656,6 +1666,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
TEmployeeContractPreVo employeeContractPreVo = new TEmployeeContractPreVo();
if (preVo.getServerItem().contains("合同") && Common.isNotNull(preVo.getEmployeeContractPreVos())) {
preVo.setContractIsBuy(employeeContractPreVo.getContractFlag());
BeanUtils.copyProperties(preVo.getEmployeeContractPreVos(),employeeContractPreVo);
//生成合同待购买数据
String errorStr = null;
......@@ -3249,7 +3260,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
archiveDetail.setPreId(empPreId);
archiveDetail.setPreLogId(logId);
archiveDetail.setOldInfo(null); // old对象为空
archiveDetail.setNewInfo(JSON.toJSONString(preVo));
archiveDetail.setNewInfo(JSON.toJSONString(preVo,JSON_FEATURES));
archiveDetail.setDifferenceInfo(null);
archiveDetail.setCreateBy(user.getId());
archiveDetail.setCreateName(user.getNickname());
......@@ -3289,7 +3300,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
insuranceDetail.setPreId(empPreId);
insuranceDetail.setPreLogId(logId);
insuranceDetail.setOldInfo(null);
insuranceDetail.setNewInfo(JSON.toJSONString(insurancePre));
insuranceDetail.setNewInfo(JSON.toJSONString(insurancePre,JSON_FEATURES));
// 使用 HrEquator 比较差异字段(新增时 old 为空,传入空对象)
insuranceDetail.setDifferenceInfo(null);
insuranceDetail.setCreateBy(user.getId());
......@@ -3307,17 +3318,35 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
diffTitleBuilder.append("合同信息");
TEmployeePreLogDetail contractDetail = new TEmployeePreLogDetail();
contractDetail.setModelType(CommonConstants.ONE_STRING);
contractDetail.setType(CommonConstants.THREE_STRING); // 3合同
contractDetail.setPreId(empPreId);
contractDetail.setPreLogId(logId);
contractDetail.setOldInfo(null);
contractDetail.setNewInfo(JSON.toJSONString(preVo.getEmployeeContractPreVos()));
contractDetail.setDifferenceInfo(null);
contractDetail.setCreateBy(user.getId());
contractDetail.setCreateName(user.getNickname());
detailList.add(contractDetail);
if (Common.isNotNull(preVo.getEmployeeContractPreVos())){
// 是否已参保
if (Common.isNotNull(preVo.getEmployeeContractPreVos().getContractFlag())) {
TEmployeePreLogDetail contractDetail = new TEmployeePreLogDetail();
contractDetail.setModelType(CommonConstants.ONE_STRING);
contractDetail.setType(CommonConstants.THREE_STRING); // 3合同
contractDetail.setPreId(empPreId);
contractDetail.setPreLogId(logId);
contractDetail.setOldInfo(null);
Map<String, Object> newInfo = new HashMap<>();
newInfo.put("contractIsBuy", preVo.getEmployeeContractPreVos().getContractFlag());
contractDetail.setNewInfo(JSON.toJSONString(newInfo));
contractDetail.setDifferenceInfo("contractIsBuy");
contractDetail.setCreateBy(user.getId());
contractDetail.setCreateName(user.getNickname());
detailList.add(contractDetail);
}
TEmployeePreLogDetail contractDetail = new TEmployeePreLogDetail();
contractDetail.setModelType(CommonConstants.ONE_STRING);
contractDetail.setType(CommonConstants.THREE_STRING); // 3合同
contractDetail.setPreId(empPreId);
contractDetail.setPreLogId(logId);
contractDetail.setOldInfo(null);
contractDetail.setNewInfo(JSON.toJSONString(preVo.getEmployeeContractPreVos(),JSON_FEATURES));
contractDetail.setDifferenceInfo(null);
contractDetail.setCreateBy(user.getId());
contractDetail.setCreateName(user.getNickname());
detailList.add(contractDetail);
}
}
// 4. 社保信息日志(type=4)
......@@ -3352,7 +3381,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
socialDetail.setPreId(empPreId);
socialDetail.setPreLogId(logId);
socialDetail.setOldInfo(null);
socialDetail.setNewInfo(JSON.toJSONString(preVo.getDispatchInfoPreVo()));
socialDetail.setNewInfo(JSON.toJSONString(preVo.getDispatchInfoPreVo(),JSON_FEATURES));
socialDetail.setDifferenceInfo(null);
socialDetail.setCreateBy(user.getId());
socialDetail.setCreateName(user.getNickname());
......@@ -3392,7 +3421,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
fundDetail.setPreId(empPreId);
fundDetail.setPreLogId(logId);
fundDetail.setOldInfo(null);
fundDetail.setNewInfo(JSON.toJSONString(preVo.getDispatchInfoFundPreVo()));
fundDetail.setNewInfo(JSON.toJSONString(preVo.getDispatchInfoFundPreVo(),JSON_FEATURES));
fundDetail.setDifferenceInfo(null);
fundDetail.setCreateBy(user.getId());
fundDetail.setCreateName(user.getNickname());
......
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