Althars123 hace 3 años
padre
commit
340f24b9a6

+ 2 - 2
zzjs-admin/src/main/java/com/miaxis/app/controller/wx/WxNotifyController.java

@@ -217,11 +217,11 @@ public class WxNotifyController {
             wxOrder.setDeviceId(sceneInfo.getString("device_id"));
         }
         //购买电影票
-        if (wxOrder.getGoodsType() =="1"){
+        if ( "1".equals(wxOrder.getGoodsType())){
             wxOrderService.buyFilmOrder(wxOrder);
         }
         //购买福禄视频会员
-        else if (wxOrder.getGoodsType() =="2"){
+        else if ( "2".equals(wxOrder.getGoodsType())){
             wxOrderService.buyFuluOrder(wxOrder);
         }
 

+ 19 - 5
zzjs-admin/src/test/java/com/miaxis/test/NormalTest.java

@@ -1,7 +1,9 @@
 package com.miaxis.test;
 
+import com.alibaba.fastjson.JSONObject;
 import com.miaxis.ZzjsApplication;
 import com.miaxis.wx.domain.WxOrder;
+import com.miaxis.wx.dto.WxNotifyReturnDTO;
 import com.miaxis.wx.service.IWxOrderService;
 import com.miaxis.wx.service.IRefundRecordService;
 import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
@@ -9,11 +11,12 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.math.BigInteger;
 import java.security.cert.X509Certificate;
-
+//@ActiveProfiles("prod")
 @SpringBootTest(classes = ZzjsApplication.class)
 @RunWith(SpringRunner.class)
 public class NormalTest {
@@ -27,12 +30,23 @@ public class NormalTest {
     private AutoUpdateCertificatesVerifier verifier;
     @Test
     public void test1() throws Exception {
-        WxOrder wxOrder = wxOrderService.getByOutTradeNo("12021052416003523348114349059153");
-        refundRecordService.refund(wxOrder,"12021051815333778448136985596488");
-        WxOrder wxOrder1 = wxOrderService.getByOutTradeNo("12021052415260767148145493655617");
-        refundRecordService.refund(wxOrder1,"12021051815333778448136985596489");
+        WxOrder wxOrder = wxOrderService.getByOutTradeNo("12021060816391765454799220937462");
+        WxNotifyReturnDTO refund = refundRecordService.refund(wxOrder, "12021060816391765454799220937463");
+        System.out.println(JSONObject.toJSONString(refund));
+//        WxOrder wxOrder1 = wxOrderService.getByOutTradeNo("12021052415260767148145493655617");
+//        refundRecordService.refund(wxOrder1,"12021051815333778448136985596489");
     }
 
+    @Test
+    public void test11() throws Exception {
+        WxOrder wxOrder = wxOrderService.getByOutTradeNo("12021052417182038148110033053335");
+        System.out.println(wxOrder.getGoodsType()=="1");
+        System.out.println(wxOrder.getGoodsType().equals("1"));
+//        WxOrder wxOrder1 = wxOrderService.getByOutTradeNo("12021052415260767148145493655617");
+//        refundRecordService.refund(wxOrder1,"12021051815333778448136985596489");
+    }
+
+
 
     @Test
     public void test2() throws Exception {

+ 46 - 1
zzjs-admin/src/test/java/com/miaxis/test/WxTest.java

@@ -5,6 +5,9 @@ import com.miaxis.ZzjsApplication;
 import com.miaxis.feign.dto.AddTemplate;
 import com.miaxis.feign.dto.WxSend;
 import com.miaxis.feign.service.IWxSendService;
+import com.miaxis.wx.domain.WxOrder;
+import com.miaxis.wx.service.IWxOrderService;
+import com.miaxis.wx.service.IWxXcxMessageService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +15,9 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 @SpringBootTest(classes = ZzjsApplication.class)
 @RunWith(SpringRunner.class)
 public class WxTest {
@@ -23,7 +29,8 @@ public class WxTest {
     @Autowired
     private IWxSendService wxSendService;
 
-
+    @Autowired
+    private IWxXcxMessageService wxXcxMessageService;
 
     @Value("${app.appid}")
     private String appid;
@@ -72,5 +79,43 @@ public class WxTest {
     }
 
 
+    @Test
+    public void getWxSendService2(){
+//        WxOrder wxOrder = wxOrderService.getByOutTradeNo("");
+        WxSend wxSend = new WxSend();
+        wxSend.setAccess_token(wxXcxMessageService.getXcxMessageToken());
+        wxSend.setTouser("oO7PJ5FlradAM7tqw3TM2zvEj4O4");
+        wxSend.setTemplate_id("Q4-tQrDwtzFUSLt_PR2kuTxBJ3d62V4Yp2iwx4PAcIE");
+        wxSend.setPage("/pages/cinema/orderdes?outTradeNo="+"12021053117040103901269463601171");
+
+        JSONObject jsonObject = new JSONObject();
+        JSONObject jsonObject1 = new JSONObject();
+        JSONObject jsonObject2 = new JSONObject();
+        JSONObject jsonObject3 = new JSONObject();
+        JSONObject jsonObject4 = new JSONObject();
+        JSONObject jsonObject5 = new JSONObject();
+
+        jsonObject1.put("value","12021053117040103901269463601171");
+        jsonObject2.put("value","¥"+"250");
+        jsonObject3.put("value",new SimpleDateFormat("yyyy年MM月dd日 HH:mm").format(new Date()));
+        jsonObject4.put("value","电影票");
+        jsonObject5.put("value","点击查看取票二维码");
+
+        jsonObject.put("character_string1",jsonObject1);
+        jsonObject.put("amount3",jsonObject2);
+        jsonObject.put("date4",jsonObject3);
+        jsonObject.put("thing6",jsonObject4);
+        jsonObject.put("thing5",jsonObject5);
+
+
+        wxSend.setData(jsonObject);
+        wxSend.setMiniprogram_state("developer");
+        wxSend.setLang("zh_CN");
+
+        String result = wxSendService.sendMessage(wxXcxMessageService.getXcxMessageToken(),wxSend);
+        System.out.println(result);
+    }
+
+
 
 }