Commit b2d0a191 authored by zengtianlai3's avatar zengtianlai3

Merge branch 'm33' into 'master'

集成Knif4j

See merge request !23
parents 9fabaa02 035f9501
...@@ -83,6 +83,13 @@ ...@@ -83,6 +83,13 @@
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
<version>3.17</version> <version>3.17</version>
</dependency> </dependency>
<!--Knife4j API文档生产工具-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.9</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -5,13 +5,21 @@ import org.springframework.boot.SpringApplication; ...@@ -5,13 +5,21 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ServletComponentScan(basePackages ="iot.sixiang.license") @ServletComponentScan(basePackages ="iot.sixiang.license")
@SpringBootApplication @SpringBootApplication
@EnableScheduling @EnableScheduling
@MapperScan(basePackages = "iot.sixiang.license.mapper") @MapperScan(basePackages = "iot.sixiang.license.mapper")
public class LicenseApplication { public class LicenseApplication implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(LicenseApplication.class, args); SpringApplication.run(LicenseApplication.class, args);
......
package iot.sixiang.license.config;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
/**
* Created by m33 on 2022/6/13 20:04
*/
@Configuration
@EnableSwagger2WebMvc
@EnableKnife4j
//@Import(BeanValidatorPluginsConfiguration.class)
public class Knife4jConfig {
@Bean
public Docket docket() {
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(new ApiInfoBuilder()
.description("实名制服务器接口文档")
.termsOfServiceUrl("http://web.license.srthinker.com/")
.version("1.0")
.build())
//分组名称
.groupName("iot_license")
.select()
//这里指定Controller扫描包路径
.apis(RequestHandlerSelectors.basePackage("iot.sixiang.license.controller"))
.paths(PathSelectors.any())
.build();
return docket;
}
}
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import iot.sixiang.license.jwt.LoginUser; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.jwt.UserUtils; import iot.sixiang.license.jwt.UserUtils;
import iot.sixiang.license.model.ResResult; import iot.sixiang.license.model.ResResult;
import iot.sixiang.license.model.vo.AlarmVo; import iot.sixiang.license.model.vo.AlarmVo;
import iot.sixiang.license.service.AlarmService; import iot.sixiang.license.service.AlarmService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
...@@ -21,18 +24,18 @@ import java.util.List; ...@@ -21,18 +24,18 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/iot_license/alarm") @RequestMapping("/iot_license/alarm")
@Api(value = "告警模块", tags = {"告警模块"})
public class AlarmController { public class AlarmController {
@Autowired @Autowired
private AlarmService alarmService; private AlarmService alarmService;
@ApiOperation(value = "获取告警列表接口", notes = "用于获取告警列表")
@GetMapping("list") @GetMapping("list")
public ResResult getAlarmList() { public ResResult getAlarmList() {
String userId = UserUtils.getLoginUserId(); String userId = UserUtils.getLoginUserId();
int Id = Integer.valueOf(userId); int Id = Integer.valueOf(userId);
List<AlarmVo> alarmList = alarmService.getAlarmList(Id); List<AlarmVo> alarmList = alarmService.getAlarmList(Id);
return ResResult.success().record(alarmList); return ResResult.success().record(alarmList);
} }
} }
\ No newline at end of file
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
import iot.sixiang.license.service.AlarmReadService; import iot.sixiang.license.service.AlarmReadService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -20,11 +20,13 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,11 +20,13 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@RestController @RestController
@RequestMapping("/iot_license/alarm_read") @RequestMapping("/iot_license/alarm_read")
@Api(value = "告警已读模块", tags = {"告警已读模块"})
public class AlarmReadController { public class AlarmReadController {
@Autowired @Autowired
private AlarmReadService alarmReadService; private AlarmReadService alarmReadService;
@ApiOperation(value = "告警已读接口", notes = "将告警信息状态设为已读")
@PostMapping("read") @PostMapping("read")
public BaseResult readAlarm(){ public BaseResult readAlarm(){
// int userId = jsonObject.getIntValue("userId"); // int userId = jsonObject.getIntValue("userId");
......
...@@ -2,6 +2,13 @@ package iot.sixiang.license.controller; ...@@ -2,6 +2,13 @@ package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
import iot.sixiang.license.model.PageInfoModel; import iot.sixiang.license.model.PageInfoModel;
import iot.sixiang.license.model.PageResult; import iot.sixiang.license.model.PageResult;
...@@ -22,6 +29,7 @@ import java.util.List; ...@@ -22,6 +29,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/iot_license/apply") @RequestMapping("/iot_license/apply")
@Api(value = "应用模块", tags = {"应用模块"})
public class ApplyController { public class ApplyController {
@Autowired @Autowired
...@@ -32,7 +40,13 @@ public class ApplyController { ...@@ -32,7 +40,13 @@ public class ApplyController {
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ApiOperation(value = "应用添加接口", notes = "用于添加应用")
@PostMapping("add") @PostMapping("add")
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject",properties = {
@DynamicParameter(name = "appName",value = "应用名",required = true,dataTypeClass = String.class),
@DynamicParameter(name = "appKey",value = "应用key",required = true,dataTypeClass = String.class),
@DynamicParameter(name = "userId",value = "用户Id",required = true,dataTypeClass = Integer.class)
}))
public BaseResult addUser(@RequestBody JSONObject jsonObject) { public BaseResult addUser(@RequestBody JSONObject jsonObject) {
String appName = jsonObject.getString("appName"); String appName = jsonObject.getString("appName");
String appKey = jsonObject.getString("appKey"); String appKey = jsonObject.getString("appKey");
...@@ -51,7 +65,13 @@ public class ApplyController { ...@@ -51,7 +65,13 @@ public class ApplyController {
* @param pageSize * @param pageSize
* @return * @return
*/ */
@ApiOperation(value = "获取应用列表接口", notes = "用于获取应用列表")
@GetMapping("list") @GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "当前页",value = "当前在第几页", required = true),
@ApiImplicitParam(name = "每页数量",value = "每页显示多少页", required = true),
@ApiImplicitParam(name = "应用名",value = "应用名", required = false)
})
public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, @RequestParam(value = "pageSize", defaultValue = "0") int pageSize, public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, @RequestParam(value = "pageSize", defaultValue = "0") int pageSize,
@RequestParam(value = "appName",required = false) String appName) { @RequestParam(value = "appName",required = false) String appName) {
PageInfoModel<AppVo> records = applyService.getAppList(pageNo,pageSize,appName); PageInfoModel<AppVo> records = applyService.getAppList(pageNo,pageSize,appName);
......
...@@ -2,6 +2,11 @@ package iot.sixiang.license.controller; ...@@ -2,6 +2,11 @@ package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
import iot.sixiang.license.model.PageInfoModel; import iot.sixiang.license.model.PageInfoModel;
import iot.sixiang.license.model.PageResult; import iot.sixiang.license.model.PageResult;
...@@ -22,6 +27,7 @@ import java.util.List; ...@@ -22,6 +27,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/iot_license/device") @RequestMapping("/iot_license/device")
@Api(value = "设备模块", tags = {"设备模块"})
public class DeviceController { public class DeviceController {
@Autowired @Autowired
...@@ -32,7 +38,12 @@ public class DeviceController { ...@@ -32,7 +38,12 @@ public class DeviceController {
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ApiOperation(value = "添加设备接口", notes = "用于添加设备")
@PostMapping("add") @PostMapping("add")
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject",properties = {
@DynamicParameter(name = "appId",value = "应用Id",required = true,dataTypeClass = Integer.class),
@DynamicParameter(name = "count",value = "需要创建的设备数量",required = true,dataTypeClass = Integer.class),
}))
public BaseResult addDevice(@RequestBody JSONObject jsonObject) { public BaseResult addDevice(@RequestBody JSONObject jsonObject) {
int appId = jsonObject.getIntValue("appId"); int appId = jsonObject.getIntValue("appId");
int count = jsonObject.getIntValue("count"); int count = jsonObject.getIntValue("count");
...@@ -52,6 +63,7 @@ public class DeviceController { ...@@ -52,6 +63,7 @@ public class DeviceController {
* @param userName * @param userName
* @return * @return
*/ */
@ApiOperation(value = "获取设备列表接口", notes = "用于获取设备列表")
@GetMapping("list") @GetMapping("list")
public PageResult getDeviceList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, public PageResult getDeviceList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "0") int pageSize, @RequestParam(value = "pageSize", defaultValue = "0") int pageSize,
......
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.jwt.JwtUtil; import iot.sixiang.license.jwt.JwtUtil;
import iot.sixiang.license.jwt.LoginUser; import iot.sixiang.license.jwt.LoginUser;
import iot.sixiang.license.jwt.UserUtils;
import iot.sixiang.license.model.ResResult; import iot.sixiang.license.model.ResResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -19,6 +20,7 @@ import java.util.Map; ...@@ -19,6 +20,7 @@ import java.util.Map;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/") @RequestMapping("/")
@Api(value = "登录模块", tags = {"登录模块"})
public class LoginController { public class LoginController {
//模拟数据库 //模拟数据库
...@@ -32,7 +34,7 @@ public class LoginController { ...@@ -32,7 +34,7 @@ public class LoginController {
/** /**
* 模拟用户登录 * 模拟用户登录
*/ */
@ApiOperation(value = "登录接口", notes = "登录接口")
@GetMapping("login") @GetMapping("login")
public ResResult login(@RequestParam("userName") String userName, @RequestParam("password") String password) { public ResResult login(@RequestParam("userName") String userName, @RequestParam("password") String password) {
...@@ -50,6 +52,7 @@ public class LoginController { ...@@ -50,6 +52,7 @@ public class LoginController {
return ResResult.fail().msg("用户名或密码错误"); return ResResult.fail().msg("用户名或密码错误");
} }
@ApiOperation(value = "注销接口", notes = "注销接口")
@GetMapping("logout") @GetMapping("logout")
public ResResult logout(@RequestParam("userName") String userName, @RequestParam("password") String password) { public ResResult logout(@RequestParam("userName") String userName, @RequestParam("password") String password) {
// @RequestBody JSONObject jsonObject // @RequestBody JSONObject jsonObject
......
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.ResResult; import iot.sixiang.license.model.ResResult;
import iot.sixiang.license.model.SamMonitor; import iot.sixiang.license.model.SamMonitor;
import iot.sixiang.license.operate.OperateManager; import iot.sixiang.license.operate.OperateManager;
...@@ -14,6 +16,7 @@ import java.util.List; ...@@ -14,6 +16,7 @@ import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/iot_license/operate") @RequestMapping("/iot_license/operate")
@Api(value = "运维模块", tags = {"运维模块"})
public class OperateController { public class OperateController {
@Autowired @Autowired
...@@ -21,6 +24,7 @@ public class OperateController { ...@@ -21,6 +24,7 @@ public class OperateController {
@Autowired @Autowired
private MonitorService monitorService; private MonitorService monitorService;
@ApiOperation(value = "服务接口", notes = "用于获取服务列表")
@GetMapping("monitor/server") @GetMapping("monitor/server")
public ResResult getDeviceTypes() { public ResResult getDeviceTypes() {
...@@ -29,11 +33,13 @@ public class OperateController { ...@@ -29,11 +33,13 @@ public class OperateController {
} }
@ApiOperation(value = "在线数量添加接口", notes = "用于添加当前在线数量")
@PostMapping("monitor/add") @PostMapping("monitor/add")
public boolean addMonitor() { public boolean addMonitor() {
return monitorService.addMonitor(20); return monitorService.addMonitor(20);
} }
@ApiOperation(value = "获取并发量接口", notes = "用于获取并发量")
@GetMapping("monitor/qps") @GetMapping("monitor/qps")
public ResResult getQps(@RequestParam("type") int type) { public ResResult getQps(@RequestParam("type") int type) {
......
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.resource.ResourceManager; import iot.sixiang.license.resource.ResourceManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -13,11 +15,13 @@ import java.io.IOException; ...@@ -13,11 +15,13 @@ import java.io.IOException;
@RestController @RestController
@RequestMapping("/resource") @RequestMapping("/resource")
@Api(value = "资源模块", tags = {"资源模块"})
public class ResourceContrller { public class ResourceContrller {
@Autowired @Autowired
ResourceManager resourceManager; ResourceManager resourceManager;
@ApiOperation(value = "资源下载接口", notes = "用于下载资源")
@GetMapping("/download") @GetMapping("/download")
public void downloadWorkHourRecordTemplate(HttpServletResponse response, @RequestParam(value = "userId") int userId) { public void downloadWorkHourRecordTemplate(HttpServletResponse response, @RequestParam(value = "userId") int userId) {
......
package iot.sixiang.license.controller; package iot.sixiang.license.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.ResResult; import iot.sixiang.license.model.ResResult;
import iot.sixiang.license.model.SamMonitor; import iot.sixiang.license.model.SamMonitor;
import iot.sixiang.license.operate.OperateManager; import iot.sixiang.license.operate.OperateManager;
...@@ -18,11 +20,13 @@ import java.util.Map; ...@@ -18,11 +20,13 @@ import java.util.Map;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/iot_license/sam") @RequestMapping("/iot_license/sam")
@Api(value = "sam管理模块", tags = {"sam管理模块"})
public class SamMapController { public class SamMapController {
@Autowired @Autowired
public OperateManager operateManager; public OperateManager operateManager;
@ApiOperation(value = "统计sam总数接口", notes = "用于统计sam的总数和总在线数量")
@GetMapping("count") @GetMapping("count")
public ResResult getSamTotalCount() { public ResResult getSamTotalCount() {
Map<String, SamMonitor> samMonitorMap = operateManager.getSamMonitorMap(); Map<String, SamMonitor> samMonitorMap = operateManager.getSamMonitorMap();
......
...@@ -2,6 +2,8 @@ package iot.sixiang.license.controller; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.entity.Server; import iot.sixiang.license.entity.Server;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
import iot.sixiang.license.model.ResResult; import iot.sixiang.license.model.ResResult;
...@@ -21,6 +23,7 @@ import java.util.List; ...@@ -21,6 +23,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/iot_license/server") @RequestMapping("/iot_license/server")
@Api(value = "服务模块", tags = {"服务模块"})
public class ServerController { public class ServerController {
@Autowired @Autowired
...@@ -31,6 +34,7 @@ public class ServerController { ...@@ -31,6 +34,7 @@ public class ServerController {
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ApiOperation(value = "添加服务接口", notes = "用于添加服务")
@PostMapping("add") @PostMapping("add")
public BaseResult addServer(@RequestBody JSONObject jsonObject) { public BaseResult addServer(@RequestBody JSONObject jsonObject) {
String serverIp = jsonObject.getString("serverIp"); String serverIp = jsonObject.getString("serverIp");
...@@ -48,6 +52,7 @@ public class ServerController { ...@@ -48,6 +52,7 @@ public class ServerController {
* @param serverIp * @param serverIp
* @return * @return
*/ */
@ApiOperation(value = "删除服务接口", notes = "删除服务")
@PostMapping("delete") @PostMapping("delete")
public BaseResult deleteServer(@RequestParam("serverIp") String serverIp) { public BaseResult deleteServer(@RequestParam("serverIp") String serverIp) {
boolean res = serverService.deleteServer(serverIp); boolean res = serverService.deleteServer(serverIp);
...@@ -63,6 +68,7 @@ public class ServerController { ...@@ -63,6 +68,7 @@ public class ServerController {
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ApiOperation(value = "修改服务接口", notes = "修改服务")
@PostMapping("update") @PostMapping("update")
public BaseResult updateServer(@RequestBody JSONObject jsonObject) { public BaseResult updateServer(@RequestBody JSONObject jsonObject) {
String serverIp = jsonObject.getString("serverIp"); String serverIp = jsonObject.getString("serverIp");
...@@ -82,6 +88,7 @@ public class ServerController { ...@@ -82,6 +88,7 @@ public class ServerController {
* @param pageSize * @param pageSize
* @return * @return
*/ */
@ApiOperation(value = "获取服务列表接口", notes = "用于获取服务列表")
@GetMapping("list") @GetMapping("list")
public ResResult getServerList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) { public ResResult getServerList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) {
List<Server> records = serverService.getServerList(pageNo,pageSize); List<Server> records = serverService.getServerList(pageNo,pageSize);
......
...@@ -2,6 +2,11 @@ package iot.sixiang.license.controller; ...@@ -2,6 +2,11 @@ package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicParameters;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.sixiang.license.model.BaseResult; import iot.sixiang.license.model.BaseResult;
import iot.sixiang.license.model.PageInfoModel; import iot.sixiang.license.model.PageInfoModel;
import iot.sixiang.license.model.PageResult; import iot.sixiang.license.model.PageResult;
...@@ -23,6 +28,7 @@ import java.util.List; ...@@ -23,6 +28,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/iot_license/user") @RequestMapping("/iot_license/user")
@Api(value = "用户模块", tags = {"用户模块"})
public class UserController { public class UserController {
@Autowired @Autowired
...@@ -33,7 +39,12 @@ public class UserController { ...@@ -33,7 +39,12 @@ public class UserController {
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ApiOperation(value = "用户添加接口", notes = "用于添加用户")
@PostMapping("add") @PostMapping("add")
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject",properties = {
@DynamicParameter(name = "userName",value = "账户名",required = true,dataTypeClass = String.class),
@DynamicParameter(name = "company",value = "公司名",required = true,dataTypeClass = String.class)
}))
public BaseResult addUser(@RequestBody JSONObject jsonObject) { public BaseResult addUser(@RequestBody JSONObject jsonObject) {
String userName = (String) jsonObject.get("userName"); String userName = (String) jsonObject.get("userName");
String company = (String) jsonObject.get("company"); String company = (String) jsonObject.get("company");
...@@ -51,6 +62,7 @@ public class UserController { ...@@ -51,6 +62,7 @@ public class UserController {
* @param userId * @param userId
* @return * @return
*/ */
@ApiOperation(value = "用户删除接口", notes = "删除用户")
@PostMapping("delete") @PostMapping("delete")
public BaseResult deleteUser(@RequestParam("userId") int userId) { public BaseResult deleteUser(@RequestParam("userId") int userId) {
boolean res = userService.deleteUser(userId); boolean res = userService.deleteUser(userId);
...@@ -66,6 +78,7 @@ public class UserController { ...@@ -66,6 +78,7 @@ public class UserController {
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ApiOperation(value = "用户修改接口", notes = "修改用户")
@PostMapping("update") @PostMapping("update")
public BaseResult updateUser(@RequestBody JSONObject jsonObject) { public BaseResult updateUser(@RequestBody JSONObject jsonObject) {
int userId = jsonObject.getInteger("userId"); int userId = jsonObject.getInteger("userId");
...@@ -85,6 +98,7 @@ public class UserController { ...@@ -85,6 +98,7 @@ public class UserController {
* @param pageSize * @param pageSize
* @return * @return
*/ */
@ApiOperation(value = "获取用户列表接口", notes = "用于获取用户列表")
@GetMapping("list") @GetMapping("list")
public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, public PageResult getUserList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
@RequestParam(value = "pageSize",defaultValue = "0") int pageSize, @RequestParam(value = "pageSize",defaultValue = "0") int pageSize,
......
...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -12,14 +14,24 @@ import java.util.Date; ...@@ -12,14 +14,24 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("告警实体类")
public class Alarm { public class Alarm {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
@ApiModelProperty("主键Id")
private Integer id; private Integer id;
@ApiModelProperty("告警类型Id")
private int typeId; private int typeId;
@ApiModelProperty("告警标题")
private String title; private String title;
@ApiModelProperty("告警内容")
private String content; private String content;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("告警创建时间")
private Date createTime; private Date createTime;
} }
...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -21,6 +23,7 @@ import java.util.Date; ...@@ -21,6 +23,7 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("告警已读实体类")
public class AlarmRead implements Serializable { public class AlarmRead implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -29,37 +32,44 @@ public class AlarmRead implements Serializable { ...@@ -29,37 +32,44 @@ public class AlarmRead implements Serializable {
* 告警已读唯一id * 告警已读唯一id
*/ */
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
@ApiModelProperty("主键Id")
private Integer id; private Integer id;
/** /**
* 告警id * 告警id
*/ */
@ApiModelProperty("告警Id")
private int alarmId; private int alarmId;
/** /**
* 告警类型id * 告警类型id
*/ */
@ApiModelProperty("告警类型Id")
private int typeId; private int typeId;
/** /**
* 告警标题 * 告警标题
*/ */
@ApiModelProperty("告警标题")
private String title; private String title;
/** /**
* 告警内容 * 告警内容
*/ */
@ApiModelProperty("告警内容")
private String content; private String content;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty("创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** /**
* 阅读用户id * 阅读用户id
*/ */
@ApiModelProperty("阅读用户Id")
private Integer userId; private Integer userId;
......
...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -19,6 +21,7 @@ import java.io.Serializable; ...@@ -19,6 +21,7 @@ import java.io.Serializable;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("告警类型实体类")
public class AlarmType implements Serializable { public class AlarmType implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -26,17 +29,20 @@ public class AlarmType implements Serializable { ...@@ -26,17 +29,20 @@ public class AlarmType implements Serializable {
/** /**
* 告警类型id * 告警类型id
*/ */
@ApiModelProperty("主键Id")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
/** /**
* 等级 * 等级
*/ */
@ApiModelProperty("告警等级")
private Integer level; private Integer level;
/** /**
* 等级描述 * 等级描述
*/ */
@ApiModelProperty("等级描述")
private String levelDescribe; private String levelDescribe;
......
...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -19,17 +21,22 @@ import java.io.Serializable; ...@@ -19,17 +21,22 @@ import java.io.Serializable;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("应用实体类")
public class Apply implements Serializable { public class Apply implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("应用Id")
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer appId; private Integer appId;
@ApiModelProperty("应用名")
private String appName; private String appName;
@ApiModelProperty("应用key")
private String appKey; private String appKey;
@ApiModelProperty("用户Id")
private Integer userId; private Integer userId;
} }
...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -19,15 +21,19 @@ import java.io.Serializable; ...@@ -19,15 +21,19 @@ import java.io.Serializable;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("设备实体类")
public class Device implements Serializable { public class Device implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("主键Id")
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer deviceId; private Integer deviceId;
@ApiModelProperty("设备编号")
private String sn; private String sn;
@ApiModelProperty("应用Id")
private Integer appId; private Integer appId;
} }
...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -20,6 +22,7 @@ import java.time.LocalDate; ...@@ -20,6 +22,7 @@ import java.time.LocalDate;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("运维实体类")
public class Monitor implements Serializable { public class Monitor implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -27,22 +30,26 @@ public class Monitor implements Serializable { ...@@ -27,22 +30,26 @@ public class Monitor implements Serializable {
/** /**
* 主键id * 主键id
*/ */
@ApiModelProperty("主键Id")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
/** /**
* 年月日 * 年月日
*/ */
@ApiModelProperty("日期")
private LocalDate date; private LocalDate date;
/** /**
* 时 * 时
*/ */
@ApiModelProperty("小时")
private Integer hour; private Integer hour;
/** /**
* 在线数量 * 在线数量
*/ */
@ApiModelProperty("在线数量")
private Integer count; private Integer count;
......
package iot.sixiang.license.entity; package iot.sixiang.license.entity;
import java.io.Serializable; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
/** /**
* <p> * <p>
* *
...@@ -16,12 +19,15 @@ import lombok.experimental.Accessors; ...@@ -16,12 +19,15 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("服务实体类")
public class Server implements Serializable { public class Server implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("服务Ip")
private String serverIp; private String serverIp;
@ApiModelProperty("端口")
private Integer port; private Integer port;
......
...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity; ...@@ -2,6 +2,8 @@ package iot.sixiang.license.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -19,16 +21,21 @@ import java.io.Serializable; ...@@ -19,16 +21,21 @@ import java.io.Serializable;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("用户实体类")
public class User implements Serializable { public class User implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("用户Id")
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer userId; private Integer userId;
@ApiModelProperty("密码")
private String password; private String password;
@ApiModelProperty("用户名")
private String userName; private String userName;
@ApiModelProperty("公司")
private String company; private String company;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment