diff --git a/src/main/java/com/sipai/controller/alarm/AlarmPointController.java b/src/main/java/com/sipai/controller/alarm/AlarmPointController.java index f50d1f13..b83fe1f5 100644 --- a/src/main/java/com/sipai/controller/alarm/AlarmPointController.java +++ b/src/main/java/com/sipai/controller/alarm/AlarmPointController.java @@ -369,7 +369,9 @@ public class AlarmPointController { this.mPointService.updateLalarmmin(alarmPoint.getUnitId(), mPoint.getMpointcode()); // mPoint.setLalarmmin(null); } -// this.mPointService.update2(alarmPoint.getUnitId(),mPoint); + // Enable TriggerAlarm to allow ScadaAlarmJob to process this MPoint + mPoint.setTriggeralarm("1"); + this.mPointService.update2(alarmPoint.getUnitId(), mPoint); } if (code == Result.SUCCESS) { diff --git a/src/main/java/com/sipai/controller/alarm/ProAlarmController.java b/src/main/java/com/sipai/controller/alarm/ProAlarmController.java index 7ae19cca..8a626ae8 100644 --- a/src/main/java/com/sipai/controller/alarm/ProAlarmController.java +++ b/src/main/java/com/sipai/controller/alarm/ProAlarmController.java @@ -197,16 +197,15 @@ public class ProAlarmController { // Iterator sIterator = jsonObject.keys(); JSONArray arr = new JSONArray(); - List allxServerList = this.xServerService.selectListByWhere(" where 1=1 "); - for (XServer xServer : - allxServerList) { +// List allxServerList = this.xServerService.selectListByWhere(" where 1=1 "); +// for (XServer xServer : allxServerList) { // if (jsonObject.get(xServer.getBizid()) != null) { // String code_value = jsonObject.get(xServer.getBizid()).toString(); // code_value = code_value + ",data_stop_alarm"; // code_value = code_value.replace(",", "','"); // List list = this.proAlarmService.selectListByWhere(xServer.getBizid(), wherestr + " and point_code in ('" + code_value + "')" // + orderstr); - List list = this.proAlarmService.selectListByWhere(xServer.getBizid(), wherestr + orderstr); + List list = this.proAlarmService.selectListByWhere(companyId, wherestr + orderstr); // System.out.println(wherestr + " and point_code in ('" + code_value + "')"); if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { @@ -249,7 +248,7 @@ public class ProAlarmController { } // } - } +// } model.addAttribute("result", arr); return new ModelAndView("result"); } diff --git a/src/main/java/com/sipai/controller/report/RptDayLogController.java b/src/main/java/com/sipai/controller/report/RptDayLogController.java index b2710b2c..4197c8c6 100644 --- a/src/main/java/com/sipai/controller/report/RptDayLogController.java +++ b/src/main/java/com/sipai/controller/report/RptDayLogController.java @@ -123,6 +123,13 @@ public class RptDayLogController { 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"; + } + JSONObject jsonObject = this.rptDayLogService.getJson(null,rptdeptId,rptdt,userId); Result result = Result.success(jsonObject); @@ -149,6 +156,14 @@ public class RptDayLogController { @RequestParam(value = "rptdeptId") String rptdeptId) 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"; + } + JSONObject jsonObject = this.rptDayLogService.getJson(id,rptdeptId,null,userId); model.addAttribute("rptDayLog", jsonObject); // return "/report/reportdetail"; @@ -196,6 +211,15 @@ public class RptDayLogController { String userId = cu.getId(); String json = request.getParameter("json"); JSONObject jsonObject = JSONObject.fromObject(json); + + // 权限验证:检查用户是否有填报权限 + String rptdeptId = (String) jsonObject.get("rptdeptId"); + if (!this.rptDayLogService.checkInputPermission(rptdeptId, cu)) { + Result result = Result.failed("您没有该报表的填报权限"); + model.addAttribute("result", CommUtil.toJson(result)); + return "result"; + } + if (jsonObject.get("id")==null||jsonObject.get("id").equals("")) { jsonObject.put("id", CommUtil.getUUID()); } @@ -268,6 +292,14 @@ public class RptDayLogController { @RequestParam(value = "rptdeptId", required=false) String rptdeptId) { 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"; + } + MultipartRequest multipartRequest = (MultipartRequest)request; List fileList = multipartRequest.getFiles("filelist"); diff --git a/src/main/java/com/sipai/controller/timeefficiency/PatrolModelController.java b/src/main/java/com/sipai/controller/timeefficiency/PatrolModelController.java index 6b84abcb..c29cd814 100644 --- a/src/main/java/com/sipai/controller/timeefficiency/PatrolModelController.java +++ b/src/main/java/com/sipai/controller/timeefficiency/PatrolModelController.java @@ -227,7 +227,7 @@ public class PatrolModelController { User cu=(User)request.getSession().getAttribute("cu"); String companyId = request.getParameter("bizId"); String type = request.getParameter("type"); - List list = this.patrolModelService.selectListByWhere("where unit_id = '"+companyId+"' and type='"+type+"' order by insdt"); + List list = this.patrolModelService.selectListByWhere("where unit_id = '"+companyId+"' order by insdt"); ArrayList list4select2 = new ArrayList(); for (int i=0;i map_redis_data = redissonClient.getMapCache(CommString.RedisMpointFlag + num); + if (map_redis_data.get(id) != null && !"".equals(map_redis_data.get(id))) { + String[] str = map_redis_data.get(id).split(";"); + if (str.length >= 3 && str[1] != null && !str[1].isEmpty() && !"null".equals(str[1])) { + mPoint.setParmvalue(new BigDecimal(str[1])); + mPoint.setMeasuredt(str[2]); + } else { + mPoint.setParmvalue(BigDecimal.ZERO); + } + } + } PageInfo pi = new PageInfo(list); JSONArray json = JSONArray.fromObject(list); result = "{\"total\":" + pi.getTotal() + ",\"rows\":" + json + "}"; diff --git a/src/main/java/com/sipai/controller/work/SchedulingController.java b/src/main/java/com/sipai/controller/work/SchedulingController.java index e4be6e7d..5fc2bdf4 100644 --- a/src/main/java/com/sipai/controller/work/SchedulingController.java +++ b/src/main/java/com/sipai/controller/work/SchedulingController.java @@ -133,6 +133,9 @@ public class SchedulingController { public String doadd(HttpServletRequest request, Model model, @RequestParam(value = "date") String date) { model.addAttribute("date", date.substring(0, 10)); + if(request.getParameter("bizid") != null && !request.getParameter("bizid").isEmpty()){ + model.addAttribute("bizid", request.getParameter("bizid")); + } return "work/schedulingAdd"; } @@ -142,6 +145,9 @@ public class SchedulingController { String wherestr = " where s.id = '" + schedulingId + "'"; List scheduling = this.schedulingService.selectCalenderListByWhere(wherestr); model.addAttribute("scheduling", scheduling.get(0)); + if(request.getParameter("bizid") != null && !request.getParameter("bizid").isEmpty()){ + model.addAttribute("bizid", request.getParameter("bizid")); + } return "work/schedulingEdit"; } diff --git a/src/main/java/com/sipai/service/report/RptDayLogService.java b/src/main/java/com/sipai/service/report/RptDayLogService.java index ded44ebe..4bce3d23 100644 --- a/src/main/java/com/sipai/service/report/RptDayLogService.java +++ b/src/main/java/com/sipai/service/report/RptDayLogService.java @@ -60,4 +60,11 @@ public interface RptDayLogService { * @return */ public abstract Result onekeyAudit(String ids ,User cu,String rptdeptId); + + /** 检查用户是否有填报权限 + * @param rptdeptId 填报配置id + * @param user 当前用户 + * @return true=有权限, false=无权限 + */ + public abstract boolean checkInputPermission(String rptdeptId, 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 82108afd..9d7ad314 100644 --- a/src/main/java/com/sipai/service/report/impl/RptDayLogServiceImpl.java +++ b/src/main/java/com/sipai/service/report/impl/RptDayLogServiceImpl.java @@ -10,6 +10,7 @@ import com.sipai.entity.scada.MPoint; import com.sipai.entity.scada.MPointExpand; import com.sipai.entity.scada.MPointHistory; import com.sipai.entity.user.User; +import com.sipai.entity.user.UserJob; import com.sipai.service.msg.MsgService; import com.sipai.service.msg.MsgServiceImpl; import com.sipai.service.msg.MsgTypeService; @@ -20,6 +21,7 @@ import com.sipai.service.scada.MPointExpandService; import com.sipai.service.scada.MPointHistoryService; import com.sipai.service.scada.MPointService; import com.sipai.service.user.UserService; +import com.sipai.service.user.UserJobService; import com.sipai.tools.CommUtil; import com.sipai.tools.SpringContextUtil; import net.sf.json.JSONArray; @@ -65,6 +67,8 @@ public class RptDayLogServiceImpl implements RptDayLogService { private MsgTypeService msgtypeService; @Resource private MPointExpandService mPointExpandService; + @Resource + private UserJobService userJobService; @Override public RptDayLog selectById(String id) { @@ -877,5 +881,69 @@ public class RptDayLogServiceImpl implements RptDayLogService { Result result = Result.success(1); return result; } - + + @Override + public boolean checkInputPermission(String rptdeptId, User user) { + if (rptdeptId == null || user == null) { + return false; + } + + RptDeptSet rptDeptSet = this.rptDeptSetService.selectById(rptdeptId); + if (rptDeptSet == null) { + return false; + } + + Integer roleType = rptDeptSet.getRoleType(); + String inputuser = rptDeptSet.getInputuser(); + String inputjob = rptDeptSet.getInputjob(); + String userId = user.getId(); + + // role_type=2: 不控制权限,所有人都可以填报 + if (roleType != null && roleType == 2) { + return true; + } + + // role_type 为 null 或空字符串: 允许所有人 + if (roleType == null || roleType == 0 && (inputuser == null || inputuser.isEmpty()) + || roleType == 1 && (inputjob == null || inputjob.isEmpty())) { + return true; + } + + // role_type=0: 按用户控制权限 + if (roleType == 0) { + if (inputuser != null && !inputuser.isEmpty()) { + // 检查当前用户ID是否在inputuser中 + String[] userIds = inputuser.split(","); + for (String uid : userIds) { + if (userId.equals(uid.trim())) { + return true; + } + } + } + return false; + } + + // role_type=1: 按岗位控制权限 + if (roleType == 1) { + if (inputjob != null && !inputjob.isEmpty()) { + // 获取当前用户的所有岗位 + List userJobs = this.userJobService.selectListByWhere("where userid = '" + userId + "'"); + if (userJobs != null && !userJobs.isEmpty()) { + String[] jobIds = inputjob.split(","); + for (UserJob userJob : userJobs) { + String userJobId = userJob.getJobid(); + for (String jobId : jobIds) { + if (userJobId != null && userJobId.equals(jobId.trim())) { + return true; + } + } + } + } + } + return false; + } + + return false; + } + } diff --git a/src/main/webapp/jsp/user/roleList.jsp b/src/main/webapp/jsp/user/roleList.jsp index a33858ac..94c4c8c8 100644 --- a/src/main/webapp/jsp/user/roleList.jsp +++ b/src/main/webapp/jsp/user/roleList.jsp @@ -56,7 +56,7 @@ //编辑用户信息 var editUserFun = function (roleid, bizid) { - $.post(ext.contextPath + '/user/showRoleUser.do', { roleid: roleid }, function (data) { + $.post(ext.contextPath + '/user/showRoleUser.do', { roleid: roleid, bizid: bizid }, function (data) { $("#subDiv_User").html(data); openModal('roleUserModal'); }); diff --git a/src/main/webapp/jsp/user/roleUser.jsp b/src/main/webapp/jsp/user/roleUser.jsp index 3a616005..abc3b45f 100644 --- a/src/main/webapp/jsp/user/roleUser.jsp +++ b/src/main/webapp/jsp/user/roleUser.jsp @@ -88,9 +88,14 @@ $("#search_pid").select2({ ajax: { type:'POST', - url: ext.contextPath +"/work/group/getListForSelect.do", + url: ext.contextPath +"/user/getDeptByBizId4Select.do", dataType: 'json', delay: 250, + data: function (params) { + return { + companyId: '${companyId}' + }; + }, processResults: function (data) { return { results: data diff --git a/src/main/webapp/jsp/work/schedulingAdd.jsp b/src/main/webapp/jsp/work/schedulingAdd.jsp index 831c630c..97db231f 100644 --- a/src/main/webapp/jsp/work/schedulingAdd.jsp +++ b/src/main/webapp/jsp/work/schedulingAdd.jsp @@ -202,9 +202,14 @@ }, 'json'); //巡检模式 + var patrolType = '${param.patroltype}'; + var bizIdForPatrol = '${bizid}'; + if (!bizIdForPatrol || bizIdForPatrol === '') { + bizIdForPatrol = unitId; + } $.post(ext.contextPath + "/timeEfficiency/patrolModel/getPatrolModelList4Select3.do", { - type: '${param.patroltype}', - bizId: unitId + type: patrolType, + bizId: bizIdForPatrol }, function (data) { var selectpatrolmode_add = $("#schedulingAddModal #patrolmode").select2({ data: data, diff --git a/src/main/webapp/jsp/work/schedulingEdit.jsp b/src/main/webapp/jsp/work/schedulingEdit.jsp index 78e6f2ab..0b2726e9 100644 --- a/src/main/webapp/jsp/work/schedulingEdit.jsp +++ b/src/main/webapp/jsp/work/schedulingEdit.jsp @@ -134,9 +134,14 @@ }, 'json'); //巡检模式 + var patrolType = '${param.patroltype}'; + var bizIdForPatrol = '${bizid}'; + if (!bizIdForPatrol || bizIdForPatrol === '') { + bizIdForPatrol = unitId; + } $.post(ext.contextPath + "/timeEfficiency/patrolModel/getPatrolModelList4Select3.do", { - type: '${param.patroltype}', - bizId: unitId + type: patrolType, + bizId: bizIdForPatrol }, function (data) { var selectpatrolmode_edit = $("#schedulingEditModal #patrolmode").select2({ data: data, diff --git a/src/main/webapp/jsp/work/schedulingHandoverList.jsp b/src/main/webapp/jsp/work/schedulingHandoverList.jsp index 30b88833..231b3e0a 100644 --- a/src/main/webapp/jsp/work/schedulingHandoverList.jsp +++ b/src/main/webapp/jsp/work/schedulingHandoverList.jsp @@ -8,15 +8,16 @@