Commit ccb11151 authored by hongguangwu's avatar hongguangwu

MVP1.7.17-离职待办-派单暂存

parent f2ebd2d3
/*
* 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.common.core.vo;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 通用跨服务调用Vo
* @Author: hgw
* @Date: 2025-11-24 10:35:06
* @return:
**/
@Getter
@Setter
public class BaseServiceParamListVO implements Serializable {
private static final long serialVersionUID = 1L;
// 跨服务调用,多消息专用
private List<String> listParam = new ArrayList<>();
// 需处理项:1社保2公积金3商险4合同5项目档案6人员档案
private String doType;
// 结果 0失败
// @Schema(description = "社保减员:0空1无需处理2待派单3发起失败4待审核5待办理6部分办理失败8办理成功9办理失败10审核不通过")
// @Schema(description = "公积金减员:0空1无需处理2待派单3发起失败4待审核5待办理8办理成功9办理失败10审核不通过")
// @Schema(description = "商险退保:0空1无需处理2待派单3发起失败4待减员5待办理6减员中8减员成功9减员退回")
// @Schema(description = "合同终止:0空1无需处理2待发起3发起失败4待审核8审核通过10审核不通过")
// @Schema(description = "减项:0空1无需处理2待减项8减项成功9减项失败")
// @Schema(description = "减档:0空1无需处理2待减档8减档成功9减档失败")
private String doStatus;
// 0:未最终成功;1:最终成功
private String isSuccess;
// 备注
private String remark;
}
......@@ -38,5 +38,6 @@ public class RegistConstants {
public static final String BASE_REASON_TYPE_NAME = "个人辞职";
public static final String BASE_LINK_PORT = "人员离职";
public static final String[] DO_TYPE_ARR = {"-","社保","公积金","商险","合同","项目档案","人员档案"};
public static final String[] DO_TYPE_REDUCE_ARR = {"-","社保派减成功;","公积金派减成功;","商险减员成功;","合同终止成功;","减项成功;","减档成功;"};
}
......@@ -27,9 +27,11 @@ import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo;
import com.yifu.cloud.plus.v1.csp.vo.ErrorInfoVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -207,6 +209,7 @@ public class EmployeeRegistrationLeaveController {
**/
@Operation(description = "定时任务批量派单")
@PostMapping("/inner/autoDoLeave")
@Inner
public String autoDoLeave() {
employeeRegistrationLeaveService.autoDoLeave();
return CommonConstants.RESULT_DATA_SUCESS;
......@@ -227,6 +230,14 @@ public class EmployeeRegistrationLeaveController {
return employeeRegistrationLeaveService.batchDoLeave(idList, isExit, doType);
}
@Operation(description = "减少办理同步离职待办")
@PostMapping("/inner/reduceHandleToLeave")
@Inner
public String reduceHandleToLeave(@RequestBody BaseServiceParamListVO vo) {
employeeRegistrationLeaveService.reduceHandleToLeave(vo);
return CommonConstants.RESULT_DATA_SUCESS;
}
}
......@@ -32,7 +32,7 @@ import java.util.List;
*/
@Mapper
public interface EmployeeRegistrationLeaveInsuranceMapper extends BaseMapper<EmployeeRegistrationLeaveInsurance> {
// 暂未使用
// 办理使用
List<EmployeeRegistrationLeaveInsurance> getLeaveInsuranceList(@Param("leaveId") String leaveId
, @Param("insuranceId") String insuranceId);
......
......@@ -74,4 +74,7 @@ public interface EmployeeRegistrationLeaveMapper extends BaseMapper<EmployeeRegi
List<EmployeeRegistrationLeave> selectLeaveListByDispatch(@Param("idList") List<String> idList);
List<EmployeeRegistrationLeave> selectLeaveListByHandleAndType(@Param("idList") List<String> idList, @Param("doType") String doType);
List<EmployeeRegistrationLeave> selectLeaveListByHandleAndInsuranceType(@Param("idList") List<String> idList);
}
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveSearchVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationLeaveTableVo;
import com.yifu.cloud.plus.v1.csp.vo.ErrorInfoVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
......@@ -81,4 +82,6 @@ public interface EmployeeRegistrationLeaveService extends IService<EmployeeRegis
// @param doType: 需处理项:1社保2公积金3商险4合同5项目档案6人员档案
R<ErrorInfoVo> batchDoLeave(List<String> idList, String isExit, String doType);
void reduceHandleToLeave(BaseServiceParamListVO vo);
}
......@@ -43,6 +43,7 @@ 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.BaseSearchListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.InsuranceDaprUtil;
......@@ -300,7 +301,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
}
if (Common.isNotNull(socialId)) {
if (Common.isNotNull(doType)) {
if (Common.isNotNull(doType) && doType.length() > CommonConstants.ZERO_INT) {
doType.append(",");
}
doType.append(CommonConstants.ONE_STRING);
......@@ -313,7 +314,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
// 设置公积金减员状态
if (Common.isNotNull(fundId)) {
if (Common.isNotNull(doType)) {
if (Common.isNotNull(doType) && doType.length() > CommonConstants.ZERO_INT) {
doType.append(",");
}
doType.append(CommonConstants.TWO_STRING);
......@@ -336,7 +337,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
}
if (Common.isNotNull(insuranceId)) {
if (Common.isNotNull(doType)) {
if (Common.isNotNull(doType) && doType.length() > CommonConstants.ZERO_INT) {
doType.append(",");
}
doType.append(CommonConstants.THREE_STRING);
......@@ -386,7 +387,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
}
if (Common.isNotNull(contractId)) {
if (Common.isNotNull(doType)) {
if (Common.isNotNull(doType) && doType.length() > CommonConstants.ZERO_INT) {
doType.append(",");
}
doType.append(CommonConstants.FOUR_STRING);
......@@ -399,7 +400,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leave.setIsMultipleDept(isMultipleDept);
if (Common.isNotNull(empProjectId)) {
if (Common.isNotNull(doType)) {
if (Common.isNotNull(doType) && doType.length() > CommonConstants.ZERO_INT) {
doType.append(",");
}
doType.append(CommonConstants.FIVE_STRING);
......@@ -410,7 +411,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leave.setDoStatusProject(CommonConstants.ONE_STRING);
}
if (Common.isNotNull(empId)) {
if (Common.isNotNull(doType)) {
if (Common.isNotNull(doType) && doType.length() > CommonConstants.ZERO_INT) {
doType.append(",");
}
doType.append(CommonConstants.SIX_STRING);
......@@ -1419,4 +1420,112 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
return R.ok(errorVo);
}
@Override
public void reduceHandleToLeave(BaseServiceParamListVO vo) {
if (vo == null) {
return;
}
String doType = vo.getDoType();
String doStatus = vo.getDoStatus();
String isSuccess = vo.getIsSuccess();
// 最终成功,才更新执行详情
boolean canUpdateDoDetail = false;
if (Common.isNotNull(isSuccess) && CommonConstants.ONE_STRING.equals(isSuccess)) {
canUpdateDoDetail = true;
}
String doRemark = vo.getRemark();
if (doRemark.length()>200) {
doRemark = doRemark.substring(0,200);
}
List<String> idList = vo.getListParam();
if (idList != null && !idList.isEmpty() && Common.isNotNull(doType)) {
// 需处理项:1社保2公积金3商险4合同5项目档案6人员档案
List<EmployeeRegistrationLeave> leaveList;
Map<String, Integer> insuranceMap = new HashMap<>();
if (CommonConstants.THREE_STRING.equals(doType)) {
leaveList = baseMapper.selectLeaveListByHandleAndInsuranceType(idList);
} else {
leaveList = baseMapper.selectLeaveListByHandleAndType(idList, doType);
for (String id:idList) {
insuranceMap.put(id, CommonConstants.ONE_INT);
}
}
if (leaveList != null && !leaveList.isEmpty()) {
String newDetail;
List<EmployeeRegistrationLeaveInsurance> insuranceList;
String minStatus;
String currentStatus;
for (EmployeeRegistrationLeave leave : leaveList) {
leave.setDoRemark(doRemark);
if (canUpdateDoDetail) {
newDetail = RegistConstants.DO_TYPE_REDUCE_ARR[Integer.parseInt(doType)];
if (Common.isEmpty(leave.getDoDetail())) {
leave.setDoDetail(newDetail);
} else if (!leave.getDoDetail().contains(newDetail)) {
leave.setDoDetail(leave.getDoDetail() + newDetail);
}
}
// 处理社保
if (CommonConstants.ONE_STRING.equals(doType)) {
leave.setDoStatusSocial(doStatus);
}
if (CommonConstants.TWO_STRING.equals(doType)) {
leave.setDoStatusFund(doStatus);
}
if (CommonConstants.THREE_STRING.equals(doType)) {
insuranceList = leaveInsuranceMapper.getLeaveInsuranceList(leave.getId(), null);
minStatus = null;
for (EmployeeRegistrationLeaveInsurance insurance : insuranceList) {
if (insuranceMap.get(insurance.getInsuranceId()) != null) {
insurance.setDoStatusInsurance(doStatus);
leaveInsuranceMapper.updateById(insurance);
}
if (Common.isNotNull(insurance.getDoStatusInsurance())) {
currentStatus = insurance.getDoStatusInsurance();
if (Common.isEmpty(minStatus)) {
minStatus = currentStatus;
} else {
minStatus = compareInsuranceStatus(minStatus, currentStatus);
}
}
}
leave.setDoStatusInsurance(minStatus);
}
if (CommonConstants.FOUR_STRING.equals(doType)) {
leave.setDoStatusContract(doStatus);
}
if (CommonConstants.FIVE_STRING.equals(doType)) {
leave.setDoStatusProject(doStatus);
}
if (CommonConstants.SIX_STRING.equals(doType)) {
leave.setDoStatusEmp(doStatus);
}
judgeStatus( leave);
}
this.updateBatchById(leaveList);
}
}
}
/**
* 比较两个保险状态,返回较小的那个
* 特殊规则:8是最大的
* // 2待派单3发起失败4待减员5待办理6减员中8减员成功9减员退回
*/
private String compareInsuranceStatus(String status1, String status2) {
// 如果其中一个状态是8,返回另一个状态
if (CommonConstants.EIGHT_STRING.equals(status1)) {
return status2;
}
if (CommonConstants.EIGHT_STRING.equals(status2)) {
return status1;
}
// 其他情况正常比较数字大小
try {
return String.valueOf(Math.min(Integer.parseInt(status1), Integer.parseInt(status2)));
} catch (Exception e) {
return status1;
}
}
}
......@@ -1321,6 +1321,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
registration.setCustomerUsernameNew(registration.getCustomerUsername());
registration.setCustomerUserLoginNameNew(registration.getCustomerUserLoginname());
baseMapper.insert(registration);
if (Common.isNotNull(registration.getFeedbackType()) && CommonConstants.TWO_STRING.equals(registration.getFeedbackType())) {
// 生成离职待办
employeeRegistrationLeaveService.saveLeaveInfo(registration);
}
//更新附件
updateFileId(registration);
}
......
......@@ -80,6 +80,6 @@
<!-- 避免数据重复,保存前,删除历史数据 -->
<delete id="deleteLeaveInsurance" >
delete employee_registration_leave_insurance where leave_id = #{leaveId}
delete from employee_registration_leave_insurance where leave_id = #{leaveId}
</delete>
</mapper>
......@@ -488,8 +488,8 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
FROM employee_registration_leave a
left join employee_registration b on a.id=b.id
<where>
1=1
<include refid="employeeRegistrationLeave_where"/>
a.confirm_user is not null
<include refid="employeeRegistrationLeave_where"/>
</where>
ORDER BY b.create_time asc,b.id asc
</select>
......@@ -518,8 +518,8 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
FROM employee_registration_leave a
left join employee_registration b on a.id=b.id
<where>
1=1
<include refid="employeeRegistrationLeave_where"/>
a.confirm_user is not null
<include refid="employeeRegistrationLeave_where"/>
</where>
ORDER BY b.create_time asc,b.id asc
<if test="employeeRegistrationLeave != null">
......@@ -547,8 +547,8 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
FROM employee_registration_leave a
left join employee_registration b on a.id=b.id
<where>
1=1
<include refid="employeeRegistrationLeave_where"/>
a.confirm_user is not null
<include refid="employeeRegistrationLeave_where"/>
</where>
</select>
......@@ -602,4 +602,49 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
ORDER BY b.create_time asc,b.id asc
</select>
<!-- 查询需要办理的数据 -->
<select id="selectLeaveListByHandleAndType" resultMap="employeeRegistrationLeaveMap">
SELECT
<include refid="Base_Column_List"/>
FROM employee_registration_leave a
<where> 1=1
<if test="idList != null and idList.size() > 0">
<if test="doType != null and doType.trim() != ''">
<if test="doType == '1'">
and a.social_id in
</if>
<if test="doType == '2'">
and a.fund_id in
</if>
<if test="doType == '4'">
and a.contract_id in
</if>
<if test="doType == '5'">
and a.emp_project_id in
</if>
<if test="doType == '6'">
and a.emp_id in
</if>
<foreach collection="idList" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
</if>
</where>
</select>
<!-- 查询需要办理的商险数据 -->
<select id="selectLeaveListByHandleAndInsuranceType" resultMap="employeeRegistrationLeaveMap">
<if test="idList != null and idList.size() > 0">
SELECT
<include refid="Base_Column_List"/>
FROM employee_registration_leave a
JOIN employee_registration_leave_insurance i on a.id=i.leave_id
where i.insurance_id in
<foreach collection="idList" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
</select>
</mapper>
......@@ -75,4 +75,7 @@ public class TInsuranceAlertSearchVo extends TInsuranceAlert {
@Schema(description = "列表查询类型 1 待办 2监控 3入职确认信息")
private String type;
@Schema(description = "是否当日以及之前的派单日期0否1是")
private String isBefore;
}
......@@ -287,6 +287,11 @@
a.EXPIRE_IGNORE_FLAG = '1' and a.DELETE_FLAG=0 and b.is_leave = '0' and a.IS_OVERDUE = 0
<include refid="tInsuranceAlert_where"/>
<if test="tInsuranceAlert != null">
<if test="tInsuranceAlert.isBefore != null and tInsuranceAlert.isBefore.trim() != ''">
<if test="tInsuranceAlert.isBefore.trim() == '1'">
AND DATE_FORMAT(now(),'%Y-%m-%d') >= DATE_FORMAT(b.expected_collection_time,'%Y-%m-%d')
</if>
</if>
<if test="tInsuranceAlert.processStatusArray != null and tInsuranceAlert.processStatusArray.length > 0">
AND b.PROCESS_STATUS in
<foreach item="statusStr" index="index" collection="tInsuranceAlert.processStatusArray" open="("
......
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