Commit a4f3442db65f24917d181e99564e1dbad2bd0cb3
Merge branch 'branch_0808' of
http://192.168.1.195:9998/ZTEITS-Developers/zteits-bcp-portal.git into branch_0808 Conflicts: src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BillManageController.java
Showing
12 changed files
with
1038 additions
and
707 deletions
src/main/java/com/zteits/irain/portal/vo/parkinglotcloudplatform/datastatistic/ParkLotEqpTypeCountVO.java
0 → 100644
1 | +package com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic; | ||
2 | + | ||
3 | +/** | ||
4 | + * 通过停车场编号统计设备类型数量 | ||
5 | + * | ||
6 | + * Copyright: Copyright (c) 2017 zteits | ||
7 | + * | ||
8 | + * @ClassName: ParkLotEqpTypeCountVO.java | ||
9 | + * @Description: | ||
10 | + * @version: v1.0.0 | ||
11 | + * @author: wangfei | ||
12 | + * @date: 2017年8月18日 下午2:31:24 | ||
13 | + * Modification History: | ||
14 | + * Date Author Version Description | ||
15 | + *---------------------------------------------------------* | ||
16 | + * 2017年6月29日 wangfei v1.0.0 创建 | ||
17 | + */ | ||
18 | +public class ParkLotEqpTypeCountVO { | ||
19 | + | ||
20 | + | ||
21 | + /**设备类型:1-地磁*/ | ||
22 | + private Integer eqpType; | ||
23 | + /**设备状态:1-未安装,2-使用中,3-损坏*/ | ||
24 | + private Integer eqpState; | ||
25 | + /**个数*/ | ||
26 | + private Integer eqpNum; | ||
27 | + | ||
28 | + public Integer getEqpState() { | ||
29 | + return eqpState; | ||
30 | + } | ||
31 | + public void setEqpState(Integer eqpState) { | ||
32 | + this.eqpState = eqpState; | ||
33 | + } | ||
34 | + | ||
35 | + public Integer getEqpType() { | ||
36 | + return eqpType; | ||
37 | + } | ||
38 | + public void setEqpType(Integer eqpType) { | ||
39 | + this.eqpType = eqpType; | ||
40 | + } | ||
41 | + public Integer getEqpNum() { | ||
42 | + return eqpNum; | ||
43 | + } | ||
44 | + public void setEqpNum(Integer eqpNum) { | ||
45 | + this.eqpNum = eqpNum; | ||
46 | + } | ||
47 | + | ||
48 | +} |
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/ebochong/receive/EBoChongReceiveController.java
@@ -2,6 +2,7 @@ package com.zteits.irain.portal.web.ebochong.receive; | @@ -2,6 +2,7 @@ package com.zteits.irain.portal.web.ebochong.receive; | ||
2 | 2 | ||
3 | import java.io.BufferedReader; | 3 | import java.io.BufferedReader; |
4 | import java.io.IOException; | 4 | import java.io.IOException; |
5 | +import java.math.BigDecimal; | ||
5 | 6 | ||
6 | import javax.servlet.http.HttpServletRequest; | 7 | import javax.servlet.http.HttpServletRequest; |
7 | import javax.servlet.http.HttpServletResponse; | 8 | import javax.servlet.http.HttpServletResponse; |
@@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject; | @@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject; | ||
10 | 11 | ||
11 | import com.clouds.common.utils.EBoChongAESUtil; | 12 | import com.clouds.common.utils.EBoChongAESUtil; |
12 | import com.clouds.common.utils.ResultUtils; | 13 | import com.clouds.common.utils.ResultUtils; |
14 | +import com.xiaoleilu.hutool.date.DateUnit; | ||
13 | import com.xiaoleilu.hutool.date.DateUtil; | 15 | import com.xiaoleilu.hutool.date.DateUtil; |
14 | import com.zteits.clouds.api.apibase.bean.BaseInfo; | 16 | import com.zteits.clouds.api.apibase.bean.BaseInfo; |
15 | import com.zteits.clouds.api.apibase.bean.BizResult; | 17 | import com.zteits.clouds.api.apibase.bean.BizResult; |
@@ -23,6 +25,7 @@ import com.zteits.clouds.api.service.park.IInOutParkingService; | @@ -23,6 +25,7 @@ import com.zteits.clouds.api.service.park.IInOutParkingService; | ||
23 | import com.zteits.clouds.api.service.park.InterfaceLogService; | 25 | import com.zteits.clouds.api.service.park.InterfaceLogService; |
24 | import com.zteits.clouds.api.service.park.ParkFreeBerthService; | 26 | import com.zteits.clouds.api.service.park.ParkFreeBerthService; |
25 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; | 27 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; |
28 | +import com.zteits.clouds.api.service.pay.ParkOrderService; | ||
26 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog; | 29 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog; |
27 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog.Type; | 30 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog.Type; |
28 | import com.zteits.irain.portal.vo.ebochong.EBoChongEnum; | 31 | import com.zteits.irain.portal.vo.ebochong.EBoChongEnum; |
@@ -79,6 +82,12 @@ public class EBoChongReceiveController { | @@ -79,6 +82,12 @@ public class EBoChongReceiveController { | ||
79 | @Autowired | 82 | @Autowired |
80 | private InterfaceLogService interfaceLogService; | 83 | private InterfaceLogService interfaceLogService; |
81 | 84 | ||
85 | + /** | ||
86 | + * 停车场订单service | ||
87 | + */ | ||
88 | + @Autowired | ||
89 | + private ParkOrderService parkOrderService; | ||
90 | + | ||
82 | @Value("${ebochong.key}") | 91 | @Value("${ebochong.key}") |
83 | private String key; | 92 | private String key; |
84 | 93 | ||
@@ -145,6 +154,18 @@ public class EBoChongReceiveController { | @@ -145,6 +154,18 @@ public class EBoChongReceiveController { | ||
145 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(inParkingRequest)); | 154 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(inParkingRequest)); |
146 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainInParking(inParkingRequest); | 155 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainInParking(inParkingRequest); |
147 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); | 156 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); |
157 | + | ||
158 | + try { | ||
159 | + logger.info("插入停车订单--begin----"); | ||
160 | + inParkingRequest.setSourceType(3); | ||
161 | + inParkingRequest.setFromType(2); | ||
162 | + BizResult<String> orderResult = parkOrderService.insertParkingOrder(inParkingRequest); | ||
163 | + logger.info("插入停车订单--end----结果=[errorMsg={},orderId={}]", orderResult.getErrMsg(), | ||
164 | + orderResult.getData()); | ||
165 | + } catch (Exception e) { | ||
166 | + logger.info("插入停车订单捕获异常:", e); | ||
167 | + } | ||
168 | + | ||
148 | } else { | 169 | } else { |
149 | logSaveRequest.setType(Type.TYPE_OUT_PARKING); | 170 | logSaveRequest.setType(Type.TYPE_OUT_PARKING); |
150 | //出场 | 171 | //出场 |
@@ -154,6 +175,7 @@ public class EBoChongReceiveController { | @@ -154,6 +175,7 @@ public class EBoChongReceiveController { | ||
154 | outParkingRequest.setFreeBerths(req.getRemaining()); | 175 | outParkingRequest.setFreeBerths(req.getRemaining()); |
155 | outParkingRequest.setFromType(4); | 176 | outParkingRequest.setFromType(4); |
156 | outParkingRequest.setInTime(DateUtil.parse(req.getInTime())); | 177 | outParkingRequest.setInTime(DateUtil.parse(req.getInTime())); |
178 | + outParkingRequest.setOutTime(DateUtil.parse(req.getPassTime())); | ||
157 | outParkingRequest.setParkCode(req.getParkIndex()); | 179 | outParkingRequest.setParkCode(req.getParkIndex()); |
158 | outParkingRequest.setRecordId(req.getUuid()); | 180 | outParkingRequest.setRecordId(req.getUuid()); |
159 | outParkingRequest.setPlNo(req.getParkIndex()); | 181 | outParkingRequest.setPlNo(req.getParkIndex()); |
@@ -162,6 +184,23 @@ public class EBoChongReceiveController { | @@ -162,6 +184,23 @@ public class EBoChongReceiveController { | ||
162 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(outParkingRequest)); | 184 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(outParkingRequest)); |
163 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainOutParking(outParkingRequest); | 185 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainOutParking(outParkingRequest); |
164 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); | 186 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); |
187 | + | ||
188 | + try { | ||
189 | + logger.info("更新停车订单--begin----"); | ||
190 | + outParkingRequest.setSourceType(3); | ||
191 | + outParkingRequest.setFromType(2); | ||
192 | + outParkingRequest.setPayType("1"); | ||
193 | + outParkingRequest.setCalcCharge(new BigDecimal(req.getReceivable())); | ||
194 | + outParkingRequest.setTotalCharge(new BigDecimal(req.getReceivable())); | ||
195 | + outParkingRequest.setParkingDuration( | ||
196 | + DateUtil.between(outParkingRequest.getInTime(), outParkingRequest.getOutTime(), | ||
197 | + DateUnit.SECOND)); | ||
198 | + BizResult<String> orderResult = parkOrderService.updateParkingOrder(outParkingRequest); | ||
199 | + logger.info("更新停车订单--end----结果=[errorMsg={},orderId={}]", orderResult.getErrMsg(), | ||
200 | + orderResult.getData()); | ||
201 | + } catch (Exception e) { | ||
202 | + logger.info("更新停车订单捕获异常:", e); | ||
203 | + } | ||
165 | } | 204 | } |
166 | 205 | ||
167 | HandledVehicleInfoRes res = new HandledVehicleInfoRes(); | 206 | HandledVehicleInfoRes res = new HandledVehicleInfoRes(); |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/BerthsStatisticController.java
1 | -/** | ||
2 | - * | ||
3 | - */ | ||
4 | package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; | 1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; |
5 | 2 | ||
3 | +import java.math.BigDecimal; | ||
6 | import java.sql.Timestamp; | 4 | import java.sql.Timestamp; |
7 | import java.text.SimpleDateFormat; | 5 | import java.text.SimpleDateFormat; |
8 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
@@ -15,6 +13,7 @@ import java.util.Map.Entry; | @@ -15,6 +13,7 @@ import java.util.Map.Entry; | ||
15 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
16 | import javax.servlet.http.HttpServletResponse; | 14 | import javax.servlet.http.HttpServletResponse; |
17 | 15 | ||
16 | +import org.apache.commons.lang3.StringUtils; | ||
18 | import org.apache.poi.xssf.usermodel.XSSFSheet; | 17 | import org.apache.poi.xssf.usermodel.XSSFSheet; |
19 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
20 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
@@ -31,6 +30,7 @@ import org.springframework.web.bind.annotation.ResponseBody; | @@ -31,6 +30,7 @@ import org.springframework.web.bind.annotation.ResponseBody; | ||
31 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 30 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
32 | import com.alibaba.fastjson.JSON; | 31 | import com.alibaba.fastjson.JSON; |
33 | import com.clouds.common.cache.park.ParkingLotCacheUtil; | 32 | import com.clouds.common.cache.park.ParkingLotCacheUtil; |
33 | +import com.clouds.common.entity.UserInfo; | ||
34 | import com.clouds.common.redis.RedisCacheUtil; | 34 | import com.clouds.common.redis.RedisCacheUtil; |
35 | import com.clouds.common.utils.DateUtil; | 35 | import com.clouds.common.utils.DateUtil; |
36 | import com.clouds.common.utils.ResultUtils; | 36 | import com.clouds.common.utils.ResultUtils; |
@@ -38,6 +38,7 @@ import com.clouds.common.utils.excle.ExcelUtil; | @@ -38,6 +38,7 @@ import com.clouds.common.utils.excle.ExcelUtil; | ||
38 | import com.clouds.common.utils.excle.ExcleFillDateManager; | 38 | import com.clouds.common.utils.excle.ExcleFillDateManager; |
39 | import com.clouds.common.utils.excle.Layouter; | 39 | import com.clouds.common.utils.excle.Layouter; |
40 | import com.clouds.common.web.BizController; | 40 | import com.clouds.common.web.BizController; |
41 | +import com.clouds.common.web.SessionCommUtil; | ||
41 | import com.clouds.common.web.vo.BizResultVO; | 42 | import com.clouds.common.web.vo.BizResultVO; |
42 | import com.clouds.common.web.vo.EasyUIDataGridVO; | 43 | import com.clouds.common.web.vo.EasyUIDataGridVO; |
43 | import com.google.common.collect.Lists; | 44 | import com.google.common.collect.Lists; |
@@ -50,18 +51,38 @@ import com.zteits.clouds.api.apibase.exception.BizException; | @@ -50,18 +51,38 @@ import com.zteits.clouds.api.apibase.exception.BizException; | ||
50 | import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; | 51 | import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; |
51 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; | 52 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; |
52 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO; | 53 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO; |
54 | +import com.zteits.clouds.api.dto.park.param.ParkFreeBerthGetByPlnoRequest; | ||
53 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; | 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 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; | 61 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; |
62 | +import com.zteits.clouds.api.service.pay.TdBOrderService; | ||
55 | import com.zteits.irain.portal.constant.ParkConstant; | 63 | import com.zteits.irain.portal.constant.ParkConstant; |
64 | +import com.zteits.irain.portal.vo.govclouds.ParkLotStatisticVO; | ||
56 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; | 65 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; |
57 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; | 66 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; |
67 | +import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.ParkStaticsticAndTodayAmountVO; | ||
58 | 68 | ||
59 | import io.swagger.annotations.Api; | 69 | import io.swagger.annotations.Api; |
60 | import io.swagger.annotations.ApiOperation; | 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 | @Api("停车场云平台 数据统计 车位使用管理") | 87 | @Api("停车场云平台 数据统计 车位使用管理") |
67 | @Controller | 88 | @Controller |
@@ -72,6 +93,15 @@ public class BerthsStatisticController extends BizController { | @@ -72,6 +93,15 @@ public class BerthsStatisticController extends BizController { | ||
72 | private String sysCode; | 93 | private String sysCode; |
73 | @Autowired | 94 | @Autowired |
74 | private ParkingLotUseStatisticService parkingLotStatisticService; | 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 | * |
@@ -113,10 +143,10 @@ public class BerthsStatisticController extends BizController { | @@ -113,10 +143,10 @@ public class BerthsStatisticController extends BizController { | ||
113 | public BizResultVO<EasyUIDataGridVO<ParkingLotUseStatisticDTO>> GetParkingPlaceStatistic( | 143 | public BizResultVO<EasyUIDataGridVO<ParkingLotUseStatisticDTO>> GetParkingPlaceStatistic( |
114 | @RequestBody ParkingLotUseStatisticForPageRequest requestObject) | 144 | @RequestBody ParkingLotUseStatisticForPageRequest requestObject) |
115 | throws InstantiationException, IllegalAccessException { | 145 | throws InstantiationException, IllegalAccessException { |
116 | - if (null == requestObject.getBeginTime() || null==requestObject.getEndTime()) { | ||
117 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
118 | - } | ||
119 | - | 146 | + if (null == requestObject.getBeginTime() || null == requestObject.getEndTime()) { |
147 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
148 | + } | ||
149 | + | ||
120 | Calendar beginc = Calendar.getInstance(); | 150 | Calendar beginc = Calendar.getInstance(); |
121 | beginc.setTime(requestObject.getBeginTime()); | 151 | beginc.setTime(requestObject.getBeginTime()); |
122 | int beginYear = beginc.get(Calendar.YEAR); | 152 | int beginYear = beginc.get(Calendar.YEAR); |
@@ -153,7 +183,7 @@ public class BerthsStatisticController extends BizController { | @@ -153,7 +183,7 @@ public class BerthsStatisticController extends BizController { | ||
153 | plNoslist.add(plNos); | 183 | plNoslist.add(plNos); |
154 | request.setPlNos(plNoslist); | 184 | request.setPlNos(plNoslist); |
155 | request.setBaseRequest(new BaseInfo(1, 0)); | 185 | request.setBaseRequest(new BaseInfo(1, 0)); |
156 | - | 186 | + |
157 | Calendar beginc = Calendar.getInstance(); | 187 | Calendar beginc = Calendar.getInstance(); |
158 | beginc.setTime(request.getBeginTime()); | 188 | beginc.setTime(request.getBeginTime()); |
159 | int beginYear = beginc.get(Calendar.YEAR); | 189 | int beginYear = beginc.get(Calendar.YEAR); |
@@ -194,7 +224,7 @@ public class BerthsStatisticController extends BizController { | @@ -194,7 +224,7 @@ public class BerthsStatisticController extends BizController { | ||
194 | Object[] obj = new Object[title.length]; | 224 | Object[] obj = new Object[title.length]; |
195 | int index = 0; | 225 | int index = 0; |
196 | obj[index++] = format.format(e.getStatisticBeginTime()); | 226 | obj[index++] = format.format(e.getStatisticBeginTime()); |
197 | - obj[index++] = e.getFreeRatio() *100 +"%"; | 227 | + obj[index++] = e.getFreeRatio() * 100 + "%"; |
198 | obj[index++] = e.getTurnoverRatio(); | 228 | obj[index++] = e.getTurnoverRatio(); |
199 | contentList.add(obj); | 229 | contentList.add(obj); |
200 | } | 230 | } |
@@ -215,13 +245,14 @@ public class BerthsStatisticController extends BizController { | @@ -215,13 +245,14 @@ public class BerthsStatisticController extends BizController { | ||
215 | @ResponseBody | 245 | @ResponseBody |
216 | public BizResultVO<LineChartVO> getFreeRatioBerthForLineChart( | 246 | public BizResultVO<LineChartVO> getFreeRatioBerthForLineChart( |
217 | @RequestBody ParkingLotUseStatisticForPageRequest request) { | 247 | @RequestBody ParkingLotUseStatisticForPageRequest request) { |
218 | - //根据权限获取停车场列表 | ||
219 | - if (null == request.getBeginTime() || null==request.getEndTime()) { | ||
220 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
221 | - } | 248 | + // 根据权限获取停车场列表 |
249 | + if (null == request.getBeginTime() || null == request.getEndTime()) { | ||
250 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
251 | + } | ||
222 | logger.info("根据停车场编号获取该停车场车位空置率折线图"); | 252 | logger.info("根据停车场编号获取该停车场车位空置率折线图"); |
223 | Calendar beginTime = Calendar.getInstance(); | 253 | Calendar beginTime = Calendar.getInstance(); |
224 | beginTime.setTime(request.getBeginTime()); | 254 | beginTime.setTime(request.getBeginTime()); |
255 | +// int year = beginTime.get(Calendar.YEAR); | ||
225 | 256 | ||
226 | Calendar endTime = Calendar.getInstance(); | 257 | Calendar endTime = Calendar.getInstance(); |
227 | endTime.setTime(request.getEndTime()); | 258 | endTime.setTime(request.getEndTime()); |
@@ -229,58 +260,62 @@ public class BerthsStatisticController extends BizController { | @@ -229,58 +260,62 @@ public class BerthsStatisticController extends BizController { | ||
229 | Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), | 260 | Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), |
230 | new Timestamp(request.getBeginTime().getTime())); | 261 | new Timestamp(request.getBeginTime().getTime())); |
231 | List<String> xAxisData = Lists.newArrayList(); | 262 | List<String> xAxisData = Lists.newArrayList(); |
232 | - String dateType=""; | ||
233 | - int berthRatio=ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE; | 263 | + String dateType = ""; |
264 | + int berthRatio = ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE; | ||
265 | + request.setBaseRequest(new BaseInfo(1, 0)); | ||
234 | if (dayDifference == 0L) { | 266 | if (dayDifference == 0L) { |
235 | // 1个小时为一个时间戳 | 267 | // 1个小时为一个时间戳 |
236 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | 268 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); |
237 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | 269 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); |
238 | - for (int i = 0; i <= totaltimestampCount; i++) { | ||
239 | - String hour = String.format("%02d", i); | ||
240 | - xAxisData.add(hour + ":" + "00"); | ||
241 | - } | ||
242 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
243 | - dateType="HH:mm"; | ||
244 | - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio); | ||
245 | - return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | ||
246 | - } else if (dayDifference <= 3L) { | ||
247 | - // 1小时为一个时间戳 | ||
248 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
249 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | ||
250 | - String day = ""; | ||
251 | - String month = ""; | ||
252 | - for (int i = 0; i < dayDifference.intValue(); i++) { | ||
253 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
254 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
255 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | ||
256 | - month = String.format("%02d", (beginMonth)); | ||
257 | - day = String.format("%02d", (beginDay)); | ||
258 | - for (int j = 0; j < totaltimestampCount; j++) { | ||
259 | - String hour = String.format("%02d", (j)); | ||
260 | - xAxisData.add(month + "-" + day + " " + hour); | ||
261 | - } | 270 | + for (int j = 0; j <= totaltimestampCount+1; j++) { |
271 | + String hour = String.format("%02d", (j)); | ||
272 | + xAxisData.add(hour+":00"); | ||
262 | } | 273 | } |
263 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
264 | - dateType="MM-dd HH"; | ||
265 | - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio); | 274 | + dateType = "HH:mm"; |
275 | + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | ||
266 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | 276 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); |
267 | - } else { | 277 | + } |
278 | +// else if (dayDifference <= 3L) { | ||
279 | +// // 1小时为一个时间戳 | ||
280 | +// request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
281 | +// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | ||
282 | +// String day = ""; | ||
283 | +// String month = ""; | ||
284 | +// for (int i = 0; i <= dayDifference.intValue(); i++) { | ||
285 | +// Calendar tempDate = Calendar.getInstance(); | ||
286 | +// tempDate.setTime(request.getBeginTime()); | ||
287 | +// tempDate.add(Calendar.DAY_OF_MONTH, i); | ||
288 | +// int beginMonth = tempDate.get(Calendar.MONTH) + 1; | ||
289 | +// int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | ||
290 | +// month = String.format("%02d", (beginMonth)); | ||
291 | +// day = String.format("%02d", (beginDay)); | ||
292 | +// for (int j = 0; j <= totaltimestampCount; j++) { | ||
293 | +// String hour = String.format("%02d", (j)); | ||
294 | +// xAxisData.add(year + "-" + month + "-" + day + " " + hour); | ||
295 | +// } | ||
296 | +// } | ||
297 | +// dateType = "yyyy-MM-dd HH"; | ||
298 | +// LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | ||
299 | +// return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | ||
300 | +// } | ||
301 | + else { | ||
268 | // 1天为一个时间戳 | 302 | // 1天为一个时间戳 |
269 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | 303 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); |
270 | - for (int i = 0; i < dayDifference.intValue(); i++) { | ||
271 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
272 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
273 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | 304 | + for (int i = 0; i <= dayDifference.intValue(); i++) { |
305 | + Calendar tempDate = Calendar.getInstance(); | ||
306 | + tempDate.setTime(request.getBeginTime()); | ||
307 | + tempDate.add(Calendar.DAY_OF_MONTH, i); | ||
308 | + int beginMonth = tempDate.get(Calendar.MONTH) + 1; | ||
309 | + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | ||
274 | String month = String.format("%02d", (beginMonth)); | 310 | String month = String.format("%02d", (beginMonth)); |
275 | String day = String.format("%02d", (beginDay)); | 311 | String day = String.format("%02d", (beginDay)); |
276 | xAxisData.add(month + "-" + day); | 312 | xAxisData.add(month + "-" + day); |
277 | } | 313 | } |
278 | - } | ||
279 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
280 | - dateType="MM-dd"; | ||
281 | - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio); | ||
282 | - return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | 314 | + dateType = "MM-dd"; |
315 | + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | ||
316 | + return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | ||
283 | 317 | ||
318 | + } | ||
284 | } | 319 | } |
285 | 320 | ||
286 | /** | 321 | /** |
@@ -296,10 +331,11 @@ public class BerthsStatisticController extends BizController { | @@ -296,10 +331,11 @@ public class BerthsStatisticController extends BizController { | ||
296 | @RequestBody ParkingLotUseStatisticForPageRequest request) { | 331 | @RequestBody ParkingLotUseStatisticForPageRequest request) { |
297 | 332 | ||
298 | logger.info("根据停车场编号获取该停车场车位周转率折线图"); | 333 | logger.info("根据停车场编号获取该停车场车位周转率折线图"); |
299 | - if (null == request.getBeginTime() || null==request.getEndTime()) { | ||
300 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
301 | - } | 334 | + if (null == request.getBeginTime() || null == request.getEndTime()) { |
335 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
336 | + } | ||
302 | Calendar beginTime = Calendar.getInstance(); | 337 | Calendar beginTime = Calendar.getInstance(); |
338 | +// int year = beginTime.get(Calendar.YEAR); | ||
303 | beginTime.setTime(request.getBeginTime()); | 339 | beginTime.setTime(request.getBeginTime()); |
304 | 340 | ||
305 | Calendar endTime = Calendar.getInstance(); | 341 | Calendar endTime = Calendar.getInstance(); |
@@ -308,64 +344,43 @@ public class BerthsStatisticController extends BizController { | @@ -308,64 +344,43 @@ public class BerthsStatisticController extends BizController { | ||
308 | Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), | 344 | Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), |
309 | new Timestamp(request.getBeginTime().getTime())); | 345 | new Timestamp(request.getBeginTime().getTime())); |
310 | List<String> xAxisData = Lists.newArrayList(); | 346 | List<String> xAxisData = Lists.newArrayList(); |
311 | - String dateType=""; | ||
312 | - int berthRatio=ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER; | 347 | + String dateType = ""; |
348 | + request.setBaseRequest(new BaseInfo(1, 0)); | ||
349 | + int berthRatio = ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER; | ||
313 | if (dayDifference == 0L) { | 350 | if (dayDifference == 0L) { |
314 | - //1个小时为一个时间戳 | 351 | + // 1个小时为一个时间戳 |
315 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | 352 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); |
316 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | 353 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); |
317 | - for (int j = 0; j <= totaltimestampCount; j++) { | 354 | + for (int j = 0; j <= totaltimestampCount+1; j++) { |
318 | String hour = String.format("%02d", (j)); | 355 | String hour = String.format("%02d", (j)); |
319 | - xAxisData.add(hour + ":" + "00"); | ||
320 | - } | ||
321 | - | ||
322 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
323 | - dateType="HH:mm"; | ||
324 | - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio); | ||
325 | - return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | ||
326 | - } else if (dayDifference <= 3L) { | ||
327 | - // 1小时为一个时间戳 | ||
328 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
329 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | ||
330 | - String day = ""; | ||
331 | - String month = ""; | ||
332 | - for (int i = 0; i < dayDifference.intValue(); i++) { | ||
333 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
334 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
335 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | ||
336 | - month = String.format("%02d", (beginMonth)); | ||
337 | - day = String.format("%02d", (beginDay)); | ||
338 | - for (int j = 0; j < totaltimestampCount; j++) { | ||
339 | - String hour = String.format("%02d", (j)); | ||
340 | - xAxisData.add(month + "-" + day + " " + hour); | ||
341 | - } | 356 | + xAxisData.add(hour+":00"); |
342 | } | 357 | } |
343 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
344 | - dateType="MM-dd HH"; | ||
345 | - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio); | 358 | + dateType = "HH:mm"; |
359 | + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | ||
346 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | 360 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); |
347 | - } else { | 361 | + }else { |
348 | // 1天为一个时间戳 | 362 | // 1天为一个时间戳 |
349 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | 363 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); |
350 | - for (int i = 0; i < dayDifference.intValue(); i++) { | ||
351 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
352 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
353 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | 364 | + for (int i = 0; i <= dayDifference.intValue(); i++) { |
365 | + Calendar tempDate = Calendar.getInstance(); | ||
366 | + tempDate.setTime(request.getBeginTime()); | ||
367 | + tempDate.add(Calendar.DAY_OF_MONTH, i); | ||
368 | + int beginMonth = tempDate.get(Calendar.MONTH) + 1; | ||
369 | + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | ||
354 | String month = String.format("%02d", (beginMonth)); | 370 | String month = String.format("%02d", (beginMonth)); |
355 | String day = String.format("%02d", (beginDay)); | 371 | String day = String.format("%02d", (beginDay)); |
356 | xAxisData.add(month + "-" + day); | 372 | xAxisData.add(month + "-" + day); |
373 | + | ||
357 | } | 374 | } |
358 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
359 | - dateType="MM-dd"; | ||
360 | - LineChartVO freeBerthRatios=getFreeBerthRatios(request, xAxisData, dateType,berthRatio); | 375 | + dateType = "MM-dd"; |
376 | + LineChartVO freeBerthRatios = getFreeBerthRatios(request, xAxisData, dateType, berthRatio); | ||
361 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); | 377 | return new BizResultVO<LineChartVO>().setData(freeBerthRatios); |
362 | } | 378 | } |
363 | 379 | ||
364 | } | 380 | } |
365 | - | ||
366 | - | ||
367 | - private LineChartVO getFreeBerthRatios(ParkingLotUseStatisticForPageRequest request, | ||
368 | - List<String> xAxisData,String dateType ,int berthRatio){ | 381 | + |
382 | + private LineChartVO getFreeBerthRatios(ParkingLotUseStatisticForPageRequest request, List<String> xAxisData, | ||
383 | + String dateType, int berthRatio) { | ||
369 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); | 384 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); |
370 | BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | 385 | BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService |
371 | .queryParkingLotUseStatisticForPage(request); | 386 | .queryParkingLotUseStatisticForPage(request); |
@@ -387,33 +402,33 @@ public class BerthsStatisticController extends BizController { | @@ -387,33 +402,33 @@ public class BerthsStatisticController extends BizController { | ||
387 | // 保存空置率 | 402 | // 保存空置率 |
388 | if (!parkLotMap.containsKey(key)) { | 403 | if (!parkLotMap.containsKey(key)) { |
389 | Map<String, Double> timeAndVal = Maps.newHashMap(); | 404 | Map<String, Double> timeAndVal = Maps.newHashMap(); |
390 | - if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio){ | 405 | + if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio) { |
391 | timeAndVal.put(statisBeginTime, statisticDTO.getFreeRatio() * 100); | 406 | timeAndVal.put(statisBeginTime, statisticDTO.getFreeRatio() * 100); |
392 | parkLotMap.put(key, timeAndVal); | 407 | parkLotMap.put(key, timeAndVal); |
393 | - }else if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio){ | 408 | + } else if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio) { |
394 | timeAndVal.put(statisBeginTime, statisticDTO.getTurnoverRatio() * 100); | 409 | timeAndVal.put(statisBeginTime, statisticDTO.getTurnoverRatio() * 100); |
395 | parkLotMap.put(key, timeAndVal); | 410 | parkLotMap.put(key, timeAndVal); |
396 | } | 411 | } |
397 | } else { | 412 | } else { |
398 | - if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio){ | 413 | + if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.FREE == berthRatio) { |
399 | parkLotMap.get(key).put(statisBeginTime, statisticDTO.getFreeRatio() * 100); | 414 | parkLotMap.get(key).put(statisBeginTime, statisticDTO.getFreeRatio() * 100); |
400 | - }else if(ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio){ | 415 | + } else if (ParkConstant.ParkingLotUseStatistic.BerthRatioType.TURNOVER == berthRatio) { |
401 | parkLotMap.get(key).put(statisBeginTime, statisticDTO.getTurnoverRatio() * 100); | 416 | parkLotMap.get(key).put(statisBeginTime, statisticDTO.getTurnoverRatio() * 100); |
402 | } | 417 | } |
403 | } | 418 | } |
404 | 419 | ||
405 | } | 420 | } |
406 | } | 421 | } |
407 | - //判断是否包含所有待查询的停车场信息 | ||
408 | - if(request.getPlNos().size()>parkLotMap.size()){ | ||
409 | - for (String plNo:request.getPlNos()) { | ||
410 | - if(!parkLotMap.containsKey(plNo)){ | ||
411 | - ParkingLotDTO parkingLotDTO=ParkingLotCacheUtil.getParkLotByPlNo(plNo); | ||
412 | - parkNameMap.put(plNo, parkingLotDTO.getPlName()); | ||
413 | - parkLotMap.put(plNo, Maps.newHashMap()); | ||
414 | - } | ||
415 | - } | ||
416 | - } | 422 | + // 判断是否包含所有待查询的停车场信息 |
423 | + if (request.getPlNos().size() > parkLotMap.size()) { | ||
424 | + for (String plNo : request.getPlNos()) { | ||
425 | + if (!parkLotMap.containsKey(plNo)) { | ||
426 | + ParkingLotDTO parkingLotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo); | ||
427 | + parkNameMap.put(plNo, parkingLotDTO.getPlName()); | ||
428 | + parkLotMap.put(plNo, Maps.newHashMap()); | ||
429 | + } | ||
430 | + } | ||
431 | + } | ||
417 | 432 | ||
418 | // 封装车位统计信息 | 433 | // 封装车位统计信息 |
419 | LineChartVO freeBerthRatios = new LineChartVO(); | 434 | LineChartVO freeBerthRatios = new LineChartVO(); |
@@ -437,7 +452,7 @@ public class BerthsStatisticController extends BizController { | @@ -437,7 +452,7 @@ public class BerthsStatisticController extends BizController { | ||
437 | for (String timestamp : xAxisData) { | 452 | for (String timestamp : xAxisData) { |
438 | if (freeRatioMaps.containsKey(timestamp)) { | 453 | if (freeRatioMaps.containsKey(timestamp)) { |
439 | lastFreeRatio = freeRatioMaps.get(timestamp).intValue(); | 454 | lastFreeRatio = freeRatioMaps.get(timestamp).intValue(); |
440 | - }else{ | 455 | + } else { |
441 | lastFreeRatio = 0; | 456 | lastFreeRatio = 0; |
442 | } | 457 | } |
443 | freeRations.add(lastFreeRatio); | 458 | freeRations.add(lastFreeRatio); |
@@ -449,5 +464,53 @@ public class BerthsStatisticController extends BizController { | @@ -449,5 +464,53 @@ public class BerthsStatisticController extends BizController { | ||
449 | freeBerthRatios.setSeries(series); | 464 | freeBerthRatios.setSeries(series); |
450 | return freeBerthRatios; | 465 | return freeBerthRatios; |
451 | } | 466 | } |
467 | + | ||
468 | + | ||
469 | + | ||
470 | + @ApiOperation("获取停车场信息统计和今日收益") | ||
471 | + @PostMapping("getParkStaticsticAndTodayAmount") | ||
472 | + @ResponseBody | ||
473 | + public BizResultVO<List<ParkStaticsticAndTodayAmountVO>> getParkStaticsticAndTodayAmount(@RequestBody QueryTodayOrderRequest request) throws Exception{ | ||
474 | + if(CollectionUtils.isEmpty(request.getPlNos())){ | ||
475 | + throw new BizException(ErrorType.PARAMM_NULL, "入参不能为空!"); | ||
476 | + } | ||
477 | + | ||
478 | + //今日收益 | ||
479 | + List<ParkStaticsticAndTodayAmountVO> listVO= new ArrayList<ParkStaticsticAndTodayAmountVO>(); | ||
480 | + BizResult<Map<String, BigDecimal>> result = tdBOrderService.queryTodayAmountSumByPlno(request); | ||
481 | + Map<String, BigDecimal> mapAmount=ResultUtils.getBizResultData(result); | ||
482 | + //空闲车位数 | ||
483 | + ParkFreeBerthGetByPlnoRequest parkFreeBerthGetByPlnoRequest = new ParkFreeBerthGetByPlnoRequest(); | ||
484 | + parkFreeBerthGetByPlnoRequest.setPlNos(request.getPlNos()); | ||
485 | + parkFreeBerthGetByPlnoRequest.setSysCode(request.getSysCode()); | ||
486 | + BizResult<Map<String, Integer>> freeBerthsNumBizResult = parkFreeBerthService.getParkFreeBerthByPlno(parkFreeBerthGetByPlnoRequest); | ||
487 | + Map<String, Integer> freeBerthsNumMap = ResultUtils.getBizResultData(freeBerthsNumBizResult); | ||
488 | + for (String plNo : request.getPlNos()) { | ||
489 | + //先查询缓存 | ||
490 | + ParkingLotDTO lotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo); | ||
491 | + if(lotDTO == null){ | ||
492 | + //查询数据库 | ||
493 | + QueryParkLotInfoByPkNoRequest request1 = new QueryParkLotInfoByPkNoRequest(); | ||
494 | + request1.setSysCode(request.getSysCode()); | ||
495 | + request1.setPklNo(plNo); | ||
496 | + BizResult<ParkingLotDTO> bizResult2 = parkingLotQueryService.QueryParkingLotByPkNo(request1); | ||
497 | + lotDTO = ResultUtils.getBizResultData(bizResult2); | ||
498 | + } | ||
499 | + if(lotDTO == null || StringUtils.isBlank(lotDTO.getPlName()) || lotDTO.getPlName().equals("null")){ | ||
500 | + continue; | ||
501 | + } | ||
502 | + ParkStaticsticAndTodayAmountVO VO=new ParkStaticsticAndTodayAmountVO(); | ||
503 | + VO.setParkId(plNo); | ||
504 | + VO.setParkName(lotDTO.getPlName()); | ||
505 | + VO.setTotalBerthsNum(lotDTO.getPlBerthNum()); | ||
506 | + VO.setUseingBerthsNum(lotDTO.getPlBerthNum()-freeBerthsNumMap.get(plNo)); | ||
507 | + VO.setOrderTotalFee(mapAmount.get(plNo)); | ||
508 | + listVO.add(VO); | ||
509 | + } | ||
510 | + return new BizResultVO<List<ParkStaticsticAndTodayAmountVO>>().setData(listVO); | ||
511 | + } | ||
512 | + | ||
513 | + | ||
514 | + | ||
452 | 515 | ||
453 | } | 516 | } |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/InOutParkStatisticController.java
@@ -10,14 +10,12 @@ import java.util.Map; | @@ -10,14 +10,12 @@ import java.util.Map; | ||
10 | 10 | ||
11 | import javax.servlet.http.HttpServletRequest; | 11 | import javax.servlet.http.HttpServletRequest; |
12 | import javax.servlet.http.HttpServletResponse; | 12 | import javax.servlet.http.HttpServletResponse; |
13 | -import javax.servlet.http.HttpSession; | ||
14 | 13 | ||
15 | import org.apache.poi.xssf.usermodel.XSSFSheet; | 14 | import org.apache.poi.xssf.usermodel.XSSFSheet; |
16 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
17 | import org.slf4j.LoggerFactory; | 16 | import org.slf4j.LoggerFactory; |
18 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
19 | import org.springframework.beans.factory.annotation.Value; | 18 | import org.springframework.beans.factory.annotation.Value; |
20 | -import org.springframework.security.config.authentication.UserServiceBeanDefinitionParser; | ||
21 | import org.springframework.stereotype.Controller; | 19 | import org.springframework.stereotype.Controller; |
22 | import org.springframework.web.bind.annotation.GetMapping; | 20 | import org.springframework.web.bind.annotation.GetMapping; |
23 | import org.springframework.web.bind.annotation.PostMapping; | 21 | import org.springframework.web.bind.annotation.PostMapping; |
@@ -25,20 +23,15 @@ import org.springframework.web.bind.annotation.RequestBody; | @@ -25,20 +23,15 @@ import org.springframework.web.bind.annotation.RequestBody; | ||
25 | import org.springframework.web.bind.annotation.RequestMapping; | 23 | import org.springframework.web.bind.annotation.RequestMapping; |
26 | import org.springframework.web.bind.annotation.RequestParam; | 24 | import org.springframework.web.bind.annotation.RequestParam; |
27 | import org.springframework.web.bind.annotation.ResponseBody; | 25 | import org.springframework.web.bind.annotation.ResponseBody; |
28 | -import org.springframework.web.bind.annotation.RestController; | ||
29 | 26 | ||
30 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 27 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
31 | -import com.alibaba.dubbo.common.utils.StringUtils; | ||
32 | import com.alibaba.fastjson.JSON; | 28 | import com.alibaba.fastjson.JSON; |
33 | -import com.clouds.common.entity.UserInfo; | ||
34 | -import com.clouds.common.utils.AmountUtils; | ||
35 | import com.clouds.common.utils.DateUtil; | 29 | import com.clouds.common.utils.DateUtil; |
36 | import com.clouds.common.utils.ResultUtils; | 30 | import com.clouds.common.utils.ResultUtils; |
37 | import com.clouds.common.utils.excle.ExcelUtil; | 31 | import com.clouds.common.utils.excle.ExcelUtil; |
38 | import com.clouds.common.utils.excle.ExcleFillDateManager; | 32 | import com.clouds.common.utils.excle.ExcleFillDateManager; |
39 | import com.clouds.common.utils.excle.Layouter; | 33 | import com.clouds.common.utils.excle.Layouter; |
40 | import com.clouds.common.web.BizController; | 34 | import com.clouds.common.web.BizController; |
41 | -import com.clouds.common.web.SessionCommUtil; | ||
42 | import com.clouds.common.web.vo.BizResultVO; | 35 | import com.clouds.common.web.vo.BizResultVO; |
43 | import com.clouds.common.web.vo.EasyUIDataGridVO; | 36 | import com.clouds.common.web.vo.EasyUIDataGridVO; |
44 | import com.google.common.collect.Lists; | 37 | import com.google.common.collect.Lists; |
@@ -48,16 +41,13 @@ import com.zteits.clouds.api.apibase.bean.BizResult; | @@ -48,16 +41,13 @@ import com.zteits.clouds.api.apibase.bean.BizResult; | ||
48 | import com.zteits.clouds.api.apibase.bean.PageBean; | 41 | import com.zteits.clouds.api.apibase.bean.PageBean; |
49 | import com.zteits.clouds.api.apibase.constants.ErrorType; | 42 | import com.zteits.clouds.api.apibase.constants.ErrorType; |
50 | import com.zteits.clouds.api.apibase.exception.BizException; | 43 | import com.zteits.clouds.api.apibase.exception.BizException; |
51 | -import com.zteits.clouds.api.dto.clouds.dto.BillManageDTO; | ||
52 | import com.zteits.clouds.api.dto.park.dto.InOutParkDTO; | 44 | import com.zteits.clouds.api.dto.park.dto.InOutParkDTO; |
53 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; | 45 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; |
54 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticSumDTO; | 46 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticSumDTO; |
55 | import com.zteits.clouds.api.dto.park.param.InOutParkRequest; | 47 | import com.zteits.clouds.api.dto.park.param.InOutParkRequest; |
56 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; | 48 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; |
57 | -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; | ||
58 | import com.zteits.clouds.api.service.clouds.InOutParkStatisticService; | 49 | import com.zteits.clouds.api.service.clouds.InOutParkStatisticService; |
59 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; | 50 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; |
60 | -import com.zteits.clouds.api.service.pay.TdCustCompanyService; | ||
61 | import com.zteits.irain.portal.constant.ParkConstant; | 51 | import com.zteits.irain.portal.constant.ParkConstant; |
62 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; | 52 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; |
63 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; | 53 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; |
@@ -68,17 +58,15 @@ import io.swagger.annotations.ApiOperation; | @@ -68,17 +58,15 @@ import io.swagger.annotations.ApiOperation; | ||
68 | /** | 58 | /** |
69 | * 企业云平台->数据统计->进出场上报。 | 59 | * 企业云平台->数据统计->进出场上报。 |
70 | * | 60 | * |
71 | - * Copyright: Copyright (c) 2017 zteits | 61 | + * Copyright: Copyright (c) 2017 zteits |
72 | * | 62 | * |
73 | * @ClassName: InOutParkStatisticController.java | 63 | * @ClassName: InOutParkStatisticController.java |
74 | - * @Description: | 64 | + * @Description: |
75 | * @version: v1.0.0 | 65 | * @version: v1.0.0 |
76 | * @author: langlw | 66 | * @author: langlw |
77 | - * @date: 2017年7月26日 上午11:30:04 | ||
78 | - * Modification History: | ||
79 | - * Date Author Version Description | ||
80 | - *---------------------------------------------------------* | ||
81 | - * 2017年7月26日 langlw v1.0.0 创建 | 67 | + * @date: 2017年7月26日 上午11:30:04 Modification History: Date Author Version |
68 | + * Description ---------------------------------------------------------* | ||
69 | + * 2017年7月26日 langlw v1.0.0 创建 | ||
82 | */ | 70 | */ |
83 | @Api(value = "企业云平台->数据统计->进出场上报数据统计", description = "企业云平台->数据统计->进出场上报数据统计") | 71 | @Api(value = "企业云平台->数据统计->进出场上报数据统计", description = "企业云平台->数据统计->进出场上报数据统计") |
84 | @Controller | 72 | @Controller |
@@ -92,31 +80,29 @@ public class InOutParkStatisticController extends BizController { | @@ -92,31 +80,29 @@ public class InOutParkStatisticController extends BizController { | ||
92 | private ParkingLotUseStatisticService parkingLotStatisticService; | 80 | private ParkingLotUseStatisticService parkingLotStatisticService; |
93 | @Autowired | 81 | @Autowired |
94 | private InOutParkStatisticService inOutParkStatisticService; | 82 | private InOutParkStatisticService inOutParkStatisticService; |
95 | - | ||
96 | - | 83 | + |
97 | @ApiOperation("数据统计进出场上报") | 84 | @ApiOperation("数据统计进出场上报") |
98 | @PostMapping("queryInOutParkForList") | 85 | @PostMapping("queryInOutParkForList") |
99 | @ResponseBody | 86 | @ResponseBody |
100 | - public BizResultVO<EasyUIDataGridVO<InOutParkDTO>> queryInOutParkForList( | ||
101 | - @RequestBody InOutParkRequest request) throws Exception { | 87 | + public BizResultVO<EasyUIDataGridVO<InOutParkDTO>> queryInOutParkForList(@RequestBody InOutParkRequest request) |
88 | + throws Exception { | ||
102 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); | 89 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); |
103 | - if (null == request.getBeginTime() || null==request.getEndTime()) { | ||
104 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
105 | - } | 90 | + if (null == request.getBeginTime() || null == request.getEndTime()) { |
91 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
92 | + } | ||
106 | BizResult<PageBean<InOutParkDTO>> bizResult = inOutParkStatisticService.queryInOutParkForList(request); | 93 | BizResult<PageBean<InOutParkDTO>> bizResult = inOutParkStatisticService.queryInOutParkForList(request); |
107 | return returnJqGridData(bizResult, InOutParkDTO.class); | 94 | return returnJqGridData(bizResult, InOutParkDTO.class); |
108 | } | 95 | } |
109 | - | 96 | + |
110 | @ApiOperation("数据统计进出场上报折线图") | 97 | @ApiOperation("数据统计进出场上报折线图") |
111 | @PostMapping("queryInOutParkForChart") | 98 | @PostMapping("queryInOutParkForChart") |
112 | @ResponseBody | 99 | @ResponseBody |
113 | - public BizResultVO<LineChartVO> queryInOutParkForChart( | ||
114 | - @RequestBody InOutParkRequest request) throws Exception { | ||
115 | - if (null == request.getBeginTime() || null==request.getEndTime() || null == request.getPlNos()) { | ||
116 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间、停车场编号集合"); | ||
117 | - } | ||
118 | - | ||
119 | - ParkingLotUseStatisticForPageRequest UseStatisticRequest=new ParkingLotUseStatisticForPageRequest(); | 100 | + public BizResultVO<LineChartVO> queryInOutParkForChart(@RequestBody InOutParkRequest request) throws Exception { |
101 | + if (null == request.getBeginTime() || null == request.getEndTime() || null == request.getPlNos()) { | ||
102 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间、停车场编号集合"); | ||
103 | + } | ||
104 | + | ||
105 | + ParkingLotUseStatisticForPageRequest UseStatisticRequest = new ParkingLotUseStatisticForPageRequest(); | ||
120 | UseStatisticRequest.setPlNos(request.getPlNos()); | 106 | UseStatisticRequest.setPlNos(request.getPlNos()); |
121 | UseStatisticRequest.setBeginTime(request.getBeginTime()); | 107 | UseStatisticRequest.setBeginTime(request.getBeginTime()); |
122 | UseStatisticRequest.setEndTime(request.getEndTime()); | 108 | UseStatisticRequest.setEndTime(request.getEndTime()); |
@@ -125,6 +111,7 @@ public class InOutParkStatisticController extends BizController { | @@ -125,6 +111,7 @@ public class InOutParkStatisticController extends BizController { | ||
125 | 111 | ||
126 | Calendar beginTime = Calendar.getInstance(); | 112 | Calendar beginTime = Calendar.getInstance(); |
127 | beginTime.setTime(request.getBeginTime()); | 113 | beginTime.setTime(request.getBeginTime()); |
114 | + // int year = beginTime.get(Calendar.YEAR); | ||
128 | 115 | ||
129 | Calendar endTime = Calendar.getInstance(); | 116 | Calendar endTime = Calendar.getInstance(); |
130 | endTime.setTime(request.getEndTime()); | 117 | endTime.setTime(request.getEndTime()); |
@@ -132,78 +119,99 @@ public class InOutParkStatisticController extends BizController { | @@ -132,78 +119,99 @@ public class InOutParkStatisticController extends BizController { | ||
132 | Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), | 119 | Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), |
133 | new Timestamp(request.getBeginTime().getTime())); | 120 | new Timestamp(request.getBeginTime().getTime())); |
134 | List<String> xAxisData = Lists.newArrayList(); | 121 | List<String> xAxisData = Lists.newArrayList(); |
135 | - String dateType=""; | ||
136 | - | ||
137 | - if (dayDifference == 0L) { | ||
138 | - //同一天 | ||
139 | - // 20分钟为一个时间戳 | ||
140 | - UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); | ||
141 | - int totaltimestampCount = (endTime.get(Calendar.HOUR_OF_DAY)-beginTime.get(Calendar.HOUR_OF_DAY))*3; | ||
142 | - for (int i = 0; i < totaltimestampCount; i++) { | ||
143 | - int hour1 = beginTime.get(Calendar.HOUR_OF_DAY)+i/3; | ||
144 | - String hour = String.format("%02d", hour1); | ||
145 | - String minute = String.format("%02d", (i % 3) * 20); | ||
146 | - xAxisData.add(hour + ":" + minute); | ||
147 | - } | ||
148 | - dateType="HH:mm"; | ||
149 | - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | ||
150 | - return new BizResultVO<LineChartVO>().setData(vehicleFlows); | 122 | + String dateType = ""; |
151 | 123 | ||
152 | - } else if (dayDifference <= 3L) { | ||
153 | - // 1小时为一个时间戳 | 124 | + if (dayDifference == 0L) { |
125 | + // 同一天 | ||
126 | + // 1个小时为一个时间戳 | ||
154 | UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | 127 | UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); |
155 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | 128 | int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); |
156 | - String day = ""; | ||
157 | - String month = ""; | ||
158 | - for (int i = 0; i < dayDifference.intValue(); i++) { | ||
159 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
160 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | ||
161 | - month = String.format("%02d", (beginMonth)); | ||
162 | - day = String.format("%02d", (beginDay)); | ||
163 | - int endDay = endTime.get(Calendar.DAY_OF_MONTH); | ||
164 | - if(beginDay != endDay){ | ||
165 | - totaltimestampCount = 24; | ||
166 | - } | ||
167 | - for (int j = 0; j < totaltimestampCount; j++) { | ||
168 | - String hour = String.format("%02d", (j)); | ||
169 | - xAxisData.add(month + "-" + day + " " + hour); | ||
170 | - } | ||
171 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | 129 | + for (int j = 0; j <= totaltimestampCount+1; j++) { |
130 | + String hour = String.format("%02d", (j)); | ||
131 | + xAxisData.add(hour + ":00"); | ||
172 | } | 132 | } |
173 | - dateType="MM-dd HH"; | ||
174 | - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | 133 | + dateType = "HH:mm"; |
134 | + LineChartVO vehicleFlows = getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | ||
175 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); | 135 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); |
176 | 136 | ||
177 | - } else { | 137 | + } |
138 | + // else if (dayDifference <= 3L) { | ||
139 | + // // 1小时为一个时间戳 | ||
140 | + // UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
141 | + // int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | ||
142 | + // String day = ""; | ||
143 | + // String month = ""; | ||
144 | + // for (int i = 0; i <=dayDifference.intValue(); i++) { | ||
145 | + // Calendar tempDate = Calendar.getInstance(); | ||
146 | + // tempDate .setTime(request.getBeginTime()); | ||
147 | + // tempDate.add(Calendar.DAY_OF_MONTH, i); | ||
148 | + // int beginMonth = tempDate.get(Calendar.MONTH) + 1; | ||
149 | + // int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | ||
150 | + // month = String.format("%02d", (beginMonth)); | ||
151 | + // day = String.format("%02d", (beginDay)); | ||
152 | + // for (int j = 0; j < 24; j++) { | ||
153 | + // String hour = String.format("%02d", (j)); | ||
154 | + // xAxisData.add(year + "-" + month + "-" + day + " " + hour); | ||
155 | + // } | ||
156 | + // } | ||
157 | + // dateType = "yyyy-MM-dd HH"; | ||
158 | + // | ||
159 | + // | ||
160 | + //// | ||
161 | + //// int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | ||
162 | + //// String day = ""; | ||
163 | + //// String month = ""; | ||
164 | + //// for (int i = 0; i < dayDifference.intValue(); i++) { | ||
165 | + //// int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
166 | + //// int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | ||
167 | + //// month = String.format("%02d", (beginMonth)); | ||
168 | + //// day = String.format("%02d", (beginDay)); | ||
169 | + //// int endDay = endTime.get(Calendar.DAY_OF_MONTH); | ||
170 | + //// if(beginDay != endDay){ | ||
171 | + //// totaltimestampCount = 24; | ||
172 | + //// } | ||
173 | + //// for (int j = 0; j < totaltimestampCount; j++) { | ||
174 | + //// String hour = String.format("%02d", (j)); | ||
175 | + //// xAxisData.add(month + "-" + day + " " + hour); | ||
176 | + //// } | ||
177 | + //// beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
178 | + //// } | ||
179 | + //// dateType="MM-dd HH"; | ||
180 | + // LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, | ||
181 | + // xAxisData, dateType); | ||
182 | + // return new BizResultVO<LineChartVO>().setData(vehicleFlows); | ||
183 | + // | ||
184 | + // } | ||
185 | + else { | ||
178 | // 1天为一个时间戳 | 186 | // 1天为一个时间戳 |
179 | UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | 187 | UseStatisticRequest.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); |
180 | - for (int i = 0; i < dayDifference.intValue()+1; i++) { | ||
181 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
182 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | 188 | + for (int i = 0; i <= dayDifference.intValue(); i++) { |
189 | + Calendar tempDate = Calendar.getInstance(); | ||
190 | + tempDate.setTime(request.getBeginTime()); | ||
191 | + tempDate.add(Calendar.DAY_OF_MONTH, i); | ||
192 | + int beginMonth = tempDate.get(Calendar.MONTH) + 1; | ||
193 | + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | ||
183 | String month = String.format("%02d", (beginMonth)); | 194 | String month = String.format("%02d", (beginMonth)); |
184 | String day = String.format("%02d", (beginDay)); | 195 | String day = String.format("%02d", (beginDay)); |
185 | xAxisData.add(month + "-" + day); | 196 | xAxisData.add(month + "-" + day); |
186 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
187 | - | ||
188 | } | 197 | } |
189 | - dateType="MM-dd"; | ||
190 | - LineChartVO vehicleFlows=getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | 198 | + dateType = "MM-dd"; |
199 | + LineChartVO vehicleFlows = getVehicleFlows(UseStatisticRequest, xAxisData, dateType); | ||
191 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); | 200 | return new BizResultVO<LineChartVO>().setData(vehicleFlows); |
192 | 201 | ||
193 | } | 202 | } |
194 | } | 203 | } |
195 | 204 | ||
196 | - | ||
197 | /** | 205 | /** |
198 | * 进出场折线图 | 206 | * 进出场折线图 |
207 | + * | ||
199 | * @param request | 208 | * @param request |
200 | * @param xAxisData | 209 | * @param xAxisData |
201 | * @param dateType | 210 | * @param dateType |
202 | - * @return | ||
203 | - * 2017年7月28日 zhaowg | 211 | + * @return 2017年7月28日 zhaowg |
204 | */ | 212 | */ |
205 | - private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, | ||
206 | - List<String> xAxisData,String dateType){ | 213 | + private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, List<String> xAxisData, |
214 | + String dateType) { | ||
207 | // 调用后场服务 | 215 | // 调用后场服务 |
208 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); | 216 | logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); |
209 | BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | 217 | BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService |
@@ -225,9 +233,13 @@ public class InOutParkStatisticController extends BizController { | @@ -225,9 +233,13 @@ public class InOutParkStatisticController extends BizController { | ||
225 | String key = statisticDTO.getPlNo(); | 233 | String key = statisticDTO.getPlNo(); |
226 | parkNameMap.put(key, statisticDTO.getPlName()); | 234 | parkNameMap.put(key, statisticDTO.getPlName()); |
227 | String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType); | 235 | String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType); |
228 | - //保存进场车流量和出场车流量 | ||
229 | - inParkMap.put(statisBeginTime, (inParkMap.get(statisBeginTime)==null?0:inParkMap.get(statisBeginTime))+statisticDTO.getTmpVehicleFlow()); | ||
230 | - outParkMap.put(statisBeginTime, (outParkMap.get(statisBeginTime)==null?0:outParkMap.get(statisBeginTime))+statisticDTO.getOutParkCount()); | 236 | + // 保存进场车流量和出场车流量 |
237 | + inParkMap.put(statisBeginTime, | ||
238 | + (inParkMap.get(statisBeginTime) == null ? 0 : inParkMap.get(statisBeginTime)) | ||
239 | + + statisticDTO.getTmpVehicleFlow()); | ||
240 | + outParkMap.put(statisBeginTime, | ||
241 | + (outParkMap.get(statisBeginTime) == null ? 0 : outParkMap.get(statisBeginTime)) | ||
242 | + + statisticDTO.getOutParkCount()); | ||
231 | } | 243 | } |
232 | } | 244 | } |
233 | 245 | ||
@@ -254,14 +266,14 @@ public class InOutParkStatisticController extends BizController { | @@ -254,14 +266,14 @@ public class InOutParkStatisticController extends BizController { | ||
254 | 266 | ||
255 | if (inParkMap.containsKey(timestamp)) { | 267 | if (inParkMap.containsKey(timestamp)) { |
256 | lastfixFlow = inParkMap.get(timestamp).intValue(); | 268 | lastfixFlow = inParkMap.get(timestamp).intValue(); |
257 | - }else{ | ||
258 | - lastfixFlow =0; | 269 | + } else { |
270 | + lastfixFlow = 0; | ||
259 | } | 271 | } |
260 | inParkSerieVoData.add(lastfixFlow); | 272 | inParkSerieVoData.add(lastfixFlow); |
261 | 273 | ||
262 | if (outParkMap.containsKey(timestamp)) { | 274 | if (outParkMap.containsKey(timestamp)) { |
263 | lasttmpFlow = outParkMap.get(timestamp).intValue(); | 275 | lasttmpFlow = outParkMap.get(timestamp).intValue(); |
264 | - }else{ | 276 | + } else { |
265 | lasttmpFlow = 0; | 277 | lasttmpFlow = 0; |
266 | } | 278 | } |
267 | outParkSerieVoData.add(lasttmpFlow); | 279 | outParkSerieVoData.add(lasttmpFlow); |
@@ -274,14 +286,11 @@ public class InOutParkStatisticController extends BizController { | @@ -274,14 +286,11 @@ public class InOutParkStatisticController extends BizController { | ||
274 | vehicleFlows.setSeries(vehicleSeries); | 286 | vehicleFlows.setSeries(vehicleSeries); |
275 | return vehicleFlows; | 287 | return vehicleFlows; |
276 | } | 288 | } |
277 | - | ||
278 | - | ||
279 | - | 289 | + |
280 | @ApiOperation("导出进出场统计excel") | 290 | @ApiOperation("导出进出场统计excel") |
281 | @GetMapping("exportInOutParkStatisticExcel") | 291 | @GetMapping("exportInOutParkStatisticExcel") |
282 | public void exportInOutParkStatisticExcel(@RequestParam String beginTime, @RequestParam String endTime, | 292 | public void exportInOutParkStatisticExcel(@RequestParam String beginTime, @RequestParam String endTime, |
283 | - @RequestParam List<String> plNos,@RequestParam String parkNames, | ||
284 | - Integer inOutStatus,Integer parkType, | 293 | + @RequestParam List<String> plNos, @RequestParam String parkNames, Integer inOutStatus, Integer parkType, |
285 | HttpServletRequest requests, HttpServletResponse response) throws Exception { | 294 | HttpServletRequest requests, HttpServletResponse response) throws Exception { |
286 | ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest(); | 295 | ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest(); |
287 | request.setSysCode(sysCode); | 296 | request.setSysCode(sysCode); |
@@ -290,9 +299,10 @@ public class InOutParkStatisticController extends BizController { | @@ -290,9 +299,10 @@ public class InOutParkStatisticController extends BizController { | ||
290 | request.setPlNos(plNos); | 299 | request.setPlNos(plNos); |
291 | request.setBaseRequest(new BaseInfo(1, 0)); | 300 | request.setBaseRequest(new BaseInfo(1, 0)); |
292 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); | 301 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); |
293 | - BizResult<ParkingLotUseStatisticSumDTO> bizResultSum = parkingLotStatisticService.QueryInOutParkStatisticSum(request); | ||
294 | - | ||
295 | - InOutParkRequest inOutParkRequest =new InOutParkRequest(); | 302 | + BizResult<ParkingLotUseStatisticSumDTO> bizResultSum = parkingLotStatisticService |
303 | + .QueryInOutParkStatisticSum(request); | ||
304 | + | ||
305 | + InOutParkRequest inOutParkRequest = new InOutParkRequest(); | ||
296 | inOutParkRequest.setBaseRequest(new BaseInfo(1, 0)); | 306 | inOutParkRequest.setBaseRequest(new BaseInfo(1, 0)); |
297 | inOutParkRequest.setSysCode(sysCode); | 307 | inOutParkRequest.setSysCode(sysCode); |
298 | inOutParkRequest.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); | 308 | inOutParkRequest.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); |
@@ -301,22 +311,20 @@ public class InOutParkStatisticController extends BizController { | @@ -301,22 +311,20 @@ public class InOutParkStatisticController extends BizController { | ||
301 | inOutParkRequest.setInOutStatus(inOutStatus); | 311 | inOutParkRequest.setInOutStatus(inOutStatus); |
302 | inOutParkRequest.setParkType(parkType); | 312 | inOutParkRequest.setParkType(parkType); |
303 | BizResult<PageBean<InOutParkDTO>> bizResult = inOutParkStatisticService.queryInOutParkForList(inOutParkRequest); | 313 | BizResult<PageBean<InOutParkDTO>> bizResult = inOutParkStatisticService.queryInOutParkForList(inOutParkRequest); |
304 | - | ||
305 | - | ||
306 | - | 314 | + |
307 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 315 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
308 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | 316 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); |
309 | - String[] title = new String[] { "停车场", "车牌号", "车辆类型", "进出场状态","进场时间","出场时间","停车时长" }; | 317 | + String[] title = new String[] { "停车场", "车牌号", "车辆类型", "进出场状态", "进场时间", "出场时间", "停车时长" }; |
310 | String sheetName = "车辆进出场统计"; | 318 | String sheetName = "车辆进出场统计"; |
311 | String fileName = "车辆进出场统计" + format2.format(new Date()); | 319 | String fileName = "车辆进出场统计" + format2.format(new Date()); |
312 | - | 320 | + |
313 | String[] billTitle = new String[8]; | 321 | String[] billTitle = new String[8]; |
314 | if (bizResultSum != null && bizResultSum.getData() != null) { | 322 | if (bizResultSum != null && bizResultSum.getData() != null) { |
315 | ParkingLotUseStatisticSumDTO dto = bizResultSum.getData(); | 323 | ParkingLotUseStatisticSumDTO dto = bizResultSum.getData(); |
316 | 324 | ||
317 | billTitle[0] = "车辆进出场统计"; | 325 | billTitle[0] = "车辆进出场统计"; |
318 | billTitle[1] = "汇总"; | 326 | billTitle[1] = "汇总"; |
319 | - billTitle[2] = "停车场: " +parkNames; | 327 | + billTitle[2] = "停车场: " + parkNames; |
320 | billTitle[3] = "进场时间: " + beginTime; | 328 | billTitle[3] = "进场时间: " + beginTime; |
321 | billTitle[4] = "出场时间:" + endTime; | 329 | billTitle[4] = "出场时间:" + endTime; |
322 | billTitle[5] = "进场车辆总数: " + (dto.getInParkSum() != null ? dto.getInParkSum() : 0); | 330 | billTitle[5] = "进场车辆总数: " + (dto.getInParkSum() != null ? dto.getInParkSum() : 0); |
@@ -326,16 +334,13 @@ public class InOutParkStatisticController extends BizController { | @@ -326,16 +334,13 @@ public class InOutParkStatisticController extends BizController { | ||
326 | billTitle[0] = "车辆进出场统计"; | 334 | billTitle[0] = "车辆进出场统计"; |
327 | billTitle[1] = "汇总"; | 335 | billTitle[1] = "汇总"; |
328 | billTitle[2] = "停车场:"; | 336 | billTitle[2] = "停车场:"; |
329 | - billTitle[3] = "进场时间:" ; | ||
330 | - billTitle[4] = "出场时间:" ; | 337 | + billTitle[3] = "进场时间:"; |
338 | + billTitle[4] = "出场时间:"; | ||
331 | billTitle[5] = "进场车辆总数:"; | 339 | billTitle[5] = "进场车辆总数:"; |
332 | billTitle[6] = "出场车辆总数:"; | 340 | billTitle[6] = "出场车辆总数:"; |
333 | billTitle[7] = "具体明细"; | 341 | billTitle[7] = "具体明细"; |
334 | } | 342 | } |
335 | - | ||
336 | - | ||
337 | - | ||
338 | - | 343 | + |
339 | // 1.创建excel信息 | 344 | // 1.创建excel信息 |
340 | XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | 345 | XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); |
341 | // 2.设置excel表头和表体 | 346 | // 2.设置excel表头和表体 |
@@ -351,29 +356,29 @@ public class InOutParkStatisticController extends BizController { | @@ -351,29 +356,29 @@ public class InOutParkStatisticController extends BizController { | ||
351 | int index = 0; | 356 | int index = 0; |
352 | obj[index++] = e.getParkName(); | 357 | obj[index++] = e.getParkName(); |
353 | obj[index++] = e.getCarNumber(); | 358 | obj[index++] = e.getCarNumber(); |
354 | - //TODO | ||
355 | - if(null!=e.getParkType()){ | ||
356 | - if(1==e.getParkType()){ | ||
357 | - obj[index++] ="固定停车"; | ||
358 | - }else{ | ||
359 | - obj[index++] ="临时停车"; | 359 | + // TODO |
360 | + if (null != e.getParkType()) { | ||
361 | + if (1 == e.getParkType()) { | ||
362 | + obj[index++] = "固定停车"; | ||
363 | + } else { | ||
364 | + obj[index++] = "临时停车"; | ||
360 | } | 365 | } |
361 | - }else{ | ||
362 | - obj[index++] ="临时停车"; | 366 | + } else { |
367 | + obj[index++] = "临时停车"; | ||
363 | } | 368 | } |
364 | - | ||
365 | - if(null !=e.getInOutState()){ | ||
366 | - if(1==e.getInOutState() || 2==e.getInOutState() || 3==e.getInOutState()){ | ||
367 | - obj[index++] ="在场"; | ||
368 | - }else{ | ||
369 | - obj[index++] ="出场"; | 369 | + |
370 | + if (null != e.getInOutState()) { | ||
371 | + if (1 == e.getInOutState() || 2 == e.getInOutState() || 3 == e.getInOutState()) { | ||
372 | + obj[index++] = "在场"; | ||
373 | + } else { | ||
374 | + obj[index++] = "出场"; | ||
370 | } | 375 | } |
371 | - }else{ | ||
372 | - obj[index++] ="出场"; | 376 | + } else { |
377 | + obj[index++] = "出场"; | ||
373 | } | 378 | } |
374 | obj[index++] = format.format(e.getInTime()); | 379 | obj[index++] = format.format(e.getInTime()); |
375 | - obj[index++] = e.getOutTime() != null? format.format(e.getOutTime()) : ""; | ||
376 | - obj[index++] = e.getParkingDuration() != null? DateUtil.secondToTime(e.getParkingDuration()) : ""; | 380 | + obj[index++] = e.getOutTime() != null ? format.format(e.getOutTime()) : ""; |
381 | + obj[index++] = e.getParkingDuration() != null ? DateUtil.secondToTime(e.getParkingDuration()) : ""; | ||
377 | contentList.add(obj); | 382 | contentList.add(obj); |
378 | } | 383 | } |
379 | ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | 384 | ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); |
@@ -381,5 +386,5 @@ public class InOutParkStatisticController extends BizController { | @@ -381,5 +386,5 @@ public class InOutParkStatisticController extends BizController { | ||
381 | // 4.excel输出配置 | 386 | // 4.excel输出配置 |
382 | ExcelUtil.write(response, workSheet, fileName); | 387 | ExcelUtil.write(response, workSheet, fileName); |
383 | } | 388 | } |
384 | - | 389 | + |
385 | } | 390 | } |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/IndexPageStatisticController.java
@@ -2,26 +2,21 @@ package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; | @@ -2,26 +2,21 @@ package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; | ||
2 | 2 | ||
3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
4 | import java.math.RoundingMode; | 4 | import java.math.RoundingMode; |
5 | +import java.text.DecimalFormat; | ||
5 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
6 | import java.util.Calendar; | 7 | import java.util.Calendar; |
7 | import java.util.Date; | 8 | import java.util.Date; |
9 | +import java.util.HashMap; | ||
8 | import java.util.List; | 10 | import java.util.List; |
9 | import java.util.Map; | 11 | import java.util.Map; |
10 | import java.util.Map.Entry; | 12 | import java.util.Map.Entry; |
11 | 13 | ||
12 | import javax.validation.Valid; | 14 | import javax.validation.Valid; |
13 | 15 | ||
14 | -import org.slf4j.Logger; | ||
15 | -import org.slf4j.LoggerFactory; | ||
16 | -import org.springframework.beans.factory.annotation.Autowired; | ||
17 | -import org.springframework.web.bind.annotation.PostMapping; | ||
18 | -import org.springframework.web.bind.annotation.RequestBody; | ||
19 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
20 | -import org.springframework.web.bind.annotation.RestController; | ||
21 | - | ||
22 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 16 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
23 | import com.alibaba.fastjson.JSON; | 17 | import com.alibaba.fastjson.JSON; |
24 | import com.alibaba.fastjson.JSONObject; | 18 | import com.alibaba.fastjson.JSONObject; |
19 | + | ||
25 | import com.clouds.common.cache.park.ParkingLotCacheUtil; | 20 | import com.clouds.common.cache.park.ParkingLotCacheUtil; |
26 | import com.clouds.common.utils.DateUtil; | 21 | import com.clouds.common.utils.DateUtil; |
27 | import com.clouds.common.utils.ResultUtils; | 22 | import com.clouds.common.utils.ResultUtils; |
@@ -37,12 +32,19 @@ import com.zteits.clouds.api.dto.clouds.dto.CustIncomeTotalDTO; | @@ -37,12 +32,19 @@ import com.zteits.clouds.api.dto.clouds.dto.CustIncomeTotalDTO; | ||
37 | import com.zteits.clouds.api.dto.clouds.dto.CustIncomeTotalParkDTO; | 32 | import com.zteits.clouds.api.dto.clouds.dto.CustIncomeTotalParkDTO; |
38 | import com.zteits.clouds.api.dto.clouds.dto.ParkingCountDTO; | 33 | import com.zteits.clouds.api.dto.clouds.dto.ParkingCountDTO; |
39 | import com.zteits.clouds.api.dto.clouds.param.CustIncomeTotalQueryRequset; | 34 | import com.zteits.clouds.api.dto.clouds.param.CustIncomeTotalQueryRequset; |
35 | +import com.zteits.clouds.api.dto.park.dto.ParkLotEqpTypeCountStatisticByCountryDTO; | ||
40 | import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; | 36 | import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; |
41 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; | 37 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; |
38 | +import com.zteits.clouds.api.dto.park.dto.TodayVehicleFlowOccupyRateAndTurnOverDTO; | ||
39 | +import com.zteits.clouds.api.dto.park.param.CommonPlnosQueryRequest; | ||
40 | +import com.zteits.clouds.api.dto.park.param.EqpTypeQueryByPlNosRequest; | ||
42 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; | 41 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; |
43 | import com.zteits.clouds.api.dto.park.param.RealTimeVehicleFlowQueryRequest; | 42 | import com.zteits.clouds.api.dto.park.param.RealTimeVehicleFlowQueryRequest; |
44 | import com.zteits.clouds.api.service.clouds.CustIncomeService; | 43 | import com.zteits.clouds.api.service.clouds.CustIncomeService; |
45 | import com.zteits.clouds.api.service.park.IInOutParkingService; | 44 | import com.zteits.clouds.api.service.park.IInOutParkingService; |
45 | +import com.zteits.clouds.api.service.park.ParkingLotBerthsService; | ||
46 | +import com.zteits.clouds.api.service.park.ParkingLotEqpService; | ||
47 | +import com.zteits.clouds.api.service.park.ParkingLotQueryService; | ||
46 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; | 48 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; |
47 | import com.zteits.irain.portal.constant.ParkConstant; | 49 | import com.zteits.irain.portal.constant.ParkConstant; |
48 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.BerthsAndFlowLineChartVO; | 50 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.BerthsAndFlowLineChartVO; |
@@ -51,8 +53,17 @@ import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.CustInco | @@ -51,8 +53,17 @@ import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.CustInco | ||
51 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.CustIncomeTotalVO; | 53 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.CustIncomeTotalVO; |
52 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; | 54 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; |
53 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; | 55 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; |
54 | - | 56 | +import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.ParkLotEqpTypeCountVO; |
55 | import io.swagger.annotations.ApiOperation; | 57 | import io.swagger.annotations.ApiOperation; |
58 | +import org.slf4j.Logger; | ||
59 | +import org.slf4j.LoggerFactory; | ||
60 | +import org.springframework.beans.BeanUtils; | ||
61 | +import org.springframework.beans.factory.annotation.Autowired; | ||
62 | +import org.springframework.web.bind.annotation.PostMapping; | ||
63 | +import org.springframework.web.bind.annotation.RequestBody; | ||
64 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
65 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
66 | +import org.springframework.web.bind.annotation.RestController; | ||
56 | 67 | ||
57 | /** | 68 | /** |
58 | * Copyright: Copyright (c) 2017 zteits | 69 | * Copyright: Copyright (c) 2017 zteits |
@@ -82,7 +93,15 @@ public class IndexPageStatisticController extends BizController { | @@ -82,7 +93,15 @@ public class IndexPageStatisticController extends BizController { | ||
82 | private IInOutParkingService iInOutParkingService; | 93 | private IInOutParkingService iInOutParkingService; |
83 | @Autowired | 94 | @Autowired |
84 | private ParkingLotUseStatisticService parkingLotStatisticService; | 95 | private ParkingLotUseStatisticService parkingLotStatisticService; |
85 | - | 96 | + @Autowired |
97 | + private ParkingLotEqpService parkingLotEqpService; | ||
98 | + | ||
99 | + @Autowired | ||
100 | + private ParkingLotQueryService parkingLotQueryService; | ||
101 | + | ||
102 | + @Autowired | ||
103 | + private ParkingLotBerthsService parkingLotBerthsService; | ||
104 | + | ||
86 | /** | 105 | /** |
87 | * 云平台首页->企业客户负责所有的停车场汇总.<br/> | 106 | * 云平台首页->企业客户负责所有的停车场汇总.<br/> |
88 | * | 107 | * |
@@ -143,8 +162,6 @@ public class IndexPageStatisticController extends BizController { | @@ -143,8 +162,6 @@ public class IndexPageStatisticController extends BizController { | ||
143 | BigDecimal escapeAmount = dto.getEscapeAmount(); | 162 | BigDecimal escapeAmount = dto.getEscapeAmount(); |
144 | BigDecimal payedTotalAmount = dto.getPayedTotalAmount(); | 163 | BigDecimal payedTotalAmount = dto.getPayedTotalAmount(); |
145 | 164 | ||
146 | - | ||
147 | - | ||
148 | CustIncomeTotalParkVO vo = new CustIncomeTotalParkVO(); | 165 | CustIncomeTotalParkVO vo = new CustIncomeTotalParkVO(); |
149 | 166 | ||
150 | //金额为分 | 167 | //金额为分 |
@@ -153,13 +170,14 @@ public class IndexPageStatisticController extends BizController { | @@ -153,13 +170,14 @@ public class IndexPageStatisticController extends BizController { | ||
153 | vo.setPayedTotalAmount(payedTotalAmount.setScale(2, BigDecimal.ROUND_HALF_UP).toString()); | 170 | vo.setPayedTotalAmount(payedTotalAmount.setScale(2, BigDecimal.ROUND_HALF_UP).toString()); |
154 | //占比乘以100取两位小数 | 171 | //占比乘以100取两位小数 |
155 | //应收 | 172 | //应收 |
156 | - if (null == amountDueTotal || amountDueTotal.doubleValue()==0) { | 173 | + if (null == amountDueTotal || amountDueTotal.doubleValue() == 0) { |
157 | vo.setLoopData(1, "00.00"); | 174 | vo.setLoopData(1, "00.00"); |
158 | vo.setLoopData(2, "00.00"); | 175 | vo.setLoopData(2, "00.00"); |
159 | 176 | ||
160 | } else { | 177 | } else { |
161 | //实收 | 178 | //实收 |
162 | - vo.setLoopData(1, payedTotalAmount.divide(amountDueTotal, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100.00")) | 179 | + vo.setLoopData(1, payedTotalAmount.divide(amountDueTotal, 4, BigDecimal.ROUND_HALF_UP).multiply( |
180 | + new BigDecimal("100.00")) | ||
163 | .setScale(2, BigDecimal.ROUND_HALF_UP).toString()); | 181 | .setScale(2, BigDecimal.ROUND_HALF_UP).toString()); |
164 | //逃逸 | 182 | //逃逸 |
165 | vo.setLoopData(2, escapeAmount.divide(amountDueTotal, 4, BigDecimal.ROUND_HALF_UP).multiply( | 183 | vo.setLoopData(2, escapeAmount.divide(amountDueTotal, 4, BigDecimal.ROUND_HALF_UP).multiply( |
@@ -189,6 +207,16 @@ public class IndexPageStatisticController extends BizController { | @@ -189,6 +207,16 @@ public class IndexPageStatisticController extends BizController { | ||
189 | return new BizResultVO<List<CustIncomeForPayTypeDTO>>(result); | 207 | return new BizResultVO<List<CustIncomeForPayTypeDTO>>(result); |
190 | } | 208 | } |
191 | 209 | ||
210 | + @ApiOperation("查询今日车流量占用率周转率") | ||
211 | + @PostMapping("/queryTodayVehicleFlowOccupyRateAndTurnOver") | ||
212 | + public BizResultVO<List<TodayVehicleFlowOccupyRateAndTurnOverDTO>> queryTodayVehicleFlowOccupyRateAndTurnOver( | ||
213 | + @RequestBody CommonPlnosQueryRequest request) { | ||
214 | + BizResult<List<TodayVehicleFlowOccupyRateAndTurnOverDTO>> bizResult = parkingLotStatisticService | ||
215 | + .queryTodayVehicleFlowOccupyRateAndTurnOver(request); | ||
216 | + return new BizResultVO<>(bizResult); | ||
217 | + | ||
218 | + } | ||
219 | + | ||
192 | /** | 220 | /** |
193 | * 根据停车场编号,获取该停车场今日车流量(当天0:00到操作时间的车流量) 折线图 | 221 | * 根据停车场编号,获取该停车场今日车流量(当天0:00到操作时间的车流量) 折线图 |
194 | * | 222 | * |
@@ -196,10 +224,11 @@ public class IndexPageStatisticController extends BizController { | @@ -196,10 +224,11 @@ public class IndexPageStatisticController extends BizController { | ||
196 | * @return 2017年6月19日 zhaowg | 224 | * @return 2017年6月19日 zhaowg |
197 | */ | 225 | */ |
198 | @ApiOperation("根据停车场编号获取该停车场今日车流量和车位折线图") | 226 | @ApiOperation("根据停车场编号获取该停车场今日车流量和车位折线图") |
199 | - @PostMapping("getTodayVehicleFlowForLineChart") | 227 | + @PostMapping("/getTodayVehicleFlowForLineChart") |
228 | + @Deprecated | ||
200 | public BizResultVO<BerthsAndFlowLineChartVO> getTodayVehicleFlowForLineChart( | 229 | public BizResultVO<BerthsAndFlowLineChartVO> getTodayVehicleFlowForLineChart( |
201 | @RequestBody @Valid ParkingLotUseStatisticForPageRequest request) { | 230 | @RequestBody @Valid ParkingLotUseStatisticForPageRequest request) { |
202 | - logger.info("根据停车场编号获取该停车场今日车流量和车位折线图"); | 231 | + logger.info("根据停车场编号获取该停车场今日车流量和车位折线图"); |
203 | //开始时间 今日0点开始 | 232 | //开始时间 今日0点开始 |
204 | Calendar beginTime = Calendar.getInstance(); | 233 | Calendar beginTime = Calendar.getInstance(); |
205 | beginTime.set(Calendar.HOUR_OF_DAY, 0); | 234 | beginTime.set(Calendar.HOUR_OF_DAY, 0); |
@@ -236,7 +265,7 @@ public class IndexPageStatisticController extends BizController { | @@ -236,7 +265,7 @@ public class IndexPageStatisticController extends BizController { | ||
236 | //每20分钟统计一次 | 265 | //每20分钟统计一次 |
237 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); | 266 | request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); |
238 | request.setBaseRequest(new BaseInfo(1, 0)); | 267 | request.setBaseRequest(new BaseInfo(1, 0)); |
239 | - logger.info("调用DUBBO服务入参:"+JSON.toJSONString(request)); | 268 | + logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); |
240 | BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | 269 | BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService |
241 | .queryParkingLotUseStatisticForPage(request); | 270 | .queryParkingLotUseStatisticForPage(request); |
242 | PageBean<ParkingLotUseStatisticDTO> pageBean = ResultUtils.getBizResultData(bizResult); | 271 | PageBean<ParkingLotUseStatisticDTO> pageBean = ResultUtils.getBizResultData(bizResult); |
@@ -268,19 +297,21 @@ public class IndexPageStatisticController extends BizController { | @@ -268,19 +297,21 @@ public class IndexPageStatisticController extends BizController { | ||
268 | } | 297 | } |
269 | 298 | ||
270 | //保存固定车流量和临时车流量 | 299 | //保存固定车流量和临时车流量 |
271 | - fixVehicleFlowMap.put(statisBeginTime, (fixVehicleFlowMap.get(statisBeginTime)==null?0:fixVehicleFlowMap.get(statisBeginTime))+statisticDTO.getFixVehicleFlow()); | ||
272 | - tmpVehicleFlowMap.put(statisBeginTime, (tmpVehicleFlowMap.get(statisBeginTime)==null?0:tmpVehicleFlowMap.get(statisBeginTime))+statisticDTO.getTmpVehicleFlow()); | 300 | + fixVehicleFlowMap.put(statisBeginTime, (fixVehicleFlowMap.get(statisBeginTime) == null ? 0 |
301 | + : fixVehicleFlowMap.get(statisBeginTime)) + statisticDTO.getFixVehicleFlow()); | ||
302 | + tmpVehicleFlowMap.put(statisBeginTime, (tmpVehicleFlowMap.get(statisBeginTime) == null ? 0 | ||
303 | + : tmpVehicleFlowMap.get(statisBeginTime)) + statisticDTO.getTmpVehicleFlow()); | ||
304 | + } | ||
305 | + } | ||
306 | + //判断是否包含所有待查询的停车场信息 | ||
307 | + if (request.getPlNos().size() > parkLotMap.size()) { | ||
308 | + for (String plNo : request.getPlNos()) { | ||
309 | + if (!parkLotMap.containsKey(plNo)) { | ||
310 | + ParkingLotDTO parkingLotDTO = ParkingLotCacheUtil.getParkLotByPlNo(plNo); | ||
311 | + parkNameMap.put(plNo, parkingLotDTO.getPlName()); | ||
312 | + parkLotMap.put(plNo, Maps.newHashMap()); | ||
313 | + } | ||
273 | } | 314 | } |
274 | - } | ||
275 | - //判断是否包含所有待查询的停车场信息 | ||
276 | - if(request.getPlNos().size()>parkLotMap.size()){ | ||
277 | - for (String plNo:request.getPlNos()) { | ||
278 | - if(!parkLotMap.containsKey(plNo)){ | ||
279 | - ParkingLotDTO parkingLotDTO=ParkingLotCacheUtil.getParkLotByPlNo(plNo); | ||
280 | - parkNameMap.put(plNo, parkingLotDTO.getPlName()); | ||
281 | - parkLotMap.put(plNo, Maps.newHashMap()); | ||
282 | - } | ||
283 | - } | ||
284 | } | 315 | } |
285 | //封装车位统计信息 | 316 | //封装车位统计信息 |
286 | LineChartVO freeBerthRatios = new LineChartVO(); | 317 | LineChartVO freeBerthRatios = new LineChartVO(); |
@@ -304,8 +335,8 @@ public class IndexPageStatisticController extends BizController { | @@ -304,8 +335,8 @@ public class IndexPageStatisticController extends BizController { | ||
304 | for (String timestamp : xAxisData) { | 335 | for (String timestamp : xAxisData) { |
305 | if (freeRatioMaps.containsKey(timestamp)) { | 336 | if (freeRatioMaps.containsKey(timestamp)) { |
306 | lastFreeRatio = freeRatioMaps.get(timestamp).intValue(); | 337 | lastFreeRatio = freeRatioMaps.get(timestamp).intValue(); |
307 | - }else{ | ||
308 | - lastFreeRatio = 0; | 338 | + } else { |
339 | + lastFreeRatio = 0; | ||
309 | } | 340 | } |
310 | freeRations.add(lastFreeRatio); | 341 | freeRations.add(lastFreeRatio); |
311 | } | 342 | } |
@@ -337,15 +368,15 @@ public class IndexPageStatisticController extends BizController { | @@ -337,15 +368,15 @@ public class IndexPageStatisticController extends BizController { | ||
337 | for (String timestamp : xAxisData) { | 368 | for (String timestamp : xAxisData) { |
338 | if (fixVehicleFlowMap.containsKey(timestamp)) { | 369 | if (fixVehicleFlowMap.containsKey(timestamp)) { |
339 | lastfixFlow = fixVehicleFlowMap.get(timestamp).intValue(); | 370 | lastfixFlow = fixVehicleFlowMap.get(timestamp).intValue(); |
340 | - }else{ | ||
341 | - lastfixFlow = 0; | 371 | + } else { |
372 | + lastfixFlow = 0; | ||
342 | } | 373 | } |
343 | fixSerieVoData.add(lastfixFlow); | 374 | fixSerieVoData.add(lastfixFlow); |
344 | 375 | ||
345 | if (tmpVehicleFlowMap.containsKey(timestamp)) { | 376 | if (tmpVehicleFlowMap.containsKey(timestamp)) { |
346 | lasttmpFlow = tmpVehicleFlowMap.get(timestamp).intValue(); | 377 | lasttmpFlow = tmpVehicleFlowMap.get(timestamp).intValue(); |
347 | - }else{ | ||
348 | - lasttmpFlow = 0; | 378 | + } else { |
379 | + lasttmpFlow = 0; | ||
349 | } | 380 | } |
350 | tmpSerieVoData.add(lasttmpFlow); | 381 | tmpSerieVoData.add(lasttmpFlow); |
351 | } | 382 | } |
@@ -373,6 +404,96 @@ public class IndexPageStatisticController extends BizController { | @@ -373,6 +404,96 @@ public class IndexPageStatisticController extends BizController { | ||
373 | } | 404 | } |
374 | 405 | ||
375 | /** | 406 | /** |
407 | + * 实时统计今日停车次数,停车次数以出场时间进行统计 | ||
408 | + * | ||
409 | + * @return | ||
410 | + */ | ||
411 | + @ApiOperation("实时查询当前停车次数") | ||
412 | + @PostMapping("/realtimeParkingOutNum") | ||
413 | + public BizResultVO<Long> realtimeParkingOutNum(@RequestBody CommonPlnosQueryRequest request) { | ||
414 | + BizResult<Long> bizResult = iInOutParkingService.queryRealTimeOutParkNumOfPlNos(request); | ||
415 | + return new BizResultVO<>(bizResult); | ||
416 | + } | ||
417 | + | ||
418 | + /** | ||
419 | + * 今日实时周转率 | ||
420 | + * | ||
421 | + * @param request | ||
422 | + * @return | ||
423 | + * @desc 今日实时进场次数/总车位数 | ||
424 | + */ | ||
425 | + @ApiOperation("实时查询当前周转率") | ||
426 | + @PostMapping("/realtimeTurnoverRate") | ||
427 | + public BizResultVO<Map<String,Object>> realtimeTurnoverRate(@RequestBody CommonPlnosQueryRequest request) { | ||
428 | + BizResultVO<Map<String,Object>> res = new BizResultVO<>(); | ||
429 | + Map<String,Object> resMap = new HashMap<>(); | ||
430 | + //1、查询截止当前进场停车次数 | ||
431 | + BizResult<Long> bizResult = iInOutParkingService.queryRealTimeInParkNumOfPlNos(request); | ||
432 | + if(ResultUtils.isError(bizResult)){ | ||
433 | + res.setCode(bizResult.getErrCode().getCode()); | ||
434 | + res.setMsg(bizResult.getErrMsg()); | ||
435 | + return res; | ||
436 | + } | ||
437 | + //2、根据停车场编号查询停车场总车位数 | ||
438 | + BizResult<Long> berthResult = parkingLotQueryService.queryBerthNumByPlNos(request); | ||
439 | + if(ResultUtils.isError(berthResult)){ | ||
440 | + res.setCode(berthResult.getErrCode().getCode()); | ||
441 | + res.setMsg(berthResult.getErrMsg()); | ||
442 | + return res; | ||
443 | + } | ||
444 | + | ||
445 | + //停车次数 | ||
446 | + resMap.put("parkNum",bizResult.getData()); | ||
447 | + //总车位数 | ||
448 | + resMap.put("allBerthNum",berthResult.getData()); | ||
449 | + double rate = bizResult.getData() * 1.0 / berthResult.getData() * 100; | ||
450 | + String rateStr = new DecimalFormat("#.00").format(rate); | ||
451 | + resMap.put("rate",rateStr); | ||
452 | + res.setData(resMap); | ||
453 | + return res; | ||
454 | + } | ||
455 | + | ||
456 | + /** | ||
457 | + * 今日实时占用率 | ||
458 | + * | ||
459 | + * @param request | ||
460 | + * @return | ||
461 | + * @desc 1-(今日实时空余车位数/总车位数) | ||
462 | + */ | ||
463 | + @ApiOperation("实时查询当前占用率") | ||
464 | + @PostMapping("/realtimeoccupationRate") | ||
465 | + public BizResultVO<Map<String,Object>> realtimeoccupationRate(@RequestBody CommonPlnosQueryRequest request) { | ||
466 | + BizResultVO<Map<String,Object>> res = new BizResultVO<>(); | ||
467 | + Map<String,Object> resMap = new HashMap<>(); | ||
468 | + | ||
469 | + //1、查询截止当前空余车位数 | ||
470 | + BizResult<Long> bizResult = parkingLotBerthsService.queryAllFreeBerthNum(request); | ||
471 | + if(ResultUtils.isError(bizResult)){ | ||
472 | + res.setCode(bizResult.getErrCode().getCode()); | ||
473 | + res.setMsg(bizResult.getErrMsg()); | ||
474 | + return res; | ||
475 | + } | ||
476 | + //2、根据停车场编号查询停车场总车位数 | ||
477 | + BizResult<Long> berthResult = parkingLotQueryService.queryBerthNumByPlNos(request); | ||
478 | + if(ResultUtils.isError(berthResult)){ | ||
479 | + res.setCode(berthResult.getErrCode().getCode()); | ||
480 | + res.setMsg(berthResult.getErrMsg()); | ||
481 | + return res; | ||
482 | + } | ||
483 | + //空余车位数 | ||
484 | + resMap.put("freeBerthNum",bizResult.getData()); | ||
485 | + //总车位数 | ||
486 | + resMap.put("allBerthNum",berthResult.getData()); | ||
487 | + | ||
488 | + double rate = (1-bizResult.getData() * 1.0 / berthResult.getData()) * 100; | ||
489 | + String rateStr = new DecimalFormat("#.00").format(rate); | ||
490 | + resMap.put("rate",rateStr); | ||
491 | + res.setData(resMap); | ||
492 | + return res; | ||
493 | + | ||
494 | + } | ||
495 | + | ||
496 | + /** | ||
376 | * 实时查询今日空置率<br> | 497 | * 实时查询今日空置率<br> |
377 | * 今日空置率:当天0:00到操作时间的每个时间戳的空置率做加权算法,<br> | 498 | * 今日空置率:当天0:00到操作时间的每个时间戳的空置率做加权算法,<br> |
378 | * 0:00-7:00加权10%,7:00-9:00加权40%,9:00-17:00加权15%,17:00-21:00加权25%,21:00-24:00加权10%,加权后的空置率之和除以时间戳数,得到“今日空置率” | 499 | * 0:00-7:00加权10%,7:00-9:00加权40%,9:00-17:00加权15%,17:00-21:00加权25%,21:00-24:00加权10%,加权后的空置率之和除以时间戳数,得到“今日空置率” |
@@ -402,12 +523,14 @@ public class IndexPageStatisticController extends BizController { | @@ -402,12 +523,14 @@ public class IndexPageStatisticController extends BizController { | ||
402 | } | 523 | } |
403 | Double totalfreeRatio = 0.00; | 524 | Double totalfreeRatio = 0.00; |
404 | for (ParkingLotUseStatisticDTO statisticDTO : pageBean.getDataList()) { | 525 | for (ParkingLotUseStatisticDTO statisticDTO : pageBean.getDataList()) { |
405 | - totalfreeRatio += this.weightForFreeRation(statisticDTO.getStatisticBeginTime(), | ||
406 | - statisticDTO.getFreeRatio(), statisticDTO.getPlNo()); | 526 | + totalfreeRatio += statisticDTO.getFreeRatio(); |
527 | + //暂时不加权 | ||
528 | + //this.weightForFreeRation(statisticDTO.getStatisticBeginTime(), | ||
529 | + //statisticDTO.getFreeRatio(), statisticDTO.getPlNo()); | ||
407 | } | 530 | } |
408 | logger.info("加权后的空置率之和:" + totalfreeRatio + " 时间戳个数:" + pageBean.getDataList().size()); | 531 | logger.info("加权后的空置率之和:" + totalfreeRatio + " 时间戳个数:" + pageBean.getDataList().size()); |
409 | Double avgFreeRation = totalfreeRatio / pageBean.getDataList().size(); | 532 | Double avgFreeRation = totalfreeRatio / pageBean.getDataList().size(); |
410 | - String result = String.format("%.2f", avgFreeRation); | 533 | + String result = String.format("%.2f", avgFreeRation * 100); |
411 | return new BizResultVO<String>().setData(result); | 534 | return new BizResultVO<String>().setData(result); |
412 | } | 535 | } |
413 | 536 | ||
@@ -455,4 +578,26 @@ public class IndexPageStatisticController extends BizController { | @@ -455,4 +578,26 @@ public class IndexPageStatisticController extends BizController { | ||
455 | return new BizResultVO<List<ParkingCountDTO>>(result); | 578 | return new BizResultVO<List<ParkingCountDTO>>(result); |
456 | } | 579 | } |
457 | 580 | ||
581 | + /** | ||
582 | + * @param request | ||
583 | + * @return 2017年8月18日 wangfei | ||
584 | + */ | ||
585 | + @ApiOperation(value = "根据停车场编号统计设备数量") | ||
586 | + @PostMapping("statisticParkLotEqpCountByPlNos") | ||
587 | + @ResponseBody | ||
588 | + public BizResult<List<ParkLotEqpTypeCountVO>> statisticParkLotEqpCountByPlNos(@RequestBody | ||
589 | + EqpTypeQueryByPlNosRequest request) { | ||
590 | + logger.info("停车场编号:" + request.getPlNos() + " 统计设备数量等信息"); | ||
591 | + List<ParkLotEqpTypeCountVO> resultList = new ArrayList<>(); | ||
592 | + BizResult<List<ParkLotEqpTypeCountStatisticByCountryDTO>> result = parkingLotEqpService | ||
593 | + .StatisticParkLotEqpCountByPlNos(request); | ||
594 | + if (!CollectionUtils.isEmpty(result.getData())) { | ||
595 | + for (ParkLotEqpTypeCountStatisticByCountryDTO i : result.getData()) { | ||
596 | + ParkLotEqpTypeCountVO vo = new ParkLotEqpTypeCountVO(); | ||
597 | + BeanUtils.copyProperties(i, vo); | ||
598 | + resultList.add(vo); | ||
599 | + } | ||
600 | + } | ||
601 | + return new BizResult<>(resultList); | ||
602 | + } | ||
458 | } | 603 | } |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java
@@ -14,13 +14,11 @@ import javax.servlet.http.HttpSession; | @@ -14,13 +14,11 @@ import javax.servlet.http.HttpSession; | ||
14 | 14 | ||
15 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 15 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
16 | import com.alibaba.dubbo.common.utils.StringUtils; | 16 | import com.alibaba.dubbo.common.utils.StringUtils; |
17 | -import com.alibaba.fastjson.JSONArray; | ||
18 | import com.alibaba.fastjson.JSONObject; | 17 | import com.alibaba.fastjson.JSONObject; |
19 | 18 | ||
20 | import com.clouds.common.entity.UserInfo; | 19 | import com.clouds.common.entity.UserInfo; |
21 | import com.clouds.common.utils.AmountUtils; | 20 | import com.clouds.common.utils.AmountUtils; |
22 | import com.clouds.common.utils.DateUtil; | 21 | import com.clouds.common.utils.DateUtil; |
23 | -import com.clouds.common.utils.ResultUtils; | ||
24 | import com.clouds.common.utils.excle.ExcelUtil; | 22 | import com.clouds.common.utils.excle.ExcelUtil; |
25 | import com.clouds.common.utils.excle.ExcleFillDateManager; | 23 | import com.clouds.common.utils.excle.ExcleFillDateManager; |
26 | import com.clouds.common.utils.excle.Layouter; | 24 | import com.clouds.common.utils.excle.Layouter; |
@@ -42,7 +40,6 @@ import com.zteits.clouds.api.dto.clouds.dto.MonthBillSummaryStatisticDTO; | @@ -42,7 +40,6 @@ import com.zteits.clouds.api.dto.clouds.dto.MonthBillSummaryStatisticDTO; | ||
42 | import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticDTO; | 40 | import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticDTO; |
43 | import com.zteits.clouds.api.dto.clouds.param.BillQueryRequest; | 41 | import com.zteits.clouds.api.dto.clouds.param.BillQueryRequest; |
44 | import com.zteits.clouds.api.dto.clouds.param.MonthBillRequest; | 42 | import com.zteits.clouds.api.dto.clouds.param.MonthBillRequest; |
45 | -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; | ||
46 | import com.zteits.clouds.api.dto.pay.param.YearMonthCardStatisticRequest; | 43 | import com.zteits.clouds.api.dto.pay.param.YearMonthCardStatisticRequest; |
47 | import com.zteits.clouds.api.service.clouds.MonthBillManagementService; | 44 | import com.zteits.clouds.api.service.clouds.MonthBillManagementService; |
48 | import com.zteits.clouds.api.service.clouds.YearMonthCardStatisticService; | 45 | import com.zteits.clouds.api.service.clouds.YearMonthCardStatisticService; |
@@ -76,11 +73,6 @@ public class MonthBillManagementController extends BizController { | @@ -76,11 +73,6 @@ public class MonthBillManagementController extends BizController { | ||
76 | private MonthBillManagementService monthBillManagementService; | 73 | private MonthBillManagementService monthBillManagementService; |
77 | @Autowired | 74 | @Autowired |
78 | private YearMonthCardStatisticService yearMonthCardStatisticService; | 75 | private YearMonthCardStatisticService yearMonthCardStatisticService; |
79 | - | ||
80 | - @Autowired | ||
81 | - private TdCustCompanyService tdCustCompanyService; | ||
82 | - @Autowired | ||
83 | - private HttpSession session; | ||
84 | @Autowired | 76 | @Autowired |
85 | private SessionCommUtil sessionCommUtil; | 77 | private SessionCommUtil sessionCommUtil; |
86 | @Value("${project.syscode}") | 78 | @Value("${project.syscode}") |
@@ -180,18 +172,20 @@ public class MonthBillManagementController extends BizController { | @@ -180,18 +172,20 @@ public class MonthBillManagementController extends BizController { | ||
180 | public BizResultVO<EasyUIDataGridVO<BillManageForMonthDTO>> queryBillforMonthList( | 172 | public BizResultVO<EasyUIDataGridVO<BillManageForMonthDTO>> queryBillforMonthList( |
181 | @RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, HttpServletResponse response) | 173 | @RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, HttpServletResponse response) |
182 | throws Exception { | 174 | throws Exception { |
183 | - // 2.调用接口查询当前登录人管辖的停车场名称 | 175 | + // 2.调用接口查询当前登录人管辖的停车场名称 |
184 | UserInfo userInfo = sessionCommUtil.getUserInfo(); | 176 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
185 | - List<String> plNos = new ArrayList<>(); | ||
186 | - if (userInfo != null) { | ||
187 | - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
188 | - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
189 | - tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
190 | - tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
191 | - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
192 | - // 拥有的停车场编号 | ||
193 | - plNos = ResultUtils.getBizResultData(bizResult); | ||
194 | - } | 177 | + List<String> plNos = userInfo.getOrgIds(); |
178 | +// UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
179 | +// List<String> plNos = new ArrayList<>(); | ||
180 | +// if (userInfo != null) { | ||
181 | +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
182 | +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
183 | +// tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
184 | +// tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
185 | +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
186 | +// // 拥有的停车场编号 | ||
187 | +// plNos = ResultUtils.getBizResultData(bizResult); | ||
188 | +// } | ||
195 | // if (CollectionUtils.isEmpty(plNos)) { | 189 | // if (CollectionUtils.isEmpty(plNos)) { |
196 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); | 190 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); |
197 | // } | 191 | // } |
@@ -215,16 +209,17 @@ public class MonthBillManagementController extends BizController { | @@ -215,16 +209,17 @@ public class MonthBillManagementController extends BizController { | ||
215 | throws Exception { | 209 | throws Exception { |
216 | // 2.调用接口查询当前登录人管辖的停车场名称 | 210 | // 2.调用接口查询当前登录人管辖的停车场名称 |
217 | UserInfo userInfo = sessionCommUtil.getUserInfo(); | 211 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
218 | - List<String> plNos = new ArrayList<>(); | ||
219 | - if (userInfo != null) { | ||
220 | - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
221 | - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
222 | - tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
223 | - tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
224 | - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
225 | - // 拥有的停车场编号 | ||
226 | - plNos = ResultUtils.getBizResultData(bizResult); | ||
227 | - } | 212 | + List<String> plNos = userInfo.getOrgIds(); |
213 | +// List<String> plNos = new ArrayList<>(); | ||
214 | +// if (userInfo != null) { | ||
215 | +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
216 | +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
217 | +// tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
218 | +// tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
219 | +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
220 | +// // 拥有的停车场编号 | ||
221 | +// plNos = ResultUtils.getBizResultData(bizResult); | ||
222 | +// } | ||
228 | // if (CollectionUtils.isEmpty(plNos)) { | 223 | // if (CollectionUtils.isEmpty(plNos)) { |
229 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); | 224 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); |
230 | // } | 225 | // } |
@@ -268,8 +263,8 @@ public class MonthBillManagementController extends BizController { | @@ -268,8 +263,8 @@ public class MonthBillManagementController extends BizController { | ||
268 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | 263 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); |
269 | String[] title = new String[] {"流水号", "时间", "车主车牌号", "进场时间", "出场时间", "停车时长", "收费规则", "支付方式", "应收金额", "优惠券", | 264 | String[] title = new String[] {"流水号", "时间", "车主车牌号", "进场时间", "出场时间", "停车时长", "收费规则", "支付方式", "应收金额", "优惠券", |
270 | "红包", "实收金额", "共计"}; | 265 | "红包", "实收金额", "共计"}; |
271 | - String sheetName = "月账单"; | ||
272 | - String fileName = "月账单管理" + format2.format(new Date()); | 266 | + String sheetName = "账单"; |
267 | + String fileName = "账单管理" + format2.format(new Date()); | ||
273 | 268 | ||
274 | // 1.创建excel信息 | 269 | // 1.创建excel信息 |
275 | XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | 270 | XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); |
@@ -367,8 +362,8 @@ public class MonthBillManagementController extends BizController { | @@ -367,8 +362,8 @@ public class MonthBillManagementController extends BizController { | ||
367 | 362 | ||
368 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | 363 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); |
369 | String[] title = new String[] {"交易单号", "交易时间", "种类", "卡名称", "车牌号", "支付金额", "有效期"}; | 364 | String[] title = new String[] {"交易单号", "交易时间", "种类", "卡名称", "车牌号", "支付金额", "有效期"}; |
370 | - String sheetName = "月账单"; | ||
371 | - String fileName = "月账单管理" + format2.format(new Date()); | 365 | + String sheetName = "账单"; |
366 | + String fileName = "账单管理" + format2.format(new Date()); | ||
372 | 367 | ||
373 | // 1.创建excel信息 | 368 | // 1.创建excel信息 |
374 | XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | 369 | XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); |
@@ -456,17 +451,20 @@ public class MonthBillManagementController extends BizController { | @@ -456,17 +451,20 @@ public class MonthBillManagementController extends BizController { | ||
456 | billQueryRequest.setBaseRequest(new BaseInfo(1, 0)); | 451 | billQueryRequest.setBaseRequest(new BaseInfo(1, 0)); |
457 | // 2.调用接口查询当前登录人管辖的停车场名称 | 452 | // 2.调用接口查询当前登录人管辖的停车场名称 |
458 | UserInfo userInfo = sessionCommUtil.getUserInfo(); | 453 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
459 | - List<String> plNos = new ArrayList<>(); | ||
460 | - if (userInfo != null) { | ||
461 | - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
462 | - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
463 | - tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
464 | - tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
465 | - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds( | ||
466 | - tdCompanyParkQueryRequest); | ||
467 | - // 拥有的停车场编号 | ||
468 | - plNos = ResultUtils.getBizResultData(bizResult); | ||
469 | - } | 454 | + List<String> plNos = userInfo.getOrgIds(); |
455 | +// // 2.调用接口查询当前登录人管辖的停车场名称 | ||
456 | +// UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
457 | +// List<String> plNos = new ArrayList<>(); | ||
458 | +// if (userInfo != null) { | ||
459 | +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
460 | +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
461 | +// tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
462 | +// tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
463 | +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds( | ||
464 | +// tdCompanyParkQueryRequest); | ||
465 | +// // 拥有的停车场编号 | ||
466 | +// plNos = ResultUtils.getBizResultData(bizResult); | ||
467 | +// } | ||
470 | billQueryRequest.setParkIdList(plNos); | 468 | billQueryRequest.setParkIdList(plNos); |
471 | logger.info("月账单导出所有 req={}", JSONObject.toJSONString(billQueryRequest)); | 469 | logger.info("月账单导出所有 req={}", JSONObject.toJSONString(billQueryRequest)); |
472 | respondResult = monthBillManagementService | 470 | respondResult = monthBillManagementService |
@@ -477,7 +475,7 @@ public class MonthBillManagementController extends BizController { | @@ -477,7 +475,7 @@ public class MonthBillManagementController extends BizController { | ||
477 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | 475 | SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); |
478 | String[] title = new String[] {"停车场名称", "现金", "微信", "支付宝", "合计"}; | 476 | String[] title = new String[] {"停车场名称", "现金", "微信", "支付宝", "合计"}; |
479 | String[] sheetName = new String[] {"临停收费", "年卡月卡收费"}; | 477 | String[] sheetName = new String[] {"临停收费", "年卡月卡收费"}; |
480 | - String fileName = "月账单管理" + format2.format(new Date()); | 478 | + String fileName = "账单管理" + format2.format(new Date()); |
481 | 479 | ||
482 | // 1.创建excel信息,多个sheet页 | 480 | // 1.创建excel信息,多个sheet页 |
483 | XSSFWorkbook workbook = new XSSFWorkbook(); | 481 | XSSFWorkbook workbook = new XSSFWorkbook(); |
@@ -549,17 +547,17 @@ public class MonthBillManagementController extends BizController { | @@ -549,17 +547,17 @@ public class MonthBillManagementController extends BizController { | ||
549 | * @return | 547 | * @return |
550 | * @throws Exception | 548 | * @throws Exception |
551 | */ | 549 | */ |
552 | - private List<String> queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws Exception { | ||
553 | - /** 查询停车场编码. */ | ||
554 | - BizResult<List<String>> parkNoResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
555 | - if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) { | ||
556 | - logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData())); | ||
557 | - return parkNoResult.getData(); | ||
558 | - } else { | ||
559 | - logger.info("根据登录用户没有获取到对应的停车场编码"); | ||
560 | - return null; | ||
561 | - } | ||
562 | - | ||
563 | - } | ||
564 | - | ||
565 | -} | 550 | +// private List<String> queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws Exception { |
551 | +// /** 查询停车场编码. */ | ||
552 | +// BizResult<List<String>> parkNoResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
553 | +// if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) { | ||
554 | +// logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData())); | ||
555 | +// return parkNoResult.getData(); | ||
556 | +// } else { | ||
557 | +// logger.info("根据登录用户没有获取到对应的停车场编码"); | ||
558 | +// return null; | ||
559 | +// } | ||
560 | +// | ||
561 | +// } | ||
562 | + | ||
563 | +} | ||
566 | \ No newline at end of file | 564 | \ No newline at end of file |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java
@@ -112,21 +112,27 @@ public class ParkLotStatisticController { | @@ -112,21 +112,27 @@ public class ParkLotStatisticController { | ||
112 | 112 | ||
113 | private List<String> GetParkLotNosByCurrUser(String sysCode) throws Exception { | 113 | private List<String> GetParkLotNosByCurrUser(String sysCode) throws Exception { |
114 | logger.info("根据登录人权限获取停车场列表"); | 114 | logger.info("根据登录人权限获取停车场列表"); |
115 | - List<String> plNos = Lists.newArrayList(); | ||
116 | - //2.调用接口查询当前登录人管辖的停车场名称 | ||
117 | /*plNos.add("A320211000"); | 115 | /*plNos.add("A320211000"); |
118 | plNos.add("B1504020C7");*/ | 116 | plNos.add("B1504020C7");*/ |
119 | - UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
120 | - if(userInfo!=null){ | ||
121 | - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
122 | - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
123 | - tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
124 | - tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
125 | - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest ); | ||
126 | - plNos = ResultUtils.getBizResultData(bizResult); | ||
127 | - }else{ | ||
128 | - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS); | ||
129 | - } | 117 | + // 2.调用接口查询当前登录人管辖的停车场名称 |
118 | + UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
119 | + List<String> plNos=Lists.newArrayList(); | ||
120 | + if(null != userInfo){ | ||
121 | + plNos= userInfo.getOrgIds(); | ||
122 | + } | ||
123 | +// if(userInfo!=null){ | ||
124 | +// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
125 | +// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
126 | +// tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
127 | +// tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
128 | +// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest ); | ||
129 | +// plNos = ResultUtils.getBizResultData(bizResult); | ||
130 | +// }else{ | ||
131 | +// throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS); | ||
132 | +// } | ||
133 | + if(CollectionUtils.isEmpty(plNos)){ | ||
134 | + throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS); | ||
135 | + } | ||
130 | return plNos; | 136 | return plNos; |
131 | } | 137 | } |
132 | } | 138 | } |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/VehicleFlowStatisticController.java
@@ -7,28 +7,14 @@ import java.util.Calendar; | @@ -7,28 +7,14 @@ import java.util.Calendar; | ||
7 | import java.util.Date; | 7 | import java.util.Date; |
8 | import java.util.List; | 8 | import java.util.List; |
9 | import java.util.Map; | 9 | import java.util.Map; |
10 | -import java.util.Map.Entry; | ||
11 | 10 | ||
12 | import javax.servlet.http.HttpServletRequest; | 11 | import javax.servlet.http.HttpServletRequest; |
13 | import javax.servlet.http.HttpServletResponse; | 12 | import javax.servlet.http.HttpServletResponse; |
14 | -import javax.servlet.http.HttpSession; | ||
15 | - | ||
16 | -import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
17 | -import org.slf4j.Logger; | ||
18 | -import org.slf4j.LoggerFactory; | ||
19 | -import org.springframework.beans.factory.annotation.Autowired; | ||
20 | -import org.springframework.beans.factory.annotation.Value; | ||
21 | -import org.springframework.stereotype.Controller; | ||
22 | -import org.springframework.web.bind.annotation.GetMapping; | ||
23 | -import org.springframework.web.bind.annotation.PostMapping; | ||
24 | -import org.springframework.web.bind.annotation.RequestBody; | ||
25 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
26 | -import org.springframework.web.bind.annotation.RequestParam; | ||
27 | -import org.springframework.web.bind.annotation.ResponseBody; | ||
28 | 13 | ||
29 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 14 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
30 | import com.alibaba.fastjson.JSON; | 15 | import com.alibaba.fastjson.JSON; |
31 | import com.alibaba.fastjson.JSONObject; | 16 | import com.alibaba.fastjson.JSONObject; |
17 | + | ||
32 | import com.clouds.common.entity.UserInfo; | 18 | import com.clouds.common.entity.UserInfo; |
33 | import com.clouds.common.utils.DateUtil; | 19 | import com.clouds.common.utils.DateUtil; |
34 | import com.clouds.common.utils.ResultUtils; | 20 | import com.clouds.common.utils.ResultUtils; |
@@ -49,357 +35,334 @@ import com.zteits.clouds.api.apibase.exception.BizException; | @@ -49,357 +35,334 @@ import com.zteits.clouds.api.apibase.exception.BizException; | ||
49 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; | 35 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticDTO; |
50 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO; | 36 | import com.zteits.clouds.api.dto.park.dto.ParkingLotUseStatisticMaxAndMinDTO; |
51 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; | 37 | import com.zteits.clouds.api.dto.park.param.ParkingLotUseStatisticForPageRequest; |
52 | -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; | ||
53 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; | 38 | import com.zteits.clouds.api.service.park.ParkingLotUseStatisticService; |
54 | -import com.zteits.clouds.api.service.pay.TdCustCompanyService; | ||
55 | import com.zteits.irain.portal.constant.ParkConstant; | 39 | import com.zteits.irain.portal.constant.ParkConstant; |
56 | -import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.BerthsAndFlowLineChartVO; | ||
57 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; | 40 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO; |
58 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; | 41 | import com.zteits.irain.portal.vo.parkinglotcloudplatform.datastatistic.LineChartVO.SerieVO; |
59 | - | ||
60 | import io.swagger.annotations.Api; | 42 | import io.swagger.annotations.Api; |
61 | import io.swagger.annotations.ApiOperation; | 43 | import io.swagger.annotations.ApiOperation; |
44 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
45 | +import org.slf4j.Logger; | ||
46 | +import org.slf4j.LoggerFactory; | ||
47 | +import org.springframework.beans.factory.annotation.Autowired; | ||
48 | +import org.springframework.beans.factory.annotation.Value; | ||
49 | +import org.springframework.stereotype.Controller; | ||
50 | +import org.springframework.web.bind.annotation.GetMapping; | ||
51 | +import org.springframework.web.bind.annotation.PostMapping; | ||
52 | +import org.springframework.web.bind.annotation.RequestBody; | ||
53 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
54 | +import org.springframework.web.bind.annotation.RequestParam; | ||
55 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
62 | 56 | ||
63 | /** | 57 | /** |
64 | - * | ||
65 | * 停车场车流量数据统计 Copyright: Copyright (c) 2017 zteits | 58 | * 停车场车流量数据统计 Copyright: Copyright (c) 2017 zteits |
66 | - * | 59 | + * |
67 | * @ClassName: ParkingLotUseStatisticController.java | 60 | * @ClassName: ParkingLotUseStatisticController.java |
68 | * @Description: | 61 | * @Description: |
69 | * @version: v1.0.0 | 62 | * @version: v1.0.0 |
70 | * @author: langlw | 63 | * @author: langlw |
71 | * @date: 2017年6月14日 下午3:02:39 Modification History: Date Author Version | 64 | * @date: 2017年6月14日 下午3:02:39 Modification History: Date Author Version |
72 | - * Description ---------------------------------------------------------* | ||
73 | - * 2017年6月14日 langlw v1.0.0 创建 | 65 | + * Description ---------------------------------------------------------* |
66 | + * 2017年6月14日 langlw v1.0.0 创建 | ||
74 | */ | 67 | */ |
75 | @Api(value = "停车场车流量数据统计", description = "停车场车流量数据统计") | 68 | @Api(value = "停车场车流量数据统计", description = "停车场车流量数据统计") |
76 | @Controller | 69 | @Controller |
77 | @RequestMapping(value = "/VehicleFlowStatistic") | 70 | @RequestMapping(value = "/VehicleFlowStatistic") |
78 | public class VehicleFlowStatisticController extends BizController { | 71 | public class VehicleFlowStatisticController extends BizController { |
79 | - private Logger logger = LoggerFactory.getLogger(VehicleFlowStatisticController.class); | ||
80 | - | ||
81 | - @Value("${project.syscode}") | ||
82 | - private String sysCode; | ||
83 | - | ||
84 | - @Autowired | ||
85 | - private ParkingLotUseStatisticService parkingLotStatisticService; | ||
86 | - @Autowired | ||
87 | - private HttpSession session; | ||
88 | - @Autowired | ||
89 | - private SessionCommUtil sessionCommUtil; | ||
90 | - @Autowired | ||
91 | - private TdCustCompanyService tdCustCompanyService; | ||
92 | - | ||
93 | - @ApiOperation("分页查询车流量数据统计车位总流量") | ||
94 | - @PostMapping("getVehicleFlowStatisticForPage") | ||
95 | - @ResponseBody | ||
96 | - public BizResultVO<EasyUIDataGridVO<ParkingLotUseStatisticDTO>> queryParkingLotUseStatisticForPage( | ||
97 | - @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception { | ||
98 | - if (null == request.getBeginTime() || null==request.getEndTime()) { | 72 | + private Logger logger = LoggerFactory.getLogger(VehicleFlowStatisticController.class); |
73 | + | ||
74 | + @Value("${project.syscode}") | ||
75 | + private String sysCode; | ||
76 | + | ||
77 | + @Autowired | ||
78 | + private ParkingLotUseStatisticService parkingLotStatisticService; | ||
79 | + @Autowired | ||
80 | + private SessionCommUtil sessionCommUtil; | ||
81 | + | ||
82 | + @ApiOperation("分页查询车流量数据统计车位总流量") | ||
83 | + @PostMapping("getVehicleFlowStatisticForPage") | ||
84 | + @ResponseBody | ||
85 | + public BizResultVO<EasyUIDataGridVO<ParkingLotUseStatisticDTO>> queryParkingLotUseStatisticForPage( | ||
86 | + @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception { | ||
87 | + if (null == request.getBeginTime() || null == request.getEndTime()) { | ||
99 | throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | 88 | throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); |
100 | } | 89 | } |
101 | - Calendar beginc = Calendar.getInstance(); | ||
102 | - beginc.setTime(request.getBeginTime()); | ||
103 | - int beginYear = beginc.get(Calendar.YEAR); | ||
104 | - int beginMonth = beginc.get(Calendar.MONTH) + 1; | ||
105 | - int beginDay = beginc.get(Calendar.DAY_OF_MONTH); | ||
106 | - | ||
107 | - Calendar endc = Calendar.getInstance(); | ||
108 | - endc.setTime(request.getEndTime()); | ||
109 | - int endYear = endc.get(Calendar.YEAR); | ||
110 | - int endMonth = endc.get(Calendar.MONTH) + 1; | ||
111 | - int endDay = endc.get(Calendar.DAY_OF_MONTH); | ||
112 | - | ||
113 | - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { | ||
114 | - // 2表示按每小时统计 | ||
115 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
116 | - } else { | ||
117 | - // 3表示按每天统计 | ||
118 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
119 | - } | ||
120 | - | ||
121 | - BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | ||
122 | - .queryParkingLotUseStatisticForPage(request); | ||
123 | - return returnJqGridData(bizResult, ParkingLotUseStatisticDTO.class); | ||
124 | - } | ||
125 | - | ||
126 | - @ApiOperation("查询车流量最大值与最小值") | ||
127 | - @PostMapping("getVehicleFlowMaxAndMin") | ||
128 | - @ResponseBody | ||
129 | - public BizResultVO<ParkingLotUseStatisticMaxAndMinDTO> QueryParkingLotUseStatisticMaxAndMin( | ||
130 | - @RequestBody ParkingLotUseStatisticForPageRequest request) { | ||
131 | - Calendar beginc = Calendar.getInstance(); | ||
132 | - beginc.setTime(request.getBeginTime()); | ||
133 | - int beginYear = beginc.get(Calendar.YEAR); | ||
134 | - int beginMonth = beginc.get(Calendar.MONTH) + 1; | ||
135 | - int beginDay = beginc.get(Calendar.DAY_OF_MONTH); | ||
136 | - | ||
137 | - Calendar endc = Calendar.getInstance(); | ||
138 | - endc.setTime(request.getEndTime()); | ||
139 | - int endYear = endc.get(Calendar.YEAR); | ||
140 | - int endMonth = endc.get(Calendar.MONTH) + 1; | ||
141 | - int endDay = endc.get(Calendar.DAY_OF_MONTH); | ||
142 | - | ||
143 | - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { | ||
144 | - // 2表示按每小时统计 | ||
145 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
146 | - } else { | ||
147 | - // 3表示按每天统计 | ||
148 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
149 | - } | ||
150 | - BizResult<ParkingLotUseStatisticMaxAndMinDTO> bizResult = parkingLotStatisticService | ||
151 | - .QueryVehicleFlowStatisticMaxAndMin(request); | ||
152 | - return new BizResultVO<>(bizResult); | ||
153 | - } | ||
154 | - | ||
155 | - @ApiOperation("导出车流量数据统计excel") | ||
156 | - @GetMapping("exportVehicleFlowStatisticExcel") | ||
157 | - public void excelParkingLotUseStatistic(@RequestParam String beginTime, @RequestParam String endTime, | ||
158 | - @RequestParam String plNos, HttpServletRequest requests, HttpServletResponse response) { | ||
159 | - ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest(); | ||
160 | - request.setSysCode(sysCode); | ||
161 | - request.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); | ||
162 | - request.setEndTime(DateUtil.to_date(endTime, DateUtil.DATETIME_FORMAT)); | ||
163 | - List<String> plNoslist = new ArrayList<>(); | ||
164 | - plNoslist.add(plNos); | ||
165 | - request.setPlNos(plNoslist); | ||
166 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
167 | - Calendar beginc = Calendar.getInstance(); | ||
168 | - beginc.setTime(request.getBeginTime()); | ||
169 | - int beginYear = beginc.get(Calendar.YEAR); | ||
170 | - int beginMonth = beginc.get(Calendar.MONTH) + 1; | ||
171 | - int beginDay = beginc.get(Calendar.DAY_OF_MONTH); | ||
172 | - | ||
173 | - Calendar endc = Calendar.getInstance(); | ||
174 | - endc.setTime(request.getEndTime()); | ||
175 | - int endYear = endc.get(Calendar.YEAR); | ||
176 | - int endMonth = endc.get(Calendar.MONTH) + 1; | ||
177 | - int endDay = endc.get(Calendar.DAY_OF_MONTH); | ||
178 | - | ||
179 | - if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { | ||
180 | - // 2表示按每小时统计 | ||
181 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
182 | - } else { | ||
183 | - // 3表示按每天统计 | ||
184 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
185 | - } | ||
186 | - BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | ||
187 | - .queryParkingLotUseStatisticForPage(request); | ||
188 | - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
189 | - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | ||
190 | - String[] title = new String[] { "时间", "总车流量", "临时车流量", "固定车流量" }; | ||
191 | - String sheetName = "车流量管理"; | ||
192 | - String fileName = "车流量管理" + format2.format(new Date()); | ||
193 | - // 1.创建excel信息 | ||
194 | - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | ||
195 | - // 2.设置excel表头和表体 | ||
196 | - Layouter.buildReport(workSheet, title, 0, 0); | ||
197 | - // 3.填充数据 | ||
198 | - List<Object[]> contentList = new ArrayList<Object[]>(); | ||
199 | - List<ParkingLotUseStatisticDTO> list = new ArrayList<>(); | ||
200 | - if (CollectionUtils.isNotEmpty(bizResult.getData().getDataList())) { | ||
201 | - list = bizResult.getData().getDataList(); | ||
202 | - } | ||
203 | - for (ParkingLotUseStatisticDTO e : list) { | ||
204 | - Object[] obj = new Object[title.length]; | ||
205 | - int index = 0; | ||
206 | - obj[index++] = format.format(e.getStatisticBeginTime()); | ||
207 | - obj[index++] = e.getVehicleFlow(); | ||
208 | - obj[index++] = e.getTmpVehicleFlow(); | ||
209 | - obj[index++] = e.getFixVehicleFlow(); | ||
210 | - contentList.add(obj); | ||
211 | - } | ||
212 | - ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
213 | - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
214 | - // 4.excel输出配置 | ||
215 | - ExcelUtil.write(response, workSheet, fileName); | ||
216 | - } | ||
217 | - | ||
218 | - /** | ||
219 | - * 根据时间获取车流量折线图 | ||
220 | - * | ||
221 | - * @param request | ||
222 | - * @return | ||
223 | - * @throws Exception | ||
224 | - */ | ||
225 | - @ApiOperation("根据时间获取车流量折线图") | ||
226 | - @PostMapping("getVehicleFlowForLineChart") | ||
227 | - @ResponseBody | ||
228 | - public BizResultVO<LineChartVO> getVehicleFlowForLineChart( | ||
229 | - @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception { | ||
230 | - | ||
231 | - if (null == request.getBeginTime() || null==request.getEndTime()) { | 90 | + Calendar beginc = Calendar.getInstance(); |
91 | + beginc.setTime(request.getBeginTime()); | ||
92 | + int beginYear = beginc.get(Calendar.YEAR); | ||
93 | + int beginMonth = beginc.get(Calendar.MONTH) + 1; | ||
94 | + int beginDay = beginc.get(Calendar.DAY_OF_MONTH); | ||
95 | + | ||
96 | + Calendar endc = Calendar.getInstance(); | ||
97 | + endc.setTime(request.getEndTime()); | ||
98 | + int endYear = endc.get(Calendar.YEAR); | ||
99 | + int endMonth = endc.get(Calendar.MONTH) + 1; | ||
100 | + int endDay = endc.get(Calendar.DAY_OF_MONTH); | ||
101 | + | ||
102 | + if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { | ||
103 | + // 2表示按每小时统计 | ||
104 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
105 | + } else { | ||
106 | + // 3表示按每天统计 | ||
107 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
108 | + } | ||
109 | + | ||
110 | + BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | ||
111 | + .queryParkingLotUseStatisticForPage(request); | ||
112 | + return returnJqGridData(bizResult, ParkingLotUseStatisticDTO.class); | ||
113 | + } | ||
114 | + | ||
115 | + @ApiOperation("查询车流量最大值与最小值") | ||
116 | + @PostMapping("getVehicleFlowMaxAndMin") | ||
117 | + @ResponseBody | ||
118 | + public BizResultVO<ParkingLotUseStatisticMaxAndMinDTO> QueryParkingLotUseStatisticMaxAndMin( | ||
119 | + @RequestBody ParkingLotUseStatisticForPageRequest request) { | ||
120 | + Calendar beginc = Calendar.getInstance(); | ||
121 | + beginc.setTime(request.getBeginTime()); | ||
122 | + int beginYear = beginc.get(Calendar.YEAR); | ||
123 | + int beginMonth = beginc.get(Calendar.MONTH) + 1; | ||
124 | + int beginDay = beginc.get(Calendar.DAY_OF_MONTH); | ||
125 | + | ||
126 | + Calendar endc = Calendar.getInstance(); | ||
127 | + endc.setTime(request.getEndTime()); | ||
128 | + int endYear = endc.get(Calendar.YEAR); | ||
129 | + int endMonth = endc.get(Calendar.MONTH) + 1; | ||
130 | + int endDay = endc.get(Calendar.DAY_OF_MONTH); | ||
131 | + | ||
132 | + if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { | ||
133 | + // 2表示按每小时统计 | ||
134 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
135 | + } else { | ||
136 | + // 3表示按每天统计 | ||
137 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
138 | + } | ||
139 | + BizResult<ParkingLotUseStatisticMaxAndMinDTO> bizResult = parkingLotStatisticService | ||
140 | + .QueryVehicleFlowStatisticMaxAndMin(request); | ||
141 | + return new BizResultVO<>(bizResult); | ||
142 | + } | ||
143 | + | ||
144 | + @ApiOperation("导出车流量数据统计excel") | ||
145 | + @GetMapping("exportVehicleFlowStatisticExcel") | ||
146 | + public void excelParkingLotUseStatistic(@RequestParam String beginTime, @RequestParam String endTime, | ||
147 | + @RequestParam String plNos, HttpServletRequest requests, HttpServletResponse response) { | ||
148 | + ParkingLotUseStatisticForPageRequest request = new ParkingLotUseStatisticForPageRequest(); | ||
149 | + request.setSysCode(sysCode); | ||
150 | + request.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); | ||
151 | + request.setEndTime(DateUtil.to_date(endTime, DateUtil.DATETIME_FORMAT)); | ||
152 | + List<String> plNoslist = new ArrayList<>(); | ||
153 | + plNoslist.add(plNos); | ||
154 | + request.setPlNos(plNoslist); | ||
155 | + request.setBaseRequest(new BaseInfo(1, 0)); | ||
156 | + Calendar beginc = Calendar.getInstance(); | ||
157 | + beginc.setTime(request.getBeginTime()); | ||
158 | + int beginYear = beginc.get(Calendar.YEAR); | ||
159 | + int beginMonth = beginc.get(Calendar.MONTH) + 1; | ||
160 | + int beginDay = beginc.get(Calendar.DAY_OF_MONTH); | ||
161 | + | ||
162 | + Calendar endc = Calendar.getInstance(); | ||
163 | + endc.setTime(request.getEndTime()); | ||
164 | + int endYear = endc.get(Calendar.YEAR); | ||
165 | + int endMonth = endc.get(Calendar.MONTH) + 1; | ||
166 | + int endDay = endc.get(Calendar.DAY_OF_MONTH); | ||
167 | + | ||
168 | + if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { | ||
169 | + // 2表示按每小时统计 | ||
170 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
171 | + } else { | ||
172 | + // 3表示按每天统计 | ||
173 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
174 | + } | ||
175 | + BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | ||
176 | + .queryParkingLotUseStatisticForPage(request); | ||
177 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
178 | + SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | ||
179 | + String[] title = new String[] {"时间", "总车流量", "临时车流量", "固定车流量"}; | ||
180 | + String sheetName = "车流量管理"; | ||
181 | + String fileName = "车流量管理" + format2.format(new Date()); | ||
182 | + // 1.创建excel信息 | ||
183 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | ||
184 | + // 2.设置excel表头和表体 | ||
185 | + Layouter.buildReport(workSheet, title, 0, 0); | ||
186 | + // 3.填充数据 | ||
187 | + List<Object[]> contentList = new ArrayList<Object[]>(); | ||
188 | + List<ParkingLotUseStatisticDTO> list = new ArrayList<>(); | ||
189 | + if (CollectionUtils.isNotEmpty(bizResult.getData().getDataList())) { | ||
190 | + list = bizResult.getData().getDataList(); | ||
191 | + } | ||
192 | + for (ParkingLotUseStatisticDTO e : list) { | ||
193 | + Object[] obj = new Object[title.length]; | ||
194 | + int index = 0; | ||
195 | + obj[index++] = format.format(e.getStatisticBeginTime()); | ||
196 | + obj[index++] = e.getVehicleFlow(); | ||
197 | + obj[index++] = e.getTmpVehicleFlow(); | ||
198 | + obj[index++] = e.getFixVehicleFlow(); | ||
199 | + contentList.add(obj); | ||
200 | + } | ||
201 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
202 | + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
203 | + // 4.excel输出配置 | ||
204 | + ExcelUtil.write(response, workSheet, fileName); | ||
205 | + } | ||
206 | + | ||
207 | + /** | ||
208 | + * 根据时间获取车流量折线图 | ||
209 | + * | ||
210 | + * @param request | ||
211 | + * @return | ||
212 | + * @throws Exception | ||
213 | + */ | ||
214 | + @ApiOperation("根据时间获取车流量折线图") | ||
215 | + @PostMapping("getVehicleFlowForLineChart") | ||
216 | + @ResponseBody | ||
217 | + public BizResultVO<LineChartVO> getVehicleFlowForLineChart( | ||
218 | + @RequestBody ParkingLotUseStatisticForPageRequest request) throws Exception { | ||
219 | + | ||
220 | + if (null == request.getBeginTime() || null == request.getEndTime()) { | ||
232 | throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | 221 | throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); |
233 | } | 222 | } |
234 | - //2.调用接口查询当前登录人管辖的停车场名称 | ||
235 | - UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
236 | - List<String> plNos = new ArrayList<>(); | ||
237 | - if(userInfo!=null){ | ||
238 | - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
239 | - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
240 | - tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
241 | - tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
242 | - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
243 | - //拥有的停车场编号 | ||
244 | - plNos = ResultUtils.getBizResultData(bizResult); | ||
245 | - } | ||
246 | - if(CollectionUtils.isEmpty(plNos)){ | ||
247 | - throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); | ||
248 | - } | ||
249 | - request.setPlNos(plNos); | ||
250 | - | ||
251 | - logger.info("根据停车场编号获取该停车场今日车流量和车位折线图"); | ||
252 | - Calendar beginTime = Calendar.getInstance(); | ||
253 | - beginTime.setTime(request.getBeginTime()); | ||
254 | - | ||
255 | - Calendar endTime = Calendar.getInstance(); | ||
256 | - endTime.setTime(request.getEndTime()); | ||
257 | - | ||
258 | - Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), | ||
259 | - new Timestamp(request.getBeginTime().getTime())); | ||
260 | - List<String> xAxisData = Lists.newArrayList(); | ||
261 | - request.setBaseRequest(new BaseInfo(1, 0)); | ||
262 | - String dateType=""; | ||
263 | - | ||
264 | - if (dayDifference == 0L) { | ||
265 | - // 20分钟为一个时间戳 | ||
266 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER20MINUTE); | ||
267 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY) * 3; | ||
268 | - for (int i = 0; i < totaltimestampCount; i++) { | ||
269 | - String hour = String.format("%02d", (i / 3)); | ||
270 | - String minute = String.format("%02d", (i % 3) * 20); | ||
271 | - xAxisData.add(hour + ":" + minute); | ||
272 | - } | ||
273 | - dateType="HH:mm"; | ||
274 | - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType); | ||
275 | - return new BizResultVO<LineChartVO>().setData(vehicleFlows); | ||
276 | - | ||
277 | - } else if (dayDifference <= 3L) { | ||
278 | - // 1小时为一个时间戳 | ||
279 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
280 | - int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | ||
281 | - String day = ""; | ||
282 | - String month = ""; | ||
283 | - for (int i = 0; i < dayDifference.intValue(); i++) { | ||
284 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
285 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
286 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | ||
287 | - month = String.format("%02d", (beginMonth)); | ||
288 | - day = String.format("%02d", (beginDay)); | ||
289 | - for (int j = 0; j < totaltimestampCount; j++) { | ||
290 | - String hour = String.format("%02d", (j)); | ||
291 | - xAxisData.add(month + "-" + day + " " + hour); | ||
292 | - } | ||
293 | - } | ||
294 | - dateType="MM-dd HH"; | ||
295 | - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType); | ||
296 | - return new BizResultVO<LineChartVO>().setData(vehicleFlows); | ||
297 | - | ||
298 | - } else { | ||
299 | - // 1天为一个时间戳 | ||
300 | - request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
301 | - for (int i = 0; i < dayDifference.intValue(); i++) { | ||
302 | - beginTime.add(Calendar.DAY_OF_MONTH, 1); | ||
303 | - int beginMonth = beginTime.get(Calendar.MONTH) + 1; | ||
304 | - int beginDay = beginTime.get(Calendar.DAY_OF_MONTH); | ||
305 | - String month = String.format("%02d", (beginMonth)); | ||
306 | - String day = String.format("%02d", (beginDay)); | ||
307 | - xAxisData.add(month + "-" + day); | ||
308 | - | ||
309 | - } | ||
310 | - dateType="MM-dd"; | ||
311 | - LineChartVO vehicleFlows=getVehicleFlows(request, xAxisData, dateType); | ||
312 | - return new BizResultVO<LineChartVO>().setData(vehicleFlows); | ||
313 | - | ||
314 | - } | ||
315 | - | ||
316 | - } | ||
317 | - | ||
318 | - | ||
319 | - private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, | ||
320 | - List<String> xAxisData,String dateType){ | ||
321 | - // 调用后场服务 | ||
322 | - logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); | ||
323 | - BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | ||
324 | - .queryParkingLotUseStatisticForPage(request); | ||
325 | - PageBean<ParkingLotUseStatisticDTO> pageBean = ResultUtils.getBizResultData(bizResult); | ||
326 | - List<ParkingLotUseStatisticDTO> useStatisticDTOs = Lists.newArrayList(); | ||
327 | - if (pageBean != null) { | ||
328 | - useStatisticDTOs = pageBean.getDataList(); | ||
329 | - } | ||
330 | - | ||
331 | - // 保存固定车流量,时间戳和车流量对应关系 | ||
332 | - Map<String, Integer> fixVehicleFlowMap = Maps.newHashMap(); | ||
333 | - // 保存临时车流量,时间戳和车流量对应关系 | ||
334 | - Map<String, Integer> tmpVehicleFlowMap = Maps.newHashMap(); | ||
335 | - // 停车场编号和名称对应关系 | ||
336 | - Map<String, String> parkNameMap = Maps.newHashMap(); | ||
337 | - // 通过停车场,和统计时间分组 | ||
338 | - // Map<String, Map<String, Double>> parkLotMap = Maps.newHashMap(); | ||
339 | - if (!CollectionUtils.isEmpty(useStatisticDTOs)) { | ||
340 | - for (ParkingLotUseStatisticDTO statisticDTO : useStatisticDTOs) { | ||
341 | - String key = statisticDTO.getPlNo(); | ||
342 | - parkNameMap.put(key, statisticDTO.getPlName()); | ||
343 | - String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType); | ||
344 | - //保存固定车流量和临时车流量 | ||
345 | - fixVehicleFlowMap.put(statisBeginTime, (fixVehicleFlowMap.get(statisBeginTime)==null?0:fixVehicleFlowMap.get(statisBeginTime))+statisticDTO.getFixVehicleFlow()); | ||
346 | - tmpVehicleFlowMap.put(statisBeginTime, (tmpVehicleFlowMap.get(statisBeginTime)==null?0:tmpVehicleFlowMap.get(statisBeginTime))+statisticDTO.getTmpVehicleFlow()); | ||
347 | - } | ||
348 | - } | ||
349 | - | ||
350 | - // 封装车流量统计 | ||
351 | - LineChartVO vehicleFlows = new LineChartVO(); | ||
352 | - List<String> vehicleFlows_legendData = Lists.newArrayList(); | ||
353 | - vehicleFlows_legendData.add("临时车"); | ||
354 | - vehicleFlows_legendData.add("固定车"); | ||
355 | - vehicleFlows.setLegendData(vehicleFlows_legendData); | ||
356 | - vehicleFlows.setxAxisData(xAxisData); | ||
357 | - List<SerieVO> vehicleSeries = Lists.newArrayList(); | ||
358 | - // 固定车 | ||
359 | - SerieVO fixSerieVo = new SerieVO(); | ||
360 | - fixSerieVo.setName("固定车"); | ||
361 | - List<Integer> fixSerieVoData = Lists.newArrayList(); | ||
362 | - // 临时车 | ||
363 | - SerieVO tmpSerieVo = new SerieVO(); | ||
364 | - tmpSerieVo.setName("临时车"); | ||
365 | - List<Integer> tmpSerieVoData = Lists.newArrayList(); | ||
366 | - // 保存上一次的临时车值,当某个时间点没有数据时,则保持和上次一致 | ||
367 | - Integer lastfixFlow = 0; | ||
368 | - Integer lasttmpFlow = 0; | ||
369 | - for (String timestamp : xAxisData) { | ||
370 | - | ||
371 | - if (fixVehicleFlowMap.containsKey(timestamp)) { | ||
372 | - lastfixFlow = fixVehicleFlowMap.get(timestamp).intValue(); | ||
373 | - }else{ | ||
374 | - lastfixFlow =0; | ||
375 | - } | ||
376 | - fixSerieVoData.add(lastfixFlow); | ||
377 | - | ||
378 | - if (tmpVehicleFlowMap.containsKey(timestamp)) { | ||
379 | - lasttmpFlow = tmpVehicleFlowMap.get(timestamp).intValue(); | ||
380 | - }else{ | ||
381 | - lasttmpFlow = 0; | ||
382 | - } | ||
383 | - tmpSerieVoData.add(lasttmpFlow); | ||
384 | - } | ||
385 | - fixSerieVo.setData(fixSerieVoData); | ||
386 | - vehicleSeries.add(fixSerieVo); | ||
387 | - tmpSerieVo.setData(tmpSerieVoData); | ||
388 | - vehicleSeries.add(tmpSerieVo); | ||
389 | - | ||
390 | - vehicleFlows.setSeries(vehicleSeries); | ||
391 | - return vehicleFlows; | ||
392 | - } | ||
393 | - | ||
394 | - public static void main(String[] args) { | ||
395 | - String json="{\"id\":\"1\",\"platform\":\"android\",\"parameter\":{\"drid\":\"177277364\",\"sex\":\"1\",\"type\":\"2\",\"creatorname\":\"Mrw\",\"username\":\"jack\",\"pwd\":\"123456\",\"remark\":\"平板用户\",\"createtime\":\"2017-07-24 23:59:59\"}}"; | ||
396 | - JSONObject object =(JSONObject)JSONObject.parse(json); | ||
397 | - System.out.println(object.get("id")); | ||
398 | - System.out.println(object.get("platform")); | ||
399 | - JSONObject parameter =(JSONObject)object.get("parameter"); | ||
400 | - System.out.println(parameter.get("drid")); | ||
401 | - System.out.println(parameter.get("sex")); | ||
402 | - } | ||
403 | - | 223 | + // 2.调用接口查询当前登录人管辖的停车场名称 |
224 | + UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
225 | + List<String> plNos = userInfo.getOrgIds(); | ||
226 | +// if (CollectionUtils.isEmpty(plNos)) { | ||
227 | +// throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); | ||
228 | +// } | ||
229 | + request.setPlNos(plNos); | ||
230 | + | ||
231 | + logger.info("根据停车场编号获取该停车场今日车流量和车位折线图"); | ||
232 | + Calendar beginTime = Calendar.getInstance(); | ||
233 | + beginTime.setTime(request.getBeginTime()); | ||
234 | +// int year = beginTime.get(Calendar.YEAR); | ||
235 | + Calendar endTime = Calendar.getInstance(); | ||
236 | + endTime.setTime(request.getEndTime()); | ||
237 | + | ||
238 | + Long dayDifference = DateUtil.getTimeDifference(new Timestamp(request.getEndTime().getTime()), | ||
239 | + new Timestamp(request.getBeginTime().getTime())); | ||
240 | + List<String> xAxisData = Lists.newArrayList(); | ||
241 | + request.setBaseRequest(new BaseInfo(1, 0)); | ||
242 | + String dateType = ""; | ||
243 | + | ||
244 | + if (dayDifference == 0L) { | ||
245 | + // 1小时为一个时间戳 | ||
246 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
247 | + int totaltimestampCount = endTime.get(Calendar.HOUR_OF_DAY); | ||
248 | + | ||
249 | + for (int j = 0; j <= totaltimestampCount+1; j++) { | ||
250 | + String hour = String.format("%02d", (j)); | ||
251 | + xAxisData.add(hour+":00"); | ||
252 | + } | ||
253 | + dateType = "HH:mm"; | ||
254 | + LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); | ||
255 | + return new BizResultVO<LineChartVO>().setData(vehicleFlows); | ||
256 | + | ||
257 | + } else { | ||
258 | + // 1天为一个时间戳 | ||
259 | + request.setQueryKind(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
260 | + for (int i = 0; i <=dayDifference.intValue(); i++) { | ||
261 | + Calendar tempDate = Calendar.getInstance(); | ||
262 | + tempDate .setTime(request.getBeginTime()); | ||
263 | + tempDate.add(Calendar.DAY_OF_MONTH, i); | ||
264 | + int beginMonth = tempDate.get(Calendar.MONTH) + 1; | ||
265 | + int beginDay = tempDate.get(Calendar.DAY_OF_MONTH); | ||
266 | + String month = String.format("%02d", (beginMonth)); | ||
267 | + String day = String.format("%02d", (beginDay)); | ||
268 | + xAxisData.add(month + "-" + day); | ||
269 | + } | ||
270 | + dateType = "MM-dd"; | ||
271 | + LineChartVO vehicleFlows = getVehicleFlows(request, xAxisData, dateType); | ||
272 | + return new BizResultVO<LineChartVO>().setData(vehicleFlows); | ||
273 | + | ||
274 | + } | ||
275 | + | ||
276 | + } | ||
277 | + | ||
278 | + private LineChartVO getVehicleFlows(ParkingLotUseStatisticForPageRequest request, List<String> xAxisData, | ||
279 | + String dateType) { | ||
280 | + // 调用后场服务 | ||
281 | + logger.info("调用DUBBO服务入参:" + JSON.toJSONString(request)); | ||
282 | + BizResult<PageBean<ParkingLotUseStatisticDTO>> bizResult = parkingLotStatisticService | ||
283 | + .queryParkingLotUseStatisticForPage(request); | ||
284 | + PageBean<ParkingLotUseStatisticDTO> pageBean = ResultUtils.getBizResultData(bizResult); | ||
285 | + List<ParkingLotUseStatisticDTO> useStatisticDTOs = Lists.newArrayList(); | ||
286 | + if (pageBean != null) { | ||
287 | + useStatisticDTOs = pageBean.getDataList(); | ||
288 | + } | ||
289 | + | ||
290 | + // 保存固定车流量,时间戳和车流量对应关系 | ||
291 | + Map<String, Integer> fixVehicleFlowMap = Maps.newHashMap(); | ||
292 | + // 保存临时车流量,时间戳和车流量对应关系 | ||
293 | + Map<String, Integer> tmpVehicleFlowMap = Maps.newHashMap(); | ||
294 | + // 停车场编号和名称对应关系 | ||
295 | + Map<String, String> parkNameMap = Maps.newHashMap(); | ||
296 | + // 通过停车场,和统计时间分组 | ||
297 | + // Map<String, Map<String, Double>> parkLotMap = Maps.newHashMap(); | ||
298 | + if (!CollectionUtils.isEmpty(useStatisticDTOs)) { | ||
299 | + for (ParkingLotUseStatisticDTO statisticDTO : useStatisticDTOs) { | ||
300 | + String key = statisticDTO.getPlNo(); | ||
301 | + parkNameMap.put(key, statisticDTO.getPlName()); | ||
302 | + String statisBeginTime = DateUtil.getDateString(statisticDTO.getStatisticBeginTime(), dateType); | ||
303 | + // 保存固定车流量和临时车流量 | ||
304 | + fixVehicleFlowMap.put(statisBeginTime, | ||
305 | + (fixVehicleFlowMap.get(statisBeginTime) == null ? 0 : fixVehicleFlowMap.get(statisBeginTime)) | ||
306 | + + statisticDTO.getFixVehicleFlow()); | ||
307 | + tmpVehicleFlowMap.put(statisBeginTime, | ||
308 | + (tmpVehicleFlowMap.get(statisBeginTime) == null ? 0 : tmpVehicleFlowMap.get(statisBeginTime)) | ||
309 | + + statisticDTO.getTmpVehicleFlow()); | ||
310 | + } | ||
311 | + } | ||
312 | + | ||
313 | + // 封装车流量统计 | ||
314 | + LineChartVO vehicleFlows = new LineChartVO(); | ||
315 | + List<String> vehicleFlows_legendData = Lists.newArrayList(); | ||
316 | + vehicleFlows_legendData.add("临时车"); | ||
317 | + vehicleFlows_legendData.add("固定车"); | ||
318 | + vehicleFlows.setLegendData(vehicleFlows_legendData); | ||
319 | + vehicleFlows.setxAxisData(xAxisData); | ||
320 | + List<SerieVO> vehicleSeries = Lists.newArrayList(); | ||
321 | + // 固定车 | ||
322 | + SerieVO fixSerieVo = new SerieVO(); | ||
323 | + fixSerieVo.setName("固定车"); | ||
324 | + List<Integer> fixSerieVoData = Lists.newArrayList(); | ||
325 | + // 临时车 | ||
326 | + SerieVO tmpSerieVo = new SerieVO(); | ||
327 | + tmpSerieVo.setName("临时车"); | ||
328 | + List<Integer> tmpSerieVoData = Lists.newArrayList(); | ||
329 | + // 保存上一次的临时车值,当某个时间点没有数据时,则保持和上次一致 | ||
330 | + Integer lastfixFlow = 0; | ||
331 | + Integer lasttmpFlow = 0; | ||
332 | + for (String timestamp : xAxisData) { | ||
333 | + | ||
334 | + if (fixVehicleFlowMap.containsKey(timestamp)) { | ||
335 | + lastfixFlow = fixVehicleFlowMap.get(timestamp).intValue(); | ||
336 | + } else { | ||
337 | + lastfixFlow = 0; | ||
338 | + } | ||
339 | + fixSerieVoData.add(lastfixFlow); | ||
340 | + | ||
341 | + if (tmpVehicleFlowMap.containsKey(timestamp)) { | ||
342 | + lasttmpFlow = tmpVehicleFlowMap.get(timestamp).intValue(); | ||
343 | + } else { | ||
344 | + lasttmpFlow = 0; | ||
345 | + } | ||
346 | + tmpSerieVoData.add(lasttmpFlow); | ||
347 | + } | ||
348 | + fixSerieVo.setData(fixSerieVoData); | ||
349 | + vehicleSeries.add(fixSerieVo); | ||
350 | + tmpSerieVo.setData(tmpSerieVoData); | ||
351 | + vehicleSeries.add(tmpSerieVo); | ||
352 | + | ||
353 | + vehicleFlows.setSeries(vehicleSeries); | ||
354 | + return vehicleFlows; | ||
355 | + } | ||
356 | + | ||
357 | + public static void main(String[] args) { | ||
358 | + String json | ||
359 | + = "{\"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\"}}"; | ||
360 | + JSONObject object = (JSONObject)JSONObject.parse(json); | ||
361 | + System.out.println(object.get("id")); | ||
362 | + System.out.println(object.get("platform")); | ||
363 | + JSONObject parameter = (JSONObject)object.get("parameter"); | ||
364 | + System.out.println(parameter.get("drid")); | ||
365 | + System.out.println(parameter.get("sex")); | ||
366 | + } | ||
404 | 367 | ||
405 | } | 368 | } |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java
1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage; | 1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage; |
2 | 2 | ||
3 | +import java.util.ArrayList; | ||
3 | import java.util.List; | 4 | import java.util.List; |
4 | import java.util.Map; | 5 | import java.util.Map; |
5 | 6 | ||
@@ -103,19 +104,11 @@ public class ParkLotManageController{ | @@ -103,19 +104,11 @@ public class ParkLotManageController{ | ||
103 | 104 | ||
104 | private List<String> GetParkLotNosByCurrUser(String sysCode) throws Exception { | 105 | private List<String> GetParkLotNosByCurrUser(String sysCode) throws Exception { |
105 | logger.info("根据登录人权限获取停车场列表"); | 106 | logger.info("根据登录人权限获取停车场列表"); |
106 | - List<String> plNos = Lists.newArrayList(); | ||
107 | - //2.调用接口查询当前登录人管辖的停车场名称 | ||
108 | UserInfo userInfo = sessionCommUtil.getUserInfo(); | 107 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
109 | - if(userInfo!=null){ | ||
110 | - TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
111 | - tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
112 | - tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
113 | - tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
114 | - BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest ); | ||
115 | - plNos = ResultUtils.getBizResultData(bizResult); | ||
116 | - }else{ | ||
117 | - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS); | ||
118 | - } | 108 | + List<String> plNos =new ArrayList<>(); |
109 | + if(null !=userInfo){ | ||
110 | + plNos = userInfo.getOrgIds(); | ||
111 | + } | ||
119 | return plNos; | 112 | return plNos; |
120 | } | 113 | } |
121 | } | 114 | } |
src/main/resources/application-prod.properties
src/main/resources/dubbo/dubbo-park-consumer.xml
@@ -138,4 +138,9 @@ | @@ -138,4 +138,9 @@ | ||
138 | version="${spring.dubbo.provider.version}" | 138 | version="${spring.dubbo.provider.version}" |
139 | timeout="30000"/> | 139 | timeout="30000"/> |
140 | 140 | ||
141 | + <!-- 泊位状态同步 --> | ||
142 | + <dubbo:reference id="eqpBerthsService" interface="com.zteits.clouds.api.service.park.EqpBerthsService" | ||
143 | + version="${spring.dubbo.provider.version}" | ||
144 | + timeout="30000"/> | ||
145 | + | ||
141 | </beans> | 146 | </beans> |
142 | \ No newline at end of file | 147 | \ No newline at end of file |