| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除模块下关联的操作类型 |
| | | * @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("父id不能为空!"); |
| | | } |
| | | 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); |
| | | }); |
| | | |
| | |
| | | //写excel |
| | | 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(); |
| | |
| | | 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); |
| | |
| | | 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) { |
| | |
| | | } |
| | | //######################### 合并 ######################### |
| | | 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){ |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | } 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) { |
| | |
| | | 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(); |
| | |
| | | * @data 2014-3-11 |
| | | */ |
| | | private List<SheetDataSet> getFileList(File f) throws PLException, IOException { |
| | | // 获取流 |
| | | BufferedInputStream fileInputStream = new BufferedInputStream( |
| | | new FileInputStream(f)); |
| | | String name = f.getName(); |
| | | // 获取表list |
| | | List<SheetDataSet> sheetDataSets = ExcelDocumentUtils |
| | | .readExcelDocument(name, fileInputStream); |
| | | List<SheetDataSet> sheetDataSets = ExcelUtil.readDataObjectFromExcel(f); |
| | | return sheetDataSets; |
| | | } |
| | | |
| | |
| | | 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{ |
| | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 移除模块下的操作 |
| | | * @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转DO对象 |
| | | * @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(); |
| | |
| | | //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(); |
| | |
| | | */ |
| | | private FunctionInfo check(MenuVO menuVO,String type) { |
| | | FunctionInfo obj = new FunctionInfo(); |
| | | |
| | | //获取表单输入的值 |
| | | String modelName = menuVO.getName(); |
| | | String csIdentity = menuVO.getPathC(); |
| | |
| | | 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")){ |
| | | //给object对象赋值 |
| | | 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(); |
| | |
| | | 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; |