Browse Source

Merge pull request 'dev-xjf' (#62) from dev-xjf into master

Reviewed-on: http://120.26.116.243:3000/root/alert-backend/pulls/62
pull/63/head
xiaojinfei 3 weeks ago
parent
commit
3579da6598
  1. 18
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/exa/EXAController.java
  2. 2
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/exa/vo/EXAPointImportExcelVO.java
  3. 6
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/exa/vo/Point.java
  4. 18
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/instant/InstantController.java
  5. 4
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/model/RunModelController.java
  6. 12
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/vo/WarnTrendReqVO.java
  7. 19
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/warnController.java
  8. 9
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/service/instant/InstantServiceImpl.java
  9. 8
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/service/warn/WarnServiceImpl.java
  10. 91
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/utils/EXAUtils.java
  11. 4
      yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
  12. 4
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

18
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/exa/EXAController.java

@ -38,7 +38,7 @@ public class EXAController {
@GetMapping("/page")
@Operation(summary = "获取测点分页列表")
@PreAuthorize("@ss.hasPermission('alert:exa:query')")
// @PreAuthorize("@ss.hasPermission('alert:exa:query')")
public CommonResult<PageResult<EXAHttp>> getEXAList(EXAPageReqVO reqVO) throws IOException, URISyntaxException {
PageResult<EXAHttp> pageResult = exaService.getEXAPage(reqVO);
return success(BeanUtils.toBean(pageResult, EXAHttp.class));
@ -46,7 +46,7 @@ public class EXAController {
@GetMapping("/nowList")
@Operation(summary = "获取带实时值的列表")
@PreAuthorize("@ss.hasPermission('alert:exa:query')")
// @PreAuthorize("@ss.hasPermission('alert:exa:query')")
public CommonResult<List<EXAHttp>> getNowDataList(List<EXAHttp> list) throws IOException, URISyntaxException {
List<EXAHttp> nowList=exaService.getEXAListNow(list);
return success(nowList);
@ -54,7 +54,7 @@ public class EXAController {
@PostMapping("/nowListReal")
@Operation(summary = "获取带实时值的列表")
@PreAuthorize("@ss.hasPermission('alert:exa:query')")
// @PreAuthorize("@ss.hasPermission('alert:exa:query')")
public CommonResult<EXAResult> getNowList(@RequestBody EXANowListReqVO list) throws IOException, URISyntaxException {
EXAResult nowList=exaService.getEXAListNowReal(list);
return success(nowList);
@ -63,7 +63,7 @@ public class EXAController {
@GetMapping("/now")
@Operation(summary = "根据点号获取测点实时值-单点或多点")
@PreAuthorize("@ss.hasPermission('alert:exa:query')")
// @PreAuthorize("@ss.hasPermission('alert:exa:query')")
public CommonResult<String> getNowData(String itemName) throws IOException, URISyntaxException {
String nowData=exaService.getEXANow(itemName);
return success(nowData);
@ -72,7 +72,7 @@ public class EXAController {
@GetMapping("/historys")
@Operation(summary = "获取点号历史-支持多点(点号之间用逗号分割)")
@PreAuthorize("@ss.hasPermission('alert:exa:query')")
// @PreAuthorize("@ss.hasPermission('alert:exa:query')")
public CommonResult<List<List<List<Double>>>> getEXAHistorys(EXAHistoryReqVO exaHistoryReqVo) {
List<List<List<Double>>> historyLists=exaService.getEXAHistorys(exaHistoryReqVo);
return success(historyLists);
@ -80,7 +80,7 @@ public class EXAController {
@PostMapping("/create")
@Operation(summary = "新增EXA点号")
@PreAuthorize("@ss.hasPermission('alert:exa:create')")
// @PreAuthorize("@ss.hasPermission('alert:exa:create')")
public CommonResult<String> createPoint(@Valid @RequestBody Point pointVo) throws IOException {
String id = exaService.createPoint(pointVo);
return success(id);
@ -88,7 +88,7 @@ public class EXAController {
@GetMapping("/group")
@Operation(summary = "获取EXA所有组名")
@PreAuthorize("@ss.hasPermission('alert:exa:query')")
// @PreAuthorize("@ss.hasPermission('alert:exa:query')")
public CommonResult<List<List<String>>> getEXAGroupInfo() throws URISyntaxException, IOException {
List<List<String>> groupList=exaService.getEXAGroupInfo();
return success(groupList);
@ -97,7 +97,7 @@ public class EXAController {
@DeleteMapping("/delete")
@Operation(summary = "删除点号")
@Parameter(name = "ItemName", description = "点号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('alert:exa:delete')")
// @PreAuthorize("@ss.hasPermission('alert:exa:delete')")
public CommonResult<Boolean> deleteUser(@RequestParam("ItemName") String ItemName) {
String result= exaService.deletePoint(ItemName);
@ -129,7 +129,7 @@ public class EXAController {
@Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
})
@PreAuthorize("@ss.hasPermission('system:user:import')")
// @PreAuthorize("@ss.hasPermission('system:user:import')")
public CommonResult<EXAPointImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
System.out.println(file.getInputStream());

2
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/exa/vo/EXAPointImportExcelVO.java

@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题
@Accessors(chain = false) // 设置 chain = false,避免导入有问题
public class EXAPointImportExcelVO {
@ExcelProperty("点号名称")
private String ItemName;

6
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/exa/vo/Point.java

@ -9,6 +9,12 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @author xiaojinfei
* @version 1.0
* @date
* EXA加点 VO
*/
@Data
@Builder
@AllArgsConstructor

18
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/instant/InstantController.java

@ -34,7 +34,7 @@ public class InstantController {
@GetMapping("/page")
@Operation(summary = "获得模型实例分页列表")
@PreAuthorize("@ss.hasPermission('run:instant:query')")
// @PreAuthorize("@ss.hasPermission('run:instant:list')")
public CommonResult<PageResult<InstantRespVO>> getInstantPage(@Valid InstantPageReqVO pageReqVO) {
PageResult<InstantDO> pageResult = instantService.getInstantPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, InstantRespVO.class));
@ -43,7 +43,7 @@ public class InstantController {
@GetMapping("/get")
@Operation(summary = "获得实例信息")
@PreAuthorize("@ss.hasPermission('run:instant:query')")
// @PreAuthorize("@ss.hasPermission('run:instant:query')")
public CommonResult<InstantRespVO> getInstant(@RequestParam("id") Long id) {
InstantDO instant = instantService.getInstant(id);
return success(BeanUtils.toBean(instant, InstantRespVO.class));
@ -52,7 +52,7 @@ public class InstantController {
@GetMapping("/getPoint")
@Operation(summary = "获得某实例的测点列表")
@PreAuthorize("@ss.hasPermission('run:instant:query')")
// @PreAuthorize("@ss.hasPermission('run:instant:query')")
public CommonResult<List<InstantPointRespVO>> getInstantPoint(@RequestParam("id") Long id) {
List<InstantPointRespVO> instantPointList= instantService.getInstantPoint(id);
return success(instantPointList);
@ -61,7 +61,7 @@ public class InstantController {
@PostMapping("/getChart")
@Operation(summary = "获得某实例的曲线数据--默认-读历史")
@PreAuthorize("@ss.hasPermission('run:instant:query')")
// @PreAuthorize("@ss.hasPermission('run:instant:query')")
public CommonResult<List<InstantChartRespVO>> getInstantChart( @Valid @RequestBody InstantChartReqVO instantChartReqVO) {
List<InstantChartRespVO> instantChartList= instantService.getInstantChart(instantChartReqVO);
return success(instantChartList);
@ -79,7 +79,7 @@ public class InstantController {
@PutMapping("/update")
@Operation(summary = "修改模型实例")
@PreAuthorize("@ss.hasPermission('run:instant:update')")
// @PreAuthorize("@ss.hasPermission('run:instant:update')")
public CommonResult<Boolean> updateInstant(@Valid @RequestBody InstantSaveReqVO updateReqVO) {
instantService.updateInstant(updateReqVO);
return success(true);
@ -87,7 +87,7 @@ public class InstantController {
@GetMapping("/count")
@Operation(summary = "获得各状态数量列表")
@PreAuthorize("@ss.hasPermission('run:instant:query')")
// @PreAuthorize("@ss.hasPermission('run:instant:query')")
public CommonResult<InstantCountRespVO> getInstantPage() {
InstantCountRespVO instantCountRespVO= instantService.getInstantCount();
return success(BeanUtils.toBean(instantCountRespVO, InstantCountRespVO.class));
@ -97,7 +97,7 @@ public class InstantController {
@PostMapping("/create")
@Operation(summary = "创建模型实例")
@PreAuthorize("@ss.hasPermission('run:instant:create')")
// @PreAuthorize("@ss.hasPermission('run:instant:create')")
public CommonResult<List<String>> createInstant(@RequestBody InstantSaveReqVO createReqVO) throws IOException {
return success(instantService.createInstant(createReqVO));
}
@ -105,7 +105,7 @@ public class InstantController {
@DeleteMapping("/delete")
@Operation(summary = "删除模型实例")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('run:instant:delete')")
// @PreAuthorize("@ss.hasPermission('run:instant:delete')")
public CommonResult<Boolean> deleteInstant(@RequestParam("id") Long id) {
instantService.deleteInstant(id);
return success(true);
@ -114,7 +114,7 @@ public class InstantController {
@PostMapping("/calc")
@Operation(summary = "回算模型实例" )
@PreAuthorize("@ss.hasPermission('run:instant:query')")
// @PreAuthorize("@ss.hasPermission('run:instant:calc')")
public CommonResult<InstantCalcResultVO> calcInstant( @Valid @RequestBody InstantCalcReqVO instantCalcReqVO) {
InstantCalcResultVO instantCalcResult= instantService.calcInstant(instantCalcReqVO);
return success(instantCalcResult);

4
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/model/RunModelController.java

@ -36,7 +36,7 @@ public class RunModelController {
@GetMapping("/page")
@Operation(summary = "获得模型分页列表")
@PreAuthorize("@ss.hasPermission('run:model:query')")
// @PreAuthorize("@ss.hasPermission('run:model:query')")
public CommonResult<PageResult<ModelRespVO>> getModelPage(@Valid ModelPageReqVO pageReqVO) {
PageResult<ModelDO> pageResult = runModelService.getModelPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ModelRespVO.class));
@ -44,7 +44,7 @@ public class RunModelController {
@GetMapping("/version/page")
@Operation(summary = "获得模型版本分页列表")
@PreAuthorize("@ss.hasPermission('run:model:query')")
// @PreAuthorize("@ss.hasPermission('run:model:query')")
public CommonResult<PageResult<ModelVersionRespVO>> getModelVersionPage(@Valid ModelVersionPageReqVO pageReqVO) {
PageResult<ModelVersionDO> pageResult = runModelService.getModelVersionPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ModelVersionRespVO.class));

12
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/vo/WarnTrendReqVO.java

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.alert.controller.admin.warn.vo;
import cn.iocoder.yudao.module.alert.controller.admin.exa.vo.EXAHistoryReqVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class WarnTrendReqVO extends EXAHistoryReqVO {
@Schema(description = "告警id")
private Long id;
}

19
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/warnController.java

@ -7,10 +7,7 @@ import cn.iocoder.yudao.module.alert.controller.admin.exa.vo.EXAHistoryReqVO;
import cn.iocoder.yudao.module.alert.controller.admin.instant.vo.InstantPageReqVO;
import cn.iocoder.yudao.module.alert.controller.admin.instant.vo.InstantRespVO;
import cn.iocoder.yudao.module.alert.controller.admin.instant.vo.InstantSaveReqVO;
import cn.iocoder.yudao.module.alert.controller.admin.warn.vo.AlarmTrendRespVO;
import cn.iocoder.yudao.module.alert.controller.admin.warn.vo.WarnPageReqVO;
import cn.iocoder.yudao.module.alert.controller.admin.warn.vo.WarnRespVO;
import cn.iocoder.yudao.module.alert.controller.admin.warn.vo.WarnSaveReqVO;
import cn.iocoder.yudao.module.alert.controller.admin.warn.vo.*;
import cn.iocoder.yudao.module.alert.dal.dataobject.instant.InstantDO;
import cn.iocoder.yudao.module.alert.dal.dataobject.warn.AlarmLevelDO;
import cn.iocoder.yudao.module.alert.dal.dataobject.warn.WarnDO;
@ -41,14 +38,14 @@ public class warnController {
@GetMapping("/page")
@Operation(summary = "获得预警分页列表")
@PreAuthorize("@ss.hasPermission('run:warn:query')")
// @PreAuthorize("@ss.hasPermission('run:warn:query')")
public CommonResult<PageResult<WarnRespVO>> getWarnPage(@Valid WarnPageReqVO pageReqVO) {
PageResult<WarnDO> pageResult = warnService.getWarnPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, WarnRespVO.class));
}
@GetMapping("/page-real")
@Operation(summary = "获得预警分页列表")
@PreAuthorize("@ss.hasPermission('run:warn:query')")
// @PreAuthorize("@ss.hasPermission('run:warn:query')")
public CommonResult<PageResult<WarnRespVO>> getWarnPageReal(@Valid WarnPageReqVO pageReqVO) {
pageReqVO.setStatusRealTime(0L);
pageReqVO.setWarnStatus1(1L);
@ -57,7 +54,7 @@ public class warnController {
}
@GetMapping("/get")
@Operation(summary = "获得预警信息")
@PreAuthorize("@ss.hasPermission('run:warn:query')")
// @PreAuthorize("@ss.hasPermission('run:warn:query')")
public CommonResult<WarnRespVO> getWarn(@RequestParam("id") Long id) {
WarnDO warn = warnService.getWarn(id);
return success(BeanUtils.toBean(warn, WarnRespVO.class));
@ -65,7 +62,7 @@ public class warnController {
@PutMapping("/update")
@Operation(summary = "修改预警")
@PreAuthorize("@ss.hasPermission('run:warn:update')")
// @PreAuthorize("@ss.hasPermission('run:warn:update')")
public CommonResult<Boolean> updateWarn(@Valid @RequestBody WarnSaveReqVO updateReqVO) {
warnService.updateWarn(updateReqVO);
return success(true);
@ -81,10 +78,12 @@ public class warnController {
}
@GetMapping("/alarm/trend")
@PostMapping("/alarm/trend")
@Operation(summary = "获取该条告警的趋势", description = "获取该条告警的趋势")
public CommonResult<AlarmTrendRespVO> getAlarmTrend(@RequestParam("id") Long id, @Valid EXAHistoryReqVO exaHistoryReqVO) {
public CommonResult<AlarmTrendRespVO> getAlarmTrend(@Valid @RequestBody WarnTrendReqVO warnTrendReqVO) {
// versionReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
Long id = warnTrendReqVO.getId();
EXAHistoryReqVO exaHistoryReqVO = warnTrendReqVO;
AlarmTrendRespVO alarmTrendRespVO = warnService.getAlarmTrend(id, exaHistoryReqVO);
return success(alarmTrendRespVO);
}

9
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/service/instant/InstantServiceImpl.java

@ -504,17 +504,10 @@ public class InstantServiceImpl implements InstantService {
public void deleteInstant(Long id) {
// 1. 校实例存在
InstantDO instant = validateInstantExists(id);
// 2.1 删除实例
instantTableMapper.deleteById(id);
// // 2.2 删除用户关联数据
// permissionService.processUserDeleted(id);
// // 2.2 删除用户岗位
// userPostMapper.deleteByUserId(id);
// 2.2删除warn_online_cfg表该实例相关数据
// 2.2删除warn_online_cfg表该实例相关数据
warnTableMapper.deleteByMpId(id);
// 3. 记录操作日志上下文
LogRecordContext.putVariable("instant", instant);
}

8
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/service/warn/WarnServiceImpl.java

@ -277,8 +277,6 @@ public class WarnServiceImpl implements WarnService {
exaHistoryReqVO.setItemName(outpoint);
List<List<Double>> outputData = exaUtils.getHistory(EXA_IP, exaHistoryReqVO);
// 4. 数据校验
if (inputData != null || outputData != null) {
//直接深拷贝outputData
//上限值列表
List<List<Double>> upList = new ArrayList<>(outputData.size());
@ -336,11 +334,7 @@ public class WarnServiceImpl implements WarnService {
result.setValueList(Arrays.asList(inputData, upList, lowList, errorList));
result.setTagList(Arrays.asList("实时值", "上限值", "下限值", "告警值"));
return result;
}
else{
log.error("getAlarmTrend error, point: {}", point);
throw exception(ALARM_TREND_FAILED, "获取告警趋势失败: 数据为空");
}
} catch (Exception e) {
log.error("getAlarmTrend error", e);
throw exception(ALARM_TREND_FAILED, "获取告警趋势失败: " + e.getMessage());

91
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/utils/EXAUtils.java

@ -2,7 +2,10 @@ package cn.iocoder.yudao.module.alert.utils;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpStatus;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.alert.controller.admin.exa.vo.*;
import com.alibaba.fastjson.JSON;
@ -29,6 +32,10 @@ import java.lang.reflect.Type;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.EXA_HISTORY_FAILED;
public class EXAUtils {
@ -187,7 +194,7 @@ public class EXAUtils {
* @return exa列表
* [[1698369232000,0.0],[1698369332000,0.0],[1698369432000,0.0],[1698369532000,0.0],[1698369632000,0.0],[1698369732000,0.0],[1698369832000,0.0],[1698369932000,0.0],[1698370032000,0.0],[1698370132000,0.0],[1698370232000,0.0],[1698370332000,0.0],[1698370432000,0.0],[1698370532000,0.0],[1698370632000,0.0],[1698370732000,0.0],[1698370832000,0.0],[1698370932000,0.0]]
*/
public List<List<Double>> getHistory(String exaIp, EXAHistoryReqVO req) {
public List<List<Double>> getHistory_old(String exaIp, EXAHistoryReqVO req) {
List<List<Double>> result = Collections.emptyList();
try {
@ -220,14 +227,92 @@ public class EXAUtils {
body = StrUtil.unWrap(body, '\"');
// 反序列化
result = JSONUtil.toBean(body, new TypeReference<List<List<Double>>>() {}, true);
result = JSONUtil.toBean(body, new TypeReference<List<List<Double>>>() {},true);
} catch (Exception e) {
System.err.println("请求历史数据失败:" + e.getMessage());
throw exception(EXA_HISTORY_FAILED,"请求历史数据失败:" + e.getMessage());
}
return result;
}
/**
* 根据点号开始时间结束时间查询历史数据
*
* @param exaHistoryReqVo 传入对象点号开始时间结束时间
* itemName 单点号
* @return exa列表
* [[1698369232000,0.0],[1698369332000,0.0],[1698369432000,0.0],[1698369532000,0.0],[1698369632000,0.0],[1698369732000,0.0],[1698369832000,0.0],[1698369932000,0.0],[1698370032000,0.0],[1698370132000,0.0],[1698370232000,0.0],[1698370332000,0.0],[1698370432000,0.0],[1698370532000,0.0],[1698370632000,0.0],[1698370732000,0.0],[1698370832000,0.0],[1698370932000,0.0]]
*/
public List<List<Double>> getHistory(String exaIp, EXAHistoryReqVO req) {
String url = String.format(
"http://%s:9000/exawebapi/EXATime/GetSamplingValueArrayFloat",
exaIp
);
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("ItemName", req.getItemName());
paramMap.put("StartingTime", req.getStartTime());
paramMap.put("TerminalTime", req.getEndTime());
paramMap.put("SamplingPeriod", 1000 * req.getInterval());
HttpResponse response = HttpUtil.createGet(url)
.form(paramMap)
.header("Content-Type", "application/json")
.timeout(5000)
.execute();
String body = response.body();
System.out.println("服务端返回的数据为:" + body);
// 1️⃣ HTTP 状态码校验
if (response.getStatus() != HttpStatus.HTTP_OK) {
throw exception(
EXA_HISTORY_FAILED,
"EXA 接口请求失败,HTTP 状态码:" + response.getStatus() + ",响应:" + body
);
}
// 1️⃣ 如果被包成字符串,先解包
if (body.startsWith("\"")) {
body = StrUtil.replace(body, "\\", "");
body = StrUtil.unWrap(body, '\"');
}
// 2️⃣ 如果是 JSON,先判断是否为错误响应
if (JSONUtil.isTypeJSONObject(body)) {
JSONObject json = JSONUtil.parseObj(body);
// RFC 9110 风格错误
if (json.containsKey("status") && json.containsKey("errors")) {
String title = json.getStr("title");
Integer status = json.getInt("status");
JSONObject errors = json.getJSONObject("errors");
String errorMsg = errors.entrySet().stream()
.map(e -> e.getKey() + ": " + e.getValue())
.collect(Collectors.joining("; "));
throw exception(
EXA_HISTORY_FAILED,
String.format("EXA 接口校验失败(status=%d):%s,%s",
status, title, errorMsg)
);
}
}
// 4️⃣ 反序列化业务数据
try {
return JSONUtil.toBean(
body,
new TypeReference<List<List<Double>>>() {},
true
);
} catch (Exception e) {
throw exception(
EXA_HISTORY_FAILED,
"EXA 返回数据格式异常,无法解析为历史数据,body=" + body
);
}
}
// 批量查询历史数据
/**

4
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java

@ -60,7 +60,7 @@ public class FileController {
@DeleteMapping("/delete")
@Operation(summary = "删除文件")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
// @PreAuthorize("@ss.hasPermission('infra:file:delete')")
public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception {
fileService.deleteFile(id);
return success(true);
@ -93,7 +93,7 @@ public class FileController {
@GetMapping("/page")
@Operation(summary = "获得文件分页")
@PreAuthorize("@ss.hasPermission('infra:file:query')")
// @PreAuthorize("@ss.hasPermission('infra:file:query')")
public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) {
PageResult<FileDO> pageResult = fileService.getFilePage(pageVO);
return success(BeanUtils.toBean(pageResult, FileRespVO.class));

4
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

@ -179,7 +179,7 @@ public interface ErrorCodeConstants {
ErrorCode WARN_NOT_EXISTS = new ErrorCode(4_001_000, "预警信息不存在");
ErrorCode ALARM_TREND_FAILED=new ErrorCode(4_001_001, "预警趋势获取失败");
ErrorCode ALARM_TREND_FAILED=new ErrorCode(4_001_001, "预警趋势获取失败,失败原因:({})");
@ -200,6 +200,6 @@ public interface ErrorCodeConstants {
ErrorCode EXA_POINT_IMPORT_LIST_IS_EMPTY = new ErrorCode(6_001_000, "导入EXA测点数据不能为空!");
ErrorCode EXA_POINT_IMPORT_FAILED = new ErrorCode(6_001_001, "导入EXA测点数据失败!失败测点:({})");
ErrorCode EXA_REAL_FAILED = new ErrorCode(6_001_002, "读取EXA测点实时数据失败!失败测点:({})");
ErrorCode EXA_HISTORY_IS_EMPTY = new ErrorCode(6_001_003, "EXA测点历史数据获取失败!");
ErrorCode EXA_HISTORY_FAILED = new ErrorCode(6_001_003, "EXA测点历史数据获取失败!原因:({})");
}

Loading…
Cancel
Save