|
@@ -7,12 +7,14 @@ import com.doc.common.core.controller.BaseController;
|
|
|
import com.doc.common.core.domain.AjaxResult;
|
|
|
import com.doc.common.core.page.TableDataInfo;
|
|
|
import com.doc.common.enums.BusinessType;
|
|
|
+import com.doc.common.utils.Tools;
|
|
|
+import com.doc.common.utils.encrypt.Sm2Util;
|
|
|
import com.doc.common.utils.poi.ExcelUtil;
|
|
|
import com.doc.system.domain.SysAlarm;
|
|
|
import com.doc.system.domain.SysConfig;
|
|
|
+import com.doc.system.domain.vo.AlarmVO;
|
|
|
import com.doc.system.service.ISysAlarmService;
|
|
|
import com.doc.system.service.ISysConfigService;
|
|
|
-import com.doc.system.domain.vo.AlarmVO;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -91,7 +93,10 @@ public class SysAlarmController extends BaseController {
|
|
|
@PostMapping("/conf")
|
|
|
public AjaxResult config(@RequestBody AlarmVO vo) {
|
|
|
SysConfig config = configService.selectConfig("alarm.config");
|
|
|
- config.setConfigValue(JSON.toJSONString(vo));
|
|
|
+ //SM2加密之后压缩
|
|
|
+ String value = Sm2Util.encrypt(JSON.toJSONString(vo));
|
|
|
+ value = Tools.compress(value);
|
|
|
+ config.setConfigValue(value);
|
|
|
return toAjax(configService.updateConfig(config));
|
|
|
}
|
|
|
|
|
@@ -104,7 +109,11 @@ public class SysAlarmController extends BaseController {
|
|
|
SysConfig config = configService.selectConfig("alarm.config");
|
|
|
AlarmVO vo = new AlarmVO();
|
|
|
try {
|
|
|
- vo = JSONObject.parseObject(config.getConfigValue(), AlarmVO.class);
|
|
|
+ String value = config.getConfigValue();
|
|
|
+ //先解压缩,再SM2解密
|
|
|
+ value = Tools.uncompress(value);
|
|
|
+ value = Sm2Util.decrypt(value);
|
|
|
+ vo = JSONObject.parseObject(value, AlarmVO.class);
|
|
|
} catch (Exception ignored) {
|
|
|
}
|
|
|
return AjaxResult.success(vo);
|