Commit 5a8b8a616186f413c628da2a8aa38511d3231f70
1 parent
18d1bfad
分析决策-泊位周转率
Showing
1 changed file
with
115 additions
and
0 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/AnalysisController.java
0 → 100644
| 1 | +package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; | ||
| 2 | + | ||
| 3 | +import java.util.Calendar; | ||
| 4 | +import java.util.List; | ||
| 5 | + | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.beans.factory.annotation.Value; | ||
| 10 | +import org.springframework.stereotype.Controller; | ||
| 11 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 14 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 15 | + | ||
| 16 | +import com.clouds.common.web.BizController; | ||
| 17 | +import com.clouds.common.web.vo.BizResultVO; | ||
| 18 | +import com.clouds.common.web.vo.EasyUIDataGridVO; | ||
| 19 | +import com.zteits.clouds.api.apibase.bean.BizResult; | ||
| 20 | +import com.zteits.clouds.api.apibase.bean.PageBean; | ||
| 21 | +import com.zteits.clouds.api.apibase.constants.ErrorType; | ||
| 22 | +import com.zteits.clouds.api.apibase.exception.BizException; | ||
| 23 | +import com.zteits.clouds.api.dto.clouds.param.BerthTurnOverQueryRequest; | ||
| 24 | +import com.zteits.clouds.api.dto.park.dto.BerthTurnOverCountDTO; | ||
| 25 | +import com.zteits.clouds.api.service.park.EqpBerthsService; | ||
| 26 | +import com.zteits.irain.portal.constant.ParkConstant; | ||
| 27 | + | ||
| 28 | +import io.swagger.annotations.Api; | ||
| 29 | +import io.swagger.annotations.ApiOperation; | ||
| 30 | + | ||
| 31 | +/** | ||
| 32 | + * | ||
| 33 | + * | ||
| 34 | + * Copyright: Copyright (c) 2017 zteits | ||
| 35 | + * | ||
| 36 | + * @ClassName: AnalysisController.java | ||
| 37 | + * @Description: | ||
| 38 | + * @version: v1.0.0 | ||
| 39 | + * @author: wangfei | ||
| 40 | + * @date: 2017年8月28日 下午5:45:21 | ||
| 41 | + * Modification History: | ||
| 42 | + * Date Author Version Description | ||
| 43 | + *---------------------------------------------------------* | ||
| 44 | + * 2017年8月28日 wangfei v1.0.0 创建 | ||
| 45 | + */ | ||
| 46 | +@Api("停车场云平台 分析决策 泊位周转率") | ||
| 47 | +@Controller | ||
| 48 | +@RequestMapping("/analysis") | ||
| 49 | +public class AnalysisController extends BizController { | ||
| 50 | + private static final Logger logger = LoggerFactory.getLogger(AnalysisController.class); | ||
| 51 | + @Value("${project.syscode}") | ||
| 52 | + private String sysCode; | ||
| 53 | + @Autowired | ||
| 54 | + private EqpBerthsService eqpBerthsService; | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * | ||
| 58 | + * @param requestObject | ||
| 59 | + * @return | ||
| 60 | + */ | ||
| 61 | + @ApiOperation("泊位周转率-折线图") | ||
| 62 | + @PostMapping("queryTurnOverForMap") | ||
| 63 | + @ResponseBody | ||
| 64 | + public BizResultVO<List<BerthTurnOverCountDTO>> queryTurnOverForMap(@RequestBody BerthTurnOverQueryRequest | ||
| 65 | + requestObject) { | ||
| 66 | + requestObject.setSysCode(sysCode); | ||
| 67 | + Calendar beginc = Calendar.getInstance(); | ||
| 68 | + beginc.setTime(requestObject.getBeginTime()); | ||
| 69 | + int beginYear = beginc.get(Calendar.YEAR); | ||
| 70 | + int beginMonth = beginc.get(Calendar.MONTH) + 1; | ||
| 71 | + int beginDay = beginc.get(Calendar.DAY_OF_MONTH); | ||
| 72 | + | ||
| 73 | + Calendar endc = Calendar.getInstance(); | ||
| 74 | + endc.setTime(requestObject.getEndTime()); | ||
| 75 | + int endYear = endc.get(Calendar.YEAR); | ||
| 76 | + int endMonth = endc.get(Calendar.MONTH) + 1; | ||
| 77 | + int endDay = endc.get(Calendar.DAY_OF_MONTH); | ||
| 78 | + | ||
| 79 | + if (beginYear == endYear && beginMonth == endMonth && beginDay == endDay) { | ||
| 80 | + // 2表示按每小时统计 | ||
| 81 | + requestObject.setTimeType(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1HOUR); | ||
| 82 | + } else { | ||
| 83 | + // 3表示按每天统计 | ||
| 84 | + requestObject.setTimeType(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
| 85 | + } | ||
| 86 | + BizResult<List<BerthTurnOverCountDTO>> respondObject = eqpBerthsService.queryBerthTurnOverForMap(requestObject); | ||
| 87 | + return new BizResultVO<>(respondObject); | ||
| 88 | + } | ||
| 89 | + /** | ||
| 90 | + * | ||
| 91 | + * @param requestObject | ||
| 92 | + * @return | ||
| 93 | + * @throws IllegalAccessException | ||
| 94 | + * @throws InstantiationException | ||
| 95 | + */ | ||
| 96 | + @ApiOperation("泊位周转率-详细记录") | ||
| 97 | + @PostMapping("berthTurnOverDetail") | ||
| 98 | + @ResponseBody | ||
| 99 | + public BizResultVO<EasyUIDataGridVO<BerthTurnOverCountDTO>> berthTurnOverDetail(@RequestBody BerthTurnOverQueryRequest | ||
| 100 | + requestObject) throws InstantiationException, IllegalAccessException { | ||
| 101 | + requestObject.setSysCode(sysCode); | ||
| 102 | + if (null == requestObject.getBeginTime() || null == requestObject.getEndTime()) { | ||
| 103 | + throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | ||
| 104 | + } | ||
| 105 | + // 按每天统计 | ||
| 106 | + requestObject.setTimeType(ParkConstant.ParkingLotUseStatistic.StatisticType.PER1DAY); | ||
| 107 | + BizResult<PageBean<BerthTurnOverCountDTO>> respondObject = eqpBerthsService.queryBerthTurnOverDetail(requestObject); | ||
| 108 | + return returnJqGridData(respondObject,BerthTurnOverCountDTO.class); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + | ||
| 115 | +} |