|
|
|
@@ -1,6 +1,5 @@ |
|
|
|
package com.iformall.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
@@ -58,7 +57,7 @@ public class WxChartServiceImpl implements WxChartDataService { |
|
|
|
@Autowired |
|
|
|
WxMerchantTradeDailyMapper wxMerchantTradeDailyMapper; |
|
|
|
@Autowired |
|
|
|
WxCarCmdLogMapper wxCarCmdLogMapper; |
|
|
|
WxCarCmdLogService wxCarCmdLogService; |
|
|
|
@Autowired |
|
|
|
WxCouponOrderMapper wxCouponOrderMapper; |
|
|
|
@Autowired |
|
|
|
@@ -852,22 +851,14 @@ public class WxChartServiceImpl implements WxChartDataService { |
|
|
|
String systemTime = DateUtils.getSystemTime("yyyy-MM-dd"); |
|
|
|
String yesterday = DateUtils.getTimeBefore(1, new Date()); |
|
|
|
String lastweek = DateUtils.getTimeBefore(7, new Date()); |
|
|
|
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); |
|
|
|
HashMap<String, Object> params = new HashMap<>(); |
|
|
|
params.put("tenantEntitys",tenantEntitys); |
|
|
|
params.put("tenantId", tenantEntity.getTenantId()); |
|
|
|
if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { |
|
|
|
params.put("parentTenantId", tenantEntity.getParentTenantId()); |
|
|
|
} |
|
|
|
params.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); |
|
|
|
params.put("startdate", systemTime + " 05:00:00"); |
|
|
|
params.put("enddate", DateUtils.getSystemTime("yyyy-MM-dd HH:mm:ss")); |
|
|
|
List<Map<String, Object>> todayCarlist = wxCarCmdLogMapper.queryTodayCar(params); |
|
|
|
Map<Object, Object> todaycollect = todayCarlist.stream().collect(Collectors.toMap(m -> { |
|
|
|
return m.get("create_time"); |
|
|
|
}, m -> { |
|
|
|
return m.get("carcount"); |
|
|
|
})); |
|
|
|
|
|
|
|
WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); |
|
|
|
wxCarCmdLog.updateTenantInfo(tenantEntity); |
|
|
|
wxCarCmdLog.setCmdTypes(EnumCarCmd.getCarIn()); |
|
|
|
wxCarCmdLog.setStartdate(DateUtils.stringToDate(systemTime + " 05:00:00","yyyy-MM-dd HH:mm:ss")); |
|
|
|
wxCarCmdLog.setEnddate(new Date()); |
|
|
|
Map<String, Integer> todaycollect = wxCarCmdLogService.getHourCountMap(wxCarCmdLog); |
|
|
|
|
|
|
|
List<String> hourList = new ArrayList<>(); |
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
instance.add(Calendar.HOUR_OF_DAY, 1); |
|
|
|
@@ -887,28 +878,19 @@ public class WxChartServiceImpl implements WxChartDataService { |
|
|
|
} |
|
|
|
datamap.put("currentimeindex", hourList); |
|
|
|
datamap.put("todaycardata", todayCarList); |
|
|
|
params.put("startdate", yesterday + " 05:00:00"); |
|
|
|
params.put("enddate", yesterday + " 22:59:59"); |
|
|
|
List<Map<String, Object>> yesterdayCarlist = wxCarCmdLogMapper.queryTodayCar(params); |
|
|
|
Map<Object, Object> yesterdaycollect = yesterdayCarlist.stream().collect(Collectors.toMap(m -> { |
|
|
|
return m.get("create_time"); |
|
|
|
}, m -> { |
|
|
|
return m.get("carcount"); |
|
|
|
})); |
|
|
|
|
|
|
|
wxCarCmdLog.setStartdate(DateUtils.stringToDate(yesterday + " 05:00:00","yyyy-MM-dd HH:mm:ss")); |
|
|
|
wxCarCmdLog.setEnddate(DateUtils.stringToDate(yesterday + " 22:59:59","yyyy-MM-dd HH:mm:ss")); |
|
|
|
Map<String, Integer> yesterdaycollect = wxCarCmdLogService.getHourCountMap(wxCarCmdLog); |
|
|
|
List<Object> yesterdayCarList = new ArrayList<>(); |
|
|
|
for (int i = startHour; i < endHour; i++) { |
|
|
|
yesterdayCarList.add(yesterdaycollect.get((Object) hourList.get(i-startHour))); |
|
|
|
} |
|
|
|
datamap.put("yesterdaycardata", yesterdayCarList); |
|
|
|
|
|
|
|
params.put("startdate", lastweek + " 05:00:00"); |
|
|
|
params.put("enddate", lastweek + " 22:59:59"); |
|
|
|
List<Map<String, Object>> lastdayCarlist = wxCarCmdLogMapper.queryTodayCar(params); |
|
|
|
Map<Object, Object> lastweekdaycollect = lastdayCarlist.stream().collect(Collectors.toMap(m -> { |
|
|
|
return m.get("create_time"); |
|
|
|
}, m -> { |
|
|
|
return m.get("carcount"); |
|
|
|
})); |
|
|
|
wxCarCmdLog.setStartdate(DateUtils.stringToDate(lastweek + " 05:00:00","yyyy-MM-dd HH:mm:ss")); |
|
|
|
wxCarCmdLog.setEnddate(DateUtils.stringToDate(lastweek + " 22:59:59","yyyy-MM-dd HH:mm:ss")); |
|
|
|
Map<String, Integer> lastweekdaycollect = wxCarCmdLogService.getHourCountMap(wxCarCmdLog); |
|
|
|
List<Object> lastweekdayCarList = new ArrayList<>(); |
|
|
|
for (int i = startHour; i < endHour; i++) { |
|
|
|
lastweekdayCarList.add(lastweekdaycollect.get((Object) hourList.get(i-startHour))); |
|
|
|
@@ -941,14 +923,14 @@ public class WxChartServiceImpl implements WxChartDataService { |
|
|
|
})); |
|
|
|
List<String> tjTimeList = DateUtils.getTjTimeList(startdate, enddate, "0"); |
|
|
|
List<String> timeList = new ArrayList<>(); |
|
|
|
List<Object> valList = new ArrayList<>(); |
|
|
|
List<Long> valList = new ArrayList<>(); |
|
|
|
for (String date : tjTimeList) { |
|
|
|
Object o = collect.get(date); |
|
|
|
String o = collect.get(date); |
|
|
|
timeList.add(date.substring(5).replace("-", "/")); |
|
|
|
if (o == null) { |
|
|
|
if (StringUtils.isBlank(o)) { |
|
|
|
valList.add(0L); |
|
|
|
} else { |
|
|
|
valList.add(o); |
|
|
|
valList.add(Long.parseLong(o)); |
|
|
|
} |
|
|
|
} |
|
|
|
Map map = new HashMap(); |
|
|
|
@@ -1007,7 +989,7 @@ public class WxChartServiceImpl implements WxChartDataService { |
|
|
|
weekParams.put("startdate", oneWeekStartdate + " 00:00:00"); |
|
|
|
weekParams.put("enddate", oneWeekEndDate + " 23:59:59"); |
|
|
|
weekParams.put("cmdTypes", EnumCarCmd.getCarPay()); |
|
|
|
datamap.put("oneWeekCarPayCount", wxCarCmdLogMapper.queryHistoryCount(weekParams)); |
|
|
|
datamap.put("oneWeekCarPayCount", wxCarCmdLogService.queryHistoryCount(weekParams)); |
|
|
|
return new ResultData(datamap); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1018,23 +1000,18 @@ public class WxChartServiceImpl implements WxChartDataService { |
|
|
|
*/ |
|
|
|
private ResultData getCarPayCountInWeek(TenantEntity tenantEntity) { |
|
|
|
HashMap<String, Object> datamap = new HashMap<>(); |
|
|
|
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); |
|
|
|
HashMap<String, Object> weekParams = new HashMap<>(); |
|
|
|
weekParams.put("tenantEntitys",tenantEntitys); |
|
|
|
weekParams.put("tenantId", tenantEntity.getTenantId()); |
|
|
|
if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { |
|
|
|
weekParams.put("parentTenantId", tenantEntity.getParentTenantId()); |
|
|
|
} |
|
|
|
String oneWeekStartdate = DateUtils.getTimeBefore(7, new Date()); |
|
|
|
String oneWeekEndDate = DateUtils.getTimeBefore(1, new Date()); |
|
|
|
weekParams.put("startdate", oneWeekStartdate + " 00:00:00"); |
|
|
|
weekParams.put("enddate", oneWeekEndDate + " 23:59:59"); |
|
|
|
weekParams.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode()); |
|
|
|
List<Map<String, Object>> weekCarPayHistoryList = wxCarCmdLogMapper.queryWeekCarPay(weekParams); |
|
|
|
Map<String, Object> weekCollect = weekCarPayHistoryList.stream().collect(Collectors.toMap(m -> { |
|
|
|
return (String) m.get("create_time"); |
|
|
|
WxChartDataEntity chartData = new WxChartDataEntity(); |
|
|
|
chartData.updateTenantInfo(tenantEntity); |
|
|
|
chartData.setType(EnumChartType.CAR_PAY_FEE.getCode()); |
|
|
|
chartData.setStartTime(DateUtils.stringToDate(oneWeekStartdate + " 00:00:00","yyyy-MM-dd HH:mm:ss")); |
|
|
|
chartData.setEndTime(DateUtils.stringToDate(oneWeekEndDate + " 23:59:59","yyyy-MM-dd HH:mm:ss")); |
|
|
|
List<WxChartDataEntity> list = wxChartDataMapper.findList(chartData); |
|
|
|
Map<String, String> weekCollect = list.stream().collect(Collectors.toMap(m -> { |
|
|
|
return new SimpleDateFormat("yyyy-MM-dd").format(m.getQuerytime()); |
|
|
|
}, m -> { |
|
|
|
return m.get("fee"); |
|
|
|
return m.getResult(); |
|
|
|
})); |
|
|
|
List<String> days = DateUtils.getTjTimeList(oneWeekStartdate, oneWeekEndDate, "0"); |
|
|
|
List<String> timeList = new ArrayList<>(); |
|
|
|
@@ -1042,7 +1019,7 @@ public class WxChartServiceImpl implements WxChartDataService { |
|
|
|
for (String date : days) { |
|
|
|
String dateStr = date.substring(5, date.length()).replace("-", "/"); |
|
|
|
timeList.add(dateStr); |
|
|
|
Object o = weekCollect.get(dateStr); |
|
|
|
String o = weekCollect.get(dateStr); |
|
|
|
if (o == null) { |
|
|
|
valList.add(0L); |
|
|
|
} else { |
|
|
|
|