From e358d69fc18870584dd2d9f531910b7838ea27d9 Mon Sep 17 00:00:00 2001
From: wangting <wangting@vci-tech.com>
Date: 星期四, 02 一月 2025 09:58:53 +0800
Subject: [PATCH] 调整行点击后的回调
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java | 176 +++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 123 insertions(+), 53 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
index d07d472..4f00074 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
@@ -10,20 +10,15 @@
import com.vci.pagemodel.*;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.exception.VciBaseException;
-import com.vci.starter.web.util.BeanUtilForVCI;
-import com.vci.starter.web.util.LangBaseUtil;
-import com.vci.starter.web.util.VciBaseUtil;
-import com.vci.starter.web.util.VciDateUtil;
+import com.vci.starter.web.util.*;
+import com.vci.starter.web.util.Lcm.Func;
import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
import com.vci.web.enumpck.UIComponentDisplayTypeEnum;
import com.vci.web.enumpck.UIComponentTypeEnum;
import com.vci.web.enumpck.UIFieldTypeEnum;
import com.vci.web.enumpck.UILayoutAreaTypeEnum;
import com.vci.web.other.AllActionThreadLocal;
-import com.vci.web.service.OsAttributeServiceI;
-import com.vci.web.service.OsBtmServiceI;
-import com.vci.web.service.UIEngineServiceI;
-import com.vci.web.service.WebBoServiceI;
+import com.vci.web.service.*;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import com.vci.web.xmlmodel.UIComponentDefineXO;
@@ -92,10 +87,10 @@
private OsAttributeServiceI attrService;
/**
- * 涓氬姟绫诲瀷鐨勬湇鍔�
+ * UI瀹氫箟绠$悊鏈嶅姟
*/
@Autowired
- private WebBoServiceI boService;
+ private UIManagerServiceI uiManagerServiceI;
/**
* 琛ㄥ崟鐨勫瓧娈电被鍨嬫槧灏�
@@ -414,16 +409,13 @@
if(StringUtils.isBlank(btmId) || StringUtils.isBlank(id)){
return null;
}
- if(!QUERY_BY_CACHE){
- PortalVI portalVI = null;
- try {
- portalVI = platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmId, id);
- } catch (PLException vciError) {
- throw WebUtil.getVciBaseException(vciError);
- }
- return formDO2VO(portalVI);
+ PortalVI portalVI = null;
+ try {
+ portalVI = platformClientUtil.getUIService().getPortalVIByTypeNameAndVIName(btmId, id);
+ } catch (PLException vciError) {
+ throw WebUtil.getVciBaseException(vciError);
}
- return self.selectAllFormMap().getOrDefault(btmId.toLowerCase()+SEP+id.toLowerCase(),null);
+ return formDO2VO(portalVI);
}
/**
@@ -876,7 +868,7 @@
private List<UIContentVO> UIContentDO2VOs(Collection<PLUILayout> pageLayoutDefinations){
List<UIContentVO> contentVOS = new ArrayList<>();
Optional.ofNullable(pageLayoutDefinations).orElseGet(()->new ArrayList<PLUILayout>()).stream().forEach(pageLayout->{
- contentVOS.add(UIContentDO2VO(pageLayout,false));
+ contentVOS.add(UIContentDO2VO(pageLayout,false,null));
});
if(!CollectionUtils.isEmpty(contentVOS)) {
Map<String, List<UILayoutVO>> layoutMap = batchListLayoutByContent(contentVOS.stream().map(UIContentVO::getOid).collect(Collectors.toSet()));
@@ -902,7 +894,7 @@
*/
@VciUnLog
@Override
- public UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail){
+ public UIContentVO UIContentDO2VO(PLUILayout pageLayoutDefination, boolean queryDetail,Map<String, RoleRightVO> roleRightMap){
UIContentVO contentVO = new UIContentVO();
if(pageLayoutDefination !=null){
contentVO.setOid(pageLayoutDefination.plOId);
@@ -920,14 +912,16 @@
contentVO.setLastModifier(pageLayoutDefination.plModifyUser);
if(queryDetail){
//鏌ヨ鍖呭惈鐨勫唴瀹�
- List<UILayoutVO> layoutVOS = listLayoutByContent(contentVO.getOid());
+ List<UILayoutVO> layoutVOS = null;
+ //鍒ゆ柇鏄惁鏍规嵁鏉冮檺杩斿洖
+ layoutVOS = listLayoutByContent(contentVO.getOid(),roleRightMap);
if(!CollectionUtils.isEmpty(layoutVOS)){
if(layoutVOS.size() == 1){
//鍙湁涓�涓尯鍩�
UILayoutVO layoutVO = layoutVOS.get(0);
List<UIComponentVO> componentVOs = layoutVO.getComponentVOs();
//绗竴涓綔涓篶enter
- UIComponentVO firstCompVO = componentVOs.stream().min((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum())).get();
+ UIComponentVO firstCompVO = componentVOs.stream().min(Comparator.comparing(UIComponentVO::getOrderNum)).get();
List<UIComponentVO> southCompVO = componentVOs.stream().filter(s->!s.getOid().equals(firstCompVO.getOid())).collect(Collectors.toList());
UILayoutVO centerVO = new UILayoutVO();
@@ -1016,16 +1010,79 @@
// }
/**
- * 鑾峰彇鏌愪釜UI涓婁笅鏂囩殑鍖哄煙
+ * 鑾峰彇鏌愪釜UI涓婁笅鏂囩殑鍖哄煙锛屾牴鎹潈闄愭帶鍒惰繑鍥�
* @param pkContent UI涓婁笅鏂囩殑涓婚敭
* @return 涓婁笅鏂�
*/
- private List<UILayoutVO> listLayoutByContent(String pkContent){
+ private List<UILayoutVO> listLayoutByContent(String pkContent,Map<String, RoleRightVO> roleRightMap){
try {
- return UILayoutDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList()),true);
+ List<PLTabPage> tabPageList = Arrays.stream(platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList());
+ //杩囨护鎺夋病鏈夎闂潈闄愮殑UI
+ tabPageList = this.filterTabPageByRoleRight(tabPageList,roleRightMap);
+ return UILayoutDO2VOs(tabPageList,true,roleRightMap);
} catch (PLException vciError) {
throw WebUtil.getVciBaseException(vciError);
}
+ }
+
+ /**
+ * 鏍规嵁鏉冮檺闆嗗悎杩囨护鎺夋病鏈夎闂潈闄愮殑椤电鏁版嵁
+ * @param tabPageList
+ * @param roleRightMap
+ */
+ private List<PLTabPage> filterTabPageByRoleRight(List<PLTabPage> tabPageList, Map<String, RoleRightVO> roleRightMap){
+ if(Func.isEmpty(roleRightMap) || Func.isEmpty(tabPageList)){
+ return tabPageList;
+ }
+ List<PLTabPage> filterList = new ArrayList<>();
+ for (int i = 0; i < tabPageList.size(); i++) {
+ PLTabPage tabPage = tabPageList.get(i);
+ if(roleRightMap.containsKey(tabPage.plOId)){
+ filterList.add(tabPage);
+ }
+ /*if(roleRightMap.containsKey(tabPage.plContextOId)) {
+ Long rightValue = roleRightMap.get(tabPage.plContextOId).getRightValue();
+ int nodeValue = tabPage.plSeq;
+ if (nodeValue >= 0 && nodeValue <= 63) {
+ //杩涜浣嶄笌鎿嶄綔锛屽鏋滅浉绛夊垯琛ㄧず鍏锋湁褰撳墠鎿嶄綔鐨勬潈闄�
+ long preValue = (rightValue >> nodeValue) & 1;
+ if (preValue != 1) {
+ tabPageList.remove(tabPage);
+ }
+ }
+ }*/
+ }
+ return filterList;
+ }
+
+ /**
+ * 鏍规嵁鏉冮檺闆嗗悎杩囨护鎺夋病鏈夎闂潈闄愮殑椤甸潰瀹氫箟鏁版嵁
+ * @param plPageDefinationList
+ * @param roleRightMap
+ */
+ private List<PLPageDefination> filterPageDefByRoleRight(List<PLPageDefination> plPageDefinationList, Map<String, RoleRightVO> roleRightMap){
+ if(Func.isEmpty(roleRightMap) || Func.isEmpty(plPageDefinationList)){
+ return plPageDefinationList;
+ }
+ List<PLPageDefination> filterList = new ArrayList<>();
+ for (int i = 0; i < plPageDefinationList.size(); i++) {
+ PLPageDefination plPageDefination = plPageDefinationList.get(i);
+ if(roleRightMap.containsKey(plPageDefination.plOId)){
+ filterList.add(plPageDefination);
+ }
+ /*if(roleRightMap.containsKey(plPageDefination.plTabPageOId)) {
+ Long rightValue = roleRightMap.get(plPageDefination.plTabPageOId).getRightValue();
+ int nodeValue = plPageDefination.seq;
+ if (nodeValue >= 0 && nodeValue <= 63) {
+ //杩涜浣嶄笌鎿嶄綔锛屽鏋滅浉绛夊垯琛ㄧず鍏锋湁褰撳墠鎿嶄綔鐨勬潈闄�
+ long preValue = (rightValue >> nodeValue) & 1;
+ if (preValue != 1) {
+ plPageDefinationList.remove(plPageDefination);
+ }
+ }
+ }*/
+ }
+ return filterList;
}
/**
@@ -1079,7 +1136,7 @@
* @param pages 鍖哄煙鐨勬暟鎹璞�
* @return 鏄剧ず瀵硅薄
*/
- private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail){
+ private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail, Map<String, RoleRightVO> roleRightMap){
List<UILayoutVO> contentVOS = new ArrayList<>();
Map<String, OsAttributeVO> attributeVOMap;
if(pages != null && pages.size() > 0){
@@ -1093,7 +1150,7 @@
attributeVOMap = null;
}
Optional.ofNullable(pages).orElseGet(()->new ArrayList<PLTabPage>()).stream().forEach(page->{
- UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail,attributeVOMap);
+ UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail,attributeVOMap,roleRightMap);
if(layoutVO.isEnableStatus()) {
contentVOS.add(layoutVO);
}
@@ -1117,7 +1174,7 @@
* @return 鍖哄煙鐨勬樉绀哄璞�
*/
@VciUnLog
- private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap){
+ private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){
UILayoutVO layoutVO = new UILayoutVO();
if(page !=null ){
layoutVO.setOid(page.plOId);
@@ -1157,7 +1214,10 @@
if(queryDetail){
//鍗曚釜鐨勶紝鐩存帴鑾峰彇
try {
- layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()),true,attributeVOMap));
+ List<PLPageDefination> pageDefinationList = Arrays.stream(platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList());
+ pageDefinationList = this.filterPageDefByRoleRight(pageDefinationList,roleRightMap);
+ List<UIComponentVO> uiComponentVOS = uiComponentDO2VOs(pageDefinationList, true, attributeVOMap,roleRightMap);
+ layoutVO.setComponentVOs(uiComponentVOS);
} catch (PLException vciError) {
throw WebUtil.getVciBaseException(vciError);
}
@@ -1165,6 +1225,7 @@
}
return layoutVO;
}
+
/**
* 鏌ヨ鎵�鏈夌殑涓婁笅鏂囩殑鍖哄煙鐨勬槧灏�
*
@@ -1201,7 +1262,12 @@
if(StringUtils.isBlank(componentOid)){
return null;
}
- if(!QUERY_BY_CACHE){
+ try {
+ return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap,null);
+ } catch (PLException vciError) {
+ throw WebUtil.getVciBaseException(vciError);
+ }
+ /*if(!QUERY_BY_CACHE){
try {
return uiComponentDO2VO(platformClientUtil.getUIService().getPLPageDefinationById(componentOid),true,attributeVOMap);
} catch (PLException vciError) {
@@ -1213,8 +1279,7 @@
if(!CollectionUtils.isEmpty(componentVOList)){
return componentVOList.get(0);
}
- }
- return null;
+ }*/
}
/**
@@ -1222,10 +1287,10 @@
* @param pages 鏁版嵁瀵硅薄
* @return 鏄剧ず瀵硅薄
*/
- private List<UIComponentVO> uiComponentDO2VOs(Collection<com.vci.corba.portal.data.PLPageDefination> pages, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap){
+ private List<UIComponentVO> uiComponentDO2VOs(Collection<PLPageDefination> pages, boolean queryDetail,Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){
List<UIComponentVO> componentVOS = new ArrayList<>();
pages.stream().forEach(page->{
- componentVOS.add(uiComponentDO2VO(page,queryDetail,attributeVOMap));
+ componentVOS.add(uiComponentDO2VO(page,queryDetail,attributeVOMap,roleRightMap));
});
return componentVOS;
}
@@ -1236,7 +1301,7 @@
* @return 鏄剧ず瀵硅薄
*/
@VciUnLog
- private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap){
+ private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail, Map<String, OsAttributeVO> attributeVOMap, Map<String, RoleRightVO> roleRightMap){
UIComponentVO componentVO = new UIComponentVO();
if(page !=null){
componentVO.setOid(page.plOId);
@@ -1244,6 +1309,7 @@
componentVO.setName(page.name);
componentVO.setDescription(page.desc);
componentVO.setOrderNum((int) page.seq);
+
UIComponentDefineXO componentDefineXO = null;
try {
componentDefineXO = readInfoFromXML(page.plDefination, UIComponentDefineXO.class);
@@ -1251,6 +1317,8 @@
logger.error("璇诲彇xml鍑洪敊",e);
return null;
}
+ //鑷畾涔夋煡璇㈡柟寮�
+ componentVO.setBsDataModel(componentDefineXO.getBsDataModel());
//涔嬪墠鐨勭被鍨嬬殑鍊兼槸1锛�2锛�3绛夌湅鐫�涓嶇洿瑙�
UIComponentTypeEnum componentTypeEnum = null;
if("1".equals(componentDefineXO.getTemplateType())){
@@ -1374,7 +1442,7 @@
treeDefineVO.setBtmType(componentDefineXO.getShowType());
treeDefineVO.setLinkType(componentDefineXO.getLinkType());
treeDefineVO.setLoadType("1".equalsIgnoreCase(componentDefineXO.getExpandMode())?"node":"all");
- //TODO:杩欎釜灞炴�х幇鍦ㄧ敱閾炬帴绫诲瀷鏌ヨ鎺у埗锛屼笉鐢遍〉闈㈠畾涔夋帶鍒朵簡
+ //TODO:杩欎釜灞炴�х幇鍦ㄧ敱閾炬帴绫诲瀷鏌ヨ妯℃澘閰嶇疆涓婃帶鍒讹紝涓嶅湪椤甸潰瀹氫箟鎺у埗浜�
//treeDefineVO.setOrientation("positive".equalsIgnoreCase(componentDefineXO.getOrientation())?false:true);
treeDefineVO.setShowImage("1".equalsIgnoreCase(componentDefineXO.getIsShowImage())?true:false);
treeDefineVO.setRootContent(componentDefineXO.getRootContent());
@@ -1400,34 +1468,30 @@
}
componentVO.setUiParseClass(componentDefineXO.getUIParser());
componentVO.setExtendAttr(componentDefineXO.getExtAttr());
- componentVO.setButtons(listButtonByComponent(componentVO.getOid()));
+ componentVO.setButtons(listButtonByComponent(componentVO.getOid(),roleRightMap));
}
return componentVO;
}
/**
- * 鑾峰彇鏌愪釜缁勪欢鐨勬寜閽�
+ * 鑾峰彇鏌愪釜缁勪欢鐨勬寜閽�(鏍规嵁鏉冮檺杩囨护)
* @param pkComponent 缁勪欢鐨勪富閿�
* @return 鎸夐挳鐨勪俊鎭�
*/
@Override
- public List<UIButtonDefineVO> listButtonByComponent(String pkComponent){
+ public List<UIButtonDefineVO> listButtonByComponent(String pkComponent, Map<String, RoleRightVO> roleRightMap){
try {
List<UIButtonDefineVO> buttonDefineVOS = buttonDO2VOs(Arrays.stream(platformClientUtil.getUIService().getPLTabButtonsByTableOId(pkComponent)).collect(Collectors.toSet())).stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).collect(Collectors.toList());
-
- Map<String,RoleRightInfo> allRightRoleMap = new HashMap<>();
- RoleRightInfo[] bts = platformClientUtil.getFrameworkService().getRoleRightByUserName("bt");
- Map<String,Long> rightMap = new HashMap<String,Long>();
- for(RoleRightInfo obj:bts){
- allRightRoleMap.put(obj.funcId, obj);
- rightMap.put(obj.funcId,obj.rightValue);
+ if(Func.isEmpty(roleRightMap)){
+ roleRightMap = uiManagerServiceI.getRoleRightMap(null);
}
+
//寰幆瀵规寜閽潈闄愯繘琛屽垽鏂紝娌℃湁鏉冮檺鐨勫皢绉婚櫎buttonDefineVOS瀵硅薄
Iterator<UIButtonDefineVO> buttonDefineVO = buttonDefineVOS.iterator();
while (buttonDefineVO.hasNext()){
UIButtonDefineVO buttonDefine = buttonDefineVO.next();
- if(rightMap.containsKey(buttonDefine.getPkComponent())) {
- Long rightValue = rightMap.get(buttonDefine.getPkComponent());
+ if(roleRightMap.containsKey(buttonDefine.getPkComponent())) {
+ Long rightValue = roleRightMap.get(buttonDefine.getPkComponent()).getRightValue();
int nodeValue = buttonDefine.getOrderNum();
if (nodeValue >= 0 && nodeValue <= 63) {
//杩涜浣嶄笌鎿嶄綔锛屽鏋滅浉绛夊垯琛ㄧず鍏锋湁褰撳墠鎿嶄綔鐨勬潈闄�
@@ -1464,7 +1528,7 @@
* @return 鏄剧ず瀵硅薄
*/
@Override
- public List<UIButtonDefineVO> buttonDO2VOs(Collection<com.vci.corba.portal.data.PLTabButton> buttons){
+ public List<UIButtonDefineVO> buttonDO2VOs(Collection<PLTabButton> buttons){
List<UIButtonDefineVO> buttonDefineVOS = new ArrayList<>();
if(buttons != null && buttons.size() > 0){
// Map<String, UIActionVO> actionVOMap = self.selectAllActionMap();
@@ -1488,7 +1552,7 @@
* @return 鏄剧ず瀵硅薄
*/
@Override
- public UIButtonDefineVO buttonDO2VO(com.vci.corba.portal.data.PLTabButton button, Map<String, UIActionVO> actionVOMap) {
+ public UIButtonDefineVO buttonDO2VO(PLTabButton button, Map<String, UIActionVO> actionVOMap) {
UIButtonDefineVO buttonVO = new UIButtonDefineVO();
// Map<String, UIActionVO> actionVOMap = ServiceProvider.getUIService().getAllPLAction();
if(button !=null){
@@ -1582,7 +1646,7 @@
* @return UI涓婁笅鏂囩殑淇℃伅
*/
@Override
- public UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) {
+ public UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) throws PLException {
WebUtil.alertNotNull(btmType,"涓氬姟绫诲瀷鎴栬�呴摼鎺ョ被鍨�",id,"UI涓婁笅鏂囩殑缂栧彿");
PLUILayout[] obj = null;
try {
@@ -1590,6 +1654,10 @@
} catch (PLException vciError) {
throw WebUtil.getVciBaseException(vciError);
}
+ // 1銆佹牴鎹綋鍓嶈鑹插垽鏂槸绠$悊浜哄憳杩樻槸鏅�氱敤鎴凤紙姝e父鏉ヨ鍙湁鏅�氱敤鎴锋墠浼氱敤鍒拌鏌ヨ鎺ュ彛锛�
+ Map<String, RoleRightVO> roleRightMap = uiManagerServiceI.getRoleRightMap(null);
+ // 2銆佹寜鐓у綋鍓嶇櫥褰曠敤鎴锋煡璇㈡潈闄愶紙鍔熻兘鏉冮檺鍜孶I鎺堟潈鐨勬巿鏉冧俊鎭兘鏄斁鍦ㄥ悓涓�寮犺〃閲岀殑锛�
+ // 3銆佹壘鍑哄綋鍓嶈鏌ヨ鐨刄I涓婁笅鏂�
PLUILayout context = null;
for (int i = 0; i < obj.length; i++) {
if (obj[i].plCode.equals(id)) {
@@ -1597,7 +1665,9 @@
break;
}
}
- return UIContentDO2VO(context,true);
+ // 4銆佹瘡涓�涓彍鍗曟煡璇㈢殑閮芥槸涓�涓猆I涓婁笅鏂囷紝鎵�浠I涓婁笅鏂囨槸鏈夊姛鑳芥巿鏉冩帶鍒剁殑锛屽彧闇�瑕佹帶鍒跺悗闈㈢殑椤电銆侀〉闈€�佹寜閽殑鏉冮檺銆�
+ return UIContentDO2VO(context, true,roleRightMap);
}
+
}
--
Gitblit v1.9.3