|
@@ -35,6 +35,7 @@ import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1357,11 +1358,11 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
Long exchangeSum = dataList.stream().filter(t -> t.getTransType().equals("1")).mapToLong(t -> t.getAmount()).sum();
|
|
Long exchangeSum = dataList.stream().filter(t -> t.getTransType().equals("1")).mapToLong(t -> t.getAmount()).sum();
|
|
|
face.setExchangeNum(exchangeSum);
|
|
face.setExchangeNum(exchangeSum);
|
|
|
|
|
|
|
|
- Long grantWmSum = dataList.stream().filter(t -> t.getTransType().equals("0") && t.getRemark().contains("文明积分")).mapToLong(t -> t.getAmount()).sum();
|
|
|
|
|
|
|
+ Long grantWmSum = dataList.stream().filter(t -> t.getTransType().equals("0") && t.getRemark() !=null && t.getRemark().contains("文明积分")).mapToLong(t -> t.getAmount()).sum();
|
|
|
face.setGrantNumWm(grantWmSum);
|
|
face.setGrantNumWm(grantWmSum);
|
|
|
- Long grantYlSum = dataList.stream().filter(t -> t.getTransType().equals("0") && t.getRemark().contains("银龄积分")).mapToLong(t -> t.getAmount()).sum();
|
|
|
|
|
|
|
+ Long grantYlSum = dataList.stream().filter(t -> t.getTransType().equals("0") && t.getRemark() !=null && t.getRemark().contains("银龄积分")).mapToLong(t -> t.getAmount()).sum();
|
|
|
face.setGrantNumYl(grantYlSum);
|
|
face.setGrantNumYl(grantYlSum);
|
|
|
- Long exchangeWmSum = dataList.stream().filter(t -> t.getTransType().equals("1") && t.getRemark().contains("文明积分")).mapToLong(t -> t.getAmount()).sum();
|
|
|
|
|
|
|
+ Long exchangeWmSum = dataList.stream().filter(t -> t.getTransType().equals("1") && t.getRemark() !=null && t.getRemark().contains("文明积分")).mapToLong(t -> t.getAmount()).sum();
|
|
|
face.setExchangeNumWm(exchangeWmSum);
|
|
face.setExchangeNumWm(exchangeWmSum);
|
|
|
List<MonthData> goodsList = Lists.newArrayList();
|
|
List<MonthData> goodsList = Lists.newArrayList();
|
|
|
Map<Integer, List<IntegralTrans>> maps = dataList.stream().filter(i -> i.getParentId() != null).collect(Collectors.groupingBy(IntegralTrans::getParentId));
|
|
Map<Integer, List<IntegralTrans>> maps = dataList.stream().filter(i -> i.getParentId() != null).collect(Collectors.groupingBy(IntegralTrans::getParentId));
|
|
@@ -1417,8 +1418,8 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
data.setUseValue(0L);
|
|
data.setUseValue(0L);
|
|
|
}else{
|
|
}else{
|
|
|
if(StringUtils.isNotEmpty(remark)){
|
|
if(StringUtils.isNotEmpty(remark)){
|
|
|
- data.setAddValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("0") && c.getRemark().contains(remark)).mapToLong(c->c.getAmount()).sum());
|
|
|
|
|
- data.setUseValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("1") && c.getRemark().contains(remark)).mapToLong(c->c.getAmount()).sum());
|
|
|
|
|
|
|
+ data.setAddValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("0") && c.getRemark() !=null && c.getRemark().contains(remark)).mapToLong(c->c.getAmount()).sum());
|
|
|
|
|
+ data.setUseValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("1") && c.getRemark() !=null && c.getRemark().contains(remark)).mapToLong(c->c.getAmount()).sum());
|
|
|
}else{
|
|
}else{
|
|
|
data.setAddValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("0")).mapToLong(c->c.getAmount()).sum());
|
|
data.setAddValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("0")).mapToLong(c->c.getAmount()).sum());
|
|
|
data.setUseValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("1")).mapToLong(c->c.getAmount()).sum());
|
|
data.setUseValue(transList.stream().filter(c->c.getBuildTime().after(calendar2.getTime()) && c.getBuildTime().before(com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(calendar2.getTime())) && c.getTransType().equals("1")).mapToLong(c->c.getAmount()).sum());
|
|
@@ -1671,14 +1672,28 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
private List<OrderStatisticsData> getOrderStatisticsDataList(List<Integer> ids,List<ListParams> categoryList){
|
|
private List<OrderStatisticsData> getOrderStatisticsDataList(List<Integer> ids,List<ListParams> categoryList){
|
|
|
List<OrderStatisticsData> returnList = Lists.newArrayList();
|
|
List<OrderStatisticsData> returnList = Lists.newArrayList();
|
|
|
List<OrderIntegrationData> list = Lists.newArrayList();
|
|
List<OrderIntegrationData> list = Lists.newArrayList();
|
|
|
|
|
+ Date beginMonth = com.poteviohealth.cgp.common.utils.DateUtils.getFirstDayOfMonth(new Date());
|
|
|
|
|
+ Date endMonth= com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(new Date());
|
|
|
|
|
+ Map<String, String> dateMap = com.poteviohealth.cgp.common.utils.DateUtils.getWeekDate();
|
|
|
|
|
+ Date monday ;
|
|
|
|
|
+ Date sunday ;
|
|
|
|
|
+ try {
|
|
|
|
|
+ monday = com.poteviohealth.cgp.common.utils.DateUtils.startOfDay(com.alibaba.excel.util.DateUtils.parseDate(dateMap.get("mondayDate")));
|
|
|
|
|
+ sunday = com.poteviohealth.cgp.common.utils.DateUtils.endOfDay(com.alibaba.excel.util.DateUtils.parseDate(dateMap.get("sundayDate")));
|
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
|
+ log.error("日期解析失败",e);
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ Date beginDay = com.poteviohealth.cgp.common.utils.DateUtils.startOfDay(new Date());
|
|
|
|
|
+ Date endDay = com.poteviohealth.cgp.common.utils.DateUtils.endOfDay(new Date());
|
|
|
for (Integer id : ids) {
|
|
for (Integer id : ids) {
|
|
|
//获取已完成的服务工单
|
|
//获取已完成的服务工单
|
|
|
- list.addAll(baseMapper.queryOrderIntegrationData(id,dbName));
|
|
|
|
|
|
|
+ list.addAll(baseMapper.queryOrderIntegrationData(id,dbName, beginDay, endDay, monday, sunday, beginMonth, endMonth));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- Map<Integer,List<ListParams>> categoryMap = categoryList.stream().collect(Collectors.groupingBy(ListParams::getId));
|
|
|
|
|
|
|
+ Map<Integer,ListParams> categoryMap = categoryList.stream().collect(Collectors.toMap(ListParams::getId, Function.identity()));
|
|
|
//按照市统计
|
|
//按照市统计
|
|
|
Map<Integer,List<OrderIntegrationData>> cityMaps = list.stream().collect(Collectors.groupingBy(OrderIntegrationData::getCityId));
|
|
Map<Integer,List<OrderIntegrationData>> cityMaps = list.stream().collect(Collectors.groupingBy(OrderIntegrationData::getCityId));
|
|
|
//按照区统计
|
|
//按照区统计
|
|
@@ -1729,47 +1744,44 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
|
|
|
|
|
OrderStatisticsData data = new OrderStatisticsData();
|
|
OrderStatisticsData data = new OrderStatisticsData();
|
|
|
data.setAreaId(areaId);
|
|
data.setAreaId(areaId);
|
|
|
- List<Long> visitNumList = orderList.stream().map(o->o.getCustomerId()).distinct().collect(Collectors.toList());
|
|
|
|
|
- data.setVisitNum(visitNumList.size());
|
|
|
|
|
- data.setOrderNum(orderList.size());
|
|
|
|
|
|
|
+ int visitNum = 0;
|
|
|
|
|
+ int orderNum = 0;
|
|
|
|
|
+ int satisfactionNum = 0;
|
|
|
|
|
+ int qualifiedNum = 0;
|
|
|
|
|
+ for (OrderIntegrationData item:orderList){
|
|
|
|
|
+ orderNum += item.getOrderId();
|
|
|
|
|
+ visitNum += item.getCustomerId();
|
|
|
|
|
+ satisfactionNum += item.getResult();
|
|
|
|
|
+ qualifiedNum += item.getQualified();
|
|
|
|
|
+ }
|
|
|
|
|
+ data.setVisitNum(visitNum);
|
|
|
|
|
+ data.setOrderNum(orderNum);
|
|
|
data.setVisitRate(new BigDecimal(100));
|
|
data.setVisitRate(new BigDecimal(100));
|
|
|
- if(data.getVisitNum()>0){
|
|
|
|
|
- List<Long> satisfactionList = orderList.stream().filter(v->v.getResult().equals(1)).map(o->o.getOrderId()).collect(Collectors.toList());
|
|
|
|
|
- data.setSatisfactionNum(satisfactionList.size());
|
|
|
|
|
- List<Long> qualifiedList = orderList.stream().filter(v->v.getQualified().equals(1)).map(o->o.getOrderId()).collect(Collectors.toList());
|
|
|
|
|
- data.setQualifiedNum(qualifiedList.size());
|
|
|
|
|
- }else{
|
|
|
|
|
- data.setSatisfactionNum(0);
|
|
|
|
|
- data.setQualifiedNum(0);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ data.setSatisfactionNum(satisfactionNum);
|
|
|
|
|
+ data.setQualifiedNum(qualifiedNum);
|
|
|
|
|
|
|
|
returnList.add(data);
|
|
returnList.add(data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
private void integrationData(List<OrderStatisticsData> returnList,List<OrderIntegrationData> orderList,
|
|
private void integrationData(List<OrderStatisticsData> returnList,List<OrderIntegrationData> orderList,
|
|
|
- Integer areaId,Map<Integer,List<ListParams>> categoryMap){
|
|
|
|
|
|
|
+ Integer areaId,Map<Integer,ListParams> categoryMap){
|
|
|
OrderStatisticsData data = new OrderStatisticsData();
|
|
OrderStatisticsData data = new OrderStatisticsData();
|
|
|
data.setAreaId(areaId);
|
|
data.setAreaId(areaId);
|
|
|
- data.setOrderNum(orderList.size());
|
|
|
|
|
- List<OrderIntegrationData> monthOrderList = orderList.stream()
|
|
|
|
|
- .filter(o-> DateUtil.isIn(o.getFinishTime(), com.poteviohealth.cgp.common.utils.DateUtils.getFirstDayOfMonth(new Date()), com.poteviohealth.cgp.common.utils.DateUtils.getLastDayOfMonth(new Date())))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- data.setOrderNumMonth(monthOrderList.size());
|
|
|
|
|
- Map<String, String> dateMap = com.poteviohealth.cgp.common.utils.DateUtils.getWeekDate();
|
|
|
|
|
- try {
|
|
|
|
|
- Date monday = com.poteviohealth.cgp.common.utils.DateUtils.startOfDay(com.alibaba.excel.util.DateUtils.parseDate(dateMap.get("mondayDate")));
|
|
|
|
|
- Date sunday = com.poteviohealth.cgp.common.utils.DateUtils.endOfDay(com.alibaba.excel.util.DateUtils.parseDate(dateMap.get("sundayDate")));
|
|
|
|
|
- List<OrderIntegrationData> weekOrderList = orderList.stream().filter(o->DateUtil.isIn(o.getFinishTime(),monday,sunday)).collect(Collectors.toList());
|
|
|
|
|
- data.setOrderNumWeek(weekOrderList.size());
|
|
|
|
|
- } catch (ParseException e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- List<OrderIntegrationData> dayOrderList = orderList.stream()
|
|
|
|
|
- .filter(o->DateUtil.isIn(o.getFinishTime(), com.poteviohealth.cgp.common.utils.DateUtils.startOfDay(new Date()), com.poteviohealth.cgp.common.utils.DateUtils.endOfDay(new Date())))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- data.setOrderNumDay(dayOrderList.size());
|
|
|
|
|
|
|
+ int orderNum = 0;
|
|
|
|
|
+ int dayNum = 0;
|
|
|
|
|
+ int weekNum = 0;
|
|
|
|
|
+ int monthNum = 0;
|
|
|
|
|
+ for (OrderIntegrationData item:orderList){
|
|
|
|
|
+ orderNum += item.getOrderId();
|
|
|
|
|
+ dayNum += item.getVisitStatus();
|
|
|
|
|
+ weekNum += item.getResult();
|
|
|
|
|
+ monthNum += item.getQualified();
|
|
|
|
|
+ }
|
|
|
|
|
+ data.setOrderNum(orderNum);
|
|
|
|
|
+ data.setOrderNumMonth(monthNum);
|
|
|
|
|
+ data.setOrderNumWeek(weekNum);
|
|
|
|
|
+ data.setOrderNumDay(dayNum);
|
|
|
|
|
|
|
|
//服务类型统计
|
|
//服务类型统计
|
|
|
List<OrderServiceTypeDTO> typeList = Lists.newArrayList();
|
|
List<OrderServiceTypeDTO> typeList = Lists.newArrayList();
|
|
@@ -1777,24 +1789,26 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|
|
|
|
|
|
|
Map<Integer,Integer> maps = Maps.newHashMap();
|
|
Map<Integer,Integer> maps = Maps.newHashMap();
|
|
|
for (Integer integer : orderCategoryMaps.keySet()) {
|
|
for (Integer integer : orderCategoryMaps.keySet()) {
|
|
|
- List<ListParams> list = categoryMap.get(integer);
|
|
|
|
|
- if(list != null && !list.isEmpty()){
|
|
|
|
|
- ListParams listParent = categoryMap.get(list.get(0).getKey()).get(0);
|
|
|
|
|
- if(maps.containsKey(listParent.getId())){
|
|
|
|
|
- maps.put(listParent.getId(),maps.get(listParent.getId())+orderCategoryMaps.get(integer).size());
|
|
|
|
|
|
|
+ ListParams list = categoryMap.get(integer);
|
|
|
|
|
+ if(list != null ){
|
|
|
|
|
+ ListParams listParent = categoryMap.get(list.getKey());
|
|
|
|
|
+ long num = orderCategoryMaps.get(integer).stream().mapToLong(OrderIntegrationData::getOrderId).sum();
|
|
|
|
|
+ Integer parentId = listParent.getId();
|
|
|
|
|
+ if(maps.containsKey(parentId)){
|
|
|
|
|
+ maps.put(parentId,maps.get(parentId)+ (int)num);
|
|
|
}else{
|
|
}else{
|
|
|
- maps.put(listParent.getId(),orderCategoryMaps.get(integer).size());
|
|
|
|
|
|
|
+ maps.put(parentId, (int)num);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
DecimalFormat df = new DecimalFormat("#0.00");
|
|
DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
if(!maps.isEmpty()){
|
|
if(!maps.isEmpty()){
|
|
|
- Integer sum = maps.values().stream().mapToInt(Integer::intValue).sum();
|
|
|
|
|
|
|
+ int sum = maps.values().stream().mapToInt(Integer::intValue).sum();
|
|
|
for (Integer integer : maps.keySet()) {
|
|
for (Integer integer : maps.keySet()) {
|
|
|
OrderServiceTypeDTO dto = new OrderServiceTypeDTO();
|
|
OrderServiceTypeDTO dto = new OrderServiceTypeDTO();
|
|
|
dto.setId(integer);
|
|
dto.setId(integer);
|
|
|
dto.setCount(maps.get(integer));
|
|
dto.setCount(maps.get(integer));
|
|
|
- dto.setName(categoryMap.get(integer).get(0).getName());
|
|
|
|
|
|
|
+ dto.setName(categoryMap.get(integer).getName());
|
|
|
if(sum == 0){
|
|
if(sum == 0){
|
|
|
dto.setRate("0");
|
|
dto.setRate("0");
|
|
|
}else{
|
|
}else{
|