Commit 703116b2 authored by AfirSraftGarrier's avatar AfirSraftGarrier

修改

parent 83e9f4c9
...@@ -17,13 +17,14 @@ import iot.sixiang.license.model.PageResult; ...@@ -17,13 +17,14 @@ import iot.sixiang.license.model.PageResult;
import iot.sixiang.license.model.vo.AppVo; import iot.sixiang.license.model.vo.AppVo;
import iot.sixiang.license.service.ApplyService; import iot.sixiang.license.service.ApplyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
/** /**
* <p> * <p>
* 前端控制器 * 前端控制器
* </p> * </p>
* *
* @author m33 * @author m33
...@@ -37,18 +38,24 @@ public class ApplyController { ...@@ -37,18 +38,24 @@ public class ApplyController {
@Autowired @Autowired
private ApplyService applyService; private ApplyService applyService;
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.setDisallowedFields(new String[]{"adminCome"});
}
/** /**
* 添加apply * 添加apply
*
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ApiOperation(value = "应用添加接口", notes = "用于添加应用") @ApiOperation(value = "应用添加接口", notes = "用于添加应用")
@PostMapping("add") @PostMapping("add")
@MyLog(title = "添加应用", optParam = "#{jsonObject}", businessType = BusinessType.INSERT) @MyLog(title = "添加应用", optParam = "#{jsonObject}", businessType = BusinessType.INSERT)
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject",properties = { @ApiOperationSupport(params = @DynamicParameters(name = "jsonObject", properties = {
@DynamicParameter(name = "appName",value = "应用名",required = true,dataTypeClass = String.class), @DynamicParameter(name = "appName", value = "应用名", required = true, dataTypeClass = String.class),
@DynamicParameter(name = "appKey",value = "应用key",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) @DynamicParameter(name = "userId", value = "用户Id", required = true, dataTypeClass = Integer.class)
})) }))
public BaseResult addApply(@RequestBody JSONObject jsonObject) { public BaseResult addApply(@RequestBody JSONObject jsonObject) {
String appName = jsonObject.getString("appName"); String appName = jsonObject.getString("appName");
...@@ -64,6 +71,7 @@ public class ApplyController { ...@@ -64,6 +71,7 @@ public class ApplyController {
/** /**
* 分页查询所有的apply * 分页查询所有的apply
*
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @return * @return
...@@ -72,21 +80,21 @@ public class ApplyController { ...@@ -72,21 +80,21 @@ public class ApplyController {
@GetMapping("list") @GetMapping("list")
@MyLog(title = "获取应用列表", optParam = "#{pageNo},#{pageSize},#{appName}", businessType = BusinessType.SELECT) @MyLog(title = "获取应用列表", optParam = "#{pageNo},#{pageSize},#{appName}", businessType = BusinessType.SELECT)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "pageNo",value = "当前在第几页", required = true, dataType = "int"), @ApiImplicitParam(name = "pageNo", value = "当前在第几页", required = true, dataType = "int"),
@ApiImplicitParam(name = "pageSize",value = "每页显示多少页", required = true, dataType = "int"), @ApiImplicitParam(name = "pageSize", value = "每页显示多少页", required = true, dataType = "int"),
@ApiImplicitParam(name = "appName",value = "应用名") @ApiImplicitParam(name = "appName", value = "应用名")
}) })
public PageResult<AppVo> getAppList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, public PageResult<AppVo> getAppList(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo,
@RequestParam(value = "pageSize", defaultValue = "0") int pageSize, @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);
int total = records.getTotal(); int total = records.getTotal();
int pages = total/pageSize;//pages为总页数 int pages = total / pageSize;//pages为总页数
int mod = total%pageSize; int mod = total % pageSize;
if(mod!=0){ if (mod != 0) {
pages = pages +1; pages = pages + 1;
} }
List<AppVo> result = records.getResult(); List<AppVo> result = records.getResult();
return new PageResult(200,"查找成功",pageNo,pages,total,result); return new PageResult(200, "查找成功", pageNo, pages, total, result);
} }
} }
\ No newline at end of file
...@@ -26,6 +26,7 @@ import iot.sixiang.license.service.AlarmService; ...@@ -26,6 +26,7 @@ import iot.sixiang.license.service.AlarmService;
import iot.sixiang.license.service.MonitorService; import iot.sixiang.license.service.MonitorService;
import iot.sixiang.license.service.ServerService; import iot.sixiang.license.service.ServerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.owasp.esapi.ESAPI;
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.*;
...@@ -92,7 +93,8 @@ public class OperateController { ...@@ -92,7 +93,8 @@ public class OperateController {
@MyLog(title = "获取告警列表", businessType = BusinessType.SELECT) @MyLog(title = "获取告警列表", businessType = BusinessType.SELECT)
public ResResult<List<AlarmVo>> getAlarmList() { public ResResult<List<AlarmVo>> getAlarmList() {
String userId = UserUtils.getLoginUserId(); String userId = UserUtils.getLoginUserId();
int Id = Integer.valueOf(userId); String comeId = ESAPI.encoder().encodeForHTML(userId);
int Id = Integer.valueOf(comeId);
List<AlarmVo> alarmList = alarmService.getAlarmList(Id); List<AlarmVo> alarmList = alarmService.getAlarmList(Id);
return ResResult.success().goRecord(alarmList); return ResResult.success().goRecord(alarmList);
} }
...@@ -138,10 +140,7 @@ public class OperateController { ...@@ -138,10 +140,7 @@ public class OperateController {
@ApiOperation(value = "添加服务接口", notes = "用于添加服务") @ApiOperation(value = "添加服务接口", notes = "用于添加服务")
@PostMapping("server/add") @PostMapping("server/add")
@MyLog(title = "添加服务", optParam = "#{jsonObject}", businessType = BusinessType.INSERT) @MyLog(title = "添加服务", optParam = "#{jsonObject}", businessType = BusinessType.INSERT)
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject", properties = { @ApiOperationSupport(params = @DynamicParameters(name = "jsonObject", properties = {@DynamicParameter(name = "serverIp", value = "服务Ip", required = true, dataTypeClass = String.class), @DynamicParameter(name = "port", value = "端口", required = true, dataTypeClass = Integer.class)}))
@DynamicParameter(name = "serverIp", value = "服务Ip", required = true, dataTypeClass = String.class),
@DynamicParameter(name = "port", value = "端口", required = true, dataTypeClass = Integer.class)
}))
public BaseResult addServer(@RequestBody JSONObject jsonObject) { public BaseResult addServer(@RequestBody JSONObject jsonObject) {
String serverIp = jsonObject.getString("serverIp"); String serverIp = jsonObject.getString("serverIp");
int port = jsonObject.getIntValue("port"); int port = jsonObject.getIntValue("port");
...@@ -180,10 +179,7 @@ public class OperateController { ...@@ -180,10 +179,7 @@ public class OperateController {
@ApiOperation(value = "修改服务接口", notes = "修改服务") @ApiOperation(value = "修改服务接口", notes = "修改服务")
@PostMapping("server/update") @PostMapping("server/update")
@MyLog(title = "修改服务", optParam = "#{serverIp},#{port}", businessType = BusinessType.UPDATE) @MyLog(title = "修改服务", optParam = "#{serverIp},#{port}", businessType = BusinessType.UPDATE)
@ApiOperationSupport(params = @DynamicParameters(name = "jsonObject", properties = { @ApiOperationSupport(params = @DynamicParameters(name = "jsonObject", properties = {@DynamicParameter(name = "serverIp", value = "服务Ip", required = true, dataTypeClass = String.class), @DynamicParameter(name = "port", value = "端口", required = true, dataTypeClass = Integer.class)}))
@DynamicParameter(name = "serverIp", value = "服务Ip", required = true, dataTypeClass = String.class),
@DynamicParameter(name = "port", value = "端口", required = true, dataTypeClass = Integer.class)
}))
public BaseResult updateServer(@RequestBody JSONObject jsonObject) { public BaseResult updateServer(@RequestBody JSONObject jsonObject) {
String serverIp = jsonObject.getString("serverIp"); String serverIp = jsonObject.getString("serverIp");
int port = jsonObject.getInteger("port"); int port = jsonObject.getInteger("port");
...@@ -206,12 +202,8 @@ public class OperateController { ...@@ -206,12 +202,8 @@ public class OperateController {
@ApiOperation(value = "获取服务列表接口", notes = "用于获取服务列表") @ApiOperation(value = "获取服务列表接口", notes = "用于获取服务列表")
@GetMapping("server/list") @GetMapping("server/list")
@MyLog(title = "获取服务列表", optParam = "#{pageNo},#{pageSize}", businessType = BusinessType.SELECT) @MyLog(title = "获取服务列表", optParam = "#{pageNo},#{pageSize}", businessType = BusinessType.SELECT)
@ApiImplicitParams({ @ApiImplicitParams({@ApiImplicitParam(name = "pageNo", value = "当前在第几页", required = true, dataType = "int"), @ApiImplicitParam(name = "pageSize", value = "每页显示多少条", required = true, dataType = "int")})
@ApiImplicitParam(name = "pageNo", value = "当前在第几页", required = true, dataType = "int"), public ResResult<List<Server>> getServerList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) {
@ApiImplicitParam(name = "pageSize", value = "每页显示多少条", required = true, dataType = "int")
})
public ResResult<List<Server>> getServerList(@RequestParam("pageNo") int pageNo,
@RequestParam("pageSize") int pageSize) {
List<Server> records = serverService.getServerList(pageNo, pageSize); List<Server> records = serverService.getServerList(pageNo, pageSize);
return ResResult.success().goRecord(records); return ResResult.success().goRecord(records);
} }
......
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