Commit f56768a46015ab044d635377fd4850998df3ce1b
1 parent
4c27df36
1
Showing
1 changed file
with
66 additions
and
2 deletions
src/main/java/com/zteits/irain/portal/web/govclouds/DataGeneralizeController.java
@@ -5,6 +5,7 @@ import java.util.List; | @@ -5,6 +5,7 @@ import java.util.List; | ||
5 | import java.util.Map; | 5 | import java.util.Map; |
6 | import java.util.Map.Entry; | 6 | import java.util.Map.Entry; |
7 | 7 | ||
8 | +import org.apache.poi.util.StringUtil; | ||
8 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
9 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
15 | import org.springframework.web.bind.annotation.ResponseBody; | 16 | import org.springframework.web.bind.annotation.ResponseBody; |
16 | import org.springframework.web.bind.annotation.RestController; | 17 | import org.springframework.web.bind.annotation.RestController; |
17 | 18 | ||
19 | +import com.alibaba.druid.util.StringUtils; | ||
18 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 20 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
19 | import com.alibaba.fastjson.JSONObject; | 21 | import com.alibaba.fastjson.JSONObject; |
20 | import com.clouds.common.cache.park.EqpAndPosStatusSyncCacheUtil; | 22 | import com.clouds.common.cache.park.EqpAndPosStatusSyncCacheUtil; |
@@ -28,6 +30,8 @@ import com.zteits.clouds.api.apibase.bean.BizResult; | @@ -28,6 +30,8 @@ import com.zteits.clouds.api.apibase.bean.BizResult; | ||
28 | import com.zteits.clouds.api.apibase.constants.ErrorType; | 30 | import com.zteits.clouds.api.apibase.constants.ErrorType; |
29 | import com.zteits.clouds.api.apibase.exception.BizException; | 31 | import com.zteits.clouds.api.apibase.exception.BizException; |
30 | import com.zteits.clouds.api.dto.govclouds.ParkTransactionDTO; | 32 | import com.zteits.clouds.api.dto.govclouds.ParkTransactionDTO; |
33 | +import com.zteits.clouds.api.dto.govclouds.dto.ParkEqpAndPDACountDTO; | ||
34 | +import com.zteits.clouds.api.dto.govclouds.param.QueryParkEqpAndPDACountRequest; | ||
31 | import com.zteits.clouds.api.dto.park.dto.ParkFreeBerthsCountStatisticByCountryDTO; | 35 | import com.zteits.clouds.api.dto.park.dto.ParkFreeBerthsCountStatisticByCountryDTO; |
32 | import com.zteits.clouds.api.dto.park.dto.ParkLotCountStatisticByCountryDTO; | 36 | import com.zteits.clouds.api.dto.park.dto.ParkLotCountStatisticByCountryDTO; |
33 | import com.zteits.clouds.api.dto.park.dto.ParkLotEqpTypeCountStatisticByCountryDTO; | 37 | import com.zteits.clouds.api.dto.park.dto.ParkLotEqpTypeCountStatisticByCountryDTO; |
@@ -38,6 +42,7 @@ import com.zteits.clouds.api.service.govclouds.ParkTransactionService; | @@ -38,6 +42,7 @@ import com.zteits.clouds.api.service.govclouds.ParkTransactionService; | ||
38 | import com.zteits.clouds.api.service.park.ParkFreeBerthService; | 42 | import com.zteits.clouds.api.service.park.ParkFreeBerthService; |
39 | import com.zteits.clouds.api.service.park.ParkingLotEqpService; | 43 | import com.zteits.clouds.api.service.park.ParkingLotEqpService; |
40 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; | 44 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; |
45 | +import com.zteits.clouds.api.service.park.TpPPdaService; | ||
41 | import com.zteits.irain.portal.vo.govclouds.StatisticParkLotEqpCountByCountryVO; | 46 | import com.zteits.irain.portal.vo.govclouds.StatisticParkLotEqpCountByCountryVO; |
42 | import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO; | 47 | import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO; |
43 | import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO.BerthSeriesVO; | 48 | import com.zteits.irain.portal.vo.parkinglotdatacenter.BerthSpaceRatioVO.BerthSeriesVO; |
@@ -77,6 +82,8 @@ public class DataGeneralizeController { | @@ -77,6 +82,8 @@ public class DataGeneralizeController { | ||
77 | private ParkFreeBerthService parkFreeBerthService; | 82 | private ParkFreeBerthService parkFreeBerthService; |
78 | @Autowired | 83 | @Autowired |
79 | private ParkTransactionService parkTransactionService; | 84 | private ParkTransactionService parkTransactionService; |
85 | + @Autowired | ||
86 | + private TpPPdaService tpPPdaService; | ||
80 | 87 | ||
81 | /** | 88 | /** |
82 | * 这里用的是@SendToUser,这就是发送给单一客户端的标志。本例中, | 89 | * 这里用的是@SendToUser,这就是发送给单一客户端的标志。本例中, |
@@ -176,7 +183,12 @@ public class DataGeneralizeController { | @@ -176,7 +183,12 @@ public class DataGeneralizeController { | ||
176 | } | 183 | } |
177 | return list; | 184 | return list; |
178 | } | 185 | } |
179 | - | 186 | + /** |
187 | + * 分区统计停车场、停车位数量 | ||
188 | + * langlw 2017-9-5 | ||
189 | + * @param request | ||
190 | + * @return | ||
191 | + */ | ||
180 | @ApiOperation(value="停车场柱图") | 192 | @ApiOperation(value="停车场柱图") |
181 | @PostMapping("parkinglotColumnChart") | 193 | @PostMapping("parkinglotColumnChart") |
182 | @ResponseBody | 194 | @ResponseBody |
@@ -363,7 +375,12 @@ public class DataGeneralizeController { | @@ -363,7 +375,12 @@ public class DataGeneralizeController { | ||
363 | map.entrySet().forEach(e->{displayCountry.add(e.getValue());}); | 375 | map.entrySet().forEach(e->{displayCountry.add(e.getValue());}); |
364 | return new BizResultVO<List<String>>().setData(displayCountry); | 376 | return new BizResultVO<List<String>>().setData(displayCountry); |
365 | } | 377 | } |
366 | - | 378 | + /** |
379 | + * 车位配比图 | ||
380 | + * langlw 2017-9-5 | ||
381 | + * @param request | ||
382 | + * @return | ||
383 | + */ | ||
367 | @ApiOperation(value="车位配比图") | 384 | @ApiOperation(value="车位配比图") |
368 | @PostMapping("berthSpaceRatioChart") | 385 | @PostMapping("berthSpaceRatioChart") |
369 | @ResponseBody | 386 | @ResponseBody |
@@ -388,4 +405,51 @@ public class DataGeneralizeController { | @@ -388,4 +405,51 @@ public class DataGeneralizeController { | ||
388 | 405 | ||
389 | return new BizResultVO<BerthSpaceRatioVO>().setData(berthSpaceRatioVO); | 406 | return new BizResultVO<BerthSpaceRatioVO>().setData(berthSpaceRatioVO); |
390 | } | 407 | } |
408 | + | ||
409 | + | ||
410 | + | ||
411 | + @ApiOperation(value="获取停车场设备和PDA在线离线总数") | ||
412 | + @PostMapping("queryParkEqpAndPDACount") | ||
413 | + @ResponseBody | ||
414 | + public BizResultVO<Map<String,ParkEqpAndPDACountDTO>> queryParkEqpAndPDACount(@RequestBody QueryParkEqpAndPDACountRequest request){ | ||
415 | + if(null == request.getEqpType() || null == request.getPdaType() || CollectionUtils.isEmpty(request.getPlNos())){ | ||
416 | + throw new BizException(ErrorType.PARAMM_NULL, "入参不能为空"); | ||
417 | + } | ||
418 | + logger.info("调用dubbo服务,请求入参: request={}", JSONObject.toJSONString(request)); | ||
419 | + Map<String,ParkEqpAndPDACountDTO> parkEqpAndPDACountMap = Maps.newHashMap(); | ||
420 | + //查询停车场设备 | ||
421 | + BizResult<List<ParkEqpAndPDACountDTO>> result = parkingLotEqpService.queryParkEqpCountByPlNosAndEqpType(request); | ||
422 | + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(result)); | ||
423 | + List<ParkEqpAndPDACountDTO> parkEqpList=result.getData(); | ||
424 | + //PDA | ||
425 | + if(CollectionUtils.isNotEmpty(parkEqpList)){ | ||
426 | + for (ParkEqpAndPDACountDTO dto : parkEqpList) { | ||
427 | + if(null != dto){ | ||
428 | + String plNo = StringUtils.isEmpty(dto.getPlNo())?"":dto.getPlNo(); | ||
429 | + parkEqpAndPDACountMap.put(plNo, dto); | ||
430 | + } | ||
431 | + } | ||
432 | + } | ||
433 | + | ||
434 | + //查询PDA在线和离线总数 | ||
435 | + BizResult<List<ParkEqpAndPDACountDTO>> bizResult = tpPPdaService.queryPDACountByPlNosAndPdaType(request); | ||
436 | + logger.info("调用后场dubbo服务,响应为: result={}", JSONObject.toJSONString(bizResult)); | ||
437 | + List<ParkEqpAndPDACountDTO> parkPDACountList=bizResult.getData(); | ||
438 | + //PDA | ||
439 | + if(CollectionUtils.isNotEmpty(parkPDACountList)){ | ||
440 | + for (ParkEqpAndPDACountDTO dto : parkPDACountList) { | ||
441 | + if(null != dto){ | ||
442 | + String plNo = StringUtils.isEmpty(dto.getPlNo())?"":dto.getPlNo(); | ||
443 | + if(parkEqpAndPDACountMap.containsKey(plNo)){ | ||
444 | + parkEqpAndPDACountMap.get(plNo).setOnlinePDACount(null==dto.getOnlinePDACount()?0:dto.getOnlinePDACount()); | ||
445 | + parkEqpAndPDACountMap.get(plNo).setAllPDACount(null==dto.getAllPDACount()?0:dto.getAllPDACount()); | ||
446 | + }else{ | ||
447 | + parkEqpAndPDACountMap.put(plNo, dto); | ||
448 | + } | ||
449 | + } | ||
450 | + } | ||
451 | + } | ||
452 | + | ||
453 | + return new BizResultVO<Map<String,ParkEqpAndPDACountDTO>>().setData(parkEqpAndPDACountMap); | ||
454 | + } | ||
391 | } | 455 | } |