Commit 2bebbbc4 authored by huyuchen's avatar huyuchen

huych-社保自动化相关提交

parent e73ddb98
......@@ -41,6 +41,14 @@ public class TDispatchInfoPreVo extends RowIndex implements Serializable {
@Schema(description = "员工身份证")
@ExcelProperty("员工身份证")
private String empIdcard;
/**
* 手机号码
*/
@ExcelAttribute(name = "手机号码", maxLength = 20)
@Length(max = 20, message = "手机号码不能超过20个字符")
@ExcelProperty("手机号码")
@Schema(description = "手机号码")
private String phone;
/**
* 社保购买状态,0待确认,1待派单,2派单失败,3待审核,4审核不通过,5待办理,6办理中,7办理成功,8办理失败,9部分办理失败
*/
......
......@@ -763,7 +763,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
}
//1.9.16社保自动化校验逻辑
if (employeeRegistrationPre.getServerItem().contains("社保购买")) {
if (employeeRegistrationPre.getServerItem().contains("社保")) {
//根据身份证号码和项目编号查询合同
TEmployeeAutoRegistCheckVo cardVo = new TEmployeeAutoRegistCheckVo();
cardVo.setEmpIdcard(employeeRegistrationPre.getEmpIdcard());
......
......@@ -643,7 +643,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
//1.9.16社保自动化校验逻辑
if (preVo.getServerItem().contains("社保购买")) {
if (preVo.getServerItem().contains("社保")) {
//根据身份证号码和项目编号查询合同
R<Boolean> socialFlag = socialDaprUtils.selectExitEmpSocial(cardVo);
//是否已签署为是需要判断合同是否在用或者流程中
......@@ -706,7 +706,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
initContractPreInfo(registration, preVo.getEmployeeContractPreVos(), user, domainR.getData());
}
//服务类型包含社保购买时
if (preVo.getServerItem().contains("社保购买") && (null != preVo.getExitSocialInfoList()
if (preVo.getServerItem().contains("社保") && (null != preVo.getExitSocialInfoList()
|| null != preVo.getDispatchInfoPreVo())) {
//生成社保待购买或者已购买数据
if (null != preVo.getDispatchInfoPreVo()) {
......@@ -990,7 +990,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
//1.9.16社保自动化校验逻辑
if (preVo.getServerItem().contains("社保购买") && null != preVo.getDispatchInfoPreVo()) {
if (preVo.getServerItem().contains("社保") && null != preVo.getDispatchInfoPreVo()) {
//根据身份证号码和项目编号查询合同
flag = socialDaprUtils.selectExitEmpSocial(cardVo);
//是否已签署为否需要判断是否在用或者流程中的合同
......@@ -1044,7 +1044,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
initContractPreInfo(registration, employeeContractPreVo, user, domainR.getData());
}
//服务类型包含社保购买时
if (preVo.getServerItem().contains("社保购买") && (null != preVo.getExitSocialInfoList()
if (preVo.getServerItem().contains("社保") && (null != preVo.getExitSocialInfoList()
|| null != preVo.getDispatchInfoPreVo())) {
//生成社保待购买或者已购买数据
if (null != preVo.getDispatchInfoPreVo()) {
......@@ -1206,7 +1206,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
initContractPreInfo(registrationNow, employeeContractPreVo, user, domainR.getData());
}
//服务类型包含社保购买时
if (preVo.getServerItem().contains("社保购买") && (null != preVo.getExitSocialInfoList()
if (preVo.getServerItem().contains("社保") && (null != preVo.getExitSocialInfoList()
|| null != preVo.getDispatchInfoPreVo())) {
//生成社保待购买或者已购买数据
initSocialPreInfo(registrationNow, preVo.getDispatchInfoPreVo(), user, domainR.getData());
......@@ -1713,6 +1713,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.setJoinLeaveDate(registration.getJoinLeaveDate());
preVo.setDeptNo(registration.getDeptNo());
preVo.setEmpName(registration.getEmployeeName());
preVo.setPhone(registration.getEmpPhone());
preVo.setPosition(registration.getPosition());
preVo.setEmpIdcard(registration.getEmpIdcard());
preVo.setCreateBy(user.getId());
......@@ -1720,6 +1721,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.setUpdateBy(user.getId());
preVo.setTypeSub(CommonConstants.ZERO_STRING);
preVo.setProcessStatus(CommonConstants.ZERO_STRING);
preVo.setDispatchItem("养老、医疗、生育、失业、工伤、大病");
//如果自动触发派增为是,计算派单发起时间和派单确认时间
if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis())
&& Common.isNotNull(preVo.getExpectedCollectionType())) {
......
......@@ -49,6 +49,14 @@ public class TDispatchInfoPre extends BaseEntity {
@ExcelProperty("身份证号")
@Schema(description = "身份证号")
private String empIdcard;
/**
* 手机号码
*/
@ExcelAttribute(name = "手机号码", maxLength = 20)
@Length(max = 20, message = "手机号码不能超过20个字符")
@ExcelProperty("手机号码")
@Schema(description = "手机号码")
private String phone;
/**
* 社保购买状态,0待确认,1待派单,2派单失败,3待审核,4审核不通过,5待办理,6办理中,7办理成功,8办理失败,9部分办理失败
*/
......@@ -385,7 +393,16 @@ public class TDispatchInfoPre extends BaseEntity {
@Schema(description = "派单id")
private String dispatcherId;
/**
* 社保公积金查询id
*/
@ExcelAttribute(name = "社保公积金查询id")
@ExcelProperty("社保公积金查询id")
@Schema(description = "社保公积金查询id")
private String socialFundId;
@Schema(description = "发起失败原因")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String errorInfo;
@Schema(description = "发起失败时间")
......@@ -393,6 +410,7 @@ public class TDispatchInfoPre extends BaseEntity {
private Date errorTime;
@Schema(description = "派单审核/办理不通过原因")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String errorBackInfo;
/**
......
......@@ -2,7 +2,6 @@ package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -16,7 +15,7 @@ import java.time.LocalDateTime;
* @date 2025-09-30 16:40:07
*/
@Data
public class TDispatchInfoPreExportVo extends RowIndex implements Serializable {
public class TDispatchInfoPreExportVo implements Serializable {
/**
* 项目名称
*/
......
......@@ -203,6 +203,9 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
if (Common.isNotNull(preVo.getExpectedConfirmTime())) {
pre.setExpectedConfirmTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedConfirmTime()));
}
if (Common.isEmpty(pre.getDispatchItem())) {
preVo.setDispatchItem("养老、医疗、生育、失业、工伤、大病");
}
//如果自动触发派增为是,计算派单发起时间和派单确认时间
if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis())
&& Common.isNotNull(preVo.getExpectedCollectionType()) && Common.isEmpty(preVo.getExpectedCollectionTime())) {
......@@ -339,7 +342,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
if (Common.isNotNull(disList)) {
//调用批量派单接口100条处理一次,同原合同派单保持一致
List<ErrorMessage> errorMessageList = new ArrayList<>();
dispatchInfoService.importTDispatchInfo(excelVOList, errorMessageList,user, null, new HashMap<>());
dispatchInfoService.importTDispatchInfo(disList, errorMessageList,user, null, new HashMap<>());
if (!errorMessageList.stream().allMatch(message -> message.getMessage().equals(CommonConstants.SAVE_SUCCESS))) {
errorMessageListAll.addAll(errorMessageList);
//更新社保状态为2发起失败
......
......@@ -40,6 +40,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.google.gson.JsonObject;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
......@@ -174,6 +175,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
@Autowired
private TSocialFriendBackLogService socialFriendBackLogService;
@Autowired
private WxConfig wxConfig;
/**
* 派单信息记录表简单分页查询
*
......@@ -650,7 +654,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 开始插入各种数据了
insertAllInfo(excelVOList, errorMessageList, empVoMap, res, socialsMap, fundsMap, socialFundAddMap, dispatchMap, excelVOTemp, dispatchPart, injury);
// 清理map list 等数据
Common.clear(excelVOList);
// Common.clear(excelVOList);
Common.clear(empAddsMap);
Common.clear(contractsMap);
Common.clear(projectsMap);
......@@ -1139,7 +1143,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
TDispatchInfoPre dispatchInfoPre = dispatchInfoPreMapper.selectById(preId);
if (Common.isNotNull(dispatchInfoPre)) {
dispatchInfoPre.setProcessStatus(CommonConstants.THREE_STRING);
dispatchInfoPre.setDispatcherId(socialFund.getId());
dispatchInfoPre.setDispatcherId(socialFund.getDispatchId());
dispatchInfoPre.setSocialFundId(socialFund.getId());
dispatchInfoPre.setErrorInfo(null);
dispatchInfoPre.setErrorTime(null);
dispatchInfoPreMapper.updateById(dispatchInfoPre);
......@@ -3688,7 +3693,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (null != socialInfo) {
//派单审核通过更新社保待购买表的状态
TDispatchInfoPre dispatchInfoPre = dispatchInfoPreMapper.selectOne(Wrappers.<TDispatchInfoPre>query().lambda()
.eq(TDispatchInfoPre::getDispatcherId, sf.getId())
.eq(TDispatchInfoPre::getSocialFundId, sf.getId())
.eq(TDispatchInfoPre::getProcessStatus, CommonConstants.THREE_STRING)
.last(CommonConstants.LAST_ONE_SQL));
// 派增审核
......@@ -3704,6 +3709,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
//审核通过更新状态
if (Common.isNotNull(dispatchInfoPre)) {
dispatchInfoPre.setProcessStatus(CommonConstants.FIVE_STRING);
dispatchInfoPre.setErrorBackInfo(null);
dispatchInfoPreMapper.updateById(dispatchInfoPre);
}
//派增审核不通过 需要处理预估数据
......@@ -3723,6 +3729,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatchInfoPre.setProcessStatus(CommonConstants.FOUR_STRING);
dispatchInfoPre.setErrorBackInfo(auditRemark);
dispatchInfoPreMapper.updateById(dispatchInfoPre);
sendDisFalureMessageToWx(dispatchInfoPre);
}
}
socialInfo.setAuditTime(now);
......@@ -4422,23 +4429,50 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
//针对社保自动化过来的数据,办理更新待购买数据状态
TDispatchInfoPre dispatchInfoPre = dispatchInfoPreMapper.selectOne(Wrappers.<TDispatchInfoPre>query().lambda()
.eq(TDispatchInfoPre::getDispatcherId, sf.getId())
.eq(TDispatchInfoPre::getSocialFundId, sf.getId())
.eq(TDispatchInfoPre::getProcessStatus, CommonConstants.FIVE_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(dispatchInfoPre)) {
//此处状态可能会更新为 办理成功 办理中 部分办理失败和办理失败
if (sf.getSocialStatus().equals(CommonConstants.TWO_STRING)) {
dispatchInfoPre.setProcessStatus(CommonConstants.SIX_STRING);
dispatchInfoPre.setErrorBackInfo(null);
}
if (sf.getSocialStatus().equals(CommonConstants.FOUR_STRING)) {
dispatchInfoPre.setProcessStatus(CommonConstants.NINE_STRING);
dispatchInfoPre.setErrorBackInfo(handleRemark);
StringBuffer errorTemp = new StringBuffer();
//针对部分办理失败更新社保待购买的派单项
if (CommonConstants.TWO_STRING.equals(sf.getPensionHandle())) {
errorTemp.append(DispatchConstants.DISPATCH_PENSION);
}
if (CommonConstants.TWO_STRING.equals(sf.getMedicalHandle())) {
errorTemp.append(DispatchConstants.DISPATCH_MEDICAL);
}
if (CommonConstants.TWO_STRING.equals(sf.getBirthHandle())) {
errorTemp.append(DispatchConstants.DISPATCH_BIRTH);
}
if (CommonConstants.TWO_STRING.equals(sf.getWorkInjuryHandle())) {
errorTemp.append(DispatchConstants.DISPATCH_INJURY);
}
if (CommonConstants.TWO_STRING.equals(sf.getUnemployHandle())) {
errorTemp.append(DispatchConstants.DISPATCH_UNEMP);
}
if (CommonConstants.TWO_STRING.equals(sf.getBigailmentHandle())) {
errorTemp.append(DispatchConstants.DISPATCH_BIGMAILMENT);
}
if (Common.isNotNull(errorTemp.toString())) {
dispatchInfoPre.setDispatchItem(errorTemp.deleteCharAt(errorTemp.length() - 1).toString());
}
sendDisFalureMessageToWx(dispatchInfoPre);
}
if (sf.getSocialStatus().equals(CommonConstants.FIVE_STRING)) {
dispatchInfoPre.setProcessStatus(CommonConstants.EIGHT_STRING);
dispatchInfoPre.setErrorBackInfo(handleRemark);
sendDisFalureMessageToWx(dispatchInfoPre);
}
if (sf.getSocialStatus().equals(CommonConstants.THREE_STRING)) {
dispatchInfoPre.setErrorBackInfo(null);
dispatchInfoPre.setProcessStatus(CommonConstants.SEVEN_STRING);
}
dispatchInfoPreMapper.updateById(dispatchInfoPre);
......@@ -8784,4 +8818,45 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
return R.failed("未找到反馈文件");
}
//发送企业微信待办
private void sendDisFalureMessageToWx(TDispatchInfoPre pre) {
//获取前端客服
SysUser user;
if (Common.isEmpty(pre.getCustomerUserLoginName())) {
return;
}
R<SysUser> res = upmsDaprUtils.getSimpleUserByLoginName(pre.getCustomerUserLoginName());
if (Common.isNotNull(res) && Common.isNotNull(res.getData())) {
user = res.getData();
} else {
return;
}
StringBuilder sendUser = null;
if (Common.isNotKong(user.getWxMessage())) {
sendUser = new StringBuilder(user.getWxMessage());
}
if (sendUser != null) {
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "68" + pre.getId());
StringBuilder description = new StringBuilder();
String title = "作业自动化——社保办理失败提醒";
description.append(pre.getEmpName()).append("-").append(pre.getEmpIdcard()).append("-")
.append(pre.getPhone()).append(",社保派单审核/办理失败").append("<br>");
description.append("请及时处理,以免产生用工风险!").append("<br>");
textcard.put("title", title);
textcard.put("url", authUrl);
textcard.put("description", description.toString());
requestMap.put("touser", sendUser);
requestMap.put("agentid", wxConfig.getAgentid());
requestMap.put("msgtype", "textcard");
requestMap.put("textcard", textcard);
// 必须加上header说明
if (!wxConfig.sendTextCard(restTemplate, requestMap)) {
wxConfig.sendTextCard(restTemplate, requestMap);
}
}
}
}
......@@ -53,6 +53,7 @@
<result property="contractStatus" column="CONTRACT_STATUS"/>
<result property="contractId" column="CONTRACT_ID"/>
<result property="dispatcherId" column="DISPATCHER_ID"/>
<result property="socialFundId" column="SOCIAL_FUND_ID"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
......@@ -63,6 +64,7 @@
<result property="errorBackInfo" column="error_back_info"/>
<result property="errorTime" column="error_time"/>
<result property="position" column="position"/>
<result property="phone" column="phone"/>
</resultMap>
<resultMap id="tDispatchInfoPreExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoPreExportVo">
......@@ -131,7 +133,7 @@
a.CREATE_NAME,
a.UPDATE_TIME,
a.CREATE_TIME,
a.DELETE_FLAG,error_info,error_time,a.DISPATCHER_ID,a.error_back_info,a.position
a.DELETE_FLAG,error_info,error_time,a.DISPATCHER_ID,a.error_back_info,a.position,SOCIAL_FUND_ID,a.phone
</sql>
<sql id="tDispatchInfoPre_where">
<if test="tDispatchInfoPre != null">
......@@ -202,6 +204,9 @@
</if>
<if test="tDispatchInfoPre.contractStatus != null and tDispatchInfoPre.contractStatus.trim() != ''">
AND a.CONTRACT_STATUS = #{tDispatchInfoPre.contractStatus}
</if>
<if test="tDispatchInfoPre.failType != null and tDispatchInfoPre.failType.trim() != ''">
AND a.error_info is not null
</if>
<if test="tDispatchInfoPre.authSql != null and tDispatchInfoPre.authSql.trim() != ''">
${tDispatchInfoPre.authSql}
......@@ -290,7 +295,7 @@
(@i :=@i+1) as rowIndex,
a.EMP_NAME empName,
a.EMP_IDCARD empIdcard,
a.dept_no deptNo,
a.dept_no settleDomainCode,
a.RECORD_BASE recordBase,
a.SOCIAL_HOUSEHOLD_NAME socialHousehold,
if(a.IS_CREATE_DATE = '0',a.SOCIAL_START_DATE,a.PENSION_START) as pensionStart,
......@@ -307,6 +312,7 @@
if(a.PAYMENT_TYPE = '1',BIRTH_CARDINAL,null) as birthCardinal,
if(a.PAYMENT_TYPE = '1',BIGAILMENT_CARDINAL,null) as bigailmentCardinal,
a.id preId,
a.TRUST_REMARK trustRemark,
a.CUSTOMER_USER_LOGIN_NAME as preLoginName,
if(#{type} = '1',concat('手动派单-',a.customer_username),concat('自动化派单-',a.customer_username)) preName
FROM t_dispatch_info_pre a,(select @i:=0) as itable
......
......@@ -1238,6 +1238,7 @@
<select id="selectSocialFundInfoCountByEmpIdcard" resultType="java.lang.Long">
SELECT count(1)
FROM t_social_fund_info a
inner join t_dispatch_info d on a.DISPATCH_ID = d.ID
where a.EMP_IDCARD = #{empIdcard}
and a.social_status in ('0', '1', '2', '3', '4', '6', '7', '9', '11', '12')
</select>
......
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