|
@@ -43,19 +43,27 @@ public class MonthlyCustomersServiceImpl implements MonthlyCustomersService {
|
|
// 按照实体类的日期进行升序排序
|
|
// 按照实体类的日期进行升序排序
|
|
monthlySalesGrowthEntities = monthlySalesGrowthEntities.stream().sorted(Comparator.comparing(MonthlySalesGrowthEntity::getYearAndMonth)).collect(Collectors.toList());
|
|
monthlySalesGrowthEntities = monthlySalesGrowthEntities.stream().sorted(Comparator.comparing(MonthlySalesGrowthEntity::getYearAndMonth)).collect(Collectors.toList());
|
|
for (String date : dateList) {
|
|
for (String date : dateList) {
|
|
|
|
+ boolean flag = false;
|
|
for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : monthlySalesGrowthEntities) {
|
|
for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : monthlySalesGrowthEntities) {
|
|
- if(!monthlySalesGrowthEntity.getYearAndMonth().equals(date)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
String totalSales = monthlySalesGrowthEntity.getTotalSales();
|
|
String totalSales = monthlySalesGrowthEntity.getTotalSales();
|
|
String taotalCustomers = monthlySalesGrowthEntity.getTotalCustomers();
|
|
String taotalCustomers = monthlySalesGrowthEntity.getTotalCustomers();
|
|
String totalNumber = monthlySalesGrowthEntity.getTotalNumber();
|
|
String totalNumber = monthlySalesGrowthEntity.getTotalNumber();
|
|
-
|
|
|
|
- totalNumberList.add(monthlySalesGrowthEntity.getYearAndMonth().equals(date) ? totalNumber : "0"); // 销售数量
|
|
|
|
- totalSalesList.add(monthlySalesGrowthEntity.getYearAndMonth().equals(date)?totalSales:"0"); // 销售额
|
|
|
|
- taotalCustomersList.add(monthlySalesGrowthEntity.getYearAndMonth().equals(date)?taotalCustomers:"0"); // 客单数
|
|
|
|
String avgBasketSale = new BigDecimal(totalSales).divide(new BigDecimal(totalNumber), 3, RoundingMode.HALF_UP).toString(); // 客单价
|
|
String avgBasketSale = new BigDecimal(totalSales).divide(new BigDecimal(totalNumber), 3, RoundingMode.HALF_UP).toString(); // 客单价
|
|
- avgBasketSaleList.add(monthlySalesGrowthEntity.getYearAndMonth().equals(date)?avgBasketSale:"0");
|
|
|
|
|
|
+ if (monthlySalesGrowthEntity.getYearAndMonth().equals(date)){
|
|
|
|
+ totalNumberList.add( totalNumber ); // 销售数量
|
|
|
|
+ totalSalesList.add(totalSales); // 销售额
|
|
|
|
+ taotalCustomersList.add(taotalCustomers); // 客单数
|
|
|
|
+ avgBasketSaleList.add(avgBasketSale);
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!flag){
|
|
|
|
+ totalNumberList.add( "0" ); // 销售数量
|
|
|
|
+ totalSalesList.add("0"); // 销售额
|
|
|
|
+ taotalCustomersList.add("0"); // 客单数
|
|
|
|
+ avgBasketSaleList.add("0");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -114,51 +122,66 @@ public class MonthlyCustomersServiceImpl implements MonthlyCustomersService {
|
|
// // 查询客单价
|
|
// // 查询客单价
|
|
List<String> avgBasketSaleList = new ArrayList<>();
|
|
List<String> avgBasketSaleList = new ArrayList<>();
|
|
|
|
|
|
- List<String> newDateList = new ArrayList<>();
|
|
|
|
// 按照实体类的日期进行升序排序
|
|
// 按照实体类的日期进行升序排序
|
|
monthlySalesGrowthEntities = monthlySalesGrowthEntities.stream().sorted(Comparator.comparing(MonthlySalesGrowthEntity::getYearAndWeek)).collect(Collectors.toList());
|
|
monthlySalesGrowthEntities = monthlySalesGrowthEntities.stream().sorted(Comparator.comparing(MonthlySalesGrowthEntity::getYearAndWeek)).collect(Collectors.toList());
|
|
for (String date : dateList) {
|
|
for (String date : dateList) {
|
|
|
|
+ boolean flag = false;
|
|
for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : monthlySalesGrowthEntities) {
|
|
for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : monthlySalesGrowthEntities) {
|
|
- if(!monthlySalesGrowthEntity.getYearAndWeek().equals(date)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
String totalSales = monthlySalesGrowthEntity.getTotalSales();
|
|
String totalSales = monthlySalesGrowthEntity.getTotalSales();
|
|
String taotalCustomers = monthlySalesGrowthEntity.getTotalCustomers();
|
|
String taotalCustomers = monthlySalesGrowthEntity.getTotalCustomers();
|
|
String totalNumber = monthlySalesGrowthEntity.getTotalNumber();
|
|
String totalNumber = monthlySalesGrowthEntity.getTotalNumber();
|
|
-
|
|
|
|
- totalNumberList.add(monthlySalesGrowthEntity.getYearAndWeek().equals(date) ? totalNumber : "0"); // 销售数量
|
|
|
|
- totalSalesList.add(monthlySalesGrowthEntity.getYearAndWeek().equals(date)?totalSales:"0"); // 销售额
|
|
|
|
- taotalCustomersList.add(monthlySalesGrowthEntity.getYearAndWeek().equals(date)?taotalCustomers:"0"); // 客单数
|
|
|
|
String avgBasketSale = new BigDecimal(totalSales).divide(new BigDecimal(totalNumber), 3, RoundingMode.HALF_UP).toString(); // 客单价
|
|
String avgBasketSale = new BigDecimal(totalSales).divide(new BigDecimal(totalNumber), 3, RoundingMode.HALF_UP).toString(); // 客单价
|
|
- avgBasketSaleList.add(monthlySalesGrowthEntity.getYearAndWeek().equals(date)?avgBasketSale:"0");
|
|
|
|
|
|
|
|
- newDateList.add(date);
|
|
|
|
|
|
+ if (monthlySalesGrowthEntity.getYearAndWeek().equals(date)) {
|
|
|
|
+ totalNumberList.add(totalNumber); // 销售数量
|
|
|
|
+ totalSalesList.add(totalSales); // 销售额
|
|
|
|
+ taotalCustomersList.add(taotalCustomers); // 客单数
|
|
|
|
+ avgBasketSaleList.add(avgBasketSale);
|
|
|
|
+ flag=true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!flag) {
|
|
|
|
+ totalNumberList.add("0"); // 销售数量
|
|
|
|
+ totalSalesList.add("0"); // 销售额
|
|
|
|
+ taotalCustomersList.add("0"); // 客单数
|
|
|
|
+ avgBasketSaleList.add("0");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- dateList = newDateList;
|
|
|
|
|
|
+
|
|
map.put("totalNumberList",totalNumberList);
|
|
map.put("totalNumberList",totalNumberList);
|
|
map.put("totalSalesList",totalSalesList);
|
|
map.put("totalSalesList",totalSalesList);
|
|
map.put("taotalCustomersList",taotalCustomersList);
|
|
map.put("taotalCustomersList",taotalCustomersList);
|
|
- map.put("avgBasketSaleList",avgBasketSaleList);
|
|
|
|
|
|
+ map.put("avgBasketSaleList", avgBasketSaleList);
|
|
map.put("dateList", dateList);
|
|
map.put("dateList", dateList);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@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);
|
|
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<>();
|
|
List<Integer> wechatFollowersList = new ArrayList<>();
|
|
|
|
|
|
// 按照实体类的日期进行升序排序
|
|
// 按照实体类的日期进行升序排序
|
|
wechatFollowersEntityList = wechatFollowersEntityList.stream().sorted(Comparator.comparing(WechatFollowersEntity::getYearAndMonth)).collect(Collectors.toList());
|
|
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;
|
|
return map;
|
|
}
|
|
}
|