|
|
@ -18,7 +18,7 @@ import co.yixiang.dozer.service.IGenerator; |
|
|
|
import co.yixiang.enums.OrderInfoEnum; |
|
|
|
import co.yixiang.enums.OrderInfoEnum; |
|
|
|
import co.yixiang.enums.OrderLogEnum; |
|
|
|
import co.yixiang.enums.OrderLogEnum; |
|
|
|
import co.yixiang.enums.ShopCommonEnum; |
|
|
|
import co.yixiang.enums.ShopCommonEnum; |
|
|
|
import co.yixiang.exception.BadRequestException; |
|
|
|
import cn.iocoder.yudao.framework.common.exception.ShopException; |
|
|
|
import co.yixiang.logging.aop.log.Log; |
|
|
|
import co.yixiang.logging.aop.log.Log; |
|
|
|
import co.yixiang.modules.aop.ForbidSubmit; |
|
|
|
import co.yixiang.modules.aop.ForbidSubmit; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrder; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrder; |
|
|
@ -209,10 +209,10 @@ public class StoreOrderController { |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources) { |
|
|
|
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources) { |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryName())) { |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryName())) { |
|
|
|
throw new BadRequestException("请选择快递公司"); |
|
|
|
throw new ShopException("请选择快递公司"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryId())) { |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryId())) { |
|
|
|
throw new BadRequestException("快递单号不能为空"); |
|
|
|
throw new ShopException("快递单号不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
yxStoreOrderService.orderDelivery(resources.getOrderId(), resources.getDeliveryId(), |
|
|
|
yxStoreOrderService.orderDelivery(resources.getOrderId(), resources.getDeliveryId(), |
|
|
@ -242,10 +242,10 @@ public class StoreOrderController { |
|
|
|
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
public ResponseEntity updateDelivery(@Validated @RequestBody YxStoreOrder resources) { |
|
|
|
public ResponseEntity updateDelivery(@Validated @RequestBody YxStoreOrder resources) { |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryName())) { |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryName())) { |
|
|
|
throw new BadRequestException("请选择快递公司"); |
|
|
|
throw new ShopException("请选择快递公司"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryId())) { |
|
|
|
if (StrUtil.isBlank(resources.getDeliveryId())) { |
|
|
|
throw new BadRequestException("快递单号不能为空"); |
|
|
|
throw new ShopException("快递单号不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
yxStoreOrderService.updateDelivery(resources.getOrderId(), resources.getDeliveryId(), |
|
|
|
yxStoreOrderService.updateDelivery(resources.getOrderId(), resources.getDeliveryId(), |
|
|
@ -259,14 +259,14 @@ public class StoreOrderController { |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
public ResponseEntity check(@Validated @RequestBody YxStoreOrder resources) { |
|
|
|
public ResponseEntity check(@Validated @RequestBody YxStoreOrder resources) { |
|
|
|
if (StrUtil.isBlank(resources.getVerifyCode())) { |
|
|
|
if (StrUtil.isBlank(resources.getVerifyCode())) { |
|
|
|
throw new BadRequestException("核销码不能为空"); |
|
|
|
throw new ShopException("核销码不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class); |
|
|
|
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class); |
|
|
|
if (!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())) { |
|
|
|
if (!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())) { |
|
|
|
throw new BadRequestException("核销码不对"); |
|
|
|
throw new ShopException("核销码不对"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())) { |
|
|
|
if (OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())) { |
|
|
|
throw new BadRequestException("订单未支付"); |
|
|
|
throw new ShopException("订单未支付"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
yxStoreOrderService.verifyOrder(resources.getVerifyCode(), |
|
|
|
yxStoreOrderService.verifyOrder(resources.getVerifyCode(), |
|
|
@ -303,10 +303,10 @@ public class StoreOrderController { |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources) { |
|
|
|
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources) { |
|
|
|
if (ObjectUtil.isNull(resources.getPayPrice())) { |
|
|
|
if (ObjectUtil.isNull(resources.getPayPrice())) { |
|
|
|
throw new BadRequestException("请输入支付金额"); |
|
|
|
throw new ShopException("请输入支付金额"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (resources.getPayPrice().doubleValue() < 0) { |
|
|
|
if (resources.getPayPrice().doubleValue() < 0) { |
|
|
|
throw new BadRequestException("金额不能低于0"); |
|
|
|
throw new ShopException("金额不能低于0"); |
|
|
|
} |
|
|
|
} |
|
|
|
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class); |
|
|
|
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class); |
|
|
|
//判断金额是否有变动,生成一个额外订单号去支付
|
|
|
|
//判断金额是否有变动,生成一个额外订单号去支付
|
|
|
@ -330,7 +330,7 @@ public class StoreOrderController { |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')") |
|
|
|
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources) { |
|
|
|
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources) { |
|
|
|
if (StrUtil.isBlank(resources.getRemark())) { |
|
|
|
if (StrUtil.isBlank(resources.getRemark())) { |
|
|
|
throw new BadRequestException("请输入备注"); |
|
|
|
throw new ShopException("请输入备注"); |
|
|
|
} |
|
|
|
} |
|
|
|
yxStoreOrderService.saveOrUpdate(resources); |
|
|
|
yxStoreOrderService.saveOrUpdate(resources); |
|
|
|
return new ResponseEntity(HttpStatus.OK); |
|
|
|
return new ResponseEntity(HttpStatus.OK); |
|
|
@ -347,7 +347,7 @@ public class StoreOrderController { |
|
|
|
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(), |
|
|
|
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(), |
|
|
|
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode()); |
|
|
|
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode()); |
|
|
|
if (!expressInfo.isSuccess()) { |
|
|
|
if (!expressInfo.isSuccess()) { |
|
|
|
// throw new BadRequestException(expressInfo.getReason());
|
|
|
|
// throw new ShopException(expressInfo.getReason());
|
|
|
|
throw new ShopException(expressInfo.getReason()); |
|
|
|
throw new ShopException(expressInfo.getReason()); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResponseEntity<>(expressInfo, HttpStatus.OK); |
|
|
|
return new ResponseEntity<>(expressInfo, HttpStatus.OK); |
|
|
|