Explorar o código

供应链调整

yumeng hai 1 ano
pai
achega
d584d7ab56

+ 14 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java

@@ -794,6 +794,20 @@ public class KuaishouItemCollectSamplesController extends BaseController {
         return returnJson;
     }
 
+
+    @GetMapping("/getBigDataAnalysis")
+    @ApiOperation(value = "工作台——数据分析")
+    public List<JSONObject> getBigDataAnalysis(
+            @ApiParam("媒体,1-抖音;2-快手 ") @RequestParam(value = "mediaId", required = false) String mediaId) {
+        JSONObject returnJson = new JSONObject();
+
+
+        return kuaishouItemCollectSamplesService.getBigDataAnalysis(mediaId);
+
+
+    }
+
+
     @GetMapping("/queryProductList")
     @ApiOperation(value = "查询商品列表")
     public TableDataInfo queryProductList(

+ 5 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemCollectSamplesMapper.java

@@ -108,7 +108,7 @@ public interface KuaishouItemCollectSamplesMapper {
 
     List<JSONObject> selectPromoterInfo(@Param("map") Map<String, String> map);
 
-    List<Long> getItemIdsByCreateId(@Param("userList") List<Long> userList,@Param("mediaId") String mediaId);
+    List<Long> getItemIdsByCreateId(@Param("userList") List<Long> userList, @Param("mediaId") String mediaId);
 
     List<JSONObject> queryProductList(Map<String, Object> map);
 
@@ -123,5 +123,9 @@ public interface KuaishouItemCollectSamplesMapper {
     void updateByIds(@Param("ids") List<Long> ids);
 
     String getStatusStringByCourierNumbe(String nu);
+
+    List<JSONObject> getBytedanceBigDataAnalysis(@Param("startDate") Long startDate, @Param("endDate") Long endDate);
+
+    List<JSONObject> getKuaishouBigDataAnalysis(@Param("startDate") String startDate, @Param("endDate") String endDate);
 }
 

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java

@@ -113,5 +113,7 @@ public interface IKuaishouItemCollectSamplesService {
     void checkAndUpdateStatus();
 
     String getStatusStringByCourierNumbe(String nu);
+
+    List<JSONObject> getBigDataAnalysis(String mediaId);
 }
 

+ 26 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -474,7 +474,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         data.put("orderAmount", order.getLong("orderAmount"));//订单金额
         data.put("regimentalPromotionAmount", order.getLong("regimentalPromotionAmount"));//预估服务费
         data.put("baseAmount", order.getLong("baseAmount"));//累计货贷基数
-        if("1".equals(mediaId)){
+        if ("1".equals(mediaId)) {
             data.put("secondEstimatedCommission", order.getLong("secondEstimatedCommission"));// 预估服务费支出
 
         }
@@ -726,6 +726,31 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         return kuaishouItemCollectSamplesMapper.getStatusStringByCourierNumbe(nu);
     }
 
+    @Override
+    public List<JSONObject> getBigDataAnalysis(String mediaId) {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", endDate, -30);
+
+        if ("1".equals(mediaId)) {
+            return kuaishouItemCollectSamplesMapper.getBytedanceBigDataAnalysis(Long.valueOf(startDate.replace("-", "")), Long.valueOf(endDate.replace("-", "")));
+        } else if ("2".equals(mediaId)) {
+            return kuaishouItemCollectSamplesMapper.getKuaishouBigDataAnalysis(startDate, endDate);
+
+        }
+
+        return null;
+    }
+
+    public static void main(String[] args) {
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", endDate, -30);
+        System.err.println(startDate);
+        System.err.println(endDate);
+
+    }
+
     // 渠道—数据分析
     private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate, String mediaId) {
         JSONObject data = new JSONObject();

+ 23 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml

@@ -745,6 +745,29 @@
     <select id="getStatusStringByCourierNumbe" resultType="java.lang.String" parameterType="java.lang.String">
         select  collect_sample_desc  from ruixuan.kuaishou_item_collect_samples where  courier_number = #{num} limit 1
     </select>
+    <select id="getBytedanceBigDataAnalysis" resultType="com.alibaba.fastjson.JSONObject">
+        select
+            date_format(pay_success_time,'%m%d') as 'date',
+            sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'orderCount',
+                round(sum(case when flow_point != 'REFUND' then total_pay_amount else 0 end) / 100,
+                    2)                                                as 'payAmount'
+        from bytedance_order_list
+        where pay_success_time &gt;= #{startDate}
+        and  pay_success_time &lt;= #{endDate}
+        group by pay_success_time
+        order by pay_success_time asc
+    </select>
+    <select id="getKuaishouBigDataAnalysis" resultType="com.alibaba.fastjson.JSONObject">
+        select
+                date_format(stat_date,'%m%d') as 'date',
+                sum(case when order_status != 80 then 1 else 0 end) as 'orderCount',
+                round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'payAmount'
+        from kuaishou_supply_chain
+        where stat_date &gt;= #{startDate}
+          and stat_date &lt;= #{endDate}
+        group by stat_date
+        order by stat_date asc
+    </select>
 
     <!--    出单量 >= 50 且 状态为5已签收待上传作业 的数据 改为 状态 7(审核通过)并备注-->
     <update id="updateByIds" parameterType="com.ruixuan.isc.entity.KuaishouItemCollectSamples">