|
@@ -2,6 +2,7 @@ package com.qs.mp.web.controller.api.admin;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.qs.mp.admin.domain.Goods;
|
|
|
import com.qs.mp.admin.domain.param.ChannelGoodsOrderQueryParam;
|
|
|
import com.qs.mp.admin.domain.param.ChannelGoodsOrderShipParam;
|
|
@@ -13,7 +14,6 @@ import com.qs.mp.channel.domain.excel.ChannelGoodsOrderExcel;
|
|
|
import com.qs.mp.channel.domain.vo.ChannelGoodsOrderInfoVO;
|
|
|
import com.qs.mp.channel.domain.vo.ChannelGoodsOrderItemVO;
|
|
|
import com.qs.mp.channel.domain.vo.ChannelGoodsOrderVO;
|
|
|
-import com.qs.mp.channel.domain.vo.ChannelVO;
|
|
|
import com.qs.mp.channel.service.IChannelGoodsOrderItemService;
|
|
|
import com.qs.mp.channel.service.IChannelGoodsOrderService;
|
|
|
import com.qs.mp.channel.service.IChannelService;
|
|
@@ -21,12 +21,9 @@ import com.qs.mp.common.annotation.Log;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
import com.qs.mp.common.domain.DeliveryCompany;
|
|
|
-import com.qs.mp.common.enums.BusinessType;
|
|
|
-import com.qs.mp.common.enums.DeliverTypeEnum;
|
|
|
-import com.qs.mp.common.enums.ErrorCodeEnum;
|
|
|
+import com.qs.mp.common.enums.*;
|
|
|
import com.qs.mp.common.service.IDeliveryCompanyService;
|
|
|
import com.qs.mp.common.utils.DateUtils;
|
|
|
-import com.qs.mp.user.service.IUserDeliverOrderItemService;
|
|
|
import com.qs.mp.utils.ExcelUtil;
|
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -141,6 +138,58 @@ public class ChannelGoodsOrderMgrController extends BaseApiController {
|
|
|
return AjaxResult.success(goodsOrderInfoVO);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 订单发货单号修改
|
|
|
+ */
|
|
|
+ @Log(title = "经销商订单发货单号修改", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/ship/update")
|
|
|
+ @ApiOperation(value = "订单发货单号修改" , notes = "在订单发货页面提交")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "操作成功", response = AjaxResult.class)
|
|
|
+ )
|
|
|
+ @PreAuthorize("@ss.hasPermi('channelGoods:channel:ship')")
|
|
|
+ public AjaxResult updateShipInfo(@RequestBody ChannelGoodsOrderShipParam shipParam) {
|
|
|
+ if(null == shipParam || StringUtils.isBlank(shipParam.getOrderId())) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+
|
|
|
+ ChannelGoodsOrder order = channelGoodsOrderService.getById(shipParam.getOrderId());
|
|
|
+ if(null == order || StringUtils.isBlank(order.getOrderId())
|
|
|
+ || null == order.getChannelId()) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer deliveryType = shipParam.getDeliveryType();
|
|
|
+ if (DeliverTypeEnum.DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ if (Objects.isNull(shipParam.getDeliveryId())) {
|
|
|
+ return AjaxResult.error("快递公司不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(shipParam.getDeliveryFlowId())) {
|
|
|
+ return AjaxResult.error("快递单号不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean rtn = false;
|
|
|
+ if (DeliverTypeEnum.NO_DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 无需物流,设置单号为空,物流公司为空
|
|
|
+ rtn = channelGoodsOrderService.update(new LambdaUpdateWrapper<ChannelGoodsOrder>()
|
|
|
+ .set(ChannelGoodsOrder::getDeliveryId, null)
|
|
|
+ .set(ChannelGoodsOrder::getDeliveryFlowId, null)
|
|
|
+ .set(ChannelGoodsOrder::getStatus, ChannelGoodsOrderStatusEnum.FINISHED)
|
|
|
+ .eq(ChannelGoodsOrder::getOrderId, shipParam.getOrderId()));
|
|
|
+
|
|
|
+ } else if (DeliverTypeEnum.DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 快递发货,原逻辑
|
|
|
+ rtn = channelGoodsOrderService.update(new LambdaUpdateWrapper<ChannelGoodsOrder>()
|
|
|
+ .set(ChannelGoodsOrder::getDeliveryId, shipParam.getDeliveryId())
|
|
|
+ .set(ChannelGoodsOrder::getDeliveryFlowId, shipParam.getDeliveryFlowId())
|
|
|
+ .eq(ChannelGoodsOrder::getOrderId, shipParam.getOrderId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return rtn ? AjaxResult.success() : AjaxResult.error("修改失败");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 订单发货
|