|
|
@ -7,14 +7,19 @@ import com.hfkj.common.exception.ErrorCode; |
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
import com.hfkj.common.exception.ErrorHelp; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
|
|
|
|
import com.hfkj.common.utils.DateUtil; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
|
|
|
import com.hfkj.entity.BsOrder; |
|
|
|
import com.hfkj.entity.BsOrderRefund; |
|
|
|
import com.hfkj.entity.BsOrderRefund; |
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
|
|
|
|
import com.hfkj.model.order.OrderChildModel; |
|
|
|
import com.hfkj.service.order.BsOrderChildService; |
|
|
|
import com.hfkj.service.order.BsOrderChildService; |
|
|
|
import com.hfkj.service.order.BsOrderRefundService; |
|
|
|
import com.hfkj.service.order.BsOrderRefundService; |
|
|
|
|
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
|
|
|
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
|
|
|
|
|
|
|
import com.hfkj.sysenum.order.OrderChildProductTypeEnum; |
|
|
|
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.apache.commons.lang3.StringUtils; |
|
|
@ -24,6 +29,7 @@ import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
@ -43,6 +49,8 @@ public class BsOrderRefundController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private BsOrderRefundService orderRefundService; |
|
|
|
private BsOrderRefundService orderRefundService; |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsOrderService orderService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private BsOrderChildService orderChildService; |
|
|
|
private BsOrderChildService orderChildService; |
|
|
|
@RequestMapping(value="/tradeOrder",method = RequestMethod.POST) |
|
|
|
@RequestMapping(value="/tradeOrder",method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
@ -82,6 +90,26 @@ public class BsOrderRefundController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) |
|
|
|
|
|
|
|
|| userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { |
|
|
|
|
|
|
|
// 查询子订单
|
|
|
|
|
|
|
|
OrderChildModel orderChild = orderChildService.getDetail(body.getString("childOrderNo")); |
|
|
|
|
|
|
|
if (orderChild == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 查询交易订单
|
|
|
|
|
|
|
|
BsOrder order = orderService.getOrder(orderChild.getOrderNo()); |
|
|
|
|
|
|
|
if (order == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { |
|
|
|
|
|
|
|
// 支付超过30分钟时间
|
|
|
|
|
|
|
|
if (DateUtil.getMinutesDiff(order.getPayTime(),new Date()) >= 30) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油订单支付时间已超过30分钟无法进行退款,如需要退款请联系客服"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(orderRefundService.tradeOrderChildRefund( |
|
|
|
return ResponseMsgUtil.success(orderRefundService.tradeOrderChildRefund( |
|
|
|
body.getString("childOrderNo"), |
|
|
|
body.getString("childOrderNo"), |
|
|
|
body.getInteger("productCount"), |
|
|
|
body.getInteger("productCount"), |
|
|
|