|
|
@ -1,17 +1,24 @@ |
|
|
|
package com.cweb.controller.pay; |
|
|
|
package com.cweb.controller.pay; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
|
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
|
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.security.AESEncodeUtil; |
|
|
|
import com.hai.common.security.AESEncodeUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.dao.HighGasOrderRefundMapper; |
|
|
|
import com.hai.dao.HighGasOrderRefundMapper; |
|
|
|
|
|
|
|
import com.hai.entity.HighChildOrder; |
|
|
|
import com.hai.entity.HighGasOrderRefund; |
|
|
|
import com.hai.entity.HighGasOrderRefund; |
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
import com.hai.model.OrderRefundModel; |
|
|
|
import com.hai.model.OrderRefundModel; |
|
|
|
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.service.HighOrderService; |
|
|
|
import com.hai.service.HighOrderService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
@ -94,4 +101,35 @@ public class TuanYouController { |
|
|
|
log.error("WechatPayController --> wechatNotify() error!", e); |
|
|
|
log.error("WechatPayController --> wechatNotify() error!", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/abnormalOrderRefund", method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ApiOperation(value = "异常订单退款") |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
public ResponseData abnormalOrderRefund(@RequestBody JSONObject body) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(body.getString("orderNo"))) { |
|
|
|
|
|
|
|
// 查询订单
|
|
|
|
|
|
|
|
HighOrder order = highOrderService.getOrderByOrderNo(body.getString("orderNo")); |
|
|
|
|
|
|
|
// 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
|
|
|
|
|
|
|
|
if (order != null && order.getOrderStatus() == 2) { |
|
|
|
|
|
|
|
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getPayRealPrice()); |
|
|
|
|
|
|
|
if(orderRefundModel.getResult_code().equals("SUCCESS")) { |
|
|
|
|
|
|
|
for (HighChildOrder childOrder : order.getHighChildOrderList()) { |
|
|
|
|
|
|
|
childOrder.setChildOrdeStatus(4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
order.setOrderStatus(4); |
|
|
|
|
|
|
|
order.setRefundTime(new Date()); |
|
|
|
|
|
|
|
order.setRefundPrice(order.getPayRealPrice()); |
|
|
|
|
|
|
|
highOrderService.updateOrder(order); |
|
|
|
|
|
|
|
return ResponseMsgUtil.success("退款成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|