Selaa lähdekoodia

达人公海 更新销售额

zhaoxian 2 vuotta sitten
vanhempi
commit
09ab72cc99

+ 8 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -203,5 +203,12 @@ public class KuaishouPromoterController extends BaseController {
         return result;
     }
 
-
+    /**
+     * 获取达人公海视频销售
+     */
+    @GetMapping("/getGongHaiVideoSales")
+    @ApiOperation(value = "获取达人公海视频销售")
+    public Result getGongHaiVideoSales(@ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) Long promoterId) {
+        return kuaishouPromoterService.getGongHaiVideoSales(promoterId);
+    }
 }

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

@@ -71,4 +71,6 @@ public interface IKuaishouPromoterService {
     Result updatePromoterLabel(JSONObject result);
 
     void updateFollowUpRecords(JSONObject result);
+
+    Result getGongHaiVideoSales(Long promoterId);
 }

+ 18 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -123,6 +123,10 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     public List<JSONObject> selectKuaishouPromoterList2(Long promoterId, String promoterNickName, String status, String parameter, String orderBy) {
         if (Check.isNull(parameter)) {
             parameter = "promoterId";
+        } else if ("avgVideoSales".equals(parameter)) {
+            parameter = "SUBSTRING_INDEX(avgVideoSales,'-',-1)+0";
+        } else if ("videoSales".equals(parameter)) {
+            parameter = "SUBSTRING_INDEX(videoSales,'-',-1)+0";
         }
         if (Check.isNull(orderBy)) {
             orderBy = "desc";
@@ -160,7 +164,6 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 Long startTime = System.currentTimeMillis();
                 String content = HttpUtil.httpGetRequest(internalIpPath + "kuaiShou/promoter/getPromoterInfo?promoterId=" + promoter.getPromoterId());
                 result = JSONObject.parseObject(content);
-                log.info("获取达人详情数据,用时:{}s", (System.currentTimeMillis() - startTime) / 1000);
                 data.put("promoterInfo", promoter);
                 data.put("result", result);
                 //跟进记录
@@ -245,7 +248,6 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             Long startTime = System.currentTimeMillis();
             String content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
             JSONObject result = JSONObject.parseObject(content);
-            log.info("更新达人信息,用时:{}s\n返回结果:{}", (System.currentTimeMillis() - startTime) / 1000, result);
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
                 KuaishouPromoter kuaishouPromoter = new KuaishouPromoter(
                         id,
@@ -294,6 +296,20 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     @Override
+    public Result getGongHaiVideoSales(Long promoterId) {
+        Map<String, Object> param = new HashMap<>();
+        param.put("promoterId", promoterId);
+        String url = startIpPath + "promoterInfo/updatePromoter";
+        String content = HttpUtil.httpPostRequest(url, param, null);
+        if ("0".equals(content)) {
+            return Result.success();
+        } else {
+            log.error("查询达人公海销售额失败,达人ID:{}\nurl:{}", promoterId, url);
+            return Result.error("失败");
+        }
+    }
+
+    @Override
     public Result updatePromoterLabel(JSONObject result) {
         Long promoterId = result.getLong("promoterId");
         Long userId = result.getLong("userId");

+ 7 - 4
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -108,7 +108,9 @@
         IF(t0.fans is null,t2.fans_number,t0.fans) AS 'fansNumber',
         t1.30day_gmv AS 'monthDayGmv',
         t1.30day_order_num AS 'monthDayOrderNum',
-        t1.valid_amount AS 'validAmount'
+        t1.valid_amount AS 'validAmount',
+        IF(t0.videoSales is null,t2.video_sales,t0.videoSales) AS 'videoSales',
+        IF(t0.avgVideoSales is null,t2.avg_video_sales,t0.avgVideoSales) AS 'avgVideoSales'
         FROM
         promoter_info t0
         LEFT JOIN promoter_oerder_amount t1 ON t1.promoter_id = t0.promoter_id
@@ -118,11 +120,12 @@
         group_concat( user_name ) AS 'userName',
         fans_number, promoter_url,
         commission_requirement,
-        promoter_nick_name
+        promoter_nick_name,
+        avg_video_sales,
+        video_sales
         FROM kuaishou_promoter
         GROUP BY promoter_id
-        ) t2 ON t1.promoter_id =
-        t2.promoter_id
+        ) t2 ON t1.promoter_id = t2.promoter_id
         <where>
             <if test="promoterId != null ">
                 and t1.promoter_id = #{promoterId}