Browse Source

监测系统

wyyay 1 year ago
parent
commit
7f62a8c334

+ 85 - 0
business-service/src/main/java/com/ozs/entity/MonitorSystem.java

@@ -0,0 +1,85 @@
+package com.ozs.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.ozs.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/7/25
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("监测系统管理")
+public class MonitorSystem extends BaseEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 客户端编号
+     */
+    private String clientId;
+
+    /**
+     *监测系统名称
+     */
+    private String monitorSystemName;
+
+    /**
+     *系统简介
+     */
+    private String systemIntroduce;
+
+    /**
+     *报警信息内容
+     */
+    private String alarmContent;
+
+    /**
+     *报警信息生成机制
+     */
+    private String alarmGenerate;
+
+    /**
+     *报警解除机制
+     */
+    private String alarmRelease;
+
+    /**
+     *报警对应的处理措施
+     */
+    private String treateMeasure;
+
+    /**
+     *状态 1在线2离线
+     */
+    private Integer status;
+
+    /**
+     *正式环境密钥
+     */
+    @TableField(exist = false)
+    private String clientSecret;
+
+    /**
+     *测试环境密钥
+     */
+    @TableField(exist = false)
+    private String testSecret;
+}

+ 5 - 0
business-service/src/main/java/com/ozs/entity/SvcAddress.java

@@ -47,4 +47,9 @@ public class SvcAddress implements Serializable {
      * 客户端密钥
      */
     private String clientSecret;
+
+    /**
+     * 环境变量1测试,2正式环境
+     */
+    private Integer env;
 }

+ 97 - 0
business-service/src/main/java/com/ozs/entity/vo/MonitorSystemVo.java

@@ -0,0 +1,97 @@
+package com.ozs.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ozs.common.vo.PageVo;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/7/26
+ */
+@Data
+public class MonitorSystemVo extends PageVo {
+    /**
+     * 主键ID
+     */
+    private Long id;
+
+    /**
+     * 客户端编号
+     */
+    private String clientId;
+
+    /**
+     *监测系统名称
+     */
+    private String monitorSystemName;
+
+    /**
+     *系统简介
+     */
+    private String systemIntroduce;
+
+    /**
+     *报警信息内容
+     */
+    private String alarmContent;
+
+    /**
+     *报警信息生成机制
+     */
+    private String alarmGenerate;
+
+    /**
+     *报警解除机制
+     */
+    private String alarmRelease;
+
+    /**
+     *报警对应的处理措施
+     */
+    private String treateMeasure;
+
+    /**
+     *状态 1在线2离线
+     */
+    private Integer status;
+
+    /**
+     *正式环境密钥
+     */
+    private String clientSecret;
+
+    /**
+     *测试环境密钥
+     */
+    private String testSecret;
+
+    /**
+     * 创建者
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /**
+     * 更新者
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 52 - 0
business-service/src/main/java/com/ozs/mapper/MonitorSystemMapper.java

@@ -0,0 +1,52 @@
+package com.ozs.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ozs.entity.MonitorSystem;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/7/25
+ */
+public interface MonitorSystemMapper extends BaseMapper<MonitorSystem> {
+    /**
+     * 新增监测系统
+     *
+     * @param monitorSystem 监测系统信息
+     * @return 结果
+     */
+    public int insertMonitorSystem(MonitorSystem monitorSystem);
+
+    /**
+     * 通过监测系统ID删除信息
+     *
+     * @param id 监测系统ID
+     * @return 结果
+     */
+    public int deleteById(Long id);
+
+    /**
+     * 批量删除监测系统
+     *
+     * @param ids 需要监测系统ID
+     * @return 结果
+     */
+    public int deleteByIds(Long[] ids);
+
+    /**
+     * 校验客户端编号是否唯一
+     *
+     * @param clientId 客户端编号
+     * @return 结果
+     */
+    public MonitorSystem checkClientIdUnique(String clientId);
+
+    /**
+     * 查询系统是否在线
+     *
+     * @param id 监测系统id
+     * @return 结果
+     */
+    public MonitorSystem checkSystemOnline(Long id);
+}
+

+ 3 - 1
business-service/src/main/java/com/ozs/mapper/SvcAddressMapper.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ozs.entity.SvcAddress;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * <p>
  * 报警消息访问令牌参数验证表 Mapper 接口
@@ -14,5 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
  */
 @Mapper
 public interface SvcAddressMapper extends BaseMapper<SvcAddress> {
-
+    List<SvcAddress> svcList(String clientId);
 }

+ 57 - 0
business-service/src/main/java/com/ozs/service/MonitorSystemService.java

@@ -0,0 +1,57 @@
+package com.ozs.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ozs.entity.MonitorSystem;
+import com.ozs.entity.vo.MonitorSystemVo;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/7/25
+ */
+public interface MonitorSystemService extends IService<MonitorSystem> {
+    /**
+     * 新增监测系统信息
+     *
+     * @param monitorSystem 监测系统信息
+     * @return 结果
+     */
+    public int insertMonitorSystem(MonitorSystem monitorSystem);
+
+    /**
+     * 批量删除监测系统
+     *
+     * @param ids 需要监测系统ID
+     * @return 结果
+     */
+    public void deleteByIds(Long[] ids);
+
+    /**
+     * 修改监测系统信息
+     *
+     * @param monitorSystem 监测系统信息
+     * @return 结果
+     */
+    public int updateMonitorSystem(MonitorSystem monitorSystem);
+
+    /**
+     * 校验客户端编号是否唯一
+     *
+     * @param monitorSystem 监测系统
+     * @return 结果
+     */
+    public String checkClientIdUnique(MonitorSystem monitorSystem);
+
+    /**
+     * 查询系统是否在线
+     *
+     * @param monitorSystem 监测系统
+     * @return 结果
+     */
+    public String checkSystemOnline(MonitorSystem monitorSystem);
+
+    MonitorSystem getMonitorSystem(Long id);
+
+    IPage<MonitorSystemVo> pageList(MonitorSystemVo monitorSystemVo);
+}

+ 166 - 0
business-service/src/main/java/com/ozs/service/impl/MonitorSystemServiceImpl.java

@@ -0,0 +1,166 @@
+package com.ozs.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.ozs.common.constant.UserConstants;
+import com.ozs.common.utils.StringUtils;
+import com.ozs.common.utils.bean.BeanUtils;
+import com.ozs.entity.MonitorSystem;
+import com.ozs.entity.SvcAddress;
+import com.ozs.entity.vo.MonitorSystemVo;
+import com.ozs.mapper.MonitorSystemMapper;
+import com.ozs.mapper.SvcAddressMapper;
+import com.ozs.service.MonitorSystemService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/7/25
+ */
+@Service
+public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, MonitorSystem> implements MonitorSystemService {
+
+    @Autowired
+    private MonitorSystemMapper monitorSystemMapper;
+    @Autowired
+    private SvcAddressMapper svcAddressMapper;
+
+    @Override
+    public int insertMonitorSystem(MonitorSystem monitorSystem) {
+        int row = monitorSystemMapper.insertMonitorSystem(monitorSystem);
+        Integer grantType =1;
+
+        SvcAddress svc = new SvcAddress();
+        svc.setClientId(monitorSystem.getClientId());
+        svc.setClientSecret(monitorSystem.getClientSecret());//正式环境
+        svc.setGrantType(grantType);
+        svc.setEnv(2);
+        int row1 =  svcAddressMapper.insert(svc);
+        SvcAddress svc1 = new SvcAddress();
+        svc1.setClientId(monitorSystem.getClientId());
+        svc1.setClientSecret(monitorSystem.getTestSecret());//测试环境
+        svc1.setGrantType(grantType);
+        svc1.setEnv(1);
+        int row2 =  svcAddressMapper.insert(svc1);
+        return row+row1+row2;
+    }
+
+    @Override
+    public void deleteByIds(Long[] ids) {
+        for(Long id :ids){
+            MonitorSystem monitorSystem = monitorSystemMapper.selectById(id);
+            LambdaQueryWrapper<SvcAddress> wrapper = new LambdaQueryWrapper<SvcAddress>();
+            wrapper.eq(SvcAddress::getClientId,monitorSystem.getClientId());
+            svcAddressMapper.delete(wrapper);
+            monitorSystemMapper.deleteById(id);
+        }
+    }
+
+    @Override
+    public int updateMonitorSystem(MonitorSystem monitorSystem) {
+        //原
+        MonitorSystem monitor = monitorSystemMapper.selectById(monitorSystem.getId());
+        List<SvcAddress> list = svcAddressMapper.svcList(monitor.getClientId());
+        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+            list.forEach(l -> {
+                if (l.getEnv().equals(1)) {//测试环境
+                    monitor.setTestSecret(l.getClientSecret());
+                } else if (l.getEnv().equals(2)) {//正式环境
+                    monitor.setClientSecret(l.getClientSecret());
+                }
+            });
+        }
+        Integer grantType =1;
+        int row1 = 0;
+        int row2 = 0;
+        if(!monitorSystem.getClientId().equals(monitor.getClientId()) || !monitorSystem.getClientSecret().equals(monitor.getClientSecret())
+            || !monitorSystem.getTestSecret().equals(monitor.getTestSecret())){//客户端编号或者正式环境密钥或者测试环境密钥改变
+            LambdaQueryWrapper<SvcAddress> wrapper = new LambdaQueryWrapper<SvcAddress>();
+            wrapper.eq(SvcAddress::getClientId,monitor.getClientId());
+            svcAddressMapper.delete(wrapper);
+
+            SvcAddress svc = new SvcAddress();
+            svc.setClientId(monitorSystem.getClientId());
+            svc.setClientSecret(monitorSystem.getClientSecret());//正式环境
+            svc.setGrantType(grantType);
+            svc.setEnv(2);
+            row1 =  svcAddressMapper.insert(svc);
+            SvcAddress svc1 = new SvcAddress();
+            svc1.setClientId(monitorSystem.getClientId());
+            svc1.setClientSecret(monitorSystem.getTestSecret());//测试环境
+            svc1.setGrantType(grantType);
+            svc1.setEnv(1);
+            row2 =  svcAddressMapper.insert(svc1);
+        }
+        int row = monitorSystemMapper.updateById(monitorSystem);
+        return row+row1+row2;
+    }
+
+    @Override
+    public String checkClientIdUnique(MonitorSystem monitorSystem) {
+        Long id = StringUtils.isNull(monitorSystem.getId()) ? -1L : monitorSystem.getId();
+        MonitorSystem monitor = monitorSystemMapper.checkClientIdUnique(monitorSystem.getClientId());
+        if (StringUtils.isNotNull(monitor) && monitor.getId().longValue() != id.longValue()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
+    @Override
+    public String checkSystemOnline(MonitorSystem monitorSystem) {
+        Long id = StringUtils.isNull(monitorSystem.getId()) ? -1L : monitorSystem.getId();
+        MonitorSystem monitor = monitorSystemMapper.checkSystemOnline(id);
+        if (StringUtils.isNotNull(monitor.getStatus()) && monitor.getStatus().equals(1)){
+            return UserConstants.EXCEPTION;
+        }
+        return UserConstants.NORMAL;
+    }
+
+    @Override
+    public MonitorSystem getMonitorSystem(Long id) {
+        MonitorSystem monitor = monitorSystemMapper.checkSystemOnline(id);
+        List<SvcAddress> list = svcAddressMapper.svcList(monitor.getClientId());
+        if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
+            list.forEach(l -> {
+                if (l.getEnv().equals(1)) {//测试环境
+                    monitor.setTestSecret(l.getClientSecret());
+                } else if (l.getEnv().equals(2)) {//正式环境
+                    monitor.setClientSecret(l.getClientSecret());
+                }
+            });
+        }
+        return monitor;
+    }
+
+    @Override
+    public IPage<MonitorSystemVo> pageList(MonitorSystemVo monitorSystemVo) {
+        LambdaQueryWrapper<MonitorSystem> wrapper = new LambdaQueryWrapper<MonitorSystem>();
+        wrapper.like(!Objects.isNull(monitorSystemVo.getMonitorSystemName()),MonitorSystem::getMonitorSystemName,monitorSystemVo.getMonitorSystemName());
+        wrapper.eq(!Objects.isNull(monitorSystemVo.getStatus()),MonitorSystem::getStatus,monitorSystemVo.getStatus());
+        int pageNum = Integer.parseInt(monitorSystemVo.getPageNum().toString());
+        int pageSize = Integer.parseInt(monitorSystemVo.getPageSize().toString());
+        com.github.pagehelper.Page<MonitorSystem> page = PageHelper
+                .startPage(pageNum, pageSize).doSelectPage(() -> monitorSystemMapper.selectList(wrapper));
+        com.baomidou.mybatisplus.extension.plugins.pagination.Page<MonitorSystemVo> pageR =
+                new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
+        if (!ObjectUtils.isEmpty(page) && page.getResult().size() > 0) {
+            List<MonitorSystemVo> dto1 = page.getResult().stream().map(o -> {
+                MonitorSystemVo monitorSystemVo1 = new MonitorSystemVo();
+                BeanUtils.copyProperties(o, monitorSystemVo1);
+                return monitorSystemVo1;
+            }).collect(Collectors.toList());
+            pageR.setRecords(dto1);
+        }
+        return pageR;
+    }
+}

+ 68 - 0
business-service/src/main/resources/mapper/MonitorSystemMapper.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ozs.mapper.MonitorSystemMapper">
+
+    <resultMap type="com.ozs.entity.MonitorSystem" id="MonitorSystemResult">
+        <id     property="id"     column="id"     />
+        <result property="clientId"   column="client_id"   />
+        <result property="monitorSystemName"   column="monitor_system_name"   />
+        <result property="systemIntroduce"   column="system_introduce"   />
+        <result property="alarmContent"     column="alarm_content"      />
+        <result property="alarmGenerate"     column="alarm_generate"      />
+        <result property="alarmRelease"   column="alarm_release"   />
+        <result property="treateMeasure" column="treate_measure" />
+        <result property="status"   column="status"   />
+        <result property="remark"     column="remark"      />
+        <result property="createBy"   column="create_by"   />
+        <result property="createTime" column="create_time" />
+        <result property="updateBy"   column="update_by"   />
+        <result property="updateTime" column="update_time" />
+    </resultMap>
+
+    <sql id="selectMonitorSystemVo">
+        select id, client_id, monitor_system_name, system_introduce,alarm_content,alarm_generate,alarm_release,treate_measure,status, create_by, create_time, remark
+		from monitor_system
+    </sql>
+
+    <insert id="insertMonitorSystem" parameterType="com.ozs.entity.MonitorSystem">
+        insert into monitor_system(
+        <if test="clientId != null and clientId != ''">client_id,</if>
+        <if test="monitorSystemName != null and monitorSystemName != ''">monitor_system_name,</if>
+        <if test="systemIntroduce != null and systemIntroduce != ''">system_introduce,</if>
+        <if test="alarmContent != null and alarmContent != ''">alarm_content,</if>
+        <if test="alarmGenerate != null and alarmGenerate != ''">alarm_generate,</if>
+        <if test="alarmRelease != null and alarmRelease != ''">alarm_release,</if>
+        <if test="treateMeasure != null and treateMeasure != ''">treate_measure,</if>
+        status,
+        <if test="remark != null and remark != ''">remark,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        create_time
+        )values(
+        <if test="clientId != null and clientId != ''">#{clientId},</if>
+        <if test="monitorSystemName != null and monitorSystemName != ''">#{monitorSystemName},</if>
+        <if test="systemIntroduce != null and systemIntroduce != ''">#{systemIntroduce},</if>
+        <if test="alarmContent != null and alarmContent != ''">#{alarmContent},</if>
+        <if test="alarmGenerate != null and alarmGenerate != ''">#{alarmGenerate},</if>
+        <if test="alarmRelease != null and alarmRelease != ''">#{alarmRelease},</if>
+        <if test="treateMeasure != null and treateMeasure != ''">#{treateMeasure},</if>
+        1,
+        <if test="remark != null and remark != ''">#{remark},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        sysdate()
+        )
+    </insert>
+
+    <delete id="deleteById" parameterType="Long">
+ 		delete from monitor_system where id = #{id}
+ 	</delete>
+
+    <select id="checkClientIdUnique" parameterType="String" resultMap="MonitorSystemResult">
+        <include refid="selectMonitorSystemVo"/>
+        where client_id = #{clientId} limit 1
+    </select>
+
+    <select id="checkSystemOnline" parameterType="Long" resultMap="MonitorSystemResult">
+        <include refid="selectMonitorSystemVo"/>
+        where id = #{id}
+    </select>
+</mapper>

+ 4 - 1
business-service/src/main/resources/mapper/SvcAddressMapper.xml

@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ozs.mapper.SvcAddressMapper">
-
+    <select id="svcList" parameterType="String" resultType="com.ozs.entity.SvcAddress">
+       select * from svc_address
+        where client_id = #{clientId}
+    </select>
 </mapper>

+ 134 - 0
vehicle-admin/src/main/java/com/ozs/web/controller/system/MonitorSystemController.java

@@ -0,0 +1,134 @@
+package com.ozs.web.controller.system;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ozs.common.annotation.Log;
+import com.ozs.common.constant.UserConstants;
+import com.ozs.common.core.controller.BaseController;
+import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.common.enums.BusinessType;
+import com.ozs.entity.MonitorSystem;
+import com.ozs.entity.vo.MonitorSystemVo;
+import com.ozs.service.MonitorSystemService;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/7/25
+ */
+@RestController
+@RequestMapping("/system/monitor")
+@Slf4j
+public class MonitorSystemController extends BaseController {
+    @Autowired
+    private MonitorSystemService monitorSystemService;
+
+    /**
+     * 分页查询
+     * @param
+     * @return
+     */
+    @Log(title = "监测系统-分页查询", businessType = BusinessType.SELECT)
+    @PostMapping("/pageList")
+    @ApiOperation(value = "监测系统分页查询")
+    public AjaxResult pageList(@RequestBody MonitorSystemVo monitorSystemVo){
+        IPage<MonitorSystemVo> page =  monitorSystemService.pageList(monitorSystemVo);
+        return AjaxResult.success(page);
+    }
+
+    /**
+     * 监测系统名称查询
+     * @param
+     * @return
+     */
+    @Log(title = "监测系统-监测系统名称查询", businessType = BusinessType.SELECT)
+    @GetMapping("/list")
+    @ApiOperation(value = "监测系统-监测系统名称查询")
+    public AjaxResult list(){
+        LambdaQueryWrapper<MonitorSystem> wrapper = new LambdaQueryWrapper<MonitorSystem>();
+        wrapper.eq(MonitorSystem::getStatus,1);
+        List<MonitorSystem> list = monitorSystemService.list(wrapper);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 详情查看
+     * @param
+     * @return
+     */
+    @Log(title = "监测系统-详情查看", businessType = BusinessType.SELECT)
+    @GetMapping("/{id}")
+    @ApiOperation(value = "监测系统-详情查看")
+    public AjaxResult detail(@PathVariable Long id){
+        MonitorSystem monitorSystem = monitorSystemService.getMonitorSystem(id);
+        return AjaxResult.success(monitorSystem);
+    }
+
+    /**
+     * 新增
+     * @param
+     * @return
+     */
+    @Log(title = "监测系统-新增", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ApiOperation(value = "监测系统-新增")
+    public AjaxResult add(@RequestBody MonitorSystem monitorSystem){
+        if (UserConstants.NOT_UNIQUE.equals(monitorSystemService.checkClientIdUnique(monitorSystem))) {
+            return error("监测系统新增'" + monitorSystem.getClientId() + "'失败,客户端编码已存在");
+        }
+        monitorSystem.setCreateBy(getUsername());
+        return AjaxResult.success(monitorSystemService.insertMonitorSystem(monitorSystem));
+    }
+
+    /**
+     * 删除
+     * @param
+     * @return
+     */
+    @Log(title = "监测系统-删除", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    @ApiOperation(value = "监测系统-删除")
+    public AjaxResult delete(@PathVariable Long[] ids){
+         monitorSystemService.deleteByIds(ids);
+         return AjaxResult.success();
+    }
+
+    /**
+     * 修改
+     * @param
+     * @return
+     */
+    @Log(title = "监测系统-修改", businessType = BusinessType.UPDATE)
+    @PutMapping
+    @ApiOperation(value = "监测系统-修改")
+    public AjaxResult update(@RequestBody MonitorSystem monitorSystem){
+        if (UserConstants.EXCEPTION.equals(monitorSystemService.checkSystemOnline(monitorSystem))) {
+            return error("监测系统修改'" + monitorSystem.getClientId() + "'失败,该系统正在使用中,无法修改");
+        }
+        monitorSystem.setUpdateBy(getUsername());
+        monitorSystem.setUpdateTime(new Date());
+        return AjaxResult.success(monitorSystemService.updateMonitorSystem(monitorSystem));
+    }
+
+    /**
+     * 生成密钥
+     * @param
+     * @return
+     */
+    @Log(title = "监测系统-生成密钥", businessType = BusinessType.SELECT)
+    @GetMapping("/getSecret")
+    @ApiOperation(value = "监测系统-生成密钥")
+    public AjaxResult getSecret(){
+        UUID id = UUID.randomUUID();
+        String[] idd = id.toString().split("-");
+        return AjaxResult.success(idd[0]+idd[1]+idd[2]);
+    }
+}