From 21989973eb90e0fbf60c60ef9343a117fa67d354 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 28 四月 2024 08:55:56 +0800 Subject: [PATCH] 靳总离职前,应元谋二期项目要求(慧图),做了通信协议修改,在他离职后,从韩月处得到最新协议,并做了部分协议软件实现修改,发现新协议中有一些协议定义有重复,也有错误的,所以这版本协议未全部实现,但实现的部分可以用来测试测控一体阀(与段志强一起测试过)。目前情况下,这版本协议实现不能应用于实际项目中,如果必须实现,还需要结合硬件协议具体实现内容再实现通信中间件的协议解析与构造部分,还需要实现上行数据处理任务树部分。 --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java | 57 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 43 insertions(+), 14 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java index be9c7e8..fce86e8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java @@ -1,5 +1,6 @@ package com.dy.pipIrrBase.role; +import com.alibaba.fastjson2.JSONArray; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoBa.BaRoleMapper; import com.dy.pipIrrGlobal.daoBa.BaRolePermissionsMapper; @@ -11,8 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; /** * @author ZhuBaoMin @@ -52,27 +55,53 @@ public QueryResultVo<List<VoRole>> getRoles(QueryVo queryVo) { Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); - Long itemTotal = baRoleMapper.getRecordCount(params); + Long itemTotal = baRolePermissionsMapper.getRecordCount(params); QueryResultVo<List<VoRole>> rsVo = new QueryResultVo<>() ; - Integer pageCurr = 0; - Integer pageSize = 10000; - rsVo.pageCurr = 1; - rsVo.pageSize = 10000; - if(queryVo.pageSize != null && queryVo.pageCurr != null) { - rsVo.pageSize = queryVo.pageSize ; - rsVo.pageCurr = queryVo.pageCurr; - pageSize = queryVo.pageSize ; - pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); - } - params.put("pageCurr", pageCurr); - params.put("pageSize", pageSize); + //Integer pageCurr = 0; + //Integer pageSize = 10000; + //rsVo.pageCurr = 1; + //rsVo.pageSize = 10000; + //if(queryVo.pageSize != null && queryVo.pageCurr != null) { + // rsVo.pageSize = queryVo.pageSize ; + // rsVo.pageCurr = queryVo.pageCurr; + // pageSize = queryVo.pageSize ; + // pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); + //} + //params.put("pageCurr", pageCurr); + //params.put("pageSize", pageSize); + rsVo.pageSize = queryVo.pageSize ; + rsVo.pageCurr = queryVo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); - rsVo.obj = baRoleMapper.getRoles(params); + //rsVo.obj = baRoleMapper.getRoles(params); + + /** + * 鑾峰彇瑙掕壊鍒楄〃锛屾妸姹楄鑹叉潈闄怚D + * 閬嶅巻瑙掕壊鍒楄〃骞跺彇鍑鸿鑹插璞′腑鐨刾erId + * 鏍规嵁perId鑾峰彇鏉冮檺瀵硅薄锛屽苟灏嗗璞℃坊鍔犲埌瑙掕壊瀵硅薄涓� + */ + List<VoRole> list_Roles = Optional.ofNullable(baRolePermissionsMapper.getRoles(params)).orElse(new ArrayList<>()); + if(list_Roles.size() > 0) { + for(int i = 0; i < list_Roles.size(); i++) { + VoRole voRole = list_Roles.get(i); + Long perId = voRole.getPerId(); + BaRolePermissions baRolePermissions = baRolePermissionsMapper.selectByPrimaryKey(perId); + JSONArray array_permission = JSONArray.parseArray("[]"); + if(baRolePermissions != null) { + array_permission = baRolePermissions.getPermissions(); + } + voRole.setPermissions(array_permission); + } + } + rsVo.obj = list_Roles; return rsVo ; } + public BaRolePermissions getRolePermissionsById(Long id) { + return baRolePermissionsMapper.selectByPrimaryKey(id); + } + /** * 寰楀埌鎵�鏈夎鑹� * @return 鎵�鏈夎鑹查泦鍚� -- Gitblit v1.8.0