From b75e809d02809726382ed45b6c3c3394b091ec7e Mon Sep 17 00:00:00 2001 From: ludc Date: 星期五, 23 八月 2024 18:30:07 +0800 Subject: [PATCH] 首页配置接口联调修改上传 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java | 176 ++++++++++++++++++++++++++++++---------------------------- 1 files changed, 90 insertions(+), 86 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java index e3b50dc..3f6dd7e 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java @@ -1,8 +1,8 @@ package com.vci.frameworkcore.compatibility.impl; +import com.vci.client.ClientSession; import com.vci.client.common.excel.ExcelDocumentUtils; import com.vci.common.exception.VciException; -import com.vci.common.locale.LocaleDisplay; import com.vci.common.utility.ObjectUtility; import com.vci.corba.common.PLException; import com.vci.corba.common.data.UserEntityInfo; @@ -11,7 +11,8 @@ import com.vci.corba.framework.data.OperateInfo; import com.vci.frameworkcore.compatibility.SmHMSysModConfigServiceI; import com.vci.pagemodel.MenuVO; -import com.vci.client.common.excel.SheetDataSet; +import com.vci.starter.poi.bo.SheetDataSet; +import com.vci.starter.poi.bo.SheetRowData; import com.vci.starter.poi.bo.WriteExcelData; import com.vci.starter.poi.bo.WriteExcelOption; import com.vci.starter.poi.util.ExcelUtil; @@ -166,34 +167,33 @@ } /** + * 鍒犻櫎妯″潡涓嬪叧鑱旂殑鎿嶄綔绫诲瀷 + * @param funcOperationInfo + * @return + */ + @Override + public boolean delFuncOperation(FuncOperationInfo funcOperationInfo) { + VciBaseUtil.alertNotNull(funcOperationInfo,"鍒犻櫎鐨勬搷浣滅被鍨嬪垪琛�"); + return foDelegate.deleteFuncOperation(funcOperationInfo); + } + + /** * 澧炲姞鎿嶄綔绫诲瀷 * @return */ @Override - public boolean addOperationType(List<MenuVO> menuVOList) { - VciBaseUtil.alertNotNull(menuVOList,"娣诲姞鎿嶄綔绫诲瀷鐨勫垪琛�"); + public boolean addOperationType(List<FuncOperationInfo> funcOperationInfoList) { + VciBaseUtil.alertNotNull(funcOperationInfoList,"娣诲姞鎿嶄綔绫诲瀷鐨勫垪琛�");//灏嗘搷浣滅被鍨嬬粍瑁呮垚闇�瑕佸瓨鍌ㄧ殑瀵硅薄 List<FuncOperationInfo> objs = new ArrayList<>(); - //灏嗘搷浣滅被鍨嬬粍瑁呮垚闇�瑕佸瓨鍌ㄧ殑瀵硅薄 - menuVOList.stream().forEach(menuVO -> { - FuncOperationInfo info = new FuncOperationInfo(); - //info.id = menuVO.getId() == null ? "" : menuVO.getId(); - info.funcId = menuVO.getParentId() == null ? "" : menuVO.getParentId(); - info.operId = menuVO.getId() == null ? "" : menuVO.getId(); - info.operName = menuVO.getName() == null ? "" : menuVO.getName(); - //info.operIndentify = menuVO.getOperIndentify() == null ? "" : menuVO.getOperIndentify(); - info.operAlias = menuVO.getAlias() == null ? "" : menuVO.getAlias(); - info.operDesc = menuVO.getRemark() == null ? "" : menuVO.getRemark(); + funcOperationInfoList.stream().forEach(info -> { + if(Func.isBlank(info.funcId)){ + throw new VciBaseException("鐖秈d涓嶈兘涓虹┖锛�"); + } + if(Func.isBlank(info.operId)){ + throw new VciBaseException("鏈幏鍙栨搷浣滃悕绉帮紒"); + } info.number = -1; info.isValid = true; - /*VCIBaseTreeNode node = (VCIBaseTreeNode)treePaths[i].getLastPathComponent(); - OperateObject operateObject = (OperateObject) node.getObj(); - obj.setFuncId(funcObj.getId()); - obj.setOperId(operateObject.getId()); - obj.setOperName(operateObject.getName()); - obj.setOperIndentify(operateObject.getIdentify()); - obj.setOperAlias(operateObject.getAlias()); - obj.setNumber(-1); - obj.setIsValid(true);*/ objs.add(info); }); @@ -279,7 +279,7 @@ //鍐檈xcel String excelPath = defaultTempFolder + File.separator + "module.xls"; final List<String> columns = new ArrayList<String>(Arrays.asList("PLNAME","PLRESOURCEC","PLSUFFIXC","PLRESOURCEB", - "PLSUFFIXB","PLMODULENO","PLDESC","PLISVALID","PLIMAGE","PLMODULESEQUENCE","PLALIASNAME", + "PLSUFFIXB","PLDESC","PLISVALID","PLIMAGE","PLMODULESEQUENCE","PLALIASNAME", "PLMODULENAME","PLRESOURCEDOTNET","PLRESOURCEMOBIL","绾у埆","鍒悕","PLNO","PLISVALID", "PLNAME","PLUNIQUEFLAG","PLDESC","PLALIAS","PLSEQUENCE"));// 璁剧疆琛ㄥ崟鍒楀悕 //int count = transmitTreeObject.getCurrentTreeNode().getChildCount(); @@ -316,7 +316,7 @@ excelDataList.add(new WriteExcelData(row,6, ""+datas[i][6])); excelDataList.add(new WriteExcelData(row,7, ""+datas[i][7])); excelDataList.add(new WriteExcelData(row,8, ""+datas[i][8])); - excelDataList.add(new WriteExcelData(row,9, ""+datas[i][9])); + excelDataList.add(new WriteExcelData(row,9,""+datas[i][9])); excelDataList.add(new WriteExcelData(row,10,""+datas[i][10])); excelDataList.add(new WriteExcelData(row,11,""+datas[i][11])); excelDataList.add(new WriteExcelData(row,12,""+datas[i][12])); @@ -329,7 +329,6 @@ excelDataList.add(new WriteExcelData(row,19,""+datas[i][19])); excelDataList.add(new WriteExcelData(row,20,""+datas[i][20])); excelDataList.add(new WriteExcelData(row,21,""+datas[i][21])); - excelDataList.add(new WriteExcelData(row,22,""+datas[i][22])); } } WriteExcelOption excelOption = new WriteExcelOption(excelDataList); @@ -410,25 +409,23 @@ if (sheetDataSets != null && !sheetDataSets.isEmpty()) { for (SheetDataSet sheet : sheetDataSets) { // sheet涓嶈兘涓虹┖骞朵笖蹇呴』鏈夊嚭琛ㄥご澶栫殑涓�鏉℃暟鎹� - if (sheet != null && sheet.getDataSet() != null && sheet.getDataSet().size() > 1) { - List<String[]> dataSet = sheet.getDataSet(); + if (sheet != null && sheet.getRowData() != null && sheet.getRowData().size() > 1) { + List<SheetRowData> dataSet = sheet.getRowData(); String fParentId=""; //绗竴绾х殑id(绗簩绾х殑parentid) boolean boo=true; boolean first=false; String[] pd=new String[100]; int jibie=2; - for (int i = 1; i < dataSet.size(); i++) { - //fileDatas = new ArrayList<FunctionObject>(); - String[] oneData = dataSet.get(i); + for (int i = 0; i < dataSet.size(); i++) { + Map<Integer, String> oneData = dataSet.get(i).getData(); String id = ObjectUtility.getNewObjectID36(); FunctionInfo funObj=new FunctionInfo(); boolean onebl=false; boolean twobl=false; boolean same=false; - String plName=oneData[0]; - //TODO: 杩欓噷缁濆浼氬嚭闂锛屽鍑虹殑绗竴灞傜殑绾у埆閮芥槸0锛岄兘涓嶄細瀛樺湪绛変簬1鐨勶紝鎵�浠ュ钩鍙拌繖鍎跨瓑浜�1搴旇鏄笉瀵圭殑 - if(oneData[14].equals("0")) { + String plName = Func.isBlank(oneData.get(0)) ? "":oneData.get(0); + if(oneData.get(14).equals("1")) { try { onebl = foDelegate.firstLevel(plName); } catch (VciException e) { @@ -462,7 +459,7 @@ } //######################### 鍚堝苟 ######################### for(jibie=2;jibie<100;jibie++){ - if(oneData[14].equals(String.valueOf(jibie))){ + if(oneData.get(14).equals(String.valueOf(jibie))){ if(first == true && boo == true){ try { if(pd[jibie]==null){ @@ -495,12 +492,12 @@ } } - if(oneData[14].equals("-1")) { + if(oneData.get(14).equals("-1")) { importExcelData(count); FuncOperationInfo foObj = new FuncOperationInfo(); int len=fileFunctionDatas.size(); //**************鍚屼竴鑺傜偣涓嬩笉鑳芥湁鐩稿悓鐨勬搷浣滅被鍨�******************** - String dataOperName=oneData[18]; + String dataOperName=oneData.get(18); String plFuncOid=fileFunctionDatas.get(len-1).id; try { same = foDelegate.selSameOper(dataOperName,plFuncOid); @@ -513,15 +510,15 @@ foObj.id = id; foObj.funcId = fileFunctionDatas.get(len-1).id; try { - OperateInfo operObj = foDelegate.fetchOperateTypeByName(oneData[18]); + OperateInfo operObj = foDelegate.fetchOperateTypeByName(oneData.get(18)); foObj.operId = operObj.id; } catch (VciException e) { // TODO Auto-generated catch block e.printStackTrace(); } - foObj.number = Integer.parseInt(oneData[16]); - foObj.operAlias = oneData[15]; - foObj.isValid = Integer.parseInt(oneData[17]) != 0; + foObj.number = Integer.parseInt(oneData.get(16)); + foObj.operAlias = oneData.get(15); + foObj.isValid = Integer.parseInt(oneData.get(17)) != 0; try { foDelegate.saveFuncOperation2(foObj); } catch (VciException e) { @@ -530,9 +527,9 @@ } } else { - foObj.number = Integer.parseInt(oneData[16]); - foObj.operAlias = oneData[15]; - foObj.isValid = Integer.parseInt(oneData[17]) != 0; + foObj.number = Integer.parseInt(oneData.get(16)); + foObj.operAlias = oneData.get(15); + foObj.isValid = Integer.parseInt(oneData.get(17)) != 0; try { foDelegate.updateOperation(foObj,dataOperName,plFuncOid); } catch (VciException e) { @@ -558,7 +555,7 @@ private boolean importExcelData(int count) throws PLException { boolean b=false; try { - b= foDelegate.importModules(fileFunctionDatas.toArray(new FunctionInfo[]{}),count); + b = foDelegate.importModules(fileFunctionDatas.toArray(new FunctionInfo[fileFunctionDatas.size()]),count); } catch (VciBaseException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -576,13 +573,8 @@ * @data 2014-3-11 */ private List<SheetDataSet> getFileList(File f) throws PLException, IOException { - // 鑾峰彇娴� - BufferedInputStream fileInputStream = new BufferedInputStream( - new FileInputStream(f)); - String name = f.getName(); // 鑾峰彇琛╨ist - List<SheetDataSet> sheetDataSets = ExcelDocumentUtils - .readExcelDocument(name, fileInputStream); + List<SheetDataSet> sheetDataSets = ExcelUtil.readDataObjectFromExcel(f); return sheetDataSets; } @@ -618,13 +610,13 @@ if(isFunction){ if(!plDatas[i][16].trim().equals("") && plDatas[i][16]!=null && !plDatas[i][16].equals("-1")){ bw.write("insert into plfunction values('"+plDatas[i][0]+"','"+plDatas[i][1]+"',"+"'"+plDatas[i][2]+"',"+"'"+plDatas[i][3]+"',"+"'"+plDatas[i][4]+"'," - +"'"+plDatas[i][5]+"',"+"'"+plDatas[i][6]+"',"+"'"+plDatas[i][7]+"',"+"'"+plDatas[i][8]+"',"+"'"+plDatas[i][9]+"',"+"'"+plDatas[i][10]+"',"+"'"+plDatas[i][11]+"'," - +"'"+plDatas[i][12]+"',"+"'"+plDatas[i][13]+"',"+"'"+plDatas[i][14]+"',"+"'"+plDatas[i][15]+"');"); + +"',"+"'"+plDatas[i][5]+"',"+"'"+plDatas[i][6]+"',"+"'"+plDatas[i][7]+"',"+"'"+plDatas[i][8]+"',"+"'"+plDatas[i][9]+"',"+"'"+plDatas[i][10]+"'," + +"'"+plDatas[i][11]+"',"+"'"+plDatas[i][12]+"',"+"'"+plDatas[i][13]+"',"+"'"+plDatas[i][14]+"');"); bw.write("\r\n"); } - if(!plDatas[i][16].trim().equals("") && plDatas[i][16]!=null && plDatas[i][16].equals("-1")){ - bw.write("insert into plfuncoperation values('"+plDatas[i][17]+"','"+plDatas[i][18]+"',"+"'"+plDatas[i][19]+"',"+"'"+plDatas[i][20]+"',"+"'"+plDatas[i][21]+"'," - +"'"+plDatas[i][22]+"');"); + if(!plDatas[i][15].trim().equals("") && plDatas[i][15]!=null && plDatas[i][15].equals("-1")){ + bw.write("insert into plfuncoperation values('"+plDatas[i][16]+"','"+plDatas[i][17]+"',"+"'"+plDatas[i][18]+"',"+"'"+plDatas[i][19]+"',"+"'"+plDatas[i][20]+"'," + +"'"+plDatas[i][21]+"');"); bw.write("\r\n"); } }else{ @@ -695,20 +687,19 @@ return res; } - public void fuzhi(FunctionInfo functionInfo,String[] oneData){ - functionInfo.name = oneData[0]; - functionInfo.resourceC = oneData[1]; - functionInfo.suffixC = oneData[2]; - functionInfo.desc = oneData[6]; - functionInfo.resourceB = oneData[3]; - functionInfo.suffixB = oneData[4]; - functionInfo.seq = Integer.parseInt(oneData[9]); - //funObj.setModuleNo(Integer.parseInt(oneData[5])); - functionInfo.image = oneData[8]; - functionInfo.isValid = Integer.parseInt(oneData[7]) != 0; - functionInfo.aliasName = oneData[10]; - functionInfo.resourceDotNet = oneData[12]; - functionInfo.resourceMobile = oneData[13]; + public void fuzhi(FunctionInfo functionInfo,Map<Integer,String> oneData){ + functionInfo.name = oneData.get(0); + functionInfo.resourceC = oneData.get(1); + functionInfo.suffixC = oneData.get(2); + functionInfo.desc = oneData.get(5); + functionInfo.resourceB = oneData.get(3); + functionInfo.suffixB = oneData.get(4); + functionInfo.seq = Integer.parseInt(oneData.get(8)); + functionInfo.image = oneData.get(7); + functionInfo.isValid = Integer.parseInt(oneData.get(6)) != 0; + functionInfo.aliasName = oneData.get(9); + functionInfo.resourceDotNet = oneData.get(11); + functionInfo.resourceMobile = oneData.get(12); } /** @@ -827,13 +818,29 @@ } /** + * 绉婚櫎妯″潡涓嬬殑鎿嶄綔 + * @param funcOperationInfo + * @return + * @throws VciException + */ + public boolean deleteFuncOperation(FuncOperationInfo funcOperationInfo) throws VciBaseException{ + boolean res = true; + try{ + res = platformClientUtil.getFrameworkService().deleteFuncOperation(funcOperationInfo, this.getUserEntityInfo()); + }catch (PLException e) { + e.printStackTrace(); + throw new VciBaseException(String.valueOf(e.code), e.messages); + } + return res; + } + + /** * VO杞珼O瀵硅薄 * @return */ public FunctionInfo menuVO2FunctionInfo(MenuVO object){ FunctionInfo info = new FunctionInfo(); info.id = object.getId() == null ? "" : object.getId(); - //info.layer = object.getLayer(); info.name = object.getName() == null ? "" : object.getName(); info.parentId = object.getParentId() == null ? "" : object.getParentId(); info.resourceC = object.getPathC() == null ? "" : object.getPathC(); @@ -842,7 +849,6 @@ //info.suffixB = object.getSuffixB() == null ? "" : object.getSuffixB(); info.desc = object.getRemark() == null ? "" : object.getRemark(); info.seq = object.getSort(); - //info.moduleNo = object.getModuleNo(); info.image = object.getSource() == null ? "" : object.getSource(); info.isValid = object.getIsValid(); info.aliasName = object.getAlias() == null ? "" : object.getAlias(); @@ -862,7 +868,6 @@ */ private FunctionInfo check(MenuVO menuVO,String type) { FunctionInfo obj = new FunctionInfo(); - //鑾峰彇琛ㄥ崟杈撳叆鐨勫�� String modelName = menuVO.getName(); String csIdentity = menuVO.getPathC(); @@ -871,36 +876,35 @@ String resDotNet = menuVO.getResourceDotNet(); String resMobile = menuVO.getResourceMobile(); - //int moduleNo = transferStringToNum(moduleNoTxt.getText()); - int sequence = menuVO.getSort(); + int sequence = Func.isNotEmpty(menuVO.getSort()) ? menuVO.getSort():1; String description = menuVO.getRemark(); - if("".equals(modelName) || "null".equals(modelName) || modelName == null) { + if(Func.isBlank(modelName)) { throw new VciBaseException("妯″潡鍚嶄笉鑳戒负绌猴紒"); }else if(modelName.length() > 128) { throw new VciBaseException("妯″潡鍚嶉暱搴︿笉鑳借秴杩�128锛�"); - }else if(description.length() > 255) { + }else if(Func.isNotBlank(description) && description.length() > 255) { throw new VciBaseException("鎻忚堪闀垮害涓嶈兘瓒呰繃255锛�"); - }else if(csIdentity != null && !"".equals(csIdentity) && csIdentity.length() > 255) { + }else if(Func.isNotBlank(csIdentity) && csIdentity.length() > 255) { throw new VciBaseException("C/S鏍囪瘑闀垮害涓嶈兘瓒呰繃255锛�"); - } else if(resDotNet != null && !"".equals(resDotNet) && resDotNet.length() > 255) { + } else if(Func.isNotBlank(resDotNet) && resDotNet.length() > 255) { throw new VciBaseException(".NET鏍囪瘑闀垮害涓嶈兘瓒呰繃255锛�"); - }else if(resMobile != null && !"".equals(resMobile) && resMobile.length() > 255) { + }else if(Func.isNotBlank(resMobile) && resMobile.length() > 255) { throw new VciBaseException("Mobile鏍囪瘑闀垮害涓嶈兘瓒呰繃255锛�"); } else if (sequence < 0) { throw new VciBaseException("搴忓彿涓嶈兘灏忎簬0锛�"); } if(type.equals("add")){ //缁檕bject瀵硅薄璧嬪�� - String parentId = ""; + /*String parentId = ""; if(menuVO.getModeType().equals("FunctionObject")) { parentId = menuVO.getParentId(); }else if("modelManagmentNode".equals(menuVO.getParentId())) { parentId = "modelManagmentNode"; }else if("systemManagmentNode".equals(menuVO.getParentId())) { parentId = "systemManagmentNode"; - } - obj.parentId = parentId; + }*/ + obj.parentId = menuVO.getParentId(); }else{ obj.id = menuVO.getId(); obj.parentId = menuVO.getParentId(); @@ -909,11 +913,11 @@ obj.resourceC = csIdentity; obj.desc = description; obj.resourceB = bsIdentity; - obj.suffixC = ""; - obj.suffixB = ""; + /*obj.suffixC = ""; + obj.suffixB = "";*/ obj.seq = sequence; obj.image = menuVO.getSource(); - obj.isValid = menuVO.getValid();//1鏈夋晥0鏃犳晥 + obj.isValid = Func.isNotEmpty(menuVO.getValid()) ? menuVO.getValid():false; obj.aliasName = aliasName; obj.resourceDotNet = resDotNet; obj.resourceMobile = resMobile; -- Gitblit v1.9.3