New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.zhenglian; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.stylefeng.guns.modular.system.util.SpringContextsUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.util.zhenglian.model.TokenRequest; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/24 14:06 |
| | | */ |
| | | public class TokenUtil { |
| | | |
| | | private static ZhengLianConfig zhengLianConfig = SpringContextsUtil.getBean(ZhengLianConfig.class).getZhengLianConfig(); |
| | | |
| | | |
| | | |
| | | public static void getToken(TokenRequest request){ |
| | | request.setAppid(zhengLianConfig.getAppid()); |
| | | HttpRequest post = HttpUtil.createPost(zhengLianConfig.getUrl()); |
| | | String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); |
| | | post.header("msgId", UUIDUtil.getRandomCode()); |
| | | post.header("merchNo", zhengLianConfig.getMerchNo()); |
| | | post.header("txCode","ZLPAY.ACC.T0001"); |
| | | post.header("version","1.0.1"); |
| | | post.header("encrp","1"); |
| | | post.header("signa","1"); |
| | | post.header("encrpNo","123456"); |
| | | post.header("signNo","123456"); |
| | | post.header("timestamp", timestamp); |
| | | post.header("Content-Length", ""); |
| | | post.header("Content-Type", "application/json;charset=utf-8"); |
| | | |
| | | |
| | | |
| | | post.body("{}"); |
| | | |
| | | |
| | | } |
| | | } |