Commit ec323865 authored by hongguangwu's avatar hongguangwu

MVP1.7.3-shuiyou 增减接口

parent dea4ef0d
/*
* 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.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 社保士兵与税友切换表
*
* @author hgw
* @date 2024-12-12 09:40:56
*/
@Data
@TableName("t_social_freind_set")
@Schema(description = "社保士兵与税友切换表")
public class TSocialFreindSet {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("id")
@Schema(description = "id")
private String id;
/**
* 类型:0社保士兵 1税友
*/
@ExcelAttribute(name = "类型:0社保士兵 1税友", isNotEmpty = true, errorInfo = "类型:0社保士兵 1税友不能为空")
@NotBlank(message = "类型:0社保士兵 1税友不能为空")
@ExcelProperty("类型:0社保士兵 1税友")
@Schema(description = "类型:0社保士兵 1税友")
private Integer type;
}
/*
* 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.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.time.LocalDateTime;
/**
* 社保士兵返回的数据记录表
*
* @author hgw
* @date 2024-12-12 09:40:55
*/
@Data
@TableName("t_social_friend_back_log")
@Schema(description = "社保士兵返回的数据记录表")
public class TSocialFriendBackLog {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String id;
/**
* 社保ID
*/
@ExcelAttribute(name = "社保ID", maxLength = 32)
@Length(max = 32, message = "社保ID不能超过32个字符")
@ExcelProperty("社保ID")
@Schema(description = "社保ID")
private String socialId;
/**
* 请求ID
*/
@ExcelAttribute(name = "请求ID", maxLength = 50)
@Length(max = 50, message = "请求ID不能超过50个字符")
@ExcelProperty("请求ID")
@Schema(description = "请求ID")
private String requestId;
/**
* 日志
*/
@ExcelAttribute(name = "日志")
@ExcelProperty("日志")
@Schema(description = "日志")
private String logInfo;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间", isDate = true)
@ExcelProperty("创建时间")
@Schema(description = "创建时间")
private LocalDateTime createTime;
}
......@@ -1045,6 +1045,25 @@ public class TSocialInfo extends BaseEntity {
@ExcelProperty("医生大社保士兵的任务ID" )
private String ysdAddId;
/**
* 养工失税友的任务ID
*/
@Length(max = 50, message = "养工失税友的任务ID 不能超过50个字符" )
@ExcelAttribute(name = "养工失税友的任务ID", maxLength = 50)
@Schema(description = "养工失税友的任务ID" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("养工失税友的任务ID" )
private String ygsRequestId;
/**
* 医生大税友的任务ID
*/
@Length(max = 50, message = "医生大税友的任务ID 不能超过50个字符" )
@ExcelAttribute(name = "医生大税友的任务ID", maxLength = 50)
@Schema(description = "医生大税友的任务ID" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医生大税友的任务ID" )
private String ysdRequestId;
// 派单id,社保士兵使用
@TableField(exist = false)
private String dispatchId;
......
......@@ -65,6 +65,8 @@ public class SociaFriendYgsAddVo implements Serializable {
@ExcelProperty("合同到期时间")
private String contractEnd;
// 中断原因 除死亡以外,其他停保原因默认:“在职人员解除/终止劳动合同” 死亡对应“死亡或失踪”
@ExcelProperty("中断原因")
private String tbyy;
// 单位提出协商一致21 职工与用人单位协商一致解除劳动合同(18条1款)
// 退休5 第四十四条第二项,劳动者开始依法享受基本养老保险待遇
//死亡16 劳动者死亡,或者被人民法院宣告死亡或者宣告失踪
......@@ -73,14 +75,18 @@ public class SociaFriendYgsAddVo implements Serializable {
//合同期满12 劳动合同期满
//单位辞退2 劳动者严重违反用人单位的规章制度
// 其他的默认 个人辞职1 劳动者提前30天书面通知解除或试用期提前3天通知解除合同 2024-12-12 09:19:59 昨晚盛宇沟通的结果
@ExcelProperty("减少原因")
private String reduceReason;
@ExcelProperty("劳动用工备案解除/终止原因")
private String zzyy;
// 企业职工社会保险增员花名册 qyzgshbxzyhmc
private String qyzgshbxzyhmc;
// 企业职工基本医疗保险参保登记表 qyzgshbxzyhmc
private String qyzgjbylbxcbdjb;
private String socialProvince;
private String socialCity;
private String socialTown;
@ExcelProperty("派单类型")
private String type;
......
......@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import com.yifu.cloud.plus.v1.yifu.social.vo.SociaFriendYgsAddVo;
import lombok.Data;
......@@ -17,7 +18,9 @@ import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
import java.security.SignatureException;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.TreeMap;
/**
......@@ -59,7 +62,8 @@ public class SocialFriendConfig {
* @Date: 2024-12-9 16:54:31
* @return: java.lang.String
**/
public String pushFriendByInfo(RestTemplate restTemplate, SociaFriendYgsAddVo vo, int type, String thisTime) {
public String pushFriendByInfo(RestTemplate restTemplate, SociaFriendYgsAddVo vo, int type, String thisTime
, TSocialFriendBackLog backLog) {
String addId = "";
String appAddUrl = urlPre + urlPush;
String version = "1.0.0";
......@@ -123,6 +127,8 @@ public class SocialFriendConfig {
// {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y"
// ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172"
if (Common.isNotNull(dataResultList)) {
backLog.setLogInfo(dataResultList);
backLog.setCreateTime(LocalDateTime.now());
JSONObject dataObject = JSON.parseObject(dataResultList);
String head = dataObject.getString("head");
if (Common.isNotNull(head)) {
......@@ -206,17 +212,20 @@ public class SocialFriendConfig {
JSONArray blxmlbArr = new JSONArray();
JSONObject blxmlbOne = new JSONObject();
String blxm = "社保";
// 险种类型 例如养老、工伤、医疗等
String xzlb = "企业职工养老, 工伤保险, 失业保险";
if (type > 2) {
blxm = "医保";
xzlb = "职工基本医疗保险, 生育保险, 大额医疗";
}
String[] strArr = xzlb.split(",");
// 办理项目
blxmlbOne.put("blxm", blxm);
// 本次参保日期 格式:yyyy-MM-dd
blxmlbOne.put("bccbrq", startDate);
// 申报工资 社保派单里的“备案基数”
blxmlbOne.put("sbgz", vo.getRecordBase());
// 险种类型 例如养老、工伤、医疗等
String[] strArr = {"企业职工养老", "工伤保险", "失业保险"};
// 险种类型 例如养老、工伤、医疗等
blxmlbOne.put("xzlb", strArr);
blxmlbArr.add(blxmlbOne);
......@@ -310,7 +319,7 @@ public class SocialFriendConfig {
// 办理项目
blxmlbOne.put("blxm", blxm);
// 中断原因 除死亡以外,其他停保原因默认:“在职人员解除/终止劳动合同” 死亡对应“死亡或失踪”
blxmlbOne.put("tbyy", vo.getReduceReason());
blxmlbOne.put("tbyy", vo.getTbyy());
// 中断时间 yyyy-MM-dd 默认当前时间
blxmlbOne.put("tbsj", DateUtil.getThisDayByPatten("yyyy-MM-dd"));
blxmlbArr.add(blxmlbOne);
......@@ -319,7 +328,7 @@ public class SocialFriendConfig {
// 特色字段信息
JSONObject tszdxx = new JSONObject();
// 劳动用工备案解除/终止原因 数据字典文档 法律依据 [社保]必填;
tszdxx.put("zzyy", vo.getReduceReason());
tszdxx.put("zzyy", vo.getZzyy());
// 社保个人身份材料 无
// tszdxx.put("shjycl", )
// 医保个人身份材料 无
......@@ -344,7 +353,7 @@ public class SocialFriendConfig {
* @Date: 2024-12-9 16:54:22
* @return: java.lang.String
**/
public FriendResult getFriendByRequestId(RestTemplate restTemplate, String requestId) {
public FriendResult getFriendByRequestId(RestTemplate restTemplate, String requestId, TSocialFriendBackLog backLog) {
if (Common.isEmpty(requestId)) {
return null;
}
......@@ -374,8 +383,13 @@ public class SocialFriendConfig {
if (statusCode != 200) {
throw new CheckedException("获取税友结果失败,statusCode=" + statusCode);
}
String dataResultList = response.getBody();
FriendResult result = new FriendResult();
String dataResultList = response.getBody();
backLog.setCreateTime(LocalDateTime.now());
backLog.setLogInfo(dataResultList);
// 组装返回结果
getResultToVo(dataResultList, result);
return result;
......
......@@ -47,108 +47,20 @@ public class TSocialFriendController {
private final TSocialFriendService tSocialFriendService;
private final TSocialFriendPushService tSocialFriendPushService;
@Operation(description = "推送税友Test")
@PostMapping("/pushFriendTest")
public R<String> pushFriendTest(@RequestBody(required = false) List<String> dispatchIdList) {
return tSocialFriendPushService.pushFriendTest(dispatchIdList);
}
@Operation(description = "1定时任务推送税友")
@PostMapping("/inner/doPushFriend")
@SysLog("1定时任务推送税友")
@Inner
public R<String> doPushFriendTest() {
return tSocialFriendPushService.pushFriendTest(null);
return tSocialFriendPushService.pushFriend(null);
}
@Operation(description = "2定时任务获取税友")
@PostMapping("/inner/doGetFriendByRequestId")
@SysLog("2定时任务获取税友")
@Inner
public R<FriendResult> doGetFriendByRequestId() {
return tSocialFriendPushService.getFriendByRequestIdTest(null);
}
/**
* @param addId 任务id,可为空
* @Description: 1获取税友状态
* @Author: hgw
* @Date: 2024/5/11 19:25
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "获取税友状态")
@GetMapping("/getFiveJob")
public R<String> getFiveJob(@RequestParam(required = false) String addId) {
return tSocialFriendService.getFiveJob(addId);
}
/**
* @param dispatchIdList 派单id
* @Description: 推送税友
* @Author: hgw
* @Date: 2024/5/11 19:25
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "推送税友")
@PostMapping("/pushSoldier")
public R<String> pushSoldier(@RequestBody(required = false) List<String> dispatchIdList) {
return tSocialFriendPushService.pushSoldier(dispatchIdList);
}
/**
* @Description: 1定时任务获取税友状态
* @Author: hgw
* @Date: 2024/5/11 19:26
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "1定时任务获取税友状态")
@PostMapping("/inner/doInnerGetFiveJob")
@SysLog("1每日定时任务获取税友状态")
@Inner
public R<String> doInnerGetFiveJob() {
return tSocialFriendService.getFiveJob(null);
}
/**
* @Description: 2定时任务推送税友
* @Author: hgw
* @Date: 2024/5/11 19:26
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "2定时任务推送税友")
@PostMapping("/inner/doInnerPushSoldier")
@SysLog("2每日定时任务推送税友")
@Inner
public R<String> doInnerPushSoldier() {
return tSocialFriendPushService.pushSoldier(null);
}
/**
* @Description: 3每日定时任务推送税友审核结果查询
* @Author: hgw
* @Date: 2024-5-24 17:01:56
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "3每日定时任务推送税友审核结果查询")
@PostMapping("/inner/doInnerPushSoldierByAudit")
@SysLog("4每日定时任务推送税友审核结果查询")
@Inner
public R<String> doInnerPushSoldierByAudit() {
return tSocialFriendPushService.pushSoldierByAudit();
}
/**
* @Description: 4每日定时任务获取税友审核结果查询
* @Author: hgw
* @Date: 2024-5-24 17:02:00
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "4每日定时任务获取税友审核结果查询")
@PostMapping("/inner/doInnerGetSixJobByAudit")
@SysLog("4每日定时任务获取税友审核结果查询")
@Inner
public R<String> doInnerGetSixJobByAudit() {
return tSocialFriendService.getSixJobByAudit();
public R<String> doGetFriendByRequestId() {
return tSocialFriendService.getInfoByRequestId();
}
}
/*
* 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.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindSet;
import org.apache.ibatis.annotations.Mapper;
/**
* 社保士兵与税友切换表
*
* @author hgw
* @date 2024-12-12 09:40:56
*/
@Mapper
public interface TSocialFreindSetMapper extends BaseMapper<TSocialFreindSet> {
}
/*
* 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.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog;
import org.apache.ibatis.annotations.Mapper;
/**
* 社保士兵返回的数据记录表
*
* @author hgw
* @date 2024-12-12 09:40:55
*/
@Mapper
public interface TSocialFriendBackLogMapper extends BaseMapper<TSocialFriendBackLog> {
}
......@@ -19,10 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAuditVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAddVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAuditVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -42,7 +39,7 @@ public interface TSocialFriendMapper extends BaseMapper<TSocialInfo> {
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYgsAddVo> getSocialSoldierYgsAddVoList(@Param("idsStr") List<String> idsStr);
List<SociaFriendYgsAddVo> getSocialSoldierYgsAddVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失减少模板
......@@ -50,7 +47,7 @@ public interface TSocialFriendMapper extends BaseMapper<TSocialInfo> {
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYgsAddVo> getSocialSoldierYgsReduceVoList(@Param("idsStr") List<String> idsStr);
List<SociaFriendYgsAddVo> getSocialSoldierYgsReduceVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵医生大增加模板
......@@ -58,7 +55,7 @@ public interface TSocialFriendMapper extends BaseMapper<TSocialInfo> {
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYsdAddVo> getSocialSoldierYsdAddVoList(@Param("idsStr") List<String> idsStr);
List<SociaFriendYgsAddVo> getSocialSoldierYsdAddVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵医生大减少模板
......@@ -66,54 +63,8 @@ public interface TSocialFriendMapper extends BaseMapper<TSocialInfo> {
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYsdAddVo> getSocialSoldierYsdReduceVoList(@Param("idsStr") List<String> idsStr);
List<SociaFriendYgsAddVo> getSocialSoldierYsdReduceVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失审核模板
*
* @Author hgw
* @Date 2024-5-24 16:39:43
**/
List<SocialSoldierYgsAuditVo> getSocialSoldierYgsAuditVoList();
/**
* 社保士兵医生大审核续保模板
*
* @Author hgw
* @Date 2024-5-24 16:39:43
**/
List<SocialSoldierYsdAuditVo> getSocialSoldierYsdAuditVoList();
/**
* 社保士兵养工失审核模板——推送给社保士兵的归总模板
*
* @Author hgw
* @Date 2024-9-2 18:03:04
**/
List<SocialSoldierYgsAuditVo> getSocialSoldierYgsAuditVoListByGroupBy();
/**
* 社保士兵医生大审核续保模板——推送给社保士兵的归总模板
*
* @Author hgw
* @Date 2024-9-2 18:03:07
**/
List<SocialSoldierYsdAuditVo> getSocialSoldierYsdAuditVoListByGroupBy();
/**
* 社保士兵医生大审核新增模板
*
* @Author hgw
* @Date 2024-5-24 16:39:43
**/
List<SocialSoldierYsdAuditVo> getSocialSoldierYsdAddAuditVoList();
/**
* 社保士兵医生大审核新增模板
*
* @Author hgw
* @Date 2024-5-24 16:39:43
**/
List<SocialSoldierYsdAuditVo> getSocialSoldierYsdAddAuditVoListByGroupBy();
}
......@@ -50,6 +50,9 @@ public interface TSocialInfoMapper extends BaseMapper<TSocialInfo> {
**/
List<TSocialInfo> getSocialSoldierYgsAll();
List<TSocialInfo> getSocialSoldierYsdAll();
List<TSocialInfo> getSocialFriendYgsAll();
List<TSocialInfo> getSocialFriendYsdAll();
/**
* @param
* @Description: 获取所有需要社保局审核的社保
......
......@@ -65,4 +65,6 @@ public interface TSocialDeadlineInfoService extends IService<TSocialDeadlineInfo
**/
Map<String, TSocialDeadlineInfo> getSocialSet();
Map<String, TSocialDeadlineInfo> getSocialSetByAreaId();
}
/*
* 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.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindSet;
/**
* 社保士兵与税友切换表
*
* @author hgw
* @date 2024-12-12 09:40:56
*/
public interface TSocialFreindSetService extends IService<TSocialFreindSet> {
}
/*
* 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.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog;
/**
* 社保士兵返回的数据记录表
*
* @author hgw
* @date 2024-12-12 09:40:55
*/
public interface TSocialFriendBackLogService extends IService<TSocialFriendBackLog> {
}
......@@ -34,14 +34,6 @@ import java.util.List;
*/
public interface TSocialFriendPushService extends IService<TSocialInfo> {
/**
* @Description: 根据文件,推送到社保士兵。注意社保id别搞错了,否则塞值到社保里就塞错了
* @Author: hgw
* @Date: 2024/5/11 14:46
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> getOneAppGetModuleDetail(List<TSocialInfo> socialIdList, MultipartFile file, String type);
/**
* @param dispatchIdList
* @Description: 根据派单id,获取要派增派减的社保、医保数据,生成文件,推送到社保士兵
......@@ -49,18 +41,6 @@ public interface TSocialFriendPushService extends IService<TSocialInfo> {
* @Date: 2024/5/10 17:52
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> pushSoldier(List<String> dispatchIdList);
R<String> pushFriendTest(List<String> dispatchIdList);
R<FriendResult> getFriendByRequestIdTest(List<String> dispatchIdList);
/**
* @param
* @Description: 推送当月所有提交社保局后,待社保局审核的查询任务
* @Author: hgw
* @Date: 2024/5/23 18:14
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> pushSoldierByAudit();
R<String> pushFriend(List<String> dispatchIdList);
}
......@@ -20,6 +20,9 @@ package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import java.util.List;
/**
* 社保士兵
......@@ -29,22 +32,12 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
*/
public interface TSocialFriendService extends IService<TSocialInfo> {
/**
* @param addId
* @Description: 查看社保士兵反馈情况
* @Author: hgw
* @Date: 2024/5/11 14:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> getFiveJob(String addId);
/**
* @Description: 查看社保士兵审核结果查询的反馈情况
* @Author: hgw
* @Date: 2024-5-24 17:02:34
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> getSixJobByAudit();
R<String> getInfoByRequestId();
}
......@@ -66,6 +66,9 @@ public interface TSocialInfoService extends IService<TSocialInfo> {
**/
List<TSocialInfo> getSocialSoldierYgsAll();
List<TSocialInfo> getSocialSoldierYsdAll();
List<TSocialInfo> getSocialFriendYgsAll();
List<TSocialInfo> getSocialFriendYsdAll();
/**
* @Description: 获取所有需要审核结果的社保
* @Author: hgw
......
......@@ -59,6 +59,11 @@ public interface TSocialSoldierLogService extends IService<TSocialSoldierLog> {
// 医保提交日志
TSocialSoldierLog getYsdSoldierLog(SocialSoldierYsdAddVo vo, String type, String remark);
// 社保提交日志-税友
TSocialSoldierLog getYgsFriendLog(SociaFriendYgsAddVo vo, String type, String remark);
// 医保提交日志-税友
TSocialSoldierLog getYsdFriendLog(SociaFriendYgsAddVo vo, String type, String remark);
// 审核社保提交日志
TSocialSoldierLog getYgsSoldierAuditLog(SocialSoldierYgsAuditVo vo, String type, String remark);
// 审核医保提交日志
......
......@@ -139,6 +139,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private DoSocialTask socialTask;
private final TDispatchSocialFundInfoService infoService;
private final TSocialFreindSetService tSocialFreindSetService;
@Autowired
private ExcelMergeImage excelMergeImage;
@Autowired
......@@ -3739,7 +3740,16 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
baseMapper.updateById(dis);
socialFundMapper.updateById(sf);
if (isAuto) {
socialTask.pushSoldier(dis.getId());
TSocialFreindSet set = tSocialFreindSetService.getById("1");
// 是否推送税友,默认不是,推送到士兵
boolean isFriend = false;
// 当前默认 安徽省 才可以税友推送办理
String provinceId = "12";
if (Common.isNotNull(dis.getSocialProvince()) && provinceId.equals(dis.getSocialProvince())
&& set != null && Common.isNotNull(set.getType()) && set.getType() == 1) {
isFriend = true;
}
socialTask.pushSoldier(dis.getId(), isFriend);
}
//派减的申请审核完更新社保公积金查询快照表
......
......@@ -494,4 +494,33 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
}
return setMap;
}
@Override
public Map<String, TSocialDeadlineInfo> getSocialSetByAreaId() {
Map<String, TSocialDeadlineInfo> setMap = new HashMap<>();
List<TSocialDeadlineInfo> setlist = baseMapper.selectList(Wrappers.<TSocialDeadlineInfo>query().lambda()
.eq(TSocialDeadlineInfo::getMonth, DateUtil.getThisMonth())
.eq(TSocialDeadlineInfo::getStatus, CommonConstants.ZERO_STRING));
if (setlist != null && !setlist.isEmpty()) {
StringBuilder addressKey;
for (TSocialDeadlineInfo socialSet : setlist) {
if (Common.isNotNull(socialSet.getProvince())) {
addressKey = new StringBuilder(socialSet.getProvince()).append(CommonConstants.DOWN_LINE_STRING);
if (Common.isEmpty(socialSet.getCity())) {
addressKey.append(CommonConstants.CENTER_SPLIT_LINE_STRING);
} else {
addressKey.append(socialSet.getCity());
}
addressKey.append(CommonConstants.DOWN_LINE_STRING);
if (Common.isEmpty(socialSet.getTown())) {
addressKey.append(CommonConstants.CENTER_SPLIT_LINE_STRING);
} else {
addressKey.append(socialSet.getTown());
}
setMap.put(addressKey.toString(), socialSet);
}
}
}
return setMap;
}
}
/*
* 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.social.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindSet;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFreindSetMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFreindSetService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
/**
* 社保士兵与税友切换表
*
* @author hgw
* @date 2024-12-12 09:40:56
*/
@Log4j2
@Service
public class TSocialFreindSetServiceImpl extends ServiceImpl<TSocialFreindSetMapper, TSocialFreindSet> implements TSocialFreindSetService {
}
/*
* 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.social.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendBackLogMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendBackLogService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
/**
* 社保士兵返回的数据记录表
*
* @author hgw
* @date 2024-12-12 09:40:55
*/
@Log4j2
@Service
public class TSocialFriendBackLogServiceImpl extends ServiceImpl<TSocialFriendBackLogMapper, TSocialFriendBackLog> implements TSocialFriendBackLogService {
}
......@@ -16,9 +16,6 @@
*/
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -27,24 +24,19 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialConfig;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialFriendConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialDeadlineInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierShenBaoTask;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import com.yifu.cloud.plus.v1.yifu.social.vo.SociaFriendYgsAddVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -62,178 +54,46 @@ import java.util.Map;
public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMapper, TSocialInfo> implements TSocialFriendPushService {
private RestTemplate restTemplate = new RestTemplate();
private final SocialConfig socialConfig;
private final SocialFriendConfig socialFriendConfig;
private final TSocialInfoService tSocialInfoService;
private final TSocialSoldierShenBaoTaskService tSocialSoldierShenBaoTaskService;
private final TSocialDeadlineInfoService tSocialDeadlineInfoService;
private final TSocialSoldierLogService tSocialSoldierLogService;
private final TSocialFriendBackLogService tSocialFriendBackLogService;
private final TDispatchInfoService tDispatchInfoService;
/**
* @Description: 推送到税友
* @Author: hgw
* @Date: 2024/5/10 17:53
* @Date: 2024-12-12 10:03:59
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> pushFriendTest(List<String> dispatchIdList) {
String thisTime = DateUtil.getThisTime();
// type 1社保增 2社保减 3医保增 4医保减
int type = 1;
SociaFriendYgsAddVo vo = new SociaFriendYgsAddVo();
String id = socialFriendConfig.pushFriendByInfo(restTemplate, vo, type, thisTime);
return R.ok(id);
}
/**
* @Description: 获取结果税友
* @Author: hgw
* @Date: 2024/5/10 17:53
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<FriendResult> getFriendByRequestIdTest(List<String> dispatchIdList) {
FriendResult info = socialFriendConfig.getFriendByRequestId(restTemplate, "15074c814b4240a19cdb4425a7ae502c");
return R.ok(info);
}
/**
* @param socialList
* @param file
* @param type
* @Description: 推送到社保士兵,更新社保表的任务id与状态
* @Author: hgw
* @Date: 2024/5/11 15:24
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> getOneAppGetModuleDetail(List<TSocialInfo> socialList, MultipartFile file, String type) {
// 1获取模板id——社保增员、社保减员、医保增员、医保减员
Map<String, String> moduleDetailMap = socialConfig.getOneModuleDetailMap(restTemplate);
if (moduleDetailMap != null && !moduleDetailMap.isEmpty() && moduleDetailMap.get(type) != null) {
// 2获取机器id
String terminalId = socialConfig.getTwoTerminalId(restTemplate, moduleDetailMap.get(type));
if (Common.isNotNull(terminalId)) {
// 3上传文件,获取文件地址
String fileAddUrl = socialConfig.getThreeTerminalId(restTemplate, file);
// 4 推送办理任务,返回任务id:
String addId = socialConfig.getFourAppAdd(restTemplate, fileAddUrl, moduleDetailMap.get(type), terminalId);
for (TSocialInfo socialInfo : socialList) {
if ("社保增员".equals(type) || "社保减员".equals(type)) {
socialInfo.setYgsAddId(addId);
socialInfo.setYgsHandleStatus(CommonConstants.TWO_STRING);
} else {
socialInfo.setYsdAddId(addId);
socialInfo.setYsdHandleStatus(CommonConstants.TWO_STRING);
}
}
tSocialInfoService.updateBatchById(socialList);
}
}
return R.ok("推送成功!");
}
/**
* @Description: 组装社保与医保的文件流
* @Author: hgw
* @Date: 2024/5/23 17:59
* @return: org.springframework.web.multipart.MultipartFile
**/
public MultipartFile getFileYgs(List<SocialSoldierYgsAddVo> list) {
if (list != null) {
String fileName = "soldierFileYgs" + DateUtil.getThisTime() + new Date().getTime() + CommonConstants.XLSX;
ExcelWriter excelWriter = EasyExcelFactory.write(fileName).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("社保明细").head(SocialSoldierYgsAddVo.class).build();
excelWriter.write(list, writeSheet);
File file = new File(fileName);
excelWriter.finish();
return getMultipartFile(file);
}
return null;
}
/**
* @Description: 组装社保与医保的文件流
* @Author: hgw
* @Date: 2024/5/23 17:59
* @return: org.springframework.web.multipart.MultipartFile
**/
public MultipartFile getFileYsd(List<SocialSoldierYsdAddVo> list) {
if (list != null) {
String fileName = "soldierFileYsd" + DateUtil.getThisTime() + new Date().getTime() + CommonConstants.XLSX;
ExcelWriter excelWriter = EasyExcelFactory.write(fileName).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("医保明细").head(SocialSoldierYsdAddVo.class).build();
excelWriter.write(list, writeSheet);
File file = new File(fileName);
excelWriter.finish();
return getMultipartFile(file);
}
return null;
}
public static MultipartFile getMultipartFile(File file) {
FileItem item = new DiskFileItemFactory().createItem("file", MediaType.MULTIPART_FORM_DATA_VALUE, true, file.getName());
try (InputStream input = new FileInputStream(file); OutputStream os = item.getOutputStream()) {
// 流转移
IOUtils.copy(input, os);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid file: " + e, e);
} finally {
//删除临时文件
try {
org.apache.commons.io.FileUtils.forceDelete(file);
} catch (IOException e) {
e.printStackTrace();
}
}
return new CommonsMultipartFile(item);
}
/**
* @Description: 推送到社保士兵
* @Author: hgw
* @Date: 2024/5/10 17:53
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> pushSoldier(List<String> dispatchIdList) {
public R<String> pushFriend(List<String> dispatchIdList) {
// 获取时间限制配置(获取 当月启用 的配置)
Map<String, TSocialDeadlineInfo> socialsetMap = tSocialDeadlineInfoService.getSocialSet();
Map<String, TSocialDeadlineInfo> socialSetMap = tSocialDeadlineInfoService.getSocialSetByAreaId();
// 社保增员、社保减员、医保增员、医保减员
// 养工失新增列表
List<SocialSoldierYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList);
List<SociaFriendYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList);
if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
this.doPushSocialAndLogYgs(socialsetMap, ygsAddlist, "社保增员");
this.doPushSocialAndLogYgs(socialSetMap, ygsAddlist, 1);
}
// 养工失减少列表
List<SocialSoldierYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList);
List<SociaFriendYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList);
if (ygsReducelist != null && !ygsReducelist.isEmpty()) {
this.doPushSocialAndLogYgs(socialsetMap, ygsReducelist, "社保减员");
this.doPushSocialAndLogYgs(socialSetMap, ygsReducelist, 2);
}
// 医生大新增列表
List<SocialSoldierYsdAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList);
List<SociaFriendYgsAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList);
if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
this.doPushSocialAndLogYsd(socialsetMap, ysdAddlist, "医保增员");
this.doPushSocialAndLogYsd(socialSetMap, ysdAddlist, 3);
}
// 医生大减少列表
List<SocialSoldierYsdAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList);
List<SociaFriendYgsAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList);
if (ysdReducelist != null && !ysdReducelist.isEmpty()) {
this.doPushSocialAndLogYsd(socialsetMap, ysdReducelist, "医保减员");
this.doPushSocialAndLogYsd(socialSetMap, ysdReducelist, 4);
}
if ((ygsAddlist == null || ygsAddlist.isEmpty())
&& (ygsReducelist == null || ygsReducelist.isEmpty())
......@@ -251,27 +111,50 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
* @Date: 2024/9/2 17:21
* @return: void
**/
private void doPushSocialAndLogYgs(Map<String, TSocialDeadlineInfo> socialsetMap
, List<SocialSoldierYgsAddVo> ygsAddlist, String socialType) {
List<TSocialInfo> socialIdList = new ArrayList<>();
private void doPushSocialAndLogYgs(Map<String, TSocialDeadlineInfo> socialSetMap
, List<SociaFriendYgsAddVo> ygsAddlist, int type) {
int canPushType;
TSocialInfo socialInfo;
List<SocialSoldierYgsAddVo> ygsAddlistCopy = new ArrayList<>();
String type = "提交";
String typeStr = "提交";
List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog;
String remark;
List<TSocialInfo> renGongList = new ArrayList<>();
for (SocialSoldierYgsAddVo vo : ygsAddlist) {
String requestId;
String thisTime = DateUtil.getThisTime();
List<TSocialFriendBackLog> backLogList = new ArrayList<>();
TSocialFriendBackLog backLog;
R<URL> urlR;
for (SociaFriendYgsAddVo vo : ygsAddlist) {
// 0:未到时间不动; 1:推送; 2:转人工
canPushType = this.getCanPushType(socialsetMap, vo);
canPushType = this.getCanPushType(socialSetMap, vo);
if (1 == canPushType) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
ygsAddlistCopy.add(vo);
remark = "已推送提交任务!";
try {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
backLog = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId());
// 房工接口,获取 企业职工社会保险增员花名册 url
urlR = tDispatchInfoService.doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode());
if (urlR != null && urlR.getCode()==200 && Common.isNotNull(urlR.getData())) {
vo.setQyzgshbxzyhmc(urlR.getData().toString());
}
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, type, thisTime, backLog);
if (Common.isEmpty(requestId)) {
socialInfo.setYgsRequestId("推送税友失败");
socialInfo.setYgsHandleStatus(CommonConstants.FIVE_STRING);
remark = "推送税友失败,转人工处理!";
} else {
backLog.setRequestId(requestId);
socialInfo.setYgsRequestId(requestId);
socialInfo.setYgsHandleStatus(CommonConstants.TWO_STRING);
remark = "已推送提交任务!";
}
backLogList.add(backLog);
tSocialInfoService.updateById(socialInfo);
} catch (Exception e) {
remark = "提交社保士兵异常!";
}
} else {
if (0 == canPushType) {
remark = "未到时间,不推送!";
......@@ -283,34 +166,21 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
renGongList.add(socialInfo);
}
}
socialLog = tSocialSoldierLogService.getYgsSoldierLog(vo, type, remark);
socialLog = tSocialSoldierLogService.getYgsFriendLog(vo, typeStr, remark);
if (socialLog != null) {
logList.add(socialLog);
}
}
if (!backLogList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(backLogList);
}
if (!renGongList.isEmpty()) {
tSocialInfoService.updateBatchById(renGongList);
}
if (!logList.isEmpty()) {
tSocialSoldierLogService.saveBatch(logList);
}
// 3如果没有要办理的数据,就不需要推送
if (!socialIdList.isEmpty()) {
try {
MultipartFile file = this.getFileYgs(ygsAddlistCopy);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, socialType);
}
} catch (Exception e) {
log.error("提交社保士兵异常2:", e);
if (!logList.isEmpty()) {
for (TSocialSoldierLog logTemp : logList) {
logTemp.setRemark("提交社保士兵异常!");
}
tSocialSoldierLogService.updateBatchById(logList);
}
}
}
}
/**
......@@ -319,27 +189,50 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
* @Date: 2024/9/2 17:21
* @return: void
**/
private void doPushSocialAndLogYsd(Map<String, TSocialDeadlineInfo> socialsetMap
, List<SocialSoldierYsdAddVo> ysdAddlist, String socialType) {
List<TSocialInfo> socialIdList = new ArrayList<>();
private void doPushSocialAndLogYsd(Map<String, TSocialDeadlineInfo> socialSetMap
, List<SociaFriendYgsAddVo> ysdAddlist, int type) {
int canPushType;
TSocialInfo socialInfo;
List<SocialSoldierYsdAddVo> ysdAddlistCopy = new ArrayList<>();
String type = "提交";
String typeStr = "提交";
List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog;
List<TSocialInfo> renGongList = new ArrayList<>();
String remark;
for (SocialSoldierYsdAddVo vo : ysdAddlist) {
String requestId;
String thisTime = DateUtil.getThisTime();
List<TSocialFriendBackLog> backLogList = new ArrayList<>();
TSocialFriendBackLog backLog;
R<URL> urlR;
for (SociaFriendYgsAddVo vo : ysdAddlist) {
// 0:未到时间不动; 1:推送; 2:转人工
canPushType = this.getCanPushTypeYsd(socialsetMap, vo);
canPushType = this.getCanPushTypeYsd(socialSetMap, vo);
if (1 == canPushType) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
ysdAddlistCopy.add(vo);
remark = "已推送提交任务!";
try {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
backLog = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId());
// 房工接口,获取 企业职工基本医疗保险参保登记表 url
urlR = tDispatchInfoService.doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode());
if (urlR != null && urlR.getCode()==200 && Common.isNotNull(urlR.getData())) {
vo.setQyzgjbylbxcbdjb(urlR.getData().toString());
}
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, type, thisTime, backLog);
if (Common.isEmpty(requestId)) {
socialInfo.setYsdRequestId("推送税友失败");
socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING);
remark = "推送税友失败,转人工处理!";
} else {
backLog.setRequestId(requestId);
socialInfo.setYsdRequestId(requestId);
socialInfo.setYsdHandleStatus(CommonConstants.TWO_STRING);
remark = "已推送提交任务!";
}
backLogList.add(backLog);
tSocialInfoService.updateById(socialInfo);
} catch (Exception e) {
remark = "提交社保士兵异常!";
}
} else {
if (0 == canPushType) {
remark = "未到时间,不推送!";
......@@ -351,48 +244,34 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
renGongList.add(socialInfo);
}
}
socialLog = tSocialSoldierLogService.getYsdSoldierLog(vo, type, remark);
socialLog = tSocialSoldierLogService.getYsdFriendLog(vo, typeStr, remark);
if (socialLog != null) {
logList.add(socialLog);
}
}
if (!backLogList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(backLogList);
}
if (!renGongList.isEmpty()) {
tSocialInfoService.updateBatchById(renGongList);
}
if (!logList.isEmpty()) {
tSocialSoldierLogService.saveBatch(logList);
}
// 3如果没有要办理的数据,就不需要推送
if (!socialIdList.isEmpty()) {
try {
MultipartFile file = this.getFileYsd(ysdAddlistCopy);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, socialType);
}
} catch (Exception e) {
log.error("提交社保士兵异常1:", e);
if (!logList.isEmpty()) {
for (TSocialSoldierLog logTemp : logList) {
logTemp.setRemark("提交社保士兵异常!");
}
tSocialSoldierLogService.updateBatchById(logList);
}
}
}
}
/**
* @param socialsetMap 时间限制配置Map
* @param socialSetMap 时间限制配置Map
* @param vo 社保或医保
* @Description:
* @Author: hgw
* @Date: 2024/9/2 16:00
* @return: int
**/
private int getCanPushType(Map<String, TSocialDeadlineInfo> socialsetMap, SocialSoldierYgsAddVo vo) {
private int getCanPushType(Map<String, TSocialDeadlineInfo> socialSetMap, SociaFriendYgsAddVo vo) {
// 0:未到时间不动; 1:推送; 2:转人工
int canPushType = 0;
if (socialsetMap != null) {
if (socialSetMap != null) {
TSocialDeadlineInfo socialSet;
StringBuilder addressKey;
Date nowTime = new Date();
......@@ -409,7 +288,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
} else {
addressKey.append(vo.getSocialTown());
}
socialSet = socialsetMap.get(addressKey.toString());
socialSet = socialSetMap.get(addressKey.toString());
if (socialSet != null) {
Date start = socialSet.getSocialStartDate();
......@@ -442,10 +321,10 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
return canPushType;
}
private int getCanPushTypeYsd(Map<String, TSocialDeadlineInfo> socialsetMap, SocialSoldierYsdAddVo vo) {
private int getCanPushTypeYsd(Map<String, TSocialDeadlineInfo> socialSetMap, SociaFriendYgsAddVo vo) {
// 0:未到时间不动; 1:推送; 2:转人工
int canPushType = 0;
if (socialsetMap != null) {
if (socialSetMap != null) {
TSocialDeadlineInfo socialSet;
StringBuilder addressKey;
Date nowTime = new Date();
......@@ -462,7 +341,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
} else {
addressKey.append(vo.getSocialTown());
}
socialSet = socialsetMap.get(addressKey.toString());
socialSet = socialSetMap.get(addressKey.toString());
if (socialSet != null) {
Date start = socialSet.getMedicalStartDate();
......@@ -495,228 +374,4 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
return canPushType;
}
/**
* @Description: 推送社保士兵审核结果查询文件
* @Author: hgw
* @Date: 2024-5-23 18:02:27
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> pushSoldierByAudit() {
// 养工失待审核列表
List<SocialSoldierYgsAuditVo> ygsAddlist = baseMapper.getSocialSoldierYgsAuditVoList();
List<SocialSoldierYgsAuditVo> ygsAddByGroupBylist = baseMapper.getSocialSoldierYgsAuditVoListByGroupBy();
String sheetName = "审核数据查询";
String type = "审核";
String remark = "已推送审核任务!";
String errorRemark = "推送社保士兵审核异常!";
TSocialSoldierLog socialLog;
List<TSocialSoldierLog> logList = new ArrayList<>();
if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
MultipartFile file = this.getFileByAudit(ygsAddByGroupBylist, null, sheetName);
if (Common.isNotNull(file)) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYgsAuditVo vo : ygsAddlist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
// 组装日志
socialLog = tSocialSoldierLogService.getYgsSoldierAuditLog(vo, type, remark);
if (socialLog != null) {
logList.add(socialLog);
}
}
// 保存
if (!logList.isEmpty()) {
tSocialSoldierLogService.saveBatch(logList);
}
try {
this.getOneAppGetModuleDetailByAudit(socialIdList, file, sheetName);
} catch (Exception e) {
log.error(errorRemark + "2:", e);
if (!logList.isEmpty()) {
// 异常时,更新日志
for (TSocialSoldierLog logTemp : logList) {
logTemp.setRemark(errorRemark);
}
tSocialSoldierLogService.updateBatchById(logList);
}
}
}
}
// 医生大【续保】待审核列表
List<SocialSoldierYsdAuditVo> ysdXuBaolist = baseMapper.getSocialSoldierYsdAuditVoList();
List<SocialSoldierYsdAuditVo> ysdXuBaoByGroupBylist = baseMapper.getSocialSoldierYsdAuditVoListByGroupBy();
sheetName = "审核数据信息查询";
logList = new ArrayList<>();
if (ysdXuBaolist != null && !ysdXuBaolist.isEmpty()) {
MultipartFile file = this.getFileByAudit(null, ysdXuBaoByGroupBylist, sheetName);
if (Common.isNotNull(file)) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYsdAuditVo vo : ysdXuBaolist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
// 组装日志
socialLog = tSocialSoldierLogService.getYsdSoldierAuditLog(vo, type, remark);
if (socialLog != null) {
logList.add(socialLog);
}
}
// 保存
if (!logList.isEmpty()) {
tSocialSoldierLogService.saveBatch(logList);
}
try {
this.getOneAppGetModuleDetailByAudit(socialIdList, file, sheetName);
} catch (Exception e) {
log.error(errorRemark + "1:", e);
if (!logList.isEmpty()) {
// 异常时,更新日志
for (TSocialSoldierLog logTemp : logList) {
logTemp.setRemark(errorRemark);
}
tSocialSoldierLogService.updateBatchById(logList);
}
}
}
}
// 医生大【新增】待审核列表
List<SocialSoldierYsdAuditVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddAuditVoList();
List<SocialSoldierYsdAuditVo> ysdAddByGroupBylist = baseMapper.getSocialSoldierYsdAddAuditVoListByGroupBy();
logList = new ArrayList<>();
if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
MultipartFile file = this.getFileByAudit(null, ysdAddByGroupBylist, sheetName);
if (Common.isNotNull(file)) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYsdAuditVo vo : ysdAddlist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
// 组装日志
socialLog = tSocialSoldierLogService.getYsdSoldierAuditLog(vo, type, remark);
if (socialLog != null) {
logList.add(socialLog);
}
}
// 保存
if (!logList.isEmpty()) {
tSocialSoldierLogService.saveBatch(logList);
}
try {
this.getOneAppGetModuleDetailByAudit(socialIdList, file, sheetName);
} catch (Exception e) {
log.error(errorRemark + "3:", e);
if (!logList.isEmpty()) {
// 异常时,更新日志
for (TSocialSoldierLog logTemp : logList) {
logTemp.setRemark(errorRemark);
}
tSocialSoldierLogService.updateBatchById(logList);
}
}
}
}
if (ygsAddlist == null && ysdXuBaolist == null && ysdAddlist == null) {
return R.failed("无数据,推送结束!");
}
return R.ok("推送成功!!");
}
/**
* @Description: 推送审核结果的查询
* @Author: hgw
* @Date: 2024/5/23 18:09
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
public R<String> getOneAppGetModuleDetailByShenBao(TSocialSoldierShenBaoTask task, MultipartFile file, String type) {
// 1获取模板id——社保增员、社保减员、医保增员、医保减员
Map<String, String> moduleDetailMap = socialConfig.getOneModuleDetailMap(restTemplate);
if (moduleDetailMap != null && !moduleDetailMap.isEmpty() && moduleDetailMap.get(type) != null) {
// 2获取机器id
String terminalId = socialConfig.getTwoTerminalId(restTemplate, moduleDetailMap.get(type));
if (Common.isNotNull(terminalId)) {
// 3上传文件,获取文件地址
String fileAddUrl = socialConfig.getThreeTerminalId(restTemplate, file);
// 4 推送办理任务,返回任务id:
String addId = socialConfig.getFourAppAdd(restTemplate, fileAddUrl, moduleDetailMap.get(type), terminalId);
task.setAddId(addId);
tSocialSoldierShenBaoTaskService.save(task);
}
}
return R.ok("推送成功!");
}
/**
* @Description: 推送审核结果的查询
* @Author: hgw
* @Date: 2024/5/23 18:09
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
public R<String> getOneAppGetModuleDetailByAudit(List<TSocialInfo> socialList, MultipartFile file, String type) {
// 1获取模板id——社保增员、社保减员、医保增员、医保减员
Map<String, String> moduleDetailMap = socialConfig.getOneModuleDetailMap(restTemplate);
if (moduleDetailMap != null && !moduleDetailMap.isEmpty() && moduleDetailMap.get(type) != null) {
// 2获取机器id
String terminalId = socialConfig.getTwoTerminalId(restTemplate, moduleDetailMap.get(type));
if (Common.isNotNull(terminalId)) {
// 3上传文件,获取文件地址
String fileAddUrl = socialConfig.getThreeTerminalId(restTemplate, file);
// 4 推送办理任务,返回任务id:
String addId = socialConfig.getFourAppAdd(restTemplate, fileAddUrl, moduleDetailMap.get(type), terminalId);
for (TSocialInfo socialInfo : socialList) {
if ("审核数据查询".equals(type)) {
socialInfo.setYgsAddId(addId);
} else {
socialInfo.setYsdAddId(addId);
}
}
tSocialInfoService.updateBatchById(socialList);
}
}
return R.ok("推送成功!");
}
/**
* @Description: 组装社保与医保的文件流
* @Author: hgw
* @Date: 2024/5/23 17:59
* @return: org.springframework.web.multipart.MultipartFile
**/
public MultipartFile getFile(List list, Class clazz, String sheetName) {
String fileName = "soldierFile" + DateUtil.getThisTime() + new Date().getTime() + CommonConstants.XLSX;
if (list != null) {
EasyExcelFactory.write(fileName, clazz).sheet(sheetName).doWrite(list);
File file = new File(fileName);
return getMultipartFile(file);
}
return null;
}
/**
* @Description: 组装社保与医保的文件流
* @Author: hgw
* @Date: 2024/5/23 17:59
* @return: org.springframework.web.multipart.MultipartFile
**/
public MultipartFile getFileByAudit(List<SocialSoldierYgsAuditVo> listYgs, List<SocialSoldierYsdAuditVo> listYsd, String sheetName) {
String fileName = "soldierAuditFile" + DateUtil.getThisTime() + new Date().getTime() + CommonConstants.XLSX;
if (listYgs != null) {
EasyExcelFactory.write(fileName, SocialSoldierYgsAuditVo.class).sheet(sheetName).doWrite(listYgs);
} else {
EasyExcelFactory.write(fileName, SocialSoldierYsdAuditVo.class).sheet(sheetName).doWrite(listYsd);
}
File file = new File(fileName);
return getMultipartFile(file);
}
}
......@@ -17,7 +17,6 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.CharsetUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
......@@ -25,43 +24,22 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
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.YifuUser;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.FailReasonConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.TAuditInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialFriendConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierReturnAuditErrorVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierReturnErrorVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
* 社保士兵
* 税友
*
* @author hgw
* @date 2024-5-8 14:55:36
......@@ -72,645 +50,93 @@ import java.util.zip.ZipInputStream;
public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, TSocialInfo> implements TSocialFriendService {
private RestTemplate restTemplate = new RestTemplate();
private final SocialConfig socialConfig;
private final SocialFriendConfig socialFriendConfig;
private final TDispatchInfoService tDispatchInfoService;
private final TSocialInfoService tSocialInfoService;
private final FailReasonConfigService failReasonConfigService;
private final TAuditInfoService tAuditInfoService;
private final TSocialSoldierLogService tSocialSoldierLogService;
// 附件
private final String RESULT_ANNEX = "resultAnnex";
/**
* 根据路径删除指定的目录或文件,无论存在与否
*
* @param path 要删除的目录或文件路径
* @return 删除成功返回 true,否则返回 false
*/
public static void deleteFolder(String path) {
File file = new File(path);
// 判断目录或文件是否存在
if (file.exists()) {
// 判断是否为文件
if (file.isFile()) { // 为文件时调用删除文件方法
deleteFile(path);
} else { // 为目录时调用删除目录方法
deleteDirectory(path);
}
}
}
/**
* 删除单个文件
*/
private static boolean deleteFile(String path) {
File file = new File(path);
// 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) {
file.delete();
return true;
}
return false;
}
/**
* 删除目录(文件夹)以及目录下的文件
*/
private static boolean deleteDirectory(String path) {
//如果path不以文件分隔符结尾,自动添加文件分隔符
if (!path.endsWith(File.separator)) {
path = path + File.separator;
}
File dirFile = new File(path);
//如果dir对应的文件不存在,或者不是一个目录,则退出
if (!dirFile.exists() || !dirFile.isDirectory()) {
return false;
}
boolean flag = true;
//删除文件夹下的所有文件(包括子目录)
File[] files = dirFile.listFiles();
for (File file : files) {
//删除子文件
if (file.isFile()) {
flag = deleteFile(file.getAbsolutePath());
} //删除子目录
else {
flag = deleteDirectory(file.getAbsolutePath());
}
if (!flag) {
break;
}
}
if (!flag) {
return false;
}
//删除当前目录
return dirFile.delete();
}
private BigDecimal getBigDecimal(String paymentBase) {
if (paymentBase.contains(",")) {
paymentBase = paymentBase.replace(",", "");
}
try {
return new BigDecimal(paymentBase);
} catch (Exception e) {
log.error("社保士兵的文件里有错误的数字,需要调整代码:" + paymentBase);
return new BigDecimal("-1");
}
}
/**
* @Description: 解码URL
* @Author: hgw
* @Date: 2024/6/3 11:01
* @return: java.lang.String
**/
private String getEncodeUrl(String fileTeturnUrl) {
String dowloadUrl = fileTeturnUrl;
int indexOf = fileTeturnUrl.lastIndexOf("/") + 1;
fileTeturnUrl = fileTeturnUrl.substring(indexOf);
try {
fileTeturnUrl = URLEncoder.encode(fileTeturnUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
log.info("编码异常!");
}
dowloadUrl = dowloadUrl.substring(0, indexOf) + fileTeturnUrl;
return dowloadUrl;
}
/**
* @Description: 6 查看社保士兵审核结果查询的反馈情况
* @Author: hgw
* @Date: 2024/5/11 15:08
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> getSixJobByAudit() {
// 获取所有需要反馈的任务id
// 社保 type 1:社保;2:医保
List<TSocialInfo> socialList = tSocialInfoService.getSocialSoldierYgsByAudit();
if (socialList != null && !socialList.isEmpty()) {
this.doAuditCoreByType(socialList, CommonConstants.ONE_INT);
}
// 医保
List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialSoldierYsdByAudit();
if (socialYsdList != null && !socialYsdList.isEmpty()) {
this.doAuditCoreByType(socialYsdList, CommonConstants.TWO_INT);
}
return R.ok();
}
/**
* @param socialList
* @param type 1:社保;2:医保
* @Description: 整合社保与医保
* @Author: hgw
* @Date: 2024/8/16 17:43
* @return: void
**/
private void doAuditCoreByType(List<TSocialInfo> socialList, int type) {
Map<String, TSocialInfo> idCardMap = new HashMap<>();
Set<String> addIdSet = new HashSet<>();
for (TSocialInfo socialInfo : socialList) {
if (type == 1 && Common.isNotNull(socialInfo.getYgsAddId())) {
addIdSet.add(socialInfo.getYgsAddId());
idCardMap.put(socialInfo.getYgsAddId() + CommonConstants.DOWN_LINE_STRING + socialInfo.getEmpIdcard(), socialInfo);
} else if (type == 2 && Common.isNotNull(socialInfo.getYsdAddId())) {
addIdSet.add(socialInfo.getYsdAddId());
idCardMap.put(socialInfo.getYsdAddId() + CommonConstants.DOWN_LINE_STRING + socialInfo.getEmpIdcard(), socialInfo);
}
}
HttpURLConnection conn;
InputStream in = null;
Map<String, FailReasonConfig> errorMap = failReasonConfigService.getFailReasonMap();
if (!addIdSet.isEmpty()) {
for (String doAddId : addIdSet) {
R<String> resultFile = socialConfig.getFiveJob(restTemplate, doAddId, RESULT_ANNEX);
log.info("resultFileByAudit=" + resultFile);
try {
// 解决中文文件名的乱码问题
String fileTeturnUrl = resultFile.getData();
if (Common.isNotNull(fileTeturnUrl)) {
fileTeturnUrl = this.getEncodeUrl(fileTeturnUrl);
URL url = new URL(fileTeturnUrl);
conn = (HttpURLConnection) url.openConnection();
//设置超时间为30秒
conn.setConnectTimeout(30 * 1000);
in = conn.getInputStream();
// 实际读取文件内容
this.readZip(in, idCardMap, errorMap, doAddId, type);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
}
public R<List<TSocialSoldierReturnAuditErrorVo>> readZip(InputStream inputStream, Map<String, TSocialInfo> idCardMap
, Map<String, FailReasonConfig> errorMap, String doAddId, int type) {
TSocialSoldierReturnAuditErrorVo vo;
List<TSocialSoldierReturnAuditErrorVo> voList = new ArrayList<>();
XSSFWorkbook sheets = null;
ZipInputStream zin = null;
BufferedInputStream bs = null;
try {
zin = new ZipInputStream(inputStream, CharsetUtil.CHARSET_GBK);
bs = new BufferedInputStream(zin);
byte[] bytes;
ZipEntry ze;
//循环读取压缩包里面的文件
while ((ze = zin.getNextEntry()) != null) {
String name = ze.getName();
if ((ze.toString().endsWith(".xls") || ze.toString().endsWith(".xlsx")) && Common.isNotNull(name) && name.contains("汇总")) {
//读取每个文件的字节,并放进数组
bytes = new byte[(int) ze.getSize()];
bs.read(bytes, 0, (int) ze.getSize());
//将文件转成流
InputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
sheets = new XSSFWorkbook(byteArrayInputStream);
// sheet
XSSFSheet sheetAt = sheets.getSheetAt(0);
XSSFRow row;
// 每个单元格内容
String cellValue;
XSSFCell cell;
// 循环每个sheet
if (sheetAt != null && Common.isNotNull(sheetAt.getSheetName())) {
// 错误信息 所在列
Integer errorInfoNum = null;
// 企业名称 所在列
Integer companyNameNum = null;
// 证件号码 所在列
Integer idCardNum = null;
// 姓名 所在列
Integer empNameNum = null;
// 审核状态 所在列
Integer auditStatusNum = null;
// 审核意见 所在列
Integer ysdRemarkNum = null;
// 操作 所在列
Integer ygsOperationNum = null;
// 错误信息
String errorInfo;
// 企业名称
String companyName;
// 证件号码
String idCard;
// 姓名
String empName;
// 审核状态 : // 空、待审核、撤回或作废数据、审核不通过、审核通过
String auditStatus;
// 审核意见
String ysdRemark;
// 操作
String ygsOperation;
for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) {
row = sheetAt.getRow(rowNum);
if (row != null) {
// 初始化
ysdRemark = null;
ygsOperation = null;
// 循环当前行的内容
if (rowNum == 0) {
for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) {
// 标题行
cellValue = this.getCellValue(row, cellNum);
if ("错误信息".equals(cellValue)) {
errorInfoNum = cellNum;
} else if ("企业名称".equals(cellValue)) {
companyNameNum = cellNum;
} else if ("证件号码".equals(cellValue)) {
idCardNum = cellNum;
} else if ("姓名".equals(cellValue)) {
empNameNum = cellNum;
} else if ("审核状态".equals(cellValue)) {
auditStatusNum = cellNum;
} else if ("审核意见".equals(cellValue)) {
// 医保
ysdRemarkNum = cellNum;
} else if ("操作".equals(cellValue)) {
// 社保
ygsOperationNum = cellNum;
}
}
} else {
if (Common.isEmpty(auditStatusNum) && Common.isEmpty(idCardNum)) {
return R.failed("未找到对应表头!");
} else {
if (Common.isNotNull(errorInfoNum)) {
errorInfo = getCellValue(row, errorInfoNum);
vo = new TSocialSoldierReturnAuditErrorVo();
vo.setErrorInfo(errorInfo);
voList.add(vo);
return R.failed("数据错误!!");
} else {
if (Common.isNotNull(idCardNum) && Common.isNotNull(companyNameNum)
&& Common.isNotNull(empNameNum) && Common.isNotNull(auditStatusNum)) {
companyName = getCellValue(row, companyNameNum);
idCard = getCellValue(row, idCardNum);
empName = getCellValue(row, empNameNum);
auditStatus = getCellValue(row, auditStatusNum);
if (Common.isNotNull(ysdRemarkNum)) {
ysdRemark = getCellValue(row, ysdRemarkNum);
}
if (Common.isNotNull(ygsOperationNum)) {
ygsOperation = getCellValue(row, ygsOperationNum);
}
vo = new TSocialSoldierReturnAuditErrorVo();
vo.setCompanyName(companyName);
vo.setIdCard(idCard);
vo.setEmpName(empName);
vo.setAuditStatus(auditStatus);
vo.setYsdRemark(ysdRemark);
vo.setYgsOperation(ygsOperation);
voList.add(vo);
}
}
}
}
}
}
}
}
}
zin.closeEntry();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
if (sheets != null) {
try {
sheets.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
} finally {
try {
if (sheets != null) {
sheets.close();
}
if (zin != null) {
zin.close();
}
if (bs != null) {
bs.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
if (!voList.isEmpty()) {
importTSocialSoldierByAudit(voList, idCardMap, errorMap, doAddId, type);
}
return R.ok(voList);
}
private final TSocialFriendBackLogService tSocialFriendBackLogService;
/**
* @param addId
* @Description: 5 查看任务进度
* @Author: hgw
* @Date: 2024/5/11 15:08
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> getFiveJob(String addId) {
List<TSocialInfo> socialList;
if (Common.isEmpty(addId)) {
// 获取所有需要反馈的任务id
socialList = tSocialInfoService.getSocialSoldierYgsAll();
List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialSoldierYsdAll();
if (socialYsdList != null && !socialYsdList.isEmpty()) {
if (socialList != null && !socialList.isEmpty()) {
socialList.addAll(socialYsdList);
} else {
socialList = socialYsdList;
}
}
} else {
socialList = tSocialInfoService.getSocialSoldierByAddId(addId);
}
public R<String> getInfoByRequestId() {
// true养工失 false 医生大
boolean typeFlag = true;
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
YifuUser user = new YifuUser("1", 1L, "", "税友",
"税友", "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null);
// 失败原因配置
Map<String, FailReasonConfig> errorMap = failReasonConfigService.getFailReasonMap();
// 获取所有需要反馈的任务id
List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll();
List<TSocialFriendBackLog> logList;
TSocialFriendBackLog backLog;
if (socialList != null && !socialList.isEmpty()) {
Map<String, TSocialInfo> idCardMap = new HashMap<>();
Set<String> addIdSet = new HashSet<>();
FriendResult info;
logList = new ArrayList<>();
for (TSocialInfo socialInfo : socialList) {
if (Common.isNotNull(socialInfo.getYgsAddId())) {
addIdSet.add(socialInfo.getYgsAddId());
idCardMap.put(socialInfo.getYgsAddId() + CommonConstants.DOWN_LINE_STRING + socialInfo.getEmpIdcard(), socialInfo);
}
if (Common.isNotNull(socialInfo.getYsdAddId())) {
addIdSet.add(socialInfo.getYsdAddId());
idCardMap.put(socialInfo.getYsdAddId() + CommonConstants.DOWN_LINE_STRING + socialInfo.getEmpIdcard(), socialInfo);
backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getId());
backLog.setRequestId(socialInfo.getYgsRequestId());
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId(), backLog);
logList.add(backLog);
if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap);
}
}
HttpURLConnection conn;
InputStream in = null;
Map<String, FailReasonConfig> errorMap = failReasonConfigService.getFailReasonMap();
if (!addIdSet.isEmpty()) {
for (String doAddId : addIdSet) {
R<String> resultFile = socialConfig.getFiveJob(restTemplate, doAddId, "resultFile");
log.info("resultFile=" + resultFile);
try {
// 解决中文文件名的乱码问题
String fileTeturnUrl = resultFile.getData();
if (Common.isNotNull(fileTeturnUrl)) {
fileTeturnUrl = this.getEncodeUrl(fileTeturnUrl);
URL url = new URL(fileTeturnUrl);
conn = (HttpURLConnection) url.openConnection();
//设置超时间为30秒
conn.setConnectTimeout(30 * 1000);
in = conn.getInputStream();
// 实际读取文件内容
this.readXls(in, idCardMap, errorMap, doAddId);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
if (!logList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(logList);
}
}
return R.ok();
}
public R<List<TSocialSoldierReturnErrorVo>> readXls(InputStream inputStream, Map<String, TSocialInfo> idCardMap
, Map<String, FailReasonConfig> errorMap, String doAddId) {
TSocialSoldierReturnErrorVo vo;
List<TSocialSoldierReturnErrorVo> voList = new ArrayList<>();
HSSFWorkbook sheets = null;
try {
sheets = new HSSFWorkbook(inputStream);
// sheet
HSSFSheet sheetAt = sheets.getSheetAt(0);
HSSFRow row;
// 每个单元格内容
String cellValue;
// 内容行
int dataRow;
HSSFCell cell;
// 循环每个sheet
if (sheetAt != null && Common.isNotNull(sheetAt.getSheetName())) {
// 初始化每个sheet的数据行
dataRow = 0;
// 错误信息 所在列
Integer errorInfoNum = null;
// 是否处理完成 所在列
Integer isDoCompletedNum = null;
// 是否成功 所在列
Integer isSuccessNum = null;
// 反馈结果 所在列
Integer msgNum = null;
// 身份证号码 所在列
Integer idCardNum = null;
// 证件号码 所在列
Integer empIdCardNum = null;
// 错误信息
String errorInfo = null;
// 是否处理完成
String isDoCompleted = null;
// 是否成功
String isSuccess = null;
// 反馈结果
String msg = null;
// 身份证号码
String idCard = null;
// 证件号码
String empIdCard = null;
for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) {
row = sheetAt.getRow(rowNum);
if (row != null) {
// 循环当前行的内容
if (rowNum == 0) {
for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) {
// 标题行
cell = row.getCell(cellNum);
cellValue = "";
try {
if (cell != null) {
if (CellType.STRING == cell.getCellType()) {
cellValue = row.getCell(cellNum).getStringCellValue();
} else if (CellType.NUMERIC == cell.getCellType()) {
cellValue = String.valueOf(row.getCell(cellNum).getNumericCellValue());
if (cellValue.contains("E")) {
cellValue = String.valueOf(new DecimalFormat("#").format(row.getCell(cellNum).getNumericCellValue()));
}
}
}
} catch (NumberFormatException e) {
cell.setCellType(CellType.STRING);
cellValue = String.valueOf(row.getCell(cellNum).getStringCellValue());
}
if ("错误信息".equals(cellValue)) {
errorInfoNum = cellNum;
} else if ("是否处理完成".equals(cellValue)) {
isDoCompletedNum = cellNum;
} else if ("是否成功".equals(cellValue)) {
isSuccessNum = cellNum;
} else if ("反馈结果".equals(cellValue)) {
msgNum = cellNum;
} else if ("身份证号码".equals(cellValue)) {
idCardNum = cellNum;
} else if ("证件号码".equals(cellValue)) {
empIdCardNum = cellNum;
}
}
} else {
if (Common.isEmpty(errorInfoNum) && Common.isEmpty(isDoCompletedNum)) {
return R.failed("未找到对应表头!");
} else {
if (Common.isNotNull(errorInfoNum)) {
errorInfo = getCellValue(row, errorInfoNum);
vo = new TSocialSoldierReturnErrorVo();
vo.setErrorInfo(errorInfo);
voList.add(vo);
return R.failed("数据错误!!");
} else {
if (Common.isNotNull(isDoCompletedNum) && Common.isNotNull(isSuccessNum)
&& Common.isNotNull(msgNum)) {
isDoCompleted = getCellValue(row, isDoCompletedNum);
isSuccess = getCellValue(row, isSuccessNum);
msg = getCellValue(row, msgNum);
if (Common.isNotNull(idCardNum)) {
idCard = getCellValue(row, idCardNum);
} else if (Common.isNotNull(empIdCardNum)) {
empIdCard = getCellValue(row, empIdCardNum);
}
vo = new TSocialSoldierReturnErrorVo();
vo.setIsDoCompleted(isDoCompleted);
vo.setIsSuccess(isSuccess);
vo.setMsg(msg);
vo.setIdCard(idCard);
vo.setEmpIdCard(empIdCard);
voList.add(vo);
}
}
}
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
if (sheets != null) {
try {
sheets.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
} finally {
if (sheets != null) {
try {
sheets.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
if (!voList.isEmpty()) {
importTSocialInfo(voList, idCardMap, errorMap, doAddId);
}
return R.ok(voList);
}
/**
* @Description: 获取单元格内容
* @Author: hgw
* @Date: 2024/5/13 16:34
* @return: java.lang.String
**/
private String getCellValue(HSSFRow row, int cellNum) {
HSSFCell cell = row.getCell(cellNum);
String cellValue = "";
try {
if (cell != null) {
if (CellType.STRING == cell.getCellType()) {
cellValue = row.getCell(cellNum).getStringCellValue();
} else if (CellType.NUMERIC == cell.getCellType()) {
cellValue = String.valueOf(row.getCell(cellNum).getNumericCellValue());
if (cellValue.contains("E")) {
cellValue = String.valueOf(new DecimalFormat("#").format(row.getCell(cellNum).getNumericCellValue()));
}
// 医保
typeFlag = false;
List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialFriendYsdAll();
if (socialYsdList != null && !socialYsdList.isEmpty()) {
FriendResult info;
logList = new ArrayList<>();
for (TSocialInfo socialInfo : socialYsdList) {
backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getId());
backLog.setRequestId(socialInfo.getYgsRequestId());
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYsdRequestId(), backLog);
logList.add(backLog);
if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap);
}
}
} catch (NumberFormatException e) {
cell.setCellType(CellType.STRING);
cellValue = String.valueOf(row.getCell(cellNum).getStringCellValue());
}
return cellValue;
}
private String getCellValue(XSSFRow row, int cellNum) {
XSSFCell cell = row.getCell(cellNum);
String cellValue = "";
try {
if (cell != null) {
if (CellType.STRING == cell.getCellType()) {
cellValue = row.getCell(cellNum).getStringCellValue();
} else if (CellType.NUMERIC == cell.getCellType()) {
cellValue = String.valueOf(row.getCell(cellNum).getNumericCellValue());
if (cellValue.contains("E")) {
cellValue = String.valueOf(new DecimalFormat("#").format(row.getCell(cellNum).getNumericCellValue()));
}
}
if (!logList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(logList);
}
} catch (NumberFormatException e) {
cell.setCellType(CellType.STRING);
cellValue = String.valueOf(row.getCell(cellNum).getStringCellValue());
}
return cellValue;
return R.ok();
}
/**
* @Description: 社保士兵审核结果的处理
* @Description: 核心信息
* @Author: hgw
* @Date: 2024/5/27 11:30
* @Date: 2024/12/12 17:46
* @return: void
**/
private void importTSocialSoldierByAudit(List<TSocialSoldierReturnAuditErrorVo> excelVOList, Map<String, TSocialInfo> idCardMap
, Map<String, FailReasonConfig> errorMap, String doAddId, int type) {
private void doCore(FriendResult info, TSocialInfo socialInfo, boolean typeFlag, YifuUser user
, Map<String, FailReasonConfig> errorMap) {
// 个性化校验逻辑
// 执行数据插入操作 组装
TSocialSoldierReturnAuditErrorVo excel;
String empIdCard;
String auditRemark;
TSocialInfo socialInfo;
List<TSocialInfo> updateSocialList = new ArrayList<>();
TSocialInfo updateSocial;
// true养工失 false 医生大
boolean typeFlag = true;
if (type == 2) {
typeFlag = false;
}
FailReasonConfig failConfig;
String auditRemark;
String ygsHandleStatus;
String ysdHandleStatus;
// 养工失办理成功的单子
......@@ -721,565 +147,197 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
List<String> ysdList = new ArrayList<>();
// 医生大办理失败的单子
List<String> ysdFailList = new ArrayList<>();
Map<String, TSocialInfo> socialMap = new HashMap<>();
// 处理社保办理成功后的状态同步-成功
String typeSub = CommonConstants.ZERO_STRING;
String handleStatus;
String title = null;
String title;
String handleRemark = null;
String remark = null;
String socialType;
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
YifuUser user = new YifuUser("1", 1L, "", "社保士兵",
"社保士兵", "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null);
// 记录日志
List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog;
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
empIdCard = excel.getIdCard();
auditRemark = excel.getYgsOperation();
if (Common.isEmpty(auditRemark)) {
auditRemark = excel.getYsdRemark();
}
if (Common.isNotNull(empIdCard)) {
title = "社保";
socialInfo = idCardMap.get(doAddId + CommonConstants.DOWN_LINE_STRING + empIdCard);
if (socialInfo != null) {
ygsHandleStatus = CommonConstants.SEVEN_STRING;
ysdHandleStatus = CommonConstants.SEVEN_STRING;
if (typeFlag && CommonConstants.SEVEN_STRING.equals(socialInfo.getYgsHandleStatus())) {
updateSocial = socialMap.get(socialInfo.getId());
if (updateSocial == null) {
updateSocial = new TSocialInfo();
updateSocial.setId(socialInfo.getId());
}
// 空、待审核、撤回或作废数据、审核不通过、审核通过
if ("审核通过".equals(excel.getAuditStatus())) {
ygsHandleStatus = CommonConstants.SIX_STRING;
ygsList = new ArrayList<>();
ygsList.add(socialInfo.getDispatchId());
handleRemark = "社保士兵自动办理成功!";
remark = handleRemark;
updateSocial.setYgsRemark(handleRemark);
updateSocial.setYgsRemarkOld(auditRemark);
} else if ("审核不通过".equals(excel.getAuditStatus())) {
// 如果找到了失败原因配置:
failConfig = getConfig(auditRemark, errorMap);
if (failConfig != null) {
updateSocial.setYgsRemark(failConfig.getSimpleReason());
// failConfig.getReplay() 1 继续办理 2 中止办理 3 人工办理
// setYgsHandleStatus 3继续办理、4终止办理、5人工处理
if (CommonConstants.ONE_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.THREE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业审核不通过!继续办理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
} else if (CommonConstants.TWO_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.FOUR_STRING;
ygsFailList = new ArrayList<>();
ygsFailList.add(socialInfo.getDispatchId());
handleRemark = "中止办理:" + failConfig.getSimpleReason();
remark = "中止办理:" + failConfig.getSimpleReason();
} else if (CommonConstants.THREE_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业审核不通过!人工处理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
}
} else {
handleRemark = "社保士兵审核不通过转人工处理!";
remark = auditRemark;
handleRemark += remark;
updateSocial.setYgsRemark(handleRemark);
updateSocial.setYgsRemarkOld(auditRemark);
ygsHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业" + handleRemark;
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
}
// 初始化继续办理
ygsHandleStatus = CommonConstants.THREE_STRING;
ysdHandleStatus = CommonConstants.THREE_STRING;
title = "社保";
updateSocial = new TSocialInfo();
auditRemark = info.getCwxx();
if (typeFlag && (CommonConstants.ONE_STRING.equals(socialInfo.getYgsHandleStatus())
|| CommonConstants.TWO_STRING.equals(socialInfo.getYgsHandleStatus())
|| CommonConstants.THREE_STRING.equals(socialInfo.getYgsHandleStatus()))) {
updateSocial.setId(socialInfo.getId());
// 空、待审核、撤回或作废数据、审核不通过、审核通过
if (CommonConstants.TWO_STRING.equals(info.getZt())) {
ygsHandleStatus = CommonConstants.SIX_STRING;
ygsList = new ArrayList<>();
ygsList.add(socialInfo.getDispatchId());
handleRemark = "税友自动办理成功!";
remark = handleRemark;
updateSocial.setYgsRemark(handleRemark);
updateSocial.setYgsRemarkOld(auditRemark);
} else if (CommonConstants.THREE_STRING.equals(info.getZt())) {
// 如果找到了失败原因配置:
failConfig = getConfig(auditRemark, errorMap);
if (failConfig != null) {
updateSocial.setYgsRemark(failConfig.getSimpleReason());
// failConfig.getReplay() 1 继续办理 2 中止办理 3 人工办理
// setYgsHandleStatus 3继续办理、4终止办理、5人工处理
if (CommonConstants.ONE_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.THREE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
updateSocial.setYgsRemark(auditRemark);
updateSocial.setYgsRemarkOld(auditRemark);
handleRemark = "社保士兵审核结果:" + excel.getAuditStatus();
remark = auditRemark;
handleRemark += remark;
updateSocial.setYgsRemark(handleRemark);
updateSocial.setYgsRemarkOld(handleRemark);
ygsHandleStatus = CommonConstants.SEVEN_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业" + handleRemark;
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
title += "派减";
}
updateSocial.setYgsHandleStatus(ygsHandleStatus);
updateSocialList.add(updateSocial);
socialMap.put(updateSocial.getId(), updateSocial);
// 拉取审核结果,加日志
if (Common.isNotNull(ygsHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialSoldierLog(socialInfo, "审核", "社保"
, getStatusName(Integer.parseInt(ygsHandleStatus)));
logList.add(socialLog);
}
} else if (!typeFlag && CommonConstants.SEVEN_STRING.equals(socialInfo.getYsdHandleStatus())) {
updateSocial = socialMap.get(socialInfo.getId());
if (updateSocial == null) {
updateSocial = new TSocialInfo();
updateSocial.setId(socialInfo.getId());
}
// 空、待审核、撤回或作废数据、审核不通过、审核通过
if ("审核通过".equals(excel.getAuditStatus())) {
ysdHandleStatus = CommonConstants.SIX_STRING;
ysdList = new ArrayList<>();
ysdList.add(socialInfo.getDispatchId());
handleRemark = "社保士兵自动办理成功!";
remark = handleRemark;
updateSocial.setYsdRemark(handleRemark);
updateSocial.setYsdRemarkOld(auditRemark);
} else if ("审核不通过".equals(excel.getAuditStatus())) {
// 如果找到了失败原因配置:
failConfig = getConfig(auditRemark, errorMap);
if (failConfig != null) {
updateSocial.setYsdRemark(failConfig.getSimpleReason());
// failConfig.getReplay() 1 继续办理 2 中止办理 3 人工办理
// ysdHandleStatus 3继续办理、4终止办理、5人工处理
if (CommonConstants.ONE_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.THREE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病审核不通过!继续办理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
} else if (CommonConstants.TWO_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.FOUR_STRING;
ysdFailList = new ArrayList<>();
ysdFailList.add(socialInfo.getDispatchId());
handleRemark = "中止办理:" + failConfig.getSimpleReason();
remark = "中止办理:" + failConfig.getSimpleReason();
} else if (CommonConstants.THREE_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病审核不通过!人工处理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
}
} else {
handleRemark = "社保士兵审核不通过转人工处理!";
remark = auditRemark;
handleRemark += remark;
updateSocial.setYsdRemark(handleRemark);
updateSocial.setYsdRemarkOld(auditRemark);
ysdHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病" + handleRemark;
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
}
title += "养老、工伤、失业办理不通过!继续办理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
} else if (CommonConstants.TWO_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.FOUR_STRING;
ygsFailList = new ArrayList<>();
ygsFailList.add(socialInfo.getDispatchId());
handleRemark = "中止办理:" + failConfig.getSimpleReason();
remark = "中止办理:" + failConfig.getSimpleReason();
} else if (CommonConstants.THREE_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
updateSocial.setYsdRemark(auditRemark);
handleRemark = "社保士兵审核结果:" + excel.getAuditStatus();
remark = auditRemark;
handleRemark += remark;
updateSocial.setYsdRemark(handleRemark);
// 此时不能更新old,因为医疗要判断是新增还是续期,要根据这个字段来判断
// updateSocial setYgsRemarkOld(handleRemark)
ysdHandleStatus = CommonConstants.SEVEN_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病" + handleRemark;
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
title += "派减";
}
updateSocial.setYsdHandleStatus(ysdHandleStatus);
updateSocialList.add(updateSocial);
socialMap.put(updateSocial.getId(), updateSocial);
// 拉取审核结果,加日志
if (Common.isNotNull(ysdHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialSoldierLog(socialInfo, "审核", "医保"
, getStatusName(Integer.parseInt(ysdHandleStatus)));
logList.add(socialLog);
}
}
// 处理社保办理成功或失败,
if (!updateSocialList.isEmpty()) {
tSocialInfoService.updateBatchById(updateSocialList);
updateSocialList = new ArrayList<>();
}
handleStatus = CommonConstants.ONE_STRING;
// 处理社保办理成功后的状态同步-成功
if (!ygsList.isEmpty()) {
socialType = "1,4,3";
this.doSocialAndDispatch(ygsList, typeSub, handleStatus, handleRemark, socialType, remark, user);
title += "养老、工伤、失业办理不通过!人工处理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
}
if (!ysdList.isEmpty()) {
socialType = "2,5,6";
this.doSocialAndDispatch(ysdList, typeSub, handleStatus, handleRemark, socialType, remark, user);
} else {
handleRemark = "税友办理不通过转人工处理!";
remark = auditRemark;
handleRemark += remark;
updateSocial.setYgsRemark(handleRemark);
updateSocial.setYgsRemarkOld(auditRemark);
ygsHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
// 处理社保办理成功后的状态同步-失败
handleStatus = CommonConstants.TWO_STRING;
if (!ygsFailList.isEmpty()) {
socialType = "1,4,3";
this.doSocialAndDispatch(ygsFailList, typeSub, handleStatus, handleRemark, socialType, remark, user);
title += "养老、工伤、失业" + handleRemark;
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
}
}
updateSocial.setYgsHandleStatus(ygsHandleStatus);
// 拉取审核结果,加日志
if (Common.isNotNull(ygsHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialSoldierLog(socialInfo, "提交", "社保"
, getStatusName(Integer.parseInt(ygsHandleStatus)));
tSocialSoldierLogService.save(socialLog);
}
} else if (!typeFlag && (CommonConstants.ONE_STRING.equals(socialInfo.getYsdHandleStatus())
|| CommonConstants.TWO_STRING.equals(socialInfo.getYsdHandleStatus())
|| CommonConstants.THREE_STRING.equals(socialInfo.getYsdHandleStatus()))) {
title = "医保";
updateSocial.setId(socialInfo.getId());
// 空、待审核、撤回或作废数据、审核不通过、审核通过
if (CommonConstants.TWO_STRING.equals(info.getZt())) {
ysdHandleStatus = CommonConstants.SIX_STRING;
ysdList.add(socialInfo.getDispatchId());
handleRemark = "税友自动办理成功!";
remark = handleRemark;
updateSocial.setYsdRemark(handleRemark);
updateSocial.setYsdRemarkOld(auditRemark);
} else if (CommonConstants.THREE_STRING.equals(info.getZt())) {
// 如果找到了失败原因配置:
failConfig = getConfig(auditRemark, errorMap);
if (failConfig != null) {
updateSocial.setYsdRemark(failConfig.getSimpleReason());
// failConfig.getReplay() 1 继续办理 2 中止办理 3 人工办理
// ysdHandleStatus 3继续办理、4终止办理、5人工处理
if (CommonConstants.ONE_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.THREE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病办理不通过!继续办理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
} else if (CommonConstants.TWO_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.FOUR_STRING;
ysdFailList.add(socialInfo.getDispatchId());
handleRemark = "中止办理:" + failConfig.getSimpleReason();
remark = "中止办理:" + failConfig.getSimpleReason();
} else if (CommonConstants.THREE_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病办理不通过!人工处理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
}
if (!ysdFailList.isEmpty()) {
socialType = "2,5,6";
this.doSocialAndDispatch(ysdFailList, typeSub, handleStatus, handleRemark, socialType, remark, user);
} else {
handleRemark = "税友办理不通过转人工处理!";
remark = auditRemark;
handleRemark += remark;
updateSocial.setYsdRemark(handleRemark);
updateSocial.setYsdRemarkOld(auditRemark);
ysdHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病" + handleRemark;
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
}
}
updateSocial.setYsdHandleStatus(ysdHandleStatus);
// 拉取审核结果,加日志
if (Common.isNotNull(ysdHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialSoldierLog(socialInfo, "提交", "医保"
, getStatusName(Integer.parseInt(ysdHandleStatus)));
tSocialSoldierLogService.save(socialLog);
}
}
if (!logList.isEmpty()) {
tSocialSoldierLogService.saveBatch(logList);
// 处理社保办理成功或失败,
if (Common.isNotNull(updateSocial.getId())) {
tSocialInfoService.updateById(updateSocial);
}
}
/**
* @Description: 社保士兵审核前的处理
* @Author: hgw
* @Date: 2024/5/27 11:29
* @return: void
**/
private void importTSocialInfo(List<TSocialSoldierReturnErrorVo> excelVOList, Map<String, TSocialInfo> idCardMap
, Map<String, FailReasonConfig> errorMap, String doAddId) {
// 个性化校验逻辑
// 执行数据插入操作 组装
TSocialSoldierReturnErrorVo excel;
String empIdCard;
TSocialInfo socialInfo;
List<TSocialInfo> updateSocialList = new ArrayList<>();
TSocialInfo updateSocial;
// true养工失 false 医生大
boolean typeFlag = true;
FailReasonConfig failConfig;
String ygsHandleStatus;
String ysdHandleStatus;
// 养工失办理成功的单子
List<String> ygsList = new ArrayList<>();
// 养工失办理失败的单子
List<String> ygsFailList = new ArrayList<>();
// 医生大办理成功的单子
List<String> ysdList = new ArrayList<>();
// 医生大办理失败的单子
List<String> ysdFailList = new ArrayList<>();
Map<String, TSocialInfo> socialMap = new HashMap<>();
handleStatus = CommonConstants.ONE_STRING;
// 处理社保办理成功后的状态同步-成功
String typeSub = CommonConstants.ZERO_STRING;
String handleStatus;
String title = null;
String handleRemark = null;
String remark = null;
String socialType;
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
YifuUser user = new YifuUser("1", 1L, "", "社保士兵",
"社保士兵", "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null);
// 记录日志
List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog;
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if ("是".equals(excel.getIsDoCompleted())) {
// 插入
empIdCard = excel.getIdCard();
if (Common.isEmpty(empIdCard)) {
empIdCard = excel.getEmpIdCard();
typeFlag = false;
}
if (Common.isNotNull(empIdCard)) {
// 初始化继续办理
ygsHandleStatus = CommonConstants.THREE_STRING;
ysdHandleStatus = CommonConstants.THREE_STRING;
title = "社保";
socialInfo = idCardMap.get(doAddId + CommonConstants.DOWN_LINE_STRING + empIdCard);
if (socialInfo != null) {
if (typeFlag &&
(CommonConstants.ONE_STRING.equals(socialInfo.getYgsHandleStatus())
|| CommonConstants.TWO_STRING.equals(socialInfo.getYgsHandleStatus())
|| CommonConstants.THREE_STRING.equals(socialInfo.getYgsHandleStatus()))) {
updateSocial = socialMap.get(socialInfo.getId());
if (updateSocial == null) {
updateSocial = new TSocialInfo();
updateSocial.setId(socialInfo.getId());
}
if ("是".equals(excel.getIsSuccess())) {
handleRemark = "社保士兵提交成功!";
remark = handleRemark;
updateSocial.setYgsRemark(handleRemark);
updateSocial.setYgsRemarkOld(handleRemark);
ygsHandleStatus = CommonConstants.SEVEN_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业提交成功!";
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
} else {
updateSocial.setYgsRemark(excel.getMsg());
updateSocial.setYgsRemarkOld(excel.getMsg());
// 过期自动变为终止
if (CommonConstants.ONE_STRING.equals(socialInfo.getYgsOverDueFlag())) {
handleRemark = "已过期,自动中止办理!";
updateSocial.setYgsRemarkOld(handleRemark);
ygsHandleStatus = CommonConstants.FOUR_STRING;
ygsFailList = new ArrayList<>();
ygsFailList.add(socialInfo.getDispatchId());
remark = handleRemark;
} else if (Common.isNotNull(excel.getMsg())) {
// 如果找到了失败原因配置:
failConfig = getConfig(excel.getMsg(), errorMap);
if (failConfig != null) {
updateSocial.setYgsRemark(failConfig.getSimpleReason());
// failConfig.getReplay() 1 继续办理 2 中止办理 3 人工办理
// setYgsHandleStatus 3继续办理、4终止办理、5人工处理
if (CommonConstants.ONE_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.THREE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业办理失败!继续办理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
} else if (CommonConstants.TWO_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.FOUR_STRING;
ygsFailList = new ArrayList<>();
ygsFailList.add(socialInfo.getDispatchId());
handleRemark = "中止办理:" + failConfig.getSimpleReason();
remark = "中止办理:" + failConfig.getSimpleReason();
} else if (CommonConstants.THREE_STRING.equals(failConfig.getReplay())) {
ygsHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业办理失败!人工处理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
}
} else {
ygsHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "养老、工伤、失业办理失败!人工处理:" + excel.getMsg();
this.doSocialTAuditInfo(socialInfo, title, "养老、工伤、失业办理失败!人工处理:" + excel.getMsg(), excel.getMsg(), user);
}
}
}
updateSocial.setYgsHandleStatus(ygsHandleStatus);
updateSocialList.add(updateSocial);
socialMap.put(updateSocial.getId(), updateSocial);
// 拉取提交结果,加日志
if (Common.isNotNull(ygsHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialSoldierLog(socialInfo, "提交", "社保"
, getStatusName(Integer.parseInt(ygsHandleStatus)));
logList.add(socialLog);
}
} else if (!typeFlag &&
(CommonConstants.ONE_STRING.equals(socialInfo.getYsdHandleStatus())
|| CommonConstants.TWO_STRING.equals(socialInfo.getYsdHandleStatus())
|| CommonConstants.THREE_STRING.equals(socialInfo.getYsdHandleStatus()))) {
updateSocial = socialMap.get(socialInfo.getId());
if (updateSocial == null) {
updateSocial = new TSocialInfo();
updateSocial.setId(socialInfo.getId());
}
if ("是".equals(excel.getIsSuccess())) {
handleRemark = "社保士兵提交成功:" + excel.getMsg();
remark = handleRemark;
updateSocial.setYsdRemark(handleRemark);
updateSocial.setYsdRemarkOld("续保");
if (Common.isNotNull(excel.getMsg()) && excel.getMsg().contains("新增")) {
updateSocial.setYsdRemarkOld("新增");
}
ysdHandleStatus = CommonConstants.SEVEN_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病提交成功!";
this.doSocialTAuditInfo(socialInfo, title, title, title, user);
} else {
updateSocial.setYsdRemark(excel.getMsg());
updateSocial.setYsdRemarkOld(excel.getMsg());
// 过期自动变为终止
if (CommonConstants.ONE_STRING.equals(socialInfo.getYsdOverDueFlag())) {
handleRemark = "已过期,自动中止办理!";
updateSocial.setYsdRemarkOld(handleRemark);
ysdHandleStatus = CommonConstants.FOUR_STRING;
ysdFailList = new ArrayList<>();
ysdFailList.add(socialInfo.getDispatchId());
remark = handleRemark;
} else if (Common.isNotNull(excel.getMsg())) {
// 如果找到了失败原因配置:
failConfig = getConfig(excel.getMsg(), errorMap);
if (failConfig != null) {
updateSocial.setYsdRemark(failConfig.getSimpleReason());
// failConfig.getReplay() 1 继续办理 2 中止办理 3 人工办理
// ysdHandleStatus 3继续办理、4终止办理、5人工处理
if (CommonConstants.ONE_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.THREE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病办理失败!继续办理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
} else if (CommonConstants.TWO_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.FOUR_STRING;
ysdFailList = new ArrayList<>();
ysdFailList.add(socialInfo.getDispatchId());
handleRemark = "中止办理:" + failConfig.getSimpleReason();
remark = "中止办理:" + failConfig.getSimpleReason();
} else if (CommonConstants.THREE_STRING.equals(failConfig.getReplay())) {
ysdHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病办理失败!人工处理:" + failConfig.getSimpleReason();
this.doSocialTAuditInfo(socialInfo, title, title, failConfig.getSimpleReason(), user);
}
} else {
ysdHandleStatus = CommonConstants.FIVE_STRING;
// 新增流程进展明细
if (CommonConstants.ZERO_STRING.equals(socialInfo.getDispatchType())) {
title += "派增";
} else {
title += "派减";
}
title += "医疗、生育、大病办理失败!人工处理:" + excel.getMsg();
this.doSocialTAuditInfo(socialInfo, title, "医疗、生育、大病办理失败!人工处理:" + excel.getMsg(), excel.getMsg(), user);
}
}
}
updateSocial.setYsdHandleStatus(ysdHandleStatus);
updateSocialList.add(updateSocial);
socialMap.put(updateSocial.getId(), updateSocial);
// 拉取提交结果,加日志
if (Common.isNotNull(ysdHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialSoldierLog(socialInfo, "提交", "医保"
, getStatusName(Integer.parseInt(ysdHandleStatus)));
logList.add(socialLog);
}
}
// 处理社保办理成功或失败,
if (!updateSocialList.isEmpty()) {
tSocialInfoService.updateBatchById(updateSocialList);
updateSocialList = new ArrayList<>();
}
handleStatus = CommonConstants.ONE_STRING;
// 处理社保办理成功后的状态同步-成功
if (!ygsList.isEmpty()) {
socialType = "1,4,3";
this.doSocialAndDispatch(ygsList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
if (!ysdList.isEmpty()) {
socialType = "2,5,6";
this.doSocialAndDispatch(ysdList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
// 处理社保办理成功后的状态同步-失败
handleStatus = CommonConstants.TWO_STRING;
if (!ygsFailList.isEmpty()) {
socialType = "1,4,3";
this.doSocialAndDispatch(ygsFailList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
if (!ysdFailList.isEmpty()) {
socialType = "2,5,6";
this.doSocialAndDispatch(ysdFailList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
}
}
}
if (!ygsList.isEmpty()) {
socialType = "1,4,3";
this.doSocialAndDispatch(ygsList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
if (!ysdList.isEmpty()) {
socialType = "2,5,6";
this.doSocialAndDispatch(ysdList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
if (!logList.isEmpty()) {
tSocialSoldierLogService.saveBatch(logList);
// 处理社保办理成功后的状态同步-失败
handleStatus = CommonConstants.TWO_STRING;
if (!ygsFailList.isEmpty()) {
socialType = "1,4,3";
this.doSocialAndDispatch(ygsFailList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
if (!ysdFailList.isEmpty()) {
socialType = "2,5,6";
this.doSocialAndDispatch(ysdFailList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
}
/**
* @param status
* @Description: 返回对应文字
......
......@@ -452,6 +452,22 @@ public class TSocialInfoServiceImpl extends ServiceImpl<TSocialInfoMapper, TSoci
public List<TSocialInfo> getSocialSoldierYsdAll() {
return baseMapper.getSocialSoldierYsdAll();
}
@Override
public List<TSocialInfo> getSocialFriendYgsAll() {
return baseMapper.getSocialFriendYgsAll();
}
/**
* @param
* @Description: 获取所有需要自动办理的社保
* @Author: hgw
* @Date: 2024/5/11 14:55
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo>
**/
@Override
public List<TSocialInfo> getSocialFriendYsdAll() {
return baseMapper.getSocialFriendYsdAll();
}
/**
* @param
* @Description: 获取所有需要社保局审核的社保
......
......@@ -164,6 +164,34 @@ public class TSocialSoldierLogServiceImpl extends ServiceImpl<TSocialSoldierLogM
return log;
}
@Override
public TSocialSoldierLog getYgsFriendLog(SociaFriendYgsAddVo vo, String type, String remark) {
TSocialSoldierLog log = new TSocialSoldierLog();
log.setSocialId(vo.getSocialId());
log.setEmpName(vo.getEmpName());
log.setEmpIdcard(vo.getEmpIdcard());
log.setDispatchItem("社保");
log.setSocialHuName(vo.getSocialHouseholdName());
// type 类型:提交;审核
log.setType(type);
log.setRemark(remark);
return log;
}
@Override
public TSocialSoldierLog getYsdFriendLog(SociaFriendYgsAddVo vo, String type, String remark) {
TSocialSoldierLog log = new TSocialSoldierLog();
log.setSocialId(vo.getSocialId());
log.setEmpName(vo.getEmpName());
log.setEmpIdcard(vo.getEmpIdcard());
log.setDispatchItem("医保");
log.setSocialHuName(vo.getSocialHouseholdName());
// type 类型:提交;审核
log.setType(type);
log.setRemark(remark);
return log;
}
@Override
public TSocialSoldierLog getYgsSoldierAuditLog(SocialSoldierYgsAuditVo vo, String type, String remark) {
TSocialSoldierLog log = new TSocialSoldierLog();
......
......@@ -14,10 +14,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSendEkpErrorMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierPushService;
import com.yifu.cloud.plus.v1.yifu.social.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -56,6 +53,9 @@ public class DoSocialTask {
@Autowired
private TSocialSoldierPushService tSocialSoldierPushService;
@Autowired
private TSocialFriendPushService tSocialFriendPushService;
/**
* @Author fxj
* @Description 异步处理相关信息
......@@ -269,7 +269,7 @@ public class DoSocialTask {
* @return
**/
@Async
public void pushSoldier(String dispatchId) {
public void pushSoldier(String dispatchId, boolean isFriend) {
List<String> dispatchIdList = new ArrayList<>();
dispatchIdList.add(dispatchId);
try {
......@@ -277,6 +277,11 @@ public class DoSocialTask {
} catch (InterruptedException e) {
e.printStackTrace();
}
tSocialSoldierPushService.pushSoldier(dispatchIdList);
// 当前默认 安徽省 ,且开关是税友的,才可以税友推送办理
if (isFriend) {
tSocialFriendPushService.pushFriend(dispatchIdList);
} else {
tSocialSoldierPushService.pushSoldier(dispatchIdList);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ 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)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFreindSetMapper">
<resultMap id="tSocialFreindSetMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindSet">
<id property="id" column="ID"/>
<result property="type" column="TYPE"/>
</resultMap>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ 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)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendBackLogMapper">
<resultMap id="tSocialFriendBackLogMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog">
<id property="id" column="ID"/>
<result property="socialId" column="SOCIAL_ID"/>
<result property="requestId" column="REQUEST_ID"/>
<result property="logInfo" column="LOG_INFO"/>
<result property="createTime" column="CREATE_TIME"/>
</resultMap>
</mapper>
......@@ -28,57 +28,64 @@
SELECT
s.id as socialId,
if(a.TYPE='0','派增','派减') type,
case a.SOCIAL_HANDLE_STATUS when '0' then '未办理' when '1' then '全部办理成功' when '2' then '全部办理失败' when '3' then '部分办理成功' when '4' then '办理中' else '-' end socialHandleStatus,
case if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) when '0' then '派增待办理' when '1' then '派增办理成功' when '2' then '派增办理失败' when '3' then '派减-已派减' when '4' then '派减失败' when '5' then '派减待办理' else '——' end pensionHandle,
case if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) when '0' then '派增待办理' when '1' then '派增办理成功' when '2' then '派增办理失败' when '3' then '派减-已派减' when '4' then '派减失败' when '5' then '派减待办理' else '——' end medicalHandle,
case if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) when '0' then '派增待办理' when '1' then '派增办理成功' when '2' then '派增办理失败' when '3' then '派减-已派减' when '4' then '派减失败' when '5' then '派减待办理' else '——' end unemployHandle,
case if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) when '0' then '派增待办理' when '1' then '派增办理成功' when '2' then '派增办理失败' when '3' then '派减-已派减' when '4' then '派减失败' when '5' then '派减待办理' else '——' end workInjuryHandle,
case if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) when '0' then '派增待办理' when '1' then '派增办理成功' when '2' then '派增办理失败' when '3' then '派减-已派减' when '4' then '派减失败' when '5' then '派减待办理' else '——' end birthHandle,
case if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) when '0' then '派增待办理' when '1' then '派增办理成功' when '2' then '派增办理失败' when '3' then '派减-已派减' when '4' then '派减失败' when '5' then '派减待办理' else '——' end bigailmentHandle,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
shh.UNIT_CREDIT_CODE unitCreditCode,
shh.AREA_CODE areaCode,
shh.SOCIAL_ACCOUNT socialAccount,
shh.SOCIAL_PASSWORD socialPassword,
shh.MEDICL_ACCOUNT mediclAccount,
shh.MEDICL_PASSWORD mediclPassword,
shh.CUSTOMER_NO customerNo,
a.EMP_NAME empName,
a.EMP_IDCARD empIdcard,
a.EDUCATION_NAME educationName,
a.BELONG_UNIT_NAME belongUnit,
a.SETTLE_DOMAIN_NAME settleDomain,
emp_natrue.label empType,
a.POST post,
if (a.EMP_NATIONAL in ('2','3','5','6','7','8','9','11') and nation.label is not null, nation.label,'汉族') empNational,
a.EMP_MOBILE empMobile,
a.ID_CARD_ADDRESS idCardAddress,
a.CONTACT_ADDRESS contactAddress,
registype.label regisType,
nation.label empNational,
workingHours.label workingHours,
a.CONTRACT_TERM contractTerm,
s.SOCIAL_START_DATE contractStart,
a.CONTRACT_END contractEnd,
a.CREATE_NAME createUserName,
DATE_FORMAT(s.SOCIAL_START_DATE,"%Y-%m-%d") socialStartDate,
if(a.EDUCATION_NAME is null, '大学专科',
case a.EDUCATION_NAME
when '博士' then '博士研究生'
when '技工' then '技工学校'
when '高中' then '普通中学(高中)'
when '小学' then '小学'
when '文盲' then '其他'
when '中专' then '中等专科'
when '初中' then '初级中学'
when '本科' then '大学本科'
when '大专' then '大学专科'
when '硕士' then '研究生'
when '职高' then '职业高中'
else '其他'
end) educationName,
s.RECORD_BASE recordBase,
case s.PAYMENT_TYPE when '0' then '最低' when '1' then '自定义' when '2' then '最高' else '-' end paymentType,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
if(ifnull(h.id,0) != '0',sp1.AREA_NAME,sp2.AREA_NAME) socialProvince,
if(ifnull(h.id,0) != '0',sc1.AREA_NAME,sc2.AREA_NAME) socialCity,
if(ifnull(h.id,0) != '0',st1.AREA_NAME,st2.AREA_NAME) socialTown,
if(ifnull(h.id,0) != '0',h.PENSION_START,s.PENSION_START) pensionStart,
if(ifnull(h.id,0) != '0',h.UNIT_PENSION_CARDINAL,s.UNIT_PENSION_CARDINAL) unitPensionCardinal,
if(ifnull(h.id,0) != '0',h.MEDICAL_START,s.MEDICAL_START) medicalStart,
if(ifnull(h.id,0) != '0',h.UNIT_MEDICAL_CARDINAL,s.UNIT_MEDICAL_CARDINAL) unitMedicalCardinal,
if(ifnull(h.id,0) != '0',h.UNEMPLOY_START,s.UNEMPLOY_START) unemployStart,
if(ifnull(h.id,0) != '0',h.UNIT_UNEMPLOYMENT_CARDINAL,s.UNIT_UNEMPLOYMENT_CARDINAL) unitUnemploymentCardinal,
if(ifnull(h.id,0) != '0',h.WORK_INJURY_START,s.WORK_INJURY_START) workInjuryStart,
if(ifnull(h.id,0) != '0',h.UNIT_WORK_INJURY_CARDINAL,s.UNIT_WORK_INJURY_CARDINAL) unitWorkInjuryCardinal,
if(ifnull(h.id,0) != '0',h.BIRTH_START,s.BIRTH_START) birthStart,
if(ifnull(h.id,0) != '0',h.UNIT_BIRTH_CARDINAL,s.UNIT_BIRTH_CARDINAL) unitBirthCardinal,
if(ifnull(h.id,0) != '0',h.BIGAILMENT_START,s.BIGAILMENT_START) bigailmentStart,
if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_CARDINAL,s.UNIT_BIGAILMENT_CARDINAL) unitBigailmentCardinal,
if(ifnull(h.id,0) != '0',h.UNIT_BIGAILMENT_MONEY,s.UNIT_BIGAILMENT_MONEY) unitBigailmentMoney,
if(ifnull(h.id,0) != '0',h.PERSONAL_BIGAILMENT_MONEY,s.PERSONAL_BIGAILMENT_MONEY) personalBigailmentMoney,
a.TRUST_REMARK socailTrustRemark,
reduceReason.label reduceReason,
'1' as exportSocialFlag,
a.SCHOOL_NAME schoolName,
a.MAJOR major,
a.FIRST_PAY_TIME graduationTime,
a.GRADUATION_TIME firstPayTime
DATE_FORMAT(s.SOCIAL_START_DATE,"%Y%m") socialStartMonth,
case a.CONTRACT_TYPE
when '0' then '订立以完成一定工作任务为期限的劳动合同'
when '1' then '订立固定期限劳动合同'
when '2' then '订立无固定期限劳动合同'
else '其他' end contractType,
case a.WORKING_HOURS
when '1' then '标准工作时间制度'
when '2' then '综合计算工时制度'
when '3' then '不定时工作时间制度'
else '标准工作时间制度' end workingHours,
case a.CONTRACT_TYPE
when '0' then '以完成一定工作为期限的劳动合同'
when '1' then '固定期限劳动合同'
when '2' then '无固定期限劳动合同'
else '固定期限劳动合同' end contractTypeTwo,
a.CONTRACT_END contractEnd,
if(a.REDUCE_REASON = '16','死亡或失踪','在职人员解除/终止劳动合同') tbyy,
case a.REDUCE_REASON
when '21' then '职工与用人单位协商一致解除劳动合同(18条1款)'
when '5' then '第四十四条第二项,劳动者开始依法享受基本养老保险待遇'
when '16' then '劳动者死亡,或者被人民法院宣告死亡或者宣告失踪'
when '1' then '劳动者提前30天书面通知解除或试用期提前3天通知解除合同'
when '2' then '劳动者严重违反用人单位的规章制度'
else '法律、行政法规规定的其他情形' end zzyy,
s.SOCIAL_PROVINCE socialProvince,
s.SOCIAL_CITY socialCity,
s.SOCIAL_TOWN socialTown
</sql>
<!-- 税友基本查询-->
......@@ -87,26 +94,16 @@
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item emp_natrue on emp_natrue.value=a.EMP_TYPE and emp_natrue.type='emp_natrue'
left join view_sys_dict_item registype on registype.value=a.EMP_REGIS_TYPE and registype.type='emp_registype'
left join sys_house_hold_info shh on shh.id = s.SOCIAL_HOUSEHOLD
left join view_sys_dict_item nation on nation.value=a.EMP_NATIONAL and nation.type='emp_national'
left join view_sys_dict_item workingHours on workingHours.value=a.WORKING_HOURS and workingHours.type='working_hours'
left join view_sys_dict_item reduceReason on reduceReason.value=a.REDUCE_REASON and reduceReason.type='social_reduce_reason'
left join sys_area sp1 on sp1.id = h.SOCIAL_PROVINCE
left join sys_area sp2 on sp2.id = s.SOCIAL_PROVINCE
left join sys_area sc1 on sc1.id = h.SOCIAL_CITY
left join sys_area sc2 on sc2.id = s.SOCIAL_CITY
left join sys_area st1 on st1.id = h.SOCIAL_TOWN
left join sys_area st2 on st2.id = s.SOCIAL_TOWN
<include refid="where_getSocialSoldier_base_handler"/>
and DATE_FORMAT(a.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')
</sql>
<!-- 税友养工失增加模板-->
<select id="getSocialSoldierYgsAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo">
<select id="getSocialSoldierYgsAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SociaFriendYgsAddVo">
<include refid="getSocialSoldierBaseOne"/>
,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao
<include refid="getSocialSoldierBaseTwo"/>
and a.type = '0' and s.YGS_HANDLE_STATUS in ('0','1','2','3')
and (
......@@ -137,9 +134,8 @@
</sql>
<!-- 税友养工失减少模板-->
<select id="getSocialSoldierYgsReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo">
<select id="getSocialSoldierYgsReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SociaFriendYgsAddVo">
<include refid="getSocialSoldierBaseOne"/>
,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao
<include refid="getSocialSoldierBaseTwo"/>
and a.type = '1' and s.YGS_HANDLE_STATUS in ('0','1','2','3')
and (
......@@ -151,9 +147,8 @@
</select>
<!-- 税友医生大增加模板-->
<select id="getSocialSoldierYsdAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAddVo">
<select id="getSocialSoldierYsdAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SociaFriendYgsAddVo">
<include refid="getSocialSoldierBaseOne"/>
,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen
<include refid="getSocialSoldierBaseTwo"/>
and a.type = '0' and s.YSD_HANDLE_STATUS in ('0','1','2','3')
and (
......@@ -165,9 +160,8 @@
</select>
<!-- 税友医生大减少模板-->
<select id="getSocialSoldierYsdReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAddVo">
<select id="getSocialSoldierYsdReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SociaFriendYgsAddVo">
<include refid="getSocialSoldierBaseOne"/>
,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen
<include refid="getSocialSoldierBaseTwo"/>
and a.type = '1' and s.YSD_HANDLE_STATUS in ('0','1','2','3')
and (
......@@ -178,110 +172,4 @@
group by s.id
</select>
<!-- 税友养工失审核结果查询的模板-->
<select id="getSocialSoldierYgsAuditVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAuditVo">
SELECT
s.id as socialId,
a.EMP_NAME empName,
a.EMP_IDCARD empIdcard,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
if(a.TYPE='0','增员','减员') type,
DATE_FORMAT(a.AUDIT_TIME,'%Y%m%d') startDate,
DATE_FORMAT(now(),'%Y%m%d') endDate,
'' backInfo,'' backInfoOne,'' backInfoTwo
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
where a.DELETE_FLAG = '0' AND a.social_id is not null AND a.STATUS = "2" AND s.YGS_HANDLE_STATUS = '7'
and a.AUTO_FLAG = '0' and DATE_FORMAT(a.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')
group by s.id
</select>
<!-- 税友医生大审核结果【续保】查询的模板-->
<select id="getSocialSoldierYsdAuditVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAuditVo">
SELECT
s.id as socialId,
a.EMP_NAME empName,
a.EMP_IDCARD empIdcard,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
if(a.TYPE='0','参保人员增员申报','参保人员减员申报') type,
DATE_FORMAT(a.AUDIT_TIME,'%Y%m%d') startDate,
DATE_FORMAT(now(),'%Y%m%d') endDate,
'' backInfo,'' backInfoOne,'' backInfoTwo
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
where a.DELETE_FLAG = '0' AND a.social_id is not null AND a.STATUS = "2" AND s.YSD_HANDLE_STATUS = '7'
and a.AUTO_FLAG = '0' and DATE_FORMAT(a.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')
and s.YSD_REMARK_OLD != "新增"
group by s.id
</select>
<!-- 税友养工失审核结果查询的模板-->
<select id="getSocialSoldierYgsAuditVoListByGroupBy" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAuditVo">
SELECT
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
if(a.TYPE='0','增员','减员') type,
DATE_FORMAT(min(a.AUDIT_TIME),'%Y%m%d') startDate,
DATE_FORMAT(now(),'%Y%m%d') endDate,
'' backInfo,'' backInfoOne,'' backInfoTwo
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
where a.DELETE_FLAG = '0' AND a.social_id is not null AND a.STATUS = "2" AND s.YGS_HANDLE_STATUS = '7'
and a.AUTO_FLAG = '0' and DATE_FORMAT(a.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')
group by a.SOCIAL_HOUSEHOLD_NAME,a.TYPE
</select>
<!-- 税友医生大审核结果【续保】查询的模板-->
<select id="getSocialSoldierYsdAuditVoListByGroupBy" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAuditVo">
SELECT
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
if(a.TYPE='0','参保人员增员申报','参保人员减员申报') type,
DATE_FORMAT(min(a.AUDIT_TIME),'%Y%m%d') startDate,
DATE_FORMAT(now(),'%Y%m%d') endDate,
'' backInfo,'' backInfoOne,'' backInfoTwo
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
where a.DELETE_FLAG = '0' AND a.social_id is not null AND a.STATUS = "2" AND s.YSD_HANDLE_STATUS = '7'
and a.AUTO_FLAG = '0' and DATE_FORMAT(a.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')
and s.YSD_REMARK_OLD != "新增"
group by a.SOCIAL_HOUSEHOLD_NAME,a.TYPE
</select>
<!-- 税友医生大审核结果【新增】查询的模板-->
<select id="getSocialSoldierYsdAddAuditVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAuditVo">
SELECT
s.id as socialId,
a.EMP_NAME empName,
a.EMP_IDCARD empIdcard,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
if(a.TYPE='0','职工新参保登记','参保人员减员申报') type,
DATE_FORMAT(a.AUDIT_TIME,'%Y%m%d') startDate,
DATE_FORMAT(now(),'%Y%m%d') endDate,
'' backInfo,'' backInfoOne,'' backInfoTwo
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
where a.DELETE_FLAG = '0' AND a.social_id is not null AND a.STATUS = "2" AND s.YSD_HANDLE_STATUS = '7'
and a.AUTO_FLAG = '0' and DATE_FORMAT(a.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')
and s.YSD_REMARK_OLD = "新增"
group by s.id
</select>
<!-- 税友医生大审核结果【新增】查询的模板-->
<select id="getSocialSoldierYsdAddAuditVoListByGroupBy" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAuditVo">
SELECT
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
if(a.TYPE='0','职工新参保登记','参保人员减员申报') type,
DATE_FORMAT(min(a.AUDIT_TIME),'%Y%m%d') startDate,
DATE_FORMAT(now(),'%Y%m%d') endDate,
'' backInfo,'' backInfoOne,'' backInfoTwo
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
where a.DELETE_FLAG = '0' AND a.social_id is not null AND a.STATUS = "2" AND s.YSD_HANDLE_STATUS = '7'
and a.AUTO_FLAG = '0' and DATE_FORMAT(a.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')
and s.YSD_REMARK_OLD = "新增"
group by a.SOCIAL_HOUSEHOLD_NAME,a.TYPE
</select>
</mapper>
......@@ -150,6 +150,10 @@
<result property="dispatchType" column="DISPATCH_TYPE"/>
<result property="ygsOverDueFlag" column="YGS_OVER_DUE_FLAG"/>
<result property="ysdOverDueFlag" column="YSD_OVER_DUE_FLAG"/>
<!-- 税友新增字段-->
<result property="ygsRequestId" column="YGS_REQUEST_ID"/>
<result property="ysdRequestId" column="YSD_REQUEST_ID"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -262,7 +266,9 @@
a.YGS_REMARK_OLD,
a.YSD_REMARK_OLD,
a.YGS_ADD_ID,
a.YSD_ADD_ID
a.YSD_ADD_ID,
a.YGS_REQUEST_ID,
a.YSD_REQUEST_ID
</sql>
<sql id="tSocialInfo_where">
......@@ -631,6 +637,52 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
group by a.id
</select>
<!-- 获取所有需要自动办理的养工失 -->
<select id="getSocialFriendYgsAll" resultMap="tSocialInfoMap">
SELECT
a.ID,
a.EMP_NAME,
a.SOCIAL_HOUSEHOLD_NAME,
a.EMP_IDCARD,
a.YGS_REQUEST_ID,
a.HANDLE_STATUS,
a.YGS_HANDLE_STATUS,
SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE,
if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YGS_OVER_DUE_FLAG
FROM t_social_info a
left join t_dispatch_info d on d.SOCIAL_ID = a.id
left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
where a.YGS_REQUEST_ID is not null and d.AUTO_FLAG='0'
and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
and a.YGS_HANDLE_STATUS in ('1','2','3')
group by a.id
</select>
<!-- 获取所有需要自动办理的医生大 -->
<select id="getSocialFriendYsdAll" resultMap="tSocialInfoMap">
SELECT
a.ID,
a.EMP_NAME,
a.SOCIAL_HOUSEHOLD_NAME,
a.EMP_IDCARD,
a.YSD_REQUEST_ID,
a.HANDLE_STATUS,
a.YSD_HANDLE_STATUS,
SUBSTRING_INDEX(GROUP_CONCAT(d.id ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_ID,
SUBSTRING_INDEX(GROUP_CONCAT(d.type ORDER BY d.CREATE_TIME desc),',',1) as DISPATCH_TYPE,
if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.MEDICAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YSD_OVER_DUE_FLAG
FROM t_social_info a
left join t_dispatch_info d on d.SOCIAL_ID = a.id
left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
where a.YSD_REQUEST_ID is not null and d.AUTO_FLAG='0'
and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
and a.YSD_HANDLE_STATUS in ('1','2','3')
group by a.id
</select>
<!-- 获取所有需要社保局审核的养工失 -->
<select id="getSocialSoldierYgsByAudit" resultMap="tSocialInfoMap">
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