Merge branch 'dev-tw'

This commit is contained in:
tangwei 2026-07-24 09:01:03 +08:00
commit 5063540d75
82 changed files with 3415 additions and 175 deletions

View File

@ -265,6 +265,24 @@ public class SwaggerConfig {
.build(); .build();
} }
@Bean
public GroupedOpenApi groupWarnRuleApi() {
return GroupedOpenApi.builder()
.group("5.5 预警规则")
.packagesToScan("com.yfd.platform.qgc_sys.warnRule.controller")
.build();
}
@Bean
public GroupedOpenApi groupPsbmodulelbbApi() {
return GroupedOpenApi.builder()
.group("5.6 电站与布局组件配置管理")
.packagesToScan("com.yfd.platform.qgc_sys.psbmodulelbb.controller")
.build();
}
@Bean @Bean
public GroupedOpenApi groupLygkApi() { public GroupedOpenApi groupLygkApi() {

View File

@ -1,26 +1,36 @@
package com.yfd.platform.qgc_base.controller; package com.yfd.platform.qgc_base.controller;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yfd.platform.annotation.Log; import com.yfd.platform.annotation.Log;
import com.yfd.platform.common.DataSourceRequest; import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.config.ResponseResult; import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.qgc_base.domain.SdEngInfoBHOperateRequest;
import com.yfd.platform.qgc_base.domain.SdFishDictoryB; import com.yfd.platform.qgc_base.domain.SdFishDictoryB;
import com.yfd.platform.qgc_base.service.ISdFishDictoryBService; import com.yfd.platform.qgc_base.service.ISdFishDictoryBService;
import com.yfd.platform.utils.DataSourceRequestUtil; import com.yfd.platform.qgc_data.service.AttachmentUploadService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
* 鱼类字典表 前端控制器 * 鱼类字典表 前端控制器
* </p> * </p>
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/env/fishDictory") @RequestMapping("/env/fishDictory")
@Tag(name = "鱼类字典管理") @Tag(name = "鱼类字典管理")
@ -29,25 +39,23 @@ public class SdFishDictoryBController {
@Resource @Resource
private ISdFishDictoryBService sdFishDictoryBService; private ISdFishDictoryBService sdFishDictoryBService;
@Resource
private ObjectMapper objectMapper;
@Resource
private AttachmentUploadService attachmentUploadService;
@PostMapping("/queryPageList") @PostMapping("/queryPageList")
@Operation(summary = "分页查询鱼类字典列表(支持动态过滤和排序)") @Operation(summary = "分页查询鱼类字典列表(支持动态过滤和排序)")
public ResponseResult queryPageList(@RequestBody DataSourceRequest request) { public ResponseResult queryPageList(@RequestBody DataSourceRequest request) {
Page<SdFishDictoryB> page = DataSourceRequestUtil.executeQuery( Page<SdFishDictoryB> page = sdFishDictoryBService.queryPageList(request);
request,
SdFishDictoryB.class,
sdFishDictoryBService
);
return ResponseResult.successData(page); return ResponseResult.successData(page);
} }
@PostMapping("/list") @PostMapping("/list")
@Operation(summary = "查询鱼类字典列表(支持动态过滤和排序,不分页)") @Operation(summary = "查询鱼类字典列表(支持动态过滤和排序,不分页)")
public ResponseResult list(@RequestBody DataSourceRequest request) { public ResponseResult list(@RequestBody DataSourceRequest request) {
List<SdFishDictoryB> list = DataSourceRequestUtil.executeList( List<SdFishDictoryB> list = sdFishDictoryBService.list();
request,
SdFishDictoryB.class,
sdFishDictoryBService
);
return ResponseResult.successData(list); return ResponseResult.successData(list);
} }
@ -56,7 +64,8 @@ public class SdFishDictoryBController {
public ResponseResult listByName(@RequestParam(required = false) String name) { public ResponseResult listByName(@RequestParam(required = false) String name) {
return ResponseResult.successData(sdFishDictoryBService.list( return ResponseResult.successData(sdFishDictoryBService.list(
new LambdaQueryWrapper<SdFishDictoryB>() new LambdaQueryWrapper<SdFishDictoryB>()
.eq(StrUtil.isNotBlank(name), SdFishDictoryB::getName, name).select(SdFishDictoryB::getId, SdFishDictoryB::getName, SdFishDictoryB::getAlias) .eq(StrUtil.isNotBlank(name), SdFishDictoryB::getName, name)
.select(SdFishDictoryB::getId, SdFishDictoryB::getName, SdFishDictoryB::getAlias)
)); ));
} }
@ -69,24 +78,84 @@ public class SdFishDictoryBController {
@Log(module = "鱼类字典管理", value = "新增鱼类字典") @Log(module = "鱼类字典管理", value = "新增鱼类字典")
@PostMapping("/add") @PostMapping("/add")
@Operation(summary = "新增鱼类字典") @Operation(summary = "新增鱼类字典")
public ResponseResult add(@RequestBody SdFishDictoryB fishDictoryB) { public ResponseResult add(@RequestParam("data") String dataStr,
boolean result = sdFishDictoryBService.add(fishDictoryB); @RequestParam(value = "files", required = false) List<MultipartFile> files) {
return result ? ResponseResult.success("新增成功") : ResponseResult.error("新增失败"); try {
SdEngInfoBHOperateRequest request = objectMapper.readValue(dataStr, SdEngInfoBHOperateRequest.class);
SdFishDictoryB entity = request == null || request.getEngInfo() == null ? null
: objectMapper.convertValue(request.getEngInfo(), SdFishDictoryB.class);
if (entity == null) {
return ResponseResult.error("数据不能为空");
}
entity.setId(IdUtil.simpleUUID());
entity.setCode(entity.getId());
// 上传文件并设置附件ID到实体
applyUploadedFiles(entity, files);
boolean result = sdFishDictoryBService.add(entity, request.getSource());
return result ? ResponseResult.success("新增成功") : ResponseResult.error("新增失败");
} catch (Exception e) {
log.error("新增鱼类字典失败", e);
return ResponseResult.error("新增失败: " + e.getMessage());
}
} }
@Log(module = "鱼类字典管理", value = "修改鱼类字典") @Log(module = "鱼类字典管理", value = "修改鱼类字典")
@PostMapping("/update") @PostMapping("/update")
@Operation(summary = "修改鱼类字典") @Operation(summary = "修改鱼类字典")
public ResponseResult update(@RequestBody SdFishDictoryB fishDictoryB) { public ResponseResult update(@RequestParam("data") String dataStr,
boolean result = sdFishDictoryBService.updateById(fishDictoryB); @RequestParam(value = "files", required = false) List<MultipartFile> files) {
return result ? ResponseResult.success("修改成功") : ResponseResult.error("修改失败"); try {
SdEngInfoBHOperateRequest request = objectMapper.readValue(dataStr, SdEngInfoBHOperateRequest.class);
SdFishDictoryB entity = request == null || request.getEngInfo() == null ? null
: objectMapper.convertValue(request.getEngInfo(), SdFishDictoryB.class);
if (entity == null || entity.getId() == null) {
return ResponseResult.error("数据或ID不能为空");
}
// 获取修改前的实体用于后续清理旧文件
SdFishDictoryB before = sdFishDictoryBService.getById(entity.getId());
List<String> oldAttachmentIds = before != null ? collectAttachmentIds(before) : Collections.emptyList();
// 上传新文件并设置附件ID
applyUploadedFiles(entity, files);
boolean result = sdFishDictoryBService.update(entity, request.getSource());
if (result) {
// 清理被替换的旧文件
deleteReplacedFiles(oldAttachmentIds, collectAttachmentIds(entity));
}
return result ? ResponseResult.success("修改成功") : ResponseResult.error("修改失败");
} catch (Exception e) {
log.error("修改鱼类字典失败", e);
return ResponseResult.error("修改失败: " + e.getMessage());
}
} }
@Log(module = "鱼类字典管理", value = "删除鱼类字典") @Log(module = "鱼类字典管理", value = "删除鱼类字典")
@PostMapping("/delete") @PostMapping("/delete")
@Operation(summary = "删除鱼类字典") @Operation(summary = "删除鱼类字典")
public ResponseResult delete(@RequestParam String id) { public ResponseResult delete(@RequestBody SdEngInfoBHOperateRequest request) {
boolean result = sdFishDictoryBService.deleteById(id); List<String> ids = request == null ? null : request.getIds();
if (ids == null || ids.isEmpty()) {
return ResponseResult.error("ID不能为空");
}
// 删除前先收集所有需要清理的附件ID
List<String> allAttachmentIds = new ArrayList<>();
for (String id : ids) {
SdFishDictoryB entity = sdFishDictoryBService.getById(id);
if (entity != null) {
allAttachmentIds.addAll(collectAttachmentIds(entity));
}
}
boolean result = sdFishDictoryBService.delete(ids, request.getSource());
if (result) {
// 删除关联的附件
deleteAttachments(allAttachmentIds);
}
return result ? ResponseResult.success("删除成功") : ResponseResult.error("删除失败"); return result ? ResponseResult.success("删除成功") : ResponseResult.error("删除失败");
} }
@ -97,4 +166,67 @@ public class SdFishDictoryBController {
@RequestParam(required = false, defaultValue = "10") Integer limit) { @RequestParam(required = false, defaultValue = "10") Integer limit) {
return ResponseResult.successData(sdFishDictoryBService.findSimilarFish(name, limit)); return ResponseResult.successData(sdFishDictoryBService.findSimilarFish(name, limit));
} }
}
// ==================== 文件处理辅助方法 ====================
/**
* 上传文件并追加附件ID到inffile字段与已有ID以逗号拼接
*/
private void applyUploadedFiles(SdFishDictoryB entity, List<MultipartFile> files) {
if (files == null || files.isEmpty()) {
return;
}
List<String> attachmentIds = attachmentUploadService.uploadMultipartFiles(files);
if (attachmentIds.isEmpty()) {
return;
}
// 新上传的文件ID
String newIds = attachmentIds.stream()
.filter(StrUtil::isNotBlank)
.collect(Collectors.joining(","));
if (StrUtil.isBlank(newIds)) {
return;
}
// 追加到已有的inffile后面
String existing = StrUtil.isNotBlank(entity.getInffile()) ? entity.getInffile() : "";
String merged = StrUtil.isBlank(existing) ? newIds : existing + "," + newIds;
entity.setInffile(merged);
}
/**
* 收集实体中inffile字段的附件ID
*/
private List<String> collectAttachmentIds(SdFishDictoryB entity) {
List<String> ids = new ArrayList<>();
if (StrUtil.isNotBlank(entity.getInffile())) {
Arrays.stream(entity.getInffile().split(","))
.map(String::trim)
.filter(StrUtil::isNotBlank)
.forEach(ids::add);
}
return ids;
}
/**
* 删除被替换的旧文件old中有但new中没有的
*/
private void deleteReplacedFiles(List<String> oldIds, List<String> newIds) {
for (String oldId : oldIds) {
if (StrUtil.isBlank(oldId)) continue;
if (!newIds.contains(oldId)) {
attachmentUploadService.deleteFile(oldId);
}
}
}
/**
* 批量删除附件
*/
private void deleteAttachments(List<String> attachmentIds) {
for (String id : attachmentIds) {
if (StrUtil.isNotBlank(id)) {
attachmentUploadService.deleteFile(id);
}
}
}
}

View File

@ -0,0 +1,162 @@
package com.yfd.platform.qgc_base.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yfd.platform.annotation.Log;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.qgc_base.domain.SdEngInfoBHOperateRequest;
import com.yfd.platform.qgc_base.domain.SdFpssrlR;
import com.yfd.platform.qgc_base.domain.SdFpssrlRAiRequest;
import com.yfd.platform.qgc_base.service.ISdFpssrlRService;
import com.yfd.platform.qgc_data.service.AttachmentUploadService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 过鱼设施自动数据表AI识别 前端控制器
* </p>
*/
@Slf4j
@RestController
@RequestMapping("/base/fpssrlR")
@Tag(name = "过鱼设施自动数据管理")
public class SdFpssrlRController {
@Resource
private ISdFpssrlRService sdFpssrlRService;
@Resource
private ObjectMapper objectMapper;
@Resource
private AttachmentUploadService attachmentUploadService;
// ==================== CRUD 方法 ====================
@PostMapping("/queryPageList")
@Operation(summary = "分页查询过鱼自动数据列表(支持动态过滤和排序)")
public ResponseResult queryPageList(@RequestBody DataSourceRequest request) {
Page<SdFpssrlR> page = sdFpssrlRService.queryPageList(request);
return ResponseResult.successData(page);
}
@GetMapping("/getById")
@Operation(summary = "根据ID查询过鱼自动数据")
public ResponseResult getById(@RequestParam String id) {
return ResponseResult.successData(sdFpssrlRService.getById(id));
}
@Log(module = "过鱼设施自动数据管理", value = "新增过鱼自动数据")
@PostMapping("/add")
@Operation(summary = "新增过鱼自动数据")
public ResponseResult add(@RequestBody SdEngInfoBHOperateRequest request) {
SdFpssrlR entity = request == null || request.getEngInfo() == null ? null
: objectMapper.convertValue(request.getEngInfo(), SdFpssrlR.class);
if (entity == null) {
return ResponseResult.error("数据不能为空");
}
boolean result = sdFpssrlRService.add(entity, request.getSource());
return result ? ResponseResult.success("新增成功") : ResponseResult.error("新增失败");
}
@Log(module = "过鱼设施自动数据管理", value = "修改过鱼自动数据")
@PostMapping("/update")
@Operation(summary = "修改过鱼自动数据")
public ResponseResult update(@RequestBody SdEngInfoBHOperateRequest request) {
SdFpssrlR entity = request == null || request.getEngInfo() == null ? null
: objectMapper.convertValue(request.getEngInfo(), SdFpssrlR.class);
if (entity == null || entity.getId() == null) {
return ResponseResult.error("数据或ID不能为空");
}
boolean result = sdFpssrlRService.update(entity, request.getSource());
return result ? ResponseResult.success("修改成功") : ResponseResult.error("修改失败");
}
@Log(module = "过鱼设施自动数据管理", value = "删除过鱼自动数据")
@PostMapping("/delete")
@Operation(summary = "删除过鱼自动数据")
public ResponseResult delete(@RequestBody SdEngInfoBHOperateRequest request) {
List<String> ids = request == null ? null : request.getIds();
if (ids == null || ids.isEmpty()) {
return ResponseResult.error("ID不能为空");
}
boolean result = sdFpssrlRService.delete(ids, request.getSource());
return result ? ResponseResult.success("删除成功") : ResponseResult.error("删除失败");
}
// ==================== AI 设备识别数据上报接口 ====================
/**
* AI设备图片/视频上传接口
* 步骤1先上传图片获取附件URL再将URL填入数据上报接口
*/
@PostMapping("/ai/uploadImage")
@Operation(summary = "AI设备图片上传")
public ResponseResult aiUploadImage(@RequestParam("file") MultipartFile file) {
if (file == null || file.isEmpty()) {
return ResponseResult.error("文件不能为空");
}
try {
List<MultipartFile> files = new ArrayList<>();
files.add(file);
List<String> attachmentIds = attachmentUploadService.uploadMultipartFiles(files);
if (attachmentIds != null && !attachmentIds.isEmpty()) {
return ResponseResult.successData(attachmentIds);
} else {
return ResponseResult.error("图片上传失败");
}
} catch (Exception e) {
log.error("AI图片上传失败", e);
return ResponseResult.error("图片上传失败: " + e.getMessage());
}
}
/**
* AI设备识别数据上报接口支持单条和批量
* 步骤2上传完图片后将附件ID填入JSON数组调用此接口
*/
@PostMapping("/ai/report")
@Operation(summary = "AI设备识别数据上报支持批量")
public ResponseResult aiReport(@RequestBody List<SdFpssrlRAiRequest> requests) {
if (requests == null || requests.isEmpty()) {
return ResponseResult.error("请求数据不能为空");
}
// 逐条校验
for (int i = 0; i < requests.size(); i++) {
SdFpssrlRAiRequest req = requests.get(i);
if (req == null) {
return ResponseResult.error("" + (i + 1) + "条数据为空");
}
if (req.getStcd() == null || req.getStcd().isEmpty()) {
return ResponseResult.error("" + (i + 1) + "条过鱼设施编码(stcd)不能为空");
}
if (req.getTm() == null) {
return ResponseResult.error("" + (i + 1) + "条识别时间(tm)不能为空");
}
if (req.getFtp() == null || req.getFtp().isEmpty()) {
return ResponseResult.error("" + (i + 1) + "条鱼种类(ftp)不能为空");
}
}
try {
List<SdFpssrlR> result = sdFpssrlRService.processAiReportBatch(requests);
// List<String> ids = result.stream().map(SdFpssrlR::getId).collect(Collectors.toList());
log.info("AI批量上报成功共{}条", result.size());
return ResponseResult.success();
} catch (Exception e) {
log.error("AI识别数据批量上报失败", e);
return ResponseResult.error("上报失败: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,82 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 平台产品化-业务组件基础表
*
* @author migration
*/
@Data
@TableName("MS_PPBCL_B")
public class MsPpbclB implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** 编码 */
@TableField("CODE")
private String code;
/** 名称 */
@TableField("NAME")
private String name;
/** 适用方式normal=普通 eng_common=电站通用 */
@TableField("USETYPE")
private String usetype;
/** 备注 */
@TableField("REMARK")
private String remark;
/** 示例图base64 */
@TableField("EXAMPLEIMG")
private String exampleimg;
/** 前端配置数据 */
@TableField("DATA")
private String data;
/** 标签ID集合 */
@TableField("TAG_IDS")
private String tagIds;
// ---------- 非持久化字段 ----------
/** 标签名称集合 */
@TableField(exist = false)
private String tagNames;
// ---------- 审计字段 ----------
@TableField("RECORD_USER")
private String recordUser;
@TableField("RECORD_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField("MODIFY_USER")
private String modifyUser;
@TableField("MODIFY_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
@TableField("IS_DELETED")
private Integer isDeleted;
@TableField("DELETE_USER")
private String deleteUser;
@TableField("DELETE_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteTime;
}

View File

@ -0,0 +1,72 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 平台产品化-页面布局基础表
*
* @author migration
*/
@Data
@TableName("MS_PPLAYOUT_B")
public class MsPplayoutB implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** 布局类型page=页面布局 map=地图布局 */
@TableField("TYPE")
private String type;
/** 编码 */
@TableField("CODE")
private String code;
/** 名称 */
@TableField("NAME")
private String name;
/** 备注 */
@TableField("REMARK")
private String remark;
/** 示例图base64 */
@TableField("EXAMPLEIMG")
private String exampleimg;
/** 前端配置数据 */
@TableField("DATA")
private String data;
// ---------- 审计字段 ----------
@TableField("RECORD_USER")
private String recordUser;
@TableField("RECORD_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField("MODIFY_USER")
private String modifyUser;
@TableField("MODIFY_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
@TableField("IS_DELETED")
private Integer isDeleted;
@TableField("DELETE_USER")
private String deleteUser;
@TableField("DELETE_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteTime;
}

View File

@ -0,0 +1,87 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 平台产品化-电站与布局组件配置表
*
* @author migration
*/
@Data
@TableName("MS_PSBMODULELB_B")
public class MsPsbmodulelbB implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** 所属电站 */
@TableField("STCD")
private String stcd;
/** 布局 */
@TableField("LAYOUT_ID")
private String layoutId;
/** 布局各组件配置 */
@TableField("BCL_DATA")
private String bclData;
/** 角色ID */
@TableField("ROLE_ID")
private String roleId;
/** 是否布局 */
@TableField("IS_LAYOUT")
private Integer isLayout;
// ---------- 非持久化字段 ----------
/** 模板id */
@TableField(exist = false)
private String templateId;
/** 主控件标签配置 */
@TableField(exist = false)
private List<TagConfigVo> mainTagList;
/** 组件标签配置 */
@TableField(exist = false)
private List<TagConfigVo> ppbclTagList;
/** 有配置标签的组件集合 */
@TableField(exist = false)
private List<String> codeList;
// ---------- 审计字段 ----------
@TableField("RECORD_USER")
private String recordUser;
@TableField("RECORD_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField("MODIFY_USER")
private String modifyUser;
@TableField("MODIFY_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
@TableField("IS_DELETED")
private Integer isDeleted;
@TableField("DELETE_USER")
private String deleteUser;
@TableField("DELETE_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteTime;
}

View File

@ -0,0 +1,72 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 页面标签配置表
*
* @author migration
*/
@Data
@TableName("MS_TAGCONFIG_B")
public class MsTagConfigB implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** 菜单ID */
@TableField("MODULE_ID")
private String moduleId;
/** 模板ID */
@TableField("TEMPLATE_ID")
private String templateId;
/** 组件CODE */
@TableField("CODE")
private String code;
/** 标签ID */
@TableField("TAG_ID")
private String tagId;
/** 标签值 */
@TableField("TAG_VALUE")
private String tagValue;
/** 是否展示 0=否 1=是 */
@TableField("IS_SHOW")
private Integer isShow;
// ---------- 审计字段 ----------
@TableField("RECORD_USER")
private String recordUser;
@TableField("RECORD_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField("MODIFY_USER")
private String modifyUser;
@TableField("MODIFY_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
@TableField("IS_DELETED")
private Integer isDeleted;
@TableField("DELETE_USER")
private String deleteUser;
@TableField("DELETE_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteTime;
}

View File

@ -0,0 +1,78 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 页面配置模板表
*
* @author migration
*/
@Data
@TableName("MS_TEMPLATE_B")
public class MsTemplateB implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** 模板名称 */
@TableField("TEMPLATE_NAME")
private String templateName;
/** 模块ID */
@TableField("MODULE_ID")
private String moduleId;
/** 模板预览图片 */
@TableField("FID")
private String fid;
/** 页面配置ID */
@TableField("PAGE_ID")
private String pageId;
/** 是否是默认模板 0=否 1=是 */
@TableField("IS_DEFAULT")
private Integer isDefault;
// ---------- 非持久化字段 ----------
/** 模块类型 1=普通菜单模板 2=电站专题模板 */
@TableField(exist = false)
private Integer templateType;
/** 模块名称 */
@TableField(exist = false)
private String moduleName;
// ---------- 审计字段 ----------
@TableField("RECORD_USER")
private String recordUser;
@TableField("RECORD_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField("MODIFY_USER")
private String modifyUser;
@TableField("MODIFY_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
@TableField("IS_DELETED")
private Integer isDeleted;
@TableField("DELETE_USER")
private String deleteUser;
@TableField("DELETE_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteTime;
}

View File

@ -24,6 +24,10 @@ public class MsWarnRuleB implements Serializable {
@TableField("RULE_TYPE") @TableField("RULE_TYPE")
private String ruleType; private String ruleType;
/** 预警规则类型名称(字典转换) */
@TableField(exist = false)
private String ruleTypeName;
/** 预警规则名称 */ /** 预警规则名称 */
@TableField("RULE_NAME") @TableField("RULE_NAME")
private String ruleName; private String ruleName;

View File

@ -0,0 +1,90 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 预警规则配置详情表
*/
@Data
@TableName("MS_WARN_RULE_DETAIL_B")
public class MsWarnRuleDetailB implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_UUID)
private String id;
@TableField("RULE_ID")
private String ruleId;
@TableField("TB_ID")
private String tbId;
@TableField("YS")
private String ys;
@TableField("TM")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date tm;
@TableField("BEGIN_TIME")
private String beginTime;
@TableField("END_TIME")
private String endTime;
@TableField("MIN_VAL")
private BigDecimal minVal;
@TableField("MAX_VAL")
private BigDecimal maxVal;
@TableField("LVL")
private Integer lvl;
@TableField("LVL_NOTE")
private String lvlNote;
@TableField("STTY")
private String stty;
@TableField("ALWYRQST")
private Integer alwyrqst;
@TableField("ELAEQ")
private Integer elaeq;
@TableField("QECSC")
private BigDecimal qecsc;
@TableField("DESCRIPTION")
private String description;
@TableField("WARN_LEVEL")
private Integer warnLevel;
@TableField("MARK")
private String mark;
@TableField("VLSR")
private String vlsr;
@TableField("VLSR_TM")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date vlsrTm;
@TableField("RECORD_USER")
private String recordUser;
@TableField("RECORD_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField("IS_DELETED")
private Integer isDeleted;
}

View File

@ -0,0 +1,59 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 预警规则与测站关联表
*/
@Data
@TableName("MS_WARN_RULE_STBPRP_B")
public class MsWarnRuleStbprpB implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_UUID)
private String id;
@TableField("RULE_ID")
private String ruleId;
@TableField("STTP_ID")
private String sttpId;
@TableField("STCD")
private String stcd;
@TableField("DESCRIPTION")
private String description;
@TableField("RECORD_USER")
private String recordUser;
@TableField("RECORD_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField("MODIFY_USER")
private String modifyUser;
@TableField("MODIFY_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
@TableField("IS_DELETED")
private Integer isDeleted;
@TableField("DELETE_USER")
private String deleteUser;
@TableField("DELETE_TIME")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteTime;
@TableField("ISOLATE_ID")
private String isolateId;
}

View File

@ -0,0 +1,15 @@
package com.yfd.platform.qgc_base.domain;
import lombok.Data;
import java.io.Serializable;
/**
* 组件编码VO用于解析 BCL_DATA JSON
*/
@Data
public class PpbclCodeVo implements Serializable {
private static final long serialVersionUID = 1L;
private String code;
}

View File

@ -116,6 +116,7 @@ public class SdArtsgBH implements Serializable {
*/ */
private String rvcd; private String rvcd;
@TableField(exist = false) @TableField(exist = false)
private String rvnm; private String rvnm;
@ -165,6 +166,7 @@ public class SdArtsgBH implements Serializable {
*/ */
private Integer bldsttCode; private Integer bldsttCode;
@TableField(exist = false)
private String bldsttCodeName; private String bldsttCodeName;
/** /**

View File

@ -198,7 +198,7 @@ public class SdDwBH implements Serializable {
/** /**
* 叠梁门层数高度 * 叠梁门层数高度
*/ */
private BigDecimal dcshg; private String dcshg;
/** /**
* 叠梁门单层取水口个数 * 叠梁门单层取水口个数

View File

@ -22,7 +22,7 @@ public class SdFishDictoryB implements Serializable {
/** /**
* 主键 * 主键
*/ */
@TableId(type = IdType.INPUT) @TableId(type = IdType.ASSIGN_UUID)
private String id; private String id;
/** /**
@ -85,6 +85,9 @@ public class SdFishDictoryB implements Serializable {
*/ */
private Integer type; private Integer type;
@TableField(exist = false)
private String typeName;
/** /**
* 成鱼大小单位cm * 成鱼大小单位cm
*/ */
@ -95,16 +98,25 @@ public class SdFishDictoryB implements Serializable {
*/ */
private Integer rare; private Integer rare;
@TableField(exist = false)
private String rareName;
/** /**
* 物种来源1=本土物种 2=外来物种 * 物种来源1=本土物种 2=外来物种
*/ */
private Integer specOrigin; private Integer specOrigin;
@TableField(exist = false)
private String specOriginName;
/** /**
* 保护类型1=濒危 2=极危 3=近危 4=易危 5=重点保护 6=无危 7=国家二级 8=市二级保护 * 保护类型1=濒危 2=极危 3=近危 4=易危 5=重点保护 6=无危 7=国家二级 8=市二级保护
*/ */
private Integer ptype; private Integer ptype;
@TableField(exist = false)
private String ptypeName;
/** /**
* 所属流域 * 所属流域
*/ */
@ -165,21 +177,33 @@ public class SdFishDictoryB implements Serializable {
*/ */
private String wqtq; private String wqtq;
// @TableField(exist = false)
// private String wqtqName;
/** /**
* 主要生活环境 1=流水生境 2=静缓流生境 3=洞穴生境 * 主要生活环境 1=流水生境 2=静缓流生境 3=洞穴生境
*/ */
private Integer habitat; private Integer habitat;
@TableField(exist = false)
private String habitatName;
/** /**
* 种群现状 1=优势种 2=常见种 3=少见种 4=记录种 * 种群现状 1=优势种 2=常见种 3=少见种 4=记录种
*/ */
private Integer situation; private Integer situation;
@TableField(exist = false)
private String situationName;
/** /**
* 资源类型 1=保护鱼类 2=特有鱼类 3=重要经济鱼类 4=濒危状况 * 资源类型 1=保护鱼类 2=特有鱼类 3=重要经济鱼类 4=濒危状况
*/ */
private Integer resourceType; private Integer resourceType;
@TableField(exist = false)
private String resourceTypeName;
/** /**
* 形态描述 * 形态描述
*/ */

View File

@ -0,0 +1,180 @@
package com.yfd.platform.qgc_base.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 过鱼设施自动数据表AI识别
* </p>
*/
@Data
@TableName("SD_FPSSRL_R")
public class SdFpssrlR implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 过鱼设施编码
*/
private String stcd;
/**
* 时间
*/
private Date tm;
/**
* 鱼种类
*/
private String ftp;
/**
* 过鱼数量
*/
private Integer fcnt;
/**
* 鱼尺寸//
*/
private String fsz;
/**
* 鱼长度
*/
private BigDecimal length;
/**
* 鱼宽度
*/
private BigDecimal width;
/**
* 鱼速度
*/
private String fishspeed;
/**
* 游向0=上行 1=下行
*/
private Integer direction;
/**
* 鱼位置
*/
private Long fishposition;
/**
* 鱼截图主图片url
*/
private String firstImgUrl;
/**
* 鱼截图副图片url
*/
private String secondImgUrl;
/**
* 视频url
*/
private String videoUrl;
/**
* 水温单位
*/
private BigDecimal temperature;
/**
* 水位单位m
*/
private BigDecimal waterlevel;
/**
* 流速单位m/s
*/
private BigDecimal speed;
/**
* 流量单位m3/s
*/
private BigDecimal q;
/**
* 溶氧单位mg/L
*/
private BigDecimal dox;
/**
* 浊度单位NTU
*/
private Integer tu;
/**
* 过鱼通道
*/
private String channelno;
/**
* 创建人关联SYS_USER.ID
*/
private String recordUser;
/**
* 创建时间
*/
private Date recordTime;
/**
* 更新人关联SYS_USER.ID
*/
private String modifyUser;
/**
* 更新时间
*/
private Date modifyTime;
/**
* 是否已删除0=未删除 1=已删除
*/
private Integer isDeleted;
/**
* 删除人关联SYS_USER.ID
*/
private String deleteUser;
/**
* 删除时间
*/
private Date deleteTime;
/**
* 附件ID
*/
private String fid;
/**
* 备注
*/
private String remark;
/**
* 过鱼设施名称非表字段用于列表展示
*/
@TableField(exist = false)
private String stnm;
}

View File

@ -0,0 +1,125 @@
package com.yfd.platform.qgc_base.domain;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* AI设备识别数据上报请求
* </p>
*/
@Data
public class SdFpssrlRAiRequest {
/**
* 过鱼设施编码必填
*/
private String stcd;
/**
* 识别时间必填格式yyyy-MM-dd HH:mm:ss
*/
private Date tm;
/**
* 鱼种类必填
*/
private String ftp;
/**
* 过鱼数量默认1
*/
private Integer fcnt;
/**
* 鱼尺寸//
*/
private String fsz;
/**
* 鱼长度单位cm
*/
private BigDecimal length;
/**
* 鱼宽度单位cm
*/
private BigDecimal width;
/**
* 鱼速度
*/
private String fishspeed;
/**
* 游向0=上行 1=下行
*/
private Integer direction;
/**
* 鱼位置
*/
private Long fishposition;
/**
* 主图片URL
*/
private String firstImgUrl;
/**
* 副图片URL
*/
private String secondImgUrl;
/**
* 视频URL
*/
private String videoUrl;
/**
* 水温单位
*/
private BigDecimal temperature;
/**
* 水位单位m
*/
private BigDecimal waterlevel;
/**
* 流速单位m/s
*/
private BigDecimal speed;
/**
* 流量单位m³/s
*/
private BigDecimal q;
/**
* 溶氧单位mg/L
*/
private BigDecimal dox;
/**
* 浊度单位NTU
*/
private Integer tu;
/**
* 过鱼通道默认"主通道"
*/
private String channelno;
/**
* 备注
*/
private String remark;
/**
* 附件ID多个以逗号分隔通过上传图片接口获取
*/
private String fid;
}

View File

@ -38,6 +38,9 @@ public class SdOtteBH implements Serializable {
private Integer usfl; private Integer usfl;
@TableField(exist = false)
private String usflName;
private Integer dtin; private Integer dtin;
@TableField(exist = false) @TableField(exist = false)

View File

@ -38,6 +38,9 @@ public class SdOtweBH implements Serializable {
private Integer usfl; private Integer usfl;
@TableField(exist = false)
private String usflName;
private Integer dtin; private Integer dtin;
@TableField(exist = false) @TableField(exist = false)

View File

@ -52,6 +52,9 @@ public class SdSonarBH implements Serializable {
private Integer usfl; private Integer usfl;
@TableField(exist = false)
private String usflName;
private Integer dtin; private Integer dtin;
@TableField(exist = false) @TableField(exist = false)

View File

@ -38,6 +38,9 @@ public class SdVaBH implements Serializable {
private Integer usfl; private Integer usfl;
@TableField(exist = false)
private String usflName;
private Integer dtin; private Integer dtin;
@TableField(exist = false) @TableField(exist = false)
private String dtinName; private String dtinName;

View File

@ -57,6 +57,9 @@ public class SdVdinfoB implements Serializable {
private String addvcd; private String addvcd;
@TableField(exist = false)
private String addvcdName;
private String hycd; private String hycd;
@TableField("BASE_ID") @TableField("BASE_ID")

View File

@ -85,7 +85,7 @@ public class SdWqBH implements Serializable {
private Integer mway; private Integer mway;
@TableField(exist = false) @TableField(exist = false)
private Integer mwayName; private String mwayName;
private String stindx; private String stindx;

View File

@ -0,0 +1,18 @@
package com.yfd.platform.qgc_base.domain;
import lombok.Data;
import java.io.Serializable;
/**
* 标签配置VO
*/
@Data
public class TagConfigVo implements Serializable {
private static final long serialVersionUID = 1L;
private String code;
private String tagId;
private String tagValue;
private Integer isShow;
}

View File

@ -0,0 +1,9 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsPpbclB;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MsPpbclBMapper extends BaseMapper<MsPpbclB> {
}

View File

@ -0,0 +1,9 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsPplayoutB;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MsPplayoutBMapper extends BaseMapper<MsPplayoutB> {
}

View File

@ -0,0 +1,21 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsPsbmodulelbB;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface MsPsbmodulelbBMapper extends BaseMapper<MsPsbmodulelbB> {
@Select("SELECT t1.* FROM MS_PSBMODULELB_B t1 " +
"INNER JOIN MS_PPLAYOUT_B t2 ON t1.LAYOUT_ID = t2.ID " +
"WHERE t1.STCD = #{stcd} AND t2.TYPE = #{layoutType}")
List<MsPsbmodulelbB> getPsbmoduleByMidAndLt(@Param("stcd") String stcd, @Param("layoutType") String layoutType);
@Select("${sql}")
List<MsPsbmodulelbB> selectBySql(@Param("sql") String sql);
}

View File

@ -0,0 +1,9 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsTagConfigB;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MsTagConfigBMapper extends BaseMapper<MsTagConfigB> {
}

View File

@ -0,0 +1,9 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsTemplateB;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MsTemplateBMapper extends BaseMapper<MsTemplateB> {
}

View File

@ -2,6 +2,55 @@ package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsWarnRuleB; import com.yfd.platform.qgc_base.domain.MsWarnRuleB;
import com.yfd.platform.qgc_sys.warnRule.vo.WarnRuleVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface MsWarnRuleBMapper extends BaseMapper<MsWarnRuleB> { public interface MsWarnRuleBMapper extends BaseMapper<MsWarnRuleB> {
@Update("UPDATE MS_WARN_RULE_B SET IS_SHOW = #{isShow} WHERE RULE_CODE IN ('common','custom')")
void updateIsShow(@Param("isShow") Integer isShow);
// @Select("SELECT RULE_NAME AS ruleName FROM (" +
// "SELECT RULE_NAME FROM MS_WARN_RULE_B " +
// "WHERE RULE_CODE = 'custom' AND STCD = #{stcd} AND IS_DELETED = 0 AND RECORD_TIME IS NOT NULL " +
// "ORDER BY RECORD_TIME DESC) WHERE ROWNUM = 1")
// String getCustomRuleNameByStcd(@Param("stcd") String stcd);
@Select("SELECT RULE_NAME AS ruleName FROM (" +
"SELECT RULE_NAME FROM MS_WARN_RULE_B " +
"WHERE 1=1 AND STCD = #{stcd} AND IS_DELETED = 0 AND RECORD_TIME IS NOT NULL " +
"ORDER BY RECORD_TIME DESC) WHERE ROWNUM = 1")
String getCustomRuleNameByStcd(@Param("stcd") String stcd);
// @Select("SELECT t1.ID, RULE_NAME AS ruleName, RULE_CODE AS ruleCode, t2.LVL AS lvl " +
// "FROM MS_WARN_RULE_B t1 INNER JOIN MS_WARN_RULE_DETAIL_B t2 ON t1.ID = t2.RULE_ID " +
// "WHERE (t1.RULE_CODE = 'common' OR (t1.RULE_CODE = 'custom' AND t1.STCD = #{stcd})) " +
// "AND t1.RULE_TYPE = #{ruleType} AND t1.IS_DELETED = 0 AND t2.IS_DELETED = 0 " +
// "GROUP BY t1.ID, RULE_NAME, RULE_CODE, lvl")
// List<WarnRuleVo> getRuleListByStcd(@Param("stcd") String stcd, @Param("ruleType") String ruleType);
@Select("SELECT t1.ID, RULE_NAME AS ruleName, RULE_CODE AS ruleCode, t2.LVL AS lvl " +
"FROM MS_WARN_RULE_B t1 INNER JOIN MS_WARN_RULE_DETAIL_B t2 ON t1.ID = t2.RULE_ID " +
"WHERE 1=1 AND t1.STCD = #{stcd} " +
"AND t1.RULE_TYPE = #{ruleType} AND t1.IS_DELETED = 0 AND t2.IS_DELETED = 0 " +
"GROUP BY t1.ID, RULE_NAME, RULE_CODE, lvl")
List<WarnRuleVo> getRuleListByStcd(@Param("stcd") String stcd, @Param("ruleType") String ruleType);
@Update("UPDATE MS_WARN_RULE_B SET STCD = #{stcd} WHERE ID = #{id}")
void updateStcd(@Param("stcd") String stcd, @Param("id") String id);
@Select("SELECT t2.STTP_NAME FROM V_MS_STBPRP_T t1 INNER JOIN SD_STTP_B t2 ON t1.STTP = t2.ID WHERE t1.STCD = #{stcd}")
String getSttpCodeNameByStcd(@Param("stcd") String stcd);
@Select("SELECT COUNT(t1.ID) FROM MS_WARN_RULE_B t1 INNER JOIN MS_WARN_RULE_DETAIL_B t2 ON t1.ID = t2.RULE_ID " +
"WHERE t1.RULE_TYPE = 'WQ_RULE' AND t1.RULE_CODE = 'common' AND t2.LVL = #{lvl} " +
"AND t1.IS_DELETED = 0 AND t2.IS_DELETED = 0")
Integer checkWqCommonRuleExist(@Param("lvl") Integer lvl);
} }

View File

@ -0,0 +1,10 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsWarnRuleDetailB;
/**
* 预警规则配置详情表 Mapper
*/
public interface MsWarnRuleDetailBMapper extends BaseMapper<MsWarnRuleDetailB> {
}

View File

@ -0,0 +1,23 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.MsWarnRuleStbprpB;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 预警规则与测站关联表 Mapper
*/
public interface MsWarnRuleStbprpBMapper extends BaseMapper<MsWarnRuleStbprpB> {
@Delete("DELETE FROM MS_WARN_RULE_STBPRP_B WHERE ID = #{id}")
void deleteBind(@Param("id") String id);
@Select("SELECT t1.ID, t1.RULE_ID, t1.STCD, t1.STTP_ID AS sttpId " +
"FROM MS_WARN_RULE_STBPRP_B t1 " +
"INNER JOIN MS_WARN_RULE_B t2 ON t1.RULE_ID = t2.ID " +
"WHERE t1.STCD = #{stcd} AND t2.RULE_TYPE = #{ruleType} " +
"AND t2.RULE_CODE IN ('common','custom') AND t1.IS_DELETED = 0 AND t2.IS_DELETED = 0")
MsWarnRuleStbprpB getBindRuleByStcd(@Param("stcd") String stcd, @Param("ruleType") String ruleType);
}

View File

@ -0,0 +1,22 @@
package com.yfd.platform.qgc_base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.qgc_base.domain.SdFpssrlR;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 过鱼设施自动数据表 Mapper 接口
* </p>
*/
@Mapper
public interface SdFpssrlRMapper extends BaseMapper<SdFpssrlR> {
/**
* 批量合并过鱼自动数据基于 STCD + TM + FTP 唯一
* 存在则更新不存在则新增
*/
int mergeFishRecords(List<SdFpssrlR> list);
}

View File

@ -31,7 +31,7 @@ public interface IMsOperationLogService {
* @param source 操作来源 * @param source 操作来源
* @param <T> 实体类型 * @param <T> 实体类型
*/ */
<T> void recordModifyDetailLog(String tableName, T before, T after, String source); <T> void recordModifyDetailLog(String recordId,String tableName, T before, T after, String source);
/** /**
* 通用新增操作详情日志含字段级详情 * 通用新增操作详情日志含字段级详情
@ -44,7 +44,7 @@ public interface IMsOperationLogService {
* @param source 操作来源 * @param source 操作来源
* @param <T> 实体类型 * @param <T> 实体类型
*/ */
<T> void recordAddDetailLog(String tableName, T entity, String source); <T> void recordAddDetailLog(String recordId,String tableName, T entity, String source);
/** /**
* 通用删除操作详情日志含字段级详情 * 通用删除操作详情日志含字段级详情
@ -57,5 +57,5 @@ public interface IMsOperationLogService {
* @param source 操作来源 * @param source 操作来源
* @param <T> 实体类型 * @param <T> 实体类型
*/ */
<T> void recordDeleteDetailLog(String tableName, T entity, String source); <T> void recordDeleteDetailLog(String recordId,String tableName, T entity, String source);
} }

View File

@ -0,0 +1,39 @@
package com.yfd.platform.qgc_base.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.qgc_base.domain.MsPsbmodulelbB;
import com.yfd.platform.qgc_sys.psbmodulelbb.vo.WbsBPpVo;
import java.util.List;
/**
* 平台产品化-电站与布局组件配置表 Service 接口
*/
public interface IMsPsbmodulelbBService extends IService<MsPsbmodulelbB> {
/**
* 处理kendo列表含标签信息
*/
List<MsPsbmodulelbB> queryPageList(DataSourceRequest request);
/**
* 获取电站与布局组件配置列表
*/
List<MsPsbmodulelbB> getPsbmoduleByMidAndLt(String stcd, String layoutType);
/**
* 保存或更新数据
*/
boolean saveOrUpdateData(MsPsbmodulelbB entity);
/**
* 逻辑删除
*/
boolean deleteData(String id);
/**
* 获取已配置电站及流域树形数据
*/
List<WbsBPpVo> getTreeConfiguredps(DataSourceRequest dataSourceRequest);
}

View File

@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yfd.platform.common.DataSourceRequest; import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.qgc_base.domain.MsWarnRuleB; import com.yfd.platform.qgc_base.domain.MsWarnRuleB;
import com.yfd.platform.qgc_sys.warnRule.vo.MsWarnRuleBVo;
import com.yfd.platform.qgc_sys.warnRule.vo.WarnRuleVo;
import com.yfd.platform.qgc_sys.warnRule.vo.WarnYsVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 预警规则配置 Service 接口 * 预警规则配置 Service 接口
@ -15,4 +19,54 @@ public interface IMsWarnRuleBService extends IService<MsWarnRuleB> {
boolean add(MsWarnRuleB entity, String source); boolean add(MsWarnRuleB entity, String source);
boolean update(MsWarnRuleB entity, String source); boolean update(MsWarnRuleB entity, String source);
boolean delete(List<String> ids, String source); boolean delete(List<String> ids, String source);
/**
* 获取告警类型对应的要素列表
*/
List<WarnYsVo> getAllYs(String ruleType);
/**
* 新增或修改预警规则
*/
MsWarnRuleB addOrUpdate(MsWarnRuleBVo vo);
/**
* 校验规则是否被测站引用
*/
boolean check(String id);
/**
* 删除规则绑定
*/
void deleteBind(String id);
/**
* 删除规则物理删除详情和绑定逻辑删除主表
*/
void deleteRule(String id);
/**
* 修改规则是否展示
*/
void updateShow(Integer isShow);
/**
* 获取水位和生态流量限值
*/
Map<String, Object> getLimit(DataSourceRequest request);
/**
* 查询测站和预警规则绑定列表
*/
Page<MsWarnRuleBVo> getRuleBindList(DataSourceRequest request);
/**
* 根据id查询规则配置详情
*/
MsWarnRuleBVo getRuleBindDetail(String ruleId, String bindId);
/**
* 根据stcd查询可绑定的规则
*/
List<WarnRuleVo> getRuleListByStcd(String stcd, String ruleType, String lvl);
} }

View File

@ -2,21 +2,24 @@ package com.yfd.platform.qgc_base.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.qgc_base.domain.SdFishDictoryB; import com.yfd.platform.qgc_base.domain.SdFishDictoryB;
import java.util.List; import java.util.List;
public interface ISdFishDictoryBService extends IService<SdFishDictoryB> { public interface ISdFishDictoryBService extends IService<SdFishDictoryB> {
Page<SdFishDictoryB> queryPageList(DataSourceRequest request);
Page<SdFishDictoryB> selectPage(String name, String code, Integer type, Integer rare, Page<SdFishDictoryB> page); Page<SdFishDictoryB> selectPage(String name, String code, Integer type, Integer rare, Page<SdFishDictoryB> page);
boolean add(SdFishDictoryB fishDictoryB); boolean add(SdFishDictoryB entity, String source);
boolean updateById(SdFishDictoryB fishDictoryB); boolean update(SdFishDictoryB entity, String source);
boolean deleteById(String id); boolean delete(List<String> ids, String source);
SdFishDictoryB getById(String id); SdFishDictoryB getById(String id);
List<SdFishDictoryB> findSimilarFish(String name, Integer limit); List<SdFishDictoryB> findSimilarFish(String name, Integer limit);
} }

View File

@ -0,0 +1,52 @@
package com.yfd.platform.qgc_base.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.qgc_base.domain.SdFpssrlR;
import com.yfd.platform.qgc_base.domain.SdFpssrlRAiRequest;
import java.util.List;
/**
* <p>
* 过鱼设施自动数据表 服务接口
* </p>
*/
public interface ISdFpssrlRService extends IService<SdFpssrlR> {
/**
* 分页查询Kendo Grid
*/
Page<SdFpssrlR> queryPageList(DataSourceRequest request);
/**
* 新增
*/
boolean add(SdFpssrlR entity, String source);
/**
* 修改
*/
boolean update(SdFpssrlR entity, String source);
/**
* 删除逻辑删除
*/
boolean delete(List<String> ids, String source);
/**
* 根据ID查询排除已删除的
*/
SdFpssrlR getById(String id);
/**
* 处理AI设备上报的单条识别数据
*/
SdFpssrlR processAiReport(SdFpssrlRAiRequest request);
/**
* 批量处理AI设备上报的识别数据
*/
List<SdFpssrlR> processAiReportBatch(List<SdFpssrlRAiRequest> requests);
}

View File

@ -38,7 +38,7 @@ public class MsEiaApprovalBServiceImpl extends ServiceImpl<MsEiaApprovalBMapper,
public boolean add(MsEiaApprovalB entity, String source) { public boolean add(MsEiaApprovalB entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getId(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -49,7 +49,7 @@ public class MsEiaApprovalBServiceImpl extends ServiceImpl<MsEiaApprovalBMapper,
MsEiaApprovalB before = this.getById(entity.getId()); MsEiaApprovalB before = this.getById(entity.getId());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(before.getId(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -60,14 +60,14 @@ public class MsEiaApprovalBServiceImpl extends ServiceImpl<MsEiaApprovalBMapper,
if (ids == null || ids.isEmpty()) return false; if (ids == null || ids.isEmpty()) return false;
int count = 0; int count = 0;
for (String id : ids) { for (String id : ids) {
MsEiaApprovalB entity = this.getById(id);
LambdaUpdateWrapper<MsEiaApprovalB> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<MsEiaApprovalB> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(MsEiaApprovalB::getId, id); wrapper.eq(MsEiaApprovalB::getId, id);
wrapper.set(MsEiaApprovalB::getIsDeleted, 1); wrapper.set(MsEiaApprovalB::getIsDeleted, 1);
wrapper.set(MsEiaApprovalB::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(MsEiaApprovalB::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(MsEiaApprovalB::getDeleteTime, new Date()); wrapper.set(MsEiaApprovalB::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
MsEiaApprovalB entity = this.getById(id); msOperationLogService.recordDeleteDetailLog(id,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -400,11 +400,11 @@ public class MsOperationLogServiceImpl implements IMsOperationLogService {
} }
@Override @Override
public <T> void recordModifyDetailLog(String tableName, T before, T after, String source) { public <T> void recordModifyDetailLog(String recordId,String tableName, T before, T after, String source) {
if (before == null || after == null) { if (before == null || after == null) {
return; return;
} }
String recordId = getStcd(before); // String recordId = getStcd(before);
MsOperationLog mainLog = buildMainLog(tableName, recordId, "修改", source); MsOperationLog mainLog = buildMainLog(tableName, recordId, "修改", source);
msOperationLogMapper.insert(mainLog); msOperationLogMapper.insert(mainLog);
@ -439,11 +439,11 @@ public class MsOperationLogServiceImpl implements IMsOperationLogService {
} }
@Override @Override
public <T> void recordAddDetailLog(String tableName, T entity, String source) { public <T> void recordAddDetailLog(String recordId,String tableName, T entity, String source) {
if (entity == null) { if (entity == null) {
return; return;
} }
String recordId = getStcd(entity); // String recordId = getStcd(entity);
MsOperationLog mainLog = buildMainLog(tableName, recordId, "新增", source); MsOperationLog mainLog = buildMainLog(tableName, recordId, "新增", source);
msOperationLogMapper.insert(mainLog); msOperationLogMapper.insert(mainLog);
@ -469,11 +469,11 @@ public class MsOperationLogServiceImpl implements IMsOperationLogService {
} }
@Override @Override
public <T> void recordDeleteDetailLog(String tableName, T entity, String source) { public <T> void recordDeleteDetailLog(String recordId,String tableName, T entity, String source) {
if (entity == null) { if (entity == null) {
return; return;
} }
String recordId = getStcd(entity); // String recordId = getStcd(entity);
MsOperationLog mainLog = buildMainLog(tableName, recordId, "删除", source); MsOperationLog mainLog = buildMainLog(tableName, recordId, "删除", source);
msOperationLogMapper.insert(mainLog); msOperationLogMapper.insert(mainLog);

View File

@ -0,0 +1,307 @@
package com.yfd.platform.qgc_base.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
import com.yfd.platform.qgc_base.domain.*;
import com.yfd.platform.qgc_base.mapper.*;
import com.yfd.platform.qgc_base.service.IMsOperationLogService;
import com.yfd.platform.qgc_base.service.IMsPsbmodulelbBService;
import com.yfd.platform.qgc_sys.psbmodulelbb.vo.WbsBPpVo;
import com.yfd.platform.utils.SecurityUtils;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 平台产品化-电站与布局组件配置表 Service 实现类
*/
@Service
public class MsPsbmodulelbBServiceImpl extends ServiceImpl<MsPsbmodulelbBMapper, MsPsbmodulelbB> implements IMsPsbmodulelbBService {
private static final String TABLE_NAME = "MS_PSBMODULELB_B";
@Resource
private MsPsbmodulelbBMapper msPsbmodulelbBMapper;
@Resource
private MsTemplateBMapper msTemplateBMapper;
@Resource
private MsPpbclBMapper msPpbclBMapper;
@Resource
private MsTagConfigBMapper msTagConfigBMapper;
@Resource
private IMsOperationLogService msOperationLogService;
@Resource
private MicroservicDynamicSQLMapper microservicDynamicSQLMapper;
@Override
public List<MsPsbmodulelbB> queryPageList(DataSourceRequest request) {
String templateId = getFilterFieldValue(request, "templateId");
String moduleId = getFilterFieldValue(request, "stcd");
String ext = getFilterFieldValue(request, "ext");
StringBuilder sql = new StringBuilder();
if (StringUtils.isBlank(templateId) && StringUtils.isNotBlank(ext) && StringUtils.isNotBlank(moduleId)) {
// 查询模块下是否有标识为默认的模板
LambdaQueryWrapper<MsTemplateB> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(MsTemplateB::getIsDefault, 1);
lambdaQueryWrapper.eq(MsTemplateB::getIsDeleted, 0);
lambdaQueryWrapper.eq(MsTemplateB::getModuleId, moduleId);
MsTemplateB msTemplateB = msTemplateBMapper.selectOne(lambdaQueryWrapper);
if (msTemplateB != null && StringUtils.isNotBlank(msTemplateB.getPageId())) {
templateId = msTemplateB.getId();
}
}
if (StringUtils.isBlank(templateId)) {
// 查询系统默认配置
sql.append("SELECT ID, STCD, LAYOUT_ID, BCL_DATA FROM MS_PSBMODULELB_B WHERE IS_DELETED = 0 AND STCD = '")
.append(moduleId).append("'")
.append(" AND ID NOT IN (SELECT PAGE_ID FROM MS_TEMPLATE_B WHERE PAGE_ID IS NOT NULL AND MODULE_ID = '")
.append(moduleId).append("') ORDER BY RECORD_TIME DESC");
} else {
// 查询指定模板配置
sql.append("SELECT t2.ID, t2.STCD, t2.LAYOUT_ID, t2.BCL_DATA ")
.append("FROM MS_TEMPLATE_B t1 ")
.append("INNER JOIN MS_PSBMODULELB_B t2 ON t1.PAGE_ID = t2.ID AND t1.MODULE_ID = t2.STCD ")
.append("WHERE t1.ID = '").append(templateId).append("'")
.append(" AND t1.MODULE_ID = '").append(moduleId).append("'");
}
List<MsPsbmodulelbB> msPsbmodulelbBList = msPsbmodulelbBMapper.selectBySql(sql.toString());
// 获取电站配置的标签信息
if (!CollectionUtils.isEmpty(msPsbmodulelbBList)) {
MsPsbmodulelbB msPsbmodulelbB = msPsbmodulelbBList.get(0);
// 解析 BCL_DATA JSON 获取组件编码列表
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<PpbclCodeVo> ppbclCodeVos;
try {
ppbclCodeVos = mapper.readValue(msPsbmodulelbB.getBclData(), new TypeReference<List<PpbclCodeVo>>() {});
} catch (Exception e) {
throw new RuntimeException("解析 BCL_DATA 失败", e);
}
List<String> codeList = ppbclCodeVos.stream().map(PpbclCodeVo::getCode).collect(Collectors.toList());
// 查询组件是否有配置标签
LambdaQueryWrapper<MsPpbclB> ppbclBWrapper = new LambdaQueryWrapper<>();
ppbclBWrapper.select(MsPpbclB::getCode);
ppbclBWrapper.in(MsPpbclB::getCode, codeList);
ppbclBWrapper.isNotNull(MsPpbclB::getTagIds);
List<MsPpbclB> msPpbclBList = msPpbclBMapper.selectList(ppbclBWrapper);
if (!CollectionUtils.isEmpty(msPpbclBList)) {
List<String> codes = msPpbclBList.stream().map(MsPpbclB::getCode).collect(Collectors.toList());
msPsbmodulelbB.setCodeList(codes);
}
// 查询组件配置的标签值
LambdaQueryWrapper<MsTagConfigB> tagConfigWrapper = new LambdaQueryWrapper<>();
tagConfigWrapper.select(MsTagConfigB::getCode, MsTagConfigB::getTagId,
MsTagConfigB::getTagValue, MsTagConfigB::getIsShow);
tagConfigWrapper.eq(MsTagConfigB::getModuleId, moduleId);
if (StringUtils.isBlank(templateId)) {
tagConfigWrapper.isNull(MsTagConfigB::getTemplateId);
} else {
tagConfigWrapper.eq(MsTagConfigB::getTemplateId, templateId);
}
if (!codeList.isEmpty()) {
tagConfigWrapper.and(w -> {
w.in(MsTagConfigB::getCode, codeList);
w.or();
w.isNull(MsTagConfigB::getCode);
});
}
List<MsTagConfigB> msTagConfigBList = msTagConfigBMapper.selectList(tagConfigWrapper);
List<TagConfigVo> mainTagList = new ArrayList<>();
List<TagConfigVo> ppbclTagList = new ArrayList<>();
CopyOptions copyOptions = CopyOptions.create().setIgnoreCase(true).setIgnoreError(true);
for (MsTagConfigB msTagConfigB : msTagConfigBList) {
TagConfigVo tagConfigVo = BeanUtil.toBean(msTagConfigB, TagConfigVo.class, copyOptions);
if (StringUtils.isBlank(tagConfigVo.getCode())) {
mainTagList.add(tagConfigVo);
} else {
ppbclTagList.add(tagConfigVo);
}
}
msPsbmodulelbB.setMainTagList(mainTagList);
msPsbmodulelbB.setPpbclTagList(ppbclTagList);
}
return msPsbmodulelbBList;
}
@Override
public List<MsPsbmodulelbB> getPsbmoduleByMidAndLt(String stcd, String layoutType) {
return msPsbmodulelbBMapper.getPsbmoduleByMidAndLt(stcd, layoutType);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveOrUpdateData(MsPsbmodulelbB entity) {
// 如果包含图片则标记为布局
if (entity.getBclData() != null && entity.getBclData().contains("image/png")) {
entity.setIsLayout(1);
}
boolean result;
if (StringUtils.isNotBlank(entity.getId())) {
// 修改
MsPsbmodulelbB before = this.getById(entity.getId());
entity.setModifyUser(SecurityUtils.getCurrentUsername());
entity.setModifyTime(new Date());
result = this.updateById(entity);
if (result && before != null) {
msOperationLogService.recordModifyDetailLog(entity.getId(), TABLE_NAME, before, entity, "psbmodulelbb");
}
} else {
// 新增
entity.setRecordUser(SecurityUtils.getCurrentUsername());
entity.setRecordTime(new Date());
result = this.save(entity);
if (result) {
msOperationLogService.recordAddDetailLog(entity.getId(), TABLE_NAME, entity, "psbmodulelbb");
}
}
// 如果是新增且有关联模板ID更新模板的页面配置ID
if (result && StringUtils.isNotBlank(entity.getTemplateId())) {
MsTemplateB msTemplateB = new MsTemplateB();
msTemplateB.setId(entity.getTemplateId());
msTemplateB.setPageId(entity.getId());
msTemplateBMapper.updateById(msTemplateB);
}
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteData(String id) {
MsPsbmodulelbB entity = this.getById(id);
if (entity == null) {
return false;
}
LambdaUpdateWrapper<MsPsbmodulelbB> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(MsPsbmodulelbB::getId, id);
wrapper.set(MsPsbmodulelbB::getIsDeleted, 1);
wrapper.set(MsPsbmodulelbB::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(MsPsbmodulelbB::getDeleteTime, new Date());
boolean result = this.update(wrapper);
if (result) {
msOperationLogService.recordDeleteDetailLog(id, TABLE_NAME, entity, "psbmodulelbb");
}
return result;
}
@Override
public List<WbsBPpVo> getTreeConfiguredps(DataSourceRequest dataSourceRequest) {
String wbsCode = getFilterFieldValue(dataSourceRequest, "wbsCode");
// 第一步获取已布局电站IS_LAYOUT=1 且未删除
StringBuilder ppsql = new StringBuilder();
ppsql.append("SELECT DISTINCT STCD FROM MS_PSBMODULELB_B WHERE IS_LAYOUT = 1 AND IS_DELETED = 0");
List<Map<String, Object>> ppList = microservicDynamicSQLMapper.getAllList(ppsql.toString(), null);
List<WbsBPpVo> list = new ArrayList<>();
if (ppList != null && !ppList.isEmpty()) {
StringBuilder stcdBuilder = new StringBuilder();
for (Map<String, Object> pp : ppList) {
stcdBuilder.append("'").append(pp.get("STCD")).append("',");
}
String stcdIn = stcdBuilder.substring(0, stcdBuilder.length() - 1);
// 第二步 SD_ENGINFO_B_H 获取电站及基地信息替代 V_MS_STBPRP_T
// HBRVCD BASE_IDHBRVCD_NAME BASE_NAME
StringBuilder basinSql = new StringBuilder();
basinSql.append("SELECT STCD AS wbsCode, ENNM AS wbsName, LGTD AS lgtd, LTTD AS lttd, ")
.append("CASE WHEN BASE_ID IS NULL THEN 'QT' ELSE BASE_ID END AS rvcd, ")
.append("CASE WHEN BASE_NAME IS NULL THEN '其他' ELSE BASE_NAME END AS rvcdName ")
.append("FROM SD_ENGINFO_B_H WHERE IS_DELETED = 0 AND STCD IN (").append(stcdIn).append(") ");
if (StringUtils.isNotBlank(wbsCode)) {
basinSql.append("AND BASE_ID = '").append(wbsCode).append("' ");
}
basinSql.append("ORDER BY ORDER_INDEX ASC");
List<WbsBPpVo> baseVoList = microservicDynamicSQLMapper.getAllListWithResultType(
basinSql.toString(), null, WbsBPpVo.class);
// 第三步按基地编码BASE_ID分组构建树形结构
Map<String, List<WbsBPpVo>> map = new LinkedHashMap<>();
for (WbsBPpVo vo : baseVoList) {
String rvcd = vo.getRvcd();
if (rvcd == null || map.get(rvcd) == null || map.get(rvcd).isEmpty()) {
List<WbsBPpVo> children = new ArrayList<>();
children.add(vo);
map.put(rvcd, children);
} else {
map.get(rvcd).add(vo);
}
}
for (Map.Entry<String, List<WbsBPpVo>> entry : map.entrySet()) {
WbsBPpVo group = new WbsBPpVo();
group.setWbsCode(entry.getKey());
List<WbsBPpVo> children = entry.getValue();
if (!children.isEmpty()) {
group.setWbsName(children.get(0).getRvcdName());
}
group.setChildren(children);
list.add(group);
}
}
return list;
}
// ==================== 私有辅助方法 ====================
/**
* DataSourceRequest 过滤条件中提取指定字段的值
*/
private String getFilterFieldValue(DataSourceRequest request, String fieldName) {
if (request == null || request.getFilter() == null) {
return null;
}
return findFilterValue(request.getFilter(), fieldName);
}
private String findFilterValue(DataSourceRequest.FilterDescriptor filter, String fieldName) {
if (filter == null) {
return null;
}
if (fieldName.equals(filter.getField()) && filter.getValue() != null) {
return filter.getValue().toString();
}
if (filter.getFilters() != null) {
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
String value = findFilterValue(child, fieldName);
if (value != null) {
return value;
}
}
}
return null;
}
}

View File

@ -1,21 +1,38 @@
package com.yfd.platform.qgc_base.service.impl; package com.yfd.platform.qgc_base.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.common.DataSourceRequest; import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
import com.yfd.platform.qgc_base.domain.MsWarnRuleB; import com.yfd.platform.qgc_base.domain.MsWarnRuleB;
import com.yfd.platform.qgc_base.domain.MsWarnRuleDetailB;
import com.yfd.platform.qgc_base.domain.MsWarnRuleStbprpB;
import com.yfd.platform.qgc_base.mapper.MsWarnRuleBMapper; import com.yfd.platform.qgc_base.mapper.MsWarnRuleBMapper;
import com.yfd.platform.qgc_base.mapper.MsWarnRuleDetailBMapper;
import com.yfd.platform.qgc_base.mapper.MsWarnRuleStbprpBMapper;
import com.yfd.platform.qgc_base.service.IMsOperationLogService; import com.yfd.platform.qgc_base.service.IMsOperationLogService;
import com.yfd.platform.qgc_base.service.IMsWarnRuleBService; import com.yfd.platform.qgc_base.service.IMsWarnRuleBService;
import com.yfd.platform.qgc_sys.warnRule.vo.MsWarnRuleBVo;
import com.yfd.platform.qgc_sys.warnRule.vo.MsWarnRuleDetailVo;
import com.yfd.platform.qgc_sys.warnRule.vo.WarnRuleVo;
import com.yfd.platform.qgc_sys.warnRule.vo.WarnYsVo;
import com.yfd.platform.utils.DataSourceRequestUtil; import com.yfd.platform.utils.DataSourceRequestUtil;
import com.yfd.platform.utils.DictCodeToNameConverter;
import com.yfd.platform.utils.CodeToNameMetadataBo;
import com.yfd.platform.utils.SecurityUtils; import com.yfd.platform.utils.SecurityUtils;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Date; import java.util.*;
import java.util.List; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/** /**
* 预警规则配置 Service 实现类 * 预警规则配置 Service 实现类
@ -25,12 +42,37 @@ public class MsWarnRuleBServiceImpl extends ServiceImpl<MsWarnRuleBMapper, MsWar
private static final String TABLE_NAME = "MS_WARN_RULE_B"; private static final String TABLE_NAME = "MS_WARN_RULE_B";
private static final List<CodeToNameMetadataBo> CODE_TO_NAME_META_LIST = new ArrayList<>();
static {
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder()
.codeProperty("ruleType")
.modifyProperty("ruleTypeName")
.dictType("STATIC")
.dictSource("WARN_RULE_TYPE")
.build());
}
@Resource @Resource
private IMsOperationLogService msOperationLogService; private IMsOperationLogService msOperationLogService;
@Resource
private DictCodeToNameConverter dictCodeToNameConverter;
@Resource
private MicroservicDynamicSQLMapper microservicDynamicSQLMapper;
@Resource
private MsWarnRuleDetailBMapper msWarnRuleDetailBMapper;
@Resource
private MsWarnRuleStbprpBMapper msWarnRuleStbprpBMapper;
@Override @Override
public Page<MsWarnRuleB> queryPageList(DataSourceRequest request) { public Page<MsWarnRuleB> queryPageList(DataSourceRequest request) {
return DataSourceRequestUtil.executeQuery(request, MsWarnRuleB.class, this); Page<MsWarnRuleB> page = DataSourceRequestUtil.executeQuery(request, MsWarnRuleB.class, this);
dictCodeToNameConverter.convertCodeToName(page, CODE_TO_NAME_META_LIST);
return page;
} }
@Override @Override
@ -38,7 +80,7 @@ public class MsWarnRuleBServiceImpl extends ServiceImpl<MsWarnRuleBMapper, MsWar
public boolean add(MsWarnRuleB entity, String source) { public boolean add(MsWarnRuleB entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getId(), TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -49,7 +91,7 @@ public class MsWarnRuleBServiceImpl extends ServiceImpl<MsWarnRuleBMapper, MsWar
MsWarnRuleB before = this.getById(entity.getId()); MsWarnRuleB before = this.getById(entity.getId());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getId(), TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -60,17 +102,526 @@ public class MsWarnRuleBServiceImpl extends ServiceImpl<MsWarnRuleBMapper, MsWar
if (ids == null || ids.isEmpty()) return false; if (ids == null || ids.isEmpty()) return false;
int count = 0; int count = 0;
for (String id : ids) { for (String id : ids) {
MsWarnRuleB entity = this.getById(id);
LambdaUpdateWrapper<MsWarnRuleB> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<MsWarnRuleB> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(MsWarnRuleB::getId, id); wrapper.eq(MsWarnRuleB::getId, id);
wrapper.set(MsWarnRuleB::getIsDeleted, 1); wrapper.set(MsWarnRuleB::getIsDeleted, 1);
wrapper.set(MsWarnRuleB::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(MsWarnRuleB::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(MsWarnRuleB::getDeleteTime, new Date()); wrapper.set(MsWarnRuleB::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
MsWarnRuleB entity = this.getById(id); msOperationLogService.recordDeleteDetailLog(id, TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }
return count > 0; return count > 0;
} }
@Override
public List<WarnYsVo> getAllYs(String ruleType) {
String dbRuleType = getOldRuleType(ruleType);
String sql = "SELECT t2.TB_ID AS tbId, t2.YS, t3.YS_SHOW_NAME AS ysName\n" +
"FROM MS_WARN_RULE_B t1\n" +
"INNER JOIN MS_WARN_RULE_DETAIL_B t2 ON t1.ID = t2.RULE_ID\n" +
"INNER JOIN ST_YS_B t3 ON t2.YS = t3.YS\n" +
"WHERE t1.RULE_TYPE ='" + dbRuleType + "'\n" +
" AND t1.IS_DELETED = 0\n" +
" AND t2.IS_DELETED = 0\n" +
"GROUP BY t2.TB_ID, t2.YS, t3.YS_SHOW_NAME";
Map<String, Object> paramMap = new HashMap<>();
return microservicDynamicSQLMapper.getAllListWithResultType(sql, paramMap, WarnYsVo.class);
}
// ==================== 新增方法 ====================
@Override
@Transactional(rollbackFor = Exception.class)
public MsWarnRuleB addOrUpdate(MsWarnRuleBVo vo) {
MsWarnRuleB entity = new MsWarnRuleB();
org.springframework.beans.BeanUtils.copyProperties(vo, entity);
entity.setId(vo.getId());
entity.setModifyTime(new Date());
List<MsWarnRuleDetailVo> detail = vo.getDetail();
Integer lvl = null;
if (!CollectionUtils.isEmpty(detail) && detail.get(0) != null && detail.get(0).getLvl() != null) {
lvl = Integer.parseInt(detail.get(0).getLvl());
}
List<MsWarnRuleDetailB> detailBList = new ArrayList<>();
AtomicInteger i = new AtomicInteger();
if (detail != null) {
for (MsWarnRuleDetailVo detailVo : detail) {
List<WarnYsVo> ysList = detailVo.getYsList();
if (ysList != null) {
for (WarnYsVo ysVo : ysList) {
i.getAndIncrement();
MsWarnRuleDetailB detailB = new MsWarnRuleDetailB();
detailB.setRuleId(vo.getId());
detailB.setTbId(ysVo.getTbId());
detailB.setYs(ysVo.getYs());
detailB.setWarnLevel(detailVo.getWarnLevel());
detailB.setLvl(detailVo.getLvl() != null ? Integer.parseInt(detailVo.getLvl()) : null);
DateTime dateTime = DateUtil.offsetSecond(new Date(), i.get());
detailB.setTm(dateTime);
detailB.setRecordUser(SecurityUtils.getCurrentUsername());
detailB.setRecordTime(dateTime);
detailB.setIsDeleted(0);
detailBList.add(detailB);
}
}
}
}
if (StringUtils.isBlank(vo.getId())) {
// ---- 新增 ----
entity.setRecordUser(SecurityUtils.getCurrentUsername());
if ("common".equals(vo.getRuleCode())) {
boolean exist = checkRuleExist(vo.getRuleType(), lvl);
if (exist) {
throw new RuntimeException("该预警类型的通用规则已存在");
}
}
if (StringUtils.isBlank(vo.getRuleName()) && "custom".equals(vo.getRuleCode())) {
String ruleName = getCustomRuleName(vo.getStcd(), vo.getStnm());
entity.setRuleName(ruleName);
}
entity.setModifyTime(new Date());
this.baseMapper.insert(entity);
if (StringUtils.isNotBlank(entity.getStcd())) {
this.baseMapper.updateStcd(entity.getStcd(), entity.getId());
}
for (MsWarnRuleDetailB detailB : detailBList) {
detailB.setRuleId(entity.getId());
msWarnRuleDetailBMapper.insert(detailB);
}
// 新增测站与规则绑定
if (StringUtils.isNotBlank(vo.getStcd())) {
MsWarnRuleStbprpB existing = msWarnRuleStbprpBMapper.getBindRuleByStcd(vo.getStcd(), vo.getRuleType());
MsWarnRuleStbprpB binding = new MsWarnRuleStbprpB();
binding.setRuleId(entity.getId());
binding.setStcd(vo.getStcd());
binding.setSttpId(vo.getSttpId());
binding.setRecordUser(SecurityUtils.getCurrentUsername());
binding.setRecordTime(new Date());
binding.setIsDeleted(0);
if (existing == null) {
msWarnRuleStbprpBMapper.insert(binding);
} else {
binding.setId(existing.getId());
msWarnRuleStbprpBMapper.updateById(binding);
}
}
msOperationLogService.recordAddDetailLog(entity.getId(), TABLE_NAME, entity, "warningRule");
} else {
// ---- 修改 ----
this.baseMapper.updateById(entity);
// 删除旧要素配置
if (detail != null) {
for (MsWarnRuleDetailVo detailVo : detail) {
Set<String> ysSet = detailVo.getYsList().stream().map(WarnYsVo::getYs).collect(Collectors.toSet());
if (!CollectionUtils.isEmpty(ysSet)) {
LambdaQueryWrapper<MsWarnRuleDetailB> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsWarnRuleDetailB::getRuleId, entity.getId());
if (detailVo.getWarnLevel() != null) {
wrapper.eq(MsWarnRuleDetailB::getWarnLevel, detailVo.getWarnLevel());
}
wrapper.in(MsWarnRuleDetailB::getYs, ysSet);
msWarnRuleDetailBMapper.delete(wrapper);
}
}
}
// 新增要素配置
for (MsWarnRuleDetailB detailB : detailBList) {
msWarnRuleDetailBMapper.insert(detailB);
}
// 更新测站与规则绑定
if (StringUtils.isNotBlank(vo.getStcd())) {
MsWarnRuleStbprpB existing = msWarnRuleStbprpBMapper.getBindRuleByStcd(vo.getStcd(), vo.getRuleType());
MsWarnRuleStbprpB binding = new MsWarnRuleStbprpB();
binding.setSttpId(vo.getSttpId());
binding.setStcd(vo.getStcd());
binding.setRuleId(vo.getId());
binding.setRecordUser(SecurityUtils.getCurrentUsername());
binding.setRecordTime(new Date());
binding.setIsDeleted(0);
if (existing == null) {
msWarnRuleStbprpBMapper.insert(binding);
} else {
binding.setId(existing.getId());
msWarnRuleStbprpBMapper.updateById(binding);
}
}
MsWarnRuleB before = this.getById(entity.getId());
msOperationLogService.recordModifyDetailLog(entity.getId(), TABLE_NAME, before, entity, "warningRule");
}
// 修改 isShow
updateShow(vo.getIsShow());
return entity;
}
@Override
public boolean check(String id) {
LambdaQueryWrapper<MsWarnRuleStbprpB> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsWarnRuleStbprpB::getRuleId, id);
return msWarnRuleStbprpBMapper.selectCount(wrapper) > 0;
}
@Override
public void deleteBind(String id) {
msWarnRuleStbprpBMapper.deleteBind(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteRule(String id) {
// 删除要素配置
LambdaQueryWrapper<MsWarnRuleDetailB> detailWrapper = new LambdaQueryWrapper<>();
detailWrapper.eq(MsWarnRuleDetailB::getRuleId, id);
msWarnRuleDetailBMapper.delete(detailWrapper);
// 删除规则绑定
LambdaQueryWrapper<MsWarnRuleStbprpB> bindWrapper = new LambdaQueryWrapper<>();
bindWrapper.eq(MsWarnRuleStbprpB::getRuleId, id);
msWarnRuleStbprpBMapper.delete(bindWrapper);
// 逻辑删除规则主表
MsWarnRuleB entity = this.getById(id);
LambdaUpdateWrapper<MsWarnRuleB> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(MsWarnRuleB::getId, id);
updateWrapper.set(MsWarnRuleB::getIsDeleted, 1);
updateWrapper.set(MsWarnRuleB::getDeleteUser, SecurityUtils.getCurrentUsername());
updateWrapper.set(MsWarnRuleB::getDeleteTime, new Date());
this.update(updateWrapper);
if (entity != null) {
msOperationLogService.recordDeleteDetailLog(id, TABLE_NAME, entity, "warningRule");
}
}
@Override
public void updateShow(Integer isShow) {
if (isShow != null) {
this.baseMapper.updateIsShow(isShow);
}
}
@Override
public Map<String, Object> getLimit(DataSourceRequest request) {
String ruleType = getFilterFieldValue(request, "ruleType");
ruleType = getOldRuleType(ruleType);
String stcd = getFilterFieldValue(request, "stcd");
String sql = "SELECT * FROM (\n" +
"SELECT t2.MIN_VAL AS min, t2.MAX_VAL AS max\n" +
"FROM MS_WARN_RULE_B t1\n" +
"INNER JOIN MS_WARN_RULE_DETAIL_B t2 ON t1.ID = t2.RULE_ID\n" +
"INNER JOIN MS_WARN_RULE_STBPRP_B t3 ON t1.ID = t3.RULE_ID\n" +
"WHERE t1.RULE_TYPE = '" + ruleType + "'\n" +
" AND t3.STCD = '" + stcd + "'\n" +
"ORDER BY TM DESC) WHERE ROWNUM = 1";
List<Map<String, Object>> allList = microservicDynamicSQLMapper.getAllList(sql, null);
return CollectionUtils.isEmpty(allList) ? new HashMap<>() : allList.get(0);
}
@Override
public Page<MsWarnRuleBVo> getRuleBindList(DataSourceRequest request) {
StringBuilder sql = new StringBuilder();
sql.append("SELECT id AS bindId, STCD, STNM, STTP_CODE AS sttpCode, RULE_NAME AS ruleName, ")
.append("RULE_TYPE AS ruleType, recordUser, MODIFY_TIME AS modifyTime, isShow, RULE_CODE AS ruleCode ")
.append("FROM (\n")
.append("SELECT t1.ID, t1.STCD, t3.STNM, t3.STTP_CODE, t2.RULE_NAME, t2.RULE_TYPE, ")
.append("t2.RECORD_USER AS recordUser, t2.MODIFY_TIME, t2.DESCRIPTION, t2.IS_SHOW AS isShow, t2.RULE_CODE ")
.append("FROM MS_WARN_RULE_STBPRP_B t1\n")
.append("INNER JOIN MS_WARN_RULE_B t2 ON t1.RULE_ID = t2.ID\n")
.append("INNER JOIN V_MS_STBPRP_T t3 ON t1.STCD = t3.STCD\n")
.append("WHERE t2.RULE_CODE IN ('common','custom')\n")
.append(") WHERE 1=1");
Map<String, Object> params = new HashMap<>();
// 处理过滤条件
appendFilterConditions(request, sql, params);
// 处理排序
appendOrderBy(request, sql);
Page<MsWarnRuleBVo> page;
if (request.getPage() > 0 && request.getPageSize() > 0) {
page = new Page<>(request.getPage(), request.getPageSize());
} else if (request.getTake() > 0) {
long pageNum = (request.getSkip() / request.getTake()) + 1;
page = new Page<>(pageNum, request.getTake());
} else {
page = new Page<>(1, 20);
}
microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), params, MsWarnRuleBVo.class);
return page;
}
@Override
public MsWarnRuleBVo getRuleBindDetail(String ruleId, String bindId) {
if (StringUtils.isBlank(ruleId) && StringUtils.isBlank(bindId)) {
return null;
}
MsWarnRuleBVo vo = new MsWarnRuleBVo();
vo.setId(ruleId);
MsWarnRuleStbprpB msStcdWarnRuleB = null;
if (StringUtils.isNotBlank(bindId)) {
msStcdWarnRuleB = msWarnRuleStbprpBMapper.selectById(bindId);
if (msStcdWarnRuleB == null) {
return null;
}
ruleId = msStcdWarnRuleB.getRuleId();
vo.setBindId(bindId);
vo.setId(ruleId);
}
MsWarnRuleB rule = this.baseMapper.selectById(ruleId);
if (rule == null) {
return null;
}
org.springframework.beans.BeanUtils.copyProperties(rule, vo);
if (msStcdWarnRuleB != null) {
vo.setStcd(msStcdWarnRuleB.getStcd());
vo.setSttpId(msStcdWarnRuleB.getSttpId());
}
if (StringUtils.isNotBlank(vo.getStcd())) {
String sql = "SELECT stcd, stnm, rstcd, ennm FROM V_MS_STBPRP_T WHERE STCD = '" + vo.getStcd() + "'";
List<MsWarnRuleBVo> voList = microservicDynamicSQLMapper.pageAllListWithResultType(null, sql, null, MsWarnRuleBVo.class);
if (!CollectionUtils.isEmpty(voList)) {
MsWarnRuleBVo stationVo = voList.get(0);
vo.setRstcd(stationVo.getRstcd());
vo.setEnnm(stationVo.getEnnm());
vo.setStnm(stationVo.getStnm());
}
}
// 查询规则配置的要素
LambdaQueryWrapper<MsWarnRuleDetailB> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MsWarnRuleDetailB::getRuleId, ruleId);
List<MsWarnRuleDetailB> detailBList = msWarnRuleDetailBMapper.selectList(queryWrapper);
List<MsWarnRuleDetailVo> detailVos = new ArrayList<>();
if (!CollectionUtils.isEmpty(detailBList)) {
Map<Integer, List<MsWarnRuleDetailB>> warnLevelMap = detailBList.stream()
.collect(Collectors.groupingBy(d -> d.getWarnLevel() != null ? d.getWarnLevel() : 0));
for (Integer warnLevel : warnLevelMap.keySet()) {
MsWarnRuleDetailVo detailVo = new MsWarnRuleDetailVo();
List<MsWarnRuleDetailB> detailGroup = warnLevelMap.get(warnLevel);
List<WarnYsVo> ysVoList = new ArrayList<>();
MsWarnRuleDetailB first = detailGroup.get(0);
org.springframework.beans.BeanUtils.copyProperties(first, detailVo);
for (MsWarnRuleDetailB db : detailGroup) {
WarnYsVo ysVo = new WarnYsVo();
org.springframework.beans.BeanUtils.copyProperties(db, ysVo);
ysVoList.add(ysVo);
}
detailVo.setYsList(ysVoList);
detailVos.add(detailVo);
}
}
vo.setDetail(detailVos);
return vo;
}
@Override
public List<WarnRuleVo> getRuleListByStcd(String stcd, String ruleType, String lvl) {
List<WarnRuleVo> ruleList = this.baseMapper.getRuleListByStcd(stcd, ruleType);
if (CollectionUtils.isEmpty(ruleList)) {
return ruleList;
}
Set<String> ruleIdSet = ruleList.stream().map(WarnRuleVo::getId).collect(Collectors.toSet());
// 如果测站有绑定规则默认第一个
LambdaQueryWrapper<MsWarnRuleStbprpB> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsWarnRuleStbprpB::getStcd, stcd);
wrapper.in(MsWarnRuleStbprpB::getRuleId, ruleIdSet);
MsWarnRuleStbprpB binding = msWarnRuleStbprpBMapper.selectOne(wrapper);
if (binding != null) {
String boundRuleId = binding.getRuleId();
WarnRuleVo first = ruleList.stream()
.filter(r -> r.getId().equals(boundRuleId)).findFirst().orElse(null);
if (first != null) {
ruleList.remove(first);
ruleList.add(0, first);
}
return ruleList;
}
if ("WQ_RULE".equals(ruleType) && StringUtils.isNotBlank(lvl)) {
WarnRuleVo matched = ruleList.stream()
.filter(r -> "common".equals(r.getRuleCode()) && r.getLvl().equals(lvl))
.findFirst().orElse(null);
if (matched != null) {
ruleList.remove(matched);
ruleList.add(0, matched);
}
}
return ruleList;
}
// ==================== 私有辅助方法 ====================
/**
* 生成自定义规则名称站名-站类型名-自定义规则-序号
*/
private String getCustomRuleName(String stcd, String stnm) {
StringBuilder sb = new StringBuilder();
String sttpCodeName = this.baseMapper.getSttpCodeNameByStcd(stcd);
String customRuleName = this.baseMapper.getCustomRuleNameByStcd(stcd);
sb.append(stnm).append("-").append(sttpCodeName).append("-自定义规则-");
if (StringUtils.isBlank(customRuleName)) {
sb.append(1);
return sb.toString();
}
String num = customRuleName.substring(customRuleName.lastIndexOf("-") + 1);
if (!num.matches("-?\\d+")) {
throw new RuntimeException("自定义规则名称异常: " + customRuleName);
}
return sb.append(Integer.parseInt(num) + 1).toString();
}
/**
* 校验通用规则是否已存在
*/
private boolean checkRuleExist(String ruleType, Integer lvl) {
if ("WQ_RULE".equals(ruleType)) {
if (lvl == null) {
throw new RuntimeException("新增通用水质规则时水质等级不能为空");
}
return this.baseMapper.checkWqCommonRuleExist(lvl) > 0;
} else {
LambdaQueryWrapper<MsWarnRuleB> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsWarnRuleB::getRuleType, ruleType);
wrapper.eq(MsWarnRuleB::getRuleCode, "common");
wrapper.eq(MsWarnRuleB::getIsDeleted, 0);
return this.baseMapper.selectCount(wrapper) > 0;
}
}
/**
* 旧版规则类型枚举映射
*/
private String getOldRuleType(String ruleType) {
if ("WQ_RULE".equals(ruleType)) {
return "WQLVL";
} else if ("WT_RULE".equals(ruleType)) {
return "WTMN";
} else if ("QGC_RULE".equals(ruleType)) {
return "EQMN";
} else if ("RZ_RULE".equals(ruleType)) {
return "RSVRFSR";
}
return ruleType;
}
/**
* DataSourceRequest 过滤条件中提取指定字段的值
*/
private String getFilterFieldValue(DataSourceRequest request, String fieldName) {
if (request == null || request.getFilter() == null) {
return null;
}
return findFilterValue(request.getFilter(), fieldName);
}
private String findFilterValue(DataSourceRequest.FilterDescriptor filter, String fieldName) {
if (filter == null) {
return null;
}
if (fieldName.equals(filter.getField()) && filter.getValue() != null) {
return filter.getValue().toString();
}
if (filter.getFilters() != null) {
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
String value = findFilterValue(child, fieldName);
if (value != null) {
return value;
}
}
}
return null;
}
/**
* 处理 DataSourceRequest 的过滤条件拼接到 SQL
*/
private void appendFilterConditions(DataSourceRequest request, StringBuilder sql, Map<String, Object> params) {
if (request == null || request.getFilter() == null) {
return;
}
processFilters(request.getFilter(), sql, params);
}
private void processFilters(DataSourceRequest.FilterDescriptor filter, StringBuilder sql, Map<String, Object> params) {
if (filter == null) {
return;
}
if (filter.getFilters() != null && !filter.getFilters().isEmpty()) {
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
processFilter(child, sql, params);
}
}
}
private void processFilter(DataSourceRequest.FilterDescriptor filter, StringBuilder sql, Map<String, Object> params) {
if (filter == null || filter.getField() == null || filter.getValue() == null) {
return;
}
String field = filter.getField();
String operator = filter.getOperator();
Object value = filter.getValue();
switch (operator) {
case "eq":
sql.append(" AND ").append(field).append(" = '").append(value).append("'");
break;
case "neq":
sql.append(" AND ").append(field).append(" <> '").append(value).append("'");
break;
case "contains":
sql.append(" AND ").append(field).append(" LIKE '%").append(value).append("%'");
break;
case "startswith":
sql.append(" AND ").append(field).append(" LIKE '").append(value).append("%'");
break;
case "endswith":
sql.append(" AND ").append(field).append(" LIKE '%").append(value).append("'");
break;
case "gt":
sql.append(" AND ").append(field).append(" > '").append(value).append("'");
break;
case "gte":
sql.append(" AND ").append(field).append(" >= '").append(value).append("'");
break;
case "lt":
sql.append(" AND ").append(field).append(" < '").append(value).append("'");
break;
case "lte":
sql.append(" AND ").append(field).append(" <= '").append(value).append("'");
break;
default:
break;
}
}
/**
* 处理排序条件
*/
private void appendOrderBy(DataSourceRequest request, StringBuilder sql) {
if (request.getSort() == null || request.getSort().isEmpty()) {
return;
}
sql.append(" ORDER BY ");
for (int i = 0; i < request.getSort().size(); i++) {
DataSourceRequest.SortDescriptor sort = request.getSort().get(i);
sql.append(sort.getField());
if ("desc".equalsIgnoreCase(sort.getDir())) {
sql.append(" DESC");
} else {
sql.append(" ASC");
}
if (i < request.getSort().size() - 1) {
sql.append(", ");
}
}
}
} }

View File

@ -71,7 +71,7 @@ public class SdAiboxBHServiceImpl extends ServiceImpl<SdAiboxBHMapper, SdAiboxBH
public boolean add(SdAiboxBH entity, String source) { public boolean add(SdAiboxBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -82,7 +82,7 @@ public class SdAiboxBHServiceImpl extends ServiceImpl<SdAiboxBHMapper, SdAiboxBH
SdAiboxBH before = this.getById(entity.getStcd()); SdAiboxBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -93,14 +93,14 @@ public class SdAiboxBHServiceImpl extends ServiceImpl<SdAiboxBHMapper, SdAiboxBH
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdAiboxBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdAiboxBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdAiboxBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdAiboxBH::getStcd, stcd); wrapper.eq(SdAiboxBH::getStcd, stcd);
wrapper.set(SdAiboxBH::getIsDeleted, 1); wrapper.set(SdAiboxBH::getIsDeleted, 1);
wrapper.set(SdAiboxBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdAiboxBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdAiboxBH::getDeleteTime, new Date()); wrapper.set(SdAiboxBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdAiboxBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -59,7 +59,7 @@ public class SdAimonitorBHServiceImpl extends ServiceImpl<SdAimonitorBHMapper, S
public boolean add(SdAimonitorBH entity, String source) { public boolean add(SdAimonitorBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -70,7 +70,7 @@ public class SdAimonitorBHServiceImpl extends ServiceImpl<SdAimonitorBHMapper, S
SdAimonitorBH before = this.getById(entity.getStcd()); SdAimonitorBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -81,14 +81,14 @@ public class SdAimonitorBHServiceImpl extends ServiceImpl<SdAimonitorBHMapper, S
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdAimonitorBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdAimonitorBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdAimonitorBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdAimonitorBH::getStcd, stcd); wrapper.eq(SdAimonitorBH::getStcd, stcd);
wrapper.set(SdAimonitorBH::getIsDeleted, 1); wrapper.set(SdAimonitorBH::getIsDeleted, 1);
wrapper.set(SdAimonitorBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdAimonitorBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdAimonitorBH::getDeleteTime, new Date()); wrapper.set(SdAimonitorBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdAimonitorBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -66,7 +66,7 @@ public class SdArtsgBHServiceImpl extends ServiceImpl<SdArtsgBHMapper, SdArtsgBH
public boolean add(SdArtsgBH entity, String source) { public boolean add(SdArtsgBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -77,7 +77,7 @@ public class SdArtsgBHServiceImpl extends ServiceImpl<SdArtsgBHMapper, SdArtsgBH
SdArtsgBH before = this.getById(entity.getStcd()); SdArtsgBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -88,9 +88,9 @@ public class SdArtsgBHServiceImpl extends ServiceImpl<SdArtsgBHMapper, SdArtsgBH
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdArtsgBH entity = this.getById(stcd);
if (this.removeById(stcd)) { if (this.removeById(stcd)) {
SdArtsgBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -68,7 +68,7 @@ public class SdDwBHServiceImpl extends ServiceImpl<SdDwBHMapper, SdDwBH> impleme
public boolean add(SdDwBH entity, String source) { public boolean add(SdDwBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -79,7 +79,7 @@ public class SdDwBHServiceImpl extends ServiceImpl<SdDwBHMapper, SdDwBH> impleme
SdDwBH before = this.getById(entity.getStcd()); SdDwBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -90,14 +90,14 @@ public class SdDwBHServiceImpl extends ServiceImpl<SdDwBHMapper, SdDwBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdDwBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdDwBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdDwBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdDwBH::getStcd, stcd); wrapper.eq(SdDwBH::getStcd, stcd);
wrapper.set(SdDwBH::getIsDeleted, 1); wrapper.set(SdDwBH::getIsDeleted, 1);
wrapper.set(SdDwBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdDwBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdDwBH::getDeleteTime, new Date()); wrapper.set(SdDwBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdDwBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -68,7 +68,7 @@ public class SdEqBHServiceImpl extends ServiceImpl<SdEqBHMapper, SdEqBH> impleme
public boolean add(SdEqBH entity, String source) { public boolean add(SdEqBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -79,7 +79,7 @@ public class SdEqBHServiceImpl extends ServiceImpl<SdEqBHMapper, SdEqBH> impleme
SdEqBH before = this.getById(entity.getStcd()); SdEqBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -90,14 +90,14 @@ public class SdEqBHServiceImpl extends ServiceImpl<SdEqBHMapper, SdEqBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdEqBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdEqBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdEqBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdEqBH::getStcd, stcd); wrapper.eq(SdEqBH::getStcd, stcd);
wrapper.set(SdEqBH::getIsDeleted, 1); wrapper.set(SdEqBH::getIsDeleted, 1);
wrapper.set(SdEqBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdEqBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdEqBH::getDeleteTime, new Date()); wrapper.set(SdEqBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdEqBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -65,7 +65,7 @@ public class SdFbrdBHServiceImpl extends ServiceImpl<SdFbrdBHMapper, SdFbrdBH> i
public boolean add(SdFbrdBH entity, String source) { public boolean add(SdFbrdBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -76,7 +76,7 @@ public class SdFbrdBHServiceImpl extends ServiceImpl<SdFbrdBHMapper, SdFbrdBH> i
SdFbrdBH before = this.getById(entity.getStcd()); SdFbrdBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -87,9 +87,9 @@ public class SdFbrdBHServiceImpl extends ServiceImpl<SdFbrdBHMapper, SdFbrdBH> i
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdFbrdBH entity = this.getById(stcd);
if (this.removeById(stcd)) { if (this.removeById(stcd)) {
SdFbrdBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -69,7 +69,7 @@ public class SdFhbtBHServiceImpl extends ServiceImpl<SdFhbtBHMapper, SdFhbtBH> i
public boolean add(SdFhbtBH entity, String source) { public boolean add(SdFhbtBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -80,7 +80,7 @@ public class SdFhbtBHServiceImpl extends ServiceImpl<SdFhbtBHMapper, SdFhbtBH> i
SdFhbtBH before = this.getById(entity.getStcd()); SdFhbtBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -91,14 +91,14 @@ public class SdFhbtBHServiceImpl extends ServiceImpl<SdFhbtBHMapper, SdFhbtBH> i
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdFhbtBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdFhbtBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdFhbtBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdFhbtBH::getStcd, stcd); wrapper.eq(SdFhbtBH::getStcd, stcd);
wrapper.set(SdFhbtBH::getIsDeleted, 1); wrapper.set(SdFhbtBH::getIsDeleted, 1);
wrapper.set(SdFhbtBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdFhbtBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdFhbtBH::getDeleteTime, new Date()); wrapper.set(SdFhbtBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdFhbtBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -2,20 +2,124 @@ package com.yfd.platform.qgc_base.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.qgc_base.domain.SdFishDictoryB; import com.yfd.platform.qgc_base.domain.SdFishDictoryB;
import com.yfd.platform.qgc_base.mapper.SdFishDictoryBMapper; import com.yfd.platform.qgc_base.mapper.SdFishDictoryBMapper;
import com.yfd.platform.qgc_base.service.IMsOperationLogService;
import com.yfd.platform.qgc_base.service.ISdFishDictoryBService; import com.yfd.platform.qgc_base.service.ISdFishDictoryBService;
import com.yfd.platform.utils.CodeToNameMetadataBo;
import com.yfd.platform.utils.DataSourceRequestUtil;
import com.yfd.platform.utils.DictCodeToNameConverter;
import com.yfd.platform.utils.SecurityUtils;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 鱼类字典 Service 实现类
*/
@Service @Service
public class SdFishDictoryBServiceImpl extends ServiceImpl<SdFishDictoryBMapper, SdFishDictoryB> implements ISdFishDictoryBService { public class SdFishDictoryBServiceImpl extends ServiceImpl<SdFishDictoryBMapper, SdFishDictoryB> implements ISdFishDictoryBService {
private static final String TABLE_NAME = "SD_FISHDICTORY_B";
@Resource
private IMsOperationLogService msOperationLogService;
@Resource
private DictCodeToNameConverter dictCodeToNameConverter;
/**
* 代码转名称元数据配置列表静态初始化
* <p>
* 每个模块的 ServiceImpl 中可按需定义自己的 codeToNameMetadataBoList
* 在查询方法返回前调用 dictCodeToNameConverter.convertCodeToName(voList, codeToNameMetadataBoList)
* 即可自动将 code 字段转为对应的 name 字段
* </p>
*
* <pre>
* 使用示例
* // 在查询方法末尾调用
* dictCodeToNameConverter.convertCodeToName(voList, CODE_TO_NAME_META_LIST);
* </pre>
*/
private static final List<CodeToNameMetadataBo> CODE_TO_NAME_META_LIST = new ArrayList<>();
static {
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("specOrigin").modifyProperty("specOriginName").dictType("STATIC").dictSource("SPEC_ORIGIN").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rare").modifyProperty("rareName").dictType("STATIC").dictSource("TY_SF").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("ptype").modifyProperty("ptypeName").dictType("STATIC").dictSource("PTYPE").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("habitat").modifyProperty("habitatName").dictType("STATIC").dictSource("HABITAT").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("situation").modifyProperty("situationName").dictType("STATIC").dictSource("SITUATION").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("resourceType").modifyProperty("resourceTypeName").dictType("STATIC").dictSource("RESOURCE_TYPE").build());
// CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("wqtq").modifyProperty("wqtqName").dictType("STATIC").dictSource("WWQTG").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("type").modifyProperty("typeName").dictType("STATIC").dictSource("WATER_TYPE").build());
}
@Override
public Page<SdFishDictoryB> queryPageList(DataSourceRequest request) {
Page<SdFishDictoryB> sdFishDictoryBPage = DataSourceRequestUtil.executeQuery(request, SdFishDictoryB.class, this);
dictCodeToNameConverter.convertCodeToName(sdFishDictoryBPage, CODE_TO_NAME_META_LIST);
return sdFishDictoryBPage;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean add(SdFishDictoryB entity, String source) {
boolean result = this.save(entity);
if (result) {
msOperationLogService.recordAddDetailLog(entity.getId(),TABLE_NAME, entity, source);
}
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean update(SdFishDictoryB entity, String source) {
SdFishDictoryB before = this.getById(entity.getId());
boolean result = this.updateById(entity);
if (result && before != null) {
msOperationLogService.recordModifyDetailLog(entity.getId(),TABLE_NAME, before, entity, source);
}
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean delete(List<String> ids, String source) {
if (ids == null || ids.isEmpty()) return false;
int count = 0;
for (String id : ids) {
SdFishDictoryB entity = getById(id);
LambdaUpdateWrapper<SdFishDictoryB> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdFishDictoryB::getId, id);
wrapper.set(SdFishDictoryB::getIsDeleted, 1);
wrapper.set(SdFishDictoryB::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdFishDictoryB::getDeleteTime, new Date());
if (this.update(wrapper)) {
msOperationLogService.recordDeleteDetailLog(id,TABLE_NAME, entity, source);
count++;
}
}
return count > 0;
}
@Override
public SdFishDictoryB getById(String id) {
LambdaQueryWrapper<SdFishDictoryB> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SdFishDictoryB::getId, id)
.eq(SdFishDictoryB::getIsDeleted, 0);
return getOne(wrapper);
}
@Override @Override
public Page<SdFishDictoryB> selectPage(String name, String code, Integer type, Integer rare, Page<SdFishDictoryB> page) { public Page<SdFishDictoryB> selectPage(String name, String code, Integer type, Integer rare, Page<SdFishDictoryB> page) {
LambdaQueryWrapper<SdFishDictoryB> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SdFishDictoryB> wrapper = new LambdaQueryWrapper<>();
@ -38,35 +142,6 @@ public class SdFishDictoryBServiceImpl extends ServiceImpl<SdFishDictoryBMapper,
return page(page, wrapper); return page(page, wrapper);
} }
@Override
public boolean add(SdFishDictoryB fishDictoryB) {
fishDictoryB.setIsDeleted(0);
return save(fishDictoryB);
}
@Override
public boolean updateById(SdFishDictoryB fishDictoryB) {
return updateById(fishDictoryB);
}
@Override
public boolean deleteById(String id) {
SdFishDictoryB entity = getById(id);
if (entity != null) {
entity.setIsDeleted(1);
return updateById(entity);
}
return false;
}
@Override
public SdFishDictoryB getById(String id) {
LambdaQueryWrapper<SdFishDictoryB> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SdFishDictoryB::getId, id)
.eq(SdFishDictoryB::getIsDeleted, 0);
return getOne(wrapper);
}
@Override @Override
public List<SdFishDictoryB> findSimilarFish(String name, Integer limit) { public List<SdFishDictoryB> findSimilarFish(String name, Integer limit) {
if (!StringUtils.hasText(name)) { if (!StringUtils.hasText(name)) {

View File

@ -216,7 +216,7 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
boolean result = save(entity); boolean result = save(entity);
if (result) { if (result) {
// msOperationLogService.recordOperationLog(TABLE_NAME, entity.getStcd(), "新增", source); // msOperationLogService.recordOperationLog(TABLE_NAME, entity.getStcd(), "新增", source);
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -226,7 +226,7 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
SdFpssBH before = this.getById(entity.getStcd()); SdFpssBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -259,14 +259,14 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdFpssBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdFpssBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdFpssBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdFpssBH::getStcd, stcd); wrapper.eq(SdFpssBH::getStcd, stcd);
wrapper.set(SdFpssBH::getIsDeleted, 1); wrapper.set(SdFpssBH::getIsDeleted, 1);
wrapper.set(SdFpssBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdFpssBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdFpssBH::getDeleteTime, new Date()); wrapper.set(SdFpssBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdFpssBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -0,0 +1,170 @@
package com.yfd.platform.qgc_base.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.qgc_base.domain.SdFpssrlR;
import com.yfd.platform.qgc_base.domain.SdFpssrlRAiRequest;
import com.yfd.platform.qgc_base.mapper.SdFpssrlRMapper;
import com.yfd.platform.qgc_base.service.IMsOperationLogService;
import com.yfd.platform.qgc_base.service.ISdFpssrlRService;
import com.yfd.platform.utils.DataSourceRequestUtil;
import com.yfd.platform.utils.SecurityUtils;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 过鱼设施自动数据表 服务实现类
* </p>
*/
@Slf4j
@Service
public class SdFpssrlRServiceImpl extends ServiceImpl<SdFpssrlRMapper, SdFpssrlR> implements ISdFpssrlRService {
private static final String TABLE_NAME = "SD_FPSSRL_R";
@Resource
private IMsOperationLogService msOperationLogService;
@Override
public Page<SdFpssrlR> queryPageList(DataSourceRequest request) {
return DataSourceRequestUtil.executeQuery(request, SdFpssrlR.class, this);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean add(SdFpssrlR entity, String source) {
boolean result = this.save(entity);
// if (result) {
// msOperationLogService.recordAddDetailLog(entity.getId(),TABLE_NAME, entity, source);
// }
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean update(SdFpssrlR entity, String source) {
// SdFpssrlR before = this.getById(entity.getId());
boolean result = this.updateById(entity);
// if (result && before != null) {
// msOperationLogService.recordModifyDetailLog(entity.getId(),TABLE_NAME, before, entity, source);
// }
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean delete(List<String> ids, String source) {
if (ids == null || ids.isEmpty()) return false;
int count = 0;
for (String id : ids) {
// SdFpssrlR entity = getById(id);
LambdaUpdateWrapper<SdFpssrlR> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdFpssrlR::getId, id);
wrapper.set(SdFpssrlR::getIsDeleted, 1);
wrapper.set(SdFpssrlR::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdFpssrlR::getDeleteTime, new Date());
if (this.update(wrapper)) {
// msOperationLogService.recordDeleteDetailLog(id,TABLE_NAME, entity, source);
count++;
}
}
return count > 0;
}
@Override
public SdFpssrlR getById(String id) {
LambdaQueryWrapper<SdFpssrlR> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SdFpssrlR::getId, id)
.eq(SdFpssrlR::getIsDeleted, 0);
return getOne(wrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public SdFpssrlR processAiReport(SdFpssrlRAiRequest request) {
SdFpssrlR entity = new SdFpssrlR();
entity.setStcd(request.getStcd());
entity.setTm(request.getTm());
entity.setFtp(request.getFtp());
entity.setFcnt(request.getFcnt() != null ? request.getFcnt() : 1);
entity.setFsz(request.getFsz());
entity.setLength(request.getLength());
entity.setWidth(request.getWidth());
entity.setFishspeed(request.getFishspeed());
entity.setDirection(request.getDirection());
entity.setFishposition(request.getFishposition());
entity.setFirstImgUrl(request.getFirstImgUrl());
entity.setSecondImgUrl(request.getSecondImgUrl());
entity.setVideoUrl(request.getVideoUrl());
entity.setTemperature(request.getTemperature());
entity.setWaterlevel(request.getWaterlevel());
entity.setSpeed(request.getSpeed());
entity.setQ(request.getQ());
entity.setDox(request.getDox());
entity.setTu(request.getTu());
entity.setChannelno(StrUtil.isNotBlank(request.getChannelno()) ? request.getChannelno() : "主通道");
entity.setRecordUser("AI_SYSTEM");
entity.setRecordTime(new Date());
entity.setIsDeleted(0);
entity.setRemark(request.getRemark());
// boolean result = this.save(entity);
// if (result) {
// log.info("AI识别数据保存成功, id={}, stcd={}, ftp={}", entity.getId(), entity.getStcd(), entity.getFtp());
// } else {
// log.error("AI识别数据保存失败, stcd={}, ftp={}", request.getStcd(), request.getFtp());
// }
return entity;
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<SdFpssrlR> processAiReportBatch(List<SdFpssrlRAiRequest> requests) {
List<SdFpssrlR> entities = new ArrayList<>();
Date now = new Date();
for (SdFpssrlRAiRequest req : requests) {
SdFpssrlR entity = new SdFpssrlR();
entity.setStcd(req.getStcd());
entity.setTm(req.getTm());
entity.setFtp(req.getFtp());
entity.setFcnt(req.getFcnt() != null ? req.getFcnt() : 1);
entity.setFsz(req.getFsz());
entity.setLength(req.getLength());
entity.setWidth(req.getWidth());
entity.setFishspeed(req.getFishspeed());
entity.setDirection(req.getDirection());
entity.setFishposition(req.getFishposition());
entity.setFirstImgUrl(req.getFirstImgUrl());
entity.setSecondImgUrl(req.getSecondImgUrl());
entity.setVideoUrl(req.getVideoUrl());
entity.setTemperature(req.getTemperature());
entity.setWaterlevel(req.getWaterlevel());
entity.setSpeed(req.getSpeed());
entity.setQ(req.getQ());
entity.setDox(req.getDox());
entity.setTu(req.getTu());
entity.setChannelno(StrUtil.isNotBlank(req.getChannelno()) ? req.getChannelno() : "主通道");
entity.setFid(req.getFid());
entity.setRemark(req.getRemark());
entity.setRecordUser("AI_SYSTEM");
entity.setRecordTime(now);
entity.setModifyUser("AI_SYSTEM");
entity.setModifyTime(now);
entity.setIsDeleted(0);
entities.add(entity);
}
baseMapper.mergeFishRecords(entities);
return entities;
}
}

View File

@ -69,7 +69,7 @@ public class SdOpinfoBHServiceImpl extends ServiceImpl<SdOpinfoBHMapper, SdOpinf
public boolean add(SdOpinfoBH entity, String source) { public boolean add(SdOpinfoBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -80,7 +80,7 @@ public class SdOpinfoBHServiceImpl extends ServiceImpl<SdOpinfoBHMapper, SdOpinf
SdOpinfoBH before = this.getById(entity.getStcd()); SdOpinfoBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -91,14 +91,14 @@ public class SdOpinfoBHServiceImpl extends ServiceImpl<SdOpinfoBHMapper, SdOpinf
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdOpinfoBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdOpinfoBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdOpinfoBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdOpinfoBH::getStcd, stcd); wrapper.eq(SdOpinfoBH::getStcd, stcd);
wrapper.set(SdOpinfoBH::getIsDeleted, 1); wrapper.set(SdOpinfoBH::getIsDeleted, 1);
wrapper.set(SdOpinfoBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdOpinfoBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdOpinfoBH::getDeleteTime, new Date()); wrapper.set(SdOpinfoBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdOpinfoBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -52,6 +52,7 @@ public class SdOtteBHServiceImpl extends ServiceImpl<SdOtteBHMapper, SdOtteBH> i
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("usfl").modifyProperty("usflName").dictType("STATIC").dictSource("USFL").build());
} }
@ -67,7 +68,7 @@ public class SdOtteBHServiceImpl extends ServiceImpl<SdOtteBHMapper, SdOtteBH> i
public boolean add(SdOtteBH entity, String source) { public boolean add(SdOtteBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -78,7 +79,7 @@ public class SdOtteBHServiceImpl extends ServiceImpl<SdOtteBHMapper, SdOtteBH> i
SdOtteBH before = this.getById(entity.getStcd()); SdOtteBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -89,9 +90,9 @@ public class SdOtteBHServiceImpl extends ServiceImpl<SdOtteBHMapper, SdOtteBH> i
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdOtteBH entity = this.getById(stcd);
if (this.removeById(stcd)) { if (this.removeById(stcd)) {
SdOtteBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -51,7 +51,7 @@ public class SdOtweBHServiceImpl extends ServiceImpl<SdOtweBHMapper, SdOtweBH> i
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("usfl").modifyProperty("usflName").dictType("STATIC").dictSource("USFL").build());
} }
@Override @Override
@ -66,7 +66,7 @@ public class SdOtweBHServiceImpl extends ServiceImpl<SdOtweBHMapper, SdOtweBH> i
public boolean add(SdOtweBH entity, String source) { public boolean add(SdOtweBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -77,7 +77,7 @@ public class SdOtweBHServiceImpl extends ServiceImpl<SdOtweBHMapper, SdOtweBH> i
SdOtweBH before = this.getById(entity.getStcd()); SdOtweBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -88,9 +88,9 @@ public class SdOtweBHServiceImpl extends ServiceImpl<SdOtweBHMapper, SdOtweBH> i
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdOtweBH entity = this.getById(stcd);
if (this.removeById(stcd)) { if (this.removeById(stcd)) {
SdOtweBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -55,6 +55,7 @@ public class SdSonarBHServiceImpl extends ServiceImpl<SdSonarBHMapper, SdSonarBH
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("usfl").modifyProperty("usflName").dictType("STATIC").dictSource("USFL").build());
} }
@ -70,7 +71,7 @@ public class SdSonarBHServiceImpl extends ServiceImpl<SdSonarBHMapper, SdSonarBH
public boolean add(SdSonarBH entity, String source) { public boolean add(SdSonarBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -81,7 +82,7 @@ public class SdSonarBHServiceImpl extends ServiceImpl<SdSonarBHMapper, SdSonarBH
SdSonarBH before = this.getById(entity.getStcd()); SdSonarBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -97,9 +98,9 @@ public class SdSonarBHServiceImpl extends ServiceImpl<SdSonarBHMapper, SdSonarBH
wrapper.set(SdSonarBH::getIsDeleted, 1); wrapper.set(SdSonarBH::getIsDeleted, 1);
wrapper.set(SdSonarBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdSonarBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdSonarBH::getDeleteTime, new Date()); wrapper.set(SdSonarBH::getDeleteTime, new Date());
SdSonarBH entity = this.getById(stcd);
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdSonarBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -66,7 +66,7 @@ public class SdTeBHServiceImpl extends ServiceImpl<SdTeBHMapper, SdTeBH> impleme
public boolean add(SdTeBH entity, String source) { public boolean add(SdTeBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -77,7 +77,7 @@ public class SdTeBHServiceImpl extends ServiceImpl<SdTeBHMapper, SdTeBH> impleme
SdTeBH before = this.getById(entity.getStcd()); SdTeBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -88,9 +88,9 @@ public class SdTeBHServiceImpl extends ServiceImpl<SdTeBHMapper, SdTeBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdTeBH entity = this.getById(stcd);
if (this.removeById(stcd)) { if (this.removeById(stcd)) {
SdTeBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -49,7 +49,7 @@ public class SdVaBHServiceImpl extends ServiceImpl<SdVaBHMapper, SdVaBH> impleme
static { static {
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dtin").modifyProperty("dtinName").dictType("STATIC").dictSource("DTIN").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dtin").modifyProperty("dtinName").dictType("STATIC").dictSource("DTIN").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("bldsttCode").modifyProperty("bldsttCodeName").dictType("STATIC").dictSource("BLDSTT_CODE").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("bldsttCode").modifyProperty("bldsttCodeName").dictType("STATIC").dictSource("BLDSTT_CODE").build());
// CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dtinType").modifyProperty("dtinTypeName").dictType("STATIC").dictSource("DTIN_TYPE").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("usfl").modifyProperty("usflName").dictType("STATIC").dictSource("USFL").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("sttp").modifyProperty("sttpName").dictType("DYNAMIC").dictSource("SD_STTP_B").codeColumn("STTP_CODE").nameColumn("STTP_NAME").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("sttp").modifyProperty("sttpName").dictType("DYNAMIC").dictSource("SD_STTP_B").codeColumn("STTP_CODE").nameColumn("STTP_NAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build());
@ -67,7 +67,7 @@ public class SdVaBHServiceImpl extends ServiceImpl<SdVaBHMapper, SdVaBH> impleme
public boolean add(SdVaBH entity, String source) { public boolean add(SdVaBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -78,7 +78,7 @@ public class SdVaBHServiceImpl extends ServiceImpl<SdVaBHMapper, SdVaBH> impleme
SdVaBH before = this.getById(entity.getStcd()); SdVaBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -89,14 +89,14 @@ public class SdVaBHServiceImpl extends ServiceImpl<SdVaBHMapper, SdVaBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdVaBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdVaBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdVaBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdVaBH::getStcd, stcd); wrapper.eq(SdVaBH::getStcd, stcd);
wrapper.set(SdVaBH::getIsDeleted, 1); wrapper.set(SdVaBH::getIsDeleted, 1);
wrapper.set(SdVaBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdVaBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdVaBH::getDeleteTime, new Date()); wrapper.set(SdVaBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdVaBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -52,6 +52,7 @@ public class SdVdinfoBServiceImpl extends ServiceImpl<SdVdinfoBMapper, SdVdinfoB
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build()); CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rvcd").modifyProperty("rvnm").dictType("DYNAMIC").dictSource("V_SD_RVCD_DIC_TREE").codeColumn("RVCD").nameColumn("RVNM").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("addvcd").modifyProperty("addvcdName").dictType("DYNAMIC").dictSource("SD_ADDVCD_DIC").codeColumn("ADDVCD").nameColumn("ADDVNM").build());
} }
@ -71,7 +72,7 @@ public class SdVdinfoBServiceImpl extends ServiceImpl<SdVdinfoBMapper, SdVdinfoB
} }
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); } msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source); }
return result; return result;
} }
@ -81,7 +82,7 @@ public class SdVdinfoBServiceImpl extends ServiceImpl<SdVdinfoBMapper, SdVdinfoB
SdVdinfoB before = this.getById(entity.getStcd()); SdVdinfoB before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordOperationLog(TABLE_NAME, entity.getStcd(), "修改", source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, entity.getStcd(), "修改", source);
} }
return result; return result;
} }
@ -92,9 +93,9 @@ public class SdVdinfoBServiceImpl extends ServiceImpl<SdVdinfoBMapper, SdVdinfoB
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdVdinfoB entity = this.getById(stcd);
if (this.removeById(stcd)) { if (this.removeById(stcd)) {
SdVdinfoB entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -67,7 +67,7 @@ public class SdVpBHServiceImpl extends ServiceImpl<SdVpBHMapper, SdVpBH> impleme
public boolean add(SdVpBH entity, String source) { public boolean add(SdVpBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); } msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source); }
return result; return result;
} }
@ -77,7 +77,7 @@ public class SdVpBHServiceImpl extends ServiceImpl<SdVpBHMapper, SdVpBH> impleme
SdVpBH before = this.getById(entity.getStcd()); SdVpBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -88,14 +88,14 @@ public class SdVpBHServiceImpl extends ServiceImpl<SdVpBHMapper, SdVpBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdVpBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdVpBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdVpBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdVpBH::getStcd, stcd); wrapper.eq(SdVpBH::getStcd, stcd);
wrapper.set(SdVpBH::getIsDeleted, 1); wrapper.set(SdVpBH::getIsDeleted, 1);
wrapper.set(SdVpBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdVpBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdVpBH::getDeleteTime, new Date()); wrapper.set(SdVpBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdVpBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -68,7 +68,7 @@ public class SdWeBHServiceImpl extends ServiceImpl<SdWeBHMapper, SdWeBH> impleme
public boolean add(SdWeBH entity, String source) { public boolean add(SdWeBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); } msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source); }
return result; return result;
} }
@ -78,7 +78,7 @@ public class SdWeBHServiceImpl extends ServiceImpl<SdWeBHMapper, SdWeBH> impleme
SdWeBH before = this.getById(entity.getStcd()); SdWeBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -89,9 +89,9 @@ public class SdWeBHServiceImpl extends ServiceImpl<SdWeBHMapper, SdWeBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdWeBH entity = this.getById(stcd);
if (this.removeById(stcd)) { if (this.removeById(stcd)) {
SdWeBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -70,7 +70,7 @@ public class SdWqBHServiceImpl extends ServiceImpl<SdWqBHMapper, SdWqBH> impleme
public boolean add(SdWqBH entity, String source) { public boolean add(SdWqBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); } msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source); }
return result; return result;
} }
@ -80,7 +80,7 @@ public class SdWqBHServiceImpl extends ServiceImpl<SdWqBHMapper, SdWqBH> impleme
SdWqBH before = this.getById(entity.getStcd()); SdWqBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -91,14 +91,14 @@ public class SdWqBHServiceImpl extends ServiceImpl<SdWqBHMapper, SdWqBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdWqBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdWqBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdWqBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdWqBH::getStcd, stcd); wrapper.eq(SdWqBH::getStcd, stcd);
wrapper.set(SdWqBH::getIsDeleted, 1); wrapper.set(SdWqBH::getIsDeleted, 1);
wrapper.set(SdWqBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdWqBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdWqBH::getDeleteTime, new Date()); wrapper.set(SdWqBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdWqBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source); count++;
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source); count++;
} }
} }
return count > 0; return count > 0;

View File

@ -72,7 +72,7 @@ public class SdWtBHServiceImpl extends ServiceImpl<SdWtBHMapper, SdWtBH> impleme
public boolean add(SdWtBH entity, String source) { public boolean add(SdWtBH entity, String source) {
boolean result = this.save(entity); boolean result = this.save(entity);
if (result) { if (result) {
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); msOperationLogService.recordAddDetailLog(entity.getStcd(),TABLE_NAME, entity, source);
} }
return result; return result;
} }
@ -83,7 +83,7 @@ public class SdWtBHServiceImpl extends ServiceImpl<SdWtBHMapper, SdWtBH> impleme
SdWtBH before = this.getById(entity.getStcd()); SdWtBH before = this.getById(entity.getStcd());
boolean result = this.updateById(entity); boolean result = this.updateById(entity);
if (result && before != null) { if (result && before != null) {
msOperationLogService.recordModifyDetailLog(TABLE_NAME, before, entity, source); msOperationLogService.recordModifyDetailLog(entity.getStcd(),TABLE_NAME, before, entity, source);
} }
return result; return result;
} }
@ -94,14 +94,14 @@ public class SdWtBHServiceImpl extends ServiceImpl<SdWtBHMapper, SdWtBH> impleme
if (stcds == null || stcds.isEmpty()) return false; if (stcds == null || stcds.isEmpty()) return false;
int count = 0; int count = 0;
for (String stcd : stcds) { for (String stcd : stcds) {
SdWtBH entity = this.getById(stcd);
LambdaUpdateWrapper<SdWtBH> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SdWtBH> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SdWtBH::getStcd, stcd); wrapper.eq(SdWtBH::getStcd, stcd);
wrapper.set(SdWtBH::getIsDeleted, 1); wrapper.set(SdWtBH::getIsDeleted, 1);
wrapper.set(SdWtBH::getDeleteUser, SecurityUtils.getCurrentUsername()); wrapper.set(SdWtBH::getDeleteUser, SecurityUtils.getCurrentUsername());
wrapper.set(SdWtBH::getDeleteTime, new Date()); wrapper.set(SdWtBH::getDeleteTime, new Date());
if (this.update(wrapper)) { if (this.update(wrapper)) {
SdWtBH entity = this.getById(stcd); msOperationLogService.recordDeleteDetailLog(stcd,TABLE_NAME, entity, source);
msOperationLogService.recordDeleteDetailLog(TABLE_NAME, entity, source);
count++; count++;
} }
} }

View File

@ -1617,6 +1617,7 @@ public class OverviewServiceImpl implements OverviewService {
case "topHynm" -> "t.TOP_HYNM"; case "topHynm" -> "t.TOP_HYNM";
case "lgtd" -> "t.LGTD"; case "lgtd" -> "t.LGTD";
case "lttd" -> "t.LTTD"; case "lttd" -> "t.LTTD";
case "url" -> "t.URL";
case "stlc" -> "t.STLC"; case "stlc" -> "t.STLC";
case "usfl" -> "t.USFL"; case "usfl" -> "t.USFL";
case "dtin" -> "t.DTIN"; case "dtin" -> "t.DTIN";

View File

@ -87,7 +87,7 @@ public interface AlongDetailMapper extends BaseMapper<SdAlongDetailVO> {
//降雨量 //降雨量
@Select("SELECT a.TM, AVG(a.DRP) AS DRP " + @Select("SELECT a.TM, AVG(a.DRP) AS DRP " +
"FROM SD_PPTN_R a " + "FROM SD_PPTN_R a " +
"INNER JOIN MS_STBPRP_T b ON a.STCD = b.STCD " + "INNER JOIN V_MS_STBPRP_T b ON a.STCD = b.STCD " +
"WHERE b.STTP_CODE = 'MM' " + "WHERE b.STTP_CODE = 'MM' " +
"AND a.IS_DELETED = 0 AND b.IS_DELETED = 0 " + "AND a.IS_DELETED = 0 AND b.IS_DELETED = 0 " +
"AND b.RSTCD = (SELECT RSTCD FROM SD_WT_B_H WHERE STCD = #{stcd} AND IS_DELETED = 0) " + "AND b.RSTCD = (SELECT RSTCD FROM SD_WT_B_H WHERE STCD = #{stcd} AND IS_DELETED = 0) " +
@ -97,7 +97,7 @@ public interface AlongDetailMapper extends BaseMapper<SdAlongDetailVO> {
//气象站数据 //气象站数据
@Select("SELECT a.TM, AVG(a.AT) AS AT " + @Select("SELECT a.TM, AVG(a.AT) AS AT " +
"FROM SD_TMP_R a " + "FROM SD_TMP_R a " +
"INNER JOIN MS_STBPRP_T b ON a.STCD = b.STCD " + "INNER JOIN V_MS_STBPRP_T b ON a.STCD = b.STCD " +
"WHERE b.STTP_CODE = 'MM' AND a.IS_DELETED = 0 AND b.IS_DELETED = 0 " + "WHERE b.STTP_CODE = 'MM' AND a.IS_DELETED = 0 AND b.IS_DELETED = 0 " +
"AND b.RSTCD = (SELECT RSTCD FROM SD_WT_B_H WHERE STCD = #{stcd} AND IS_DELETED = 0) " + "AND b.RSTCD = (SELECT RSTCD FROM SD_WT_B_H WHERE STCD = #{stcd} AND IS_DELETED = 0) " +
"AND a.TM BETWEEN #{startTime} AND #{endTime} " + "AND a.TM BETWEEN #{startTime} AND #{endTime} " +
@ -124,10 +124,10 @@ public interface AlongDetailMapper extends BaseMapper<SdAlongDetailVO> {
"REGEXP_REPLACE(LISTAGG(TO_CHAR(c.STNM), ',') WITHIN GROUP (ORDER BY c.STCD), '([^,]+)(,\\1)*(,|$)', '\\1\\3') AS vtStnm, " + "REGEXP_REPLACE(LISTAGG(TO_CHAR(c.STNM), ',') WITHIN GROUP (ORDER BY c.STCD), '([^,]+)(,\\1)*(,|$)', '\\1\\3') AS vtStnm, " +
"REGEXP_REPLACE(LISTAGG(TO_CHAR(d.STCD), ',') WITHIN GROUP (ORDER BY d.STCD), '([^,]+)(,\\1)*(,|$)', '\\1\\3') AS dwStcd, " + "REGEXP_REPLACE(LISTAGG(TO_CHAR(d.STCD), ',') WITHIN GROUP (ORDER BY d.STCD), '([^,]+)(,\\1)*(,|$)', '\\1\\3') AS dwStcd, " +
"REGEXP_REPLACE(LISTAGG(TO_CHAR(d.STNM), ',') WITHIN GROUP (ORDER BY d.STCD), '([^,]+)(,\\1)*(,|$)', '\\1\\3') AS dwStnm " + "REGEXP_REPLACE(LISTAGG(TO_CHAR(d.STNM), ',') WITHIN GROUP (ORDER BY d.STCD), '([^,]+)(,\\1)*(,|$)', '\\1\\3') AS dwStnm " +
"FROM MS_STBPRP_T a " + "FROM V_MS_STBPRP_T a " +
"LEFT JOIN MS_STBPRP_T b ON a.STCD = b.RSTCD AND b.STTP_CODE = 'WTRV' AND b.IS_DELETED = 0 AND b.MWAY = 2 AND b.DTIN_TYPE = 0 " + "LEFT JOIN V_MS_STBPRP_T b ON a.STCD = b.RSTCD AND b.STTP_CODE = 'WTRV' AND b.IS_DELETED = 0 AND b.MWAY = 2 AND b.DTIN_TYPE = 0 " +
"LEFT JOIN MS_STBPRP_T c ON a.STCD = c.RSTCD AND c.STTP_CODE = 'WTVT' AND c.IS_DELETED = 0 AND c.MWAY = 2 " + "LEFT JOIN V_MS_STBPRP_T c ON a.STCD = c.RSTCD AND c.STTP_CODE = 'WTVT' AND c.IS_DELETED = 0 AND c.MWAY = 2 " +
"LEFT JOIN MS_STBPRP_T d ON a.STCD = d.RSTCD AND d.STTP_CODE LIKE 'DW_%' AND d.IS_DELETED = 0 " + "LEFT JOIN V_MS_STBPRP_T d ON a.STCD = d.RSTCD AND d.STTP_CODE LIKE 'DW_%' AND d.IS_DELETED = 0 " +
"WHERE a.STTP_CODE = 'ENG' AND a.IS_DELETED = 0 " + "WHERE a.STTP_CODE = 'ENG' AND a.IS_DELETED = 0 " +
"AND b.STCD IS NOT NULL AND c.STCD IS NOT NULL AND d.STCD IS NOT NULL AND b.ENG_DWT_CODE IS NOT NULL " + "AND b.STCD IS NOT NULL AND c.STCD IS NOT NULL AND d.STCD IS NOT NULL AND b.ENG_DWT_CODE IS NOT NULL " +
"AND (d.STCD = #{stcd} OR b.STCD = #{stcd} OR c.STCD = #{stcd} OR a.STCD = #{stcd}) " + "AND (d.STCD = #{stcd} OR b.STCD = #{stcd} OR c.STCD = #{stcd} OR a.STCD = #{stcd}) " +

View File

@ -29,7 +29,7 @@ public class MsUsercolumnBServiceImpl
throw new IllegalArgumentException("模块(cfgId)不能为空"); throw new IllegalArgumentException("模块(cfgId)不能为空");
} }
String currentUser = SecurityUtils.getCurrentUsername(); String currentUser = SecurityUtils.getUserId();
List<MsUsercolumnB> list = userColumn.getList(); List<MsUsercolumnB> list = userColumn.getList();
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
@ -53,7 +53,7 @@ public class MsUsercolumnBServiceImpl
@Override @Override
public List<MsUsercolumnB> getUserColumnData(MsUsercolumnB userColumn) { public List<MsUsercolumnB> getUserColumnData(MsUsercolumnB userColumn) {
String currentUser = SecurityUtils.getCurrentUsername(); String currentUser = SecurityUtils.getUserId();
return usercolumnBMapper.getUserColumnList(currentUser, userColumn.getCfgId()); return usercolumnBMapper.getUserColumnList(currentUser, userColumn.getCfgId());
} }
} }

View File

@ -0,0 +1,112 @@
package com.yfd.platform.qgc_sys.psbmodulelbb.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.qgc_base.domain.MsPplayoutB;
import com.yfd.platform.qgc_base.domain.MsPsbmodulelbB;
import com.yfd.platform.qgc_base.mapper.MsPplayoutBMapper;
import com.yfd.platform.qgc_base.service.IMsPsbmodulelbBService;
import com.yfd.platform.qgc_sys.psbmodulelbb.vo.WbsBPpVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 平台产品化-电站与布局组件配置表控制器
*/
@Slf4j
@RestController
@RequestMapping("/sys/psbmodulelbb")
@Tag(name = "电站与布局组件配置管理")
public class MsPsbmodulelbBController {
@Resource
private IMsPsbmodulelbBService msPsbmodulelbBService;
@Resource
private MsPplayoutBMapper msPplayoutBMapper;
@PostMapping("/GetKendoListCust")
@Operation(summary = "条件过滤数据列表(含标签信息)")
public ResponseResult getKendoList(@RequestBody DataSourceRequest dataSourceRequest) {
List<MsPsbmodulelbB> list = msPsbmodulelbBService.queryPageList(dataSourceRequest);
return ResponseResult.successData(list);
}
@GetMapping("/getPsbmoduleByMidAndLt")
@Operation(summary = "根据电站和布局类型获取配置列表")
public ResponseResult getPsbmoduleByMidAndLt(
@RequestParam("stcd") String stcd,
@RequestParam("layoutType") String layoutType) {
if (StringUtils.isBlank(stcd)) {
return ResponseResult.error("stcd 不能为空");
}
if (StringUtils.isBlank(layoutType)) {
return ResponseResult.error("layoutType 不能为空");
}
List<MsPsbmodulelbB> list = msPsbmodulelbBService.getPsbmoduleByMidAndLt(stcd, layoutType);
return ResponseResult.successData(list);
}
@PostMapping("/save")
@Operation(summary = "保存或更新电站与布局组件配置")
public ResponseResult save(@RequestBody MsPsbmodulelbB msPsbmodulelbB) {
// 校验必填字段
if (StringUtils.isBlank(msPsbmodulelbB.getStcd())
|| StringUtils.isBlank(msPsbmodulelbB.getLayoutId())
|| StringUtils.isBlank(msPsbmodulelbB.getBclData())) {
return ResponseResult.error("电站编码、布局ID、组件配置数据不能为空");
}
// 验证布局是否存在
LambdaQueryWrapper<MsPplayoutB> layoutWrapper = new LambdaQueryWrapper<>();
layoutWrapper.eq(MsPplayoutB::getCode, msPsbmodulelbB.getLayoutId());
layoutWrapper.eq(MsPplayoutB::getIsDeleted, 0);
MsPplayoutB pplayoutB = msPplayoutBMapper.selectOne(layoutWrapper);
if (pplayoutB == null) {
return ResponseResult.error("布局不存在");
}
// 修改时验证记录是否存在
if (StringUtils.isNotBlank(msPsbmodulelbB.getId())) {
MsPsbmodulelbB existing = msPsbmodulelbBService.getById(msPsbmodulelbB.getId());
if (existing == null) {
return ResponseResult.error("要修改的记录不存在");
}
}
boolean result = msPsbmodulelbBService.saveOrUpdateData(msPsbmodulelbB);
if (result) {
return ResponseResult.success();
} else {
return ResponseResult.error("数据保存失败");
}
}
@PostMapping("/delete")
@Operation(summary = "逻辑删除电站与布局组件配置")
public ResponseResult delete(@RequestParam String id) {
if (StringUtils.isBlank(id)) {
return ResponseResult.error("id 不能为空");
}
boolean result = msPsbmodulelbBService.deleteData(id);
if (result) {
return ResponseResult.success();
} else {
return ResponseResult.error("删除失败,记录不存在");
}
}
@PostMapping("/getTreeConfiguredps")
@Operation(summary = "获取已配置电站及流域树形数据")
public ResponseResult getTreeConfiguredps(@RequestBody DataSourceRequest dataSourceRequest) {
List<WbsBPpVo> list = msPsbmodulelbBService.getTreeConfiguredps(dataSourceRequest);
return ResponseResult.successData(list);
}
}

View File

@ -0,0 +1,51 @@
package com.yfd.platform.qgc_sys.psbmodulelbb.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 电站与布局组件配置VO
*/
@Data
public class MsPsbmodulelbBVo {
private String id;
/** 所属电站 */
private String stcd;
/** 布局ID */
private String layoutId;
/** 布局各组件配置 */
private String bclData;
/** 模板id */
private String templateId;
/** 是否布局 */
private Integer isLayout;
/** 主控件标签配置 */
private List<TagConfigVo> mainTagList;
/** 组件标签配置 */
private List<TagConfigVo> ppbclTagList;
/** 有配置标签的组件集合 */
private List<String> codeList;
/** 创建人 */
private String recordUser;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}

View File

@ -0,0 +1,14 @@
package com.yfd.platform.qgc_sys.psbmodulelbb.vo;
import lombok.Data;
/**
* 标签配置VO
*/
@Data
public class TagConfigVo {
private String code;
private String tagId;
private String tagValue;
private Integer isShow;
}

View File

@ -0,0 +1,33 @@
package com.yfd.platform.qgc_sys.psbmodulelbb.vo;
import lombok.Data;
import java.util.List;
/**
* 流域及电站VO树形结构
*/
@Data
public class WbsBPpVo {
/** 节点编码电站STCD / 基地BASE_ID */
private String wbsCode;
/** 节点名称(电站名称 / 基地名称) */
private String wbsName;
/** 子节点 */
private List<WbsBPpVo> children;
/** 经度 */
private String lgtd;
/** 纬度 */
private String lttd;
/** 基地编码 */
private String rvcd;
/** 基地名称 */
private String rvcdName;
}

View File

@ -0,0 +1,138 @@
package com.yfd.platform.qgc_sys.warnRule.controller;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.qgc_base.service.IMsWarnRuleBService;
import com.yfd.platform.qgc_sys.warnRule.vo.MsWarnRuleBVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* 告警规则控制器
*/
@Slf4j
@RestController
@RequestMapping("/sys/warnRule")
@Tag(name = "告警规则配置管理")
@Controller("msWarnRuleBControllerSys")
public class MsWarnRuleBController {
@Resource
private IMsWarnRuleBService msWarnRuleBService;
@PostMapping("/GetKendoListCust")
@Operation(summary = "条件过滤数据列表")
public ResponseResult getKendoList(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(msWarnRuleBService.queryPageList(dataSourceRequest));
}
@PostMapping("/ysList")
@Operation(summary = "获取告警类型对应的要素")
public ResponseResult getAllYs(@RequestBody DataSourceRequest dataSourceRequest) {
String ruleType = getFilterFieldValue(dataSourceRequest, "ruleType");
if (ruleType == null || ruleType.isEmpty()) {
return ResponseResult.error("ruleType 不能为空");
}
return ResponseResult.successData(msWarnRuleBService.getAllYs(ruleType));
}
@PostMapping("/addOrUpdate")
@Operation(summary = "新增或修改规则")
public ResponseResult addOrUpdate(@RequestBody MsWarnRuleBVo vo) {
return ResponseResult.successData(msWarnRuleBService.addOrUpdate(vo));
}
@GetMapping("/check")
@Operation(summary = "校验规则是否被测站引用")
public ResponseResult check(@RequestParam("id") String id) {
return ResponseResult.successData(msWarnRuleBService.check(id));
}
@GetMapping("/bind/delete")
@Operation(summary = "删除规则绑定")
public ResponseResult deleteBind(@RequestParam("id") String id) {
if (id == null || id.isEmpty()) {
return ResponseResult.error("id不能为空");
}
msWarnRuleBService.deleteBind(id);
return ResponseResult.success();
}
@GetMapping("/delete")
@Operation(summary = "删除规则")
public ResponseResult deleteRule(@RequestParam("id") String id) {
if (id == null || id.isEmpty()) {
return ResponseResult.error("id不能为空");
}
msWarnRuleBService.deleteRule(id);
return ResponseResult.success();
}
@PostMapping("/updateShow")
@Operation(summary = "修改规则是否展示")
public ResponseResult updateShow(@RequestParam("isShow") Integer isShow) {
msWarnRuleBService.updateShow(isShow);
return ResponseResult.success();
}
@PostMapping("/limit")
@Operation(summary = "获取水位和生态流量限值")
public ResponseResult getLimit(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(msWarnRuleBService.getLimit(dataSourceRequest));
}
@PostMapping("/bind/GetKendoList")
@Operation(summary = "查询测站和预警规则绑定列表")
public ResponseResult getWarnRuleBindingList(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(msWarnRuleBService.getRuleBindList(dataSourceRequest));
}
@GetMapping("/getDetailById")
@Operation(summary = "根据id查询规则配置详情")
public ResponseResult getWarnRuleBindingDetail(
@RequestParam(value = "ruleId", required = false) String ruleId,
@RequestParam(value = "bindId", required = false) String bindId) {
return ResponseResult.successData(msWarnRuleBService.getRuleBindDetail(ruleId, bindId));
}
@GetMapping("/getRuleListByStcd")
@Operation(summary = "根据stcd查询可绑定的规则")
public ResponseResult getRuleListByStcd(
@RequestParam("stcd") String stcd,
@RequestParam("ruleType") String ruleType,
@RequestParam(value = "lvl", required = false) String lvl) {
return ResponseResult.successData(msWarnRuleBService.getRuleListByStcd(stcd, ruleType, lvl));
}
/**
* DataSourceRequest 过滤条件中提取指定字段的值
*/
private String getFilterFieldValue(DataSourceRequest request, String fieldName) {
if (request == null || request.getFilter() == null) {
return null;
}
return findFilterValue(request.getFilter(), fieldName);
}
private String findFilterValue(DataSourceRequest.FilterDescriptor filter, String fieldName) {
if (filter == null) {
return null;
}
if (fieldName.equals(filter.getField()) && filter.getValue() != null) {
return filter.getValue().toString();
}
if (filter.getFilters() != null) {
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
String value = findFilterValue(child, fieldName);
if (value != null) {
return value;
}
}
}
return null;
}
}

View File

@ -0,0 +1,69 @@
package com.yfd.platform.qgc_sys.warnRule.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 预警规则配置VO
*/
@Data
public class MsWarnRuleBVo {
/** 告警规则id */
private String id;
/** 设施与规则绑定id */
private String bindId;
/** 告警规则名称 */
private String ruleName;
/** 告警规则类型 */
private String ruleType;
/** 告警规则类型名称 */
private String ruleTypeName;
/** 告警编码 */
private String ruleCode;
/** 测站编码 */
private String stcd;
/** 测站名称 */
private String stnm;
/** 关联测站编码 */
private String rstcd;
/** 工程名称 */
private String ennm;
/** 测站类型编码 */
private String sttpId;
/** 测站类型编码 */
private String sttpCode;
/** 是否展示告警等级 */
private Integer isShow;
/** 备注 */
private String description;
/** 告警规则详情数据 */
private List<MsWarnRuleDetailVo> detail;
/** 创建人 */
private String recordUser;
/** 创建人名称 */
private String recordUserName;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}

View File

@ -0,0 +1,24 @@
package com.yfd.platform.qgc_sys.warnRule.vo;
import lombok.Data;
import java.util.List;
/**
* 预警规则详情VO
*/
@Data
public class MsWarnRuleDetailVo {
/** 水质等级 */
private String lvl;
/** 水质等级名称 */
private String lvlName;
/** 告警等级 */
private Integer warnLevel;
/** 要素列表 */
private List<WarnYsVo> ysList;
}

View File

@ -0,0 +1,18 @@
package com.yfd.platform.qgc_sys.warnRule.vo;
import lombok.Data;
/**
* 可绑定的规则VO
*/
@Data
public class WarnRuleVo {
private String id;
private String ruleName;
private String ruleCode;
private String lvl;
}

View File

@ -0,0 +1,29 @@
package com.yfd.platform.qgc_sys.warnRule.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 告警类型对应的要素VO
*/
@Data
public class WarnYsVo {
/** 监测表id */
private String tbId;
/** 要素编码 */
private String ys;
/** 要素名称 */
private String ysName;
/** 最小值 */
private BigDecimal minVal;
/** 最大值 */
private BigDecimal maxVal;
/** 描述 */
private String mark;
}

View File

@ -43,12 +43,12 @@ public class SysDictionaryController {
***********************************/ ***********************************/
@GetMapping("/dictList") @GetMapping("/dictList")
@Operation(summary = "获取数据字典列表") @Operation(summary = "获取数据字典列表")
public ResponseResult getDictList(String dictType) { public ResponseResult getDictList(String dictType,String dictName) {
if (StrUtil.isBlank(dictType)) { if (StrUtil.isBlank(dictType)) {
return ResponseResult.error("参数为空"); return ResponseResult.error("参数为空");
} }
List<SysDictionary> sysDictionaries = List<SysDictionary> sysDictionaries =
sysDictionaryService.getDictList(dictType); sysDictionaryService.getDictList(dictType,dictName);
return ResponseResult.successData(sysDictionaries); return ResponseResult.successData(sysDictionaries);
} }

View File

@ -149,6 +149,9 @@ public class SysMenuController {
public ResponseResult addMenu(@RequestBody SysMenu sysMenu, public ResponseResult addMenu(@RequestBody SysMenu sysMenu,
@RequestHeader(value = "Tenant_id", required = false) String tenantId) { @RequestHeader(value = "Tenant_id", required = false) String tenantId) {
sysMenu.setTenantId(StrUtil.trimToNull(tenantId)); sysMenu.setTenantId(StrUtil.trimToNull(tenantId));
if(StrUtil.isBlank(sysMenu.getTenantId())){
sysMenu.setTenantId(sysMenu.getSystemcode());
}
boolean isOk = sysMenuService.addMenu(sysMenu); boolean isOk = sysMenuService.addMenu(sysMenu);
if (isOk) { if (isOk) {
return ResponseResult.success(); return ResponseResult.success();
@ -176,6 +179,9 @@ public class SysMenuController {
return ResponseResult.error("未找到对应租户的菜单"); return ResponseResult.error("未找到对应租户的菜单");
} }
sysMenu.setTenantId(StrUtil.trimToNull(tenantId)); sysMenu.setTenantId(StrUtil.trimToNull(tenantId));
if(StrUtil.isBlank(sysMenu.getTenantId())){
sysMenu.setTenantId(sysMenu.getSystemcode());
}
sysMenu.setLastmodifier(userService.getUsername()); sysMenu.setLastmodifier(userService.getUsername());
sysMenu.setLastmodifydate(new Timestamp(System.currentTimeMillis())); sysMenu.setLastmodifydate(new Timestamp(System.currentTimeMillis()));
boolean isOk = sysMenuService.updateById(sysMenu); boolean isOk = sysMenuService.updateById(sysMenu);

View File

@ -20,7 +20,7 @@ public interface ISysDictionaryService extends IService<SysDictionary> {
* 参数说明 dictType 字典类型 * 参数说明 dictType 字典类型
* 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果 * 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果
***********************************/ ***********************************/
List<SysDictionary> getDictList(String dictType); List<SysDictionary> getDictList(String dictType,String dictName);
/********************************** /**********************************
* 用途说明: 新增字典 * 用途说明: 新增字典

View File

@ -1,5 +1,6 @@
package com.yfd.platform.system.service.impl; package com.yfd.platform.system.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -39,10 +40,10 @@ public class SysDictionaryServiceImpl extends ServiceImpl<SysDictionaryMapper
* 返回值说明: 返回字典列表集合 * 返回值说明: 返回字典列表集合
***********************************/ ***********************************/
@Override @Override
public List<SysDictionary> getDictList(String dictType) { public List<SysDictionary> getDictList(String dictType,String dictName) {
LambdaQueryWrapper<SysDictionary> queryWrapper = LambdaQueryWrapper<SysDictionary> queryWrapper =
new LambdaQueryWrapper<>(); new LambdaQueryWrapper<>();
queryWrapper.eq(SysDictionary::getDictType, dictType).orderByAsc(SysDictionary::getOrderNo); queryWrapper.eq(SysDictionary::getDictType, dictType).eq(StrUtil.isNotBlank(dictName),SysDictionary::getDictName, dictName).orderByAsc(SysDictionary::getOrderNo);
return sysDictionaryMapper.selectList(queryWrapper); return sysDictionaryMapper.selectList(queryWrapper);
} }

View File

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.common.DataSourceRequest; import com.yfd.platform.common.DataSourceRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -240,17 +241,29 @@ public class DataSourceRequestUtil {
case "isempty" -> wrapper.eq(columnName, ""); case "isempty" -> wrapper.eq(columnName, "");
case "isnotempty" -> wrapper.ne(columnName, ""); case "isnotempty" -> wrapper.ne(columnName, "");
case "in" -> { case "in" -> {
if (value instanceof Iterable) { if (value instanceof Collection) {
wrapper.in(columnName, (Iterable<?>) value); if (!((Collection<?>) value).isEmpty()) {
wrapper.in(columnName, (Collection<?>) value);
}
} else if (value instanceof Object[]) { } else if (value instanceof Object[]) {
wrapper.in(columnName, (Object[]) value); if (((Object[]) value).length > 0) {
wrapper.in(columnName, (Object[]) value);
}
} else {
wrapper.eq(columnName, value); // 单个值转为 eq
} }
} }
case "ni", "notin" -> { case "ni", "notin" -> {
if (value instanceof Iterable) { if (value instanceof Collection) {
wrapper.notIn(columnName, (Iterable<?>) value); if (!((Collection<?>) value).isEmpty()) {
wrapper.notIn(columnName, (Collection<?>) value);
}
} else if (value instanceof Object[]) { } else if (value instanceof Object[]) {
wrapper.notIn(columnName, (Object[]) value); if (((Object[]) value).length > 0) {
wrapper.notIn(columnName, (Object[]) value);
}
} else {
wrapper.ne(columnName, value);
} }
} }
default -> wrapper.eq(columnName, value); default -> wrapper.eq(columnName, value);

View File

@ -0,0 +1,80 @@
<?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.yfd.platform.qgc_base.mapper.SdFpssrlRMapper">
<!-- 批量合并过鱼自动数据(基于 STCD + TM + FTP 唯一) -->
<insert id="mergeFishRecords" parameterType="java.util.List">
MERGE INTO SD_FPSSRL_R T
USING (
<foreach collection="list" item="obj" index="index" separator="UNION ALL">
SELECT
#{obj.stcd, jdbcType=VARCHAR} AS STCD,
#{obj.tm, jdbcType=TIMESTAMP} AS TM,
#{obj.ftp, jdbcType=VARCHAR} AS FTP,
#{obj.fcnt, jdbcType=INTEGER} AS FCNT,
#{obj.fsz, jdbcType=VARCHAR} AS FSZ,
#{obj.length, jdbcType=DECIMAL} AS LENGTH,
#{obj.width, jdbcType=DECIMAL} AS WIDTH,
#{obj.fishspeed, jdbcType=VARCHAR} AS FISHSPEED,
#{obj.direction, jdbcType=INTEGER} AS DIRECTION,
#{obj.fishposition, jdbcType=DECIMAL} AS FISHPOSITION,
#{obj.firstImgUrl, jdbcType=VARCHAR} AS FIRSTIMGURL,
#{obj.secondImgUrl, jdbcType=VARCHAR} AS SECONDIMGURL,
#{obj.videoUrl, jdbcType=VARCHAR} AS VIDEOURL,
#{obj.temperature, jdbcType=DECIMAL} AS TEMPERATURE,
#{obj.waterlevel, jdbcType=DECIMAL} AS WATERLEVEL,
#{obj.speed, jdbcType=DECIMAL} AS SPEED,
#{obj.q, jdbcType=DECIMAL} AS Q,
#{obj.dox, jdbcType=DECIMAL} AS DOX,
#{obj.tu, jdbcType=INTEGER} AS TU,
#{obj.channelno, jdbcType=VARCHAR} AS CHANNELNO,
#{obj.fid, jdbcType=VARCHAR} AS FID,
#{obj.remark, jdbcType=VARCHAR} AS REMARK,
#{obj.recordUser, jdbcType=VARCHAR} AS RECORD_USER,
#{obj.modifyUser, jdbcType=VARCHAR} AS MODIFY_USER
FROM DUAL
</foreach>
) S
ON (T.STCD = S.STCD AND T.TM = S.TM AND T.FTP = S.FTP AND T.IS_DELETED = 0)
WHEN MATCHED THEN
UPDATE SET
T.FCNT = S.FCNT,
T.FSZ = S.FSZ,
T.LENGTH = S.LENGTH,
T.WIDTH = S.WIDTH,
T.FISHSPEED = S.FISHSPEED,
T.DIRECTION = S.DIRECTION,
T.FISHPOSITION = S.FISHPOSITION,
T.FIRSTIMGURL = S.FIRSTIMGURL,
T.SECONDIMGURL = S.SECONDIMGURL,
T.VIDEOURL = S.VIDEOURL,
T.TEMPERATURE = S.TEMPERATURE,
T.WATERLEVEL = S.WATERLEVEL,
T.SPEED = S.SPEED,
T.Q = S.Q,
T.DOX = S.DOX,
T.TU = S.TU,
T.CHANNELNO = S.CHANNELNO,
T.FID = S.FID,
T.REMARK = S.REMARK,
T.MODIFY_USER = S.MODIFY_USER,
T.MODIFY_TIME = SYSDATE
WHEN NOT MATCHED THEN
INSERT (
ID, STCD, TM, FTP, FCNT, FSZ, LENGTH, WIDTH, FISHSPEED,
DIRECTION, FISHPOSITION, FIRSTIMGURL, SECONDIMGURL, VIDEOURL,
TEMPERATURE, WATERLEVEL, SPEED, Q, DOX, TU, CHANNELNO,
FID, REMARK, RECORD_USER, RECORD_TIME, MODIFY_USER, MODIFY_TIME,
IS_DELETED
) VALUES (
SYS_GUID(),
S.STCD, S.TM, S.FTP, S.FCNT, S.FSZ, S.LENGTH, S.WIDTH, S.FISHSPEED,
S.DIRECTION, S.FISHPOSITION, S.FIRSTIMGURL, S.SECONDIMGURL, S.VIDEOURL,
S.TEMPERATURE, S.WATERLEVEL, S.SPEED, S.Q, S.DOX, S.TU, S.CHANNELNO,
S.FID, S.REMARK, S.RECORD_USER, SYSDATE, S.MODIFY_USER, SYSDATE,
0
)
</insert>
</mapper>

View File

@ -35,7 +35,8 @@
mcb.COLUMN_EN, mcb.COLUMN_EN,
mcb.COLUMN_CFG AS COLUMN_NAME, mcb.COLUMN_CFG AS COLUMN_NAME,
CASE WHEN mub.COLUMN_EN IS NULL THEN 1 ELSE 0 END AS DEFAULT_CONFIG, CASE WHEN mub.COLUMN_EN IS NULL THEN 1 ELSE 0 END AS DEFAULT_CONFIG,
CASE WHEN mub.ENABLE IS NULL THEN mcb.ENABLE ELSE mub.ENABLE END AS ENABLE, -- CASE WHEN mub.ENABLE IS NULL THEN mcb.ENABLE ELSE mub.ENABLE END AS ENABLE,
CASE WHEN mcb.ENABLE IS NULL THEN mub.ENABLE ELSE mcb.ENABLE END AS ENABLE,
CASE WHEN mub.ORDER_INDEX IS NULL THEN mcb.ORDER_INDEX ELSE mub.ORDER_INDEX END AS ORDER_INDEX, CASE WHEN mub.ORDER_INDEX IS NULL THEN mcb.ORDER_INDEX ELSE mub.ORDER_INDEX END AS ORDER_INDEX,
mub.RECORD_USER, mub.RECORD_USER,
CASE WHEN mub.CHECKED IS NULL THEN mcb.DEFAULT_CHECKED ELSE mub.CHECKED END AS CHECKED, CASE WHEN mub.CHECKED IS NULL THEN mcb.DEFAULT_CHECKED ELSE mub.CHECKED END AS CHECKED,