TdCCustRuleServiceImpl.java
1.99 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.pay.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 com.alibaba.fastjson.JSONObject;
import com.clouds.common.utils.ListCopyUtil;
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.pay.TdCCustRuleDTO;
import com.zteits.clouds.api.dto.pay.param.TdCCustRuleRequest;
import com.zteits.clouds.api.service.pay.TdCCustRuleService;
import com.zteits.pay.dao.TdCCustRuleDao;
import com.zteits.pay.domain.TdCCustRule;
import org.springframework.stereotype.Service;
@Service("com.zteits.pay.biz.TdCCustRuleServiceImpl")
public class TdCCustRuleServiceImpl implements TdCCustRuleService {
private static final Logger logger = LoggerFactory.getLogger(TdCCustRuleServiceImpl.class);
@Autowired
private TdCCustRuleDao tdCCustRuleDao;
@Override
public BizResult<List<TdCCustRuleDTO>> queryRuleByCondition(TdCCustRuleRequest request) {
logger.info("查询卡劵、积分规则请求入参:request={}"+ JSONObject.toJSONString(request));
List<TdCCustRuleDTO> tdCCustRuleDTOs = new ArrayList<>();
if(null == request){
throw new BizException(ErrorType.PARAMM_NULL, "入参不能为空!");
}
if(null == request.getRuleType()){
throw new BizException(ErrorType.PARAMM_NULL, "规则类型不能为空!");
}
TdCCustRule record = new TdCCustRule();
BeanUtils.copyProperties(request, record);
List<TdCCustRule> tdCCustRules = tdCCustRuleDao.queryRuleByCondition(record);
if(null != tdCCustRules){
ListCopyUtil.listCopyProperties(tdCCustRules, tdCCustRuleDTOs, TdCCustRuleDTO.class);
}
logger.info("查询卡劵、积分规则请求响应:={}"+ JSONObject.toJSONString(tdCCustRuleDTOs));
return new BizResult<List<TdCCustRuleDTO>>(tdCCustRuleDTOs);
}
}