package com.zteits.park.biz.incomecalculation; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import com.github.pagehelper.PageInfo; import com.xiaoleilu.hutool.date.DateTime; import com.zteits.clouds.api.apibase.bean.BizResult; import com.zteits.clouds.api.apibase.bean.PageBean; import com.zteits.clouds.api.apibase.constants.ErrorType; import com.zteits.clouds.api.apibase.exception.BizException; import com.zteits.clouds.api.dto.order.parkorder.dto.IncomeCalculationDTO; import com.zteits.clouds.api.dto.order.parkorder.param.QueryIncomeCalculationForPageReq; import com.zteits.clouds.api.dto.park.dto.IncomeCalculationExcelDTO; import com.zteits.clouds.api.service.park.IncomeCalculationStaticService; import com.zteits.park.dao.InComeCalculationStaticDao; import com.zteits.park.pagepager.PageBeanUtil; /** * Copyright: Copyright (c) 2017 zteits * * @ClassName: com.zteits.park.biz.incomecalculation * @Description: * @version: v1.0.0 * @author: atao * @date: 2017/12/26 下午5:37 * Modification History: * Date Author Version Description * ---------------------------------------------------------* * 2017/12/26 atao v1.0.0 创建 */ @Component public class IncomeCalculationStaticServiceImpl implements IncomeCalculationStaticService { @Autowired private InComeCalculationStaticDao inComeCalculationStaticDao; @Override public BizResult> exportStaticIncomeExcelByNum( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } if (null == req.getGroupType()){ req.setGroupType(3); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao.exportStaticIncomeExcelByNum(req); PageBean pageBean = new PageBean<>(); if(dtoPageInfo!=null){ PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); } return new BizResult<>(pageBean); } @Override public BizResult> exportStaticIncomeExcelByNumForAreaBlock( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao .exportStaticIncomeExcelByNumForAreaBlock(req); PageBean pageBean = new PageBean<>(); PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); return new BizResult<>(pageBean); } @Override public BizResult> getIncomeCalculationDataOfSummationByTime( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao .getIncomeCalculationDataOfSummationByTime(req); PageBean pageBean = new PageBean<>(); if (null != pageBean) { PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); } return new BizResult<>(pageBean); } @Override public BizResult> getIncomeCalculationDataOfAreaByTime( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao .getIncomeCalculationDataOfAreaByTime(req); PageBean pageBean = new PageBean<>(); if (null != pageBean) { PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); } return new BizResult<>(pageBean); } @Override public BizResult> getIncomeCalculationDataOfPlByTime( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao .getIncomeCalculationDataOfPlByTime(req); PageBean pageBean = new PageBean<>(); if (null != pageBean) { PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); } return new BizResult<>(pageBean); } @Override public BizResult> staticIncomeByNumForNewColumnChart( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); List list = inComeCalculationStaticDao.staticIncomeByNumForNewColumnChart(req); return new BizResult<>(list); } @Override public BizResult> staticIncomeByNumForNewLineChart( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); List list = inComeCalculationStaticDao.staticIncomeByNumForNewLineChart(req); return new BizResult<>(list); } @Override public BizResult> exportStaticIncomeExcelByNumForAllGroupByPlType( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao .exportStaticIncomeExcelByNumForAllGroupByPlType(req); PageBean pageBean = new PageBean<>(); if (null != pageBean) { PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); } return new BizResult<>(pageBean); } @Override public BizResult> getSummationIncomeByTimeOfArea( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao.getSummationIncomeByTimeOfArea( req); PageBean pageBean = new PageBean<>(); if (null != pageBean) { PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); } return new BizResult<>(pageBean); } @Override public BizResult> getSummationIncomeByTimeOfPl( QueryIncomeCalculationForPageReq req) { if (CollectionUtils.isEmpty(req.getPlNos())) { throw new BizException(ErrorType.PARAMM_NULL, "停车场编号"); } req.setBeginTime(new DateTime(req.getBeginTime())); req.setEndTime(new DateTime(req.getEndTime())); PageInfo dtoPageInfo = inComeCalculationStaticDao.getSummationIncomeByTimeOfPl(req); PageBean pageBean = new PageBean<>(); if (null != pageBean) { PageBeanUtil.copyProperties(dtoPageInfo, pageBean, IncomeCalculationExcelDTO.class); } return new BizResult<>(pageBean); } }