|
@@ -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)) {
|