MerchantMissionService.java
6.11 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
92
93
94
95
96
97
98
99
100
101
102
package cn.com.glsx.merchants.service;
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.merchants.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.request.mission.*;
import cn.com.glsx.merchants.util.Pagination;
import cn.com.glsx.stoassistant.model.request.mission.PlatformMerchantMissionInfoRequest;
import cn.com.glsx.stoassistant.model.request.mission.PlatformMerchantMissionListRequest;
import cn.com.glsx.stoassistant.model.request.mission.PlatformMerchantStaffMissionRequest;
import cn.com.glsx.stoassistant.model.response.mission.PlatformMerchantMissionInfoResponse;
import cn.com.glsx.stoassistant.model.response.mission.PlatformMerchantMissionListResponse;
import cn.com.glsx.stoassistant.model.response.mission.PlatformMerchantStaffMissionDetailResponse;
import cn.com.glsx.stoassistant.remote.PlatformMerchantMissionRemote;
import cn.com.glsx.stoassistant.remote.PlatformMerchantStaffMissionRemote;
import com.rop.AbstractRopRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MerchantMissionService {
@Autowired
private PlatformMerchantMissionRemote platformMerchantMissionRemote;
@Autowired
private PlatformMerchantStaffMissionRemote platformMerchantStaffMissionRemote;
public Boolean createMission(CreatedMissionRopRequest createdMissionRopRequest) {
PlatformMerchantMissionInfoRequest param = ConvertRequest.convertRequest(createdMissionRopRequest, new PlatformMerchantMissionInfoRequest());
RpcResponse<Boolean> rpcResponse = platformMerchantMissionRemote.createMission(param);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public Boolean updateMission(UpdateMissionRopRequest updateMissionRopRequest) {
PlatformMerchantMissionInfoRequest param = ConvertRequest.convertRequest(updateMissionRopRequest, new PlatformMerchantMissionInfoRequest());
RpcResponse<Boolean> rpcResponse = platformMerchantMissionRemote.updateMission(param);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public Boolean updateStatusMission(UpdateStatusMissionRopRequest updateStatusMissionRopRequest) {
PlatformMerchantMissionInfoRequest param = ConvertRequest.convertRequest(updateStatusMissionRopRequest, new PlatformMerchantMissionInfoRequest());
RpcResponse<Boolean> rpcResponse = platformMerchantMissionRemote.updateStatusMission(param);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public PlatformMerchantMissionInfoResponse findMissionDeail(MissionDetailRopRequest missionDetailRopRequest) {
PlatformMerchantMissionInfoRequest param = ConvertRequest.convertRequest(missionDetailRopRequest, new PlatformMerchantMissionInfoRequest());
RpcResponse<PlatformMerchantMissionInfoResponse> rpcResponse = platformMerchantMissionRemote.findMissionDeail(param);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public Pagination<PlatformMerchantMissionInfoResponse> findMissionList(MissionPageRopRequest missionDetailRopRequest) {
RpcPagination<PlatformMerchantMissionListRequest> param = ConvertRequest.convertPage(missionDetailRopRequest, new PlatformMerchantMissionListRequest());
RpcResponse<RpcPagination<PlatformMerchantMissionInfoResponse>> rpcResponse = platformMerchantMissionRemote.findMissionList(param);
if (rpcResponse.isSuccess()) {
return ConvertResponse.convertPage(rpcResponse.getResult(), PlatformMerchantMissionInfoResponse.class);
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public Pagination<PlatformMerchantStaffMissionDetailResponse> findStaffMissionPageList(MissionStaffPageRopRequest missionDetailRopRequest) {
RpcPagination<PlatformMerchantStaffMissionRequest> param = ConvertRequest.convertPage(missionDetailRopRequest, new PlatformMerchantStaffMissionRequest());
RpcResponse<RpcPagination<PlatformMerchantStaffMissionDetailResponse>> rpcResponse = platformMerchantStaffMissionRemote.findStaffMissionPageList(param);
if (rpcResponse.isSuccess()) {
return ConvertResponse.convertPage(rpcResponse.getResult(), PlatformMerchantStaffMissionDetailResponse.class);
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public String getStaffMissionLink(MissionStaffLinkRequest missionStaffLinkRequest) {
PlatformMerchantStaffMissionRequest param = ConvertRequest.convertRequest(missionStaffLinkRequest, new PlatformMerchantStaffMissionRequest());
RpcResponse<String> rpcResponse = platformMerchantStaffMissionRemote.getStaffMissionLink(param);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
public PlatformMerchantMissionListResponse staticMission(AbstractRopRequest abstractRopRequest) {
RpcResponse<PlatformMerchantMissionListResponse> rpcResponse = platformMerchantMissionRemote.staticMission();
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
}