Ver código fonte

fix: 添加小程序航期接口

luofeiyun 2 semanas atrás
pai
commit
141e4c922b

+ 8 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/app/voyage/AppVoyageController.java

@@ -120,6 +120,14 @@ public class AppVoyageController {
         return success(list);
     }
 
+    // 根据日期和游轮ID获取当日航次列表
+    @GetMapping("/getVoyageListByShipIdAndDate")
+    @Operation(summary = "根据日期和游轮ID获取当日航次列表")
+    public CommonResult<List<AppVoyageDayRespVO>> getVoyageListByShipIdAndDate(@RequestParam(value = "shipId", required = false) Long shipId, @RequestParam(value = "date",required = false) String date) {
+        List<AppVoyageDayRespVO> list = voyageService.getVoyageListByShipIdAndDate(shipId, date);
+        return success(list);
+    }
+
     @GetMapping("/getRoomModelListByVoyageId")
     @Operation(summary = "获取航次(航期)房型列表")
     public CommonResult<List<AppRoomModelPriceRespVO>> getRoomModelListByVoyageId(@RequestParam("voyageId") Long voyageId) {

+ 47 - 0
ship-module-product/ship-module-product-biz/src/main/java/com/yc/ship/module/product/controller/app/voyage/vo/AppVoyageDayRespVO.java

@@ -0,0 +1,47 @@
+package com.yc.ship.module.product.controller.app.voyage.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Schema(description = "航次APP - 当日航次信息 Response VO")
+@Data
+public class AppVoyageDayRespVO {
+
+    @Schema(description = "航次ID", example = "1234")
+    private Long voyageId;
+
+    @Schema(description = "航次名称")
+    private String voyageName;
+
+    @Schema(description = "游轮ID", example = "6699")
+    private Long shipId;
+
+    @Schema(description = "游轮名称")
+    private String shipName;
+
+    @Schema(description = "船名简称")
+    private String shipShortName;
+
+    @Schema(description = "航线ID", example = "4445")
+    private Long routeId;
+
+    @Schema(description = "航线名称")
+    private String routeName;
+
+    @Schema(description = "航线简称")
+    private String routeShortName;
+
+    @Schema(description = "航线时长")
+    private String duration;
+
+    @Schema(description = "航线价格")
+    private BigDecimal routePrice;
+
+    @Schema(description = "航线航向")
+    private Integer direction;
+
+    @Schema(description = "航线航向名称")
+    private String directionName;
+}

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

@@ -6,6 +6,7 @@ import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
 import com.yc.ship.module.product.controller.admin.voyage.vo.VoyageCalendarReqVO;
 import com.yc.ship.module.product.controller.admin.voyage.vo.VoyagePageReqVO;
 import com.yc.ship.module.product.controller.admin.voyage.vo.VoyageReqVO;
+import com.yc.ship.module.product.controller.app.voyage.vo.AppVoyageDayRespVO;
 import com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO;
 import com.yc.ship.module.product.enums.VoyageShelfStatusEnum;
 import org.apache.ibatis.annotations.Mapper;
@@ -93,4 +94,11 @@ public interface VoyageMapper extends BaseMapperX<VoyageDO> {
                 .eq(VoyageDO::getShipId, shipId)
                 .orderByAsc(VoyageDO::getStartTime));
     }
+    /**
+     * 根据船Id和日期查询航次
+     * @param shipId
+     * @param date
+     * @return
+     */
+    List<AppVoyageDayRespVO> selectVoyageListByShipIdAndDate(@Param("shipId") Long shipId, @Param("date") String date);
 }

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

@@ -2,6 +2,7 @@ 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.*;
+import com.yc.ship.module.product.controller.app.voyage.vo.AppVoyageDayRespVO;
 import com.yc.ship.module.product.dal.dataobject.voyage.VoyageDO;
 
 import javax.validation.Valid;
@@ -85,4 +86,12 @@ public interface VoyageService {
      * @return
      */
     List<VoyageDO> getListByShipId(Long shipId);
+
+    /**
+     * 根据游轮ID和日期获取航次列表
+     * @param shipId
+     * @param date
+     * @return
+     */
+    List<AppVoyageDayRespVO> getVoyageListByShipIdAndDate(Long shipId, String date);
 }

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

@@ -9,6 +9,7 @@ import com.yc.ship.framework.common.util.object.BeanUtils;
 import com.yc.ship.module.product.controller.admin.pricetemplate.vo.*;
 import com.yc.ship.module.product.controller.admin.pricevoyage.vo.PriceVoyageSaveReqVO;
 import com.yc.ship.module.product.controller.admin.voyage.vo.*;
+import com.yc.ship.module.product.controller.app.voyage.vo.AppVoyageDayRespVO;
 import com.yc.ship.module.product.dal.dataobject.basicpricearea.BasicPriceAreaDO;
 import com.yc.ship.module.product.dal.dataobject.pricearea.PriceAreaDO;
 import com.yc.ship.module.product.dal.dataobject.pricefloor.PriceFloorDO;
@@ -421,4 +422,9 @@ public class VoyageServiceImpl implements VoyageService {
         return voyageMapper.selectListByShipId(shipId);
     }
 
+    @Override
+    public List<AppVoyageDayRespVO> getVoyageListByShipIdAndDate(Long shipId, String date) {
+        return voyageMapper.selectVoyageListByShipIdAndDate(shipId, date);
+    }
+
 }

+ 4 - 0
ship-module-product/ship-module-product-biz/src/main/resources/mapper/pricevoyage/PriceVoyageMapper.xml

@@ -24,8 +24,12 @@
             t1.deleted = 0
           AND t2.deleted = 0
           AND t3.deleted = 0
+        <if test="reqVO.shipId != null and reqVO.shipId != ''">
           and t1.ship_id = #{reqVO.shipId}
+        </if>
+        <if test="reqVO.routeId != null and reqVO.routeId != ''">
           AND t1.route_id = #{reqVO.routeId}
+        </if>
         and t1.start_time > now()
         and t1.channel like '%2%'
         and t4.can_sale = 1

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

@@ -12,4 +12,22 @@
          select  w.*,r.direction from product_voyage w inner join resource_route r on w.route_id = r.id
          where w.deleted = 0 and r.deleted = 0 and w.ship_id = #{shipId} and w.start_time > now() and w.shelf_status = 1 and w.channel like '%1%' order by w.create_time asc;
     </select>
+    <select id="selectVoyageListByShipIdAndDate"
+            resultType="com.yc.ship.module.product.controller.app.voyage.vo.AppVoyageDayRespVO">
+        select w.id voyage_id, w.name as voyage_name,
+               s.id ship_id, s.name as ship_name, s.short_name as ship_short_name,
+               r.id route_id, r.name as route_name, r.short_name as route_short_name,
+               r.duration, r.price as route_price, r.direction
+        from product_voyage w
+        inner join resource_ship s on w.ship_id = s.id
+        inner join resource_route r on w.route_id = r.id
+        where w.deleted = 0 and r.deleted = 0 and s.deleted = 0
+          <if test="shipId != null and shipId != ''">
+              and w.ship_id = #{shipId}
+          </if>
+          <if test="date != null and date != ''">
+              and DATE_FORMAT(w.start_time,'%Y-%m-%d') = #{date}
+          </if>
+         and w.shelf_status = 1
+    </select>
 </mapper>