| | |
| | | Integer sPoint = 0; |
| | | Integer shopCommissionPoint = 0; |
| | | Integer subShopCommissionPoint = 0; |
| | | Shop shop = shopService.getById(sysUser.getObjectId()); |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | if (sysUser.getRoleType()==1){ |
| | | List<Shop> shopIds = shopService.lambdaQuery().eq(Shop::getDelFlag, 0).list(); |
| | | for (Shop shop : shopIds) { |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | } |
| | | return shopPointStatistics; |
| | | }else{ |
| | | Shop shop = shopService.getById(sysUser.getObjectId()); |
| | | sPoint += shop.getServerPoint(); |
| | | shopCommissionPoint += shop.getSharePoint(); |
| | | subShopCommissionPoint += shop.getLowerLevelSharePoint(); |
| | | ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); |
| | | shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); |
| | | shopPointStatistics.setShopPoint(sPoint); |
| | | shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); |
| | | shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); |
| | | |
| | | IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); |
| | | shopPointStatistics.setShopPointIPage(shopPointIPage); |
| | | |
| | | LocalDateTime startTime = shopPoint.getStartTime(); |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | | String format = "MM.dd"; |
| | | while (true){ |
| | | if(startTime.isAfter(endTime)){ |
| | | break; |
| | | } |
| | | date.add(startTime.format(DateTimeFormatter.ofPattern(format))); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | //返佣积分 |
| | | LocalDateTime finalStartTime = startTime; |
| | | List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); |
| | | map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | |
| | | //服务积分 |
| | | List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); |
| | | map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | //绑定下级门店返佣积分 |
| | | List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) |
| | | .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); |
| | | map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); |
| | | data.add(map); |
| | | startTime = startTime.plusDays(1); |
| | | } |
| | | Map<String, Object> brokenLine = new HashMap<>(); |
| | | brokenLine.put("date", date); |
| | | brokenLine.put("data", data); |
| | | shopPointStatistics.setBrokenLine(brokenLine); |
| | | } |
| | | return shopPointStatistics; |
| | | } |
| | | return shopPointStatistics; |
| | | } |
| | | } |