diff --git a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java index 62038da..4c65bbb 100644 --- a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java +++ b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/RemoteTdEngineService.java @@ -63,8 +63,8 @@ public interface RemoteTdEngineService { @PostMapping("/tdengine/getDeviceStatusList") R>> getDeviceStatusList(@Validated @RequestBody DeviceStatus queryDeviceStatus, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); - - + @PostMapping("/tdengine/getDeviceLocation") + R> getDeviceLocation(@Validated @RequestBody TdSelectDto tdSelectDto, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); @PostMapping("/tdengine/dropTable") R dropTable(@Validated @RequestBody TdTableDropVo tdTableDropVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); } diff --git a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java index 624cc50..58db51f 100644 --- a/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java +++ b/ruoyi-api/hw-api-tdengine/src/main/java/com/ruoyi/tdengine/api/factory/RemoteTdEngineFallbackFactory.java @@ -102,6 +102,11 @@ public class RemoteTdEngineFallbackFactory implements FallbackFactory> getDeviceLocation(TdSelectDto tdSelectDto, String source) { + return R.fail("获取设备位置失败:" + throwable.getMessage()); + } + @Override public R dropTable(TdTableDropVo tdTableDropVo, String source) { return R.fail("drop子表失败:" + throwable.getMessage()); diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysRole.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysRole.java index dc533fd..23cee46 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysRole.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysRole.java @@ -49,7 +49,7 @@ public class SysRole extends BaseEntity @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") private String status; - /** 删除标志(0代表存在 2代表删除) */ + /** 删除标志(0代表存在 2代表删除) */ private String delFlag; /** 用户是否存在此角色标识 默认不存在 */ diff --git a/ruoyi-auth/src/main/resources/bootstrap.yml b/ruoyi-auth/src/main/resources/bootstrap.yml index afee82b..50c1875 100644 --- a/ruoyi-auth/src/main/resources/bootstrap.yml +++ b/ruoyi-auth/src/main/resources/bootstrap.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwPortalConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwPortalConstants.java new file mode 100644 index 0000000..82c1063 --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwPortalConstants.java @@ -0,0 +1,38 @@ +package com.ruoyi.common.core.constant; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description: 门户网站服务常量 + * @ClassName: HwPortalConstants + * @Author : xins + * @Date :2023-12-18 15:20 + * @Version :1.0 + */ +public class HwPortalConstants { + + /** + * 产品信息配置配置模式 + * 配置模式(1图标 +文字+内容横铺4个2左标题+内容,右图片;3左图标,右标题+内容,一行2个;4左大图右标题+内容,一行2个;5上标题+下图片,6上标题+内容,下图片;7图标标题内容,一行3个,8一张图9上图下内容,一行4个) + */ + public static final String PRODUCT_INFO_CONFIG_MODAL_ONE = "1"; + public static final String PRODUCT_INFO_CONFIG_MODAL_TWO = "2"; + + +// public static final List ABNDON_FUNCTION_IDENTIFIERS = Arrays.asList("ts","value1","type"); +// +// public static final String DEFAULT_FIRST_FIELD_NAME_DISPLAY = "时间";//timestamp格式首字段的显示名称 +// public static final Map DEVICE_DATA_COLUMN_MAP = new HashMap(); +// +// static { +// DEVICE_DATA_COLUMN_MAP.put(ST_TAG_DEVICECODE, "设备编号"); +// DEVICE_DATA_COLUMN_MAP.put(ST_TAG_DEVICENAME, "设备名称"); +// DEVICE_DATA_COLUMN_MAP.put(DEFAULT_FIRST_FIELD_NAME, DEFAULT_FIRST_FIELD_NAME_DISPLAY); +// } + + + +} diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/TableDataNameVo.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/TableDataNameVo.java new file mode 100644 index 0000000..8c8d7a9 --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/TableDataNameVo.java @@ -0,0 +1,31 @@ +package com.ruoyi.common.core.web.page; + +import java.util.Map; + +/** + * @ClassName : TableDataNameVo + * @Description : + * @Author : + * @Date: 2024-06-17 10:41 + */ +public class TableDataNameVo { + private TableDataInfo tableDataInfo; + + private Map mapName; + + public TableDataInfo getTableDataInfo() { + return tableDataInfo; + } + + public void setTableDataInfo(TableDataInfo tableDataInfo) { + this.tableDataInfo = tableDataInfo; + } + + public Map getMapName() { + return mapName; + } + + public void setMapName(Map mapName) { + this.mapName = mapName; + } +} diff --git a/ruoyi-common/ruoyi-common-datascope/src/main/java/com/ruoyi/common/datascope/aspect/DataScopeAspect.java b/ruoyi-common/ruoyi-common-datascope/src/main/java/com/ruoyi/common/datascope/aspect/DataScopeAspect.java index fcd0a66..98ef0b6 100644 --- a/ruoyi-common/ruoyi-common-datascope/src/main/java/com/ruoyi/common/datascope/aspect/DataScopeAspect.java +++ b/ruoyi-common/ruoyi-common-datascope/src/main/java/com/ruoyi/common/datascope/aspect/DataScopeAspect.java @@ -148,7 +148,7 @@ public class DataScopeAspect { StringBuilder sql = new StringBuilder(); Long tenantId = user.getTenantId(); if (!tenantId.equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)) { - sql.append(StringUtils.format(" OR {}.tenant_id = {} ", tenantAlias, tenantId)); + sql.append(StringUtils.format(" AND tenant_id = {} ", tenantId)); } return sql; diff --git a/ruoyi-gateway/src/main/resources/bootstrap.yml b/ruoyi-gateway/src/main/resources/bootstrap.yml index 20652b5..be8794f 100644 --- a/ruoyi-gateway/src/main/resources/bootstrap.yml +++ b/ruoyi-gateway/src/main/resources/bootstrap.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 @@ -33,7 +35,8 @@ spring: datasource: ds1: nacos: - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev dataId: sentinel-ruoyi-gateway groupId: DEFAULT_GROUP data-type: json diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwGlobalCfgController.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwGlobalCfgController.java new file mode 100644 index 0000000..fddb2e5 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwGlobalCfgController.java @@ -0,0 +1,84 @@ +package com.ruoyi.basic.controller; +import com.ruoyi.basic.domain.HwGlobalCfg; +import com.ruoyi.basic.service.HwGlobalCfgService; +import com.ruoyi.common.core.web.controller.BaseController; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 全局配置表(HwGlobalCfg)表控制层 + * + * @author makejava + * @since 2024-09-26 14:42:39 + */ +@RestController +@RequestMapping("hwGlobalCfg") +public class HwGlobalCfgController extends BaseController { + /** + * 服务对象 + */ + @Resource + private HwGlobalCfgService hwGlobalCfgService; + + /** + * 分页查询 + * + * @param hwGlobalCfg 筛选条件 + * @return 查询结果 + */ + @GetMapping + public ResponseEntity> queryByPage(HwGlobalCfg hwGlobalCfg) { + List list = hwGlobalCfgService.queryAll(hwGlobalCfg); + return ResponseEntity.ok(list); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseEntity queryById(@PathVariable("id") Long id) { + return ResponseEntity.ok(this.hwGlobalCfgService.queryById(id)); + } + + /** + * 新增数据 + * + * @param hwGlobalCfg 实体 + * @return 新增结果 + */ + @PostMapping + public ResponseEntity add(@RequestBody HwGlobalCfg hwGlobalCfg) { + return ResponseEntity.ok(this.hwGlobalCfgService.insert(hwGlobalCfg)); + } + + + /** + * 编辑数据 + * + * @param hwGlobalCfg 实体 + * @return 编辑结果 + */ + @PutMapping + public ResponseEntity edit(@RequestBody HwGlobalCfg hwGlobalCfg) { + return ResponseEntity.ok(this.hwGlobalCfgService.update(hwGlobalCfg)); + } + + /** + * 删除数据 + * + * @param id 主键 + * @return 删除是否成功 + */ + @DeleteMapping + public ResponseEntity deleteById(Long globalCfgId) { + return ResponseEntity.ok(this.hwGlobalCfgService.deleteById(globalCfgId)); + } + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwTemplateAchieveController.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwTemplateAchieveController.java new file mode 100644 index 0000000..f3e806c --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwTemplateAchieveController.java @@ -0,0 +1,125 @@ +package com.ruoyi.basic.controller; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.basic.domain.HwTemplate; +import com.ruoyi.basic.domain.HwTemplateAchieve; +import com.ruoyi.basic.service.HwTemplateAchieveService; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.file.FileUtils; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.system.api.RemoteFileService; +import com.ruoyi.system.api.domain.SysFile; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Base64; +import java.util.List; +import java.util.Map; + +/** + * 模板实现表(HwTemplateAchieve)表控制层 + * + * @author makejava + * @since 2024-09-18 10:09:52 + */ +@RestController +@RequestMapping("hwTemplateAchieve") +public class HwTemplateAchieveController extends BaseController { + /** + * 服务对象 + */ + @Resource + private HwTemplateAchieveService hwTemplateAchieveService; + + @Autowired + private RemoteFileService remoteFileService; + + /** + * 分页查询 + * + * @param hwTemplateAchieve 筛选条件 + * @param + * @return 查询结果 + */ + @GetMapping + public TableDataInfo queryByPage(HwTemplateAchieve hwTemplateAchieve) { + startPage(); + List list = hwTemplateAchieveService.queryAll(hwTemplateAchieve); + return getDataTable(list); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseEntity queryById(@PathVariable("id") Long id) { + return ResponseEntity.ok(this.hwTemplateAchieveService.queryById(id)); + } + + /** + * 新增数据 + * @return 新增结果 + */ + @PostMapping + public AjaxResult add(@RequestBody Map templateAchieve) { + HwTemplateAchieve hwTemplateAchieve = new HwTemplateAchieve(); + hwTemplateAchieve.setAchieveContent(templateAchieve.get("achieveContent").toString()); + hwTemplateAchieve.setTemplateId((Long)templateAchieve.get("templateId")); + hwTemplateAchieve.setAchieveName(templateAchieve.get("achieveName").toString()); + int insert = this.hwTemplateAchieveService.insert(hwTemplateAchieve); + if (insert == 0){ + return AjaxResult.error("添加失败"); + } + return AjaxResult.success("添加成功"); + } + + /** + * 编辑数据 + * + * @param hwTemplateAchieve 实体 + * @return 编辑结果 + */ + @PutMapping + public AjaxResult edit(@RequestBody HwTemplateAchieve hwTemplateAchieve) { + return AjaxResult.success(this.hwTemplateAchieveService.update(hwTemplateAchieve)); + } + + /** + * 删除数据 + * + * @param achieveId 主键 + * @return 删除是否成功 + */ + @DeleteMapping + public AjaxResult deleteById(Long achieveId) { + return AjaxResult.success(this.hwTemplateAchieveService.deleteById(achieveId)); + } + + @PostMapping("/saveImage") + public AjaxResult saveImage(@RequestParam("file") MultipartFile file){ + R sysFileR = remoteFileService.upload(file); + SysFile sysFile = sysFileR.getData(); + int count = hwTemplateAchieveService.saveImage(sysFile); + return AjaxResult.success(sysFile); + } + @PostMapping("/queryImage") + public AjaxResult queryImage(@RequestBody SysFile sysFile){ + startPage(); + List list = hwTemplateAchieveService.queryImage(sysFile); + return AjaxResult.success(getDataTable(list)); + } + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwTemplateController.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwTemplateController.java new file mode 100644 index 0000000..1847055 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwTemplateController.java @@ -0,0 +1,114 @@ +package com.ruoyi.basic.controller; + + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.basic.domain.HwTemplate; +import com.ruoyi.basic.service.HwTemplateService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.common.security.utils.SecurityUtils; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 模板表(HwTemplate)表控制层 + * + * @author makejava + * @since 2024-09-18 10:09:19 + */ +@RestController +@RequestMapping("hwTemplate") +public class HwTemplateController extends BaseController { + /** + * 服务对象 + */ + @Resource + private HwTemplateService hwTemplateService; + + /** + * 分页查询 + * + * @param hwTemplate 筛选条件 + * @return 查询结果 + */ + @GetMapping + public TableDataInfo queryByPage(HwTemplate hwTemplate) { + startPage(); + List list = hwTemplateService.queryAll(hwTemplate); + return getDataTable(list); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseEntity queryById(@PathVariable("id") Long id) { + return ResponseEntity.ok(this.hwTemplateService.queryById(id)); + } + + /** + * 新增数据 + * + * @param + * @return 新增结果 + */ + @PostMapping + public AjaxResult add(@RequestBody Map template){ + HwTemplate hwTemplate = new HwTemplate(); + String templateName = template.get("templateName").toString(); + template.remove("templateName"); + hwTemplate.setTemplateName(templateName); + hwTemplate.setTemplateContent(template.get("templateContent").toString()); + HwTemplate insert = hwTemplateService.insert(hwTemplate); + if (insert == null){ + return AjaxResult.error("操作失败"); + } + return AjaxResult.success(); + } + + /** + * 编辑数据 + * + * @param hwTemplate 实体 + * @return 编辑结果 + */ + @PutMapping + public AjaxResult edit(@RequestBody HwTemplate hwTemplate) { + hwTemplate.setUpdateBy(SecurityUtils.getUsername()); + hwTemplate.setUpdateTime(new Date()); + int update = hwTemplateService.update(hwTemplate); + if (update == 0) { + return AjaxResult.error("操作失败"); + } + return AjaxResult.success(); + } + + /** + * 删除数据 + * + * @param templateId 主键 + * @return 删除是否成功 + */ + @DeleteMapping + public AjaxResult deleteById(Long templateId) { + boolean delete = hwTemplateService.deleteById(templateId); + if (delete == false) { + return AjaxResult.error("操作失败"); + } + return AjaxResult.success(); + } + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutConfigController.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutConfigController.java index 0a6cf55..4f318dc 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutConfigController.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutConfigController.java @@ -2,17 +2,27 @@ package com.ruoyi.basic.controller; +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.dynamic.datasource.creator.DataSourceCreator; +import com.baomidou.dynamic.datasource.creator.DruidDataSourceCreator; +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.basic.domain.LayoutConfig; +import com.ruoyi.basic.domain.LayoutDesc; import com.ruoyi.basic.service.LayoutConfigService; +import com.ruoyi.basic.service.LayoutDescService; import com.ruoyi.common.core.web.domain.AjaxResult; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.sql.DataSource; import java.util.List; import java.util.Map; @@ -30,6 +40,9 @@ public class LayoutConfigController { */ @Resource private LayoutConfigService layoutConfigService; + @Autowired + private LayoutDescService layoutDescService; + /** * 分页查询 @@ -89,10 +102,10 @@ public class LayoutConfigController { // 添加组件新配置 @PostMapping("/insertLayoutConfig") public AjaxResult insertLayoutConfig(@RequestBody Map config) throws JsonProcessingException { - System.out.println(config.get("items")); List items = (List)config.get("items"); String option = config.get("option").toString(); - return layoutConfigService.insertSceneConfig(items,option); + String layoutName = config.get("layoutDesc").toString(); + return layoutConfigService.insertSceneConfig(items,option,layoutName); } // 查询所有场景 @@ -106,6 +119,4 @@ public class LayoutConfigController { public AjaxResult selectConfigById(String sceneId){ return layoutConfigService.selectConfigById(sceneId); } - } - diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutDescController.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutDescController.java index c579950..9429963 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutDescController.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/LayoutDescController.java @@ -81,5 +81,4 @@ public class LayoutDescController { return ResponseEntity.ok(this.layoutDescService.deleteById(id)); } -} - +} \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwGlobalCfg.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwGlobalCfg.java new file mode 100644 index 0000000..979cde2 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwGlobalCfg.java @@ -0,0 +1,88 @@ +package com.ruoyi.basic.domain; + +import java.io.Serializable; + +/** + * 全局配置表(HwGlobalCfg)实体类 + * + * @author makejava + * @since 2024-09-26 14:42:42 + */ +public class HwGlobalCfg implements Serializable { + private static final long serialVersionUID = 673640661217554284L; + /** + * 全局配置ID + */ + private Long globalCfgId; + /** + * 配置名称 + */ + private String globalCfgName; + /** + * 配置类型 + */ + private String globalCfgType; + /** + * 配置值 + */ + private String globalCfgDate; + /** + * 是否包含内容(1、true 2、false) + */ + private String isDetail; + /** + * 内容 + */ + private String details; + + + public Long getGlobalCfgId() { + return globalCfgId; + } + + public void setGlobalCfgId(Long globalCfgId) { + this.globalCfgId = globalCfgId; + } + + public String getGlobalCfgName() { + return globalCfgName; + } + + public void setGlobalCfgName(String globalCfgName) { + this.globalCfgName = globalCfgName; + } + + public String getGlobalCfgType() { + return globalCfgType; + } + + public void setGlobalCfgType(String globalCfgType) { + this.globalCfgType = globalCfgType; + } + + public String getGlobalCfgDate() { + return globalCfgDate; + } + + public void setGlobalCfgDate(String globalCfgDate) { + this.globalCfgDate = globalCfgDate; + } + + public String getIsDetail() { + return isDetail; + } + + public void setIsDetail(String isDetail) { + this.isDetail = isDetail; + } + + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplate.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplate.java new file mode 100644 index 0000000..8475ef4 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplate.java @@ -0,0 +1,113 @@ +package com.ruoyi.basic.domain; + +import java.io.Serializable; +import java.util.Date; + +/** + * 模板表(HwTemplate)实体类 + * + * @author makejava + * @since 2024-09-18 10:09:21 + */ +public class HwTemplate implements Serializable { + private static final long serialVersionUID = -58454096786541114L; + /** + * 模板id + */ + private Long templateId; + /** + * 模板名称 + */ + private String templateName; + /** + * 模板内容 + */ + private String templateContent; + /** + * 创建者 + */ + private String createBy; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新者 + */ + private String updateBy; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 备注 + */ + private String remark; + + + public Long getTemplateId() { + return templateId; + } + + public void setTemplateId(Long templateId) { + this.templateId = templateId; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getTemplateContent() { + return templateContent; + } + + public void setTemplateContent(String templateContent) { + this.templateContent = templateContent; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplateAchieve.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplateAchieve.java new file mode 100644 index 0000000..c30c79a --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplateAchieve.java @@ -0,0 +1,129 @@ +package com.ruoyi.basic.domain; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 模板实现表(HwTemplateAchieve)实体类 + * + * @author makejava + * @since 2024-09-18 10:09:52 + */ +@Data +public class HwTemplateAchieve implements Serializable { + private static final long serialVersionUID = 683594578695679743L; + /** + * 模板实现id + */ + private Long achieveId; + /** + * 模板id + */ + private Long templateId; + /** + * 模板名称 + */ + private String achieveName; + /** + * 模板内容 + */ + private String achieveContent; + private byte[] image; + /** + * 创建者 + */ + private String createBy; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新者 + */ + private String updateBy; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 备注 + */ + private String remark; + + + public Long getAchieveId() { + return achieveId; + } + + public void setAchieveId(Long achieveId) { + this.achieveId = achieveId; + } + + public Long getTemplateId() { + return templateId; + } + + public void setTemplateId(Long templateId) { + this.templateId = templateId; + } + + public String getAchieveName() { + return achieveName; + } + + public void setAchieveName(String achieveName) { + this.achieveName = achieveName; + } + + public String getAchieveContent() { + return achieveContent; + } + + public void setAchieveContent(String achieveContent) { + this.achieveContent = achieveContent; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplateAchieveContent.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplateAchieveContent.java new file mode 100644 index 0000000..56b4587 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwTemplateAchieveContent.java @@ -0,0 +1,34 @@ +package com.ruoyi.basic.domain; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 模板实现表(HwTemplateAchieve)实体类 + * + * @author makejava + * @since 2024-09-18 10:09:52 + */ +@Data +public class HwTemplateAchieveContent implements Serializable { + private static final long serialVersionUID = 683594578695679743L; + /** + * 模板实现id + */ + private Long id; + /** + * 模板id + */ + private Long achieveId; + /** + * 模板名称 + */ + + private String achieveContent; + + + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutConfig.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutConfig.java index fb96afd..dcb2493 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutConfig.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutConfig.java @@ -116,5 +116,4 @@ public class LayoutConfig implements Serializable { // this.updateTime = updateTime; // } -} - +} \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutDesc.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutDesc.java index dadc2f7..ccfbd32 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutDesc.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/LayoutDesc.java @@ -104,5 +104,4 @@ public class LayoutDesc implements Serializable { // this.updateTime = updateTime; // } -} - +} \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwGlobalCfgDao.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwGlobalCfgDao.java new file mode 100644 index 0000000..9103f49 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwGlobalCfgDao.java @@ -0,0 +1,87 @@ +package com.ruoyi.basic.mapper; + +import com.ruoyi.basic.domain.HwGlobalCfg; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 全局配置表(HwGlobalCfg)表数据库访问层 + * + * @author makejava + * @since 2024-09-26 14:42:39 + */ +public interface HwGlobalCfgDao { + + /** + * 通过ID查询单条数据 + * + * @param globalCfgId 主键 + * @return 实例对象 + */ + HwGlobalCfg queryById(Long globalCfgId); + + /** + * 查询指定行数据 + * + * @param hwGlobalCfg 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAllByLimit(HwGlobalCfg hwGlobalCfg, @Param("pageable") Pageable pageable); + + /** + * 统计总行数 + * + * @param hwGlobalCfg 查询条件 + * @return 总行数 + */ + long count(HwGlobalCfg hwGlobalCfg); + + /** + * 新增数据 + * + * @param hwGlobalCfg 实例对象 + * @return 影响行数 + */ + int insert(HwGlobalCfg hwGlobalCfg); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param hwGlobalCfg 实例对象 + * @return 影响行数 + */ + int update(HwGlobalCfg hwGlobalCfg); + + /** + * 通过主键删除数据 + * + * @param globalCfgId 主键 + * @return 影响行数 + */ + int deleteById(Long globalCfgId); + + List queryAll(HwGlobalCfg hwGlobalCfg); + + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwTemplateAchieveDao.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwTemplateAchieveDao.java new file mode 100644 index 0000000..314cc76 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwTemplateAchieveDao.java @@ -0,0 +1,95 @@ +package com.ruoyi.basic.mapper; + +import com.ruoyi.basic.domain.HwTemplateAchieve; +import com.ruoyi.basic.domain.HwTemplateAchieveContent; +import com.ruoyi.system.api.domain.SysFile; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 模板实现表(HwTemplateAchieve)表数据库访问层 + * + * @author makejava + * @since 2024-09-18 10:09:52 + */ +public interface HwTemplateAchieveDao { + + /** + * 通过ID查询单条数据 + * + * @param achieveId 主键 + * @return 实例对象 + */ + HwTemplateAchieve queryById(Long achieveId); + + /** + * 查询指定行数据 + * + * @param hwTemplateAchieve 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAllByLimit(HwTemplateAchieve hwTemplateAchieve, @Param("pageable") Pageable pageable); + + /** + * 统计总行数 + * + * @param hwTemplateAchieve 查询条件 + * @return 总行数 + */ + long count(HwTemplateAchieve hwTemplateAchieve); + + /** + * 新增数据 + * + * @param hwTemplateAchieve 实例对象 + * @return 影响行数 + */ + int insert(HwTemplateAchieve hwTemplateAchieve); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param hwTemplateAchieve 实例对象 + * @return 影响行数 + */ + int update(@Param("entity") HwTemplateAchieve hwTemplateAchieve); + + /** + * 通过主键删除数据 + * + * @param achieveId 主键 + * @return 影响行数 + */ + int deleteById(Long achieveId); + + List queryAll(HwTemplateAchieve hwTemplateAchieve); + + int insertContent(@Param("entity") HwTemplateAchieveContent content); + + int deleteContentById(Long achieveId); + + int saveImage(SysFile sysFile); + + List queryImage(SysFile sysFile); +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwTemplateDao.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwTemplateDao.java new file mode 100644 index 0000000..4e032e7 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwTemplateDao.java @@ -0,0 +1,86 @@ +package com.ruoyi.basic.mapper; + +import com.ruoyi.basic.domain.HwTemplate; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 模板表(HwTemplate)表数据库访问层 + * + * @author makejava + * @since 2024-09-18 10:09:19 + */ +public interface HwTemplateDao { + + /** + * 通过ID查询单条数据 + * + * @param templateId 主键 + * @return 实例对象 + */ + HwTemplate queryById(Long templateId); + + /** + * 查询指定行数据 + * + * @param hwTemplate 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAllByLimit(HwTemplate hwTemplate, @Param("pageable") Pageable pageable); + + /** + * 统计总行数 + * + * @param hwTemplate 查询条件 + * @return 总行数 + */ + long count(HwTemplate hwTemplate); + + /** + * 新增数据 + * + * @param hwTemplate 实例对象 + * @return 影响行数 + */ + int insert(HwTemplate hwTemplate); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param hwTemplate 实例对象 + * @return 影响行数 + */ + int update(HwTemplate hwTemplate); + + /** + * 通过主键删除数据 + * + * @param templateId 主键 + * @return 影响行数 + */ + int deleteById(Long templateId); + + List queryAll(HwTemplate hwTemplate); + +} + diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutConfigDao.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutConfigDao.java index 04086f1..af8efe9 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutConfigDao.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutConfigDao.java @@ -84,5 +84,4 @@ public interface LayoutConfigDao { List selectConfigById(String sceneId); List selectAllScenes(); -} - +} \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutDescDao.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutDescDao.java index 11c5bff..a5f0832 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutDescDao.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/LayoutDescDao.java @@ -4,6 +4,7 @@ package com.ruoyi.basic.mapper; import com.ruoyi.basic.domain.LayoutDesc; import java.util.List; +import java.util.Map; /** * 布局配置表(LayoutConfig)表数据库访问层 @@ -18,5 +19,7 @@ public interface LayoutDescDao { List selectAllScenes(); -} + LayoutDesc queryById(); + +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwGlobalCfgService.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwGlobalCfgService.java new file mode 100644 index 0000000..ff92c89 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwGlobalCfgService.java @@ -0,0 +1,61 @@ +package com.ruoyi.basic.service; + +import com.ruoyi.basic.domain.HwGlobalCfg; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +import java.util.List; + +/** + * 全局配置表(HwGlobalCfg)表服务接口 + * + * @author makejava + * @since 2024-09-26 14:42:44 + */ +public interface HwGlobalCfgService { + + /** + * 通过ID查询单条数据 + * + * @param globalCfgId 主键 + * @return 实例对象 + */ + HwGlobalCfg queryById(Long globalCfgId); + + /** + * 分页查询 + * + * @param hwGlobalCfg 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + Page queryByPage(HwGlobalCfg hwGlobalCfg, PageRequest pageRequest); + + /** + * 新增数据 + * + * @param hwGlobalCfg 实例对象 + * @return 实例对象 + */ + int insert(HwGlobalCfg hwGlobalCfg); + + /** + * 修改数据 + * + * @param hwGlobalCfg 实例对象 + * @return 实例对象 + */ + HwGlobalCfg update(HwGlobalCfg hwGlobalCfg); + + /** + * 通过主键删除数据 + * + * @param globalCfgId 主键 + * @return 是否成功 + */ + boolean deleteById(Long globalCfgId); + + List queryAll(HwGlobalCfg hwGlobalCfg); + + +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwTemplateAchieveService.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwTemplateAchieveService.java new file mode 100644 index 0000000..78298dd --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwTemplateAchieveService.java @@ -0,0 +1,66 @@ +package com.ruoyi.basic.service; + + +import com.ruoyi.basic.domain.HwTemplateAchieve; +import com.ruoyi.system.api.domain.SysFile; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +import java.util.List; + +/** + * 模板实现表(HwTemplateAchieve)表服务接口 + * + * @author makejava + * @since 2024-09-18 10:09:52 + */ +public interface HwTemplateAchieveService { + + /** + * 通过ID查询单条数据 + * + * @param achieveId 主键 + * @return 实例对象 + */ + HwTemplateAchieve queryById(Long achieveId); + + /** + * 分页查询 + * + * @param hwTemplateAchieve 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + Page queryByPage(HwTemplateAchieve hwTemplateAchieve, PageRequest pageRequest); + + /** + * 新增数据 + * + * @param hwTemplateAchieve 实例对象 + * @return 实例对象 + */ + int insert(HwTemplateAchieve hwTemplateAchieve); + + /** + * 修改数据 + * + * @param hwTemplateAchieve 实例对象 + * @return 实例对象 + */ + int update(HwTemplateAchieve hwTemplateAchieve); + + /** + * 通过主键删除数据 + * + * @param achieveId 主键 + * @return 是否成功 + */ + boolean deleteById(Long achieveId); + + List queryAll(HwTemplateAchieve hwTemplateAchieve); + + int saveImage(SysFile sysFile); + + List queryImage(SysFile sysFile); + +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwTemplateService.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwTemplateService.java new file mode 100644 index 0000000..f293b55 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/HwTemplateService.java @@ -0,0 +1,59 @@ +package com.ruoyi.basic.service; + +import com.ruoyi.basic.domain.HwTemplate; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +import java.util.List; + +/** + * 模板表(HwTemplate)表服务接口 + * + * @author makejava + * @since 2024-09-18 10:09:26 + */ +public interface HwTemplateService { + + /** + * 通过ID查询单条数据 + * + * @param templateId 主键 + * @return 实例对象 + */ + HwTemplate queryById(Long templateId); + + /** + * 分页查询 + * + * @param hwTemplate 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + Page queryByPage(HwTemplate hwTemplate, PageRequest pageRequest); + + /** + * 新增数据 + * + * @param hwTemplate 实例对象 + * @return 实例对象 + */ + HwTemplate insert(HwTemplate hwTemplate); + + /** + * 修改数据 + * + * @param hwTemplate 实例对象 + * @return 实例对象 + */ + int update(HwTemplate hwTemplate); + + /** + * 通过主键删除数据 + * + * @param templateId 主键 + * @return 是否成功 + */ + boolean deleteById(Long templateId); + + List queryAll(HwTemplate hwTemplate); +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/LayoutConfigService.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/LayoutConfigService.java index 9f67332..96324fa 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/LayoutConfigService.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/LayoutConfigService.java @@ -57,10 +57,11 @@ public interface LayoutConfigService { */ boolean deleteById(Long configId); - AjaxResult insertSceneConfig(List items, String option) throws JsonProcessingException; + AjaxResult insertSceneConfig(List items, String option,String layoutName) throws JsonProcessingException; AjaxResult selectConfigById(String sceneId); AjaxResult selectAllScenes(); + } diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwGlobalCfgServiceImpl.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwGlobalCfgServiceImpl.java new file mode 100644 index 0000000..4d14f7f --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwGlobalCfgServiceImpl.java @@ -0,0 +1,90 @@ +package com.ruoyi.basic.service.impl; + +import com.ruoyi.basic.domain.HwGlobalCfg; +import com.ruoyi.basic.mapper.HwGlobalCfgDao; +import com.ruoyi.basic.service.HwGlobalCfgService; +import org.springframework.stereotype.Service; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 全局配置表(HwGlobalCfg)表服务实现类 + * + * @author makejava + * @since 2024-09-26 14:42:44 + */ +@Service("hwGlobalCfgService") +public class HwGlobalCfgServiceImpl implements HwGlobalCfgService { + @Resource + private HwGlobalCfgDao hwGlobalCfgDao; + + /** + * 通过ID查询单条数据 + * + * @param globalCfgId 主键 + * @return 实例对象 + */ + @Override + public HwGlobalCfg queryById(Long globalCfgId) { + return this.hwGlobalCfgDao.queryById(globalCfgId); + } + + /** + * 分页查询 + * + * @param hwGlobalCfg 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + @Override + public Page queryByPage(HwGlobalCfg hwGlobalCfg, PageRequest pageRequest) { + long total = this.hwGlobalCfgDao.count(hwGlobalCfg); + return new PageImpl<>(this.hwGlobalCfgDao.queryAllByLimit(hwGlobalCfg, pageRequest), pageRequest, total); + } + + /** + * 新增数据 + * + * @param hwGlobalCfg 实例对象 + * @return 实例对象 + */ + @Override + public int insert(HwGlobalCfg hwGlobalCfg) { + int insert = this.hwGlobalCfgDao.insert(hwGlobalCfg); + return insert; + } + + /** + * 修改数据 + * + * @param hwGlobalCfg 实例对象 + * @return 实例对象 + */ + @Override + public HwGlobalCfg update(HwGlobalCfg hwGlobalCfg) { + this.hwGlobalCfgDao.update(hwGlobalCfg); + return this.queryById(hwGlobalCfg.getGlobalCfgId()); + } + + + + @Override + public List queryAll(HwGlobalCfg hwGlobalCfg) { + return hwGlobalCfgDao.queryAll(hwGlobalCfg); + } + + /** + * 通过主键删除数据 + * + * @param globalCfgId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long globalCfgId) { + return this.hwGlobalCfgDao.deleteById(globalCfgId) > 0; + } +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwTemplateAchieveServiceImpl.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwTemplateAchieveServiceImpl.java new file mode 100644 index 0000000..3bcbeba --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwTemplateAchieveServiceImpl.java @@ -0,0 +1,112 @@ +package com.ruoyi.basic.service.impl; + +import com.ruoyi.basic.domain.HwTemplateAchieve; +import com.ruoyi.basic.domain.HwTemplateAchieveContent; +import com.ruoyi.basic.mapper.HwTemplateAchieveDao; +import com.ruoyi.basic.service.HwTemplateAchieveService; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysFile; +import org.springframework.stereotype.Service; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * 模板实现表(HwTemplateAchieve)表服务实现类 + * + * @author makejava + * @since 2024-09-18 10:09:52 + */ +@Service("hwTemplateAchieveService") +public class HwTemplateAchieveServiceImpl implements HwTemplateAchieveService { + @Resource + private HwTemplateAchieveDao hwTemplateAchieveDao; + + /** + * 通过ID查询单条数据 + * + * @param achieveId 主键 + * @return 实例对象 + */ + @Override + public HwTemplateAchieve queryById(Long achieveId) { + return this.hwTemplateAchieveDao.queryById(achieveId); + } + + /** + * 分页查询 + * + * @param hwTemplateAchieve 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + @Override + public Page queryByPage(HwTemplateAchieve hwTemplateAchieve, PageRequest pageRequest) { + long total = this.hwTemplateAchieveDao.count(hwTemplateAchieve); + return new PageImpl<>(this.hwTemplateAchieveDao.queryAllByLimit(hwTemplateAchieve, pageRequest), pageRequest, total); + } + + /** + * 新增数据 + * + * @param hwTemplateAchieve 实例对象 + * @return 实例对象 + */ + @Override + public int insert(HwTemplateAchieve hwTemplateAchieve) { + hwTemplateAchieve.setCreateBy(SecurityUtils.getUsername()); + hwTemplateAchieve.setCreateTime(new Date()); + HwTemplateAchieveContent content = new HwTemplateAchieveContent(); + content.setAchieveContent(hwTemplateAchieve.getAchieveContent()); + hwTemplateAchieve.setAchieveContent(null); + int insert = hwTemplateAchieveDao.insert(hwTemplateAchieve); + content.setAchieveId(hwTemplateAchieve.getAchieveId()); + int count = hwTemplateAchieveDao.insertContent(content); + return count+insert; + } + + /** + * 修改数据 + * + * @param hwTemplateAchieve 实例对象 + * @return 实例对象 + */ + @Override + public int update(HwTemplateAchieve hwTemplateAchieve) { + return hwTemplateAchieveDao.update(hwTemplateAchieve); + + } + + @Override + public List queryImage(SysFile sysFile) { + return hwTemplateAchieveDao.queryImage(sysFile); + } + + @Override + public int saveImage(SysFile sysFile) { + return hwTemplateAchieveDao.saveImage(sysFile); + + } + + @Override + public List queryAll(HwTemplateAchieve hwTemplateAchieve) { + return hwTemplateAchieveDao.queryAll(hwTemplateAchieve); + } + + /** + * 通过主键删除数据 + * + * @param achieveId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long achieveId) { + int count = hwTemplateAchieveDao.deleteContentById(achieveId); + int delete = hwTemplateAchieveDao.deleteById(achieveId); + return count+delete > 0; + } +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwTemplateServiceImpl.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwTemplateServiceImpl.java new file mode 100644 index 0000000..e90c3c1 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwTemplateServiceImpl.java @@ -0,0 +1,94 @@ +package com.ruoyi.basic.service.impl; + +import com.ruoyi.basic.domain.HwTemplate; +import com.ruoyi.basic.mapper.HwTemplateDao; +import com.ruoyi.basic.service.HwTemplateService; +import com.ruoyi.common.security.utils.SecurityUtils; +import org.springframework.stereotype.Service; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * 模板表(HwTemplate)表服务实现类 + * + * @author makejava + * @since 2024-09-18 10:09:26 + */ +@Service("hwTemplateService") +public class HwTemplateServiceImpl implements HwTemplateService { + @Resource + private HwTemplateDao hwTemplateDao; + + /** + * 通过ID查询单条数据 + * + * @param templateId 主键 + * @return 实例对象 + */ + @Override + public HwTemplate queryById(Long templateId) { + return this.hwTemplateDao.queryById(templateId); + } + + /** + * 分页查询 + * + * @param hwTemplate 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + @Override + public Page queryByPage(HwTemplate hwTemplate, PageRequest pageRequest) { + long total = this.hwTemplateDao.count(hwTemplate); + return new PageImpl<>(this.hwTemplateDao.queryAllByLimit(hwTemplate, pageRequest), pageRequest, total); + } + + /** + * 新增数据 + * + * @param hwTemplate 实例对象 + * @return 实例对象 + */ + @Override + public HwTemplate insert(HwTemplate hwTemplate) { + hwTemplate.setCreateBy(SecurityUtils.getUsername()); + hwTemplate.setCreateTime(new Date()); + this.hwTemplateDao.insert(hwTemplate); + return hwTemplate; + } + + /** + * 修改数据 + * + * @param hwTemplate 实例对象 + * @return 实例对象 + */ + @Override + public int update(HwTemplate hwTemplate) { + int update = this.hwTemplateDao.update(hwTemplate); + return update; + } + + @Override + public List queryAll(HwTemplate hwTemplate) { + return hwTemplateDao.queryAll(hwTemplate); + } + + /** + * 通过主键删除数据 + * + * @param templateId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long templateId) { + return this.hwTemplateDao.deleteById(templateId) > 0; + } + + +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutConfigServiceImpl.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutConfigServiceImpl.java index bdf17bb..30781fa 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutConfigServiceImpl.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutConfigServiceImpl.java @@ -20,10 +20,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; +import java.util.*; /** * 布局配置表(LayoutConfig)表服务实现类 @@ -99,12 +96,13 @@ public class LayoutConfigServiceImpl implements LayoutConfigService { } @Override - public AjaxResult insertSceneConfig(List items, String option) throws JsonProcessingException { + public AjaxResult insertSceneConfig(List items, String option,String layoutName) throws JsonProcessingException { String layoutId = UUID.randomUUID().toString().replaceAll("-", ""); LoginUser loginUser = SecurityUtils.getLoginUser(); LayoutDesc layoutDesc = new LayoutDesc(); layoutDesc.setLayoutId(layoutId); layoutDesc.setSceneConfig(option); + layoutDesc.setLayoutDesc(layoutName); // layoutDesc.setCreateBy(loginUser.getUsername()); Date date = new Date(); layoutDesc.setCreateTime(date); diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutDescServiceImpl.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutDescServiceImpl.java index f7e4eaf..dc59083 100644 --- a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutDescServiceImpl.java +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/LayoutDescServiceImpl.java @@ -27,7 +27,7 @@ public class LayoutDescServiceImpl implements LayoutDescService { @Override public LayoutDesc queryById(Long layoutId) { - return null; + return layoutDescDao.queryById(); } @Override diff --git a/ruoyi-modules/hw-basic/src/main/resources/bootstrap.yml b/ruoyi-modules/hw-basic/src/main/resources/bootstrap.yml index c36045a..80da9b5 100644 --- a/ruoyi-modules/hw-basic/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/hw-basic/src/main/resources/bootstrap.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwGlobalCfgDao.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwGlobalCfgDao.xml new file mode 100644 index 0000000..6269433 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwGlobalCfgDao.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + insert into hw_global_cfg(global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details) + values (#{globalCfgName}, #{globalCfgType}, #{globalCfgDate}, #{isDetail}, #{details}) + + + + insert into hw_global_cfg(global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details) + values + + (#{entity.globalCfgName}, #{entity.globalCfgType}, #{entity.globalCfgDate}, #{entity.isDetail}, #{entity.details}) + + + + + insert into hw_global_cfg(global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details) + values + + (#{entity.globalCfgName}, #{entity.globalCfgType}, #{entity.globalCfgDate}, #{entity.isDetail}, #{entity.details}) + + on duplicate key update + global_cfg_name = values(global_cfg_name), + global_cfg_type = values(global_cfg_type), + global_cfg_date = values(global_cfg_date), + is_detail = values(is_detail), + details = values(details) + + + + + update hw_global_cfg + + + global_cfg_name = #{globalCfgName}, + + + global_cfg_type = #{globalCfgType}, + + + global_cfg_date = #{globalCfgDate}, + + + is_detail = #{isDetail}, + + + details = #{details}, + + + where global_cfg_id = #{globalCfgId} + + + + + delete from hw_global_cfg where global_cfg_id = #{globalCfgId} + + + + diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwTemplateAchieveDao.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwTemplateAchieveDao.xml new file mode 100644 index 0000000..36c1734 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwTemplateAchieveDao.xml @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into hw_template_achieve(template_id, achieve_name, create_by, create_time, update_by, update_time, remark) + values (#{templateId}, #{achieveName}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark}) + + + + insert into hw_template_achieve(template_id, achieve_name, achieve_content, create_by, create_time, update_by, update_time, remark) + values + + (#{entity.templateId}, #{entity.achieveName}, #{entity.achieveContent}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.remark}) + + + + + insert into hw_template_achieve(template_id, achieve_name, achieve_content, create_by, create_time, update_by, update_time, remark) + values + + (#{entity.templateId}, #{entity.achieveName}, #{entity.achieveContent}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.remark}) + + on duplicate key update + template_id = values(template_id), + achieve_name = values(achieve_name), + achieve_content = values(achieve_content), + create_by = values(create_by), + create_time = values(create_time), + update_by = values(update_by), + update_time = values(update_time), + remark = values(remark) + + + insert into hw_template_achieve_content(achieve_id, achieve_content) + values + (#{entity.achieveId}, #{entity.achieveContent}) + + + insert into sys_file(name,url) + values (#{name},#{url}) + + + + + update hw_template_achieve_content + + + achieve_content = #{entity.achieveContent}, + + + where achieve_id = #{entity.achieveId} + + + + + delete from hw_template_achieve where achieve_id = #{achieveId} + + + delete from hw_template_achieve_content where achieve_id = #{achieveId} + + + + diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwTemplateDao.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwTemplateDao.xml new file mode 100644 index 0000000..5c3248b --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwTemplateDao.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into hw_template(template_name, template_content, create_by, create_time, update_by, update_time, remark) + values (#{templateName}, #{templateContent}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark}) + + + + insert into hw_template(template_name, template_content, create_by, create_time, update_by, update_time, remark) + values + + (#{entity.templateName}, #{entity.templateContent}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.remark}) + + + + + insert into hw_template(template_name, template_content, create_by, create_time, update_by, update_time, remark) + values + + (#{entity.templateName}, #{entity.templateContent}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.remark}) + + on duplicate key update + template_name = values(template_name), + template_content = values(template_content), + create_by = values(create_by), + create_time = values(create_time), + update_by = values(update_by), + update_time = values(update_time), + remark = values(remark) + + + + + update hw_template + + + template_name = #{templateName}, + + + template_content = #{templateContent}, + + + create_by = #{createBy}, + + + create_time = #{createTime}, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}, + + + remark = #{remark}, + + + where template_id = #{templateId} + + + + + delete from hw_template where template_id = #{templateId} + + + + diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutConfigDao.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutConfigDao.xml index de3c88b..3ea8402 100644 --- a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutConfigDao.xml +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutConfigDao.xml @@ -157,5 +157,4 @@ delete from layout_config where config_id = #{configId} - - + \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutDescDao.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutDescDao.xml index 434b15d..f692f51 100644 --- a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutDescDao.xml +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/LayoutDescDao.xml @@ -13,11 +13,8 @@ - + @@ -76,6 +73,9 @@ + @@ -133,5 +133,4 @@ delete from layout_desc where layout_id = #{layoutId} - - + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/pom.xml b/ruoyi-modules/hw-business/pom.xml index 7385159..a8a5663 100644 --- a/ruoyi-modules/hw-business/pom.xml +++ b/ruoyi-modules/hw-business/pom.xml @@ -16,6 +16,24 @@ + + + org.apache.httpcomponents + httpmime + 4.5.7 + + + + com.alibaba + fastjson + 1.2.41 + + + + org.apache.poi + poi-ooxml + 3.16 + @@ -111,6 +129,12 @@ compile + + cn.hutool + hutool-all + 5.8.26 + + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmInfomationController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmInfomationController.java new file mode 100644 index 0000000..a569ddb --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmInfomationController.java @@ -0,0 +1,112 @@ +package com.ruoyi.business.controller; + +import java.util.ArrayList; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; + +import com.ruoyi.business.service.IHwAlarmInfoService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * 报警信息Controller + * + * @author zangch + * @date 2024-09-05 + */ +@RestController +@RequestMapping("/alarmInformation") +public class HwAlarmInfomationController extends BaseController +{ + @Autowired + private IHwAlarmInfoService hwAlarmInfoService; + + + + + /** + * 查询报警信息列表 + */ + @RequiresPermissions("business:alarmInformation:list") + @GetMapping("/list") + public TableDataInfo list(HwAlarmInfo hwAlarmInfo) + { + startPage(); + List list = hwAlarmInfoService.selectHwAlarmInfoList(hwAlarmInfo); + return getDataTable(list); + } + + /** + * 导出报警信息列表 + */ + @RequiresPermissions("business:alarmInformation:export") + @Log(title = "报警信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwAlarmInfo hwAlarmInfo) + { + List list = hwAlarmInfoService.selectHwAlarmInfoList(hwAlarmInfo); + ExcelUtil util = new ExcelUtil(HwAlarmInfo.class); + util.exportExcel(response, list, "报警信息数据"); + } + + /** + * 获取报警信息详细信息 + */ + @RequiresPermissions("business:alarmInformation:query") + @GetMapping(value = "/{alarmInfoId}") + public AjaxResult getInfo(@PathVariable("alarmInfoId") Long alarmInfoId) + { + return success(hwAlarmInfoService.selectHwAlarmInfoByAlarmInfoId(alarmInfoId)); + } + + /** + * 新增报警信息 + */ + @RequiresPermissions("business:alarmInformation:add") + @Log(title = "报警信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwAlarmInfo hwAlarmInfo) + { + return toAjax(hwAlarmInfoService.insertHwAlarmInfo(hwAlarmInfo)); + } + + /** + * 修改报警信息 + */ + @RequiresPermissions("business:alarmInformation:edit") + @Log(title = "报警信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwAlarmInfo hwAlarmInfo) + { + return toAjax(hwAlarmInfoService.updateHwAlarmInformation(hwAlarmInfo)); + } + + /** + * 删除报警信息 + */ + @RequiresPermissions("business:alarmInformation:remove") + @Log(title = "报警信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{alarmInfoIds}") + public AjaxResult remove(@PathVariable Long[] alarmInfoIds) + { + return toAjax(hwAlarmInfoService.deleteHwAlarmInfoByAlarmInfoIds(alarmInfoIds)); + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java index 754900d..814c97f 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java @@ -138,14 +138,17 @@ public class HwAlarmRuleController extends BaseController { alarmLevel.setSceneId(sceneId); List alarmLevels = hwAlarmLevelService.selectHwAlarmLevelList(alarmLevel); - HwDevice device = new HwDevice(); - device.setSceneId(sceneId); - List devices = hwDeviceService.selectHwDeviceListWithDeviceMode(device); +// HwDevice device = new HwDevice(); +// device.setSceneId(sceneId); +// List devices = hwDeviceService.selectHwDeviceListWithDeviceMode(device); + + List models = hwDeviceModeService.selectModel(sceneId); JSONObject result = new JSONObject(); result.put("alarmTypes", alarmTypes); result.put("alarmLevels",alarmLevels); - result.put("devices",devices); +// result.put("devices",devices); + result.put("models",models); return success(result); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java index 273a192..0b434b0 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java @@ -53,6 +53,7 @@ public class HwDeviceController extends BaseController { @Autowired private IHwSceneService hwSceneService; + /** * 查询设备信息列表 */ @@ -246,5 +247,15 @@ public class HwDeviceController extends BaseController { public void computeOnlineDevicecCount(@PathVariable("days") int days) { hwDeviceService.computeOnlineDevicecCount(days); } + @GetMapping("/getDeviceByModel") + public AjaxResult getDeviceByModel(Long modelId){ + return AjaxResult.success(hwDeviceModeService.getDeviceByModel(modelId)); + } + + @GetMapping("/getDeviceLocation") + private AjaxResult getDeviceLocation(Long deviceId){ + Map deviceLocation = hwDeviceService.getDeviceLocation(deviceId); + return AjaxResult.success(deviceLocation); + } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java index 4a7360c..552d4f3 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java @@ -147,4 +147,6 @@ public class HwDeviceModeController extends BaseController { public void rebuildTdSuperTables() { hwDeviceModeService.rebuildTdSuperTables(); } + + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java index 78e4476..9cfa02e 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java @@ -1,23 +1,43 @@ package com.ruoyi.business.controller; +import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.ruoyi.business.domain.*; import com.ruoyi.business.domain.VO.*; import com.ruoyi.business.service.*; +import com.ruoyi.business.utils.ExcelUtils; +import com.ruoyi.business.utils.UnitExcelUtils; +import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.constant.HwDictConstants; +import com.ruoyi.common.core.utils.poi.ExcelUtil; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.common.core.web.page.TableDataNameVo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.tdengine.api.domain.TdReturnDataVo; +import io.micrometer.core.instrument.util.StringEscapeUtils; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; -import java.util.List; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.reflect.Field; +import java.sql.*; +import java.util.*; +import java.util.Date; +import java.util.stream.Collectors; @RestController @RequestMapping("/monitorPlatform") @@ -35,6 +55,7 @@ public class HwMonitorPlatformController extends BaseController { private IHwElectronicFenceService hwElectronicFenceService; @Autowired private IHwAlarmInfoService hwAlarmInfoService; + @Autowired HwMonitorUnitAttributeService hwMonitorUnitAttributeService; @Autowired private IHwMonitorPlatformService hwMonitorPlatformService; @@ -299,4 +320,242 @@ public class HwMonitorPlatformController extends BaseController { return success(hwScenes); } + /** + * 根据场景查询场景下设备的经纬度 + * */ + @GetMapping("/selectDeviceLatitudeAndLongitude/{sceneId}") + public AjaxResult selectDeviceLatitudeAndLongitude(@PathVariable("sceneId") Long sceneId){ + List beaconDevices = hwDeviceService.selectDeviceLatitudeAndLongitude(sceneId); + return success(beaconDevices); + } + /** + * 根据设备id查询信标设备历史数据 + * */ + @GetMapping("/selectBeaconDevicesHistory") + public TableDataInfo selectBeaconDevicesHistory(@RequestParam(required = false) Map map){ +// List beaconDevices = hwDeviceService.selectBeaconDevicesHistory(map); + List> lists = hwDeviceService.selectBeaconDevicesHistory(map); + if(lists != null){ + long total = Long.valueOf(lists.get(lists.size() - 1).get("total").toString()); + lists.remove(lists.size() - 1); + TableDataInfo dataTable = getDataTable(lists); + dataTable.setTotal(total); + return dataTable; + }else { + return null; + } + } + /** + * 根据设备id查询其对应的监控单元 + * */ + @GetMapping("/selectMonitorUnit/{deviceId}") + public AjaxResult selectMonitorUnit(@PathVariable("deviceId") Long deviceId){ + HwMonitorUnit hwMonitorUnit = hwDeviceService.selectMonitorUnit(deviceId); + return success(hwMonitorUnit); + } + /** + * 根据设备id查询其对应的电子围栏 + * */ + @GetMapping("/selectMonitorElectronic/{deviceId}") + public AjaxResult selectMonitorElectronic(@PathVariable("deviceId") Long deviceId){ + return success(hwDeviceService.selectMonitorElectronic(deviceId)); + } + /** + * 历史数据弹出框(多参数且可多选) + * */ + @GetMapping("/selectHistoryAndTrendAnalysis") + public TableDataNameVo selectHistoryDevice(@RequestParam(required = false) Map map){ + List> list = hwDeviceService.selectHistoryDevice(map); + TableDataInfo dataTable = getDataTable(list); + TableDataNameVo tableDataNameVo = new TableDataNameVo(); + if (list.size()>1){ + long total = Long.valueOf(list.get(list.size() - 1).get("total").toString()); + Map mapName = new HashMap<>(); + list.remove(list.size() - 1); + if (list.size()>0){ + mapName = list.get(list.size() - 1); + list.remove(list.size() - 1); + } + + + Map mapTotal = new HashMap(); + dataTable = getDataTable(list); + dataTable.setTotal(total); + tableDataNameVo.setTableDataInfo(dataTable); + tableDataNameVo.setMapName(mapName); + return tableDataNameVo; + } + else { + map.remove("startTime"); + map.remove("endTime"); + List> listNull = hwDeviceService.selectHistoryDevice(map); + Map map1 = new HashMap(); + if (listNull.size()>1){ + map1 = listNull.get(listNull.size() - 2); + } + dataTable.setTotal(0); + list.get(0).remove("total"); + tableDataNameVo.setMapName(map1); + tableDataNameVo.setTableDataInfo(dataTable); + return tableDataNameVo; + + } + + } + /** + * 返回一级、二级、传感器 + * */ + @GetMapping("/selectComparison") + public AjaxResult selectComparison(){ + List list = hwDeviceService.selectComparison(); + return success(list); + } + /** + * 弹出框导出数据 + * */ + @PostMapping("/export") + public void export(HttpServletResponse response,@RequestParam Map map) + { + List> list = hwDeviceService.getExportDevice(map); + List exportList = new ArrayList<>(); + for (int i = 0; i < list.size(); i++){ + DeviceExport deviceExport = new DeviceExport(); + if (list.get(i).containsKey("deviceId")){ + deviceExport.setDeviceId(Long.valueOf(list.get(i).get("deviceId").toString())); + } + if (list.get(i).containsKey("value1")){ + deviceExport.setValue1(list.get(i).get("value1").toString()); + } + if (list.get(i).containsKey("voltage")){ + deviceExport.setVoltage(list.get(i).get("voltage").toString()); + } + if (list.get(i).containsKey("longitude")){ + deviceExport.setLongitude(list.get(i).get("longitude").toString()); + } + if (list.get(i).containsKey("latitude")){ + deviceExport.setLatitude(list.get(i).get("latitude").toString()); + } + if (list.get(i).containsKey("ts")){ + deviceExport.setTs(list.get(i).get("ts").toString()); + } + exportList.add(deviceExport); + } + ExcelUtil util = new ExcelUtil(DeviceExport.class); + System.out.println(exportList.size()); + util.exportExcel(response,exportList,"历史数据导出"); + + } + + /** + * 进入实际地图后显示计量箱点位标识 + * */ + @GetMapping("/getDeviceByAreaId/{tenantId}") + public AjaxResult getDeviceByAreaId(@PathVariable("tenantId") Long tenantId){ + List deviceList = hwDeviceService.getDeviceByAreaId(tenantId); + + return success(deviceList); + } + /** + * 报警信息导出 + * */ + @PostMapping("/AlarmInfosExport") + @RequiresPermissions("business:monitor:alarm") + public void AlarmInfosExport(HttpServletResponse response,Date startTime,Date endTime) throws IOException, NoSuchFieldException, IllegalAccessException { + List list1 = hwAlarmInfoService.selectUnitId(); + HashMap> map = new HashMap<>(); + for (Long unitId : list1) { + List list2 = hwAlarmInfoService.selectAlarmInfoExport1(unitId,startTime,endTime); + List attributes = hwMonitorUnitAttributeService.selectAttributes(unitId); + HwMonitorUnit hwMonitorUnit = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(unitId); + List excelMap = new ArrayList(); + LinkedHashMap attributeMap = new LinkedHashMap(); + for (HwMonitorUnitAttribute attribute : attributes) { + if (attribute!=null){ + attributeMap.put(attribute.getAttributeName(),attribute.getAttributeValue()); + } + } + for (AlarmInfoExportVo alarmInfo : list2) { + LinkedHashMap voMap = new LinkedHashMap<>(); + Class clazz = AlarmInfoExportVo.class; + Field[] fields = clazz.getDeclaredFields(); + for (Field field : fields) { + Excel annotation = field.getAnnotation(Excel.class); + String name = annotation.name(); + System.out.println(name); + field.setAccessible(true); + if (field.getName().equals("alarmInfoId")){ + System.out.println(field); +// Long alarmInfoId =(Long)field.get(alarmInfo); + Long alarmInfoId = alarmInfo.getAlarmInfoId(); + System.out.println(alarmInfoId); + voMap.put(name,alarmInfoId); + }else { + String value = null; + if (field.get(alarmInfo)!=null){ + value = field.get(alarmInfo).toString(); + } + voMap.put(name,value); + } + + } + voMap.putAll(attributeMap); + excelMap.add(voMap); + } + if (CollectionUtil.isNotEmpty(excelMap)){ + map.put(hwMonitorUnit.getMonitorUnitName(),excelMap); + } + + } + + + UnitExcelUtils unitExcelUtils = new UnitExcelUtils(); + unitExcelUtils.exportAlarmInfos(response,map); +// List alarmInfoExportVos = hwAlarmInfoService.selectAlarmInfoExport(startTime,endTime); +// ExcelUtil util = new ExcelUtil(AlarmInfoExportVo.class); +// util.exportExcel(response,alarmInfoExportVos,"报警数据导出"); + } + /** + * 导入excel,同一个租户重复导入时会覆盖之前的excel + * */ + @PostMapping("/import") + public JSONArray importUser(@RequestPart("file")MultipartFile file,Long tenantId) throws Exception { + JSONArray array = ExcelUtils.readMultipartFile(file); +// System.out.println("导入数据为:" + array); + hwDeviceService.insertRedis(array,tenantId); + return array; + } + /** + * 传入租户id查看导入的excel + * */ + @GetMapping("/getRedisFile/{tenantId}") + public JSONObject getRedisFile(@PathVariable("tenantId") Long tenantId) + { + JSONObject o = hwDeviceService.selectRedisFile(tenantId); + + if (o!=null){ + + return o; + } + else{ + return null; + } + } + + /** + * 根据模糊查询返回信标设备信息 + * */ + @PostMapping("/selectDeviceByName") + public AjaxResult selectDeviceByName(@RequestBody Map map){ + + try { + List deviceList = hwDeviceService.selectMonitorUnitAndDeviceByName(map); + return success(deviceList); + }catch (Exception ex){ + return error(String.format("获取设备信息异常:%e",ex.getMessage())); + } + + + } + + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitAttributeController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitAttributeController.java new file mode 100644 index 0000000..3ad6ddf --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitAttributeController.java @@ -0,0 +1,112 @@ +package com.ruoyi.business.controller; + +import com.ruoyi.business.domain.HwMonitorUnitAttribute; +import com.ruoyi.business.service.HwMonitorUnitAttributeService; +import com.ruoyi.common.core.web.domain.AjaxResult; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +/** + * 监控单元属性表(HwMonitorUnitAttribute)表控制层 + * + * @author makejava + * @since 2024-09-04 13:20:30 + */ +@RestController +@RequestMapping("hwMonitorUnitAttribute") +public class HwMonitorUnitAttributeController { + /** + * 服务对象 + */ + @Resource + private HwMonitorUnitAttributeService hwMonitorUnitAttributeService; + + /** + * 分页查询 + * + * @param hwMonitorUnitAttribute 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + @GetMapping + public ResponseEntity> queryByPage(HwMonitorUnitAttribute hwMonitorUnitAttribute, PageRequest pageRequest) { + return ResponseEntity.ok(this.hwMonitorUnitAttributeService.queryByPage(hwMonitorUnitAttribute, pageRequest)); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseEntity queryById(@PathVariable("id") Long id) { + return ResponseEntity.ok(this.hwMonitorUnitAttributeService.queryById(id)); + } + + /** + * 新增数据 + * + * @param hwMonitorUnitAttribute 实体 + * @return 新增结果 + */ + @PostMapping + public ResponseEntity add(HwMonitorUnitAttribute hwMonitorUnitAttribute) { + return ResponseEntity.ok(this.hwMonitorUnitAttributeService.insert(hwMonitorUnitAttribute)); + } + + /** + * 编辑数据 + * + * @param hwMonitorUnitAttribute 实体 + * @return 编辑结果 + */ + @PutMapping + public ResponseEntity edit(HwMonitorUnitAttribute hwMonitorUnitAttribute) { + return ResponseEntity.ok(this.hwMonitorUnitAttributeService.update(hwMonitorUnitAttribute)); + } + + /** + * 删除数据 + * + * @param id 主键 + * @return 删除是否成功 + */ + @DeleteMapping + public ResponseEntity deleteById(Long id) { + return ResponseEntity.ok(this.hwMonitorUnitAttributeService.deleteById(id)); + } + + @PostMapping("/addUnitAttribute") + public AjaxResult addUnitAttribute(@RequestBody HwMonitorUnitAttribute hwMonitorUnitAttribute){ + int rows = hwMonitorUnitAttributeService.addUnitAttribute(hwMonitorUnitAttribute); + return AjaxResult.success(rows); + } + + @GetMapping("/selectAttributeByUnitId") + public AjaxResult selectAttributeByUnitId(Long monitorUnitId){ + List attributes = hwMonitorUnitAttributeService.selectAttributeByUnitId(monitorUnitId); + if (attributes.size()==0){ + return AjaxResult.success(Collections.emptyList()); + } + return AjaxResult.success(attributes); + } + + @PostMapping("/updateAttributeByUniitId") + public AjaxResult updateAttributeByUniitId(@RequestBody HwMonitorUnitAttribute hwMonitorUnitAttribute){ + return AjaxResult.success(hwMonitorUnitAttributeService.updateAttributeByUniitId(hwMonitorUnitAttribute)); + } + + @DeleteMapping("/deleteAttributeByUniitId/{attributeId}") + public AjaxResult deleteAttributeByUniitId(@PathVariable Long attributeId){ + return AjaxResult.success(hwMonitorUnitAttributeService.deleteAttributeByUniitId(attributeId)); + } + +} + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwOfflineRuleController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwOfflineRuleController.java new file mode 100644 index 0000000..fbd7fdc --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwOfflineRuleController.java @@ -0,0 +1,42 @@ +package com.ruoyi.business.controller; + +import com.ruoyi.business.domain.HwOfflineRule; +import com.ruoyi.business.service.HwOfflineRuleService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/offlineRule") +public class HwOfflineRuleController extends BaseController { + + @Autowired + private HwOfflineRuleService hwOfflineRuleService; + + @GetMapping("list") + public TableDataInfo list(HwOfflineRule hwOfflineRule){ + startPage(); + List hwOfflineRules = hwOfflineRuleService.selectRuleList(hwOfflineRule); + return getDataTable(hwOfflineRules); + } + @GetMapping("/{offlineRuleId}") + public HwOfflineRule selectOfflineRuleById(@PathVariable("offlineRuleId") Long offlineRuleId){ + HwOfflineRule hwOfflineRule = hwOfflineRuleService.selectOfflineRuleById(offlineRuleId); + return hwOfflineRule; + } + + @DeleteMapping("/{offlineRuleId}") + public int deleteOfflineRuleById(@PathVariable("offlineRuleId") Long offlineRuleId){ + return hwOfflineRuleService.deleteOfflineRuleById(offlineRuleId); + + } + + @PostMapping + public int addOfflineRule(@RequestBody HwOfflineRule hwOfflineRule){ + return hwOfflineRuleService.addOfflineRule(hwOfflineRule); + + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java index 56d48d8..b5ea021 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java @@ -1,10 +1,13 @@ package com.ruoyi.business.controller; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.io.IOException; import javax.servlet.http.HttpServletResponse; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.http.HttpUtil; import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.domain.SysUser; @@ -110,4 +113,13 @@ public class HwTenantController extends BaseController { return toAjax(hwTenantService.deleteHwTenantByTenantIds(tenantIds)); } + + + @GetMapping("/getAliArea") + public AjaxResult getAliArea(Long areaCode) + { + String url = "https://geo.datav.aliyun.com/areas_v3/bound/"+areaCode+"_full.json"; + String result= HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + return success(result); + } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/BeaconDevice.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/BeaconDevice.java new file mode 100644 index 0000000..f3db390 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/BeaconDevice.java @@ -0,0 +1,131 @@ +package com.ruoyi.business.domain; + +/** + * @ClassName : BeaconDevice + * @Description : + * @Author : + * @Date: 2024-06-06 15:31 + */ +public class BeaconDevice { + private Long deviceId; + + private String deviceName; + + private Double latitude; + + private Double longitude; + + private String remark; + + private String deviceLocation; + + private Long deviceModeId; + + private String deviceStatus; + + private String ifAlarm; + + private String monitorUnitName; + private Boolean alarmElectronFence; + public Boolean getAlarmElectronFence() { + return alarmElectronFence; + } + + public void setAlarmElectronFence(Boolean alarmElectronFence) { + this.alarmElectronFence = alarmElectronFence; + } + + public String getIfAlarm() { + return ifAlarm; + } + + public void setIfAlarm(String ifAlarm) { + this.ifAlarm = ifAlarm; + } + + public String getDeviceStatus() { + return deviceStatus; + } + + public void setDeviceStatus(String deviceStatus) { + this.deviceStatus = deviceStatus; + } + + public Long getDeviceModeId() { + return deviceModeId; + } + + public void setDeviceModeId(Long deviceModeId) { + this.deviceModeId = deviceModeId; + } + + public String getDeviceLocation() { + return deviceLocation; + } + + public void setDeviceLocation(String deviceLocation) { + this.deviceLocation = deviceLocation; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Long getDeviceId() { + return deviceId; + } + + public void setDeviceId(Long deviceId) { + this.deviceId = deviceId; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public String getMonitorUnitName() { + return monitorUnitName; + } + + public void setMonitorUnitName(String monitorUnitName) { + this.monitorUnitName = monitorUnitName; + } + + @Override + public String toString() { + return "BeaconDevice{" + + "deviceId=" + deviceId + + ", deviceName='" + deviceName + '\'' + + ", latitude=" + latitude + + ", longitude=" + longitude + + ", remark='" + remark + '\'' + + ", deviceLocation='" + deviceLocation + '\'' + + ", deviceModeId=" + deviceModeId + + ", deviceStatus='" + deviceStatus + '\'' + + '}'; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java index bf8da07..160c4e1 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java @@ -111,8 +111,8 @@ public class HwAlarmInfo extends BaseEntity { /** * 实际报警时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "实际报警时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "实际报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date alarmTime; /** @@ -125,6 +125,78 @@ public class HwAlarmInfo extends BaseEntity { private String alarmLevelName; private String alarmTypeName; + private String areaName; + private String monitorUnitTypeName; + /** + * 是否处理该传感器全部报警 + * */ + private String ifDisposalAll; + + + + private String deviceName; + private String tenantName; + private String sceneName; + private String alarmRuleName; + private String offlineRuleName; + private String electronicFenceName; + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public String getSceneName() { + return sceneName; + } + + public void setSceneName(String sceneName) { + this.sceneName = sceneName; + } + + public String getAlarmRuleName() { + return alarmRuleName; + } + + public void setAlarmRuleName(String alarmRuleName) { + this.alarmRuleName = alarmRuleName; + } + + public String getOfflineRuleName() { + return offlineRuleName; + } + + public void setOfflineRuleName(String offlineRuleName) { + this.offlineRuleName = offlineRuleName; + } + + public String getElectronicFenceName() { + return electronicFenceName; + } + + public void setElectronicFenceName(String electronicFenceName) { + this.electronicFenceName = electronicFenceName; + } + + public String getIfDisposalAll() { + return ifDisposalAll; + } + + public void setIfDisposalAll(String ifDisposalAll) { + this.ifDisposalAll = ifDisposalAll; + } + public void setAlarmInfoId(Long alarmInfoId) { this.alarmInfoId = alarmInfoId; } @@ -285,6 +357,22 @@ public class HwAlarmInfo extends BaseEntity { this.alarmTypeName = alarmTypeName; } + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getMonitorUnitTypeName() { + return monitorUnitTypeName; + } + + public void setMonitorUnitTypeName(String monitorUnitTypeName) { + this.monitorUnitTypeName = monitorUnitTypeName; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) @@ -311,6 +399,16 @@ public class HwAlarmInfo extends BaseEntity { .append("monitorUnitName", getMonitorUnitName()) .append("alarmLevelName", getAlarmLevelName()) .append("alarmTypeName", getAlarmTypeName()) + + .append("areaName", getAreaName()) + .append("monitorUnitTypeName", getMonitorUnitTypeName()) + .append("deviceName", getDeviceName()) + .append("tenantName", getTenantName()) + .append("sceneName", getSceneName()) + .append("offlineRuleName", getOfflineRuleName()) + + + .toString(); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java index ab0c97e..0a356d7 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java @@ -93,6 +93,16 @@ public class HwAlarmRule extends BaseEntity private Double triggerDataB; + /** + * 时间范围 + */ + private Long triggerTimeFrame; + + /** + * 告警联系人 + */ + private String phoneNumbers; + @Excel(name = "所属租户") private String tenantName; @@ -384,6 +394,22 @@ public class HwAlarmRule extends BaseEntity this.alarmInfoFlag = alarmInfoFlag; } + public Long getTriggerTimeFrame() { + return triggerTimeFrame; + } + + public void setTriggerTimeFrame(Long triggerTimeFrame) { + this.triggerTimeFrame = triggerTimeFrame; + } + + public String getPhoneNumbers() { + return phoneNumbers; + } + + public void setPhoneNumbers(String phoneNumbers) { + this.phoneNumbers = phoneNumbers; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java index ee0ee63..22f8886 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java @@ -47,6 +47,8 @@ public class HwDevice extends BaseEntity { @Excel(name = "所属监控单元") private Long monitorUnitId; + private String monitorUnitName; + /** * 设备类型(1:网关设备,2:网关子设备,3:直连设备) */ @@ -170,7 +172,24 @@ public class HwDevice extends BaseEntity { // @Excel(name = "在线状态", readConverterExp = "1=在线,0离线") private String onlineStatus; - private String monitorUnitName; + /** + * 经度 + * */ + private Double longitude; + /** + * 纬度 + * */ + private Double latitude; + + private String functionName; + + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(String functionName) { + this.functionName = functionName; + } private String sceneName; private String deviceModeName; @@ -183,6 +202,43 @@ public class HwDevice extends BaseEntity { private String deviceTypeStr; + private String publicTime; + + //是否报警 + private String ifAlarm; + + public String getIfAlarm() { + return ifAlarm; + } + + public void setIfAlarm(String ifAlarm) { + this.ifAlarm = ifAlarm; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public String getPublicTime() { + return publicTime; + } + + public void setPublicTime(String publicTime) { + this.publicTime = publicTime; + } + public void setDeviceId(Long deviceId) { this.deviceId = deviceId; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceMode.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceMode.java index 97675ac..cc3ae62 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceMode.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceMode.java @@ -98,6 +98,8 @@ public class HwDeviceMode extends BaseEntity { private String sceneName; + private String deviceModelType; + /** * 设备模型功能信息 */ @@ -231,6 +233,14 @@ public class HwDeviceMode extends BaseEntity { this.sceneName = sceneName; } + public String getDeviceModelType() { + return deviceModelType; + } + + public void setDeviceModelType(String deviceModelType) { + this.deviceModelType = deviceModelType; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java index 8e9a62d..e78e1e6 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeFunction.java @@ -113,6 +113,8 @@ public class HwDeviceModeFunction extends BaseEntity // @Excel(name = "预留字段") private String propertyField; + private String deviceModelType; + private List inputParameters; private List outputParameters; @@ -316,6 +318,14 @@ public class HwDeviceModeFunction extends BaseEntity this.outputParameters = outputParameters; } + public String getDeviceModelType() { + return deviceModelType; + } + + public void setDeviceModelType(String deviceModelType) { + this.deviceModelType = deviceModelType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeParameter.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeParameter.java index 4a0f3c6..00387db 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeParameter.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDeviceModeParameter.java @@ -64,6 +64,8 @@ public class HwDeviceModeParameter extends BaseEntity @Excel(name = "预留字段,步长") private BigDecimal propertyStep; + private String deviceModelType; + public void setModeParameterId(Long modeParameterId) { this.modeParameterId = modeParameterId; @@ -155,6 +157,14 @@ public class HwDeviceModeParameter extends BaseEntity return propertyStep; } + public String getDeviceModelType() { + return deviceModelType; + } + + public void setDeviceModelType(String deviceModelType) { + this.deviceModelType = deviceModelType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java index 5ff816c..9599359 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java @@ -8,7 +8,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity; /** * 电子围栏对象 hw_electronic_fence - * + * * @author xins * @date 2023-09-19 */ @@ -76,42 +76,21 @@ public class HwElectronicFence extends BaseEntity private String circleAreaListStr; private String alarmInfoFlag;//是否有报警信息关联标识 + //电子围栏区域信息 + private List hwFenceAreaList; private String deviceModeName; private String deviceName; private Long deviceModeId; private Long deviceId; - public String getDeviceModeName() { - return deviceModeName; + + public List getHwFenceAreaList() { + return hwFenceAreaList; } - public void setDeviceModeName(String deviceModeName) { - this.deviceModeName = deviceModeName; - } - - public String getDeviceName() { - return deviceName; - } - - public void setDeviceName(String deviceName) { - this.deviceName = deviceName; - } - - public Long getDeviceModeId() { - return deviceModeId; - } - - public void setDeviceModeId(Long deviceModeId) { - this.deviceModeId = deviceModeId; - } - - public Long getDeviceId() { - return deviceId; - } - - public void setDeviceId(Long deviceId) { - this.deviceId = deviceId; + public void setHwFenceAreaList(List hwFenceAreaList) { + this.hwFenceAreaList = hwFenceAreaList; } public void setElectronicFenceId(Long electronicFenceId) @@ -119,115 +98,115 @@ public class HwElectronicFence extends BaseEntity this.electronicFenceId = electronicFenceId; } - public Long getElectronicFenceId() + public Long getElectronicFenceId() { return electronicFenceId; } - public void setElectronicFenceName(String electronicFenceName) + public void setElectronicFenceName(String electronicFenceName) { this.electronicFenceName = electronicFenceName; } - public String getElectronicFenceName() + public String getElectronicFenceName() { return electronicFenceName; } - public void setTenantId(Long tenantId) + public void setTenantId(Long tenantId) { this.tenantId = tenantId; } - public Long getTenantId() + public Long getTenantId() { return tenantId; } - public void setSceneId(Long sceneId) + public void setSceneId(Long sceneId) { this.sceneId = sceneId; } - public Long getSceneId() + public Long getSceneId() { return sceneId; } - public void setFenceType(String fenceType) + public void setFenceType(String fenceType) { this.fenceType = fenceType; } - public String getFenceType() + public String getFenceType() { return fenceType; } - public void setEffectiveTimeFlag(String effectiveTimeFlag) + public void setEffectiveTimeFlag(String effectiveTimeFlag) { this.effectiveTimeFlag = effectiveTimeFlag; } - public String getEffectiveTimeFlag() + public String getEffectiveTimeFlag() { return effectiveTimeFlag; } - public void setTimeZone(String timeZone) + public void setTimeZone(String timeZone) { this.timeZone = timeZone; } - public String getTimeZone() + public String getTimeZone() { return timeZone; } - public void setEffectiveTime(String effectiveTime) + public void setEffectiveTime(String effectiveTime) { this.effectiveTime = effectiveTime; } - public String getEffectiveTime() + public String getEffectiveTime() { return effectiveTime; } - public void setTriggerStatus(String triggerStatus) + public void setTriggerStatus(String triggerStatus) { this.triggerStatus = triggerStatus; } - public String getTriggerStatus() + public String getTriggerStatus() { return triggerStatus; } - public void setFencePushFlag(String fencePushFlag) + public void setFencePushFlag(String fencePushFlag) { this.fencePushFlag = fencePushFlag; } - public String getFencePushFlag() + public String getFencePushFlag() { return fencePushFlag; } - public void setFencePushContent(String fencePushContent) + public void setFencePushContent(String fencePushContent) { this.fencePushContent = fencePushContent; } - public String getFencePushContent() + public String getFencePushContent() { return fencePushContent; } - public void setFenceRecoverContent(String fenceRecoverContent) + public void setFenceRecoverContent(String fenceRecoverContent) { this.fenceRecoverContent = fenceRecoverContent; } - public String getFenceRecoverContent() + public String getFenceRecoverContent() { return fenceRecoverContent; } - public void setFenceField(String fenceField) + public void setFenceField(String fenceField) { this.fenceField = fenceField; } - public String getFenceField() + public String getFenceField() { return fenceField; } @@ -274,6 +253,38 @@ public class HwElectronicFence extends BaseEntity this.alarmInfoFlag = alarmInfoFlag; } + public String getDeviceModeName() { + return deviceModeName; + } + + public void setDeviceModeName(String deviceModeName) { + this.deviceModeName = deviceModeName; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public Long getDeviceModeId() { + return deviceModeId; + } + + public void setDeviceModeId(Long deviceModeId) { + this.deviceModeId = deviceModeId; + } + + public Long getDeviceId() { + return deviceId; + } + + public void setDeviceId(Long deviceId) { + this.deviceId = deviceId; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java index 68fbb69..1e7f3e7 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java @@ -70,6 +70,16 @@ public class HwMonitorUnit extends BaseEntity private String tenantName; private boolean normalFlag;//是否正常(如果有报警未处理的则为异常) + private List devicesList; + + public List getDevicesList() { + return devicesList; + } + + public void setDevicesList(List devicesList) { + this.devicesList = devicesList; + } + private List child = new ArrayList(); /** 子部门 */ @@ -253,4 +263,4 @@ public class HwMonitorUnit extends BaseEntity .append("monitorUnitField", getMonitorUnitField()) .toString(); } -} \ No newline at end of file +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnitAttribute.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnitAttribute.java new file mode 100644 index 0000000..b31f01d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnitAttribute.java @@ -0,0 +1,114 @@ +package com.ruoyi.business.domain; + +import java.io.Serializable; +import java.util.Date; + +/** + * 监控单元属性表(HwMonitorUnitAttribute)实体类 + * + * @author makejava + * @since 2024-09-04 13:20:33 + */ +public class HwMonitorUnitAttribute implements Serializable { + private static final long serialVersionUID = -41167481835416588L; + /** + * 监控单元属性ID + */ + private Long attributeId; + /** + * 监控单元ID + */ + private Long monitorUnitId; + /** + * 监控单元属性名称 + */ + private String attributeName; + /** + * 监控单元属性值 + */ + private String attributeValue; + /** + * 创建人 + */ + private String createBy; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新人 + */ + private String updateBy; + /** + * 更新时间 + */ + private Date updateTime; + + + public Long getAttributeId() { + return attributeId; + } + + public void setAttributeId(Long attributeId) { + this.attributeId = attributeId; + } + + public Long getMonitorUnitId() { + return monitorUnitId; + } + + public void setMonitorUnitId(Long monitorUnitId) { + this.monitorUnitId = monitorUnitId; + } + + public String getAttributeName() { + return attributeName; + } + + public void setAttributeName(String attributeName) { + this.attributeName = attributeName; + } + + public String getAttributeValue() { + return attributeValue; + } + + public void setAttributeValue(String attributeValue) { + this.attributeValue = attributeValue; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + +} + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwScene.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwScene.java index e3a926c..8d265ec 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwScene.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwScene.java @@ -1,6 +1,8 @@ package com.ruoyi.business.domain; import java.math.BigDecimal; +import java.util.List; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; @@ -10,7 +12,7 @@ import javax.validation.constraints.NotNull; /** * 场景信息对象 hw_scene - * + * * @author xins * @date 2023-08-23 */ @@ -83,138 +85,148 @@ public class HwScene extends BaseEntity private String selectedDisable; - public void setSceneId(Long sceneId) + private List unitList; + + public List getUnitList() { + return unitList; + } + + public void setUnitList(List unitList) { + this.unitList = unitList; + } + + public void setSceneId(Long sceneId) { this.sceneId = sceneId; } - public Long getSceneId() + public Long getSceneId() { return sceneId; } - public void setSceneName(String sceneName) + public void setSceneName(String sceneName) { this.sceneName = sceneName; } - public String getSceneName() + public String getSceneName() { return sceneName; } - public void setTenantId(Long tenantId) + public void setTenantId(Long tenantId) { this.tenantId = tenantId; } - public Long getTenantId() + public Long getTenantId() { return tenantId; } - public void setSceneModeId(Long sceneModeId) + public void setSceneModeId(Long sceneModeId) { this.sceneModeId = sceneModeId; } - public Long getSceneModeId() + public Long getSceneModeId() { return sceneModeId; } - public void setScenePic(String scenePic) + public void setScenePic(String scenePic) { this.scenePic = scenePic; } - public String getScenePic() + public String getScenePic() { return scenePic; } - public void setDefaultFlag(String defaultFlag) + public void setDefaultFlag(String defaultFlag) { this.defaultFlag = defaultFlag; } - public String getDefaultFlag() + public String getDefaultFlag() { return defaultFlag; } - public void setSceneStatus(String sceneStatus) + public void setSceneStatus(String sceneStatus) { this.sceneStatus = sceneStatus; } - public String getSceneStatus() + public String getSceneStatus() { return sceneStatus; } - public void setAuthMode(String authMode) + public void setAuthMode(String authMode) { this.authMode = authMode; } - public String getAuthMode() + public String getAuthMode() { return authMode; } - public void setModeAccount(String modeAccount) + public void setModeAccount(String modeAccount) { this.modeAccount = modeAccount; } - public String getModeAccount() + public String getModeAccount() { return modeAccount; } - public void setModeKey(String modeKey) + public void setModeKey(String modeKey) { this.modeKey = modeKey; } - public String getModeKey() + public String getModeKey() { return modeKey; } - public void setModeSecret(String modeSecret) + public void setModeSecret(String modeSecret) { this.modeSecret = modeSecret; } - public String getModeSecret() + public String getModeSecret() { return modeSecret; } - public void setPreserveTime(BigDecimal preserveTime) + public void setPreserveTime(BigDecimal preserveTime) { this.preserveTime = preserveTime; } - public BigDecimal getPreserveTime() + public BigDecimal getPreserveTime() { return preserveTime; } - public void setTestPreserveTime(BigDecimal testPreserveTime) + public void setTestPreserveTime(BigDecimal testPreserveTime) { this.testPreserveTime = testPreserveTime; } - public BigDecimal getTestPreserveTime() + public BigDecimal getTestPreserveTime() { return testPreserveTime; } - public void setSceneEnvironment(String sceneEnvironment) + public void setSceneEnvironment(String sceneEnvironment) { this.sceneEnvironment = sceneEnvironment; } - public String getSceneEnvironment() + public String getSceneEnvironment() { return sceneEnvironment; } - public void setSceneField(String sceneField) + public void setSceneField(String sceneField) { this.sceneField = sceneField; } - public String getSceneField() + public String getSceneField() { return sceneField; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwTenant.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwTenant.java index f5d22e3..050b4cf 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwTenant.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwTenant.java @@ -104,6 +104,18 @@ public class HwTenant extends BaseEntity { // @Excel(name = "预留字段") private String tenantField; + /** + * 行政区域代码 + */ + private String tenantMapCode; + + public String getTenantMapCode() { + return tenantMapCode; + } + + public void setTenantMapCode(String tenantMapCode) { + this.tenantMapCode = tenantMapCode; + } public void setTenantId(Long tenantId) { this.tenantId = tenantId; diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmInfoExportVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmInfoExportVo.java new file mode 100644 index 0000000..d247fcb --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmInfoExportVo.java @@ -0,0 +1,125 @@ +package com.ruoyi.business.domain.VO; + +import com.ruoyi.common.core.annotation.Excel; +import lombok.Data; + +import javax.validation.constraints.Email; + +/** + * @ClassName : AlarmInfoExportVo + * @Description : + * @Author : + * @Date: 2024-06-14 09:52 + */ +@Data +public class AlarmInfoExportVo { + @Excel(name = "报警id") + private Long alarmInfoId; + + @Excel(name = "报警位置") + private String monitorUnitName; + +// @Excel(name = "报警级别名称") +// private String alarmLevelName; + + @Excel(name = "报警类型名称") + private String alarmTypeName; + + @Excel(name = "报警时间") + private String alarmTime; + + @Excel(name = "ID") + private String monitorUnitId; + + @Excel(name = "状态") + private String monitorUnitStatus; + + @Excel(name = "类型") + private String monitorUnitTypeName; + + @Excel(name = "报警区域") + private String areaName; + +// public Long getAlarmInfoId() { +// return alarmInfoId; +// } +// +// public void setAlarmInfoId(Long alarmInfoId) { +// this.alarmInfoId = alarmInfoId; +// } +// +// public String getAreaName() { +// return areaName; +// } +// +// public void setAreaName(String areaName) { +// this.areaName = areaName; +// } +// +// public String getMonitorUnitName() { +// return monitorUnitName; +// } +// +// public void setMonitorUnitName(String monitorUnitName) { +// this.monitorUnitName = monitorUnitName; +// } +// +// public String getAlarmLevelName() { +// return alarmLevelName; +// } +// +// public void setAlarmLevelName(String alarmLevelName) { +// this.alarmLevelName = alarmLevelName; +// } +// +// public String getAlarmTypeName() { +// return alarmTypeName; +// } +// +// public void setAlarmTypeName(String alarmTypeName) { +// this.alarmTypeName = alarmTypeName; +// } +// +// public String getAlarmTime() { +// return alarmTime; +// } +// +// public void setAlarmTime(String alarmTime) { +// this.alarmTime = alarmTime; +// } + +// public String getMonitor_unit_id() { +// return monitor_unit_id; +// } +// +// public void setMonitor_unit_id(String monitor_unit_id) { +// this.monitor_unit_id = monitor_unit_id; +// } +// +// public String getMonitor_unit_status() { +// return monitor_unit_status; +// } +// +// public void setMonitor_unit_status(String monitor_unit_status) { +// this.monitor_unit_status = monitor_unit_status; +// } +// +// public String getMonitor_unit_type_name() { +// return monitor_unit_type_name; +// } +// +// public void setMonitor_unit_type_name(String monitor_unit_type_name) { +// this.monitor_unit_type_name = monitor_unit_type_name; +// } + +// @Override +// public String toString() { +// return "AlarmInfoExportVo{" + +// "alarmInfoId=" + alarmInfoId + +// ", monitorUnitName='" + monitorUnitName + '\'' + +// ", alarmLevelName='" + alarmLevelName + '\'' + +// ", alarmTypeName='" + alarmTypeName + '\'' + +// ", alarmTime='" + alarmTime + '\'' + +// '}'; +// } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AllNumsVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AllNumsVo.java index c053fe6..5a7a764 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AllNumsVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AllNumsVo.java @@ -9,6 +9,7 @@ import java.util.List; * @Date: 2023-09-04 09:00 */ public class AllNumsVo { + private Integer beaconDeviceSum; private String sceneId; private Integer subSum; private Integer sum; @@ -37,6 +38,14 @@ public class AllNumsVo { this.sum = sum; } + public Integer getBeaconDeviceSum() { + return beaconDeviceSum; + } + + public void setBeaconDeviceSum(Integer beaconDeviceSum) { + this.beaconDeviceSum = beaconDeviceSum; + } + @Override public String toString() { return "AllNumsVo{" + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceExport.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceExport.java new file mode 100644 index 0000000..5e308f6 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceExport.java @@ -0,0 +1,85 @@ +package com.ruoyi.business.domain.VO; + +import com.ruoyi.common.core.annotation.Excel; +import org.springframework.web.bind.annotation.ExceptionHandler; + +/** + * @ClassName : DeviceExport + * @Description : + * @Author : + * @Date: 2024-06-12 13:26 + */ +public class DeviceExport { + @Excel(name = "设备ID") + private Long deviceId; + @Excel(name = "温度") + private String value1; + @Excel(name = "电压") + private String voltage; + @Excel(name = "经度") + private String longitude; + @Excel(name = "纬度") + private String latitude; + @Excel(name = "记录时间") + private String ts; + + public Long getDeviceId() { + return deviceId; + } + + public void setDeviceId(Long deviceId) { + this.deviceId = deviceId; + } + + public String getValue1() { + return value1; + } + + public void setValue1(String value1) { + this.value1 = value1; + } + + public String getVoltage() { + return voltage; + } + + public void setVoltage(String voltage) { + this.voltage = voltage; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + @Override + public String toString() { + return "DeviceExport{" + + "deviceId=" + deviceId + + ", value1='" + value1 + '\'' + + ", voltage='" + voltage + '\'' + + ", longitude='" + longitude + '\'' + + ", latitude='" + latitude + '\'' + + ", ts='" + ts + '\'' + + '}'; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java index 39f4e54..5617a57 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java @@ -1,6 +1,7 @@ package com.ruoyi.business.domain.VO; import com.ruoyi.business.domain.HwDeviceModeFunction; +import com.ruoyi.common.core.web.domain.BaseEntity; import lombok.Data; import java.util.List; @@ -14,7 +15,7 @@ import java.util.Map; * @Version :1.0 */ @Data -public class HwDeviceVo { +public class HwDeviceVo extends BaseEntity { private Long deviceId; diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeAreaVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeAreaVo.java new file mode 100644 index 0000000..d9f4701 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeAreaVo.java @@ -0,0 +1,115 @@ +package com.ruoyi.business.domain.VO; + +import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.domain.HwMonitorUnit; +import com.ruoyi.common.core.web.domain.BaseEntity; + +import java.util.List; + +/** + * @ClassName : TreeAreaVo + * @Description : + * @Author : + * @Date: 2024-06-13 10:20 + */ +public class TreeAreaVo { + + private Long areaId; + + private String areaName; + +// private String ancestors; +// +// private Long parentId; +// +// private String areaStatus; +// +// private Long orderNum; + + private List listArea; + + private List deviceList; + + private List monitorUnitList; + + public List getMonitorUnitList() { + return monitorUnitList; + } + + public void setMonitorUnitList(List monitorUnitList) { + this.monitorUnitList = monitorUnitList; + } + + public List getDeviceList() { + return deviceList; + } + + public void setDeviceList(List deviceList) { + this.deviceList = deviceList; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } +// +// public String getAncestors() { +// return ancestors; +// } +// +// public void setAncestors(String ancestors) { +// this.ancestors = ancestors; +// } +// +// public Long getParentId() { +// return parentId; +// } +// +// public void setParentId(Long parentId) { +// this.parentId = parentId; +// } +// +// public String getAreaStatus() { +// return areaStatus; +// } +// +// public void setAreaStatus(String areaStatus) { +// this.areaStatus = areaStatus; +// } +// +// public Long getOrderNum() { +// return orderNum; +// } +// +// public void setOrderNum(Long orderNum) { +// this.orderNum = orderNum; +// } + + public List getListArea() { + return listArea; + } + + public void setListArea(List listArea) { + this.listArea = listArea; + } + + @Override + public String toString() { + return "TreeAreaVo{" + + "areaId=" + areaId + + ", areaName='" + areaName + '\'' + + ", listArea=" + listArea + + '}'; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeDeviceVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeDeviceVo.java new file mode 100644 index 0000000..dab70dc --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeDeviceVo.java @@ -0,0 +1,73 @@ +package com.ruoyi.business.domain.VO; + +import java.util.List; + +/** + * @ClassName : TreeDeviceVo + * @Description : + * @Author : + * @Date: 2024-06-11 17:47 + */ +public class TreeDeviceVo { + + private Long voId; + + private String voName; + + private Long parentId; + + private List voList; + + private String prop; + + public String getProp() { + return prop; + } + + public void setProp(String prop) { + this.prop = prop; + } + + public Long getVoId() { + return voId; + } + + public void setVoId(Long voId) { + this.voId = voId; + } + + public String getVoName() { + return voName; + } + + public void setVoName(String voName) { + this.voName = voName; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public List getVoList() { + return voList; + } + + public void setVoList(List voList) { + this.voList = voList; + } + + @Override + public String toString() { + return "TreeDeviceVo{" + + "voId=" + voId + + ", voName='" + voName + '\'' + + ", parentId=" + parentId + + ", voList=" + voList + + ", prop=" + prop + + '}'; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java index a6c834e..8ac9855 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java @@ -1,21 +1,29 @@ package com.ruoyi.business.mapper; +import java.util.Date; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; + import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.VO.AlarmInfoExportVo; import com.ruoyi.business.domain.VO.AlarmInfoVo; import com.ruoyi.business.domain.VO.AlarmTypeVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 报警信息Mapper接口 - * + * * @author xins * @date 2023-09-15 */ -public interface HwAlarmInfoMapper +@Mapper +public interface HwAlarmInfoMapper { /** * 查询报警信息 - * + * * @param alarmInfoId 报警信息主键 * @return 报警信息 */ @@ -23,7 +31,7 @@ public interface HwAlarmInfoMapper /** * 查询报警信息列表 - * + * * @param hwAlarmInfo 报警信息 * @return 报警信息集合 */ @@ -31,7 +39,7 @@ public interface HwAlarmInfoMapper /** * 新增报警信息 - * + * * @param hwAlarmInfo 报警信息 * @return 结果 */ @@ -39,15 +47,16 @@ public interface HwAlarmInfoMapper /** * 修改报警信息 - * + * * @param hwAlarmInfo 报警信息 * @return 结果 */ public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + /** * 删除报警信息 - * + * * @param alarmInfoId 报警信息主键 * @return 结果 */ @@ -55,7 +64,7 @@ public interface HwAlarmInfoMapper /** * 批量删除报警信息 - * + * * @param alarmInfoIds 需要删除的数据主键集合 * @return 结果 */ @@ -74,4 +83,21 @@ public interface HwAlarmInfoMapper * @return int */ public int selectAlarmCountByMonitorUnitId(Long monitorUnitId); + + /** + * 导出报警信息 + * */ + List selectAlarmInfoExport(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * 批量处理报警信息 + * */ + public int updateHwAlarmInfoAllByDevice(HwAlarmInfo hwAlarmInfo); + +// List selectAlarmInfoExport1(@Param("monitorUnitId")Long monitorUnitId); + List selectAlarmInfoExport1(@Param("monitorUnitId")Long monitorUnitId,@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + List selectUnitId(); + + int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java index 57a73b2..bca3ebc 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java @@ -3,6 +3,8 @@ package com.ruoyi.business.mapper; import java.util.List; import com.ruoyi.business.domain.HwAlarmRule; import com.ruoyi.business.domain.HwAlarmRuleLink; +import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.domain.HwDeviceMode; /** * 报警规则Mapper接口 @@ -18,7 +20,7 @@ public interface HwAlarmRuleMapper * @param alarmRuleId 报警规则主键 * @return 报警规则 */ - public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId); + public List selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId); /** * 查询报警规则列表 @@ -92,4 +94,6 @@ public interface HwAlarmRuleMapper * @return 结果 */ public int deleteHwAlarmRuleLinkByAlarmRuleId(Long alarmRuleId); + + HwDeviceMode selectModeByDeviceId(Long deviceId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java index ce781f0..266a9e4 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java @@ -1,9 +1,15 @@ package com.ruoyi.business.mapper; +import java.util.HashMap; import java.util.List; +import java.util.Map; + import com.ruoyi.business.domain.HwDevice; import com.ruoyi.business.domain.VO.DeviceModeVo; import com.ruoyi.business.domain.VO.HwMonitorUnitVo; +import com.ruoyi.business.domain.VO.TreeAreaVo; +import com.ruoyi.business.domain.VO.TreeDeviceVo; +import org.apache.ibatis.annotations.Param; /** * 设备信息Mapper接口 @@ -26,7 +32,7 @@ public interface HwDeviceMapper /** * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) * */ - public List selectDeviceModeNameVo(); + public List selectDeviceModeNameVo(Long tenantId); /** * 查询设备信息列表 * @@ -108,9 +114,9 @@ public interface HwDeviceMapper * @return HwDevice */ public HwDevice selectHwDeviceByDeviceCode(String deviceCode); - + public int selectDeviceNumCount(HwDevice hwDevice); - + public int selectAbnormalDeviceNumCount(HwDevice hwDevice); @@ -134,4 +140,40 @@ public interface HwDeviceMapper * @return List */ public List selectUnallocatedList(HwDevice hwDevice); + + /** + * 查询设备列表集合 + * */ + List selectDeviceList(); + + /** + * 查询设备的字段名 + * */ + public String selectPropBydeviceIdAndFunctionName(@Param(value = "deviceModeId") Long deviceModeId,@Param(value = "functionName") String functionName); + + /** + * 根据地图显示计量箱点位标识 + * */ + List getDeviceByAreaId(@Param(value = "tenantId") Long tenantId,@Param(value = "areaId") Long areaId); + List getTreeArea(Long areaId); + + /** + * 获取监控单元下的信标设备 + * */ + List getDeviceListInMonitorUnit(Long monitorUnitId); + + /** + * 根据设备模型标识符获取设备模型名称 + * */ + String selectFunctionNameByFunctionIdentifier(@Param("functionIdentifier") String functionIdentifier,@Param("modeId") Long modeId); + /** + * 根据设备id查询该设备是否报警 + * */ + Long selectDeviceIfAlarm(Long deviceId); + + List getDeviceByModel(Long modelId); + + Long selectDeviceIfAlarmElectronFence(Long deviceId); + + Long selectModeIdByDeviceId(String deviceId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeFunctionMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeFunctionMapper.java index 4a94095..0f20a08 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeFunctionMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeFunctionMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.business.mapper; import java.util.List; import com.ruoyi.business.domain.HwDeviceModeFunction; +import org.apache.ibatis.annotations.Param; /** * 设备模型功能Mapper接口 @@ -58,4 +59,7 @@ public interface HwDeviceModeFunctionMapper * @return 结果 */ public int deleteHwDeviceModeFunctionByModeFunctionIds(Long[] modeFunctionIds); + + String selectUbitByIdAndName(@Param("dataFunctionIdentifier") String dataFunctionIdentifier,@Param("modeId") Long modeId); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java index d4297c2..ae1e860 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceModeMapper.java @@ -143,4 +143,6 @@ public interface HwDeviceModeMapper * @return 设备模型集合 */ public List selectHwDeviceModeJoinList(HwDeviceMode hwDeviceMode); + + List selectModel(Long sceneId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java index dcde8cf..536ef1b 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java @@ -114,4 +114,10 @@ public interface HwElectronicFenceMapper * @return 结果 */ public int deleteHwFenceAreaByElectronicFenceId(Long electronicFenceId); + + /** + * 查询电子围栏信息根据设备id + * */ + List selectMonitorElectronic(Long deviceId); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwFenceTargetMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwFenceTargetMapper.java index c2cb8e7..791a4ae 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwFenceTargetMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwFenceTargetMapper.java @@ -58,4 +58,6 @@ public interface HwFenceTargetMapper * @return 结果 */ public int deleteHwFenceTargetByTargetIds(Long[] targetIds); + + public int deleteHwFenceTargetByFenceId(Long[] electronicFenceIds); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitAttributeDao.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitAttributeDao.java new file mode 100644 index 0000000..593e09e --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitAttributeDao.java @@ -0,0 +1,92 @@ +package com.ruoyi.business.mapper; + + +import com.ruoyi.business.domain.HwMonitorUnitAttribute; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 监控单元属性表(HwMonitorUnitAttribute)表数据库访问层 + * + * @author makejava + * @since 2024-09-04 13:20:30 + */ +public interface HwMonitorUnitAttributeDao { + + /** + * 通过ID查询单条数据 + * + * @param attributeId 主键 + * @return 实例对象 + */ + HwMonitorUnitAttribute queryById(Long attributeId); + + /** + * 查询指定行数据 + * + * @param hwMonitorUnitAttribute 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAllByLimit(HwMonitorUnitAttribute hwMonitorUnitAttribute, @Param("pageable") Pageable pageable); + + /** + * 统计总行数 + * + * @param hwMonitorUnitAttribute 查询条件 + * @return 总行数 + */ + long count(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + /** + * 新增数据 + * + * @param hwMonitorUnitAttribute 实例对象 + * @return 影响行数 + */ + int insert(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param hwMonitorUnitAttribute 实例对象 + * @return 影响行数 + */ + int update(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + /** + * 通过主键删除数据 + * + * @param attributeId 主键 + * @return 影响行数 + */ + int deleteById(Long attributeId); + + List selectAttributeByUnitId(Long monitorUnitId); + + int updateAttributeByUniitId(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + int deleteAttributeByUniitId(Long attributeId); + + List selectAttributes(Long unitId); +} + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java index fae663f..4bb5cc0 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java @@ -1,11 +1,13 @@ package com.ruoyi.business.mapper; import java.util.List; +import java.util.Map; import com.alibaba.druid.support.http.MonitorClientContextListener; import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.HwScene; import com.ruoyi.business.domain.VO.*; +import org.apache.ibatis.annotations.Param; /** * 监控单元Mapper接口 @@ -25,22 +27,22 @@ public interface HwMonitorUnitMapper /** * 查询区域数量站场景区总数百分比(左上角) * */ - public List selectMonitorPercentage(); + public List selectMonitorPercentage(Long tenantId); /** *  展示总的设备数量和总的监控单元数量(最低级的监控单元) * */ public List selectAllNums(); public List selectsum(); //查询id与name的结果集 - List selectSceneNameById(); - Integer selectSubSetNums(Long sceneId); + List selectSceneNameById(Long tenantId); + Integer selectSubSetNums(@Param("tenantId") Long tenantId,@Param("sceneId")Long sceneId); /** * 分页获取最子集监控单元列表 * */ public List selectLimitSubMonitorUnit(HwMonitorUnit hwMonitorUnit); Integer selectReleatedDeviceIdNums(Long deviceCode); - Integer selectDeviceNums(Long sceneId); + Integer selectDeviceNums(@Param("sceneId")Long sceneId,@Param("tenantId")Long tenantId); Integer selectSubDeviceSum(Long sceneId); /** @@ -155,4 +157,31 @@ public interface HwMonitorUnitMapper */ public int deleteMonitorUnitById(Long monitorUnitId); -} \ No newline at end of file + /** + * 查询信标设备数量 + * */ + Integer selectBeaconDeviceNums(Long sceneId); + + /** + * 根据场景查询信标设备 + * */ + Integer[] selectBeaconDeviceBySceneId(Long sceneId); + + /** + * 根据设备id查询其对应的电子围栏信息 + * */ + HwMonitorUnit selectMonitorUnit(Long deviceId); + + /** + * 查询监控单元信息并返回map + * */ + List selectMonitorUnitReturnMap(); + + /** + * 根据区域id查询监控单元 + * */ + List getMonitorUnitByAreaId(@Param(value = "tenantId") Long tenantId, @Param(value = "areaId") Long areaId); + + List selectMonitorUnitListHavAreaId(Long tenantId); + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwOfflineRuleMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwOfflineRuleMapper.java new file mode 100644 index 0000000..6b2d89b --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwOfflineRuleMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.business.mapper; + +import com.ruoyi.business.domain.HwOfflineRule; + +import java.util.List; + +public interface HwOfflineRuleMapper { + + List selectHwOfflineRuleJoinList(HwOfflineRule hwOfflineRule); + + + HwOfflineRule selectOfflineRuleById(Long offlineRuleId); + + int deleteOfflineRuleById(Long offlineRuleId); + + int addOfflineRule(HwOfflineRule hwOfflineRule); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java index 917cc85..dc30410 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java @@ -1,8 +1,12 @@ package com.ruoyi.business.mapper; import java.util.List; +import java.util.Map; + import com.ruoyi.business.domain.HwScene; import com.ruoyi.business.domain.VO.HwSceneVo; +import com.ruoyi.business.domain.VO.TreeDeviceVo; +import org.apache.ibatis.annotations.Param; /** * 场景信息Mapper接口 @@ -66,4 +70,11 @@ public interface HwSceneMapper * @return 结果 */ public int deleteHwSceneBySceneIds(Long[] sceneIds); + + /** + * 查询场景信息集合 + * */ + public List selectHwSceneListReturnMap(); + + HwScene selectHwSceneByTenantId(@Param("tenantId") Long tenantId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/HwMonitorUnitAttributeService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/HwMonitorUnitAttributeService.java new file mode 100644 index 0000000..df14465 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/HwMonitorUnitAttributeService.java @@ -0,0 +1,68 @@ +package com.ruoyi.business.service; + + +import com.ruoyi.business.domain.HwMonitorUnitAttribute; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +import java.util.List; + +/** + * 监控单元属性表(HwMonitorUnitAttribute)表服务接口 + * + * @author makejava + * @since 2024-09-04 13:20:34 + */ +public interface HwMonitorUnitAttributeService { + + /** + * 通过ID查询单条数据 + * + * @param attributeId 主键 + * @return 实例对象 + */ + HwMonitorUnitAttribute queryById(Long attributeId); + + /** + * 分页查询 + * + * @param hwMonitorUnitAttribute 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + Page queryByPage(HwMonitorUnitAttribute hwMonitorUnitAttribute, PageRequest pageRequest); + + /** + * 新增数据 + * + * @param hwMonitorUnitAttribute 实例对象 + * @return 实例对象 + */ + HwMonitorUnitAttribute insert(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + /** + * 修改数据 + * + * @param hwMonitorUnitAttribute 实例对象 + * @return 实例对象 + */ + HwMonitorUnitAttribute update(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + /** + * 通过主键删除数据 + * + * @param attributeId 主键 + * @return 是否成功 + */ + boolean deleteById(Long attributeId); + + int addUnitAttribute(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + List selectAttributeByUnitId(Long monitorUnitId); + + int updateAttributeByUniitId(HwMonitorUnitAttribute hwMonitorUnitAttribute); + + int deleteAttributeByUniitId(Long attributeId); + + List selectAttributes(Long unitId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/HwOfflineRuleService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/HwOfflineRuleService.java new file mode 100644 index 0000000..5cffd21 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/HwOfflineRuleService.java @@ -0,0 +1,15 @@ +package com.ruoyi.business.service; + +import com.ruoyi.business.domain.HwOfflineRule; + +import java.util.List; + +public interface HwOfflineRuleService { + List selectRuleList(HwOfflineRule hwOfflineRule); + + HwOfflineRule selectOfflineRuleById(Long offlineRuleId); + + int deleteOfflineRuleById(Long offlineRuleId); + + int addOfflineRule(HwOfflineRule hwOfflineRule); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java index d5f150b..3b441ac 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java @@ -1,20 +1,25 @@ package com.ruoyi.business.service; +import java.util.Date; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; + import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.VO.AlarmInfoExportVo; import com.ruoyi.business.domain.VO.AlarmTypeVo; /** * 报警信息Service接口 - * + * * @author xins * @date 2023-09-15 */ -public interface IHwAlarmInfoService +public interface IHwAlarmInfoService { /** * 查询报警信息 - * + * * @param alarmInfoId 报警信息主键 * @return 报警信息 */ @@ -22,7 +27,7 @@ public interface IHwAlarmInfoService /** * 查询报警信息列表 - * + * * @param hwAlarmInfo 报警信息 * @return 报警信息集合 */ @@ -30,7 +35,7 @@ public interface IHwAlarmInfoService /** * 新增报警信息 - * + * * @param hwAlarmInfo 报警信息 * @return 结果 */ @@ -38,7 +43,7 @@ public interface IHwAlarmInfoService /** * 修改报警信息 - * + * * @param hwAlarmInfo 报警信息 * @return 结果 */ @@ -46,7 +51,7 @@ public interface IHwAlarmInfoService /** * 批量删除报警信息 - * + * * @param alarmInfoIds 需要删除的报警信息主键集合 * @return 结果 */ @@ -54,7 +59,7 @@ public interface IHwAlarmInfoService /** * 删除报警信息信息 - * + * * @param alarmInfoId 报警信息主键 * @return 结果 */ @@ -68,4 +73,15 @@ public interface IHwAlarmInfoService * @return List */ public List selectAlarmsByAlarmType(Long sceneId); + + /** + * 导出报警信息 + * */ + List selectAlarmInfoExport(Date startTime, Date endTime); + + List selectAlarmInfoExport1(Long monitorUnitId,Date startTime, Date endTime); + + List selectUnitId(); + + int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java index d0ba61f..6dc0f7d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceModeService.java @@ -3,6 +3,7 @@ package com.ruoyi.business.service; import java.util.List; import java.util.Map; +import com.ruoyi.business.domain.HwDevice; import com.ruoyi.business.domain.HwDeviceMode; import com.ruoyi.business.domain.HwDeviceModeFunction; import com.ruoyi.business.domain.HwDeviceModeParameter; @@ -134,4 +135,9 @@ public interface IHwDeviceModeService */ public HwDeviceMode selectHwDeviceModeByDeviceId(Long deviceId); + List selectModel(Long sceneId); + + List getDeviceByModel(Long modelId); + +// Map getDeviceLocation(Long deviceId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java index 1ca2caf..fd8ed0b 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java @@ -1,10 +1,12 @@ package com.ruoyi.business.service; +import java.util.HashMap; import java.util.List; import java.util.Map; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.domain.*; import com.ruoyi.business.domain.VO.*; import com.ruoyi.common.datascope.annotation.DataScope; @@ -213,4 +215,54 @@ public interface IHwDeviceService { */ public List selectUnallocatedList(HwDevice device); + + /** + * 查询设备经纬度 + * */ + public List selectDeviceLatitudeAndLongitude(Long sceneId); + + /** + * 查询历史信标数据 + * */ + public List> selectBeaconDevicesHistory(Map map); + /** + * 根据设备查询其电子围栏 + * */ + public HwMonitorUnit selectMonitorUnit(Long deviceId); + + /** + * 支持多参数查询历史数据 + * */ + public List> selectHistoryDevice(Map map); + + /** + * 返回一级、二级、传感器 + * */ + public List selectComparison(); + + /** + * 导出数据接口 + * */ + List> getExportDevice(Map map); + /** + * 根据地图显示计量箱点位标识 + * */ + List getDeviceByAreaId(Long tenantId); + /** + * 查询电子围栏信息根据设备id + * */ + List selectMonitorElectronic(Long deviceId); + /** + * 将数据存入到redis中 + * */ + void insertRedis(JSONArray jsonArray,Long tenantId); + JSONObject selectRedisFile(Long tenantId); + + /** + * 根据监控单元/设备名称查询监控单元 + * */ + ListselectMonitorUnitAndDeviceByName(Map map); + + + Map getDeviceLocation(Long deviceId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java index 42f07bc..9192f74 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java @@ -1,16 +1,18 @@ package com.ruoyi.business.service.impl; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import com.ruoyi.business.domain.HwAlarmType; +import com.ruoyi.business.domain.VO.AlarmInfoExportVo; import com.ruoyi.business.domain.VO.AlarmTypeVo; import com.ruoyi.business.mapper.HwAlarmTypeMapper; import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.datascope.annotation.DataScope; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.business.mapper.HwAlarmInfoMapper; @@ -51,6 +53,10 @@ public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService { @Override @DataScope(tenantAlias = "hai") public List selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwAlarmInfo.setTenantId(tenantId); return hwAlarmInfoMapper.selectHwAlarmInfoList(hwAlarmInfo); } @@ -76,7 +82,14 @@ public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService { public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo) { hwAlarmInfo.setUpdateTime(DateUtils.getNowDate()); hwAlarmInfo.setHandleStatus(HwDictConstants.ALARM_HANDLE_STATUS_YES); - return hwAlarmInfoMapper.updateHwAlarmInfo(hwAlarmInfo); + + if (hwAlarmInfo.getIfDisposalAll().equals("0")){ + return hwAlarmInfoMapper.updateHwAlarmInfo(hwAlarmInfo); + } + else { + return hwAlarmInfoMapper.updateHwAlarmInfoAllByDevice(hwAlarmInfo); + } + } /** @@ -142,4 +155,25 @@ public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService { } return list; } + + @Override + public List selectAlarmInfoExport(Date startTime, Date endTime) { + return hwAlarmInfoMapper.selectAlarmInfoExport(startTime,endTime); + } + + @Override + public List selectAlarmInfoExport1(Long monitorUnitId,Date startTime, Date endTime) { + return hwAlarmInfoMapper.selectAlarmInfoExport1(monitorUnitId,startTime,endTime); + } + + @Override + public List selectUnitId() { + return hwAlarmInfoMapper.selectUnitId(); + } + +/* int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation);*/ + @Override + public int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation) { + return hwAlarmInfoMapper.updateHwAlarmInformation(hwAlarmInformation); + } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java index 30be5cc..f576e9f 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.business.service.impl; import com.ruoyi.business.domain.HwAlarmInfo; import com.ruoyi.business.domain.HwAlarmRule; import com.ruoyi.business.domain.HwAlarmRuleLink; +import com.ruoyi.business.domain.HwDeviceMode; import com.ruoyi.business.mapper.HwAlarmInfoMapper; import com.ruoyi.business.mapper.HwAlarmRuleMapper; import com.ruoyi.business.service.IHwAlarmRuleService; @@ -12,6 +13,8 @@ import com.ruoyi.common.core.utils.RegexUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.datascope.annotation.DataScope; import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -40,7 +43,17 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { */ @Override public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId) { - HwAlarmRule alarmRule = hwAlarmRuleMapper.selectHwAlarmRuleByAlarmRuleId(alarmRuleId); + List alarmRules = hwAlarmRuleMapper.selectHwAlarmRuleByAlarmRuleId(alarmRuleId); + ArrayList ruleDeviceIds = new ArrayList<>(); + for (HwAlarmRule rule : alarmRules) { + ruleDeviceIds.add(rule.getRuleDeviceId()); + } + HwDeviceMode hwDeviceMode = hwAlarmRuleMapper.selectModeByDeviceId(ruleDeviceIds.get(0)); + HwAlarmRule alarmRule = alarmRules.get(0); + alarmRule.setRuleDeviceIds(ruleDeviceIds); + alarmRule.setDeviceModeId(hwDeviceMode.getDeviceModeId()); + alarmRule.setDeviceModeName(alarmRule.getDeviceModeName()); +// HwAlarmRule alarmRule = hwAlarmRuleMapper.selectHwAlarmRuleByAlarmRuleId(alarmRuleId); String triggerExpression = alarmRule.getTriggerExpression(); String triggerCondition = ""; if (triggerExpression.indexOf("and") > 0) { @@ -105,7 +118,12 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @DataScope(tenantAlias = "har") public List selectHwAlarmRuleJoinList(HwAlarmRule hwAlarmRule) { hwAlarmRule.setRuleType(HwDictConstants.ALARM_RULE_RULE_TYPE_DEVICE); + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwAlarmRule.setTenantId(tenantId); return hwAlarmRuleMapper.selectHwAlarmRuleJoinList(hwAlarmRule); + } /** @@ -117,14 +135,22 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @Transactional @Override public int insertHwAlarmRule(HwAlarmRule hwAlarmRule) { - String triggerExpression = this.getTriggerExpression(hwAlarmRule); - hwAlarmRule.setTriggerExpression(triggerExpression); - hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO); - hwAlarmRule.setCreateTime(DateUtils.getNowDate()); - hwAlarmRule.setTenantId(SecurityUtils.getTenantId()); - hwAlarmRule.setCreateBy(SecurityUtils.getUsername()); - int rows = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule); - insertHwAlarmRuleLink(hwAlarmRule); + List ruleDeviceIds = hwAlarmRule.getRuleDeviceIds(); + int rows = 0; + for (Long ruleDeviceId : ruleDeviceIds) { + hwAlarmRule.setRuleDeviceId(ruleDeviceId); + String triggerExpression = this.getTriggerExpression(hwAlarmRule); + hwAlarmRule.setTriggerExpression(triggerExpression); + hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO); + hwAlarmRule.setCreateTime(DateUtils.getNowDate()); + hwAlarmRule.setTenantId(SecurityUtils.getTenantId()); + hwAlarmRule.setCreateBy(SecurityUtils.getUsername()); + hwAlarmRule.setAlarmLevelId(hwAlarmRule.getAlarmTypeId()); + int rowsAdd = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule); + insertHwAlarmRuleLink(hwAlarmRule); + rows += rowsAdd; + } + return rows; } @@ -138,25 +164,32 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @Transactional @Override public int updateHwAlarmRule(HwAlarmRule hwAlarmRule) { - hwAlarmRule.setUpdateTime(DateUtils.getNowDate()); - hwAlarmRule.setUpdateBy(SecurityUtils.getUsername()); + List ruleDeviceIds = hwAlarmRule.getRuleDeviceIds(); + int updateRows = 0; + for (Long ruleDeviceId : ruleDeviceIds) { + hwAlarmRule.setRuleDeviceId(ruleDeviceId); + hwAlarmRule.setUpdateTime(DateUtils.getNowDate()); + hwAlarmRule.setUpdateBy(SecurityUtils.getUsername()); + HwAlarmInfo queryAlarmInfo = new HwAlarmInfo(); + queryAlarmInfo.setAlarmInfoType(HwDictConstants.ALARM_INFO_TYPE_DEVICE); + queryAlarmInfo.setAlarmReleatedId(hwAlarmRule.getAlarmRuleId()); + List alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); + if (alarmInfos == null || alarmInfos.isEmpty()) {//没有关联报警信息,才能修改表达式 + String triggerExpression = this.getTriggerExpression(hwAlarmRule); + hwAlarmRule.setTriggerExpression(triggerExpression); + } else { + hwAlarmRule.setTriggerExpression(null); + } - HwAlarmInfo queryAlarmInfo = new HwAlarmInfo(); - queryAlarmInfo.setAlarmInfoType(HwDictConstants.ALARM_INFO_TYPE_DEVICE); - queryAlarmInfo.setAlarmReleatedId(hwAlarmRule.getAlarmRuleId()); - List alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); - if (alarmInfos == null || alarmInfos.isEmpty()) {//没有关联报警信息,才能修改表达式 - String triggerExpression = this.getTriggerExpression(hwAlarmRule); - hwAlarmRule.setTriggerExpression(triggerExpression); - } else { - hwAlarmRule.setTriggerExpression(null); + hwAlarmRuleMapper.deleteHwAlarmRuleLinkByAlarmRuleId(hwAlarmRule.getAlarmRuleId()); + if (hwAlarmRule.getLinkFlag().equals(HwDictConstants.ALARM_RULE_LINK_FLAG_YES)) { + insertHwAlarmRuleLink(hwAlarmRule); + } + int row = hwAlarmRuleMapper.updateHwAlarmRule(hwAlarmRule); + updateRows += row; } - hwAlarmRuleMapper.deleteHwAlarmRuleLinkByAlarmRuleId(hwAlarmRule.getAlarmRuleId()); - if (hwAlarmRule.getLinkFlag().equals(HwDictConstants.ALARM_RULE_LINK_FLAG_YES)) { - insertHwAlarmRuleLink(hwAlarmRule); - } - return hwAlarmRuleMapper.updateHwAlarmRule(hwAlarmRule); + return updateRows; } /** diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java index 13b72ee..5b3b16b 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java @@ -10,6 +10,8 @@ import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.datascope.annotation.DataScope; import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -61,6 +63,10 @@ public class HwAlarmTypeServiceImpl implements IHwAlarmTypeService { @Override @DataScope(tenantAlias = "hat") public List selectHwAlarmTypeJoinList(HwAlarmType hwAlarmType) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwAlarmType.setTenantId(tenantId); return hwAlarmTypeMapper.selectHwAlarmTypeJoinList(hwAlarmType); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java index 61187a2..4a5ad53 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java @@ -20,8 +20,11 @@ import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.datascope.annotation.DataScope; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.RemoteConfigService; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.tdengine.api.RemoteTdEngineService; import com.ruoyi.tdengine.api.domain.TdField; +import com.ruoyi.tdengine.api.domain.TdSelectDto; import com.ruoyi.tdengine.api.domain.TdSuperTableVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -375,6 +378,10 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { @Override @DataScope(tenantAlias = "hdm") public List selectHwDeviceModeJoinList(HwDeviceMode hwDeviceMode) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwDeviceMode.setTenantId(tenantId); return hwDeviceModeMapper.selectHwDeviceModeJoinList(hwDeviceMode); } @@ -433,6 +440,25 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { return deviceMode; } + @Override + public List selectModel(Long sceneId) { + return hwDeviceModeMapper.selectModel(sceneId); + } + + @Override + public List getDeviceByModel(Long modelId) { + System.out.println(hwDeviceMapper.getDeviceByModel(modelId)); + return hwDeviceMapper.getDeviceByModel(modelId); + } +// public Map getDeviceLocation(Long deviceId) { +// TdSelectDto tdSelectDto = new TdSelectDto(); +// tdSelectDto.setDatabaseName("db_hwsaas"); +// tdSelectDto.setTableName("t_device_"+deviceId); +// R> deviceLocation = remoteTdEngineService.getDeviceLocation(tdSelectDto, SecurityConstants.FROM_SOURCE); +// Map data = deviceLocation.getData(); +// return data; +// } + /** * @param: hwDeviceModeFunction diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java index 865eb83..33ea550 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java @@ -3,10 +3,12 @@ package com.ruoyi.business.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.ruoyi.business.domain.*; import com.ruoyi.business.domain.VO.*; import com.ruoyi.business.mapper.*; import com.ruoyi.business.service.IHwDeviceService; +//import com.ruoyi.business.utils.GpsCoordinateUtils; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.constant.SecurityConstants; @@ -19,8 +21,10 @@ import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.NumberUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.datascope.annotation.DataScope; +import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.tdengine.api.RemoteTdEngineService; import com.ruoyi.tdengine.api.domain.*; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +33,11 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.sql.Timestamp; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -56,7 +64,14 @@ public class HwDeviceServiceImpl implements IHwDeviceService { private StringRedisTemplate redisTemplate; @Autowired private HwAlarmInfoMapper hwAlarmInfoMapper; - + @Autowired + private HwElectronicFenceMapper hwElectronicFenceMapper; + @Autowired + private RedisService redisService; + @Autowired + private HwFenceAreaMapper hwFenceAreaMapper; + public static final String SEPARATOR_UNDERLINE = "_"; + public static final String SEPARATOR_COMMA = ","; /** * 查询设备信息 * @@ -65,7 +80,6 @@ public class HwDeviceServiceImpl implements IHwDeviceService { */ @Override public HwDevice selectHwDeviceByDeviceId(Long deviceId) { - return hwDeviceMapper.selectHwDeviceByDeviceId(deviceId); } @@ -97,6 +111,10 @@ public class HwDeviceServiceImpl implements IHwDeviceService { // @DataScope(tenantAlias = "hd") //todo 去掉上面注释 public List selectHwDeviceList(HwDevice hwDevice) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwDevice.setTenantId(tenantId); return hwDeviceMapper.selectHwDeviceList(hwDevice); } @@ -273,7 +291,10 @@ public class HwDeviceServiceImpl implements IHwDeviceService { */ @Override public List selectDeviceModeNameVo() { - List list = hwDeviceMapper.selectDeviceModeNameVo(); + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + List list = hwDeviceMapper.selectDeviceModeNameVo(tenantId); Integer value = 0; if (list.size() > 10) { for (int i = 9; i < list.size(); i++) { @@ -336,7 +357,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService { @Override public int changeDeviceStatus(HwDevice hwDevice) { HwDevice dbDevice = hwDeviceMapper.selectHwDeviceByDeviceId(hwDevice.getDeviceId()); - if (dbDevice.getDeviceStatus().equals(HwDictConstants.DEVICE_STATUS_PUBLISH)) { + if (dbDevice.getDeviceStatus().equals(HwDictConstants.DEVICE_STATUS_PUBLISH) && !hwDevice.getDeviceStatus().equals("0")) { throw new ServiceException("已发布状态不能修改"); } hwDevice.setUpdateBy(SecurityUtils.getUsername()); @@ -409,6 +430,27 @@ public class HwDeviceServiceImpl implements IHwDeviceService { String databaseName = TdEngineConstants.getDatabaseName(); List hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice); + +/* 获取该监控单元节点下的所有子孙节点的设备 */ + //获取所有监控单元 + List hwMonitorUnits = hwMonitorUnitMapper.selectHwMonitorUnitList(new HwMonitorUnit()); + Long targetNodeId = queryHwDevice.getMonitorUnitId();//目标节点,即父节点ID + //TODO(zangch,2024.10.16):在hwDevices拼接子孙节点的设备列表,数据库样本少未完全验证性能和有效性 + //调用递归方法 + List descendants = getAllHwMonitorUnits(hwMonitorUnits,targetNodeId); + // 遍历所有监控单元 + for (HwMonitorUnit hwMonitorUnit : descendants){ + // 创建设备对象 + HwDevice hwMonitorUnitDevice = new HwDevice(); + // 设置监控单元ID + hwMonitorUnitDevice.setMonitorUnitId(hwMonitorUnit.getMonitorUnitId()); + // 根据监控单元ID查询设备列表 + List hwDevicesByMonitor = hwDeviceMapper.selectHwDeviceListByMonitor(hwMonitorUnitDevice); + // 将查询到的设备列表添加到总列表中 + hwDevices.addAll(hwDevicesByMonitor); + } + + if (hwDevices.size()>0){ hwDevices.forEach(hwDevice -> { Long deviceId = hwDevice.getDeviceId(); HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction(); @@ -490,8 +532,20 @@ public class HwDeviceServiceImpl implements IHwDeviceService { Set functionIdentifiers = deviceLatestDataMap.keySet(); for (String dataFunctionIdentifier : functionIdentifiers) { if (functionIndentifierNameMap.get(dataFunctionIdentifier) != null) { + String unit; + if (dataFunctionIdentifier.equals("value1")){ + unit = hwDevieModeFunctionMapper.selectUbitByIdAndName("value",hwDevice.getDeviceModeId()); + }else { + unit = hwDevieModeFunctionMapper.selectUbitByIdAndName(dataFunctionIdentifier,hwDevice.getDeviceModeId()); + } + Object value; + if (unit == null){ + value = deviceLatestDataMap.get(dataFunctionIdentifier); + }else { + value = deviceLatestDataMap.get(dataFunctionIdentifier) + unit; + } ddValueMap.put(functionIndentifierNameMap.get(dataFunctionIdentifier), - deviceLatestDataMap.get(dataFunctionIdentifier)); + value); } } }); @@ -505,9 +559,17 @@ public class HwDeviceServiceImpl implements IHwDeviceService { hwDeviceVo.setDevicePic(hwDevice.getDevicePic()); hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE); hwDeviceVo.setDeviceDataMap(ddValueMap); + if (deviceLatestDataMapList.size()>0){ + String ts = deviceLatestDataMapList.get(0).get("ts").toString(); + DateTimeFormatter dateTime = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + ZonedDateTime parse = ZonedDateTime.parse(ts, dateTime); + Date updateTime = Date.from(parse.toInstant()); + hwDeviceVo.setUpdateTime(updateTime); + } acquisitionDeviceVos.add(hwDeviceVo); }); + } devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos); devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos); @@ -515,6 +577,26 @@ public class HwDeviceServiceImpl implements IHwDeviceService { return devicesMap; } + //TODO(zangch,2024.10.16):递归获取所有子孙节点,数据库数据太少没办法验证是否完全有效 +/* 根据节点ID获取所有子孙节点*/ + private List getAllHwMonitorUnits(List hwMonitorUnits,Long nodeId){ + // 创建一个空的列表,用于存储所有子节点 + List hwMonitorUnitList = new ArrayList<>(); + // 遍历所有节点 + for(HwMonitorUnit node :hwMonitorUnits){ + // 如果当前节点的父节点ID等于传入的节点ID + if (node.getParentId().equals(nodeId)){ + // 当前节点是直接子节点,加入结果集并继续寻找其子孙节点 + hwMonitorUnitList.add(node); + // 递归调用方法,获取当前节点的所有子孙节点 + hwMonitorUnitList.addAll(getAllHwMonitorUnits(hwMonitorUnits, node.getMonitorUnitId())); + } + } + // 返回所有子节点 + return hwMonitorUnitList; + } + + /** * 查询设备信息列表,join监控单元、设备模型等表 * @@ -524,6 +606,10 @@ public class HwDeviceServiceImpl implements IHwDeviceService { @Override @DataScope(tenantAlias = "hd") public List selectHwDeviceJoinList(HwDevice hwDevice) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwDevice.setTenantId(tenantId); return hwDeviceMapper.selectHwDeviceJoinList(hwDevice); } @@ -1124,4 +1210,504 @@ public class HwDeviceServiceImpl implements IHwDeviceService { return hwDeviceMapper.selectUnallocatedList(device); } + + /** + * + * 查询设备经纬度 + * */ + @Override + public List selectDeviceLatitudeAndLongitude(Long sceneId) { + //根据场景查询下面的设备 + HwDevice device = new HwDevice(); + device.setSceneId(sceneId); + List hwDevices = hwDeviceMapper.selectHwDeviceList(device); + Integer[] integers = hwMonitorUnitMapper.selectBeaconDeviceBySceneId(sceneId); + //调用tde查询每个设备的经纬度 + if (integers.length!=0){ + TdSelectDto tdSelectDto = new TdSelectDto(); + tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); + TdField tdField = new TdField(); + tdField.setFieldName("longitude"); + TdField tdField1 = new TdField(); + tdField1.setFieldName("latitude"); + List fields = new ArrayList(); + fields.add(tdField); + fields.add(tdField1); + tdSelectDto.setSchemaFieldValues(fields); + List lists = new ArrayList(); + for (int i = 0;i latestData = remoteTdEngineService.getLatestData(tdSelectDto, SecurityConstants.INNER); + Object data = latestData.getData(); + String s = JSONObject.toJSONString(data); + if (latestData.getCode()!=500){ + String substring = s.substring(1, s.length() - 1); + if (!substring.isEmpty()){ + Map map = JSONObject.parseObject(substring, Map.class); + if (map.size()>0){ +// BeaconDevice beaconDevice = new BeaconDevice(); +// beaconDevice.setDeviceId(hwDevices.get(i).getDeviceId()); +// beaconDevice.setDeviceName(hwDevices.get(i).getDeviceName()); +// beaconDevice.setLatitude(Double.valueOf( map.get("latitude").toString())); +// beaconDevice.setLongitude(Double.valueOf( map.get("longitude").toString())); +// beaconDevice.setRemark(hwDevices.get(i).getRemark()); +// beaconDevice.setDeviceLocation(hwDevices.get(i).getDeviceLocation()); +// beaconDevice.setDeviceLocation("白银市"); +// beaconDevice.setDeviceModeId(hwDevices.get(i).getDeviceModeId()); +// beaconDevice.setMonitorUnitName(hwDevices.get(i).getMonitorUnitName()); +// //查询是否报警 +// Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevices.get(i).getDeviceId()); +// Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevices.get(i).getDeviceId()); + String tableName = tdSelectDto.getTableName(); + int underscoreIndex = tableName.lastIndexOf('_'); + int deviceId = Integer.parseInt(tableName.substring(underscoreIndex + 1)); + Optional first = hwDevices.stream().filter(x -> x.getDeviceId() == deviceId).findFirst(); + HwDevice hwDevice = new HwDevice(); + if (first.isPresent()){ + hwDevice = first.get(); + }else { + continue; + } +// HwDevice hwDevice = hwDevices.stream().filter(x -> x.getDeviceId() == deviceId).findFirst().get(); +// if(hwDevice == null){ +// continue; +// } + + BeaconDevice beaconDevice = new BeaconDevice(); + beaconDevice.setDeviceId(hwDevice.getDeviceId()); + beaconDevice.setDeviceName(hwDevice.getDeviceName()); + beaconDevice.setLatitude(Double.valueOf( map.get("latitude").toString())); + beaconDevice.setLongitude(Double.valueOf( map.get("longitude").toString())); + beaconDevice.setRemark(hwDevice.getRemark()); + beaconDevice.setDeviceLocation(hwDevice.getDeviceLocation()); + beaconDevice.setDeviceLocation("白银市"); + beaconDevice.setDeviceModeId(hwDevice.getDeviceModeId()); + beaconDevice.setMonitorUnitName(hwDevice.getMonitorUnitName()); + //查询是否报警 + Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevice.getDeviceId()); + Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevice.getDeviceId()); + Boolean alarmElectronFence = false; + String ifAlarm = new String(); + if (integer>0){ + //正常 + ifAlarm="1"; + } + else { + ifAlarm="0"; + } + if (integer1>0){ + alarmElectronFence = true; + } + beaconDevice.setIfAlarm(ifAlarm); + beaconDevice.setAlarmElectronFence(alarmElectronFence); + lists.add(beaconDevice); + } + } + + } + + } + return lists; + } + return null; + + } + + /** + * 根据设备id查询信标设备历史数据 + * */ + @Override + public List> selectBeaconDevicesHistory(Map map) { + try{ + TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto(); + tdHistorySelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); + tdHistorySelectDto.setTableName(TdEngineConstants.DEFAULT_TABLE_NAME_PREFIX+map.get("deviceId")); + tdHistorySelectDto.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + if (map.get("pageSize")!=null){ + tdHistorySelectDto.setLimit(Integer.valueOf(map.get("pageSize").toString())); + } + if (map.get("pageSize")!=null&&map.get("pageNum")!=null){ + tdHistorySelectDto.setOffset(Integer.valueOf(map.get("pageSize").toString())*(Integer.valueOf(map.get("pageNum").toString())-1)); + } + tdHistorySelectDto.setOrderByFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE); + if (map.containsKey("startTime")&&map.get("startTime")!=null){ + tdHistorySelectDto.setStartTime(Timestamp.valueOf(map.get("startTime").toString()).getTime()); + } + if (map.containsKey("endTime")&&map.get("endTime")!=null){ + tdHistorySelectDto.setEndTime(Timestamp.valueOf(map.get("endTime").toString()).getTime()); + } + R historyData = remoteTdEngineService.getHistoryData(tdHistorySelectDto, SecurityConstants.INNER); + System.out.println("查询历史数据"+map.get("deviceId")); + List> dataList = historyData.getData().dataList; + for (int i = 0; i < dataList.size(); i++){ + dataList.get(i).put("deviceId",map.get("deviceId")); + } + int count = historyData.getData().count; + Map map1 = new HashMap<>(); + map1.put("total",count); + dataList.add(map1); + return dataList; + }catch (Exception ex){ + return null; + } + } + + /** + * 根据设备id查询其对应的监控单元 + * */ + @Override + public HwMonitorUnit selectMonitorUnit(Long deviceId) { + HwMonitorUnit hwMonitorUnit = hwMonitorUnitMapper.selectMonitorUnit(deviceId); + return hwMonitorUnit; + } + + /** + * 历史数据弹出框(多参数且可多选) + * */ + @Override + public List> selectHistoryDevice(Map map) { + //1-趋势分析 2历史数据 + //如果是趋势分析就删除分页 + Long pageSize = 0l; + if (map.get("type")!=null){ + if (map.get("type").toString().equals("1")){ + map.remove("pageSize"); + map.remove("pageNum"); + } + else { + pageSize = Long.valueOf(map.get("pageSize").toString()); + } + } + + String deviceIds = map.get("deviceIds").toString(); + String[] str = deviceIds.split(","); + map.replace("pageSize",pageSize/str.length); + List> list = new ArrayList>(); + Long total = 0l; + for (int i = 0; i < str.length; i++) { + + + + map.put("deviceId",str[i]); + if (i== str.length-2){ + map.replace("pageSize",pageSize%str.length); + } + if (map.get("prop")!=null){ + //查询类型的字段名 + String s = hwDeviceMapper.selectPropBydeviceIdAndFunctionName(Long.valueOf(map.get("deviceId").toString()) + , map.get("prop").toString()); + map.put("functionIdentifier",s); + } + List> list1 = this.selectBeaconDevicesHistory(map); + total = total+Long.valueOf(list1.get(list1.size()-1).get("total").toString()); + list1.remove(list1.size()-1); + + List> list2 = new ArrayList>(); + //在弹出框中进行对比时,对历史数据进行过滤,根据传入的传感器类型 + + if (map.get("functionIdentifier")!=null) { + for (int x = 0; x < list1.size(); x++) { + //查看数据中是否拥有所需要的数据,没有进入下一循环 + if (list1.get(i).get(map.get("functionIdentifier").toString())==null){ + continue; + } + Map map2 = new HashMap(); + //获取出需要的数据存入返回值中 + map2.put("deviceId", list1.get(x).get("deviceId")); + map2.put("ts", list1.get(x).get("ts")); + map2.put("deviceName", list1.get(x).get("deviceName")); + map2.put("functionName", map.get("prop")); + map2.put("functionIdentifier", + list1.get(x).get(map.get("functionIdentifier").toString())); + list.add(map2); + } + } + else { + list.addAll(list1); + } + } + Long modeId = hwDeviceMapper.selectModeIdByDeviceId(deviceIds); + Map mapName = new HashMap(); + if (list.size()>0){ + Set strings = list.get(0).keySet(); + List list2 = new ArrayList(); + list2.addAll(strings); + for (int i = 0; i < list2.size(); i++) { + //查询类型的字段名 + String s = hwDeviceMapper.selectFunctionNameByFunctionIdentifier(list2.get(i),modeId); + mapName.put(list2.get(i),s); + } + list.add(mapName); + } + if (map.get("type")!=null&&map.get("type").equals("1") ){ + for (int i = 0; i < list.size(); i++) { + if (list.get(i).containsKey("valid")){ + list.get(i).remove("valid"); + } + if (list.get(i).containsKey("acc")){ + list.get(i).remove("acc"); + } + if (list.get(i).containsKey("version")){ + list.get(i).remove("version"); + } + if (list.get(i).containsKey("speed")){ + list.get(i).remove("speed"); + } + } + } + + Map mapTotal = new HashMap(); + mapTotal.put("total", total); + list.add(mapTotal); + return list; + } + + /** + * 返回一级、二级、传感器 + * */ + @Override + public List selectComparison() { + List sceneMap = hwSceneMapper.selectHwSceneListReturnMap(); + List unitMap = hwMonitorUnitMapper.selectMonitorUnitReturnMap(); + List deviceMap = hwDeviceMapper.selectDeviceList(); + for (int i = 0; i < unitMap.size(); i++) { + List list = new ArrayList(); + for (int j = 0; j < deviceMap.size(); j++) { + if (unitMap.get(i).getVoId().longValue() == deviceMap.get(j).getParentId().longValue()) { + list.add(deviceMap.get(j)); + } + } + unitMap.get(i).setVoList(list); + } + for (int i = 0; i < sceneMap.size(); i++) { + List list = new ArrayList(); + for (int j = 0; j < unitMap.size(); j++) { + if (sceneMap.get(i).getVoId().equals(unitMap.get(j).getParentId())) { + list.add(unitMap.get(j)); + } + } + sceneMap.get(i).setVoList(list); + } + + return sceneMap; + + + } + + /** + * 导出excel + * */ + @Override + public List> getExportDevice(Map map) { + map.remove("pageSize"); + map.remove("pageNum"); + String deviceIds = map.get("deviceIds").toString(); + String[] str = deviceIds.split(","); + List> exportList = new ArrayList>(); + for (int i = 0; i < str.length; i++) { + map.put("deviceId",str[i]); + + List> list1 = this.selectBeaconDevicesHistory(map); + list1.remove(list1.size()-1); + exportList.addAll(list1); + + } + return exportList; + } + + /** + * 查询租户下的所有信标设备下挂到监控单元 + * */ + @Override + public List getDeviceByAreaId(Long tenantId) { + //如果是管理员,则不对租户进行过滤,即可以看到城市下所有租户的设备信息 + if (tenantId==1l) + { + tenantId = null; + } + + /** + * 逻辑 + *先根据租户id查询所有的监控单元 + * 再根据监控单元查出所有信标设备然后返回 + * */ + HwMonitorUnit hwMonitorUnit = new HwMonitorUnit(); + hwMonitorUnit.setTenantId(tenantId); + List unitList = hwMonitorUnitMapper.selectMonitorUnitListHavAreaId(tenantId); + for (int i = 0; i < unitList.size(); i++){ + List deviceList = this.getDeviceListInMonitorUnit(unitList.get(i).getMonitorUnitId()); + unitList.get(i).setDevicesList(deviceList); + } +// List treeArea1 = hwDeviceMapper.getTreeArea(areaId); +// for (int i=0;i selectMonitorElectronic(Long deviceId) { + List hwElectronicFences = hwElectronicFenceMapper.selectMonitorElectronic(deviceId); + for (int i = 0; i < hwElectronicFences.size();i++){ + HwFenceArea hwFenceArea = new HwFenceArea(); + hwFenceArea.setElectronicFenceId(hwElectronicFences.get(i).getElectronicFenceId()); + List hwFenceAreaList = hwFenceAreaMapper.selectHwFenceAreaList(hwFenceArea); +// for (HwFenceArea fenceArea : hwFenceAreaList) { +// if (fenceArea.getAreaShapeFlag().equals("1")){ +// String[] points = fenceArea.getAreaRange().split("_"); +// StringBuilder areaRange = new StringBuilder(); +// for (String point : points) { +// areaRange.append(SEPARATOR_UNDERLINE); +// String[] location = point.split(","); +// double longitude = Double.parseDouble(location[0]); +// double latitude = Double.parseDouble(location[1]); +// double[] doubles = GpsCoordinateUtils.calWGS84toGCJ02(latitude, longitude); +// areaRange.append(doubles[1]).append(SEPARATOR_COMMA) +// .append(doubles[0]); +// } +// fenceArea.setAreaRange(areaRange.toString().replaceFirst(SEPARATOR_UNDERLINE, "")); +// } +// if (fenceArea.getAreaShapeFlag().equals("2")){ +// String areaRange = fenceArea.getAreaRange(); +// String[] points = areaRange.split(","); +// double longitude = Double.parseDouble(points[0]); +// double latitude = Double.parseDouble(points[1]); +// double[] doubles = GpsCoordinateUtils.calWGS84toGCJ02(latitude, longitude); +// fenceArea.setAreaRange(longitude+","+latitude+","+points[2]); +// } +// } + hwElectronicFences.get(i).setHwFenceAreaList(hwFenceAreaList); + } + return hwElectronicFences; + } + + + + //查询监控单元下的信标设备 + public List getDeviceListInMonitorUnit(Long monitorUnitId){ + List deviceListInMonitorUnit = hwDeviceMapper.getDeviceListInMonitorUnit(monitorUnitId); + Map map = new HashMap(); + map.put("pageNum","1"); + map.put("pageSize","1"); + for (int i=0;i0){ + //有未处理报警 + ifAlarm="1"; + } + else { + ifAlarm="0"; + } + List> list = this.selectBeaconDevicesHistory(map); +// list.remove(list.size()-1); + System.out.println(list); + for(int j=0;j map = JSON.parseObject(s2,LinkedHashMap.class, Feature.OrderedField); + Map linkedMap = new LinkedHashMap(); + Long along = 1l; + for (String key : map.keySet()){ + linkedMap.put(along, key); + along++; + } + array.put("Header",linkedMap); + return array; + } + + } + + @Override + public Map getDeviceLocation(Long deviceId) { + TdSelectDto tdSelectDto = new TdSelectDto(); + tdSelectDto.setDatabaseName("db_hwsaas"); + tdSelectDto.setTableName("t_device_"+deviceId); +// R> deviceLocation = remoteTdEngineService.getDeviceLocation(tdSelectDto, SecurityConstants.INNER); +// Map data = deviceLocation.getData(); + return null; + } + + /** + * 根据名字搜索信标设备 + * */ + @Override + public List selectMonitorUnitAndDeviceByName(Map map) { + String name = map.get("name").toString(); + HwMonitorUnit hwMonitorUnit= new HwMonitorUnit(); +// System.out.println(name); + hwMonitorUnit.setMonitorUnitName(name); + List monitorUnits = hwMonitorUnitMapper.selectHwMonitorUnitList(hwMonitorUnit); + HwDevice hwDevice = new HwDevice(); + hwDevice.setDeviceName(name); + List deviceList = hwDeviceMapper.selectHwDeviceList(hwDevice); + List stringList = new ArrayList(); + for (int i = 0; i < deviceList.size(); i++){ + HwMonitorUnit hwMonitorUnit1 = hwMonitorUnitMapper.selectMonitorUnit(deviceList.get(i).getDeviceId()); + monitorUnits.add(hwMonitorUnit1); + } + List collect = monitorUnits.stream().collect(Collectors.collectingAndThen( + Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(HwMonitorUnit::getMonitorUnitId)) + ),ArrayList::new)); + List deviceListReturn = new ArrayList(); + for (int i = 0; i < collect.size(); i++){ + deviceListReturn.addAll(this.getDeviceListInMonitorUnit(collect.get(i).getMonitorUnitId())); + + } + return deviceListReturn; + } + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java index f6a373b..f19b47e 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.ruoyi.business.domain.HwAlarmInfo; import com.ruoyi.business.domain.HwElectronicFence; import com.ruoyi.business.domain.HwFenceArea; +import com.ruoyi.business.domain.HwFenceTarget; import com.ruoyi.business.domain.VO.AlarmInfoVo; import com.ruoyi.business.domain.VO.ElectronicFenceVo; import com.ruoyi.business.mapper.HwAlarmInfoMapper; @@ -17,6 +18,8 @@ import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.datascope.annotation.DataScope; import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -218,7 +221,12 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { hwElectronicFence.setFencePushFlag(HwDictConstants.FENCE_PUSH_FLAG_NO); hwElectronicFence.setFenceType(HwDictConstants.FENCE_TYPE_SCENE); hwElectronicFence.setCreateTime(DateUtils.getNowDate()); + HwFenceTarget hwFenceTarget = new HwFenceTarget(); int rows = hwElectronicFenceMapper.insertHwElectronicFence(hwElectronicFence); + hwFenceTarget.setElectronicFenceId(hwElectronicFence.getElectronicFenceId()); + hwFenceTarget.setTargetId(hwElectronicFence.getDeviceId()); + hwFenceTarget.setTargetType("1"); + hwFenceTargetMapper.insertHwFenceTarget(hwFenceTarget); this.batchInsertFenceArea(hwElectronicFence); return rows; } @@ -331,6 +339,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds) { //逻辑删除,修改触发状态为9 int rows = hwElectronicFenceMapper.deleteHwElectronicFenceByElectronicFenceIds(electronicFenceIds); + int targetRows = hwFenceTargetMapper.deleteHwFenceTargetByFenceId(electronicFenceIds); // hwElectronicFenceMapper.deleteHwFenceAreaByElectronicFenceIds(electronicFenceIds); return rows; } @@ -356,6 +365,10 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { @Override @DataScope(tenantAlias = "hef") public List selectHwElectronicFenceJoinList(HwElectronicFence hwElectronicFence) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwElectronicFence.setTenantId(tenantId); return hwElectronicFenceMapper.selectHwElectronicFenceJoinList(hwElectronicFence); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java index c6c2c8c..361ff79 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java @@ -124,6 +124,11 @@ public class HwMonitorPlatformServiceImpl implements IHwMonitorPlatformService { } } + deviceDataColumnVos.remove(3); + DeviceDataColumnVo deviceDataColumnVo = deviceDataColumnVos.get(5); + DeviceDataColumnVo deviceDataColumnVo1 = deviceDataColumnVos.get(deviceDataColumnVos.size()-1); + deviceDataColumnVos.set(5,deviceDataColumnVo1); + deviceDataColumnVos.set(deviceDataColumnVos.size()-1,deviceDataColumnVo); returnObj.put("deviceDataColumns", deviceDataColumnVos); returnObj.put("latestData", latestDataMaps); return returnObj; diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitAttributeServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitAttributeServiceImpl.java new file mode 100644 index 0000000..292876a --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitAttributeServiceImpl.java @@ -0,0 +1,116 @@ +package com.ruoyi.business.service.impl; + + +import com.ruoyi.business.domain.HwMonitorUnitAttribute; +import com.ruoyi.business.mapper.HwMonitorUnitAttributeDao; +import com.ruoyi.business.service.HwMonitorUnitAttributeService; +import com.ruoyi.common.security.utils.SecurityUtils; +import org.springframework.stereotype.Service; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * 监控单元属性表(HwMonitorUnitAttribute)表服务实现类 + * + * @author makejava + * @since 2024-09-04 13:20:34 + */ +@Service("hwMonitorUnitAttributeService") +public class HwMonitorUnitAttributeServiceImpl implements HwMonitorUnitAttributeService { + @Resource + private HwMonitorUnitAttributeDao hwMonitorUnitAttributeDao; + + /** + * 通过ID查询单条数据 + * + * @param attributeId 主键 + * @return 实例对象 + */ + @Override + public HwMonitorUnitAttribute queryById(Long attributeId) { + return this.hwMonitorUnitAttributeDao.queryById(attributeId); + } + + /** + * 分页查询 + * + * @param hwMonitorUnitAttribute 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + @Override + public Page queryByPage(HwMonitorUnitAttribute hwMonitorUnitAttribute, PageRequest pageRequest) { + long total = this.hwMonitorUnitAttributeDao.count(hwMonitorUnitAttribute); + return new PageImpl<>(this.hwMonitorUnitAttributeDao.queryAllByLimit(hwMonitorUnitAttribute, pageRequest), pageRequest, total); + } + + /** + * 新增数据 + * + * @param hwMonitorUnitAttribute 实例对象 + * @return 实例对象 + */ + @Override + public HwMonitorUnitAttribute insert(HwMonitorUnitAttribute hwMonitorUnitAttribute) { + this.hwMonitorUnitAttributeDao.insert(hwMonitorUnitAttribute); + return hwMonitorUnitAttribute; + } + + /** + * 修改数据 + * + * @param hwMonitorUnitAttribute 实例对象 + * @return 实例对象 + */ + @Override + public HwMonitorUnitAttribute update(HwMonitorUnitAttribute hwMonitorUnitAttribute) { + this.hwMonitorUnitAttributeDao.update(hwMonitorUnitAttribute); + return this.queryById(hwMonitorUnitAttribute.getAttributeId()); + } + + /** + * 通过主键删除数据 + * + * @param attributeId 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long attributeId) { + return this.hwMonitorUnitAttributeDao.deleteById(attributeId) > 0; + } + + @Override + public int addUnitAttribute(HwMonitorUnitAttribute hwMonitorUnitAttribute) { + hwMonitorUnitAttribute.setCreateBy(SecurityUtils.getUsername()); + hwMonitorUnitAttribute.setCreateTime(new Date()); + return hwMonitorUnitAttributeDao.insert(hwMonitorUnitAttribute); + } + + @Override + public List selectAttributeByUnitId(Long monitorUnitId) { + return hwMonitorUnitAttributeDao.selectAttributeByUnitId(monitorUnitId); + } + + @Override + public int updateAttributeByUniitId(HwMonitorUnitAttribute hwMonitorUnitAttribute) { + return hwMonitorUnitAttributeDao.updateAttributeByUniitId(hwMonitorUnitAttribute); + + } + + @Override + public List selectAttributes(Long aLong) { + return hwMonitorUnitAttributeDao.selectAttributes(aLong); + } + + @Override + public int deleteAttributeByUniitId(Long unitId) { + return hwMonitorUnitAttributeDao.deleteAttributeByUniitId(unitId); + } + + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java index ed28dc4..c603d5f 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.business.domain.VO.*; import com.ruoyi.business.mapper.HwAlarmInfoMapper; import com.ruoyi.business.mapper.HwDeviceMapper; import com.ruoyi.business.mapper.HwElectronicFenceMapper; + import com.ruoyi.business.mapper.HwMonitorUnitMapper; import com.ruoyi.business.service.IHwMonitorUnitService; import com.ruoyi.common.core.constant.HwDictConstants; @@ -15,6 +16,9 @@ import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.NumberUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.datascope.annotation.DataScope; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.tdengine.api.RemoteTdEngineService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -71,8 +75,11 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService { // Integer value = monitorUnitMap.get(key); // System.out.println(key+"\t"+value); // } - List list = hwMonitorUnitMapper.selectMonitorPercentage(); - List hwScenes = hwMonitorUnitMapper.selectSceneNameById(); + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + List list = hwMonitorUnitMapper.selectMonitorPercentage(tenantId); + List hwScenes = hwMonitorUnitMapper.selectSceneNameById(tenantId); list.stream().forEach(l -> { for (int i = 0; i < hwScenes.size(); i++) { if (l.getSceneId().equals(hwScenes.get(i).getSceneId())) { @@ -125,13 +132,20 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService { //获取总的设备数量与监控单元数量(标准场景使用) @Override public AllNumsVo selectAllNums(Long sceneId) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); //监控单元数量 - Integer monitor = hwMonitorUnitMapper.selectSubSetNums(sceneId) == null ? 0 - : hwMonitorUnitMapper.selectSubSetNums(sceneId); + Integer monitor = hwMonitorUnitMapper.selectSubSetNums(tenantId,sceneId) == null ? 0 + : hwMonitorUnitMapper.selectSubSetNums(tenantId,sceneId); //查询设备数量(子设备和直连设备),不包括网关 - Integer integer = hwMonitorUnitMapper.selectDeviceNums(sceneId) == null ? 0 - : hwMonitorUnitMapper.selectDeviceNums(sceneId); + Integer integer = hwMonitorUnitMapper.selectDeviceNums(sceneId,tenantId) == null ? 0 + : hwMonitorUnitMapper.selectDeviceNums(sceneId,tenantId); + //查询信标设备数量 + Integer beaconNums = hwMonitorUnitMapper.selectBeaconDeviceNums(sceneId) ==null ? 0 + :hwMonitorUnitMapper.selectBeaconDeviceNums(sceneId); AllNumsVo vo = new AllNumsVo(); + vo.setBeaconDeviceSum(beaconNums); vo.setSubSum(monitor); vo.setSum(integer); return vo; @@ -175,10 +189,13 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService { AllNumsVo numsVo = selectAllNums(sceneId); //获取在线设备数量,获取已发布状态子设备并且关联网关为在线的数量以及在线状态发布状态的直连设备数量之和 int onlineDeviceNum = hwDeviceMapper.getOnlineDeviceNum(sceneId); - + //查询信标设备数量 + Integer beaconNums = hwMonitorUnitMapper.selectBeaconDeviceNums(sceneId) ==null ? 0 + :hwMonitorUnitMapper.selectBeaconDeviceNums(sceneId); SubDeviceSumVo subDeviceSumVo = new SubDeviceSumVo(); subDeviceSumVo.setSubSum(numsVo.getSubSum());//监控单元数量 - subDeviceSumVo.setDeviceNum(numsVo.getSum());//设备数量 + subDeviceSumVo.setDeviceNum(beaconNums);//信标设备数量 +// subDeviceSumVo.setDeviceNum(numsVo.getSum());//设备数量 subDeviceSumVo.setOnlineDeviceNum(onlineDeviceNum);//在线设备数量 return subDeviceSumVo; @@ -421,6 +438,10 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService { @DataScope(tenantAlias = "hmu") public List selectHwMonitorUnitJoinList(HwMonitorUnit hwMonitorUnit) { hwMonitorUnit.setMonitorUnitStatus(HwDictConstants.MONITOR_UNIT_STATUS_NORMAL); + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + hwMonitorUnit.setTenantId(tenantId); return hwMonitorUnitMapper.selectHwMonitorUnitJoinList(hwMonitorUnit); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitTypeServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitTypeServiceImpl.java index 16e8c46..a36a5fb 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitTypeServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitTypeServiceImpl.java @@ -8,6 +8,9 @@ import com.ruoyi.business.mapper.HwMonitorUnitMapper; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.datascope.annotation.DataScope; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.business.mapper.HwMonitorUnitTypeMapper; @@ -125,6 +128,9 @@ public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService { @Override @DataScope(tenantAlias = "hmut") public List selectHwMonitorUnitTypeJoinList(HwMonitorUnitType hwMonitorUnitType) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser user = loginUser.getSysUser(); + hwMonitorUnitType.setTenantId(user.getTenantId()); return hwMonitorUnitTypeMapper.selectHwMonitorUnitTypeJoinList(hwMonitorUnitType); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java new file mode 100644 index 0000000..e856116 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java @@ -0,0 +1,34 @@ +package com.ruoyi.business.service.impl; + +import com.ruoyi.business.domain.HwOfflineRule; +import com.ruoyi.business.mapper.HwOfflineRuleMapper; +import com.ruoyi.business.service.HwOfflineRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class HwOfflineRuleServiceImpl implements HwOfflineRuleService { + @Autowired + private HwOfflineRuleMapper hwOfflineRuleMapper; + @Override + public List selectRuleList(HwOfflineRule hwOfflineRule) { + List hwOfflineRules = hwOfflineRuleMapper.selectHwOfflineRuleJoinList(hwOfflineRule); + return hwOfflineRules; + } + + @Override + public HwOfflineRule selectOfflineRuleById(Long offlineRuleId) { + return hwOfflineRuleMapper.selectOfflineRuleById(offlineRuleId); + } + + @Override + public int deleteOfflineRuleById(Long offlineRuleId) { + return hwOfflineRuleMapper.deleteOfflineRuleById(offlineRuleId); + } + + @Override + public int addOfflineRule(HwOfflineRule hwOfflineRule) { + return hwOfflineRuleMapper.addOfflineRule(hwOfflineRule); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java index ea99200..2ffcf9b 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java @@ -80,6 +80,8 @@ public class HwSceneServiceImpl implements IHwSceneService { @Override public List selectHwSceneJoinList(HwSceneVo hwScene) { + Long tenantId = SecurityUtils.getTenantId(); + hwScene.setTenantId(tenantId); hwScene.setSceneStatus(HwDictConstants.SCENE_STATUS_NORMAL); return hwSceneMapper.selectHwSceneVoList(hwScene); } @@ -249,6 +251,9 @@ public class HwSceneServiceImpl implements IHwSceneService { * @date 2023-09-26 18:19 */ private void updateDefaultFlag(HwScene hwScene) { + if (hwScene.getDefaultFlag() == null){ + hwScene.setDefaultFlag("0"); + } if (hwScene.getDefaultFlag().equals(HwDictConstants.SCENE_DEFAULT_FLAG_YES)) { HwScene queryScene = new HwScene(); queryScene.setTenantId(hwScene.getTenantId()); diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelClassField.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelClassField.java new file mode 100644 index 0000000..276386b --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelClassField.java @@ -0,0 +1,77 @@ +package com.ruoyi.business.utils; + +import java.util.LinkedHashMap; + +/** + * @author sunnyzyq + * @date 2021/12/17 + */ +public class ExcelClassField { + + /** 字段名称 */ + private String fieldName; + + /** 表头名称 */ + private String name; + + /** 映射关系 */ + private LinkedHashMap kvMap; + + /** 示例值 */ + private Object example; + + /** 排序 */ + private int sort; + + /** 是否为注解字段:0-否,1-是 */ + private int hasAnnotation; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public LinkedHashMap getKvMap() { + return kvMap; + } + + public void setKvMap(LinkedHashMap kvMap) { + this.kvMap = kvMap; + } + + public Object getExample() { + return example; + } + + public void setExample(Object example) { + this.example = example; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getHasAnnotation() { + return hasAnnotation; + } + + public void setHasAnnotation(int hasAnnotation) { + this.hasAnnotation = hasAnnotation; + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelExport.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelExport.java new file mode 100644 index 0000000..47d689d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelExport.java @@ -0,0 +1,28 @@ +package com.ruoyi.business.utils; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author sunnyzyq + * @date 2021/12/17 + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface ExcelExport { + + /** 字段名称 */ + String value(); + + /** 导出排序先后: 数字越小越靠前(默认按Java类字段顺序导出) */ + int sort() default 0; + + /** 导出映射,格式如:0-未知;1-男;2-女 */ + String kv() default ""; + + /** 导出模板示例值(有值的话,直接取该值,不做映射) */ + String example() default ""; + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelImport.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelImport.java new file mode 100644 index 0000000..96f270d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelImport.java @@ -0,0 +1,31 @@ +package com.ruoyi.business.utils; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author sunnyzyq + * @date 2021/12/17 + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface ExcelImport { + + /** 字段名称 */ + String value(); + + /** 导出映射,格式如:0-未知;1-男;2-女 */ + String kv() default ""; + + /** 是否为必填字段(默认为非必填) */ + boolean required() default false; + + /** 最大长度(默认255) */ + int maxLength() default 255; + + /** 导入唯一性验证(多个字段则取联合验证) */ + boolean unique() default false; + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelUtils.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelUtils.java new file mode 100644 index 0000000..70d803b --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/ExcelUtils.java @@ -0,0 +1,1162 @@ +package com.ruoyi.business.utils; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.apache.poi.hssf.usermodel.HSSFDataValidation; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFClientAnchor; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.net.URL; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.Map.Entry; +import java.util.regex.Pattern; + +/** + * Excel导入导出工具类 + * 原文链接(不定时增加新功能): https://zyqok.blog.csdn.net/article/details/121994504 + * + * @author sunnyzyq + * @date 2021/12/17 + */ +@SuppressWarnings("unused") +public class ExcelUtils { + + private static final String XLSX = ".xlsx"; + private static final String XLS = ".xls"; + public static final String ROW_MERGE = "row_merge"; + public static final String COLUMN_MERGE = "column_merge"; + private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; + private static final String ROW_NUM = "rowNum"; + private static final String ROW_DATA = "rowData"; + private static final String ROW_TIPS = "rowTips"; + private static final int CELL_OTHER = 0; + private static final int CELL_ROW_MERGE = 1; + private static final int CELL_COLUMN_MERGE = 2; + private static final int IMG_HEIGHT = 30; + private static final int IMG_WIDTH = 30; + private static final char LEAN_LINE = '/'; + private static final int BYTES_DEFAULT_LENGTH = 10240; + private static final NumberFormat NUMBER_FORMAT = NumberFormat.getNumberInstance(); + + + public static List readFile(File file, Class clazz) throws Exception { + JSONArray array = readFile(file); + return getBeanList(array, clazz); + } + + public static List readMultipartFile(MultipartFile mFile, Class clazz) throws Exception { + JSONArray array = readMultipartFile(mFile); + return getBeanList(array, clazz); + } + + public static JSONArray readFile(File file) throws Exception { + return readExcel(null, file); + } + + public static JSONArray readMultipartFile(MultipartFile mFile) throws Exception { + return readExcel(mFile, null); + } + + public static Map readFileManySheet(File file) throws Exception { + return readExcelManySheet(null, file); + } + + public static Map readFileManySheet(MultipartFile file) throws Exception { + return readExcelManySheet(file, null); + } + + private static List getBeanList(JSONArray array, Class clazz) throws Exception { + List list = new ArrayList<>(); + Map uniqueMap = new HashMap<>(16); + for (int i = 0; i < array.size(); i++) { + list.add(getBean(clazz, array.getJSONObject(i), uniqueMap)); + } + return list; + } + + /** + * 获取每个对象的数据 + */ + private static T getBean(Class c, JSONObject obj, Map uniqueMap) throws Exception { + T t = c.newInstance(); + Field[] fields = c.getDeclaredFields(); + List errMsgList = new ArrayList<>(); + boolean hasRowTipsField = false; + StringBuilder uniqueBuilder = new StringBuilder(); + int rowNum = 0; + for (Field field : fields) { + // 行号 + if (field.getName().equals(ROW_NUM)) { + rowNum = obj.getInteger(ROW_NUM); + field.setAccessible(true); + field.set(t, rowNum); + continue; + } + // 是否需要设置异常信息 + if (field.getName().equals(ROW_TIPS)) { + hasRowTipsField = true; + continue; + } + // 原始数据 + if (field.getName().equals(ROW_DATA)) { + field.setAccessible(true); + field.set(t, obj.toString()); + continue; + } + // 设置对应属性值 + setFieldValue(t, field, obj, uniqueBuilder, errMsgList); + } + // 数据唯一性校验 + if (uniqueBuilder.length() > 0) { + if (uniqueMap.containsValue(uniqueBuilder.toString())) { + Set rowNumKeys = uniqueMap.keySet(); + for (Integer num : rowNumKeys) { + if (uniqueMap.get(num).equals(uniqueBuilder.toString())) { + errMsgList.add(String.format("数据唯一性校验失败,(%s)与第%s行重复)", uniqueBuilder, num)); + } + } + } else { + uniqueMap.put(rowNum, uniqueBuilder.toString()); + } + } + // 失败处理 + if (errMsgList.isEmpty() && !hasRowTipsField) { + return t; + } + StringBuilder sb = new StringBuilder(); + int size = errMsgList.size(); + for (int i = 0; i < size; i++) { + if (i == size - 1) { + sb.append(errMsgList.get(i)); + } else { + sb.append(errMsgList.get(i)).append(";"); + } + } + // 设置错误信息 + for (Field field : fields) { + if (field.getName().equals(ROW_TIPS)) { + field.setAccessible(true); + field.set(t, sb.toString()); + } + } + return t; + } + + private static void setFieldValue(T t, Field field, JSONObject obj, StringBuilder uniqueBuilder, List errMsgList) { + // 获取 ExcelImport 注解属性 + ExcelImport annotation = field.getAnnotation(ExcelImport.class); + if (annotation == null) { + return; + } + String cname = annotation.value(); + if (cname.trim().length() == 0) { + return; + } + // 获取具体值 + String val = null; + if (obj.containsKey(cname)) { + val = getString(obj.getString(cname)); + } + if (val == null) { + return; + } + field.setAccessible(true); + // 判断是否必填 + boolean require = annotation.required(); + if (require && val.isEmpty()) { + errMsgList.add(String.format("[%s]不能为空", cname)); + return; + } + // 数据唯一性获取 + boolean unique = annotation.unique(); + if (unique) { + if (uniqueBuilder.length() > 0) { + uniqueBuilder.append("--").append(val); + } else { + uniqueBuilder.append(val); + } + } + // 判断是否超过最大长度 + int maxLength = annotation.maxLength(); + if (maxLength > 0 && val.length() > maxLength) { + errMsgList.add(String.format("[%s]长度不能超过%s个字符(当前%s个字符)", cname, maxLength, val.length())); + } + // 判断当前属性是否有映射关系 + LinkedHashMap kvMap = getKvMap(annotation.kv()); + if (!kvMap.isEmpty()) { + boolean isMatch = false; + for (String key : kvMap.keySet()) { + if (kvMap.get(key).equals(val)) { + val = key; + isMatch = true; + break; + } + } + if (!isMatch) { + errMsgList.add(String.format("[%s]的值不正确(当前值为%s)", cname, val)); + return; + } + } + // 其余情况根据类型赋值 + String fieldClassName = field.getType().getSimpleName(); + try { + if ("String".equalsIgnoreCase(fieldClassName)) { + field.set(t, val); + } else if ("boolean".equalsIgnoreCase(fieldClassName)) { + field.set(t, Boolean.valueOf(val)); + } else if ("int".equalsIgnoreCase(fieldClassName) || "Integer".equals(fieldClassName)) { + try { + field.set(t, Integer.valueOf(val)); + } catch (NumberFormatException e) { + errMsgList.add(String.format("[%s]的值格式不正确(当前值为%s)", cname, val)); + } + } else if ("double".equalsIgnoreCase(fieldClassName)) { + field.set(t, Double.valueOf(val)); + } else if ("long".equalsIgnoreCase(fieldClassName)) { + field.set(t, Long.valueOf(val)); + } else if ("BigDecimal".equalsIgnoreCase(fieldClassName)) { + field.set(t, new BigDecimal(val)); + } else if ("Date".equalsIgnoreCase(fieldClassName)) { + try { + field.set(t, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(val)); + } catch (Exception e) { + field.set(t, new SimpleDateFormat("yyyy-MM-dd").parse(val)); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static Map readExcelManySheet(MultipartFile mFile, File file) throws IOException { + Workbook book = getWorkbook(mFile, file); + if (book == null) { + return Collections.emptyMap(); + } + Map map = new LinkedHashMap<>(); + for (int i = 0; i < book.getNumberOfSheets(); i++) { + Sheet sheet = book.getSheetAt(i); + JSONArray arr = readSheet(sheet); + map.put(sheet.getSheetName(), arr); + } + book.close(); + return map; + } + + private static JSONArray readExcel(MultipartFile mFile, File file) throws IOException { + Workbook book = getWorkbook(mFile, file); + if (book == null) { + return new JSONArray(); + } + JSONArray array = readSheet(book.getSheetAt(0)); + book.close(); + return array; + } + + private static Workbook getWorkbook(MultipartFile mFile, File file) throws IOException { + boolean fileNotExist = (file == null || !file.exists()); + if (mFile == null && fileNotExist) { + return null; + } + // 解析表格数据 + InputStream in; + String fileName; + if (mFile != null) { + // 上传文件解析 + in = mFile.getInputStream(); + fileName = getString(mFile.getOriginalFilename()).toLowerCase(); + } else { + // 本地文件解析 + in = new FileInputStream(file); + fileName = file.getName().toLowerCase(); + } + Workbook book; + if (fileName.endsWith(XLSX)) { + book = new XSSFWorkbook(in); + } else if (fileName.endsWith(XLS)) { + POIFSFileSystem poifsFileSystem = new POIFSFileSystem(in); + book = new HSSFWorkbook(poifsFileSystem); + } else { + return null; + } + in.close(); + return book; + } + + private static JSONArray readSheet(Sheet sheet) { + // 首行下标 + int rowStart = sheet.getFirstRowNum(); + // 尾行下标 + int rowEnd = sheet.getLastRowNum(); + //行数 + int lastRowNum = sheet.getLastRowNum()+1; + int row = 0; +// Row row = sheet.getRow(5); +// short lastCellNum = row.getLastCellNum(); + for (int x=0;x keyMap = new LinkedHashMap<>(); + for (int j = cellStart; j < cellEnd; j++) { + // 获取表头数据 + String val = getCellValue(headRow.getCell(j)); + if (val != null && val.trim().length() != 0) { + keyMap.put(j, val); + } + else { + keyMap.put(j,"第"+(j+1)+"列"); + } + } + // 如果表头没有数据则不进行解析 +// if (keyMap.isEmpty()) { +// return (JSONArray) Collections.emptyList(); +// } + // 获取每行JSON对象的值 + JSONArray array = new JSONArray(); + // 如果首行与尾行相同,表明只有一行,返回表头数据 + if (rowStart == rowEnd) { + JSONObject obj = new JSONObject(); + // 添加行号 +// obj.put(ROW_NUM, 1); + for (int i : keyMap.keySet()) { + obj.put(keyMap.get(i), ""); + } + array.add(obj); + return array; + } + for (int i = rowStart + 1; i <= rowEnd; i++) { + Row eachRow = sheet.getRow(i); + JSONObject obj = new JSONObject(true); + // 添加行号 +// obj.put(ROW_NUM, i + 1); + StringBuilder sb = new StringBuilder(); + for (int k = cellStart; k < cellEnd; k++) { + if (eachRow != null) { + String val = getCellValue(eachRow.getCell(k)); + // 所有数据添加到里面,用于判断该行是否为空 + sb.append(val); + obj.put(keyMap.get(k), val); + } + } + if (sb.length() > 0) { + array.add(obj); + } + } + return array; + } + + private static String getCellValue(Cell cell) { + // 空白或空 + if (cell == null || cell.getCellTypeEnum() == CellType.BLANK) { + return ""; + } + // String类型 + if (cell.getCellTypeEnum() == CellType.STRING) { + String val = cell.getStringCellValue(); + if (val == null || val.trim().length() == 0) { + return ""; + } + return val.trim(); + } + // 数字类型 + if (cell.getCellTypeEnum() == CellType.NUMERIC) { + String s = cell.getNumericCellValue() + ""; + // 去掉尾巴上的小数点0 + if (Pattern.matches(".*\\.0*", s)) { + return s.split("\\.")[0]; + } else { + return s; + } + } + // 布尔值类型 + if (cell.getCellTypeEnum() == CellType.BOOLEAN) { + return cell.getBooleanCellValue() + ""; + } + // 错误类型 + return cell.getCellFormula(); + } + + public static void exportTemplate(HttpServletResponse response, String fileName, Class clazz) { + exportTemplate(response, fileName, fileName, clazz, false); + } + + public static void exportTemplate(HttpServletResponse response, String fileName, String sheetName, + Class clazz) { + exportTemplate(response, fileName, sheetName, clazz, false); + } + + public static void exportTemplate(HttpServletResponse response, String fileName, Class clazz, + boolean isContainExample) { + exportTemplate(response, fileName, fileName, clazz, isContainExample); + } + + public static void exportTemplate(HttpServletResponse response, String fileName, String sheetName, + Class clazz, boolean isContainExample) { + // 获取表头字段 + List headFieldList = getExcelClassFieldList(clazz); + // 获取表头数据和示例数据 + List> sheetDataList = new ArrayList<>(); + List headList = new ArrayList<>(); + List exampleList = new ArrayList<>(); + Map> selectMap = new LinkedHashMap<>(); + for (int i = 0; i < headFieldList.size(); i++) { + ExcelClassField each = headFieldList.get(i); + headList.add(each.getName()); + exampleList.add(each.getExample()); + LinkedHashMap kvMap = each.getKvMap(); + if (kvMap != null && kvMap.size() > 0) { + selectMap.put(i, new ArrayList<>(kvMap.values())); + } + } + sheetDataList.add(headList); + if (isContainExample) { + sheetDataList.add(exampleList); + } + // 导出数据 + export(response, fileName, sheetName, sheetDataList, selectMap); + } + + private static List getExcelClassFieldList(Class clazz) { + // 解析所有字段 + Field[] fields = clazz.getDeclaredFields(); + boolean hasExportAnnotation = false; + Map> map = new LinkedHashMap<>(); + List sortList = new ArrayList<>(); + for (Field field : fields) { + ExcelClassField cf = getExcelClassField(field); + if (cf.getHasAnnotation() == 1) { + hasExportAnnotation = true; + } + int sort = cf.getSort(); + if (map.containsKey(sort)) { + map.get(sort).add(cf); + } else { + List list = new ArrayList<>(); + list.add(cf); + sortList.add(sort); + map.put(sort, list); + } + } + Collections.sort(sortList); + // 获取表头 + List headFieldList = new ArrayList<>(); + if (hasExportAnnotation) { + for (Integer sort : sortList) { + for (ExcelClassField cf : map.get(sort)) { + if (cf.getHasAnnotation() == 1) { + headFieldList.add(cf); + } + } + } + } else { + headFieldList.addAll(map.get(0)); + } + return headFieldList; + } + + private static ExcelClassField getExcelClassField(Field field) { + ExcelClassField cf = new ExcelClassField(); + String fieldName = field.getName(); + cf.setFieldName(fieldName); + ExcelExport annotation = field.getAnnotation(ExcelExport.class); + // 无 ExcelExport 注解情况 + if (annotation == null) { + cf.setHasAnnotation(0); + cf.setName(fieldName); + cf.setSort(0); + return cf; + } + // 有 ExcelExport 注解情况 + cf.setHasAnnotation(1); + cf.setName(annotation.value()); + String example = getString(annotation.example()); + if (!example.isEmpty()) { + if (isNumeric(example) && example.length() < 8) { + cf.setExample(Double.valueOf(example)); + } else { + cf.setExample(example); + } + } else { + cf.setExample(""); + } + cf.setSort(annotation.sort()); + // 解析映射 + String kv = getString(annotation.kv()); + cf.setKvMap(getKvMap(kv)); + return cf; + } + + private static LinkedHashMap getKvMap(String kv) { + LinkedHashMap kvMap = new LinkedHashMap<>(); + if (kv.isEmpty()) { + return kvMap; + } + String[] kvs = kv.split(";"); + if (kvs.length == 0) { + return kvMap; + } + for (String each : kvs) { + String[] eachKv = getString(each).split("-"); + if (eachKv.length != 2) { + continue; + } + String k = eachKv[0]; + String v = eachKv[1]; + if (k.isEmpty() || v.isEmpty()) { + continue; + } + kvMap.put(k, v); + } + return kvMap; + } + + /** + * 导出表格到本地 + * + * @param file 本地文件对象 + * @param sheetData 导出数据 + */ + public static void exportFile(File file, List> sheetData) { + if (file == null) { + System.out.println("文件创建失败"); + return; + } + if (sheetData == null) { + sheetData = new ArrayList<>(); + } + Map>> map = new HashMap<>(); + map.put(file.getName(), sheetData); + export(null, file, file.getName(), map, null); + } + + /** + * 导出表格到本地 + * + * @param 导出数据类似,和K类型保持一致 + * @param filePath 文件父路径(如:D:/doc/excel/) + * @param fileName 文件名称(不带尾缀,如:学生表) + * @param list 导出数据 + * @throws IOException IO异常 + */ + public static File exportFile(String filePath, String fileName, List list) throws IOException { + File file = getFile(filePath, fileName); + List> sheetData = getSheetData(list); + exportFile(file, sheetData); + return file; + } + + /** + * 获取文件 + * + * @param filePath filePath 文件父路径(如:D:/doc/excel/) + * @param fileName 文件名称(不带尾缀,如:用户表) + * @return 本地File文件对象 + */ + private static File getFile(String filePath, String fileName) throws IOException { + String dirPath = getString(filePath); + String fileFullPath; + if (dirPath.isEmpty()) { + fileFullPath = fileName; + } else { + // 判定文件夹是否存在,如果不存在,则级联创建 + File dirFile = new File(dirPath); + if (!dirFile.exists()) { + boolean mkdirs = dirFile.mkdirs(); + if (!mkdirs) { + return null; + } + } + // 获取文件夹全名 + if (dirPath.endsWith(String.valueOf(LEAN_LINE))) { + fileFullPath = dirPath + fileName + XLSX; + } else { + fileFullPath = dirPath + LEAN_LINE + fileName + XLSX; + } + } + System.out.println(fileFullPath); + File file = new File(fileFullPath); + if (!file.exists()) { + boolean result = file.createNewFile(); + if (!result) { + return null; + } + } + return file; + } + + private static List> getSheetData(List list) { + // 获取表头字段 + List excelClassFieldList = getExcelClassFieldList(list.get(0).getClass()); + List headFieldList = new ArrayList<>(); + List headList = new ArrayList<>(); + Map headFieldMap = new HashMap<>(); + for (ExcelClassField each : excelClassFieldList) { + String fieldName = each.getFieldName(); + headFieldList.add(fieldName); + headFieldMap.put(fieldName, each); + headList.add(each.getName()); + } + // 添加表头名称 + List> sheetDataList = new ArrayList<>(); + sheetDataList.add(headList); + // 获取表数据 + for (T t : list) { + Map fieldDataMap = getFieldDataMap(t); + Set fieldDataKeys = fieldDataMap.keySet(); + List rowList = new ArrayList<>(); + for (String headField : headFieldList) { + if (!fieldDataKeys.contains(headField)) { + continue; + } + Object data = fieldDataMap.get(headField); + if (data == null) { + rowList.add(""); + continue; + } + ExcelClassField cf = headFieldMap.get(headField); + // 判断是否有映射关系 + LinkedHashMap kvMap = cf.getKvMap(); + if (kvMap == null || kvMap.isEmpty()) { + rowList.add(data); + continue; + } + String val = kvMap.get(data.toString()); + if (isNumeric(val)) { + rowList.add(Double.valueOf(val)); + } else { + rowList.add(val); + } + } + sheetDataList.add(rowList); + } + return sheetDataList; + } + + private static Map getFieldDataMap(T t) { + Map map = new HashMap<>(); + Field[] fields = t.getClass().getDeclaredFields(); + try { + for (Field field : fields) { + String fieldName = field.getName(); + field.setAccessible(true); + Object object = field.get(t); + map.put(fieldName, object); + } + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + return map; + } + + public static void exportEmpty(HttpServletResponse response, String fileName) { + List> sheetDataList = new ArrayList<>(); + List headList = new ArrayList<>(); + headList.add("导出无数据"); + sheetDataList.add(headList); + export(response, fileName, sheetDataList); + } + + public static void export(HttpServletResponse response, String fileName, List> sheetDataList) { + export(response, fileName, fileName, sheetDataList, null); + } + + public static void exportManySheet(HttpServletResponse response, String fileName, Map>> sheetMap) { + export(response, null, fileName, sheetMap, null); + } + + + public static void export(HttpServletResponse response, String fileName, String sheetName, + List> sheetDataList) { + export(response, fileName, sheetName, sheetDataList, null); + } + + public static void export(HttpServletResponse response, String fileName, String sheetName, + List> sheetDataList, Map> selectMap) { + + Map>> map = new HashMap<>(); + map.put(sheetName, sheetDataList); + export(response, null, fileName, map, selectMap); + } + + public static void export(HttpServletResponse response, String fileName, List list, Class template) { + // list 是否为空 + boolean lisIsEmpty = list == null || list.isEmpty(); + // 如果模板数据为空,且导入的数据为空,则导出空文件 + if (template == null && lisIsEmpty) { + exportEmpty(response, fileName); + return; + } + // 如果 list 数据,则导出模板数据 + if (lisIsEmpty) { + exportTemplate(response, fileName, template); + return; + } + // 导出数据 + List> sheetDataList = getSheetData(list); + export(response, fileName, sheetDataList); + } + + public static void export(HttpServletResponse response, String fileName, List> sheetDataList, Map> selectMap) { + export(response, fileName, fileName, sheetDataList, selectMap); + } + + private static void export(HttpServletResponse response, File file, String fileName, + Map>> sheetMap, Map> selectMap) { + // 整个 Excel 表格 book 对象 + SXSSFWorkbook book = new SXSSFWorkbook(); + // 每个 Sheet 页 + Set>>> entries = sheetMap.entrySet(); + for (Entry>> entry : entries) { + List> sheetDataList = entry.getValue(); + Sheet sheet = book.createSheet(entry.getKey()); + Drawing patriarch = sheet.createDrawingPatriarch(); + // 设置表头背景色(灰色) + CellStyle headStyle = book.createCellStyle(); + headStyle.setFillForegroundColor(IndexedColors.GREY_80_PERCENT.index); + headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + headStyle.setAlignment(HorizontalAlignment.CENTER); + headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index); + // 设置表身背景色(默认色) + CellStyle rowStyle = book.createCellStyle(); + rowStyle.setAlignment(HorizontalAlignment.CENTER); + rowStyle.setVerticalAlignment(VerticalAlignment.CENTER); + // 设置表格列宽度(默认为15个字节) + sheet.setDefaultColumnWidth(15); + // 创建合并算法数组 + int rowLength = sheetDataList.size(); + int columnLength = sheetDataList.get(0).size(); + int[][] mergeArray = new int[rowLength][columnLength]; + for (int i = 0; i < sheetDataList.size(); i++) { + // 每个 Sheet 页中的行数据 + Row row = sheet.createRow(i); + List rowList = sheetDataList.get(i); + for (int j = 0; j < rowList.size(); j++) { + // 每个行数据中的单元格数据 + Object o = rowList.get(j); + int v = 0; + if (o instanceof URL) { + // 如果要导出图片的话, 链接需要传递 URL 对象 + setCellPicture(book, row, patriarch, i, j, (URL) o); + } else { + Cell cell = row.createCell(j); + if (i == 0) { + // 第一行为表头行,采用灰色底背景 + v = setCellValue(cell, o, headStyle); + } else { + // 其他行为数据行,默认白底色 + v = setCellValue(cell, o, rowStyle); + } + } + mergeArray[i][j] = v; + } + } + // 合并单元格 + mergeCells(sheet, mergeArray); + // 设置下拉列表 + setSelect(sheet, selectMap); + } + // 写数据 + if (response != null) { + // 前端导出 + try { + write(response, book, fileName); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + // 本地导出 + FileOutputStream fos; + try { + fos = new FileOutputStream(file); + ByteArrayOutputStream ops = new ByteArrayOutputStream(); + book.write(ops); + fos.write(ops.toByteArray()); + fos.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + /** + * 合并当前Sheet页的单元格 + * + * @param sheet 当前 sheet 页 + * @param mergeArray 合并单元格算法 + */ + private static void mergeCells(Sheet sheet, int[][] mergeArray) { + // 横向合并 + for (int x = 0; x < mergeArray.length; x++) { + int[] arr = mergeArray[x]; + boolean merge = false; + int y1 = 0; + int y2 = 0; + for (int y = 0; y < arr.length; y++) { + int value = arr[y]; + if (value == CELL_COLUMN_MERGE) { + if (!merge) { + y1 = y; + } + y2 = y; + merge = true; + } else { + merge = false; + if (y1 > 0) { + sheet.addMergedRegion(new CellRangeAddress(x, x, (y1 - 1), y2)); + } + y1 = 0; + y2 = 0; + } + } + if (y1 > 0) { + sheet.addMergedRegion(new CellRangeAddress(x, x, (y1 - 1), y2)); + } + } + // 纵向合并 + int xLen = mergeArray.length; + int yLen = mergeArray[0].length; + for (int y = 0; y < yLen; y++) { + boolean merge = false; + int x1 = 0; + int x2 = 0; + for (int x = 0; x < xLen; x++) { + int value = mergeArray[x][y]; + if (value == CELL_ROW_MERGE) { + if (!merge) { + x1 = x; + } + x2 = x; + merge = true; + } else { + merge = false; + if (x1 > 0) { + sheet.addMergedRegion(new CellRangeAddress((x1 - 1), x2, y, y)); + } + x1 = 0; + x2 = 0; + } + } + if (x1 > 0) { + sheet.addMergedRegion(new CellRangeAddress((x1 - 1), x2, y, y)); + } + } + } + + private static void write(HttpServletResponse response, SXSSFWorkbook book, String fileName) throws IOException { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + String name = new String(fileName.getBytes("GBK"), "ISO8859_1") + XLSX; + response.addHeader("Content-Disposition", "attachment;filename=" + name); + ServletOutputStream out = response.getOutputStream(); + book.write(out); + out.flush(); + out.close(); + } + + private static int setCellValue(Cell cell, Object o, CellStyle style) { + // 设置样式 + cell.setCellStyle(style); + // 数据为空时 + if (o == null) { + cell.setCellType(CellType.STRING); + cell.setCellValue(""); + return CELL_OTHER; + } + // 是否为字符串 + if (o instanceof String) { + String s = o.toString(); + // 当数字类型长度超过8位时,改为字符串类型显示(Excel数字超过一定长度会显示为科学计数法) + if (isNumeric(s) && s.length() < 8) { + cell.setCellType(CellType.NUMERIC); + cell.setCellValue(Double.parseDouble(s)); + return CELL_OTHER; + } else { + cell.setCellType(CellType.STRING); + cell.setCellValue(s); + } + if (s.equals(ROW_MERGE)) { + return CELL_ROW_MERGE; + } else if (s.equals(COLUMN_MERGE)) { + return CELL_COLUMN_MERGE; + } else { + return CELL_OTHER; + } + } + // 是否为字符串 + if (o instanceof Integer || o instanceof Long || o instanceof Double || o instanceof Float) { + cell.setCellType(CellType.NUMERIC); + cell.setCellValue(Double.parseDouble(o.toString())); + return CELL_OTHER; + } + // 是否为Boolean + if (o instanceof Boolean) { + cell.setCellType(CellType.BOOLEAN); + cell.setCellValue((Boolean) o); + return CELL_OTHER; + } + // 如果是BigDecimal,则默认3位小数 + if (o instanceof BigDecimal) { + cell.setCellType(CellType.NUMERIC); + cell.setCellValue(((BigDecimal) o).setScale(3, RoundingMode.HALF_UP).doubleValue()); + return CELL_OTHER; + } + // 如果是Date数据,则显示格式化数据 + if (o instanceof Date) { + cell.setCellType(CellType.STRING); + cell.setCellValue(formatDate((Date) o)); + return CELL_OTHER; + } + // 如果是其他,则默认字符串类型 + cell.setCellType(CellType.STRING); + cell.setCellValue(o.toString()); + return CELL_OTHER; + } + + private static void setCellPicture(SXSSFWorkbook wb, Row sr, Drawing patriarch, int x, int y, URL url) { + // 设置图片宽高 + sr.setHeight((short) (IMG_WIDTH * IMG_HEIGHT)); + // (jdk1.7版本try中定义流可自动关闭) + try (InputStream is = url.openStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { + byte[] buff = new byte[BYTES_DEFAULT_LENGTH]; + int rc; + while ((rc = is.read(buff, 0, BYTES_DEFAULT_LENGTH)) > 0) { + outputStream.write(buff, 0, rc); + } + // 设置图片位置 + XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, y, x, y + 1, x + 1); + // 设置这个,图片会自动填满单元格的长宽 + anchor.setAnchorType(AnchorType.MOVE_AND_RESIZE); + patriarch.createPicture(anchor, wb.addPicture(outputStream.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static String formatDate(Date date) { + if (date == null) { + return ""; + } + SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT); + return format.format(date); + } + + private static void setSelect(Sheet sheet, Map> selectMap) { + if (selectMap == null || selectMap.isEmpty()) { + return; + } + Set>> entrySet = selectMap.entrySet(); + for (Entry> entry : entrySet) { + int y = entry.getKey(); + List list = entry.getValue(); + if (list == null || list.isEmpty()) { + continue; + } + String[] arr = new String[list.size()]; + for (int i = 0; i < list.size(); i++) { + arr[i] = list.get(i); + } + DataValidationHelper helper = sheet.getDataValidationHelper(); + CellRangeAddressList addressList = new CellRangeAddressList(1, 65000, y, y); + DataValidationConstraint dvc = helper.createExplicitListConstraint(arr); + DataValidation dv = helper.createValidation(dvc, addressList); + if (dv instanceof HSSFDataValidation) { + dv.setSuppressDropDownArrow(false); + } else { + dv.setSuppressDropDownArrow(true); + dv.setShowErrorBox(true); + } + sheet.addValidationData(dv); + } + } + + private static boolean isNumeric(String str) { + if (Objects.nonNull(str) && "0.0".equals(str)) { + return true; + } + for (int i = str.length(); --i >= 0; ) { + if (!Character.isDigit(str.charAt(i))) { + return false; + } + } + return true; + } + + private static String getString(String s) { + if (s == null) { + return ""; + } + if (s.isEmpty()) { + return s; + } + return s.trim(); + } + + /** + * 获取 Excel 文件表头信息 + * + * @param fileUrl + * @return + * @throws Exception + */ + public static List getExcelHeaders(MultipartFile fileUrl) throws Exception { + File file = multipartFile2File(fileUrl); + InputStream is = new FileInputStream(file); + Workbook workbook = new XSSFWorkbook(is); + Sheet sheet = workbook.getSheetAt(0); + System.out.println(sheet.getLastRowNum()); + //获取 excel 第一行数据(表头) + Row row = sheet.getRow(0); + //存放表头信息 + List headers = new ArrayList(); + Set set = new HashSet<>(); + //算下有多少列 + int colCount = sheet.getRow(0).getLastCellNum(); + System.out.println(colCount); + for (int j = 0; j < colCount; j++) { + Cell cell = row.getCell(j); + String cellValue = cell.getStringCellValue().trim(); + headers.add(cellValue); + } + return headers; + } + + /** + * 获取 Excel 文件信息(除去表头) + * + * @param fileUrl + * @return + * @throws Exception + */ + public static List> getExcelData(String fileUrl) throws Exception { + File file = new File(fileUrl); + InputStream is = new FileInputStream(file); + Workbook workbook = new XSSFWorkbook(is); + Sheet sheet = workbook.getSheetAt(0); + //获取 Excel 中 sheet 的行数 + int rowNum = sheet.getLastRowNum(); + List> resList = new ArrayList<>(); + //负责标记检测到空行时,跳过 + boolean flag = false; + for (int i = 1; i <= rowNum; i++) { + //默认认为此行为空行 + flag = true; + Row row = sheet.getRow(i); + //过滤空行 + if (row == null) { + continue; + } + //创建列表,负责装纳一行数据 + List list = new ArrayList<>(); + //获取列数 + int colCount = sheet.getRow(i).getLastCellNum(); + for (int j = 0; j < colCount; j++) { + //获得制定空格 + Cell cell = row.getCell(j); + String cellValue = ""; + //如果存在空格内有内容,就将标志位设置为 false,表示这一行不是空行 + if (!(cell == null)) { + cellValue = getStringCellValue(cell); + if (!"".equals(cellValue)) { + flag = false; + } + } + list.add(cellValue); + } + if (!flag) { + resList.add(list); + } else { + continue; + } + } + return resList; + } + + + public static File multipartFile2File(MultipartFile multipartFile) { + String path = "../demo.xlsx"; + File file = new File(path); + try { + if (!file.exists()) { + file.createNewFile(); + } + // 底层也是通过io流写入文件file + FileCopyUtils.copy(multipartFile.getBytes(), file); + } catch (Exception e) { + throw new RuntimeException(e); + } + return file; + } + + /** + * 获取单元格数据内容为字符串类型的数据 + * + * @param cell Excel单元格 + * @return String 单元格数据内容 + */ + public static String getStringCellValue(Cell cell) { + String strCell = ""; + if (cell == null) { + return ""; + } + switch (cell.getCellType()) { + case Cell.CELL_TYPE_STRING: + strCell = cell.getStringCellValue().trim(); + break; + case Cell.CELL_TYPE_NUMERIC: + strCell = String.valueOf(cell.getNumericCellValue()).trim(); + break; + case Cell.CELL_TYPE_BOOLEAN: + strCell = String.valueOf(cell.getBooleanCellValue()).trim(); + break; + case Cell.CELL_TYPE_BLANK: + strCell = ""; + break; + default: + strCell = ""; + break; + } + if (strCell.equals("") || strCell == null) { + return ""; + } + return strCell; + } + + + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/UnitExcelUtils.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/UnitExcelUtils.java new file mode 100644 index 0000000..069cc07 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/utils/UnitExcelUtils.java @@ -0,0 +1,89 @@ +package com.ruoyi.business.utils; + +import com.ruoyi.business.mapper.HwAlarmInfoMapper; +import com.ruoyi.common.core.utils.DateUtils; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.servlet.http.HttpServletResponse; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; + +public class UnitExcelUtils { + @Autowired + private HwAlarmInfoMapper hwAlarmInfoMapper; + + public void exportAlarmInfos(HttpServletResponse response, HashMap> map) throws IOException { + Workbook bk = new XSSFWorkbook(); + for (String aLong : map.keySet()) { + List list3 = map.get(aLong); + Sheet unitId = bk.createSheet(aLong); + int row = 0; + for (row = 0;row < list3.size();row++){ + if (row == 0){ + LinkedHashMap map1 = list3.get(row); + ArrayList list1 = new ArrayList<>(map1.keySet()); + int size = map1.keySet().size(); + int cellIndex = 0; + Row row1 = unitId.createRow(row); + Row row2 = unitId.createRow(1); + for (cellIndex = 0;cellIndex < size;cellIndex++){ + String key = list1.get(cellIndex).toString(); + row1.createCell(cellIndex).setCellValue(key); + Object value = map1.get(key); + if (value instanceof String){ + row2.createCell(cellIndex).setCellValue((String) map1.get(key)); + }else if (value instanceof Long){ + row2.createCell(cellIndex).setCellValue((Long) map1.get(key)); + }else if(value instanceof Date){ + row2.createCell(cellIndex).setCellValue((Date) map1.get(key)); + }else { + row2.createCell(cellIndex).setCellValue(""); + } + } + + }else { + LinkedHashMap map1 = list3.get(row); + ArrayList list1 = new ArrayList<>(map1.keySet()); + int size = map1.keySet().size(); + int cellIndex = 0; + Row row1 = unitId.createRow(row+1); + for (cellIndex = 0;cellIndex < size;cellIndex++){ + String key = list1.get(cellIndex).toString(); + Object value = map1.get(key); + if (value instanceof String){ + row1.createCell(cellIndex).setCellValue((String) map1.get(key)); + }else if (value instanceof Long){ + row1.createCell(cellIndex).setCellValue((Long) map1.get(key)); + } + else if(value instanceof Date){ + row1.createCell(cellIndex).setCellValue((Date) map1.get(key)); + } + else { + row1.createCell(cellIndex).setCellValue(""); + } + } + } + + } + + } + + + try { +// FileOutputStream stream = new FileOutputStream("告警信息"); + bk.write(response.getOutputStream()); + + } catch (Exception e) { + e.printStackTrace(); + } + bk.close(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/resources/bootstrap.yml b/ruoyi-modules/hw-business/src/main/resources/bootstrap.yml index ecdf076..b21635c 100644 --- a/ruoyi-modules/hw-business/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/hw-business/src/main/resources/bootstrap.yml @@ -3,7 +3,7 @@ server: port: 9601 # Spring -spring: +spring: application: # 应用名称 name: hw-business @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml index 0d5c386..298ce55 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -29,6 +29,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + @@ -41,9 +53,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + - select hai.alarm_info_id, hai.alarm_info_type, hai.alarm_releated_id, hai.device_id, + /*select hai.alarm_info_id, hai.alarm_info_type, hai.alarm_releated_id, hai.device_id, hai.monitor_unit_id, hai.tenant_id, hai.scene_id, hai.alarm_level_id, hai.alarm_type_id, hai.mode_function_id, hai.function_name, hai.function_identifier, hai.function_value, hai.trigger_status, hai.handle_status, hai.alarm_time, @@ -51,17 +75,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" hmu.monitor_unit_name,hal.alarm_level_name,hat.alarm_type_name from hw_alarm_info hai left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id left join hw_alarm_level hal on hai.alarm_level_id=hal.alarm_level_id - left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id + left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id*/ + select hai.alarm_info_id, + hai.alarm_info_type, + hai.alarm_releated_id, + hai.device_id, + hai.monitor_unit_id, + hai.tenant_id, + hai.scene_id, + hai.alarm_level_id, + hai.alarm_type_id, + hai.mode_function_id, + hai.function_name, + hai.function_identifier, + hai.function_value, + hai.trigger_status, + hai.handle_status, + hai.alarm_time, + hai.create_time, + hai.update_by, + hai.update_time, + hai.alarm_info_field, + hmu.monitor_unit_name, + hal.alarm_level_name, + hat.alarm_type_name, + ha.area_name, + hmut.monitor_unit_type_name, + + hd.device_name, + ht.tenant_id, + ht.tenant_name as tenant_name, + hs.scene_name as scene_name, + har.alarm_rule_name as alarm_rule_name, + hor.offline_rule_name as offline_rule_name, + hef.electronic_fence_name as electronic_fence_name + + + from hw_alarm_info hai + left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id + left join hw_alarm_level hal on hai.alarm_level_id = hal.alarm_level_id + left join hw_alarm_type hat on hai.alarm_type_id = hat.alarm_type_id + left join hw_area ha on ha.area_id = hmu.area_id + left join hw_monitor_unit_type hmut on hmu.monitor_unit_type_id = hmut.monitor_unit_type_id + + LEFT JOIN hw_fence_area hfa ON hai.fence_area_id = hfa.fence_area_id + LEFT JOIN hw_device hd ON hai.device_id = hd.device_id + LEFT JOIN hw_tenant ht ON hai.tenant_id = ht.tenant_id + LEFT JOIN hw_scene hs ON hai.scene_id = hs.scene_id + LEFT JOIN hw_alarm_rule har ON hai.alarm_releated_id = har.alarm_rule_id + LEFT JOIN hw_offline_rule hor ON hai.alarm_releated_id = hor.offline_rule_id + LEFT JOIN hw_electronic_fence hef ON hai.alarm_releated_id = hef.electronic_fence_id + - + - + insert into hw_alarm_info @@ -130,6 +218,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + update hw_alarm_info @@ -161,7 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from hw_alarm_info where alarm_info_id in + delete from hw_alarm_info where alarm_info_id in #{alarmInfoId} @@ -183,5 +273,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" exists (select 1 from hw_device hd where hai.device_id=hd.device_id and hd.device_status='1' and hd.monitor_unit_id=#{monitorUnitId}) + + + + + update hw_alarm_info + + handle_status = #{handleStatus}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_info_field = #{alarmInfoField}, + + where device_id = (select t.device_id from (select device_id from hw_alarm_info hai where alarm_info_id = #{alarmInfoId})t) and handle_status = 0 + - \ No newline at end of file + + + update hw_alarm_info + + alarm_info_type = #{alarmInfoType}, + alarm_releated_id = #{alarmReleatedId}, + device_id = #{deviceId}, + monitor_unit_id = #{monitorUnitId}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + alarm_level_id = #{alarmLevelId}, + alarm_type_id = #{alarmTypeId}, + mode_function_id = #{modeFunctionId}, + function_name = #{functionName}, + function_identifier = #{functionIdentifier}, + function_value = #{functionValue}, + trigger_status = #{triggerStatus}, + handle_status = #{handleStatus}, + alarm_time = #{alarmTime}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_info_field = #{alarmInfoField}, + + where alarm_info_id = #{alarmInfoId} + + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml index 66c43e1..f95c305 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml @@ -32,6 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -52,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, language_code, alarm_level_id, alarm_type_id, rule_type, rule_device_id, rule_function_total, trigger_expression, link_flag, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field from hw_alarm_rule har + select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, language_code, alarm_level_id, alarm_type_id, rule_type, rule_device_id, rule_function_total, trigger_expression, link_flag, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field,trigger_time_frame,phone_numbers from hw_alarm_rule har - + + + insert into hw_alarm_rule @@ -152,6 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, alarm_rule_field, + trigger_time_frame, + phone_numbers, #{alarmRuleName}, @@ -175,6 +184,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{alarmRuleField}, + #{triggerTimeFrame}, + #{phoneNumbers}, @@ -202,6 +213,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, alarm_rule_field = #{alarmRuleField}, + trigger_time_frame = #{triggerTimeFrame}, + phone_numbers = #{phoneNumbers}, where alarm_rule_id = #{alarmRuleId} diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml index 63f117f..623d7e1 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml @@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and hat.handle_mode = #{handleMode} and hat.type_status = #{typeStatus} - ${params.tenantDataScope} +-- ${params.tenantDataScope} order by hat.scene_id,hat.alarm_type_id desc diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml index e09fdc4..f38bfec 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml @@ -39,8 +39,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + - @@ -48,10 +62,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and device_status !='9' + and hd.device_code like concat('%', #{deviceCode}, '%') + and hd.device_name like concat('%', #{deviceName}, '%') + and hd.scene_id = #{sceneId} + and hd.monitor_unit_id = #{monitorUnitId} + and hd.device_type = #{deviceType} + and hd.networking_mode = #{networkingMode} + and hd.access_protocol = #{accessProtocol} + and hd.data_format = #{dataFormat} + and hd.releated_device_id = #{releatedDeviceId} + and hd.device_mode_id = #{deviceModeId} + and hd.access_gw_protocol = #{accessGwProtocol} + and hd.active_status = #{activeStatus} + and hd.device_status = #{deviceStatus} + and hd.active_time = #{activeTime} + and hd.device_pic = #{devicePic} + and hd.ip_address = #{ipAddress} + and hd.area_id = #{areaId} + and hd.device_location = #{deviceLocation} + and hd.current_module_version = #{currentModuleVersion} + and hd.current_singlechip_version = #{currentSinglechipVersion} + and hd.device_field = #{deviceField} + and hd.tenant_id = #{tenantId} + and hd.online_status = #{onlineStatus} and device_code like concat('%', #{deviceCode}, '%') and device_name like concat('%', #{deviceName}, '%') and scene_id = #{sceneId} @@ -111,13 +198,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and online_status = #{onlineStatus} and device_type in (${deviceTypeStr}) +-- ${params.tenantDataScope} @@ -280,7 +368,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and hd.releated_device_id = #{releatedDeviceId} and hd.online_status = #{onlineStatus} - ${params.tenantDataScope} +-- ${params.tenantDataScope} order by hd.device_id desc @@ -291,7 +379,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -314,10 +402,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml index b24d576..fd3fc50 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml @@ -61,7 +61,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where mode_function_id = #{modeFunctionId} - + + insert into hw_device_mode_function diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml index d128d86..107d0d6 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeMapper.xml @@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -53,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -66,11 +68,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select device_mode_id, device_mode_name, tenant_id, scene_id, language_code, gps_flag, device_mode_status, common_flag, mode_classfication,mode_type, device_mode_pic, data_verify_level, remark, create_by, create_time, update_by, update_time, device_mode_field from hw_device_mode hdm + select device_mode_id, device_mode_name, tenant_id, scene_id, language_code, gps_flag, device_mode_status, common_flag, mode_classfication,mode_type, device_mode_pic, data_verify_level, remark, create_by, create_time, update_by, update_time, device_mode_field,device_model_type from hw_device_mode hdm @@ -93,14 +96,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and data_verify_level = #{dataVerifyLevel} and device_mode_field = #{deviceModeField} - ${params.tenantDataScope} +-- ${params.tenantDataScope} order by device_mode_id desc select hdm.device_mode_id,hdm.device_mode_name,hdm.gps_flag,hdm.mode_classfication, - hs.scene_name,ht.tenant_name,hdm.tenant_id,hdm.scene_id,hdm.common_flag,hdm.device_mode_status,hdm.device_mode_pic + hs.scene_name,ht.tenant_name,hdm.tenant_id,hdm.scene_id,hdm.common_flag,hdm.device_mode_status,hdm.device_mode_pic,hdm.device_model_type from hw_device_mode hdm left join hw_scene hs on hdm.scene_id = hs.scene_id left join hw_tenant ht on hdm.tenant_id=ht.tenant_id @@ -317,10 +323,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and hdm.data_verify_level = #{dataVerifyLevel} and hdm.device_mode_field = #{deviceModeField} - ${params.tenantDataScope} +-- ${params.tenantDataScope} order by hdm.device_mode_id desc + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml index d633540..656e5f5 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -41,64 +41,93 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select hwf.electronic_fence_id, - hwf.electronic_fence_name, - hwf.tenant_id, - hwf.scene_id, - hwf.fence_type, - hwf.effective_time_flag, - hwf.time_zone, - hwf.effective_time, - hwf.trigger_status, - hwf.fence_push_flag, - hwf.fence_push_content, - hwf.fence_recover_content, - hwf.remark, - hwf.create_by, - hwf.create_time, - hwf.update_by, - hwf.update_time, - hwf.fence_field, + select hef.electronic_fence_id, + hef.electronic_fence_name, + hef.tenant_id, + hef.scene_id, + hef.fence_type, + hef.effective_time_flag, + hef.time_zone, + hef.effective_time, + hef.trigger_status, + hef.fence_push_flag, + hef.fence_push_content, + hef.fence_recover_content, + hef.remark, + hef.create_by, + hef.create_time, + hef.update_by, + hef.update_time, + hef.fence_field, hdm.device_mode_name, hd.device_name, - hwf.device_mode_id, - hwf.device_id - from hw_electronic_fence hwf - left join hw_device_model hdm on hdm.device_mode_id = hwf.device_mode_id - left join hw_device hd on hd.device_id = hwf.device_id + hef.device_mode_id, + hef.device_id, + hs.scene_name + from hw_electronic_fence hef + left join hw_device_mode hdm on hdm.device_mode_id = hef.device_mode_id + left join hw_device hd on hd.device_id = hef.device_id + left join hw_scene hs on hs.scene_id = hef.scene_id - - + - + insert into hw_electronic_fence @@ -140,8 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{fenceField}, - #{deviceModeId}, - #{deviceId}, + device_mode_id, + device_id, @@ -190,7 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from hw_fence_target where electronic_fence_id in + delete from hw_fence_target where electronic_fence_id in #{electronicFenceId} @@ -231,6 +260,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" hs.scene_name from hw_electronic_fence hef left join hw_scene hs on hef.scene_id = hs.scene_id + left join hw_fence_target hft on hft.electronic_fence_id = hef.electronic_fence_id + left join hw_device_mode hdm on hdm.device_mode_id = hef.device_mode_id + left join hw_device hd on hd.device_id = hef.device_id hef.trigger_status !='9' and hef.electronic_fence_name like concat('%', #{electronicFenceName}, '%') @@ -245,8 +277,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and hef.fence_push_content = #{fencePushContent} and hef.fence_recover_content = #{fenceRecoverContent} and hef.fence_field = #{fenceField} + and hdm.device_model_name like concat('%', #{deviceModeName}, '%') + and hd.device_name like concat('%', #{deviceName}, '%') + and hef.device_id = #{deviceId} + and hef.device_mode_id = #{deviceModeId} - ${params.tenantDataScope} +-- ${params.tenantDataScope} order by hef.electronic_fence_id desc @@ -262,4 +298,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from hw_fence_area where electronic_fence_id = #{electronicFenceId} - \ No newline at end of file + + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwFenceTargetMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwFenceTargetMapper.xml index 3ef51f6..f02ef83 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwFenceTargetMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwFenceTargetMapper.xml @@ -60,4 +60,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{targetId} + + delete from hw_fence_target where electronic_fence_id in + + #{electronicFenceId} + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitAttributeDao.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitAttributeDao.xml new file mode 100644 index 0000000..5ab23af --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitAttributeDao.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into hw_monitor_unit_attribute(monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time) + values (#{monitorUnitId}, #{attributeName}, #{attributeValue}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}) + + + + insert into hw_monitor_unit_attribute(monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time) + values + + (#{entity.monitorUnitId}, #{entity.attributeName}, #{entity.attributeValue}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}) + + + + + insert into hw_monitor_unit_attribute(monitor_unit_id, attribute_name, attribute_value, create_by, create_time, update_by, update_time) + values + + (#{entity.monitorUnitId}, #{entity.attributeName}, #{entity.attributeValue}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}) + + on duplicate key update + monitor_unit_id = values(monitor_unit_id), + attribute_name = values(attribute_name), + attribute_value = values(attribute_value), + create_by = values(create_by), + create_time = values(create_time), + update_by = values(update_by), + update_time = values(update_time) + + + + + update hw_monitor_unit_attribute + + + monitor_unit_id = #{monitorUnitId}, + + + attribute_name = #{attributeName}, + + + attribute_value = #{attributeValue}, + + + create_by = #{createBy}, + + + create_time = #{createTime}, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}, + + + where attribute_id = #{attributeId} + + + update hw_monitor_unit_attribute + + + monitor_unit_id = #{monitorUnitId}, + + + attribute_name = #{attributeName}, + + + attribute_value = #{attributeValue}, + + + create_by = #{createBy}, + + + create_time = #{createTime}, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}, + + + where attribute_id = #{attributeId} + + + + + delete from hw_monitor_unit_attribute where attribute_id = #{attributeId} + + + delete from hw_monitor_unit_attribute where attribute_id = #{attributeId} + + + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml index e3aef8b..138da97 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml @@ -60,6 +60,11 @@ + + + + + select monitor_unit_id, monitor_unit_name, scene_id, parent_id, monitor_unit_type_id, area_id, monitor_address, monitor_pic, preserve_time, remark, monitor_unit_status, create_by, create_time, update_by, update_time, monitor_unit_field from hw_monitor_unit hmu @@ -111,14 +116,16 @@ where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null))as temp GROUP BY scene_id - select count(*)from hw_monitor_unit where monitor_unit_status='1' and monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null) + and tenant_id = #{tenantId} and scene_id = #{sceneId} @@ -146,7 +153,7 @@ select scene_id,count(*) as sum from (select monitor_unit_id,scene_id from hw_monitor_unit where monitor_unit_id not in - (select parent_id from hw_monitor_unit where parent_id is not null))as temp + (select parent_id from hw_monitor_unit where parent_id is not null) and tenant_id = #{tenantId})as temp GROUP BY scene_id order by sum desc @@ -234,6 +241,11 @@ #{monitorUnitField}, + + update hw_monitor_unit + set attribute = #{attribute} + where monitor_unit_id = #{monitorUnitId} + update hw_monitor_unit @@ -286,7 +298,7 @@ and hmu.preserve_time = #{preserveTime} and hmu.monitor_unit_status = #{monitorUnitStatus} - ${params.tenantDataScope} +-- ${params.tenantDataScope} order by hmu.tenant_id,hmu.parent_id @@ -312,4 +324,39 @@ update hw_monitor_unit set monitor_unit_status = '9' where monitor_unit_id = #{monitorUnitId} - \ No newline at end of file + + + + + + + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitTypeMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitTypeMapper.xml index b299da3..2ac5268 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitTypeMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitTypeMapper.xml @@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and hmut.unit_type_icon = #{unitTypeIcon} and hmut.unit_type_field = #{unitTypeField} - ${params.tenantDataScope} +-- ${params.tenantDataScope} order by hmut.monitor_unit_type_id desc diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwOfflineRuleMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwOfflineRuleMapper.xml index fcb25bb..3dcd17f 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwOfflineRuleMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwOfflineRuleMapper.xml @@ -195,6 +195,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from hw_alarm_rule_link where alarm_rule_id = #{alarmRuleId} + + update hw_offline_rule set deleted_flag = 1 + insert into hw_alarm_rule_link( rule_link_id, alarm_rule_type, alarm_rule_id, link_type, link_device_id, link_device_function_id, link_device_function_identifier, link_device_function_data) values @@ -202,7 +205,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ( #{item.ruleLinkId}, #{item.alarmRuleType}, #{item.alarmRuleId}, #{item.linkType}, #{item.linkDeviceId}, #{item.linkDeviceFunctionId}, #{item.linkDeviceFunctionIdentifier}, #{item.linkDeviceFunctionData}) - + + insert into hw_offline_rule + + offline_rule_name, + tenant_id, + scene_id, + alarm_level_id, + rule_type, + offline_time, + offline_number_time, + offline_number, + trigger_time_frame, + consume_traffic, + battery_level, + power_down_flag, + link_flag, + alarm_rule_status, + alarm_push_flag, + alarm_push_content, + alarm_recover_content, + remark, + create_by, + create_time, + update_by, + update_time, + offline_rule_field, + + + #{offlineRuleName}, + #{tenantId}, + #{sceneId}, + #{alarmLevelId}, + #{ruleType}, + #{offlineTime}, + #{offlineNumberTime}, + #{offlineNumber}, + #{triggerTimeFrame}, + #{consumeTraffic}, + #{batteryLevel}, + #{powerDownFlag}, + #{linkFlag}, + #{alarmRuleStatus}, + #{alarmPushFlag}, + #{alarmPushContent}, + #{alarmRecoverContent}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{offlineRuleField}, + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml index bb40a02..1d3f0cd 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml @@ -52,6 +52,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + select scene_id, scene_name, tenant_id, scene_mode_id, scene_pic, default_flag, scene_status, auth_mode, mode_account, mode_key, mode_secret, preserve_time, test_preserve_time, remark, create_by, create_time, update_by, update_time, scene_environment, scene_field from hw_scene hs @@ -75,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select scene_id as vo_id,scene_name as vo_name from hw_scene hs where scene_status = 1 + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml index 32d8e76..afe7e93 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml @@ -25,10 +25,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select tenant_id, tenant_type, tenant_name, tenant_industry, contact_name, contact_phone, email, area_id, contact_address, remark, tenant_status, is_register, create_by, create_time, update_by, update_time,tenant_board_topic, tenant_board_pic,tenant_grade, tenant_field from hw_tenant ht + select tenant_id, tenant_type, tenant_name, tenant_industry, contact_name, contact_phone, email, area_id, contact_address, remark, tenant_status, is_register, create_by, create_time, update_by, update_time,tenant_board_topic, tenant_board_pic,tenant_grade, tenant_field ,tenant_map_code from hw_tenant ht select a.alarm_rule_id, a.alarm_rule_name, a.tenant_id, a.scene_id, a.language_code, a.alarm_level_id, a.alarm_type_id, a.rule_type, a.rule_device_id, a.rule_function_total, a.trigger_expression, a.link_flag, a.alarm_rule_status, a.alarm_push_flag, a.alarm_push_content, a.alarm_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.alarm_rule_field, - b.rule_link_id as sub_rule_link_id, b.alarm_rule_id as sub_alarm_rule_id, b.link_type as sub_link_type, b.link_device_id as sub_link_device_id, b.link_device_function_id as sub_link_device_function_id, b.link_device_function_identifier as sub_link_device_function_identifier, b.link_device_function_data as sub_link_device_function_data + b.rule_link_id as sub_rule_link_id, b.alarm_rule_id as sub_alarm_rule_id, b.link_type as sub_link_type, b.link_device_id as sub_link_device_id, b.link_device_function_id as sub_link_device_function_id, b.link_device_function_identifier as sub_link_device_function_identifier, b.link_device_function_data as sub_link_device_function_data,a.trigger_time_frame,a.phone_numbers from hw_alarm_rule a left join hw_alarm_rule_link b on b.alarm_rule_id = a.alarm_rule_id and b.alarm_rule_type=1 diff --git a/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml index 80c1fcf..055a863 100644 --- a/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml +++ b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwDeviceMapper.xml @@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -45,6 +46,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where device_code = #{deviceCode} limit 1 + + update hw_device diff --git a/ruoyi-modules/hw-mqtt-broker/src/main/resources/bootstrap.yml b/ruoyi-modules/hw-mqtt-broker/src/main/resources/bootstrap.yml index 51d54ff..b0a9969 100644 --- a/ruoyi-modules/hw-mqtt-broker/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/hw-mqtt-broker/src/main/resources/bootstrap.yml @@ -29,7 +29,8 @@ spring: nacos: config: # 配置中心地址 - server-addr: 124.70.63.37:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java index 0b6b00e..3e3f3a6 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java @@ -1,26 +1,19 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwAboutUsInfo; import com.ruoyi.portal.service.IHwAboutUsInfoService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 关于我们信息Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java index abf2b81..a59c987 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java @@ -1,26 +1,19 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwAboutUsInfoDetail; import com.ruoyi.portal.service.IHwAboutUsInfoDetailService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 关于我们信息明细Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java index 62b7b68..10c39d1 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java @@ -1,26 +1,19 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwContactUsInfo; import com.ruoyi.portal.service.IHwContactUsInfoService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 联系我们信息Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java index 29c96fd..97ac1ef 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java @@ -1,26 +1,19 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwPortalConfig; import com.ruoyi.portal.service.IHwPortalConfigService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 门户网站配置Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java index 2af2c42..d181403 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java @@ -1,25 +1,18 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwPortalConfigType; import com.ruoyi.portal.service.IHwPortalConfigTypeService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 门户网站配置类型Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalController.java new file mode 100644 index 0000000..091c75e --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalController.java @@ -0,0 +1,178 @@ +package com.ruoyi.portal.controller; + +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.portal.domain.*; +import com.ruoyi.portal.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 门户网站前端Controller + * + * @author xins + * @date 2024-12-12 + */ +@RestController +@RequestMapping("/portal") +public class HwPortalController extends BaseController +{ + @Autowired + private IHwPortalConfigService hwPortalConfigService; + + @Autowired + private IHwPortalConfigTypeService hwPortalConfigTypeService; + + @Autowired + private IHwProductCaseInfoService hwProductCaseInfoService; + + @Autowired + private IHwContactUsInfoService hwContactUsInfoService; + + @Autowired + private IHwProductInfoService productInfoService; + + @Autowired + private IHwProductInfoDetailService hwProductInfoDetailService; + + @Autowired + private IHwAboutUsInfoService hwAboutUsInfoService; + + @Autowired + private IHwAboutUsInfoDetailService hwAboutUsInfoDetailService; + + + /** + * 查询门户网站配置列表(首页大图,portal_config_type为1;产品中心大图,portal_config_type为2,并且需要根据portalConfigTypeId获取) + */ + @GetMapping("/getPortalConfigList") + public TableDataInfo getPortalConfigList(HwPortalConfig hwPortalConfig) + { + startPage(); + List list = hwPortalConfigService.selectHwPortalConfigList(hwPortalConfig); + return getDataTable(list); + } + + + /** + * 门户网站配置类型(首页产品中心,config_type_classfication为1,按homeConfigTypeName显示;产品中心页面上面的按configTypeName显示) + */ + @GetMapping("/getPortalConfigTypeList") + public TableDataInfo getPortalConfigTypeList(HwPortalConfigType hwPortalConfigType) + { + startPage(); + List list = hwPortalConfigTypeService.selectHwPortalConfigTypeList(hwPortalConfigType); + return getDataTable(list); + } + + /** + * 获取首页案例tab title(例如物联网、制造中心和快递物流) + */ + @GetMapping("/getHomeCaseTitleList") + public TableDataInfo getHomeCaseTitleList(HwPortalConfigType hwPortalConfigType) + { + startPage(); + List list = hwPortalConfigTypeService.selectHwPortalConfigTypeList(hwPortalConfigType); + return getDataTable(list); + } + + + /** + * 获取首页案例信息 + */ + @GetMapping("/getTypicalHomeCaseInfo") + public AjaxResult getTypicalHomeCaseInfo(HwProductCaseInfo queryProductCaseInfo) + { + HwProductCaseInfo hwProductCaseInfo = hwProductCaseInfoService.getTypicalHomeCaseInfo(queryProductCaseInfo); + + return success(hwProductCaseInfo); + } + + + + /** + * 新增联系我们 + */ + @Log(title = "联系我们", businessType = BusinessType.INSERT) + @PostMapping("/addContactUsInfo") + public AjaxResult addContactUsInfo(@RequestBody HwContactUsInfo hwContactUsInfo) + { + return toAjax(hwContactUsInfoService.insertHwContactUsInfo(hwContactUsInfo)); + } + + + + /** + * 获取产品中心产品信息(平台简介,hw_product_info获取,(配置模式2左标题+内容,右图片)读取中文标题和英文标题,下面内容从hw_product_info_detail获取,读取标题,内容和图片) + */ + @GetMapping("/getProductCenterProductInfos") + public AjaxResult getProductCenterProductInfos(HwProductInfo hwProductInfo) + { +// 配置模式(1图标 +文字+内容横铺4个2左标题+内容,右图片;3左图标,右标题+内容,一行2个;4左大图右标题+内容,一行2个;5上标题+下图片,6上标题+内容,下图片;7图标标题内容,一行3个,8左图右列表9上图下内容,一行4个) + return success(productInfoService.selectHwProductInfoJoinDetailList(hwProductInfo)); + } + + /** + * 产品中心如果tab的话,根据tab的product_info_detail_id获取children productinfodetail + * @param hwProductInfoDetail + * @return + */ + @GetMapping("/getProductCenterProductDetailInfos") + public AjaxResult getProductCenterProductDetailInfos(HwProductInfoDetail hwProductInfoDetail) + { +// productinfodetail的config_modal 配置模式(1图标 +文字+内容横铺4个2左标题+内容,右图片;3左图标,右标题+内容,一行2个;4左大图右标题+内容,一行2个;5上标题+下图片,6上标题+内容,下图片;7图标标题内容,一行3个,8一张图9上图下内容,一行4个) + return success(hwProductInfoDetailService.selectHwProductInfoDetailList(hwProductInfoDetail)); + } + + + /** + * 产品中心如果tab的话,根据tab的portalconfigtypeid获取productcaseinfo + * @param hwProductCaseInfo + * @return + */ + @GetMapping("/getCaseCenterCaseInfos") + public AjaxResult getCaseCenterCaseInfos(HwProductCaseInfo hwProductCaseInfo) + { + return success(hwProductCaseInfoService.selectHwProductCaseInfoList(hwProductCaseInfo)); + } + + /** + * 根据案例ID获取案例详情 + * @param caseInfoId + * @return + */ + @GetMapping("/getCaseCenterCaseInfo/{caseInfoId}") + public AjaxResult getCaseCenterCaseInfo(@PathVariable("caseInfoId") Long caseInfoId) + { + return success(hwProductCaseInfoService.selectHwProductCaseInfoByCaseInfoId(caseInfoId)); + } + + + /** + * 获取关于我们信息 + * @param hwAboutUsInfo + * @return + */ + @GetMapping("/getAboutUsInfo") + public AjaxResult getAboutUsInfo(HwAboutUsInfo hwAboutUsInfo) + { + return success(hwAboutUsInfoService.selectHwAboutUsInfoList(hwAboutUsInfo)); + } + + + /** + * 获取关于我们信息详情 + * @param hwAboutUsInfoDetail + * @return + */ + @GetMapping("/getAboutUsInfoDetails") + public AjaxResult getAboutUsInfoDetails(HwAboutUsInfoDetail hwAboutUsInfoDetail) + { + return success(hwAboutUsInfoDetailService.selectHwAboutUsInfoDetailList(hwAboutUsInfoDetail)); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java index 7abde7a..84ce2cd 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java @@ -1,26 +1,19 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwProductCaseInfo; import com.ruoyi.portal.service.IHwProductCaseInfoService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 案例内容Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java index 5c3e721..1d7c867 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java @@ -1,26 +1,19 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwProductInfo; import com.ruoyi.portal.service.IHwProductInfoService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 产品信息配置Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java index 605ecf3..772d3c0 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java @@ -1,25 +1,18 @@ package com.ruoyi.portal.controller; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.portal.domain.HwProductInfoDetail; import com.ruoyi.portal.service.IHwProductInfoDetailService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * 产品信息明细配置Controller diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfo.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfo.java index 528f73d..9b4739d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfo.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfo.java @@ -1,9 +1,9 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; /** * 关于我们信息对象 hw_about_us_info diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfoDetail.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfoDetail.java index ee32ecb..334318c 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfoDetail.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwAboutUsInfoDetail.java @@ -1,9 +1,9 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; /** * 关于我们信息明细对象 hw_about_us_info_detail diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwContactUsInfo.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwContactUsInfo.java index cf06a57..a0efe46 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwContactUsInfo.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwContactUsInfo.java @@ -1,9 +1,9 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; /** * 联系我们信息对象 hw_contact_us_info @@ -34,6 +34,8 @@ public class HwContactUsInfo extends BaseEntity @Excel(name = "IP地址") private String userIp; + private String remark; + public void setContactUsInfoId(Long contactUsInfoId) { this.contactUsInfoId = contactUsInfoId; @@ -80,6 +82,16 @@ public class HwContactUsInfo extends BaseEntity return userIp; } + @Override + public String getRemark() { + return remark; + } + + @Override + public void setRemark(String remark) { + this.remark = remark; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java index 586ee9d..58dce9d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java @@ -1,9 +1,9 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; /** * 门户网站配置对象 hw_portal_config @@ -22,6 +22,9 @@ public class HwPortalConfig extends BaseEntity @Excel(name = "类型(1首页大图 2产品中心大图)") private String portalConfigType; + /**如果类型是2的,则需要关联hw_portal_config_type*/ + private Long portalConfigTypeId; + /** 标题 */ @Excel(name = "标题") private String portalConfigTitle; @@ -64,7 +67,16 @@ public class HwPortalConfig extends BaseEntity { return portalConfigType; } - public void setPortalConfigTitle(String portalConfigTitle) + + public Long getPortalConfigTypeId() { + return portalConfigTypeId; + } + + public void setPortalConfigTypeId(Long portalConfigTypeId) { + this.portalConfigTypeId = portalConfigTypeId; + } + + public void setPortalConfigTitle(String portalConfigTitle) { this.portalConfigTitle = portalConfigTitle; } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfigType.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfigType.java index deb8247..fec425d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfigType.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfigType.java @@ -1,9 +1,11 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.TreeEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; /** * 门户网站配置类型对象 hw_portal_config_type @@ -42,6 +44,9 @@ public class HwPortalConfigType extends TreeEntity @Excel(name = "首页图片地址") private String homeConfigTypePic; + private List hwProductCaseInfoList; + + public void setConfigTypeId(Long configTypeId) { this.configTypeId = configTypeId; @@ -106,6 +111,14 @@ public class HwPortalConfigType extends TreeEntity return homeConfigTypePic; } + public List getHwProductCaseInfoList() { + return hwProductCaseInfoList; + } + + public void setHwProductCaseInfoList(List hwProductCaseInfoList) { + this.hwProductCaseInfoList = hwProductCaseInfoList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductCaseInfo.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductCaseInfo.java index 2d9d773..403c360 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductCaseInfo.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductCaseInfo.java @@ -1,9 +1,9 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; /** * 案例内容对象 hw_product_case_info @@ -24,7 +24,7 @@ public class HwProductCaseInfo extends BaseEntity /** 配置类型ID */ @Excel(name = "配置类型ID") - private Long caseTypeId; + private Long configTypeId; /** 典型案例标识(1是0否) */ @Excel(name = "典型案例标识(1是0否)") @@ -42,6 +42,9 @@ public class HwProductCaseInfo extends BaseEntity @Excel(name = "案例详情") private String caseInfoHtml; + private String homeTypicalFlag; + + public void setCaseInfoId(Long caseInfoId) { this.caseInfoId = caseInfoId; @@ -60,16 +63,16 @@ public class HwProductCaseInfo extends BaseEntity { return caseInfoTitle; } - public void setCaseTypeId(Long caseTypeId) - { - this.caseTypeId = caseTypeId; + + public Long getConfigTypeId() { + return configTypeId; } - public Long getCaseTypeId() - { - return caseTypeId; + public void setConfigTypeId(Long configTypeId) { + this.configTypeId = configTypeId; } - public void setTypicalFlag(String typicalFlag) + + public void setTypicalFlag(String typicalFlag) { this.typicalFlag = typicalFlag; } @@ -106,12 +109,20 @@ public class HwProductCaseInfo extends BaseEntity return caseInfoHtml; } + public String getHomeTypicalFlag() { + return homeTypicalFlag; + } + + public void setHomeTypicalFlag(String homeTypicalFlag) { + this.homeTypicalFlag = homeTypicalFlag; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("caseInfoId", getCaseInfoId()) .append("caseInfoTitle", getCaseInfoTitle()) - .append("caseTypeId", getCaseTypeId()) + .append("configTypeId", getConfigTypeId()) .append("typicalFlag", getTypicalFlag()) .append("caseInfoDesc", getCaseInfoDesc()) .append("caseInfoPic", getCaseInfoPic()) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfo.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfo.java index f021f4b..685cb80 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfo.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfo.java @@ -1,9 +1,11 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; /** * 产品信息配置对象 hw_product_info @@ -42,6 +44,11 @@ public class HwProductInfo extends BaseEntity @Excel(name = "顺序") private Long productInfoOrder; + /** 产品信息明细配置信息 */ + private List hwProductInfoDetailList; + + private Long parentId; + public void setProductInfoId(Long productInfoId) { this.productInfoId = productInfoId; @@ -106,20 +113,39 @@ public class HwProductInfo extends BaseEntity return productInfoOrder; } + public List getHwProductInfoDetailList() + { + return hwProductInfoDetailList; + } + + public void setHwProductInfoDetailList(List hwProductInfoDetailList) + { + this.hwProductInfoDetailList = hwProductInfoDetailList; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("productInfoId", getProductInfoId()) - .append("configTypeId", getConfigTypeId()) - .append("tabFlag", getTabFlag()) - .append("configModal", getConfigModal()) - .append("productInfoEtitle", getProductInfoEtitle()) - .append("productInfoCtitle", getProductInfoCtitle()) - .append("productInfoOrder", getProductInfoOrder()) - .append("createTime", getCreateTime()) - .append("createBy", getCreateBy()) - .append("updateTime", getUpdateTime()) - .append("updateBy", getUpdateBy()) - .toString(); + .append("productInfoId", getProductInfoId()) + .append("configTypeId", getConfigTypeId()) + .append("tabFlag", getTabFlag()) + .append("configModal", getConfigModal()) + .append("productInfoEtitle", getProductInfoEtitle()) + .append("productInfoCtitle", getProductInfoCtitle()) + .append("productInfoOrder", getProductInfoOrder()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("updateBy", getUpdateBy()) + .append("hwProductInfoDetailList", getHwProductInfoDetailList()) + .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java index 80bde59..b543000 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java @@ -1,9 +1,9 @@ package com.ruoyi.portal.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.TreeEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; /** * 产品信息明细配置对象 hw_product_info_detail diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoDetailMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoDetailMapper.java index 12bf14d..80211ca 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoDetailMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoDetailMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwAboutUsInfoDetail; +import java.util.List; + /** * 关于我们信息明细Mapper接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoMapper.java index 8460df5..a04d21d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwAboutUsInfoMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwAboutUsInfo; +import java.util.List; + /** * 关于我们信息Mapper接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwContactUsInfoMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwContactUsInfoMapper.java index 8d03dfc..aba791f 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwContactUsInfoMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwContactUsInfoMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwContactUsInfo; +import java.util.List; + /** * 联系我们信息Mapper接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java index b08acb1..b104877 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwPortalConfig; +import java.util.List; + /** * 门户网站配置Mapper接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigTypeMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigTypeMapper.java index a32de85..de83bf6 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigTypeMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigTypeMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwPortalConfigType; +import java.util.List; + /** * 门户网站配置类型Mapper接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductCaseInfoMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductCaseInfoMapper.java index f22aa2c..ca3668c 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductCaseInfoMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductCaseInfoMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwProductCaseInfo; +import java.util.List; + /** * 案例内容Mapper接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoDetailMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoDetailMapper.java index 1a97e09..69f52ec 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoDetailMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoDetailMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwProductInfoDetail; +import java.util.List; + /** * 产品信息明细配置Mapper接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoMapper.java index 6ccd7e1..95cb22d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwProductInfoMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.mapper; -import java.util.List; import com.ruoyi.portal.domain.HwProductInfo; +import java.util.List; + /** * 产品信息配置Mapper接口 * @@ -58,4 +59,13 @@ public interface HwProductInfoMapper * @return 结果 */ public int deleteHwProductInfoByProductInfoIds(Long[] productInfoIds); + + /** + * 查询产品信息配置列表,join product info detail + * + * @param hwProductInfo 产品信息配置 + * @return 产品信息配置集合 + */ + public List selectHwProductInfoJoinDetailList(HwProductInfo hwProductInfo); + } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoDetailService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoDetailService.java index 29f94cd..3abcb00 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoDetailService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoDetailService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwAboutUsInfoDetail; +import java.util.List; + /** * 关于我们信息明细Service接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoService.java index 8435265..9baf7a3 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwAboutUsInfoService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwAboutUsInfo; +import java.util.List; + /** * 关于我们信息Service接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwContactUsInfoService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwContactUsInfoService.java index 382f843..3f8ae56 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwContactUsInfoService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwContactUsInfoService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwContactUsInfo; +import java.util.List; + /** * 联系我们信息Service接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigService.java index 361b67d..2894a95 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwPortalConfig; +import java.util.List; + /** * 门户网站配置Service接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigTypeService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigTypeService.java index bc1afb8..41cb672 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigTypeService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwPortalConfigTypeService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwPortalConfigType; +import java.util.List; + /** * 门户网站配置类型Service接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductCaseInfoService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductCaseInfoService.java index e1cfa59..b229a24 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductCaseInfoService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductCaseInfoService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwProductCaseInfo; +import java.util.List; + /** * 案例内容Service接口 * @@ -58,4 +59,11 @@ public interface IHwProductCaseInfoService * @return 结果 */ public int deleteHwProductCaseInfoByCaseInfoId(Long caseInfoId); + + /** + * 根据configTypeId获取首页典型案例 + * @param hwProductCaseInfo + * @return + */ + public HwProductCaseInfo getTypicalHomeCaseInfo(HwProductCaseInfo hwProductCaseInfo); } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoDetailService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoDetailService.java index e56ab4b..afe5a16 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoDetailService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoDetailService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwProductInfoDetail; +import java.util.List; + /** * 产品信息明细配置Service接口 * diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoService.java index 0bd2f1c..640cf39 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwProductInfoService.java @@ -1,8 +1,9 @@ package com.ruoyi.portal.service; -import java.util.List; import com.ruoyi.portal.domain.HwProductInfo; +import java.util.List; + /** * 产品信息配置Service接口 * @@ -58,4 +59,12 @@ public interface IHwProductInfoService * @return 结果 */ public int deleteHwProductInfoByProductInfoId(Long productInfoId); + + /** + * 获取产品中心产品信息(平台简介,hw_product_info获取,(配置模式2左标题+内容,右图片)读取中文标题和英文标题,下面内容从hw_product_info_detail获取,读取标题,内容和图片) + * + * @param hwProductInfo 产品信息配置 + * @return 产品信息配置 + */ + public List selectHwProductInfoJoinDetailList(HwProductInfo hwProductInfo); } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoDetailServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoDetailServiceImpl.java index 479221e..a54a307 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoDetailServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoDetailServiceImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.portal.domain.HwAboutUsInfoDetail; +import com.ruoyi.portal.mapper.HwAboutUsInfoDetailMapper; +import com.ruoyi.portal.service.IHwAboutUsInfoDetailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwAboutUsInfoDetailMapper; -import com.ruoyi.portal.domain.HwAboutUsInfoDetail; -import com.ruoyi.portal.service.IHwAboutUsInfoDetailService; + +import java.util.List; /** * 关于我们信息明细Service业务层处理 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoServiceImpl.java index 5c24391..3be1c1a 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwAboutUsInfoServiceImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.portal.domain.HwAboutUsInfo; +import com.ruoyi.portal.mapper.HwAboutUsInfoMapper; +import com.ruoyi.portal.service.IHwAboutUsInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwAboutUsInfoMapper; -import com.ruoyi.portal.domain.HwAboutUsInfo; -import com.ruoyi.portal.service.IHwAboutUsInfoService; + +import java.util.List; /** * 关于我们信息Service业务层处理 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwContactUsInfoServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwContactUsInfoServiceImpl.java index 1ff9677..b2c3776 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwContactUsInfoServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwContactUsInfoServiceImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.portal.domain.HwContactUsInfo; +import com.ruoyi.portal.mapper.HwContactUsInfoMapper; +import com.ruoyi.portal.service.IHwContactUsInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwContactUsInfoMapper; -import com.ruoyi.portal.domain.HwContactUsInfo; -import com.ruoyi.portal.service.IHwContactUsInfoService; + +import java.util.List; /** * 联系我们信息Service业务层处理 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java index 6b4a5e0..0ae8927 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.portal.domain.HwPortalConfig; +import com.ruoyi.portal.mapper.HwPortalConfigMapper; +import com.ruoyi.portal.service.IHwPortalConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwPortalConfigMapper; -import com.ruoyi.portal.domain.HwPortalConfig; -import com.ruoyi.portal.service.IHwPortalConfigService; + +import java.util.List; /** * 门户网站配置Service业务层处理 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigTypeServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigTypeServiceImpl.java index e42a62a..61fbdaf 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigTypeServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigTypeServiceImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.portal.domain.HwPortalConfigType; +import com.ruoyi.portal.mapper.HwPortalConfigTypeMapper; +import com.ruoyi.portal.service.IHwPortalConfigTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwPortalConfigTypeMapper; -import com.ruoyi.portal.domain.HwPortalConfigType; -import com.ruoyi.portal.service.IHwPortalConfigTypeService; + +import java.util.List; /** * 门户网站配置类型Service业务层处理 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductCaseInfoServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductCaseInfoServiceImpl.java index 829aaa6..c36954d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductCaseInfoServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductCaseInfoServiceImpl.java @@ -1,12 +1,14 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.portal.domain.HwProductCaseInfo; +import com.ruoyi.portal.mapper.HwProductCaseInfoMapper; +import com.ruoyi.portal.service.IHwProductCaseInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwProductCaseInfoMapper; -import com.ruoyi.portal.domain.HwProductCaseInfo; -import com.ruoyi.portal.service.IHwProductCaseInfoService; + +import java.util.List; +import java.util.stream.Collectors; /** * 案例内容Service业务层处理 @@ -93,4 +95,22 @@ public class HwProductCaseInfoServiceImpl implements IHwProductCaseInfoService { return hwProductCaseInfoMapper.deleteHwProductCaseInfoByCaseInfoId(caseInfoId); } + + /** + * 根据configTypeId获取首页典型案例 + * @param hwProductCaseInfo + * @return + */ + @Override + public HwProductCaseInfo getTypicalHomeCaseInfo(HwProductCaseInfo hwProductCaseInfo){ + hwProductCaseInfo.setHomeTypicalFlag("1"); + List productCaseInfoList = hwProductCaseInfoMapper.selectHwProductCaseInfoList(hwProductCaseInfo); + List typicalProductCaseInfoList = productCaseInfoList.stream().filter(pci -> pci.getTypicalFlag().equals("1")).collect(Collectors.toList()); + if(typicalProductCaseInfoList!=null && ! typicalProductCaseInfoList.isEmpty()){ + return typicalProductCaseInfoList.get(0); + }else if (productCaseInfoList!=null && !productCaseInfoList.isEmpty()){ + return productCaseInfoList.get(0); + } + return new HwProductCaseInfo(); + } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoDetailServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoDetailServiceImpl.java index b3ca46f..4628754 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoDetailServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoDetailServiceImpl.java @@ -1,12 +1,13 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.portal.domain.HwProductInfoDetail; +import com.ruoyi.portal.mapper.HwProductInfoDetailMapper; +import com.ruoyi.portal.service.IHwProductInfoDetailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwProductInfoDetailMapper; -import com.ruoyi.portal.domain.HwProductInfoDetail; -import com.ruoyi.portal.service.IHwProductInfoDetailService; + +import java.util.List; /** * 产品信息明细配置Service业务层处理 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java index b89915c..c545ce4 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java @@ -1,12 +1,19 @@ package com.ruoyi.portal.service.impl; -import java.util.List; +import com.ruoyi.common.core.constant.HwPortalConstants; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.portal.domain.HwProductInfo; +import com.ruoyi.portal.domain.HwProductInfoDetail; +import com.ruoyi.portal.mapper.HwProductInfoMapper; +import com.ruoyi.portal.service.IHwProductInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.portal.mapper.HwProductInfoMapper; -import com.ruoyi.portal.domain.HwProductInfo; -import com.ruoyi.portal.service.IHwProductInfoService; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; /** * 产品信息配置Service业务层处理 @@ -93,4 +100,80 @@ public class HwProductInfoServiceImpl implements IHwProductInfoService { return hwProductInfoMapper.deleteHwProductInfoByProductInfoId(productInfoId); } + + + /** + * 获取产品中心产品信息(平台简介,hw_product_info获取,(配置模式2左标题+内容,右图片)读取中文标题和英文标题,下面内容从hw_product_info_detail获取,读取标题,内容和图片) + * + * @param hwProductInfo 产品信息配置 + * @return 产品信息配置 + */ + @Override + public List selectHwProductInfoJoinDetailList(HwProductInfo hwProductInfo) + { + List hwProductInfoJoinDetailList = hwProductInfoMapper.selectHwProductInfoJoinDetailList(hwProductInfo); + return hwProductInfoJoinDetailList; + } + + + + /** + * 构建前端所需要树结构 + * + * @param productInfoDetails 产品明细列表 + * @return 树结构列表 + */ +// @Override + public List buildProductInfoDetailTree(List productInfoDetails) { + List returnList = new ArrayList<>(); + List tempList = productInfoDetails.stream().map(HwProductInfoDetail::getProductInfoDetailId).collect(Collectors.toList()); + for (HwProductInfoDetail hwProductInfoDetail : productInfoDetails) { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(hwProductInfoDetail.getParentId())) { + recursionFn(productInfoDetails, hwProductInfoDetail); + returnList.add(hwProductInfoDetail); + } + } + if (returnList.isEmpty()) { + returnList = productInfoDetails; + } + return returnList; + } + + /** + * 递归列表 + */ + private void recursionFn(List list, HwProductInfoDetail t) { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (HwProductInfoDetail tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + + /** + * 得到子节点列表 + */ + private List getChildList(List list, HwProductInfoDetail t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + HwProductInfoDetail n = (HwProductInfoDetail) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getProductInfoDetailId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, HwProductInfoDetail t) { + return getChildList(list, t).size() > 0 ? true : false; + } } diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwContactUsInfoMapper.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwContactUsInfoMapper.xml index 5b42004..055adc4 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwContactUsInfoMapper.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwContactUsInfoMapper.xml @@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select contact_us_info_id, user_name, user_email, user_phone, user_ip, create_time, create_by, update_time, update_by from hw_contact_us_info + select contact_us_info_id, user_name, user_email, user_phone, user_ip, remark,create_time, create_by, update_time, update_by from hw_contact_us_info and portal_config_type = #{portalConfigType} + and portal_config_type_id = #{portalConfigTypeId} and portal_config_title = #{portalConfigTitle} and portal_config_order = #{portalConfigOrder} and portal_config_desc = #{portalConfigDesc} @@ -45,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into hw_portal_config portal_config_type, + portal_config_type_id, portal_config_title, portal_config_order, portal_config_desc, @@ -58,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{portalConfigType}, + #{portalConfigTypeId}, #{portalConfigTitle}, #{portalConfigOrder}, #{portalConfigDesc}, @@ -75,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update hw_portal_config portal_config_type = #{portalConfigType}, + portal_config_type_id = #{portalConfigTypeId}, portal_config_title = #{portalConfigTitle}, portal_config_order = #{portalConfigOrder}, portal_config_desc = #{portalConfigDesc}, diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductCaseInfoMapper.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductCaseInfoMapper.xml index deb78b2..40000c3 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductCaseInfoMapper.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductCaseInfoMapper.xml @@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -18,24 +18,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - select case_info_id, case_info_title, case_type_id, typical_flag, case_info_desc, case_info_pic, case_info_html, create_time, create_by, update_time, update_by from hw_product_case_info + + select case_info_id, case_info_title, config_type_id, typical_flag, case_info_desc, case_info_pic, case_info_html, create_time, create_by, update_time, update_by from hw_product_case_info hpci + + select case_info_id, case_info_title, config_type_id, typical_flag, case_info_desc, case_info_pic, create_time, create_by, update_time, update_by from hw_product_case_info hpci + + + @@ -43,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into hw_product_case_info case_info_title, - case_type_id, + config_type_id, typical_flag, case_info_desc, case_info_pic, @@ -55,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{caseInfoTitle}, - #{caseTypeId}, + #{configTypeId}, #{typicalFlag}, #{caseInfoDesc}, #{caseInfoPic}, @@ -71,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update hw_product_case_info case_info_title = #{caseInfoTitle}, - case_type_id = #{caseTypeId}, + config_type_id = #{configTypeId}, typical_flag = #{typicalFlag}, case_info_desc = #{caseInfoDesc}, case_info_pic = #{caseInfoPic}, diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductInfoMapper.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductInfoMapper.xml index 5d248bc..4e3d3aa 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductInfoMapper.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwProductInfoMapper.xml @@ -16,6 +16,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + + + + + + + @@ -94,4 +115,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{productInfoId} + + + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java index 232af38..03b8c3a 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/controller/TdEngineController.java @@ -329,6 +329,25 @@ public class TdEngineController { return R.fail(e.getMessage()); } } + @InnerAuth + @PostMapping("/getDeviceLocation") + public R getDeviceLocation(@Validated @RequestBody TdSelectDto tdSelectDto) { + try { + return R.ok(this.tdEngineService.getDeviceLocation(tdSelectDto)); + } catch (UncategorizedSQLException e) { + String message = e.getCause().getMessage(); + try { + message = message.substring(message.lastIndexOf("invalid operation")); + } catch (Exception ex) { + } + log.error(message); + return R.fail(message); + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail(e.getMessage()); + } + } + /** * @return R>> diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java index 0e0a03c..70b638f 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/mapper/TdEngineMapper.java @@ -163,6 +163,8 @@ public interface TdEngineMapper { void dropTable(@Param("databaseName") String databaseName, @Param("tableName") String tableName); + Map getDeviceLocation(TdSelectDto tdSelectDto); + // /** // * 检查表是否存在 // * @param dataBaseName diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java index 1ab6212..5aa074c 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/ITdEngineService.java @@ -141,6 +141,8 @@ public interface ITdEngineService { * @date 2024-04-20 11:08 */ public void dropTable(String databaseName, String tableName) throws Exception; + + Map getDeviceLocation(TdSelectDto tdSelectDto); // void initSTableFrame(String msg) throws Exception; // List> getRealtimeData(SelectVisualDto selectVisualDto); diff --git a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java index 134c706..a1859d8 100644 --- a/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java +++ b/ruoyi-modules/hw-tdengine/src/main/java/com/ruoyi/tdengine/service/impl/TdEngineServiceImpl.java @@ -242,6 +242,10 @@ public class TdEngineServiceImpl implements ITdEngineService { } + @Override + public Map getDeviceLocation(TdSelectDto tdSelectDto) { + return this.tdEngineMapper.getDeviceLocation(tdSelectDto); + } /** * @param: databaseName diff --git a/ruoyi-modules/hw-tdengine/src/main/resources/bootstrap.yml b/ruoyi-modules/hw-tdengine/src/main/resources/bootstrap.yml index e43943e..6f5e7fe 100644 --- a/ruoyi-modules/hw-tdengine/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/hw-tdengine/src/main/resources/bootstrap.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml b/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml index 834f9f9..e5d99c3 100644 --- a/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml +++ b/ruoyi-modules/hw-tdengine/src/main/resources/mapper/tdengine/TdEngineMapper.xml @@ -226,7 +226,7 @@ resultType="java.util.Map"> select last(${item.fieldName}) + index="">last(${item.fieldName}),last(ts) from #{databaseName}.#{tableName} @@ -309,6 +309,10 @@ group by timetruncate(ts,1d),devicetype,onlinestatus,devicecode order by ts + diff --git a/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml b/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml index e7adb8c..cb2f2b2 100644 --- a/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml +++ b/ruoyi-modules/hw-websocket-server/src/main/resources/application.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: localhost:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: localhost:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-file/pom.xml b/ruoyi-modules/ruoyi-file/pom.xml index 1eec73a..5b943c1 100644 --- a/ruoyi-modules/ruoyi-file/pom.xml +++ b/ruoyi-modules/ruoyi-file/pom.xml @@ -16,56 +16,56 @@ - + com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery - + com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config - + com.alibaba.cloud spring-cloud-starter-alibaba-sentinel - + org.springframework.boot spring-boot-starter-actuator - + com.github.tobato fastdfs-client - + io.minio minio ${minio.version} - + com.ruoyi ruoyi-api-system - + com.ruoyi ruoyi-common-swagger - + @@ -84,5 +84,5 @@ - - \ No newline at end of file + + diff --git a/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/config/ResourcesConfig.java b/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/config/ResourcesConfig.java index 8003670..975d2ea 100644 --- a/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/config/ResourcesConfig.java +++ b/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/config/ResourcesConfig.java @@ -9,7 +9,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * 通用映射配置 - * + * * @author ruoyi */ @Configuration @@ -34,7 +34,7 @@ public class ResourcesConfig implements WebMvcConfigurer registry.addResourceHandler(localFilePrefix + "/**") .addResourceLocations("file:" + localFilePath + File.separator); } - + /** * 开启跨域 */ @@ -47,4 +47,4 @@ public class ResourcesConfig implements WebMvcConfigurer // 设置允许的方法 .allowedMethods("GET"); } -} \ No newline at end of file +} diff --git a/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/controller/SysFileController.java b/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/controller/SysFileController.java index 30a4fbf..065a41e 100644 --- a/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/controller/SysFileController.java +++ b/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/controller/SysFileController.java @@ -13,6 +13,8 @@ import com.ruoyi.common.core.utils.file.FileUtils; import com.ruoyi.file.service.ISysFileService; import com.ruoyi.system.api.domain.SysFile; +import javax.annotation.Resource; + /** * 文件请求处理 * @@ -22,6 +24,7 @@ import com.ruoyi.system.api.domain.SysFile; public class SysFileController { private static final Logger log = LoggerFactory.getLogger(SysFileController.class); +// @Resource(name = "LocalSysFileService") @Autowired private ISysFileService sysFileService; diff --git a/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml index 9094995..d34a632 100644 --- a/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml index 64b9d91..9af179c 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml index c2aa059..0124c9b 100644 --- a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java index 2722bf4..a4245b0 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java @@ -51,8 +51,9 @@ public class SysDeptController extends BaseController { @RequiresPermissions("system:dept:list") @GetMapping("/list") public AjaxResult list(SysDept dept) { - List depts = deptService.selectDeptList(dept); Long tenantId = SecurityUtils.getTenantId(); + dept.setTenantId(tenantId); + List depts = deptService.selectDeptList(dept); if (tenantId.equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)) { depts.forEach(d -> { if (!d.getTenantId().equals(tenantId)) { diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysPostController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysPostController.java index ad93749..34d70d1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysPostController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysPostController.java @@ -52,6 +52,8 @@ public class SysPostController extends BaseController @GetMapping("/list") public TableDataInfo list(SysPost post) { + Long tenantId = SecurityUtils.getTenantId(); + post.setTenantId(tenantId); startPage(); List list = postService.selectPostList(post); return getDataTable(list); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java index db2cc0b..7d3d1e1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysRoleController.java @@ -52,9 +52,12 @@ public class SysRoleController extends BaseController @GetMapping("/list") public TableDataInfo list(SysRole role) { - startPage(); - List list = roleService.selectRoleList(role); Long tenantId = SecurityUtils.getTenantId(); + role.setTenantId(tenantId); + startPage(); + + List list = roleService.selectRoleList(role); + if(tenantId.equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)){ list.forEach(r->{ if(!r.getTenantId().equals(tenantId)){ diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index 33b7145..377f7e6 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -164,6 +164,9 @@ public class SysUserController extends BaseController { public AjaxResult getAddedInfo(@PathVariable(value = "tenantId", required = false) Long tenantId) { userService.checkUserDataScope(null); AjaxResult ajax = AjaxResult.success(); + if (tenantId==null){ + tenantId = SecurityUtils.getLoginUser().getSysUser().getTenantId(); + } SysRole querySysRole = new SysRole(); querySysRole.setTenantId(tenantId); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 1d33a75..fb1a785 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -5,6 +5,7 @@ import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.constant.UserConstants; @@ -44,6 +45,9 @@ public class SysDeptServiceImpl implements ISysDeptService { @Override @DataScope(deptAlias = "d", tenantAlias = "d") public List selectDeptList(SysDept dept) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + Long tenantId = loginUser.getSysUser().getTenantId(); + dept.setTenantId(tenantId); return deptMapper.selectDeptList(dept); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 5660356..ea4d054 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.stream.Collectors; import javax.validation.Validator; +import com.ruoyi.system.api.model.LoginUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -70,6 +71,10 @@ public class SysUserServiceImpl implements ISysUserService { @Override @DataScope(deptAlias = "d", userAlias = "u", tenantAlias = "u") public List selectUserList(SysUser user) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + user.setTenantId(tenantId); return userMapper.selectUserList(user); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml index 3af593e..a05b3fb 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml @@ -3,7 +3,7 @@ server: port: 9661 # Spring -spring: +spring: application: # 应用名称 name: ruoyi-system @@ -14,10 +14,12 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 175.27.215.92:8848 + namespace: jrm_iot_dev # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index e9f0bf6..72e5f4f 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -44,13 +44,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND d.status = #{status} - + AND d.tenant_id = #{tenantId} - ${params.dataScope} - - ${params.tenantDataScope} + + + order by d.parent_id, d.order_num diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml index 112d0bf..f8d9bf7 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml @@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 9fcaf81..cc5a4da 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, r.status, r.del_flag, r.create_time, r.remark,r.tenant_id,ht.tenant_name @@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sys_dept d on u.dept_id = d.dept_id left join hw_tenant ht on r.tenant_id = ht.tenant_id - + - + - + - + - + - + - + - + - + insert into sys_role( role_id, @@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sysdate() ) - + update sys_role @@ -143,20 +143,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" status = #{status}, remark = #{remark}, update_by = #{updateBy}, + tenant_id = #{tenantId}, update_time = sysdate() where role_id = #{roleId} - + update sys_role set del_flag = '2' where role_id = #{roleId} - + update sys_role set del_flag = '2' where role_id in #{roleId} - + @@ -189,4 +190,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by r.role_sort - \ No newline at end of file + diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 1bfbda1..ab911aa 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND u.user_id = #{userId} - + AND u.tenant_id = #{tenantId} @@ -88,9 +88,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) - ${params.dataScope} +-- ${params.dataScope} - ${params.tenantDataScope} +-- ${params.tenantDataScope}