Commit 1e6272298d3ea4dd441ead998921d3a5cfdc6261
1 parent
767214e2
提交本地
Showing
3 changed files
with
154 additions
and
6 deletions
src/main/java/com/zteits/irain/portal/vo/parkinglotcloudplatform/datastatistic/ParkStaticsticAndTodayAmountVO.java
0 → 100644
1 | +package com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic; | |
2 | + | |
3 | +import java.math.BigDecimal; | |
4 | + | |
5 | +/** | |
6 | + * 企业云平台->车位使用统计、 | |
7 | + * 停车场基本信息和今日收入统计信息 | |
8 | + * | |
9 | + * Copyright: Copyright (c) 2017 zteits | |
10 | + * | |
11 | + * @ClassName: ParkStaticsticAndTodayAmountVO.java | |
12 | + * @Description: | |
13 | + * @version: v1.0.0 | |
14 | + * @author: langlw | |
15 | + * @date: 2017年8月18日 下午5:50:43 | |
16 | + * Modification History: | |
17 | + * Date Author Version Description | |
18 | + *---------------------------------------------------------* | |
19 | + * 2017年8月18日 langlw v1.0.0 创建 | |
20 | + */ | |
21 | +public class ParkStaticsticAndTodayAmountVO { | |
22 | + | |
23 | + /** 停车场id. */ | |
24 | + private String parkId; | |
25 | + /** 订单总金额=未支付费用+已支付费用. */ | |
26 | + private BigDecimal orderTotalFee; | |
27 | + /** 停车场名称. */ | |
28 | + private String parkName; | |
29 | + /** 总车位数*/ | |
30 | + private Integer totalBerthsNum; | |
31 | + /** 使用中的车位数*/ | |
32 | + private Integer useingBerthsNum; | |
33 | + | |
34 | + public Integer getTotalBerthsNum() { | |
35 | + return totalBerthsNum; | |
36 | + } | |
37 | + public void setTotalBerthsNum(Integer totalBerthsNum) { | |
38 | + this.totalBerthsNum = totalBerthsNum; | |
39 | + } | |
40 | + public Integer getUseingBerthsNum() { | |
41 | + return useingBerthsNum; | |
42 | + } | |
43 | + public void setUseingBerthsNum(Integer useingBerthsNum) { | |
44 | + this.useingBerthsNum = useingBerthsNum; | |
45 | + } | |
46 | + public String getParkId() { | |
47 | + return parkId; | |
48 | + } | |
49 | + public void setParkId(String parkId) { | |
50 | + this.parkId = parkId; | |
51 | + } | |
52 | + public BigDecimal getOrderTotalFee() { | |
53 | + return orderTotalFee; | |
54 | + } | |
55 | + public void setOrderTotalFee(BigDecimal orderTotalFee) { | |
56 | + this.orderTotalFee = orderTotalFee; | |
57 | + } | |
58 | + public String getParkName() { | |
59 | + return parkName; | |
60 | + } | |
61 | + public void setParkName(String parkName) { | |
62 | + this.parkName = parkName; | |
63 | + } | |
64 | + | |
65 | + | |
66 | +} | ... | ... |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java
1 | -/** | |
2 | - * | |
3 | - */ | |
4 | 1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; |
5 | 2 | |
3 | +import java.math.BigDecimal; | |
6 | 4 | import java.sql.Timestamp; |
7 | 5 | import java.text.SimpleDateFormat; |
8 | 6 | import java.util.ArrayList; |
... | ... | @@ -15,6 +13,7 @@ import java.util.Map.Entry; |
15 | 13 | import javax.servlet.http.HttpServletRequest; |
16 | 14 | import javax.servlet.http.HttpServletResponse; |
17 | 15 | |
16 | +import org.apache.commons.lang3.StringUtils; | |
18 | 17 | import org.apache.poi.xssf.usermodel.XSSFSheet; |
19 | 18 | import org.slf4j.Logger; |
20 | 19 | import org.slf4j.LoggerFactory; |
... | ... | @@ -31,6 +30,7 @@ import org.springframework.web.bind.annotation.ResponseBody; |
31 | 30 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
32 | 31 | import com.alibaba.fastjson.JSON; |
33 | 32 | import com.clouds.common.cache.park.ParkingLotCacheUtil; |
33 | +import com.clouds.common.entity.UserInfo; | |
34 | 34 | import com.clouds.common.redis.RedisCacheUtil; |
35 | 35 | import com.clouds.common.utils.DateUtil; |
36 | 36 | import com.clouds.common.utils.ResultUtils; |
... | ... | @@ -38,6 +38,7 @@ import com.clouds.common.utils.excle.ExcelUtil; |
38 | 38 | import com.clouds.common.utils.excle.ExcleFillDateManager; |
39 | 39 | import com.clouds.common.utils.excle.Layouter; |
40 | 40 | import com.clouds.common.web.BizController; |
41 | +import com.clouds.common.web.SessionCommUtil; | |
41 | 42 | import com.clouds.common.web.vo.BizResultVO; |
42 | 43 | import com.clouds.common.web.vo.EasyUIDataGridVO; |
43 | 44 | import com.google.common.collect.Lists; |
... | ... | @@ -50,18 +51,38 @@ import com.zteits.clouds.api.apibase.exception.BizException; |
50 | 51 | import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; |
51 | 52 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; |
52 | 53 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO; |
54 | +import com.zteits.clouds.api.dto.park.param.ParkFreeBerthGetByPlnoRequest; | |
53 | 55 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; |
56 | +import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest; | |
57 | +import com.zteits.clouds.api.dto.pay.TdBOrderDTO; | |
58 | +import com.zteits.clouds.api.dto.pay.param.QueryTodayOrderRequest; | |
59 | +import com.zteits.clouds.api.service.park.ParkFreeBerthService; | |
60 | +import com.zteits.clouds.api.service.park.ParkingLotQueryService; | |
54 | 61 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; |
62 | +import com.zteits.clouds.api.service.pay.TdBOrderService; | |
55 | 63 | import com.zteits.irain.portal.constant.ParkConstant; |
64 | +import com.zteits.irain.portal.vo.govclouds.ParkLotStatisticVO; | |
56 | 65 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; |
57 | 66 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; |
67 | +import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.ParkStaticsticAndTodayAmountVO; | |
58 | 68 | |
59 | 69 | import io.swagger.annotations.Api; |
60 | 70 | import io.swagger.annotations.ApiOperation; |
61 | 71 | |
62 | 72 | /** |
63 | - * @author hxz | |
64 | - * | |
73 | + * | |
74 | + * | |
75 | + * Copyright: Copyright (c) 2017 zteits | |
76 | + * | |
77 | + * @ClassName: BerthsStatisticController.java | |
78 | + * @Description: | |
79 | + * @version: v1.0.0 | |
80 | + * @author: langlw | |
81 | + * @date: 2017年8月18日 下午5:45:21 | |
82 | + * Modification History: | |
83 | + * Date Author Version Description | |
84 | + *---------------------------------------------------------* | |
85 | + * 2017年8月18日 langlw v1.0.0 创建 | |
65 | 86 | */ |
66 | 87 | @Api("停车场云平台 数据统计 车位使用管理") |
67 | 88 | @Controller |
... | ... | @@ -72,6 +93,15 @@ public class BerthsStatisticController extends BizController { |
72 | 93 | private String sysCode; |
73 | 94 | @Autowired |
74 | 95 | private ParkingLotUseStatisticService parkingLotStatisticService; |
96 | + @Autowired | |
97 | + private SessionCommUtil sessionCommUtil; | |
98 | + @Autowired | |
99 | + private TdBOrderService tdBOrderService; | |
100 | + @Autowired | |
101 | + private ParkFreeBerthService parkFreeBerthService; | |
102 | + @Autowired | |
103 | + private ParkingLotQueryService parkingLotQueryService; | |
104 | + | |
75 | 105 | |
76 | 106 | /** |
77 | 107 | * |
... | ... | @@ -434,5 +464,54 @@ public class BerthsStatisticController extends BizController { |
434 | 464 | freeBerthRatios.setSeries(series); |
435 | 465 | return freeBerthRatios; |
436 | 466 | } |
467 | + | |
468 | + | |
469 | + | |
470 | + @ApiOperation("获取停车场信息统计和今日收益") | |
471 | + @PostMapping("getParkStaticsticAndTodayAmount") | |
472 | + public BizResultVO<List<ParkStaticsticAndTodayAmountVO>> getParkStaticsticAndTodayAmount(@RequestBody QueryTodayOrderRequest request) throws Exception{ | |
473 | + // 1.调用接口查询当前登录人管辖的停车场名称 | |
474 | + UserInfo userInfo = sessionCommUtil.getUserInfo(); | |
475 | + List<String> plNos=Lists.newArrayList(); | |
476 | + if(null != userInfo){ | |
477 | + plNos= userInfo.getOrgIds(); | |
478 | + } | |
479 | + //今日收益 | |
480 | + List<ParkStaticsticAndTodayAmountVO> listVO= new ArrayList<ParkStaticsticAndTodayAmountVO>(); | |
481 | + BizResult<Map<String, BigDecimal>> result = tdBOrderService.queryTodayAmountSumByPlno(request); | |
482 | + Map<String, BigDecimal> mapAmount=ResultUtils.getBizResultData(result); | |
483 | + //空闲车位数 | |
484 | + ParkFreeBerthGetByPlnoRequest parkFreeBerthGetByPlnoRequest = new ParkFreeBerthGetByPlnoRequest(); | |
485 | + request.setPlNos(plNos); | |
486 | + request.setSysCode(sysCode); | |
487 | + BizResult<Map<String, Integer>> freeBerthsNumBizResult = parkFreeBerthService.getParkFreeBerthByPlno(parkFreeBerthGetByPlnoRequest); | |
488 | + Map<String, Integer> freeBerthsNumMap = ResultUtils.getBizResultData(freeBerthsNumBizResult); | |
489 | + for (String plNo : plNos) { | |
490 | + //先查询缓存 | |
491 | + ParkingLotDTO lotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo); | |
492 | + if(lotDTO == null){ | |
493 | + //查询数据库 | |
494 | + QueryParkLotInfoByPkNoRequest request1 = new QueryParkLotInfoByPkNoRequest(); | |
495 | + request1.setSysCode(sysCode); | |
496 | + request1.setPklNo(plNo); | |
497 | + BizResult<ParkingLotDTO> bizResult2 = parkingLotQueryService.QueryParkingLotByPkNo(request1); | |
498 | + lotDTO = ResultUtils.getBizResultData(bizResult2); | |
499 | + } | |
500 | + if(lotDTO == null || StringUtils.isBlank(lotDTO.getPlName()) || lotDTO.getPlName().equals("null")){ | |
501 | + continue; | |
502 | + } | |
503 | + ParkStaticsticAndTodayAmountVO VO=new ParkStaticsticAndTodayAmountVO(); | |
504 | + VO.setParkId(plNo); | |
505 | + VO.setParkName(lotDTO.getPlName()); | |
506 | + VO.setTotalBerthsNum(lotDTO.getPlBerthNum()); | |
507 | + VO.setUseingBerthsNum(lotDTO.getPlBerthNum()-freeBerthsNumMap.get(plNo)); | |
508 | + VO.setOrderTotalFee(mapAmount.get(plNo)); | |
509 | + listVO.add(VO); | |
510 | + } | |
511 | + return new BizResultVO<List<ParkStaticsticAndTodayAmountVO>>().setData(listVO); | |
512 | + } | |
513 | + | |
514 | + | |
515 | + | |
437 | 516 | |
438 | 517 | } | ... | ... |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java
... | ... | @@ -116,7 +116,10 @@ public class ParkLotStatisticController { |
116 | 116 | plNos.add("B1504020C7");*/ |
117 | 117 | // 2.调用接口查询当前登录人管辖的停车场名称 |
118 | 118 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
119 | - List<String> plNos = userInfo.getOrgIds(); | |
119 | + List<String> plNos=Lists.newArrayList(); | |
120 | + if(null != userInfo){ | |
121 | + plNos= userInfo.getOrgIds(); | |
122 | + } | |
120 | 123 | // if(userInfo!=null){ |
121 | 124 | // TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); |
122 | 125 | // tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ... | ... |