From 0c8b53033936b59f1c72acf23aceb015e7aa6a4c Mon Sep 17 00:00:00 2001 From: Timer <@> Date: Sun, 5 Apr 2026 22:16:12 +0800 Subject: [PATCH] bug --- .../report/RptDayLogController.java | 37 +++- .../controller/work/SchedulingController.java | 6 +- .../service/report/RptDayLogService.java | 7 + .../service/report/RptInfoSetService.java | 8 + .../report/impl/RptDayLogServiceImpl.java | 23 ++ .../report/impl/RptInfoSetServiceImpl.java | 45 ++++ src/main/webapp/jsp/report/rptDayLogList.jsp | 9 +- 使用说明文档.md | 205 ++++++++++++++++++ 8 files changed, 329 insertions(+), 11 deletions(-) create mode 100644 使用说明文档.md diff --git a/src/main/java/com/sipai/controller/report/RptDayLogController.java b/src/main/java/com/sipai/controller/report/RptDayLogController.java index bb4f6d91..c86545aa 100644 --- a/src/main/java/com/sipai/controller/report/RptDayLogController.java +++ b/src/main/java/com/sipai/controller/report/RptDayLogController.java @@ -122,14 +122,14 @@ public class RptDayLogController { @RequestParam(value = "rptdt") String rptdt) throws IOException { User cu = (User) request.getSession().getAttribute("cu"); String userId = cu.getId(); - + // 权限验证:检查用户是否有填报权限 - if (!this.rptDayLogService.checkInputPermission(rptdeptId, cu)) { - Result result = Result.failed("您没有该报表的填报权限"); - model.addAttribute("result", CommUtil.toJson(result)); - return "result"; - } - +// if (!this.rptDayLogService.checkInputPermission(rptdeptId, cu)) { +// Result result = Result.failed("您没有该报表的填报权限"); +// model.addAttribute("result", CommUtil.toJson(result)); +// return "result"; +// } + JSONObject jsonObject = this.rptDayLogService.getJson(null,rptdeptId,rptdt,userId); Result result = Result.success(jsonObject); @@ -251,6 +251,29 @@ public class RptDayLogController { @RequestMapping("/dodeletes.do") public String dodels(HttpServletRequest request,Model model, @RequestParam(value="ids") String ids){ +// User cu = (User) request.getSession().getAttribute("cu"); +// String userId = cu.getId(); + + // 获取rptdeptId,假设从参数或第一个ID推断 +// String rptdeptId = request.getParameter("rptdeptId"); +// if (rptdeptId == null || rptdeptId.isEmpty()) { +// // 如果没有提供rptdeptId,从第一个ID获取 +// String[] idArray = ids.split(","); +// if (idArray.length > 0) { +// RptDayLog rptDayLog = this.rptDayLogService.selectById(idArray[0]); +// if (rptDayLog != null) { +// rptdeptId = rptDayLog.getRptdeptId(); +// } +// } +// } + + // 权限验证:检查用户是否有生成权限 +// if (!this.rptDayLogService.checkGeneratePermission(rptdeptId, cu)) { +// Result result = Result.failed("您没有该报表的删除权限,无法删除");// 生成权限=删除权限 +// model.addAttribute("result", CommUtil.toJson(result)); +// return "result"; +// } + String[] idArray = ids.split(","); try { for (int i = 0; i < idArray.length; i++) { diff --git a/src/main/java/com/sipai/controller/work/SchedulingController.java b/src/main/java/com/sipai/controller/work/SchedulingController.java index 5fc2bdf4..c5d5917b 100644 --- a/src/main/java/com/sipai/controller/work/SchedulingController.java +++ b/src/main/java/com/sipai/controller/work/SchedulingController.java @@ -481,7 +481,7 @@ public class SchedulingController { JSONArray array = new JSONArray(); String[] workpeopleids = scheduling.getWorkpeople().split(","); if (workpeopleids != null && workpeopleids.length > 0) { - if (!workpeopleids[0].equals("")) { + if (!userId.equals(workpeopleids[0])) { for (int i = 0; i < workpeopleids.length; i++) { if (!userId.equals(workpeopleids[i])) { JSONObject object = new JSONObject(); @@ -1156,6 +1156,10 @@ public class SchedulingController { } } + // 获取交班表单数据 + List formDataList = this.groupContentFormDataService.selectListByWhere(" where schedulingId='" + schedulingId + "' "); + model.addAttribute("formDataList", formDataList); + model.addAttribute("scheduling", scheduling); return "work/schedulingView"; } diff --git a/src/main/java/com/sipai/service/report/RptDayLogService.java b/src/main/java/com/sipai/service/report/RptDayLogService.java index 4bce3d23..860322b4 100644 --- a/src/main/java/com/sipai/service/report/RptDayLogService.java +++ b/src/main/java/com/sipai/service/report/RptDayLogService.java @@ -67,4 +67,11 @@ public interface RptDayLogService { * @return true=有权限, false=无权限 */ public abstract boolean checkInputPermission(String rptdeptId, User user); + + /** 检查用户是否有生成权限 + * @param rptdeptId 填报配置id + * @param user 当前用户 + * @return true=有权限, false=无权限 + */ + public abstract boolean checkGeneratePermission(String rptdeptId, User user); } diff --git a/src/main/java/com/sipai/service/report/RptInfoSetService.java b/src/main/java/com/sipai/service/report/RptInfoSetService.java index 2363adf7..12686e28 100644 --- a/src/main/java/com/sipai/service/report/RptInfoSetService.java +++ b/src/main/java/com/sipai/service/report/RptInfoSetService.java @@ -71,6 +71,14 @@ public interface RptInfoSetService { * @return */ public abstract String getRptInfoSetIds(String userId, String unitId, String type); + + /** + * 检查用户是否有生成权限 + * @param rptInfoSetId 报表配置ID + * @param user 用户 + * @return true=有权限, false=无权限 + */ + public abstract boolean checkGeneratePermission(String rptInfoSetId, com.sipai.entity.user.User user); /** * diff --git a/src/main/java/com/sipai/service/report/impl/RptDayLogServiceImpl.java b/src/main/java/com/sipai/service/report/impl/RptDayLogServiceImpl.java index 9d7ad314..cde56ae4 100644 --- a/src/main/java/com/sipai/service/report/impl/RptDayLogServiceImpl.java +++ b/src/main/java/com/sipai/service/report/impl/RptDayLogServiceImpl.java @@ -17,6 +17,7 @@ import com.sipai.service.msg.MsgTypeService; import com.sipai.service.report.RptDayLogService; import com.sipai.service.report.RptDayValSetService; import com.sipai.service.report.RptDeptSetService; +import com.sipai.service.report.RptInfoSetService; import com.sipai.service.scada.MPointExpandService; import com.sipai.service.scada.MPointHistoryService; import com.sipai.service.scada.MPointService; @@ -70,6 +71,9 @@ public class RptDayLogServiceImpl implements RptDayLogService { @Resource private UserJobService userJobService; + @Resource + private RptInfoSetService rptInfoSetService; + @Override public RptDayLog selectById(String id) { RptDayLog rptDayLog =this.rptDayLogDao.selectByPrimaryKey(id); @@ -946,4 +950,23 @@ public class RptDayLogServiceImpl implements RptDayLogService { return false; } + @Override + public boolean checkGeneratePermission(String rptdeptId, User user) { + if (rptdeptId == null || user == null) { + return false; + } + + RptDeptSet rptDeptSet = this.rptDeptSetService.selectById(rptdeptId); + if (rptDeptSet == null) { + return false; + } + + String rptInfoSetId = rptDeptSet.getBizId(); // 假设bizId是RptInfoSet的ID + if (rptInfoSetId == null || rptInfoSetId.isEmpty()) { + return false; + } + + return this.rptInfoSetService.checkGeneratePermission(rptInfoSetId, user); + } + } diff --git a/src/main/java/com/sipai/service/report/impl/RptInfoSetServiceImpl.java b/src/main/java/com/sipai/service/report/impl/RptInfoSetServiceImpl.java index 3beaf548..5c53a740 100644 --- a/src/main/java/com/sipai/service/report/impl/RptInfoSetServiceImpl.java +++ b/src/main/java/com/sipai/service/report/impl/RptInfoSetServiceImpl.java @@ -615,4 +615,49 @@ public class RptInfoSetServiceImpl implements RptInfoSetService { } return list_result; } + + @Override + public boolean checkGeneratePermission(String rptInfoSetId, User user) { + if (rptInfoSetId == null || user == null) { + return false; + } + + RptInfoSet rptInfoSet = this.selectById(rptInfoSetId); + if (rptInfoSet == null) { + return false; + } + + String userId = user.getId(); + String createusers = rptInfoSet.getCreateusers(); + String generatePosition = rptInfoSet.getGeneratePosition(); + + // 检查createusers + if (createusers != null && !createusers.isEmpty()) { + String[] userIds = createusers.split(","); + for (String uid : userIds) { + if (userId.equals(uid.trim())) { + return true; + } + } + } + + // 检查generatePosition + if (generatePosition != null && !generatePosition.isEmpty()) { + // 获取当前用户的所有岗位 + List userJobs = userJobService.selectListByWhere("where userid = '" + userId + "'"); + if (userJobs != null && !userJobs.isEmpty()) { + String[] jobIds = generatePosition.split(","); + for (UserJob userJob : userJobs) { + String userJobId = userJob.getJobid(); + for (String jobId : jobIds) { + if (userJobId != null && userJobId.equals(jobId.trim())) { + return true; + } + } + } + } + } + + return false; + } } diff --git a/src/main/webapp/jsp/report/rptDayLogList.jsp b/src/main/webapp/jsp/report/rptDayLogList.jsp index 8f44e90e..aa93aa1d 100644 --- a/src/main/webapp/jsp/report/rptDayLogList.jsp +++ b/src/main/webapp/jsp/report/rptDayLogList.jsp @@ -78,8 +78,11 @@ rptdt: time, rptdeptId: '${param.rptdeptId}' }, function (data) { - $("#rptDiv").html(data); - openModal('subModal'); + if (data.code > 0) { + $("#rptDiv").html(data); openModal('subModal'); + } else { + showAlert('d', '您没有该报表的填报权限', 'mainAlertdiv'); + } }); }; @@ -160,7 +163,7 @@ if (data.code > 0) { $("#table").bootstrapTable('refresh'); } else { - showAlert('d', '删除失败', 'mainAlertdiv'); + showAlert('d', data.msg, 'mainAlertdiv'); } }, 'json'); diff --git a/使用说明文档.md b/使用说明文档.md new file mode 100644 index 00000000..c77b4f5f --- /dev/null +++ b/使用说明文档.md @@ -0,0 +1,205 @@ +# SIPAIIS_WMS_JSSW 项目使用说明文档 + +## 项目概述 + +SIPAIIS_WMS_JSSW 是一个基于Java的污水处理管理平台(SIPAIIS Wastewater Management System for JSSW),旨在提供全过程的监控、管理和优化服务。该系统采用Spring框架、MyBatis ORM、Activiti工作流引擎等技术栈,支持多种集成如Redis缓存、RabbitMQ消息队列、MQTT物联网通信等。 + +### 技术栈 +- **后端框架**: Spring 5.1.12, Spring MVC, Spring Security +- **数据库ORM**: MyBatis 3.5.1 +- **工作流**: Activiti 5.22.0 +- **缓存**: Redis, Redisson +- **消息队列**: RabbitMQ, Spring AMQP +- **物联网**: MQTT (Eclipse Paho), Modbus +- **搜索**: Elasticsearch +- **定时任务**: Quartz, XXL-Job +- **WebSocket**: 实时通信 +- **报表**: JasperReports, iText PDF +- **Excel处理**: Apache POI, EasyExcel +- **对象存储**: MinIO +- **其他**: Hutool工具库, Lombok, Knife4j API文档 + +### 部署环境 +- **Java版本**: JDK 1.8 +- **应用服务器**: 支持WAR包部署,如Tomcat, Jetty +- **数据库**: SQL Server (推荐), 支持其他JDBC兼容数据库 +- **端口**: 默认8088 (Jetty) + +## 功能点梳理 + +基于项目中的功能清单,系统包含以下主要功能模块: + +### 1. 用户管理 +- 用户信息增删改查 +- 部门组织架构管理 +- 角色权限管理 +- 菜单配置 + +### 2. 监控与报警 +- 测点数据管理 +- 报警记录管理 +- 报警类型配置 +- 设备监控 + +### 3. 设备管理 +- 设备基本信息管理 +- 设备类型分类 +- 设备生命周期管理(采购、入库、出库、维修、保养、巡检、点检、润滑、校准、报废等) +- 设备统计、分析、排名、对比、预警 +- BIM设备关联与巡检 + +### 4. 工单管理 +- 工作工单管理 +- 维修工单处理 +- 保养工单管理 +- 工单执行与跟踪 + +### 5. 备品备件管理 +- 备件库存管理 +- 采购记录管理 +- 库存调拨管理 + +### 6. 视频监控 +- 摄像头管理 +- NVR设备管理 + +### 7. 巡检与考核 +- 巡检计划与记录 +- KPI考核指标、计划、结果 + +### 8. 消息与通知 +- 系统消息管理 +- 短信用户管理 + +### 9. 工作流管理 +- 工作流流程管理 +- 请假申请 +- 任务管理 + +### 10. 文档管理 +- 文档资料管理 +- 图书资料管理 +- 图纸管理 + +### 11. 报表与分析 +- 数据报表管理 +- 工作日报管理 +- 能源数据监控 +- 生产工艺参数 +- 生产指标管理 + +### 12. 可视化展示 +- 大屏数据可视化 +- 工艺流程图管理 +- 页面布局配置 + +### 13. 计划与交互 +- 生产计划管理 +- 页面交互配置 +- 数据类型定义 + +### 14. BIM管理 +- BIM模型管理 +- BIM巡检路线 +- BIM设备关联 +- BIM报警记录 + +### 15. 其他模块 +- 缓存数据管理 +- JSP配置 +- 第三方接口集成 + +## 功能点间相互依赖关系 + +### 核心依赖关系 +- **设备管理** 是基础模块,其他模块如报警、工单、巡检、BIM等均依赖设备数据。 +- **测点与报警**: 报警依赖测点数据和设备状态。 +- **工单管理**: 维修、保养工单依赖设备信息和工作流引擎。 +- **工作流**: 工单、请假、任务等流程依赖Activiti工作流。 +- **巡检与KPI**: 巡检记录影响KPI考核结果。 +- **BIM**: BIM设备关联依赖设备管理,BIM报警依赖报警模块。 +- **报表与可视化**: 依赖各模块数据进行统计和展示。 +- **消息通知**: 报警、工单等事件触发消息发送。 +- **缓存与消息队列**: Redis用于缓存热点数据,RabbitMQ用于异步处理,MQTT用于设备通信。 + +### 数据流依赖 +- 用户权限控制贯穿所有模块。 +- 设备数据是中心,影响报警、工单、统计等。 +- 工作流驱动业务流程,如工单审批。 +- 集成技术(Redis、MQ、ES)支持高性能和实时性。 + +## 安装与部署 + +### 环境要求 +- JDK 1.8+ +- Maven 3.6+ +- 数据库:SQL Server 2012+ 或兼容JDBC数据库 +- Redis 2.6+ +- RabbitMQ 5.9+ +- Elasticsearch 3.2+ +- MinIO (可选,用于文件存储) + +### 部署步骤 +1. **克隆或下载项目**: + ``` + git clone + cd SIPAIIS_WMS_JSSW + ``` + +2. **配置数据库**: + - 编辑 `src/main/resources/db.properties` 配置数据库连接。 + - 执行数据库脚本初始化表结构。 + +3. **配置其他服务**: + - 编辑 `config.properties`, `redis.properties`, `rabbitmq.properties`, `mqtt.properties` 等配置文件。 + - 启动Redis, RabbitMQ, Elasticsearch等服务。 + +4. **构建项目**: + ``` + mvn clean package + ``` + +5. **部署WAR包**: + - 将 `target/TGLW.war` 部署到Tomcat或Jetty。 + - 默认端口8088,可在 `pom.xml` 中修改。 + +6. **启动应用**: + - 访问 `http://localhost:8088/` 进入系统。 + +### 配置说明 +- **applicationContext.xml**: Spring上下文配置,XXL-Job执行器。 +- **log4j.properties**: 日志配置。 +- **xxl-job-executor.properties**: 定时任务配置。 + +## 使用指南 + +### 系统登录 +- 默认管理员账号:根据配置。 +- 登录后,根据角色权限访问不同模块。 + +### 主要操作 +- **设备管理**: 添加设备,配置参数,监控状态。 +- **报警处理**: 查看报警记录,确认处理。 +- **工单执行**: 创建工单,分配任务,跟踪进度。 +- **巡检管理**: 设置巡检计划,记录巡检结果。 +- **报表查看**: 生成各类统计报表。 +- **BIM可视化**: 查看3D模型,关联设备数据。 + +### API文档 +- 使用Knife4j查看API接口:`http://localhost:8088/doc.html` + +### 维护与监控 +- 日志文件:`logs/TGLW.log` +- 监控Redis、MQ连接状态。 +- 使用XXL-Job管理定时任务。 + +## 注意事项 +- 确保数据库和外部服务正常运行。 +- 定期备份数据。 +- 根据实际环境调整配置文件。 +- 安全配置:启用Spring Security,定期更新密码。 + +## 联系与支持 +- 项目维护者:JSSW团队 +- 版本:0.0.1-SNAPSHOT +- 更新日期:2026-04-05