|
|
|
@ -812,8 +812,28 @@ public class HighGasController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,未找到加油站信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { |
|
|
|
|
JSONObject object = TuanYouConfig.refuelingOrderRefund(order.getMemPhone(), order.getOrderNo(), body.getString("refundContent")); |
|
|
|
|
if (object == null || !object.getString("code").equals("200")) { |
|
|
|
|
log.error("HighOrderController --> refuelingOrderRefund() error!", "提交退款审核失败," + object.getString("message")); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "提交退款审核失败," + object.getString("message")); |
|
|
|
|
} |
|
|
|
|
order.setOrderStatus(6); |
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
JSONObject object = shellGroupService.gasSyncRefund(order.getPayTime(), order.getOrderNo()); |
|
|
|
|
if (!object.getString("status").equals("SUCCESS")) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,原因:" + object.getString("message")); |
|
|
|
|
} |
|
|
|
|
order.setOrderStatus(6); |
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 来源类型 1:平台自建 2:团油
|
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { |
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber()) |
|
|
|
|
|| store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
|
|
|
|
|
if (order.getPayType() == 2) { |
|
|
|
|
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getAccountMerchantNum(), order.getPayRealPrice()); |
|
|
|
@ -823,7 +843,7 @@ public class HighGasController { |
|
|
|
|
order.setRefundPrice(order.getPayRealPrice()); |
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
} |
|
|
|
|
} else if (order.getPayType() == 3){ |
|
|
|
|
} else if (order.getPayType() == 3) { |
|
|
|
|
// 积分退款
|
|
|
|
|
highUserService.goldHandle(order.getMemId(), order.getPayGold(),1, 2, order.getId()); |
|
|
|
|
order.setOrderStatus(4); |
|
|
|
@ -850,39 +870,25 @@ public class HighGasController { |
|
|
|
|
oilCardService.refund(order.getOrderNo()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, Object> pushParam = new HashMap<>(); |
|
|
|
|
pushParam.put("businessType", MerStoreAmountTypeEnum.type1.getType()); |
|
|
|
|
pushParam.put("storeId", store.getId()); |
|
|
|
|
pushParam.put("price", order.getTotalPrice()); |
|
|
|
|
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type3.getType()); |
|
|
|
|
pushParam.put("sourceId", order.getId()); |
|
|
|
|
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",退款金额:¥" + order.getTotalPrice()); |
|
|
|
|
pushParam.put("opUserId", userInfoModel.getSecUser().getId()); |
|
|
|
|
pushParam.put("opUserName", userInfoModel.getSecUser().getUserName()); |
|
|
|
|
// 退款到预存余额
|
|
|
|
|
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); |
|
|
|
|
// 预存类型 0:非预存 1:预存门店
|
|
|
|
|
if (store.getPrestoreType().equals(1)) { |
|
|
|
|
Map<String, Object> pushParam = new HashMap<>(); |
|
|
|
|
pushParam.put("businessType", MerStoreAmountTypeEnum.type1.getType()); |
|
|
|
|
pushParam.put("storeId", store.getId()); |
|
|
|
|
pushParam.put("price", order.getTotalPrice()); |
|
|
|
|
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type3.getType()); |
|
|
|
|
pushParam.put("sourceId", order.getId()); |
|
|
|
|
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",退款金额:¥" + order.getTotalPrice()); |
|
|
|
|
pushParam.put("opUserId", userInfoModel.getSecUser().getId()); |
|
|
|
|
pushParam.put("opUserName", userInfoModel.getSecUser().getUserName()); |
|
|
|
|
// 退款到预存余额
|
|
|
|
|
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
order.setOrderStatus(4); |
|
|
|
|
order.setRefundTime(new Date()); |
|
|
|
|
order.setRefundContent(body.getString("refundContent")); |
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { |
|
|
|
|
JSONObject object = TuanYouConfig.refuelingOrderRefund(order.getMemPhone(), order.getOrderNo(), body.getString("refundContent")); |
|
|
|
|
if (object == null || !object.getString("code").equals("200")) { |
|
|
|
|
log.error("HighOrderController --> refuelingOrderRefund() error!", "提交退款审核失败," + object.getString("message")); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "提交退款审核失败," + object.getString("message")); |
|
|
|
|
} |
|
|
|
|
order.setOrderStatus(6); |
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
JSONObject object = shellGroupService.gasSyncRefund(order.getPayTime(), order.getOrderNo()); |
|
|
|
|
if (!object.getString("status").equals("SUCCESS")) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,原因:" + object.getString("message")); |
|
|
|
|
} |
|
|
|
|
order.setOrderStatus(6); |
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|