提交 | 用户 | age
|
2d7bdc
|
1 |
package com.hx.phip.controller.refund; |
4918c4
|
2 |
|
4edff3
|
3 |
import com.alibaba.fastjson.JSON; |
a2fbbf
|
4 |
import com.hx.common.service.CommonService; |
Z |
5 |
import com.hx.exception.TipsException; |
|
6 |
import com.hx.mybatisTool.SqlSentence; |
|
7 |
import com.hx.phiappt.common.OrderTotalConstants; |
|
8 |
import com.hx.phiappt.dao.mapper.OrdersTotalMapper; |
|
9 |
import com.hx.phiappt.model.BaseEntity; |
fd7281
|
10 |
import com.hx.phiappt.model.Employee; |
C |
11 |
import com.hx.phiappt.model.EmployeeRole; |
4edff3
|
12 |
import com.hx.phiappt.model.consume.ConsumeNotify; |
a2fbbf
|
13 |
import com.hx.phiappt.model.order.OrdersTotal; |
fd7281
|
14 |
import com.hx.phiappt.model.refund.RefundRecord; |
C |
15 |
import com.hx.phip.service.EmployeeRoleService; |
|
16 |
import com.hx.phip.service.EmployeeService; |
c9e2be
|
17 |
import com.hx.phip.service.OrdersTotalService; |
4edff3
|
18 |
import com.hx.phip.service.consume.ConsumeNotifyService; |
4dc6e5
|
19 |
import com.hx.phip.service.order.OrderRefundService; |
fd7281
|
20 |
import com.hx.phip.service.refund.RefundRecordService; |
1af0b3
|
21 |
import com.hx.phip.tool.payment.ConsumeTool; |
a2fbbf
|
22 |
import com.hx.resultTool.Result; |
4dc6e5
|
23 |
import com.hx.util.StringUtils; |
Z |
24 |
import com.hz.his.dto.order.OrderRefundDto; |
fd7281
|
25 |
import com.hz.his.vo.order.refund.RefundCancelVo; |
4edff3
|
26 |
import com.hz.his.vo.order.refund.qr.RefundQrVo; |
4df03d
|
27 |
import com.platform.constants.LoginConstant; |
C |
28 |
import com.platform.entity.ThirtApplication; |
4dc6e5
|
29 |
import com.platform.exception.PlatTipsException; |
Z |
30 |
import com.platform.resultTool.PlatformCode; |
|
31 |
import com.platform.resultTool.PlatformResult; |
4edff3
|
32 |
import org.slf4j.Logger; |
C |
33 |
import org.slf4j.LoggerFactory; |
4dc6e5
|
34 |
import org.springframework.web.bind.annotation.RequestBody; |
Z |
35 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
36 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
37 |
import org.springframework.web.bind.annotation.RestController; |
|
38 |
|
|
39 |
import javax.annotation.Resource; |
4df03d
|
40 |
import javax.servlet.http.HttpServletRequest; |
4edff3
|
41 |
import java.math.BigDecimal; |
a2fbbf
|
42 |
import java.util.HashMap; |
Z |
43 |
import java.util.List; |
|
44 |
import java.util.Map; |
4dc6e5
|
45 |
|
Z |
46 |
/** |
4918c4
|
47 |
* @Author 部分退款工具类 |
4dc6e5
|
48 |
*/ |
Z |
49 |
@RestController |
|
50 |
@RequestMapping("/order") |
|
51 |
public class OrderRefundController { |
4edff3
|
52 |
|
C |
53 |
private static final Logger logger = LoggerFactory.getLogger(OrderRefundController.class); |
4dc6e5
|
54 |
|
Z |
55 |
@Resource |
|
56 |
private OrderRefundService orderRefundService; |
a2fbbf
|
57 |
@Resource |
Z |
58 |
private CommonService commonService; |
c9e2be
|
59 |
@Resource |
Z |
60 |
private OrdersTotalService ordersTotalService; |
fd7281
|
61 |
@Resource |
C |
62 |
private RefundRecordService refundRecordService; |
|
63 |
@Resource |
|
64 |
private EmployeeService employeeService; |
|
65 |
@Resource |
|
66 |
private EmployeeRoleService employeeRoleService; |
4edff3
|
67 |
@Resource |
C |
68 |
private ConsumeNotifyService consumeNotifyService; |
6e962c
|
69 |
|
118d96
|
70 |
|
4df03d
|
71 |
/** 部分退款显示数据接口-获取可退款数量*/ |
a2fbbf
|
72 |
@RequestMapping("/refund/details") |
4df03d
|
73 |
public Result refundDetails(@RequestBody OrderRefundDto orderRefundDto){ |
a2fbbf
|
74 |
if (StringUtils.isEmpty(orderRefundDto.getOrderId())) { |
Z |
75 |
throw new TipsException("订单标识为空!"); |
|
76 |
} |
118d96
|
77 |
OrdersTotal ordersTotal = ordersTotalService.selectOneByKey(orderRefundDto.getOrderId()); |
a2fbbf
|
78 |
if (ordersTotal == null) { |
a026ab
|
79 |
throw new TipsException("订单标识错误!"); |
a2fbbf
|
80 |
} |
118d96
|
81 |
if(ordersTotal.getIsDel().equals(OrdersTotal.YES)){ |
C |
82 |
throw new TipsException("订单处于删除状态!"); |
a2fbbf
|
83 |
} |
542dc1
|
84 |
|
a2fbbf
|
85 |
if (OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())) { |
Z |
86 |
throw new TipsException("充值订单不支持部分退款!"); |
|
87 |
} |
118d96
|
88 |
|
C |
89 |
if(OrderTotalConstants.PAY_STATUS_SUC != ordersTotal.getPayStatus()){ |
|
90 |
throw new TipsException("订单未支付!"); |
|
91 |
} |
|
92 |
|
|
93 |
if(OrderTotalConstants.STATUS_PAY != ordersTotal.getStatus() |
|
94 |
&& OrderTotalConstants.STATUS_WAIT_RECEIVE != ordersTotal.getStatus() |
|
95 |
&& OrderTotalConstants.STATUS_DONE != ordersTotal.getStatus()){ |
|
96 |
throw new TipsException("当前订单状态不能退款!"); |
|
97 |
} |
|
98 |
|
|
99 |
if(OrderTotalConstants.STATUS_REFUND_NONE != ordersTotal.getRefundStatus() |
|
100 |
&& OrderTotalConstants.STATUS_REFUND_PART != ordersTotal.getRefundStatus()){ |
|
101 |
throw new TipsException("订单退款状态不正确!"); |
|
102 |
} |
|
103 |
|
a2fbbf
|
104 |
//返回集合 |
Z |
105 |
Map<String, Object> returnMap = new HashMap<>(); |
|
106 |
returnMap.put("details",ordersTotal); |
118d96
|
107 |
List<Map<String, Object>> refundDetails=orderRefundService.refundDetails(ordersTotal); |
a2fbbf
|
108 |
returnMap.put("refundDetails",refundDetails); |
4dc6e5
|
109 |
|
a2fbbf
|
110 |
return Result.success(returnMap); |
Z |
111 |
} |
118d96
|
112 |
|
a2fbbf
|
113 |
/** 选完数量点击下一步显示数据接口 */ |
Z |
114 |
@RequestMapping("/refund/nextStep") |
4df03d
|
115 |
public Result nextStep(@RequestBody OrderRefundDto orderRefundDto){ |
a2fbbf
|
116 |
if (StringUtils.isEmpty(orderRefundDto.getOrderId())) { |
Z |
117 |
throw new TipsException("订单标识为空!"); |
|
118 |
} |
|
119 |
if (orderRefundDto.getRefundList()==null) { |
|
120 |
throw new TipsException("退款信息集合为空!"); |
|
121 |
} |
c9e2be
|
122 |
SqlSentence sqlSentence = new SqlSentence(); |
Z |
123 |
Map<String, Object> sqlMap = new HashMap<>(); |
|
124 |
sqlSentence.setM(sqlMap); |
|
125 |
sqlMap.put("isDel", BaseEntity.NO); |
|
126 |
sqlMap.put("orderId", orderRefundDto.getOrderId()); |
|
127 |
|
4df03d
|
128 |
sqlSentence.setSqlSentence("SELECT * FROM orders_total WHERE id = #{m.orderId} and isDel = #{m.isDel} "); |
c9e2be
|
129 |
OrdersTotal ordersTotal = ordersTotalService.selectOne(sqlSentence); |
Z |
130 |
if (ordersTotal == null) { |
a026ab
|
131 |
throw new TipsException("订单标识错误!"); |
c9e2be
|
132 |
} |
Z |
133 |
if (OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())) { |
|
134 |
throw new TipsException("充值订单不支持部分退款!"); |
|
135 |
} |
118d96
|
136 |
if(OrderTotalConstants.PAY_STATUS_SUC != ordersTotal.getPayStatus()){ |
C |
137 |
throw new TipsException("订单未支付!"); |
|
138 |
} |
|
139 |
|
|
140 |
if(OrderTotalConstants.STATUS_PAY != ordersTotal.getStatus() |
|
141 |
&& OrderTotalConstants.STATUS_WAIT_RECEIVE != ordersTotal.getStatus() |
|
142 |
&& OrderTotalConstants.STATUS_DONE != ordersTotal.getStatus()){ |
|
143 |
throw new TipsException("当前订单状态不能退款!"); |
|
144 |
} |
|
145 |
|
|
146 |
if(OrderTotalConstants.STATUS_REFUND_NONE != ordersTotal.getRefundStatus() |
|
147 |
&& OrderTotalConstants.STATUS_REFUND_PART != ordersTotal.getRefundStatus()){ |
|
148 |
throw new TipsException("订单退款状态不正确!"); |
|
149 |
} |
|
150 |
|
a2fbbf
|
151 |
//返回集合 |
118d96
|
152 |
OrderRefundDto returnMap = orderRefundService.nextStep(ordersTotal,orderRefundDto); |
ae6ff7
|
153 |
returnMap.setRefundPayMethod(returnMap.getPayMethodList()); |
4df03d
|
154 |
returnMap.setCouponList(returnMap.getPayCouponList()); |
a2fbbf
|
155 |
return Result.success(returnMap); |
Z |
156 |
} |
118d96
|
157 |
|
4dc6e5
|
158 |
/** |
4918c4
|
159 |
* 部分退款 |
4dc6e5
|
160 |
*/ |
Z |
161 |
@RequestMapping(value = "/partial/refund",method = RequestMethod.POST) |
4df03d
|
162 |
public PlatformResult partRefund(HttpServletRequest request, @RequestBody OrderRefundDto orderRefundDto) { |
C |
163 |
//操作平台 |
|
164 |
ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
165 |
if(thirtApplication==null){ |
|
166 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"签名失败,请检查签名!"); |
|
167 |
} |
c04e8a
|
168 |
|
4dc6e5
|
169 |
if(StringUtils.isEmpty(orderRefundDto.getOrderId())){ |
c04e8a
|
170 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"订单标识不能为空"); |
4dc6e5
|
171 |
} |
c04e8a
|
172 |
|
4df03d
|
173 |
if(StringUtils.isEmpty(orderRefundDto.getRoleId())){ |
c04e8a
|
174 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作角色标识不能为空"); |
4dc6e5
|
175 |
} |
ae6ff7
|
176 |
if(StringUtils.isEmpty(orderRefundDto.getOperatorId())){ |
C |
177 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作员工标识不能为空"); |
|
178 |
} |
c04e8a
|
179 |
|
4dc6e5
|
180 |
if(orderRefundDto.getIsApproval()==null){ |
Z |
181 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"是否需要审批不能为空"); |
|
182 |
} |
c04e8a
|
183 |
|
C |
184 |
if(orderRefundDto.getIsRefund() == null){ |
4dc6e5
|
185 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"是否自动生成退款单不能为空"); |
Z |
186 |
} |
3a9bb6
|
187 |
if(orderRefundDto.getRefundStatistics() == null){ |
F |
188 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"退款统计类型不能为空!"); |
|
189 |
} |
c04e8a
|
190 |
|
C |
191 |
OrdersTotal ordersTotal = ordersTotalService.selectOneByKey(orderRefundDto.getOrderId()); |
da4ad2
|
192 |
if (ordersTotal == null) { |
c3fd3d
|
193 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"订单标识错误!"); |
da4ad2
|
194 |
} |
c04e8a
|
195 |
if(ordersTotal.getIsDel().equals(OrdersTotal.YES)){ |
C |
196 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"订单已删除!"); |
da4ad2
|
197 |
} |
8b5222
|
198 |
if (OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())) { |
C |
199 |
throw new TipsException("充值订单不支持部分退款!"); |
|
200 |
} |
4dc6e5
|
201 |
|
04ce22
|
202 |
orderRefundDto.setRefundOperationType(BaseEntity.YES); |
4df03d
|
203 |
return orderRefundService.partRefund(ordersTotal,orderRefundDto,thirtApplication); |
4dc6e5
|
204 |
} |
c04e8a
|
205 |
|
97a5fc
|
206 |
/** |
Z |
207 |
* 全部退款 |
|
208 |
*/ |
|
209 |
@RequestMapping(value = "/whole/refund",method = RequestMethod.POST) |
4df03d
|
210 |
public PlatformResult wholeRefund(HttpServletRequest request,@RequestBody OrderRefundDto orderRefundDto) { |
C |
211 |
//操作平台 |
|
212 |
ThirtApplication thirtApplication= (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
213 |
if(thirtApplication==null){ |
|
214 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"签名失败,请检查签名!"); |
|
215 |
} |
|
216 |
|
97a5fc
|
217 |
if(StringUtils.isEmpty(orderRefundDto.getOrderId())){ |
Z |
218 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"订单id不能为空"); |
|
219 |
} |
|
220 |
if(StringUtils.isEmpty(orderRefundDto.getOperatorId())){ |
|
221 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作人不能为空"); |
|
222 |
} |
|
223 |
if(orderRefundDto.getIsApproval()==null){ |
|
224 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"是否需要审批不能为空"); |
|
225 |
} |
|
226 |
if(orderRefundDto.getIsRefund()==null){ |
|
227 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"是否自动生成退款单不能为空"); |
|
228 |
} |
3a9bb6
|
229 |
if(orderRefundDto.getRefundStatistics() == null){ |
F |
230 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"退款统计类型不能为空!"); |
|
231 |
} |
|
232 |
|
97a5fc
|
233 |
SqlSentence sqlSentence = new SqlSentence(); |
Z |
234 |
Map<String, Object> sqlMap = new HashMap<>(); |
|
235 |
sqlSentence.setM(sqlMap); |
|
236 |
sqlMap.put("isDel", BaseEntity.NO); |
|
237 |
sqlMap.put("id", orderRefundDto.getOrderId()); |
|
238 |
sqlSentence.setSqlSentence("SELECT * FROM orders_total WHERE id = #{m.id} and isDel = #{m.isDel} "); |
|
239 |
OrdersTotal ordersTotal = commonService.selectOne(OrdersTotalMapper.class, sqlSentence); |
|
240 |
if (ordersTotal == null) { |
a026ab
|
241 |
throw new TipsException("订单标识错误!"); |
97a5fc
|
242 |
} |
Z |
243 |
if(!(OrderTotalConstants.PAY_STATUS_SUC==ordersTotal.getPayStatus())){ |
a026ab
|
244 |
throw new TipsException("订单未支付!"); |
97a5fc
|
245 |
} |
edf5ea
|
246 |
if(!(OrderTotalConstants.STATUS_PAY==ordersTotal.getStatus()) && !(OrderTotalConstants.STATUS_WAIT_RECEIVE==ordersTotal.getStatus()) && !(OrderTotalConstants.STATUS_DONE==ordersTotal.getStatus())){ |
a026ab
|
247 |
throw new TipsException("订单不是已支付状态!"); |
97a5fc
|
248 |
} |
Z |
249 |
|
|
250 |
if(OrderTotalConstants.STATUS_REFUND_NONE!=ordersTotal.getRefundStatus()){ |
a026ab
|
251 |
throw new TipsException("订单退款状态不正确!"); |
97a5fc
|
252 |
} |
Z |
253 |
|
4df03d
|
254 |
return orderRefundService.wholeRefund(orderRefundDto,thirtApplication); |
97a5fc
|
255 |
} |
250fca
|
256 |
|
Z |
257 |
/** |
25d452
|
258 |
* 伪造部分退款处理退款逻辑 |
250fca
|
259 |
* |
Z |
260 |
*/ |
e97325
|
261 |
/*@RequestMapping(value = "/forge/partial/refund",method = RequestMethod.POST)*/ |
250fca
|
262 |
public PlatformResult forgePartRefund(@RequestBody OrderRefundDto orderRefundDto) { |
Z |
263 |
if(StringUtils.isEmpty(orderRefundDto.getOrderId())){ |
|
264 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"订单id不能为空"); |
|
265 |
} |
|
266 |
if(StringUtils.isEmpty(orderRefundDto.getOperatorId())){ |
|
267 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作人不能为空"); |
|
268 |
} |
|
269 |
if(orderRefundDto.getIsApproval()==null){ |
|
270 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"是否需要审批不能为空"); |
|
271 |
} |
|
272 |
if(orderRefundDto.getIsRefund()==null){ |
|
273 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"是否自动生成退款单不能为空"); |
|
274 |
} |
|
275 |
SqlSentence sqlSentence = new SqlSentence(); |
|
276 |
Map<String, Object> sqlMap = new HashMap<>(); |
|
277 |
sqlSentence.setM(sqlMap); |
|
278 |
sqlMap.put("isDel", BaseEntity.NO); |
|
279 |
sqlMap.put("id", orderRefundDto.getOrderId()); |
|
280 |
sqlSentence.setSqlSentence("SELECT * FROM orders_total WHERE id = #{m.id} and isDel = #{m.isDel} "); |
|
281 |
OrdersTotal ordersTotal = commonService.selectOne(OrdersTotalMapper.class, sqlSentence); |
|
282 |
if (ordersTotal == null) { |
a026ab
|
283 |
throw new TipsException("订单标识错误!"); |
250fca
|
284 |
} |
Z |
285 |
if(!(OrderTotalConstants.PAY_STATUS_SUC==ordersTotal.getPayStatus())){ |
a026ab
|
286 |
throw new TipsException("订单未支付!"); |
250fca
|
287 |
} |
edf5ea
|
288 |
if(!(OrderTotalConstants.STATUS_PAY==ordersTotal.getStatus()) && !(OrderTotalConstants.STATUS_WAIT_RECEIVE==ordersTotal.getStatus()) && !(OrderTotalConstants.STATUS_DONE==ordersTotal.getStatus())){ |
a026ab
|
289 |
throw new TipsException("订单不是已支付状态!"); |
250fca
|
290 |
} |
Z |
291 |
|
|
292 |
if(!(OrderTotalConstants.STATUS_REFUND_NONE==ordersTotal.getRefundStatus()) && |
|
293 |
!(OrderTotalConstants.STATUS_REFUND_PART==ordersTotal.getRefundStatus())){ |
a026ab
|
294 |
throw new TipsException("订单退款状态不正确!"); |
250fca
|
295 |
} |
Z |
296 |
/* if (OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())) { |
|
297 |
throw new TipsException("充值订单不支持部分退款!"); |
|
298 |
}*/ |
|
299 |
orderRefundDto.setRefundOperationType(BaseEntity.YES); |
|
300 |
return orderRefundService.forgePartRefund(orderRefundDto); |
|
301 |
} |
892b96
|
302 |
/** |
Z |
303 |
* 根据订单 重新绑定订单退款状态 |
|
304 |
* |
|
305 |
*/ |
|
306 |
@RequestMapping(value = "/verify/order/refundStatus",method = RequestMethod.POST) |
|
307 |
public PlatformResult verifyOrderRefundStatus(@RequestBody OrdersTotal ordersTotalDto) { |
|
308 |
if(ordersTotalDto==null){ |
|
309 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"参数不能为空!"); |
|
310 |
} |
|
311 |
if(StringUtils.isEmpty(ordersTotalDto.getId())){ |
|
312 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"订单id不能为空"); |
|
313 |
} |
|
314 |
orderRefundService.verifyOrderRefundStatus(ordersTotalDto); |
|
315 |
return PlatformResult.success(); |
|
316 |
} |
|
317 |
|
fd7281
|
318 |
/** |
755975
|
319 |
* 作废订单退款单 |
fd7281
|
320 |
* |
C |
321 |
*/ |
4ebb90
|
322 |
@RequestMapping(value = "/refund/cancel",method = RequestMethod.POST) |
fd7281
|
323 |
public PlatformResult refundCancel(HttpServletRequest request,@RequestBody RefundCancelVo refundCancelVo) { |
C |
324 |
//操作平台 |
|
325 |
ThirtApplication thirtApplication= (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
326 |
if(thirtApplication==null){ |
|
327 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"未获取到操作平台!"); |
|
328 |
} |
|
329 |
|
|
330 |
if(StringUtils.isEmpty(refundCancelVo.getId())){ |
|
331 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"退款单标识必传!"); |
|
332 |
} |
|
333 |
RefundRecord refundRecord = refundRecordService.selectOneByKey(refundCancelVo.getId()); |
|
334 |
if(refundRecord == null){ |
|
335 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"退款单标识错误!"); |
|
336 |
} |
|
337 |
if(StringUtils.isEmpty(refundCancelVo.getRemarks())){ |
|
338 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"作废备注必填!"); |
|
339 |
} |
|
340 |
if(StringUtils.isEmpty(refundCancelVo.getStaffId())){ |
|
341 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作员工必填!"); |
|
342 |
} |
|
343 |
Employee employee = employeeService.selectOneByKey(refundCancelVo.getStaffId()); |
|
344 |
if(employee == null){ |
|
345 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作员工标识错误!"); |
|
346 |
} |
|
347 |
if(StringUtils.isEmpty(refundCancelVo.getStaffRoleId())){ |
|
348 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作员工角色必填!"); |
|
349 |
} |
|
350 |
EmployeeRole employeeRole = employeeRoleService.getEmployeeRole(refundCancelVo.getStaffRoleId()); |
|
351 |
if(employeeRole == null){ |
|
352 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作员工角色标识错误!"); |
|
353 |
} |
|
354 |
|
|
355 |
orderRefundService.refundCancel(refundCancelVo,refundRecord,employee,employeeRole,thirtApplication); |
|
356 |
return PlatformResult.success(); |
6e962c
|
357 |
} |
C |
358 |
|
4edff3
|
359 |
/** |
C |
360 |
* 订单二维码调起退款 |
|
361 |
* 针对未支付的订单,但是已经使用了订单二维码支付 |
478fa9
|
362 |
* 只能全部退款,不能部分退款,逻辑删除支付回调记录 |
4edff3
|
363 |
*/ |
C |
364 |
@RequestMapping(value = "/qr/refund",method = RequestMethod.POST) |
|
365 |
public PlatformResult orderQrRefund(HttpServletRequest request,@RequestBody RefundQrVo refundQrVo) { |
|
366 |
logger.info("订单二维码调起退款数据:{}", JSON.toJSONString(refundQrVo)); |
|
367 |
|
|
368 |
//操作平台 |
|
369 |
ThirtApplication thirtApplication= (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY); |
|
370 |
if(thirtApplication==null){ |
|
371 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS,"未获取到操作平台!"); |
|
372 |
} |
|
373 |
logger.info("订单二维码调起退款操作平台:{},{},{}", thirtApplication.getAppId(),thirtApplication.getName(),thirtApplication.getAppIdCode()); |
|
374 |
|
|
375 |
if(StringUtils.isEmpty(refundQrVo.getOrderId())){ |
|
376 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"订单标识必传!"); |
|
377 |
} |
|
378 |
if(refundQrVo.getRefundTotal() == null){ |
|
379 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"退款金額!"); |
|
380 |
} |
|
381 |
if(refundQrVo.getRefundTotal().compareTo(BigDecimal.ZERO) < 1){ |
|
382 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"退款金額错误!"); |
|
383 |
} |
|
384 |
if(StringUtils.isEmpty(refundQrVo.getPayNo())){ |
|
385 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"支付订单编号必传!"); |
|
386 |
} |
|
387 |
if(StringUtils.isEmpty(refundQrVo.getEmployeeId())){ |
|
388 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作员工必传!"); |
|
389 |
} |
|
390 |
Employee employee = employeeService.selectOneByKey(refundQrVo.getEmployeeId()); |
|
391 |
if(employee == null){ |
|
392 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"操作员工标识错误!"); |
|
393 |
} |
|
394 |
|
|
395 |
//找到回调信息 |
1af0b3
|
396 |
ConsumeNotify consumeNotify = ConsumeTool.selectConsumeNotifyByOrderNo(refundQrVo.getOrderId(),refundQrVo.getPayNo(),refundQrVo.getPayNo(),commonService); |
4edff3
|
397 |
if(consumeNotify == null){ |
C |
398 |
throw new TipsException("未找到支付记录!"); |
|
399 |
} |
|
400 |
|
|
401 |
return PlatformResult.success( consumeNotifyService.consumeNotifyRefund(consumeNotify,employee,refundQrVo)); |
|
402 |
} |
|
403 |
|
|
404 |
|
4dc6e5
|
405 |
} |