Commit a2e5a768 authored by hongguangwu's avatar hongguangwu

MVP1.7.7-friend-改为批量

parent 970a019a
...@@ -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;
......
...@@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.ExcelProperty; ...@@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
/** /**
* @Author hgw * @Author hgw
......
...@@ -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;
...@@ -252,7 +253,7 @@ public class SocialFriendConfig { ...@@ -252,7 +253,7 @@ public class SocialFriendConfig {
if (type == 1 || type == 3) { if (type == 1 || type == 3) {
setEmpInfoAdd(json, listVo, type); setEmpInfoAdd(json, listVo, type);
} else { } else {
setEmpInfoReduce(json, vo, type); setEmpInfoReduce(json, listVo, type);
} }
} }
...@@ -268,7 +269,7 @@ public class SocialFriendConfig { ...@@ -268,7 +269,7 @@ public class SocialFriendConfig {
JSONArray cbrymdArr = new JSONArray(); JSONArray cbrymdArr = new JSONArray();
JSONObject cbrymdOne; JSONObject cbrymdOne;
// 2025-3-6 15:44:32 单个改造为批量 // 2025-3-14 15:44:32 单个改造为批量
for (SociaFriendYgsAddVo vo : listVo) { for (SociaFriendYgsAddVo vo : listVo) {
cbrymdOne = new JSONObject(); cbrymdOne = new JSONObject();
// 姓名 // 姓名
...@@ -416,50 +417,54 @@ public class SocialFriendConfig { ...@@ -416,50 +417,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);
...@@ -473,9 +478,10 @@ public class SocialFriendConfig { ...@@ -473,9 +478,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)) {
...@@ -496,7 +502,7 @@ public class SocialFriendConfig { ...@@ -496,7 +502,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);
...@@ -509,19 +515,18 @@ public class SocialFriendConfig { ...@@ -509,19 +515,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");
...@@ -532,39 +537,50 @@ public class SocialFriendConfig { ...@@ -532,39 +537,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);
} }
} }
} }
......
...@@ -142,35 +142,71 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -142,35 +142,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,14 +220,15 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -184,14 +220,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); }
} }
} }
List<SociaFriendYgsAddVo> listVo, if (!socialInfoUpdate.isEmpty()) {
tSocialInfoService.updateBatchById(socialInfoUpdate);
}
if (!backLogList.isEmpty()) { if (!backLogList.isEmpty()) {
tSocialFriendBackLogService.saveBatch(backLogList); tSocialFriendBackLogService.saveBatch(backLogList);
} }
...@@ -217,12 +254,24 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -217,12 +254,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 +279,10 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -230,6 +279,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 +294,44 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -241,17 +294,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 +345,19 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -265,16 +345,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);
} }
......
...@@ -86,9 +86,12 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -86,9 +86,12 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll(); List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll();
List<TSocialFriendBackLog> logList; List<TSocialFriendBackLog> logList;
TSocialFriendBackLog backLog; TSocialFriendBackLog backLog;
FriendResult info;
List<FriendResult> resultList;
Map<String, FriendResult> resultMap;
if (socialList != null && !socialList.isEmpty()) { if (socialList != null && !socialList.isEmpty()) {
FriendResult info;
logList = new ArrayList<>(); logList = new ArrayList<>();
resultMap = new HashMap<>();
for (TSocialInfo socialInfo : socialList) { for (TSocialInfo socialInfo : socialList) {
backLog = new TSocialFriendBackLog(); backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getId()); backLog.setSocialId(socialInfo.getId());
...@@ -97,7 +100,17 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -97,7 +100,17 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) { if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) {
backLog.setType(2); backLog.setType(2);
} }
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId(), backLog, socialInfo.getDispatchType()); info = resultMap.get(socialInfo.getEmpIdcard());
if (info == null) {
resultList = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId()
, 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); logList.add(backLog);
if (info != null && Common.isNotNull(info.getZt())) { if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap); doCore(info, socialInfo, typeFlag, user, errorMap);
...@@ -111,8 +124,8 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -111,8 +124,8 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
typeFlag = false; typeFlag = false;
List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialFriendYsdAll(); List<TSocialInfo> socialYsdList = tSocialInfoService.getSocialFriendYsdAll();
if (socialYsdList != null && !socialYsdList.isEmpty()) { if (socialYsdList != null && !socialYsdList.isEmpty()) {
FriendResult info;
logList = new ArrayList<>(); logList = new ArrayList<>();
resultMap = new HashMap<>();
for (TSocialInfo socialInfo : socialYsdList) { for (TSocialInfo socialInfo : socialYsdList) {
backLog = new TSocialFriendBackLog(); backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getId()); backLog.setSocialId(socialInfo.getId());
...@@ -121,7 +134,17 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -121,7 +134,17 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) { if (Common.isNotNull(socialInfo.getDispatchType()) && CommonConstants.ONE_STRING.equals(socialInfo.getDispatchType())) {
backLog.setType(4); backLog.setType(4);
} }
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYsdRequestId(), backLog, socialInfo.getDispatchType()); info = resultMap.get(socialInfo.getEmpIdcard());
if (info == null) {
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); logList.add(backLog);
if (info != null && Common.isNotNull(info.getZt())) { if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap); doCore(info, socialInfo, typeFlag, user, errorMap);
......
...@@ -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);
} }
......
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,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">
...@@ -145,6 +146,7 @@ ...@@ -145,6 +146,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>
<!-- 税友医生大增加模板--> <!-- 税友医生大增加模板-->
...@@ -159,6 +161,7 @@ ...@@ -159,6 +161,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>
<!-- 税友医生大减少模板--> <!-- 税友医生大减少模板-->
...@@ -232,6 +235,7 @@ ...@@ -232,6 +235,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>
...@@ -609,7 +609,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -609,7 +609,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 d.AUTO_FLAG='0' where a.YGS_ADD_ID is not null 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
...@@ -633,7 +633,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -633,7 +633,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 d.AUTO_FLAG='0' where a.YSD_ADD_ID is not null 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
...@@ -660,6 +660,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -660,6 +660,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>
<!-- 获取所有需要自动办理的医生大 --> <!-- 获取所有需要自动办理的医生大 -->
...@@ -683,6 +684,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -683,6 +684,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>
<!-- 获取所有需要社保局审核的养工失 --> <!-- 获取所有需要社保局审核的养工失 -->
......
...@@ -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