SopTaskCustomerService.java
3.62 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.stoassistant.service.sop;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.marketing.model.request.sop.SopCustomerPageRpcRequest;
import cn.com.glsx.marketing.model.request.sop.SopStageUpdateRpcRequest;
import cn.com.glsx.marketing.model.request.sop.SopTaskCustomerRequest;
import cn.com.glsx.marketing.model.response.sop.SopCustomerArchivesRpcResponse;
import cn.com.glsx.marketing.model.response.sop.SopCustomerRpcResponse;
import cn.com.glsx.marketing.remote.sop.SopTaskCustomerRemote;
import cn.com.glsx.stoassistant.convert.ConvertRequest;
import cn.com.glsx.stoassistant.convert.ConvertResponse;
import cn.com.glsx.stoassistant.request.sop.CustomerIdRopRequest;
import cn.com.glsx.stoassistant.request.sop.SaveSopTaskRopRequest;
import cn.com.glsx.stoassistant.request.sop.SopCustomerPageRopRequest;
import cn.com.glsx.stoassistant.request.sop.SopStageUpdateRopRequest;
import cn.com.glsx.stoassistant.response.sop.SopCustomerArchivesResponse;
import cn.com.glsx.stoassistant.response.sop.SopCustomerRopResponse;
import cn.com.glsx.stoassistant.utils.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class SopTaskCustomerService {
@Autowired
private SopTaskCustomerRemote sopTaskCustomerRemote;
public Boolean saveSopTaskCustomer(SaveSopTaskRopRequest request) {
RpcResponse<Boolean> rpcResponse = sopTaskCustomerRemote.saveSopTaskCustomer(request.getRequestList());
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
public Pagination<SopCustomerRopResponse> sopTaskCustomerPage(SopCustomerPageRopRequest request) {
SopCustomerPageRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new SopCustomerPageRpcRequest());
RpcResponse<RpcPagination<SopCustomerRpcResponse>> rpcResponse = sopTaskCustomerRemote.sopTaskCustomerPage(rpcRequest);
if (rpcResponse.isSuccess()) {
return ConvertResponse.convertPage(rpcResponse.getResult(),SopCustomerRopResponse.class);
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
public List<SopCustomerArchivesResponse> getCustomerArchives(CustomerIdRopRequest request) {
SopTaskCustomerRequest rpcRequest = ConvertRequest.convertRequest(request, new SopTaskCustomerRequest());
RpcResponse<List<SopCustomerArchivesRpcResponse>> rpcResponse = sopTaskCustomerRemote.sopCustomerArchives(rpcRequest);
if (rpcResponse.isSuccess()) {
return ConvertResponse.convertList(rpcResponse.getResult(),SopCustomerArchivesResponse.class);
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
public Boolean changeCustomerStage(SopStageUpdateRopRequest request) {
SopStageUpdateRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new SopStageUpdateRpcRequest());
RpcResponse<Boolean> rpcResponse = sopTaskCustomerRemote.changeCustomerStage(rpcRequest);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
}