Commit c82bd732 authored by hongguangwu's avatar hongguangwu

MVP1.7.3-shuiyou 测试提交

parent 1102dd7b
......@@ -194,6 +194,29 @@ public class SocialTask {
log.info("------------2定时任务推送社保士兵-定时任务结束------------");
}
/**
* @Description: 1定时任务推送税友
* @Author: hgw
* @Date: 2024-12-9 17:00:02
**/
public void doPushFriend() {
log.info("------------1定时任务推送税友-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),
"/tsocialfriend/inner/doPushFriend","", Object.class, SecurityConstants.FROM_IN);
log.info("------------1定时任务推送税友-定时任务结束------------");
}
/**
* @Description: 2定时任务获取税友
* @Author: hgw
* @Date: 2024-12-9 16:59:56
**/
public void doGetFriendByRequestId() {
log.info("------------2定时任务获取税友-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),
"/tsocialfriend/inner/doGetFriendByRequestId","", Object.class, SecurityConstants.FROM_IN);
log.info("------------2定时任务获取税友-定时任务结束------------");
}
/**
* @Description: 3每日定时任务推送社保士兵审核结果查询
* @Author: hgw
......
package com.yifu.cloud.plus.v1.yifu.social.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author fxj
* @Date 2024/5/10
* @Description
* @Version 1.0
*/
@Data
public class FriendResult implements Serializable {
// 身份证
private String idCard;
// 状态1-处理中,2-处理成功,3-处理失败,4-待办(提交成功,待网厅状态流转,上海特有)
private String zt;
// 提示或者错误信息 SUCCESS
private String cwxx;
}
package com.yifu.cloud.plus.v1.yifu.social.config;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Base64;
import java.util.Map;
/**
* @author hgw2
* @description 税友签名接口
* @date 2024/12/9
*/
public class SocialFriendSign {
public static String qianMing(Map<String, String> treeMap) throws SignatureException {
// 1. 将以上 key=value 对的 value 进行合并,生成一下字符串 mergeStr
//System.out.println("header内的信息:"+treeMap.toString())
StringBuilder mergeStr = new StringBuilder();
for (Map.Entry<String, String> stringStringEntry : treeMap.entrySet()) {
mergeStr.append(stringStringEntry.getValue());
}
//System.out.println("Key-Value 合并: " + mergeStr)
// 2. 将生成的 mergeStr 进行 Url 编码
String encodedStr = null;
try {
encodedStr = URLEncoder.encode(mergeStr.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
// URL 编码失败
throw new SignatureException("【税友】URL 编码失败");
}
//System.out.println("encodeURL 编码:" + encodedStr)
// 3.利用 HmacSHA256 算法对 signStr 进行哈希运算生成消息摘要,摘要结果以 Base64 结果形式返回,signStr 即为请求参数中的 signature 字段
String signatureResult = "";
try {
Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec signingKey = new SecretKeySpec(treeMap.get("appSecret").getBytes(), "HmacSHA256");
mac.init(signingKey);
byte[] signData = mac.doFinal(encodedStr.getBytes());
byte[] resultBytes = Base64.getEncoder().encode(signData);
signatureResult = new String(resultBytes, StandardCharsets.UTF_8);
} catch (NoSuchAlgorithmException e) {
throw new SignatureException("【税友】平台不支持 HmacSHA 摘要方式");
} catch (InvalidKeyException e) {
throw new SignatureException("【税友】指定的访问密钥无效");
}
//ystem.out.println("加密结果: " + signatureResult)
return signatureResult;
}
private SocialFriendSign() {
throw new IllegalStateException("SocialFriendSign class");
}
}
......@@ -17,11 +17,13 @@
package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.alibaba.fastjson.JSONObject;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
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.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;
......@@ -51,6 +53,22 @@ public class TSocialFriendController {
return tSocialFriendPushService.pushFriendTest(dispatchIdList);
}
@Operation(description = "1定时任务推送税友")
@PostMapping("/inner/doPushFriend")
@SysLog("1定时任务推送税友")
@Inner
public R<String> doPushFriendTest() {
return tSocialFriendPushService.pushFriendTest(null);
}
@Operation(description = "2定时任务获取税友")
@PostMapping("/inner/doGetFriendByRequestId")
@SysLog("2定时任务获取税友")
@Inner
public R<FriendResult> doGetFriendByRequestId() {
return tSocialFriendPushService.getFriendByRequestIdTest(null);
}
/**
* @param addId 任务id,可为空
* @Description: 1获取税友状态
......
......@@ -17,9 +17,11 @@
package com.yifu.cloud.plus.v1.yifu.social.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.FriendResult;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
......@@ -50,6 +52,7 @@ public interface TSocialFriendPushService extends IService<TSocialInfo> {
R<String> pushSoldier(List<String> dispatchIdList);
R<String> pushFriendTest(List<String> dispatchIdList);
R<FriendResult> getFriendByRequestIdTest(List<String> dispatchIdList);
/**
* @param
......
......@@ -32,10 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierShenBaoTask;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFriendMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAuditVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAddVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAuditVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.compress.utils.IOUtils;
......@@ -172,12 +169,25 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
**/
@Override
public R<String> pushFriendTest(List<String> dispatchIdList) {
// 获取时间限制配置(获取 当月启用 的配置)
String id = socialFriendConfig.getFourAppAdd(restTemplate);
String thisTime = DateUtil.getThisTime();
// type 1社保增 2社保减 3医保增 4医保减
int type = 1;
String id = socialFriendConfig.pushFriendByInfo(restTemplate, "3", type, thisTime);
return R.ok(id);
}
/**
* @Description: 推送到社保士兵
* @Author: hgw
* @Date: 2024/5/10 17:53
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<FriendResult> getFriendByRequestIdTest(List<String> dispatchIdList) {
R<FriendResult> info = socialFriendConfig.getFriendByRequestId(restTemplate, "15074c814b4240a19cdb4425a7ae502c");
return info;
}
/**
* @Description: 推送到社保士兵
* @Author: hgw
......
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