|
@@ -778,6 +778,79 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
|
return returnJson;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public JSONObject getKsGmvHour(Long userId, String type, String mediaId) {
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd"); // 当天
|
|
|
+ String lastDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1); // 日期 -1
|
|
|
+ String roleKey = userService.getRoleKeyByUserId(userId);
|
|
|
+ List<Long> userList = null;
|
|
|
+ if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey) || "associationManager".equals(roleKey)) {
|
|
|
+ Long deptId = deptService.getDeptIdByUserId(userId);
|
|
|
+ userList = deptService.getDeptUserListByDeptId(deptId);
|
|
|
+ } else if ("supplyChainAdmin".equals(roleKey) || "admin".equals(roleKey)) {
|
|
|
+ userList = null;
|
|
|
+ } else {
|
|
|
+ userList = Arrays.asList(userId);
|
|
|
+ }
|
|
|
+ List<JSONObject> today = new ArrayList<>();
|
|
|
+ List<JSONObject> yesterday = new ArrayList<>();
|
|
|
+ if ("1".equals(type)) { // 渠道
|
|
|
+ today = supplyChainService.getKsChannelGmvHourByDate(userList, nowDate);
|
|
|
+ yesterday = supplyChainService.getKsChannelGmvHourByDate(userList, lastDate);
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
+ today = supplyChainService.getKsCourtshipGmvHourByDate(userList, nowDate);
|
|
|
+ yesterday = supplyChainService.getKsCourtshipGmvHourByDate(userList, lastDate);
|
|
|
+ }
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("today", today);
|
|
|
+ result.put("yesterday", yesterday);
|
|
|
+ returnJson.put("result", result);
|
|
|
+ returnJson.put("success", true);
|
|
|
+ returnJson.put("message", "操作成功");
|
|
|
+ returnJson.put("code", 200);
|
|
|
+ return returnJson;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public JSONObject getBytedanceGmvHour(Long userId, String type, String mediaId) {
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd"); // 当天
|
|
|
+ String lastDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1); // 日期 -1
|
|
|
+
|
|
|
+ Long dataNow = Long.valueOf(nowDate.replace("-", ""));
|
|
|
+ Long lastDateNow = Long.valueOf(lastDate.replace("-", ""));
|
|
|
+
|
|
|
+ String roleKey = userService.getRoleKeyByUserId(userId);
|
|
|
+ List<Long> userList = null;
|
|
|
+ if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey) || "associationManager".equals(roleKey)) {
|
|
|
+ Long deptId = deptService.getDeptIdByUserId(userId);
|
|
|
+ userList = deptService.getDeptUserListByDeptId(deptId);
|
|
|
+ } else if ("supplyChainAdmin".equals(roleKey) || "admin".equals(roleKey)) {
|
|
|
+ userList = null;
|
|
|
+ } else {
|
|
|
+ userList = Arrays.asList(userId);
|
|
|
+ }
|
|
|
+ List<JSONObject> today = new ArrayList<>();
|
|
|
+ List<JSONObject> yesterday = new ArrayList<>();
|
|
|
+ if ("1".equals(type)) { // 渠道
|
|
|
+
|
|
|
+ today = supplyChainService.getBytedanceChannelGmvHourByDate(userList,dataNow);
|
|
|
+ yesterday = supplyChainService.getBytedanceChannelGmvHourByDate(userList, lastDateNow);
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
+ today = supplyChainService.getBytedanceCourtshipGmvHourByDate(userList, dataNow);
|
|
|
+ yesterday = supplyChainService.getBytedanceCourtshipGmvHourByDate(userList, lastDateNow);
|
|
|
+ }
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("today", today);
|
|
|
+ result.put("yesterday", yesterday);
|
|
|
+ returnJson.put("result", result);
|
|
|
+ returnJson.put("success", true);
|
|
|
+ returnJson.put("message", "操作成功");
|
|
|
+ returnJson.put("code", 200);
|
|
|
+ return returnJson;
|
|
|
+ }
|
|
|
+
|
|
|
// 渠道—数据分析
|
|
|
private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate, String mediaId) {
|
|
|
JSONObject data = new JSONObject();
|