ParkHeatmapServiceImpl.java 3.11 KB
package com.zteits.park.biz;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaoleilu.hutool.util.CollectionUtil;
import com.zteits.clouds.api.apibase.bean.BizResult;
import com.zteits.clouds.api.dto.govclouds.dto.ParkinglotHeatmapDayDTO;
import com.zteits.clouds.api.dto.govclouds.dto.ParkinglotHeatmapHourDTO;
import com.zteits.clouds.api.dto.govclouds.param.QueryHeatmapByDateRequest;
import com.zteits.clouds.api.service.govclouds.ParkHeatmapService;
import com.zteits.park.biz.berths.query.ParkFreeBerthQueryServiceImpl;
import com.zteits.park.dao.ParkinglotHeatmapDayDao;
import com.zteits.park.dao.ParkinglotHeatmapHourDao;
import com.zteits.park.domain.ParkinglotHeatmapDay;
import com.zteits.park.domain.ParkinglotHeatmapHour;
/**
 * 
 * .<br/>
 * 
 * Copyright: Copyright (c) 2017  zteits
 * 
 * @ClassName: ParkHeatmapServiceImpl
 * @Description: 
 * @version: v1.0.0
 * @author: xiejianpeng
 * @date: 2017年7月11日 上午11:01:26
 * Modification History:
 * Date             Author          Version            Description
 *---------------------------------------------------------*
 * 2017年7月11日      xiejianpeng           v1.0.0               创建
 */
@Service("com.zteits.park.biz.ParkHeatmapServiceImpl")
public class ParkHeatmapServiceImpl implements ParkHeatmapService{

	private static final Logger logger = LoggerFactory.getLogger(ParkFreeBerthQueryServiceImpl.class);
	
	@Autowired
	private ParkinglotHeatmapHourDao parkinglotHeatmapHourDao;
	
	@Autowired
	private ParkinglotHeatmapDayDao parkinglotHeatmapDayDao;
	
	@Override
	public BizResult<List<ParkinglotHeatmapHourDTO>> queryParkHeatmapByHour(QueryHeatmapByDateRequest request) {
		List<ParkinglotHeatmapHour>  heatmapList = parkinglotHeatmapHourDao.queryParkHeatmapByHour(
				request.getProvId(),request.getCityId(),request.getQueryDate());
		List<ParkinglotHeatmapHourDTO> heatmapDTOList = new ArrayList<ParkinglotHeatmapHourDTO>();
		if(CollectionUtil.isNotEmpty(heatmapList)){
			for(ParkinglotHeatmapHour heatmapHour:heatmapList){
				ParkinglotHeatmapHourDTO heatmapHourDTO = new ParkinglotHeatmapHourDTO();
				BeanUtils.copyProperties(heatmapHour, heatmapHourDTO);
				heatmapDTOList.add(heatmapHourDTO);
			}
		}
		return new BizResult<>(heatmapDTOList);
	}

	@Override
	public BizResult<List<ParkinglotHeatmapDayDTO>> queryParkHeatmapByDay(QueryHeatmapByDateRequest request) {
		List<ParkinglotHeatmapDay>  heatmapList = parkinglotHeatmapDayDao.queryParkHeatmapByDay(
				request.getProvId(),request.getCityId(),request.getQueryDate());
		List<ParkinglotHeatmapDayDTO> heatmapDTOList = new ArrayList<ParkinglotHeatmapDayDTO>();
		if(CollectionUtil.isNotEmpty(heatmapList)){
			for(ParkinglotHeatmapDay heatmapday:heatmapList){
				ParkinglotHeatmapDayDTO heatmapDayDTO = new ParkinglotHeatmapDayDTO();
				BeanUtils.copyProperties(heatmapday, heatmapDayDTO);
				heatmapDTOList.add(heatmapDayDTO);
			}
		}
		return new BizResult<>(heatmapDTOList);
	}

}