MerchantMissionController.java
7.82 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package cn.com.glsx.merchants.controller;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.mission.*;
import cn.com.glsx.merchants.service.MerchantMissionService;
import cn.com.glsx.merchants.util.Pagination;
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 com.rop.AbstractRopRequest;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
/**
* @ClassName MerchantStaffScoreController
* @Description
* @Author lichongyuan
* @Date 2022/10/14
*/
@Slf4j
@Api("任务管理接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
public class MerchantMissionController {
@Autowired
private MerchantMissionService merchantMissionService;
@Autowired
private Environment environment;
/**
* 任务创建
*
* @param createdMissionRopRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.createMission", needInSession = NeedInSessionType.NO)
@ApiOperation("任务创建")
public RopResponse<Boolean> createMission(CreatedMissionRopRequest createdMissionRopRequest) {
try {
return RopResponse.success(merchantMissionService.createMission(createdMissionRopRequest));
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__createMission__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 任务更新
*
* @param updateMissionRopRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.updateMission", needInSession = NeedInSessionType.NO)
@ApiOperation("任务更新")
public RopResponse<Boolean> updateMission(UpdateMissionRopRequest updateMissionRopRequest) {
try {
return RopResponse.success(merchantMissionService.updateMission(updateMissionRopRequest));
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__updateMission__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 任务状态更新
*
* @param updateStatusMissionRopRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.updateStatusMission", needInSession = NeedInSessionType.NO)
@ApiOperation("任务状态更新")
public RopResponse<Boolean> updateMission(UpdateStatusMissionRopRequest updateStatusMissionRopRequest) {
try {
return RopResponse.success(merchantMissionService.updateStatusMission(updateStatusMissionRopRequest));
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__updateMission__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 任务详情
*
* @param missionDetailRopRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.findMissionDeail", needInSession = NeedInSessionType.NO)
@ApiOperation("任务详情")
public RopResponse<PlatformMerchantMissionInfoResponse> findMissionDeail(MissionDetailRopRequest missionDetailRopRequest) {
try {
return RopResponse.success(merchantMissionService.findMissionDeail(missionDetailRopRequest));
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__findMissionDeail__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 任务列表查询
*
* @param missionDetailRopRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.findMissionList", needInSession = NeedInSessionType.NO)
@ApiOperation("任务列表查询")
public RopResponse<Pagination<PlatformMerchantMissionInfoResponse>> findMissionList(MissionPageRopRequest missionDetailRopRequest) {
try {
Pagination<PlatformMerchantMissionInfoResponse> productResponsePagination = merchantMissionService.findMissionList(missionDetailRopRequest);
return RopResponse.success(productResponsePagination);
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__findMissionList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 员工任务列表查询
*
* @param missionStaffPageRopRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.findStaffMissionPageList", needInSession = NeedInSessionType.NO)
@ApiOperation("员工任务列表查询")
public RopResponse<Pagination<PlatformMerchantStaffMissionDetailResponse>> findStaffMissionPageList(MissionStaffPageRopRequest missionStaffPageRopRequest) {
try {
Pagination<PlatformMerchantStaffMissionDetailResponse> productResponsePagination = merchantMissionService.findStaffMissionPageList(missionStaffPageRopRequest);
return RopResponse.success(productResponsePagination);
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__findStaffMissionPageList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 复制员工任务链接
*
* @param missionStaffLinkRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.getStaffMissionLink", needInSession = NeedInSessionType.NO)
@ApiOperation("复制员工任务链接")
public RopResponse<String> getStaffMissionLink(MissionStaffLinkRequest missionStaffLinkRequest) {
try {
String staffMissionLink = merchantMissionService.getStaffMissionLink(missionStaffLinkRequest);
String context=environment.getProperty("merchants.api.mission.context");
if(!StringUtils.isEmpty(context)){
staffMissionLink=context+" "+staffMissionLink;
}
return RopResponse.success(staffMissionLink);
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__getStaffMissionLink__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询任务总数
*
* @param abstractRopRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.mission.staticMission", needInSession = NeedInSessionType.NO)
@ApiOperation("查询任务总数")
public RopResponse<PlatformMerchantMissionListResponse> staticMission(AbstractRopRequest abstractRopRequest) {
try {
return RopResponse.success(merchantMissionService.staticMission(abstractRopRequest));
} catch (RpcServiceException e) {
log.info("=======MerchantMissionController__invoke__staticMission__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}