|
@@ -3,10 +3,14 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
|
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*;
|
|
|
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
|
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
|
|
+import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreStaffDO;
|
|
|
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryPickUpStoreService;
|
|
|
+import cn.iocoder.yudao.module.trade.service.delivery.DeliveryPickUpStoreStaffService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -16,10 +20,15 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
import jakarta.validation.Valid;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
|
|
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
|
+import static java.util.stream.Collectors.toList;
|
|
|
|
|
|
@Tag(name = "管理后台 - 自提门店")
|
|
|
@RestController
|
|
@@ -30,6 +39,9 @@ public class DeliveryPickUpStoreController {
|
|
|
@Resource
|
|
|
private DeliveryPickUpStoreService deliveryPickUpStoreService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private DeliveryPickUpStoreStaffService deliveryPickUpStoreStaffService;
|
|
|
+
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建自提门店")
|
|
|
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:create')")
|
|
@@ -66,9 +78,16 @@ public class DeliveryPickUpStoreController {
|
|
|
@GetMapping("/list-all-simple")
|
|
|
@Operation(summary = "获得自提门店精简信息列表")
|
|
|
public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() {
|
|
|
- List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(
|
|
|
- CommonStatusEnum.ENABLE.getStatus());
|
|
|
- return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list));
|
|
|
+ List<DeliveryPickUpStoreStaffDO> storeStaffDOS = deliveryPickUpStoreStaffService.selectStaffByUserId(getLoginUserId());
|
|
|
+ List<Long> storeIds = storeStaffDOS.stream().map(DeliveryPickUpStoreStaffDO::getStoreId).toList();
|
|
|
+ if(!storeIds.isEmpty()){
|
|
|
+ List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(
|
|
|
+ CommonStatusEnum.ENABLE.getStatus(), storeIds);
|
|
|
+ return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list));
|
|
|
+ }else{
|
|
|
+ return success(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@GetMapping("/list")
|
|
@@ -88,4 +107,22 @@ public class DeliveryPickUpStoreController {
|
|
|
return success(DeliveryPickUpStoreConvert.INSTANCE.convertPage(pageResult));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/bind")
|
|
|
+ @Operation(summary = "绑定自提店员")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:create')")
|
|
|
+ public CommonResult<Boolean> bindDeliveryPickUpBindStoreStaffId(@Valid @RequestBody DeliveryPickUpBindStoreStaffIdReqVO bindStoreStaffIdVO) {
|
|
|
+ deliveryPickUpStoreService.bindDeliveryPickUpBindStoreStaffId(bindStoreStaffIdVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get-store-staff")
|
|
|
+ @Operation(summary = "查询门店绑定情况")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:query')")
|
|
|
+ public CommonResult<DeliveryPickUpBindStoreStaffIdReqsVO> getDeliveryPickUpStoreStaff(@RequestParam("id") Long id) {
|
|
|
+ DeliveryPickUpStoreDO deliveryPickUpStore = deliveryPickUpStoreService.getDeliveryPickUpStore(id);
|
|
|
+ return success(deliveryPickUpStoreStaffService.getDeliveryPickUpStoreStaff(deliveryPickUpStore.getId(),deliveryPickUpStore.getName()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|