Prechádzať zdrojové kódy

fix:游轮管理添加供应商选择

luofeiyun 1 mesiac pred
rodič
commit
210b56b0ee

+ 12 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/controller/admin/ship/ResourceShipController.java

@@ -2,7 +2,9 @@ package com.yc.ship.module.resource.controller.admin.ship;
 
 import com.yc.ship.framework.common.util.collection.CollectionUtils;
 import com.yc.ship.module.resource.dal.dataobject.shiptype.ResourceShipTypeDO;
+import com.yc.ship.module.resource.dal.dataobject.supplier.ProductSupplierDO;
 import com.yc.ship.module.resource.service.shiptype.ResourceShipTypeService;
+import com.yc.ship.module.resource.service.supplier.ProductSupplierService;
 import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import org.springframework.validation.annotation.Validated;
@@ -44,6 +46,9 @@ public class ResourceShipController {
     @Resource
     private ResourceShipTypeService shipTypeService;
 
+    @Resource
+    private ProductSupplierService supplierService;
+
     @PostMapping("/create")
     @Operation(summary = "创建资源管理-游轮管理")
     @PreAuthorize("@ss.hasPermission('resource:ship:create')")
@@ -87,8 +92,15 @@ public class ResourceShipController {
         List<Long> typeIds = CollectionUtils.convertList(list, ResourceShipRespVO::getShipTypeId);
         List<ResourceShipTypeDO> typeList = shipTypeService.getList(typeIds);
         Map<Long, ResourceShipTypeDO> longResourceShipTypeDOMap = CollectionUtils.convertMap(typeList, ResourceShipTypeDO::getId);
+
+        //供应商名称
+        List<Long> supplierIds = CollectionUtils.convertList(list, ResourceShipRespVO::getSupplierId);
+        List<ProductSupplierDO> supplierDOS = supplierService.getList(supplierIds);
+        Map<Long, ProductSupplierDO> longProductSupplierDOMap = CollectionUtils.convertMap(supplierDOS, ProductSupplierDO::getId);
+
         list.stream().forEach(item -> {
             item.setShipTypeName(longResourceShipTypeDOMap.get(item.getShipTypeId()).getName());
+            item.setSupplierName(longProductSupplierDOMap.get(item.getSupplierId()).getName());
         });
         return success(page);
     }

+ 4 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/controller/admin/ship/vo/ResourceShipRespVO.java

@@ -30,6 +30,10 @@ public class ResourceShipRespVO {
     @ExcelProperty("所属供应商")
     private Long supplierId;
 
+    @Schema(description = "供应商名称")
+    @ExcelProperty("供应商名称")
+    private String supplierName;
+
     @Schema(description = "游轮类型", example = "20445")
     @ExcelProperty("游轮类型")
     private Long shipTypeId;

+ 10 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/controller/admin/supplier/ProductSupplierController.java

@@ -139,4 +139,14 @@ public class ProductSupplierController {
         return success(BeanUtils.toBean(list, SupplierSimpleRespVO.class));
     }
 
+    @GetMapping({"/list-by-type"})
+    @Operation(summary = "获取资源类型精简信息列表", description = "只包含被开启的类型,主要用于前端的下拉选项")
+    public CommonResult<List<SupplierSimpleRespVO>> getSimpleListByType(SupplierListReqVO reqVO) {
+
+        reqVO.setUseStatus(UseStatusEnum.ENABLE.getStatus());
+        List<ProductSupplierDO> list= productSupplierService.getSimpleListByType(reqVO);
+
+        return success(BeanUtils.toBean(list, SupplierSimpleRespVO.class));
+    }
+
 }

+ 3 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/controller/admin/supplier/vo/SupplierListReqVO.java

@@ -16,4 +16,7 @@ public class SupplierListReqVO {
     @Schema(description = "资源分类类型")
     private Long cateId;
 
+    @Schema(description = "供应商类型")
+    private Integer type;
+
 }

+ 6 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/dal/mysql/supplier/ProductSupplierMapper.java

@@ -55,4 +55,10 @@ public interface ProductSupplierMapper extends BaseMapperX<ProductSupplierDO> {
     IPage<SupplierRespVO> queryPage(IPage<SupplierRespVO> iPage, @Param("param")SupplierPageReqVO pageReqVO);
     List<ProductSupplierDO> getSimpleListByCategory(@Param("param") SupplierListReqVO param);
 
+    default List<ProductSupplierDO> selectListByType(SupplierListReqVO reqVO) {
+        return selectList(new LambdaQueryWrapperX<ProductSupplierDO>()
+                .eqIfPresent(ProductSupplierDO::getType, reqVO.getType())
+                .eqIfPresent(ProductSupplierDO::getUseStatus, reqVO.getUseStatus())
+        );
+    }
 }

+ 4 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/service/supplier/ProductSupplierService.java

@@ -61,4 +61,8 @@ public interface ProductSupplierService {
     List<ProductSupplierDO> getSimpleListByCategory(SupplierListReqVO reqVO);
 
     SupplierRespVO getSupplierByDirectAccount(String directAccount);
+
+    List<ProductSupplierDO> getSimpleListByType(SupplierListReqVO reqVO);
+
+    List<ProductSupplierDO> getList(List<Long> ids);
 }

+ 14 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/service/supplier/ProductSupplierServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -152,4 +153,17 @@ public class ProductSupplierServiceImpl implements ProductSupplierService {
         }
         return null;
     }
+
+    @Override
+    public List<ProductSupplierDO> getSimpleListByType(SupplierListReqVO reqVO) {
+        return productSupplierMapper.selectListByType(reqVO);
+    }
+
+    @Override
+    public List<ProductSupplierDO> getList(List<Long> ids) {
+        if(ids.isEmpty()) {
+            return Collections.emptyList();
+        }
+        return productSupplierMapper.selectByIds(ids);
+    }
 }