BillingLogServiceImpl.java
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.zteits.bill.biz.billlog;
import org.apache.commons.lang3.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.zteits.bill.dao.billlog.BillingLogDao;
import com.zteits.bill.domain.TBillingLogs;
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.billinglog.dto.BillingLogDTO;
import com.zteits.clouds.api.dto.bill.billinglog.param.BillingLogByIdQueryReq;
import com.zteits.clouds.api.service.bill.billlog.BillingLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Copyright: Copyright (c) 2017 zteits
*
* @ClassName: com.zteits.bill.biz.billlog
* @Description:
* @version: v1.0.0
* @author: atao
* @date: 2017/11/13 下午3:36
* Modification History:
* Date Author Version Description
* ---------------------------------------------------------*
* 2017/11/13 atao v1.0.0 创建
*/
@Component
public class BillingLogServiceImpl implements BillingLogService {
@Autowired
private BillingLogDao billingLogDao;
@Override
public BizResult<BillingLogDTO> queryBillingLogById(BillingLogByIdQueryReq req) {
if (StringUtils.isBlank(req.getId())) {
throw new BizException(ErrorType.PARAMM_NULL, "计费日志ID");
}
TBillingLogs billingLogs = billingLogDao.queryBillingLogById(req.getId());
if (StringUtils.isBlank(billingLogs.getLogDetail())) {
throw new BizException(ErrorType.BIZ_ERROR, "计费日志不存在");
}
BillingLogDTO dto = JSONObject.parseObject(billingLogs.getLogDetail(), BillingLogDTO.class);
return new BizResult<>(dto);
}
}