Commit 2326044f authored by hongguangwu's avatar hongguangwu

Merge branch 'MVP-1.7.7-Friend' into MVP1.7.8

# Conflicts:
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/config/SocialFriendConfig.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TSocialFriendPushServiceImpl.java
#	yifu-social/yifu-social-biz/src/main/resources/mapper/TSocialInfoMapper.xml
parents f0311785 afdf144b
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.yifu.cloud.plus.v1</groupId> <groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu</artifactId> <artifactId>yifu-check</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
......
/*
* 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 javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
@Data
@TableName("t_social_freind_push_and_get")
@Schema(description = "税友推送和拉取的日志表,用于10分钟只能推拉一次")
public class TSocialFreindPushAndGet {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("id")
@Schema(description = "id")
private String id;
/**
* 类型:1推送;2拉取
*/
@ExcelAttribute(name = "类型:1推送;2拉取", isNotEmpty = true, errorInfo = "类型:1推送;2拉取不能为空")
@NotBlank(message = "类型:1推送;2拉取不能为空")
@ExcelProperty("类型:1推送;2拉取")
@Schema(description = "类型:1推送;2拉取")
private Integer type;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间", isNotEmpty = true, errorInfo = "创建时间不能为空", isDate = true)
@NotBlank(message = "创建时间不能为空")
@ExcelProperty("创建时间")
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 创建人姓名
*/
@ExcelAttribute(name = "创建人姓名", isNotEmpty = true, errorInfo = "创建人姓名不能为空", maxLength = 50)
@NotBlank(message = "创建人姓名不能为空")
@Length(max = 50, message = "创建人姓名不能超过50个字符")
@ExcelProperty("创建人姓名")
@Schema(description = "创建人姓名")
private String createUserName;
}
...@@ -47,10 +47,10 @@ public class TSocialFriendBackLog { ...@@ -47,10 +47,10 @@ public class TSocialFriendBackLog {
@Schema(description = "主键") @Schema(description = "主键")
private String id; private String id;
/** /**
* 社保ID * 社保ID,逗号拼接
*/ */
@ExcelAttribute(name = "社保ID", maxLength = 32) @ExcelAttribute(name = "社保ID", maxLength = 2000)
@Length(max = 32, message = "社保ID不能超过32个字符") @Length(max = 2000, message = "社保ID不能超过2000个字符")
@ExcelProperty("社保ID") @ExcelProperty("社保ID")
@Schema(description = "社保ID") @Schema(description = "社保ID")
private String socialId; private String socialId;
...@@ -65,7 +65,7 @@ public class TSocialFriendBackLog { ...@@ -65,7 +65,7 @@ public class TSocialFriendBackLog {
@ExcelAttribute(name = "类型") @ExcelAttribute(name = "类型")
@ExcelProperty("类型") @ExcelProperty("类型")
@Schema(description = "类型1社保增 2社保减 3医保增 4医保减 5推送的日志") @Schema(description = "类型1社保增 2社保减 3医保增 4医保减 5推送的日志 6社保图片路径7医保图片路径11社保增拉取 12社保减拉取 13医保增拉取 14医保减拉取")
private Integer type; private Integer type;
/** /**
......
...@@ -20,6 +20,7 @@ import org.springframework.web.client.RestTemplate; ...@@ -20,6 +20,7 @@ import org.springframework.web.client.RestTemplate;
import java.security.SignatureException; import java.security.SignatureException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TreeMap; import java.util.TreeMap;
...@@ -67,13 +68,15 @@ public class SocialFriendConfig { ...@@ -67,13 +68,15 @@ public class SocialFriendConfig {
private static final String VERSION = "version"; private static final String VERSION = "version";
/** /**
* @param : listVo 同一类(户、增减)的前100个
* @param : vo 第一个,存账密等信息
* @param : type 1社保增 2社保减 3医保增 4医保减 * @param : type 1社保增 2社保减 3医保增 4医保减
* @Description: 推送任务接口 * @Description: 推送任务接口
* @Author: hgw * @Author: hgw
* @Date: 2024-12-9 16:54:31 * @Date: 2024-12-9 16:54:31
* @return: java.lang.String * @return: java.lang.String
**/ **/
public String pushFriendByInfo(RestTemplate restTemplate, SociaFriendYgsAddVo vo, int type, String thisTime public String pushFriendByInfo(RestTemplate restTemplate, SociaFriendYgsAddVo vo, List<SociaFriendYgsAddVo> listVo, int type, String thisTime
, List<TSocialFriendBackLog> backLogList) { , List<TSocialFriendBackLog> backLogList) {
String addId = ""; String addId = "";
String appAddUrl = urlPre; String appAddUrl = urlPre;
...@@ -137,23 +140,36 @@ public class SocialFriendConfig { ...@@ -137,23 +140,36 @@ public class SocialFriendConfig {
} }
json.put("ywblzhlb", ywblzhlbArr); json.put("ywblzhlb", ywblzhlbArr);
// type 1社保增 2社保减 3医保增 4医保减 // type 1社保增 2社保减 3医保增 4医保减
setEmpInfo(json, vo, type); setEmpInfo(json, listVo, type);
HttpEntity<String> formEntity = new HttpEntity<>(json.toString(), headers); HttpEntity<String> formEntity = new HttpEntity<>(json.toString(), headers);
// 推的json // 推的json
TSocialFriendBackLog backLog = new TSocialFriendBackLog(); TSocialFriendBackLog backLogPush = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId()); backLogPush.setSocialId(vo.getSocialId());
backLog.setType(5); backLogPush.setType(5);
backLog.setLogInfo(json.toString()); backLogPush.setLogInfo(json.toString());
backLog.setCreateTime(LocalDateTime.now()); backLogPush.setCreateTime(LocalDateTime.now());
backLogList.add(backLog); backLogList.add(backLogPush);
String dataResultList = restTemplate.postForObject(appAddUrl, formEntity, String.class); String dataResultList = restTemplate.postForObject(appAddUrl, formEntity, String.class);
// {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y" // {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y"
// ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172" // ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172"
if (Common.isNotNull(dataResultList)) { if (Common.isNotNull(dataResultList)) {
// 拉取的数据日志 // 拉取的数据日志
backLog = new TSocialFriendBackLog(); TSocialFriendBackLog backLog = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId()); StringBuilder ids = new StringBuilder();
String idTemp;
for (SociaFriendYgsAddVo tempVo : listVo) {
if (Common.isNotNull(tempVo.getEmpIdcard())) {
idTemp = tempVo.getEmpIdcard();
} else if (Common.isNotNull(tempVo.getSocialId())) {
idTemp = tempVo.getSocialId();
} else {
idTemp = vo.getSocialId();
}
ids.append(idTemp).append(",");
}
backLogPush.setSocialId(ids.toString());
backLog.setSocialId(ids.toString());
backLog.setType(type); backLog.setType(type);
backLog.setLogInfo(dataResultList); backLog.setLogInfo(dataResultList);
backLog.setCreateTime(LocalDateTime.now()); backLog.setCreateTime(LocalDateTime.now());
...@@ -242,11 +258,11 @@ public class SocialFriendConfig { ...@@ -242,11 +258,11 @@ public class SocialFriendConfig {
* @Date: 2024/12/11 10:24 * @Date: 2024/12/11 10:24
* @return: void * @return: void
**/ **/
private void setEmpInfo(JSONObject json, SociaFriendYgsAddVo vo, int type) { private void setEmpInfo(JSONObject json, List<SociaFriendYgsAddVo> listVo, int type) {
if (type == 1 || type == 3) { if (type == 1 || type == 3) {
setEmpInfoAdd(json, vo, type); setEmpInfoAdd(json, listVo, type);
} else { } else {
setEmpInfoReduce(json, vo, type); setEmpInfoReduce(json, listVo, type);
} }
} }
...@@ -257,143 +273,148 @@ public class SocialFriendConfig { ...@@ -257,143 +273,148 @@ public class SocialFriendConfig {
* @Date: 2024/12/10 18:05 * @Date: 2024/12/10 18:05
* @return: void * @return: void
**/ **/
private void setEmpInfoAdd(JSONObject json, SociaFriendYgsAddVo vo, int type) { private void setEmpInfoAdd(JSONObject json, List<SociaFriendYgsAddVo> listVo, int type) {
// 参保人员名单 数组 // 参保人员名单 数组
JSONArray cbrymdArr = new JSONArray(); JSONArray cbrymdArr = new JSONArray();
JSONObject cbrymdOne = new JSONObject(); JSONObject cbrymdOne;
// 姓名
cbrymdOne.put("xm", vo.getEmpName()); // 2025-3-14 15:44:32 单个改造为批量
// 证件类型 for (SociaFriendYgsAddVo vo : listVo) {
cbrymdOne.put("zzlx", "居民身份证"); cbrymdOne = new JSONObject();
// 证件号码"828888200908213819" // 姓名
cbrymdOne.put("zzhm", vo.getEmpIdcard()); cbrymdOne.put("xm", vo.getEmpName());
// 证件类型
// 国籍(地区) "中国" cbrymdOne.put("zzlx", "居民身份证");
cbrymdOne.put("gj", "中国"); // 证件号码"828888200908213819"
// 性别 cbrymdOne.put("zzhm", vo.getEmpIdcard());
//cbrymdOne.put("xb", "男")
cbrymdOne.put("xb", getSexName(vo.getEmpIdcard())); // 国籍(地区) "中国"
// 出生日期 cbrymdOne.put("gj", "中国");
cbrymdOne.put("csrq", getBirthStr(vo.getEmpIdcard())); // 性别
// 民族 空的默认汉族 //cbrymdOne.put("xb", "男")
cbrymdOne.put("mz", vo.getEmpNational()); cbrymdOne.put("xb", getSexName(vo.getEmpIdcard()));
// 手机号码 // 出生日期
cbrymdOne.put("sjhm", vo.getEmpMobile()); cbrymdOne.put("csrq", getBirthStr(vo.getEmpIdcard()));
String areaName = "安徽省"; // 民族 空的默认汉族
// 户口地所在行政区 cbrymdOne.put("mz", vo.getEmpNational());
cbrymdOne.put("hkszdxzq", areaName); // 手机号码
// 户口所在地地址 cbrymdOne.put("sjhm", vo.getEmpMobile());
cbrymdOne.put("hkszddz", areaName); String areaName = "安徽省";
// 户口性质 // 户口地所在行政区
//cbrymdOne.put("hkxz", "居民户口(含农业户口、非农业户口)") cbrymdOne.put("hkszdxzq", areaName);
cbrymdOne.put("hkxz", "本地居民户口"); // 户口所在地地址
// 居住地址 cbrymdOne.put("hkszddz", areaName);
cbrymdOne.put("jzdz", areaName); // 户口性质
// 居住地行政区 //cbrymdOne.put("hkxz", "居民户口(含农业户口、非农业户口)")
cbrymdOne.put("jzdzxzq", areaName); cbrymdOne.put("hkxz", "本地居民户口");
// 社保起缴日期(养老起缴)yyyy-MM-dd // 居住地址
String startDate = vo.getSocialStartDate(); cbrymdOne.put("jzdz", areaName);
// 参加工作日期 // 居住地行政区
cbrymdOne.put("cjgzrq", startDate); cbrymdOne.put("jzdzxzq", areaName);
// 文化程度 见字典“受教育程度” 空的默认“大学专科” // 社保起缴日期(养老起缴)yyyy-MM-dd
//cbrymdOne.put("whcd", "大学专科") String startDate = vo.getSocialStartDate();
cbrymdOne.put("whcd", vo.getEducationName()); // 参加工作日期
cbrymdOne.put("cjgzrq", startDate);
// 办理项目列表 // 文化程度 见字典“受教育程度” 空的默认“大学专科”
JSONArray blxmlbArr = new JSONArray(); //cbrymdOne.put("whcd", "大学专科")
JSONObject blxmlbOne = new JSONObject(); cbrymdOne.put("whcd", vo.getEducationName());
String blxm = "社保";
// 险种类型 例如养老、工伤、医疗等 // 办理项目列表
String xzlb = "企业职工养老,工伤保险,失业保险"; JSONArray blxmlbArr = new JSONArray();
if (type > 2) { JSONObject blxmlbOne = new JSONObject();
blxm = "医保"; String blxm = "社保";
xzlb = null; // 险种类型 例如养老、工伤、医疗等
if (Common.isNotNull(vo.getUnitMedicalMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitMedicalMoney())) { String xzlb = "企业职工养老,工伤保险,失业保险";
xzlb = "职工基本医疗保险"; if (type > 2) {
} blxm = "医保";
if (Common.isNotNull(vo.getUnitBirthMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitBirthMoney())) { xzlb = null;
if (Common.isNotNull(xzlb)) { if (Common.isNotNull(vo.getUnitMedicalMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitMedicalMoney())) {
xzlb += ",生育保险"; xzlb = "职工基本医疗保险";
} else {
xzlb = "生育保险";
} }
} if (Common.isNotNull(vo.getUnitBirthMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitBirthMoney())) {
if (Common.isNotNull(vo.getUnitBigailmentMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitBigailmentMoney())) { if (Common.isNotNull(xzlb)) {
if (Common.isNotNull(xzlb)) { xzlb += ",生育保险";
xzlb += ",大额医疗"; } else {
} else { xzlb = "生育保险";
xzlb = "大额医疗"; }
}
if (Common.isNotNull(vo.getUnitBigailmentMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitBigailmentMoney())) {
if (Common.isNotNull(xzlb)) {
xzlb += ",大额医疗";
} else {
xzlb = "大额医疗";
}
} }
} }
String[] strArr = xzlb.split(",");
// 办理项目
blxmlbOne.put("blxm", blxm);
// 本次参保日期 格式:yyyy-MM-dd
blxmlbOne.put("bccbrq", startDate);
// 申报工资 社保派单里的“备案基数”
blxmlbOne.put("sbgz", vo.getRecordBase());
// 险种类型 例如养老、工伤、医疗等
blxmlbOne.put("xzlb", strArr);
blxmlbArr.add(blxmlbOne);
cbrymdOne.put("blxmlb", blxmlbArr);
// 特色字段信息
JSONObject tszdxx = new JSONObject();
// 增员年月 社保必填;yyyyMM 社保起缴日期(养老起缴)到月
tszdxx.put("zyny", vo.getSocialStartMonth());
// 同步办理用工劳动备案 社保必填;是
tszdxx.put("tbblygldhtba", "是");
// 参保模式 新参、续参
tszdxx.put("cbms", "续参");
// 就业登记时间 社保必填;yyyy-MM-dd
tszdxx.put("jydjsj", startDate);
// 单位就业起始时间 社保必填;yyyy-MM-dd
tszdxx.put("dwjyqssj", startDate);
// 安徽非必填!社保个人身份材料 取文件上传后获取的文件路径。图片总大小不超过1M, 材料仅支持图片格式,支持上传jpeg/jpg/png格式。
// tszdxx.put("sbzycl", url)
// 用工形式 社保必填 // 盛宇文档对应,只有3种
tszdxx.put("ygxs", vo.getContractType());
// 劳动合同签署情况 社保必填 默认"初签"
tszdxx.put("ldhtqsqk", "初签");
// 人员类型 默认:在职职工
tszdxx.put("rylx", "在职职工");
// 医保个人身份材料 安徽非必填! 无
//tszdxx.put("ybzycl", url)
// 职业工种 社保必填 默认“办事人员和有关人员”
tszdxx.put("zygz", "办事人员和有关人员");
// 人员身份 个人身份 社保必填 默认“职员”
tszdxx.put("grsf", "职员");
// 工作时间制度 社保必填
tszdxx.put("gzsjzd", vo.getWorkingHours());
// 医保用工形式 医保新参必填 默认“原固定职工”
tszdxx.put("ybygxs", "原固定职工");
// 毕业院校
tszdxx.put("byyx", vo.getByyx());
if (type < 3) {
// 企业职工社会保险增员花名册 安徽非必填!
// 社保增员必填
tszdxx.put("qyzgshbxzyhmc", vo.getQyzgshbxzyhmc());
} else {
// 企业职工基本医疗保险参保登记表 安徽非必填! 数组
String[] arr = {vo.getQyzgjbylbxcbdjb()};
// 增员、减员必填
tszdxx.put("qyzgjbylbxcbdjb", arr);
}
cbrymdOne.put("tszdxx", tszdxx);
// 就业信息 社保必填;
JSONObject jyxx = new JSONObject();
// 劳动合同类型
jyxx.put("ldhtlx", vo.getContractTypeTwo());
// 劳动合同起始日期
jyxx.put("ldhtqsrq", startDate);
// 劳动合同截止日期 派单里的“合同截止日期”
jyxx.put("ldhtjzrq", vo.getContractEnd());
cbrymdOne.put("jyxx", jyxx);
cbrymdArr.add(cbrymdOne);
} }
String[] strArr = xzlb.split(",");
// 办理项目
blxmlbOne.put("blxm", blxm);
// 本次参保日期 格式:yyyy-MM-dd
blxmlbOne.put("bccbrq", startDate);
// 申报工资 社保派单里的“备案基数”
blxmlbOne.put("sbgz", vo.getRecordBase());
// 险种类型 例如养老、工伤、医疗等
blxmlbOne.put("xzlb", strArr);
blxmlbArr.add(blxmlbOne);
cbrymdOne.put("blxmlb", blxmlbArr);
// 特色字段信息
JSONObject tszdxx = new JSONObject();
// 增员年月 社保必填;yyyyMM 社保起缴日期(养老起缴)到月
tszdxx.put("zyny", vo.getSocialStartMonth());
// 同步办理用工劳动备案 社保必填;是
tszdxx.put("tbblygldhtba", "是");
// 参保模式 新参、续参
tszdxx.put("cbms", "续参");
// 就业登记时间 社保必填;yyyy-MM-dd
tszdxx.put("jydjsj", startDate);
// 单位就业起始时间 社保必填;yyyy-MM-dd
tszdxx.put("dwjyqssj", startDate);
// 安徽非必填!社保个人身份材料 取文件上传后获取的文件路径。图片总大小不超过1M, 材料仅支持图片格式,支持上传jpeg/jpg/png格式。
// tszdxx.put("sbzycl", url)
// 用工形式 社保必填 // 盛宇文档对应,只有3种
tszdxx.put("ygxs", vo.getContractType());
// 劳动合同签署情况 社保必填 默认"初签"
tszdxx.put("ldhtqsqk", "初签");
// 人员类型 默认:在职职工
tszdxx.put("rylx", "在职职工");
// 医保个人身份材料 安徽非必填! 无
//tszdxx.put("ybzycl", url)
// 职业工种 社保必填 默认“办事人员和有关人员”
tszdxx.put("zygz", "办事人员和有关人员");
// 人员身份 个人身份 社保必填 默认“职员”
tszdxx.put("grsf", "职员");
// 工作时间制度 社保必填
tszdxx.put("gzsjzd", vo.getWorkingHours());
// 医保用工形式 医保新参必填 默认“原固定职工”
tszdxx.put("ybygxs", "原固定职工");
// 毕业院校
tszdxx.put("byyx", vo.getByyx());
if (type < 3) {
// 企业职工社会保险增员花名册 安徽非必填!
// 社保增员必填
tszdxx.put("qyzgshbxzyhmc", vo.getQyzgshbxzyhmc());
} else {
// 企业职工基本医疗保险参保登记表 安徽非必填! 数组
String[] arr = {vo.getQyzgjbylbxcbdjb()};
// 增员、减员必填
tszdxx.put("qyzgjbylbxcbdjb", arr);
}
cbrymdOne.put("tszdxx", tszdxx);
// 就业信息 社保必填;
JSONObject jyxx = new JSONObject();
// 劳动合同类型
jyxx.put("ldhtlx", vo.getContractTypeTwo());
// 劳动合同起始日期
jyxx.put("ldhtqsrq", startDate);
// 劳动合同截止日期 派单里的“合同截止日期”
jyxx.put("ldhtjzrq", vo.getContractEnd());
cbrymdOne.put("jyxx", jyxx);
cbrymdArr.add(cbrymdOne);
// 人员名单 // 人员名单
String buyType = "cbrymd"; String buyType = "cbrymd";
json.put(buyType, cbrymdArr); json.put(buyType, cbrymdArr);
...@@ -406,50 +427,54 @@ public class SocialFriendConfig { ...@@ -406,50 +427,54 @@ public class SocialFriendConfig {
* @Date: 2024/12/10 18:05 * @Date: 2024/12/10 18:05
* @return: void * @return: void
**/ **/
private void setEmpInfoReduce(JSONObject json, SociaFriendYgsAddVo vo, int type) { private void setEmpInfoReduce(JSONObject json, List<SociaFriendYgsAddVo> listVo, int type) {
// 参保人员名单 数组 // 参保人员名单 数组
// 参保人员名单 数组 // 参保人员名单 数组
JSONArray cbrymdArr = new JSONArray(); JSONArray cbrymdArr = new JSONArray();
JSONObject cbrymdOne = new JSONObject(); JSONObject cbrymdOne = new JSONObject();
// 姓名
cbrymdOne.put("xm", vo.getEmpName()); // 2025-3-14 15:44:32 单个改造为批量
// 证件类型 for (SociaFriendYgsAddVo vo : listVo) {
cbrymdOne.put("zzlx", "居民身份证"); // 姓名
// 证件号码"828888200908213819" cbrymdOne.put("xm", vo.getEmpName());
cbrymdOne.put("zzhm", vo.getEmpIdcard()); // 证件类型
// 办理项目列表 cbrymdOne.put("zzlx", "居民身份证");
JSONArray blxmlbArr = new JSONArray(); // 证件号码"828888200908213819"
JSONObject blxmlbOne = new JSONObject(); cbrymdOne.put("zzhm", vo.getEmpIdcard());
String blxm = "社保"; // 办理项目列表
if (type > 2) { JSONArray blxmlbArr = new JSONArray();
blxm = "医保"; JSONObject blxmlbOne = new JSONObject();
} String blxm = "社保";
// 办理项目 if (type > 2) {
blxmlbOne.put("blxm", blxm); blxm = "医保";
// 中断原因 除死亡以外,其他停保原因默认:“在职人员解除/终止劳动合同” 死亡对应“死亡或失踪” }
blxmlbOne.put("tbyy", vo.getTbyy()); // 办理项目
// 中断时间 yyyy-MM-dd 默认当前时间 blxmlbOne.put("blxm", blxm);
blxmlbOne.put("tbsj", DateUtil.getLastDay()); // 中断原因 除死亡以外,其他停保原因默认:“在职人员解除/终止劳动合同” 死亡对应“死亡或失踪”
blxmlbArr.add(blxmlbOne); blxmlbOne.put("tbyy", vo.getTbyy());
cbrymdOne.put("blxmlb", blxmlbArr); // 中断时间 yyyy-MM-dd 默认当前时间
blxmlbOne.put("tbsj", DateUtil.getLastDay());
// 特色字段信息 blxmlbArr.add(blxmlbOne);
JSONObject tszdxx = new JSONObject(); cbrymdOne.put("blxmlb", blxmlbArr);
// 劳动用工备案解除/终止原因 数据字典文档 法律依据 [社保]必填;
tszdxx.put("zzyy", vo.getZzyy()); // 特色字段信息
// 社保个人身份材料 无 JSONObject tszdxx = new JSONObject();
// tszdxx.put("shjycl", ) // 劳动用工备案解除/终止原因 数据字典文档 法律依据 [社保]必填;
// 医保个人身份材料 无 tszdxx.put("zzyy", vo.getZzyy());
// tszdxx.put("ybjycl", ) // 社保个人身份材料 无
// 职工社会保险减少花名册 无 // tszdxx.put("shjycl", )
// tszdxx.put("zgshbxjshmc", ) // 医保个人身份材料 无
if (type > 2) { // tszdxx.put("ybjycl", )
// 职工基本医疗保险参保登记表 // 职工社会保险减少花名册 无
String[] arr = {vo.getQyzgjbylbxcbdjb()}; // tszdxx.put("zgshbxjshmc", )
tszdxx.put("zgjbylbxcbdjb", arr); if (type > 2) {
// 职工基本医疗保险参保登记表
String[] arr = {vo.getQyzgjbylbxcbdjb()};
tszdxx.put("zgjbylbxcbdjb", arr);
}
cbrymdOne.put("tszdxx", tszdxx);
cbrymdArr.add(cbrymdOne);
} }
cbrymdOne.put("tszdxx", tszdxx);
cbrymdArr.add(cbrymdOne);
// 人员名单 // 人员名单
String buyType = "tbrymd"; String buyType = "tbrymd";
json.put(buyType, cbrymdArr); json.put(buyType, cbrymdArr);
...@@ -463,9 +488,10 @@ public class SocialFriendConfig { ...@@ -463,9 +488,10 @@ public class SocialFriendConfig {
* @Date: 2024-12-9 16:54:22 * @Date: 2024-12-9 16:54:22
* @return: java.lang.String * @return: java.lang.String
**/ **/
public FriendResult getFriendByRequestId(RestTemplate restTemplate, String requestId, TSocialFriendBackLog backLog, String type) { public List<FriendResult> getFriendByRequestId(RestTemplate restTemplate, String requestId, TSocialFriendBackLog backLog, String type) {
List<FriendResult> resultList = new ArrayList<>();
if (Common.isEmpty(requestId)) { if (Common.isEmpty(requestId)) {
return null; return resultList;
} }
String appAddUrl = urlPre; String appAddUrl = urlPre;
if (CommonConstants.ZERO_STRING.equals(type)) { if (CommonConstants.ZERO_STRING.equals(type)) {
...@@ -486,7 +512,7 @@ public class SocialFriendConfig { ...@@ -486,7 +512,7 @@ public class SocialFriendConfig {
headers.add("signature", signature); headers.add("signature", signature);
} catch (SignatureException e) { } catch (SignatureException e) {
log.error("税友签名失败", e); log.error("税友签名失败", e);
return null; return resultList;
} }
headers.add(X_REQ_NONCE, xReqNonce); headers.add(X_REQ_NONCE, xReqNonce);
headers.add(VERSION, version); headers.add(VERSION, version);
...@@ -499,19 +525,18 @@ public class SocialFriendConfig { ...@@ -499,19 +525,18 @@ public class SocialFriendConfig {
if (statusCode != 200) { if (statusCode != 200) {
throw new CheckedException("获取税友结果失败,statusCode=" + statusCode); throw new CheckedException("获取税友结果失败,statusCode=" + statusCode);
} }
FriendResult result = new FriendResult();
String dataResultList = response.getBody(); String dataResultList = response.getBody();
backLog.setCreateTime(LocalDateTime.now()); backLog.setCreateTime(LocalDateTime.now());
backLog.setLogInfo(dataResultList); backLog.setLogInfo(dataResultList);
// 组装返回结果 // 组装返回结果
getResultToVo(dataResultList, result); getResultToVo(dataResultList, resultList);
return result; return resultList;
} }
// 组装返回结果 // 组装返回结果
private void getResultToVo(String dataResultList, FriendResult result) { private void getResultToVo(String dataResultList, List<FriendResult> resultList) {
if (Common.isNotNull(dataResultList)) { if (Common.isNotNull(dataResultList)) {
JSONObject dataObject = JSON.parseObject(dataResultList); JSONObject dataObject = JSON.parseObject(dataResultList);
String head = dataObject.getString("head"); String head = dataObject.getString("head");
...@@ -522,39 +547,50 @@ public class SocialFriendConfig { ...@@ -522,39 +547,50 @@ public class SocialFriendConfig {
String body = dataObject.getString("body"); String body = dataObject.getString("body");
JSONObject bodyObject = JSON.parseObject(body); JSONObject bodyObject = JSON.parseObject(body);
// 获取核心结果 // 获取核心结果
getResultToVoCore(result, bodyObject); getResultToVoCore(resultList, bodyObject);
} }
} }
} }
} }
// 提取方法,组装核心结果 // 提取方法,组装核心结果
private void getResultToVoCore(FriendResult result, JSONObject bodyObject) { private void getResultToVoCore(List<FriendResult> resultList, JSONObject bodyObject) {
if (Common.isNotNull(bodyObject)) { if (Common.isNotNull(bodyObject)) {
// 人员办理项目结果 // 人员办理项目结果
JSONArray ryywbljglbArr = (JSONArray) bodyObject.get("ryywbljglb"); JSONArray ryywbljglbArr = (JSONArray) bodyObject.get("ryywbljglb");
if (Common.isNotNull(ryywbljglbArr)) { if (Common.isNotNull(ryywbljglbArr)) {
// 注意:此处可以返回多条身份证,但是我们单条提交 // 注意:此处可以返回多条身份证,但是我们单条提交
JSONObject ryywbljglb = (JSONObject) ryywbljglbArr.get(0); JSONObject ryywbljglb;
// 身份证 FriendResult result;
String idCard = ryywbljglb.getString("zzhm"); String idCard;
result.setIdCard(idCard); JSONArray blxmjglbArr;
// 办理项目列表 JSONObject blxmjglb;
JSONArray blxmjglbArr = (JSONArray) ryywbljglb.get("blxmjglb"); String zt;
if (Common.isNotNull(blxmjglbArr)) { String cwxx;
// 注意:此处可以返回多条办理,但是我们社保与医保分开提交 for (int i=0; i<ryywbljglbArr.size(); i++) {
JSONObject blxmjglb = (JSONObject) blxmjglbArr.get(0); ryywbljglb = (JSONObject) ryywbljglbArr.get(i);
// 状态1-处理中,2-处理成功,3-处理失败,4-待办(提交成功,待网厅状态流转,上海特有) result = new FriendResult();
String zt = blxmjglb.getString("zt"); // 身份证
result.setZt(zt); idCard = ryywbljglb.getString("zzhm");
// 明细状态:提交失败、审核失败、审核成功、待确认 result.setIdCard(idCard);
//String mxzt = blxmjglb.getString("mxzt") // 办理项目列表
// 提示或者错误信息 SUCCESS blxmjglbArr = (JSONArray) ryywbljglb.get("blxmjglb");
String cwxx = blxmjglb.getString("cwxx"); if (Common.isNotNull(blxmjglbArr)) {
if (Common.isNotNull(cwxx) && cwxx.length()>100 ) { // 注意:此处可以返回多条办理,但是我们社保与医保分开提交
cwxx = cwxx.substring(0, 100); blxmjglb = (JSONObject) blxmjglbArr.get(0);
// 状态1-处理中,2-处理成功,3-处理失败,4-待办(提交成功,待网厅状态流转,上海特有)
zt = blxmjglb.getString("zt");
result.setZt(zt);
// 明细状态:提交失败、审核失败、审核成功、待确认
//String mxzt = blxmjglb.getString("mxzt")
// 提示或者错误信息 SUCCESS
cwxx = blxmjglb.getString("cwxx");
if (Common.isNotNull(cwxx) && cwxx.length() > 100) {
cwxx = cwxx.substring(0, 100);
}
result.setCwxx(cwxx);
} }
result.setCwxx(cwxx); resultList.add(result);
} }
} }
} }
......
...@@ -17,19 +17,27 @@ ...@@ -17,19 +17,27 @@
package com.yifu.cloud.plus.v1.yifu.social.controller; package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.alibaba.fastjson.JSONObject; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindPushAndGet;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFreindPushAndGetService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendPushService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendPushService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendService;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.time.LocalDateTime;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
...@@ -44,8 +52,12 @@ import java.util.List; ...@@ -44,8 +52,12 @@ import java.util.List;
@Tag(name = "税友") @Tag(name = "税友")
public class TSocialFriendController { public class TSocialFriendController {
private AtomicInteger atomicPush = new AtomicInteger(0);
private AtomicInteger atomicGet = new AtomicInteger(0);
private final TSocialFriendService tSocialFriendService; private final TSocialFriendService tSocialFriendService;
private final TSocialFriendPushService tSocialFriendPushService; private final TSocialFriendPushService tSocialFriendPushService;
private final TSocialFreindPushAndGetService tSocialFreindPushAndGetService;
@Operation(description = "1定时任务推送税友") @Operation(description = "1定时任务推送税友")
@PostMapping("/inner/doPushFriend") @PostMapping("/inner/doPushFriend")
...@@ -63,4 +75,93 @@ public class TSocialFriendController { ...@@ -63,4 +75,93 @@ public class TSocialFriendController {
return tSocialFriendService.getInfoByRequestId(); return tSocialFriendService.getInfoByRequestId();
} }
/**
* @Description: 主动推送税友
* @Author: hgw
* @Date: 2025/3/18 10:44
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "主动推送税友")
@GetMapping("/doPushFriendByActive")
@SysLog("主动推送税友")
public R<String> doPushFriendActive() {
if (atomicPush.incrementAndGet() <= 1) {
try {
R<String> failed = getCore(CommonConstants.ONE_INT);
if (failed != null) return failed;
} finally {
atomicPush.decrementAndGet();
}
return R.ok();
} else {
atomicPush.decrementAndGet();
return R.failed("距离上一次推送任务时间间隔太短,请10分钟后再试!!");
}
}
/**
* @param type 1推送2拉取
* @Description: 核心处理
* @Author: hgw
* @Date: 2025/3/18 17:27
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> getCore(int type) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getNickname())) {
return R.failed("请先登录!");
}
// 先加限制 查有没有到10分钟
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 计算10分钟前的时间
LocalDateTime tenMinutesAgo = now.minusMinutes(10);
LocalDateTime time = tSocialFreindPushAndGetService.getMaxTimeByType(type);
if (Common.isEmpty(time) || time.isBefore(tenMinutesAgo)) {
TSocialFreindPushAndGet info = new TSocialFreindPushAndGet();
info.setType(type);
info.setCreateTime(now);
info.setCreateUserName(user.getNickname());
tSocialFreindPushAndGetService.save(info);
if (type == CommonConstants.ONE_INT) {
tSocialFriendPushService.pushFriendByAsync();
} else {
tSocialFriendService.getInfoByRequestIdByAsync();
}
return R.ok();
}
if (Common.isNotNull(time) && time.isAfter(tenMinutesAgo)) {
if (type == CommonConstants.ONE_INT) {
return R.failed("距离上一次推送任务时间间隔太短,请10分钟后再试!");
} else {
return R.failed("距离上一次拉取任务时间间隔太短,请10分钟后再试!");
}
}
return null;
}
/**
* @Description: 主动获取税友
* @Author: hgw
* @Date: 2025/3/18 10:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "主动获取税友")
@GetMapping("/doGetFriendByActive")
@SysLog("主动获取税友")
public R<String> doGetFriendByActive() {
if (atomicGet.incrementAndGet() <= 1) {
try {
R<String> failed = getCore(CommonConstants.TWO_INT);
if (failed != null) return failed;
} finally {
atomicGet.decrementAndGet();
}
return R.ok();
} else {
atomicGet.decrementAndGet();
return R.failed("距离上一次推送任务时间间隔太短,请10分钟后再试!!");
}
}
} }
...@@ -31,6 +31,7 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -31,6 +31,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -62,6 +63,18 @@ public class TSocialSoldierLogController { ...@@ -62,6 +63,18 @@ public class TSocialSoldierLogController {
return new R<>(tSocialSoldierLogService.getTSocialSoldierLogPage(page, tSocialSoldierLog)); return new R<>(tSocialSoldierLogService.getTSocialSoldierLogPage(page, tSocialSoldierLog));
} }
/**
* @Description: 获取最新的拉取时间
* @Author: hgw
* @Date: 2025/3/18 18:09
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.time.LocalDateTime>
**/
@Operation(description = "获取最新的拉取时间")
@GetMapping("/getMaxTimeToLog")
public R<LocalDateTime> getMaxTimeToLog() {
return R.ok(tSocialSoldierLogService.getMaxTimeToLog());
}
/** /**
* 不分页查询 * 不分页查询
* *
......
/*
* 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.TSocialFreindPushAndGet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
@Mapper
public interface TSocialFreindPushAndGetMapper extends BaseMapper<TSocialFreindPushAndGet> {
/**
* @param type 类型:1推送;2拉取
* @Description: 获取当前类型最大的时间,用来判断10分钟内是否有操作过
* @Author: hgw
* @Date: 2025/3/18 15:57
* @return: java.time.LocalDateTime
**/
LocalDateTime getMaxTimeByType(@Param("type") Integer type);
}
...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierLogSearchVo; ...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierLogSearchVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
...@@ -46,4 +47,6 @@ public interface TSocialSoldierLogMapper extends BaseMapper<TSocialSoldierLog> { ...@@ -46,4 +47,6 @@ public interface TSocialSoldierLogMapper extends BaseMapper<TSocialSoldierLog> {
List<TSocialSoldierLogExportVo> getTSocialSoldierLogList(@Param("tSocialSoldierLog") TSocialSoldierLogSearchVo tSocialSoldierLog); List<TSocialSoldierLogExportVo> getTSocialSoldierLogList(@Param("tSocialSoldierLog") TSocialSoldierLogSearchVo tSocialSoldierLog);
LocalDateTime getMaxTimeToLog();
} }
/*
* 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.TSocialFreindPushAndGet;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
public interface TSocialFreindPushAndGetService extends IService<TSocialFreindPushAndGet> {
/**
* @param type 类型:1推送;2拉取
* @Description: 获取当前类型最大的时间,用来判断10分钟内是否有操作过
* @Author: hgw
* @Date: 2025/3/18 15:57
* @return: java.time.LocalDateTime
**/
LocalDateTime getMaxTimeByType(Integer type);
}
...@@ -40,5 +40,13 @@ public interface TSocialFriendPushService extends IService<TSocialInfo> { ...@@ -40,5 +40,13 @@ public interface TSocialFriendPushService extends IService<TSocialInfo> {
**/ **/
R<String> pushFriend(List<String> dispatchIdList); R<String> pushFriend(List<String> dispatchIdList);
/**
* @Description: 主动推送税友-异步
* @Author: hgw
* @Date: 2025/3/18 10:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
void pushFriendByAsync();
R<String> doExportRoster(String socialId, String type, String unitCreditCode); R<String> doExportRoster(String socialId, String type, String unitCreditCode);
} }
...@@ -37,4 +37,12 @@ public interface TSocialFriendService extends IService<TSocialInfo> { ...@@ -37,4 +37,12 @@ public interface TSocialFriendService extends IService<TSocialInfo> {
**/ **/
R<String> getInfoByRequestId(); R<String> getInfoByRequestId();
/**
* @Description: 主动获取税友-异步
* @Author: hgw
* @Date: 2025/3/18 10:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
void getInfoByRequestIdByAsync();
} }
...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog; ...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog;
import com.yifu.cloud.plus.v1.yifu.social.vo.*; import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
...@@ -42,6 +43,14 @@ public interface TSocialSoldierLogService extends IService<TSocialSoldierLog> { ...@@ -42,6 +43,14 @@ public interface TSocialSoldierLogService extends IService<TSocialSoldierLog> {
*/ */
IPage<TSocialSoldierLog> getTSocialSoldierLogPage(Page<TSocialSoldierLog> page, TSocialSoldierLogSearchVo tSocialSoldierLog); IPage<TSocialSoldierLog> getTSocialSoldierLogPage(Page<TSocialSoldierLog> page, TSocialSoldierLogSearchVo tSocialSoldierLog);
/**
* @Description: 获取最新的拉取时间
* @Author: hgw
* @Date: 2025/3/18 18:10
* @return: java.time.LocalDateTime
**/
LocalDateTime getMaxTimeToLog();
void listExport(HttpServletResponse response, TSocialSoldierLogSearchVo searchVo); void listExport(HttpServletResponse response, TSocialSoldierLogSearchVo searchVo);
List<TSocialSoldierLog> noPageDiy(TSocialSoldierLogSearchVo searchVo); List<TSocialSoldierLog> noPageDiy(TSocialSoldierLogSearchVo searchVo);
......
/*
* 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.TSocialFreindPushAndGet;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFreindPushAndGetMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFreindPushAndGetService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
@Log4j2
@Service
public class TSocialFreindPushAndGetServiceImpl extends ServiceImpl<TSocialFreindPushAndGetMapper, TSocialFreindPushAndGet> implements TSocialFreindPushAndGetService {
/**
* @param type 类型:1推送;2拉取
* @Description: 获取当前类型最大的时间,用来判断10分钟内是否有操作过
* @Author: hgw
* @Date: 2025/3/18 15:57
* @return: java.time.LocalDateTime
**/
@Override
public LocalDateTime getMaxTimeByType(Integer type) {
return baseMapper.getMaxTimeByType(type);
}
}
...@@ -40,12 +40,14 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.*; ...@@ -40,12 +40,14 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.io.*; import java.io.*;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 税友-推送 * 税友-推送
...@@ -66,6 +68,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -66,6 +68,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
private final TSocialFriendBackLogService tSocialFriendBackLogService; private final TSocialFriendBackLogService tSocialFriendBackLogService;
private final TSocialFreindSetService tSocialFreindSetService; private final TSocialFreindSetService tSocialFreindSetService;
private final TSocialInfoMapper socialMapper; private final TSocialInfoMapper socialMapper;
private final AtomicInteger atomicPushFriend = new AtomicInteger(0);
@Autowired @Autowired
private ExcelMergeImage excelMergeImage; private ExcelMergeImage excelMergeImage;
@Autowired @Autowired
...@@ -82,6 +86,19 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -82,6 +86,19 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
@Autowired @Autowired
private TDispatchInfoMapper dispatchInfoMapper; private TDispatchInfoMapper dispatchInfoMapper;
/**
* @Description: 核心推送改为异步
* @Author: hgw
* @Date: 2025/3/18 10:52
* @return: void
**/
@Async
@Override
public void pushFriendByAsync() {
this.pushFriend(null);
}
/** /**
* @Description: 推送到税友 * @Description: 推送到税友
* @Author: hgw * @Author: hgw
...@@ -90,43 +107,52 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -90,43 +107,52 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
**/ **/
@Override @Override
public R<String> pushFriend(List<String> dispatchIdList) { public R<String> pushFriend(List<String> dispatchIdList) {
TSocialFreindSet set = tSocialFreindSetService.getById("1"); if (atomicPushFriend.incrementAndGet() <= 1) {
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) { try {
TSocialFreindSet set = tSocialFreindSetService.getById("1");
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) {
// 获取时间限制配置(获取 当月启用 的配置) // 获取时间限制配置(获取 当月启用 的配置)
Map<String, TSocialDeadlineInfo> socialSetMap = tSocialDeadlineInfoService.getSocialSetByAreaId(); Map<String, TSocialDeadlineInfo> socialSetMap = tSocialDeadlineInfoService.getSocialSetByAreaId();
// 社保增员、社保减员、医保增员、医保减员 // 社保增员、社保减员、医保增员、医保减员
// 养工失新增列表 // 养工失新增列表
List<SociaFriendYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList); List<SociaFriendYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList);
if (ygsAddlist != null && !ygsAddlist.isEmpty()) { if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
this.doPushSocialAndLogYgs(socialSetMap, ygsAddlist, 1); this.doPushSocialAndLogYgs(socialSetMap, ygsAddlist, 1);
} }
// 养工失减少列表 // 养工失减少列表
List<SociaFriendYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList); List<SociaFriendYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList);
if (ygsReducelist != null && !ygsReducelist.isEmpty()) { if (ygsReducelist != null && !ygsReducelist.isEmpty()) {
this.doPushSocialAndLogYgs(socialSetMap, ygsReducelist, 2); this.doPushSocialAndLogYgs(socialSetMap, ygsReducelist, 2);
} }
// 医生大新增列表 // 医生大新增列表
List<SociaFriendYgsAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList); List<SociaFriendYgsAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList);
if (ysdAddlist != null && !ysdAddlist.isEmpty()) { if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdAddlist, 3); this.doPushSocialAndLogYsd(socialSetMap, ysdAddlist, 3);
} }
// 医生大减少列表 // 医生大减少列表
List<SociaFriendYgsAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList); List<SociaFriendYgsAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList);
if (ysdReducelist != null && !ysdReducelist.isEmpty()) { if (ysdReducelist != null && !ysdReducelist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdReducelist, 4); this.doPushSocialAndLogYsd(socialSetMap, ysdReducelist, 4);
} }
if ((ygsAddlist == null || ygsAddlist.isEmpty()) if ((ygsAddlist == null || ygsAddlist.isEmpty())
&& (ygsReducelist == null || ygsReducelist.isEmpty()) && (ygsReducelist == null || ygsReducelist.isEmpty())
&& (ysdAddlist == null || ysdAddlist.isEmpty()) && (ysdAddlist == null || ysdAddlist.isEmpty())
&& (ysdReducelist == null || ysdReducelist.isEmpty()) && (ysdReducelist == null || ysdReducelist.isEmpty())
) { ) {
return R.failed("无数据,推送结束!"); return R.failed("无数据,推送结束!");
}
}
} finally {
atomicPushFriend.decrementAndGet();
} }
return R.ok();
} else {
atomicPushFriend.decrementAndGet();
return R.failed("距离上一次推送任务时间间隔太短,请10分钟后再试!!!");
} }
return R.ok("推送成功!!");
} }
/** /**
...@@ -142,35 +168,71 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -142,35 +168,71 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
String typeStr = "提交"; String typeStr = "提交";
List<TSocialSoldierLog> logList = new ArrayList<>(); List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog; TSocialSoldierLog socialLog;
String remark; String remark = null;
List<TSocialInfo> renGongList = new ArrayList<>(); List<TSocialInfo> renGongList = new ArrayList<>();
String requestId; String requestId;
String thisTime = DateUtil.getThisTime(); String thisTime = DateUtil.getThisTime();
List<TSocialFriendBackLog> backLogList = new ArrayList<>(); List<TSocialFriendBackLog> backLogList = new ArrayList<>();
R<String> urlR; R<String> urlR;
for (SociaFriendYgsAddVo vo : ygsAddlist) { List<SociaFriendYgsAddVo> listVo = new ArrayList<>();
List<TSocialSoldierLog> logTemp = new ArrayList<>();
List<TSocialInfo> socialInfoTemp = new ArrayList<>();
List<TSocialInfo> socialInfoUpdate = new ArrayList<>();
int i=1;
String ygsHandleStatus;
String dispatchItem = "社保";
// 同一个户才一批次推送,因为账号密码不一样 ,不同户,则先推送一批
boolean nextFlag = false;
SociaFriendYgsAddVo vo;
for (int index = 0 ; index < ygsAddlist.size(); index++) {
vo = ygsAddlist.get(index);
// 0:未到时间不动; 1:推送; 2:转人工 // 0:未到时间不动; 1:推送; 2:转人工
canPushType = this.getCanPushType(socialSetMap, vo); canPushType = this.getCanPushType(socialSetMap, vo);
if (1 == canPushType) { if (1 == canPushType) {
try { try {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
// 房工接口,获取 企业职工社会保险增员花名册 url // 房工接口,获取 企业职工社会保险增员花名册 url
urlR = doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode()); urlR = doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode());
if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) { if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) {
vo.setQyzgshbxzyhmc(urlR.getData()); vo.setQyzgshbxzyhmc(urlR.getData());
} }
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, type, thisTime, backLogList); listVo.add(vo);
if (Common.isEmpty(requestId)) { socialInfo = new TSocialInfo();
socialInfo.setYgsRequestId("推送税友失败"); socialInfo.setId(vo.getSocialId());
socialInfo.setYgsHandleStatus(CommonConstants.FIVE_STRING); socialInfoTemp.add(socialInfo);
remark = "推送税友失败,转人工处理!"; socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
} else { if (socialLog != null) {
socialInfo.setYgsRequestId(requestId); logTemp.add(socialLog);
socialInfo.setYgsHandleStatus(CommonConstants.TWO_STRING); }
if (Common.isNotNull(vo.getSocialHouseholdName())
&& index+1 < ygsAddlist.size()
&& !vo.getSocialHouseholdName().equals(ygsAddlist.get(index+1).getSocialHouseholdName())) {
nextFlag = true;
}
if (nextFlag || i % 20 == 0 || i >= ygsAddlist.size()) {
nextFlag = false;
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, listVo, type, thisTime, backLogList);
ygsHandleStatus = CommonConstants.TWO_STRING;
remark = "已推送提交任务!"; remark = "已推送提交任务!";
if (Common.isEmpty(requestId)) {
requestId = "推送税友失败";
ygsHandleStatus = CommonConstants.FIVE_STRING;
remark = "推送税友失败,转人工处理!";
}
for (TSocialInfo s : socialInfoTemp) {
s.setYgsRequestId(requestId);
s.setYgsHandleStatus(ygsHandleStatus);
socialInfoUpdate.add(s);
}
for (TSocialSoldierLog sLog : logTemp) {
sLog.setRemark("【税友】" + remark);
logList.add(sLog);
}
// 重置
listVo = new ArrayList<>();
socialInfoTemp = new ArrayList<>();
logTemp = new ArrayList<>();
} }
tSocialInfoService.updateById(socialInfo); i++;
} catch (Exception e) { } catch (Exception e) {
remark = "提交社保士兵异常!"; remark = "提交社保士兵异常!";
} }
...@@ -184,13 +246,15 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -184,13 +246,15 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
socialInfo.setYgsHandleStatus(CommonConstants.FIVE_STRING); socialInfo.setYgsHandleStatus(CommonConstants.FIVE_STRING);
renGongList.add(socialInfo); renGongList.add(socialInfo);
} }
} socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, "社保", remark); if (socialLog != null) {
if (socialLog != null) { logList.add(socialLog);
logList.add(socialLog); }
} }
} }
if (!socialInfoUpdate.isEmpty()) {
tSocialInfoService.updateBatchById(socialInfoUpdate);
}
if (!backLogList.isEmpty()) { if (!backLogList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(backLogList); tSocialFriendBackLogService.saveBatch(backLogList);
} }
...@@ -216,13 +280,24 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -216,13 +280,24 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
List<TSocialSoldierLog> logList = new ArrayList<>(); List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog; TSocialSoldierLog socialLog;
List<TSocialInfo> renGongList = new ArrayList<>(); List<TSocialInfo> renGongList = new ArrayList<>();
String remark; String remark = null;
String requestId; String requestId;
String thisTime = DateUtil.getThisTime(); String thisTime = DateUtil.getThisTime();
List<TSocialFriendBackLog> backLogList = new ArrayList<>(); List<TSocialFriendBackLog> backLogList = new ArrayList<>();
R<String> urlR; R<String> urlR;
for (SociaFriendYgsAddVo vo : ysdAddlist) {
// List<SociaFriendYgsAddVo> listVo = new ArrayList<>();
List<TSocialSoldierLog> logTemp = new ArrayList<>();
List<TSocialInfo> socialInfoTemp = new ArrayList<>();
List<TSocialInfo> socialInfoUpdate = new ArrayList<>();
int i=1;
String ysdHandleStatus;
String dispatchItem = "医保";
// 同一个户才一批次推送,因为账号密码不一样 ,不同户,则先推送一批
boolean nextFlag = false;
SociaFriendYgsAddVo vo;
for (int index = 0 ; index < ysdAddlist.size(); index++) {
vo = ysdAddlist.get(index);
// 0:未到时间不动; 1:推送; 2:转人工 // 0:未到时间不动; 1:推送; 2:转人工
if ("劳动者死亡".equals(vo.getTbyy())) { if ("劳动者死亡".equals(vo.getTbyy())) {
remark = "劳动者死亡,转人工!"; remark = "劳动者死亡,转人工!";
...@@ -230,6 +305,10 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -230,6 +305,10 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
socialInfo.setId(vo.getSocialId()); socialInfo.setId(vo.getSocialId());
socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING); socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING);
renGongList.add(socialInfo); renGongList.add(socialInfo);
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
if (socialLog != null) {
logList.add(socialLog);
}
} else { } else {
canPushType = this.getCanPushTypeYsd(socialSetMap, vo); canPushType = this.getCanPushTypeYsd(socialSetMap, vo);
if (1 == canPushType) { if (1 == canPushType) {
...@@ -241,17 +320,44 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -241,17 +320,44 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) { if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) {
vo.setQyzgjbylbxcbdjb(urlR.getData()); vo.setQyzgjbylbxcbdjb(urlR.getData());
} }
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, type, thisTime, backLogList);
if (Common.isEmpty(requestId)) { listVo.add(vo);
socialInfo.setYsdRequestId("推送税友失败"); socialInfo = new TSocialInfo();
socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING); socialInfo.setId(vo.getSocialId());
remark = "推送税友失败,转人工处理!"; socialInfoTemp.add(socialInfo);
} else { socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
socialInfo.setYsdRequestId(requestId); if (socialLog != null) {
socialInfo.setYsdHandleStatus(CommonConstants.TWO_STRING); logTemp.add(socialLog);
}
if (Common.isNotNull(vo.getSocialHouseholdName())
&& index+1 < ysdAddlist.size()
&& !vo.getSocialHouseholdName().equals(ysdAddlist.get(index+1).getSocialHouseholdName())) {
nextFlag = true;
}
if (nextFlag || i % 20 == 0 || i >= ysdAddlist.size()) {
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, listVo, type, thisTime, backLogList);
ysdHandleStatus = CommonConstants.TWO_STRING;
remark = "已推送提交任务!"; remark = "已推送提交任务!";
if (Common.isEmpty(requestId)) {
requestId = "推送税友失败";
ysdHandleStatus = CommonConstants.FIVE_STRING;
remark = "推送税友失败,转人工处理!";
}
for (TSocialInfo s : socialInfoTemp) {
s.setYsdRequestId(requestId);
s.setYsdHandleStatus(ysdHandleStatus);
socialInfoUpdate.add(s);
}
for (TSocialSoldierLog sLog : logTemp) {
sLog.setRemark("【税友】" + remark);
logList.add(sLog);
}
// 重置
listVo = new ArrayList<>();
socialInfoTemp = new ArrayList<>();
logTemp = new ArrayList<>();
} }
tSocialInfoService.updateById(socialInfo); i++;
} catch (Exception e) { } catch (Exception e) {
remark = "提交社保士兵异常!"; remark = "提交社保士兵异常!";
} }
...@@ -265,16 +371,19 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -265,16 +371,19 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING); socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING);
renGongList.add(socialInfo); renGongList.add(socialInfo);
} }
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
if (socialLog != null) {
logList.add(socialLog);
}
} }
} }
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, "医保", remark);
if (socialLog != null) {
logList.add(socialLog);
}
} }
if (!backLogList.isEmpty()) { if (!backLogList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(backLogList); tSocialFriendBackLogService.saveBatch(backLogList);
} }
if (!socialInfoUpdate.isEmpty()) {
tSocialInfoService.updateBatchById(socialInfoUpdate);
}
if (!renGongList.isEmpty()) { if (!renGongList.isEmpty()) {
tSocialInfoService.updateBatchById(renGongList); tSocialInfoService.updateBatchById(renGongList);
} }
...@@ -630,7 +739,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -630,7 +739,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
inputStreamOut = new FileInputStream(outFile); inputStreamOut = new FileInputStream(outFile);
// 转换成图片 完成后清理流 // 转换成图片 完成后清理流
TSocialFriendBackLog backLog = new TSocialFriendBackLog(); TSocialFriendBackLog backLog = new TSocialFriendBackLog();
backLog.setType(Integer.parseInt(type)); backLog.setType(CommonConstants.SEVEN_INT);
backLog.setSocialId(searchVo.getSocialId());
R<String> ulrR = excelToImage.excelToImg(inputStreamOut, socialFriendConfig, restTemplate, backLog); R<String> ulrR = excelToImage.excelToImg(inputStreamOut, socialFriendConfig, restTemplate, backLog);
tSocialFriendBackLogService.save(backLog); tSocialFriendBackLogService.save(backLog);
return ulrR; return ulrR;
...@@ -894,7 +1004,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -894,7 +1004,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
inputStreamOut = new FileInputStream(outFile); inputStreamOut = new FileInputStream(outFile);
// 转换成图片 完成后清理流 // 转换成图片 完成后清理流
TSocialFriendBackLog backLog = new TSocialFriendBackLog(); TSocialFriendBackLog backLog = new TSocialFriendBackLog();
backLog.setType(Integer.parseInt(type)); backLog.setSocialId(searchVo.getSocialId());
backLog.setType(CommonConstants.SIX_INT);
R<String> ulrR = excelToImage.excelToImg(inputStreamOut, socialFriendConfig, restTemplate, backLog); R<String> ulrR = excelToImage.excelToImg(inputStreamOut, socialFriendConfig, restTemplate, backLog);
tSocialFriendBackLogService.save(backLog); tSocialFriendBackLogService.save(backLog);
return ulrR; return ulrR;
......
...@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; ...@@ -24,6 +24,7 @@ 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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialFriendConfig; 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.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper;
...@@ -31,12 +32,16 @@ import com.yifu.cloud.plus.v1.yifu.social.service.*; ...@@ -31,12 +32,16 @@ import com.yifu.cloud.plus.v1.yifu.social.service.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult; import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 税友 * 税友
...@@ -58,6 +63,18 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -58,6 +63,18 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
private final TSocialSoldierLogService tSocialSoldierLogService; private final TSocialSoldierLogService tSocialSoldierLogService;
private final TSocialFriendBackLogService tSocialFriendBackLogService; private final TSocialFriendBackLogService tSocialFriendBackLogService;
private final TSocialFreindSetService tSocialFreindSetService; private final TSocialFreindSetService tSocialFreindSetService;
private final AtomicInteger atomicGetFriend = new AtomicInteger(0);
/**
* @Description: 核心推送改为异步
* @Author: hgw
* @Date: 2025/3/18 10:52
* @return: void
**/
@Async
@Override
public void getInfoByRequestIdByAsync() {
this.getInfoByRequestId();
}
/** /**
* @Description: 5 查看任务进度 * @Description: 5 查看任务进度
...@@ -67,73 +84,110 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -67,73 +84,110 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
**/ **/
@Override @Override
public R<String> getInfoByRequestId() { public R<String> getInfoByRequestId() {
TSocialFreindSet set = tSocialFreindSetService.getById("1"); if (atomicGetFriend.incrementAndGet() <= 1) {
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) { try {
// true养工失 false 医生大 TSocialFreindSet set = tSocialFreindSetService.getById("1");
boolean typeFlag = true; if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) {
Set<String> dbAuthsSet = new HashSet<>(); // true养工失 false 医生大
Collection<? extends GrantedAuthority> authorities = AuthorityUtils boolean typeFlag = true;
.createAuthorityList(dbAuthsSet.toArray(new String[0])); Set<String> dbAuthsSet = new HashSet<>();
YifuUser user = new YifuUser("1", 1L, "", "税友", Collection<? extends GrantedAuthority> authorities = AuthorityUtils
"税友", "0", SecurityConstants.BCRYPT + "123456", .createAuthorityList(dbAuthsSet.toArray(new String[0]));
"12345678911", true, true, true, YifuUser user = new YifuUser("1", 1L, "", "税友",
true, "税友", "0", SecurityConstants.BCRYPT + "123456",
"1", authorities, "1", "12345678911", true, true, true,
null, null, true,
null, null); "1", authorities, "1",
// 失败原因配置 null, null,
Map<String, FailReasonConfig> errorMap = failReasonConfigService.getFailReasonMap(); null, null);
// 获取所有需要反馈的任务id // 失败原因配置
List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll(); Map<String, FailReasonConfig> errorMap = failReasonConfigService.getFailReasonMap();
List<TSocialFriendBackLog> logList; // 获取所有需要反馈的任务id
TSocialFriendBackLog backLog; List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll();
if (socialList != null && !socialList.isEmpty()) { List<TSocialFriendBackLog> logList;
FriendResult info; TSocialFriendBackLog backLog = new TSocialFriendBackLog();
logList = new ArrayList<>(); FriendResult info;
for (TSocialInfo socialInfo : socialList) { List<FriendResult> resultList;
backLog = new TSocialFriendBackLog(); Map<String, FriendResult> resultMap;
backLog.setSocialId(socialInfo.getId()); if (socialList != null && !socialList.isEmpty()) {
backLog.setRequestId(socialInfo.getYgsRequestId()); logList = new ArrayList<>();
backLog.setType(1); resultMap = new HashMap<>();
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) { for (TSocialInfo socialInfo : socialList) {
backLog.setType(2); info = resultMap.get(socialInfo.getEmpIdcard());
} if (info == null) {
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId(), backLog, socialInfo.getDispatchType()); backLog = new TSocialFriendBackLog();
logList.add(backLog); backLog.setSocialId(socialInfo.getEmpIdcard());
if (info != null && Common.isNotNull(info.getZt())) { backLog.setRequestId(socialInfo.getYgsRequestId());
doCore(info, socialInfo, typeFlag, user, errorMap); backLog.setType(11);
} if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) {
} backLog.setType(12);
if (!logList.isEmpty()) { }
tSocialFriendBackLogService.saveBatch(logList); resultList = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId()
} , backLog, socialInfo.getDispatchType());
} logList.add(backLog);
// 医保 if (resultList != null && !resultList.isEmpty()) {
typeFlag = false; for (FriendResult result : resultList) {
List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialFriendYsdAll(); resultMap.put(result.getIdCard(), result);
if (socialYsdList != null && !socialYsdList.isEmpty()) { }
FriendResult info; info = resultMap.get(socialInfo.getEmpIdcard());
logList = new ArrayList<>(); }
for (TSocialInfo socialInfo : socialYsdList) { } else {
backLog = new TSocialFriendBackLog(); backLog.setSocialId(backLog.getSocialId() + "," +socialInfo.getEmpIdcard());
backLog.setSocialId(socialInfo.getId()); }
backLog.setRequestId(socialInfo.getYsdRequestId()); if (info != null && Common.isNotNull(info.getZt())) {
backLog.setType(3); doCore(info, socialInfo, typeFlag, user, errorMap);
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) { }
backLog.setType(4); }
if (!logList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(logList);
}
} }
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYsdRequestId(), backLog, socialInfo.getDispatchType()); // 医保
logList.add(backLog); typeFlag = false;
if (info != null && Common.isNotNull(info.getZt())) { List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialFriendYsdAll();
doCore(info, socialInfo, typeFlag, user, errorMap); if (socialYsdList != null && !socialYsdList.isEmpty()) {
logList = new ArrayList<>();
resultMap = new HashMap<>();
backLog = new TSocialFriendBackLog();
for (TSocialInfo socialInfo : socialYsdList) {
info = resultMap.get(socialInfo.getEmpIdcard());
if (info == null) {
backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getEmpIdcard());
backLog.setRequestId(socialInfo.getYsdRequestId());
backLog.setType(13);
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) {
backLog.setType(14);
}
resultList = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYsdRequestId()
, backLog, socialInfo.getDispatchType());
if (resultList != null && !resultList.isEmpty()) {
for (FriendResult result : resultList) {
resultMap.put(result.getIdCard(), result);
}
info = resultMap.get(socialInfo.getEmpIdcard());
}
logList.add(backLog);
} else {
backLog.setSocialId(backLog.getSocialId() + "," +socialInfo.getEmpIdcard());
}
if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap);
}
}
if (!logList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(logList);
}
} }
} }
if (!logList.isEmpty()) { } finally {
tSocialFriendBackLogService.saveBatch(logList); atomicGetFriend.decrementAndGet();
}
} }
return R.ok();
} else {
atomicGetFriend.decrementAndGet();
return R.failed("距离上一次获取任务时间间隔太短,请10分钟后再试!!!");
} }
return R.ok();
} }
/** /**
...@@ -244,7 +298,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -244,7 +298,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
updateSocial.setYgsHandleStatus(ygsHandleStatus); updateSocial.setYgsHandleStatus(ygsHandleStatus);
// 拉取审核结果,加日志 // 拉取审核结果,加日志
if (Common.isNotNull(ygsHandleStatus)) { if (Common.isNotNull(ygsHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "提交", "社保" socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "拉取", "社保"
, getStatusName(Integer.parseInt(ygsHandleStatus))); , getStatusName(Integer.parseInt(ygsHandleStatus)));
tSocialSoldierLogService.save(socialLog); tSocialSoldierLogService.save(socialLog);
} }
...@@ -333,7 +387,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -333,7 +387,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
// 拉取审核结果,加日志 // 拉取审核结果,加日志
if (Common.isNotNull(ysdHandleStatus)) { if (Common.isNotNull(ysdHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "提交", "医保" socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "拉取", "医保"
, getStatusName(Integer.parseInt(ysdHandleStatus))); , getStatusName(Integer.parseInt(ysdHandleStatus)));
tSocialSoldierLogService.save(socialLog); tSocialSoldierLogService.save(socialLog);
} }
......
...@@ -41,6 +41,7 @@ import javax.servlet.ServletOutputStream; ...@@ -41,6 +41,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -64,6 +65,11 @@ public class TSocialSoldierLogServiceImpl extends ServiceImpl<TSocialSoldierLogM ...@@ -64,6 +65,11 @@ public class TSocialSoldierLogServiceImpl extends ServiceImpl<TSocialSoldierLogM
return baseMapper.getTSocialSoldierLogPage(page, tSocialSoldierLog); return baseMapper.getTSocialSoldierLogPage(page, tSocialSoldierLog);
} }
@Override
public LocalDateTime getMaxTimeToLog() {
return baseMapper.getMaxTimeToLog();
}
/** /**
* 自动化日志批量导出 * 自动化日志批量导出
* *
......
...@@ -279,7 +279,8 @@ public class DoSocialTask { ...@@ -279,7 +279,8 @@ public class DoSocialTask {
} }
// 当前默认 安徽省 ,且开关是税友的,才可以税友推送办理 // 当前默认 安徽省 ,且开关是税友的,才可以税友推送办理
if (isFriend) { if (isFriend) {
tSocialFriendPushService.pushFriend(dispatchIdList); // 断开派单单条推送税友
// tSocialFriendPushService.pushFriend(dispatchIdList);
} else { } else {
tSocialSoldierPushService.pushSoldier(dispatchIdList); 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.TSocialFreindPushAndGetMapper">
<resultMap id="tSocialFreindPushAndGetMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindPushAndGet">
<id property="id" column="ID"/>
<result property="type" column="TYPE"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="createUserName" column="CREATE_USER_NAME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.TYPE,
a.CREATE_TIME,
a.CREATE_USER_NAME
</sql>
<sql id="tSocialFreindPushAndGet_where">
<if test="tSocialFreindPushAndGet != null">
<if test="tSocialFreindPushAndGet.id != null and tSocialFreindPushAndGet.id.trim() != ''">
AND a.ID = #{tSocialFreindPushAndGet.id}
</if>
<if test="tSocialFreindPushAndGet.type != null">
AND a.TYPE = #{tSocialFreindPushAndGet.type}
</if>
<if test="tSocialFreindPushAndGet.createTime != null">
AND a.CREATE_TIME = #{tSocialFreindPushAndGet.createTime}
</if>
<if test="tSocialFreindPushAndGet.createUserName != null and tSocialFreindPushAndGet.createUserName.trim() != ''">
AND a.CREATE_USER_NAME = #{tSocialFreindPushAndGet.createUserName}
</if>
</if>
</sql>
<!--获取当前类型最大的时间,用来判断10分钟内是否有操作过-->
<select id="getMaxTimeByType" resultType="java.time.LocalDateTime">
SELECT
max(a.CREATE_TIME)
FROM t_social_freind_push_and_get a
where a.TYPE = #{type}
</select>
</mapper>
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '0' if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '0'
) )
group by s.id group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
<sql id="where_getSocialSoldier_base_handler"> <sql id="where_getSocialSoldier_base_handler">
...@@ -149,6 +150,7 @@ ...@@ -149,6 +150,7 @@
if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '5' if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '5'
) )
group by a.id group by a.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
<!-- 税友医生大增加模板--> <!-- 税友医生大增加模板-->
...@@ -165,6 +167,7 @@ ...@@ -165,6 +167,7 @@
if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '0' if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '0'
) )
group by s.id group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
<!-- 税友医生大减少模板--> <!-- 税友医生大减少模板-->
...@@ -239,6 +242,7 @@ ...@@ -239,6 +242,7 @@
if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '5' if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '5'
) )
group by s.id group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
</mapper> </mapper>
...@@ -611,7 +611,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -611,7 +611,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
left join t_dispatch_info d on d.SOCIAL_ID = a.id 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' 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)) 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_ADD_ID is not null and a.YGS_ADD_ID != '' and d.AUTO_FLAG='0' where a.YGS_ADD_ID is not null and a.YGS_ADD_ID != '' and a.YGS_REQUEST_ID is 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 (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') and a.YGS_HANDLE_STATUS in ('1','2','3')
group by a.id group by a.id
...@@ -635,7 +635,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -635,7 +635,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
left join t_dispatch_info d on d.SOCIAL_ID = a.id 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' 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)) 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_ADD_ID is not null and a.YSD_ADD_ID != '' and d.AUTO_FLAG='0' where a.YSD_ADD_ID is not null and a.YSD_ADD_ID != '' and a.YSD_REQUEST_ID is 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 (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') and a.YSD_HANDLE_STATUS in ('1','2','3')
group by a.id group by a.id
...@@ -662,6 +662,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -662,6 +662,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
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 (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') and a.YGS_HANDLE_STATUS in ('1','2')
group by a.id group by a.id
order by a.YGS_REQUEST_ID asc
</select> </select>
<!-- 获取所有需要自动办理的医生大 --> <!-- 获取所有需要自动办理的医生大 -->
...@@ -687,6 +688,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -687,6 +688,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
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 (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') and a.YSD_HANDLE_STATUS in ('1','2')
group by a.id group by a.id
order by a.YSD_REQUEST_ID asc
</select> </select>
<!-- 获取所有需要社保局审核的养工失 --> <!-- 获取所有需要社保局审核的养工失 -->
......
...@@ -41,19 +41,19 @@ ...@@ -41,19 +41,19 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
a.ADD_ID, a.ADD_ID,
a.SOCIAL_ID, a.SOCIAL_ID,
a.EMP_IDCARD, a.EMP_IDCARD,
a.EMP_NAME, a.EMP_NAME,
a.DISPATCH_ITEM, a.DISPATCH_ITEM,
a.SOCIAL_HU_NAME, a.SOCIAL_HU_NAME,
a.TYPE, a.TYPE,
a.REMARK, a.REMARK,
a.CREATE_BY, a.CREATE_BY,
a.UPDATE_BY, a.UPDATE_BY,
a.CREATE_NAME, a.CREATE_NAME,
a.UPDATE_TIME, a.UPDATE_TIME,
a.CREATE_TIME a.CREATE_TIME
</sql> </sql>
<sql id="tSocialSoldierLog_where"> <sql id="tSocialSoldierLog_where">
<if test="tSocialSoldierLog != null"> <if test="tSocialSoldierLog != null">
...@@ -132,4 +132,13 @@ ...@@ -132,4 +132,13 @@
</if> </if>
</if> </if>
</select> </select>
<!--tSocialSoldierLog简单分页查询-->
<select id="getMaxTimeToLog" resultType="java.time.LocalDateTime">
SELECT
max(a.CREATE_TIME)
FROM t_social_soldier_log a
where a.TYPE = '拉取'
</select>
</mapper> </mapper>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao ,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '0' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and a.type = '0' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and s.YGS_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '0' or
if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '0' or
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao ,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '1' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and a.type = '1' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and s.YGS_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '5' or
if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '5' or
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen ,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '0' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and a.type = '0' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and s.YSD_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '0' or
if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '0' or
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen ,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '1' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and a.type = '1' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and s.YSD_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '5' or
if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '5' or
......
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