stjdydayou il y a 4 ans
Parent
commit
b01a540105

+ 158 - 27
src/main/java/com/zhiqiyun/open/router/apis/BzApi.java

@@ -1,50 +1,181 @@
 package com.zhiqiyun.open.router.apis;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dliyun.oap.framework.annotation.ServiceMethod;
 import com.dliyun.oap.framework.annotation.ServiceMethodBean;
-import com.dliyun.oap.framework.request.AbstractOapRequest;
 import com.dliyun.oap.framework.response.OapResponse;
-import com.zhiqiyun.open.core.service.SystemConfigService;
+import com.zhiqiyun.open.core.models.bz.*;
+import com.zhiqiyun.open.core.service.*;
+import com.zhiqiyun.open.router.request.bz.*;
 import lombok.extern.slf4j.Slf4j;
-import okhttp3.OkHttpClient;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.io.IOException;
-import java.util.HashMap;
-
 @Slf4j
 @ServiceMethodBean
 public class BzApi {
 
     @Autowired
-    private OkHttpClient okHttpClient;
+    private HolidayVillageInfoService holidayVillageInfoService;
 
     @Autowired
-    private SystemConfigService systemConfigService;
+    private VenueInfoService venueInfoService;
 
-    @ServiceMethod(method = "bz.list.weather.info", title = "查询天气")
-    public OapResponse weatherInfo(AbstractOapRequest request) throws IOException {
-        return OapResponse.success().setBody(new HashMap<>());
-    }
-    @ServiceMethod(method = "bz.list.tourist.agency.info", title = "旅行社信息")
-    public OapResponse touristAgencyInfo(AbstractOapRequest request) throws IOException {
-        return OapResponse.success().setBody(new HashMap<>());
+    @Autowired
+    private SceneryInfoService sceneryInfoService;
+
+    @Autowired
+    private HotelInfoService hotelInfoService;
+
+    @Autowired
+    private HomeStayInfoService homeStayInfoService;
+
+    @Autowired
+    private TouristInfoService touristInfoService;
+
+    @ServiceMethod(method = "bz.list.page.venue.info", title = "场馆信息")
+    public OapResponse listPageVenueInfo(VenueInfoRequest request) {
+        QueryWrapper<VenueInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(request.getKeyword())) {
+            queryWrapper.and(true, wrapper -> {
+                wrapper.like("name", request.getKeyword());
+                wrapper.or();
+                wrapper.like("brief", request.getKeyword());
+                wrapper.or();
+                wrapper.like("address", request.getKeyword());
+                wrapper.or();
+                wrapper.like("contacts", request.getKeyword());
+            });
+        }
+
+        Page<VenueInfo> page = new Page<>(request.getCurrent(), request.getSize());
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<VenueInfo> resultData = this.venueInfoService.page(page, queryWrapper);
+
+        return OapResponse.success().setBody(resultData);
     }
-    @ServiceMethod(method = "bz.list.hotel.info", title = "酒店与民宿信息")
-    public OapResponse bzHotelInfo(AbstractOapRequest request) throws IOException {
-        return OapResponse.success().setBody(new HashMap<>());
+
+    @ServiceMethod(method = "bz.list.page.scenery.info", title = "酒店信息")
+    public OapResponse listPageSceneryInfo(SceneryInfoRequest request) {
+        QueryWrapper<SceneryInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(request.getKeyword())) {
+            queryWrapper.and(true, wrapper -> {
+                wrapper.like("name", request.getKeyword());
+                wrapper.or();
+                wrapper.like("brief", request.getKeyword());
+                wrapper.or();
+                wrapper.like("address", request.getKeyword());
+                wrapper.or();
+                wrapper.like("contacts", request.getKeyword());
+            });
+        }
+
+        Page<SceneryInfo> page = new Page<>(request.getCurrent(), request.getSize());
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<SceneryInfo> resultData = this.sceneryInfoService.page(page, queryWrapper);
+
+        return OapResponse.success().setBody(resultData);
     }
-    @ServiceMethod(method = "bz.list.holiday.resort.info", title = "度假区信息")
-    public OapResponse bz_holiday_resort_info(AbstractOapRequest request) throws IOException {
-        return OapResponse.success().setBody(new HashMap<>());
+
+    @ServiceMethod(method = "bz.list.page.holiday.village.info", title = "查询度假村信息")
+    public OapResponse listPageHolidayVillageInfo(HolidayVillageInfoRequest request) {
+        QueryWrapper<HolidayVillageInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(request.getKeyword())) {
+            queryWrapper.and(true, wrapper -> {
+                wrapper.like("name", request.getKeyword());
+                wrapper.or();
+                wrapper.like("brief", request.getKeyword());
+                wrapper.or();
+                wrapper.like("address", request.getKeyword());
+                wrapper.or();
+                wrapper.like("contacts", request.getKeyword());
+            });
+        }
+
+        Page<HolidayVillageInfo> page = new Page<>(request.getCurrent(), request.getSize());
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<HolidayVillageInfo> resultData = this.holidayVillageInfoService.page(page, queryWrapper);
+
+        return OapResponse.success().setBody(resultData);
     }
-    @ServiceMethod(method = "bz.list.venue.info", title = "场馆信息")
-    public OapResponse bzBenueInfo(AbstractOapRequest request) throws IOException {
-        return OapResponse.success().setBody(new HashMap<>());
+
+    @ServiceMethod(method = "bz.list.page.hotel.info", title = "查询酒店信息")
+    public OapResponse listPageHotelInfo(HotelInfoRequest request) {
+        QueryWrapper<HotelInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(request.getKeyword())) {
+            queryWrapper.and(true, wrapper -> {
+                wrapper.like("name", request.getKeyword());
+                wrapper.or();
+                wrapper.like("brief", request.getKeyword());
+                wrapper.or();
+                wrapper.like("address", request.getKeyword());
+                wrapper.or();
+                wrapper.like("contacts", request.getKeyword());
+            });
+        }
+
+        Page<HotelInfo> page = new Page<>(request.getCurrent(), request.getSize());
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<HotelInfo> resultData = this.hotelInfoService.page(page, queryWrapper);
+
+        return OapResponse.success().setBody(resultData);
     }
-    @ServiceMethod(method = "bz.list.scenery.info", title = "景区信息")
-    public OapResponse bzSceneryInfo(AbstractOapRequest request) throws IOException {
-        return OapResponse.success().setBody(new HashMap<>());
+
+    @ServiceMethod(method = "bz.list.page.home.stay.info", title = "查询酒店信息")
+    public OapResponse listPageHomeStayInfo(HomeStayRequest request) {
+        QueryWrapper<HomeStayInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(request.getKeyword())) {
+            queryWrapper.and(true, wrapper -> {
+                wrapper.like("name", request.getKeyword());
+                wrapper.or();
+                wrapper.like("brief", request.getKeyword());
+                wrapper.or();
+                wrapper.like("address", request.getKeyword());
+                wrapper.or();
+                wrapper.like("contacts", request.getKeyword());
+            });
+        }
+
+        Page<HomeStayInfo> page = new Page<>(request.getCurrent(), request.getSize());
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<HomeStayInfo> resultData = this.homeStayInfoService.page(page, queryWrapper);
+
+        return OapResponse.success().setBody(resultData);
     }
 
+    @ServiceMethod(method = "bz.list.page.tourist.info", title = "查询酒店信息")
+    public OapResponse listPageTouristInfo(TouristRequest request) {
+        QueryWrapper<TouristInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(request.getKeyword())) {
+            queryWrapper.and(true, wrapper -> {
+                wrapper.like("name", request.getKeyword());
+                wrapper.or();
+                wrapper.like("brief", request.getKeyword());
+                wrapper.or();
+                wrapper.like("address", request.getKeyword());
+                wrapper.or();
+                wrapper.like("contacts", request.getKeyword());
+            });
+        }
+
+        Page<TouristInfo> page = new Page<>(request.getCurrent(), request.getSize());
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<TouristInfo> resultData = this.touristInfoService.page(page, queryWrapper);
+
+        return OapResponse.success().setBody(resultData);
+    }
 }

+ 31 - 0
src/main/java/com/zhiqiyun/open/router/request/bz/HolidayVillageInfoRequest.java

@@ -0,0 +1,31 @@
+package com.zhiqiyun.open.router.request.bz;
+
+import com.dliyun.oap.framework.annotation.ServiceParamField;
+import com.dliyun.oap.framework.request.AbstractOapRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class HolidayVillageInfoRequest extends AbstractOapRequest {
+    @ServiceParamField(describe = "当前页")
+    private Integer current;
+    @ServiceParamField(describe = "每页条数")
+    private Integer size;
+    @ServiceParamField(describe = "关键词搜索")
+    private String keyword;
+
+    public Integer getCurrent() {
+        if (this.current == null || this.current < 1) {
+            return 1;
+        }
+        return this.current;
+    }
+
+    public Integer getSize() {
+        if (this.size == null || this.size < 1) {
+            return 1;
+        }
+        return this.size;
+    }
+}

+ 31 - 0
src/main/java/com/zhiqiyun/open/router/request/bz/HomeStayRequest.java

@@ -0,0 +1,31 @@
+package com.zhiqiyun.open.router.request.bz;
+
+import com.dliyun.oap.framework.annotation.ServiceParamField;
+import com.dliyun.oap.framework.request.AbstractOapRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class HomeStayRequest extends AbstractOapRequest {
+    @ServiceParamField(describe = "当前页")
+    private Integer current;
+    @ServiceParamField(describe = "每页条数")
+    private Integer size;
+    @ServiceParamField(describe = "关键词搜索")
+    private String keyword;
+
+    public Integer getCurrent() {
+        if (this.current == null || this.current < 1) {
+            return 1;
+        }
+        return this.current;
+    }
+
+    public Integer getSize() {
+        if (this.size == null || this.size < 1) {
+            return 1;
+        }
+        return this.size;
+    }
+}

+ 31 - 0
src/main/java/com/zhiqiyun/open/router/request/bz/HotelInfoRequest.java

@@ -0,0 +1,31 @@
+package com.zhiqiyun.open.router.request.bz;
+
+import com.dliyun.oap.framework.annotation.ServiceParamField;
+import com.dliyun.oap.framework.request.AbstractOapRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class HotelInfoRequest extends AbstractOapRequest {
+    @ServiceParamField(describe = "当前页")
+    private Integer current;
+    @ServiceParamField(describe = "每页条数")
+    private Integer size;
+    @ServiceParamField(describe = "关键词搜索")
+    private String keyword;
+
+    public Integer getCurrent() {
+        if (this.current == null || this.current < 1) {
+            return 1;
+        }
+        return this.current;
+    }
+
+    public Integer getSize() {
+        if (this.size == null || this.size < 1) {
+            return 1;
+        }
+        return this.size;
+    }
+}

+ 31 - 0
src/main/java/com/zhiqiyun/open/router/request/bz/SceneryInfoRequest.java

@@ -0,0 +1,31 @@
+package com.zhiqiyun.open.router.request.bz;
+
+import com.dliyun.oap.framework.annotation.ServiceParamField;
+import com.dliyun.oap.framework.request.AbstractOapRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SceneryInfoRequest extends AbstractOapRequest {
+    @ServiceParamField(describe = "当前页")
+    private Integer current;
+    @ServiceParamField(describe = "每页条数")
+    private Integer size;
+    @ServiceParamField(describe = "关键词搜索")
+    private String keyword;
+
+    public Integer getCurrent() {
+        if (this.current == null || this.current < 1) {
+            return 1;
+        }
+        return this.current;
+    }
+
+    public Integer getSize() {
+        if (this.size == null || this.size < 1) {
+            return 1;
+        }
+        return this.size;
+    }
+}

+ 31 - 0
src/main/java/com/zhiqiyun/open/router/request/bz/TouristRequest.java

@@ -0,0 +1,31 @@
+package com.zhiqiyun.open.router.request.bz;
+
+import com.dliyun.oap.framework.annotation.ServiceParamField;
+import com.dliyun.oap.framework.request.AbstractOapRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TouristRequest extends AbstractOapRequest {
+    @ServiceParamField(describe = "当前页")
+    private Integer current;
+    @ServiceParamField(describe = "每页条数")
+    private Integer size;
+    @ServiceParamField(describe = "关键词搜索")
+    private String keyword;
+
+    public Integer getCurrent() {
+        if (this.current == null || this.current < 1) {
+            return 1;
+        }
+        return this.current;
+    }
+
+    public Integer getSize() {
+        if (this.size == null || this.size < 1) {
+            return 1;
+        }
+        return this.size;
+    }
+}

+ 31 - 0
src/main/java/com/zhiqiyun/open/router/request/bz/VenueInfoRequest.java

@@ -0,0 +1,31 @@
+package com.zhiqiyun.open.router.request.bz;
+
+import com.dliyun.oap.framework.annotation.ServiceParamField;
+import com.dliyun.oap.framework.request.AbstractOapRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class VenueInfoRequest extends AbstractOapRequest {
+    @ServiceParamField(describe = "当前页")
+    private Integer current;
+    @ServiceParamField(describe = "每页条数")
+    private Integer size;
+    @ServiceParamField(describe = "关键词搜索")
+    private String keyword;
+
+    public Integer getCurrent() {
+        if (this.current == null || this.current < 1) {
+            return 1;
+        }
+        return this.current;
+    }
+
+    public Integer getSize() {
+        if (this.size == null || this.size < 1) {
+            return 1;
+        }
+        return this.size;
+    }
+}