MerchantStaffPersonalService.java
9.54 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
183
184
185
186
187
188
package cn.com.glsx.stoassistant.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.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationDTO;
import cn.com.glsx.scrm.shopmall.enums.integral.MerchantScoreSourceEnum;
import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivationOperation;
import cn.com.glsx.scrm.shopmall.remote.StaffMotivationRemote;
import cn.com.glsx.stoassistant.annotation.LogSupport;
import cn.com.glsx.stoassistant.convert.ConvertRequest;
import cn.com.glsx.stoassistant.convert.ConvertResponse;
import cn.com.glsx.stoassistant.model.request.score.MerchantStaffScoreSearchRpcRequest;
import cn.com.glsx.stoassistant.model.request.withdrawal.MerchantStaffWithdrawalBankDTO;
import cn.com.glsx.stoassistant.model.request.withdrawal.MerchantStaffWithdrawalInsertRpcRequest;
import cn.com.glsx.stoassistant.model.request.withdrawal.MerchantStaffWithdrawalSearchRpcRequest;
import cn.com.glsx.stoassistant.model.response.score.MerchantStaffScoreDetailRpcResponse;
import cn.com.glsx.stoassistant.model.response.score.MerchantStaffScoreListRpcResponse;
import cn.com.glsx.stoassistant.model.response.score.MerchantStaffScorePageRpcResponse;
import cn.com.glsx.stoassistant.model.response.withdrawal.MerchantStaffWithdrawalListRpcResponse;
import cn.com.glsx.stoassistant.remote.MerchantStaffScoreRemote;
import cn.com.glsx.stoassistant.remote.MerchantStaffWithdrawalRemote;
import cn.com.glsx.stoassistant.request.CommonIdRequest;
import cn.com.glsx.stoassistant.request.merchant.MerchantBaseInfoRequest;
import cn.com.glsx.stoassistant.request.withdrawal.MerchantStaffScoreSearchRopRequest;
import cn.com.glsx.stoassistant.request.withdrawal.MerchantStaffWithdrawalBankRequest;
import cn.com.glsx.stoassistant.request.withdrawal.MerchantStaffWithdrawalInsertRopRequest;
import cn.com.glsx.stoassistant.response.score.MerchantStaffScoreDetailRopResponse;
import cn.com.glsx.stoassistant.response.score.MerchantStaffScoreListRopResponse;
import cn.com.glsx.stoassistant.response.score.MerchantStaffWithdrawalBankVO;
import cn.com.glsx.stoassistant.response.withdrawal.MerchantStaffWithdrawalListRopResponse;
import cn.com.glsx.stoassistant.utils.CommonUtil;
import cn.com.glsx.stoassistant.utils.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName MerchantStaffPersonalService
* @Description
* @Author lichongyuan
* @Date 2022/10/15
*/
@Service
public class MerchantStaffPersonalService {
@Autowired
private MerchantStaffWithdrawalRemote merchantStaffWithdrawalRemote;
@Autowired
private MerchantStaffScoreRemote merchantStaffScoreRemote;
@Autowired
private StaffMotivationRemote staffMotivationRemote;
/**
* 个人中心-员工积分列表()
*
* @param request
*/
@LogSupport(module = "个人中心",method = "员工积分列表")
public MerchantStaffScoreDetailRopResponse getStaffScoreDetail(MerchantStaffScoreSearchRopRequest request) {
MerchantStaffScoreSearchRpcRequest param = ConvertRequest.convertRequest(request, new MerchantStaffScoreSearchRpcRequest());
RpcResponse<MerchantStaffScoreDetailRpcResponse> rpcResponse = merchantStaffScoreRemote.getStaffScoreDetail(param);
if (rpcResponse.isSuccess()) {
MerchantStaffScoreDetailRpcResponse result = rpcResponse.getResult();
MerchantStaffScoreDetailRopResponse response = ConvertResponse.convertObject(result, MerchantStaffScoreDetailRopResponse.class);
return response;
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
/**
* 个人中心-员工提现列表
*
* @param request
* @return
*/
@LogSupport(module = "个人中心",method = "员工提现列表")
public List<MerchantStaffWithdrawalListRopResponse> getWithdrawalList(MerchantStaffScoreSearchRopRequest request) {
MerchantStaffWithdrawalSearchRpcRequest param = ConvertRequest.convertRequest(request, new MerchantStaffWithdrawalSearchRpcRequest());
RpcResponse<List<MerchantStaffWithdrawalListRpcResponse>> rpcResponse = merchantStaffWithdrawalRemote.getList(param);
if (rpcResponse.isSuccess()) {
List<MerchantStaffWithdrawalListRopResponse> response = ConvertResponse.convertList(rpcResponse.getResult(), MerchantStaffWithdrawalListRopResponse.class);
return response;
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
/**
* 单个提现
*
* @param request
*/
@LogSupport(module = "个人中心",method = "单个提现")
public void insertWithdrawal(MerchantStaffWithdrawalInsertRopRequest request) {
MerchantStaffWithdrawalInsertRpcRequest param = ConvertRequest.convertRequest(request, new MerchantStaffWithdrawalInsertRpcRequest());
param.setStaffSource(MerchantScoreSourceEnum.MERCHANT_4S.getValue());
RpcResponse<Boolean> rpcResponse = merchantStaffWithdrawalRemote.insertWithdrawal(param);
if (rpcResponse.isFailed()) {
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
}
/**
* 获取员工收益列表分页
* @param request
* @return
*/
public Pagination<MerchantStaffScoreListRopResponse> getStaffScoreList(MerchantStaffScoreSearchRopRequest request) {
RpcPagination<MerchantStaffScoreSearchRpcRequest> param = ConvertRequest.convertPage(request, new MerchantStaffScoreSearchRpcRequest());
RpcResponse<MerchantStaffScorePageRpcResponse> rpcResponse = merchantStaffScoreRemote.getPage(param);
if (rpcResponse.isSuccess()) {
MerchantStaffScorePageRpcResponse result = rpcResponse.getResult();
Pagination<MerchantStaffScoreListRopResponse> response = ConvertResponse.convertPage(result.getPagination(), MerchantStaffScoreListRopResponse.class);
return response;
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
public MerchantStaffScoreListRpcResponse getStaffScoreDetailById(CommonIdRequest request) {
RpcResponse<MerchantStaffScoreListRpcResponse> rpcResponse = merchantStaffScoreRemote.getById(request.getId());
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getMessage());
}
/**
* 插入或更新员工银行卡信息
*
* @param request
*/
public Boolean insertOrUpdateStaffBank(MerchantStaffWithdrawalBankRequest request) {
MerchantStaffWithdrawalBankDTO param = ConvertRequest.convertRequest(request, new MerchantStaffWithdrawalBankDTO());
RpcResponse<Boolean> rpcResponse = merchantStaffWithdrawalRemote.insertOrUpdateStaffBank(param);
if (rpcResponse.isSuccess()){
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
/**
* 根据员工id查询员工银行卡列表
*
* @param request
*/
public List<MerchantStaffWithdrawalBankVO> staffBankList(MerchantStaffWithdrawalBankRequest request) {
MerchantStaffWithdrawalBankDTO param = ConvertRequest.convertRequest(request, new MerchantStaffWithdrawalBankDTO());
RpcResponse<List<MerchantStaffWithdrawalBankDTO>> rpcResponse = merchantStaffWithdrawalRemote.staffBankList(param);
if (rpcResponse.isSuccess()){
return ConvertResponse.convertList(rpcResponse.getResult(),MerchantStaffWithdrawalBankVO.class);
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
/**
* 根据员工id查询员工银行卡列表
*
* @param request
*/
public MerchantStaffWithdrawalBankVO staffBankDetail(MerchantStaffWithdrawalBankRequest request) {
RpcResponse<MerchantStaffWithdrawalBankDTO> rpcResponse = merchantStaffWithdrawalRemote.staffBankDetail(request.getId());
if (rpcResponse.isSuccess()){
return ConvertResponse.convertObject(rpcResponse.getResult(),MerchantStaffWithdrawalBankVO.class);
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
public String getWithdrawalRate(MerchantBaseInfoRequest request) {
RpcResponse<String> rpcResponse = merchantStaffWithdrawalRemote.getWithdrawalRate(request.getMerchantId());
if (rpcResponse.isSuccess()){
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
public List<ShopmallStaffMotivationOperation> getOrderOperation(MerchantStaffScoreSearchRopRequest request) {
ShopmallStaffMotivationDTO req = CommonUtil.convertRequest(ShopmallStaffMotivationDTO.class);
RpcResponse<List<ShopmallStaffMotivationOperation>> rpcResponse = staffMotivationRemote.getOrderOperation(req);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getException().getErrId(), rpcResponse.getException().getMessage());
}
}