|
@@ -132,40 +132,56 @@ public class MonthlyCustomersServiceImpl implements MonthlyCustomersService {
|
|
|
String totalNumber = monthlySalesGrowthEntity.getTotalNumber();
|
|
|
String avgBasketSale = new BigDecimal(totalSales).divide(new BigDecimal(totalNumber), 3, RoundingMode.HALF_UP).toString(); // 客单价
|
|
|
|
|
|
- if (monthlySalesGrowthEntity.getYearAndWeek().equals(date) ){
|
|
|
+ if (monthlySalesGrowthEntity.getYearAndWeek().equals(date)) {
|
|
|
totalNumberList.add(totalNumber); // 销售数量
|
|
|
totalSalesList.add(totalSales); // 销售额
|
|
|
- taotalCustomersList.add(monthlySalesGrowthEntity.getYearAndWeek().equals(date)?taotalCustomers:"0"); // 客单数
|
|
|
-
|
|
|
- avgBasketSaleList.add(monthlySalesGrowthEntity.getYearAndWeek().equals(date)?avgBasketSale:"0");
|
|
|
+ taotalCustomersList.add(taotalCustomers); // 客单数
|
|
|
+ avgBasketSaleList.add(avgBasketSale);
|
|
|
+ flag=true;
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ totalNumberList.add("0"); // 销售数量
|
|
|
+ totalSalesList.add("0"); // 销售额
|
|
|
+ taotalCustomersList.add("0"); // 客单数
|
|
|
+ avgBasketSaleList.add("0");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
map.put("totalNumberList",totalNumberList);
|
|
|
map.put("totalSalesList",totalSalesList);
|
|
|
map.put("taotalCustomersList",taotalCustomersList);
|
|
|
- map.put("avgBasketSaleList",avgBasketSaleList);
|
|
|
-
|
|
|
+ map.put("avgBasketSaleList", avgBasketSaleList);
|
|
|
+ map.put("dateList", dateList);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> queryMonthlyWechatFollowers(String startMonth, String endMonth, String merchSn) {
|
|
|
+ public Map<String, Object> queryMonthlyWechatFollowers(String startMonth, String endMonth, String merchSn,List<String> dateList) {
|
|
|
List<WechatFollowersEntity> wechatFollowersEntityList = wechatFollowersDao.queryMonthlyWechatFollowers(startMonth, endMonth, merchSn);
|
|
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
// 查询每月微信好友数
|
|
|
List<Integer> wechatFollowersList = new ArrayList<>();
|
|
|
|
|
|
// 按照实体类的日期进行升序排序
|
|
|
wechatFollowersEntityList = wechatFollowersEntityList.stream().sorted(Comparator.comparing(WechatFollowersEntity::getYearAndMonth)).collect(Collectors.toList());
|
|
|
- for (WechatFollowersEntity wechatFollowersEntity : wechatFollowersEntityList) {
|
|
|
- Integer wechatFollowers = wechatFollowersEntity.getWechatFollowers();
|
|
|
- wechatFollowersList.add(wechatFollowers);
|
|
|
+ for (String date : dateList) {
|
|
|
+ boolean flag = false;
|
|
|
+ for (WechatFollowersEntity wechatFollowersEntity : wechatFollowersEntityList) {
|
|
|
+ Integer wechatFollowers = wechatFollowersEntity.getWechatFollowers();
|
|
|
+ if (wechatFollowersEntity.getYearAndMonth().equals(date)){
|
|
|
+ wechatFollowersList.add(wechatFollowers);
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag){
|
|
|
+ wechatFollowersList.add(0);
|
|
|
+ }
|
|
|
}
|
|
|
- map.put("wechatFollowersList",wechatFollowersList);
|
|
|
+ map.put("wechatFollowersList", wechatFollowersList);
|
|
|
|
|
|
return map;
|
|
|
}
|