DataCustomerRemoteImpl.java
2.88 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package cn.com.glsx.entmicro.remote;
import cn.com.glsx.entmicro.Enum.BusinessExceptionEnum;
import cn.com.glsx.entmicro.dto.DataGroupCustomerDTO;
import cn.com.glsx.entmicro.dto.DataMerchantCustomerDTO;
import cn.com.glsx.entmicro.dto.DataTotalCustomerDTO;
import cn.com.glsx.entmicro.dto.request.DataMerhcantCustomerRequest;
import cn.com.glsx.entmicro.service.DataCustomerService;
import cn.com.glsx.entmicro.service.drainage.DracScrmStatisticService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.alibaba.dubbo.config.annotation.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author wangxw
* @version 1.0.0
* @ClassName DataCustomerRemoteImpl.java
* @description: ${description}
* @createTime 2021年11月21日 16:35:00
*/
@Slf4j
@Component
@Service(version = "1.0.0", protocol = "dubbo", timeout = 10000)
public class DataCustomerRemoteImpl implements DataCustomerRemote {
@Autowired
private DataCustomerService dataCustomerService;
@Autowired
private DracScrmStatisticService dracScrmStatisticService;
@Override
public RpcResponse<DataTotalCustomerDTO> statisticsCustomerTotalCount(Integer merchantId) {
RpcAssert.assertNotNull(merchantId, DefaultErrorEnum.PARAMETER_NULL, "params must not be null");
DataTotalCustomerDTO dataTotalCustomerDTO = new DataTotalCustomerDTO();
try {
dataTotalCustomerDTO = dataCustomerService.statisticCustomerTotalCount(merchantId);
} catch (Exception e) {
log.error("statisticsCustomerTotalCount merchantId:{} is exception.", e.getMessage());
throw new RpcServiceException(BusinessExceptionEnum.CUSTOMER_TOTAL_COUNT_ERROR);
}
return RpcResponse.success(dataTotalCustomerDTO);
}
@Override
public RpcResponse<DataGroupCustomerDTO> statisticsCustomerGroupCount(Integer merchantId) {
RpcAssert.assertNotNull(merchantId, DefaultErrorEnum.PARAMETER_NULL, "params must not be null");
DataGroupCustomerDTO customerTypeCount = new DataGroupCustomerDTO();
try {
customerTypeCount = dracScrmStatisticService.findCustomerTypeCount(merchantId);
} catch (Exception e) {
log.error("statisticsCustomerTotalCount merchantId:{} is exception.", e.getMessage());
throw new RpcServiceException(BusinessExceptionEnum.CUSTOMER_GROUP_COUNT_ERROR);
}
return RpcResponse.success(customerTypeCount);
}
@Override
public RpcResponse<List<DataMerchantCustomerDTO>> statisticsMerchantCustomer(DataMerhcantCustomerRequest dataMerhcantCustomerRequest) {
return null;
}
}