|
@@ -0,0 +1,57 @@
|
|
|
|
+package com.bz.smart_city.controller.common;
|
|
|
|
+
|
|
|
|
+import com.bz.smart_city.commom.model.AjaxMessage;
|
|
|
|
+import com.bz.smart_city.commom.model.ResultStatus;
|
|
|
|
+import com.bz.smart_city.commom.util.TreeUtil;
|
|
|
|
+import com.bz.smart_city.dao.AreaMapper;
|
|
|
|
+import com.bz.smart_city.dto.AreaDto;
|
|
|
|
+import com.bz.smart_city.dto.ChannelDeviceCountDto;
|
|
|
|
+import com.bz.smart_city.dto.DeviceDto;
|
|
|
|
+import com.bz.smart_city.dto.DeviceTypeDto;
|
|
|
|
+import com.bz.smart_city.service.ChannelService;
|
|
|
|
+import com.bz.smart_city.service.DeviceService;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+@Controller
|
|
|
|
+@ResponseBody
|
|
|
|
+@RequestMapping("common")
|
|
|
|
+@Api(tags = "公共模块")
|
|
|
|
+public class CommonController {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ChannelService channelService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private AreaMapper areaMapper;
|
|
|
|
+
|
|
|
|
+ @GetMapping("/getChanelList")
|
|
|
|
+ @ApiOperation(value = "获取场景列表")
|
|
|
|
+ public AjaxMessage<List<ChannelDeviceCountDto>> getChanelList(
|
|
|
|
+ ) {
|
|
|
|
+ List<ChannelDeviceCountDto> list = channelService.getList();
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/getAllArea")
|
|
|
|
+ @ApiOperation(value = "获取所有的省市区")
|
|
|
|
+ public AjaxMessage<List<AreaDto>> getAllArea(
|
|
|
|
+ ) {
|
|
|
|
+ List<AreaDto> list = areaMapper.getAllArea();
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, TreeUtil.getArea(list, 100000, 1));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|