459242451@qq.com преди 4 години
родител
ревизия
30fd17fd63

+ 70 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/gas/ThresholdController.java

@@ -0,0 +1,70 @@
+package com.ruoyi.web.controller.gas;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.util.StringUtil;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.service.ISysConfigService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 阈值管理
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/threshold")
+@Api(tags = "阈值管理")
+public class ThresholdController extends BaseController {
+    @Autowired
+    private ISysConfigService configService;
+
+    /**
+     * 获取参数配置列表(type:so2、black、ais)
+     */
+//    @PreAuthorize("@ss.hasPermi('system:config:list')")
+    @GetMapping("/list")
+    @ApiOperation("获取参数配置列表(type:so2、black、ais)")
+    public TableDataInfo list(@RequestParam String type) {
+        List<SysConfig> list = configService.selectRightList(type);
+        return getDataTable(list);
+    }
+
+    /**
+     * 修改参数配置
+     */
+    @PreAuthorize("@ss.hasPermi('system:config:edit')")
+    @Log(title = "阈值更新", businessType = BusinessType.UPDATE)
+    @PutMapping("/edit")
+    @ApiOperation("阈值更新")
+    public AjaxResult edit(@RequestBody JSONObject jsonObject) {
+        if (StrUtil.isBlank(jsonObject.getString("configId"))) {
+            return AjaxResult.error("id不能为空");
+        }
+        SysConfig sysConfig = configService.selectConfigById(jsonObject.getLongValue("configId"));
+        if (sysConfig == null) {
+            return AjaxResult.error();
+        }
+        sysConfig.setConfigValue(jsonObject.getString("configValue"));
+        sysConfig.setUpdateBy(SecurityUtils.getUsername());
+        return toAjax(configService.updateThresholdConfig(sysConfig));
+    }
+
+}

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java

@@ -113,9 +113,9 @@ public class SwaggerConfig
         // 用ApiInfoBuilder进行定制
         return new ApiInfoBuilder()
                 // 设置标题
-                .title("标题:若依管理系统_接口文档")
+                .title("船舶尾气监测管理系统_接口文档")
                 // 描述
-                .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
+                .description("")
                 // 作者信息
                 .contact(new Contact(ruoyiConfig.getName(), null, null))
                 // 版本

+ 6 - 0
ruoyi-framework/pom.xml

@@ -65,6 +65,12 @@
             <artifactId>lombok</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.3.10</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java

@@ -59,7 +59,7 @@ public class CaptchaConfig
         // 验证码图片高度 默认为50
         properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60");
         // 验证码文本字符大小 默认为40
-        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35");
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "43");
         // KAPTCHA_SESSION_KEY
         properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath");
         // 验证码文本生成器

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
 
 import java.util.List;
 import com.ruoyi.system.domain.SysConfig;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 参数配置 数据层
@@ -65,4 +66,8 @@ public interface SysConfigMapper
      * @return 结果
      */
     public int deleteConfigByIds(Long[] configIds);
+
+    List<SysConfig> selectRightList(@Param("type") String type);
+
+    int updateThresholdConfig(SysConfig sysConfig);
 }

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java

@@ -87,4 +87,8 @@ public interface ISysConfigService
      * @return 结果
      */
     public String checkConfigKeyUnique(SysConfig config);
+
+    List<SysConfig> selectRightList(String type);
+
+    int updateThresholdConfig(SysConfig sysConfig);
 }

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java

@@ -213,6 +213,21 @@ public class SysConfigServiceImpl implements ISysConfigService
         return UserConstants.UNIQUE;
     }
 
+    @Override
+    public List<SysConfig> selectRightList(String type) {
+        return configMapper.selectRightList(type);
+    }
+
+    @Override
+    public int updateThresholdConfig(SysConfig sysConfig) {
+        int row = configMapper.updateThresholdConfig(sysConfig);
+        if (row > 0)
+        {
+            redisCache.setCacheObject(getCacheKey(sysConfig.getConfigKey()), sysConfig.getConfigValue());
+        }
+        return row;
+    }
+
     /**
      * 设置cache key
      * 

+ 17 - 2
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -63,7 +63,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectConfigVo"/>
         where config_key = #{configKey} limit 1
     </select>
-    
+
+    <select id="selectRightList" parameterType="String" resultMap="SysConfigResult">
+        <include refid="selectConfigVo"/>
+        where config_key like concat(#{type},'%')
+    </select>
+
     <insert id="insertConfig" parameterType="SysConfig">
         insert into sys_config (
 			<if test="configName != null and configName != '' ">config_name,</if>
@@ -97,7 +102,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </set>
         where config_id = #{configId}
     </update>
-	
+
+    <update id="updateThresholdConfig">
+        update sys_config
+        <set>
+            config_value = #{configValue},
+            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            update_time = sysdate()
+        </set>
+        where config_id = #{configId}
+    </update>
+
     <delete id="deleteConfigById" parameterType="Long">
         delete from sys_config where config_id = #{configId}
     </delete>