From eb7f3343af839a7c71f16e8ada2b25d5e2201c08 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 19 四月 2021 19:27:52 +0800 Subject: [PATCH] bug修复 --- src/test/java/com/hxh/spring/test/vip/VIPTest.java | 74 ++++++++++++++++++------------------ 1 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/test/java/com/hxh/spring/test/vip/VIPTest.java b/src/test/java/com/hxh/spring/test/vip/VIPTest.java index f263daf..e496ac2 100644 --- a/src/test/java/com/hxh/spring/test/vip/VIPTest.java +++ b/src/test/java/com/hxh/spring/test/vip/VIPTest.java @@ -1,38 +1,26 @@ package com.hxh.spring.test.vip; import com.yeshi.buwan.domain.vip.UserVIPInfo; -import com.yeshi.buwan.domain.vip.VIPOrderRecord; +import com.yeshi.buwan.domain.vip.OrderRecord; import com.yeshi.buwan.domain.vip.VIPPrice; import com.yeshi.buwan.domain.vip.VIPPriceType; +import com.yeshi.buwan.exception.order.OrderException; import com.yeshi.buwan.exception.vip.VIPException; +import com.yeshi.buwan.job.OrderJob; import com.yeshi.buwan.pptv.PPTVVipManager; +import com.yeshi.buwan.service.inter.order.OrderService; import com.yeshi.buwan.service.inter.vip.VIPPriceService; import com.yeshi.buwan.service.inter.vip.VIPService; import com.yeshi.buwan.util.Constant; import com.yeshi.buwan.util.HttpUtil; -import com.yeshi.buwan.util.log.LoggerUtil; -import com.yeshi.buwan.util.user.VipUtil; -import com.yeshi.buwan.util.vip.VIPOrderUtil; -import net.sf.json.JSONObject; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -import org.yeshi.utils.entity.wx.WXAPPInfo; import javax.annotation.Resource; -import javax.crypto.Cipher; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.spec.GCMParameterSpec; -import javax.crypto.spec.SecretKeySpec; -import java.io.IOException; import java.math.BigDecimal; -import java.security.GeneralSecurityException; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.Base64; import java.util.Date; import java.util.List; @@ -47,14 +35,20 @@ @Resource private VIPService vipService; + + @Resource + private OrderService orderService; + @Resource private PPTVVipManager pptvVipManager; + + @Resource + private OrderJob orderJob; @Test public void addVIPPrice() { VIPPrice price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("8.8")); - price.setActualPrice(new BigDecimal("14.8")); + price.setActualPrice(new BigDecimal("8.8")); price.setPrice(new BigDecimal("14.8")); price.setType(VIPPriceType.month); price.setPptvGoodsNo("DA7559531560894"); @@ -66,8 +60,7 @@ } price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("22.8")); - price.setActualPrice(new BigDecimal("37.8")); + price.setActualPrice(new BigDecimal("22.8")); price.setPrice(new BigDecimal("37.8")); price.setType(VIPPriceType.season); price.setPptvGoodsNo("DA7559574625089"); @@ -80,8 +73,7 @@ price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("42")); - price.setActualPrice(new BigDecimal("68.8")); + price.setActualPrice(new BigDecimal("42")); price.setPrice(new BigDecimal("68.8")); price.setType(VIPPriceType.halfYear); price.setPptvGoodsNo("DA6989580247516"); @@ -94,8 +86,7 @@ price = new VIPPrice(); -// price.setActualPrice(new BigDecimal("77.8")); - price.setActualPrice(new BigDecimal("128.8")); + price.setActualPrice(new BigDecimal("77.8")); price.setPrice(new BigDecimal("128.8")); price.setType(VIPPriceType.year); price.setPptvGoodsNo("DA8129574268091"); @@ -118,33 +109,33 @@ @Test public void addOrderRecord() { VIPPrice price = vipPriceService.selectByPrimaryKey("172a8327fcd3685ab3c0f740d031da09"); - VIPOrderRecord record = new VIPOrderRecord(); + OrderRecord record = new OrderRecord(); record.setMoney(price.getActualPrice()); record.setType(price.getType()); record.setUid(766693 + ""); try { - vipService.addVIPRecord(record); - } catch (VIPException e) { + orderService.createOrder(record); + } catch (OrderException e) { e.printStackTrace(); } } @Test public void listRecord() { - List<VIPOrderRecord> list = vipService.listOrderRecord(null, null, 1, 10); - long count = vipService.countOrderRecord(null, null); + List<OrderRecord> list = orderService.listOrderRecord(null, null,null, 1, 10); + long count = orderService.countOrderRecord(null, null,null); - list = vipService.listOrderRecord(766693 + "", null, 1, 10); - count = vipService.countOrderRecord(766693 + "", null); + list = orderService.listOrderRecord(766693 + "", null,null, 1, 10); + count = orderService.countOrderRecord(766693 + "", null,null); - list = vipService.listOrderRecord(766693 + "", VIPOrderRecord.STATE_NOT_PAY, 1, 10); - count = vipService.countOrderRecord(766693 + "", VIPOrderRecord.STATE_NOT_PAY); + list = orderService.listOrderRecord(766693 + "", null,OrderRecord.STATE_NOT_PAY, 1, 10); + count = orderService.countOrderRecord(766693 + "", null,OrderRecord.STATE_NOT_PAY); - list = vipService.listOrderRecord(766693 + "", VIPOrderRecord.STATE_PAY, 1, 10); - count = vipService.countOrderRecord(766693 + "", VIPOrderRecord.STATE_PAY); + list = orderService.listOrderRecord(766693 + "", null,OrderRecord.STATE_PAY, 1, 10); + count = orderService.countOrderRecord(766693 + "",null, OrderRecord.STATE_PAY); System.out.println(list); } @@ -152,7 +143,7 @@ @Test public void paySuccess() { // try { -// vipService.paySuccess("",VIPOrderRecord.PAY_WAY_WX,new BigDecimal("14.8"),) +// vipService.paySuccess("",OrderRecord.PAY_WAY_WX,new BigDecimal("14.8"),) // } catch (Exception e) { // e.printStackTrace(); // } @@ -194,10 +185,19 @@ @Test public void test3() throws Exception { - VIPOrderRecord record = vipService.getOrderRecord("82"); + OrderRecord record = orderService.getOrderRecord("82"); pptvVipManager.buyVIP(record); } + @Test + public void cancelOrder(){ + try { + orderJob.cancelOrder("1000140"); + } catch (Exception e) { + e.printStackTrace(); + } + } + } -- Gitblit v1.8.0