Browse Source

Merge remote-tracking branch 'origin/master'

yumeng 11 months ago
parent
commit
adabb3df42

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

@@ -785,7 +785,7 @@ public class KuaishouItemCollectSamplesController extends BaseController {
     public JSONObject getGmvHour(@ApiParam("创建人ID") @RequestParam(value = "userId", required = true) Long userId,
     public JSONObject getGmvHour(@ApiParam("创建人ID") @RequestParam(value = "userId", required = true) Long userId,
                                  @ApiParam("类型,1-渠道;2-招商") @RequestParam(value = "type", required = true) String type,
                                  @ApiParam("类型,1-渠道;2-招商") @RequestParam(value = "type", required = true) String type,
                                  @ApiParam("媒体,1-抖音;2-快手") @RequestParam(value = "mediaId", required = false) String mediaId,
                                  @ApiParam("媒体,1-抖音;2-快手") @RequestParam(value = "mediaId", required = false) String mediaId,
-                                 @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate,
+                                 @ApiParam("开始日期") @RequestParam(value = "statDate", required = false) String statDate,
                                  @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate
                                  @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate
     ) {
     ) {
         JSONObject returnJson = new JSONObject();
         JSONObject returnJson = new JSONObject();
@@ -795,13 +795,13 @@ public class KuaishouItemCollectSamplesController extends BaseController {
             }
             }
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");   // 当天
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");   // 当天
             String lastDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);  //  日期 -1
             String lastDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);  //  日期 -1
-            if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
-                List<String> allDatesOfTwoTimes = DateUtils.getAllDatesOfTwoTimes(startDate, endDate);
+            if (!Check.isNull(statDate) && !Check.isNull(endDate)) {
+                List<String> allDatesOfTwoTimes = DateUtils.getAllDatesOfTwoTimes(statDate, endDate);
                 if (allDatesOfTwoTimes.size() == 2) {
                 if (allDatesOfTwoTimes.size() == 2) {
                     nowDate = endDate;
                     nowDate = endDate;
-                    lastDate = startDate;
+                    lastDate = statDate;
                 } else if (allDatesOfTwoTimes.size() == 1) {
                 } else if (allDatesOfTwoTimes.size() == 1) {
-                    nowDate = startDate;
+                    nowDate = statDate;
                     lastDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);  //  日期 -1
                     lastDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);  //  日期 -1
                 }
                 }
             }
             }

+ 54 - 3
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -779,7 +779,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
     }
 
 
     @Override
     @Override
-    public JSONObject getKsGmvHour(Long userId, String type, String mediaId,String nowDate,String lastDate){
+    public JSONObject getKsGmvHour(Long userId, String type, String mediaId, String nowDate, String lastDate) {
         JSONObject returnJson = new JSONObject();
         JSONObject returnJson = new JSONObject();
         String roleKey = userService.getRoleKeyByUserId(userId);
         String roleKey = userService.getRoleKeyByUserId(userId);
         List<Long> userList = null;
         List<Long> userList = null;
@@ -800,6 +800,8 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
             today = supplyChainService.getKsCourtshipGmvHourByDate(userList, nowDate);
             today = supplyChainService.getKsCourtshipGmvHourByDate(userList, nowDate);
             yesterday = supplyChainService.getKsCourtshipGmvHourByDate(userList, lastDate);
             yesterday = supplyChainService.getKsCourtshipGmvHourByDate(userList, lastDate);
         }
         }
+        completionTime(today, nowDate);
+        completionTime(yesterday, lastDate);
         JSONObject result = new JSONObject();
         JSONObject result = new JSONObject();
         result.put("today", today);
         result.put("today", today);
         result.put("yesterday", yesterday);
         result.put("yesterday", yesterday);
@@ -810,8 +812,57 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         return returnJson;
         return returnJson;
     }
     }
 
 
+    /**
+     * 补全时辰
+     */
+    private void completionTime(List<JSONObject> dataList, String nowDate) {
+        String today = DateUtils.getNowDate("yyyy-MM-dd");   // 当天
+        Integer tohour = DateUtils.getNowHour(); // 当前小时
+
+        List<Integer> newDayList = new ArrayList<>();
+        for (JSONObject data : dataList) {
+            newDayList.add(data.getInteger("time"));
+        }
+        List<Integer> dayList = new ArrayList<>();
+        if (today.equals(nowDate)) {
+            for (int i = 0; i <= tohour; i++) {
+                dayList.add(i);
+            }
+        } else {
+            for (int i = 0; i <= 23; i++) {
+                dayList.add(i);
+            }
+        }
+        for (Integer hour : dayList) {
+            if (!newDayList.contains(hour)) {
+                JSONObject obj = new JSONObject();
+                obj.put("time", hour);
+                obj.put("charge", 0.00);
+                dataList.add(obj);
+            }
+        }
+        statHourListSort(dataList);
+    }
+
+    //排序
+    private static void statHourListSort(List<JSONObject> list) {
+        Collections.sort(list, new Comparator<JSONObject>() {
+            @Override
+            public int compare(JSONObject o1, JSONObject o2) {
+                try {
+                    Integer dt1 = o1.getInteger("time");
+                    Integer dt2 = o2.getInteger("time");
+                    return dt1.compareTo(dt2);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                return 0;
+            }
+        });
+    }
+
     @Override
     @Override
-    public JSONObject getBytedanceGmvHour(Long userId, String type, String mediaId,String nowDate,String lastDate) {
+    public JSONObject getBytedanceGmvHour(Long userId, String type, String mediaId, String nowDate, String lastDate) {
         JSONObject returnJson = new JSONObject();
         JSONObject returnJson = new JSONObject();
 
 
         Long dataNow = Long.valueOf(nowDate.replace("-", ""));
         Long dataNow = Long.valueOf(nowDate.replace("-", ""));
@@ -831,7 +882,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         List<JSONObject> yesterday = new ArrayList<>();
         List<JSONObject> yesterday = new ArrayList<>();
         if ("1".equals(type)) { // 渠道
         if ("1".equals(type)) { // 渠道
 
 
-            today = supplyChainService.getBytedanceChannelGmvHourByDate(userList,dataNow);
+            today = supplyChainService.getBytedanceChannelGmvHourByDate(userList, dataNow);
             yesterday = supplyChainService.getBytedanceChannelGmvHourByDate(userList, lastDateNow);
             yesterday = supplyChainService.getBytedanceChannelGmvHourByDate(userList, lastDateNow);
         } else if ("2".equals(type)) {
         } else if ("2".equals(type)) {
             today = supplyChainService.getBytedanceCourtshipGmvHourByDate(userList, dataNow);
             today = supplyChainService.getBytedanceCourtshipGmvHourByDate(userList, dataNow);

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

@@ -359,7 +359,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
             }
             JSONObject result = JSONObject.parseObject(content);
             JSONObject result = JSONObject.parseObject(content);
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
-                log.info("--------------------达人更新,【入参】:{},【返回结果】:{}", param, result.toJSONString());
+                log.info("--------------------RuiXuan达人更新\n【入参】:{}\n【返回结果】:{}", param, result.toJSONString());
                 String province = "";
                 String province = "";
                 if (Check.isNotNull(result.getString("province"))) {
                 if (Check.isNotNull(result.getString("province"))) {
                     province = result.getString("province").concat("-").concat(result.getString("city"));
                     province = result.getString("province").concat("-").concat(result.getString("city"));
@@ -423,6 +423,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
 
 
             JSONObject result = JSONObject.parseObject(content);
             JSONObject result = JSONObject.parseObject(content);
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
+                log.info("--------------------JY达人更新\n【入参】:{}\n【返回结果】:{}", param, result.toJSONString());
                 String province = "";
                 String province = "";
                 if (Check.isNotNull(result.getString("province"))) {
                 if (Check.isNotNull(result.getString("province"))) {
                     province = result.getString("province").concat("-").concat(result.getString("city"));
                     province = result.getString("province").concat("-").concat(result.getString("city"));
@@ -474,6 +475,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
 
 
             JSONObject result = JSONObject.parseObject(content);
             JSONObject result = JSONObject.parseObject(content);
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
+                log.info("--------------------Miaogousi达人更新\n【入参】:{}\n【返回结果】:{}", param, result.toJSONString());
                 String province = "";
                 String province = "";
                 if (Check.isNotNull(result.getString("province"))) {
                 if (Check.isNotNull(result.getString("province"))) {
                     province = result.getString("province").concat("-").concat(result.getString("city"));
                     province = result.getString("province").concat("-").concat(result.getString("city"));
@@ -526,6 +528,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
 
 
             JSONObject result = JSONObject.parseObject(content);
             JSONObject result = JSONObject.parseObject(content);
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
+                log.info("--------------------Rocket达人更新\n【入参】:{}\n【返回结果】:{}", param, result.toJSONString());
                 String province = "";
                 String province = "";
                 if (Check.isNotNull(result.getString("province"))) {
                 if (Check.isNotNull(result.getString("province"))) {
                     province = result.getString("province").concat("-").concat(result.getString("city"));
                     province = result.getString("province").concat("-").concat(result.getString("city"));
@@ -580,7 +583,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
             }
         }
         }
         kuaishouPromoterMapper.insertKuaishouPromoter3(promoter);
         kuaishouPromoterMapper.insertKuaishouPromoter3(promoter);
-        //    editPromoter3(promoter.getId(), promoter.getMediaId(), promoter.getPromoterId(), true);
+        editPromoter3(promoter.getId(), promoter.getMediaId(), promoter.getPromoterId(), true);
         result.put("code", 200);
         result.put("code", 200);
         result.put("msg", "success");
         result.put("msg", "success");
         return result;
         return result;