CustomerReportService.java
3.97 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package cn.com.glsx.entmicro.service;
import cn.com.glsx.entmicro.convert.ConvertRequest;
import cn.com.glsx.entmicro.model.request.CustomerReportSearchRpcRequest;
import cn.com.glsx.entmicro.model.response.CustomerReportVO;
import cn.com.glsx.entmicro.model.response.GroupCustomerReportVO;
import cn.com.glsx.entmicro.remote.CustomerReportRemote;
import cn.com.glsx.entmicro.request.customer.CustomerReportSearchRopRequest;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
@Slf4j
public class CustomerReportService {
@Autowired
private CustomerReportRemote customerReportRemote;
/**
* 获取集团客户报告数据
*
* @param request
* @return
*/
public RpcResponse<GroupCustomerReportVO> getGroupCustomerReport(CustomerReportSearchRopRequest request) {
CustomerReportSearchRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new CustomerReportSearchRpcRequest());
RpcResponse<GroupCustomerReportVO> response = customerReportRemote.merchantGroupCustomerReportQuery(rpcRequest);
log.info("rop集团客户报告数据:{}", response);
if (null != response && response.isSuccess()) {
return response;
}
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
/**
* 获取门店客户报告数据
*
* @param request
* @return
*/
public RpcResponse<CustomerReportVO> getMerchantCustomerReport(CustomerReportSearchRopRequest request) {
CustomerReportSearchRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new CustomerReportSearchRpcRequest());
RpcResponse<CustomerReportVO> response = customerReportRemote.merchantCustomerReportQuery(rpcRequest);
log.info("rop门店客户报告数据:{}", response);
if (null != response && response.isSuccess()) {
return response;
}
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
/**
* 脚本 - 手动统计指定商户所有日期客户报告
*
* @param request
*/
public RpcResponse<Boolean> handleStatisticsCustomerReportByAllDays(CustomerReportSearchRopRequest request) {
CustomerReportSearchRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new CustomerReportSearchRpcRequest());
RpcResponse<Boolean> flag = customerReportRemote.handleStatisticsCustomerReportByAllDays(rpcRequest);
log.info("手动统计" + request.getMerchantId() + "商户所有日期客户报告脚本已执行");
return flag;
}
/**
* 脚本 - 手动统计所有商户所有日期客户报告
*
* @param request
*/
public RpcResponse<Boolean> handleStatisticsCustomerReportByAllMerchant(CustomerReportSearchRopRequest request) {
CustomerReportSearchRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new CustomerReportSearchRpcRequest());
RpcResponse<Boolean> flag = customerReportRemote.handleStatisticsCustomerReportByAllMerchant(rpcRequest);
log.info("手动统计所有商户所有日期客户报告脚本已执行");
return flag;
}
/**
* 脚本 - 手动推送特定日期的周报/月报
*
* @param request
*/
public RpcResponse<Boolean> handlePushWeeklyOrMonthlyReport(CustomerReportSearchRopRequest request) {
CustomerReportSearchRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new CustomerReportSearchRpcRequest());
RpcResponse<Boolean> flag = customerReportRemote.handlePushWeeklyOrMonthlyReport(rpcRequest);
log.info("手动推送" + request.getStartDate() + "至" + request.getEndDate() + "的周报/月报脚本已执行");
return flag;
}
}