liujie
2025-11-26 21fad5bb63b6e5daae1ed4f4c543705588f64fe8
DriverJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/huifu/biz/DouGongPayUtil.java
@@ -7,6 +7,7 @@
import com.alibaba.fastjson.JSONObject;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.huifu.properties.HuiFuProperties;
import com.stylefeng.guns.modular.system.util.RedisUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -35,6 +36,9 @@
    @Value("${callbackPath}")
    private static String callbackPath;//支付回调网关地址
    @Autowired
    private RedisUtil redisUtil;
    public static void main(String[] args) throws Exception {
@@ -95,7 +99,7 @@
     * @param orderId
     * @return
     */
    public static ResultUtil wxPayOrder(String money, String openId, String goodsDesc, int type, String orderId, int callType) {
    public  ResultUtil wxPayOrder(String money, String openId, String goodsDesc, int type, String orderId, int callType) {
        HttpRequest post = HttpUtil.createPost("https://api.huifu.com/v4/trade/payment/create");
        String req_seq_id = orderId + "_" + type + "_" + System.currentTimeMillis() + ToolUtil.getRandomNumber(10);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
@@ -149,9 +153,14 @@
        System.out.println(p);
        post.body(p);
        HttpResponse execute = post.execute();
        System.out.println(execute.body());
        String randomString = ToolUtil.getRandomString(18);
        redisUtil.setStrValue("dg_wx_pay:"+randomString,execute.body(),300);
        JSONObject jsonObject = JSONObject.parseObject(execute.body());
        jsonObject.put("dg_wx_pay","dg_wx_pay:"+randomString);
        return ResultUtil.success(jsonObject);
    }