提交代码

dev
胡锐 4 months ago
parent b2aeefc5e8
commit 8beae2c017
  1. 28
      bweb/src/main/java/com/bweb/controller/BsOrderRefundController.java
  2. 2
      service/src/main/java/com/hfkj/common/utils/DateUtil.java
  3. 3
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  4. 22
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java

@ -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"),

@ -563,7 +563,7 @@ public class DateUtil {
* @return: int * @return: int
* @throws * @throws
*/ */
public static long getMinutesDiff(Date oldTime, Date newTime) throws Exception{ public static long getMinutesDiff(Date oldTime, Date newTime) {
long oldTimeStamp = oldTime.getTime(); long oldTimeStamp = oldTime.getTime();
long newTimeStamp = newTime.getTime(); long newTimeStamp = newTime.getTime();

@ -139,7 +139,8 @@ public class OrderPaySuccessService {
} }
// TODO 赠送积分 // TODO 赠送积分
} }
// 子订单完成
orderService.childOrderComplete(gasOrder.getOrderChildNo());
} }
} }

@ -14,10 +14,7 @@ import com.hfkj.model.order.OrderModel;
import com.hfkj.pay.HuiPayService; import com.hfkj.pay.HuiPayService;
import com.hfkj.service.merchant.BsMerchantService; import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.order.*; import com.hfkj.service.order.*;
import com.hfkj.sysenum.order.OrderChildStatusEnum; import com.hfkj.sysenum.order.*;
import com.hfkj.sysenum.order.OrderPayChannelEnum;
import com.hfkj.sysenum.order.OrderRefundStatusEnum;
import com.hfkj.sysenum.order.OrderStatusEnum;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -30,6 +27,7 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @className: BsOrderRefundServiceImpl * @className: BsOrderRefundServiceImpl
@ -50,7 +48,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
@Resource @Resource
private BsOrderSettleService orderSettleService; private BsOrderSettleService orderSettleService;
@Resource @Resource
private OrderRefundBusiness OrderRefundBusiness; private OrderRefundBusiness orderRefundBusiness;
@Override @Override
public void editData(BsOrderRefund data) { public void editData(BsOrderRefund data) {
@ -223,7 +221,19 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderChildService.editData(orderChild); orderChildService.editData(orderChild);
// 处理退款业务 // 处理退款业务
OrderRefundBusiness.gasOrder(orderRefund); if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
try {
orderRefundBusiness.gasOrder(orderRefund);
} catch (Exception e) { }
}
// 查询子订单已全部退款
List<OrderChildModel> orderChildList = orderChildService.getOrderChildListByOrderNo(orderChild.getOrderNo());
if (orderChildList.size() == orderChildList.stream().filter(o->o.getStatus().equals(OrderChildStatusEnum.status4.getCode())).collect(Collectors.toList()).size()) {
order.setOrderStatus(OrderStatusEnum.status4.getCode());
order.setRefundTime(new Date());
orderService.editData(order);
}
} }
// 删除缓存 // 删除缓存

Loading…
Cancel
Save