乱七八糟
This commit is contained in:
@@ -1,22 +1,36 @@
|
||||
package com.gxwebsoft;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.request.AlipayFundAuthOrderUnfreezeRequest;
|
||||
import com.alipay.api.response.AlipayFundAuthOrderUnfreezeResponse;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.gxwebsoft.apps.service.HualalaService;
|
||||
import com.gxwebsoft.apps.service.TestDataService;
|
||||
import com.gxwebsoft.common.core.utils.AlipayConfigUtil;
|
||||
import com.gxwebsoft.common.system.mapper.RoleMapper;
|
||||
import com.gxwebsoft.common.system.mapper.UserMapper;
|
||||
import com.gxwebsoft.common.system.service.SettingService;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.love.service.CertificateService;
|
||||
import com.gxwebsoft.shop.entity.FreezeOrder;
|
||||
import com.gxwebsoft.shop.mapper.OrderGoodsMapper;
|
||||
import com.gxwebsoft.shop.mapper.OrderMapper;
|
||||
import com.gxwebsoft.shop.service.FreezeOrderService;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by WebSoft on 2020-03-23 23:37
|
||||
@@ -47,6 +61,12 @@ public class TestMain {
|
||||
@Resource
|
||||
private CertificateService certificateService;
|
||||
|
||||
@Resource
|
||||
private FreezeOrderService freezeOrderService;
|
||||
|
||||
@Resource
|
||||
private AlipayConfigUtil alipayConfig;
|
||||
|
||||
/**
|
||||
* 生成唯一的key用于jwt工具类
|
||||
*/
|
||||
@@ -277,7 +297,57 @@ public class TestMain {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void close() throws AlipayApiException {
|
||||
|
||||
|
||||
List<FreezeOrder> freeze = freezeOrderService.lambdaQuery().eq(FreezeOrder::getOperationType, "FREEZE").list();
|
||||
List<FreezeOrder> unfreeze = freezeOrderService.lambdaQuery().eq(FreezeOrder::getOperationType, "UNFREEZE").list();
|
||||
|
||||
Map<String, List<FreezeOrder>> collect = unfreeze.stream().collect(Collectors.groupingBy(FreezeOrder::getOutOrderNo));
|
||||
DefaultAlipayClient alipayClient = null;
|
||||
try {
|
||||
alipayClient = alipayConfig.alipayClient(6);
|
||||
} catch (AlipayApiException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
DefaultAlipayClient finalAlipayClient = alipayClient;
|
||||
freeze.forEach(item -> {
|
||||
List<FreezeOrder> freezeOrders = collect.get(item.getOutOrderNo());
|
||||
if(CollectionUtils.isEmpty(freezeOrders)) {
|
||||
|
||||
AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();
|
||||
// request.setNotifyUrl("https://yxw.wsdns.cn/api/shop/freeze-order/notify");
|
||||
request.setNotifyUrl("http://1.14.132.108:10090/api/shop/freeze-order/notify");
|
||||
JSONObject bizContent = new JSONObject();
|
||||
bizContent.put("auth_no", item.getAuthNo());
|
||||
bizContent.put("out_request_no", IdUtil.getSnowflakeNextId());
|
||||
bizContent.put("amount", item.getAmount());
|
||||
// bizContent.put("amount", .99);
|
||||
bizContent.put("remark", "解冻资金");
|
||||
|
||||
JSONObject extraParam = new JSONObject();
|
||||
JSONObject unfreezeBizInfo = new JSONObject();
|
||||
unfreezeBizInfo.put("bizComplete", true);
|
||||
extraParam.put("unfreezeBizInfo", unfreezeBizInfo);
|
||||
bizContent.put("extra_param", extraParam);
|
||||
|
||||
request.setBizContent(bizContent.toString());
|
||||
AlipayFundAuthOrderUnfreezeResponse response = null;
|
||||
try {
|
||||
response = finalAlipayClient.certificateExecute(request);
|
||||
} catch (AlipayApiException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (response.isSuccess()) {
|
||||
System.out.println("调用成功");
|
||||
System.out.println(response.getBody());
|
||||
} else {
|
||||
System.out.println("调用失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public void setProfile(){
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,8 @@ public class ShopGenerator {
|
||||
// "shop_user_like",
|
||||
// "shop_user_look"
|
||||
// "shop_user_feedback"
|
||||
"shop_profit_log"
|
||||
// "shop_freeze_order",
|
||||
"shop_order_pay",
|
||||
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
|
||||
Reference in New Issue
Block a user