BillingPrepaymentServiceImpl.java 2.25 KB
package com.zteits.bill.biz.billingprement;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import com.zteits.bill.dao.billprepayment.BillingPrepaymentDao;
import com.zteits.clouds.api.apibase.bean.BizResult;
import com.zteits.clouds.api.apibase.constants.ErrorType;
import com.zteits.clouds.api.apibase.exception.BizException;
import com.zteits.clouds.api.dto.bill.billprepayment.dto.BillingPrepaymentDTO;
import com.zteits.clouds.api.dto.bill.billprepayment.param.BillingPrepaymentInfoQueryReq;
import com.zteits.clouds.api.dto.bill.billprepayment.param.BillingPrepaymentQueryReq;
import com.zteits.clouds.api.service.bill.billprepayment.BillingPrepaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Copyright: Copyright (c) 2017  zteits
 *
 * @ClassName: com.zteits.bill.biz.billingprement
 * @Description:
 * @version: v1.0.0
 * @author: atao
 * @date: 2017/11/15   下午7:15
 * Modification History:
 * Date         Author          Version      Description
 * ---------------------------------------------------------*
 * 2017/11/15      atao          v1.0.0          创建
 */
@Component
public class BillingPrepaymentServiceImpl implements BillingPrepaymentService {
    @Autowired
    private BillingPrepaymentDao billingPrepaymentDao;

    @Override
    public BizResult<BillingPrepaymentDTO> queryBillingPrepayment(BillingPrepaymentQueryReq req) {
        if (StringUtils.isBlank(req.getPlNo())) {
            throw new BizException(ErrorType.PARAMM_NULL, "停车场编号");
        }

        if (null == req.getCarType()) {
            throw new BizException(ErrorType.PARAMM_NULL, "车辆类型");
        }

        BillingPrepaymentDTO dto = billingPrepaymentDao.queryBillingPrepayment(req.getPlNo(), req.getCarType());

        return new BizResult<>(dto);
    }

    @Override
    public BizResult<List<BillingPrepaymentDTO>> queryBillingPrepaymentInfo(BillingPrepaymentInfoQueryReq req) {
        if (StringUtils.isBlank(req.getPlNo())) {
            throw new BizException(ErrorType.PARAMM_NULL, "停车场编号");
        }

        List<BillingPrepaymentDTO> dtos = billingPrepaymentDao.queryBillingPrepaymentInfo(req.getPlNo());
        return new BizResult<>(dtos);
    }
}