Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java
@@ -38,6 +38,10 @@ * 屿§ç±»åï¼ä½¿ç¨æä¸¾VciFieldTypeEnum */ private String attributeDataType; /** * 屿§UIæ§ä»¶æ¾ç¤ºç±»å */ private String attributeUIType; /** * æ¯å¦å¯ä»¥ä¸ºç©º @@ -301,6 +305,14 @@ this.scaleLength = scaleLength; } public String getAttributeUIType() { return attributeUIType; } public void setAttributeUIType(String attributeUIType) { this.attributeUIType = attributeUIType; } @Override public String toString() { return "OsAttributeDTO{" + @@ -309,17 +321,24 @@ ", name='" + name + '\'' + ", description='" + description + '\'' + ", attributeDataType='" + attributeDataType + '\'' + ", attributeUIType='" + attributeUIType + '\'' + ", nullableFlag=" + nullableFlag + ", defaultValue='" + defaultValue + '\'' + ", enumId='" + enumId + '\'' + ", enumName='" + enumName + '\'' + ", btmTypeId='" + btmTypeId + '\'' + ", btmTypeName='" + btmTypeName + '\'' + ", linkTypeName='" + linkTypeName + '\'' + ", version=" + version + ", attrLength=" + attrLength + ", precisionLength=" + precisionLength + ", scaleLength=" + scaleLength + ", range='" + range + '\'' + ", ts=" + ts + ", creator='" + creator + '\'' + ", createTime=" + createTime + ", lastModifier='" + lastModifier + '\'' + ", lastModifyTime=" + lastModifyTime + '}'; } } Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java
@@ -43,6 +43,14 @@ * 屿§ç±»åæ¾ç¤ºææ¬ */ private String attributeDataTypeText; /** * 屿§UIæ§ä»¶æ¾ç¤ºç±»å */ private String attributeUIType; /** * 屿§UIæ§ä»¶æ¾ç¤ºç±»åææ¬ */ private String attributeUITypeText; /** * æ¯å¦å¯ä»¥ä¸ºç©º @@ -353,6 +361,22 @@ this.scaleLength = scaleLength; } public String getAttributeUIType() { return attributeUIType; } public void setAttributeUIType(String attributeUIType) { this.attributeUIType = attributeUIType; } public String getAttributeUITypeText() { return attributeUITypeText; } public void setAttributeUITypeText(String attributeUITypeText) { this.attributeUITypeText = attributeUITypeText; } @Override public String toString() { return "OsAttributeVO{" + @@ -362,16 +386,21 @@ ", description='" + description + '\'' + ", attributeDataType='" + attributeDataType + '\'' + ", attributeDataTypeText='" + attributeDataTypeText + '\'' + ", attributeUIType='" + attributeUIType + '\'' + ", attributeUITypeText='" + attributeUITypeText + '\'' + ", nullableFlag=" + nullableFlag + ", defaultValue='" + defaultValue + '\'' + ", enumId='" + enumId + '\'' + ", enumName='" + enumName + '\'' + ", btmTypeId='" + btmTypeId + '\'' + ", btmTypeName='" + btmTypeName + '\'' + ", linkTypeName='" + linkTypeName + '\'' + ", version=" + version + ", attrLength=" + attrLength + ", precisionLength=" + precisionLength + ", scaleLength=" + scaleLength + ", range='" + range + '\'' + ", other='" + other + '\'' + ", btmname='" + btmname + '\'' + ", owner='" + owner + '\'' + ", creator='" + creator + '\'' + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/ControlAttributeType.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ package com.vci.web.enumpck; public enum ControlAttributeType { VTString, VTInteger, VTLong, VTDouble, VTBoolean, VTImage, VTDate, VTTime, VTDateTime, VTNote, VTFilePath, VTClob, canzhao; public static ControlType Parse(String value) { for (ControlType ct : ControlType.values()) { if (ct.name().equalsIgnoreCase(value)) { return ct; } } return null; } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/ControlType.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,33 @@ package com.vci.web.enumpck; public enum ControlType { Text, TextBtn, TextArea, RichText, Number, Password, Radio, Checkbox, Select, WebEditor, Date, Time, Datetime, Hidden, Customform, File, MultiFile, Custom, UserChoose; public static ControlType Parse(String value) { for (ControlType ct : ControlType.values()) { if (ct.name().equalsIgnoreCase(value)) { return ct; } } return null; } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/enumpck/ItemTypeEnum.java
@@ -2,6 +2,7 @@ import com.vci.pagemodel.KeyValue; import com.vci.starter.web.enumpck.BaseEnum; import com.vci.starter.web.enumpck.VciFieldTypeEnum; import java.util.ArrayList; import java.util.List; @@ -141,4 +142,87 @@ } return enumDataList; } /*** *æ ¹æ®å±æ§ç±»åè·åUI屿§ç±»å(ææ¬) * @param key * @return */ public static String convertAttributeTypeTOUITypeTextByValue(String key,boolean isText){ String value=ItemTypeEnum.TEXT.getValue(); ItemTypeEnum itemTypeEnum=null; if(ControlAttributeType.VTInteger.equals(key)|| ControlAttributeType.VTDouble.equals(key) ){ value = ItemTypeEnum.NUMBER.getValue(); } else if (ControlAttributeType.VTNote.equals(key)) {// textareaç±»å value = ItemTypeEnum.TEXTAREA.getValue(); }// æ¥èµ·ç±»å else if (ControlAttributeType.VTDate.equals(key)) {//æ¥æ value = ItemTypeEnum.DATE.getValue(); }else if(ControlAttributeType.VTDateTime.equals(key)){//æ¥ææ¶é´ value = ItemTypeEnum.DATETIME.getValue(); }else if( ControlAttributeType.VTTime.equals(key)){//æ¶é´ value = ItemTypeEnum.TIME.getValue(); } else if( ControlAttributeType.canzhao.equals(key)){//åç § value = ItemTypeEnum.TEXT.getValue(); } else if( ControlAttributeType.VTBoolean.equals(key)){//boolean value = ItemTypeEnum.CHECKBOX.getValue(); }else if( ControlAttributeType.VTFilePath.equals(key)){//æä»¶ value = ItemTypeEnum.FILE.getValue(); } else { value = ItemTypeEnum.TEXT.getValue(); } itemTypeEnum = forValue(value); if(itemTypeEnum==null){ return ""; }else { if (isText) { value = itemTypeEnum.getText(); } else { value = itemTypeEnum.getText(); } } return value; } /*** *æ ¹æ®å±æ§ç±»åè·åUI屿§ç±»å(ææ¬) * @param key * @return */ public static String convertAttributeTypeTOUITypeValueByText(String key){ String value=ItemTypeEnum.TEXT.getValue(); if(ControlAttributeType.VTInteger.equals(key)|| ControlAttributeType.VTDouble.equals(key) ){ value = ItemTypeEnum.NUMBER.getValue(); } else if (ControlAttributeType.VTNote.equals(key)) {// textareaç±»å value = ItemTypeEnum.TEXTAREA.getValue(); }// æ¥èµ·ç±»å else if (ControlAttributeType.VTDate.equals(key)) {//æ¥æ value = ItemTypeEnum.DATE.getValue(); }else if(ControlAttributeType.VTDateTime.equals(key)){//æ¥ææ¶é´ value = ItemTypeEnum.DATETIME.getValue(); }else if( ControlAttributeType.VTTime.equals(key)){//æ¶é´ value = ItemTypeEnum.TIME.getValue(); } else if( ControlAttributeType.canzhao.equals(key)){//åç § value = ItemTypeEnum.TEXT.getValue(); } else if( ControlAttributeType.VTBoolean.equals(key)){//boolean value = ItemTypeEnum.CHECKBOX.getValue(); }else if( ControlAttributeType.VTFilePath.equals(key)){//æä»¶ value = ItemTypeEnum.FILE.getValue(); } else { value = ItemTypeEnum.TEXT.getValue(); } value= getTextByValue(value); return value; } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -28,6 +28,7 @@ import com.vci.starter.web.pagemodel.*; import com.vci.starter.web.util.*; import com.vci.model.OsAttributeDO; import com.vci.web.enumpck.ItemTypeEnum; import com.vci.web.enumpck.PortalVITypeFlag; import com.vci.web.properties.UsedNames; import com.vci.web.service.OsAttributeServiceI; @@ -347,6 +348,10 @@ attributeVO.setDescription(attribItem.description); attributeVO.setAttributeDataType(attribItem.vtDataType); attributeVO.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(attribItem.vtDataType)); //è·åUI屿§ç±»å attributeVO.setAttributeUIType(ItemTypeEnum.convertAttributeTypeTOUITypeTextByValue(attribItem.vtDataType,false)); //è·åUI屿§ç±»åææ¬ attributeVO.setAttributeUITypeText(ItemTypeEnum.convertAttributeTypeTOUITypeTextByValue(attribItem.vtDataType,true)); attributeVO.setDefaultValue(attribItem.defValue); if(Func.isNotBlank(attribItem.rage)){ attributeVO.setRange(attribItem.rage.replace("<","<")); Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
@@ -33,6 +33,7 @@ import lombok.NoArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -62,7 +63,11 @@ */ @Resource private SmRoleQueryServiceI smRoleQueryServiceI; /*** * æ¯å¦æ¯ç®¡çå */ @Autowired RightControlUtil rightControlUtil; /** * ä¸å¡ç±»å */ @@ -827,6 +832,12 @@ return treeList; } /*** * UIææ * @param uiAuthorDTO * @return * @throws Exception */ @Override public boolean authorizedUI(UIAuthorDTO uiAuthorDTO) throws Exception { boolean res=false; @@ -842,41 +853,41 @@ treeQueryObject.setConditionMap(conditionMap); List<Tree> treeList=this.getUIAuthor(treeQueryObject); HashMap<String,Tree> allTreeMap=new HashMap<>(); Map<String,RoleRightVO> roleRightVOMap=new HashMap<>(); if(!CollectionUtil.isEmpty(treeList)){ if(StringUtils.isNotBlank(uiAuthorDTO.getRoleId())){ String userName= WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); RoleRightInfo[] rightInfos= platformClientUtil.getFrameworkService().getRoleRightList(uiAuthorDTO.getRoleId(),userName); List<RoleRightVO> roleRightVOList=roleRightDOO2VOS(Arrays.asList(rightInfos)); roleRightVOMap=roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO)); } convertTreeDOO2Map(treeList,allTreeMap); List<RoleRightDTO> roleRightDTOList=new ArrayList<>(); List<Tree> selectTreeList= uiAuthorDTO.getSelectTreeList(); getRoleRightDTOS(uiAuthorDTO.getRoleId(),selectTreeList,allTreeMap,roleRightDTOList); getSelectedRoleRightObjs(uiAuthorDTO.getRoleId(),selectTreeList,allTreeMap,roleRightDTOList); } return res; } private void getRoleRightDTOS(String roleOid,List<Tree> selectTreeList,HashMap<String,Tree> allTreeMap, List<RoleRightDTO> roleRightDTOList){ /** * * @param roleOid * @param selectTreeList * @param allTreeMap * @param roleRightDTOList */ private void getSelectedRoleRightObjs(String roleOid,List<Tree> selectTreeList,HashMap<String,Tree> allTreeMap, List<RoleRightDTO> roleRightDTOList){ Date date=new Date(); Map<String,RoleRightDTO> roleRightDTOMap=new HashMap<>(); selectTreeList.stream().forEach(tree -> { RoleRightDTO roleRightDTO=new RoleRightDTO(); String id=ObjectUtility.getNewObjectID36(); Object data= tree.getData(); if (data instanceof BizType) {//ä¸å¡ç±»å BizType bizType=(BizType)data; roleRightDTO.setId(id);//ä¸»é® roleRightDTO.setCreateUser(null);//å建è roleRightDTO.setCreateTime(null);//å建æ¶é´ roleRightDTO.setModifyUser(null);//ä¿®æ¹è roleRightDTO.setModifyTime(null);//ä¿®æ¹æ¶é´ roleRightDTO.setRoleId(roleOid);//è§è²ID roleRightDTO.setRightValue(1);// æéå¼ roleRightDTO.setRightType((short) -1);//æéç±»å æéç±»åï¼è¶ 级管çåç»ç®¡çåææä¸º1ï¼ç®¡çåç»æ®éç¨æ·ææä¸º2 roleRightDTO.setFuncId(null); roleRightDTO.setLicensor(null); }else if (data instanceof PLUILayout){//UI }else if (data instanceof PLTabPage) {//UIä¸ä¸æ }else if (data instanceof PLPageDefination) {// if(data instanceof String){ getRightValue(roleOid,tree,allTreeMap,false,roleRightDTOMap);//åä¸è·åæææ¨¡åçæéå¼ }else if (!(data instanceof PLTabButton)) {//ä¸å¡ç±»å getRightValue(roleOid,tree,allTreeMap,true,roleRightDTOMap);//åä¸å¤ç getRightValue(roleOid,tree,allTreeMap,false,roleRightDTOMap);//åä¸å¤çï¼å å«å½åèç¹ï¼ }else if (data instanceof PLTabButton) {//æé® } @@ -885,6 +896,136 @@ } /** * è·åæé * @param isUp æ¯å¦æ¯åä¸è·åï¼å¦ææ¯åä¸è·åï¼ä¼ è¿æ¥çå¿ ç¶æ¯æ¨¡åèç¹ï¼ä¸ä¸çº§æ¨¡åå¿ ç¶æ¯æ²¡æéä¸ */ private void getRightValue(String roleId,Tree node,HashMap<String,Tree> allTreeMap,boolean isUp,Map<String,RoleRightDTO> rightMap){ SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); String currentUserName = sessionInfo.getUserId(); boolean isDeveloper= rightControlUtil.isDeveloper(currentUserName); String parentOid=node.getParentId(); if(allTreeMap.containsKey(parentOid)){ String id=ObjectUtility.getNewObjectID36(); Tree parentNode =allTreeMap.get(parentOid); Object parentData= parentNode.getData(); if(isUp) {//åä¸è·åï¼å卿¯ä¸ªä¸çº§æ¨¡åçæéå¼ while (!"root".equals(parentNode.getData())){ String funcId = ""; if (parentData instanceof BizType) { BizType bizType = (BizType) parentData; funcId = bizType.name; } else if (parentData instanceof PLUILayout) { PLUILayout context = (PLUILayout)parentData; funcId = context.plOId; } else if (parentData instanceof PLTabPage) { PLTabPage tab = (PLTabPage) parentData; funcId = tab.plOId; } else if (parentData instanceof PLPageDefination){ PLPageDefination pageDef = (PLPageDefination) parentData; funcId = pageDef.plOId; } else if (parentData instanceof PLTabButton) { PLTabButton but = (PLTabButton)parentData; funcId = but.plOId; } RoleRightDTO roleRightDTO = new RoleRightDTO(); roleRightDTO.setId(id);//ä¸»é® roleRightDTO.setFuncId(funcId); if(isDeveloper) { roleRightDTO.setRightType((short) 1);//æéç±»å æéç±»åï¼è¶ 级管çåç»ç®¡çåææä¸º1ï¼ç®¡çåç»æ®éç¨æ·ææä¸º2 }else{ roleRightDTO.setRightType((short) 2); } roleRightDTO.setRightValue(1);// æéå¼ï¼æ²¡ææä½ç模åæéå¼åå¨ä¸º0 roleRightDTO.setRoleId(roleId);//è§è²ID roleRightDTO.setCreateUser(currentUserName);//å建è roleRightDTO.setCreateTime(new Date());//å建æ¶é´ roleRightDTO.setModifyUser(currentUserName);//ä¿®æ¹è roleRightDTO.setModifyTime(new Date());//ä¿®æ¹æ¶é´ roleRightDTO.setLicensor(""); if(!rightMap.containsKey(funcId)){ rightMap.put(funcId, roleRightDTO); } } }else{ String funcId = ""; if(parentData instanceof String){ funcId = (String)parentData; } else if (parentData instanceof BizType) { BizType bizType = (BizType)parentData; funcId = bizType.name; } else if (parentData instanceof PLUILayout) { PLUILayout context = (PLUILayout)parentData; funcId = context.plOId; } else if (parentData instanceof PLTabPage) { PLTabPage tab = (PLTabPage) parentData; funcId = tab.plOId; } else if (parentData instanceof PLPageDefination){ PLPageDefination pageDef = (PLPageDefination) parentData; funcId = pageDef.plOId; } else if (parentData instanceof PLTabButton) { PLTabButton but = (PLTabButton)parentData; funcId = but.plOId; } if(!(parentData instanceof PLPageDefination)) {//åèç¹ä¸æ¯æä½ if(!rightMap.containsKey(funcId)&&!funcId.equals("root")){ RoleRightDTO roleRightDTO = new RoleRightDTO(); roleRightDTO.setFuncId(funcId); if(isDeveloper) { roleRightDTO.setRightType((short) 1);//æéç±»å æéç±»åï¼è¶ 级管çåç»ç®¡çåææä¸º1ï¼ç®¡çåç»æ®éç¨æ·ææä¸º2 }else{ roleRightDTO.setRightType((short) 2); } roleRightDTO.setRightValue(0);//没ææä½ç模åæéå¼åå¨ä¸º0 roleRightDTO.setRoleId(roleId); roleRightDTO.setCreateUser(currentUserName); roleRightDTO.setCreateTime(new Date()); roleRightDTO.setModifyUser(currentUserName); roleRightDTO.setModifyTime(new Date()); roleRightDTO.setLicensor(""); rightMap.put(funcId, roleRightDTO); } for(int i = 0;i < parentNode.getChildren().size();i++){ //对æ¯ä¸ªååä¸éå½éå getRightValue(roleId,parentNode.getChildren().get(i),allTreeMap,false,rightMap); } }else { if(!rightMap.containsKey(funcId)){ RoleRightDTO roleRightDTO = new RoleRightDTO(); roleRightDTO.setFuncId(funcId); roleRightDTO.setRightType((short)2); // 设置UIæé roleRightDTO.setRightValue(countRightValue(parentNode,true));//没ææä½ç模åæéå¼åå¨ä¸º0 roleRightDTO.setRoleId(roleId); roleRightDTO.setCreateUser(currentUserName); roleRightDTO.setCreateTime(new Date()); roleRightDTO.setModifyUser(currentUserName); roleRightDTO.setModifyTime(new Date()); roleRightDTO.setLicensor(""); rightMap.put(funcId, roleRightDTO); } } } } } /** * ä¼ å ¥ç´æ¥ææ¥æä½ç模åçèç¹,计ç®è¯¥èç¹çæéå¼ * @param node 模åèç¹ * @param isAll æ¯å¦åçº§å ¨é¨éä¸ * @return */ private long countRightValue(Tree node,boolean isAll){ long value = 0; for(int i = 0;i < node.getChildren().size();i++){ Tree childNode = (Tree)node.getChildren().get(i); if(isAll && node.getData() instanceof PLTabButton ){ PLTabButton obj = (PLTabButton)node.getData(); value += (long)Math.pow(2, obj.plSeq);//累计å ä¸å个æä½çæéå¼ } } return value; } /** *