From 3afbc3856b2426426bdf8a0a7bbac92e37fc3631 Mon Sep 17 00:00:00 2001 From: llw <18235445130@163.com> Date: Fri, 18 Aug 2017 10:46:46 +0800 Subject: [PATCH] 提交 --- src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java | 109 ++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------- src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java | 299 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------ src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java | 43 ++++++------------------------------------- 3 files changed, 179 insertions(+), 272 deletions(-) diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java index 8dee59f..7881b3e 100644 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java +++ b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java @@ -222,7 +222,7 @@ public class BerthsStatisticController extends BizController { logger.info("根据停车场编号获取该停车场车位空置率折线图"); Calendar beginTime = Calendar.getInstance(); beginTime.setTime(request.getBeginTime()); - int year = beginTime.get(Calendar.YEAR); +// int year = beginTime.get(Calendar.YEAR); Calendar endTime = Calendar.getInstance(); endTime.setTime(request.getEndTime()); @@ -237,44 +237,38 @@ public class BerthsStatisticController extends BizController { // 1个小时为一个时间戳 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - - int beginMonth = beginTime.get(Calendar.MONTH) + 1; - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); for (int j = 0; j <= totaltimestampCount; j++) { String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); - } - - dateType = "yyyy-MM-dd HH"; - LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); - return new BizResultVO().setData(freeBerthRatios); - } else if (dayDifference <= 3L) { - // 1小时为一个时间戳 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - for (int i = 0; i <= dayDifference.intValue(); i++) { - Calendar tempDate = Calendar.getInstance(); - tempDate.setTime(request.getBeginTime()); - tempDate.add(Calendar.DAY_OF_MONTH, i); - int beginMonth = tempDate.get(Calendar.MONTH) + 1; - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); - for (int j = 0; j <= totaltimestampCount; j++) { - String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); - } + xAxisData.add(hour+":00"); } - dateType = "yyyy-MM-dd HH"; + dateType = "HH:mm"; LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); return new BizResultVO().setData(freeBerthRatios); - } else { + } +// else if (dayDifference <= 3L) { +// // 1小时为一个时间戳 +// request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); +// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); +// String day = ""; +// String month = ""; +// for (int i = 0; i <= dayDifference.intValue(); i++) { +// Calendar tempDate = Calendar.getInstance(); +// tempDate.setTime(request.getBeginTime()); +// tempDate.add(Calendar.DAY_OF_MONTH, i); +// int beginMonth = tempDate.get(Calendar.MONTH) + 1; +// int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); +// month = String.format("%02d", (beginMonth)); +// day = String.format("%02d", (beginDay)); +// for (int j = 0; j <= totaltimestampCount; j++) { +// String hour = String.format("%02d", (j)); +// xAxisData.add(year + "-" + month + "-" + day + " " + hour); +// } +// } +// dateType = "yyyy-MM-dd HH"; +// LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); +// return new BizResultVO().setData(freeBerthRatios); +// } + else { // 1天为一个时间戳 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); for (int i = 0; i <= dayDifference.intValue(); i++) { @@ -285,10 +279,9 @@ public class BerthsStatisticController extends BizController { int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); String month = String.format("%02d", (beginMonth)); String day = String.format("%02d", (beginDay)); - xAxisData.add(year + "-" + month + "-" + day); - + xAxisData.add(month + "-" + day); } - dateType = "yyyy-MM-dd"; + dateType = "MM-dd"; LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); return new BizResultVO().setData(freeBerthRatios); @@ -312,7 +305,7 @@ public class BerthsStatisticController extends BizController { throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); } Calendar beginTime = Calendar.getInstance(); - int year = beginTime.get(Calendar.YEAR); +// int year = beginTime.get(Calendar.YEAR); beginTime.setTime(request.getBeginTime()); Calendar endTime = Calendar.getInstance(); @@ -328,44 +321,14 @@ public class BerthsStatisticController extends BizController { // 1个小时为一个时间戳 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - - int beginMonth = beginTime.get(Calendar.MONTH) + 1; - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); for (int j = 0; j <= totaltimestampCount; j++) { String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); + xAxisData.add(hour+":00"); } - - dateType = "yyyy-MM-dd HH"; + dateType = "HH:mm"; LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); return new BizResultVO().setData(freeBerthRatios); - } else if (dayDifference <= 3L) { - // 1小时为一个时间戳 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - for (int i = 0; i <= dayDifference.intValue(); i++) { - Calendar tempDate = Calendar.getInstance(); - tempDate.setTime(request.getBeginTime()); - tempDate.add(Calendar.DAY_OF_MONTH, i); - int beginMonth = tempDate.get(Calendar.MONTH) + 1; - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); - for (int j = 0; j <= totaltimestampCount; j++) { - String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); - } - } - dateType = "yyyy-MM-dd HH"; - LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); - return new BizResultVO().setData(freeBerthRatios); - } else { + }else { // 1天为一个时间戳 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); for (int i = 0; i <= dayDifference.intValue(); i++) { @@ -376,10 +339,10 @@ public class BerthsStatisticController extends BizController { int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); String month = String.format("%02d", (beginMonth)); String day = String.format("%02d", (beginDay)); - xAxisData.add(year + "-" + month + "-" + day); + xAxisData.add(month + "-" + day); } - dateType = "yyyy-MM-dd"; + dateType = "MM-dd"; LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); return new BizResultVO().setData(freeBerthRatios); } diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java index 4b3e8c6..3b25ce4 100644 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java +++ b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java @@ -58,17 +58,15 @@ import io.swagger.annotations.ApiOperation; /** * 企业云平台->数据统计->进出场上报。 * - * Copyright: Copyright (c) 2017 zteits + * Copyright: Copyright (c) 2017 zteits * * @ClassName: InOutParkStatisticController.java - * @Description: + * @Description: * @version: v1.0.0 * @author: langlw - * @date: 2017年7月26日 上午11:30:04 - * Modification History: - * Date Author Version Description - *---------------------------------------------------------* - * 2017年7月26日 langlw v1.0.0 创建 + * @date: 2017年7月26日 上午11:30:04 Modification History: Date Author Version + * Description ---------------------------------------------------------* + * 2017年7月26日 langlw v1.0.0 创建 */ @Api(value = "企业云平台->数据统计->进出场上报数据统计", description = "企业云平台->数据统计->进出场上报数据统计") @Controller @@ -82,31 +80,29 @@ public class InOutParkStatisticController extends BizController { private ParkingLotUseStatisticService parkingLotStatisticService; @Autowired private InOutParkStatisticService inOutParkStatisticService; - - + @ApiOperation("数据统计进出场上报") @PostMapping("queryInOutParkForList") @ResponseBody - public BizResultVO> queryInOutParkForList( - @RequestBody InOutParkRequest request) throws Exception { + public BizResultVO> queryInOutParkForList(@RequestBody InOutParkRequest request) + throws Exception { logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); - if (null == request.getBeginTime() || null==request.getEndTime()) { - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); - } + if (null == request.getBeginTime() || null == request.getEndTime()) { + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); + } BizResult> bizResult = inOutParkStatisticService.queryInOutParkForList(request); return returnJqGridData(bizResult, InOutParkDTO.class); } - + @ApiOperation("数据统计进出场上报折线图") @PostMapping("queryInOutParkForChart") @ResponseBody - public BizResultVO queryInOutParkForChart( - @RequestBody InOutParkRequest request) throws Exception { - if (null == request.getBeginTime() || null==request.getEndTime() || null == request.getPlNos()) { - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间、停车场编号集合"); - } - - ParkingLotUseStatisticForPageRequest UseStatisticRequest=new ParkingLotUseStatisticForPageRequest(); + public BizResultVO queryInOutParkForChart(@RequestBody InOutParkRequest request) throws Exception { + if (null == request.getBeginTime() || null == request.getEndTime() || null == request.getPlNos()) { + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间、停车场编号集合"); + } + + ParkingLotUseStatisticForPageRequest UseStatisticRequest = new ParkingLotUseStatisticForPageRequest(); UseStatisticRequest.setPlNos(request.getPlNos()); UseStatisticRequest.setBeginTime(request.getBeginTime()); UseStatisticRequest.setEndTime(request.getEndTime()); @@ -115,7 +111,7 @@ public class InOutParkStatisticController extends BizController { Calendar beginTime = Calendar.getInstance(); beginTime.setTime(request.getBeginTime()); - int year = beginTime.get(Calendar.YEAR); + // int year = beginTime.get(Calendar.YEAR); Calendar endTime = Calendar.getInstance(); endTime.setTime(request.getEndTime()); @@ -123,117 +119,99 @@ public class InOutParkStatisticController extends BizController { Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), new Timestamp(request.getBeginTime().getTime())); List xAxisData = Lists.newArrayList(); - String dateType=""; - - if (dayDifference == 0L) { - //同一天 - // 20分钟为一个时间戳 - UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - - int beginMonth = beginTime.get(Calendar.MONTH) + 1; - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); - for (int j = 0; j <= totaltimestampCount; j++) { - String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); - } - - dateType = "yyyy-MM-dd HH"; - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); - return new BizResultVO().setData(vehicleFlows); + String dateType = ""; - } else if (dayDifference <= 3L) { - // 1小时为一个时间戳 + if (dayDifference == 0L) { + // 同一天 + // 1个小时为一个时间戳 UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - for (int i = 0; i <=dayDifference.intValue(); i++) { - Calendar tempDate = Calendar.getInstance(); - tempDate .setTime(request.getBeginTime()); - tempDate.add(Calendar.DAY_OF_MONTH, i); - int beginMonth = tempDate.get(Calendar.MONTH) + 1; - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); - for (int j = 0; j < 24; j++) { - String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); - } - } - dateType = "yyyy-MM-dd HH"; - - -// -// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); -// String day = ""; -// String month = ""; -// for (int i = 0; i < dayDifference.intValue(); i++) { -// int beginMonth = beginTime.get(Calendar.MONTH) + 1; -// int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); -// month = String.format("%02d", (beginMonth)); -// day = String.format("%02d", (beginDay)); -// int endDay = endTime.get(Calendar.DAY_OF_MONTH); -// if(beginDay != endDay){ -// totaltimestampCount = 24; -// } -// for (int j = 0; j < totaltimestampCount; j++) { -// String hour = String.format("%02d", (j)); -// xAxisData.add(month + "-" + day + " " + hour); -// } -// beginTime.add(Calendar.DAY_OF_MONTH, 1); -// } -// dateType="MM-dd HH"; - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); + int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); + for (int j = 0; j <= totaltimestampCount; j++) { + String hour = String.format("%02d", (j)); + xAxisData.add(hour + ":00"); + } + dateType = "HH:mm"; + LineChartVO vehicleFlows = getVehicleFlows(UseStatisticRequest, xAxisData, dateType); return new BizResultVO().setData(vehicleFlows); - } else { + } + // else if (dayDifference <= 3L) { + // // 1小时为一个时间戳 + // UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); + // int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); + // String day = ""; + // String month = ""; + // for (int i = 0; i <=dayDifference.intValue(); i++) { + // Calendar tempDate = Calendar.getInstance(); + // tempDate .setTime(request.getBeginTime()); + // tempDate.add(Calendar.DAY_OF_MONTH, i); + // int beginMonth = tempDate.get(Calendar.MONTH) + 1; + // int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); + // month = String.format("%02d", (beginMonth)); + // day = String.format("%02d", (beginDay)); + // for (int j = 0; j < 24; j++) { + // String hour = String.format("%02d", (j)); + // xAxisData.add(year + "-" + month + "-" + day + " " + hour); + // } + // } + // dateType = "yyyy-MM-dd HH"; + // + // + //// + //// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); + //// String day = ""; + //// String month = ""; + //// for (int i = 0; i < dayDifference.intValue(); i++) { + //// int beginMonth = beginTime.get(Calendar.MONTH) + 1; + //// int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); + //// month = String.format("%02d", (beginMonth)); + //// day = String.format("%02d", (beginDay)); + //// int endDay = endTime.get(Calendar.DAY_OF_MONTH); + //// if(beginDay != endDay){ + //// totaltimestampCount = 24; + //// } + //// for (int j = 0; j < totaltimestampCount; j++) { + //// String hour = String.format("%02d", (j)); + //// xAxisData.add(month + "-" + day + " " + hour); + //// } + //// beginTime.add(Calendar.DAY_OF_MONTH, 1); + //// } + //// dateType="MM-dd HH"; + // LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, + // xAxisData, dateType); + // return new BizResultVO().setData(vehicleFlows); + // + // } + else { // 1天为一个时间戳 UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); - for (int i = 0; i <=dayDifference.intValue(); i++) { - Calendar tempDate = Calendar.getInstance(); - tempDate .setTime(request.getBeginTime()); - tempDate.add(Calendar.DAY_OF_MONTH, i); - int beginMonth = tempDate.get(Calendar.MONTH) + 1; - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); - String month = String.format("%02d", (beginMonth)); - String day = String.format("%02d", (beginDay)); - xAxisData.add(year + "-" + month + "-" + day); - - } - dateType = "yyyy-MM-dd"; - -// for (int i = 0; i < dayDifference.intValue()+1; i++) { -// int beginMonth = beginTime.get(Calendar.MONTH) + 1; -// int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); -// String month = String.format("%02d", (beginMonth)); -// String day = String.format("%02d", (beginDay)); -// xAxisData.add(month + "-" + day); -// beginTime.add(Calendar.DAY_OF_MONTH, 1); -// -// } -// dateType="MM-dd"; - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); + for (int i = 0; i <= dayDifference.intValue(); i++) { + Calendar tempDate = Calendar.getInstance(); + tempDate.setTime(request.getBeginTime()); + tempDate.add(Calendar.DAY_OF_MONTH, i); + int beginMonth = tempDate.get(Calendar.MONTH) + 1; + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); + String month = String.format("%02d", (beginMonth)); + String day = String.format("%02d", (beginDay)); + xAxisData.add(month + "-" + day); + } + dateType = "MM-dd"; + LineChartVO vehicleFlows = getVehicleFlows(UseStatisticRequest, xAxisData, dateType); return new BizResultVO().setData(vehicleFlows); } } - /** * 进出场折线图 + * * @param request * @param xAxisData * @param dateType - * @return - * 2017年7月28日 zhaowg + * @return 2017年7月28日 zhaowg */ - private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, - List xAxisData,String dateType){ + private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, List xAxisData, + String dateType) { // 调用后场服务 logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); BizResult> bizResult = parkingLotStatisticService @@ -255,9 +233,13 @@ public class InOutParkStatisticController extends BizController { String key = statisticDTO.getPlNo(); parkNameMap.put(key, statisticDTO.getPlName()); String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType); - //保存进场车流量和出场车流量 - inParkMap.put(statisBeginTime, (inParkMap.get(statisBeginTime)==null?0:inParkMap.get(statisBeginTime))+statisticDTO.getTmpVehicleFlow()); - outParkMap.put(statisBeginTime, (outParkMap.get(statisBeginTime)==null?0:outParkMap.get(statisBeginTime))+statisticDTO.getOutParkCount()); + // 保存进场车流量和出场车流量 + inParkMap.put(statisBeginTime, + (inParkMap.get(statisBeginTime) == null ? 0 : inParkMap.get(statisBeginTime)) + + statisticDTO.getTmpVehicleFlow()); + outParkMap.put(statisBeginTime, + (outParkMap.get(statisBeginTime) == null ? 0 : outParkMap.get(statisBeginTime)) + + statisticDTO.getOutParkCount()); } } @@ -284,14 +266,14 @@ public class InOutParkStatisticController extends BizController { if (inParkMap.containsKey(timestamp)) { lastfixFlow = inParkMap.get(timestamp).intValue(); - }else{ - lastfixFlow =0; + } else { + lastfixFlow = 0; } inParkSerieVoData.add(lastfixFlow); if (outParkMap.containsKey(timestamp)) { lasttmpFlow = outParkMap.get(timestamp).intValue(); - }else{ + } else { lasttmpFlow = 0; } outParkSerieVoData.add(lasttmpFlow); @@ -304,14 +286,11 @@ public class InOutParkStatisticController extends BizController { vehicleFlows.setSeries(vehicleSeries); return vehicleFlows; } - - - + @ApiOperation("导出进出场统计excel") @GetMapping("exportInOutParkStatisticExcel") public void exportInOutParkStatisticExcel(@RequestParam String beginTime, @RequestParam String endTime, - @RequestParam List plNos,@RequestParam String parkNames, - Integer inOutStatus,Integer parkType, + @RequestParam List plNos, @RequestParam String parkNames, Integer inOutStatus, Integer parkType, HttpServletRequest requests, HttpServletResponse response) throws Exception { ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest(); request.setSysCode(sysCode); @@ -320,9 +299,10 @@ public class InOutParkStatisticController extends BizController { request.setPlNos(plNos); request.setBaseRequest(new BaseInfo(1, 0)); request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); - BizResult bizResultSum = parkingLotStatisticService.QueryInOutParkStatisticSum(request); - - InOutParkRequest inOutParkRequest =new InOutParkRequest(); + BizResult bizResultSum = parkingLotStatisticService + .QueryInOutParkStatisticSum(request); + + InOutParkRequest inOutParkRequest = new InOutParkRequest(); inOutParkRequest.setBaseRequest(new BaseInfo(1, 0)); inOutParkRequest.setSysCode(sysCode); inOutParkRequest.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); @@ -331,22 +311,20 @@ public class InOutParkStatisticController extends BizController { inOutParkRequest.setInOutStatus(inOutStatus); inOutParkRequest.setParkType(parkType); BizResult> bizResult = inOutParkStatisticService.queryInOutParkForList(inOutParkRequest); - - - + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); - String[] title = new String[] { "停车场", "车牌号", "车辆类型", "进出场状态","进场时间","出场时间","停车时长" }; + String[] title = new String[] { "停车场", "车牌号", "车辆类型", "进出场状态", "进场时间", "出场时间", "停车时长" }; String sheetName = "车辆进出场统计"; String fileName = "车辆进出场统计" + format2.format(new Date()); - + String[] billTitle = new String[8]; if (bizResultSum != null && bizResultSum.getData() != null) { ParkingLotUseStatisticSumDTO dto = bizResultSum.getData(); billTitle[0] = "车辆进出场统计"; billTitle[1] = "汇总"; - billTitle[2] = "停车场: " +parkNames; + billTitle[2] = "停车场: " + parkNames; billTitle[3] = "进场时间: " + beginTime; billTitle[4] = "出场时间:" + endTime; billTitle[5] = "进场车辆总数: " + (dto.getInParkSum() != null ? dto.getInParkSum() : 0); @@ -356,16 +334,13 @@ public class InOutParkStatisticController extends BizController { billTitle[0] = "车辆进出场统计"; billTitle[1] = "汇总"; billTitle[2] = "停车场:"; - billTitle[3] = "进场时间:" ; - billTitle[4] = "出场时间:" ; + billTitle[3] = "进场时间:"; + billTitle[4] = "出场时间:"; billTitle[5] = "进场车辆总数:"; billTitle[6] = "出场车辆总数:"; billTitle[7] = "具体明细"; } - - - - + // 1.创建excel信息 XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); // 2.设置excel表头和表体 @@ -381,29 +356,29 @@ public class InOutParkStatisticController extends BizController { int index = 0; obj[index++] = e.getParkName(); obj[index++] = e.getCarNumber(); - //TODO - if(null!=e.getParkType()){ - if(1==e.getParkType()){ - obj[index++] ="固定停车"; - }else{ - obj[index++] ="临时停车"; + // TODO + if (null != e.getParkType()) { + if (1 == e.getParkType()) { + obj[index++] = "固定停车"; + } else { + obj[index++] = "临时停车"; } - }else{ - obj[index++] ="临时停车"; + } else { + obj[index++] = "临时停车"; } - - if(null !=e.getInOutState()){ - if(1==e.getInOutState() || 2==e.getInOutState() || 3==e.getInOutState()){ - obj[index++] ="在场"; - }else{ - obj[index++] ="出场"; + + if (null != e.getInOutState()) { + if (1 == e.getInOutState() || 2 == e.getInOutState() || 3 == e.getInOutState()) { + obj[index++] = "在场"; + } else { + obj[index++] = "出场"; } - }else{ - obj[index++] ="出场"; + } else { + obj[index++] = "出场"; } obj[index++] = format.format(e.getInTime()); - obj[index++] = e.getOutTime() != null? format.format(e.getOutTime()) : ""; - obj[index++] = e.getParkingDuration() != null? DateUtil.secondToTime(e.getParkingDuration()) : ""; + obj[index++] = e.getOutTime() != null ? format.format(e.getOutTime()) : ""; + obj[index++] = e.getParkingDuration() != null ? DateUtil.secondToTime(e.getParkingDuration()) : ""; contentList.add(obj); } ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); @@ -411,5 +386,5 @@ public class InOutParkStatisticController extends BizController { // 4.excel输出配置 ExcelUtil.write(response, workSheet, fileName); } - + } diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java index 2908491..80ae11f 100644 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java +++ b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java @@ -231,7 +231,7 @@ public class VehicleFlowStatisticController extends BizController { logger.info("根据停车场编号获取该停车场今日车流量和车位折线图"); Calendar beginTime = Calendar.getInstance(); beginTime.setTime(request.getBeginTime()); - int year = beginTime.get(Calendar.YEAR); +// int year = beginTime.get(Calendar.YEAR); Calendar endTime = Calendar.getInstance(); endTime.setTime(request.getEndTime()); @@ -245,42 +245,12 @@ public class VehicleFlowStatisticController extends BizController { // 1小时为一个时间戳 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - - int beginMonth = beginTime.get(Calendar.MONTH) + 1; - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); + for (int j = 0; j <= totaltimestampCount; j++) { String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); - } - - dateType = "yyyy-MM-dd HH"; - LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); - return new BizResultVO().setData(vehicleFlows); - - } else if (dayDifference <= 3L) { - // 1小时为一个时间戳 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - for (int i = 0; i <=dayDifference.intValue(); i++) { - Calendar tempDate = Calendar.getInstance(); - tempDate .setTime(request.getBeginTime()); - tempDate.add(Calendar.DAY_OF_MONTH, i); - int beginMonth = tempDate.get(Calendar.MONTH) + 1; - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); - for (int j = 0; j <= totaltimestampCount; j++) { - String hour = String.format("%02d", (j)); - xAxisData.add(year + "-" + month + "-" + day + " " + hour); - } + xAxisData.add(hour+":00"); } - dateType = "yyyy-MM-dd HH"; + dateType = "HH:mm"; LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); return new BizResultVO().setData(vehicleFlows); @@ -295,10 +265,9 @@ public class VehicleFlowStatisticController extends BizController { int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); String month = String.format("%02d", (beginMonth)); String day = String.format("%02d", (beginDay)); - xAxisData.add(year + "-" + month + "-" + day); - + xAxisData.add(month + "-" + day); } - dateType = "yyyy-MM-dd"; + dateType = "MM-dd"; LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); return new BizResultVO().setData(vehicleFlows); -- libgit2 0.21.4