Commit 2326044f authored by hongguangwu's avatar hongguangwu

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

# Conflicts:
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/config/SocialFriendConfig.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TSocialFriendPushServiceImpl.java
#	yifu-social/yifu-social-biz/src/main/resources/mapper/TSocialInfoMapper.xml
parents f0311785 afdf144b
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.yifu.cloud.plus.v1</groupId> <groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu</artifactId> <artifactId>yifu-check</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
@Data
@TableName("t_social_freind_push_and_get")
@Schema(description = "税友推送和拉取的日志表,用于10分钟只能推拉一次")
public class TSocialFreindPushAndGet {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("id")
@Schema(description = "id")
private String id;
/**
* 类型:1推送;2拉取
*/
@ExcelAttribute(name = "类型:1推送;2拉取", isNotEmpty = true, errorInfo = "类型:1推送;2拉取不能为空")
@NotBlank(message = "类型:1推送;2拉取不能为空")
@ExcelProperty("类型:1推送;2拉取")
@Schema(description = "类型:1推送;2拉取")
private Integer type;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间", isNotEmpty = true, errorInfo = "创建时间不能为空", isDate = true)
@NotBlank(message = "创建时间不能为空")
@ExcelProperty("创建时间")
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 创建人姓名
*/
@ExcelAttribute(name = "创建人姓名", isNotEmpty = true, errorInfo = "创建人姓名不能为空", maxLength = 50)
@NotBlank(message = "创建人姓名不能为空")
@Length(max = 50, message = "创建人姓名不能超过50个字符")
@ExcelProperty("创建人姓名")
@Schema(description = "创建人姓名")
private String createUserName;
}
...@@ -47,10 +47,10 @@ public class TSocialFriendBackLog { ...@@ -47,10 +47,10 @@ public class TSocialFriendBackLog {
@Schema(description = "主键") @Schema(description = "主键")
private String id; private String id;
/** /**
* 社保ID * 社保ID,逗号拼接
*/ */
@ExcelAttribute(name = "社保ID", maxLength = 32) @ExcelAttribute(name = "社保ID", maxLength = 2000)
@Length(max = 32, message = "社保ID不能超过32个字符") @Length(max = 2000, message = "社保ID不能超过2000个字符")
@ExcelProperty("社保ID") @ExcelProperty("社保ID")
@Schema(description = "社保ID") @Schema(description = "社保ID")
private String socialId; private String socialId;
...@@ -65,7 +65,7 @@ public class TSocialFriendBackLog { ...@@ -65,7 +65,7 @@ public class TSocialFriendBackLog {
@ExcelAttribute(name = "类型") @ExcelAttribute(name = "类型")
@ExcelProperty("类型") @ExcelProperty("类型")
@Schema(description = "类型1社保增 2社保减 3医保增 4医保减 5推送的日志") @Schema(description = "类型1社保增 2社保减 3医保增 4医保减 5推送的日志 6社保图片路径7医保图片路径11社保增拉取 12社保减拉取 13医保增拉取 14医保减拉取")
private Integer type; private Integer type;
/** /**
......
...@@ -20,6 +20,7 @@ import org.springframework.web.client.RestTemplate; ...@@ -20,6 +20,7 @@ import org.springframework.web.client.RestTemplate;
import java.security.SignatureException; import java.security.SignatureException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TreeMap; import java.util.TreeMap;
...@@ -67,13 +68,15 @@ public class SocialFriendConfig { ...@@ -67,13 +68,15 @@ public class SocialFriendConfig {
private static final String VERSION = "version"; private static final String VERSION = "version";
/** /**
* @param : listVo 同一类(户、增减)的前100个
* @param : vo 第一个,存账密等信息
* @param : type 1社保增 2社保减 3医保增 4医保减 * @param : type 1社保增 2社保减 3医保增 4医保减
* @Description: 推送任务接口 * @Description: 推送任务接口
* @Author: hgw * @Author: hgw
* @Date: 2024-12-9 16:54:31 * @Date: 2024-12-9 16:54:31
* @return: java.lang.String * @return: java.lang.String
**/ **/
public String pushFriendByInfo(RestTemplate restTemplate, SociaFriendYgsAddVo vo, int type, String thisTime public String pushFriendByInfo(RestTemplate restTemplate, SociaFriendYgsAddVo vo, List<SociaFriendYgsAddVo> listVo, int type, String thisTime
, List<TSocialFriendBackLog> backLogList) { , List<TSocialFriendBackLog> backLogList) {
String addId = ""; String addId = "";
String appAddUrl = urlPre; String appAddUrl = urlPre;
...@@ -137,23 +140,36 @@ public class SocialFriendConfig { ...@@ -137,23 +140,36 @@ public class SocialFriendConfig {
} }
json.put("ywblzhlb", ywblzhlbArr); json.put("ywblzhlb", ywblzhlbArr);
// type 1社保增 2社保减 3医保增 4医保减 // type 1社保增 2社保减 3医保增 4医保减
setEmpInfo(json, vo, type); setEmpInfo(json, listVo, type);
HttpEntity<String> formEntity = new HttpEntity<>(json.toString(), headers); HttpEntity<String> formEntity = new HttpEntity<>(json.toString(), headers);
// 推的json // 推的json
TSocialFriendBackLog backLog = new TSocialFriendBackLog(); TSocialFriendBackLog backLogPush = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId()); backLogPush.setSocialId(vo.getSocialId());
backLog.setType(5); backLogPush.setType(5);
backLog.setLogInfo(json.toString()); backLogPush.setLogInfo(json.toString());
backLog.setCreateTime(LocalDateTime.now()); backLogPush.setCreateTime(LocalDateTime.now());
backLogList.add(backLog); backLogList.add(backLogPush);
String dataResultList = restTemplate.postForObject(appAddUrl, formEntity, String.class); String dataResultList = restTemplate.postForObject(appAddUrl, formEntity, String.class);
// {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y" // {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y"
// ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172" // ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172"
if (Common.isNotNull(dataResultList)) { if (Common.isNotNull(dataResultList)) {
// 拉取的数据日志 // 拉取的数据日志
backLog = new TSocialFriendBackLog(); TSocialFriendBackLog backLog = new TSocialFriendBackLog();
backLog.setSocialId(vo.getSocialId()); StringBuilder ids = new StringBuilder();
String idTemp;
for (SociaFriendYgsAddVo tempVo : listVo) {
if (Common.isNotNull(tempVo.getEmpIdcard())) {
idTemp = tempVo.getEmpIdcard();
} else if (Common.isNotNull(tempVo.getSocialId())) {
idTemp = tempVo.getSocialId();
} else {
idTemp = vo.getSocialId();
}
ids.append(idTemp).append(",");
}
backLogPush.setSocialId(ids.toString());
backLog.setSocialId(ids.toString());
backLog.setType(type); backLog.setType(type);
backLog.setLogInfo(dataResultList); backLog.setLogInfo(dataResultList);
backLog.setCreateTime(LocalDateTime.now()); backLog.setCreateTime(LocalDateTime.now());
...@@ -242,11 +258,11 @@ public class SocialFriendConfig { ...@@ -242,11 +258,11 @@ public class SocialFriendConfig {
* @Date: 2024/12/11 10:24 * @Date: 2024/12/11 10:24
* @return: void * @return: void
**/ **/
private void setEmpInfo(JSONObject json, SociaFriendYgsAddVo vo, int type) { private void setEmpInfo(JSONObject json, List<SociaFriendYgsAddVo> listVo, int type) {
if (type == 1 || type == 3) { if (type == 1 || type == 3) {
setEmpInfoAdd(json, vo, type); setEmpInfoAdd(json, listVo, type);
} else { } else {
setEmpInfoReduce(json, vo, type); setEmpInfoReduce(json, listVo, type);
} }
} }
...@@ -257,10 +273,14 @@ public class SocialFriendConfig { ...@@ -257,10 +273,14 @@ public class SocialFriendConfig {
* @Date: 2024/12/10 18:05 * @Date: 2024/12/10 18:05
* @return: void * @return: void
**/ **/
private void setEmpInfoAdd(JSONObject json, SociaFriendYgsAddVo vo, int type) { private void setEmpInfoAdd(JSONObject json, List<SociaFriendYgsAddVo> listVo, int type) {
// 参保人员名单 数组 // 参保人员名单 数组
JSONArray cbrymdArr = new JSONArray(); JSONArray cbrymdArr = new JSONArray();
JSONObject cbrymdOne = new JSONObject(); JSONObject cbrymdOne;
// 2025-3-14 15:44:32 单个改造为批量
for (SociaFriendYgsAddVo vo : listVo) {
cbrymdOne = new JSONObject();
// 姓名 // 姓名
cbrymdOne.put("xm", vo.getEmpName()); cbrymdOne.put("xm", vo.getEmpName());
// 证件类型 // 证件类型
...@@ -394,6 +414,7 @@ public class SocialFriendConfig { ...@@ -394,6 +414,7 @@ public class SocialFriendConfig {
jyxx.put("ldhtjzrq", vo.getContractEnd()); jyxx.put("ldhtjzrq", vo.getContractEnd());
cbrymdOne.put("jyxx", jyxx); cbrymdOne.put("jyxx", jyxx);
cbrymdArr.add(cbrymdOne); cbrymdArr.add(cbrymdOne);
}
// 人员名单 // 人员名单
String buyType = "cbrymd"; String buyType = "cbrymd";
json.put(buyType, cbrymdArr); json.put(buyType, cbrymdArr);
...@@ -406,11 +427,14 @@ public class SocialFriendConfig { ...@@ -406,11 +427,14 @@ 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();
// 2025-3-14 15:44:32 单个改造为批量
for (SociaFriendYgsAddVo vo : listVo) {
// 姓名 // 姓名
cbrymdOne.put("xm", vo.getEmpName()); cbrymdOne.put("xm", vo.getEmpName());
// 证件类型 // 证件类型
...@@ -450,6 +474,7 @@ public class SocialFriendConfig { ...@@ -450,6 +474,7 @@ public class SocialFriendConfig {
} }
cbrymdOne.put("tszdxx", tszdxx); cbrymdOne.put("tszdxx", tszdxx);
cbrymdArr.add(cbrymdOne); cbrymdArr.add(cbrymdOne);
}
// 人员名单 // 人员名单
String buyType = "tbrymd"; String buyType = "tbrymd";
json.put(buyType, cbrymdArr); json.put(buyType, cbrymdArr);
...@@ -463,9 +488,10 @@ public class SocialFriendConfig { ...@@ -463,9 +488,10 @@ public class SocialFriendConfig {
* @Date: 2024-12-9 16:54:22 * @Date: 2024-12-9 16:54:22
* @return: java.lang.String * @return: java.lang.String
**/ **/
public FriendResult getFriendByRequestId(RestTemplate restTemplate, String requestId, TSocialFriendBackLog backLog, String type) { public List<FriendResult> getFriendByRequestId(RestTemplate restTemplate, String requestId, TSocialFriendBackLog backLog, String type) {
List<FriendResult> resultList = new ArrayList<>();
if (Common.isEmpty(requestId)) { if (Common.isEmpty(requestId)) {
return null; return resultList;
} }
String appAddUrl = urlPre; String appAddUrl = urlPre;
if (CommonConstants.ZERO_STRING.equals(type)) { if (CommonConstants.ZERO_STRING.equals(type)) {
...@@ -486,7 +512,7 @@ public class SocialFriendConfig { ...@@ -486,7 +512,7 @@ public class SocialFriendConfig {
headers.add("signature", signature); headers.add("signature", signature);
} catch (SignatureException e) { } catch (SignatureException e) {
log.error("税友签名失败", e); log.error("税友签名失败", e);
return null; return resultList;
} }
headers.add(X_REQ_NONCE, xReqNonce); headers.add(X_REQ_NONCE, xReqNonce);
headers.add(VERSION, version); headers.add(VERSION, version);
...@@ -499,19 +525,18 @@ public class SocialFriendConfig { ...@@ -499,19 +525,18 @@ public class SocialFriendConfig {
if (statusCode != 200) { if (statusCode != 200) {
throw new CheckedException("获取税友结果失败,statusCode=" + statusCode); throw new CheckedException("获取税友结果失败,statusCode=" + statusCode);
} }
FriendResult result = new FriendResult();
String dataResultList = response.getBody(); String dataResultList = response.getBody();
backLog.setCreateTime(LocalDateTime.now()); backLog.setCreateTime(LocalDateTime.now());
backLog.setLogInfo(dataResultList); backLog.setLogInfo(dataResultList);
// 组装返回结果 // 组装返回结果
getResultToVo(dataResultList, result); getResultToVo(dataResultList, resultList);
return result; return resultList;
} }
// 组装返回结果 // 组装返回结果
private void getResultToVo(String dataResultList, FriendResult result) { private void getResultToVo(String dataResultList, List<FriendResult> resultList) {
if (Common.isNotNull(dataResultList)) { if (Common.isNotNull(dataResultList)) {
JSONObject dataObject = JSON.parseObject(dataResultList); JSONObject dataObject = JSON.parseObject(dataResultList);
String head = dataObject.getString("head"); String head = dataObject.getString("head");
...@@ -522,40 +547,51 @@ public class SocialFriendConfig { ...@@ -522,40 +547,51 @@ 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;
JSONArray blxmjglbArr;
JSONObject blxmjglb;
String zt;
String cwxx;
for (int i=0; i<ryywbljglbArr.size(); i++) {
ryywbljglb = (JSONObject) ryywbljglbArr.get(i);
result = new FriendResult();
// 身份证 // 身份证
String idCard = ryywbljglb.getString("zzhm"); idCard = ryywbljglb.getString("zzhm");
result.setIdCard(idCard); result.setIdCard(idCard);
// 办理项目列表 // 办理项目列表
JSONArray blxmjglbArr = (JSONArray) ryywbljglb.get("blxmjglb"); blxmjglbArr = (JSONArray) ryywbljglb.get("blxmjglb");
if (Common.isNotNull(blxmjglbArr)) { if (Common.isNotNull(blxmjglbArr)) {
// 注意:此处可以返回多条办理,但是我们社保与医保分开提交 // 注意:此处可以返回多条办理,但是我们社保与医保分开提交
JSONObject blxmjglb = (JSONObject) blxmjglbArr.get(0); blxmjglb = (JSONObject) blxmjglbArr.get(0);
// 状态1-处理中,2-处理成功,3-处理失败,4-待办(提交成功,待网厅状态流转,上海特有) // 状态1-处理中,2-处理成功,3-处理失败,4-待办(提交成功,待网厅状态流转,上海特有)
String zt = blxmjglb.getString("zt"); zt = blxmjglb.getString("zt");
result.setZt(zt); result.setZt(zt);
// 明细状态:提交失败、审核失败、审核成功、待确认 // 明细状态:提交失败、审核失败、审核成功、待确认
//String mxzt = blxmjglb.getString("mxzt") //String mxzt = blxmjglb.getString("mxzt")
// 提示或者错误信息 SUCCESS // 提示或者错误信息 SUCCESS
String cwxx = blxmjglb.getString("cwxx"); cwxx = blxmjglb.getString("cwxx");
if (Common.isNotNull(cwxx) && cwxx.length()>100 ) { if (Common.isNotNull(cwxx) && cwxx.length() > 100) {
cwxx = cwxx.substring(0, 100); cwxx = cwxx.substring(0, 100);
} }
result.setCwxx(cwxx); result.setCwxx(cwxx);
} }
resultList.add(result);
}
} }
} }
} }
......
...@@ -17,19 +17,27 @@ ...@@ -17,19 +17,27 @@
package com.yifu.cloud.plus.v1.yifu.social.controller; package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.alibaba.fastjson.JSONObject; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindPushAndGet;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFreindPushAndGetService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendPushService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendPushService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFriendService;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.time.LocalDateTime;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
...@@ -44,8 +52,12 @@ import java.util.List; ...@@ -44,8 +52,12 @@ import java.util.List;
@Tag(name = "税友") @Tag(name = "税友")
public class TSocialFriendController { public class TSocialFriendController {
private AtomicInteger atomicPush = new AtomicInteger(0);
private AtomicInteger atomicGet = new AtomicInteger(0);
private final TSocialFriendService tSocialFriendService; private final TSocialFriendService tSocialFriendService;
private final TSocialFriendPushService tSocialFriendPushService; private final TSocialFriendPushService tSocialFriendPushService;
private final TSocialFreindPushAndGetService tSocialFreindPushAndGetService;
@Operation(description = "1定时任务推送税友") @Operation(description = "1定时任务推送税友")
@PostMapping("/inner/doPushFriend") @PostMapping("/inner/doPushFriend")
...@@ -63,4 +75,93 @@ public class TSocialFriendController { ...@@ -63,4 +75,93 @@ public class TSocialFriendController {
return tSocialFriendService.getInfoByRequestId(); return tSocialFriendService.getInfoByRequestId();
} }
/**
* @Description: 主动推送税友
* @Author: hgw
* @Date: 2025/3/18 10:44
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "主动推送税友")
@GetMapping("/doPushFriendByActive")
@SysLog("主动推送税友")
public R<String> doPushFriendActive() {
if (atomicPush.incrementAndGet() <= 1) {
try {
R<String> failed = getCore(CommonConstants.ONE_INT);
if (failed != null) return failed;
} finally {
atomicPush.decrementAndGet();
}
return R.ok();
} else {
atomicPush.decrementAndGet();
return R.failed("距离上一次推送任务时间间隔太短,请10分钟后再试!!");
}
}
/**
* @param type 1推送2拉取
* @Description: 核心处理
* @Author: hgw
* @Date: 2025/3/18 17:27
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> getCore(int type) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getNickname())) {
return R.failed("请先登录!");
}
// 先加限制 查有没有到10分钟
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 计算10分钟前的时间
LocalDateTime tenMinutesAgo = now.minusMinutes(10);
LocalDateTime time = tSocialFreindPushAndGetService.getMaxTimeByType(type);
if (Common.isEmpty(time) || time.isBefore(tenMinutesAgo)) {
TSocialFreindPushAndGet info = new TSocialFreindPushAndGet();
info.setType(type);
info.setCreateTime(now);
info.setCreateUserName(user.getNickname());
tSocialFreindPushAndGetService.save(info);
if (type == CommonConstants.ONE_INT) {
tSocialFriendPushService.pushFriendByAsync();
} else {
tSocialFriendService.getInfoByRequestIdByAsync();
}
return R.ok();
}
if (Common.isNotNull(time) && time.isAfter(tenMinutesAgo)) {
if (type == CommonConstants.ONE_INT) {
return R.failed("距离上一次推送任务时间间隔太短,请10分钟后再试!");
} else {
return R.failed("距离上一次拉取任务时间间隔太短,请10分钟后再试!");
}
}
return null;
}
/**
* @Description: 主动获取税友
* @Author: hgw
* @Date: 2025/3/18 10:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "主动获取税友")
@GetMapping("/doGetFriendByActive")
@SysLog("主动获取税友")
public R<String> doGetFriendByActive() {
if (atomicGet.incrementAndGet() <= 1) {
try {
R<String> failed = getCore(CommonConstants.TWO_INT);
if (failed != null) return failed;
} finally {
atomicGet.decrementAndGet();
}
return R.ok();
} else {
atomicGet.decrementAndGet();
return R.failed("距离上一次推送任务时间间隔太短,请10分钟后再试!!");
}
}
} }
...@@ -31,6 +31,7 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -31,6 +31,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -62,6 +63,18 @@ public class TSocialSoldierLogController { ...@@ -62,6 +63,18 @@ public class TSocialSoldierLogController {
return new R<>(tSocialSoldierLogService.getTSocialSoldierLogPage(page, tSocialSoldierLog)); return new R<>(tSocialSoldierLogService.getTSocialSoldierLogPage(page, tSocialSoldierLog));
} }
/**
* @Description: 获取最新的拉取时间
* @Author: hgw
* @Date: 2025/3/18 18:09
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.time.LocalDateTime>
**/
@Operation(description = "获取最新的拉取时间")
@GetMapping("/getMaxTimeToLog")
public R<LocalDateTime> getMaxTimeToLog() {
return R.ok(tSocialSoldierLogService.getMaxTimeToLog());
}
/** /**
* 不分页查询 * 不分页查询
* *
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindPushAndGet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
@Mapper
public interface TSocialFreindPushAndGetMapper extends BaseMapper<TSocialFreindPushAndGet> {
/**
* @param type 类型:1推送;2拉取
* @Description: 获取当前类型最大的时间,用来判断10分钟内是否有操作过
* @Author: hgw
* @Date: 2025/3/18 15:57
* @return: java.time.LocalDateTime
**/
LocalDateTime getMaxTimeByType(@Param("type") Integer type);
}
...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierLogSearchVo; ...@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierLogSearchVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
...@@ -46,4 +47,6 @@ public interface TSocialSoldierLogMapper extends BaseMapper<TSocialSoldierLog> { ...@@ -46,4 +47,6 @@ public interface TSocialSoldierLogMapper extends BaseMapper<TSocialSoldierLog> {
List<TSocialSoldierLogExportVo> getTSocialSoldierLogList(@Param("tSocialSoldierLog") TSocialSoldierLogSearchVo tSocialSoldierLog); List<TSocialSoldierLogExportVo> getTSocialSoldierLogList(@Param("tSocialSoldierLog") TSocialSoldierLogSearchVo tSocialSoldierLog);
LocalDateTime getMaxTimeToLog();
} }
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindPushAndGet;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
public interface TSocialFreindPushAndGetService extends IService<TSocialFreindPushAndGet> {
/**
* @param type 类型:1推送;2拉取
* @Description: 获取当前类型最大的时间,用来判断10分钟内是否有操作过
* @Author: hgw
* @Date: 2025/3/18 15:57
* @return: java.time.LocalDateTime
**/
LocalDateTime getMaxTimeByType(Integer type);
}
...@@ -40,5 +40,13 @@ public interface TSocialFriendPushService extends IService<TSocialInfo> { ...@@ -40,5 +40,13 @@ public interface TSocialFriendPushService extends IService<TSocialInfo> {
**/ **/
R<String> pushFriend(List<String> dispatchIdList); R<String> pushFriend(List<String> dispatchIdList);
/**
* @Description: 主动推送税友-异步
* @Author: hgw
* @Date: 2025/3/18 10:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
void pushFriendByAsync();
R<String> doExportRoster(String socialId, String type, String unitCreditCode); R<String> doExportRoster(String socialId, String type, String unitCreditCode);
} }
...@@ -37,4 +37,12 @@ public interface TSocialFriendService extends IService<TSocialInfo> { ...@@ -37,4 +37,12 @@ public interface TSocialFriendService extends IService<TSocialInfo> {
**/ **/
R<String> getInfoByRequestId(); R<String> getInfoByRequestId();
/**
* @Description: 主动获取税友-异步
* @Author: hgw
* @Date: 2025/3/18 10:45
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
void getInfoByRequestIdByAsync();
} }
...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog; ...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog;
import com.yifu.cloud.plus.v1.yifu.social.vo.*; import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
...@@ -42,6 +43,14 @@ public interface TSocialSoldierLogService extends IService<TSocialSoldierLog> { ...@@ -42,6 +43,14 @@ public interface TSocialSoldierLogService extends IService<TSocialSoldierLog> {
*/ */
IPage<TSocialSoldierLog> getTSocialSoldierLogPage(Page<TSocialSoldierLog> page, TSocialSoldierLogSearchVo tSocialSoldierLog); IPage<TSocialSoldierLog> getTSocialSoldierLogPage(Page<TSocialSoldierLog> page, TSocialSoldierLogSearchVo tSocialSoldierLog);
/**
* @Description: 获取最新的拉取时间
* @Author: hgw
* @Date: 2025/3/18 18:10
* @return: java.time.LocalDateTime
**/
LocalDateTime getMaxTimeToLog();
void listExport(HttpServletResponse response, TSocialSoldierLogSearchVo searchVo); void listExport(HttpServletResponse response, TSocialSoldierLogSearchVo searchVo);
List<TSocialSoldierLog> noPageDiy(TSocialSoldierLogSearchVo searchVo); List<TSocialSoldierLog> noPageDiy(TSocialSoldierLogSearchVo searchVo);
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindPushAndGet;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFreindPushAndGetMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFreindPushAndGetService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
/**
* 税友推送和拉取的日志表,用于10分钟只能推拉一次
*
* @author hgw
* @date 2025-03-18 15:43:40
*/
@Log4j2
@Service
public class TSocialFreindPushAndGetServiceImpl extends ServiceImpl<TSocialFreindPushAndGetMapper, TSocialFreindPushAndGet> implements TSocialFreindPushAndGetService {
/**
* @param type 类型:1推送;2拉取
* @Description: 获取当前类型最大的时间,用来判断10分钟内是否有操作过
* @Author: hgw
* @Date: 2025/3/18 15:57
* @return: java.time.LocalDateTime
**/
@Override
public LocalDateTime getMaxTimeByType(Integer type) {
return baseMapper.getMaxTimeByType(type);
}
}
...@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; ...@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialFriendConfig; import com.yifu.cloud.plus.v1.yifu.social.config.SocialFriendConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.*; import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper;
...@@ -31,12 +32,16 @@ import com.yifu.cloud.plus.v1.yifu.social.service.*; ...@@ -31,12 +32,16 @@ import com.yifu.cloud.plus.v1.yifu.social.service.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult; import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 税友 * 税友
...@@ -58,6 +63,18 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -58,6 +63,18 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
private final TSocialSoldierLogService tSocialSoldierLogService; private final TSocialSoldierLogService tSocialSoldierLogService;
private final TSocialFriendBackLogService tSocialFriendBackLogService; private final TSocialFriendBackLogService tSocialFriendBackLogService;
private final TSocialFreindSetService tSocialFreindSetService; private final TSocialFreindSetService tSocialFreindSetService;
private final AtomicInteger atomicGetFriend = new AtomicInteger(0);
/**
* @Description: 核心推送改为异步
* @Author: hgw
* @Date: 2025/3/18 10:52
* @return: void
**/
@Async
@Override
public void getInfoByRequestIdByAsync() {
this.getInfoByRequestId();
}
/** /**
* @Description: 5 查看任务进度 * @Description: 5 查看任务进度
...@@ -67,6 +84,8 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -67,6 +84,8 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
**/ **/
@Override @Override
public R<String> getInfoByRequestId() { public R<String> getInfoByRequestId() {
if (atomicGetFriend.incrementAndGet() <= 1) {
try {
TSocialFreindSet set = tSocialFreindSetService.getById("1"); TSocialFreindSet set = tSocialFreindSetService.getById("1");
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) { if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) {
// true养工失 false 医生大 // true养工失 false 医生大
...@@ -86,20 +105,35 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -86,20 +105,35 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
// 获取所有需要反馈的任务id // 获取所有需要反馈的任务id
List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll(); List<TSocialInfo> socialList = tSocialInfoService.getSocialFriendYgsAll();
List<TSocialFriendBackLog> logList; List<TSocialFriendBackLog> logList;
TSocialFriendBackLog backLog; TSocialFriendBackLog backLog = new TSocialFriendBackLog();
if (socialList != null && !socialList.isEmpty()) {
FriendResult info; FriendResult info;
List<FriendResult> resultList;
Map<String, FriendResult> resultMap;
if (socialList != null && !socialList.isEmpty()) {
logList = new ArrayList<>(); logList = new ArrayList<>();
resultMap = new HashMap<>();
for (TSocialInfo socialInfo : socialList) { for (TSocialInfo socialInfo : socialList) {
info = resultMap.get(socialInfo.getEmpIdcard());
if (info == null) {
backLog = new TSocialFriendBackLog(); backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getId()); backLog.setSocialId(socialInfo.getEmpIdcard());
backLog.setRequestId(socialInfo.getYgsRequestId()); backLog.setRequestId(socialInfo.getYgsRequestId());
backLog.setType(1); backLog.setType(11);
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(12);
} }
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId(), backLog, socialInfo.getDispatchType()); resultList = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYgsRequestId()
, backLog, socialInfo.getDispatchType());
logList.add(backLog); 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())) { if (info != null && Common.isNotNull(info.getZt())) {
doCore(info, socialInfo, typeFlag, user, errorMap); doCore(info, socialInfo, typeFlag, user, errorMap);
} }
...@@ -112,18 +146,31 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -112,18 +146,31 @@ 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<>();
backLog = new TSocialFriendBackLog();
for (TSocialInfo socialInfo : socialYsdList) { for (TSocialInfo socialInfo : socialYsdList) {
info = resultMap.get(socialInfo.getEmpIdcard());
if (info == null) {
backLog = new TSocialFriendBackLog(); backLog = new TSocialFriendBackLog();
backLog.setSocialId(socialInfo.getId()); backLog.setSocialId(socialInfo.getEmpIdcard());
backLog.setRequestId(socialInfo.getYsdRequestId()); backLog.setRequestId(socialInfo.getYsdRequestId());
backLog.setType(3); backLog.setType(13);
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(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());
} }
info = socialFriendConfig.getFriendByRequestId(restTemplate, socialInfo.getYsdRequestId(), backLog, socialInfo.getDispatchType());
logList.add(backLog); logList.add(backLog);
} else {
backLog.setSocialId(backLog.getSocialId() + "," +socialInfo.getEmpIdcard());
}
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);
} }
...@@ -133,7 +180,14 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -133,7 +180,14 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
} }
} }
} }
} finally {
atomicGetFriend.decrementAndGet();
}
return R.ok(); return R.ok();
} else {
atomicGetFriend.decrementAndGet();
return R.failed("距离上一次获取任务时间间隔太短,请10分钟后再试!!!");
}
} }
/** /**
...@@ -244,7 +298,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -244,7 +298,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
updateSocial.setYgsHandleStatus(ygsHandleStatus); updateSocial.setYgsHandleStatus(ygsHandleStatus);
// 拉取审核结果,加日志 // 拉取审核结果,加日志
if (Common.isNotNull(ygsHandleStatus)) { if (Common.isNotNull(ygsHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "提交", "社保" socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "拉取", "社保"
, getStatusName(Integer.parseInt(ygsHandleStatus))); , getStatusName(Integer.parseInt(ygsHandleStatus)));
tSocialSoldierLogService.save(socialLog); tSocialSoldierLogService.save(socialLog);
} }
...@@ -333,7 +387,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T ...@@ -333,7 +387,7 @@ public class TSocialFriendServiceImpl extends ServiceImpl<TSocialFriendMapper, T
// 拉取审核结果,加日志 // 拉取审核结果,加日志
if (Common.isNotNull(ysdHandleStatus)) { if (Common.isNotNull(ysdHandleStatus)) {
socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "提交", "医保" socialLog = tSocialSoldierLogService.getSocialFriendLog(socialInfo, "拉取", "医保"
, getStatusName(Integer.parseInt(ysdHandleStatus))); , getStatusName(Integer.parseInt(ysdHandleStatus)));
tSocialSoldierLogService.save(socialLog); tSocialSoldierLogService.save(socialLog);
} }
......
...@@ -41,6 +41,7 @@ import javax.servlet.ServletOutputStream; ...@@ -41,6 +41,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -64,6 +65,11 @@ public class TSocialSoldierLogServiceImpl extends ServiceImpl<TSocialSoldierLogM ...@@ -64,6 +65,11 @@ public class TSocialSoldierLogServiceImpl extends ServiceImpl<TSocialSoldierLogM
return baseMapper.getTSocialSoldierLogPage(page, tSocialSoldierLog); return baseMapper.getTSocialSoldierLogPage(page, tSocialSoldierLog);
} }
@Override
public LocalDateTime getMaxTimeToLog() {
return baseMapper.getMaxTimeToLog();
}
/** /**
* 自动化日志批量导出 * 自动化日志批量导出
* *
......
...@@ -279,7 +279,8 @@ public class DoSocialTask { ...@@ -279,7 +279,8 @@ public class DoSocialTask {
} }
// 当前默认 安徽省 ,且开关是税友的,才可以税友推送办理 // 当前默认 安徽省 ,且开关是税友的,才可以税友推送办理
if (isFriend) { if (isFriend) {
tSocialFriendPushService.pushFriend(dispatchIdList); // 断开派单单条推送税友
// tSocialFriendPushService.pushFriend(dispatchIdList);
} else { } else {
tSocialSoldierPushService.pushSoldier(dispatchIdList); tSocialSoldierPushService.pushSoldier(dispatchIdList);
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFreindPushAndGetMapper">
<resultMap id="tSocialFreindPushAndGetMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFreindPushAndGet">
<id property="id" column="ID"/>
<result property="type" column="TYPE"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="createUserName" column="CREATE_USER_NAME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.TYPE,
a.CREATE_TIME,
a.CREATE_USER_NAME
</sql>
<sql id="tSocialFreindPushAndGet_where">
<if test="tSocialFreindPushAndGet != null">
<if test="tSocialFreindPushAndGet.id != null and tSocialFreindPushAndGet.id.trim() != ''">
AND a.ID = #{tSocialFreindPushAndGet.id}
</if>
<if test="tSocialFreindPushAndGet.type != null">
AND a.TYPE = #{tSocialFreindPushAndGet.type}
</if>
<if test="tSocialFreindPushAndGet.createTime != null">
AND a.CREATE_TIME = #{tSocialFreindPushAndGet.createTime}
</if>
<if test="tSocialFreindPushAndGet.createUserName != null and tSocialFreindPushAndGet.createUserName.trim() != ''">
AND a.CREATE_USER_NAME = #{tSocialFreindPushAndGet.createUserName}
</if>
</if>
</sql>
<!--获取当前类型最大的时间,用来判断10分钟内是否有操作过-->
<select id="getMaxTimeByType" resultType="java.time.LocalDateTime">
SELECT
max(a.CREATE_TIME)
FROM t_social_freind_push_and_get a
where a.TYPE = #{type}
</select>
</mapper>
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '0' if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '0'
) )
group by s.id group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
<sql id="where_getSocialSoldier_base_handler"> <sql id="where_getSocialSoldier_base_handler">
...@@ -149,6 +150,7 @@ ...@@ -149,6 +150,7 @@
if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '5' if(ifnull(h.id,0) != '0',h.UNEMPLOY_HANDLE,s.UNEMPLOY_HANDLE) = '5'
) )
group by a.id group by a.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
<!-- 税友医生大增加模板--> <!-- 税友医生大增加模板-->
...@@ -165,6 +167,7 @@ ...@@ -165,6 +167,7 @@
if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '0' if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '0'
) )
group by s.id group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
<!-- 税友医生大减少模板--> <!-- 税友医生大减少模板-->
...@@ -239,6 +242,7 @@ ...@@ -239,6 +242,7 @@
if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '5' if(ifnull(h.id,0) != '0',h.BIGAILMENT_HANDLE,s.BIGAILMENT_HANDLE) = '5'
) )
group by s.id group by s.id
order by a.SOCIAL_HOUSEHOLD_NAME asc
</select> </select>
</mapper> </mapper>
...@@ -611,7 +611,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -611,7 +611,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
left join t_dispatch_info d on d.SOCIAL_ID = a.id left join t_dispatch_info d on d.SOCIAL_ID = a.id
left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0' left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN)) and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
where a.YGS_ADD_ID is not null and a.YGS_ADD_ID != '' and d.AUTO_FLAG='0' where a.YGS_ADD_ID is not null and a.YGS_ADD_ID != '' and a.YGS_REQUEST_ID is null and d.AUTO_FLAG='0'
and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')) and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
and a.YGS_HANDLE_STATUS in ('1','2','3') and a.YGS_HANDLE_STATUS in ('1','2','3')
group by a.id group by a.id
...@@ -635,7 +635,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -635,7 +635,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
left join t_dispatch_info d on d.SOCIAL_ID = a.id left join t_dispatch_info d on d.SOCIAL_ID = a.id
left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0' left join t_social_deadline_info sd on sd.MONTH = DATE_FORMAT(d.AUDIT_TIME,'%Y%m') and sd.STATUS = '0'
and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN)) and sd.PROVINCE=a.SOCIAL_PROVINCE and sd.CITY=a.SOCIAL_CITY and ( (a.SOCIAL_TOWN is null and sd.TOWN is null) or (sd.TOWN=a.SOCIAL_TOWN))
where a.YSD_ADD_ID is not null and a.YSD_ADD_ID != '' and d.AUTO_FLAG='0' where a.YSD_ADD_ID is not null and a.YSD_ADD_ID != '' and a.YSD_REQUEST_ID is null and d.AUTO_FLAG='0'
and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')) and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
and a.YSD_HANDLE_STATUS in ('1','2','3') and a.YSD_HANDLE_STATUS in ('1','2','3')
group by a.id group by a.id
...@@ -662,6 +662,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -662,6 +662,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')) and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
and a.YGS_HANDLE_STATUS in ('1','2') and a.YGS_HANDLE_STATUS in ('1','2')
group by a.id group by a.id
order by a.YGS_REQUEST_ID asc
</select> </select>
<!-- 获取所有需要自动办理的医生大 --> <!-- 获取所有需要自动办理的医生大 -->
...@@ -687,6 +688,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id ...@@ -687,6 +688,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')) and (DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m') or DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m'))
and a.YSD_HANDLE_STATUS in ('1','2') and a.YSD_HANDLE_STATUS in ('1','2')
group by a.id group by a.id
order by a.YSD_REQUEST_ID asc
</select> </select>
<!-- 获取所有需要社保局审核的养工失 --> <!-- 获取所有需要社保局审核的养工失 -->
......
...@@ -132,4 +132,13 @@ ...@@ -132,4 +132,13 @@
</if> </if>
</if> </if>
</select> </select>
<!--tSocialSoldierLog简单分页查询-->
<select id="getMaxTimeToLog" resultType="java.time.LocalDateTime">
SELECT
max(a.CREATE_TIME)
FROM t_social_soldier_log a
where a.TYPE = '拉取'
</select>
</mapper> </mapper>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao ,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '0' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and a.type = '0' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and s.YGS_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '0' or
if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '0' or
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao ,'是' isAutoSubmit,'是' isAutoInsert,'是' isAutoUpload,'是' isDoShenBao,'' isDanShenBao
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '1' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and a.type = '1' and s.YGS_HANDLE_STATUS in ('0','1','2','3') and s.YGS_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.PENSION_HANDLE,s.PENSION_HANDLE) = '5' or
if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.WORK_INJURY_HANDLE,s.WORK_INJURY_HANDLE) = '5' or
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen ,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '0' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and a.type = '0' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and s.YSD_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '0' or
if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '0' or if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '0' or
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
<include refid="getSocialSoldierBaseOne"/> <include refid="getSocialSoldierBaseOne"/>
,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen ,'' isBatch,'是' isAutoMonth,'' isAdd,'' isXu,'是' isShen
<include refid="getSocialSoldierBaseTwo"/> <include refid="getSocialSoldierBaseTwo"/>
and a.type = '1' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and a.type = '1' and s.YSD_HANDLE_STATUS in ('0','1','2','3') and s.YSD_REQUEST_ID is null
and ( and (
if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.MEDICAL_HANDLE,s.MEDICAL_HANDLE) = '5' or
if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '5' or if(ifnull(h.id,0) != '0',h.BIRTH_HANDLE,s.BIRTH_HANDLE) = '5' or
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment