| | |
| | | import com.vci.corba.portal.data.*; |
| | | import com.vci.dto.RoleRightDTO; |
| | | import com.vci.dto.UIAuthorDTO; |
| | | import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; |
| | | import com.vci.model.PLDefination; |
| | | import com.vci.pagemodel.PLDefinationVO; |
| | | import com.vci.pagemodel.PLTabButtonVO; |
| | | import com.vci.pagemodel.PLUILayoutCloneVO; |
| | | import com.vci.pagemodel.RoleRightVO; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.swing.*; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | return plDefinationVOList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ·»å 页é¢å®ä¹ |
| | | * @param pdVO |
| | |
| | | */ |
| | | @Override |
| | | public boolean updatePageDefination(PLDefinationVO pdVO) throws Throwable { |
| | | /*PLPageDefination pd = getPageDefination(); |
| | | |
| | | PLDefination d = UITools.getPLDefination(pd.plDefination); |
| | | VciBaseUtil.alertNotNull(pdVO,"页é¢å®ä¹å¯¹è±¡",pdVO.getSeq(),"ç¼å·",pdVO.getName(),"åç§°"); |
| | | PLPageDefination pd = new PLPageDefination(); |
| | | PLDefination d = new PLDefination(); |
| | | BeanUtil.copy(pdVO,d); |
| | | |
| | | //ä¸è½ä¸ºç©ºå±æ§æ£æ¥ |
| | | if(!this.baseInfoIsOk(pd,true)){ |
| | | return false; |
| | | } |
| | | setUIValueToObject(pd, d); |
| | | pd.name = pdVO.getName().trim(); |
| | | pd.seq = Short.valueOf(pdVO.getSeq().trim()); |
| | | pd.desc = pdVO.getDescription(); |
| | | pd.plType = Short.parseShort(pdVO.getTemplateType()); |
| | | |
| | | d.setName(pdVO.getName().trim()); |
| | | d.setUiParser(pdVO.getUiParser().trim()); |
| | | d.setExtAttr(pdVO.getExtAttr().trim()); |
| | | d.setTemplateType(pdVO.getTemplateType()); |
| | | |
| | | this.newPLDefinationIsOk(pdVO, true); |
| | | |
| | |
| | | break; |
| | | } |
| | | |
| | | d = comptPanel.getNewPLDefination(d); |
| | | d = setEventDataToPLDefination(d,pdVO); |
| | | pd.plDefination = UITools.getPLDefinationText(d);*/ |
| | | pd.plDefination = UITools.getPLDefinationText(d); |
| | | |
| | | boolean res = true;//platformClientUtil.getUIService().updatePLPageDefination(pd); |
| | | return platformClientUtil.getUIService().updatePLPageDefination(pd); |
| | | } |
| | | |
| | | /** |
| | | * å é¤é¡µé¢å®ä¹ |
| | | * @param oids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean delPageDefination(String[] oids) throws PLException { |
| | | VciBaseUtil.alertNotNull(oids,"å é¤ç页é¢å®ä¹ä¸»é®"); |
| | | boolean res = platformClientUtil.getUIService().deletePLUILayoutByOidsForCascade(oids); |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * è·å页ç¾åºåæé®é
ç½®ä¿¡æ¯ |
| | | * @param pageDefinationOid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PLTabButtonVO> getTabButton(String pageDefinationOid) { |
| | | VciBaseUtil.alertNotNull(pageDefinationOid,"页é¢å®ä¹ä¸»é®"); |
| | | List<PLTabButton> buttonList = new ArrayList<>(); |
| | | try { |
| | | PLTabButton[] plTabButtons = platformClientUtil.getUIService().getPLTabButtonsByTableOId(pageDefinationOid); |
| | | buttonList = Arrays.asList(plTabButtons); |
| | | return this.tabButton2TabButtonVOS(buttonList); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException("å 载页ç¾åºåæé®é
置信æ¯å¼å¸¸ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¤ä¸ªæé®é
ç½®DO对象转å¤ä¸ªVO对象 |
| | | * @param listDO |
| | | * @return |
| | | */ |
| | | private List<PLTabButtonVO> tabButton2TabButtonVOS(List<PLTabButton> listDO){ |
| | | List<PLTabButtonVO> plTabButtonVOList = new ArrayList<PLTabButtonVO>(); |
| | | if(Func.isEmpty(listDO)){ |
| | | return plTabButtonVOList; |
| | | } |
| | | listDO.stream().forEach(item->{ |
| | | try { |
| | | PLTabButtonVO plTabButtonVO = this.tabButton2TabButtonVO(item); |
| | | plTabButtonVOList.add(plTabButtonVO); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String errorLog = "æé®é
ç½®DO TO VOæ¶åºç°é误ï¼åå ï¼"+VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(errorLog); |
| | | throw new VciBaseException(errorLog); |
| | | } |
| | | |
| | | }); |
| | | return plTabButtonVOList; |
| | | } |
| | | |
| | | /** |
| | | * æé®é
置DO对象转VO对象 |
| | | * @param tabButtonDO |
| | | * @return |
| | | */ |
| | | private PLTabButtonVO tabButton2TabButtonVO(PLTabButton tabButtonDO) throws PLException { |
| | | PLTabButtonVO plTabButtonVO = new PLTabButtonVO(); |
| | | if(Func.isEmpty(tabButtonDO) && Func.isBlank(tabButtonDO.plOId)){ |
| | | return plTabButtonVO; |
| | | } |
| | | plTabButtonVO.setOId(tabButtonDO.plOId); |
| | | plTabButtonVO.setTableOId(tabButtonDO.plTableOId); |
| | | plTabButtonVO.setPageOId(tabButtonDO.plPageOId); |
| | | plTabButtonVO.setActionOId(tabButtonDO.plActionOId); |
| | | plTabButtonVO.setLabel(tabButtonDO.plLabel); |
| | | plTabButtonVO.setAreaType(tabButtonDO.plAreaType); |
| | | plTabButtonVO.setDesc(tabButtonDO.plDesc); |
| | | plTabButtonVO.setSeq(tabButtonDO.plSeq); |
| | | plTabButtonVO.setCreateUser(tabButtonDO.plCreateUser); |
| | | plTabButtonVO.setCreateTime(tabButtonDO.plCreateTime); |
| | | plTabButtonVO.setModifyUser(tabButtonDO.plModifyUser); |
| | | plTabButtonVO.setModifyTime(tabButtonDO.plModifyTime); |
| | | plTabButtonVO.setLicensOrs(tabButtonDO.plLicensOrs); |
| | | plTabButtonVO.setParentOid(tabButtonDO.plParentOid); |
| | | plTabButtonVO.setDisplayMode(tabButtonDO.displayMode); |
| | | plTabButtonVO.setIconPath(tabButtonDO.iconPath); |
| | | plTabButtonVO.setAuthorization(tabButtonDO.authorization); |
| | | plTabButtonVO.setShow(tabButtonDO.show); |
| | | //åæ°ä¿¡æ¯åå¡« |
| | | PLCommandParameter[] parameters = platformClientUtil.getUIService().getPLCommandParametersByCommandOId(tabButtonDO.plOId); |
| | | if(Func.isNotEmpty(parameters)){ |
| | | LinkedHashMap<String, String> parameterMap = (LinkedHashMap<String, String>)Arrays.stream(parameters).collect(Collectors.toMap(parm -> parm.plKey, parm -> parm.plValue)); |
| | | plTabButtonVO.setButtonParams(parameterMap); |
| | | } |
| | | return plTabButtonVO; |
| | | } |
| | | |
| | | /** |
| | | * æé®é
置VO对象转DO对象 |
| | | * @param tabButtonVO |
| | | * @return |
| | | * @throws PLException |
| | | */ |
| | | private PLTabButton tabButtonVO2TabButton(PLTabButton plTabButton,PLTabButtonVO tabButtonVO) { |
| | | plTabButton.plOId = tabButtonVO.getOId(); |
| | | plTabButton.plTableOId = tabButtonVO.getTableOId(); |
| | | plTabButton.plPageOId = tabButtonVO.getPageOId(); |
| | | plTabButton.plActionOId = tabButtonVO.getActionOId(); |
| | | plTabButton.plLabel = tabButtonVO.getLabel(); |
| | | plTabButton.plAreaType = tabButtonVO.getAreaType(); |
| | | plTabButton.plDesc = tabButtonVO.getDesc(); |
| | | plTabButton.plSeq = tabButtonVO.getSeq(); |
| | | plTabButton.plCreateUser = tabButtonVO.getCreateUser(); |
| | | plTabButton.plCreateTime = tabButtonVO.getCreateTime(); |
| | | plTabButton.plModifyUser = tabButtonVO.getModifyUser(); |
| | | plTabButton.plModifyTime = tabButtonVO.getModifyTime(); |
| | | plTabButton.plLicensOrs = tabButtonVO.getLicensOrs(); |
| | | plTabButton.plParentOid = tabButtonVO.getParentOid(); |
| | | plTabButton.displayMode = tabButtonVO.getDisplayMode(); |
| | | plTabButton.iconPath = tabButtonVO.getIconPath(); |
| | | plTabButton.authorization = tabButtonVO.getAuthorization(); |
| | | plTabButton.show = tabButtonVO.getShow(); |
| | | return plTabButton; |
| | | } |
| | | |
| | | /** |
| | | * æ·»å æé®é
ç½®ä¿¡æ¯ |
| | | * @param tabButtonVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult addTapButton(PLTabButtonVO tabButtonVO) { |
| | | boolean res = this.saveOrUpdateTapButton(tabButtonVO, true); |
| | | return res ? BaseResult.success("æé®é
ç½®æ·»å æåï¼"):BaseResult.success("æé®é
置添å 失败ï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æé®é
ç½®ä¿¡æ¯ |
| | | * @param tabButtonVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BaseResult updateTapButton(PLTabButtonVO tabButtonVO) { |
| | | boolean res = this.saveOrUpdateTapButton(tabButtonVO, false); |
| | | return res ? BaseResult.success("æé®é
ç½®ä¿®æ¹æåï¼"):BaseResult.success("æé®é
置修æ¹å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ä¿åæä¿®æ¹æé®é
ç½®ä¿¡æ¯ |
| | | * @param tabButtonVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean saveOrUpdateTapButton(PLTabButtonVO tabButtonVO,boolean isAdd){ |
| | | VciBaseUtil.alertNotNull(tabButtonVO,"æé®é
置对象",tabButtonVO.getLabel(),"åæ°åç§°"); |
| | | //æ£æ¥å½åæ·»å çå表æ¯å¦éå¤ï¼ä½æ¯è¿å¿åªæ¯æåæ¡æ°æ®ä¿åï¼ææå½åå表å¤éå¯ä»¥å端æ¥å |
| | | //String btnParamValidate = this.geCheckRes(); |
| | | |
| | | if (tabButtonVO.getSeq() < 1 || tabButtonVO.getSeq() > 63) { |
| | | throw new VciBaseException("æåºå·è¶
åºèå´ï¼è¯·ä¿®æ¹ï¼æé®ãç¼å·ãåªè½å¨ã1-63ãèå´å
ã"); |
| | | } |
| | | //å½åç»å½ç¨æ·çä¿¡æ¯ |
| | | SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | //VO2DO |
| | | PLTabButton plTabButton = this.tabButtonVO2TabButton(new PLTabButton(), tabButtonVO); |
| | | if(isAdd) { |
| | | //妿æ¯å¢å æä½ï¼ç´æ¥å建PLTabButton对象 |
| | | plTabButton.plOId = ObjectUtility.getNewObjectID36(); |
| | | plTabButton.plCreateUser = sessionInfo.getUserId(); |
| | | plTabButton.plModifyUser = sessionInfo.getUserId(); |
| | | } else { |
| | | //ä¿®æ¹æä½ |
| | | plTabButton.plModifyUser = sessionInfo.getUserId(); |
| | | } |
| | | |
| | | try { |
| | | if(isAdd){ |
| | | boolean success = platformClientUtil.getUIService().savePLTabButton(plTabButton); |
| | | if(success == false) { |
| | | throw new VciBaseException("ç¼å·éå¤ï¼ç¼å·å·²ç»å¨å½å页ç¾ä¸åå¨ï¼"); |
| | | } |
| | | } else if(!isAdd){ |
| | | platformClientUtil.getUIService().updatePLTabButton(plTabButton); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String errorLog = "ä¿åæé®ä¿¡æ¯æ¶åçå¼å¸¸ï¼" + e.getMessage(); |
| | | logger.error(errorLog); |
| | | throw new VciBaseException(errorLog); |
| | | } |
| | | //å¤ç¨ä»¥åç代ç ï¼å¯¹äºåæ°ä¸æ¡ä¸æ¡å é¤ï¼ä¸æ¡ä¸æ¡å建 |
| | | //æ°æ®éåå¹¶åè¾å°ï¼ææ¶è¿ä¹å¤ç没æä»ä¹é®é¢ |
| | | if(!isAdd) { |
| | | try { |
| | | platformClientUtil.getUIService().deletePLCommandParameterByTabButtonId(plTabButton.plOId); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | LinkedHashMap<String, String> buttonParams = tabButtonVO.getButtonParams(); |
| | | if(!buttonParams.isEmpty()) { |
| | | Iterator<Map.Entry<String, String>> iterator = buttonParams.entrySet().iterator(); |
| | | while(iterator.hasNext()){ |
| | | Map.Entry<String, String> next = iterator.next(); |
| | | if(StringUtils.isEmpty(next.getKey()) || StringUtils.isEmpty(next.getValue())){ |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | if(!buttonParams.isEmpty()){ |
| | | Iterator<Map.Entry<String, String>> kvItor = buttonParams.entrySet().iterator(); |
| | | while(kvItor.hasNext()){ |
| | | Map.Entry<String, String> next = kvItor.next(); |
| | | PLCommandParameter plCommandParameter = new PLCommandParameter(); |
| | | plCommandParameter.plOId = ObjectUtility.getNewObjectID36(); |
| | | plCommandParameter.plCommandOId = plTabButton.plOId; |
| | | plCommandParameter.plKey = next.getKey(); |
| | | plCommandParameter.plValue = next.getValue(); |
| | | plCommandParameter.plCreateUser = sessionInfo.getUserId(); |
| | | plCommandParameter.plModifyUser = sessionInfo.getUserId(); |
| | | try { |
| | | platformClientUtil.getUIService().savePLCommandParameter(plCommandParameter); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException("ä¿åæé®ä¿¡æ¯æ¶åçå¼å¸¸ï¼"+ e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * å¤çé
ç½®çeventäºä»¶ |
| | |
| | | } else { |
| | | res = true; |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * å é¤é¡µé¢å®ä¹ |
| | | * @param oids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean delPageDefination(String[] oids) throws PLException { |
| | | VciBaseUtil.alertNotNull(oids,"å é¤ç页é¢å®ä¹ä¸»é®"); |
| | | boolean res = platformClientUtil.getUIService().deletePLUILayoutByOidsForCascade(oids); |
| | | return res; |
| | | } |
| | | |