From cc30aa0884535c6e08844e3b6b0dfadbc7d86d35 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Sat, 08 Apr 2023 10:30:10 +0800
Subject: [PATCH] 在mq之前,先更新订单状态
---
src/test/java/cc/mrbird/febs/ProfitTest.java | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 99 insertions(+), 0 deletions(-)
diff --git a/src/test/java/cc/mrbird/febs/ProfitTest.java b/src/test/java/cc/mrbird/febs/ProfitTest.java
index 212afbe..2530112 100644
--- a/src/test/java/cc/mrbird/febs/ProfitTest.java
+++ b/src/test/java/cc/mrbird/febs/ProfitTest.java
@@ -1,17 +1,24 @@
package cc.mrbird.febs;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.utils.MallUtils;
import cc.mrbird.febs.mall.entity.MallOrderItem;
import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper;
import cc.mrbird.febs.mall.mapper.MallOrderItemMapper;
+import cc.mrbird.febs.mall.quartz.OrderSettlementJob;
import cc.mrbird.febs.mall.service.IAgentService;
import cc.mrbird.febs.mall.service.IMallAchieveService;
import cc.mrbird.febs.mall.service.IMemberProfitService;
+import cc.mrbird.febs.pay.model.*;
+import cc.mrbird.febs.pay.service.UnipayService;
import cc.mrbird.febs.rabbit.consumer.AgentConsumer;
+import cn.hutool.core.date.DateUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.math.BigDecimal;
+import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -102,4 +109,96 @@
public void staticProfit(){
memberProfitService.staticProfit(null);
}
+
+ @Autowired
+ private OrderSettlementJob orderSettlementJob;
+
+ @Test
+ public void orderSettlementJobTest() {
+// orderSettlementJob.normalGoodsSettlementJob();
+
+ mallAchieveService.add(83L);
+ }
+
+
+ @Autowired
+ private UnipayService unipayService;
+ @Test
+ public void unipay(){
+ UnipayDto unipayDto = new UnipayDto();
+ unipayDto.setAmount(new BigDecimal("0.01"));
+ unipayDto.setFrpCode("ALIPAY_H5");
+ unipayDto.setTradeMerchantNo("777180800385820");
+// unipayDto.setFrpCode("WEIXIN_APP3");
+ unipayDto.setOrderNo("2022082316415386395");
+ unipayDto.setProductName("洗护套装");
+ unipayService.unipay(unipayDto);
+ }
+ @Test
+ public void getAgreeMentPaySms(){
+ AgreeMentPaySmsDto agreeMentPaySmsDto = new AgreeMentPaySmsDto();
+ agreeMentPaySmsDto.setOrderNo("2022082617305930328");
+
+ BigDecimal value = new BigDecimal("0.1").setScale(2, BigDecimal.ROUND_DOWN);
+ DecimalFormat decimalFormat = new DecimalFormat("0.00#");
+ String strVal = decimalFormat.format(value);
+ agreeMentPaySmsDto.setOrderAmount(new BigDecimal(strVal));
+ agreeMentPaySmsDto.setName("肖永");
+ agreeMentPaySmsDto.setCreatedTime(DateUtil.now());
+ agreeMentPaySmsDto.setIdType("1");
+ agreeMentPaySmsDto.setIdCardNum("430321199310113713");
+ agreeMentPaySmsDto.setBankNo("6222031901002389639");
+ agreeMentPaySmsDto.setPhone("15274802129");
+ String agreeMentPaySms = unipayService.getAgreeMentPaySms(agreeMentPaySmsDto);
+ if("JS000000".equals(agreeMentPaySms)){
+ System.out.println("获取成功");
+ }else{
+ System.out.println(agreeMentPaySms);
+ }
+ }
+
+ @Test
+ public void agreementSign(){
+ AgreementSignDto agreementSignDto = new AgreementSignDto();
+ agreementSignDto.setOrderNo("2022082614465345250");
+ agreementSignDto.setSmsCode("841243");
+ unipayService.agreementSign(agreementSignDto);
+ }
+
+ @Test
+ public void agreementPay(){
+ AgreementPayDto agreementPayDto = new AgreementPayDto();
+ agreementPayDto.setOrderNo("2022082614465345250");
+
+ BigDecimal value = new BigDecimal("0.1").setScale(2, BigDecimal.ROUND_DOWN);
+ DecimalFormat decimalFormat = new DecimalFormat("0.00#");
+ String strVal = decimalFormat.format(value);
+ agreementPayDto.setOrderAmount(new BigDecimal(strVal));
+ agreementPayDto.setOrderTime(DateUtil.now());
+ agreementPayDto.setOrderDesc("测试");
+ agreementPayDto.setBankNo("6222031901002389639");
+ unipayService.agreementPay(agreementPayDto);
+ }
+
+ @Test
+ public void singlePay(){
+ /**
+ * 调用汇聚代付
+ */
+ String orderNo = MallUtils.getOrderNum("W");
+ SinglePayDto singlePayDto = new SinglePayDto();
+ singlePayDto.setMerchantOrderNo(orderNo);
+ singlePayDto.setReceiverAccountNoEncBankNo("6222031903210023839639");
+ singlePayDto.setReceiverAccountNoEncName("肖永");
+ singlePayDto.setReceiverAccountType("201");
+ BigDecimal paidAmount = new BigDecimal(1.00);
+ singlePayDto.setPaidAmount(paidAmount);
+ singlePayDto.setCurrency("201");
+ singlePayDto.setIsChecked("202");
+ singlePayDto.setPaidDesc("用户提现");
+ singlePayDto.setPaidUse("202");
+ String singlePayRep = unipayService.singlePay(singlePayDto);
+
+ System.out.println(singlePayRep);
+ }
}
--
Gitblit v1.9.1