Переглянути джерело

用户提货订单发货单号修改

chunping 3 роки тому
батько
коміт
6bb8d508f9

+ 25 - 0
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/UserDeliverOrderMgrController.java

@@ -1,6 +1,7 @@
 package com.qs.mp.web.controller.api.admin;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.qs.mp.admin.domain.param.UserDeliverOrderQueryParam;
 import com.qs.mp.admin.domain.param.UserDeliverOrderShipParam;
 import com.qs.mp.common.annotation.Log;
@@ -30,6 +31,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -142,6 +144,29 @@ public class UserDeliverOrderMgrController extends BaseApiController {
 		return AjaxResult.error("发货失败");
 	}
 
+	/**
+	 * 订单发货修改
+	 */
+	@Log(title = "用户提货订单发货单号修改", businessType = BusinessType.UPDATE)
+	@PostMapping("/ship/update")
+	@ApiOperation(value = "订单发货修改", notes = "在订单发货页面提交")
+	@PreAuthorize("@ss.hasPermi('order:deliver:ship')")
+	public AjaxResult updateShipInfo(@RequestBody UserDeliverOrderShipParam shipParam) {
+		if (null == shipParam || StringUtils.isBlank(shipParam.getOrderId())
+				|| null == shipParam.getDeliveryId() || StringUtils.isBlank(shipParam.getDeliveryFlowId())
+				|| CollectionUtils.isEmpty(shipParam.getItemIds())) {
+			return error(ErrorCodeEnum.ERROR_CODE_1001);
+		}
+
+		for (String itemId : shipParam.getItemIds()) {
+			userDeliverOrderItemService.update(new LambdaUpdateWrapper<UserDeliverOrderItem>()
+					.set(UserDeliverOrderItem::getDeliveryId, shipParam.getDeliveryId())
+					.set(UserDeliverOrderItem::getDeliveryFlowId, shipParam.getDeliveryFlowId())
+					.eq(UserDeliverOrderItem::getItemId, itemId));
+		}
+		return AjaxResult.success();
+	}
+
 	@Log(title = "提货订单导出", businessType = BusinessType.EXPORT)
 	@PostMapping("/export")
 	@PreAuthorize("@ss.hasPermi('order:deliver:export')")