BusinessAssistantMerchantController.java
9 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
package cn.com.glsx.busassistant.controller;
import cn.com.glsx.busassistant.request.activity.ActivityIdRequest;
import cn.com.glsx.busassistant.request.merchant.CoProductRopRequest;
import cn.com.glsx.busassistant.request.merchant.*;
import cn.com.glsx.busassistant.request.messageBox.MessageBoxCheckRopRequest;
import cn.com.glsx.busassistant.request.messageBox.MessageBoxPageRopRequest;
import cn.com.glsx.busassistant.response.merchant.MerchantBaseRopResponse;
import cn.com.glsx.busassistant.response.merchant.MerchantBySceneRopResponse;
import cn.com.glsx.busassistant.response.merchant.MerchantPageRopResponse;
import cn.com.glsx.busassistant.response.merchant.MerchantRopResponse;
import cn.com.glsx.busassistant.response.messageBox.MessageBoxPageRopResponse;
import cn.com.glsx.busassistant.service.BusiAssistantMerchantService;
import cn.com.glsx.busassistant.util.Pagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.scrm.shopmall.dto.stoassistant.NewestActivityReportDTO;
import cn.com.glsx.scrm.shopmall.remote.ActivityReportRemote;
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.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @Author xiongzs
* @Description 生意助手-门店接口
* @date 2022/10/14 13:51
* @Version 1.0
*/
@Slf4j
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
@Api("生意助手-门店")
public class BusinessAssistantMerchantController {
@Autowired
private BusiAssistantMerchantService merchantService;
@Autowired
private ActivityReportRemote activityReportRemote;
@ApiOperation("申请门店列表")
@ServiceMethod(method = "scrm.api.busassistant.merchant.page", needInSession = NeedInSessionType.YES)
public RopResponse<Pagination<MerchantPageRopResponse>> getApplyMerchantPage(MerchantPageRopRequest ropRequest) {
try {
return RopResponse.success(merchantService.getApplyMerchantPage(ropRequest));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__MerchantPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("申请门店")
@ServiceMethod(method = "scrm.api.busassistant.merchant.apply", needInSession = NeedInSessionType.YES)
public RopResponse<Boolean> addApplyMerchant(MerchantApplyRopRequest ropRequest) {
try {
merchantService.addApplyMerchant(ropRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__MerchantApply__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("确认申请门店")
@ServiceMethod(method = "scrm.api.busassistant.merchant.confirm", needInSession = NeedInSessionType.YES)
public RopResponse<Boolean> confirmMerchant(MerchantConfirmRopRequest ropRequest) {
try {
merchantService.confirmMerchant(ropRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__Merchantconfirm__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("根据场景查询已开通的商户")
@ServiceMethod(method = "scrm.api.busassistant.merchant.byscene", needInSession = NeedInSessionType.NO)
public RopResponse<List<MerchantBySceneRopResponse>> findMerchantByScene(MerchantBySceneRopRequest request) {
try {
return RopResponse.success(merchantService.findMerchantByScene(request));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__MerchantByScene__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("消息盒子列表")
@ServiceMethod(method = "scrm.api.busassistant.messageBox.page", needInSession = NeedInSessionType.YES)
public RopResponse<Pagination<MessageBoxPageRopResponse>> getMessageBoxPage(MessageBoxPageRopRequest pageReuest) {
try {
return RopResponse.success(merchantService.getMessageBoxPage(pageReuest));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__MessageBoxPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("查询是否有未读消息")
@ServiceMethod(method = "scrm.api.busassistant.messageBox.isread", needInSession = NeedInSessionType.YES)
public RopResponse<Boolean> checkMessageReadStatus(MessageBoxCheckRopRequest ropRequest) {
try {
return RopResponse.success(merchantService.checkMessageReadStatus(ropRequest.getServiceMerchantId()));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__MessageBoxIsRead__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("获取最新战报消息")
@ServiceMethod(method = "scrm.api.busassistant.message.battleMessage", needInSession = NeedInSessionType.YES)
public RopResponse<MessageBoxPageRopResponse> getNewestMessage(MessageBoxCheckRopRequest ropRequest) {
try {
return RopResponse.success(merchantService.getNewestMessage(ropRequest.getServiceMerchantId()));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__battleMessage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("获取活动最新战报")
@ServiceMethod(method = "scrm.api.busassistant.crowd.activity.newest.report",needInSession = NeedInSessionType.YES)
private RopResponse<NewestActivityReportDTO> getNewestActivityReport(ActivityIdRequest request){
log.error("获取活动最新战报,活动id={}",request.getActivityId());
try {
RpcResponse<NewestActivityReportDTO> rpcResponse = activityReportRemote.getBattleReportUrlByActivityId(request.getActivityId());
if(rpcResponse.isFailed()){
return RopResponse.error(rpcResponse.getMessage());
}
if(!rpcResponse.hasResult()){
return RopResponse.success(null);
}
return RopResponse.success(rpcResponse.getResult());
}catch (Exception e){
log.error("获取活动最新战报,活动id={},异常:{}",request.getActivityId(),e);
return RopResponse.error("系统异常");
}
}
@ApiOperation("申请合作产品")
@ServiceMethod(method = "scrm.api.busassistant.merchant.addCoProduct", needInSession = NeedInSessionType.NO)
public RopResponse<Boolean> addCoProduct(CoProductRopRequest ropRequest) {
try {
return RopResponse.success(merchantService.addCoProduct(ropRequest));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__addCoProduct__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("根据场景值、服务商查询4s店")
@ServiceMethod(method = "scrm.api.busassistant.merchant.getMerchantListBySceneRemote", needInSession = NeedInSessionType.NO)
public RopResponse<List<MerchantBaseRopResponse>> getMerchantListBySceneRemote(MerchantBySceneRemoteRopRequest ropRequest) {
try {
return RopResponse.success(merchantService.getMerchantListBySceneRemote(ropRequest));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__getMerchantListBySceneRemote__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ApiOperation("查询商户详情")
@ServiceMethod(method = "scrm.api.busassistant.merchant.getMerchantIdByMerchantNo", needInSession = NeedInSessionType.NO)
public RopResponse<List<MerchantRopResponse>> getMerchantIdByMerchantNo(MerchantRopRequest ropRequest) {
try {
return RopResponse.success(merchantService.getMerchantIdByMerchantNo(ropRequest));
} catch (RpcServiceException e) {
log.info("=======BusinessAssistantActivityControllerr__invoke__getMerchantIdByMerchantNo__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}