From 4e6d6e7c8e4ca42e96528a71162f5e58e473f652 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期五, 11 七月 2025 09:37:15 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- buyer-api/src/main/java/cn/lili/controller/lmk/SupplierController.java | 130 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 130 insertions(+), 0 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/SupplierController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/SupplierController.java new file mode 100644 index 0000000..637d39a --- /dev/null +++ b/buyer-api/src/main/java/cn/lili/controller/lmk/SupplierController.java @@ -0,0 +1,130 @@ +package cn.lili.controller.lmk; + +import cn.lili.common.enums.ResultUtil; +import cn.lili.common.security.OperationalJudgment; +import cn.lili.common.security.context.UserContext; +import cn.lili.common.utils.StringUtils; +import cn.lili.common.vo.ResultMessage; +import cn.lili.modules.goods.entity.vos.CategoryVO; +import cn.lili.modules.goods.service.CategoryService; +import cn.lili.modules.member.entity.dos.Clerk; +import cn.lili.modules.member.service.ClerkService; +import cn.lili.modules.member.service.StoreLogisticsService; +import cn.lili.modules.order.order.entity.dto.PartDeliveryParamsDTO; +import cn.lili.modules.order.order.entity.dto.SupplierOrderSearchParams; +import cn.lili.modules.order.order.entity.vo.OrderDetailVO; +import cn.lili.modules.order.order.entity.vo.OrderSimpleXcxVO; +import cn.lili.modules.order.order.service.OrderService; +import cn.lili.modules.store.service.StoreDetailService; +import cn.lili.modules.system.entity.vo.StoreLogisticsVO; +import cn.lili.utils.COSUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotNull; +import java.util.List; +import java.util.Objects; + +@Validated +@RequiredArgsConstructor +@Api(value = "灏忕▼搴忓晢鎴风鎺ュ彛", tags = "灏忕▼搴忓晢鎴风鎺ュ彛") +@RestController +@RequestMapping("/buyer/lmk/supplier") +public class SupplierController { + /** + * 鍒嗙被 + */ + @Autowired + private CategoryService categoryService; + /** + * 搴楅摵璇︽儏 + */ + @Autowired + private StoreDetailService storeDetailService; + /** + * 鐗╂祦鍏徃 + */ + @Autowired + private StoreLogisticsService storeLogisticsService; + /** + * 璁㈠崟 + */ + @Autowired + private OrderService orderService; + + @Autowired + private COSUtil cosUtil; + @Autowired + private ClerkService clerkService; + + @ApiOperation(value = "鑾峰彇搴楅摵缁忚惀鐨勫垎绫�") + @GetMapping(value = "/allCategery") + public ResultMessage<List<CategoryVO>> getListAll() { + + String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId(); + if (StringUtils.isEmpty(storeId)) { + Clerk clerk = clerkService.getClerkByMemberId(UserContext.getCurrentUserId()); + storeId = clerk.getStoreId(); + } + + //鑾峰彇搴楅摵缁忚惀鑼冨洿 + String goodsManagementCategory = storeDetailService.getStoreDetail(storeId).getGoodsManagementCategory(); + return ResultUtil.data(this.categoryService.getStoreCategory(goodsManagementCategory.split(","))); + } + + @ApiOperation(value = "鏌ヨ浼氬憳璁㈠崟鍒楄〃") + @GetMapping("/orderList") + public ResultMessage<IPage<OrderSimpleXcxVO>> orderList(SupplierOrderSearchParams orderSearchParams) { + String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId(); + if (StringUtils.isEmpty(storeId)) { + Clerk clerk = clerkService.getClerkByMemberId(UserContext.getCurrentUserId()); + orderSearchParams.setStoreId(clerk.getStoreId()); + } else { + orderSearchParams.setStoreId(storeId); + } + return ResultUtil.data(orderService.querySupplierOrderParams(orderSearchParams)); + } + + @ApiOperation(value = "璁㈠崟鏄庣粏") + @ApiImplicitParams({ + @ApiImplicitParam(name = "orderSn", value = "璁㈠崟缂栧彿", required = true, dataType = "String", paramType = "path") + }) + @GetMapping(value = "/orderDetail/{orderSn}") + public ResultMessage<OrderDetailVO> detail(@NotNull @PathVariable String orderSn) { + OperationalJudgment.judgment(orderService.getBySn(orderSn)); + OrderDetailVO orderDetailVO = orderService.queryDetail(orderSn); + orderDetailVO.getOrderItems().forEach(orderItem -> { + String image = orderItem.getImage(); + if (StringUtils.isNotBlank(image) && !image.contains("http")) { + orderItem.setImage(cosUtil.getPreviewUrl(image)); + } + }); + return ResultUtil.data(orderDetailVO); + } + + @ApiOperation(value = "鑾峰彇鍟嗗宸查�夋嫨鐗╂祦鍏徃鍒楄〃") + @GetMapping("/getChecked") + public ResultMessage<List<StoreLogisticsVO>> getChecked() { + String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId(); + return ResultUtil.data(storeLogisticsService.getStoreSelectedLogistics(storeId)); + } + + @ApiOperation(value = "璁㈠崟鍖呰9鍙戣揣") + @ApiImplicitParams({ + @ApiImplicitParam(name = "orderSn", value = "璁㈠崟sn", required = true, dataType = "String", paramType = "path"), + @ApiImplicitParam(name = "logisticsNo", value = "鍙戣揣鍗曞彿", required = true, dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "logisticsId", value = "鐗╂祦鍏徃", required = true, dataType = "String", paramType = "query") + }) + @PostMapping(value = "/{orderSn}/partDelivery") + public ResultMessage<Object> delivery(@RequestBody PartDeliveryParamsDTO partDeliveryParamsDTO) { + return ResultUtil.data(orderService.partDelivery(partDeliveryParamsDTO)); + } + +} -- Gitblit v1.8.0