¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.frameworkcore.compatibility.impl; |
| | | |
| | | 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.FuncOperationInfo; |
| | | import com.vci.corba.framework.data.FunctionInfo; |
| | | 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.WriteExcelData; |
| | | import com.vci.starter.poi.bo.WriteExcelOption; |
| | | import com.vci.starter.poi.util.ExcelUtil; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.SessionInfo; |
| | | import com.vci.starter.web.util.LocalFileUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.WebThreadLocalUtil; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * é¦é¡µç³»ç»æ¨¡åé
ç½®æ·»å æé®ãæ·»å æä½ç±»åçæ¥å£æå¡ |
| | | * @author ludc |
| | | * @date 2024/8/19 12:42 |
| | | */ |
| | | @Service |
| | | public class SmHMSysModConfigServiceImpl implements SmHMSysModConfigServiceI { |
| | | |
| | | @Autowired |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | private List<FunctionInfo> fileFunctionDatas = new ArrayList<FunctionInfo>(); |
| | | |
| | | private int count = 0; |
| | | |
| | | private static FunctionOperateDelegate foDelegate; |
| | | |
| | | { |
| | | if(Func.isEmpty(foDelegate)){ |
| | | foDelegate = new FunctionOperateDelegate(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * æ·»å æ¨¡å |
| | | * @param menuVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MenuVO addModule(MenuVO menuVO) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(menuVO,"æ°å¢ç模å对象"); |
| | | try { |
| | | //徿°æ®åºéæå
¥æ°å»ºæ¨¡åæ°æ® |
| | | String puid = foDelegate.saveModule(menuVO); |
| | | /** |
| | | * è¿åå¼ï¼1ï¼è¡¨ç¤ºæ¨¡ååç§°éå¤ |
| | | * 2ï¼è¡¨ç¤ºæ¨¡åæ è¯éå¤ |
| | | * 3, 模æ¿å«ååå¨éå¤ |
| | | */ |
| | | if(puid.equals("1")){ |
| | | throw new VciBaseException("模ååç§°éå¤ï¼è¯·ä¿®æ¹ï¼"); |
| | | }else if(puid.equals("2")){ |
| | | throw new VciBaseException("æ¨¡åæ è¯éå¤ï¼è¯·ä¿®æ¹ï¼"); |
| | | }else if(puid.equals("3")) { |
| | | throw new VciBaseException("模åå«åéå¤ï¼è¯·ä¿®æ¹ï¼"); |
| | | } |
| | | menuVO.setId(puid); |
| | | return menuVO; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨¡å |
| | | * @param menuVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MenuVO updateModule(MenuVO menuVO) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(menuVO,"ä¿®æ¹ç模å对象"); |
| | | try { |
| | | String res = ""; |
| | | //æ´æ°æ°æ®åº |
| | | res = foDelegate.updateMod(menuVO); |
| | | /** |
| | | * è¿åï¼1表示模ååéå¤ã |
| | | * 2è¡¨ç¤ºæ¨¡åæ è¯éå¤ã |
| | | * 3æ 示模åå«åéå¤ã |
| | | */ |
| | | if(res.equals("1")){ |
| | | throw new VciBaseException("模ååç§°éå¤ï¼è¯·ä¿®æ¹ï¼"); |
| | | }else if(res.equals("2")){ |
| | | throw new VciBaseException("æ¨¡åæ è¯éå¤ï¼è¯·ä¿®æ¹ï¼"); |
| | | }else if(res.equals("3")) { |
| | | throw new VciBaseException("模åå«åéå¤ï¼è¯·ä¿®æ¹ï¼"); |
| | | }/* else if (res.equals("4")) { |
| | | throw new VciBaseException("模åç¼å·éå¤ï¼è¯·ä¿®æ¹ï¼"); |
| | | }*/ |
| | | return menuVO; |
| | | } catch (VciBaseException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å 餿¨¡å |
| | | * @param menuVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean delModule(MenuVO menuVO) { |
| | | VciBaseUtil.alertNotNull(menuVO,"æ·»å æä½ç±»åçå表"); |
| | | String res = ""; |
| | | try { |
| | | String puid = ""; |
| | | if("FunctionObject".equals(menuVO.getModeType())) { |
| | | puid = menuVO.getId(); |
| | | }else if("modelManagmentNode".equals(menuVO.getId())) { |
| | | puid = "modelManagmentNode"; |
| | | }else if("systemManagmentNode".equals(menuVO.getId())) { |
| | | puid = "systemManagmentNode"; |
| | | } |
| | | if(Func.isBlank(puid)){ |
| | | throw new VciBaseException("æªæ¾å°è¦å é¤ç模åï¼"); |
| | | } |
| | | res = foDelegate.deleteModule(puid); |
| | | /** |
| | | * è¿åå¼ï¼1表示模å卿鿍¡åå·²ç»æææä¿¡æ¯ï¼æ æ³å é¤ |
| | | */ |
| | | if(res.equals("1")){ |
| | | throw new VciBaseException("å½å模åï¼æä¸çº§æ¨¡åï¼å·²ç»å卿æä¿¡æ¯ï¼æ æ³å é¤ã"); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¢å æä½ç±»å |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addOperationType(List<MenuVO> menuVOList) { |
| | | VciBaseUtil.alertNotNull(menuVOList,"æ·»å æä½ç±»åçå表"); |
| | | 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(); |
| | | 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); |
| | | }); |
| | | |
| | | //æ§è¡ä¿å |
| | | boolean res = true; |
| | | try { |
| | | res = this.saveFuncOperation(objs.toArray(new FuncOperationInfo[objs.size()])); |
| | | } catch (Exception e) { |
| | | res = false; |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "å¢å æä½ç±»å失败ï¼åå ï¼" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * å é¤éç³»ç»æ¨¡å |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean delNonsysModule() { |
| | | try { |
| | | if(platformClientUtil.getFrameworkService().deleteModules("nonsys")){ |
| | | return true; |
| | | } |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "å é¤éç³»ç»æ¨¡å失败,åå ï¼"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸å¡æ¨¡å |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean delBusinessModule() { |
| | | try { |
| | | if(platformClientUtil.getFrameworkService().deleteModules("business")){ |
| | | return true; |
| | | } |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "å é¤ä¸å¡æ¨¡å失败,åå ï¼"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | throw new VciBaseException(exceptionMessage); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 导åºsql |
| | | * @return |
| | | */ |
| | | @Override |
| | | public File exportFunctionSql(HttpServletResponse response,String exportPath,boolean isFunction) throws PLException { |
| | | String dir = Func.isBlank(exportPath) ? LocalFileUtil.getDefaultTempFolder():exportPath; |
| | | String[][] allDatas; |
| | | int size; |
| | | if(isFunction){ |
| | | size = (int)platformClientUtil.getFrameworkService().getAllModelManagementNum(); |
| | | allDatas = this.getAllDatas(size); |
| | | }else{ |
| | | size = (int)platformClientUtil.getFrameworkService().getAllOperitionsNum(); |
| | | allDatas = this.getAllOperitions(size); |
| | | } |
| | | File file = expData(dir,isFunction, allDatas); |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String exportModule(HttpServletResponse response) throws IOException { |
| | | String defaultTempFolder = LocalFileUtil.getDefaultTempFolder(); |
| | | //å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", |
| | | "PLMODULENAME","PLRESOURCEDOTNET","PLRESOURCEMOBIL","级å«","å«å","PLNO","PLISVALID", |
| | | "PLNAME","PLUNIQUEFLAG","PLDESC","PLALIAS","PLSEQUENCE"));// 设置表ååå |
| | | //int count = transmitTreeObject.getCurrentTreeNode().getChildCount(); |
| | | new File(excelPath).createNewFile(); |
| | | //设置å |
| | | List<WriteExcelData> excelDataList = new ArrayList<>(10000); |
| | | //设置å头 |
| | | for (int index = 0; index < columns.size(); index++) { |
| | | excelDataList.add(new WriteExcelData(0,index, columns.get(index))); |
| | | } |
| | | //æ¥è¯¢è¦å¯¼åºçæ°æ® |
| | | String[][] firstLevel = new String[3000][23]; |
| | | try { |
| | | firstLevel = this.checkLevel(); |
| | | } catch (VciBaseException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | String[][] datas = new String[10000][columns.size()]; |
| | | for(int i=0;i<firstLevel.length;i++){ |
| | | datas[i] =firstLevel[i]; |
| | | } |
| | | if(Func.isEmpty(datas)){ |
| | | excelDataList.add(new WriteExcelData(1,1, "导åºçå表为空ï¼è¯·å·æ°åå°è¯éæ°å¯¼åºï¼")); |
| | | }else{ |
| | | for (int i = 0; i < firstLevel.length; i++) { |
| | | int row = i + 1; |
| | | excelDataList.add(new WriteExcelData(row,0, ""+datas[i][0])); |
| | | excelDataList.add(new WriteExcelData(row,1, ""+datas[i][1])); |
| | | excelDataList.add(new WriteExcelData(row,2, ""+datas[i][2])); |
| | | excelDataList.add(new WriteExcelData(row,3, ""+datas[i][3])); |
| | | excelDataList.add(new WriteExcelData(row,4, ""+datas[i][4])); |
| | | excelDataList.add(new WriteExcelData(row,5, ""+datas[i][5])); |
| | | 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,10,""+datas[i][10])); |
| | | excelDataList.add(new WriteExcelData(row,11,""+datas[i][11])); |
| | | excelDataList.add(new WriteExcelData(row,12,""+datas[i][12])); |
| | | excelDataList.add(new WriteExcelData(row,13,""+datas[i][13])); |
| | | excelDataList.add(new WriteExcelData(row,14,""+datas[i][14])); |
| | | excelDataList.add(new WriteExcelData(row,15,""+datas[i][15])); |
| | | excelDataList.add(new WriteExcelData(row,16,""+datas[i][16])); |
| | | excelDataList.add(new WriteExcelData(row,17,""+datas[i][17])); |
| | | excelDataList.add(new WriteExcelData(row,18,""+datas[i][18])); |
| | | 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); |
| | | ExcelUtil.writeDataToFile(excelPath, excelOption); |
| | | return excelPath; |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥ |
| | | * @param files |
| | | * @return |
| | | * @throws PLException |
| | | */ |
| | | @Override |
| | | public BaseResult importModule(LinkedList<File> files) throws PLException, IOException { |
| | | logger.info("æ£å¨æ¶éè¡¨åæ°æ®......"); |
| | | boolean isSuccess = collectionDatas(files); |
| | | logger.info("æ£å¨å¯¼å
¥è¡¨å人åä¿¡æ¯......"); |
| | | logger.info("count==="+count); |
| | | boolean resBoolean = false; |
| | | if(isSuccess == false){ |
| | | resBoolean = importExcelData(count); |
| | | } |
| | | return resBoolean ? BaseResult.success("导å
¥æåï¼"):BaseResult.fail("导å
¥å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | /** |
| | | * 管çåè½æ¨¡åãä¸å¡åè½æ¨¡åä¸çå¶åèç¹âä¿®æ¹æä½å«åæ¥å£ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateAlias(MenuVO menuVO) throws VciException { |
| | | String alias = menuVO.getAlias(); |
| | | if ("".equals(alias)){ |
| | | throw new VciBaseException("请填åæä½å«å!"); |
| | | } |
| | | boolean isValid = menuVO.getIsValid(); |
| | | String id = menuVO.getId(); |
| | | return foDelegate.updateFuncOperation(id , alias, isValid); |
| | | } |
| | | |
| | | @Override |
| | | public List<Object> getSysConfTree() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public boolean addSysConf() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateSysConf() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean delSysConf() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public String exportSysConf(HttpServletResponse response) { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * æ¶é表åä¿¡æ¯ã |
| | | * @param files |
| | | * @return |
| | | * @throws PLException |
| | | * @throws IOException |
| | | */ |
| | | private boolean collectionDatas(LinkedList<File> files) throws PLException, IOException{ |
| | | boolean b=false; |
| | | for (File f : files) { |
| | | List<SheetDataSet> sheetDataSets = this.getFileList(f); |
| | | 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(); |
| | | 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); |
| | | 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")) { |
| | | try { |
| | | onebl = foDelegate.firstLevel(plName); |
| | | } catch (VciException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | //å¦æç¬¬ä¸çº§éå |
| | | if(onebl == true) {//第ä¸çº§éååè¦ç第ä¸çº§ |
| | | fuzhi(funObj,oneData); |
| | | try { |
| | | fParentId = foDelegate.changeFirstLevel(funObj,plName); |
| | | pd[2]=fParentId; |
| | | } catch (VciException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | funObj.id = fParentId; |
| | | fileFunctionDatas.add(funObj); |
| | | first=true; |
| | | |
| | | |
| | | } else { |
| | | funObj.id = id; |
| | | funObj.parentId = "modelManagmentNode"; |
| | | fuzhi(funObj,oneData); |
| | | fileFunctionDatas.add(funObj); |
| | | first=false; |
| | | } |
| | | |
| | | b=false; |
| | | } |
| | | //######################### åå¹¶ ######################### |
| | | for(jibie=2;jibie<100;jibie++){ |
| | | if(oneData[14].equals(String.valueOf(jibie))){ |
| | | if(first == true && boo == true){ |
| | | try { |
| | | if(pd[jibie]==null){ |
| | | pd[jibie]=""; |
| | | } |
| | | twobl=foDelegate.secondLevel(plName,pd[jibie]); |
| | | } catch (VciException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | if(twobl==true) {//éååè¦ç |
| | | fuzhi(funObj,oneData); |
| | | try { |
| | | fParentId=foDelegate.changeSecondLevel(funObj,plName,pd[jibie]); |
| | | pd[jibie+1]=fParentId; |
| | | } catch (VciException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | //funObj.setId(fParentId); |
| | | funObj.id = pd[jibie+1]; |
| | | fileFunctionDatas.add(funObj); |
| | | boo = true; |
| | | |
| | | } |
| | | } else { |
| | | funObj.id = id; |
| | | b = false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(oneData[14].equals("-1")) { |
| | | importExcelData(count); |
| | | FuncOperationInfo foObj = new FuncOperationInfo(); |
| | | int len=fileFunctionDatas.size(); |
| | | //**************åä¸èç¹ä¸ä¸è½æç¸åçæä½ç±»å******************** |
| | | String dataOperName=oneData[18]; |
| | | String plFuncOid=fileFunctionDatas.get(len-1).id; |
| | | try { |
| | | same = foDelegate.selSameOper(dataOperName,plFuncOid); |
| | | } catch (VciBaseException e1) { |
| | | // TODO Auto-generated catch block |
| | | e1.printStackTrace(); |
| | | } |
| | | //****************************************************** |
| | | if(same == false) { |
| | | foObj.id = id; |
| | | foObj.funcId = fileFunctionDatas.get(len-1).id; |
| | | try { |
| | | OperateInfo operObj = foDelegate.fetchOperateTypeByName(oneData[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; |
| | | try { |
| | | foDelegate.saveFuncOperation2(foObj); |
| | | } catch (VciException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } else { |
| | | foObj.number = Integer.parseInt(oneData[16]); |
| | | foObj.operAlias = oneData[15]; |
| | | foObj.isValid = Integer.parseInt(oneData[17]) != 0; |
| | | try { |
| | | foDelegate.updateOperation(foObj,dataOperName,plFuncOid); |
| | | } catch (VciException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | count=fileFunctionDatas.size(); |
| | | b=true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥è¡¨åæ°æ® |
| | | * @throws VciException |
| | | */ |
| | | private boolean importExcelData(int count) throws PLException { |
| | | boolean b=false; |
| | | try { |
| | | b= foDelegate.importModules(fileFunctionDatas.toArray(new FunctionInfo[]{}),count); |
| | | } catch (VciBaseException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * è·åè¡¨åæ°æ® |
| | | * @param f |
| | | * @return |
| | | * @throws IOException |
| | | * @throws PLException |
| | | * @autor caicong |
| | | * @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); |
| | | return sheetDataSets; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢"åè½æ¨¡å管ç"æ´ä¸ªæ ç»æå¹¶å¯¼åº |
| | | * add by caill start |
| | | * */ |
| | | private String[][] checkLevel() throws VciBaseException{ |
| | | String[][] res = new String[3000][23]; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().checkLevel(); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(String.valueOf(e.code), e.messages); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * å°æ¥è¯¢åºçæ°æ®è½¬æ¢æsqlå¹¶åå
¥æå®è·¯å¾ä¸ |
| | | * @param dir |
| | | * @param plDatas |
| | | * @return |
| | | */ |
| | | private File expData(String dir,boolean isFunction/*æ¯å¦æ¯å¯¼åºç®¡çåè½æ¨¡åsql*/, String[][] plDatas){ |
| | | new File(dir).mkdir(); |
| | | File file = new File(dir + (isFunction ? "/plfuncoperation.sql":"/ploperation.sql")); |
| | | try { |
| | | FileWriter w = new FileWriter(file); |
| | | BufferedWriter bw = new BufferedWriter(w); |
| | | System.out.println("é¿åº¦ä¸ºï¼"+plDatas.length); |
| | | for(int i=0;i<plDatas.length;i++){ |
| | | 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]+"');"); |
| | | 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]+"');"); |
| | | bw.write("\r\n"); |
| | | } |
| | | }else{ |
| | | bw.write("insert into ploperation values('"+plDatas[i][0]+"','"+plDatas[i][1]+"',"+"'"+plDatas[i][2]+"',"+"'"+plDatas[i][3]+"',"+"'"+plDatas[i][4]+"'," |
| | | +"'"+plDatas[i][5]+"');"); |
| | | bw.write("\r\n"); |
| | | } |
| | | } |
| | | |
| | | bw.flush(); |
| | | bw.close(); |
| | | return file; |
| | | } catch (IOException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * ä¿å模åä¸çæä½ |
| | | * @param funcOperationObjs |
| | | * @return |
| | | * @throws VciException |
| | | */ |
| | | public boolean saveFuncOperation(FuncOperationInfo[] funcOperationObjs) throws VciException { |
| | | if(funcOperationObjs == null || funcOperationObjs.length < 0){ |
| | | return false; |
| | | } |
| | | boolean res = true; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().saveFuncOperation(funcOperationObjs, foDelegate.getUserEntityInfo()); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciException(String.valueOf(e.code),e.messages); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢"åè½æ¨¡å管ç"æ´ä¸ªæ ç»æå¹¶å¯¼åºsql |
| | | * @return |
| | | * @throws PLException |
| | | */ |
| | | public String[][] getAllDatas(int size) throws PLException { |
| | | String[][] res = new String[size][23]; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().getAllDatas(size); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new PLException(String.valueOf(e.code), e.messages); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * è·å¾ææçæä½ç±»å并导åºå°.sqlæä»¶ä¸ |
| | | * add by caill start 2015.12.11 |
| | | * */ |
| | | private String[][] getAllOperitions(int size) throws VciBaseException{ |
| | | String[][] res = new String[size][6]; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().getAllOperitions(size); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(String.valueOf(e.code), e.messages); |
| | | } |
| | | 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]; |
| | | } |
| | | |
| | | /** |
| | | * å
å«ä¿åæ¨¡åæ¹æ³çæä½ç±» |
| | | */ |
| | | private class FunctionOperateDelegate { |
| | | |
| | | /** |
| | | * å¤æç¬¬ä¸çº§æ°æ®ææ²¡æéåç |
| | | * @param plName |
| | | * @return |
| | | * @throws VciException |
| | | */ |
| | | public boolean firstLevel(String plName) throws VciException{ |
| | | try{ |
| | | return platformClientUtil.getFrameworkService().firstLevel(plName); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciException(String.valueOf(e.code), e.messages); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¦çéåç第ä¸çº§æ°æ® |
| | | * add by caill |
| | | * */ |
| | | public String changeFirstLevel(FunctionInfo functionInfo,String plName) throws VciException{ |
| | | String fParentId=""; |
| | | try { |
| | | fParentId= platformClientUtil.getFrameworkService().changeFirstLevel(functionInfo, plName); |
| | | } catch (PLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return fParentId; |
| | | } |
| | | |
| | | /** |
| | | * å¤æç¬¬äºçº§æ°æ®ææ²¡æéåç |
| | | * add by caill |
| | | * */ |
| | | public boolean secondLevel(String plName,String fParentId) throws VciException{ |
| | | try{ |
| | | return platformClientUtil.getFrameworkService().secondLevel(plName,fParentId); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciException(String.valueOf(e.code), e.messages); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¦çéåç第äºçº§æ°æ® |
| | | * add by caill |
| | | * */ |
| | | public String changeSecondLevel(FunctionInfo functionInfo,String plName,String fParentId) throws VciException{ |
| | | String sParentId=""; |
| | | try { |
| | | sParentId= platformClientUtil.getFrameworkService().changeSecondLevel(functionInfo, plName,fParentId); |
| | | } catch (PLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return sParentId; |
| | | } |
| | | |
| | | /** |
| | | * ä¿å模å |
| | | * @param object |
| | | * @return |
| | | * @throws VciException |
| | | */ |
| | | public String saveModule(MenuVO object) throws VciBaseException { |
| | | String res = ""; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().saveModule(this.check(object,"add"),this.getUserEntityInfo()); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(String.valueOf(e.code), e.messages); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¨¡å |
| | | * @param object |
| | | * @return |
| | | * @throws VciException |
| | | */ |
| | | public String updateMod(MenuVO object) throws VciBaseException { |
| | | String res = ""; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().updateModule(this.check(object,"update"),this.getUserEntityInfo()); |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(String.valueOf(e.code), e.messages); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * å 餿¨¡å |
| | | * @param puid |
| | | * @return |
| | | * @throws VciException |
| | | */ |
| | | public String deleteModule(String puid) throws VciBaseException{ |
| | | String res = ""; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().deleteModule(puid,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.suffixC = object.getSuffixC() == null ? "" : object.getSuffixC(); |
| | | info.resourceB = object.getPath() == null ? "" : object.getPath(); |
| | | //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(); |
| | | info.resourceDotNet = object.getResourceDotNet() == null ? "" : object.getResourceDotNet(); |
| | | info.resourceMobile = object.getResourceMobile() == null ? "" : object.getResourceMobile(); |
| | | info.desc = object.getRemark(); |
| | | return info; |
| | | } |
| | | |
| | | /** |
| | | * <p>Description: 页é¢è¾å
¥çæ ¡éª</p> |
| | | * |
| | | *@author xf |
| | | *@time 2012-5-15 |
| | | *@return FunctionObject |
| | | * @return |
| | | */ |
| | | private FunctionInfo check(MenuVO menuVO,String type) { |
| | | FunctionInfo obj = new FunctionInfo(); |
| | | |
| | | //è·å表åè¾å
¥çå¼ |
| | | String modelName = menuVO.getName(); |
| | | String csIdentity = menuVO.getPathC(); |
| | | String bsIdentity = menuVO.getPath(); |
| | | String aliasName = menuVO.getAlias(); |
| | | String resDotNet = menuVO.getResourceDotNet(); |
| | | String resMobile = menuVO.getResourceMobile(); |
| | | |
| | | //int moduleNo = transferStringToNum(moduleNoTxt.getText()); |
| | | int sequence = menuVO.getSort(); |
| | | String description = menuVO.getRemark(); |
| | | |
| | | if("".equals(modelName) || "null".equals(modelName) || modelName == null) { |
| | | throw new VciBaseException("模ååä¸è½ä¸ºç©ºï¼"); |
| | | }else if(modelName.length() > 128) { |
| | | throw new VciBaseException("模ååé¿åº¦ä¸è½è¶
è¿128ï¼"); |
| | | }else if(description.length() > 255) { |
| | | throw new VciBaseException("æè¿°é¿åº¦ä¸è½è¶
è¿255ï¼"); |
| | | }else if(csIdentity != null && !"".equals(csIdentity) && csIdentity.length() > 255) { |
| | | throw new VciBaseException("C/Sæ è¯é¿åº¦ä¸è½è¶
è¿255ï¼"); |
| | | } else if(resDotNet != null && !"".equals(resDotNet) && resDotNet.length() > 255) { |
| | | throw new VciBaseException(".NETæ è¯é¿åº¦ä¸è½è¶
è¿255ï¼"); |
| | | }else if(resMobile != null && !"".equals(resMobile) && resMobile.length() > 255) { |
| | | throw new VciBaseException("Mobileæ è¯é¿åº¦ä¸è½è¶
è¿255ï¼"); |
| | | } else if (sequence < 0) { |
| | | throw new VciBaseException("åºå·ä¸è½å°äº0ï¼"); |
| | | } |
| | | if(type.equals("add")){ |
| | | //ç»object对象èµå¼ |
| | | 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; |
| | | }else{ |
| | | obj.id = menuVO.getId(); |
| | | obj.parentId = menuVO.getParentId(); |
| | | } |
| | | obj.name = modelName; |
| | | obj.resourceC = csIdentity; |
| | | obj.desc = description; |
| | | obj.resourceB = bsIdentity; |
| | | obj.suffixC = ""; |
| | | obj.suffixB = ""; |
| | | obj.seq = sequence; |
| | | obj.image = menuVO.getSource(); |
| | | obj.isValid = menuVO.getValid();//1ææ0æ æ |
| | | obj.aliasName = aliasName; |
| | | obj.resourceDotNet = resDotNet; |
| | | obj.resourceMobile = resMobile; |
| | | return obj; |
| | | } |
| | | |
| | | /** |
| | | * è·åUserEntityInfo对象 |
| | | * @return |
| | | */ |
| | | public UserEntityInfo getUserEntityInfo(){ |
| | | SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | UserEntityInfo userEntityInfo = new UserEntityInfo(sessionInfo.getUserId(), ""); |
| | | return userEntityInfo; |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥æ¨¡å对象 |
| | | * add by caill |
| | | * */ |
| | | public boolean importModules(FunctionInfo[] funObject,int count) throws VciBaseException{ |
| | | boolean b=false; |
| | | int len = funObject.length; |
| | | List<FunctionInfo> funInfoList = new ArrayList<FunctionInfo>(); |
| | | for(int i = count ; i<len ; i++){ |
| | | if(funObject[i].parentId!=null){ |
| | | FunctionInfo funInfo = funObject[i]; |
| | | funInfoList.add(funInfo); |
| | | } |
| | | } |
| | | FunctionInfo[] funInfos = new FunctionInfo[funInfoList.size()]; |
| | | for(int j=0;j<funInfoList.size();j++){ |
| | | funInfos[j] = funInfoList.get(j); |
| | | } |
| | | |
| | | try { |
| | | b = platformClientUtil.getFrameworkService().importModules(funInfos,this.getUserEntityInfo()); |
| | | } catch (PLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å䏿¨¡å䏿¯å¦å·²ç»åå¨ç¸åçæä½ç±»å |
| | | * add by caill |
| | | * */ |
| | | public boolean selSameOper(String dataOperName,String plFuncOid) throws VciBaseException{ |
| | | boolean same=false; |
| | | try { |
| | | same = platformClientUtil.getFrameworkService().selSameOper(dataOperName,plFuncOid); |
| | | } catch (PLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return same; |
| | | } |
| | | |
| | | public OperateInfo fetchOperateTypeByName(String name) throws VciException { |
| | | try{ |
| | | OperateInfo info = platformClientUtil.getFrameworkService().fetchOperateTypeByName(name); |
| | | return info; |
| | | }catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException(String.valueOf(e.code),e.messages); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿åæä½ç±»å |
| | | * add by caill |
| | | * */ |
| | | public boolean saveFuncOperation2(FuncOperationInfo funcOperationInfo) throws VciException{ |
| | | try { |
| | | platformClientUtil.getFrameworkService().saveFuncOperation2(funcOperationInfo,this.getUserEntityInfo()); |
| | | } catch (PLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * è¦çæä½ç±»å |
| | | * add by caill |
| | | * */ |
| | | public String updateOperation(FuncOperationInfo funcOperationInfo,String dataOperName,String plFuncOid) throws VciException{ |
| | | try { |
| | | platformClientUtil.getFrameworkService().updateOperation(funcOperationInfo,this.getUserEntityInfo(),dataOperName,plFuncOid); |
| | | } catch (PLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public boolean updateFuncOperation(String id , String alias, boolean isSelected) throws VciException { |
| | | boolean res = false; |
| | | try{ |
| | | res = platformClientUtil.getFrameworkService().updateFuncOperation(id, alias, isSelected, this.getUserEntityInfo()); |
| | | }catch(PLException e){ |
| | | throw new VciException(String.valueOf(e.code), e.messages); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |