瀏覽代碼

Merge remote-tracking branch 'ship-ota-server/main' into main1

luofeiyun 4 周之前
父節點
當前提交
9613279dc5

+ 6 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/controller/admin/room/ResourceRoomController.java

@@ -149,4 +149,10 @@ public class ResourceRoomController {
         return success(BeanUtils.toBean(list, ResourceRoomRespVO.class));
     }
 
+
+    @GetMapping("/getRoomListByShipIdAndFloorsForArrange")
+    @Operation(summary = "根据游轮ID获取游轮房间管理-用于分房")
+    public CommonResult<List<ResourceRoomRespVO>> getRoomListByShipIdAndFloorsForArrange(@RequestParam("shipId") String shipId,@RequestParam("voyageId") String voyageId, @RequestParam("floors") String floors) {
+        return success(roomService.getRoomListByShipIdAndFloorsForArrange(shipId,voyageId, floors));
+    }
 }

+ 12 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/dal/mysql/room/ResourceRoomMapper.java

@@ -5,6 +5,7 @@ import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
 import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
 import com.yc.ship.module.resource.api.ship.dto.RoomModelFloorNumDTO;
 import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomPageReqVO;
+import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomRespVO;
 import com.yc.ship.module.resource.dal.dataobject.room.ResourceRoomDO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -59,4 +60,15 @@ public interface ResourceRoomMapper extends BaseMapperX<ResourceRoomDO> {
     List<RoomModelFloorNumDTO> selectRoomModelFloorToNum(Long shipId);
 
     List<ResourceRoomDO> selectRoomListByRoomModelIdAndFloor(@Param("shipId") Long shipId, @Param("roomModelIdFloorList") List<String> roomModelIdFloorList);
+
+    /**
+     * 查询所有空闲客房
+     * @param voyageId
+     * @param roomId
+     * @return
+     */
+    List<ResourceRoomDO> selectFreeRoomList(@Param("voyageId") String voyageId, @Param("roomId") String roomId);
+
+    List<ResourceRoomRespVO> selectAllByShipIdAndFloors(@Param("shipId") String shipId, @Param("voyageId") String voyageId, @Param("floors") String floors);
+
 }

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

@@ -4,6 +4,7 @@ import com.yc.ship.framework.common.pojo.PageResult;
 import com.yc.ship.module.resource.api.room.dto.RoomRespDTO;
 import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomBatchSaveReqVO;
 import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomPageReqVO;
+import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomRespVO;
 import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomSaveReqVO;
 import com.yc.ship.module.resource.dal.dataobject.room.ResourceRoomDO;
 
@@ -85,4 +86,7 @@ public interface ResourceRoomService {
      * @return
      */
     List<ResourceRoomDO> getRoomListByRoomModelIdAndFloor(Long shipId, List<String> roomModelIdFloorList);
+
+    List<ResourceRoomRespVO> getRoomListByShipIdAndFloorsForArrange(String shipId, String voyageId, String floors);
+
 }

+ 6 - 0
ship-module-resource/ship-module-resource-biz/src/main/java/com/yc/ship/module/resource/service/room/ResourceRoomServiceImpl.java

@@ -5,6 +5,7 @@ import com.yc.ship.framework.common.util.collection.CollectionUtils;
 import com.yc.ship.framework.common.util.object.BeanUtils;
 import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomBatchSaveReqVO;
 import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomPageReqVO;
+import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomRespVO;
 import com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomSaveReqVO;
 import com.yc.ship.module.resource.dal.dataobject.room.ResourceRoomDO;
 import com.yc.ship.module.resource.dal.dataobject.roommodelrooms.ResourceRoomModelRoomsDO;
@@ -163,4 +164,9 @@ public class ResourceRoomServiceImpl implements ResourceRoomService {
         return roomMapper.selectRoomListByRoomModelIdAndFloor(shipId, roomModelIdFloorList);
     }
 
+
+    @Override
+    public List<ResourceRoomRespVO> getRoomListByShipIdAndFloorsForArrange(String shipId, String voyageId, String floors) {
+        return roomMapper.selectAllByShipIdAndFloors(shipId,voyageId, floors);
+    }
 }

+ 60 - 0
ship-module-resource/ship-module-resource-biz/src/main/resources/mapper/resourceroom/ResourceRoomMapper.xml

@@ -20,4 +20,64 @@
             #{item}
         </foreach>
     </select>
+
+
+    <select id="selectFreeRoomList" resultType="com.yc.ship.module.resource.dal.dataobject.room.ResourceRoomDO">
+        select t1.id            as id,
+        t1.room_num      as roomNum,
+        t1.room_model_id as roomModelId,
+        t1.floors as floors,
+        group_concat(t3.gender separator ',') as genders,
+        count(t3.id) as count
+        from resource_room t1
+        left join (select tv.* from trade_visitor tv
+        join trade_order to1 on tv.order_id = to1.id where to1.voyage_id = #{voyageId}) t3
+        on if(t3.final_room_id is null,t3.init_room_id,t3.final_room_id)= t1.id
+        where t1.ship_id = (select ship_id from product_voyage where id=#{voyageId})
+        <if test="roomId!=null" >and t1.id=#{roomId}</if>
+        group by t1.id, t1.room_num, t1.room_model_id, t1.floors having count(t3.id)&lt;2
+        ORDER BY t1.room_num
+    </select>
+
+
+    <select id="selectAllByShipIdAndFloors"
+            resultType="com.yc.ship.module.resource.controller.admin.room.vo.ResourceRoomRespVO">
+        select t1.id            as id,
+               t1.room_num      as roomNum,
+               t1.ship_id       as shipId,
+               t1.room_model_id as roomModelId,
+               t2.name          as roomModelName,
+               t1.floors        as floors,
+               CASE
+                   WHEN t5.status IS NULL THEN
+                       CASE
+                           WHEN t3.name IS NOT NULL THEN 3
+                           ELSE 0
+                           END
+                   ELSE t5.status
+                   END          as status,
+               group_concat(concat(t3.name,'-',coalesce(t3.nationality,''),'-',coalesce(t3.mobile,'')) separator ',') as visitorName
+
+        from resource_room t1
+                 left join resource_room_model t2 on t1.room_model_id = t2.id
+                 left join (select tv.*
+                            from trade_visitor tv
+                                     join trade_order to1 on tv.order_id = to1.id
+                            where to1.voyage_id = #{voyageId}) t3
+                           on (t1.id = t3.final_room_id or t1.id = t3.init_room_id)
+            on if(t3.final_room_id is null,t3.init_room_id,t3.final_room_id)= t1.id
+                 left join buss_room_status t5 on t1.id = t5.room_id and t5.voyage_id= #{voyageId}
+        where t1.ship_id = #{shipId}
+          and t1.deleted = 0
+          and t1.floors = #{floors}
+        group by t1.id, t1.room_num, t1.ship_id, t1.room_model_id, t2.name, t1.floors ,CASE
+            WHEN t5.status IS NULL THEN
+            CASE
+            WHEN t3.name IS NOT NULL THEN 3
+            ELSE 0
+        END
+        ELSE t5.status
+        END
+        order by t1.room_num
+    </select>
 </mapper>