Commit 3ab2f7e5b2aaad81eef2638dd3b7bc1f47c51b6b

Authored by llw
1 parent 27be2244

tijiao

src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java
... ... @@ -113,10 +113,10 @@ public class BerthsStatisticController extends BizController {
113 113 public BizResultVO<EasyUIDataGridVO<ParkingLotUseStatisticDTO>> GetParkingPlaceStatistic(
114 114 @RequestBody ParkingLotUseStatisticForPageRequest requestObject)
115 115 throws InstantiationException, IllegalAccessException {
116   - if (null == requestObject.getBeginTime() || null==requestObject.getEndTime()) {
117   - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");
118   - }
119   -
  116 + if (null == requestObject.getBeginTime() || null == requestObject.getEndTime()) {
  117 + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");
  118 + }
  119 +
120 120 Calendar beginc = Calendar.getInstance();
121 121 beginc.setTime(requestObject.getBeginTime());
122 122 int beginYear = beginc.get(Calendar.YEAR);
... ... @@ -153,7 +153,7 @@ public class BerthsStatisticController extends BizController {
153 153 plNoslist.add(plNos);
154 154 request.setPlNos(plNoslist);
155 155 request.setBaseRequest(new BaseInfo(1, 0));
156   -
  156 +
157 157 Calendar beginc = Calendar.getInstance();
158 158 beginc.setTime(request.getBeginTime());
159 159 int beginYear = beginc.get(Calendar.YEAR);
... ... @@ -194,7 +194,7 @@ public class BerthsStatisticController extends BizController {
194 194 Object[] obj = new Object[title.length];
195 195 int index = 0;
196 196 obj[index++] = format.format(e.getStatisticBeginTime());
197   - obj[index++] = e.getFreeRatio() *100 +"%";
  197 + obj[index++] = e.getFreeRatio() * 100 + "%";
198 198 obj[index++] = e.getTurnoverRatio();
199 199 contentList.add(obj);
200 200 }
... ... @@ -215,13 +215,14 @@ public class BerthsStatisticController extends BizController {
215 215 @ResponseBody
216 216 public BizResultVO<LineChartVO> getFreeRatioBerthForLineChart(
217 217 @RequestBody ParkingLotUseStatisticForPageRequest request) {
218   - //根据权限获取停车场列表
219   - if (null == request.getBeginTime() || null==request.getEndTime()) {
220   - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");
221   - }
  218 + // 根据权限获取停车场列表
  219 + if (null == request.getBeginTime() || null == request.getEndTime()) {
  220 + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");
  221 + }
222 222 logger.info("根据停车场编号获取该停车场车位空置率折线图");
223 223 Calendar beginTime = Calendar.getInstance();
224 224 beginTime.setTime(request.getBeginTime());
  225 + int year = beginTime.get(Calendar.YEAR);
225 226  
226 227 Calendar endTime = Calendar.getInstance();
227 228 endTime.setTime(request.getEndTime());
... ... @@ -229,28 +230,27 @@ public class BerthsStatisticController extends BizController {
229 230 Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()),
230 231 new Timestamp(request.getBeginTime().getTime()));
231 232 List<String> xAxisData = Lists.newArrayList();
232   - String dateType="";
233   - int berthRatio=ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE;
  233 + String dateType = "";
  234 + int berthRatio = ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE;
  235 + request.setBaseRequest(new BaseInfo(1, 0));
234 236 if (dayDifference == 0L) {
235 237 // 1个小时为一个时间戳
236 238 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);
237 239 int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY);
238 240 String day = "";
239 241 String month = "";
240   - for (int i = 0; i < dayDifference.intValue(); i++) {
241   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
242   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
243   - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);
244   - month = String.format("%02d", (beginMonth));
245   - day = String.format("%02d", (beginDay));
246   - for (int j = 0; j < totaltimestampCount; j++) {
247   - String hour = String.format("%02d", (j));
248   - xAxisData.add(month + "-" + day + " " + hour);
249   - }
  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 + for (int j = 0; j <= totaltimestampCount; j++) {
  248 + String hour = String.format("%02d", (j));
  249 + xAxisData.add(year + "-" + month + "-" + day + " " + hour);
250 250 }
251   - request.setBaseRequest(new BaseInfo(1, 0));
252   - dateType="MM-dd HH";
253   - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio);
  251 +
  252 + dateType = "yyyy-MM-dd HH";
  253 + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio);
254 254 return new BizResultVO<LineChartVO>().setData(freeBerthRatios);
255 255 } else if (dayDifference <= 3L) {
256 256 // 1小时为一个时间戳
... ... @@ -258,38 +258,41 @@ public class BerthsStatisticController extends BizController {
258 258 int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY);
259 259 String day = "";
260 260 String month = "";
261   - for (int i = 0; i < dayDifference.intValue(); i++) {
262   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
263   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
264   - int beginDay = beginTime.get(Calendar.DAY_OF_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);
265 267 month = String.format("%02d", (beginMonth));
266 268 day = String.format("%02d", (beginDay));
267   - for (int j = 0; j < totaltimestampCount; j++) {
  269 + for (int j = 0; j <= totaltimestampCount; j++) {
268 270 String hour = String.format("%02d", (j));
269   - xAxisData.add(month + "-" + day + " " + hour);
  271 + xAxisData.add(year + "-" + month + "-" + day + " " + hour);
270 272 }
271 273 }
272   - request.setBaseRequest(new BaseInfo(1, 0));
273   - dateType="MM-dd HH";
274   - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio);
  274 + dateType = "yyyy-MM-dd HH";
  275 + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio);
275 276 return new BizResultVO<LineChartVO>().setData(freeBerthRatios);
276 277 } else {
277 278 // 1天为一个时间戳
278 279 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY);
279   - for (int i = 0; i < dayDifference.intValue(); i++) {
280   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
281   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
282   - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);
  280 + for (int i = 0; i <= dayDifference.intValue(); i++) {
  281 + Calendar tempDate = Calendar.getInstance();
  282 + tempDate.setTime(request.getBeginTime());
  283 + tempDate.add(Calendar.DAY_OF_MONTH, i);
  284 + int beginMonth = tempDate.get(Calendar.MONTH) + 1;
  285 + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH);
283 286 String month = String.format("%02d", (beginMonth));
284 287 String day = String.format("%02d", (beginDay));
285   - xAxisData.add(month + "-" + day);
  288 + xAxisData.add(year + "-" + month + "-" + day);
  289 +
286 290 }
287   - }
288   - request.setBaseRequest(new BaseInfo(1, 0));
289   - dateType="MM-dd";
290   - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio);
291   - return new BizResultVO<LineChartVO>().setData(freeBerthRatios);
  291 + dateType = "yyyy-MM-dd";
  292 + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio);
  293 + return new BizResultVO<LineChartVO>().setData(freeBerthRatios);
292 294  
  295 + }
293 296 }
294 297  
295 298 /**
... ... @@ -305,11 +308,11 @@ public class BerthsStatisticController extends BizController {
305 308 @RequestBody ParkingLotUseStatisticForPageRequest request) {
306 309  
307 310 logger.info("根据停车场编号获取该停车场车位周转率折线图");
308   - if (null == request.getBeginTime() || null==request.getEndTime()) {
309   - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");
310   - }
  311 + if (null == request.getBeginTime() || null == request.getEndTime()) {
  312 + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");
  313 + }
311 314 Calendar beginTime = Calendar.getInstance();
312   - int year=beginTime.get(Calendar.YEAR);
  315 + int year = beginTime.get(Calendar.YEAR);
313 316 beginTime.setTime(request.getBeginTime());
314 317  
315 318 Calendar endTime = Calendar.getInstance();
... ... @@ -318,28 +321,27 @@ public class BerthsStatisticController extends BizController {
318 321 Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()),
319 322 new Timestamp(request.getBeginTime().getTime()));
320 323 List<String> xAxisData = Lists.newArrayList();
321   - String dateType="";
  324 + String dateType = "";
322 325 request.setBaseRequest(new BaseInfo(1, 0));
323   - int berthRatio=ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER;
  326 + int berthRatio = ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER;
324 327 if (dayDifference == 0L) {
325   - //1个小时为一个时间戳
  328 + // 1个小时为一个时间戳
326 329 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);
327 330 int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY);
328 331 String day = "";
329 332 String month = "";
330   - for (int i = 0; i < dayDifference.intValue(); i++) {
331   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
332   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
333   - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);
334   - month = String.format("%02d", (beginMonth));
335   - day = String.format("%02d", (beginDay));
336   - for (int j = 0; j < totaltimestampCount; j++) {
337   - String hour = String.format("%02d", (j));
338   - xAxisData.add(year+"-"+month + "-" + day + " " + hour);
339   - }
  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 + for (int j = 0; j <= totaltimestampCount; j++) {
  339 + String hour = String.format("%02d", (j));
  340 + xAxisData.add(year + "-" + month + "-" + day + " " + hour);
340 341 }
341   - dateType="yyyy-MM-dd HH";
342   - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio);
  342 +
  343 + dateType = "yyyy-MM-dd HH";
  344 + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio);
343 345 return new BizResultVO<LineChartVO>().setData(freeBerthRatios);
344 346 } else if (dayDifference <= 3L) {
345 347 // 1小时为一个时间戳
... ... @@ -347,41 +349,45 @@ public class BerthsStatisticController extends BizController {
347 349 int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY);
348 350 String day = "";
349 351 String month = "";
350   - for (int i = 0; i < dayDifference.intValue(); i++) {
351   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
352   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
353   - int beginDay = beginTime.get(Calendar.DAY_OF_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);
354 358 month = String.format("%02d", (beginMonth));
355 359 day = String.format("%02d", (beginDay));
356   - for (int j = 0; j < totaltimestampCount; j++) {
  360 + for (int j = 0; j <= totaltimestampCount; j++) {
357 361 String hour = String.format("%02d", (j));
358   - xAxisData.add(year+"-"+month + "-" + day + " " + hour);
  362 + xAxisData.add(year + "-" + month + "-" + day + " " + hour);
359 363 }
360 364 }
361   - dateType="yyyy-MM-dd HH";
362   - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio);
  365 + dateType = "yyyy-MM-dd HH";
  366 + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio);
363 367 return new BizResultVO<LineChartVO>().setData(freeBerthRatios);
364 368 } else {
365 369 // 1天为一个时间戳
366 370 request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY);
367   - for (int i = 0; i < dayDifference.intValue(); i++) {
368   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
369   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
370   - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);
  371 + for (int i = 0; i <= dayDifference.intValue(); i++) {
  372 + Calendar tempDate = Calendar.getInstance();
  373 + tempDate.setTime(request.getBeginTime());
  374 + tempDate.add(Calendar.DAY_OF_MONTH, i);
  375 + int beginMonth = tempDate.get(Calendar.MONTH) + 1;
  376 + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH);
371 377 String month = String.format("%02d", (beginMonth));
372 378 String day = String.format("%02d", (beginDay));
373   - xAxisData.add(year+"-"+month + "-" + day);
  379 + xAxisData.add(year + "-" + month + "-" + day);
  380 +
374 381 }
375   - dateType="yyyy-MM-dd";
376   - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio);
  382 + dateType = "yyyy-MM-dd";
  383 + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio);
377 384 return new BizResultVO<LineChartVO>().setData(freeBerthRatios);
378 385 }
379 386  
380 387 }
381   -
382   -
383   - private LineChartVO getFreeBerthRatios(ParkingLotUseStatisticForPageRequest request,
384   - List<String> xAxisData,String dateType ,int berthRatio){
  388 +
  389 + private LineChartVO getFreeBerthRatios(ParkingLotUseStatisticForPageRequest request, List<String> xAxisData,
  390 + String dateType, int berthRatio) {
385 391 logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request));
386 392 BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService
387 393 .queryParkingLotUseStatisticForPage(request);
... ... @@ -403,33 +409,33 @@ public class BerthsStatisticController extends BizController {
403 409 // 保存空置率
404 410 if (!parkLotMap.containsKey(key)) {
405 411 Map<String, Double> timeAndVal = Maps.newHashMap();
406   - if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio){
  412 + if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio) {
407 413 timeAndVal.put(statisBeginTime, statisticDTO.getFreeRatio() * 100);
408 414 parkLotMap.put(key, timeAndVal);
409   - }else if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio){
  415 + } else if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio) {
410 416 timeAndVal.put(statisBeginTime, statisticDTO.getTurnoverRatio() * 100);
411 417 parkLotMap.put(key, timeAndVal);
412 418 }
413 419 } else {
414   - if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio){
  420 + if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio) {
415 421 parkLotMap.get(key).put(statisBeginTime, statisticDTO.getFreeRatio() * 100);
416   - }else if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio){
  422 + } else if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio) {
417 423 parkLotMap.get(key).put(statisBeginTime, statisticDTO.getTurnoverRatio() * 100);
418 424 }
419 425 }
420 426  
421 427 }
422 428 }
423   - //判断是否包含所有待查询的停车场信息
424   - if(request.getPlNos().size()>parkLotMap.size()){
425   - for (String plNo:request.getPlNos()) {
426   - if(!parkLotMap.containsKey(plNo)){
427   - ParkingLotDTO parkingLotDTO=ParkingLotCacheUtil.getParkLotByPlNo(plNo);
428   - parkNameMap.put(plNo, parkingLotDTO.getPlName());
429   - parkLotMap.put(plNo, Maps.newHashMap());
430   - }
431   - }
432   - }
  429 + // 判断是否包含所有待查询的停车场信息
  430 + if (request.getPlNos().size() > parkLotMap.size()) {
  431 + for (String plNo : request.getPlNos()) {
  432 + if (!parkLotMap.containsKey(plNo)) {
  433 + ParkingLotDTO parkingLotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo);
  434 + parkNameMap.put(plNo, parkingLotDTO.getPlName());
  435 + parkLotMap.put(plNo, Maps.newHashMap());
  436 + }
  437 + }
  438 + }
433 439  
434 440 // 封装车位统计信息
435 441 LineChartVO freeBerthRatios = new LineChartVO();
... ... @@ -453,7 +459,7 @@ public class BerthsStatisticController extends BizController {
453 459 for (String timestamp : xAxisData) {
454 460 if (freeRatioMaps.containsKey(timestamp)) {
455 461 lastFreeRatio = freeRatioMaps.get(timestamp).intValue();
456   - }else{
  462 + } else {
457 463 lastFreeRatio = 0;
458 464 }
459 465 freeRations.add(lastFreeRatio);
... ...
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java
... ... @@ -10,14 +10,12 @@ import java.util.Map;
10 10  
11 11 import javax.servlet.http.HttpServletRequest;
12 12 import javax.servlet.http.HttpServletResponse;
13   -import javax.servlet.http.HttpSession;
14 13  
15 14 import org.apache.poi.xssf.usermodel.XSSFSheet;
16 15 import org.slf4j.Logger;
17 16 import org.slf4j.LoggerFactory;
18 17 import org.springframework.beans.factory.annotation.Autowired;
19 18 import org.springframework.beans.factory.annotation.Value;
20   -import org.springframework.security.config.authentication.UserServiceBeanDefinitionParser;
21 19 import org.springframework.stereotype.Controller;
22 20 import org.springframework.web.bind.annotation.GetMapping;
23 21 import org.springframework.web.bind.annotation.PostMapping;
... ... @@ -25,20 +23,15 @@ import org.springframework.web.bind.annotation.RequestBody;
25 23 import org.springframework.web.bind.annotation.RequestMapping;
26 24 import org.springframework.web.bind.annotation.RequestParam;
27 25 import org.springframework.web.bind.annotation.ResponseBody;
28   -import org.springframework.web.bind.annotation.RestController;
29 26  
30 27 import com.alibaba.dubbo.common.utils.CollectionUtils;
31   -import com.alibaba.dubbo.common.utils.StringUtils;
32 28 import com.alibaba.fastjson.JSON;
33   -import com.clouds.common.entity.UserInfo;
34   -import com.clouds.common.utils.AmountUtils;
35 29 import com.clouds.common.utils.DateUtil;
36 30 import com.clouds.common.utils.ResultUtils;
37 31 import com.clouds.common.utils.excle.ExcelUtil;
38 32 import com.clouds.common.utils.excle.ExcleFillDateManager;
39 33 import com.clouds.common.utils.excle.Layouter;
40 34 import com.clouds.common.web.BizController;
41   -import com.clouds.common.web.SessionCommUtil;
42 35 import com.clouds.common.web.vo.BizResultVO;
43 36 import com.clouds.common.web.vo.EasyUIDataGridVO;
44 37 import com.google.common.collect.Lists;
... ... @@ -48,16 +41,13 @@ import com.zteits.clouds.api.apibase.bean.BizResult;
48 41 import com.zteits.clouds.api.apibase.bean.PageBean;
49 42 import com.zteits.clouds.api.apibase.constants.ErrorType;
50 43 import com.zteits.clouds.api.apibase.exception.BizException;
51   -import com.zteits.clouds.api.dto.clouds.dto.BillManageDTO;
52 44 import com.zteits.clouds.api.dto.park.dto.InOutParkDTO;
53 45 import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO;
54 46 import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticSumDTO;
55 47 import com.zteits.clouds.api.dto.park.param.InOutParkRequest;
56 48 import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest;
57   -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest;
58 49 import com.zteits.clouds.api.service.clouds.InOutParkStatisticService;
59 50 import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService;
60   -import com.zteits.clouds.api.service.pay.TdCustCompanyService;
61 51 import com.zteits.irain.portal.constant.ParkConstant;
62 52 import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO;
63 53 import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO;
... ... @@ -125,6 +115,7 @@ public class InOutParkStatisticController extends BizController {
125 115  
126 116 Calendar beginTime = Calendar.getInstance();
127 117 beginTime.setTime(request.getBeginTime());
  118 + int year = beginTime.get(Calendar.YEAR);
128 119  
129 120 Calendar endTime = Calendar.getInstance();
130 121 endTime.setTime(request.getEndTime());
... ... @@ -137,56 +128,95 @@ public class InOutParkStatisticController extends BizController {
137 128 if (dayDifference == 0L) {
138 129 //同一天
139 130 // 20分钟为一个时间戳
140   - UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE);
141   - int totaltimestampCount = (endTime.get(Calendar.HOUR_OF_DAY)-beginTime.get(Calendar.HOUR_OF_DAY))*3;
142   - for (int i = 0; i < totaltimestampCount; i++) {
143   - int hour1 = beginTime.get(Calendar.HOUR_OF_DAY)+i/3;
144   - String hour = String.format("%02d", hour1);
145   - String minute = String.format("%02d", (i % 3) * 20);
146   - xAxisData.add(hour + ":" + minute);
147   - }
148   - dateType="HH:mm";
  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";
149 146 LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType);
150 147 return new BizResultVO<LineChartVO>().setData(vehicleFlows);
151 148  
152 149 } else if (dayDifference <= 3L) {
153 150 // 1小时为一个时间戳
154 151 UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);
155   - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY);
156   - String day = "";
157   - String month = "";
158   - for (int i = 0; i < dayDifference.intValue(); i++) {
159   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
160   - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);
161   - month = String.format("%02d", (beginMonth));
162   - day = String.format("%02d", (beginDay));
163   - int endDay = endTime.get(Calendar.DAY_OF_MONTH);
164   - if(beginDay != endDay){
165   - totaltimestampCount = 24;
166   - }
167   - for (int j = 0; j < totaltimestampCount; j++) {
168   - String hour = String.format("%02d", (j));
169   - xAxisData.add(month + "-" + day + " " + hour);
170   - }
171   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
172   - }
173   - dateType="MM-dd HH";
  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";
174 191 LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType);
175 192 return new BizResultVO<LineChartVO>().setData(vehicleFlows);
176 193  
177 194 } else {
178 195 // 1天为一个时间戳
179 196 UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY);
180   - for (int i = 0; i < dayDifference.intValue()+1; i++) {
181   - int beginMonth = beginTime.get(Calendar.MONTH) + 1;
182   - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);
183   - String month = String.format("%02d", (beginMonth));
184   - String day = String.format("%02d", (beginDay));
185   - xAxisData.add(month + "-" + day);
186   - beginTime.add(Calendar.DAY_OF_MONTH, 1);
  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);
187 206  
188   - }
189   - dateType="MM-dd";
  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";
190 220 LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType);
191 221 return new BizResultVO<LineChartVO>().setData(vehicleFlows);
192 222  
... ...
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java
... ... @@ -14,13 +14,11 @@ import javax.servlet.http.HttpSession;
14 14  
15 15 import com.alibaba.dubbo.common.utils.CollectionUtils;
16 16 import com.alibaba.dubbo.common.utils.StringUtils;
17   -import com.alibaba.fastjson.JSONArray;
18 17 import com.alibaba.fastjson.JSONObject;
19 18  
20 19 import com.clouds.common.entity.UserInfo;
21 20 import com.clouds.common.utils.AmountUtils;
22 21 import com.clouds.common.utils.DateUtil;
23   -import com.clouds.common.utils.ResultUtils;
24 22 import com.clouds.common.utils.excle.ExcelUtil;
25 23 import com.clouds.common.utils.excle.ExcleFillDateManager;
26 24 import com.clouds.common.utils.excle.Layouter;
... ... @@ -42,7 +40,6 @@ import com.zteits.clouds.api.dto.clouds.dto.MonthBillSummaryStatisticDTO;
42 40 import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticDTO;
43 41 import com.zteits.clouds.api.dto.clouds.param.BillQueryRequest;
44 42 import com.zteits.clouds.api.dto.clouds.param.MonthBillRequest;
45   -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest;
46 43 import com.zteits.clouds.api.dto.pay.param.YearMonthCardStatisticRequest;
47 44 import com.zteits.clouds.api.service.clouds.MonthBillManagementService;
48 45 import com.zteits.clouds.api.service.clouds.YearMonthCardStatisticService;
... ... @@ -76,11 +73,6 @@ public class MonthBillManagementController extends BizController {
76 73 private MonthBillManagementService monthBillManagementService;
77 74 @Autowired
78 75 private YearMonthCardStatisticService yearMonthCardStatisticService;
79   -
80   - @Autowired
81   - private TdCustCompanyService tdCustCompanyService;
82   - @Autowired
83   - private HttpSession session;
84 76 @Autowired
85 77 private SessionCommUtil sessionCommUtil;
86 78 @Value("${project.syscode}")
... ... @@ -180,18 +172,20 @@ public class MonthBillManagementController extends BizController {
180 172 public BizResultVO<EasyUIDataGridVO<BillManageForMonthDTO>> queryBillforMonthList(
181 173 @RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, HttpServletResponse response)
182 174 throws Exception {
183   - // 2.调用接口查询当前登录人管辖的停车场名称
  175 + // 2.调用接口查询当前登录人管辖的停车场名称
184 176 UserInfo userInfo = sessionCommUtil.getUserInfo();
185   - List<String> plNos = new ArrayList<>();
186   - if (userInfo != null) {
187   - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
188   - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
189   - tdCompanyParkQueryRequest.setSessionId(session.getId());
190   - tdCompanyParkQueryRequest.setSysCode(sysCode);
191   - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);
192   - // 拥有的停车场编号
193   - plNos = ResultUtils.getBizResultData(bizResult);
194   - }
  177 + List<String> plNos = userInfo.getOrgIds();
  178 +// UserInfo userInfo = sessionCommUtil.getUserInfo();
  179 +// List<String> plNos = new ArrayList<>();
  180 +// if (userInfo != null) {
  181 +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
  182 +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
  183 +// tdCompanyParkQueryRequest.setSessionId(session.getId());
  184 +// tdCompanyParkQueryRequest.setSysCode(sysCode);
  185 +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);
  186 +// // 拥有的停车场编号
  187 +// plNos = ResultUtils.getBizResultData(bizResult);
  188 +// }
195 189 // if (CollectionUtils.isEmpty(plNos)) {
196 190 // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在");
197 191 // }
... ... @@ -215,16 +209,17 @@ public class MonthBillManagementController extends BizController {
215 209 throws Exception {
216 210 // 2.调用接口查询当前登录人管辖的停车场名称
217 211 UserInfo userInfo = sessionCommUtil.getUserInfo();
218   - List<String> plNos = new ArrayList<>();
219   - if (userInfo != null) {
220   - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
221   - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
222   - tdCompanyParkQueryRequest.setSessionId(session.getId());
223   - tdCompanyParkQueryRequest.setSysCode(sysCode);
224   - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);
225   - // 拥有的停车场编号
226   - plNos = ResultUtils.getBizResultData(bizResult);
227   - }
  212 + List<String> plNos = userInfo.getOrgIds();
  213 +// List<String> plNos = new ArrayList<>();
  214 +// if (userInfo != null) {
  215 +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
  216 +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
  217 +// tdCompanyParkQueryRequest.setSessionId(session.getId());
  218 +// tdCompanyParkQueryRequest.setSysCode(sysCode);
  219 +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);
  220 +// // 拥有的停车场编号
  221 +// plNos = ResultUtils.getBizResultData(bizResult);
  222 +// }
228 223 // if (CollectionUtils.isEmpty(plNos)) {
229 224 // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在");
230 225 // }
... ... @@ -456,17 +451,20 @@ public class MonthBillManagementController extends BizController {
456 451 billQueryRequest.setBaseRequest(new BaseInfo(1, 0));
457 452 // 2.调用接口查询当前登录人管辖的停车场名称
458 453 UserInfo userInfo = sessionCommUtil.getUserInfo();
459   - List<String> plNos = new ArrayList<>();
460   - if (userInfo != null) {
461   - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
462   - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
463   - tdCompanyParkQueryRequest.setSessionId(session.getId());
464   - tdCompanyParkQueryRequest.setSysCode(sysCode);
465   - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(
466   - tdCompanyParkQueryRequest);
467   - // 拥有的停车场编号
468   - plNos = ResultUtils.getBizResultData(bizResult);
469   - }
  454 + List<String> plNos = userInfo.getOrgIds();
  455 +// // 2.调用接口查询当前登录人管辖的停车场名称
  456 +// UserInfo userInfo = sessionCommUtil.getUserInfo();
  457 +// List<String> plNos = new ArrayList<>();
  458 +// if (userInfo != null) {
  459 +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
  460 +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
  461 +// tdCompanyParkQueryRequest.setSessionId(session.getId());
  462 +// tdCompanyParkQueryRequest.setSysCode(sysCode);
  463 +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(
  464 +// tdCompanyParkQueryRequest);
  465 +// // 拥有的停车场编号
  466 +// plNos = ResultUtils.getBizResultData(bizResult);
  467 +// }
470 468 billQueryRequest.setParkIdList(plNos);
471 469 logger.info("月账单导出所有 req={}", JSONObject.toJSONString(billQueryRequest));
472 470 respondResult = monthBillManagementService
... ... @@ -549,17 +547,17 @@ public class MonthBillManagementController extends BizController {
549 547 * @return
550 548 * @throws Exception
551 549 */
552   - private List<String> queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws Exception {
553   - /** 查询停车场编码. */
554   - BizResult<List<String>> parkNoResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);
555   - if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) {
556   - logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData()));
557   - return parkNoResult.getData();
558   - } else {
559   - logger.info("根据登录用户没有获取到对应的停车场编码");
560   - return null;
561   - }
562   -
563   - }
  550 +// private List<String> queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws Exception {
  551 +// /** 查询停车场编码. */
  552 +// BizResult<List<String>> parkNoResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);
  553 +// if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) {
  554 +// logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData()));
  555 +// return parkNoResult.getData();
  556 +// } else {
  557 +// logger.info("根据登录用户没有获取到对应的停车场编码");
  558 +// return null;
  559 +// }
  560 +//
  561 +// }
564 562  
565 563 }
566 564 \ No newline at end of file
... ...
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java
... ... @@ -112,21 +112,24 @@ public class ParkLotStatisticController {
112 112  
113 113 private List<String> GetParkLotNosByCurrUser(String sysCode) throws Exception {
114 114 logger.info("根据登录人权限获取停车场列表");
115   - List<String> plNos = Lists.newArrayList();
116   - //2.调用接口查询当前登录人管辖的停车场名称
117 115 /*plNos.add("A320211000");
118 116 plNos.add("B1504020C7");*/
119   - UserInfo userInfo = sessionCommUtil.getUserInfo();
120   - if(userInfo!=null){
121   - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
122   - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
123   - tdCompanyParkQueryRequest.setSysCode(sysCode);
124   - tdCompanyParkQueryRequest.setSessionId(session.getId());
125   - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest );
126   - plNos = ResultUtils.getBizResultData(bizResult);
127   - }else{
128   - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS);
129   - }
  117 + // 2.调用接口查询当前登录人管辖的停车场名称
  118 + UserInfo userInfo = sessionCommUtil.getUserInfo();
  119 + List<String> plNos = userInfo.getOrgIds();
  120 +// if(userInfo!=null){
  121 +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
  122 +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
  123 +// tdCompanyParkQueryRequest.setSysCode(sysCode);
  124 +// tdCompanyParkQueryRequest.setSessionId(session.getId());
  125 +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest );
  126 +// plNos = ResultUtils.getBizResultData(bizResult);
  127 +// }else{
  128 +// throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS);
  129 +// }
  130 + if(CollectionUtils.isEmpty(plNos)){
  131 + throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS);
  132 + }
130 133 return plNos;
131 134 }
132 135 }
... ...
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java
... ... @@ -10,7 +10,6 @@ import java.util.Map;
10 10  
11 11 import javax.servlet.http.HttpServletRequest;
12 12 import javax.servlet.http.HttpServletResponse;
13   -import javax.servlet.http.HttpSession;
14 13  
15 14 import com.alibaba.dubbo.common.utils.CollectionUtils;
16 15 import com.alibaba.fastjson.JSON;
... ... @@ -37,7 +36,6 @@ import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO;
37 36 import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO;
38 37 import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest;
39 38 import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService;
40   -import com.zteits.clouds.api.service.pay.TdCustCompanyService;
41 39 import com.zteits.irain.portal.constant.ParkConstant;
42 40 import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO;
43 41 import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO;
... ... @@ -79,11 +77,7 @@ public class VehicleFlowStatisticController extends BizController {
79 77 @Autowired
80 78 private ParkingLotUseStatisticService parkingLotStatisticService;
81 79 @Autowired
82   - private HttpSession session;
83   - @Autowired
84 80 private SessionCommUtil sessionCommUtil;
85   - @Autowired
86   - private TdCustCompanyService tdCustCompanyService;
87 81  
88 82 @ApiOperation("分页查询车流量数据统计车位总流量")
89 83 @PostMapping("getVehicleFlowStatisticForPage")
... ... @@ -229,9 +223,9 @@ public class VehicleFlowStatisticController extends BizController {
229 223 // 2.调用接口查询当前登录人管辖的停车场名称
230 224 UserInfo userInfo = sessionCommUtil.getUserInfo();
231 225 List<String> plNos = userInfo.getOrgIds();
232   - if (CollectionUtils.isEmpty(plNos)) {
233   - throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在");
234   - }
  226 +// if (CollectionUtils.isEmpty(plNos)) {
  227 +// throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在");
  228 +// }
235 229 request.setPlNos(plNos);
236 230  
237 231 logger.info("根据停车场编号获取该停车场今日车流量和车位折线图");
... ... @@ -258,7 +252,7 @@ public class VehicleFlowStatisticController extends BizController {
258 252 int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);
259 253 month = String.format("%02d", (beginMonth));
260 254 day = String.format("%02d", (beginDay));
261   - for (int j = 0; j < totaltimestampCount; j++) {
  255 + for (int j = 0; j <= totaltimestampCount; j++) {
262 256 String hour = String.format("%02d", (j));
263 257 xAxisData.add(year + "-" + month + "-" + day + " " + hour);
264 258 }
... ... @@ -281,7 +275,7 @@ public class VehicleFlowStatisticController extends BizController {
281 275 int beginDay = tempDate.get(Calendar.DAY_OF_MONTH);
282 276 month = String.format("%02d", (beginMonth));
283 277 day = String.format("%02d", (beginDay));
284   - for (int j = 0; j < totaltimestampCount; j++) {
  278 + for (int j = 0; j <= totaltimestampCount; j++) {
285 279 String hour = String.format("%02d", (j));
286 280 xAxisData.add(year + "-" + month + "-" + day + " " + hour);
287 281 }
... ...