|
@@ -1,5 +1,6 @@
|
|
|
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.param.UserDeliverOrderQueryParam;
|
|
@@ -8,6 +9,8 @@ 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.enums.BusinessType;
|
|
|
+import com.qs.mp.common.enums.DeliverOrderStatusEnum;
|
|
|
+import com.qs.mp.common.enums.DeliverTypeEnum;
|
|
|
import com.qs.mp.common.enums.ErrorCodeEnum;
|
|
|
import com.qs.mp.user.domain.UserDeliverOrder;
|
|
|
import com.qs.mp.user.domain.UserDeliverOrderItem;
|
|
@@ -25,6 +28,9 @@ import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import ma.glasnost.orika.MapperFacade;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -69,13 +75,16 @@ public class UserDeliverOrderMgrController extends BaseApiController {
|
|
|
*/
|
|
|
@PostMapping("/list")
|
|
|
@ApiOperation(value = "用户提货订单列表", notes = "获取用户提货订单列表")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "OK", response = UserDeliverOrderVO.class)
|
|
|
+ )
|
|
|
@PreAuthorize("@ss.hasPermi('order:deliver:list')")
|
|
|
public TableDataInfo list(@RequestBody UserDeliverOrderQueryParam queryParam) {
|
|
|
startPage();
|
|
|
QueryWrapper<UserDeliverOrder> queryWrapper = new QueryWrapper<UserDeliverOrder>();
|
|
|
queryWrapper.eq(null != queryParam && StringUtils.isNotBlank(queryParam.getOrderId()), "t1.order_id", queryParam.getOrderId());
|
|
|
queryWrapper.eq(null != queryParam && null != queryParam.getStatus(), "t1.`status`", queryParam.getStatus());
|
|
|
- queryWrapper.eq(null != queryParam && null != queryParam.getTel(), "t1.`tel`", queryParam.getTel());
|
|
|
+ queryWrapper.eq(null != queryParam && StringUtils.isNotBlank(queryParam.getTel()) , "t1.`tel`", queryParam.getTel());
|
|
|
queryWrapper.ge(null != queryParam && null != queryParam.getStartTime(), "t1.created_time", queryParam.getStartTime());
|
|
|
queryWrapper.le(null != queryParam && null != queryParam.getEndTime(), "t1.created_time", queryParam.getEndTime());
|
|
|
queryWrapper.like(null != queryParam && StringUtils.isNotBlank(queryParam.getNickName()), "t2.nick_name", queryParam.getNickName());
|
|
@@ -95,6 +104,9 @@ public class UserDeliverOrderMgrController extends BaseApiController {
|
|
|
*/
|
|
|
@PostMapping("/detail")
|
|
|
@ApiOperation(value = "订单详情", notes = "在订单列表页面查看详情")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "OK", response = UserDeliverOrderVO.class)
|
|
|
+ )
|
|
|
@PreAuthorize("@ss.hasPermi('order:deliver:query')")
|
|
|
public AjaxResult query(@RequestBody UserDeliverOrder order) {
|
|
|
if (null == order || StringUtils.isBlank(order.getOrderId())) {
|
|
@@ -124,16 +136,31 @@ public class UserDeliverOrderMgrController extends BaseApiController {
|
|
|
if (null == shipParam || StringUtils.isBlank(shipParam.getOrderId())) {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
}
|
|
|
+
|
|
|
+ Integer deliveryType = shipParam.getDeliveryType();
|
|
|
+ if (null == deliveryType) {
|
|
|
+ deliveryType = 0;
|
|
|
+ }
|
|
|
+
|
|
|
List<UserDeliverOrderItem> itemList = new ArrayList<UserDeliverOrderItem>();
|
|
|
if (null != shipParam && null != shipParam.getItemIds() && shipParam.getItemIds().size() > 0) {
|
|
|
Date deliveryTime = new Date();
|
|
|
for (String itemId : shipParam.getItemIds()) {
|
|
|
if (StringUtils.isNotBlank(itemId)) {
|
|
|
UserDeliverOrderItem item = new UserDeliverOrderItem();
|
|
|
- item.setItemId(itemId);
|
|
|
- item.setDeliveryId(shipParam.getDeliveryId());
|
|
|
- item.setDeliveryFlowId(shipParam.getDeliveryFlowId());
|
|
|
- item.setDeliveryTime(deliveryTime);
|
|
|
+
|
|
|
+ if (DeliverTypeEnum.NO_DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 无需物流,设置发货时间为当前时间
|
|
|
+ item.setItemId(itemId);
|
|
|
+ item.setDeliveryTime(deliveryTime);
|
|
|
+
|
|
|
+ } else if (DeliverTypeEnum.DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 快递发货,设置物流信息
|
|
|
+ item.setItemId(itemId);
|
|
|
+ item.setDeliveryId(shipParam.getDeliveryId());
|
|
|
+ item.setDeliveryFlowId(shipParam.getDeliveryFlowId());
|
|
|
+ item.setDeliveryTime(deliveryTime);
|
|
|
+ }
|
|
|
itemList.add(item);
|
|
|
}
|
|
|
}
|
|
@@ -142,6 +169,7 @@ public class UserDeliverOrderMgrController extends BaseApiController {
|
|
|
boolean rtn = userDeliverOrderService.userDeliverOrderShip(shipParam.getOrderId(), itemList);
|
|
|
return rtn ? AjaxResult.success() : AjaxResult.error("发货失败");
|
|
|
}
|
|
|
+
|
|
|
return AjaxResult.error("发货失败");
|
|
|
}
|
|
|
|
|
@@ -151,21 +179,26 @@ public class UserDeliverOrderMgrController extends BaseApiController {
|
|
|
@Log(title = "用户提货订单发货单号修改", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/ship/update")
|
|
|
@ApiOperation(value = "订单发货修改", notes = "在订单发货页面提交")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "success", response = AjaxResult.class)
|
|
|
+ )
|
|
|
@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));
|
|
|
+ Integer deliveryType = shipParam.getDeliveryType();
|
|
|
+ if (null == deliveryType) {
|
|
|
+ deliveryType = 0;
|
|
|
}
|
|
|
- return AjaxResult.success();
|
|
|
+
|
|
|
+ // 修改物流信息
|
|
|
+ boolean res = userDeliverOrderService.updateShipInfo(shipParam);
|
|
|
+
|
|
|
+
|
|
|
+ return res ? AjaxResult.success() : AjaxResult.error("消息修改失败");
|
|
|
}
|
|
|
|
|
|
@Log(title = "提货订单导出", businessType = BusinessType.EXPORT)
|