|
@@ -218,11 +218,31 @@ public class BookableService {
|
|
|
|
|
|
public ResultVo<String> applyRefund(Integer reqNo) {
|
|
|
WxPayOrder order = dao.selectWxPayOrder(reqNo);
|
|
|
- ResultVo<String> refundResult = wxApiService.autoRefund(order.getTradeNo(), "驳回的医技预约,患者选择退款。");
|
|
|
- log.info("【reqNo: {}】驳回的检查预约,患者选择退款,退款结果:{}", reqNo, refundResult);
|
|
|
- if (null != refundResult && refundResult.getCode() == 200) {
|
|
|
- return ResultVoUtil.success("退款成功,资金已原路返还,请您留意退款到账信息(可能有1到3分钟延迟)。");
|
|
|
+ if (null == order) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "您本条预约尚未支付,无法退款。");
|
|
|
+ }
|
|
|
+ if (order.getPayStatus() == 1) {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("hisOrdNum", order.getHisOrdNum());
|
|
|
+ RestTemplate template = new RestTemplate();
|
|
|
+ SaveMzFeeResponse response = template.postForObject(hrgApiUrl + "/saveRefundFeeFormHaiCi",
|
|
|
+ param, SaveMzFeeResponse.class);
|
|
|
+ log.info("【hisOrdNum: {}】撤销处方结果:{}", order.getHisOrdNum(), response);
|
|
|
+ if (null == response || null == response.getResultCode()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "服务器内部错误,请联系服务中心(0731-88518888)。");
|
|
|
+ }
|
|
|
+ if (response.getResultCode() == 0) {
|
|
|
+ ResultVo<String> refundResult = wxApiService.autoRefund(order.getTradeNo(), "驳回的医技预约,患者选择退款。");
|
|
|
+ log.info("【reqNo: {}】驳回的检查预约,退款结果:{}", reqNo, refundResult);
|
|
|
+ if (null != refundResult && refundResult.getCode() == ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ return ResultVoUtil.success("退款成功,资金已原路返还,请您留意退款到账信息(可能有1到3分钟延迟)。");
|
|
|
+ }
|
|
|
+ return refundResult;
|
|
|
+ }
|
|
|
+ if (response.getResultCode() != 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, response.getResultMessage());
|
|
|
+ }
|
|
|
}
|
|
|
- return refundResult;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您本条预约尚未支付,或者缴费暂未入库。请稍后再试(建议30分钟后再操作)。");
|
|
|
}
|
|
|
}
|