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 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu</artifactId>
<artifactId>yifu-check</artifactId>
<version>1.0.0</version>
</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 {
@Schema(description = "主键")
private String id;
/**
* 社保ID
* 社保ID,逗号拼接
*/
@ExcelAttribute(name = "社保ID", maxLength = 32)
@Length(max = 32, message = "社保ID不能超过32个字符")
@ExcelAttribute(name = "社保ID", maxLength = 2000)
@Length(max = 2000, message = "社保ID不能超过2000个字符")
@ExcelProperty("社保ID")
@Schema(description = "社保ID")
private String socialId;
......@@ -65,7 +65,7 @@ public class TSocialFriendBackLog {
@ExcelAttribute(name = "类型")
@ExcelProperty("类型")
@Schema(description = "类型1社保增 2社保减 3医保增 4医保减 5推送的日志")
@Schema(description = "类型1社保增 2社保减 3医保增 4医保减 5推送的日志 6社保图片路径7医保图片路径11社保增拉取 12社保减拉取 13医保增拉取 14医保减拉取")
private Integer type;
/**
......
......@@ -20,6 +20,7 @@ import org.springframework.web.client.RestTemplate;
import java.security.SignatureException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TreeMap;
......@@ -67,13 +68,15 @@ public class SocialFriendConfig {
private static final String VERSION = "version";
/**
* @param : listVo 同一类(户、增减)的前100个
* @param : vo 第一个,存账密等信息
* @param : type 1社保增 2社保减 3医保增 4医保减
* @Description: 推送任务接口
* @Author: hgw
* @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, List<SociaFriendYgsAddVo> listVo, int type, String thisTime
, List<TSocialFriendBackLog> backLogList) {
String addId = "";
String appAddUrl = urlPre;
......@@ -137,23 +140,36 @@ public class SocialFriendConfig {
}
json.put("ywblzhlb", ywblzhlbArr);
// type 1社保增 2社保减 3医保增 4医保减
setEmpInfo(json, vo, type);
setEmpInfo(json, listVo, type);
HttpEntity<String> formEntity = new HttpEntity<>(json.toString(), headers);
// 推的json
TSocialFriendBackLog backLog = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId());
backLog.setType(5);
backLog.setLogInfo(json.toString());
backLog.setCreateTime(LocalDateTime.now());
backLogList.add(backLog);
TSocialFriendBackLog backLogPush = new TSocialFriendBackLog();
backLogPush.setSocialId(vo.getSocialId());
backLogPush.setType(5);
backLogPush.setLogInfo(json.toString());
backLogPush.setCreateTime(LocalDateTime.now());
backLogList.add(backLogPush);
String dataResultList = restTemplate.postForObject(appAddUrl, formEntity, String.class);
// {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y"
// ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172"
if (Common.isNotNull(dataResultList)) {
// 拉取的数据日志
backLog = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId());
TSocialFriendBackLog backLog = new TSocialFriendBackLog();
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.setLogInfo(dataResultList);
backLog.setCreateTime(LocalDateTime.now());
......@@ -242,11 +258,11 @@ public class SocialFriendConfig {
* @Date: 2024/12/11 10:24
* @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) {
setEmpInfoAdd(json, vo, type);
setEmpInfoAdd(json, listVo, type);
} else {
setEmpInfoReduce(json, vo, type);
setEmpInfoReduce(json, listVo, type);
}
}
......@@ -257,143 +273,148 @@ public class SocialFriendConfig {
* @Date: 2024/12/10 18:05
* @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();
JSONObject cbrymdOne = new JSONObject();
// 姓名
cbrymdOne.put("xm", vo.getEmpName());
// 证件类型
cbrymdOne.put("zzlx", "居民身份证");
// 证件号码"828888200908213819"
cbrymdOne.put("zzhm", vo.getEmpIdcard());
// 国籍(地区) "中国"
cbrymdOne.put("gj", "中国");
// 性别
//cbrymdOne.put("xb", "男")
cbrymdOne.put("xb", getSexName(vo.getEmpIdcard()));
// 出生日期
cbrymdOne.put("csrq", getBirthStr(vo.getEmpIdcard()));
// 民族 空的默认汉族
cbrymdOne.put("mz", vo.getEmpNational());
// 手机号码
cbrymdOne.put("sjhm", vo.getEmpMobile());
String areaName = "安徽省";
// 户口地所在行政区
cbrymdOne.put("hkszdxzq", areaName);
// 户口所在地地址
cbrymdOne.put("hkszddz", areaName);
// 户口性质
//cbrymdOne.put("hkxz", "居民户口(含农业户口、非农业户口)")
cbrymdOne.put("hkxz", "本地居民户口");
// 居住地址
cbrymdOne.put("jzdz", areaName);
// 居住地行政区
cbrymdOne.put("jzdzxzq", areaName);
// 社保起缴日期(养老起缴)yyyy-MM-dd
String startDate = vo.getSocialStartDate();
// 参加工作日期
cbrymdOne.put("cjgzrq", startDate);
// 文化程度 见字典“受教育程度” 空的默认“大学专科”
//cbrymdOne.put("whcd", "大学专科")
cbrymdOne.put("whcd", vo.getEducationName());
// 办理项目列表
JSONArray blxmlbArr = new JSONArray();
JSONObject blxmlbOne = new JSONObject();
String blxm = "社保";
// 险种类型 例如养老、工伤、医疗等
String xzlb = "企业职工养老,工伤保险,失业保险";
if (type > 2) {
blxm = "医保";
xzlb = null;
if (Common.isNotNull(vo.getUnitMedicalMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitMedicalMoney())) {
xzlb = "职工基本医疗保险";
}
if (Common.isNotNull(vo.getUnitBirthMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitBirthMoney())) {
if (Common.isNotNull(xzlb)) {
xzlb += ",生育保险";
} else {
xzlb = "生育保险";
JSONObject cbrymdOne;
// 2025-3-14 15:44:32 单个改造为批量
for (SociaFriendYgsAddVo vo : listVo) {
cbrymdOne = new JSONObject();
// 姓名
cbrymdOne.put("xm", vo.getEmpName());
// 证件类型
cbrymdOne.put("zzlx", "居民身份证");
// 证件号码"828888200908213819"
cbrymdOne.put("zzhm", vo.getEmpIdcard());
// 国籍(地区) "中国"
cbrymdOne.put("gj", "中国");
// 性别
//cbrymdOne.put("xb", "男")
cbrymdOne.put("xb", getSexName(vo.getEmpIdcard()));
// 出生日期
cbrymdOne.put("csrq", getBirthStr(vo.getEmpIdcard()));
// 民族 空的默认汉族
cbrymdOne.put("mz", vo.getEmpNational());
// 手机号码
cbrymdOne.put("sjhm", vo.getEmpMobile());
String areaName = "安徽省";
// 户口地所在行政区
cbrymdOne.put("hkszdxzq", areaName);
// 户口所在地地址
cbrymdOne.put("hkszddz", areaName);
// 户口性质
//cbrymdOne.put("hkxz", "居民户口(含农业户口、非农业户口)")
cbrymdOne.put("hkxz", "本地居民户口");
// 居住地址
cbrymdOne.put("jzdz", areaName);
// 居住地行政区
cbrymdOne.put("jzdzxzq", areaName);
// 社保起缴日期(养老起缴)yyyy-MM-dd
String startDate = vo.getSocialStartDate();
// 参加工作日期
cbrymdOne.put("cjgzrq", startDate);
// 文化程度 见字典“受教育程度” 空的默认“大学专科”
//cbrymdOne.put("whcd", "大学专科")
cbrymdOne.put("whcd", vo.getEducationName());
// 办理项目列表
JSONArray blxmlbArr = new JSONArray();
JSONObject blxmlbOne = new JSONObject();
String blxm = "社保";
// 险种类型 例如养老、工伤、医疗等
String xzlb = "企业职工养老,工伤保险,失业保险";
if (type > 2) {
blxm = "医保";
xzlb = null;
if (Common.isNotNull(vo.getUnitMedicalMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitMedicalMoney())) {
xzlb = "职工基本医疗保险";
}
}
if (Common.isNotNull(vo.getUnitBigailmentMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitBigailmentMoney())) {
if (Common.isNotNull(xzlb)) {
xzlb += ",大额医疗";
} else {
xzlb = "大额医疗";
if (Common.isNotNull(vo.getUnitBirthMoney()) && CommonConstants.ONE_INTEGER.equals(vo.getUnitBirthMoney())) {
if (Common.isNotNull(xzlb)) {
xzlb += ",生育保险";
} else {
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";
json.put(buyType, cbrymdArr);
......@@ -406,50 +427,54 @@ public class SocialFriendConfig {
* @Date: 2024/12/10 18:05
* @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();
JSONObject cbrymdOne = new JSONObject();
// 姓名
cbrymdOne.put("xm", vo.getEmpName());
// 证件类型
cbrymdOne.put("zzlx", "居民身份证");
// 证件号码"828888200908213819"
cbrymdOne.put("zzhm", vo.getEmpIdcard());
// 办理项目列表
JSONArray blxmlbArr = new JSONArray();
JSONObject blxmlbOne = new JSONObject();
String blxm = "社保";
if (type > 2) {
blxm = "医保";
}
// 办理项目
blxmlbOne.put("blxm", blxm);
// 中断原因 除死亡以外,其他停保原因默认:“在职人员解除/终止劳动合同” 死亡对应“死亡或失踪”
blxmlbOne.put("tbyy", vo.getTbyy());
// 中断时间 yyyy-MM-dd 默认当前时间
blxmlbOne.put("tbsj", DateUtil.getLastDay());
blxmlbArr.add(blxmlbOne);
cbrymdOne.put("blxmlb", blxmlbArr);
// 特色字段信息
JSONObject tszdxx = new JSONObject();
// 劳动用工备案解除/终止原因 数据字典文档 法律依据 [社保]必填;
tszdxx.put("zzyy", vo.getZzyy());
// 社保个人身份材料 无
// tszdxx.put("shjycl", )
// 医保个人身份材料 无
// tszdxx.put("ybjycl", )
// 职工社会保险减少花名册 无
// tszdxx.put("zgshbxjshmc", )
if (type > 2) {
// 职工基本医疗保险参保登记表
String[] arr = {vo.getQyzgjbylbxcbdjb()};
tszdxx.put("zgjbylbxcbdjb", arr);
// 2025-3-14 15:44:32 单个改造为批量
for (SociaFriendYgsAddVo vo : listVo) {
// 姓名
cbrymdOne.put("xm", vo.getEmpName());
// 证件类型
cbrymdOne.put("zzlx", "居民身份证");
// 证件号码"828888200908213819"
cbrymdOne.put("zzhm", vo.getEmpIdcard());
// 办理项目列表
JSONArray blxmlbArr = new JSONArray();
JSONObject blxmlbOne = new JSONObject();
String blxm = "社保";
if (type > 2) {
blxm = "医保";
}
// 办理项目
blxmlbOne.put("blxm", blxm);
// 中断原因 除死亡以外,其他停保原因默认:“在职人员解除/终止劳动合同” 死亡对应“死亡或失踪”
blxmlbOne.put("tbyy", vo.getTbyy());
// 中断时间 yyyy-MM-dd 默认当前时间
blxmlbOne.put("tbsj", DateUtil.getLastDay());
blxmlbArr.add(blxmlbOne);
cbrymdOne.put("blxmlb", blxmlbArr);
// 特色字段信息
JSONObject tszdxx = new JSONObject();
// 劳动用工备案解除/终止原因 数据字典文档 法律依据 [社保]必填;
tszdxx.put("zzyy", vo.getZzyy());
// 社保个人身份材料 无
// tszdxx.put("shjycl", )
// 医保个人身份材料 无
// tszdxx.put("ybjycl", )
// 职工社会保险减少花名册 无
// tszdxx.put("zgshbxjshmc", )
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";
json.put(buyType, cbrymdArr);
......@@ -463,9 +488,10 @@ public class SocialFriendConfig {
* @Date: 2024-12-9 16:54:22
* @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)) {
return null;
return resultList;
}
String appAddUrl = urlPre;
if (CommonConstants.ZERO_STRING.equals(type)) {
......@@ -486,7 +512,7 @@ public class SocialFriendConfig {
headers.add("signature", signature);
} catch (SignatureException e) {
log.error("税友签名失败", e);
return null;
return resultList;
}
headers.add(X_REQ_NONCE, xReqNonce);
headers.add(VERSION, version);
......@@ -499,19 +525,18 @@ public class SocialFriendConfig {
if (statusCode != 200) {
throw new CheckedException("获取税友结果失败,statusCode=" + statusCode);
}
FriendResult result = new FriendResult();
String dataResultList = response.getBody();
backLog.setCreateTime(LocalDateTime.now());
backLog.setLogInfo(dataResultList);
// 组装返回结果
getResultToVo(dataResultList, result);
return result;
getResultToVo(dataResultList, resultList);
return resultList;
}
// 组装返回结果
private void getResultToVo(String dataResultList, FriendResult result) {
private void getResultToVo(String dataResultList, List<FriendResult> resultList) {
if (Common.isNotNull(dataResultList)) {
JSONObject dataObject = JSON.parseObject(dataResultList);
String head = dataObject.getString("head");
......@@ -522,39 +547,50 @@ public class SocialFriendConfig {
String body = dataObject.getString("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)) {
// 人员办理项目结果
JSONArray ryywbljglbArr = (JSONArray) bodyObject.get("ryywbljglb");
if (Common.isNotNull(ryywbljglbArr)) {
// 注意:此处可以返回多条身份证,但是我们单条提交
JSONObject ryywbljglb = (JSONObject) ryywbljglbArr.get(0);
// 身份证
String idCard = ryywbljglb.getString("zzhm");
result.setIdCard(idCard);
// 办理项目列表
JSONArray blxmjglbArr = (JSONArray) ryywbljglb.get("blxmjglb");
if (Common.isNotNull(blxmjglbArr)) {
// 注意:此处可以返回多条办理,但是我们社保与医保分开提交
JSONObject blxmjglb = (JSONObject) blxmjglbArr.get(0);
// 状态1-处理中,2-处理成功,3-处理失败,4-待办(提交成功,待网厅状态流转,上海特有)
String zt = blxmjglb.getString("zt");
result.setZt(zt);
// 明细状态:提交失败、审核失败、审核成功、待确认
//String mxzt = blxmjglb.getString("mxzt")
// 提示或者错误信息 SUCCESS
String cwxx = blxmjglb.getString("cwxx");
if (Common.isNotNull(cwxx) && cwxx.length()>100 ) {
cwxx = cwxx.substring(0, 100);
JSONObject ryywbljglb;
FriendResult result;
String idCard;
JSONArray blxmjglbArr;
JSONObject blxmjglb;
String zt;
String cwxx;
for (int i=0; i<ryywbljglbArr.size(); i++) {
ryywbljglb = (JSONObject) ryywbljglbArr.get(i);
result = new FriendResult();
// 身份证
idCard = ryywbljglb.getString("zzhm");
result.setIdCard(idCard);
// 办理项目列表
blxmjglbArr = (JSONArray) ryywbljglb.get("blxmjglb");
if (Common.isNotNull(blxmjglbArr)) {
// 注意:此处可以返回多条办理,但是我们社保与医保分开提交
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 @@
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.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import 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.TSocialFriendService;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;
@Tag(name = "税友")
public class TSocialFriendController {
private AtomicInteger atomicPush = new AtomicInteger(0);
private AtomicInteger atomicGet = new AtomicInteger(0);
private final TSocialFriendService tSocialFriendService;
private final TSocialFriendPushService tSocialFriendPushService;
private final TSocialFreindPushAndGetService tSocialFreindPushAndGetService;
@Operation(description = "1定时任务推送税友")
@PostMapping("/inner/doPushFriend")
......@@ -63,4 +75,93 @@ public class TSocialFriendController {
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;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
......@@ -62,6 +63,18 @@ public class TSocialSoldierLogController {
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;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -46,4 +47,6 @@ public interface TSocialSoldierLogMapper extends BaseMapper<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> {
**/
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);
}
......@@ -37,4 +37,12 @@ public interface TSocialFriendService extends IService<TSocialInfo> {
**/
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;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -42,6 +43,14 @@ public interface TSocialSoldierLogService extends IService<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);
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.*;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.net.URL;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 税友-推送
......@@ -66,6 +68,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
private final TSocialFriendBackLogService tSocialFriendBackLogService;
private final TSocialFreindSetService tSocialFreindSetService;
private final TSocialInfoMapper socialMapper;
private final AtomicInteger atomicPushFriend = new AtomicInteger(0);
@Autowired
private ExcelMergeImage excelMergeImage;
@Autowired
......@@ -82,6 +86,19 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
@Autowired
private TDispatchInfoMapper dispatchInfoMapper;
/**
* @Description: 核心推送改为异步
* @Author: hgw
* @Date: 2025/3/18 10:52
* @return: void
**/
@Async
@Override
public void pushFriendByAsync() {
this.pushFriend(null);
}
/**
* @Description: 推送到税友
* @Author: hgw
......@@ -90,43 +107,52 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
**/
@Override
public R<String> pushFriend(List<String> dispatchIdList) {
TSocialFreindSet set = tSocialFreindSetService.getById("1");
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) {
if (atomicPushFriend.incrementAndGet() <= 1) {
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);
if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
this.doPushSocialAndLogYgs(socialSetMap, ygsAddlist, 1);
}
// 社保增员、社保减员、医保增员、医保减员
// 养工失新增列表
List<SociaFriendYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList);
if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
this.doPushSocialAndLogYgs(socialSetMap, ygsAddlist, 1);
}
// 养工失减少列表
List<SociaFriendYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList);
if (ygsReducelist != null && !ygsReducelist.isEmpty()) {
this.doPushSocialAndLogYgs(socialSetMap, ygsReducelist, 2);
}
// 医生大新增列表
List<SociaFriendYgsAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList);
if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdAddlist, 3);
}
// 医生大减少列表
List<SociaFriendYgsAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList);
if (ysdReducelist != null && !ysdReducelist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdReducelist, 4);
}
if ((ygsAddlist == null || ygsAddlist.isEmpty())
&& (ygsReducelist == null || ygsReducelist.isEmpty())
&& (ysdAddlist == null || ysdAddlist.isEmpty())
&& (ysdReducelist == null || ysdReducelist.isEmpty())
) {
return R.failed("无数据,推送结束!");
// 养工失减少列表
List<SociaFriendYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList);
if (ygsReducelist != null && !ygsReducelist.isEmpty()) {
this.doPushSocialAndLogYgs(socialSetMap, ygsReducelist, 2);
}
// 医生大新增列表
List<SociaFriendYgsAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList);
if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdAddlist, 3);
}
// 医生大减少列表
List<SociaFriendYgsAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList);
if (ysdReducelist != null && !ysdReducelist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdReducelist, 4);
}
if ((ygsAddlist == null || ygsAddlist.isEmpty())
&& (ygsReducelist == null || ygsReducelist.isEmpty())
&& (ysdAddlist == null || ysdAddlist.isEmpty())
&& (ysdReducelist == null || ysdReducelist.isEmpty())
) {
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
String typeStr = "提交";
List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog;
String remark;
String remark = null;
List<TSocialInfo> renGongList = new ArrayList<>();
String requestId;
String thisTime = DateUtil.getThisTime();
List<TSocialFriendBackLog> backLogList = new ArrayList<>();
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:转人工
canPushType = this.getCanPushType(socialSetMap, vo);
if (1 == canPushType) {
try {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
// 房工接口,获取 企业职工社会保险增员花名册 url
urlR = doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode());
if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) {
vo.setQyzgshbxzyhmc(urlR.getData());
}
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, type, thisTime, backLogList);
if (Common.isEmpty(requestId)) {
socialInfo.setYgsRequestId("推送税友失败");
socialInfo.setYgsHandleStatus(CommonConstants.FIVE_STRING);
remark = "推送税友失败,转人工处理!";
} else {
socialInfo.setYgsRequestId(requestId);
socialInfo.setYgsHandleStatus(CommonConstants.TWO_STRING);
listVo.add(vo);
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialInfoTemp.add(socialInfo);
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
if (socialLog != null) {
logTemp.add(socialLog);
}
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 = "已推送提交任务!";
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) {
remark = "提交社保士兵异常!";
}
......@@ -184,13 +246,15 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
socialInfo.setYgsHandleStatus(CommonConstants.FIVE_STRING);
renGongList.add(socialInfo);
}
}
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, "社保", remark);
if (socialLog != null) {
logList.add(socialLog);
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
if (socialLog != null) {
logList.add(socialLog);
}
}
}
if (!socialInfoUpdate.isEmpty()) {
tSocialInfoService.updateBatchById(socialInfoUpdate);
}
if (!backLogList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(backLogList);
}
......@@ -216,13 +280,24 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
List<TSocialSoldierLog> logList = new ArrayList<>();
TSocialSoldierLog socialLog;
List<TSocialInfo> renGongList = new ArrayList<>();
String remark;
String remark = null;
String requestId;
String thisTime = DateUtil.getThisTime();
List<TSocialFriendBackLog> backLogList = new ArrayList<>();
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:转人工
if ("劳动者死亡".equals(vo.getTbyy())) {
remark = "劳动者死亡,转人工!";
......@@ -230,6 +305,10 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
socialInfo.setId(vo.getSocialId());
socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING);
renGongList.add(socialInfo);
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
if (socialLog != null) {
logList.add(socialLog);
}
} else {
canPushType = this.getCanPushTypeYsd(socialSetMap, vo);
if (1 == canPushType) {
......@@ -241,17 +320,44 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) {
vo.setQyzgjbylbxcbdjb(urlR.getData());
}
requestId = socialFriendConfig.pushFriendByInfo(restTemplate, vo, type, thisTime, backLogList);
if (Common.isEmpty(requestId)) {
socialInfo.setYsdRequestId("推送税友失败");
socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING);
remark = "推送税友失败,转人工处理!";
} else {
socialInfo.setYsdRequestId(requestId);
socialInfo.setYsdHandleStatus(CommonConstants.TWO_STRING);
listVo.add(vo);
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialInfoTemp.add(socialInfo);
socialLog = tSocialSoldierLogService.getFriendLog(vo, typeStr, dispatchItem, remark);
if (socialLog != null) {
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 = "已推送提交任务!";
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) {
remark = "提交社保士兵异常!";
}
......@@ -265,16 +371,19 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
socialInfo.setYsdHandleStatus(CommonConstants.FIVE_STRING);
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()) {
tSocialFriendBackLogService.saveBatch(backLogList);
}
if (!socialInfoUpdate.isEmpty()) {
tSocialInfoService.updateBatchById(socialInfoUpdate);
}
if (!renGongList.isEmpty()) {
tSocialInfoService.updateBatchById(renGongList);
}
......@@ -630,7 +739,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
inputStreamOut = new FileInputStream(outFile);
// 转换成图片 完成后清理流
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);
tSocialFriendBackLogService.save(backLog);
return ulrR;
......@@ -894,7 +1004,8 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
inputStreamOut = new FileInputStream(outFile);
// 转换成图片 完成后清理流
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);
tSocialFriendBackLogService.save(backLog);
return ulrR;
......
......@@ -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.R;
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.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper;
......@@ -31,12 +32,16 @@ import com.yifu.cloud.plus.v1.yifu.social.service.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import lombok.AllArgsConstructor;
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.authority.AuthorityUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 税友
......@@ -58,6 +63,18 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
private final TSocialSoldierLogService tSocialSoldierLogService;
private final TSocialFriendBackLogService tSocialFriendBackLogService;
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 查看任务进度
......@@ -67,73 +84,110 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
**/
@Override
public R<String> getInfoByRequestId() {
TSocialFreindSet set = tSocialFreindSetService.getById("1");
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) {
// 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, null);
// 失败原因配置
Map<String, FailReasonConfig> errorMap = failReasonConfigService.getFailReasonMap();
// 获取所有需要反馈的任务id
List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll();
List<TSocialFriendBackLog> logList;
TSocialFriendBackLog backLog;
if (socialList != null && !socialList.isEmpty()) {
FriendResult info;
logList = new ArrayList<>();
for (TSocialInfo socialInfo : socialList) {
backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getId());
backLog.setRequestId(socialInfo.getYgsRequestId());
backLog.setType(1);
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) {
backLog.setType(2);
}
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId(), backLog, socialInfo.getDispatchType());
logList.add(backLog);
if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap);
}
}
if (!logList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(logList);
}
}
// 医保
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.getYsdRequestId());
backLog.setType(3);
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) {
backLog.setType(4);
if (atomicGetFriend.incrementAndGet() <= 1) {
try {
TSocialFreindSet set = tSocialFreindSetService.getById("1");
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) {
// 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, null);
// 失败原因配置
Map<String, FailReasonConfig> errorMap = failReasonConfigService.getFailReasonMap();
// 获取所有需要反馈的任务id
List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll();
List<TSocialFriendBackLog> logList;
TSocialFriendBackLog backLog = new TSocialFriendBackLog();
FriendResult info;
List<FriendResult> resultList;
Map<String, FriendResult> resultMap;
if (socialList != null && !socialList.isEmpty()) {
logList = new ArrayList<>();
resultMap = new HashMap<>();
for (TSocialInfo socialInfo : socialList) {
info = resultMap.get(socialInfo.getEmpIdcard());
if (info == null) {
backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getEmpIdcard());
backLog.setRequestId(socialInfo.getYgsRequestId());
backLog.setType(11);
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) {
backLog.setType(12);
}
resultList = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId()
, backLog, socialInfo.getDispatchType());
logList.add(backLog);
if (resultList != null && !resultList.isEmpty()) {
for (FriendResult result : resultList) {
resultMap.put(result.getIdCard(), result);
}
info = resultMap.get(socialInfo.getEmpIdcard());
}
} 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);
}
}
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYsdRequestId(), backLog, socialInfo.getDispatchType());
logList.add(backLog);
if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap);
// 医保
typeFlag = false;
List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialFriendYsdAll();
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()) {
tSocialFriendBackLogService.saveBatch(logList);
}
} finally {
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
updateSocial.setYgsHandleStatus(ygsHandleStatus);
// 拉取审核结果,加日志
if (Common.isNotNull(ygsHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "提交", "社保"
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "拉取", "社保"
, getStatusName(Integer.parseInt(ygsHandleStatus)));
tSocialSoldierLogService.save(socialLog);
}
......@@ -333,7 +387,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
// 拉取审核结果,加日志
if (Common.isNotNull(ysdHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "提交", "医保"
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "拉取", "医保"
, getStatusName(Integer.parseInt(ysdHandleStatus)));
tSocialSoldierLogService.save(socialLog);
}
......
......@@ -41,6 +41,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
......@@ -64,6 +65,11 @@ public class TSocialSoldierLogServiceImpl extends ServiceImpl<TSocialSoldierLogM
return baseMapper.getTSocialSoldierLogPage(page, tSocialSoldierLog);
}
@Override
public LocalDateTime getMaxTimeToLog() {
return baseMapper.getMaxTimeToLog();
}
/**
* 自动化日志批量导出
*
......
......@@ -279,7 +279,8 @@ public class DoSocialTask {
}
// 当前默认 安徽省 ,且开关是税友的,才可以税友推送办理
if (isFriend) {
tSocialFriendPushService.pushFriend(dispatchIdList);
// 断开派单单条推送税友
// 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.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 @@
if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '0'
)
group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select>
<sql id="where_getSocialSoldier_base_handler">
......@@ -149,6 +150,7 @@
if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '5'
)
group by a.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select>
<!-- 税友医生大增加模板-->
......@@ -165,6 +167,7 @@
if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '0'
)
group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select>
<!-- 税友医生大减少模板-->
......@@ -239,6 +242,7 @@
if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '5'
)
group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select>
</mapper>
......@@ -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_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_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 a.YGS_HANDLE_STATUS in ('1','2','3')
group by a.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_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_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 a.YSD_HANDLE_STATUS in ('1','2','3')
group by a.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 a.YGS_HANDLE_STATUS in ('1','2')
group by a.id
order by a.YGS_REQUEST_ID asc
</select>
<!-- 获取所有需要自动办理的医生大 -->
......@@ -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 a.YSD_HANDLE_STATUS in ('1','2')
group by a.id
order by a.YSD_REQUEST_ID asc
</select>
<!-- 获取所有需要社保局审核的养工失 -->
......
......@@ -41,19 +41,19 @@
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.ADD_ID,
a.SOCIAL_ID,
a.EMP_IDCARD,
a.EMP_NAME,
a.DISPATCH_ITEM,
a.SOCIAL_HU_NAME,
a.TYPE,
a.REMARK,
a.CREATE_BY,
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_TIME,
a.CREATE_TIME
a.ADD_ID,
a.SOCIAL_ID,
a.EMP_IDCARD,
a.EMP_NAME,
a.DISPATCH_ITEM,
a.SOCIAL_HU_NAME,
a.TYPE,
a.REMARK,
a.CREATE_BY,
a.UPDATE_BY,
a.CREATE_NAME,
a.UPDATE_TIME,
a.CREATE_TIME
</sql>
<sql id="tSocialSoldierLog_where">
<if test="tSocialSoldierLog != null">
......@@ -132,4 +132,13 @@
</if>
</if>
</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>
......@@ -108,7 +108,7 @@
<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 a.type = '0' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and s.YGS_REQUEST_ID is null
and (
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
......@@ -141,7 +141,7 @@
<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 a.type = '1' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and s.YGS_REQUEST_ID is null
and (
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
......@@ -155,7 +155,7 @@
<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 a.type = '0' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and s.YSD_REQUEST_ID is null
and (
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
......@@ -169,7 +169,7 @@
<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 a.type = '1' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and s.YSD_REQUEST_ID is null
and (
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
......
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