Commit 3afbc3856b2426426bdf8a0a7bbac92e37fc3631
1 parent
73392c68
提交
Showing
3 changed files
with
179 additions
and
272 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java
| ... | ... | @@ -222,7 +222,7 @@ public class BerthsStatisticController extends BizController { |
| 222 | 222 | logger.info("根据停车场编号获取该停车场车位空置率折线图"); |
| 223 | 223 | Calendar beginTime = Calendar.getInstance(); |
| 224 | 224 | beginTime.setTime(request.getBeginTime()); |
| 225 | - int year = beginTime.get(Calendar.YEAR); | |
| 225 | +// int year = beginTime.get(Calendar.YEAR); | |
| 226 | 226 | |
| 227 | 227 | Calendar endTime = Calendar.getInstance(); |
| 228 | 228 | endTime.setTime(request.getEndTime()); |
| ... | ... | @@ -237,44 +237,38 @@ public class BerthsStatisticController extends BizController { |
| 237 | 237 | // 1个小时为一个时间戳 |
| 238 | 238 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); |
| 239 | 239 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); |
| 240 | - String day = ""; | |
| 241 | - String month = ""; | |
| 242 | - | |
| 243 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | |
| 244 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | |
| 245 | - month = String.format("%02d", (beginMonth)); | |
| 246 | - day = String.format("%02d", (beginDay)); | |
| 247 | 240 | for (int j = 0; j <= totaltimestampCount; j++) { |
| 248 | 241 | String hour = String.format("%02d", (j)); |
| 249 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 250 | - } | |
| 251 | - | |
| 252 | - dateType = "yyyy-MM-dd HH"; | |
| 253 | - LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | |
| 254 | - return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | |
| 255 | - } else if (dayDifference <= 3L) { | |
| 256 | - // 1小时为一个时间戳 | |
| 257 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | |
| 258 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 259 | - String day = ""; | |
| 260 | - String month = ""; | |
| 261 | - for (int i = 0; i <= dayDifference.intValue(); i++) { | |
| 262 | - Calendar tempDate = Calendar.getInstance(); | |
| 263 | - tempDate.setTime(request.getBeginTime()); | |
| 264 | - tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 265 | - int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 266 | - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 267 | - month = String.format("%02d", (beginMonth)); | |
| 268 | - day = String.format("%02d", (beginDay)); | |
| 269 | - for (int j = 0; j <= totaltimestampCount; j++) { | |
| 270 | - String hour = String.format("%02d", (j)); | |
| 271 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 272 | - } | |
| 242 | + xAxisData.add(hour+":00"); | |
| 273 | 243 | } |
| 274 | - dateType = "yyyy-MM-dd HH"; | |
| 244 | + dateType = "HH:mm"; | |
| 275 | 245 | LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); |
| 276 | 246 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); |
| 277 | - } else { | |
| 247 | + } | |
| 248 | +// else if (dayDifference <= 3L) { | |
| 249 | +// // 1小时为一个时间戳 | |
| 250 | +// request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | |
| 251 | +// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 252 | +// String day = ""; | |
| 253 | +// String month = ""; | |
| 254 | +// for (int i = 0; i <= dayDifference.intValue(); i++) { | |
| 255 | +// Calendar tempDate = Calendar.getInstance(); | |
| 256 | +// tempDate.setTime(request.getBeginTime()); | |
| 257 | +// tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 258 | +// int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 259 | +// int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 260 | +// month = String.format("%02d", (beginMonth)); | |
| 261 | +// day = String.format("%02d", (beginDay)); | |
| 262 | +// for (int j = 0; j <= totaltimestampCount; j++) { | |
| 263 | +// String hour = String.format("%02d", (j)); | |
| 264 | +// xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 265 | +// } | |
| 266 | +// } | |
| 267 | +// dateType = "yyyy-MM-dd HH"; | |
| 268 | +// LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | |
| 269 | +// return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | |
| 270 | +// } | |
| 271 | + else { | |
| 278 | 272 | // 1天为一个时间戳 |
| 279 | 273 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); |
| 280 | 274 | for (int i = 0; i <= dayDifference.intValue(); i++) { |
| ... | ... | @@ -285,10 +279,9 @@ public class BerthsStatisticController extends BizController { |
| 285 | 279 | int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); |
| 286 | 280 | String month = String.format("%02d", (beginMonth)); |
| 287 | 281 | String day = String.format("%02d", (beginDay)); |
| 288 | - xAxisData.add(year + "-" + month + "-" + day); | |
| 289 | - | |
| 282 | + xAxisData.add(month + "-" + day); | |
| 290 | 283 | } |
| 291 | - dateType = "yyyy-MM-dd"; | |
| 284 | + dateType = "MM-dd"; | |
| 292 | 285 | LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); |
| 293 | 286 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); |
| 294 | 287 | |
| ... | ... | @@ -312,7 +305,7 @@ public class BerthsStatisticController extends BizController { |
| 312 | 305 | throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); |
| 313 | 306 | } |
| 314 | 307 | Calendar beginTime = Calendar.getInstance(); |
| 315 | - int year = beginTime.get(Calendar.YEAR); | |
| 308 | +// int year = beginTime.get(Calendar.YEAR); | |
| 316 | 309 | beginTime.setTime(request.getBeginTime()); |
| 317 | 310 | |
| 318 | 311 | Calendar endTime = Calendar.getInstance(); |
| ... | ... | @@ -328,44 +321,14 @@ public class BerthsStatisticController extends BizController { |
| 328 | 321 | // 1个小时为一个时间戳 |
| 329 | 322 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); |
| 330 | 323 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); |
| 331 | - String day = ""; | |
| 332 | - String month = ""; | |
| 333 | - | |
| 334 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | |
| 335 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | |
| 336 | - month = String.format("%02d", (beginMonth)); | |
| 337 | - day = String.format("%02d", (beginDay)); | |
| 338 | 324 | for (int j = 0; j <= totaltimestampCount; j++) { |
| 339 | 325 | String hour = String.format("%02d", (j)); |
| 340 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 326 | + xAxisData.add(hour+":00"); | |
| 341 | 327 | } |
| 342 | - | |
| 343 | - dateType = "yyyy-MM-dd HH"; | |
| 328 | + dateType = "HH:mm"; | |
| 344 | 329 | LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); |
| 345 | 330 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); |
| 346 | - } else if (dayDifference <= 3L) { | |
| 347 | - // 1小时为一个时间戳 | |
| 348 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | |
| 349 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 350 | - String day = ""; | |
| 351 | - String month = ""; | |
| 352 | - for (int i = 0; i <= dayDifference.intValue(); i++) { | |
| 353 | - Calendar tempDate = Calendar.getInstance(); | |
| 354 | - tempDate.setTime(request.getBeginTime()); | |
| 355 | - tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 356 | - int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 357 | - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 358 | - month = String.format("%02d", (beginMonth)); | |
| 359 | - day = String.format("%02d", (beginDay)); | |
| 360 | - for (int j = 0; j <= totaltimestampCount; j++) { | |
| 361 | - String hour = String.format("%02d", (j)); | |
| 362 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 363 | - } | |
| 364 | - } | |
| 365 | - dateType = "yyyy-MM-dd HH"; | |
| 366 | - LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | |
| 367 | - return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | |
| 368 | - } else { | |
| 331 | + }else { | |
| 369 | 332 | // 1天为一个时间戳 |
| 370 | 333 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); |
| 371 | 334 | for (int i = 0; i <= dayDifference.intValue(); i++) { |
| ... | ... | @@ -376,10 +339,10 @@ public class BerthsStatisticController extends BizController { |
| 376 | 339 | int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); |
| 377 | 340 | String month = String.format("%02d", (beginMonth)); |
| 378 | 341 | String day = String.format("%02d", (beginDay)); |
| 379 | - xAxisData.add(year + "-" + month + "-" + day); | |
| 342 | + xAxisData.add(month + "-" + day); | |
| 380 | 343 | |
| 381 | 344 | } |
| 382 | - dateType = "yyyy-MM-dd"; | |
| 345 | + dateType = "MM-dd"; | |
| 383 | 346 | LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); |
| 384 | 347 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); |
| 385 | 348 | } | ... | ... |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java
| ... | ... | @@ -58,17 +58,15 @@ import io.swagger.annotations.ApiOperation; |
| 58 | 58 | /** |
| 59 | 59 | * 企业云平台->数据统计->进出场上报。 |
| 60 | 60 | * |
| 61 | - * Copyright: Copyright (c) 2017 zteits | |
| 61 | + * Copyright: Copyright (c) 2017 zteits | |
| 62 | 62 | * |
| 63 | 63 | * @ClassName: InOutParkStatisticController.java |
| 64 | - * @Description: | |
| 64 | + * @Description: | |
| 65 | 65 | * @version: v1.0.0 |
| 66 | 66 | * @author: langlw |
| 67 | - * @date: 2017年7月26日 上午11:30:04 | |
| 68 | - * Modification History: | |
| 69 | - * Date Author Version Description | |
| 70 | - *---------------------------------------------------------* | |
| 71 | - * 2017年7月26日 langlw v1.0.0 创建 | |
| 67 | + * @date: 2017年7月26日 上午11:30:04 Modification History: Date Author Version | |
| 68 | + * Description ---------------------------------------------------------* | |
| 69 | + * 2017年7月26日 langlw v1.0.0 创建 | |
| 72 | 70 | */ |
| 73 | 71 | @Api(value = "企业云平台->数据统计->进出场上报数据统计", description = "企业云平台->数据统计->进出场上报数据统计") |
| 74 | 72 | @Controller |
| ... | ... | @@ -82,31 +80,29 @@ public class InOutParkStatisticController extends BizController { |
| 82 | 80 | private ParkingLotUseStatisticService parkingLotStatisticService; |
| 83 | 81 | @Autowired |
| 84 | 82 | private InOutParkStatisticService inOutParkStatisticService; |
| 85 | - | |
| 86 | - | |
| 83 | + | |
| 87 | 84 | @ApiOperation("数据统计进出场上报") |
| 88 | 85 | @PostMapping("queryInOutParkForList") |
| 89 | 86 | @ResponseBody |
| 90 | - public BizResultVO<EasyUIDataGridVO<InOutParkDTO>> queryInOutParkForList( | |
| 91 | - @RequestBody InOutParkRequest request) throws Exception { | |
| 87 | + public BizResultVO<EasyUIDataGridVO<InOutParkDTO>> queryInOutParkForList(@RequestBody InOutParkRequest request) | |
| 88 | + throws Exception { | |
| 92 | 89 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); |
| 93 | - if (null == request.getBeginTime() || null==request.getEndTime()) { | |
| 94 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | |
| 95 | - } | |
| 90 | + if (null == request.getBeginTime() || null == request.getEndTime()) { | |
| 91 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | |
| 92 | + } | |
| 96 | 93 | BizResult<PageBean<InOutParkDTO>> bizResult = inOutParkStatisticService.queryInOutParkForList(request); |
| 97 | 94 | return returnJqGridData(bizResult, InOutParkDTO.class); |
| 98 | 95 | } |
| 99 | - | |
| 96 | + | |
| 100 | 97 | @ApiOperation("数据统计进出场上报折线图") |
| 101 | 98 | @PostMapping("queryInOutParkForChart") |
| 102 | 99 | @ResponseBody |
| 103 | - public BizResultVO<LineChartVO> queryInOutParkForChart( | |
| 104 | - @RequestBody InOutParkRequest request) throws Exception { | |
| 105 | - if (null == request.getBeginTime() || null==request.getEndTime() || null == request.getPlNos()) { | |
| 106 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间、停车场编号集合"); | |
| 107 | - } | |
| 108 | - | |
| 109 | - ParkingLotUseStatisticForPageRequest UseStatisticRequest=new ParkingLotUseStatisticForPageRequest(); | |
| 100 | + public BizResultVO<LineChartVO> queryInOutParkForChart(@RequestBody InOutParkRequest request) throws Exception { | |
| 101 | + if (null == request.getBeginTime() || null == request.getEndTime() || null == request.getPlNos()) { | |
| 102 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间、停车场编号集合"); | |
| 103 | + } | |
| 104 | + | |
| 105 | + ParkingLotUseStatisticForPageRequest UseStatisticRequest = new ParkingLotUseStatisticForPageRequest(); | |
| 110 | 106 | UseStatisticRequest.setPlNos(request.getPlNos()); |
| 111 | 107 | UseStatisticRequest.setBeginTime(request.getBeginTime()); |
| 112 | 108 | UseStatisticRequest.setEndTime(request.getEndTime()); |
| ... | ... | @@ -115,7 +111,7 @@ public class InOutParkStatisticController extends BizController { |
| 115 | 111 | |
| 116 | 112 | Calendar beginTime = Calendar.getInstance(); |
| 117 | 113 | beginTime.setTime(request.getBeginTime()); |
| 118 | - int year = beginTime.get(Calendar.YEAR); | |
| 114 | + // int year = beginTime.get(Calendar.YEAR); | |
| 119 | 115 | |
| 120 | 116 | Calendar endTime = Calendar.getInstance(); |
| 121 | 117 | endTime.setTime(request.getEndTime()); |
| ... | ... | @@ -123,117 +119,99 @@ public class InOutParkStatisticController extends BizController { |
| 123 | 119 | Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), |
| 124 | 120 | new Timestamp(request.getBeginTime().getTime())); |
| 125 | 121 | List<String> xAxisData = Lists.newArrayList(); |
| 126 | - String dateType=""; | |
| 127 | - | |
| 128 | - if (dayDifference == 0L) { | |
| 129 | - //同一天 | |
| 130 | - // 20分钟为一个时间戳 | |
| 131 | - UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | |
| 132 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 133 | - String day = ""; | |
| 134 | - String month = ""; | |
| 135 | - | |
| 136 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | |
| 137 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | |
| 138 | - month = String.format("%02d", (beginMonth)); | |
| 139 | - day = String.format("%02d", (beginDay)); | |
| 140 | - for (int j = 0; j <= totaltimestampCount; j++) { | |
| 141 | - String hour = String.format("%02d", (j)); | |
| 142 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 143 | - } | |
| 144 | - | |
| 145 | - dateType = "yyyy-MM-dd HH"; | |
| 146 | - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | |
| 147 | - return new BizResultVO<LineChartVO>().setData(vehicleFlows); | |
| 122 | + String dateType = ""; | |
| 148 | 123 | |
| 149 | - } else if (dayDifference <= 3L) { | |
| 150 | - // 1小时为一个时间戳 | |
| 124 | + if (dayDifference == 0L) { | |
| 125 | + // 同一天 | |
| 126 | + // 1个小时为一个时间戳 | |
| 151 | 127 | UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); |
| 152 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 153 | - String day = ""; | |
| 154 | - String month = ""; | |
| 155 | - for (int i = 0; i <=dayDifference.intValue(); i++) { | |
| 156 | - Calendar tempDate = Calendar.getInstance(); | |
| 157 | - tempDate .setTime(request.getBeginTime()); | |
| 158 | - tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 159 | - int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 160 | - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 161 | - month = String.format("%02d", (beginMonth)); | |
| 162 | - day = String.format("%02d", (beginDay)); | |
| 163 | - for (int j = 0; j < 24; j++) { | |
| 164 | - String hour = String.format("%02d", (j)); | |
| 165 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 166 | - } | |
| 167 | - } | |
| 168 | - dateType = "yyyy-MM-dd HH"; | |
| 169 | - | |
| 170 | - | |
| 171 | -// | |
| 172 | -// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 173 | -// String day = ""; | |
| 174 | -// String month = ""; | |
| 175 | -// for (int i = 0; i < dayDifference.intValue(); i++) { | |
| 176 | -// int beginMonth = beginTime.get(Calendar.MONTH) + 1; | |
| 177 | -// int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | |
| 178 | -// month = String.format("%02d", (beginMonth)); | |
| 179 | -// day = String.format("%02d", (beginDay)); | |
| 180 | -// int endDay = endTime.get(Calendar.DAY_OF_MONTH); | |
| 181 | -// if(beginDay != endDay){ | |
| 182 | -// totaltimestampCount = 24; | |
| 183 | -// } | |
| 184 | -// for (int j = 0; j < totaltimestampCount; j++) { | |
| 185 | -// String hour = String.format("%02d", (j)); | |
| 186 | -// xAxisData.add(month + "-" + day + " " + hour); | |
| 187 | -// } | |
| 188 | -// beginTime.add(Calendar.DAY_OF_MONTH, 1); | |
| 189 | -// } | |
| 190 | -// dateType="MM-dd HH"; | |
| 191 | - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | |
| 128 | + int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 129 | + for (int j = 0; j <= totaltimestampCount; j++) { | |
| 130 | + String hour = String.format("%02d", (j)); | |
| 131 | + xAxisData.add(hour + ":00"); | |
| 132 | + } | |
| 133 | + dateType = "HH:mm"; | |
| 134 | + LineChartVO vehicleFlows = getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | |
| 192 | 135 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); |
| 193 | 136 | |
| 194 | - } else { | |
| 137 | + } | |
| 138 | + // else if (dayDifference <= 3L) { | |
| 139 | + // // 1小时为一个时间戳 | |
| 140 | + // UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | |
| 141 | + // int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 142 | + // String day = ""; | |
| 143 | + // String month = ""; | |
| 144 | + // for (int i = 0; i <=dayDifference.intValue(); i++) { | |
| 145 | + // Calendar tempDate = Calendar.getInstance(); | |
| 146 | + // tempDate .setTime(request.getBeginTime()); | |
| 147 | + // tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 148 | + // int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 149 | + // int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 150 | + // month = String.format("%02d", (beginMonth)); | |
| 151 | + // day = String.format("%02d", (beginDay)); | |
| 152 | + // for (int j = 0; j < 24; j++) { | |
| 153 | + // String hour = String.format("%02d", (j)); | |
| 154 | + // xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 155 | + // } | |
| 156 | + // } | |
| 157 | + // dateType = "yyyy-MM-dd HH"; | |
| 158 | + // | |
| 159 | + // | |
| 160 | + //// | |
| 161 | + //// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 162 | + //// String day = ""; | |
| 163 | + //// String month = ""; | |
| 164 | + //// for (int i = 0; i < dayDifference.intValue(); i++) { | |
| 165 | + //// int beginMonth = beginTime.get(Calendar.MONTH) + 1; | |
| 166 | + //// int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | |
| 167 | + //// month = String.format("%02d", (beginMonth)); | |
| 168 | + //// day = String.format("%02d", (beginDay)); | |
| 169 | + //// int endDay = endTime.get(Calendar.DAY_OF_MONTH); | |
| 170 | + //// if(beginDay != endDay){ | |
| 171 | + //// totaltimestampCount = 24; | |
| 172 | + //// } | |
| 173 | + //// for (int j = 0; j < totaltimestampCount; j++) { | |
| 174 | + //// String hour = String.format("%02d", (j)); | |
| 175 | + //// xAxisData.add(month + "-" + day + " " + hour); | |
| 176 | + //// } | |
| 177 | + //// beginTime.add(Calendar.DAY_OF_MONTH, 1); | |
| 178 | + //// } | |
| 179 | + //// dateType="MM-dd HH"; | |
| 180 | + // LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, | |
| 181 | + // xAxisData, dateType); | |
| 182 | + // return new BizResultVO<LineChartVO>().setData(vehicleFlows); | |
| 183 | + // | |
| 184 | + // } | |
| 185 | + else { | |
| 195 | 186 | // 1天为一个时间戳 |
| 196 | 187 | UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); |
| 197 | - for (int i = 0; i <=dayDifference.intValue(); i++) { | |
| 198 | - Calendar tempDate = Calendar.getInstance(); | |
| 199 | - tempDate .setTime(request.getBeginTime()); | |
| 200 | - tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 201 | - int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 202 | - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 203 | - String month = String.format("%02d", (beginMonth)); | |
| 204 | - String day = String.format("%02d", (beginDay)); | |
| 205 | - xAxisData.add(year + "-" + month + "-" + day); | |
| 206 | - | |
| 207 | - } | |
| 208 | - dateType = "yyyy-MM-dd"; | |
| 209 | - | |
| 210 | -// for (int i = 0; i < dayDifference.intValue()+1; i++) { | |
| 211 | -// int beginMonth = beginTime.get(Calendar.MONTH) + 1; | |
| 212 | -// int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | |
| 213 | -// String month = String.format("%02d", (beginMonth)); | |
| 214 | -// String day = String.format("%02d", (beginDay)); | |
| 215 | -// xAxisData.add(month + "-" + day); | |
| 216 | -// beginTime.add(Calendar.DAY_OF_MONTH, 1); | |
| 217 | -// | |
| 218 | -// } | |
| 219 | -// dateType="MM-dd"; | |
| 220 | - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | |
| 188 | + for (int i = 0; i <= dayDifference.intValue(); i++) { | |
| 189 | + Calendar tempDate = Calendar.getInstance(); | |
| 190 | + tempDate.setTime(request.getBeginTime()); | |
| 191 | + tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 192 | + int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 193 | + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 194 | + String month = String.format("%02d", (beginMonth)); | |
| 195 | + String day = String.format("%02d", (beginDay)); | |
| 196 | + xAxisData.add(month + "-" + day); | |
| 197 | + } | |
| 198 | + dateType = "MM-dd"; | |
| 199 | + LineChartVO vehicleFlows = getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | |
| 221 | 200 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); |
| 222 | 201 | |
| 223 | 202 | } |
| 224 | 203 | } |
| 225 | 204 | |
| 226 | - | |
| 227 | 205 | /** |
| 228 | 206 | * 进出场折线图 |
| 207 | + * | |
| 229 | 208 | * @param request |
| 230 | 209 | * @param xAxisData |
| 231 | 210 | * @param dateType |
| 232 | - * @return | |
| 233 | - * 2017年7月28日 zhaowg | |
| 211 | + * @return 2017年7月28日 zhaowg | |
| 234 | 212 | */ |
| 235 | - private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, | |
| 236 | - List<String> xAxisData,String dateType){ | |
| 213 | + private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, List<String> xAxisData, | |
| 214 | + String dateType) { | |
| 237 | 215 | // 调用后场服务 |
| 238 | 216 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); |
| 239 | 217 | BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService |
| ... | ... | @@ -255,9 +233,13 @@ public class InOutParkStatisticController extends BizController { |
| 255 | 233 | String key = statisticDTO.getPlNo(); |
| 256 | 234 | parkNameMap.put(key, statisticDTO.getPlName()); |
| 257 | 235 | String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType); |
| 258 | - //保存进场车流量和出场车流量 | |
| 259 | - inParkMap.put(statisBeginTime, (inParkMap.get(statisBeginTime)==null?0:inParkMap.get(statisBeginTime))+statisticDTO.getTmpVehicleFlow()); | |
| 260 | - outParkMap.put(statisBeginTime, (outParkMap.get(statisBeginTime)==null?0:outParkMap.get(statisBeginTime))+statisticDTO.getOutParkCount()); | |
| 236 | + // 保存进场车流量和出场车流量 | |
| 237 | + inParkMap.put(statisBeginTime, | |
| 238 | + (inParkMap.get(statisBeginTime) == null ? 0 : inParkMap.get(statisBeginTime)) | |
| 239 | + + statisticDTO.getTmpVehicleFlow()); | |
| 240 | + outParkMap.put(statisBeginTime, | |
| 241 | + (outParkMap.get(statisBeginTime) == null ? 0 : outParkMap.get(statisBeginTime)) | |
| 242 | + + statisticDTO.getOutParkCount()); | |
| 261 | 243 | } |
| 262 | 244 | } |
| 263 | 245 | |
| ... | ... | @@ -284,14 +266,14 @@ public class InOutParkStatisticController extends BizController { |
| 284 | 266 | |
| 285 | 267 | if (inParkMap.containsKey(timestamp)) { |
| 286 | 268 | lastfixFlow = inParkMap.get(timestamp).intValue(); |
| 287 | - }else{ | |
| 288 | - lastfixFlow =0; | |
| 269 | + } else { | |
| 270 | + lastfixFlow = 0; | |
| 289 | 271 | } |
| 290 | 272 | inParkSerieVoData.add(lastfixFlow); |
| 291 | 273 | |
| 292 | 274 | if (outParkMap.containsKey(timestamp)) { |
| 293 | 275 | lasttmpFlow = outParkMap.get(timestamp).intValue(); |
| 294 | - }else{ | |
| 276 | + } else { | |
| 295 | 277 | lasttmpFlow = 0; |
| 296 | 278 | } |
| 297 | 279 | outParkSerieVoData.add(lasttmpFlow); |
| ... | ... | @@ -304,14 +286,11 @@ public class InOutParkStatisticController extends BizController { |
| 304 | 286 | vehicleFlows.setSeries(vehicleSeries); |
| 305 | 287 | return vehicleFlows; |
| 306 | 288 | } |
| 307 | - | |
| 308 | - | |
| 309 | - | |
| 289 | + | |
| 310 | 290 | @ApiOperation("导出进出场统计excel") |
| 311 | 291 | @GetMapping("exportInOutParkStatisticExcel") |
| 312 | 292 | public void exportInOutParkStatisticExcel(@RequestParam String beginTime, @RequestParam String endTime, |
| 313 | - @RequestParam List<String> plNos,@RequestParam String parkNames, | |
| 314 | - Integer inOutStatus,Integer parkType, | |
| 293 | + @RequestParam List<String> plNos, @RequestParam String parkNames, Integer inOutStatus, Integer parkType, | |
| 315 | 294 | HttpServletRequest requests, HttpServletResponse response) throws Exception { |
| 316 | 295 | ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest(); |
| 317 | 296 | request.setSysCode(sysCode); |
| ... | ... | @@ -320,9 +299,10 @@ public class InOutParkStatisticController extends BizController { |
| 320 | 299 | request.setPlNos(plNos); |
| 321 | 300 | request.setBaseRequest(new BaseInfo(1, 0)); |
| 322 | 301 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); |
| 323 | - BizResult<ParkingLotUseStatisticSumDTO> bizResultSum = parkingLotStatisticService.QueryInOutParkStatisticSum(request); | |
| 324 | - | |
| 325 | - InOutParkRequest inOutParkRequest =new InOutParkRequest(); | |
| 302 | + BizResult<ParkingLotUseStatisticSumDTO> bizResultSum = parkingLotStatisticService | |
| 303 | + .QueryInOutParkStatisticSum(request); | |
| 304 | + | |
| 305 | + InOutParkRequest inOutParkRequest = new InOutParkRequest(); | |
| 326 | 306 | inOutParkRequest.setBaseRequest(new BaseInfo(1, 0)); |
| 327 | 307 | inOutParkRequest.setSysCode(sysCode); |
| 328 | 308 | inOutParkRequest.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); |
| ... | ... | @@ -331,22 +311,20 @@ public class InOutParkStatisticController extends BizController { |
| 331 | 311 | inOutParkRequest.setInOutStatus(inOutStatus); |
| 332 | 312 | inOutParkRequest.setParkType(parkType); |
| 333 | 313 | BizResult<PageBean<InOutParkDTO>> bizResult = inOutParkStatisticService.queryInOutParkForList(inOutParkRequest); |
| 334 | - | |
| 335 | - | |
| 336 | - | |
| 314 | + | |
| 337 | 315 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 338 | 316 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); |
| 339 | - String[] title = new String[] { "停车场", "车牌号", "车辆类型", "进出场状态","进场时间","出场时间","停车时长" }; | |
| 317 | + String[] title = new String[] { "停车场", "车牌号", "车辆类型", "进出场状态", "进场时间", "出场时间", "停车时长" }; | |
| 340 | 318 | String sheetName = "车辆进出场统计"; |
| 341 | 319 | String fileName = "车辆进出场统计" + format2.format(new Date()); |
| 342 | - | |
| 320 | + | |
| 343 | 321 | String[] billTitle = new String[8]; |
| 344 | 322 | if (bizResultSum != null && bizResultSum.getData() != null) { |
| 345 | 323 | ParkingLotUseStatisticSumDTO dto = bizResultSum.getData(); |
| 346 | 324 | |
| 347 | 325 | billTitle[0] = "车辆进出场统计"; |
| 348 | 326 | billTitle[1] = "汇总"; |
| 349 | - billTitle[2] = "停车场: " +parkNames; | |
| 327 | + billTitle[2] = "停车场: " + parkNames; | |
| 350 | 328 | billTitle[3] = "进场时间: " + beginTime; |
| 351 | 329 | billTitle[4] = "出场时间:" + endTime; |
| 352 | 330 | billTitle[5] = "进场车辆总数: " + (dto.getInParkSum() != null ? dto.getInParkSum() : 0); |
| ... | ... | @@ -356,16 +334,13 @@ public class InOutParkStatisticController extends BizController { |
| 356 | 334 | billTitle[0] = "车辆进出场统计"; |
| 357 | 335 | billTitle[1] = "汇总"; |
| 358 | 336 | billTitle[2] = "停车场:"; |
| 359 | - billTitle[3] = "进场时间:" ; | |
| 360 | - billTitle[4] = "出场时间:" ; | |
| 337 | + billTitle[3] = "进场时间:"; | |
| 338 | + billTitle[4] = "出场时间:"; | |
| 361 | 339 | billTitle[5] = "进场车辆总数:"; |
| 362 | 340 | billTitle[6] = "出场车辆总数:"; |
| 363 | 341 | billTitle[7] = "具体明细"; |
| 364 | 342 | } |
| 365 | - | |
| 366 | - | |
| 367 | - | |
| 368 | - | |
| 343 | + | |
| 369 | 344 | // 1.创建excel信息 |
| 370 | 345 | XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); |
| 371 | 346 | // 2.设置excel表头和表体 |
| ... | ... | @@ -381,29 +356,29 @@ public class InOutParkStatisticController extends BizController { |
| 381 | 356 | int index = 0; |
| 382 | 357 | obj[index++] = e.getParkName(); |
| 383 | 358 | obj[index++] = e.getCarNumber(); |
| 384 | - //TODO | |
| 385 | - if(null!=e.getParkType()){ | |
| 386 | - if(1==e.getParkType()){ | |
| 387 | - obj[index++] ="固定停车"; | |
| 388 | - }else{ | |
| 389 | - obj[index++] ="临时停车"; | |
| 359 | + // TODO | |
| 360 | + if (null != e.getParkType()) { | |
| 361 | + if (1 == e.getParkType()) { | |
| 362 | + obj[index++] = "固定停车"; | |
| 363 | + } else { | |
| 364 | + obj[index++] = "临时停车"; | |
| 390 | 365 | } |
| 391 | - }else{ | |
| 392 | - obj[index++] ="临时停车"; | |
| 366 | + } else { | |
| 367 | + obj[index++] = "临时停车"; | |
| 393 | 368 | } |
| 394 | - | |
| 395 | - if(null !=e.getInOutState()){ | |
| 396 | - if(1==e.getInOutState() || 2==e.getInOutState() || 3==e.getInOutState()){ | |
| 397 | - obj[index++] ="在场"; | |
| 398 | - }else{ | |
| 399 | - obj[index++] ="出场"; | |
| 369 | + | |
| 370 | + if (null != e.getInOutState()) { | |
| 371 | + if (1 == e.getInOutState() || 2 == e.getInOutState() || 3 == e.getInOutState()) { | |
| 372 | + obj[index++] = "在场"; | |
| 373 | + } else { | |
| 374 | + obj[index++] = "出场"; | |
| 400 | 375 | } |
| 401 | - }else{ | |
| 402 | - obj[index++] ="出场"; | |
| 376 | + } else { | |
| 377 | + obj[index++] = "出场"; | |
| 403 | 378 | } |
| 404 | 379 | obj[index++] = format.format(e.getInTime()); |
| 405 | - obj[index++] = e.getOutTime() != null? format.format(e.getOutTime()) : ""; | |
| 406 | - obj[index++] = e.getParkingDuration() != null? DateUtil.secondToTime(e.getParkingDuration()) : ""; | |
| 380 | + obj[index++] = e.getOutTime() != null ? format.format(e.getOutTime()) : ""; | |
| 381 | + obj[index++] = e.getParkingDuration() != null ? DateUtil.secondToTime(e.getParkingDuration()) : ""; | |
| 407 | 382 | contentList.add(obj); |
| 408 | 383 | } |
| 409 | 384 | ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); |
| ... | ... | @@ -411,5 +386,5 @@ public class InOutParkStatisticController extends BizController { |
| 411 | 386 | // 4.excel输出配置 |
| 412 | 387 | ExcelUtil.write(response, workSheet, fileName); |
| 413 | 388 | } |
| 414 | - | |
| 389 | + | |
| 415 | 390 | } | ... | ... |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java
| ... | ... | @@ -231,7 +231,7 @@ public class VehicleFlowStatisticController extends BizController { |
| 231 | 231 | logger.info("根据停车场编号获取该停车场今日车流量和车位折线图"); |
| 232 | 232 | Calendar beginTime = Calendar.getInstance(); |
| 233 | 233 | beginTime.setTime(request.getBeginTime()); |
| 234 | - int year = beginTime.get(Calendar.YEAR); | |
| 234 | +// int year = beginTime.get(Calendar.YEAR); | |
| 235 | 235 | Calendar endTime = Calendar.getInstance(); |
| 236 | 236 | endTime.setTime(request.getEndTime()); |
| 237 | 237 | |
| ... | ... | @@ -245,42 +245,12 @@ public class VehicleFlowStatisticController extends BizController { |
| 245 | 245 | // 1小时为一个时间戳 |
| 246 | 246 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); |
| 247 | 247 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); |
| 248 | - String day = ""; | |
| 249 | - String month = ""; | |
| 250 | - | |
| 251 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | |
| 252 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | |
| 253 | - month = String.format("%02d", (beginMonth)); | |
| 254 | - day = String.format("%02d", (beginDay)); | |
| 248 | + | |
| 255 | 249 | for (int j = 0; j <= totaltimestampCount; j++) { |
| 256 | 250 | String hour = String.format("%02d", (j)); |
| 257 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 258 | - } | |
| 259 | - | |
| 260 | - dateType = "yyyy-MM-dd HH"; | |
| 261 | - LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); | |
| 262 | - return new BizResultVO<LineChartVO>().setData(vehicleFlows); | |
| 263 | - | |
| 264 | - } else if (dayDifference <= 3L) { | |
| 265 | - // 1小时为一个时间戳 | |
| 266 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | |
| 267 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | |
| 268 | - String day = ""; | |
| 269 | - String month = ""; | |
| 270 | - for (int i = 0; i <=dayDifference.intValue(); i++) { | |
| 271 | - Calendar tempDate = Calendar.getInstance(); | |
| 272 | - tempDate .setTime(request.getBeginTime()); | |
| 273 | - tempDate.add(Calendar.DAY_OF_MONTH, i); | |
| 274 | - int beginMonth = tempDate.get(Calendar.MONTH) + 1; | |
| 275 | - int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | |
| 276 | - month = String.format("%02d", (beginMonth)); | |
| 277 | - day = String.format("%02d", (beginDay)); | |
| 278 | - for (int j = 0; j <= totaltimestampCount; j++) { | |
| 279 | - String hour = String.format("%02d", (j)); | |
| 280 | - xAxisData.add(year + "-" + month + "-" + day + " " + hour); | |
| 281 | - } | |
| 251 | + xAxisData.add(hour+":00"); | |
| 282 | 252 | } |
| 283 | - dateType = "yyyy-MM-dd HH"; | |
| 253 | + dateType = "HH:mm"; | |
| 284 | 254 | LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); |
| 285 | 255 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); |
| 286 | 256 | |
| ... | ... | @@ -295,10 +265,9 @@ public class VehicleFlowStatisticController extends BizController { |
| 295 | 265 | int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); |
| 296 | 266 | String month = String.format("%02d", (beginMonth)); |
| 297 | 267 | String day = String.format("%02d", (beginDay)); |
| 298 | - xAxisData.add(year + "-" + month + "-" + day); | |
| 299 | - | |
| 268 | + xAxisData.add(month + "-" + day); | |
| 300 | 269 | } |
| 301 | - dateType = "yyyy-MM-dd"; | |
| 270 | + dateType = "MM-dd"; | |
| 302 | 271 | LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); |
| 303 | 272 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); |
| 304 | 273 | ... | ... |