Browse Source

修改报错

yumeng 1 year ago
parent
commit
6da9c13059

+ 23 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedancePromoterOrderListController.java

@@ -1,6 +1,7 @@
 package com.ruixuan.bytedance.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonElement;
 import com.ruixuan.bytedance.service.IBytedancePromoterOrderListService;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.page.TableDataInfo;
@@ -22,6 +23,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -42,6 +44,27 @@ public class BytedancePromoterOrderListController extends BaseController {
     private IBytedancePromoterOrderListService bytedancePromoterOrderListService;
 
 
+    @GetMapping("/testOrder")
+    @ApiOperation(value = "达人订单管理-列表")
+    public void testOrder() {
+        BigDecimal bigDecimal = new BigDecimal(0);
+        List<JSONObject> proDate = bytedancePromoterOrderListService.getproDate();
+        for (int i = 0; i < proDate.size(); i++) {
+            JSONObject jsonObject = proDate.get(i);
+            String promoterId = jsonObject.getString("promoter_id");
+            Long start = jsonObject.getLong("start");
+            Long end = jsonObject.getLong("end");
+            BigDecimal bigDecimal1 = bytedancePromoterOrderListService.getCount(promoterId,start,end);
+            if(!Check.isNull(bigDecimal1)){
+                bigDecimal = bigDecimal.add(bigDecimal1);
+            }
+
+        }
+        System.err.println(bigDecimal);
+
+    }
+
+
     /**
      * 【达人订单管理】
      * -列表

+ 6 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/mapper/BytedancePromoterOrderListMapper.java

@@ -2,7 +2,9 @@ package com.ruixuan.bytedance.mapper;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.bytedance.entity.BytedancePromoterOrderList;
+import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -63,4 +65,8 @@ public interface BytedancePromoterOrderListMapper
     List<JSONObject> bdReportList(Map<String, Object> requestMap);
 
     List<JSONObject> bdReportListByBind(Map<String, Object> requestMap);
+
+    List<JSONObject> getproDate();
+
+    BigDecimal getCount(@Param("promoterId") String promoterId, @Param("start") Long start, @Param("end") Long end);
 }

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/IBytedancePromoterOrderListService.java

@@ -4,6 +4,7 @@ package com.ruixuan.bytedance.service;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.bytedance.entity.BytedancePromoterOrderList;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -61,4 +62,8 @@ public interface IBytedancePromoterOrderListService {
     List<JSONObject> bdReportList(Map<String, Object> requestMap);
 
     List<JSONObject> bdReportListByBind(Map<String, Object> requestMap);
+
+    List<JSONObject> getproDate();
+
+    BigDecimal getCount(String promoterId, Long start, Long end);
 }

+ 11 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/impl/BytedancePromoterOrderListServiceImpl.java

@@ -8,6 +8,7 @@ import com.ruixuan.common.utils.Check;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -132,4 +133,14 @@ public class BytedancePromoterOrderListServiceImpl implements IBytedancePromoter
     public List<JSONObject> bdReportListByBind(Map<String, Object> requestMap) {
         return bytedancePromoterOrderListMapper.bdReportListByBind(requestMap);
     }
+
+    @Override
+    public List<JSONObject> getproDate() {
+        return bytedancePromoterOrderListMapper.getproDate();
+    }
+
+    @Override
+    public BigDecimal getCount(String promoterId, Long start, Long end) {
+        return bytedancePromoterOrderListMapper.getCount(promoterId, start, end);
+    }
 }

+ 39 - 5
ruixuan-live/src/main/resources/mapper/bytedance/BytedancePromoterOrderListMapper.xml

@@ -834,12 +834,12 @@
         sum(CASE
         WHEN t2.flow_point != 'REFUND' and t2.colonel_type != 2
         THEN t2.second_estimated_commission
-        ELSE 0 END) / 100 AS 'secondEstimatedCommission',
+        ELSE 0 END) /
+        100 AS 'secondEstimatedCommission',
         round(sum(t2.colonel_real_commission) / 100, 2) as 'totalRegimentalSettleAmount'
-        from promoter_bind_channel_date t1
-        left join bytedance_promoter_order_list t2
-        on t1.promoter_id = t2.author_short_id and t1.stat_date = t2.pay_success_time
-        where 1 = 1
+        from (select user_id, user_name, promoter_id, stat_date
+        from promoter_bind_channel_date
+        where media_id = 1
         <if test="start != null and start != ''">
             and t1.stat_date &gt;= #{start}
         </if>
@@ -849,6 +849,18 @@
         <if test="collectSampleId != null and collectSampleId != ''">
             and t1.user_id = #{collectSampleId}
         </if>
+        ) t1
+        left join (select *
+        from bytedance_order_list
+        where
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        ) t2
+        on t1.promoter_id = t2.author_short_id and t1.stat_date = t2.pay_success_time
         group by t1.user_id) t
         left join (select user_id,
         count(distinct promoter_id) as 'promoterCount'
@@ -973,5 +985,27 @@
         where t.orderNum > 0
         order by t.orderNum desc
     </select>
+    <select id="getproDate" resultType="com.alibaba.fastjson.JSONObject">
+        select promoter_id as 'promoter_id', min(stat_date) as 'start', max(stat_date) as 'end'
+        from promoter_bind_channel_date
+        where user_name = '胡勤朴'
+          and stat_date >= 20240101
+          and stat_date &lt;= 20240131
+        group by promoter_id
+    </select>
+    <select id="getCount" resultType="java.math.BigDecimal">
+        select sum(CASE
+                       WHEN flow_point != 'REFUND' and colonel_type != 2
+                   THEN colonel_estimated_commission
+               WHEN flow_point != 'REFUND' and colonel_type = 2
+                   then second_estimated_commission
+               ELSE 0 END) * 0.9 / 100 AS
+                                                                                                                       'regimentalPromotionAmount'
+        from bytedance_order_list
+        where author_short_id = #{promoterId}
+          and pay_success_time >= #{start}
+          and pay_success_time &lt;= #{end}
+
+    </select>
 
 </mapper>