瀏覽代碼

抖音小程序 下单

Althars123 2 年之前
父節點
當前提交
c1eb705cdc

+ 5 - 4
sdjk-admin/src/main/java/com/miaxis/app/controller/tt/TtNotifyController.java

@@ -11,6 +11,7 @@ import com.miaxis.common.utils.AesUtil;
 import com.miaxis.tt.domain.TtOrder;
 import com.miaxis.tt.dto.TtNotifyReturnDTO;
 import com.miaxis.tt.dto.TtpayNotifyDTO;
+import com.miaxis.tt.dto.TtpaySource;
 import com.miaxis.tt.service.ITtOrderService;
 import com.miaxis.user.service.IUserInfoService;
 import com.miaxis.vip.domain.VipCode;
@@ -85,11 +86,12 @@ public class TtNotifyController {
     public TtNotifyReturnDTO wxpayNotify(@RequestBody TtpayNotifyDTO ttpayNotifyDTO) {
 
         //将回调数据写入数据库
-        writeNotifyDataToDb(ttpayNotifyDTO);
+        TtpaySource msg = JSONObject.parseObject(ttpayNotifyDTO.getMsg(), TtpaySource.class);
+        writeNotifyDataToDb(msg);
         //创建兑换码
         String code = createCode();
         //激活用户
-        avtivityCode(ttpayNotifyDTO.getMsg().getCp_orderno(),code);
+        avtivityCode(msg.getCp_orderno(),code);
 
         TtNotifyReturnDTO ttNotifyReturnDTO = new TtNotifyReturnDTO();
         ttNotifyReturnDTO.setErr_no(0);
@@ -169,8 +171,7 @@ public class TtNotifyController {
 
 
 
-    public void writeNotifyDataToDb(TtpayNotifyDTO ttpayNotifyDTO) {
-        TtpayNotifyDTO.TTpaySource msg = ttpayNotifyDTO.getMsg();
+    public void writeNotifyDataToDb(TtpaySource msg) {
         TtOrder order= ttOrderService.getOne(new QueryWrapper<TtOrder>().eq("cp_orderno",msg.getCp_orderno()));
         if (order == null) {
             throw new CustomException("该订单不存在");

+ 2 - 33
sdjk-service/src/main/java/com/miaxis/tt/dto/TtpayNotifyDTO.java

@@ -17,7 +17,7 @@ public class TtpayNotifyDTO {
     private String nonce;
 
     @ApiModelProperty(value = "订单信息的 json 字符串")
-    private TTpaySource msg;
+    private String msg;
 
 
     @ApiModelProperty(value = "回调类型标记,支付成功回调为\"payment\"")
@@ -28,38 +28,7 @@ public class TtpayNotifyDTO {
     private String msg_signature;
 
 
-    @Data
-    public class TTpaySource{
-        @ApiModelProperty(value = "当前交易发起的小程序id")
-        private String appid;
-        @ApiModelProperty(value = "开发者侧的订单号")
-        private String cp_orderno;
-        @ApiModelProperty(value = "预下单时开发者传入字段")
-        private String cp_extra;
-        @ApiModelProperty(value = "way 字段中标识了支付渠道1-微信支付,2-支付宝支付,10-抖音支付")
-        private String way;
-        @ApiModelProperty(value = "支付渠道侧单号")
-        private String channel_no;
-
-
-        @ApiModelProperty(value = "支付渠道侧商家订单号")
-        private String payment_order_no;
-        @ApiModelProperty(value = "支付金额,单位为分")
-        private Integer total_amount;
-        @ApiModelProperty(value = "固定SUCCESS")
-        private String status;
-        @ApiModelProperty(value = "订单来源视频对应视频 id")
-        private String item_id;
-        @ApiModelProperty(value = "该笔交易卖家商户号")
-        private String seller_uid;
-        @ApiModelProperty(value = "支付时间,Unix 时间戳,10 位,整型数")
-        private Long paid_at;
-        @ApiModelProperty(value = "抖音侧订单号")
-        private String order_id;
-
-
-
-    }
+
 
 
 

+ 34 - 0
sdjk-service/src/main/java/com/miaxis/tt/dto/TtpaySource.java

@@ -0,0 +1,34 @@
+package com.miaxis.tt.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class TtpaySource {
+    @ApiModelProperty(value = "当前交易发起的小程序id")
+    private String appid;
+    @ApiModelProperty(value = "开发者侧的订单号")
+    private String cp_orderno;
+    @ApiModelProperty(value = "预下单时开发者传入字段")
+    private String cp_extra;
+    @ApiModelProperty(value = "way 字段中标识了支付渠道1-微信支付,2-支付宝支付,10-抖音支付")
+    private String way;
+    @ApiModelProperty(value = "支付渠道侧单号")
+    private String channel_no;
+
+
+    @ApiModelProperty(value = "支付渠道侧商家订单号")
+    private String payment_order_no;
+    @ApiModelProperty(value = "支付金额,单位为分")
+    private Integer total_amount;
+    @ApiModelProperty(value = "固定SUCCESS")
+    private String status;
+    @ApiModelProperty(value = "订单来源视频对应视频 id")
+    private String item_id;
+    @ApiModelProperty(value = "该笔交易卖家商户号")
+    private String seller_uid;
+    @ApiModelProperty(value = "支付时间,Unix 时间戳,10 位,整型数")
+    private Long paid_at;
+    @ApiModelProperty(value = "抖音侧订单号")
+    private String order_id;
+}