Browse Source

自研系统下单并支付后,传递自研系统的订单编号,在芸信供应链那边下单

zhangwl 1 month ago
parent
commit
2c0141b526

+ 2 - 2
src/main/java/zs/payment/controller/YxSupplyChannelManualController.java

@@ -90,13 +90,13 @@ public class YxSupplyChannelManualController {
         JSONObject reqJson = JSONObject.parseObject(JSONObject.toJSONString(req));
         JSONObject reqJson = JSONObject.parseObject(JSONObject.toJSONString(req));
         String messageType = reqJson.getString("message_type");
         String messageType = reqJson.getString("message_type");
         OrderCallback callback = new OrderCallback();
         OrderCallback callback = new OrderCallback();
-        callback.setMessage_type(messageType);
+        callback.setMessageType(messageType);
         callback.setMessage(req);
         callback.setMessage(req);
         //当 message_type == 商品类的事件 时跳过保存,其他类型才入库
         //当 message_type == 商品类的事件 时跳过保存,其他类型才入库
         if (CallbackMessageType.GOODS_ALTER.equalsIgnoreCase(messageType) || CallbackMessageType.GOODS_UNDERCARRIAGE.equalsIgnoreCase(messageType)
         if (CallbackMessageType.GOODS_ALTER.equalsIgnoreCase(messageType) || CallbackMessageType.GOODS_UNDERCARRIAGE.equalsIgnoreCase(messageType)
         || CallbackMessageType.GOODS_ON_SALE.equalsIgnoreCase(messageType) ||  CallbackMessageType.GOODS_DELETE.equalsIgnoreCase(messageType)) {
         || CallbackMessageType.GOODS_ON_SALE.equalsIgnoreCase(messageType) ||  CallbackMessageType.GOODS_DELETE.equalsIgnoreCase(messageType)) {
             int productId = reqJson.getIntValue("product_id");
             int productId = reqJson.getIntValue("product_id");
-            callback.setProduct_id(productId);
+            callback.setProductId(productId);
             // 若product_id =0 ,则为无效数据,直接跳过
             // 若product_id =0 ,则为无效数据,直接跳过
             if (0== productId){
             if (0== productId){
                 return result;
                 return result;

+ 4 - 2
src/main/java/zs/payment/controller/YxSupplyOrderController.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import zs.payment.req.CloseOrderReq;
 import zs.payment.req.CloseOrderReq;
 import zs.payment.req.OrderCheckReq;
 import zs.payment.req.OrderCheckReq;
+import zs.payment.req.OrderPayReq;
 import zs.payment.req.OrderReq;
 import zs.payment.req.OrderReq;
 import zs.payment.resp.Result;
 import zs.payment.resp.Result;
 import zs.payment.service.supply.order.OrderSupplyService;
 import zs.payment.service.supply.order.OrderSupplyService;
@@ -42,8 +43,8 @@ public class YxSupplyOrderController {
 
 
 
 
     // 生成订单同时支付,如果已生成订单则是直接支付
     // 生成订单同时支付,如果已生成订单则是直接支付
-    @PostMapping("/order")
-    public Result order(@Valid @RequestBody OrderReq req) {
+    @PostMapping("/orderAndPay")
+    public Result order(@Valid @RequestBody OrderPayReq req) {
         return orderSupplyService.order(req);
         return orderSupplyService.order(req);
     }
     }
 
 
@@ -52,4 +53,5 @@ public class YxSupplyOrderController {
     public Result appCloseOrder(@Valid @RequestBody CloseOrderReq req){
     public Result appCloseOrder(@Valid @RequestBody CloseOrderReq req){
         return orderSupplyService.appCloseOrder(req);
         return orderSupplyService.appCloseOrder(req);
     }
     }
+
 }
 }

+ 12 - 0
src/main/java/zs/payment/dao/OrderFailRecordDao.java

@@ -0,0 +1,12 @@
+package zs.payment.dao;
+
+import org.springframework.stereotype.Repository;
+import zs.payment.entity.mongodb.supply.OrderFailRecord;
+
+@Repository
+public class OrderFailRecordDao extends NewMongoDBDao<OrderFailRecord> {
+    @Override
+    protected Class<OrderFailRecord> getEntityClass() {
+        return OrderFailRecord.class;
+    }
+}

+ 9 - 3
src/main/java/zs/payment/entity/mongodb/supply/OrderCallback.java

@@ -3,7 +3,10 @@ package zs.payment.entity.mongodb.supply;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.Setter;
+import org.bson.types.ObjectId;
+import org.springframework.data.annotation.Id;
 import org.springframework.data.mongodb.core.mapping.Document;
 import org.springframework.data.mongodb.core.mapping.Document;
+import org.springframework.data.mongodb.core.mapping.Field;
 
 
 
 
 @Document(collection = "order_call_back")
 @Document(collection = "order_call_back")
@@ -12,12 +15,15 @@ import org.springframework.data.mongodb.core.mapping.Document;
 @NoArgsConstructor
 @NoArgsConstructor
 public class OrderCallback {
 public class OrderCallback {
 
 
-    private String id;
+    @Id
+    private ObjectId id;
     // 消息类型
     // 消息类型
-    private String message_type;
+    @Field("message_type")
+    private String messageType;
 
 
     // 商品编号
     // 商品编号
-    private Integer product_id;
+    @Field("product_id")
+    private Integer productId;
 
 
     //原始消息
     //原始消息
     private Object message;
     private Object message;

+ 40 - 0
src/main/java/zs/payment/entity/mongodb/supply/OrderFailRecord.java

@@ -0,0 +1,40 @@
+package zs.payment.entity.mongodb.supply;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.bson.types.ObjectId;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.mapping.Document;
+import org.springframework.data.mongodb.core.mapping.Field;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@Document(collection = "order_fail_record")
+public class OrderFailRecord {
+
+    @Id
+    private ObjectId id;
+    // 第三方订单编号
+    @Field("order_sn")
+    private String orderSn;
+    // 失败原因
+    @Field("fail_msg")
+    private String failMsg;
+    // 请求参数
+    @Field("req_params")
+    private String reqParams;
+    // 重试次数
+    @Field("retry_count")
+    private int retryCount;
+    // 重试状态 0-待重试 1-重试成功 2-重试失败不再重试
+    @Field("retry_status")
+    private int retryStatus;
+    // 创建时间
+    @Field("create_time")
+    private long createTime;
+    // 最后重试时间
+    @Field("last_retry_time")
+    private long lastRetryTime;
+}

+ 87 - 42
src/main/java/zs/payment/entity/mongodb/supply/Orders.java

@@ -3,6 +3,9 @@ package zs.payment.entity.mongodb.supply;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import lombok.Setter;
+import org.bson.types.ObjectId;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.mapping.Field;
 import zs.payment.dto.*;
 import zs.payment.dto.*;
 
 
 import java.util.List;
 import java.util.List;
@@ -13,21 +16,29 @@ import java.util.List;
 public class Orders {
 public class Orders {
 
 
     // 订单id
     // 订单id
-    private Integer id;
+    @Id
+    private ObjectId id;
     // 创建时间
     // 创建时间
-    private Long created_at;
+    @Field("created_at")
+    private Long createdAt;
     // 修改时间
     // 修改时间
-    private Long updated_at;
+    @Field("updated_at")
+    private Long updatedAt;
     // 订单编号(主要的)
     // 订单编号(主要的)
-    private Long order_sn;
+    @Field("order_sn")
+    private Long orderSn;
     // 第三方订单号
     // 第三方订单号
-    private String third_order_sn;
+    @Field("third_order_sn")
+    private String thirdOrderSn;
     // 供应链订单号
     // 供应链订单号
-    private String gather_supply_sn;
+    @Field("gather_supply_sn")
+    private String gatherSupplySn;
     //
     //
-    private String gather_supply_msg;
+    @Field("gather_supply_msg")
+    private String gatherSupplyMsg;
     // 供应链类型id
     // 供应链类型id
-    private Integer gather_supply_type;
+    @Field("gather_supply_type")
+    private Integer gatherSupplyType;
     //
     //
     private String key;
     private String key;
     // 标题
     // 标题
@@ -37,79 +48,113 @@ public class Orders {
     // 订单总金额(分)
     // 订单总金额(分)
     private Integer amount;
     private Integer amount;
     // 退款金额(分)
     // 退款金额(分)
-    private Integer refund_amount;
+    @Field("refund_amount")
+    private Integer refundAmount;
     // 商品市场价(分)
     // 商品市场价(分)
-    private Integer item_amount;
+    @Field("item_amount")
+    private Integer itemAmount;
     // 供货金额(分)
     // 供货金额(分)
-    private Integer supply_amount;
+    @Field("supply_amount")
+    private Integer supplyAmount;
     // 成本金额(分)
     // 成本金额(分)
-    private Integer cost_amount;
+    @Field("cost_amount")
+    private Integer costAmount;
     // 运费(分)
     // 运费(分)
     private Integer freight;
     private Integer freight;
     // 服务费(分)
     // 服务费(分)
-    private Integer service_fee;
+    @Field("service_fee")
+    private Integer serviceFee;
     // 商品总数
     // 商品总数
-    private Integer goods_count;
+    @Field("goods_count")
+    private Integer goodsCount;
     // 发货状态 0待发货 1部分发货 2已发货
     // 发货状态 0待发货 1部分发货 2已发货
-    private Integer send_status;
+    @Field("send_status")
+    private Integer sendStatus;
     // 退款状态
     // 退款状态
-    private Integer refund_status;
+    @Field("refund_status")
+    private Integer refundStatus;
     // 买家留言
     // 买家留言
     private String remark;
     private String remark;
     // 商家备注
     // 商家备注
     private String note;
     private String note;
     // 技术服务费(分)
     // 技术服务费(分)
-    private Integer technical_services_fee;
+    @Field("technical_services_fee")
+    private Integer technicalServicesFee;
     // 支付时间
     // 支付时间
-    private String paid_at;
+    @Field("paid_at")
+    private String paidAt;
     // 发货时间
     // 发货时间
-    private String sent_at;
+    @Field("sent_at")
+    private String sentAt;
     // 完成时间
     // 完成时间
-    private String received_at;
+    @Field("received_at")
+    private String receivedAt;
     // 关闭时间
     // 关闭时间
-    private String closed_at;
+    @Field("closed_at")
+    private String closedAt;
     // 会员id
     // 会员id
-    private Integer user_id;
+    @Field("user_id")
+    private Integer userId;
     // 供应商id
     // 供应商id
-    private Integer supplier_id;
+    @Field("supplier_id")
+    private Integer supplierId;
     // 供应链id
     // 供应链id
-    private Integer gather_supply_id;
+    @Field("gather_supply_id")
+    private Integer gatherSupplyId;
     //
     //
-    private Integer application_id;
+    @Field("application_id")
+    private Integer applicationId;
     // 交易id
     // 交易id
-    private Integer trade_id;
+    @Field("trade_id")
+    private Integer tradeId;
     // 支付方式id
     // 支付方式id
-    private Integer pay_type_id;
+    @Field("pay_type_id")
+    private Integer payTypeId;
     //
     //
-    private Integer pay_info_id;
+    @Field("pay_info_id")
+    private Integer payInfoId;
     //
     //
-    private Integer shipping_method_id;
+    @Field("shipping_method_id")
+    private Integer shippingMethodId;
     // 收货地址id
     // 收货地址id
-    private Integer shipping_address_id;
+    @Field("shipping_address_id")
+    private Integer shippingAddressId;
     //
     //
-    private Integer send_type_id;
+    @Field("send_type_id")
+    private Integer sendTypeId;
     //
     //
-    private Integer comment_status;
+    @Field("comment_status")
+    private Integer commentStatus;
     // 是否可以退货(1是0否)
     // 是否可以退货(1是0否)
-    private Integer can_refund;
+    @Field("can_refund")
+    private Integer canRefund;
     //
     //
     private Integer lock;
     private Integer lock;
     //
     //
-    private Integer is_connection;
+    @Field("is_connection")
+    private Integer isConnection;
     //
     //
-    private Integer is_update_shipping_address;
+    @Field("is_update_shipping_address")
+    private Integer isUpdateShippingAddress;
     //
     //
-    private Integer is_cps;
+    @Field("is_cps")
+    private Integer isCps;
     // 订单支付明细
     // 订单支付明细
-    private AmountDetailDTO amount_detail;
+    @Field("amount_detail")
+    private AmountDetailDTO amountDetail;
     // 子订单信息
     // 子订单信息
-    private List<OrderItemDTO> order_items;
+    @Field("order_items")
+    private List<OrderItemDTO> orderItems;
     // 配送信息
     // 配送信息
-    private OrderExpressDTO order_express;
+    @Field("order_express")
+    private OrderExpressDTO orderExpress;
     // 收货信息
     // 收货信息
-    private ShippingAddressDTO shipping_address;
+    @Field("shipping_address")
+    private ShippingAddressDTO shippingAddress;
     // 发票信息
     // 发票信息
-    private OrderBillDTO order_bill;
+    @Field("order_bill")
+    private OrderBillDTO orderBill;
     // 技术服务费账单
     // 技术服务费账单
-    private TechnologyFeeBillDTO technology_fee_bill;
+    @Field("technology_fee_bill")
+    private TechnologyFeeBillDTO technologyFeeBill;
 }
 }

+ 3 - 0
src/main/java/zs/payment/entity/mysql/ImsEweiShopGoodsOption.java

@@ -1,6 +1,7 @@
 package zs.payment.entity.mysql;
 package zs.payment.entity.mysql;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Getter;
 import lombok.Getter;
@@ -88,6 +89,7 @@ public class ImsEweiShopGoodsOption {
     private String specs;
     private String specs;
 
 
     //SKU id ,存储芸信的商品规格id,下单与获取运费验证是否可售等使用这个
     //SKU id ,存储芸信的商品规格id,下单与获取运费验证是否可售等使用这个
+    @TableField("skuId")
     private String skuId;
     private String skuId;
 
 
     //商品编号
     //商品编号
@@ -136,6 +138,7 @@ public class ImsEweiShopGoodsOption {
     private String cycelbuy_periodic;
     private String cycelbuy_periodic;
 
 
     //云商城规格id
     //云商城规格id
+    @TableField("sku_id")
     private Integer sku_id;
     private Integer sku_id;
 
 
 }
 }

+ 19 - 0
src/main/java/zs/payment/mapper/primary/ImsEweiShopGoodsMapper.java

@@ -2,8 +2,27 @@ package zs.payment.mapper.primary;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import zs.payment.entity.mysql.ImsEweiShopGoods;
 import zs.payment.entity.mysql.ImsEweiShopGoods;
+import zs.payment.req.order.AddressInfo;
+import zs.payment.req.order.SpuItem;
+
+import java.util.List;
 
 
 @Mapper
 @Mapper
 public interface ImsEweiShopGoodsMapper extends BaseMapper<ImsEweiShopGoods> {
 public interface ImsEweiShopGoodsMapper extends BaseMapper<ImsEweiShopGoods> {
+
+    /**
+     * 根据订单编号查询下单的商品
+     * @param ordersn
+     * @return
+     */
+    List<SpuItem> findSpuByOrdersn(@Param("ordersn") String ordersn);
+
+    /**
+     * 根据订单编号查询下单地址
+     * @param ordersn
+     * @return
+     */
+    AddressInfo findAddressByOrdersn(@Param("ordersn")String ordersn);
 }
 }

+ 3 - 3
src/main/java/zs/payment/messages/KafkaConsumer.java

@@ -221,9 +221,9 @@ public class KafkaConsumer {
                     goods.setPcate(pcate);
                     goods.setPcate(pcate);
                     goods.setCcate(ccate);
                     goods.setCcate(ccate);
                     goods.setTcate(tcate);
                     goods.setTcate(tcate);
-//                    goods.setPcates(pcate.toString());
-//                    goods.setCcates(ccate.toString());
-                    goods.setTcates(tcate.toString());
+                    goods.setPcates("");
+                    goods.setCcates("");
+                    goods.setTcates("");
                     goods.setType(1);
                     goods.setType(1);
                     //启用商品规格
                     //启用商品规格
                     goods.setHasoption(1);
                     goods.setHasoption(1);

+ 3 - 2
src/main/java/zs/payment/req/order/AddressInfo.java

@@ -26,7 +26,8 @@ public class AddressInfo {
     @NotBlank(message = "区域不能为空")
     @NotBlank(message = "区域不能为空")
     private String area;
     private String area;
 
 
-    private String street;
+//    private String street;
 
 
+    //地址
     private String description;
     private String description;
-}
+}

+ 8 - 0
src/main/java/zs/payment/service/order/OrderFailRecordService.java

@@ -0,0 +1,8 @@
+package zs.payment.service.order;
+
+import zs.payment.entity.mongodb.supply.OrderFailRecord;
+
+public interface OrderFailRecordService {
+
+    void save(OrderFailRecord record);
+}

+ 19 - 0
src/main/java/zs/payment/service/order/impl/OrderFailRecordServiceImpl.java

@@ -0,0 +1,19 @@
+package zs.payment.service.order.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import zs.payment.dao.OrderFailRecordDao;
+import zs.payment.entity.mongodb.supply.OrderFailRecord;
+import zs.payment.service.order.OrderFailRecordService;
+
+@Service
+public class OrderFailRecordServiceImpl implements OrderFailRecordService {
+
+    @Autowired
+    private OrderFailRecordDao orderFailRecordDao;
+
+    @Override
+    public void save(OrderFailRecord record) {
+        orderFailRecordDao.save(record);
+    }
+}

+ 2 - 1
src/main/java/zs/payment/service/supply/order/OrderSupplyService.java

@@ -2,6 +2,7 @@ package zs.payment.service.supply.order;
 
 
 import zs.payment.req.CloseOrderReq;
 import zs.payment.req.CloseOrderReq;
 import zs.payment.req.OrderCheckReq;
 import zs.payment.req.OrderCheckReq;
+import zs.payment.req.OrderPayReq;
 import zs.payment.req.OrderReq;
 import zs.payment.req.OrderReq;
 import zs.payment.resp.Result;
 import zs.payment.resp.Result;
 
 
@@ -12,7 +13,7 @@ public interface OrderSupplyService {
      * @param req
      * @param req
      * @return
      * @return
      */
      */
-    Result order(OrderReq req);
+    Result order(OrderPayReq req);
 
 
     /**
     /**
      * 订单验证
      * 订单验证

+ 28 - 5
src/main/java/zs/payment/service/supply/order/impl/OrderSupplyServiceImpl.java

@@ -6,15 +6,20 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import zs.payment.entity.mongodb.supply.Orders;
 import zs.payment.entity.mongodb.supply.Orders;
+import zs.payment.entity.mongodb.supply.OrderFailRecord;
 import zs.payment.req.CloseOrderReq;
 import zs.payment.req.CloseOrderReq;
 import zs.payment.req.OrderCheckReq;
 import zs.payment.req.OrderCheckReq;
+import zs.payment.req.OrderPayReq;
 import zs.payment.req.OrderReq;
 import zs.payment.req.OrderReq;
+import zs.payment.req.order.AddressInfo;
 import zs.payment.resp.Result;
 import zs.payment.resp.Result;
 import zs.payment.service.order.OrdersService;
 import zs.payment.service.order.OrdersService;
+import zs.payment.service.order.OrderFailRecordService;
 import zs.payment.service.supply.order.OrderSupplyService;
 import zs.payment.service.supply.order.OrderSupplyService;
 import zs.payment.service.supply.token.SupplyTokenService;
 import zs.payment.service.supply.token.SupplyTokenService;
+import zs.payment.mapper.primary.ImsEweiShopGoodsMapper;
+import zs.payment.req.order.SpuItem;
 import zs.payment.utils.HttpUtil;
 import zs.payment.utils.HttpUtil;
-
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -33,23 +38,41 @@ public class OrderSupplyServiceImpl implements OrderSupplyService {
     @Autowired
     @Autowired
     private OrdersService ordersService;
     private OrdersService ordersService;
 
 
+    @Autowired
+    private ImsEweiShopGoodsMapper imsEweiShopGoodsMapper;
+
+    @Autowired
+    private OrderFailRecordService orderFailRecordService;
+
 
 
     @Override
     @Override
-    public Result order(OrderReq req) {
+    public Result order(OrderPayReq req) {
         Map<String, String> headers = supplyTokenService.buildAuthHeaders();
         Map<String, String> headers = supplyTokenService.buildAuthHeaders();
         if (headers == null) {
         if (headers == null) {
             return Result.fail("获取token失败");
             return Result.fail("获取token失败");
         }
         }
+        List<SpuItem> spuItems = imsEweiShopGoodsMapper.findSpuByOrdersn(req.getOrderSn());
+        AddressInfo address = imsEweiShopGoodsMapper.findAddressByOrdersn(req.getOrderSn());
+
 
 
         Map<String, Object> params = new HashMap<>();
         Map<String, Object> params = new HashMap<>();
-        params.put("spu", req.getSpu());
-        params.put("address", req.getAddress());
+        params.put("spu", spuItems);
+        params.put("address", address);
         params.put("order_sn", req.getOrderSn());
         params.put("order_sn", req.getOrderSn());
 
 
         String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/order", params, headers);
         String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/order", params, headers);
 
 
         JSONObject respJson = JSONObject.parseObject(resp);
         JSONObject respJson = JSONObject.parseObject(resp);
         if (respJson.getIntValue("code") != 0) {
         if (respJson.getIntValue("code") != 0) {
+            log.error("第三方编号{}订单下单并支付失败,报错信息如下{}",req.getOrderSn(),respJson.getString("msg"));
+            OrderFailRecord record = new OrderFailRecord();
+            record.setOrderSn(req.getOrderSn());
+            record.setFailMsg(respJson.getString("msg"));
+            record.setReqParams(JSONObject.toJSONString(params));
+            record.setRetryCount(0);
+            record.setRetryStatus(0);
+            record.setCreateTime(System.currentTimeMillis());
+            orderFailRecordService.save(record);
             return Result.fail(respJson.getString("msg"));
             return Result.fail(respJson.getString("msg"));
         }
         }
 
 
@@ -57,7 +80,7 @@ public class OrderSupplyServiceImpl implements OrderSupplyService {
             respJson.getJSONObject("data").getJSONArray("Orders").toJSONString(),
             respJson.getJSONObject("data").getJSONArray("Orders").toJSONString(),
             Orders.class
             Orders.class
         );
         );
-        log.info("下单并支付,存储订单");
+        log.info("第三方订单编号{},完成下单并支付",req.getOrderSn());
         ordersService.addBatchOrder(orders);
         ordersService.addBatchOrder(orders);
         return Result.success(orders);
         return Result.success(orders);
     }
     }

+ 25 - 0
src/main/resources/mapper/primary/ImsEweiShopGoodsMapper.xml

@@ -2,5 +2,30 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="zs.payment.mapper.primary.ImsEweiShopGoodsMapper">
 <mapper namespace="zs.payment.mapper.primary.ImsEweiShopGoodsMapper">
 
 
+    <select id="findSpuByOrdersn" resultType="zs.payment.req.order.SpuItem">
+
+        SELECT
+            opt.skuId as sku,
+            og.total  as number
+        FROM ims_ewei_shop_order o
+                 INNER JOIN ims_ewei_shop_order_goods og ON og.orderid = o.id
+                 LEFT JOIN ims_ewei_shop_goods g ON g.id = og.goodsid
+                 LEFT JOIN ims_ewei_shop_goods_option opt ON opt.id = og.optionid
+        WHERE o.ordersn = #{ordersn} and g.supply_id is not null
+    </select>
+
+
+    <select id="findAddressByOrdersn" resultType="zs.payment.req.order.AddressInfo">
+        SELECT
+            addr.realname as consignee,
+            addr.mobile as phone,
+            addr.province,
+            addr.city,
+            addr.area,
+            addr.address AS description
+        FROM ims_ewei_shop_order o
+                 LEFT JOIN ims_ewei_shop_member_address addr ON addr.id = o.addressid
+        WHERE o.ordersn = #{ordersn}
+    </select>
 
 
 </mapper>
 </mapper>