stjdydayou 4 éve
szülő
commit
ddfe0c2d7c

+ 0 - 1
src/main/java/com/zhiqiyun/open/core/models/bz/VenueInfo.java

@@ -18,7 +18,6 @@ public class VenueInfo {
 	private String name;
 	@TableField(typeHandler = FastjsonTypeHandler.class)
 	private List<String> litpics;
-	private String describe;
 	private String brief;
 	private String address;
 	private String contacts;

+ 73 - 15
src/main/java/com/zhiqiyun/open/mvc/manager/controller/VenueInfoController.java

@@ -1,44 +1,102 @@
 package com.zhiqiyun.open.mvc.manager.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zhiqiyun.open.annotation.Permission;
+import com.zhiqiyun.open.core.enmus.YN;
 import com.zhiqiyun.open.core.models.app.AppKeyInfo;
 import com.zhiqiyun.open.core.models.bz.VenueInfo;
+import com.zhiqiyun.open.core.service.SequenceService;
 import com.zhiqiyun.open.core.service.VenueInfoService;
 import com.zhiqiyun.open.mvc.Result;
-import com.zhiqiyun.open.mvc.manager.params.QueryAppKeyInfoParams;
 import com.zhiqiyun.open.mvc.manager.params.QueryVenueInfoParams;
+import com.zhiqiyun.open.mvc.manager.params.SaveVenueInfoParams;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+import java.util.List;
+import java.util.function.Consumer;
+
 @RestController
 @RequestMapping("/bz/base/venue")
 public class VenueInfoController {
 
-	@Autowired
-	private VenueInfoService venueInfoService;
+    @Autowired
+    private VenueInfoService venueInfoService;
+
+    @Autowired
+    private SequenceService sequenceService;
+
+    @Permission(value = "bz.base.venue.find", tags = "查询场馆")
+    @PostMapping("/findPage")
+    public Result findPage(@RequestBody QueryVenueInfoParams params) {
+
+        QueryWrapper<VenueInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(params.getContactNumber())) {
+            queryWrapper.like("contact_number", params.getContactNumber());
+        }
+        if (StringUtils.isNotBlank(params.getKeyword())) {
+            queryWrapper.and(true, new Consumer<QueryWrapper<VenueInfo>>() {
+                @Override
+                public void accept(QueryWrapper<VenueInfo> venueInfoQueryWrapper) {
+                    venueInfoQueryWrapper.like("name", params.getKeyword());
+                    venueInfoQueryWrapper.or();
+                    venueInfoQueryWrapper.like("brief", params.getKeyword());
+                    venueInfoQueryWrapper.or();
+                    venueInfoQueryWrapper.like("address", params.getKeyword());
+                    venueInfoQueryWrapper.or();
+                    venueInfoQueryWrapper.like("contacts", params.getKeyword());
+                }
+            });
+        }
+
+        Page<VenueInfo> page = params.getPage();
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<VenueInfo> resultData = this.venueInfoService.page(page, queryWrapper);
+
+        return Result.instance(Result.Code.SUCCESS).setData(resultData);
+    }
+
+    @Permission(value = "bz.base.venue.add", tags = "保存场馆")
+    @PostMapping("/save")
+    public Result save(@Valid @RequestBody SaveVenueInfoParams params) {
+
+        VenueInfo venueInfo = new VenueInfo();
+        BeanUtils.copyProperties(params, venueInfo);
+        venueInfo.setId(this.sequenceService.nextId());
+        this.venueInfoService.save(venueInfo);
+
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
 
-	@Permission(value = "bz.base.venue.find", tags = "查询")
-	@PostMapping("/findPage")
-	public Result findPage(@RequestBody QueryVenueInfoParams params) {
+    @Permission(value = "bz.base.venue.edit", tags = "编辑场馆")
+    @PostMapping("/updateById")
+    public Result updateById(Long id, @Valid @RequestBody SaveVenueInfoParams params) {
 
-		QueryWrapper<VenueInfo> queryWrapper = new QueryWrapper<>();
+        VenueInfo venueInfo = new VenueInfo();
+        BeanUtils.copyProperties(params, venueInfo);
+        venueInfo.setId(id);
 
-		if (StringUtils.isNotBlank(params.getContactNumber())) {
-			queryWrapper.like("contact_number", params.getContactNumber());
-		}
+        this.venueInfoService.updateById(venueInfo);
 
-		Page<VenueInfo> page = params.getPage();
-		page.addOrder(OrderItem.desc("id"));
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
 
-		Page<VenueInfo> resultData = this.venueInfoService.page(page, queryWrapper);
 
-		return Result.instance(Result.Code.SUCCESS).setData(resultData);
-	}
+    @Permission(value = "bz.base.venue.delete", tags = "删除场馆")
+    @PostMapping("/deleteByIds")
+    public Result deleteByIds(@RequestBody List<Long> ids) {
+        this.venueInfoService.removeByIds(ids);
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
 }

+ 20 - 0
src/main/java/com/zhiqiyun/open/mvc/manager/params/SaveVenueInfoParams.java

@@ -0,0 +1,20 @@
+package com.zhiqiyun.open.mvc.manager.params;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class SaveVenueInfoParams {
+    private String name;
+    private List<String> litpics;
+    private String describe;
+    private String brief;
+    private String address;
+    private String contacts;
+    private String contactNumber;
+    private String businessHours;
+    private BigDecimal lng;
+    private BigDecimal lat;
+}

+ 50 - 0
src/main/java/com/zhiqiyun/open/router/apis/BzApi.java

@@ -0,0 +1,50 @@
+package com.zhiqiyun.open.router.apis;
+
+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 lombok.extern.slf4j.Slf4j;
+import okhttp3.OkHttpClient;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+@Slf4j
+@ServiceMethodBean
+public class BzApi {
+
+    @Autowired
+    private OkHttpClient okHttpClient;
+
+    @Autowired
+    private SystemConfigService systemConfigService;
+
+    @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<>());
+    }
+    @ServiceMethod(method = "bz.list.hotel.info", title = "酒店与民宿信息")
+    public OapResponse bzHotelInfo(AbstractOapRequest request) throws IOException {
+        return OapResponse.success().setBody(new HashMap<>());
+    }
+    @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.venue.info", title = "场馆信息")
+    public OapResponse bzBenueInfo(AbstractOapRequest request) throws IOException {
+        return OapResponse.success().setBody(new HashMap<>());
+    }
+    @ServiceMethod(method = "bz.list.scenery.info", title = "景区信息")
+    public OapResponse bzSceneryInfo(AbstractOapRequest request) throws IOException {
+        return OapResponse.success().setBody(new HashMap<>());
+    }
+
+}