Commit 1dc4e716211323fafc9add38d92d07ca5fcfb267

Authored by zhaowg3
2 parents bc8128d0 44191240

Merge remote-tracking branch 'origin/branch0905'

.gitignore
@@ -98,3 +98,5 @@ local.properties @@ -98,3 +98,5 @@ local.properties
98 .worksheet 98 .worksheet
99 .idea 99 .idea
100 *.iml 100 *.iml
  101 +/logging.path_IS_UNDEFINEDlogging.file_IS_UNDEFINED-2017-08-18.0.log
  102 +/logging.path_IS_UNDEFINEDlogging.file_IS_UNDEFINED-2017-08-28.0.log
src/main/java/com/zteits/irain/portal/ParkPortalApplication.java
@@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication; @@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication;
6 import org.springframework.boot.autoconfigure.SpringBootApplication; 6 import org.springframework.boot.autoconfigure.SpringBootApplication;
7 import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; 7 import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
8 import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; 8 import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
  9 +import org.springframework.boot.web.servlet.ServletComponentScan;
9 import org.springframework.context.annotation.Bean; 10 import org.springframework.context.annotation.Bean;
10 import org.springframework.context.annotation.ComponentScan; 11 import org.springframework.context.annotation.ComponentScan;
11 import org.springframework.context.annotation.EnableAspectJAutoProxy; 12 import org.springframework.context.annotation.EnableAspectJAutoProxy;
src/main/java/com/zteits/irain/portal/config/RedisMsgListenerContainer.java
1 -package com.zteits.irain.portal.config; 1 +/*package com.zteits.irain.portal.config;
2 2
3 import org.springframework.context.annotation.Bean; 3 import org.springframework.context.annotation.Bean;
4 import org.springframework.context.annotation.Configuration; 4 import org.springframework.context.annotation.Configuration;
@@ -9,7 +9,7 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer; @@ -9,7 +9,7 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer;
9 import com.clouds.common.constants.RedisKeyEnum; 9 import com.clouds.common.constants.RedisKeyEnum;
10 import com.zteits.irain.portal.config.listener.FreeBrethsListener; 10 import com.zteits.irain.portal.config.listener.FreeBrethsListener;
11 11
12 -/** 12 +*//**
13 * redis 消息队列监听容器 13 * redis 消息队列监听容器
14 * 14 *
15 * Copyright: Copyright (c) 2017 zteits 15 * Copyright: Copyright (c) 2017 zteits
@@ -23,17 +23,17 @@ import com.zteits.irain.portal.config.listener.FreeBrethsListener; @@ -23,17 +23,17 @@ import com.zteits.irain.portal.config.listener.FreeBrethsListener;
23 * Date Author Version Description 23 * Date Author Version Description
24 *---------------------------------------------------------* 24 *---------------------------------------------------------*
25 * 2017年6月7日 zhaowg v1.0.0 创建 25 * 2017年6月7日 zhaowg v1.0.0 创建
26 - */ 26 + *//*
27 @Configuration 27 @Configuration
28 public class RedisMsgListenerContainer { 28 public class RedisMsgListenerContainer {
29 29
30 - /** 30 + *//**
31 * 空闲车位监听容器 31 * 空闲车位监听容器
32 * @param connectionFactory 32 * @param connectionFactory
33 * @param brethsListener 33 * @param brethsListener
34 * @return 34 * @return
35 * 2017年6月7日 zhaowg 35 * 2017年6月7日 zhaowg
36 - */ 36 + *//*
37 @Bean 37 @Bean
38 RedisMessageListenerContainer freeBrethscontainer(RedisConnectionFactory connectionFactory,FreeBrethsListener brethsListener) { 38 RedisMessageListenerContainer freeBrethscontainer(RedisConnectionFactory connectionFactory,FreeBrethsListener brethsListener) {
39 RedisMessageListenerContainer container = new RedisMessageListenerContainer(); 39 RedisMessageListenerContainer container = new RedisMessageListenerContainer();
@@ -42,3 +42,4 @@ public class RedisMsgListenerContainer { @@ -42,3 +42,4 @@ public class RedisMsgListenerContainer {
42 return container; 42 return container;
43 } 43 }
44 } 44 }
  45 +*/
45 \ No newline at end of file 46 \ No newline at end of file
src/main/java/com/zteits/irain/portal/config/listener/FreeBrethsListener.java
1 -package com.zteits.irain.portal.config.listener; 1 +/*package com.zteits.irain.portal.config.listener;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
@@ -20,7 +20,7 @@ import com.zteits.irain.portal.service.interfaces.induction.InductionService; @@ -20,7 +20,7 @@ import com.zteits.irain.portal.service.interfaces.induction.InductionService;
20 import com.zteits.irain.portal.service.interfaces.induction.param.DoLevelTwoAndThreeInductionReleaseBatchRequest; 20 import com.zteits.irain.portal.service.interfaces.induction.param.DoLevelTwoAndThreeInductionReleaseBatchRequest;
21 import com.zteits.irain.portal.service.interfaces.induction.param.InductionRelease; 21 import com.zteits.irain.portal.service.interfaces.induction.param.InductionRelease;
22 22
23 -/** 23 +*//**
24 * 空闲车位监听器<br> 24 * 空闲车位监听器<br>
25 * 25 *
26 * Copyright: Copyright (c) 2017 zteits 26 * Copyright: Copyright (c) 2017 zteits
@@ -34,7 +34,7 @@ import com.zteits.irain.portal.service.interfaces.induction.param.InductionRelea @@ -34,7 +34,7 @@ import com.zteits.irain.portal.service.interfaces.induction.param.InductionRelea
34 * Date Author Version Description 34 * Date Author Version Description
35 *---------------------------------------------------------* 35 *---------------------------------------------------------*
36 * 2017年6月7日 zhaowg v1.0.0 创建 36 * 2017年6月7日 zhaowg v1.0.0 创建
37 - */ 37 + *//*
38 @Component 38 @Component
39 public class FreeBrethsListener implements MessageListener{ 39 public class FreeBrethsListener implements MessageListener{
40 private static final Logger logger = LoggerFactory.getLogger(FreeBrethsListener.class); 40 private static final Logger logger = LoggerFactory.getLogger(FreeBrethsListener.class);
@@ -65,3 +65,4 @@ public class FreeBrethsListener implements MessageListener{ @@ -65,3 +65,4 @@ public class FreeBrethsListener implements MessageListener{
65 inductionService.doLevelTwoAndThreeInductionReleaseBatch(releaseBatchRequest); 65 inductionService.doLevelTwoAndThreeInductionReleaseBatch(releaseBatchRequest);
66 } 66 }
67 } 67 }
  68 +*/
68 \ No newline at end of file 69 \ No newline at end of file
src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingDeviceVO.java 0 → 100644
  1 +package com.zteits.irain.portal.vo.govclouds;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +public class ParkingDeviceVO implements Serializable {
  6 +
  7 + /**
  8 + *
  9 + */
  10 + private static final long serialVersionUID = 1L;
  11 + /**早先数量*/
  12 + private Integer onlineCount;
  13 + /**总量*/
  14 + private Integer allCount;
  15 + /**类型*/
  16 + private Integer type;
  17 +
  18 + public Integer getOnlineCount() {
  19 + return onlineCount;
  20 + }
  21 + public void setOnlineCount(Integer onlineCount) {
  22 + this.onlineCount = onlineCount;
  23 + }
  24 + public Integer getAllCount() {
  25 + return allCount;
  26 + }
  27 + public void setAllCount(Integer allCount) {
  28 + this.allCount = allCount;
  29 + }
  30 + public Integer getType() {
  31 + return type;
  32 + }
  33 + public void setType(Integer type) {
  34 + this.type = type;
  35 + }
  36 +
  37 +}
src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingStatisVO.java 0 → 100644
  1 +package com.zteits.irain.portal.vo.govclouds;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.List;
  5 +
  6 +import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO;
  7 +
  8 +public class ParkingStatisVO implements Serializable{
  9 +
  10 + /**
  11 + *
  12 + */
  13 + private static final long serialVersionUID = 1L;
  14 +
  15 +
  16 + private List<ParkingLotUseStatisticDTO> statisList;
  17 + /**占用率**/
  18 + private Double avgOccupyRate;
  19 + /**周转率*/
  20 + private Double avgTurnoverRate;
  21 + /**空闲车位*/
  22 + private Integer freeParkingSpace;
  23 + /**停车场设备信息**/
  24 + private List<ParkingDeviceVO> deviceVoList;
  25 +
  26 +
  27 + public Integer getFreeParkingSpace() {
  28 + return freeParkingSpace;
  29 + }
  30 + public void setFreeParkingSpace(Integer freeParkingSpace) {
  31 + this.freeParkingSpace = freeParkingSpace;
  32 + }
  33 + public List<ParkingDeviceVO> getDeviceVoList() {
  34 + return deviceVoList;
  35 + }
  36 + public void setDeviceVoList(List<ParkingDeviceVO> deviceVoList) {
  37 + this.deviceVoList = deviceVoList;
  38 + }
  39 + public List<ParkingLotUseStatisticDTO> getStatisList() {
  40 + return statisList;
  41 + }
  42 + public void setStatisList(List<ParkingLotUseStatisticDTO> statisList) {
  43 + this.statisList = statisList;
  44 + }
  45 + public Double getAvgOccupyRate() {
  46 + return avgOccupyRate;
  47 + }
  48 + public void setAvgOccupyRate(Double avgOccupyRate) {
  49 + this.avgOccupyRate = avgOccupyRate;
  50 + }
  51 + public Double getAvgTurnoverRate() {
  52 + return avgTurnoverRate;
  53 + }
  54 + public void setAvgTurnoverRate(Double avgTurnoverRate) {
  55 + this.avgTurnoverRate = avgTurnoverRate;
  56 + }
  57 +
  58 +}
src/main/java/com/zteits/irain/portal/vo/parkinglotdatacenter/ParkLotAndBerthsCountVO.java
@@ -24,6 +24,11 @@ public class ParkLotAndBerthsCountVO { @@ -24,6 +24,11 @@ public class ParkLotAndBerthsCountVO {
24 private Map<String,Integer> pkberthsCount; 24 private Map<String,Integer> pkberthsCount;
25 //key:区县名称,value:停车场数 25 //key:区县名称,value:停车场数
26 private Map<String,Integer> pkCount; 26 private Map<String,Integer> pkCount;
  27 + //key:区县名称,value:map{key:plType,停车场类型,value :车位数 }
  28 + private Map<String,Object> pkberthsCountMap;
  29 + //key:区县名称,value:map{key:plType,停车场类型,value :停车场数 }
  30 + private Map<String,Object> pkCountMap;
  31 +
27 public Map<String, Integer> getPkberthsCount() { 32 public Map<String, Integer> getPkberthsCount() {
28 return pkberthsCount; 33 return pkberthsCount;
29 } 34 }
@@ -36,6 +41,18 @@ public class ParkLotAndBerthsCountVO { @@ -36,6 +41,18 @@ public class ParkLotAndBerthsCountVO {
36 public void setPkCount(Map<String, Integer> pkCount) { 41 public void setPkCount(Map<String, Integer> pkCount) {
37 this.pkCount = pkCount; 42 this.pkCount = pkCount;
38 } 43 }
  44 + public Map<String, Object> getPkberthsCountMap() {
  45 + return pkberthsCountMap;
  46 + }
  47 + public void setPkberthsCountMap(Map<String, Object> pkberthsCountMap) {
  48 + this.pkberthsCountMap = pkberthsCountMap;
  49 + }
  50 + public Map<String, Object> getPkCountMap() {
  51 + return pkCountMap;
  52 + }
  53 + public void setPkCountMap(Map<String, Object> pkCountMap) {
  54 + this.pkCountMap = pkCountMap;
  55 + }
39 56
40 57
41 } 58 }
src/main/java/com/zteits/irain/portal/web/govclouds/DataGeneralizeController.java
1 package com.zteits.irain.portal.web.govclouds; 1 package com.zteits.irain.portal.web.govclouds;
  2 +import java.math.BigDecimal;
2 import java.util.ArrayList; 3 import java.util.ArrayList;
  4 +import java.util.Calendar;
  5 +import java.util.Date;
3 import java.util.HashMap; 6 import java.util.HashMap;
4 import java.util.List; 7 import java.util.List;
5 import java.util.Map; 8 import java.util.Map;
@@ -7,6 +10,7 @@ import java.util.Map.Entry; @@ -7,6 +10,7 @@ import java.util.Map.Entry;
7 10
8 import org.slf4j.Logger; 11 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 12 import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.BeanUtils;
10 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.beans.factory.annotation.Value; 15 import org.springframework.beans.factory.annotation.Value;
12 import org.springframework.web.bind.annotation.PostMapping; 16 import org.springframework.web.bind.annotation.PostMapping;
@@ -27,17 +31,29 @@ import com.google.common.collect.Maps; @@ -27,17 +31,29 @@ import com.google.common.collect.Maps;
27 import com.zteits.clouds.api.apibase.bean.BizResult; 31 import com.zteits.clouds.api.apibase.bean.BizResult;
28 import com.zteits.clouds.api.apibase.constants.ErrorType; 32 import com.zteits.clouds.api.apibase.constants.ErrorType;
29 import com.zteits.clouds.api.apibase.exception.BizException; 33 import com.zteits.clouds.api.apibase.exception.BizException;
  34 +import com.zteits.clouds.api.dto.clouds.dto.OrderTransDTO;
  35 +import com.zteits.clouds.api.dto.clouds.param.OrderTransactionQueryRequest;
30 import com.zteits.clouds.api.dto.govclouds.ParkTransactionDTO; 36 import com.zteits.clouds.api.dto.govclouds.ParkTransactionDTO;
  37 +import com.zteits.clouds.api.dto.govclouds.dto.ParkEqpAndPDACountDTO;
  38 +import com.zteits.clouds.api.dto.govclouds.dto.ParkingOccupyDTO;
  39 +import com.zteits.clouds.api.dto.govclouds.param.QueryParkEqpAndPDACountRequest;
  40 +import com.zteits.clouds.api.dto.govclouds.param.QueryParkingOccupyRequest;
31 import com.zteits.clouds.api.dto.park.dto.ParkFreeBerthsCountStatisticByCountryDTO; 41 import com.zteits.clouds.api.dto.park.dto.ParkFreeBerthsCountStatisticByCountryDTO;
32 import com.zteits.clouds.api.dto.park.dto.ParkLotCountStatisticByCountryDTO; 42 import com.zteits.clouds.api.dto.park.dto.ParkLotCountStatisticByCountryDTO;
33 import com.zteits.clouds.api.dto.park.dto.ParkLotEqpTypeCountStatisticByCountryDTO; 43 import com.zteits.clouds.api.dto.park.dto.ParkLotEqpTypeCountStatisticByCountryDTO;
34 import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; 44 import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO;
35 import com.zteits.clouds.api.dto.park.param.ParkTransactionRequest; 45 import com.zteits.clouds.api.dto.park.param.ParkTransactionRequest;
36 import com.zteits.clouds.api.dto.park.param.StatisticParkLotCountByCountryRequest; 46 import com.zteits.clouds.api.dto.park.param.StatisticParkLotCountByCountryRequest;
  47 +import com.zteits.clouds.api.dto.pay.ParkingFlowCountDTO;
  48 +import com.zteits.clouds.api.dto.pay.param.QueryTodayFlowRequest;
  49 +import com.zteits.clouds.api.service.govclouds.ParkOccupyService;
37 import com.zteits.clouds.api.service.govclouds.ParkTransactionService; 50 import com.zteits.clouds.api.service.govclouds.ParkTransactionService;
38 import com.zteits.clouds.api.service.park.ParkFreeBerthService; 51 import com.zteits.clouds.api.service.park.ParkFreeBerthService;
39 import com.zteits.clouds.api.service.park.ParkingLotEqpService; 52 import com.zteits.clouds.api.service.park.ParkingLotEqpService;
40 import com.zteits.clouds.api.service.park.ParkingLotQueryService; 53 import com.zteits.clouds.api.service.park.ParkingLotQueryService;
  54 +import com.zteits.clouds.api.service.park.TpPPdaService;
  55 +import com.zteits.clouds.api.service.pay.TdBOrderService;
  56 +import com.zteits.irain.portal.constant.ParkConstant;
41 import com.zteits.irain.portal.vo.govclouds.StatisticParkLotEqpCountByCountryVO; 57 import com.zteits.irain.portal.vo.govclouds.StatisticParkLotEqpCountByCountryVO;
42 import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO; 58 import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO;
43 import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO.BerthSeriesVO; 59 import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO.BerthSeriesVO;
@@ -77,6 +93,13 @@ public class DataGeneralizeController { @@ -77,6 +93,13 @@ public class DataGeneralizeController {
77 private ParkFreeBerthService parkFreeBerthService; 93 private ParkFreeBerthService parkFreeBerthService;
78 @Autowired 94 @Autowired
79 private ParkTransactionService parkTransactionService; 95 private ParkTransactionService parkTransactionService;
  96 + @Autowired
  97 + private TpPPdaService tpPPdaService;
  98 + @Autowired
  99 + private TdBOrderService tdBOrderService;
  100 + @Autowired
  101 + private ParkOccupyService parkOccupyService;
  102 +
80 103
81 /** 104 /**
82 * 这里用的是@SendToUser,这就是发送给单一客户端的标志。本例中, 105 * 这里用的是@SendToUser,这就是发送给单一客户端的标志。本例中,
@@ -176,7 +199,12 @@ public class DataGeneralizeController { @@ -176,7 +199,12 @@ public class DataGeneralizeController {
176 } 199 }
177 return list; 200 return list;
178 } 201 }
179 - 202 + /**
  203 + * 分区统计停车场、停车位数量
  204 + * langlw 2017-9-5
  205 + * @param request
  206 + * @return
  207 + */
180 @ApiOperation(value="停车场柱图") 208 @ApiOperation(value="停车场柱图")
181 @PostMapping("parkinglotColumnChart") 209 @PostMapping("parkinglotColumnChart")
182 @ResponseBody 210 @ResponseBody
@@ -363,7 +391,12 @@ public class DataGeneralizeController { @@ -363,7 +391,12 @@ public class DataGeneralizeController {
363 map.entrySet().forEach(e->{displayCountry.add(e.getValue());}); 391 map.entrySet().forEach(e->{displayCountry.add(e.getValue());});
364 return new BizResultVO<List<String>>().setData(displayCountry); 392 return new BizResultVO<List<String>>().setData(displayCountry);
365 } 393 }
366 - 394 + /**
  395 + * 车位配比图
  396 + * langlw 2017-9-5
  397 + * @param request
  398 + * @return
  399 + */
367 @ApiOperation(value="车位配比图") 400 @ApiOperation(value="车位配比图")
368 @PostMapping("berthSpaceRatioChart") 401 @PostMapping("berthSpaceRatioChart")
369 @ResponseBody 402 @ResponseBody
@@ -388,4 +421,306 @@ public class DataGeneralizeController { @@ -388,4 +421,306 @@ public class DataGeneralizeController {
388 421
389 return new BizResultVO<BerthSpaceRatioVO>().setData(berthSpaceRatioVO); 422 return new BizResultVO<BerthSpaceRatioVO>().setData(berthSpaceRatioVO);
390 } 423 }
  424 +
  425 +
  426 + /**
  427 + * 获取停车场设备和PDA在线离线总数
  428 + * langlw 2017-9-5
  429 + * @param request
  430 + * @return
  431 + */
  432 + @ApiOperation(value="获取停车场设备和PDA在线离线总数")
  433 + @PostMapping("queryParkEqpAndPDACount")
  434 + @ResponseBody
  435 + public BizResultVO<ParkEqpAndPDACountDTO> queryParkEqpAndPDACount(@RequestBody QueryParkEqpAndPDACountRequest request){
  436 + if(null == request.getEqpType() || null == request.getPdaType() || CollectionUtils.isEmpty(request.getPlNos())){
  437 + throw new BizException(ErrorType.PARAMM_NULL, "入参不能为空");
  438 + }
  439 + logger.info("调用dubbo服务,请求入参: request={}", JSONObject.toJSONString(request));
  440 + ParkEqpAndPDACountDTO parkEqpAndPDACountDTO=new ParkEqpAndPDACountDTO();
  441 + //查询停车场设备
  442 + BizResult<List<ParkEqpAndPDACountDTO>> result = parkingLotEqpService.queryParkEqpCountByPlNosAndEqpType(request);
  443 + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(result));
  444 + List<ParkEqpAndPDACountDTO> parkEqpList=result.getData();
  445 + //PDA
  446 + int onlineEqpCountSum=0;
  447 + int allEqpCountSum=0;
  448 + int onlinePDACountSum=0;
  449 + int allPDACountSum=0;
  450 +
  451 + if(CollectionUtils.isNotEmpty(parkEqpList)){
  452 + for (ParkEqpAndPDACountDTO dto : parkEqpList) {
  453 + if(null != dto){
  454 + onlineEqpCountSum=onlineEqpCountSum+(null==dto.getOnlineEqpCount()?0:dto.getOnlineEqpCount());
  455 + allEqpCountSum=allEqpCountSum+(null==dto.getAllEqpCount()?0:dto.getAllEqpCount());
  456 + }
  457 + }
  458 + }
  459 +
  460 + //查询PDA在线和离线总数
  461 + BizResult<List<ParkEqpAndPDACountDTO>> bizResult = tpPPdaService.queryPDACountByPlNosAndPdaType(request);
  462 + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(bizResult));
  463 + List<ParkEqpAndPDACountDTO> parkPDACountList=bizResult.getData();
  464 + //PDA
  465 + if(CollectionUtils.isNotEmpty(parkPDACountList)){
  466 + for (ParkEqpAndPDACountDTO dto : parkPDACountList) {
  467 + if(null != dto){
  468 + onlinePDACountSum=onlinePDACountSum+(null==dto.getOnlinePDACount()?0:dto.getOnlinePDACount());
  469 + allPDACountSum=allPDACountSum+(null==dto.getAllPDACount()?0:dto.getAllPDACount());
  470 + }
  471 + }
  472 + }
  473 + parkEqpAndPDACountDTO.setAllEqpCount(allEqpCountSum);
  474 + parkEqpAndPDACountDTO.setAllPDACount(allPDACountSum);
  475 + parkEqpAndPDACountDTO.setOnlineEqpCount(onlineEqpCountSum);
  476 + parkEqpAndPDACountDTO.setOnlinePDACount(onlinePDACountSum);
  477 +
  478 +
  479 + return new BizResultVO<ParkEqpAndPDACountDTO>().setData(parkEqpAndPDACountDTO);
  480 + }
  481 +
  482 +
  483 + /**
  484 + * 分区统计停车场、停车位数量
  485 + * langlw 2017-9-5
  486 + * @param request
  487 + * @return
  488 + */
  489 + @ApiOperation(value="分区、停车场类型统计停车场、停车位数量")
  490 + @PostMapping("getParkAndBerthAndEquChartForPlType")
  491 + @ResponseBody
  492 + public BizResultVO<ParkLotAndBerthsCountVO> getParkAndBerthAndEquChartForPlType(@RequestBody StatisticParkLotCountByCountryRequest request){
  493 + if(null == request.getCityId()){
  494 + throw new BizException(ErrorType.PARAMM_NULL, "城市编号");
  495 + }
  496 + logger.info("对城市:"+request.getCityId()+" 按照区域统计停车场、车位数量等信息");
  497 + //停车场数量 先查询缓存
  498 + BizResult<List<ParkLotCountStatisticByCountryDTO>> bizResultParkLot = parkingLotQueryService.statisticParkLotCountByCountryForPlType(request);
  499 + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(bizResultParkLot));
  500 + List<ParkLotCountStatisticByCountryDTO> parkLotCountList=bizResultParkLot.getData();
  501 +
  502 + Map<String,Object> pkberthsCountObjMap=Maps.newHashMap();
  503 + Map<String,Object> parkLotCountObjMap=Maps.newHashMap();
  504 +
  505 +
  506 + if(CollectionUtils.isNotEmpty(parkLotCountList)){
  507 + for (ParkLotCountStatisticByCountryDTO dto : parkLotCountList) {
  508 + String countryName = dto.getPlCountryName();
  509 + //停车场车位数
  510 + Map<Integer,Integer> berthsCountMap = Maps.newHashMap();
  511 + //停车场数
  512 + Map<Integer,Integer> parkLotCountMap = Maps.newHashMap();
  513 + //停车场个数
  514 + int pkCount = dto.getParkLotCount()==null?0:dto.getParkLotCount();
  515 + Integer plType=dto.getPlType();
  516 + parkLotCountMap.put(plType, pkCount);
  517 + parkLotCountObjMap.put(countryName, parkLotCountMap);
  518 + //停车位个数
  519 + int pkberthsCount = dto.getTotalBerths();
  520 + berthsCountMap.put(plType, pkberthsCount);
  521 + pkberthsCountObjMap.put(countryName, berthsCountMap);
  522 + }
  523 + }
  524 + ParkLotAndBerthsCountVO parkLotAndBerthsCountVO = new ParkLotAndBerthsCountVO();
  525 + parkLotAndBerthsCountVO.setPkberthsCountMap(pkberthsCountObjMap);
  526 + parkLotAndBerthsCountVO.setPkCountMap(parkLotCountObjMap);
  527 + return new BizResultVO<ParkLotAndBerthsCountVO>().setData(parkLotAndBerthsCountVO);
  528 + }
  529 +
  530 +
  531 + @SuppressWarnings("serial")
  532 + @ApiOperation(value="今日车流量")
  533 + @PostMapping("queryTodayVehicleFlow")
  534 + @ResponseBody
  535 + public BizResultVO<List<ParkingFlowCountDTO>> queryTodayVehicleFlow(@RequestBody StatisticParkLotCountByCountryRequest request){
  536 + BizResultVO<List<ParkingFlowCountDTO>> parkFlowDTOs = new BizResultVO<>();
  537 + List<ParkingFlowCountDTO> parkingFlowCountDTOs = new ArrayList<>();
  538 +
  539 + List<QueryTodayFlowRequest> requests = new ArrayList<>();
  540 + List<String> HSPlNos = new ArrayList<String>(){{add("-1");}};
  541 + List<String> SSPlNos = new ArrayList<String>(){{add("-1");}};
  542 + List<String> YBSPlNos = new ArrayList<String>(){{add("-1");}};
  543 + List<String> QTPlNos = new ArrayList<String>(){{add("-1");}};
  544 +
  545 +
  546 + //先查询城市下面的停车场
  547 + BizResult<List<ParkingLotDTO>> parkResult = parkingLotQueryService.queryParkLotByCountry(request);
  548 + if (ResultUtils.isError(parkResult)) {
  549 + //如果失败
  550 + parkFlowDTOs.setCode(parkResult.getErrCode().getCode());
  551 + parkFlowDTOs.setMsg(parkResult.getErrMsg());
  552 + return parkFlowDTOs;
  553 + }
  554 + QueryTodayFlowRequest HSRequest = new QueryTodayFlowRequest();
  555 + QueryTodayFlowRequest SSRequest = new QueryTodayFlowRequest();
  556 + QueryTodayFlowRequest YBSRequest = new QueryTodayFlowRequest();
  557 + QueryTodayFlowRequest QTRequest = new QueryTodayFlowRequest();
  558 + QueryTodayFlowRequest flowRequest = new QueryTodayFlowRequest();
  559 + BeanUtils.copyProperties(request, flowRequest);
  560 + Calendar calendar = Calendar.getInstance();
  561 + calendar.setTime(new Date());
  562 + calendar.set(Calendar.HOUR_OF_DAY, 0);
  563 + calendar.set(Calendar.MINUTE, 0);
  564 + calendar.set(Calendar.SECOND, 0);
  565 + Date beginTime = calendar.getTime();
  566 + flowRequest.setBeginTime(beginTime);
  567 + flowRequest.setEndTime(new Date());
  568 + flowRequest.setDataState(1);
  569 + flowRequest.setOrderType(1);
  570 + for (ParkingLotDTO dto : parkResult.getData()) {
  571 + switch (dto.getPlCountryId().intValue()) {
  572 + case 923://红山区
  573 + HSPlNos.add(dto.getPlNo());
  574 + BeanUtils.copyProperties(flowRequest, HSRequest);
  575 + HSRequest.setPlCountryId(dto.getPlCountryId());
  576 + HSRequest.setPlCountryName(dto.getPlCountryName());
  577 + break;
  578 + case 925://松山区
  579 + SSPlNos.add(dto.getPlNo());
  580 + BeanUtils.copyProperties(flowRequest, SSRequest);
  581 + SSRequest.setPlCountryId(dto.getPlCountryId());
  582 + SSRequest.setPlCountryName(dto.getPlCountryName());
  583 + break;
  584 + case 924://元宝山区
  585 + YBSPlNos.add(dto.getPlNo());
  586 + BeanUtils.copyProperties(flowRequest, YBSRequest);
  587 + YBSRequest.setPlCountryId(dto.getPlCountryId());
  588 + YBSRequest.setPlCountryName(dto.getPlCountryName());
  589 + break;
  590 + default://其他
  591 + QTPlNos.add(dto.getPlNo());
  592 + BeanUtils.copyProperties(flowRequest, QTRequest);
  593 + QTRequest.setPlCountryId(9999L);
  594 + QTRequest.setPlCountryName("其他");
  595 +
  596 + break;
  597 + }
  598 + }
  599 +
  600 + HSRequest.setPlNos(HSPlNos);
  601 + SSRequest.setPlNos(SSPlNos);
  602 + YBSRequest.setPlNos(YBSPlNos);
  603 + QTRequest.setPlNos(QTPlNos);
  604 + requests.add(HSRequest);
  605 + requests.add(SSRequest);
  606 + requests.add(YBSRequest);
  607 + requests.add(QTRequest);
  608 + for (QueryTodayFlowRequest re : requests) {
  609 + BizResult<ParkingFlowCountDTO> dtoBiz = tdBOrderService.queryTodayVehicleFlow(re);
  610 + if(dtoBiz.getData()!=null){
  611 + BeanUtils.copyProperties(re, dtoBiz.getData());
  612 + parkingFlowCountDTOs.add(dtoBiz.getData());
  613 + }
  614 + }
  615 + parkFlowDTOs.setData(parkingFlowCountDTOs);
  616 + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(parkFlowDTOs));
  617 + return parkFlowDTOs;
  618 + }
  619 +
  620 + @ApiOperation(value="24小时占用率")
  621 + @PostMapping("queryTwentyFourHoursOccupyRate")
  622 + @ResponseBody
  623 + public BizResultVO<List<ParkingOccupyDTO>> queryTwentyFourHoursOccupyRate(@RequestBody StatisticParkLotCountByCountryRequest request){
  624 + BizResultVO<List<ParkingOccupyDTO>> parkOccupyDTOs = new BizResultVO<>();
  625 + QueryParkingOccupyRequest occupyRequest = new QueryParkingOccupyRequest();
  626 + List<String> plNos = new ArrayList<>();
  627 + //先查询城市下面的停车场
  628 + BizResult<List<ParkingLotDTO>> parkResult = parkingLotQueryService.queryParkLotByCountry(request);
  629 + if (ResultUtils.isError(parkResult)) {
  630 + //如果失败
  631 + parkOccupyDTOs.setCode(parkResult.getErrCode().getCode());
  632 + parkOccupyDTOs.setMsg(parkResult.getErrMsg());
  633 + return parkOccupyDTOs;
  634 + }
  635 + for (ParkingLotDTO parkDto : parkResult.getData()) {
  636 + plNos.add(parkDto.getPlNo());
  637 + }
  638 + if(plNos.size()<1){
  639 + throw new BizException(ErrorType.PARAMM_NULL,"停车场编号");
  640 + }
  641 + BeanUtils.copyProperties(request, occupyRequest);
  642 + occupyRequest.setPlNos(plNos);
  643 + occupyRequest.setDataStatus(1);
  644 + occupyRequest.setStatisticType(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);
  645 + Calendar calendar = Calendar.getInstance();
  646 + calendar.setTime(new Date());
  647 + calendar.set(Calendar.MINUTE, 0);
  648 + calendar.set(Calendar.SECOND, 0);
  649 + Date endTime = calendar.getTime();
  650 +
  651 + //往前倒三个月
  652 + //calendar.add(Calendar.MONTH, -3);
  653 + calendar.add(Calendar.DAY_OF_MONTH, -1);
  654 + calendar.set(Calendar.MINUTE, 0);
  655 + calendar.set(Calendar.SECOND, 0);
  656 + Date beginTime = calendar.getTime();
  657 +
  658 + occupyRequest.setBeginTime(beginTime);
  659 + occupyRequest.setEndTime(endTime);
  660 +
  661 + BizResult<List<ParkingOccupyDTO>> result = parkOccupyService.queryTwentyFourHoursOccupyRate(occupyRequest);
  662 + if(!(result.isSuccess())){
  663 + //如果失败
  664 + parkOccupyDTOs.setCode(result.getErrCode().getCode());
  665 + parkOccupyDTOs.setMsg(result.getErrMsg());
  666 + return parkOccupyDTOs;
  667 + }
  668 + parkOccupyDTOs.setData(result.getData());
  669 + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(parkOccupyDTOs));
  670 + return parkOccupyDTOs;
  671 + }
  672 +
  673 + @ApiOperation(value="今日交易")
  674 + @PostMapping("queryTodayOrderTrans")
  675 + @ResponseBody
  676 + public BizResultVO<OrderTransDTO> queryTodayOrderTrans(@RequestBody StatisticParkLotCountByCountryRequest request){
  677 + BizResultVO<OrderTransDTO> orderDTO = new BizResultVO<>();
  678 + OrderTransactionQueryRequest orderTransRequest = new OrderTransactionQueryRequest();
  679 + List<String> plNos = new ArrayList<>();
  680 + //先查询城市下面的停车场
  681 + BizResult<List<ParkingLotDTO>> parkResult = parkingLotQueryService.queryParkLotByCountry(request);
  682 + if (ResultUtils.isError(parkResult)) {
  683 + //如果失败
  684 + orderDTO.setCode(parkResult.getErrCode().getCode());
  685 + orderDTO.setMsg(parkResult.getErrMsg());
  686 + return orderDTO;
  687 + }
  688 + for (ParkingLotDTO parkDto : parkResult.getData()) {
  689 + plNos.add(parkDto.getPlNo());
  690 + }
  691 + if(plNos.size()<1){
  692 + throw new BizException(ErrorType.PARAMM_NULL,"停车场编号");
  693 + }
  694 + BeanUtils.copyProperties(request, orderTransRequest);
  695 + orderTransRequest.setParkIds(plNos);
  696 +
  697 + Calendar calendar = Calendar.getInstance();
  698 + calendar.setTime(new Date());
  699 + calendar.set(Calendar.HOUR_OF_DAY, 0);
  700 + calendar.set(Calendar.MINUTE, 0);
  701 + calendar.set(Calendar.SECOND, 0);
  702 + Date beginTime = calendar.getTime();
  703 + orderTransRequest.setBeginTime(beginTime);
  704 + orderTransRequest.setEndTime(new Date());
  705 +
  706 + BizResult<OrderTransDTO> result = tdBOrderService.queryOrderTrans(orderTransRequest);
  707 + if(!(result.isSuccess())){
  708 + //如果失败
  709 + orderDTO.setCode(result.getErrCode().getCode());
  710 + orderDTO.setMsg(result.getErrMsg());
  711 + return orderDTO;
  712 + }
  713 + orderDTO.setData(result.getData());
  714 + //分->元
  715 + BigDecimal hundred = new BigDecimal("100");
  716 + OrderTransDTO o = orderDTO.getData();
  717 + o.setAliTotalAmount(o.getAliTotalAmount()!=null?o.getAliTotalAmount().divide(hundred):new BigDecimal("0"));
  718 + o.setCashTotalAmount(o.getCashTotalAmount()!=null?o.getCashTotalAmount().divide(hundred):new BigDecimal("0"));
  719 + o.setPayedTotalAmount(o.getPayedTotalAmount()!=null?o.getPayedTotalAmount().divide(hundred):new BigDecimal("0"));
  720 + o.setWxTotalAmount(o.getWxTotalAmount()!=null?o.getWxTotalAmount().divide(hundred):new BigDecimal("0"));
  721 + o.setYlTotalAmount(o.getYlTotalAmount()!=null?o.getYlTotalAmount().divide(hundred):new BigDecimal("0"));
  722 + orderDTO.setData(o);
  723 + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(orderDTO));
  724 + return orderDTO;
  725 + }
391 } 726 }
src/main/java/com/zteits/irain/portal/web/govclouds/ParkingContrailController.java
@@ -18,17 +18,44 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -18,17 +18,44 @@ import org.springframework.web.bind.annotation.RequestMapping;
18 import org.springframework.web.bind.annotation.ResponseBody; 18 import org.springframework.web.bind.annotation.ResponseBody;
19 19
20 import com.alibaba.fastjson.JSONObject; 20 import com.alibaba.fastjson.JSONObject;
  21 +import com.clouds.common.cache.park.ParkFreeBerthsCacheUtil;
  22 +import com.clouds.common.utils.AppRsesultUtil;
  23 +import com.clouds.common.utils.DateUtil;
21 import com.clouds.common.web.BizController; 24 import com.clouds.common.web.BizController;
22 import com.clouds.common.web.vo.BizResultVO; 25 import com.clouds.common.web.vo.BizResultVO;
  26 +import com.google.common.collect.Lists;
  27 +import com.xiaoleilu.hutool.util.CollectionUtil;
23 import com.zteits.clouds.api.apibase.bean.BizResult; 28 import com.zteits.clouds.api.apibase.bean.BizResult;
24 import com.zteits.clouds.api.apibase.bean.PageBean; 29 import com.zteits.clouds.api.apibase.bean.PageBean;
  30 +import com.zteits.clouds.api.apibase.constants.BasicEnum;
  31 +import com.zteits.clouds.api.apibase.constants.ErrorType;
  32 +import com.zteits.clouds.api.dto.govclouds.dto.ParkEqpAndPDACountDTO;
25 import com.zteits.clouds.api.dto.govclouds.dto.ParkingCountForTypeDTO; 33 import com.zteits.clouds.api.dto.govclouds.dto.ParkingCountForTypeDTO;
26 import com.zteits.clouds.api.dto.govclouds.dto.ParkingTrackDTO; 34 import com.zteits.clouds.api.dto.govclouds.dto.ParkingTrackDTO;
  35 +import com.zteits.clouds.api.dto.govclouds.param.QueryParkEqpAndPDACountRequest;
27 import com.zteits.clouds.api.dto.govclouds.param.QueryParkingCountRequest; 36 import com.zteits.clouds.api.dto.govclouds.param.QueryParkingCountRequest;
28 import com.zteits.clouds.api.dto.govclouds.param.QueryParkingTrackRequest; 37 import com.zteits.clouds.api.dto.govclouds.param.QueryParkingTrackRequest;
  38 +import com.zteits.clouds.api.dto.park.dto.BerthsDTO;
  39 +import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO;
  40 +import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO;
  41 +import com.zteits.clouds.api.dto.park.dto.TodayVehicleFlowOccupyRateAndTurnOverDTO;
  42 +import com.zteits.clouds.api.dto.park.param.CommonPlnosQueryRequest;
  43 +import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest;
  44 +import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest;
  45 +import com.zteits.clouds.api.dto.pay.TdCFileDTO;
  46 +import com.zteits.clouds.api.dto.pay.param.SysFileGetBySourceIdAndTypeRequest;
29 import com.zteits.clouds.api.service.govclouds.ParkPreferenceService; 47 import com.zteits.clouds.api.service.govclouds.ParkPreferenceService;
  48 +import com.zteits.clouds.api.service.park.BerthManageService;
  49 +import com.zteits.clouds.api.service.park.ParkingLotEqpService;
  50 +import com.zteits.clouds.api.service.park.ParkingLotQueryService;
  51 +import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService;
  52 +import com.zteits.clouds.api.service.park.TpPPdaService;
  53 +import com.zteits.clouds.api.service.pay.TdCFileService;
  54 +import com.zteits.irain.portal.constant.ParkConstant;
30 import com.zteits.irain.portal.vo.govclouds.ParkingBusiCircleForTypeVO; 55 import com.zteits.irain.portal.vo.govclouds.ParkingBusiCircleForTypeVO;
31 import com.zteits.irain.portal.vo.govclouds.ParkingCountForTypeVO; 56 import com.zteits.irain.portal.vo.govclouds.ParkingCountForTypeVO;
  57 +import com.zteits.irain.portal.vo.govclouds.ParkingDeviceVO;
  58 +import com.zteits.irain.portal.vo.govclouds.ParkingStatisVO;
32 59
33 import io.swagger.annotations.Api; 60 import io.swagger.annotations.Api;
34 import io.swagger.annotations.ApiOperation; 61 import io.swagger.annotations.ApiOperation;
@@ -55,6 +82,23 @@ public class ParkingContrailController extends BizController{ @@ -55,6 +82,23 @@ public class ParkingContrailController extends BizController{
55 private static final Logger logger = LoggerFactory.getLogger(ParkingContrailController.class); 82 private static final Logger logger = LoggerFactory.getLogger(ParkingContrailController.class);
56 @Autowired 83 @Autowired
57 private ParkPreferenceService parkPreferenceService; 84 private ParkPreferenceService parkPreferenceService;
  85 + //停车场基本信息查询服务
  86 + @Autowired
  87 + private ParkingLotQueryService parkingLotQueryService;
  88 + //附件查询服务-查询停车场图片
  89 + @Autowired
  90 + private TdCFileService tdCFileService;
  91 + //停车场泊位信息查询
  92 + @Autowired
  93 + private BerthManageService berthManageService;
  94 + //停车场空置率 周转率查询
  95 + @Autowired
  96 + private ParkingLotUseStatisticService parkingLotUseStatisticService;
  97 + @Autowired
  98 + //硬件设备服务
  99 + private ParkingLotEqpService parkingLotEqpService;
  100 + @Autowired
  101 + private TpPPdaService tpPPdaService;
58 102
59 @ApiOperation("停车编好->饼图") 103 @ApiOperation("停车编好->饼图")
60 @PostMapping("/parkingCountForPlType") 104 @PostMapping("/parkingCountForPlType")
@@ -107,6 +151,137 @@ public class ParkingContrailController extends BizController{ @@ -107,6 +151,137 @@ public class ParkingContrailController extends BizController{
107 return result; 151 return result;
108 } 152 }
109 153
  154 +
  155 +
  156 + @ApiOperation("停车场基本信息查询")
  157 + @PostMapping("/queryParkingBaseInfo")
  158 + @ResponseBody
  159 + public BizResultVO<ParkingLotDTO> queryParkingBaseInfo(@RequestBody QueryParkLotInfoByPkNoRequest queryParkLotInfoByPkNoRequest,HttpServletRequest request, HttpServletResponse response) throws Exception{
  160 + BizResultVO<ParkingLotDTO> result = new BizResultVO<ParkingLotDTO>();
  161 + logger.info("停车场停车资源-基本信息查询 Controller,入参={}",JSONObject.toJSON(queryParkLotInfoByPkNoRequest));
  162 +
  163 + queryParkLotInfoByPkNoRequest.setSysCode(BasicEnum.SYS_CODE.getValue());
  164 + logger.debug("开始 查询停车场信息:" + JSONObject.toJSONString(queryParkLotInfoByPkNoRequest));
  165 + BizResult<ParkingLotDTO> rtMap = parkingLotQueryService.QueryParkingLotByPkNo(queryParkLotInfoByPkNoRequest);
  166 + logger.debug("结束 查询停车场信息:" + JSONObject.toJSONString(rtMap));
  167 + ParkingLotDTO parkingLotDTO = new ParkingLotDTO();
  168 + if(rtMap.isSuccess()){
  169 + parkingLotDTO =rtMap.getData();
  170 + if(parkingLotDTO ==null){
  171 + AppRsesultUtil.fail(ErrorType.RESOURCE_NOT_EXISTS.getCode(), ErrorType.RESOURCE_NOT_EXISTS.getMsg());
  172 + }
  173 + }
  174 + Integer freeParkingSpace = ParkFreeBerthsCacheUtil.getFreeBerthsByPlNo(queryParkLotInfoByPkNoRequest.getPklNo());
  175 + rtMap.getData().setBerthNum(freeParkingSpace);
  176 +
  177 + logger.debug("start 停车场图片查询");
  178 + SysFileGetBySourceIdAndTypeRequest sysFileGetBySourceIdAndTypeRequest = new SysFileGetBySourceIdAndTypeRequest();
  179 + sysFileGetBySourceIdAndTypeRequest.setSourceId(queryParkLotInfoByPkNoRequest.getPklNo());
  180 + sysFileGetBySourceIdAndTypeRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode());
  181 + BizResult<List<TdCFileDTO>> fileList = tdCFileService.getFilesBySourceIdAndType(sysFileGetBySourceIdAndTypeRequest);
  182 +
  183 + List<String> picUrls = Lists.newArrayList();
  184 + if(fileList.isSuccess() && CollectionUtil.isNotEmpty(fileList.getData())){
  185 + fileList.getData().forEach(file->picUrls.add(file.getFilePath()));
  186 + }else{
  187 + /** 如果没有查询停车场的真实图片--则展示默认的停车场图片**/
  188 + SysFileGetBySourceIdAndTypeRequest sysFileRequest = new SysFileGetBySourceIdAndTypeRequest();
  189 + /*** '停车场类型:1:路内(占用道路停车位),2-路外',*/
  190 + if(rtMap.getData().getPlType()==1){
  191 + sysFileRequest.setSourceId("defaul_park_pic_out");
  192 + }else{
  193 + sysFileRequest.setSourceId("defaul_park_pic_in");
  194 + }
  195 + sysFileRequest.setFileType(1);
  196 + sysFileRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode());
  197 + BizResult<List<TdCFileDTO>> defaultfileList = tdCFileService.getFilesBySourceIdAndType(sysFileRequest);
  198 + if(defaultfileList.isSuccess() && CollectionUtil.isNotEmpty(defaultfileList.getData())){
  199 + defaultfileList.getData().forEach(file->picUrls.add(file.getFilePath()));
  200 + }
  201 + }
  202 + logger.debug("end 停车场图片查询:{}",JSONObject.toJSONString(picUrls));
  203 +
  204 + BizResult<List<BerthsDTO>> rsMaplist = berthManageService.queryBerthsByPlNo(queryParkLotInfoByPkNoRequest);
  205 + if(rsMaplist.isSuccess() && CollectionUtil.isNotEmpty(rsMaplist.getData())){
  206 + rtMap.getData().setBerths(rsMaplist.getData());
  207 + }
  208 +
  209 + result.setData(rtMap.getData());
  210 + result.getData().setPicUrls(picUrls);
  211 + return result;
  212 + }
  213 +
  214 +
  215 + @ApiOperation("停车场停车数据查询")
  216 + @PostMapping("/queryParkingdatas")
  217 + @ResponseBody
  218 + public BizResultVO<ParkingStatisVO> queryParkingdatas(@RequestBody QueryParkLotInfoByPkNoRequest queryParkLotInfoByPkNoRequest,HttpServletRequest request, HttpServletResponse response) throws Exception{
  219 + BizResultVO<ParkingStatisVO> result = new BizResultVO<ParkingStatisVO>();
  220 +
  221 + List<ParkingDeviceVO> deviceVoList = Lists.newArrayList();
  222 + logger.info("停车场停车资源-停车场停车数据查询 Controller,入参={}",JSONObject.toJSON(queryParkLotInfoByPkNoRequest));
  223 + ParkingStatisVO vo = new ParkingStatisVO();
  224 + List<String> plNos = Lists.newArrayList();
  225 + plNos.add(queryParkLotInfoByPkNoRequest.getPklNo());
  226 + CommonPlnosQueryRequest commonPlnosQueryRequest = new CommonPlnosQueryRequest();
  227 + commonPlnosQueryRequest.setPlNos(plNos);
  228 + commonPlnosQueryRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode());
  229 + BizResult<List<TodayVehicleFlowOccupyRateAndTurnOverDTO>> rsList = parkingLotUseStatisticService.queryTodayVehicleFlowOccupyRateAndTurnOver(commonPlnosQueryRequest);
  230 + if(rsList.isSuccess() && CollectionUtil.isNotEmpty(rsList.getData())){
  231 + TodayVehicleFlowOccupyRateAndTurnOverDTO dto = rsList.getData().get(0);
  232 + vo.setAvgOccupyRate(dto.getAvgOccupyRate());
  233 + vo.setAvgTurnoverRate(dto.getAvgTurnoverRate());
  234 + }
  235 +
  236 + ParkingLotUseStatisticForPageRequest staticRequest = new ParkingLotUseStatisticForPageRequest();
  237 + staticRequest.setBeginTime(DateUtil.getTimeBeforeDay(DateUtil.getSysDate()));
  238 + staticRequest.setEndTime(DateUtil.getSysDate());
  239 + staticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);
  240 + staticRequest.setPlNos(plNos);
  241 + staticRequest.getBaseRequest().setPageSize(100);
  242 + staticRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode());
  243 + BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotUseStatisticService
  244 + .queryParkingLotUseStatisticForPage(staticRequest);
  245 + /**周转率,空置率不为空**/
  246 + if(bizResult.isSuccess() && CollectionUtil.isNotEmpty(bizResult.getData().getDataList())){
  247 + vo.setStatisList(bizResult.getData().getDataList());
  248 + }
  249 +
  250 + QueryParkEqpAndPDACountRequest queryParkEqpAndPDACountRequest = new QueryParkEqpAndPDACountRequest();
  251 + queryParkEqpAndPDACountRequest.setPlNos(plNos);
  252 + queryParkEqpAndPDACountRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode());
  253 + logger.info("停车场停车资源-停车场停车数据查询 -查询硬件设备,入参={}",JSONObject.toJSON(queryParkEqpAndPDACountRequest));
  254 + BizResult<List<ParkEqpAndPDACountDTO>> eqpList = parkingLotEqpService.queryParkEqpCountByPlNos(queryParkEqpAndPDACountRequest);
  255 + logger.info("停车场停车资源-停车场停车数据查询 -查询硬件设备 地磁,出参={}",JSONObject.toJSON(eqpList));
  256 + if(eqpList.isSuccess() && CollectionUtil.isNotEmpty(eqpList.getData())){
  257 + eqpList.getData().forEach(eqp->{
  258 + ParkingDeviceVO device = new ParkingDeviceVO();
  259 + device.setType(eqp.getEqpType());
  260 + device.setAllCount(eqp.getAllEqpCount());
  261 + device.setOnlineCount(eqp.getOnlineEqpCount());
  262 + deviceVoList.add(device);
  263 + });
  264 + }
  265 + BizResult<List<ParkEqpAndPDACountDTO>> pdaList = tpPPdaService.queryPDACountByPlNosAndPdaType(queryParkEqpAndPDACountRequest);
  266 + logger.info("停车场停车资源-停车场停车数据查询 -查询硬件设备 PDA等,出参={}",JSONObject.toJSON(pdaList));
  267 + if(pdaList.isSuccess() && CollectionUtil.isNotEmpty(pdaList.getData())){
  268 + pdaList.getData().forEach(pda->{
  269 + ParkingDeviceVO device = new ParkingDeviceVO();
  270 + //device.setType(pda.getEqpType());
  271 + device.setType(9);//PDA类型暂时设置为 9
  272 + device.setAllCount(pda.getAllEqpCount());
  273 + device.setOnlineCount(pda.getOnlineEqpCount());
  274 + deviceVoList.add(device);
  275 + });
  276 + }
  277 + /**获取停车场的空闲车位*/
  278 + Integer freeParkingSpace = ParkFreeBerthsCacheUtil.getFreeBerthsByPlNo(queryParkLotInfoByPkNoRequest.getPklNo());
  279 + vo.setFreeParkingSpace(freeParkingSpace);
  280 + vo.setDeviceVoList(deviceVoList);
  281 + result.setData(vo);
  282 + return result;
  283 + }
  284 +
110 @ApiOperation("停车车轨迹") 285 @ApiOperation("停车车轨迹")
111 @PostMapping("/queryParkingTrack") 286 @PostMapping("/queryParkingTrack")
112 @ResponseBody 287 @ResponseBody
@@ -118,10 +293,6 @@ public class ParkingContrailController extends BizController{ @@ -118,10 +293,6 @@ public class ParkingContrailController extends BizController{
118 return new BizResultVO<ParkingTrackDTO>(bizResult); 293 return new BizResultVO<ParkingTrackDTO>(bizResult);
119 } 294 }
120 295
121 -  
122 -  
123 -  
124 -  
125 } 296 }
126 297
127 298
src/main/java/com/zteits/irain/portal/web/govclouds/RealTimeInfoController.java 0 → 100644
  1 +/**
  2 + *
  3 + */
  4 +package com.zteits.irain.portal.web.govclouds;
  5 +
  6 +import java.util.ArrayList;
  7 +import java.util.List;
  8 +
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.beans.factory.annotation.Value;
  13 +import org.springframework.util.CollectionUtils;
  14 +import org.springframework.web.bind.annotation.PostMapping;
  15 +import org.springframework.web.bind.annotation.RequestBody;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +
  19 +import com.alibaba.fastjson.JSON;
  20 +import com.clouds.common.cache.park.ParkFreeBerthsCacheUtil;
  21 +import com.clouds.common.cache.park.ParkingLotGeoCacheUtil;
  22 +import com.clouds.common.entity.UserArea;
  23 +import com.clouds.common.entity.UserInfo;
  24 +import com.clouds.common.web.SessionCommUtil;
  25 +import com.clouds.common.web.vo.BizResultVO;
  26 +import com.zteits.clouds.api.apibase.bean.BizResult;
  27 +import com.zteits.clouds.api.apibase.constants.LonLatTypeEnum;
  28 +import com.zteits.clouds.api.dto.govclouds.dto.BerthInfoDTO;
  29 +import com.zteits.clouds.api.dto.govclouds.dto.EscapesPaymentDataDTO;
  30 +import com.zteits.clouds.api.dto.govclouds.dto.WarningInfoDTO;
  31 +import com.zteits.clouds.api.dto.govclouds.dto.ZeroBerthParkingLotDTO;
  32 +import com.zteits.clouds.api.dto.govclouds.param.BerthExponentinfoRequest;
  33 +import com.zteits.clouds.api.dto.govclouds.param.EscapePaymentRequest;
  34 +import com.zteits.clouds.api.dto.govclouds.param.ParkingBerthInfoRequest;
  35 +import com.zteits.clouds.api.dto.govclouds.param.UserAreaInfo;
  36 +import com.zteits.clouds.api.dto.govclouds.param.WaringFreeBerthRequest;
  37 +import com.zteits.clouds.api.dto.govclouds.param.WarningInfoRequest;
  38 +import com.zteits.clouds.api.dto.park.dto.ParkinglotAndGeoInfoDTO;
  39 +import com.zteits.clouds.api.service.govclouds.RealtimeInfoService;
  40 +import com.zteits.clouds.api.service.park.ParkingLotBerthsService;
  41 +
  42 +import io.swagger.annotations.Api;
  43 +import io.swagger.annotations.ApiOperation;
  44 +
  45 +/**
  46 + * @author hxz
  47 + *
  48 + */
  49 +@Api(value="实时停车", description="实时停车")
  50 +@RestController
  51 +@RequestMapping("/rtinfo")
  52 +public class RealTimeInfoController {
  53 + private static final Logger logger = LoggerFactory.getLogger(RealTimeInfoController.class);
  54 +
  55 + @Value("${project.syscode}")
  56 + private String sysCode;
  57 + @Autowired
  58 + private SessionCommUtil sessionCommUtil;
  59 +
  60 + @Autowired
  61 + private RealtimeInfoService rtInfoService;
  62 + @Autowired
  63 + private ParkingLotBerthsService plBerthsService;
  64 +
  65 + @ApiOperation("24小时逃逸补缴情况")
  66 + @PostMapping("/escapePaymentInfo")
  67 + public BizResultVO<EscapesPaymentDataDTO> getEscapePaymentInfoDuring24hs(@RequestBody EscapePaymentRequest request) {
  68 + BizResult<EscapesPaymentDataDTO> result = null;
  69 + try {
  70 + result = rtInfoService.getEscapePaymentInfoDuring24hs(request);
  71 + } catch (Exception e) {
  72 + logger.error(e.toString());
  73 + e.printStackTrace();
  74 + }
  75 +
  76 + return new BizResultVO<EscapesPaymentDataDTO>(result);
  77 + }
  78 +
  79 + @ApiOperation("停车指数,根据登录人所属市区id获取计算所需数据")
  80 + @PostMapping("/berthinfo")
  81 + public BizResultVO<BerthInfoDTO> getParkingBerthInfo(@RequestBody BerthExponentinfoRequest req) {
  82 + ParkingBerthInfoRequest request = new ParkingBerthInfoRequest();
  83 + request.setSysCode(req.getSysCode());
  84 +
  85 + UserInfo userInfo = sessionCommUtil.getUserInfo();
  86 + List<UserArea> userAreaList = userInfo.getUserAreas();
  87 + List<UserAreaInfo> userAreaInfoList = null;
  88 + if (null != userAreaList && !CollectionUtils.isEmpty(userAreaList)) {
  89 + userAreaInfoList = JSON.parseArray(JSON.toJSONString(userAreaList, false), UserAreaInfo.class);
  90 + }
  91 + request.setUserAreaInfoList(userAreaInfoList);
  92 +
  93 + BizResult<BerthInfoDTO> result = plBerthsService.getParkingBerthInfo(request);
  94 +
  95 + return new BizResultVO<BerthInfoDTO>(result);
  96 + }
  97 +
  98 + @ApiOperation("停车预警")
  99 + @PostMapping("/warninginfo")
  100 + public BizResultVO<List<WarningInfoDTO>> getPreWarningInfo(@RequestBody WaringFreeBerthRequest req) {
  101 + logger.debug("getPreWarningInfo:" + req.getSysCode());
  102 +
  103 + WarningInfoRequest request = new WarningInfoRequest();
  104 + request.setSysCode(req.getSysCode());
  105 + //UserInfo userInfo = sessionCommUtil.getUserInfo();
  106 + List<UserArea> userAreaList = new ArrayList<UserArea>();//userInfo.getUserAreas();
  107 + // 权宜之策构造 begin
  108 + UserArea userArea = new UserArea();
  109 + userArea.setAreaId(req.getCityId());
  110 + userAreaList.add(userArea);
  111 + // 权宜之策构造 end
  112 + List<UserAreaInfo> userAreaInfoList = null;
  113 + if (null != userAreaList && !CollectionUtils.isEmpty(userAreaList)) {
  114 + userAreaInfoList = JSON.parseArray(JSON.toJSONString(userAreaList, false), UserAreaInfo.class);
  115 + }
  116 + request.setUserAreaInfoList(userAreaInfoList);
  117 +
  118 + // 获取所有空闲车位为零的停车场信息列表
  119 + List<ZeroBerthParkingLotDTO> zeroBerthplDTOList = plBerthsService.getZeroBerthParkinglotList(request);
  120 + List<WarningInfoDTO> warningInfoList = new ArrayList<WarningInfoDTO>();
  121 + if (null != zeroBerthplDTOList) {
  122 + logger.debug("zeroBerthplDTOList---->" + JSON.toJSONString(zeroBerthplDTOList, false));
  123 +
  124 + for (ZeroBerthParkingLotDTO zeroBerthpl: zeroBerthplDTOList) {
  125 +
  126 + List<ParkinglotAndGeoInfoDTO> plgInfoList = ParkingLotGeoCacheUtil.queryParkLotsWithDistanceAndCoordinateByAsc(
  127 + LonLatTypeEnum.LON_LAT_TYPE_1, zeroBerthpl.getLongitude(), zeroBerthpl.getLatitude(), 5000D, 50L);
  128 +
  129 + int notZeroBerthPlCount = 0;// 非零空闲泊位数的停车场个数
  130 + if (null != plgInfoList && !CollectionUtils.isEmpty(plgInfoList)) {
  131 + WarningInfoDTO warningInfoDTO = new WarningInfoDTO();
  132 + for (ParkinglotAndGeoInfoDTO ParkinglotAndGeoInfoDTO: plgInfoList) {
  133 + if (0 < ParkFreeBerthsCacheUtil.getFreeBerthsByPlNo(ParkinglotAndGeoInfoDTO.getPlNo()))
  134 + {
  135 + notZeroBerthPlCount += 1;
  136 + }
  137 + }
  138 +
  139 + if (0 < notZeroBerthPlCount) {
  140 + warningInfoDTO.setParkingLotName(zeroBerthpl.getParkingLotName());
  141 + warningInfoDTO.setPlCountHavingFreeBerth(notZeroBerthPlCount);
  142 +
  143 + warningInfoList.add(warningInfoDTO);
  144 + }
  145 + }
  146 + }
  147 + }
  148 + return new BizResultVO<>(new BizResult<>(warningInfoList)) ;
  149 + }
  150 +}
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BillManageController.java deleted
1 -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic;  
2 -  
3 -import java.math.BigDecimal;  
4 -import java.text.SimpleDateFormat;  
5 -import java.util.ArrayList;  
6 -import java.util.Date;  
7 -import java.util.List;  
8 -import java.util.Map;  
9 -  
10 -import javax.servlet.http.HttpServletRequest;  
11 -import javax.servlet.http.HttpServletResponse;  
12 -  
13 -import org.apache.poi.xssf.usermodel.XSSFSheet;  
14 -import org.slf4j.Logger;  
15 -import org.slf4j.LoggerFactory;  
16 -import org.springframework.beans.factory.annotation.Autowired;  
17 -import org.springframework.stereotype.Controller;  
18 -import org.springframework.web.bind.annotation.RequestBody;  
19 -import org.springframework.web.bind.annotation.RequestMapping;  
20 -import org.springframework.web.bind.annotation.RequestMethod;  
21 -import org.springframework.web.bind.annotation.ResponseBody;  
22 -  
23 -import com.alibaba.dubbo.common.utils.StringUtils;  
24 -import com.alibaba.fastjson.JSONArray;  
25 -import com.alibaba.fastjson.JSONObject;  
26 -import com.clouds.common.constants.SessionEnum;  
27 -import com.clouds.common.entity.UserInfo;  
28 -import com.clouds.common.utils.excle.ExcelUtil;  
29 -import com.clouds.common.utils.excle.ExcleFillDateManager;  
30 -import com.clouds.common.utils.excle.Layouter;  
31 -import com.clouds.common.web.BizController;  
32 -import com.clouds.common.web.SessionCommUtil;  
33 -import com.zteits.clouds.api.apibase.bean.BizResult;  
34 -import com.zteits.clouds.api.apibase.bean.PageBean;  
35 -import com.zteits.clouds.api.dto.clouds.dto.BillManageDTO;  
36 -import com.zteits.clouds.api.dto.clouds.param.BillQueryRequest;  
37 -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest;  
38 -import com.zteits.clouds.api.service.clouds.BillManageForDayService;  
39 -import com.zteits.clouds.api.service.pay.TdCustCompanyService;  
40 -  
41 -import io.swagger.annotations.Api;  
42 -import io.swagger.annotations.ApiOperation;  
43 -  
44 -/**  
45 - * 日账单controller类.<br/>  
46 - *  
47 - * Copyright: Copyright (c) 2017 zteits  
48 - *  
49 - * @ClassName: BillManageController.java  
50 - * @Description:  
51 - * @version: v1.0.0  
52 - * @author: wangfs  
53 - * @date: 2017年6月30日 下午1:14:16  
54 - * Modification History:  
55 - * Date Author Version Description  
56 - *---------------------------------------------------------*  
57 - * 2017年6月30日 wangfs v1.0.0 创建  
58 - */  
59 -  
60 -@Api(value = "停车场云平台 日账单", description = "停车场云平台 日账单")  
61 -@Controller  
62 -@RequestMapping("/bill")  
63 -public class BillManageController extends BizController {  
64 - private Logger logger = LoggerFactory.getLogger(BillManageController.class);  
65 - @Autowired  
66 - private BillManageForDayService billManageForDayService;  
67 -  
68 - @Autowired  
69 - private TdCustCompanyService tdCustCompanyService;  
70 -  
71 - @Autowired  
72 - private SessionCommUtil sessionCommUtil;  
73 -  
74 - @Autowired  
75 - private Map<String,TdCustCompanyService> map;  
76 -  
77 - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
78 -  
79 - @ApiOperation("日账汇总单查询")  
80 - @RequestMapping("/queryBillforDayForPage")  
81 - @ResponseBody  
82 - public void queryBillforDayTotalForPage(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request,  
83 - HttpServletResponse response) throws Exception {  
84 - TdCustCompanyService sert = map.get("tdCustCompanyService");  
85 - logger.info("---begin--日账汇总单查询调用后场dubbo服务,入参={}", JSONObject.toJSON(billQueryRequest));  
86 - System.out.println("seesionId="+request.getSession().getId());  
87 - UserInfo userInfo = sessionCommUtil.getUserInfo();  
88 - logger.info("从session中获取的用户信息={}" + JSONObject.toJSONString(userInfo));  
89 - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();  
90 - if (userInfo != null) {  
91 -  
92 - tdCompanyParkQueryRequest.setSysCode(billQueryRequest.getSysCode());  
93 - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());  
94 - tdCompanyParkQueryRequest.setSessionId(request.getSession().getId());  
95 - billQueryRequest.setParkIdList(this.queryParkNoByCustIds(tdCompanyParkQueryRequest));  
96 - }  
97 -  
98 - BizResult<PageBean<BillManageDTO>> result = billManageForDayService.queryBillforDayTotalForPage(billQueryRequest);  
99 - result.setErrMsg(billQueryRequest.getParkIdList().toString());  
100 - logger.info("---end--日账汇总单查询调用后场dubbo服务,结果={}", JSONObject.toJSONString(result));  
101 - this.returnJsonDataGrid(response, result);  
102 - }  
103 -  
104 - /**  
105 - * 查询日账单.<br/>  
106 - *  
107 - * @param request  
108 - * @param response  
109 - * @throws Exception  
110 - */  
111 - @ApiOperation("日账单查看")  
112 - @RequestMapping(value = "/queryBillForDay", method = RequestMethod.POST)  
113 - @ResponseBody  
114 - public void queryBillForDay(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request,  
115 - HttpServletResponse response) throws Exception {  
116 - BizResult<PageBean<BillManageDTO>> result = new BizResult<PageBean<BillManageDTO>>();  
117 - logger.info("---begin---日账单查看调用后场dubbo服务,入参={}", JSONObject.toJSONString(billQueryRequest));  
118 - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();  
119 - UserInfo userInfo = (UserInfo) request.getSession().getAttribute(SessionEnum.USER_INFO.key());  
120 - logger.info("从session中获取的用户信息={}" + JSONObject.toJSONString(userInfo));  
121 - if (userInfo != null) {  
122 -  
123 - tdCompanyParkQueryRequest.setSysCode(billQueryRequest.getSysCode());  
124 - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());  
125 - tdCompanyParkQueryRequest.setSessionId(request.getSession().getId());  
126 - billQueryRequest.setUserName(userInfo.getName());  
127 - billQueryRequest.setParkIdList(this.queryParkNoByCustIds(tdCompanyParkQueryRequest));  
128 -  
129 - }  
130 - result = billManageForDayService.queryBillforDayDeatilPage(billQueryRequest);  
131 - logger.info("---end---日账单查看调用后场dubbo服务,结果={}", JSONObject.toJSON(result));  
132 -  
133 - this.returnJsonDataGrid(response, result);  
134 - }  
135 -  
136 - /**  
137 - * 获取登录用户信息.<br/>  
138 - * @param request  
139 - * @param response  
140 - * @throws Exception  
141 - */  
142 - @RequestMapping(value = "/queryUserInfoForName", method = RequestMethod.POST)  
143 - public void queryUserInfoForName( HttpServletRequest request,  
144 - HttpServletResponse response) throws Exception {  
145 - UserInfo userInfo = (UserInfo) request.getSession().getAttribute(SessionEnum.USER_INFO.key());  
146 - this.returnJson(response, userInfo);  
147 - }  
148 -  
149 -  
150 -  
151 -  
152 -  
153 - /**  
154 - * 日账单导出.<br/>  
155 - *  
156 - * @param request  
157 - * @param response  
158 - * @throws Exception  
159 - */  
160 - @RequestMapping("/exportToExcleForBillForDay")  
161 - public void exportToExcleForBillForDay(String sysCode, String beginTime, String endTime, String aliTotalFee ,  
162 - String aliDealCount,String wxTotalFee,String wxDealCount,String cashTotalFee,String cashDealCount,  
163 - String orderTotalFee,String orderDealCount,  
164 - HttpServletRequest request,String parkIds,String userName,  
165 - HttpServletResponse response) throws Exception {  
166 -  
167 - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
168 - //获取session中的用户信息  
169 - UserInfo userInfo = sessionCommUtil.getUserInfo();  
170 - BillQueryRequest billQueryRequest = new BillQueryRequest();  
171 -  
172 - billQueryRequest.setBeginTime(format.parse(beginTime));  
173 - billQueryRequest.setEndTime(format.parse(endTime));  
174 - billQueryRequest.setSysCode(sysCode);  
175 - billQueryRequest.getBaseRequest().setPageSize(0);  
176 - List<String> parkList= new ArrayList<String>();  
177 - if(StringUtils.isNotEmpty(parkIds)){  
178 - for(String str :parkIds.split(",")){  
179 - if(StringUtils.isNotEmpty(str)){  
180 - parkList.add(str.trim());  
181 - }  
182 - }  
183 - }  
184 - billQueryRequest.setParkIdList(parkList);  
185 - /**查询日账单汇总信息.*/  
186 - BizResult<PageBean<BillManageDTO>> result = billManageForDayService.queryBillforDayDeatilPage(billQueryRequest);  
187 - String[] titleOne = new String[2];  
188 - titleOne[0] = "用户: " + (StringUtils.isNotEmpty(userName) ? userName : "");  
189 - titleOne[1] = "时间: "+beginTime+" "+endTime;  
190 - String[] titleTwo = new String[] {"","现金", "微信", "支付宝", "合计"};  
191 - String[] titleThree = new String[] { "停车场名称", "现金", "微信", "支付宝", "合计"};  
192 - String sheetName = "日账单";  
193 - String fileName = "日账单管理" + format.format(new Date());  
194 -  
195 -  
196 - // 1.创建excel信息  
197 - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName);  
198 - // 2.设置excel表头和表体  
199 - Layouter.buildBillForDay(workSheet, titleOne, 0, 0);//创建第一行标题  
200 - Layouter.buildHeaders(workSheet, titleTwo, 0, 0);//创建第2行标题  
201 - Layouter.buildHeaders(workSheet, titleThree, 3, 0);//创建第3行标题  
202 - // 3.填充数据  
203 - List<Object[]> contentListTwo = new ArrayList<Object[]>();  
204 - for(int i = 0;i<2;i++){  
205 - Object[] str = new Object[titleTwo.length];  
206 - if(i == 0){  
207 - str[0] = "交易笔数";  
208 - str[1] = (cashDealCount == null ? "0" : cashDealCount);  
209 - str[2] = (wxDealCount== null ? "0" : wxDealCount);  
210 - str[3] = (aliDealCount== null ? "0" : aliDealCount);  
211 - str[4] = (orderDealCount== null ? "0" : orderDealCount);  
212 - }else{  
213 - str[0] = "总收入(元)";  
214 - str[1] = (cashTotalFee == null ? "0" : new BigDecimal(cashTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
215 - str[2] = (wxTotalFee== null ? "0" : new BigDecimal(wxTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
216 - str[3] = (aliTotalFee== null ? "0" : new BigDecimal(aliTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
217 - str[4] = (orderTotalFee== null ? "0" : new BigDecimal(orderTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
218 - }  
219 - contentListTwo.add(str);  
220 - }  
221 - ExcleFillDateManager fillUserManagerTwo = new ExcleFillDateManager();  
222 - fillUserManagerTwo.fillSalesOrga(workSheet, titleTwo, contentListTwo, 2); //第2行标题  
223 -  
224 - //  
225 - List<Object[]> contentList = new ArrayList<Object[]>();  
226 - if(result != null && result.getData() != null){  
227 - List<BillManageDTO> list = result.getData().getDataList();  
228 - if(list != null && list.size()>0){  
229 - for (int i = 0; i < list.size(); i++) {  
230 - BillManageDTO e = list.get(i);  
231 - Object[] obj = new Object[titleThree.length];  
232 - int index = 0;  
233 - obj[index++] = e.getParkName();  
234 - obj[index++] = (e.getCashTotalFee()== null ? "0" : e.getCashTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
235 - obj[index++] = (e.getWxTotalFee()== null ? "0" : e.getWxTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
236 - obj[index++] = (e.getAliTotalFee()== null ? "0" : e.getAliTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
237 - obj[index++] = (e.getAliTotalFee()== null ? "0" : e.getAliTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ;  
238 - contentList.add(obj);  
239 - }  
240 - }  
241 - }  
242 -  
243 - ExcleFillDateManager fillUserManager = new ExcleFillDateManager();  
244 - fillUserManager.fillSalesOrga(workSheet, titleThree, contentList, 5);  
245 - // 4.excel输出配置  
246 - ExcelUtil.write(response, workSheet, fileName);  
247 -  
248 -  
249 - }  
250 -  
251 - /**  
252 - * 通过session信息获取停车场编码.<br/>  
253 - *  
254 - * @param billQueryRequest  
255 - * @param userInfo  
256 - * @return  
257 - * @throws Exception  
258 - */  
259 - private List<String> queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws Exception {  
260 - /** 查询停车场编码. */  
261 - BizResult<List<String>> parkNoResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);  
262 - if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) {  
263 - logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData()));  
264 - return parkNoResult.getData();  
265 - } else {  
266 - logger.info("根据登录用户没有获取到对应的停车场编码");  
267 - return null;  
268 - }  
269 -  
270 - }  
271 -  
272 -  
273 -  
274 -}  
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java deleted
1 -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic;  
2 -  
3 -import java.util.List;  
4 -import java.util.Map;  
5 -  
6 -import javax.servlet.http.HttpSession;  
7 -  
8 -import org.apache.commons.lang3.StringUtils;  
9 -import org.slf4j.Logger;  
10 -import org.slf4j.LoggerFactory;  
11 -import org.springframework.beans.factory.annotation.Autowired;  
12 -import org.springframework.web.bind.annotation.PostMapping;  
13 -import org.springframework.web.bind.annotation.RequestMapping;  
14 -import org.springframework.web.bind.annotation.RequestParam;  
15 -import org.springframework.web.bind.annotation.RestController;  
16 -  
17 -import com.alibaba.dubbo.common.utils.CollectionUtils;  
18 -import com.clouds.common.cache.park.ParkingLotCacheUtil;  
19 -import com.clouds.common.entity.UserInfo;  
20 -import com.clouds.common.utils.ResultUtils;  
21 -import com.clouds.common.web.SessionCommUtil;  
22 -import com.clouds.common.web.vo.BizResultVO;  
23 -import com.google.common.collect.Lists;  
24 -import com.zteits.clouds.api.apibase.bean.BizResult;  
25 -import com.zteits.clouds.api.apibase.constants.ErrorType;  
26 -import com.zteits.clouds.api.apibase.exception.BizException;  
27 -import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO;  
28 -import com.zteits.clouds.api.dto.park.param.ParkFreeBerthGetByPlnoRequest;  
29 -import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest;  
30 -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest;  
31 -import com.zteits.clouds.api.service.park.ParkFreeBerthService;  
32 -import com.zteits.clouds.api.service.park.ParkingLotQueryService;  
33 -import com.zteits.clouds.api.service.pay.TdCustCompanyService;  
34 -import com.zteits.irain.portal.vo.govclouds.ParkLotStatisticVO;  
35 -import com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage.ParkLotManageController;  
36 -  
37 -import io.swagger.annotations.Api;  
38 -import io.swagger.annotations.ApiOperation;  
39 -/**  
40 - *  
41 - * Copyright: Copyright (c) 2017 zteits  
42 - *  
43 - * @ClassName: ParkLotStatisticController.java  
44 - * @Description:  
45 - * @version: v1.0.0  
46 - * @author: zhaowg  
47 - * @date: 2017年8月7日 下午5:21:16  
48 - * Modification History:  
49 - * Date Author Version Description  
50 - *---------------------------------------------------------*  
51 - * 2017年8月7日 zhaowg v1.0.0 创建  
52 - */  
53 -  
54 -@Api("停车场信息统计")  
55 -@RestController  
56 -@RequestMapping("parklotstatistic")  
57 -public class ParkLotStatisticController {  
58 - private Logger logger = LoggerFactory.getLogger(ParkLotManageController.class);  
59 - @Autowired  
60 - private HttpSession session;  
61 - @Autowired  
62 - private SessionCommUtil sessionCommUtil;  
63 - @Autowired  
64 - private TdCustCompanyService tdCustCompanyService;  
65 - @Autowired  
66 - private ParkingLotQueryService parkingLotQueryService;  
67 - @Autowired  
68 - private ParkFreeBerthService parkFreeBerthService;  
69 -  
70 - @ApiOperation("获取停车场信息统计")  
71 - @PostMapping("getParkLotStatistic")  
72 - public BizResultVO<List<ParkLotStatisticVO>> getParkLotStatistic(@RequestParam String sysCode) throws Exception{  
73 - List<ParkLotStatisticVO> result = Lists.newArrayList();  
74 - //拥有的停车场编号  
75 - List<String> plNos = this.GetParkLotNosByCurrUser(sysCode);  
76 - //查询对应的停车场信息  
77 - if(CollectionUtils.isEmpty(plNos)){  
78 - return new BizResultVO<List<ParkLotStatisticVO>>().setData(result);  
79 - }  
80 - //空闲车位数  
81 - ParkFreeBerthGetByPlnoRequest request = new ParkFreeBerthGetByPlnoRequest();  
82 - request.setPlNos(plNos);  
83 - request.setSysCode(sysCode);  
84 - BizResult<Map<String, Integer>> freeBerthsNumBizResult = parkFreeBerthService.getParkFreeBerthByPlno(request );  
85 - Map<String, Integer> freeBerthsNumMap = ResultUtils.getBizResultData(freeBerthsNumBizResult);  
86 - for (String plNo : plNos) {  
87 - //先查询缓存  
88 - ParkingLotDTO lotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo);  
89 - if(lotDTO == null){  
90 - //查询数据库  
91 - QueryParkLotInfoByPkNoRequest request1 = new QueryParkLotInfoByPkNoRequest();  
92 - request1.setSysCode(sysCode);  
93 - request1.setPklNo(plNo);  
94 - BizResult<ParkingLotDTO> bizResult2 = parkingLotQueryService.QueryParkingLotByPkNo(request1);  
95 - lotDTO = ResultUtils.getBizResultData(bizResult2);  
96 - }  
97 - if(lotDTO == null || StringUtils.isBlank(lotDTO.getPlName()) || lotDTO.getPlName().equals("null")){  
98 - continue;  
99 - }  
100 - ParkLotStatisticVO lotStatisticVO = new ParkLotStatisticVO();  
101 - lotStatisticVO.setPlNo(plNo);  
102 - lotStatisticVO.setPlName(lotDTO.getPlName());  
103 - lotStatisticVO.setFreeBerthsNum(freeBerthsNumMap.get(plNo));  
104 - lotStatisticVO.setTotalBerthsNum(lotDTO.getPlBerthNum());  
105 - lotStatisticVO.setUseingBerthsNum(lotDTO.getPlBerthNum()-freeBerthsNumMap.get(plNo));  
106 - //设置地磁在线离线数量  
107 - //TODO 临时方案,只有红山区有数据  
108 - result.add(lotStatisticVO);  
109 - }  
110 - return new BizResultVO<List<ParkLotStatisticVO>>().setData(result);  
111 - }  
112 -  
113 - private List<String> GetParkLotNosByCurrUser(String sysCode) throws Exception {  
114 - logger.info("根据登录人权限获取停车场列表");  
115 - List<String> plNos = Lists.newArrayList();  
116 - //2.调用接口查询当前登录人管辖的停车场名称  
117 - plNos.add("A320211000");  
118 - 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 - }*/  
130 - return plNos;  
131 - }  
132 -}  
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java deleted
1 -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic;  
2 -  
3 -import java.sql.Timestamp;  
4 -import java.text.SimpleDateFormat;  
5 -import java.util.ArrayList;  
6 -import java.util.Calendar;  
7 -import java.util.Date;  
8 -import java.util.List;  
9 -import java.util.Map;  
10 -import java.util.Map.Entry;  
11 -  
12 -import javax.servlet.http.HttpServletRequest;  
13 -import javax.servlet.http.HttpServletResponse;  
14 -import javax.servlet.http.HttpSession;  
15 -  
16 -import org.apache.poi.xssf.usermodel.XSSFSheet;  
17 -import org.slf4j.Logger;  
18 -import org.slf4j.LoggerFactory;  
19 -import org.springframework.beans.factory.annotation.Autowired;  
20 -import org.springframework.beans.factory.annotation.Value;  
21 -import org.springframework.stereotype.Controller;  
22 -import org.springframework.web.bind.annotation.GetMapping;  
23 -import org.springframework.web.bind.annotation.PostMapping;  
24 -import org.springframework.web.bind.annotation.RequestBody;  
25 -import org.springframework.web.bind.annotation.RequestMapping;  
26 -import org.springframework.web.bind.annotation.RequestParam;  
27 -import org.springframework.web.bind.annotation.ResponseBody;  
28 -  
29 -import com.alibaba.dubbo.common.utils.CollectionUtils;  
30 -import com.alibaba.fastjson.JSON;  
31 -import com.alibaba.fastjson.JSONObject;  
32 -import com.clouds.common.entity.UserInfo;  
33 -import com.clouds.common.utils.DateUtil;  
34 -import com.clouds.common.utils.ResultUtils;  
35 -import com.clouds.common.utils.excle.ExcelUtil;  
36 -import com.clouds.common.utils.excle.ExcleFillDateManager;  
37 -import com.clouds.common.utils.excle.Layouter;  
38 -import com.clouds.common.web.BizController;  
39 -import com.clouds.common.web.SessionCommUtil;  
40 -import com.clouds.common.web.vo.BizResultVO;  
41 -import com.clouds.common.web.vo.EasyUIDataGridVO;  
42 -import com.google.common.collect.Lists;  
43 -import com.google.common.collect.Maps;  
44 -import com.zteits.clouds.api.apibase.bean.BaseInfo;  
45 -import com.zteits.clouds.api.apibase.bean.BizResult;  
46 -import com.zteits.clouds.api.apibase.bean.PageBean;  
47 -import com.zteits.clouds.api.apibase.constants.ErrorType;  
48 -import com.zteits.clouds.api.apibase.exception.BizException;  
49 -import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO;  
50 -import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO;  
51 -import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest;  
52 -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest;  
53 -import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService;  
54 -import com.zteits.clouds.api.service.pay.TdCustCompanyService;  
55 -import com.zteits.irain.portal.constant.ParkConstant;  
56 -import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.BerthsAndFlowLineChartVO;  
57 -import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO;  
58 -import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO;  
59 -  
60 -import io.swagger.annotations.Api;  
61 -import io.swagger.annotations.ApiOperation;  
62 -  
63 -/**  
64 - *  
65 - * 停车场车流量数据统计 Copyright: Copyright (c) 2017 zteits  
66 - *  
67 - * @ClassName: ParkingLotUseStatisticController.java  
68 - * @Description:  
69 - * @version: v1.0.0  
70 - * @author: langlw  
71 - * @date: 2017年6月14日 下午3:02:39 Modification History: Date Author Version  
72 - * Description ---------------------------------------------------------*  
73 - * 2017年6月14日 langlw v1.0.0 创建  
74 - */  
75 -@Api(value = "停车场车流量数据统计", description = "停车场车流量数据统计")  
76 -@Controller  
77 -@RequestMapping(value = "/VehicleFlowStatistic")  
78 -public class VehicleFlowStatisticController extends BizController {  
79 - private Logger logger = LoggerFactory.getLogger(VehicleFlowStatisticController.class);  
80 -  
81 - @Value("${project.syscode}")  
82 - private String sysCode;  
83 -  
84 - @Autowired  
85 - private ParkingLotUseStatisticService parkingLotStatisticService;  
86 - @Autowired  
87 - private HttpSession session;  
88 - @Autowired  
89 - private SessionCommUtil sessionCommUtil;  
90 - @Autowired  
91 - private TdCustCompanyService tdCustCompanyService;  
92 -  
93 - @ApiOperation("分页查询车流量数据统计车位总流量")  
94 - @PostMapping("getVehicleFlowStatisticForPage")  
95 - @ResponseBody  
96 - public BizResultVO<EasyUIDataGridVO<ParkingLotUseStatisticDTO>> queryParkingLotUseStatisticForPage(  
97 - @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception {  
98 - if (null == request.getBeginTime() || null==request.getEndTime()) {  
99 - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");  
100 - }  
101 - Calendar beginc = Calendar.getInstance();  
102 - beginc.setTime(request.getBeginTime());  
103 - int beginYear = beginc.get(Calendar.YEAR);  
104 - int beginMonth = beginc.get(Calendar.MONTH) + 1;  
105 - int beginDay = beginc.get(Calendar.DAY_OF_MONTH);  
106 -  
107 - Calendar endc = Calendar.getInstance();  
108 - endc.setTime(request.getEndTime());  
109 - int endYear = endc.get(Calendar.YEAR);  
110 - int endMonth = endc.get(Calendar.MONTH) + 1;  
111 - int endDay = endc.get(Calendar.DAY_OF_MONTH);  
112 -  
113 - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) {  
114 - // 2表示按每小时统计  
115 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);  
116 - } else {  
117 - // 3表示按每天统计  
118 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY);  
119 - }  
120 -  
121 - BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService  
122 - .queryParkingLotUseStatisticForPage(request);  
123 - return returnJqGridData(bizResult, ParkingLotUseStatisticDTO.class);  
124 - }  
125 -  
126 - @ApiOperation("查询车流量最大值与最小值")  
127 - @PostMapping("getVehicleFlowMaxAndMin")  
128 - @ResponseBody  
129 - public BizResultVO<ParkingLotUseStatisticMaxAndMinDTO> QueryParkingLotUseStatisticMaxAndMin(  
130 - @RequestBody ParkingLotUseStatisticForPageRequest request) {  
131 - Calendar beginc = Calendar.getInstance();  
132 - beginc.setTime(request.getBeginTime());  
133 - int beginYear = beginc.get(Calendar.YEAR);  
134 - int beginMonth = beginc.get(Calendar.MONTH) + 1;  
135 - int beginDay = beginc.get(Calendar.DAY_OF_MONTH);  
136 -  
137 - Calendar endc = Calendar.getInstance();  
138 - endc.setTime(request.getEndTime());  
139 - int endYear = endc.get(Calendar.YEAR);  
140 - int endMonth = endc.get(Calendar.MONTH) + 1;  
141 - int endDay = endc.get(Calendar.DAY_OF_MONTH);  
142 -  
143 - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) {  
144 - // 2表示按每小时统计  
145 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);  
146 - } else {  
147 - // 3表示按每天统计  
148 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY);  
149 - }  
150 - BizResult<ParkingLotUseStatisticMaxAndMinDTO> bizResult = parkingLotStatisticService  
151 - .QueryVehicleFlowStatisticMaxAndMin(request);  
152 - return new BizResultVO<>(bizResult);  
153 - }  
154 -  
155 - @ApiOperation("导出车流量数据统计excel")  
156 - @GetMapping("exportVehicleFlowStatisticExcel")  
157 - public void excelParkingLotUseStatistic(@RequestParam String beginTime, @RequestParam String endTime,  
158 - @RequestParam String plNos, HttpServletRequest requests, HttpServletResponse response) {  
159 - ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest();  
160 - request.setSysCode(sysCode);  
161 - request.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT));  
162 - request.setEndTime(DateUtil.to_date(endTime, DateUtil.DATETIME_FORMAT));  
163 - List<String> plNoslist = new ArrayList<>();  
164 - plNoslist.add(plNos);  
165 - request.setPlNos(plNoslist);  
166 - request.setBaseRequest(new BaseInfo(1, 0));  
167 - Calendar beginc = Calendar.getInstance();  
168 - beginc.setTime(request.getBeginTime());  
169 - int beginYear = beginc.get(Calendar.YEAR);  
170 - int beginMonth = beginc.get(Calendar.MONTH) + 1;  
171 - int beginDay = beginc.get(Calendar.DAY_OF_MONTH);  
172 -  
173 - Calendar endc = Calendar.getInstance();  
174 - endc.setTime(request.getEndTime());  
175 - int endYear = endc.get(Calendar.YEAR);  
176 - int endMonth = endc.get(Calendar.MONTH) + 1;  
177 - int endDay = endc.get(Calendar.DAY_OF_MONTH);  
178 -  
179 - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) {  
180 - // 2表示按每小时统计  
181 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);  
182 - } else {  
183 - // 3表示按每天统计  
184 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY);  
185 - }  
186 - BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService  
187 - .queryParkingLotUseStatisticForPage(request);  
188 - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
189 - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd");  
190 - String[] title = new String[] { "时间", "总车流量", "临时车流量", "固定车流量" };  
191 - String sheetName = "车流量管理";  
192 - String fileName = "车流量管理" + format2.format(new Date());  
193 - // 1.创建excel信息  
194 - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName);  
195 - // 2.设置excel表头和表体  
196 - Layouter.buildReport(workSheet, title, 0, 0);  
197 - // 3.填充数据  
198 - List<Object[]> contentList = new ArrayList<Object[]>();  
199 - List<ParkingLotUseStatisticDTO> list = new ArrayList<>();  
200 - if (CollectionUtils.isNotEmpty(bizResult.getData().getDataList())) {  
201 - list = bizResult.getData().getDataList();  
202 - }  
203 - for (ParkingLotUseStatisticDTO e : list) {  
204 - Object[] obj = new Object[title.length];  
205 - int index = 0;  
206 - obj[index++] = format.format(e.getStatisticBeginTime());  
207 - obj[index++] = e.getVehicleFlow();  
208 - obj[index++] = e.getTmpVehicleFlow();  
209 - obj[index++] = e.getFixVehicleFlow();  
210 - contentList.add(obj);  
211 - }  
212 - ExcleFillDateManager fillUserManager = new ExcleFillDateManager();  
213 - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2);  
214 - // 4.excel输出配置  
215 - ExcelUtil.write(response, workSheet, fileName);  
216 - }  
217 -  
218 - /**  
219 - * 根据时间获取车流量折线图  
220 - *  
221 - * @param request  
222 - * @return  
223 - * @throws Exception  
224 - */  
225 - @ApiOperation("根据时间获取车流量折线图")  
226 - @PostMapping("getVehicleFlowForLineChart")  
227 - @ResponseBody  
228 - public BizResultVO<LineChartVO> getVehicleFlowForLineChart(  
229 - @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception {  
230 -  
231 - if (null == request.getBeginTime() || null==request.getEndTime()) {  
232 - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");  
233 - }  
234 - //2.调用接口查询当前登录人管辖的停车场名称  
235 - UserInfo userInfo = sessionCommUtil.getUserInfo();  
236 - List<String> plNos = new ArrayList<>();  
237 - if(userInfo!=null){  
238 - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();  
239 - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());  
240 - tdCompanyParkQueryRequest.setSessionId(session.getId());  
241 - tdCompanyParkQueryRequest.setSysCode(sysCode);  
242 - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest);  
243 - //拥有的停车场编号  
244 - plNos = ResultUtils.getBizResultData(bizResult);  
245 - }  
246 - if(CollectionUtils.isEmpty(plNos)){  
247 - throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在");  
248 - }  
249 - request.setPlNos(plNos);  
250 -  
251 - logger.info("根据停车场编号获取该停车场今日车流量和车位折线图");  
252 - Calendar beginTime = Calendar.getInstance();  
253 - beginTime.setTime(request.getBeginTime());  
254 -  
255 - Calendar endTime = Calendar.getInstance();  
256 - endTime.setTime(request.getEndTime());  
257 -  
258 - Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()),  
259 - new Timestamp(request.getBeginTime().getTime()));  
260 - List<String> xAxisData = Lists.newArrayList();  
261 - request.setBaseRequest(new BaseInfo(1, 0));  
262 - String dateType="";  
263 -  
264 - if (dayDifference == 0L) {  
265 - // 20分钟为一个时间戳  
266 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE);  
267 - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY) * 3;  
268 - for (int i = 0; i < totaltimestampCount; i++) {  
269 - String hour = String.format("%02d", (i / 3));  
270 - String minute = String.format("%02d", (i % 3) * 20);  
271 - xAxisData.add(hour + ":" + minute);  
272 - }  
273 - dateType="HH:mm";  
274 - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType);  
275 - return new BizResultVO<LineChartVO>().setData(vehicleFlows);  
276 -  
277 - } else if (dayDifference <= 3L) {  
278 - // 1小时为一个时间戳  
279 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR);  
280 - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY);  
281 - String day = "";  
282 - String month = "";  
283 - for (int i = 0; i < dayDifference.intValue(); i++) {  
284 - beginTime.add(Calendar.DAY_OF_MONTH, 1);  
285 - int beginMonth = beginTime.get(Calendar.MONTH) + 1;  
286 - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);  
287 - month = String.format("%02d", (beginMonth));  
288 - day = String.format("%02d", (beginDay));  
289 - for (int j = 0; j < totaltimestampCount; j++) {  
290 - String hour = String.format("%02d", (j));  
291 - xAxisData.add(month + "-" + day + " " + hour);  
292 - }  
293 - }  
294 - dateType="MM-dd HH";  
295 - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType);  
296 - return new BizResultVO<LineChartVO>().setData(vehicleFlows);  
297 -  
298 - } else {  
299 - // 1天为一个时间戳  
300 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY);  
301 - for (int i = 0; i < dayDifference.intValue(); i++) {  
302 - beginTime.add(Calendar.DAY_OF_MONTH, 1);  
303 - int beginMonth = beginTime.get(Calendar.MONTH) + 1;  
304 - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH);  
305 - String month = String.format("%02d", (beginMonth));  
306 - String day = String.format("%02d", (beginDay));  
307 - xAxisData.add(month + "-" + day);  
308 -  
309 - }  
310 - dateType="MM-dd";  
311 - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType);  
312 - return new BizResultVO<LineChartVO>().setData(vehicleFlows);  
313 -  
314 - }  
315 -  
316 - }  
317 -  
318 -  
319 - private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request,  
320 - List<String> xAxisData,String dateType){  
321 - // 调用后场服务  
322 - logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request));  
323 - BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService  
324 - .queryParkingLotUseStatisticForPage(request);  
325 - PageBean<ParkingLotUseStatisticDTO> pageBean = ResultUtils.getBizResultData(bizResult);  
326 - List<ParkingLotUseStatisticDTO> useStatisticDTOs = Lists.newArrayList();  
327 - if (pageBean != null) {  
328 - useStatisticDTOs = pageBean.getDataList();  
329 - }  
330 -  
331 - // 保存固定车流量,时间戳和车流量对应关系  
332 - Map<String, Integer> fixVehicleFlowMap = Maps.newHashMap();  
333 - // 保存临时车流量,时间戳和车流量对应关系  
334 - Map<String, Integer> tmpVehicleFlowMap = Maps.newHashMap();  
335 - // 停车场编号和名称对应关系  
336 - Map<String, String> parkNameMap = Maps.newHashMap();  
337 - // 通过停车场,和统计时间分组  
338 - // Map<String, Map<String, Double>> parkLotMap = Maps.newHashMap();  
339 - if (!CollectionUtils.isEmpty(useStatisticDTOs)) {  
340 - for (ParkingLotUseStatisticDTO statisticDTO : useStatisticDTOs) {  
341 - String key = statisticDTO.getPlNo();  
342 - parkNameMap.put(key, statisticDTO.getPlName());  
343 - String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType);  
344 - //保存固定车流量和临时车流量  
345 - fixVehicleFlowMap.put(statisBeginTime, (fixVehicleFlowMap.get(statisBeginTime)==null?0:fixVehicleFlowMap.get(statisBeginTime))+statisticDTO.getFixVehicleFlow());  
346 - tmpVehicleFlowMap.put(statisBeginTime, (tmpVehicleFlowMap.get(statisBeginTime)==null?0:tmpVehicleFlowMap.get(statisBeginTime))+statisticDTO.getTmpVehicleFlow());  
347 - }  
348 - }  
349 -  
350 - // 封装车流量统计  
351 - LineChartVO vehicleFlows = new LineChartVO();  
352 - List<String> vehicleFlows_legendData = Lists.newArrayList();  
353 - vehicleFlows_legendData.add("临时车");  
354 - vehicleFlows_legendData.add("固定车");  
355 - vehicleFlows.setLegendData(vehicleFlows_legendData);  
356 - vehicleFlows.setxAxisData(xAxisData);  
357 - List<SerieVO> vehicleSeries = Lists.newArrayList();  
358 - // 固定车  
359 - SerieVO fixSerieVo = new SerieVO();  
360 - fixSerieVo.setName("固定车");  
361 - List<Integer> fixSerieVoData = Lists.newArrayList();  
362 - // 临时车  
363 - SerieVO tmpSerieVo = new SerieVO();  
364 - tmpSerieVo.setName("临时车");  
365 - List<Integer> tmpSerieVoData = Lists.newArrayList();  
366 - // 保存上一次的临时车值,当某个时间点没有数据时,则保持和上次一致  
367 - Integer lastfixFlow = 0;  
368 - Integer lasttmpFlow = 0;  
369 - for (String timestamp : xAxisData) {  
370 -  
371 - if (fixVehicleFlowMap.containsKey(timestamp)) {  
372 - lastfixFlow = fixVehicleFlowMap.get(timestamp).intValue();  
373 - }else{  
374 - lastfixFlow =0;  
375 - }  
376 - fixSerieVoData.add(lastfixFlow);  
377 -  
378 - if (tmpVehicleFlowMap.containsKey(timestamp)) {  
379 - lasttmpFlow = tmpVehicleFlowMap.get(timestamp).intValue();  
380 - }else{  
381 - lasttmpFlow = 0;  
382 - }  
383 - tmpSerieVoData.add(lasttmpFlow);  
384 - }  
385 - fixSerieVo.setData(fixSerieVoData);  
386 - vehicleSeries.add(fixSerieVo);  
387 - tmpSerieVo.setData(tmpSerieVoData);  
388 - vehicleSeries.add(tmpSerieVo);  
389 -  
390 - vehicleFlows.setSeries(vehicleSeries);  
391 - return vehicleFlows;  
392 - }  
393 -  
394 - public static void main(String[] args) {  
395 - String json="{\"id\":\"1\",\"platform\":\"android\",\"parameter\":{\"drid\":\"177277364\",\"sex\":\"1\",\"type\":\"2\",\"creatorname\":\"Mrw\",\"username\":\"jack\",\"pwd\":\"123456\",\"remark\":\"平板用户\",\"createtime\":\"2017-07-24 23:59:59\"}}";  
396 - JSONObject object =(JSONObject)JSONObject.parse(json);  
397 - System.out.println(object.get("id"));  
398 - System.out.println(object.get("platform"));  
399 - JSONObject parameter =(JSONObject)object.get("parameter");  
400 - System.out.println(parameter.get("drid"));  
401 - System.out.println(parameter.get("sex"));  
402 - }  
403 -  
404 -  
405 -}  
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/YearMonthCardStatisticController.java deleted
1 -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic;  
2 -  
3 -import java.text.SimpleDateFormat;  
4 -import java.util.ArrayList;  
5 -import java.util.Date;  
6 -import java.util.List;  
7 -  
8 -import javax.servlet.http.HttpServletRequest;  
9 -import javax.servlet.http.HttpServletResponse;  
10 -  
11 -import com.alibaba.dubbo.common.utils.CollectionUtils;  
12 -import com.alibaba.fastjson.JSON;  
13 -  
14 -import com.clouds.common.utils.excle.ExcelUtil;  
15 -import com.clouds.common.utils.excle.ExcleFillDateManager;  
16 -import com.clouds.common.utils.excle.Layouter;  
17 -import com.clouds.common.web.BizController;  
18 -import com.clouds.common.web.vo.BizResultVO;  
19 -import com.clouds.common.web.vo.EasyUIDataGridVO;  
20 -import com.zteits.clouds.api.apibase.bean.BaseInfo;  
21 -import com.zteits.clouds.api.apibase.bean.BizResult;  
22 -import com.zteits.clouds.api.apibase.bean.PageBean;  
23 -import com.zteits.clouds.api.apibase.constants.ErrorType;  
24 -import com.zteits.clouds.api.apibase.exception.BizException;  
25 -import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticDTO;  
26 -import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticSumDTO;  
27 -import com.zteits.clouds.api.dto.pay.param.YearMonthCardStatisticRequest;  
28 -import com.zteits.clouds.api.service.clouds.YearMonthCardStatisticService;  
29 -import io.swagger.annotations.Api;  
30 -import io.swagger.annotations.ApiOperation;  
31 -import org.apache.poi.xssf.usermodel.XSSFSheet;  
32 -import org.slf4j.Logger;  
33 -import org.slf4j.LoggerFactory;  
34 -import org.springframework.beans.factory.annotation.Autowired;  
35 -import org.springframework.beans.factory.annotation.Value;  
36 -import org.springframework.web.bind.annotation.GetMapping;  
37 -import org.springframework.web.bind.annotation.PostMapping;  
38 -import org.springframework.web.bind.annotation.RequestBody;  
39 -import org.springframework.web.bind.annotation.RequestMapping;  
40 -import org.springframework.web.bind.annotation.RequestParam;  
41 -import org.springframework.web.bind.annotation.ResponseBody;  
42 -import org.springframework.web.bind.annotation.RestController;  
43 -  
44 -/**  
45 - * 企业云平台->数据统计->年卡月卡统计。  
46 - *  
47 - * Copyright: Copyright (c) 2017 zteits  
48 - *  
49 - * @ClassName: InOutParkStatisticController.java  
50 - * @Description:  
51 - * @version: v1.0.0  
52 - * @author: langlw  
53 - * @date: 2017年7月26日 上午11:30:04  
54 - * Modification History:  
55 - * Date Author Version Description  
56 - * ---------------------------------------------------------*  
57 - * 2017年7月26日 langlw v1.0.0 创建  
58 - */  
59 -@Api(value = "企业云平台->数据统计->年卡月卡统计", description = "企业云平台->数据统计->年卡月卡统计")  
60 -@RestController  
61 -@RequestMapping(value = "/yearMonthCardStatistic")  
62 -public class YearMonthCardStatisticController extends BizController {  
63 -  
64 - private static final Logger logger = LoggerFactory.getLogger(InOutParkStatisticController.class);  
65 -  
66 - @Value("${project.syscode}")  
67 - private String sysCode;  
68 - @Autowired  
69 - private YearMonthCardStatisticService yearMonthCardStatisticService;  
70 -  
71 - @ApiOperation("年卡月卡统计")  
72 - @PostMapping("queryYearMonthCardStatistic")  
73 - @ResponseBody  
74 - public BizResultVO<EasyUIDataGridVO<YearMonthCardStatisticDTO>> queryYearMonthCardStatistic(  
75 - @RequestBody YearMonthCardStatisticRequest request) throws Exception {  
76 - logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request));  
77 - if (null == request.getBeginTime() || null == request.getEndTime()) {  
78 - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");  
79 - }  
80 - BizResult<PageBean<YearMonthCardStatisticDTO>> bizResult = yearMonthCardStatisticService  
81 - .queryYearMonthCardStatistic(request);  
82 - return returnJqGridData(bizResult, YearMonthCardStatisticDTO.class);  
83 - }  
84 -  
85 - @ApiOperation("年卡月卡统计折线图")  
86 - @PostMapping("queryYearMonthCardStatisticForChart")  
87 - @ResponseBody  
88 - public BizResultVO<List<YearMonthCardStatisticSumDTO>> queryYearMonthCardStatisticForChart(  
89 - @RequestBody YearMonthCardStatisticRequest request) throws Exception {  
90 - logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request));  
91 - if (null == request.getBeginTime() || null == request.getEndTime()) {  
92 - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间");  
93 - }  
94 - BizResult<List<YearMonthCardStatisticSumDTO>> bizResult = yearMonthCardStatisticService  
95 - .queryYearMonthCardStatisticSum(request);  
96 - logger.info("调用DUBBO服务返回结果:" + JSON.toJSONString(bizResult));  
97 - return new BizResultVO<>(bizResult);  
98 - }  
99 -  
100 - @ApiOperation("导出年卡月卡统计excel")  
101 - @GetMapping("exportYearMonthStatisticExcel")  
102 - public void exportYearMonthStatisticExcel(@RequestParam Long beginTime, @RequestParam Long endTime,  
103 - @RequestParam List<String> parkIdList, @RequestParam String parkNames,  
104 - Integer orderType, Integer payType, Integer dataState,  
105 - HttpServletRequest requests, HttpServletResponse response) throws Exception {  
106 -  
107 - YearMonthCardStatisticRequest request = new YearMonthCardStatisticRequest();  
108 - request.setSysCode(sysCode);  
109 - request.setBeginTime(new Date(beginTime));  
110 - request.setEndTime(new Date(endTime));  
111 -  
112 - request.setParkIdList(parkIdList);  
113 - request.setBaseRequest(new BaseInfo(1, 0));  
114 - request.setOrderType(orderType);  
115 - request.setPayType(payType);  
116 - request.setDataState(dataState);  
117 -  
118 - BizResult<PageBean<YearMonthCardStatisticDTO>> bizResult = yearMonthCardStatisticService  
119 - .queryYearMonthCardStatistic(request);  
120 - BizResult<List<YearMonthCardStatisticSumDTO>> bizResultSum = yearMonthCardStatisticService  
121 - .queryYearMonthCardStatisticSum(request);  
122 -  
123 - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
124 - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd");  
125 - String[] title = new String[] {"交易时间", "停车场", "类型", "车牌号", "支付方式", "支付金额", "有效期", "状态"};  
126 - String sheetName = "年卡月卡统计";  
127 - String fileName = "年卡月卡统计" + format2.format(new Date());  
128 -  
129 - String[] billTitle = new String[9];  
130 - billTitle = new String[2];  
131 - //if (!org.springframework.util.CollectionUtils.isEmpty(bizResultSum.getData())) {  
132 - // List<YearMonthCardStatisticSumDTO> dtoList = bizResultSum.getData();  
133 - // String amountsum = "";  
134 - // String sum = "";  
135 - // for (YearMonthCardStatisticSumDTO dto : dtoList) {  
136 - // amountsum = dto.getAmountSum() == null ? " " : dto.getAmountSum() + "," + amountsum;  
137 - // sum = dto.getOrderSum() + "," + sum;  
138 - // }  
139 - // String ordertype = "";  
140 - // if (null != orderType) {  
141 - // if (2 == orderType) {  
142 - // ordertype = "年卡";  
143 - // } else if (3 == orderType) {  
144 - // ordertype = "月卡";  
145 - // }  
146 - // }  
147 - // String datastate = "";  
148 - // if (null != dataState) {  
149 - // if (1 == dataState) {  
150 - // datastate = "有效";  
151 - // } else if (0 == dataState) {  
152 - // datastate = "无效";  
153 - // }  
154 - // }  
155 - //  
156 - billTitle[0] = "年卡月卡统计";  
157 - // billTitle[1] = "汇总";  
158 - // billTitle[2] = "停车场: " + parkNames;  
159 - // billTitle[3] = "时间: " + endTime;  
160 - // billTitle[4] = "类型:" + (orderType != null ? ordertype : "");  
161 - // billTitle[5] = "状态: " + (dataState != null ? datastate : "");  
162 - // billTitle[6] = "支付方式: " + (payType != null ? payType : "");  
163 - // billTitle[7] = "每个月的总笔数" + sum;  
164 - // billTitle[8] = "每个月的总金额数" + amountsum;  
165 - //} else {  
166 - // billTitle[0] = "年卡月卡统计";  
167 - // billTitle[1] = "汇总";  
168 - // billTitle[2] = "停车场: ";  
169 - // billTitle[3] = "时间: ";  
170 - // billTitle[4] = "类型:";  
171 - // billTitle[5] = "状态: ";  
172 - // billTitle[6] = "支付方式: ";  
173 - // billTitle[7] = "每个月的总车数";  
174 - // billTitle[8] = "每个月的总金额数";  
175 - //}  
176 -  
177 - // 1.创建excel信息  
178 - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName);  
179 - // 2.设置excel表头和表体  
180 - Layouter.buildReport(workSheet, title,0,0);  
181 - // 3.填充数据  
182 - List<Object[]> contentList = new ArrayList<Object[]>();  
183 - List<YearMonthCardStatisticDTO> list = new ArrayList<>();  
184 - if (CollectionUtils.isNotEmpty(bizResult.getData().getDataList())) {  
185 - list = bizResult.getData().getDataList();  
186 - }  
187 - for (YearMonthCardStatisticDTO e : list) {  
188 - Object[] obj = new Object[title.length];  
189 - int index = 0;  
190 - obj[index++] = e.getPayFinishTime() != null ? format.format(e.getPayFinishTime()) : "";  
191 - obj[index++] = e.getParkName();  
192 - String cardType="";  
193 - if (null != e.getOrderType()) {  
194 - if (2 == e.getOrderType()) {  
195 - cardType = "年卡";  
196 - }else{  
197 - cardType = "月卡";  
198 - }  
199 - }  
200 - obj[index++]=cardType;  
201 - obj[index++] = e.getCarNumber();  
202 - if (e.getPayType() != null) {  
203 - switch (e.getPayType()) {  
204 - case 1:  
205 - obj[index++] = "支付宝";  
206 - break;  
207 - case 2:  
208 - obj[index++] = "微信";  
209 - break;  
210 - case 3:  
211 - obj[index++] = "银联";  
212 - break;  
213 - case 4:  
214 - obj[index++] = "微信";  
215 - break;  
216 - default:  
217 - obj[index++] = "现金";  
218 - break;  
219 - }  
220 - } else {  
221 - obj[index++] = "";  
222 - }  
223 - obj[index++] = e.getAmount() != null ? e.getAmount() : "0.00";  
224 - obj[index++] = e.getEffDate() != null ? format.format(e.getEffDate())  
225 - : "" + "-" + e.getExpDate() != null ? format.format(e.getExpDate()) : "";  
226 - //有效、无效  
227 - Date d = new Date();  
228 - String state = "";  
229 - if ((d.getTime() <= e.getExpDate().getTime()) && (d.getTime() >= e.getEffDate().getTime())) {  
230 - state = "有效";  
231 - } else {  
232 - state = "无效";  
233 - }  
234 - obj[index++] = state;  
235 - contentList.add(obj);  
236 - }  
237 - ExcleFillDateManager fillUserManager = new ExcleFillDateManager();  
238 - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2);  
239 - // 4.excel输出配置  
240 - ExcelUtil.write(response, workSheet, fileName);  
241 - }  
242 -  
243 -}  
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java deleted
1 -package com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage;  
2 -  
3 -import java.util.List;  
4 -import java.util.Map;  
5 -  
6 -import javax.servlet.http.HttpSession;  
7 -  
8 -import org.apache.commons.lang3.StringUtils;  
9 -import org.slf4j.Logger;  
10 -import org.slf4j.LoggerFactory;  
11 -import org.springframework.beans.factory.annotation.Autowired;  
12 -import org.springframework.web.bind.annotation.GetMapping;  
13 -import org.springframework.web.bind.annotation.RequestMapping;  
14 -import org.springframework.web.bind.annotation.RequestParam;  
15 -import org.springframework.web.bind.annotation.RestController;  
16 -  
17 -import com.alibaba.dubbo.common.utils.CollectionUtils;  
18 -import com.clouds.common.cache.park.ParkingLotCacheUtil;  
19 -import com.clouds.common.entity.UserInfo;  
20 -import com.clouds.common.utils.ResultUtils;  
21 -import com.clouds.common.web.SessionCommUtil;  
22 -import com.clouds.common.web.vo.BizResultVO;  
23 -import com.google.common.collect.Lists;  
24 -import com.google.common.collect.Maps;  
25 -import com.zteits.clouds.api.apibase.bean.BizResult;  
26 -import com.zteits.clouds.api.apibase.constants.ErrorType;  
27 -import com.zteits.clouds.api.apibase.exception.BizException;  
28 -import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO;  
29 -import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest;  
30 -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest;  
31 -import com.zteits.clouds.api.service.park.ParkingLotQueryService;  
32 -import com.zteits.clouds.api.service.pay.TdCustCompanyService;  
33 -  
34 -import io.swagger.annotations.Api;  
35 -import io.swagger.annotations.ApiOperation;  
36 -  
37 -/**  
38 - * 停车场管理  
39 - *  
40 - * Copyright: Copyright (c) 2017 zteits  
41 - *  
42 - * @ClassName: ParkingLotController.java  
43 - * @Description:  
44 - * @version: v1.0.0  
45 - * @author: zhaowg  
46 - * @date: 2017年6月16日 下午5:27:21  
47 - * Modification History:  
48 - * Date Author Version Description  
49 - *---------------------------------------------------------*  
50 - * 2017年6月16日 zhaowg v1.0.0 创建  
51 - */  
52 -@Api(value="停车场管理",description="停车场管理")  
53 -@RestController  
54 -@RequestMapping("parkLotManage")  
55 -public class ParkLotManageController{  
56 - private Logger logger = LoggerFactory.getLogger(ParkLotManageController.class);  
57 - @Autowired  
58 - private HttpSession session;  
59 - @Autowired  
60 - private SessionCommUtil sessionCommUtil;  
61 - @Autowired  
62 - private TdCustCompanyService tdCustCompanyService;  
63 - @Autowired  
64 - private ParkingLotQueryService parkingLotQueryService;  
65 - /**  
66 - * 根据登录人权限获取停车场名称列表  
67 - * @return  
68 - * 2017年6月16日 zhaowg  
69 - * @throws Exception  
70 - */  
71 - @ApiOperation("根据登录人权限获取停车场名称列表")  
72 - @GetMapping("getParkLotNamesByUserId")  
73 - public BizResultVO<List<Map<String,String>>> GetParkLotNameListByUserId(@RequestParam String sysCode) throws Exception {  
74 - List<Map<String,String>> result = Lists.newArrayList();  
75 - //拥有的停车场编号  
76 - List<String> plNos = this.GetParkLotNosByCurrUser(sysCode);  
77 - //查询对应的停车场信息  
78 - if(CollectionUtils.isEmpty(plNos)){  
79 - return new BizResultVO<List<Map<String,String>>>().setData(result);  
80 - }  
81 - for (String plNo : plNos) {  
82 - Map<String,String> plNoMap = Maps.newHashMap();  
83 - //先查询缓存  
84 - ParkingLotDTO lotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo);  
85 - if(lotDTO == null){  
86 - //查询数据库  
87 - QueryParkLotInfoByPkNoRequest request = new QueryParkLotInfoByPkNoRequest();  
88 - request.setSysCode(sysCode);  
89 - request.setPklNo(plNo);  
90 - BizResult<ParkingLotDTO> bizResult2 = parkingLotQueryService.QueryParkingLotByPkNo(request);  
91 - lotDTO = ResultUtils.getBizResultData(bizResult2);  
92 - }  
93 - if(lotDTO == null || StringUtils.isBlank(lotDTO.getPlName()) || lotDTO.getPlName().equals("null")){  
94 - continue;  
95 - }  
96 - plNoMap.put("code",plNo );  
97 - plNoMap.put("name",lotDTO.getPlName());  
98 - result.add(plNoMap);  
99 - }  
100 -  
101 - return new BizResultVO<List<Map<String,String>>>().setData(result);  
102 - }  
103 -  
104 - private List<String> GetParkLotNosByCurrUser(String sysCode) throws Exception {  
105 - logger.info("根据登录人权限获取停车场列表");  
106 - List<String> plNos = Lists.newArrayList();  
107 - //2.调用接口查询当前登录人管辖的停车场名称  
108 - UserInfo userInfo = sessionCommUtil.getUserInfo();  
109 - if(userInfo!=null){  
110 - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();  
111 - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());  
112 - tdCompanyParkQueryRequest.setSysCode(sysCode);  
113 - tdCompanyParkQueryRequest.setSessionId(session.getId());  
114 - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest );  
115 - plNos = ResultUtils.getBizResultData(bizResult);  
116 - }else{  
117 - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS);  
118 - }  
119 - return plNos;  
120 - }  
121 -}  
src/main/resources/application-wwwtown.properties 0 → 100644
  1 +#irain
  2 +irain.url=http://api.parkingwang.com:8280
  3 +server.port=8094
  4 +#irain艾润
  5 +irain.appid=avakrky0gk1m7n00
  6 +#irain
  7 +irain.appsecret=rrr6uz3aqvutpsq2lsna0k18cea4mabw
  8 +#irain aes
  9 +irain.aes=avakrky0gk1m7n00
  10 +
  11 +irain.park_code=734861a1e8656ffa51bdd90829941ca9
  12 +
  13 +spring.dubbo.application.name=${spring.application.name}
  14 +spring.dubbo.registry.address=zookeeper://10.112.92.88:2181?backup=10.112.92.87:2181
  15 +spring.dubbo.provider.version=1.0.0
  16 +spring.dubbo.cunsumer.check=false
  17 +
  18 +#spring session redis config
  19 +spring.redis.host=10.112.92.88
  20 +spring.redis.port=7001
  21 +spring.redis.password=myredis
  22 +
  23 +#ebochong config
  24 +ebochong.url=
  25 +ebochong.clientCode=12345678
  26 +ebochong.key=2xJLZAlyolvMMz4+c/8nRA==
0 \ No newline at end of file 27 \ No newline at end of file
src/main/resources/application.properties
1 project.syscode=zteits-park-portal 1 project.syscode=zteits-park-portal
2 spring.application.name=zteits-park-portal 2 spring.application.name=zteits-park-portal
3 -server.port=8099 3 +server.port=8094
4 4
5 # logging 5 # logging
6 logging.level.root=info 6 logging.level.root=info
src/main/resources/dubbo/dubbo-park-consumer.xml
@@ -138,4 +138,21 @@ @@ -138,4 +138,21 @@
138 version="${spring.dubbo.provider.version}" 138 version="${spring.dubbo.provider.version}"
139 timeout="30000"/> 139 timeout="30000"/>
140 140
  141 + <dubbo:reference id="berthManageService" interface="com.zteits.clouds.api.service.park.BerthManageService"
  142 + version="${spring.dubbo.provider.version}"
  143 + timeout="30000"/>
  144 +
  145 + <!-- PDA管理 -->
  146 + <dubbo:reference id="tpPPdaService" interface="com.zteits.clouds.api.service.park.TpPPdaService"
  147 + version="${spring.dubbo.provider.version}"
  148 + timeout="30000"/>
  149 +
  150 + <!-- 政府云平台->24小时占用率 -->
  151 + <dubbo:reference id="parkOccupyService" interface="com.zteits.clouds.api.service.govclouds.ParkOccupyService"
  152 + version="${spring.dubbo.provider.version}"
  153 + timeout="30000"/>
  154 +
  155 + <!-- 实时停车 实时 -->
  156 + <dubbo:reference id="realtimeInfoService" interface="com.zteits.clouds.api.service.govclouds.RealtimeInfoService"
  157 + version="${spring.dubbo.provider.version}" timeout="30000"/>
141 </beans> 158 </beans>
142 \ No newline at end of file 159 \ No newline at end of file