Browse Source

feat: 添加航次管理

luofeiyun 3 weeks ago
parent
commit
5b2b60aa1d
15 changed files with 793 additions and 20 deletions
  1. 4 1
      ship-module-product/ship-module-product-api/src/main/java/com/yc/ship/module/product/enums/ErrorCodeConstants.java
  2. 118 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/VoyageController.java
  3. 57 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/vo/VoyagePageReqVO.java
  4. 113 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/vo/VoyageRespVO.java
  5. 73 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/vo/VoyageSaveReqVO.java
  6. 120 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/dataobject/voyage/VoyageDO.java
  7. 34 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/mysql/voyage/VoyageMapper.java
  8. 55 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyage/VoyageService.java
  9. 71 0
      ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyage/VoyageServiceImpl.java
  10. 12 0
      ship-module-product/ship-module-product-biz/src/main/resources/mapper/voyage/VoyageMapper.xml
  11. 19 0
      ship-module-resource/ship-module-resource-api/src/main/java/com/yc/ship/module/resource/api/ship/ShipApi.java
  12. 65 0
      ship-module-resource/ship-module-resource-api/src/main/java/com/yc/ship/module/resource/api/ship/dto/ShipRespDTO.java
  13. 26 0
      ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/api/ship/ShipApiImpl.java
  14. 8 7
      ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/service/route/ResourceRouteService.java
  15. 18 12
      ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/service/route/ResourceRouteServiceImpl.java

+ 4 - 1
ship-module-product/ship-module-product-api/src/main/java/com/yc/ship/module/product/enums/ErrorCodeConstants.java

@@ -30,6 +30,9 @@ public interface ErrorCodeConstants {
     ErrorCode REDUCE_PRODUCT_FAIL_NO_LOCK = new ErrorCode(10_120, "扣减产品库存失败,未获取到锁");
     ErrorCode REDUCE_PRODUCT_EXCEPTION = new ErrorCode(10_121, "扣减产品库存异常");
     ErrorCode NO_PLAT_PRODUCT_AVAILABLE = new ErrorCode(10_022, "未查询到可用平台产品");
-    ErrorCode PRODUCT_BASE_SPEC_NOT_EXISTS = new ErrorCode(10_022, "基础产品或分销产品信息不存在");
+    ErrorCode PRODUCT_BASE_SPEC_NOT_EXISTS = new ErrorCode(10_023, "基础产品或分销产品信息不存在");
+
+    ErrorCode VOYAGE_NOT_EXISTS = new ErrorCode(10_024, "航次不存在");
+
 
 }

+ 118 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/VoyageController.java

@@ -0,0 +1,118 @@
+package com.yc.ship.module.product.controller.admin.voyage;
+
+import com.yc.ship.framework.apilog.core.annotation.ApiAccessLog;
+import com.yc.ship.framework.common.pojo.CommonResult;
+import com.yc.ship.framework.common.pojo.PageParam;
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.common.util.collection.CollectionUtils;
+import com.yc.ship.framework.common.util.object.BeanUtils;
+import com.yc.ship.framework.excel.core.util.ExcelUtils;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyagePageReqVO;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyageRespVO;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyageSaveReqVO;
+import com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO;
+import com.yc.ship.module.product.service.voyage.VoyageService;
+import com.yc.ship.module.resource.dal.dataobject.route.ResourceRouteDO;
+import com.yc.ship.module.resource.dal.dataobject.ship.ResourceShipDO;
+import com.yc.ship.module.resource.service.route.ResourceRouteService;
+import com.yc.ship.module.resource.service.ship.ResourceShipService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import static com.yc.ship.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static com.yc.ship.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "管理后台 - 航次管理")
+@RestController
+@RequestMapping("/product/voyage")
+@Validated
+public class VoyageController {
+
+    @Resource
+    private VoyageService voyageService;
+
+    @Resource
+    private ResourceShipService shipService;
+
+    @Resource
+    private ResourceRouteService routeService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建航次管理")
+    @PreAuthorize("@ss.hasPermission('product:voyage:create')")
+    public CommonResult<Long> createVoyage(@Valid @RequestBody VoyageSaveReqVO createReqVO) {
+        return success(voyageService.createVoyage(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新航次管理")
+    @PreAuthorize("@ss.hasPermission('product:voyage:update')")
+    public CommonResult<Boolean> updateVoyage(@Valid @RequestBody VoyageSaveReqVO updateReqVO) {
+        voyageService.updateVoyage(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除航次管理")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('product:voyage:delete')")
+    public CommonResult<Boolean> deleteVoyage(@RequestParam("id") Long id) {
+        voyageService.deleteVoyage(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得航次管理")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('product:voyage:query')")
+    public CommonResult<VoyageRespVO> getVoyage(@RequestParam("id") Long id) {
+        VoyageDO voyage = voyageService.getVoyage(id);
+        return success(BeanUtils.toBean(voyage, VoyageRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得航次管理分页")
+    @PreAuthorize("@ss.hasPermission('product:voyage:query')")
+    public CommonResult<PageResult<VoyageRespVO>> getVoyagePage(@Valid VoyagePageReqVO pageReqVO) {
+        PageResult<VoyageDO> pageResult = voyageService.getVoyagePage(pageReqVO);
+        PageResult<VoyageRespVO> page = BeanUtils.toBean(pageResult, VoyageRespVO.class);
+        List<VoyageRespVO> list = page.getList();
+        List<Long> shipIds = CollectionUtils.convertList(list, VoyageRespVO::getShipId);
+        List<ResourceShipDO> shipList = shipService.getList(shipIds);
+        Map<Long, ResourceShipDO> shipDOMap = CollectionUtils.convertMap(shipList, ResourceShipDO::getId);
+
+        List<Long> routeIds = CollectionUtils.convertList(list, VoyageRespVO::getRouteId);
+        List<ResourceRouteDO> routeList = routeService.getList(routeIds);
+        Map<Long, ResourceRouteDO> routeDOMap = CollectionUtils.convertMap(routeList, ResourceRouteDO::getId);
+        list.stream().forEach(item -> {
+            item.setShipName(shipDOMap.get(item.getShipId()).getName());
+            item.setRouteName(routeDOMap.get(item.getRouteId()).getName());
+        });
+        return success(page);
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出航次管理 Excel")
+    @PreAuthorize("@ss.hasPermission('product:voyage:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportVoyageExcel(@Valid VoyagePageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<VoyageDO> list = voyageService.getVoyagePage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "航次管理.xls", "数据", VoyageRespVO.class,
+                        BeanUtils.toBean(list, VoyageRespVO.class));
+    }
+
+}

+ 57 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/vo/VoyagePageReqVO.java

@@ -0,0 +1,57 @@
+package com.yc.ship.module.product.controller.admin.voyage.vo;
+
+import com.yc.ship.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static com.yc.ship.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 航次管理分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class VoyagePageReqVO extends PageParam {
+
+    @Schema(description = "航次名称", example = "李四")
+    private String name;
+
+    @Schema(description = "航次代码")
+    private String code;
+
+    @Schema(description = "游轮", example = "6699")
+    private Long shipId;
+
+    @Schema(description = "航线", example = "4445")
+    private Long routeId;
+
+    @Schema(description = "登船时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] boardingTime;
+
+    @Schema(description = "开航时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] startTime;
+
+    @Schema(description = "离船时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] leaveTime;
+
+    @Schema(description = "航次类别", example = "1")
+    private Integer type;
+
+    @Schema(description = "是否中转")
+    private Integer transfer;
+
+    @Schema(description = "上架状态", example = "1")
+    private Integer shelfStatus;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 113 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/vo/VoyageRespVO.java

@@ -0,0 +1,113 @@
+package com.yc.ship.module.product.controller.admin.voyage.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.yc.ship.framework.excel.core.annotations.DictFormat;
+import com.yc.ship.framework.excel.core.convert.DictConvert;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Schema(description = "管理后台 - 航次管理 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class VoyageRespVO {
+
+    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22359")
+    @ExcelProperty("ID")
+    private Long id;
+
+    @Schema(description = "航次名称", example = "李四")
+    @ExcelProperty("航次名称")
+    private String name;
+
+    @Schema(description = "航次代码")
+    @ExcelProperty("航次代码")
+    private String code;
+
+    @Schema(description = "游轮", example = "6699")
+    @ExcelProperty("游轮")
+    private Long shipId;
+
+    @Schema(description = "航线", example = "4445")
+    @ExcelProperty("航线")
+    private Long routeId;
+
+    @Schema(description = "登船时间")
+    @ExcelProperty("登船时间")
+    private LocalDateTime boardingTime;
+
+    @Schema(description = "开航时间")
+    @ExcelProperty("开航时间")
+    private LocalDateTime startTime;
+
+    @Schema(description = "离船时间")
+    @ExcelProperty("离船时间")
+    private LocalDateTime leaveTime;
+
+    @Schema(description = "航次类别", example = "1")
+    @ExcelProperty(value = "航次类别", converter = DictConvert.class)
+    @DictFormat("voyage_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+    private Integer type;
+
+    @Schema(description = "是否中转")
+    @ExcelProperty(value = "是否中转", converter = DictConvert.class)
+    @DictFormat("yes_no") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+    private Integer transfer;
+
+    @Schema(description = "中转时间")
+    @ExcelProperty("中转时间")
+    private LocalDateTime transferTime;
+
+    @Schema(description = "登船码头", example = "1357")
+    @ExcelProperty("登船码头")
+    private Long boardingDockId;
+
+    @Schema(description = "登船地点")
+    @ExcelProperty("登船地点")
+    private String boardingAddress;
+
+    @Schema(description = "离船地点")
+    @ExcelProperty("离船地点")
+
+    private String leaveAddress;
+
+    @Schema(description = "预定渠道")
+    @ExcelProperty(value = "预定渠道", converter = DictConvert.class)
+    @DictFormat("product_reserve_channel") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+    private List<Integer> channel;
+
+    @Schema(description = "库存是否可见")
+    @ExcelProperty(value = "库存是否可见", converter = DictConvert.class)
+    @DictFormat("yes_no") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+    private Integer stockVisible;
+
+    @Schema(description = "上架状态", example = "1")
+    @ExcelProperty(value = "上架状态", converter = DictConvert.class)
+    @DictFormat("product_shelf_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
+    private Integer shelfStatus;
+
+    @Schema(description = "集合地点")
+    @ExcelProperty("集合地点")
+    private String venue;
+
+    @Schema(description = "产品介绍")
+    @ExcelProperty("产品介绍")
+    private String introduce;
+
+    @Schema(description = "登船须知")
+    @ExcelProperty("登船须知")
+    private String notice;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+    @Schema(description = "船名")
+    private String shipName;
+
+    @Schema(description = "线路名称")
+    private String routeName;
+}

+ 73 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/admin/voyage/vo/VoyageSaveReqVO.java

@@ -0,0 +1,73 @@
+package com.yc.ship.module.product.controller.admin.voyage.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Schema(description = "管理后台 - 航次管理新增/修改 Request VO")
+@Data
+public class VoyageSaveReqVO {
+
+    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22359")
+    private Long id;
+
+    @Schema(description = "航次名称", example = "李四")
+    private String name;
+
+    @Schema(description = "航次代码")
+    private String code;
+
+    @Schema(description = "游轮", example = "6699")
+    private Long shipId;
+
+    @Schema(description = "航线", example = "4445")
+    private Long routeId;
+
+    @Schema(description = "登船时间")
+    private LocalDateTime boardingTime;
+
+    @Schema(description = "开航时间")
+    private LocalDateTime startTime;
+
+    @Schema(description = "离船时间")
+    private LocalDateTime leaveTime;
+
+    @Schema(description = "航次类别", example = "1")
+    private Integer type;
+
+    @Schema(description = "是否中转")
+    private Integer transfer;
+
+    @Schema(description = "中转时间")
+    private LocalDateTime transferTime;
+
+    @Schema(description = "登船码头", example = "1357")
+    private Long boardingDockId;
+
+    @Schema(description = "登船地点")
+    private String boardingAddress;
+
+    @Schema(description = "离船地点")
+    private String leaveAddress;
+
+    @Schema(description = "预定渠道")
+    private List<Integer> channel;
+
+    @Schema(description = "库存是否可见")
+    private Integer stockVisible;
+
+    @Schema(description = "上架状态", example = "1")
+    private Integer shelfStatus;
+
+    @Schema(description = "集合地点")
+    private String venue;
+
+    @Schema(description = "产品介绍")
+    private String introduce;
+
+    @Schema(description = "登船须知")
+    private String notice;
+
+}

+ 120 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/dataobject/voyage/VoyageDO.java

@@ -0,0 +1,120 @@
+package com.yc.ship.module.product.dal.dataobject.voyage;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
+import com.sun.xml.bind.v2.TODO;
+import com.yc.ship.framework.tenant.core.db.TenantBaseDO;
+import lombok.*;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 航次管理 DO
+ *
+ * @author flycloud
+ */
+@TableName(value = "product_voyage",autoResultMap = true)
+@KeySequence("product_voyage_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class VoyageDO extends TenantBaseDO {
+
+    /**
+     * ID
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private Long id;
+    /**
+     * 航次名称
+     */
+    private String name;
+    /**
+     * 航次代码
+     */
+    private String code;
+    /**
+     * 游轮
+     */
+    private Long shipId;
+    /**
+     * 航线
+     */
+    private Long routeId;
+    /**
+     * 登船时间
+     */
+    private LocalDateTime boardingTime;
+    /**
+     * 开航时间
+     */
+    private LocalDateTime startTime;
+    /**
+     * 离船时间
+     */
+    private LocalDateTime leaveTime;
+    /**
+     * 航次类别
+     *
+     * 枚举 {@link TODO voyage_type 对应的类}
+     */
+    private Integer type;
+    /**
+     * 是否中转
+     *
+     * 枚举 {@link TODO yes_no 对应的类}
+     */
+    private Integer transfer;
+    /**
+     * 中转时间
+     */
+    private LocalDateTime transferTime;
+    /**
+     * 登船码头
+     */
+    private Long boardingDockId;
+    /**
+     * 登船地点
+     */
+    private String boardingAddress;
+    /**
+     * 离船地点
+     */
+    private String leaveAddress;
+    /**
+     * 预定渠道
+     *
+     * 枚举 {@link TODO product_reserve_channel 对应的类}
+     */
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private List<Integer> channel;
+    /**
+     * 库存是否可见
+     *
+     * 枚举 {@link TODO yes_no 对应的类}
+     */
+    private Integer stockVisible;
+    /**
+     * 上架状态
+     *
+     * 枚举 {@link TODO product_shelf_status 对应的类}
+     */
+    private Integer shelfStatus;
+    /**
+     * 集合地点
+     */
+    private String venue;
+    /**
+     * 产品介绍
+     */
+    private String introduce;
+    /**
+     * 登船须知
+     */
+    private String notice;
+
+}

+ 34 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/dal/mysql/voyage/VoyageMapper.java

@@ -0,0 +1,34 @@
+package com.yc.ship.module.product.dal.mysql.voyage;
+
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
+import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyagePageReqVO;
+import com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 航次管理 Mapper
+ *
+ * @author flycloud
+ */
+@Mapper
+public interface VoyageMapper extends BaseMapperX<VoyageDO> {
+
+    default PageResult<VoyageDO> selectPage(VoyagePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<VoyageDO>()
+                .likeIfPresent(VoyageDO::getName, reqVO.getName())
+                .eqIfPresent(VoyageDO::getCode, reqVO.getCode())
+                .eqIfPresent(VoyageDO::getShipId, reqVO.getShipId())
+                .eqIfPresent(VoyageDO::getRouteId, reqVO.getRouteId())
+                .betweenIfPresent(VoyageDO::getBoardingTime, reqVO.getBoardingTime())
+                .betweenIfPresent(VoyageDO::getStartTime, reqVO.getStartTime())
+                .betweenIfPresent(VoyageDO::getLeaveTime, reqVO.getLeaveTime())
+                .eqIfPresent(VoyageDO::getType, reqVO.getType())
+                .eqIfPresent(VoyageDO::getTransfer, reqVO.getTransfer())
+                .eqIfPresent(VoyageDO::getShelfStatus, reqVO.getShelfStatus())
+                .betweenIfPresent(VoyageDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(VoyageDO::getId));
+    }
+
+}

+ 55 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyage/VoyageService.java

@@ -0,0 +1,55 @@
+package com.yc.ship.module.product.service.voyage;
+
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyagePageReqVO;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyageSaveReqVO;
+import com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO;
+
+import javax.validation.Valid;
+
+/**
+ * 航次管理 Service 接口
+ *
+ * @author flycloud
+ */
+public interface VoyageService {
+
+    /**
+     * 创建航次管理
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createVoyage(@Valid VoyageSaveReqVO createReqVO);
+
+    /**
+     * 更新航次管理
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateVoyage(@Valid VoyageSaveReqVO updateReqVO);
+
+    /**
+     * 删除航次管理
+     *
+     * @param id 编号
+     */
+    void deleteVoyage(Long id);
+
+    /**
+     * 获得航次管理
+     *
+     * @param id 编号
+     * @return 航次管理
+     */
+    VoyageDO getVoyage(Long id);
+
+    /**
+     * 获得航次管理分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 航次管理分页
+     */
+    PageResult<VoyageDO> getVoyagePage(VoyagePageReqVO pageReqVO);
+
+}

+ 71 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/service/voyage/VoyageServiceImpl.java

@@ -0,0 +1,71 @@
+package com.yc.ship.module.product.service.voyage;
+
+import com.yc.ship.framework.common.pojo.PageResult;
+import com.yc.ship.framework.common.util.object.BeanUtils;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyagePageReqVO;
+import com.yc.ship.module.product.controller.admin.voyage.vo.VoyageSaveReqVO;
+import com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO;
+import com.yc.ship.module.product.dal.mysql.voyage.VoyageMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static com.yc.ship.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static com.yc.ship.module.product.enums.ErrorCodeConstants.VOYAGE_NOT_EXISTS;
+
+/**
+ * 航次管理 Service 实现类
+ *
+ * @author flycloud
+ */
+@Service
+@Validated
+public class VoyageServiceImpl implements VoyageService {
+
+    @Resource
+    private VoyageMapper voyageMapper;
+
+    @Override
+    public Long createVoyage(VoyageSaveReqVO createReqVO) {
+        // 插入
+        VoyageDO voyage = BeanUtils.toBean(createReqVO, VoyageDO.class);
+        voyageMapper.insert(voyage);
+        // 返回
+        return voyage.getId();
+    }
+
+    @Override
+    public void updateVoyage(VoyageSaveReqVO updateReqVO) {
+        // 校验存在
+        validateVoyageExists(updateReqVO.getId());
+        // 更新
+        VoyageDO updateObj = BeanUtils.toBean(updateReqVO, VoyageDO.class);
+        voyageMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteVoyage(Long id) {
+        // 校验存在
+        validateVoyageExists(id);
+        // 删除
+        voyageMapper.deleteById(id);
+    }
+
+    private void validateVoyageExists(Long id) {
+        if (voyageMapper.selectById(id) == null) {
+            throw exception(VOYAGE_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public VoyageDO getVoyage(Long id) {
+        return voyageMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<VoyageDO> getVoyagePage(VoyagePageReqVO pageReqVO) {
+        return voyageMapper.selectPage(pageReqVO);
+    }
+
+}

+ 12 - 0
ship-module-product/ship-module-product-biz/src/main/resources/mapper/voyage/VoyageMapper.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yc.ship.module.product.dal.mysql.voyage.VoyageMapper">
+
+    <!--
+        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
+        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
+        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
+        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
+     -->
+
+</mapper>

+ 19 - 0
ship-module-resource/ship-module-resource-api/src/main/java/com/yc/ship/module/resource/api/ship/ShipApi.java

@@ -0,0 +1,19 @@
+package com.yc.ship.module.resource.api.ship;
+
+import com.yc.ship.module.resource.api.ship.dto.ShipRespDTO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 游轮对外服务
+ */
+public interface ShipApi {
+    /**
+     * 获取游轮键值对
+     * @param ids
+     * @return
+     */
+    Map<Long, ShipRespDTO> queryShip(List<Long> ids);
+
+}

+ 65 - 0
ship-module-resource/ship-module-resource-api/src/main/java/com/yc/ship/module/resource/api/ship/dto/ShipRespDTO.java

@@ -0,0 +1,65 @@
+package com.yc.ship.module.resource.api.ship.dto;
+
+import lombok.Data;
+
+@Data
+public class ShipRespDTO {
+
+    /**
+     * ID
+     */
+    private Long id;
+    /**
+     * 游轮名称
+     */
+    private String name;
+    /**
+     * 游轮编码
+     */
+    private String code;
+    /**
+     * 所属供应商
+     */
+    private Long supplierId;
+    /**
+     * 游轮类型
+     */
+    private Long shipTypeId;
+    /**
+     * 船长(米)
+     */
+    private Double shipLength;
+    /**
+     * 船宽(米)
+     */
+    private Double shipWidth;
+    /**
+     * 船舶净吨(吨)
+     */
+    private Double shipWeight;
+    /**
+     * 吃水深度(米)
+     */
+    private Double shipDraft;
+    /**
+     * 楼层数量
+     */
+    private Integer floorsNum;
+    /**
+     * 排水量
+     */
+    private Double displacement;
+    /**
+     * 规模
+     */
+    private String shipScale;
+    /**
+     * 备注
+     */
+    private String remark;
+    /**
+     * 状态
+     *
+     */
+    private Integer status;
+}

+ 26 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/api/ship/ShipApiImpl.java

@@ -0,0 +1,26 @@
+package com.yc.ship.module.resource.api.ship;
+
+import com.yc.ship.framework.common.util.collection.CollectionUtils;
+import com.yc.ship.framework.common.util.object.BeanUtils;
+import com.yc.ship.module.resource.api.ship.dto.ShipRespDTO;
+import com.yc.ship.module.resource.dal.dataobject.ship.ResourceShipDO;
+import com.yc.ship.module.resource.service.ship.ResourceShipService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ShipApiImpl implements ShipApi {
+
+    @Resource
+    private ResourceShipService shipService;
+    @Override
+    public Map<Long, ShipRespDTO> queryShip(List<Long> ids) {
+        List<ResourceShipDO> list = shipService.getList(ids);
+        List<ShipRespDTO> shipRespDTOS = BeanUtils.toBean(list, ShipRespDTO.class);
+        Map<Long, ShipRespDTO> map = CollectionUtils.convertMap(shipRespDTOS, ShipRespDTO::getId);
+        return map;
+    }
+}

+ 8 - 7
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/service/route/ResourceRouteService.java

@@ -1,13 +1,12 @@
 package com.yc.ship.module.resource.service.route;
 
-import java.util.*;
-import javax.validation.*;
-
-import com.yc.ship.module.resource.controller.admin.category.vo.CategoryListReqVO;
-import com.yc.ship.module.resource.controller.admin.route.vo.*;
-import com.yc.ship.module.resource.dal.dataobject.route.ResourceRouteDO;
 import com.yc.ship.framework.common.pojo.PageResult;
-import com.yc.ship.framework.common.pojo.PageParam;
+import com.yc.ship.module.resource.controller.admin.route.vo.ResourceRoutePageReqVO;
+import com.yc.ship.module.resource.controller.admin.route.vo.ResourceRouteSaveReqVO;
+import com.yc.ship.module.resource.dal.dataobject.route.ResourceRouteDO;
+
+import javax.validation.Valid;
+import java.util.List;
 
 /**
  * 航线管理 Service 接口
@@ -55,4 +54,6 @@ public interface ResourceRouteService {
     PageResult<ResourceRouteDO> getRoutePage(ResourceRoutePageReqVO pageReqVO);
 
     List<ResourceRouteDO> getRouteList();
+
+    List<ResourceRouteDO> getList(List<Long> routeIds);
 }

+ 18 - 12
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/service/route/ResourceRouteServiceImpl.java

@@ -1,22 +1,20 @@
 package com.yc.ship.module.resource.service.route;
 
-import com.yc.ship.module.resource.controller.admin.category.vo.CategoryListReqVO;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import com.yc.ship.module.resource.controller.admin.route.vo.*;
-import com.yc.ship.module.resource.dal.dataobject.route.ResourceRouteDO;
 import com.yc.ship.framework.common.pojo.PageResult;
-import com.yc.ship.framework.common.pojo.PageParam;
 import com.yc.ship.framework.common.util.object.BeanUtils;
-
+import com.yc.ship.module.resource.controller.admin.route.vo.ResourceRoutePageReqVO;
+import com.yc.ship.module.resource.controller.admin.route.vo.ResourceRouteSaveReqVO;
+import com.yc.ship.module.resource.dal.dataobject.route.ResourceRouteDO;
 import com.yc.ship.module.resource.dal.mysql.route.ResourceRouteMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+import java.util.Collections;
+import java.util.List;
 
 import static com.yc.ship.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static com.yc.ship.module.resource.enums.ErrorCodeConstants.*;
+import static com.yc.ship.module.resource.enums.ErrorCodeConstants.ROUTE_NOT_EXISTS;
 
 /**
  * 航线管理 Service 实现类
@@ -77,4 +75,12 @@ public class ResourceRouteServiceImpl implements ResourceRouteService {
         return routeMapper.selectList();
     }
 
+    @Override
+    public List<ResourceRouteDO> getList(List<Long> routeIds) {
+        if(routeIds.isEmpty()) {
+            return Collections.emptyList();
+        }
+        return routeMapper.selectByIds(routeIds);
+    }
+
 }