|
|
|
@ -21,6 +21,7 @@ import com.hai.order.service.OrderService; |
|
|
|
|
import com.hai.order.type.OrderPayType; |
|
|
|
|
import com.hai.order.type.OrderStatus; |
|
|
|
|
import com.hai.order.type.RechargePlatformType; |
|
|
|
|
import com.hai.service.HighOrderService; |
|
|
|
|
import com.hai.service.OutRechargeChildOrderService; |
|
|
|
|
import com.hai.service.OutRechargeOrderService; |
|
|
|
|
import com.hai.service.impl.OutRechargeOrderServiceImpl; |
|
|
|
@ -29,6 +30,8 @@ import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
@ -57,12 +60,13 @@ public class OrderMobileRechargeController { |
|
|
|
|
private OutRechargeOrderService outRechargeOrderService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private OutRechargeChildOrderService outRechargeChildOrderService; |
|
|
|
|
|
|
|
|
|
private OrderService orderService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private OrderService orderService; |
|
|
|
|
private HighOrderService highOrderService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
@ -71,6 +75,7 @@ public class OrderMobileRechargeController { |
|
|
|
|
@RequestParam(name = "memPhone", required = false) String memPhone, |
|
|
|
|
@RequestParam(name = "memCardNo", required = false) String memCardNo, |
|
|
|
|
@RequestParam(name = "title", required = false) String title, |
|
|
|
|
@RequestParam(name = "exceptionStatus", required = false) Boolean exceptionStatus, |
|
|
|
|
@RequestParam(name = "payType", required = false) Integer payType, |
|
|
|
|
@RequestParam(name = "orderStatus", required = false) Integer orderStatus, |
|
|
|
|
@RequestParam(name = "companyId", required = false) Long companyId, |
|
|
|
@ -80,8 +85,8 @@ public class OrderMobileRechargeController { |
|
|
|
|
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
|
|
|
|
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS, |
|
|
|
|
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE, |
|
|
|
|
@RequestParam(name = "refundTimeS", required = false) String refundTimeS, |
|
|
|
|
@RequestParam(name = "refundTimeE", required = false) String refundTimeE, |
|
|
|
|
@RequestParam(name = "refundTimeS", required = false) Long refundTimeS, |
|
|
|
|
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE, |
|
|
|
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
|
|
|
|
@RequestParam(name = "pageSize", required = true) Integer pageSize, |
|
|
|
|
HttpServletRequest request) { |
|
|
|
@ -99,6 +104,8 @@ public class OrderMobileRechargeController { |
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
map.put("exceptionStatus", exceptionStatus); |
|
|
|
|
map.put("createTimeS", createTimeS); |
|
|
|
|
map.put("createTimeE", createTimeE); |
|
|
|
|
map.put("payTimeS", payTimeS); |
|
|
|
@ -133,6 +140,7 @@ public class OrderMobileRechargeController { |
|
|
|
|
@RequestParam(name = "payType", required = false) Integer payType, |
|
|
|
|
@RequestParam(name = "orderStatus", required = false) Integer orderStatus, |
|
|
|
|
@RequestParam(name = "companyId", required = false) Long companyId, |
|
|
|
|
@RequestParam(name = "exceptionStatus", required = false) Boolean exceptionStatus, |
|
|
|
|
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
|
|
|
|
@RequestParam(name = "title", required = false) String title, |
|
|
|
|
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
|
|
|
@ -159,6 +167,7 @@ public class OrderMobileRechargeController { |
|
|
|
|
} |
|
|
|
|
map.put("createTimeS", createTimeS); |
|
|
|
|
map.put("createTimeE", createTimeE); |
|
|
|
|
map.put("exceptionStatus", exceptionStatus); |
|
|
|
|
map.put("payTimeS", payTimeS); |
|
|
|
|
map.put("payTimeE", payTimeE); |
|
|
|
|
map.put("finishTimeS", finishTimeS); |
|
|
|
@ -250,4 +259,69 @@ public class OrderMobileRechargeController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/refundOrder",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "订单退款") |
|
|
|
|
public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { |
|
|
|
|
|
|
|
|
|
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(orderNo); |
|
|
|
|
|
|
|
|
|
String key = "recharge_" + outRechargeOrder.getId(); |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
// 分布式锁占坑
|
|
|
|
|
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, outRechargeOrder.getOrderNo()); |
|
|
|
|
|
|
|
|
|
if(Boolean.TRUE.equals(lock)) { |
|
|
|
|
// 加锁成功,处理业务
|
|
|
|
|
// 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单存在多个充值订单 5:订单充值完成 6:充值订单号未查询到任何充值记录
|
|
|
|
|
int orderStatus = outRechargeOrderService.orderWhetherRecharge(outRechargeOrder); |
|
|
|
|
if (orderStatus == 2) { |
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId()); |
|
|
|
|
} |
|
|
|
|
if (orderStatus == 6) { |
|
|
|
|
outRechargeOrderService.refundOrder(outRechargeOrder.getId()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 加锁失败,重试
|
|
|
|
|
Thread.sleep(100); |
|
|
|
|
refundOrder(orderNo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HighOrder order = highOrderService.getOrderByOrderNo(orderNo); |
|
|
|
|
order.setExceptionStatus(false); |
|
|
|
|
highOrderService.updateOrder(order); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("OrderExtController -> getGasOrderDetail() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} finally { |
|
|
|
|
// 删除key,释放锁
|
|
|
|
|
redisTemplate.delete(key); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/orderNormal",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "订单修改正常") |
|
|
|
|
public ResponseData orderNormal(@RequestParam(name = "orderNo", required = true) String orderNo) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
HighOrder order = highOrderService.getOrderByOrderNo(orderNo); |
|
|
|
|
order.setExceptionStatus(false); |
|
|
|
|
highOrderService.updateOrder(order); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success("操作成功"); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("OrderExtController -> getGasOrderDetail() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|