diff --git a/.gitignore b/.gitignore index 7b281fc..4c07105 100644 --- a/.gitignore +++ b/.gitignore @@ -98,3 +98,5 @@ local.properties .worksheet .idea *.iml +/logging.path_IS_UNDEFINEDlogging.file_IS_UNDEFINED-2017-08-18.0.log +/logging.path_IS_UNDEFINEDlogging.file_IS_UNDEFINED-2017-08-28.0.log diff --git a/src/main/java/com/zteits/irain/portal/ParkPortalApplication.java b/src/main/java/com/zteits/irain/portal/ParkPortalApplication.java index c4cc9d4..334e21f 100644 --- a/src/main/java/com/zteits/irain/portal/ParkPortalApplication.java +++ b/src/main/java/com/zteits/irain/portal/ParkPortalApplication.java @@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.EnableAspectJAutoProxy; diff --git a/src/main/java/com/zteits/irain/portal/config/RedisMsgListenerContainer.java b/src/main/java/com/zteits/irain/portal/config/RedisMsgListenerContainer.java index fd7214e..ce255cd 100644 --- a/src/main/java/com/zteits/irain/portal/config/RedisMsgListenerContainer.java +++ b/src/main/java/com/zteits/irain/portal/config/RedisMsgListenerContainer.java @@ -1,4 +1,4 @@ -package com.zteits.irain.portal.config; +/*package com.zteits.irain.portal.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -9,7 +9,7 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer; import com.clouds.common.constants.RedisKeyEnum; import com.zteits.irain.portal.config.listener.FreeBrethsListener; -/** +*//** * redis 消息队列监听容器 * * Copyright: Copyright (c) 2017 zteits @@ -23,17 +23,17 @@ import com.zteits.irain.portal.config.listener.FreeBrethsListener; * Date Author Version Description *---------------------------------------------------------* * 2017年6月7日 zhaowg v1.0.0 创建 - */ + *//* @Configuration public class RedisMsgListenerContainer { - /** + *//** * 空闲车位监听容器 * @param connectionFactory * @param brethsListener * @return * 2017年6月7日 zhaowg - */ + *//* @Bean RedisMessageListenerContainer freeBrethscontainer(RedisConnectionFactory connectionFactory,FreeBrethsListener brethsListener) { RedisMessageListenerContainer container = new RedisMessageListenerContainer(); @@ -42,3 +42,4 @@ public class RedisMsgListenerContainer { return container; } } +*/ \ No newline at end of file diff --git a/src/main/java/com/zteits/irain/portal/config/listener/FreeBrethsListener.java b/src/main/java/com/zteits/irain/portal/config/listener/FreeBrethsListener.java index d2b6837..c89f197 100644 --- a/src/main/java/com/zteits/irain/portal/config/listener/FreeBrethsListener.java +++ b/src/main/java/com/zteits/irain/portal/config/listener/FreeBrethsListener.java @@ -1,4 +1,4 @@ -package com.zteits.irain.portal.config.listener; +/*package com.zteits.irain.portal.config.listener; import java.util.ArrayList; import java.util.List; @@ -20,7 +20,7 @@ import com.zteits.irain.portal.service.interfaces.induction.InductionService; import com.zteits.irain.portal.service.interfaces.induction.param.DoLevelTwoAndThreeInductionReleaseBatchRequest; import com.zteits.irain.portal.service.interfaces.induction.param.InductionRelease; -/** +*//** * 空闲车位监听器
* * Copyright: Copyright (c) 2017 zteits @@ -34,7 +34,7 @@ import com.zteits.irain.portal.service.interfaces.induction.param.InductionRelea * Date Author Version Description *---------------------------------------------------------* * 2017年6月7日 zhaowg v1.0.0 创建 - */ + *//* @Component public class FreeBrethsListener implements MessageListener{ private static final Logger logger = LoggerFactory.getLogger(FreeBrethsListener.class); @@ -65,3 +65,4 @@ public class FreeBrethsListener implements MessageListener{ inductionService.doLevelTwoAndThreeInductionReleaseBatch(releaseBatchRequest); } } +*/ \ No newline at end of file diff --git a/src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingDeviceVO.java b/src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingDeviceVO.java new file mode 100644 index 0000000..2bb3f5a --- /dev/null +++ b/src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingDeviceVO.java @@ -0,0 +1,37 @@ +package com.zteits.irain.portal.vo.govclouds; + +import java.io.Serializable; + +public class ParkingDeviceVO implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + /**早先数量*/ + private Integer onlineCount; + /**总量*/ + private Integer allCount; + /**类型*/ + private Integer type; + + public Integer getOnlineCount() { + return onlineCount; + } + public void setOnlineCount(Integer onlineCount) { + this.onlineCount = onlineCount; + } + public Integer getAllCount() { + return allCount; + } + public void setAllCount(Integer allCount) { + this.allCount = allCount; + } + public Integer getType() { + return type; + } + public void setType(Integer type) { + this.type = type; + } + +} diff --git a/src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingStatisVO.java b/src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingStatisVO.java new file mode 100644 index 0000000..022919e --- /dev/null +++ b/src/main/java/com/zteits/irain/portal/vo/govclouds/ParkingStatisVO.java @@ -0,0 +1,58 @@ +package com.zteits.irain.portal.vo.govclouds; + +import java.io.Serializable; +import java.util.List; + +import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; + +public class ParkingStatisVO implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + private List statisList; + /**占用率**/ + private Double avgOccupyRate; + /**周转率*/ + private Double avgTurnoverRate; + /**空闲车位*/ + private Integer freeParkingSpace; + /**停车场设备信息**/ + private List deviceVoList; + + + public Integer getFreeParkingSpace() { + return freeParkingSpace; + } + public void setFreeParkingSpace(Integer freeParkingSpace) { + this.freeParkingSpace = freeParkingSpace; + } + public List getDeviceVoList() { + return deviceVoList; + } + public void setDeviceVoList(List deviceVoList) { + this.deviceVoList = deviceVoList; + } + public List getStatisList() { + return statisList; + } + public void setStatisList(List statisList) { + this.statisList = statisList; + } + public Double getAvgOccupyRate() { + return avgOccupyRate; + } + public void setAvgOccupyRate(Double avgOccupyRate) { + this.avgOccupyRate = avgOccupyRate; + } + public Double getAvgTurnoverRate() { + return avgTurnoverRate; + } + public void setAvgTurnoverRate(Double avgTurnoverRate) { + this.avgTurnoverRate = avgTurnoverRate; + } + +} diff --git a/src/main/java/com/zteits/irain/portal/vo/parkinglotdatacenter/ParkLotAndBerthsCountVO.java b/src/main/java/com/zteits/irain/portal/vo/parkinglotdatacenter/ParkLotAndBerthsCountVO.java index 399c62f..6a811a7 100644 --- a/src/main/java/com/zteits/irain/portal/vo/parkinglotdatacenter/ParkLotAndBerthsCountVO.java +++ b/src/main/java/com/zteits/irain/portal/vo/parkinglotdatacenter/ParkLotAndBerthsCountVO.java @@ -24,6 +24,11 @@ public class ParkLotAndBerthsCountVO { private Map pkberthsCount; //key:区县名称,value:停车场数 private Map pkCount; + //key:区县名称,value:map{key:plType,停车场类型,value :车位数 } + private Map pkberthsCountMap; + //key:区县名称,value:map{key:plType,停车场类型,value :停车场数 } + private Map pkCountMap; + public Map getPkberthsCount() { return pkberthsCount; } @@ -36,6 +41,18 @@ public class ParkLotAndBerthsCountVO { public void setPkCount(Map pkCount) { this.pkCount = pkCount; } + public Map getPkberthsCountMap() { + return pkberthsCountMap; + } + public void setPkberthsCountMap(Map pkberthsCountMap) { + this.pkberthsCountMap = pkberthsCountMap; + } + public Map getPkCountMap() { + return pkCountMap; + } + public void setPkCountMap(Map pkCountMap) { + this.pkCountMap = pkCountMap; + } } diff --git a/src/main/java/com/zteits/irain/portal/web/govclouds/DataGeneralizeController.java b/src/main/java/com/zteits/irain/portal/web/govclouds/DataGeneralizeController.java index 32ae9ab..8bb349a 100644 --- a/src/main/java/com/zteits/irain/portal/web/govclouds/DataGeneralizeController.java +++ b/src/main/java/com/zteits/irain/portal/web/govclouds/DataGeneralizeController.java @@ -1,5 +1,8 @@ package com.zteits.irain.portal.web.govclouds; +import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -7,6 +10,7 @@ import java.util.Map.Entry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; @@ -27,17 +31,29 @@ import com.google.common.collect.Maps; import com.zteits.clouds.api.apibase.bean.BizResult; import com.zteits.clouds.api.apibase.constants.ErrorType; import com.zteits.clouds.api.apibase.exception.BizException; +import com.zteits.clouds.api.dto.clouds.dto.OrderTransDTO; +import com.zteits.clouds.api.dto.clouds.param.OrderTransactionQueryRequest; import com.zteits.clouds.api.dto.govclouds.ParkTransactionDTO; +import com.zteits.clouds.api.dto.govclouds.dto.ParkEqpAndPDACountDTO; +import com.zteits.clouds.api.dto.govclouds.dto.ParkingOccupyDTO; +import com.zteits.clouds.api.dto.govclouds.param.QueryParkEqpAndPDACountRequest; +import com.zteits.clouds.api.dto.govclouds.param.QueryParkingOccupyRequest; import com.zteits.clouds.api.dto.park.dto.ParkFreeBerthsCountStatisticByCountryDTO; import com.zteits.clouds.api.dto.park.dto.ParkLotCountStatisticByCountryDTO; import com.zteits.clouds.api.dto.park.dto.ParkLotEqpTypeCountStatisticByCountryDTO; import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; import com.zteits.clouds.api.dto.park.param.ParkTransactionRequest; import com.zteits.clouds.api.dto.park.param.StatisticParkLotCountByCountryRequest; +import com.zteits.clouds.api.dto.pay.ParkingFlowCountDTO; +import com.zteits.clouds.api.dto.pay.param.QueryTodayFlowRequest; +import com.zteits.clouds.api.service.govclouds.ParkOccupyService; import com.zteits.clouds.api.service.govclouds.ParkTransactionService; import com.zteits.clouds.api.service.park.ParkFreeBerthService; import com.zteits.clouds.api.service.park.ParkingLotEqpService; import com.zteits.clouds.api.service.park.ParkingLotQueryService; +import com.zteits.clouds.api.service.park.TpPPdaService; +import com.zteits.clouds.api.service.pay.TdBOrderService; +import com.zteits.irain.portal.constant.ParkConstant; import com.zteits.irain.portal.vo.govclouds.StatisticParkLotEqpCountByCountryVO; import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO; import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO.BerthSeriesVO; @@ -77,6 +93,13 @@ public class DataGeneralizeController { private ParkFreeBerthService parkFreeBerthService; @Autowired private ParkTransactionService parkTransactionService; + @Autowired + private TpPPdaService tpPPdaService; + @Autowired + private TdBOrderService tdBOrderService; + @Autowired + private ParkOccupyService parkOccupyService; + /** * 这里用的是@SendToUser,这就是发送给单一客户端的标志。本例中, @@ -176,7 +199,12 @@ public class DataGeneralizeController { } return list; } - + /** + * 分区统计停车场、停车位数量 + * langlw 2017-9-5 + * @param request + * @return + */ @ApiOperation(value="停车场柱图") @PostMapping("parkinglotColumnChart") @ResponseBody @@ -363,7 +391,12 @@ public class DataGeneralizeController { map.entrySet().forEach(e->{displayCountry.add(e.getValue());}); return new BizResultVO>().setData(displayCountry); } - + /** + * 车位配比图 + * langlw 2017-9-5 + * @param request + * @return + */ @ApiOperation(value="车位配比图") @PostMapping("berthSpaceRatioChart") @ResponseBody @@ -388,4 +421,306 @@ public class DataGeneralizeController { return new BizResultVO().setData(berthSpaceRatioVO); } + + + /** + * 获取停车场设备和PDA在线离线总数 + * langlw 2017-9-5 + * @param request + * @return + */ + @ApiOperation(value="获取停车场设备和PDA在线离线总数") + @PostMapping("queryParkEqpAndPDACount") + @ResponseBody + public BizResultVO queryParkEqpAndPDACount(@RequestBody QueryParkEqpAndPDACountRequest request){ + if(null == request.getEqpType() || null == request.getPdaType() || CollectionUtils.isEmpty(request.getPlNos())){ + throw new BizException(ErrorType.PARAMM_NULL, "入参不能为空"); + } + logger.info("调用dubbo服务,请求入参: request={}", JSONObject.toJSONString(request)); + ParkEqpAndPDACountDTO parkEqpAndPDACountDTO=new ParkEqpAndPDACountDTO(); + //查询停车场设备 + BizResult> result = parkingLotEqpService.queryParkEqpCountByPlNosAndEqpType(request); + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(result)); + List parkEqpList=result.getData(); + //PDA + int onlineEqpCountSum=0; + int allEqpCountSum=0; + int onlinePDACountSum=0; + int allPDACountSum=0; + + if(CollectionUtils.isNotEmpty(parkEqpList)){ + for (ParkEqpAndPDACountDTO dto : parkEqpList) { + if(null != dto){ + onlineEqpCountSum=onlineEqpCountSum+(null==dto.getOnlineEqpCount()?0:dto.getOnlineEqpCount()); + allEqpCountSum=allEqpCountSum+(null==dto.getAllEqpCount()?0:dto.getAllEqpCount()); + } + } + } + + //查询PDA在线和离线总数 + BizResult> bizResult = tpPPdaService.queryPDACountByPlNosAndPdaType(request); + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(bizResult)); + List parkPDACountList=bizResult.getData(); + //PDA + if(CollectionUtils.isNotEmpty(parkPDACountList)){ + for (ParkEqpAndPDACountDTO dto : parkPDACountList) { + if(null != dto){ + onlinePDACountSum=onlinePDACountSum+(null==dto.getOnlinePDACount()?0:dto.getOnlinePDACount()); + allPDACountSum=allPDACountSum+(null==dto.getAllPDACount()?0:dto.getAllPDACount()); + } + } + } + parkEqpAndPDACountDTO.setAllEqpCount(allEqpCountSum); + parkEqpAndPDACountDTO.setAllPDACount(allPDACountSum); + parkEqpAndPDACountDTO.setOnlineEqpCount(onlineEqpCountSum); + parkEqpAndPDACountDTO.setOnlinePDACount(onlinePDACountSum); + + + return new BizResultVO().setData(parkEqpAndPDACountDTO); + } + + + /** + * 分区统计停车场、停车位数量 + * langlw 2017-9-5 + * @param request + * @return + */ + @ApiOperation(value="分区、停车场类型统计停车场、停车位数量") + @PostMapping("getParkAndBerthAndEquChartForPlType") + @ResponseBody + public BizResultVO getParkAndBerthAndEquChartForPlType(@RequestBody StatisticParkLotCountByCountryRequest request){ + if(null == request.getCityId()){ + throw new BizException(ErrorType.PARAMM_NULL, "城市编号"); + } + logger.info("对城市:"+request.getCityId()+" 按照区域统计停车场、车位数量等信息"); + //停车场数量 先查询缓存 + BizResult> bizResultParkLot = parkingLotQueryService.statisticParkLotCountByCountryForPlType(request); + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(bizResultParkLot)); + List parkLotCountList=bizResultParkLot.getData(); + + Map pkberthsCountObjMap=Maps.newHashMap(); + Map parkLotCountObjMap=Maps.newHashMap(); + + + if(CollectionUtils.isNotEmpty(parkLotCountList)){ + for (ParkLotCountStatisticByCountryDTO dto : parkLotCountList) { + String countryName = dto.getPlCountryName(); + //停车场车位数 + Map berthsCountMap = Maps.newHashMap(); + //停车场数 + Map parkLotCountMap = Maps.newHashMap(); + //停车场个数 + int pkCount = dto.getParkLotCount()==null?0:dto.getParkLotCount(); + Integer plType=dto.getPlType(); + parkLotCountMap.put(plType, pkCount); + parkLotCountObjMap.put(countryName, parkLotCountMap); + //停车位个数 + int pkberthsCount = dto.getTotalBerths(); + berthsCountMap.put(plType, pkberthsCount); + pkberthsCountObjMap.put(countryName, berthsCountMap); + } + } + ParkLotAndBerthsCountVO parkLotAndBerthsCountVO = new ParkLotAndBerthsCountVO(); + parkLotAndBerthsCountVO.setPkberthsCountMap(pkberthsCountObjMap); + parkLotAndBerthsCountVO.setPkCountMap(parkLotCountObjMap); + return new BizResultVO().setData(parkLotAndBerthsCountVO); + } + + + @SuppressWarnings("serial") + @ApiOperation(value="今日车流量") + @PostMapping("queryTodayVehicleFlow") + @ResponseBody + public BizResultVO> queryTodayVehicleFlow(@RequestBody StatisticParkLotCountByCountryRequest request){ + BizResultVO> parkFlowDTOs = new BizResultVO<>(); + List parkingFlowCountDTOs = new ArrayList<>(); + + List requests = new ArrayList<>(); + List HSPlNos = new ArrayList(){{add("-1");}}; + List SSPlNos = new ArrayList(){{add("-1");}}; + List YBSPlNos = new ArrayList(){{add("-1");}}; + List QTPlNos = new ArrayList(){{add("-1");}}; + + + //先查询城市下面的停车场 + BizResult> parkResult = parkingLotQueryService.queryParkLotByCountry(request); + if (ResultUtils.isError(parkResult)) { + //如果失败 + parkFlowDTOs.setCode(parkResult.getErrCode().getCode()); + parkFlowDTOs.setMsg(parkResult.getErrMsg()); + return parkFlowDTOs; + } + QueryTodayFlowRequest HSRequest = new QueryTodayFlowRequest(); + QueryTodayFlowRequest SSRequest = new QueryTodayFlowRequest(); + QueryTodayFlowRequest YBSRequest = new QueryTodayFlowRequest(); + QueryTodayFlowRequest QTRequest = new QueryTodayFlowRequest(); + QueryTodayFlowRequest flowRequest = new QueryTodayFlowRequest(); + BeanUtils.copyProperties(request, flowRequest); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + Date beginTime = calendar.getTime(); + flowRequest.setBeginTime(beginTime); + flowRequest.setEndTime(new Date()); + flowRequest.setDataState(1); + flowRequest.setOrderType(1); + for (ParkingLotDTO dto : parkResult.getData()) { + switch (dto.getPlCountryId().intValue()) { + case 923://红山区 + HSPlNos.add(dto.getPlNo()); + BeanUtils.copyProperties(flowRequest, HSRequest); + HSRequest.setPlCountryId(dto.getPlCountryId()); + HSRequest.setPlCountryName(dto.getPlCountryName()); + break; + case 925://松山区 + SSPlNos.add(dto.getPlNo()); + BeanUtils.copyProperties(flowRequest, SSRequest); + SSRequest.setPlCountryId(dto.getPlCountryId()); + SSRequest.setPlCountryName(dto.getPlCountryName()); + break; + case 924://元宝山区 + YBSPlNos.add(dto.getPlNo()); + BeanUtils.copyProperties(flowRequest, YBSRequest); + YBSRequest.setPlCountryId(dto.getPlCountryId()); + YBSRequest.setPlCountryName(dto.getPlCountryName()); + break; + default://其他 + QTPlNos.add(dto.getPlNo()); + BeanUtils.copyProperties(flowRequest, QTRequest); + QTRequest.setPlCountryId(9999L); + QTRequest.setPlCountryName("其他"); + + break; + } + } + + HSRequest.setPlNos(HSPlNos); + SSRequest.setPlNos(SSPlNos); + YBSRequest.setPlNos(YBSPlNos); + QTRequest.setPlNos(QTPlNos); + requests.add(HSRequest); + requests.add(SSRequest); + requests.add(YBSRequest); + requests.add(QTRequest); + for (QueryTodayFlowRequest re : requests) { + BizResult dtoBiz = tdBOrderService.queryTodayVehicleFlow(re); + if(dtoBiz.getData()!=null){ + BeanUtils.copyProperties(re, dtoBiz.getData()); + parkingFlowCountDTOs.add(dtoBiz.getData()); + } + } + parkFlowDTOs.setData(parkingFlowCountDTOs); + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(parkFlowDTOs)); + return parkFlowDTOs; + } + + @ApiOperation(value="24小时占用率") + @PostMapping("queryTwentyFourHoursOccupyRate") + @ResponseBody + public BizResultVO> queryTwentyFourHoursOccupyRate(@RequestBody StatisticParkLotCountByCountryRequest request){ + BizResultVO> parkOccupyDTOs = new BizResultVO<>(); + QueryParkingOccupyRequest occupyRequest = new QueryParkingOccupyRequest(); + List plNos = new ArrayList<>(); + //先查询城市下面的停车场 + BizResult> parkResult = parkingLotQueryService.queryParkLotByCountry(request); + if (ResultUtils.isError(parkResult)) { + //如果失败 + parkOccupyDTOs.setCode(parkResult.getErrCode().getCode()); + parkOccupyDTOs.setMsg(parkResult.getErrMsg()); + return parkOccupyDTOs; + } + for (ParkingLotDTO parkDto : parkResult.getData()) { + plNos.add(parkDto.getPlNo()); + } + if(plNos.size()<1){ + throw new BizException(ErrorType.PARAMM_NULL,"停车场编号"); + } + BeanUtils.copyProperties(request, occupyRequest); + occupyRequest.setPlNos(plNos); + occupyRequest.setDataStatus(1); + occupyRequest.setStatisticType(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + Date endTime = calendar.getTime(); + + //往前倒三个月 + //calendar.add(Calendar.MONTH, -3); + calendar.add(Calendar.DAY_OF_MONTH, -1); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + Date beginTime = calendar.getTime(); + + occupyRequest.setBeginTime(beginTime); + occupyRequest.setEndTime(endTime); + + BizResult> result = parkOccupyService.queryTwentyFourHoursOccupyRate(occupyRequest); + if(!(result.isSuccess())){ + //如果失败 + parkOccupyDTOs.setCode(result.getErrCode().getCode()); + parkOccupyDTOs.setMsg(result.getErrMsg()); + return parkOccupyDTOs; + } + parkOccupyDTOs.setData(result.getData()); + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(parkOccupyDTOs)); + return parkOccupyDTOs; + } + + @ApiOperation(value="今日交易") + @PostMapping("queryTodayOrderTrans") + @ResponseBody + public BizResultVO queryTodayOrderTrans(@RequestBody StatisticParkLotCountByCountryRequest request){ + BizResultVO orderDTO = new BizResultVO<>(); + OrderTransactionQueryRequest orderTransRequest = new OrderTransactionQueryRequest(); + List plNos = new ArrayList<>(); + //先查询城市下面的停车场 + BizResult> parkResult = parkingLotQueryService.queryParkLotByCountry(request); + if (ResultUtils.isError(parkResult)) { + //如果失败 + orderDTO.setCode(parkResult.getErrCode().getCode()); + orderDTO.setMsg(parkResult.getErrMsg()); + return orderDTO; + } + for (ParkingLotDTO parkDto : parkResult.getData()) { + plNos.add(parkDto.getPlNo()); + } + if(plNos.size()<1){ + throw new BizException(ErrorType.PARAMM_NULL,"停车场编号"); + } + BeanUtils.copyProperties(request, orderTransRequest); + orderTransRequest.setParkIds(plNos); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + Date beginTime = calendar.getTime(); + orderTransRequest.setBeginTime(beginTime); + orderTransRequest.setEndTime(new Date()); + + BizResult result = tdBOrderService.queryOrderTrans(orderTransRequest); + if(!(result.isSuccess())){ + //如果失败 + orderDTO.setCode(result.getErrCode().getCode()); + orderDTO.setMsg(result.getErrMsg()); + return orderDTO; + } + orderDTO.setData(result.getData()); + //分->元 + BigDecimal hundred = new BigDecimal("100"); + OrderTransDTO o = orderDTO.getData(); + o.setAliTotalAmount(o.getAliTotalAmount()!=null?o.getAliTotalAmount().divide(hundred):new BigDecimal("0")); + o.setCashTotalAmount(o.getCashTotalAmount()!=null?o.getCashTotalAmount().divide(hundred):new BigDecimal("0")); + o.setPayedTotalAmount(o.getPayedTotalAmount()!=null?o.getPayedTotalAmount().divide(hundred):new BigDecimal("0")); + o.setWxTotalAmount(o.getWxTotalAmount()!=null?o.getWxTotalAmount().divide(hundred):new BigDecimal("0")); + o.setYlTotalAmount(o.getYlTotalAmount()!=null?o.getYlTotalAmount().divide(hundred):new BigDecimal("0")); + orderDTO.setData(o); + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(orderDTO)); + return orderDTO; + } } diff --git a/src/main/java/com/zteits/irain/portal/web/govclouds/ParkingContrailController.java b/src/main/java/com/zteits/irain/portal/web/govclouds/ParkingContrailController.java index 7325ef3..9f19a38 100644 --- a/src/main/java/com/zteits/irain/portal/web/govclouds/ParkingContrailController.java +++ b/src/main/java/com/zteits/irain/portal/web/govclouds/ParkingContrailController.java @@ -18,17 +18,44 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.alibaba.fastjson.JSONObject; +import com.clouds.common.cache.park.ParkFreeBerthsCacheUtil; +import com.clouds.common.utils.AppRsesultUtil; +import com.clouds.common.utils.DateUtil; import com.clouds.common.web.BizController; import com.clouds.common.web.vo.BizResultVO; +import com.google.common.collect.Lists; +import com.xiaoleilu.hutool.util.CollectionUtil; import com.zteits.clouds.api.apibase.bean.BizResult; import com.zteits.clouds.api.apibase.bean.PageBean; +import com.zteits.clouds.api.apibase.constants.BasicEnum; +import com.zteits.clouds.api.apibase.constants.ErrorType; +import com.zteits.clouds.api.dto.govclouds.dto.ParkEqpAndPDACountDTO; import com.zteits.clouds.api.dto.govclouds.dto.ParkingCountForTypeDTO; import com.zteits.clouds.api.dto.govclouds.dto.ParkingTrackDTO; +import com.zteits.clouds.api.dto.govclouds.param.QueryParkEqpAndPDACountRequest; import com.zteits.clouds.api.dto.govclouds.param.QueryParkingCountRequest; import com.zteits.clouds.api.dto.govclouds.param.QueryParkingTrackRequest; +import com.zteits.clouds.api.dto.park.dto.BerthsDTO; +import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; +import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; +import com.zteits.clouds.api.dto.park.dto.TodayVehicleFlowOccupyRateAndTurnOverDTO; +import com.zteits.clouds.api.dto.park.param.CommonPlnosQueryRequest; +import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; +import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest; +import com.zteits.clouds.api.dto.pay.TdCFileDTO; +import com.zteits.clouds.api.dto.pay.param.SysFileGetBySourceIdAndTypeRequest; import com.zteits.clouds.api.service.govclouds.ParkPreferenceService; +import com.zteits.clouds.api.service.park.BerthManageService; +import com.zteits.clouds.api.service.park.ParkingLotEqpService; +import com.zteits.clouds.api.service.park.ParkingLotQueryService; +import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; +import com.zteits.clouds.api.service.park.TpPPdaService; +import com.zteits.clouds.api.service.pay.TdCFileService; +import com.zteits.irain.portal.constant.ParkConstant; import com.zteits.irain.portal.vo.govclouds.ParkingBusiCircleForTypeVO; import com.zteits.irain.portal.vo.govclouds.ParkingCountForTypeVO; +import com.zteits.irain.portal.vo.govclouds.ParkingDeviceVO; +import com.zteits.irain.portal.vo.govclouds.ParkingStatisVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -55,6 +82,23 @@ public class ParkingContrailController extends BizController{ private static final Logger logger = LoggerFactory.getLogger(ParkingContrailController.class); @Autowired private ParkPreferenceService parkPreferenceService; + //停车场基本信息查询服务 + @Autowired + private ParkingLotQueryService parkingLotQueryService; + //附件查询服务-查询停车场图片 + @Autowired + private TdCFileService tdCFileService; + //停车场泊位信息查询 + @Autowired + private BerthManageService berthManageService; + //停车场空置率 周转率查询 + @Autowired + private ParkingLotUseStatisticService parkingLotUseStatisticService; + @Autowired + //硬件设备服务 + private ParkingLotEqpService parkingLotEqpService; + @Autowired + private TpPPdaService tpPPdaService; @ApiOperation("停车编好->饼图") @PostMapping("/parkingCountForPlType") @@ -107,6 +151,137 @@ public class ParkingContrailController extends BizController{ return result; } + + + @ApiOperation("停车场基本信息查询") + @PostMapping("/queryParkingBaseInfo") + @ResponseBody + public BizResultVO queryParkingBaseInfo(@RequestBody QueryParkLotInfoByPkNoRequest queryParkLotInfoByPkNoRequest,HttpServletRequest request, HttpServletResponse response) throws Exception{ + BizResultVO result = new BizResultVO(); + logger.info("停车场停车资源-基本信息查询 Controller,入参={}",JSONObject.toJSON(queryParkLotInfoByPkNoRequest)); + + queryParkLotInfoByPkNoRequest.setSysCode(BasicEnum.SYS_CODE.getValue()); + logger.debug("开始 查询停车场信息:" + JSONObject.toJSONString(queryParkLotInfoByPkNoRequest)); + BizResult rtMap = parkingLotQueryService.QueryParkingLotByPkNo(queryParkLotInfoByPkNoRequest); + logger.debug("结束 查询停车场信息:" + JSONObject.toJSONString(rtMap)); + ParkingLotDTO parkingLotDTO = new ParkingLotDTO(); + if(rtMap.isSuccess()){ + parkingLotDTO =rtMap.getData(); + if(parkingLotDTO ==null){ + AppRsesultUtil.fail(ErrorType.RESOURCE_NOT_EXISTS.getCode(), ErrorType.RESOURCE_NOT_EXISTS.getMsg()); + } + } + Integer freeParkingSpace = ParkFreeBerthsCacheUtil.getFreeBerthsByPlNo(queryParkLotInfoByPkNoRequest.getPklNo()); + rtMap.getData().setBerthNum(freeParkingSpace); + + logger.debug("start 停车场图片查询"); + SysFileGetBySourceIdAndTypeRequest sysFileGetBySourceIdAndTypeRequest = new SysFileGetBySourceIdAndTypeRequest(); + sysFileGetBySourceIdAndTypeRequest.setSourceId(queryParkLotInfoByPkNoRequest.getPklNo()); + sysFileGetBySourceIdAndTypeRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode()); + BizResult> fileList = tdCFileService.getFilesBySourceIdAndType(sysFileGetBySourceIdAndTypeRequest); + + List picUrls = Lists.newArrayList(); + if(fileList.isSuccess() && CollectionUtil.isNotEmpty(fileList.getData())){ + fileList.getData().forEach(file->picUrls.add(file.getFilePath())); + }else{ + /** 如果没有查询停车场的真实图片--则展示默认的停车场图片**/ + SysFileGetBySourceIdAndTypeRequest sysFileRequest = new SysFileGetBySourceIdAndTypeRequest(); + /*** '停车场类型:1:路内(占用道路停车位),2-路外',*/ + if(rtMap.getData().getPlType()==1){ + sysFileRequest.setSourceId("defaul_park_pic_out"); + }else{ + sysFileRequest.setSourceId("defaul_park_pic_in"); + } + sysFileRequest.setFileType(1); + sysFileRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode()); + BizResult> defaultfileList = tdCFileService.getFilesBySourceIdAndType(sysFileRequest); + if(defaultfileList.isSuccess() && CollectionUtil.isNotEmpty(defaultfileList.getData())){ + defaultfileList.getData().forEach(file->picUrls.add(file.getFilePath())); + } + } + logger.debug("end 停车场图片查询:{}",JSONObject.toJSONString(picUrls)); + + BizResult> rsMaplist = berthManageService.queryBerthsByPlNo(queryParkLotInfoByPkNoRequest); + if(rsMaplist.isSuccess() && CollectionUtil.isNotEmpty(rsMaplist.getData())){ + rtMap.getData().setBerths(rsMaplist.getData()); + } + + result.setData(rtMap.getData()); + result.getData().setPicUrls(picUrls); + return result; + } + + + @ApiOperation("停车场停车数据查询") + @PostMapping("/queryParkingdatas") + @ResponseBody + public BizResultVO queryParkingdatas(@RequestBody QueryParkLotInfoByPkNoRequest queryParkLotInfoByPkNoRequest,HttpServletRequest request, HttpServletResponse response) throws Exception{ + BizResultVO result = new BizResultVO(); + + List deviceVoList = Lists.newArrayList(); + logger.info("停车场停车资源-停车场停车数据查询 Controller,入参={}",JSONObject.toJSON(queryParkLotInfoByPkNoRequest)); + ParkingStatisVO vo = new ParkingStatisVO(); + List plNos = Lists.newArrayList(); + plNos.add(queryParkLotInfoByPkNoRequest.getPklNo()); + CommonPlnosQueryRequest commonPlnosQueryRequest = new CommonPlnosQueryRequest(); + commonPlnosQueryRequest.setPlNos(plNos); + commonPlnosQueryRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode()); + BizResult> rsList = parkingLotUseStatisticService.queryTodayVehicleFlowOccupyRateAndTurnOver(commonPlnosQueryRequest); + if(rsList.isSuccess() && CollectionUtil.isNotEmpty(rsList.getData())){ + TodayVehicleFlowOccupyRateAndTurnOverDTO dto = rsList.getData().get(0); + vo.setAvgOccupyRate(dto.getAvgOccupyRate()); + vo.setAvgTurnoverRate(dto.getAvgTurnoverRate()); + } + + ParkingLotUseStatisticForPageRequest staticRequest = new ParkingLotUseStatisticForPageRequest(); + staticRequest.setBeginTime(DateUtil.getTimeBeforeDay(DateUtil.getSysDate())); + staticRequest.setEndTime(DateUtil.getSysDate()); + staticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); + staticRequest.setPlNos(plNos); + staticRequest.getBaseRequest().setPageSize(100); + staticRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode()); + BizResult> bizResult = parkingLotUseStatisticService + .queryParkingLotUseStatisticForPage(staticRequest); + /**周转率,空置率不为空**/ + if(bizResult.isSuccess() && CollectionUtil.isNotEmpty(bizResult.getData().getDataList())){ + vo.setStatisList(bizResult.getData().getDataList()); + } + + QueryParkEqpAndPDACountRequest queryParkEqpAndPDACountRequest = new QueryParkEqpAndPDACountRequest(); + queryParkEqpAndPDACountRequest.setPlNos(plNos); + queryParkEqpAndPDACountRequest.setSysCode(queryParkLotInfoByPkNoRequest.getSysCode()); + logger.info("停车场停车资源-停车场停车数据查询 -查询硬件设备,入参={}",JSONObject.toJSON(queryParkEqpAndPDACountRequest)); + BizResult> eqpList = parkingLotEqpService.queryParkEqpCountByPlNos(queryParkEqpAndPDACountRequest); + logger.info("停车场停车资源-停车场停车数据查询 -查询硬件设备 地磁,出参={}",JSONObject.toJSON(eqpList)); + if(eqpList.isSuccess() && CollectionUtil.isNotEmpty(eqpList.getData())){ + eqpList.getData().forEach(eqp->{ + ParkingDeviceVO device = new ParkingDeviceVO(); + device.setType(eqp.getEqpType()); + device.setAllCount(eqp.getAllEqpCount()); + device.setOnlineCount(eqp.getOnlineEqpCount()); + deviceVoList.add(device); + }); + } + BizResult> pdaList = tpPPdaService.queryPDACountByPlNosAndPdaType(queryParkEqpAndPDACountRequest); + logger.info("停车场停车资源-停车场停车数据查询 -查询硬件设备 PDA等,出参={}",JSONObject.toJSON(pdaList)); + if(pdaList.isSuccess() && CollectionUtil.isNotEmpty(pdaList.getData())){ + pdaList.getData().forEach(pda->{ + ParkingDeviceVO device = new ParkingDeviceVO(); + //device.setType(pda.getEqpType()); + device.setType(9);//PDA类型暂时设置为 9 + device.setAllCount(pda.getAllEqpCount()); + device.setOnlineCount(pda.getOnlineEqpCount()); + deviceVoList.add(device); + }); + } + /**获取停车场的空闲车位*/ + Integer freeParkingSpace = ParkFreeBerthsCacheUtil.getFreeBerthsByPlNo(queryParkLotInfoByPkNoRequest.getPklNo()); + vo.setFreeParkingSpace(freeParkingSpace); + vo.setDeviceVoList(deviceVoList); + result.setData(vo); + return result; + } + @ApiOperation("停车车轨迹") @PostMapping("/queryParkingTrack") @ResponseBody @@ -118,10 +293,6 @@ public class ParkingContrailController extends BizController{ return new BizResultVO(bizResult); } - - - - } diff --git a/src/main/java/com/zteits/irain/portal/web/govclouds/RealTimeInfoController.java b/src/main/java/com/zteits/irain/portal/web/govclouds/RealTimeInfoController.java new file mode 100644 index 0000000..d1d5f2e --- /dev/null +++ b/src/main/java/com/zteits/irain/portal/web/govclouds/RealTimeInfoController.java @@ -0,0 +1,150 @@ +/** + * + */ +package com.zteits.irain.portal.web.govclouds; + +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.fastjson.JSON; +import com.clouds.common.cache.park.ParkFreeBerthsCacheUtil; +import com.clouds.common.cache.park.ParkingLotGeoCacheUtil; +import com.clouds.common.entity.UserArea; +import com.clouds.common.entity.UserInfo; +import com.clouds.common.web.SessionCommUtil; +import com.clouds.common.web.vo.BizResultVO; +import com.zteits.clouds.api.apibase.bean.BizResult; +import com.zteits.clouds.api.apibase.constants.LonLatTypeEnum; +import com.zteits.clouds.api.dto.govclouds.dto.BerthInfoDTO; +import com.zteits.clouds.api.dto.govclouds.dto.EscapesPaymentDataDTO; +import com.zteits.clouds.api.dto.govclouds.dto.WarningInfoDTO; +import com.zteits.clouds.api.dto.govclouds.dto.ZeroBerthParkingLotDTO; +import com.zteits.clouds.api.dto.govclouds.param.BerthExponentinfoRequest; +import com.zteits.clouds.api.dto.govclouds.param.EscapePaymentRequest; +import com.zteits.clouds.api.dto.govclouds.param.ParkingBerthInfoRequest; +import com.zteits.clouds.api.dto.govclouds.param.UserAreaInfo; +import com.zteits.clouds.api.dto.govclouds.param.WaringFreeBerthRequest; +import com.zteits.clouds.api.dto.govclouds.param.WarningInfoRequest; +import com.zteits.clouds.api.dto.park.dto.ParkinglotAndGeoInfoDTO; +import com.zteits.clouds.api.service.govclouds.RealtimeInfoService; +import com.zteits.clouds.api.service.park.ParkingLotBerthsService; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * @author hxz + * + */ +@Api(value="实时停车", description="实时停车") +@RestController +@RequestMapping("/rtinfo") +public class RealTimeInfoController { + private static final Logger logger = LoggerFactory.getLogger(RealTimeInfoController.class); + + @Value("${project.syscode}") + private String sysCode; + @Autowired + private SessionCommUtil sessionCommUtil; + + @Autowired + private RealtimeInfoService rtInfoService; + @Autowired + private ParkingLotBerthsService plBerthsService; + + @ApiOperation("24小时逃逸补缴情况") + @PostMapping("/escapePaymentInfo") + public BizResultVO getEscapePaymentInfoDuring24hs(@RequestBody EscapePaymentRequest request) { + BizResult result = null; + try { + result = rtInfoService.getEscapePaymentInfoDuring24hs(request); + } catch (Exception e) { + logger.error(e.toString()); + e.printStackTrace(); + } + + return new BizResultVO(result); + } + + @ApiOperation("停车指数,根据登录人所属市区id获取计算所需数据") + @PostMapping("/berthinfo") + public BizResultVO getParkingBerthInfo(@RequestBody BerthExponentinfoRequest req) { + ParkingBerthInfoRequest request = new ParkingBerthInfoRequest(); + request.setSysCode(req.getSysCode()); + + UserInfo userInfo = sessionCommUtil.getUserInfo(); + List userAreaList = userInfo.getUserAreas(); + List userAreaInfoList = null; + if (null != userAreaList && !CollectionUtils.isEmpty(userAreaList)) { + userAreaInfoList = JSON.parseArray(JSON.toJSONString(userAreaList, false), UserAreaInfo.class); + } + request.setUserAreaInfoList(userAreaInfoList); + + BizResult result = plBerthsService.getParkingBerthInfo(request); + + return new BizResultVO(result); + } + + @ApiOperation("停车预警") + @PostMapping("/warninginfo") + public BizResultVO> getPreWarningInfo(@RequestBody WaringFreeBerthRequest req) { + logger.debug("getPreWarningInfo:" + req.getSysCode()); + + WarningInfoRequest request = new WarningInfoRequest(); + request.setSysCode(req.getSysCode()); + //UserInfo userInfo = sessionCommUtil.getUserInfo(); + List userAreaList = new ArrayList();//userInfo.getUserAreas(); + // 权宜之策构造 begin + UserArea userArea = new UserArea(); + userArea.setAreaId(req.getCityId()); + userAreaList.add(userArea); + // 权宜之策构造 end + List userAreaInfoList = null; + if (null != userAreaList && !CollectionUtils.isEmpty(userAreaList)) { + userAreaInfoList = JSON.parseArray(JSON.toJSONString(userAreaList, false), UserAreaInfo.class); + } + request.setUserAreaInfoList(userAreaInfoList); + + // 获取所有空闲车位为零的停车场信息列表 + List zeroBerthplDTOList = plBerthsService.getZeroBerthParkinglotList(request); + List warningInfoList = new ArrayList(); + if (null != zeroBerthplDTOList) { + logger.debug("zeroBerthplDTOList---->" + JSON.toJSONString(zeroBerthplDTOList, false)); + + for (ZeroBerthParkingLotDTO zeroBerthpl: zeroBerthplDTOList) { + + List plgInfoList = ParkingLotGeoCacheUtil.queryParkLotsWithDistanceAndCoordinateByAsc( + LonLatTypeEnum.LON_LAT_TYPE_1, zeroBerthpl.getLongitude(), zeroBerthpl.getLatitude(), 5000D, 50L); + + int notZeroBerthPlCount = 0;// 非零空闲泊位数的停车场个数 + if (null != plgInfoList && !CollectionUtils.isEmpty(plgInfoList)) { + WarningInfoDTO warningInfoDTO = new WarningInfoDTO(); + for (ParkinglotAndGeoInfoDTO ParkinglotAndGeoInfoDTO: plgInfoList) { + if (0 < ParkFreeBerthsCacheUtil.getFreeBerthsByPlNo(ParkinglotAndGeoInfoDTO.getPlNo())) + { + notZeroBerthPlCount += 1; + } + } + + if (0 < notZeroBerthPlCount) { + warningInfoDTO.setParkingLotName(zeroBerthpl.getParkingLotName()); + warningInfoDTO.setPlCountHavingFreeBerth(notZeroBerthPlCount); + + warningInfoList.add(warningInfoDTO); + } + } + } + } + return new BizResultVO<>(new BizResult<>(warningInfoList)) ; + } +} diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BillManageController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BillManageController.java deleted file mode 100644 index 00a349b..0000000 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BillManageController.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; - -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.alibaba.dubbo.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.clouds.common.constants.SessionEnum; -import com.clouds.common.entity.UserInfo; -import com.clouds.common.utils.excle.ExcelUtil; -import com.clouds.common.utils.excle.ExcleFillDateManager; -import com.clouds.common.utils.excle.Layouter; -import com.clouds.common.web.BizController; -import com.clouds.common.web.SessionCommUtil; -import com.zteits.clouds.api.apibase.bean.BizResult; -import com.zteits.clouds.api.apibase.bean.PageBean; -import com.zteits.clouds.api.dto.clouds.dto.BillManageDTO; -import com.zteits.clouds.api.dto.clouds.param.BillQueryRequest; -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; -import com.zteits.clouds.api.service.clouds.BillManageForDayService; -import com.zteits.clouds.api.service.pay.TdCustCompanyService; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - -/** - * 日账单controller类.
- * - * Copyright: Copyright (c) 2017 zteits - * - * @ClassName: BillManageController.java - * @Description: - * @version: v1.0.0 - * @author: wangfs - * @date: 2017年6月30日 下午1:14:16 - * Modification History: - * Date Author Version Description - *---------------------------------------------------------* - * 2017年6月30日 wangfs v1.0.0 创建 - */ - -@Api(value = "停车场云平台 日账单", description = "停车场云平台 日账单") -@Controller -@RequestMapping("/bill") -public class BillManageController extends BizController { - private Logger logger = LoggerFactory.getLogger(BillManageController.class); - @Autowired - private BillManageForDayService billManageForDayService; - - @Autowired - private TdCustCompanyService tdCustCompanyService; - - @Autowired - private SessionCommUtil sessionCommUtil; - - @Autowired - private Map map; - - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - @ApiOperation("日账汇总单查询") - @RequestMapping("/queryBillforDayForPage") - @ResponseBody - public void queryBillforDayTotalForPage(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, - HttpServletResponse response) throws Exception { - TdCustCompanyService sert = map.get("tdCustCompanyService"); - logger.info("---begin--日账汇总单查询调用后场dubbo服务,入参={}", JSONObject.toJSON(billQueryRequest)); - System.out.println("seesionId="+request.getSession().getId()); - UserInfo userInfo = sessionCommUtil.getUserInfo(); - logger.info("从session中获取的用户信息={}" + JSONObject.toJSONString(userInfo)); - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); - if (userInfo != null) { - - tdCompanyParkQueryRequest.setSysCode(billQueryRequest.getSysCode()); - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); - tdCompanyParkQueryRequest.setSessionId(request.getSession().getId()); - billQueryRequest.setParkIdList(this.queryParkNoByCustIds(tdCompanyParkQueryRequest)); - } - - BizResult> result = billManageForDayService.queryBillforDayTotalForPage(billQueryRequest); - result.setErrMsg(billQueryRequest.getParkIdList().toString()); - logger.info("---end--日账汇总单查询调用后场dubbo服务,结果={}", JSONObject.toJSONString(result)); - this.returnJsonDataGrid(response, result); - } - - /** - * 查询日账单.
- * - * @param request - * @param response - * @throws Exception - */ - @ApiOperation("日账单查看") - @RequestMapping(value = "/queryBillForDay", method = RequestMethod.POST) - @ResponseBody - public void queryBillForDay(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, - HttpServletResponse response) throws Exception { - BizResult> result = new BizResult>(); - logger.info("---begin---日账单查看调用后场dubbo服务,入参={}", JSONObject.toJSONString(billQueryRequest)); - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); - UserInfo userInfo = (UserInfo) request.getSession().getAttribute(SessionEnum.USER_INFO.key()); - logger.info("从session中获取的用户信息={}" + JSONObject.toJSONString(userInfo)); - if (userInfo != null) { - - tdCompanyParkQueryRequest.setSysCode(billQueryRequest.getSysCode()); - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); - tdCompanyParkQueryRequest.setSessionId(request.getSession().getId()); - billQueryRequest.setUserName(userInfo.getName()); - billQueryRequest.setParkIdList(this.queryParkNoByCustIds(tdCompanyParkQueryRequest)); - - } - result = billManageForDayService.queryBillforDayDeatilPage(billQueryRequest); - logger.info("---end---日账单查看调用后场dubbo服务,结果={}", JSONObject.toJSON(result)); - - this.returnJsonDataGrid(response, result); - } - - /** - * 获取登录用户信息.
- * @param request - * @param response - * @throws Exception - */ - @RequestMapping(value = "/queryUserInfoForName", method = RequestMethod.POST) - public void queryUserInfoForName( HttpServletRequest request, - HttpServletResponse response) throws Exception { - UserInfo userInfo = (UserInfo) request.getSession().getAttribute(SessionEnum.USER_INFO.key()); - this.returnJson(response, userInfo); - } - - - - - - /** - * 日账单导出.
- * - * @param request - * @param response - * @throws Exception - */ - @RequestMapping("/exportToExcleForBillForDay") - public void exportToExcleForBillForDay(String sysCode, String beginTime, String endTime, String aliTotalFee , - String aliDealCount,String wxTotalFee,String wxDealCount,String cashTotalFee,String cashDealCount, - String orderTotalFee,String orderDealCount, - HttpServletRequest request,String parkIds,String userName, - HttpServletResponse response) throws Exception { - - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - //获取session中的用户信息 - UserInfo userInfo = sessionCommUtil.getUserInfo(); - BillQueryRequest billQueryRequest = new BillQueryRequest(); - - billQueryRequest.setBeginTime(format.parse(beginTime)); - billQueryRequest.setEndTime(format.parse(endTime)); - billQueryRequest.setSysCode(sysCode); - billQueryRequest.getBaseRequest().setPageSize(0); - List parkList= new ArrayList(); - if(StringUtils.isNotEmpty(parkIds)){ - for(String str :parkIds.split(",")){ - if(StringUtils.isNotEmpty(str)){ - parkList.add(str.trim()); - } - } - } - billQueryRequest.setParkIdList(parkList); - /**查询日账单汇总信息.*/ - BizResult> result = billManageForDayService.queryBillforDayDeatilPage(billQueryRequest); - String[] titleOne = new String[2]; - titleOne[0] = "用户: " + (StringUtils.isNotEmpty(userName) ? userName : ""); - titleOne[1] = "时间: "+beginTime+" "+endTime; - String[] titleTwo = new String[] {"","现金", "微信", "支付宝", "合计"}; - String[] titleThree = new String[] { "停车场名称", "现金", "微信", "支付宝", "合计"}; - String sheetName = "日账单"; - String fileName = "日账单管理" + format.format(new Date()); - - - // 1.创建excel信息 - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); - // 2.设置excel表头和表体 - Layouter.buildBillForDay(workSheet, titleOne, 0, 0);//创建第一行标题 - Layouter.buildHeaders(workSheet, titleTwo, 0, 0);//创建第2行标题 - Layouter.buildHeaders(workSheet, titleThree, 3, 0);//创建第3行标题 - // 3.填充数据 - List contentListTwo = new ArrayList(); - for(int i = 0;i<2;i++){ - Object[] str = new Object[titleTwo.length]; - if(i == 0){ - str[0] = "交易笔数"; - str[1] = (cashDealCount == null ? "0" : cashDealCount); - str[2] = (wxDealCount== null ? "0" : wxDealCount); - str[3] = (aliDealCount== null ? "0" : aliDealCount); - str[4] = (orderDealCount== null ? "0" : orderDealCount); - }else{ - str[0] = "总收入(元)"; - str[1] = (cashTotalFee == null ? "0" : new BigDecimal(cashTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - str[2] = (wxTotalFee== null ? "0" : new BigDecimal(wxTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - str[3] = (aliTotalFee== null ? "0" : new BigDecimal(aliTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - str[4] = (orderTotalFee== null ? "0" : new BigDecimal(orderTotalFee).divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - } - contentListTwo.add(str); - } - ExcleFillDateManager fillUserManagerTwo = new ExcleFillDateManager(); - fillUserManagerTwo.fillSalesOrga(workSheet, titleTwo, contentListTwo, 2); //第2行标题 - - // - List contentList = new ArrayList(); - if(result != null && result.getData() != null){ - List list = result.getData().getDataList(); - if(list != null && list.size()>0){ - for (int i = 0; i < list.size(); i++) { - BillManageDTO e = list.get(i); - Object[] obj = new Object[titleThree.length]; - int index = 0; - obj[index++] = e.getParkName(); - obj[index++] = (e.getCashTotalFee()== null ? "0" : e.getCashTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - obj[index++] = (e.getWxTotalFee()== null ? "0" : e.getWxTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - obj[index++] = (e.getAliTotalFee()== null ? "0" : e.getAliTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - obj[index++] = (e.getAliTotalFee()== null ? "0" : e.getAliTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; - contentList.add(obj); - } - } - } - - ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); - fillUserManager.fillSalesOrga(workSheet, titleThree, contentList, 5); - // 4.excel输出配置 - ExcelUtil.write(response, workSheet, fileName); - - - } - - /** - * 通过session信息获取停车场编码.
- * - * @param billQueryRequest - * @param userInfo - * @return - * @throws Exception - */ - private List queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws Exception { - /** 查询停车场编码. */ - BizResult> parkNoResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); - if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) { - logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData())); - return parkNoResult.getData(); - } else { - logger.info("根据登录用户没有获取到对应的停车场编码"); - return null; - } - - } - - - -} diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java deleted file mode 100644 index 1eba049..0000000 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpSession; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import com.alibaba.dubbo.common.utils.CollectionUtils; -import com.clouds.common.cache.park.ParkingLotCacheUtil; -import com.clouds.common.entity.UserInfo; -import com.clouds.common.utils.ResultUtils; -import com.clouds.common.web.SessionCommUtil; -import com.clouds.common.web.vo.BizResultVO; -import com.google.common.collect.Lists; -import com.zteits.clouds.api.apibase.bean.BizResult; -import com.zteits.clouds.api.apibase.constants.ErrorType; -import com.zteits.clouds.api.apibase.exception.BizException; -import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; -import com.zteits.clouds.api.dto.park.param.ParkFreeBerthGetByPlnoRequest; -import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest; -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; -import com.zteits.clouds.api.service.park.ParkFreeBerthService; -import com.zteits.clouds.api.service.park.ParkingLotQueryService; -import com.zteits.clouds.api.service.pay.TdCustCompanyService; -import com.zteits.irain.portal.vo.govclouds.ParkLotStatisticVO; -import com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage.ParkLotManageController; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -/** - * - * Copyright: Copyright (c) 2017 zteits - * - * @ClassName: ParkLotStatisticController.java - * @Description: - * @version: v1.0.0 - * @author: zhaowg - * @date: 2017年8月7日 下午5:21:16 - * Modification History: - * Date Author Version Description - *---------------------------------------------------------* - * 2017年8月7日 zhaowg v1.0.0 创建 - */ - -@Api("停车场信息统计") -@RestController -@RequestMapping("parklotstatistic") -public class ParkLotStatisticController { - private Logger logger = LoggerFactory.getLogger(ParkLotManageController.class); - @Autowired - private HttpSession session; - @Autowired - private SessionCommUtil sessionCommUtil; - @Autowired - private TdCustCompanyService tdCustCompanyService; - @Autowired - private ParkingLotQueryService parkingLotQueryService; - @Autowired - private ParkFreeBerthService parkFreeBerthService; - - @ApiOperation("获取停车场信息统计") - @PostMapping("getParkLotStatistic") - public BizResultVO> getParkLotStatistic(@RequestParam String sysCode) throws Exception{ - List result = Lists.newArrayList(); - //拥有的停车场编号 - List plNos = this.GetParkLotNosByCurrUser(sysCode); - //查询对应的停车场信息 - if(CollectionUtils.isEmpty(plNos)){ - return new BizResultVO>().setData(result); - } - //空闲车位数 - ParkFreeBerthGetByPlnoRequest request = new ParkFreeBerthGetByPlnoRequest(); - request.setPlNos(plNos); - request.setSysCode(sysCode); - BizResult> freeBerthsNumBizResult = parkFreeBerthService.getParkFreeBerthByPlno(request ); - Map freeBerthsNumMap = ResultUtils.getBizResultData(freeBerthsNumBizResult); - for (String plNo : plNos) { - //先查询缓存 - ParkingLotDTO lotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo); - if(lotDTO == null){ - //查询数据库 - QueryParkLotInfoByPkNoRequest request1 = new QueryParkLotInfoByPkNoRequest(); - request1.setSysCode(sysCode); - request1.setPklNo(plNo); - BizResult bizResult2 = parkingLotQueryService.QueryParkingLotByPkNo(request1); - lotDTO = ResultUtils.getBizResultData(bizResult2); - } - if(lotDTO == null || StringUtils.isBlank(lotDTO.getPlName()) || lotDTO.getPlName().equals("null")){ - continue; - } - ParkLotStatisticVO lotStatisticVO = new ParkLotStatisticVO(); - lotStatisticVO.setPlNo(plNo); - lotStatisticVO.setPlName(lotDTO.getPlName()); - lotStatisticVO.setFreeBerthsNum(freeBerthsNumMap.get(plNo)); - lotStatisticVO.setTotalBerthsNum(lotDTO.getPlBerthNum()); - lotStatisticVO.setUseingBerthsNum(lotDTO.getPlBerthNum()-freeBerthsNumMap.get(plNo)); - //设置地磁在线离线数量 - //TODO 临时方案,只有红山区有数据 - result.add(lotStatisticVO); - } - return new BizResultVO>().setData(result); - } - - private List GetParkLotNosByCurrUser(String sysCode) throws Exception { - logger.info("根据登录人权限获取停车场列表"); - List plNos = Lists.newArrayList(); - //2.调用接口查询当前登录人管辖的停车场名称 - plNos.add("A320211000"); - plNos.add("B1504020C7"); - /*UserInfo userInfo = sessionCommUtil.getUserInfo(); - if(userInfo!=null){ - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); - tdCompanyParkQueryRequest.setSysCode(sysCode); - tdCompanyParkQueryRequest.setSessionId(session.getId()); - BizResult> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest ); - plNos = ResultUtils.getBizResultData(bizResult); - }else{ - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS); - }*/ - return plNos; - } -} diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java deleted file mode 100644 index d4597e7..0000000 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java +++ /dev/null @@ -1,405 +0,0 @@ -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; - -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.alibaba.dubbo.common.utils.CollectionUtils; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.clouds.common.entity.UserInfo; -import com.clouds.common.utils.DateUtil; -import com.clouds.common.utils.ResultUtils; -import com.clouds.common.utils.excle.ExcelUtil; -import com.clouds.common.utils.excle.ExcleFillDateManager; -import com.clouds.common.utils.excle.Layouter; -import com.clouds.common.web.BizController; -import com.clouds.common.web.SessionCommUtil; -import com.clouds.common.web.vo.BizResultVO; -import com.clouds.common.web.vo.EasyUIDataGridVO; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.zteits.clouds.api.apibase.bean.BaseInfo; -import com.zteits.clouds.api.apibase.bean.BizResult; -import com.zteits.clouds.api.apibase.bean.PageBean; -import com.zteits.clouds.api.apibase.constants.ErrorType; -import com.zteits.clouds.api.apibase.exception.BizException; -import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; -import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO; -import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; -import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; -import com.zteits.clouds.api.service.pay.TdCustCompanyService; -import com.zteits.irain.portal.constant.ParkConstant; -import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.BerthsAndFlowLineChartVO; -import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; -import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - -/** - * - * 停车场车流量数据统计 Copyright: Copyright (c) 2017 zteits - * - * @ClassName: ParkingLotUseStatisticController.java - * @Description: - * @version: v1.0.0 - * @author: langlw - * @date: 2017年6月14日 下午3:02:39 Modification History: Date Author Version - * Description ---------------------------------------------------------* - * 2017年6月14日 langlw v1.0.0 创建 - */ -@Api(value = "停车场车流量数据统计", description = "停车场车流量数据统计") -@Controller -@RequestMapping(value = "/VehicleFlowStatistic") -public class VehicleFlowStatisticController extends BizController { - private Logger logger = LoggerFactory.getLogger(VehicleFlowStatisticController.class); - - @Value("${project.syscode}") - private String sysCode; - - @Autowired - private ParkingLotUseStatisticService parkingLotStatisticService; - @Autowired - private HttpSession session; - @Autowired - private SessionCommUtil sessionCommUtil; - @Autowired - private TdCustCompanyService tdCustCompanyService; - - @ApiOperation("分页查询车流量数据统计车位总流量") - @PostMapping("getVehicleFlowStatisticForPage") - @ResponseBody - public BizResultVO> queryParkingLotUseStatisticForPage( - @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception { - if (null == request.getBeginTime() || null==request.getEndTime()) { - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); - } - Calendar beginc = Calendar.getInstance(); - beginc.setTime(request.getBeginTime()); - int beginYear = beginc.get(Calendar.YEAR); - int beginMonth = beginc.get(Calendar.MONTH) + 1; - int beginDay = beginc.get(Calendar.DAY_OF_MONTH); - - Calendar endc = Calendar.getInstance(); - endc.setTime(request.getEndTime()); - int endYear = endc.get(Calendar.YEAR); - int endMonth = endc.get(Calendar.MONTH) + 1; - int endDay = endc.get(Calendar.DAY_OF_MONTH); - - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { - // 2表示按每小时统计 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - } else { - // 3表示按每天统计 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); - } - - BizResult> bizResult = parkingLotStatisticService - .queryParkingLotUseStatisticForPage(request); - return returnJqGridData(bizResult, ParkingLotUseStatisticDTO.class); - } - - @ApiOperation("查询车流量最大值与最小值") - @PostMapping("getVehicleFlowMaxAndMin") - @ResponseBody - public BizResultVO QueryParkingLotUseStatisticMaxAndMin( - @RequestBody ParkingLotUseStatisticForPageRequest request) { - Calendar beginc = Calendar.getInstance(); - beginc.setTime(request.getBeginTime()); - int beginYear = beginc.get(Calendar.YEAR); - int beginMonth = beginc.get(Calendar.MONTH) + 1; - int beginDay = beginc.get(Calendar.DAY_OF_MONTH); - - Calendar endc = Calendar.getInstance(); - endc.setTime(request.getEndTime()); - int endYear = endc.get(Calendar.YEAR); - int endMonth = endc.get(Calendar.MONTH) + 1; - int endDay = endc.get(Calendar.DAY_OF_MONTH); - - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { - // 2表示按每小时统计 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - } else { - // 3表示按每天统计 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); - } - BizResult bizResult = parkingLotStatisticService - .QueryVehicleFlowStatisticMaxAndMin(request); - return new BizResultVO<>(bizResult); - } - - @ApiOperation("导出车流量数据统计excel") - @GetMapping("exportVehicleFlowStatisticExcel") - public void excelParkingLotUseStatistic(@RequestParam String beginTime, @RequestParam String endTime, - @RequestParam String plNos, HttpServletRequest requests, HttpServletResponse response) { - ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest(); - request.setSysCode(sysCode); - request.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); - request.setEndTime(DateUtil.to_date(endTime, DateUtil.DATETIME_FORMAT)); - List plNoslist = new ArrayList<>(); - plNoslist.add(plNos); - request.setPlNos(plNoslist); - request.setBaseRequest(new BaseInfo(1, 0)); - Calendar beginc = Calendar.getInstance(); - beginc.setTime(request.getBeginTime()); - int beginYear = beginc.get(Calendar.YEAR); - int beginMonth = beginc.get(Calendar.MONTH) + 1; - int beginDay = beginc.get(Calendar.DAY_OF_MONTH); - - Calendar endc = Calendar.getInstance(); - endc.setTime(request.getEndTime()); - int endYear = endc.get(Calendar.YEAR); - int endMonth = endc.get(Calendar.MONTH) + 1; - int endDay = endc.get(Calendar.DAY_OF_MONTH); - - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { - // 2表示按每小时统计 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - } else { - // 3表示按每天统计 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); - } - BizResult> bizResult = parkingLotStatisticService - .queryParkingLotUseStatisticForPage(request); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); - String[] title = new String[] { "时间", "总车流量", "临时车流量", "固定车流量" }; - String sheetName = "车流量管理"; - String fileName = "车流量管理" + format2.format(new Date()); - // 1.创建excel信息 - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); - // 2.设置excel表头和表体 - Layouter.buildReport(workSheet, title, 0, 0); - // 3.填充数据 - List contentList = new ArrayList(); - List list = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(bizResult.getData().getDataList())) { - list = bizResult.getData().getDataList(); - } - for (ParkingLotUseStatisticDTO e : list) { - Object[] obj = new Object[title.length]; - int index = 0; - obj[index++] = format.format(e.getStatisticBeginTime()); - obj[index++] = e.getVehicleFlow(); - obj[index++] = e.getTmpVehicleFlow(); - obj[index++] = e.getFixVehicleFlow(); - contentList.add(obj); - } - ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); - // 4.excel输出配置 - ExcelUtil.write(response, workSheet, fileName); - } - - /** - * 根据时间获取车流量折线图 - * - * @param request - * @return - * @throws Exception - */ - @ApiOperation("根据时间获取车流量折线图") - @PostMapping("getVehicleFlowForLineChart") - @ResponseBody - public BizResultVO getVehicleFlowForLineChart( - @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception { - - if (null == request.getBeginTime() || null==request.getEndTime()) { - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); - } - //2.调用接口查询当前登录人管辖的停车场名称 - UserInfo userInfo = sessionCommUtil.getUserInfo(); - List plNos = new ArrayList<>(); - if(userInfo!=null){ - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); - tdCompanyParkQueryRequest.setSessionId(session.getId()); - tdCompanyParkQueryRequest.setSysCode(sysCode); - BizResult> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); - //拥有的停车场编号 - plNos = ResultUtils.getBizResultData(bizResult); - } - if(CollectionUtils.isEmpty(plNos)){ - throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); - } - request.setPlNos(plNos); - - logger.info("根据停车场编号获取该停车场今日车流量和车位折线图"); - Calendar beginTime = Calendar.getInstance(); - beginTime.setTime(request.getBeginTime()); - - Calendar endTime = Calendar.getInstance(); - endTime.setTime(request.getEndTime()); - - Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), - new Timestamp(request.getBeginTime().getTime())); - List xAxisData = Lists.newArrayList(); - request.setBaseRequest(new BaseInfo(1, 0)); - String dateType=""; - - if (dayDifference == 0L) { - // 20分钟为一个时间戳 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY) * 3; - for (int i = 0; i < totaltimestampCount; i++) { - String hour = String.format("%02d", (i / 3)); - String minute = String.format("%02d", (i % 3) * 20); - xAxisData.add(hour + ":" + minute); - } - dateType="HH:mm"; - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType); - return new BizResultVO().setData(vehicleFlows); - - } else if (dayDifference <= 3L) { - // 1小时为一个时间戳 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); - String day = ""; - String month = ""; - for (int i = 0; i < dayDifference.intValue(); i++) { - beginTime.add(Calendar.DAY_OF_MONTH, 1); - int beginMonth = beginTime.get(Calendar.MONTH) + 1; - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); - month = String.format("%02d", (beginMonth)); - day = String.format("%02d", (beginDay)); - for (int j = 0; j < totaltimestampCount; j++) { - String hour = String.format("%02d", (j)); - xAxisData.add(month + "-" + day + " " + hour); - } - } - dateType="MM-dd HH"; - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType); - return new BizResultVO().setData(vehicleFlows); - - } else { - // 1天为一个时间戳 - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); - for (int i = 0; i < dayDifference.intValue(); i++) { - beginTime.add(Calendar.DAY_OF_MONTH, 1); - int beginMonth = beginTime.get(Calendar.MONTH) + 1; - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); - String month = String.format("%02d", (beginMonth)); - String day = String.format("%02d", (beginDay)); - xAxisData.add(month + "-" + day); - - } - dateType="MM-dd"; - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType); - return new BizResultVO().setData(vehicleFlows); - - } - - } - - - private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, - List xAxisData,String dateType){ - // 调用后场服务 - logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); - BizResult> bizResult = parkingLotStatisticService - .queryParkingLotUseStatisticForPage(request); - PageBean pageBean = ResultUtils.getBizResultData(bizResult); - List useStatisticDTOs = Lists.newArrayList(); - if (pageBean != null) { - useStatisticDTOs = pageBean.getDataList(); - } - - // 保存固定车流量,时间戳和车流量对应关系 - Map fixVehicleFlowMap = Maps.newHashMap(); - // 保存临时车流量,时间戳和车流量对应关系 - Map tmpVehicleFlowMap = Maps.newHashMap(); - // 停车场编号和名称对应关系 - Map parkNameMap = Maps.newHashMap(); - // 通过停车场,和统计时间分组 - // Map> parkLotMap = Maps.newHashMap(); - if (!CollectionUtils.isEmpty(useStatisticDTOs)) { - for (ParkingLotUseStatisticDTO statisticDTO : useStatisticDTOs) { - String key = statisticDTO.getPlNo(); - parkNameMap.put(key, statisticDTO.getPlName()); - String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType); - //保存固定车流量和临时车流量 - fixVehicleFlowMap.put(statisBeginTime, (fixVehicleFlowMap.get(statisBeginTime)==null?0:fixVehicleFlowMap.get(statisBeginTime))+statisticDTO.getFixVehicleFlow()); - tmpVehicleFlowMap.put(statisBeginTime, (tmpVehicleFlowMap.get(statisBeginTime)==null?0:tmpVehicleFlowMap.get(statisBeginTime))+statisticDTO.getTmpVehicleFlow()); - } - } - - // 封装车流量统计 - LineChartVO vehicleFlows = new LineChartVO(); - List vehicleFlows_legendData = Lists.newArrayList(); - vehicleFlows_legendData.add("临时车"); - vehicleFlows_legendData.add("固定车"); - vehicleFlows.setLegendData(vehicleFlows_legendData); - vehicleFlows.setxAxisData(xAxisData); - List vehicleSeries = Lists.newArrayList(); - // 固定车 - SerieVO fixSerieVo = new SerieVO(); - fixSerieVo.setName("固定车"); - List fixSerieVoData = Lists.newArrayList(); - // 临时车 - SerieVO tmpSerieVo = new SerieVO(); - tmpSerieVo.setName("临时车"); - List tmpSerieVoData = Lists.newArrayList(); - // 保存上一次的临时车值,当某个时间点没有数据时,则保持和上次一致 - Integer lastfixFlow = 0; - Integer lasttmpFlow = 0; - for (String timestamp : xAxisData) { - - if (fixVehicleFlowMap.containsKey(timestamp)) { - lastfixFlow = fixVehicleFlowMap.get(timestamp).intValue(); - }else{ - lastfixFlow =0; - } - fixSerieVoData.add(lastfixFlow); - - if (tmpVehicleFlowMap.containsKey(timestamp)) { - lasttmpFlow = tmpVehicleFlowMap.get(timestamp).intValue(); - }else{ - lasttmpFlow = 0; - } - tmpSerieVoData.add(lasttmpFlow); - } - fixSerieVo.setData(fixSerieVoData); - vehicleSeries.add(fixSerieVo); - tmpSerieVo.setData(tmpSerieVoData); - vehicleSeries.add(tmpSerieVo); - - vehicleFlows.setSeries(vehicleSeries); - return vehicleFlows; - } - - public static void main(String[] args) { - 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\"}}"; - JSONObject object =(JSONObject)JSONObject.parse(json); - System.out.println(object.get("id")); - System.out.println(object.get("platform")); - JSONObject parameter =(JSONObject)object.get("parameter"); - System.out.println(parameter.get("drid")); - System.out.println(parameter.get("sex")); - } - - -} diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/YearMonthCardStatisticController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/YearMonthCardStatisticController.java deleted file mode 100644 index 6e5b2ec..0000000 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/YearMonthCardStatisticController.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.alibaba.dubbo.common.utils.CollectionUtils; -import com.alibaba.fastjson.JSON; - -import com.clouds.common.utils.excle.ExcelUtil; -import com.clouds.common.utils.excle.ExcleFillDateManager; -import com.clouds.common.utils.excle.Layouter; -import com.clouds.common.web.BizController; -import com.clouds.common.web.vo.BizResultVO; -import com.clouds.common.web.vo.EasyUIDataGridVO; -import com.zteits.clouds.api.apibase.bean.BaseInfo; -import com.zteits.clouds.api.apibase.bean.BizResult; -import com.zteits.clouds.api.apibase.bean.PageBean; -import com.zteits.clouds.api.apibase.constants.ErrorType; -import com.zteits.clouds.api.apibase.exception.BizException; -import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticDTO; -import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticSumDTO; -import com.zteits.clouds.api.dto.pay.param.YearMonthCardStatisticRequest; -import com.zteits.clouds.api.service.clouds.YearMonthCardStatisticService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -/** - * 企业云平台->数据统计->年卡月卡统计。 - * - * Copyright: Copyright (c) 2017 zteits - * - * @ClassName: InOutParkStatisticController.java - * @Description: - * @version: v1.0.0 - * @author: langlw - * @date: 2017年7月26日 上午11:30:04 - * Modification History: - * Date Author Version Description - * ---------------------------------------------------------* - * 2017年7月26日 langlw v1.0.0 创建 - */ -@Api(value = "企业云平台->数据统计->年卡月卡统计", description = "企业云平台->数据统计->年卡月卡统计") -@RestController -@RequestMapping(value = "/yearMonthCardStatistic") -public class YearMonthCardStatisticController extends BizController { - - private static final Logger logger = LoggerFactory.getLogger(InOutParkStatisticController.class); - - @Value("${project.syscode}") - private String sysCode; - @Autowired - private YearMonthCardStatisticService yearMonthCardStatisticService; - - @ApiOperation("年卡月卡统计") - @PostMapping("queryYearMonthCardStatistic") - @ResponseBody - public BizResultVO> queryYearMonthCardStatistic( - @RequestBody YearMonthCardStatisticRequest request) throws Exception { - logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); - if (null == request.getBeginTime() || null == request.getEndTime()) { - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); - } - BizResult> bizResult = yearMonthCardStatisticService - .queryYearMonthCardStatistic(request); - return returnJqGridData(bizResult, YearMonthCardStatisticDTO.class); - } - - @ApiOperation("年卡月卡统计折线图") - @PostMapping("queryYearMonthCardStatisticForChart") - @ResponseBody - public BizResultVO> queryYearMonthCardStatisticForChart( - @RequestBody YearMonthCardStatisticRequest request) throws Exception { - logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); - if (null == request.getBeginTime() || null == request.getEndTime()) { - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); - } - BizResult> bizResult = yearMonthCardStatisticService - .queryYearMonthCardStatisticSum(request); - logger.info("调用DUBBO服务返回结果:" + JSON.toJSONString(bizResult)); - return new BizResultVO<>(bizResult); - } - - @ApiOperation("导出年卡月卡统计excel") - @GetMapping("exportYearMonthStatisticExcel") - public void exportYearMonthStatisticExcel(@RequestParam Long beginTime, @RequestParam Long endTime, - @RequestParam List parkIdList, @RequestParam String parkNames, - Integer orderType, Integer payType, Integer dataState, - HttpServletRequest requests, HttpServletResponse response) throws Exception { - - YearMonthCardStatisticRequest request = new YearMonthCardStatisticRequest(); - request.setSysCode(sysCode); - request.setBeginTime(new Date(beginTime)); - request.setEndTime(new Date(endTime)); - - request.setParkIdList(parkIdList); - request.setBaseRequest(new BaseInfo(1, 0)); - request.setOrderType(orderType); - request.setPayType(payType); - request.setDataState(dataState); - - BizResult> bizResult = yearMonthCardStatisticService - .queryYearMonthCardStatistic(request); - BizResult> bizResultSum = yearMonthCardStatisticService - .queryYearMonthCardStatisticSum(request); - - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); - String[] title = new String[] {"交易时间", "停车场", "类型", "车牌号", "支付方式", "支付金额", "有效期", "状态"}; - String sheetName = "年卡月卡统计"; - String fileName = "年卡月卡统计" + format2.format(new Date()); - - String[] billTitle = new String[9]; - billTitle = new String[2]; - //if (!org.springframework.util.CollectionUtils.isEmpty(bizResultSum.getData())) { - // List dtoList = bizResultSum.getData(); - // String amountsum = ""; - // String sum = ""; - // for (YearMonthCardStatisticSumDTO dto : dtoList) { - // amountsum = dto.getAmountSum() == null ? " " : dto.getAmountSum() + "," + amountsum; - // sum = dto.getOrderSum() + "," + sum; - // } - // String ordertype = ""; - // if (null != orderType) { - // if (2 == orderType) { - // ordertype = "年卡"; - // } else if (3 == orderType) { - // ordertype = "月卡"; - // } - // } - // String datastate = ""; - // if (null != dataState) { - // if (1 == dataState) { - // datastate = "有效"; - // } else if (0 == dataState) { - // datastate = "无效"; - // } - // } - // - billTitle[0] = "年卡月卡统计"; - // billTitle[1] = "汇总"; - // billTitle[2] = "停车场: " + parkNames; - // billTitle[3] = "时间: " + endTime; - // billTitle[4] = "类型:" + (orderType != null ? ordertype : ""); - // billTitle[5] = "状态: " + (dataState != null ? datastate : ""); - // billTitle[6] = "支付方式: " + (payType != null ? payType : ""); - // billTitle[7] = "每个月的总笔数" + sum; - // billTitle[8] = "每个月的总金额数" + amountsum; - //} else { - // billTitle[0] = "年卡月卡统计"; - // billTitle[1] = "汇总"; - // billTitle[2] = "停车场: "; - // billTitle[3] = "时间: "; - // billTitle[4] = "类型:"; - // billTitle[5] = "状态: "; - // billTitle[6] = "支付方式: "; - // billTitle[7] = "每个月的总车数"; - // billTitle[8] = "每个月的总金额数"; - //} - - // 1.创建excel信息 - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); - // 2.设置excel表头和表体 - Layouter.buildReport(workSheet, title,0,0); - // 3.填充数据 - List contentList = new ArrayList(); - List list = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(bizResult.getData().getDataList())) { - list = bizResult.getData().getDataList(); - } - for (YearMonthCardStatisticDTO e : list) { - Object[] obj = new Object[title.length]; - int index = 0; - obj[index++] = e.getPayFinishTime() != null ? format.format(e.getPayFinishTime()) : ""; - obj[index++] = e.getParkName(); - String cardType=""; - if (null != e.getOrderType()) { - if (2 == e.getOrderType()) { - cardType = "年卡"; - }else{ - cardType = "月卡"; - } - } - obj[index++]=cardType; - obj[index++] = e.getCarNumber(); - if (e.getPayType() != null) { - switch (e.getPayType()) { - case 1: - obj[index++] = "支付宝"; - break; - case 2: - obj[index++] = "微信"; - break; - case 3: - obj[index++] = "银联"; - break; - case 4: - obj[index++] = "微信"; - break; - default: - obj[index++] = "现金"; - break; - } - } else { - obj[index++] = ""; - } - obj[index++] = e.getAmount() != null ? e.getAmount() : "0.00"; - obj[index++] = e.getEffDate() != null ? format.format(e.getEffDate()) - : "" + "-" + e.getExpDate() != null ? format.format(e.getExpDate()) : ""; - //有效、无效 - Date d = new Date(); - String state = ""; - if ((d.getTime() <= e.getExpDate().getTime()) && (d.getTime() >= e.getEffDate().getTime())) { - state = "有效"; - } else { - state = "无效"; - } - obj[index++] = state; - contentList.add(obj); - } - ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); - // 4.excel输出配置 - ExcelUtil.write(response, workSheet, fileName); - } - -} diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java deleted file mode 100644 index da98071..0000000 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpSession; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import com.alibaba.dubbo.common.utils.CollectionUtils; -import com.clouds.common.cache.park.ParkingLotCacheUtil; -import com.clouds.common.entity.UserInfo; -import com.clouds.common.utils.ResultUtils; -import com.clouds.common.web.SessionCommUtil; -import com.clouds.common.web.vo.BizResultVO; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.zteits.clouds.api.apibase.bean.BizResult; -import com.zteits.clouds.api.apibase.constants.ErrorType; -import com.zteits.clouds.api.apibase.exception.BizException; -import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; -import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest; -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; -import com.zteits.clouds.api.service.park.ParkingLotQueryService; -import com.zteits.clouds.api.service.pay.TdCustCompanyService; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - -/** - * 停车场管理 - * - * Copyright: Copyright (c) 2017 zteits - * - * @ClassName: ParkingLotController.java - * @Description: - * @version: v1.0.0 - * @author: zhaowg - * @date: 2017年6月16日 下午5:27:21 - * Modification History: - * Date Author Version Description - *---------------------------------------------------------* - * 2017年6月16日 zhaowg v1.0.0 创建 - */ -@Api(value="停车场管理",description="停车场管理") -@RestController -@RequestMapping("parkLotManage") -public class ParkLotManageController{ - private Logger logger = LoggerFactory.getLogger(ParkLotManageController.class); - @Autowired - private HttpSession session; - @Autowired - private SessionCommUtil sessionCommUtil; - @Autowired - private TdCustCompanyService tdCustCompanyService; - @Autowired - private ParkingLotQueryService parkingLotQueryService; - /** - * 根据登录人权限获取停车场名称列表 - * @return - * 2017年6月16日 zhaowg - * @throws Exception - */ - @ApiOperation("根据登录人权限获取停车场名称列表") - @GetMapping("getParkLotNamesByUserId") - public BizResultVO>> GetParkLotNameListByUserId(@RequestParam String sysCode) throws Exception { - List> result = Lists.newArrayList(); - //拥有的停车场编号 - List plNos = this.GetParkLotNosByCurrUser(sysCode); - //查询对应的停车场信息 - if(CollectionUtils.isEmpty(plNos)){ - return new BizResultVO>>().setData(result); - } - for (String plNo : plNos) { - Map plNoMap = Maps.newHashMap(); - //先查询缓存 - ParkingLotDTO lotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo); - if(lotDTO == null){ - //查询数据库 - QueryParkLotInfoByPkNoRequest request = new QueryParkLotInfoByPkNoRequest(); - request.setSysCode(sysCode); - request.setPklNo(plNo); - BizResult bizResult2 = parkingLotQueryService.QueryParkingLotByPkNo(request); - lotDTO = ResultUtils.getBizResultData(bizResult2); - } - if(lotDTO == null || StringUtils.isBlank(lotDTO.getPlName()) || lotDTO.getPlName().equals("null")){ - continue; - } - plNoMap.put("code",plNo ); - plNoMap.put("name",lotDTO.getPlName()); - result.add(plNoMap); - } - - return new BizResultVO>>().setData(result); - } - - private List GetParkLotNosByCurrUser(String sysCode) throws Exception { - logger.info("根据登录人权限获取停车场列表"); - List plNos = Lists.newArrayList(); - //2.调用接口查询当前登录人管辖的停车场名称 - UserInfo userInfo = sessionCommUtil.getUserInfo(); - if(userInfo!=null){ - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); - tdCompanyParkQueryRequest.setSysCode(sysCode); - tdCompanyParkQueryRequest.setSessionId(session.getId()); - BizResult> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest ); - plNos = ResultUtils.getBizResultData(bizResult); - }else{ - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS); - } - return plNos; - } -} diff --git a/src/main/resources/application-wwwtown.properties b/src/main/resources/application-wwwtown.properties new file mode 100644 index 0000000..8464c1f --- /dev/null +++ b/src/main/resources/application-wwwtown.properties @@ -0,0 +1,26 @@ +#irain +irain.url=http://api.parkingwang.com:8280 +server.port=8094 +#irain艾润 +irain.appid=avakrky0gk1m7n00 +#irain +irain.appsecret=rrr6uz3aqvutpsq2lsna0k18cea4mabw +#irain aes +irain.aes=avakrky0gk1m7n00 + +irain.park_code=734861a1e8656ffa51bdd90829941ca9 + +spring.dubbo.application.name=${spring.application.name} +spring.dubbo.registry.address=zookeeper://10.112.92.88:2181?backup=10.112.92.87:2181 +spring.dubbo.provider.version=1.0.0 +spring.dubbo.cunsumer.check=false + +#spring session redis config +spring.redis.host=10.112.92.88 +spring.redis.port=7001 +spring.redis.password=myredis + +#ebochong config +ebochong.url= +ebochong.clientCode=12345678 +ebochong.key=2xJLZAlyolvMMz4+c/8nRA== \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 7b7ac06..c9f196d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ project.syscode=zteits-park-portal spring.application.name=zteits-park-portal -server.port=8099 +server.port=8094 # logging logging.level.root=info diff --git a/src/main/resources/dubbo/dubbo-park-consumer.xml b/src/main/resources/dubbo/dubbo-park-consumer.xml index a193d5f..b169256 100644 --- a/src/main/resources/dubbo/dubbo-park-consumer.xml +++ b/src/main/resources/dubbo/dubbo-park-consumer.xml @@ -138,4 +138,21 @@ version="${spring.dubbo.provider.version}" timeout="30000"/> + + + + + + + + + + \ No newline at end of file