Prechádzať zdrojové kódy

头条团长 查询团长订单

zhaoxian 2 rokov pred
rodič
commit
8c11ee09b2

+ 12 - 5
ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java

@@ -51,11 +51,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     }
 
 
-
-
-
-
-
     public static String getNowDateStr() {
         SimpleDateFormat simp = new SimpleDateFormat("yyyy-MM-dd");
         return simp.format(new Date());
@@ -194,6 +189,18 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         return Long.valueOf(date.replaceAll("-", ""));
     }
 
+    /**
+     * 时间字符串转long类型
+     * 2022-05-01 00:00:00 ===>>>> 20220501
+     *
+     * @param date
+     * @return
+     */
+    public static Long strDateTimsToInt(String date) {
+        String[] datas = date.split(" ");
+        return Long.valueOf(datas[0].replaceAll("-", ""));
+    }
+
 
     /**
      * @param

+ 2 - 4
ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedanceController.java

@@ -1,6 +1,5 @@
 package com.ruixuan.bytedance.controller;
 
-import com.ruixuan.bytedance.service.IBytedanceColonelActivityService;
 import com.ruixuan.bytedance.service.IBytedanceService;
 import com.ruixuan.common.core.controller.BaseController;
 import io.swagger.annotations.Api;
@@ -62,10 +61,9 @@ public class BytedanceController extends BaseController {
     @ApiOperation(value = "新增团长订单")
     @GetMapping("/addBytedanceInstituteOrderColonel")
     public void addBytedanceInstituteOrderColonel(@ApiParam("startTime") @RequestParam(value = "开始时间", required = true) String startTime,
-                                                  @ApiParam("endTime") @RequestParam(value = "结束时间", required = true) String endTime,
-                                                  @ApiParam("cursor") @RequestParam(value = "索引", required = true) String cursor
+                                                  @ApiParam("endTime") @RequestParam(value = "结束时间", required = true) String endTime
     ) {
-        bytedanceService.addBytedanceInstituteOrderColonel(startTime, endTime, cursor);
+        bytedanceService.addBytedanceInstituteOrderColonel(startTime, endTime, null);
     }
 
 

+ 5 - 5
ruixuan-live/src/main/java/com/ruixuan/bytedance/entity/BytedanceOrderList.java

@@ -80,7 +80,7 @@ public class BytedanceOrderList implements Serializable {
      * 店铺ID
      */
     @Excel(name = "店铺ID")
-    private Integer shopId;
+    private Long shopId;
 
     /**
      * 商家名称
@@ -92,7 +92,7 @@ public class BytedanceOrderList implements Serializable {
      * 订单支付金额,单位分
      */
     @Excel(name = "订单支付金额,单位分")
-    private Integer totalPayAmount;
+    private Long totalPayAmount;
 
     /**
      * 订单状态(PAY_SUCC:支付完成 REFUND:退款 SETTLE:结算 CONFIRM: 确认收货)
@@ -122,19 +122,19 @@ public class BytedanceOrderList implements Serializable {
      * 预估参与结算金额,单位分
      */
     @Excel(name = "预估参与结算金额,单位分")
-    private Integer payGoodsAmount;
+    private Long payGoodsAmount;
 
     /**
      * 实际参与结算金额,单位分
      */
     @Excel(name = "实际参与结算金额,单位分")
-    private Integer settledGoodsAmount;
+    private Long settledGoodsAmount;
 
     /**
      * 商品数目
      */
     @Excel(name = "商品数目")
-    private Integer itemNum;
+    private Long itemNum;
 
     /**
      * 退款订单退款时间

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/bytedance/mapper/BytedanceMapper.java

@@ -17,5 +17,5 @@ public interface BytedanceMapper {
 
     BytedanceColonelActivityDetail getDetailByActivityId(@Param("activityId") Long activityId);
 
-    void replaceBatchOrders(List<BytedanceOrderList> list);
+    void replaceBatchOrders(@Param("list") List<BytedanceOrderList> list);
 }

+ 19 - 8
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/impl/BytedanceServiceImpl.java

@@ -179,7 +179,7 @@ public class BytedanceServiceImpl implements IBytedanceService {
     @Override
     public void addBytedanceInstituteOrderColonel(String startTime, String endTime, String cursor) {
         AccessToken accessToken = tokenService.getAccessToken(1L);
-
+        cursor = Check.isNull(cursor) ? "0" : cursor;
         BuyinInstituteOrderColonelRequest request = new BuyinInstituteOrderColonelRequest();
         BuyinInstituteOrderColonelParam param = request.getParam();
         param.setSize(200L);
@@ -200,13 +200,26 @@ public class BytedanceServiceImpl implements IBytedanceService {
             cursor = data.getCursor();
             if (Check.isNotNull(orders) && orders.size() > 0) {
                 List<BytedanceOrderList> list = new ArrayList<>();
-                BytedanceOrderList orderList = new BytedanceOrderList();
                 for (OrdersItem order : orders) {
+                    BytedanceOrderList orderList = new BytedanceOrderList();
                     BeanUtils.copyProperties(order, orderList);
-                    orderList.setUpdateTime(DateUtils.strDateToInt(order.getUpdateTime()));
-                    orderList.setPaySuccessTime(DateUtils.strDateToInt(order.getPaySuccessTime()));
-                    orderList.setRefundTime(DateUtils.strDateToInt(order.getRefundTime()));
-                    orderList.setSettleTime(DateUtils.strDateToInt(order.getSettleTime()));
+                    orderList.setOrderId(Long.valueOf(order.getOrderId()));
+                    if (Check.isNotNull(order.getUpdateTime())) {
+                        orderList.setUpdateTime(DateUtils.strDateTimsToInt(order.getUpdateTime()));
+                    }
+                    if (Check.isNotNull(order.getPaySuccessTime())) {
+                        orderList.setPaySuccessTime(DateUtils.strDateTimsToInt(order.getPaySuccessTime()));
+                    }
+                    if (Check.isNotNull(order.getRefundTime())) {
+                        orderList.setRefundTime(DateUtils.strDateTimsToInt(order.getRefundTime()));
+                    }
+                    if (Check.isNotNull(order.getSettleTime())) {
+                        orderList.setSettleTime(DateUtils.strDateTimsToInt(order.getSettleTime()));
+                    }
+                    if (Check.isNotNull(order.getIsTrusteeship())) {
+                        orderList.setIsTrusteeship(order.getIsTrusteeship() ? "1" : "0");
+                    }
+
                     ColonelOrderInfo colonelInfo = order.getColonelOrderInfo();
                     if (Check.isNotNull(colonelInfo)) {
                         orderList.setColonelCommissionRate(colonelInfo.getCommissionRate());
@@ -232,9 +245,7 @@ public class BytedanceServiceImpl implements IBytedanceService {
                     }
                     list.add(orderList);
                 }
-
                 bytedanceMapper.replaceBatchOrders(list);
-
                 int size = orders.size();
                 if (size >= 200) {
                     addBytedanceInstituteOrderColonel(startTime, endTime, cursor);

+ 1 - 2
ruixuan-live/src/main/resources/mapper/bytedance/BytedanceMapper.xml

@@ -123,7 +123,6 @@
     </select>
 
 
-
     <insert id="replaceBatchOrders">
         replace into bytedance_order_list(
         order_id,
@@ -175,7 +174,7 @@
         second_colonel_buyin_id
         )
         values
-        <foreach collection="activityList" item="cell" separator=",">
+        <foreach collection="list" item="cell" separator=",">
             (
             #{cell.orderId},
             #{cell.buyerAppId},