diff --git a/console-web/src/views/modules/pub/role-add-or-update.vue b/console-web/src/views/modules/pub/role-add-or-update.vue index 428e6624..eb9a8bec 100644 --- a/console-web/src/views/modules/pub/role-add-or-update.vue +++ b/console-web/src/views/modules/pub/role-add-or-update.vue @@ -1,23 +1,23 @@ @@ -45,11 +46,14 @@ export default { data () { return { + title: '', + readonly: false, visible: false, menuList: [], menuListTreeProps: { label: 'name', - children: 'children' + children: 'children', + disabled: this.disabledFn }, dataForm: { id: '', @@ -77,10 +81,18 @@ }, methods: { - + disabledFn(data, node) { + this.visible = true + if (this.title == '查看') { + return true; + } else { + return false; + } + }, init (id) { this.dataForm.id = id || 0 + this.visible = true this.$http({ url: this.$http.adornUrl('/buipubbpc1/buiMenuList.do'), method: 'get', @@ -115,6 +127,7 @@ } }) }, + // 表单提交 dataFormSubmit () { this.$refs['dataForm'].validate((valid) => { diff --git a/console-web/src/views/modules/pub/role.vue b/console-web/src/views/modules/pub/role.vue index b4e9e55f..3a78a417 100644 --- a/console-web/src/views/modules/pub/role.vue +++ b/console-web/src/views/modules/pub/role.vue @@ -5,7 +5,7 @@ - 查看 + 查询 新增 批量删除 @@ -145,6 +145,8 @@ addOrUpdateHandle (id) { this.addOrUpdateVisible = true this.$nextTick(() => { + this.$refs.addOrUpdate.title = !id ? '新增' : '修改' + this.$refs.addOrUpdate.readonly = false this.$refs.addOrUpdate.init(id) }) }, @@ -152,6 +154,7 @@ queryHandle(id) { this.addOrUpdateVisible = true this.$nextTick(() => { + this.$refs.addOrUpdate.title = '查看' this.$refs.addOrUpdate.readonly = true this.$refs.addOrUpdate.init(id) }) diff --git a/console-web/src/views/modules/pub/user-add-or-update.vue b/console-web/src/views/modules/pub/user-add-or-update.vue index 899a1a01..5bd54419 100644 --- a/console-web/src/views/modules/pub/user-add-or-update.vue +++ b/console-web/src/views/modules/pub/user-add-or-update.vue @@ -1,6 +1,6 @@ @@ -115,6 +121,8 @@ } } return { + title: '', + readonly: false, visible: false, roleList: [], dataForm: { @@ -133,6 +141,7 @@ status: '0' }, orgNoList: [], + dataRule: { operNo: [ { required: true, message: '登录账号不能为空', trigger: 'blur' } @@ -160,6 +169,7 @@ methods: { init (id) { this.dataForm.id = id || 0 + this.visible = true this.$http({ url: this.$http.adornUrl(`/buipubbpc1/buiRoleList.do`), method: 'get', diff --git a/console-web/src/views/modules/pub/user.vue b/console-web/src/views/modules/pub/user.vue index 2a005930..e31b3f7c 100644 --- a/console-web/src/views/modules/pub/user.vue +++ b/console-web/src/views/modules/pub/user.vue @@ -128,6 +128,8 @@ addOrUpdateHandle(id) { this.addOrUpdateVisible = true this.$nextTick(() => { + this.$refs.addOrUpdate.title = !id ? '新增' : '修改' + this.$refs.addOrUpdate.readonly = false this.$refs.addOrUpdate.init(id) }) }, @@ -135,6 +137,8 @@ queryHandle(id) { this.addOrUpdateVisible = true this.$nextTick(() => { + this.$refs.addOrUpdate.title = '查看' + this.$refs.addOrUpdate.readonly = true this.$refs.addOrUpdate.init(id) }) }, diff --git a/doc/cre_bui.sql b/doc/cre_bui.sql index d1b86e99..ee1c17fb 100644 --- a/doc/cre_bui.sql +++ b/doc/cre_bui.sql @@ -532,38 +532,49 @@ create table T_BUI_OPERLOG ) ; -comment on table T_BUI_CONFIG is '系统配置信息表' +comment on table T_BUI_OPERLOG is '操作日志' ; -comment on column T_BUI_CONFIG.PARAM_KEY is 'key' +comment on column T_BUI_OPERLOG.PARAM_KEY is 'key' ; -comment on column T_BUI_CONFIG.PARAM_VALUE is 'value' +comment on column T_BUI_OPERLOG.PARAM_VALUE is 'value' ; -comment on column T_BUI_CONFIG.STS is '状态 0:正常 1:无效' +comment on column T_BUI_OPERLOG.STS is '状态 0:正常 1:无效' ; -comment on column T_BUI_CONFIG.REMARK is '备注' +comment on column T_BUI_OPERLOG.REMARK is '备注' ; -comment on column T_BUI_CONFIG.REQ_ID is '请求id' +comment on column T_BUI_OPERLOG.REQ_ID is '请求id' ; -comment on column T_BUI_CONFIG.NOD_ID is '节点' +comment on column T_BUI_OPERLOG.NOD_ID is '节点' ; -comment on column T_BUI_CONFIG.TM_SMP is '时间戳' +comment on column T_BUI_OPERLOG.TM_SMP is '时间戳' ; -comment on column T_BUI_CONFIG.UPD_OPR is '操作员' +comment on column T_BUI_OPERLOG.UPD_OPR is '操作员' ; -comment on column T_BUI_CONFIG.MSG_CODE is '响应码' +comment on column T_BUI_OPERLOG.MSG_CODE is '响应码' ; comment on column T_BUI_OPERLOG.MSG_INFO is '结果' ; -create unique index ui1_T_BUI_CONFIG on T_BUI_CONFIG (PARAM_KEY); +create unique index ui1_T_BUI_OPERLOG on T_BUI_OPERLOG (PARAM_KEY); +-- auto-generated definition + +create sequence S_PUB_ID + minvalue 1 + start with 1 + maxvalue 9999999999999999999 + cache 100 +/ + + + diff --git a/doc/中间业务平台开发指南.docx b/doc/中间业务平台开发指南.docx index e64c0cdd..bc7ea25e 100644 Binary files a/doc/中间业务平台开发指南.docx and b/doc/中间业务平台开发指南.docx differ diff --git a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/action/buipubbpc1/BuiMenuNavAction.java b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/action/buipubbpc1/BuiMenuNavAction.java index c8d0bc37..0c5d7724 100644 --- a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/action/buipubbpc1/BuiMenuNavAction.java +++ b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/action/buipubbpc1/BuiMenuNavAction.java @@ -1,5 +1,6 @@ package com.murong.ecp.netpay.mbu.web.pub.action.buipubbpc1; +import com.alibaba.fastjson.JSON; import com.murong.ecp.netpay.mbu.web.common.utils.*; import com.murong.ecp.netpay.mbu.web.pub.common.PUBUtils; import com.murong.ecp.netpay.mbu.web.pub.dal.dao.BuiMenuMapper; @@ -7,6 +8,7 @@ import com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiMenuDO; import com.murong.ecp.netpay.mbu.web.pub.model.BuiMenuDTO; import com.murong.ecp.netpay.mbu.web.pub.model.BuiMenuNavRspBO; import com.murong.ecp.netpay.mbu.web.pub.model.BuiOperDTO; +import com.yuangou.ecp.biz.transengine.sqlsession.YGPageEntity; import com.yuangou.ecp.bp.core.common.exception.YGException; import com.yuangou.ecp.bp.core.common.message.YGBizMessage; import com.yuangou.ecp.bp.core.common.message.YGBizMessageContext; @@ -14,10 +16,12 @@ import com.yuangou.ecp.bp.core.common.message.YGEDB; import com.yuangou.ecp.bp.core.common.yglog4j.Logger; import com.yuangou.ecp.bp.core.common.yglog4j.YGLogger; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; +import java.util.*; /** * 菜单管理管理服务 @@ -45,9 +49,42 @@ public class BuiMenuNavAction extends BaseAction { buiOperDTO.setOperId(buiOperDTO.getOperId()); + YGPageEntity pageEntity = new YGPageEntity(); + pageEntity.setPag_no(1); + pageEntity.setLimit(9999); + BuiMenuDO menuDO = new BuiMenuDO(); + List list = buiMenuMapper.selectPage(pageEntity, menuDO); + + List list2 = PUBUtils.menuProc1(list); + List list1 = buiMenuMapper.selectByOperId(buiOperDTO.getOperId()); - BuiMenuNavRspBO rspBO = PUBUtils.menuProc(list1); + Set authMenuIdSet = new HashSet(); + for( BuiMenuDO menuDO1: list1 ) { + authMenuIdSet.add(menuDO1.getMenuId()); + } + + Set permissions = new HashSet(); + for( BuiMenuDO menuDO1: list1 ) { + String perms = menuDO1.getPerms(); + if (StringUtils.isNotBlank(perms)) { + String[] values = StringUtils.split(perms, ","); + for (String value : values) { + if (!permissions.contains(value)) { + permissions.add(value); + } + } + } + } + + walkMenuTree(list2, authMenuIdSet); + + msgLog.info("list2:" + JSON.toJSONString(list2)); + + BuiMenuNavRspBO rspBO = new BuiMenuNavRspBO(); + rspBO.setMenulist(list2); + rspBO.setPermissions(StringUtils.join(permissions, "|")); + ResultT resultT = new ResultT(); resultT.setMsgCod(CommonMessageCode.SUCC); @@ -56,5 +93,28 @@ public class BuiMenuNavAction extends BaseAction { return resultT; } + private boolean walkMenuTree(List list, Set authMenuIdSet) { + boolean flag = false; + + for( Iterator iter = list.iterator(); iter.hasNext(); ) { + BuiMenuDTO menuDTO = (BuiMenuDTO)iter.next(); + if( authMenuIdSet.contains(menuDTO.getMenuId())) { + menuDTO.setFlag("Y"); + flag = true; + } + if( !menuDTO.getList().isEmpty() ) { + boolean flag1 = walkMenuTree(menuDTO.getList(), authMenuIdSet); + if( flag1 ) { + menuDTO.setFlag("Y"); + flag = true; + } + } + if( "N".equals(menuDTO.getFlag())) { + iter.remove(); + } + } + return flag; + } + } diff --git a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/common/PUBUtils.java b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/common/PUBUtils.java index a0a610d9..119895ff 100644 --- a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/common/PUBUtils.java +++ b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/common/PUBUtils.java @@ -26,6 +26,45 @@ import java.util.List; * copyright @2018 北京沐融信息科技股份有限公司 */ public class PUBUtils { + public static List menuProc1(List menus) + throws YGException { + + List list = new ArrayList(); + + for (BuiMenuDO menuDO : menus) { + Long menuId = menuDO.getMenuId(); + Long parentId = menuDO.getParentId(); + if (2 == menuDO.getType()) { + continue; + } + BuiMenuDTO menuDTO = new BuiMenuDTO(); + BeanUtils.copyProperties(menuDO, menuDTO); + if( "0".equals(menuDTO.getMenuId())) { + list.add(menuDTO); + continue; + } + + BuiMenuDTO parentMenuDTO = getParentMenuDTO(list, parentId); + if (parentMenuDTO == null) { + BuiMenuDO parentMenuDO = geParentMenuDO(menus, parentId); + if (parentMenuDO == null) { + // root + list.add(menuDTO); + continue; + } else { + parentMenuDTO = new BuiMenuDTO(); + BeanUtils.copyProperties(parentMenuDO, parentMenuDTO); + list.add(parentMenuDTO); + } + } + + List list1 = parentMenuDTO.getList(); + list1.add(menuDTO); + } + + return list; + } + /** * 菜单处理 * diff --git a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/model/BuiMenuDTO.java b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/model/BuiMenuDTO.java index 788174e5..109d0440 100644 --- a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/model/BuiMenuDTO.java +++ b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/model/BuiMenuDTO.java @@ -45,6 +45,10 @@ public class BuiMenuDTO extends BaseDO { * 授权(多个用逗号分隔,如:user:list,user:create) */ private String perms = ""; + /** + * 是否有权限 + */ + private String flag = "N"; /** * 类型 0:目录 1:菜单 2:按钮 */ @@ -140,4 +144,12 @@ public class BuiMenuDTO extends BaseDO { public void setList(List list) { this.list = list; } + + public String getFlag() { + return flag; + } + + public void setFlag(String flag) { + this.flag = flag; + } } diff --git a/ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiMenuMapper.xml b/ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiMenuMapper.xml index 0f968f2e..320d192d 100644 --- a/ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiMenuMapper.xml +++ b/ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiMenuMapper.xml @@ -141,4 +141,5 @@ delete from t_bui_menu where menu_id in (select menu_id from t_bui_menu start with menu_id=${menuId} connect by prior menu_id = parent_id) +