Pārlūkot izejas kodu

达人列表添加字段

zhaoxian 2 gadi atpakaļ
vecāks
revīzija
07fcf61bbe

+ 3 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java

@@ -552,13 +552,15 @@ public class KuaishouItemCollectSamplesController extends BaseController {
     @GetMapping("/getDataAnalysis")
     @ApiOperation(value = "工作台——数据分析")
     public JSONObject getDataAnalysis(@ApiParam("创建人ID") @RequestParam(value = "userId", required = true) Long userId,
+                                      @ApiParam("开始日期") @RequestParam(value = "statDate", required = false) String startDate,
+                                      @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate,
                                       @ApiParam("类型,1-渠道;2-招商") @RequestParam(value = "type", required = true) String type) {
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(userId)) {
                 throw new Exception("请传入人员ID");
             }
-            return kuaishouItemCollectSamplesService.getDataAnalysis(userId, type);
+            return kuaishouItemCollectSamplesService.getDataAnalysis(userId, startDate, endDate, type);
         } catch (Exception e) {
             e.printStackTrace();
             returnJson.put("code", 500);

+ 31 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouPromoter.java

@@ -100,6 +100,34 @@ public class KuaishouPromoter {
      */
     @ApiModelProperty(name = "达人头像")
     private String promoterUrl;
+    /**
+     * 单视频销售额
+     */
+    @ApiModelProperty(name = "单视频销售额")
+    private String avgVideoSales;
+    /**
+     * 短视频销售额
+     */
+    @ApiModelProperty(name = "短视频销售额")
+    private String videoSales;
+    /**
+     * 睿选gmv
+     */
+    @ApiModelProperty(name = "睿选gmv")
+    private String monthDayGmv;
+
+    /**
+     * 30天出单量
+     */
+    @ApiModelProperty(name = "30天出单量")
+    private String monthDayOrderNum;
+
+    /**
+     * 出单金额
+     */
+    @ApiModelProperty(name = "出单金额")
+    private String validAmount;
+
 
     /**
      * 更新时间
@@ -116,12 +144,14 @@ public class KuaishouPromoter {
     public KuaishouPromoter() {
     }
 
-    public KuaishouPromoter(Long id, String promoterNickName, String province, String promoterUrl, String fansNumber, String totalSale) {
+    public KuaishouPromoter(Long id, String promoterNickName, String province, String promoterUrl, String fansNumber, String avgVideoSales, String videoSales, String totalSale) {
         this.id = id;
         this.promoterNickName = promoterNickName;
         this.province = province;
         this.promoterUrl = promoterUrl;
         this.fansNumber = fansNumber;
+        this.avgVideoSales = avgVideoSales;
+        this.videoSales = videoSales;
         this.totalSale = totalSale;
     }
 }

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

@@ -98,7 +98,7 @@ public interface IKuaishouItemCollectSamplesService {
 
     JSONObject getOrderData(Long userId, String startDate, String endDate, String type);
 
-    JSONObject getDataAnalysis(Long userId, String type);
+    JSONObject getDataAnalysis(Long userId, String startDate, String endDate, String type);
 
     List<JSONObject> queryProductList(Map<String, Object> map);
 }

+ 44 - 41
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -576,7 +576,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     @Override
-    public JSONObject getDataAnalysis(Long userId, String type) {
+    public JSONObject getDataAnalysis(Long userId, String startDate, String endDate, String type) {
         String roleKey = userService.getRoleKeyByUserId(String.valueOf(userId));
         List<Long> userList = null;
         if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey)) {
@@ -593,9 +593,9 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         returnJson.put("code", 0);
         returnJson.put("message", "调用成功");
         if ("1".equals(type)) {
-            returnJson.put("data", getDataAnalysisByChannel(userList));
+            returnJson.put("data", getDataAnalysisByChannel(userList, startDate, endDate));
         } else {
-            returnJson.put("data", getDataAnalysisByAttractInvestment(userList));
+            returnJson.put("data", getDataAnalysisByAttractInvestment(userList, startDate, endDate));
         }
         return returnJson;
     }
@@ -607,26 +607,27 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     // 渠道—数据分析
-    private JSONObject getDataAnalysisByChannel(List<Long> userList) {
+    private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate) {
         JSONObject data = new JSONObject();
         List<Long> promoterIds = null;
         if (Check.isNotNull(userList)) {
             promoterIds = promoterService.selectPromoterIdList(userList);
         }
-
-        //当天
-        String end = DateUtils.getNowDateStr();
-        //当前月份第一天
-        String start = DateUtils.getFirstDayByMonth();
+        if (Check.isNull(startDate) && Check.isNull(endDate)) {
+            //当前月份第一天
+            startDate = DateUtils.getFirstDayByMonth();
+            //当天
+            endDate = DateUtils.getNowDateStr();
+        }
         Map<String, Object> map = new HashMap<>();
-        map.put("start", start);
-        map.put("end", end);
+        map.put("start", startDate);
+        map.put("end", endDate);
         map.put("userList", userList);
         map.put("promoterIds", promoterIds);
-        map.put("startLong", DateUtils.getStartLongTime(start));
-        map.put("endLong", DateUtils.getEndLongTime(end));
+        map.put("startLong", DateUtils.getStartLongTime(startDate));
+        map.put("endLong", DateUtils.getEndLongTime(endDate));
         List<JSONObject> list = supplyChainService.getMonthOrderAmount(map);
-        List<String> allDates = DateUtils.getAllDatesOfTwoTimes(start, end);
+        List<String> allDates = DateUtils.getAllDatesOfTwoTimes(startDate, endDate);
         if (Check.isNull(list) || list.size() != allDates.size()) {
             String orderAmountStr = JSONObject.toJSONString(list);
             for (String date : allDates) {
@@ -639,16 +640,16 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
                     list.add(obj);
                 }
             }
-            //排序
-            Collections.sort(list, new Comparator<JSONObject>() {
-                @Override
-                public int compare(JSONObject o1, JSONObject o2) {
-                    return o1.getString("date").compareTo(o2.getString("date"));
-                }
-            });
         }
+        //排序
+        Collections.sort(list, new Comparator<JSONObject>() {
+            @Override
+            public int compare(JSONObject o1, JSONObject o2) {
+                return o1.getString("date").compareTo(o2.getString("date"));
+            }
+        });
         data.put("list", list);
-        map.put("toStartLong", DateUtils.getStartLongTime(end));
+        map.put("toStartLong", DateUtils.getStartLongTime(endDate));
         JSONObject amount = supplyChainService.getMonthOrderAmountTotal(map);
         if (Check.isNotNull(amount)) {
             data.put("orderAmount", amount.getInteger("orderAmount"));
@@ -656,7 +657,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
             data.put("orderAmountRate", amount.getString("orderAmountRate"));
             data.put("totalRegimentalSettleAmountRate", amount.getString("totalRegimentalSettleAmountRate"));
         }
-        JSONObject promoter = promoterService.getgetMonthPromoterTotal(userList, start, end);
+        JSONObject promoter = promoterService.getgetMonthPromoterTotal(userList, startDate, endDate);
         if (Check.isNotNull(promoter)) {
             data.put("promoterCount", promoter.getString("count"));
             data.put("promoterRate", promoter.getString("rate"));
@@ -665,24 +666,26 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     // 招商—数据分析
-    private JSONObject getDataAnalysisByAttractInvestment(List<Long> userList) {
+    private JSONObject getDataAnalysisByAttractInvestment(List<Long> userList, String startDate, String endDate) {
         JSONObject data = new JSONObject();
         //查询登录人(创建人)的所有商品
         List<Long> itemIds = kuaishouItemCollectSamplesMapper.getItemIdsByCreateId(userList);
         if (Check.isNotNull(itemIds)) {
-            //当天
-            String end = DateUtils.getNowDateStr();
-            //当前月份第一天
-            String start = DateUtils.getFirstDayByMonth();
+            if (Check.isNull(startDate) && Check.isNull(endDate)) {
+                //当前月份第一天
+                startDate = DateUtils.getFirstDayByMonth();
+                //当天
+                endDate = DateUtils.getNowDateStr();
+            }
             Map<String, Object> map = new HashMap<>();
-            map.put("start", start);
-            map.put("end", end);
+            map.put("start", startDate);
+            map.put("end", endDate);
             map.put("itemIds", itemIds);
-            map.put("startLong", DateUtils.getStartLongTime(start));
-            map.put("toStartLong", DateUtils.getStartLongTime(end));
-            map.put("endLong", DateUtils.getEndLongTime(end));
+            map.put("startLong", DateUtils.getStartLongTime(startDate));
+            map.put("toStartLong", DateUtils.getStartLongTime(endDate));
+            map.put("endLong", DateUtils.getEndLongTime(endDate));
             List<JSONObject> list = supplyChainService.getMonthOrderAmountByItems(map);
-            List<String> allDates = DateUtils.getAllDatesOfTwoTimes(start, end);
+            List<String> allDates = DateUtils.getAllDatesOfTwoTimes(startDate, endDate);
             if (Check.isNull(list) || list.size() != allDates.size()) {
                 String orderAmountStr = JSONObject.toJSONString(list);
                 for (String date : allDates) {
@@ -695,14 +698,14 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
                         list.add(obj);
                     }
                 }
-                //排序
-                Collections.sort(list, new Comparator<JSONObject>() {
-                    @Override
-                    public int compare(JSONObject o1, JSONObject o2) {
-                        return o1.getString("date").compareTo(o2.getString("date"));
-                    }
-                });
             }
+            //排序
+            Collections.sort(list, new Comparator<JSONObject>() {
+                @Override
+                public int compare(JSONObject o1, JSONObject o2) {
+                    return o1.getString("date").compareTo(o2.getString("date"));
+                }
+            });
             data.put("list", list);
             JSONObject amount = supplyChainService.getMonthOrderAmountTotalByItems(map);
             if (Check.isNotNull(amount)) {

+ 4 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -175,7 +175,10 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                         result.getString("province").concat("-").concat(result.getString("city")),
                         result.getString("promoterHeadImgUrl"),
                         result.getString("fanNum"),
-                        result.getString("totalSale"));
+                        result.getString("avgVideoSales"),
+                        result.getString("videoSales"),
+                        result.getString("totalSale")
+                );
                 kuaishouPromoterMapper.updateKuaishouPromoter(kuaishouPromoter);
             }
         } catch (Exception e) {

+ 35 - 5
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -21,7 +21,12 @@
         <result property="phone" column="phone"/>
         <result property="consignee" column="consignee"/>
         <result property="promoterAddress" column="promoter_address"/>
+        <result property="avgVideoSales" column="avg_video_sales"/>
+        <result property="videoSales" column="video_sales"/>
         <result property="updateTime" column="update_time"/>
+        <result property="monthDayGmv" column="30day_gmv"/>
+        <result property="monthDayOrderNum" column="30day_order_num"/>
+        <result property="validAmount" column="valid_amount"/>
     </resultMap>
 
     <sql id="selectKuaishouPromoterVo">
@@ -40,28 +45,53 @@
                promoter_address,
                total_sale,
                fans_number,
+               avg_video_sales,
+               video_sales,
                create_time,
                update_time
         from kuaishou_promoter
     </sql>
 
     <select id="selectKuaishouPromoterList" resultMap="KuaishouPromoterResult">
-        <include refid="selectKuaishouPromoterVo"/>
+        SELECT
+        t1.id,
+        t1.user_id,
+        t1.user_name,
+        t1.promoter_id,
+        t1.promoter_nick_name,
+        t1.`state`,
+        t1.province,
+        t1.commission_requirement,
+        t1.category_requirement,
+        t1.promoter_url,
+        t1.phone,
+        t1.consignee,
+        t1.promoter_address,
+        t1.total_sale,
+        t1.fans_number,
+        t1.avg_video_sales,
+        t1.video_sales,
+        t1.create_time,
+        t2.30day_gmv,
+        t2.30day_order_num
+        FROM
+        kuaishou_promoter t1
+        LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
         <where>
             <if test="userList != null and userList.size() > 0  ">
-                and user_id in
+                and t1.user_id in
                 <foreach collection="userList" item="userId" open="(" separator="," close=")">
                     #{userId}
                 </foreach>
             </if>
             <if test="promoterId != null ">
-                and promoter_id = #{promoterId}
+                and t1.promoter_id = #{promoterId}
             </if>
             <if test="promoterNickName != null  and promoterNickName != ''">
-                and promoter_nick_name like concat('%', #{promoterNickName}, '%')
+                and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
             </if>
         </where>
-        order by create_time desc
+        order by t1.create_time desc
     </select>
 
     <select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">