| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.common.oq.OQTool; |
| | | import com.vci.common.qt.object.QueryTemplate; |
| | | import com.vci.common.qt.object.Symbol; |
| | | import com.vci.constant.IRightConstant; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.framework.data.CheckValue; |
| | | import com.vci.corba.framework.data.GrandValue; |
| | | import com.vci.corba.omd.btm.BizType; |
| | | import com.vci.corba.omd.data.AttributeValue; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.corba.omd.lcm.LifeCycle; |
| | | import com.vci.corba.omd.lcm.TransitionVO; |
| | | import com.vci.corba.omd.ltm.LinkType; |
| | | import com.vci.corba.portal.data.PLAction; |
| | | import com.vci.dto.AuthResultDTO; |
| | | import com.vci.dto.OsDataAuthDTO; |
| | | import com.vci.pagemodel.OpItemVO; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.web.service.OsDataAuthServiceI; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | } |
| | | return BaseResult.success("删除成功!"); |
| | | } |
| | | /** |
| | | * 查询授权结果 |
| | | * @param params 查询对象 |
| | | * @return 授权结果 |
| | | */ |
| | | @Override |
| | | public BaseResult authResult(CheckValue params) { |
| | | // CheckValue params = new CheckValue(); |
| | | params.opname = IRightConstant.OPS; |
| | | if(StringUtils.isBlank(params.objectoid)){ |
| | | params.objectoid = "22385E82-485C-549D-E2F4-91278E9E0A76"; |
| | | } |
| | | List<String> tableHeaders = new ArrayList<>(); |
| | | List<Object> tableValues = new ArrayList<>(); |
| | | // 操作 |
| | | List<OpItemVO> opitems = new ArrayList<OpItemVO>(); |
| | | try { |
| | | String where = platformClientUtil.getFrameworkService().checkRight(params); |
| | | String[] ops = where.split(":"); |
| | | //处理列表头 |
| | | for (String s : ops) { |
| | | if (s != null && !s.equals("")) { |
| | | OpItemVO item = new OpItemVO(); |
| | | String[] op = s.split(","); |
| | | item.setName(op[0]); |
| | | item.setValue(op[1]); |
| | | tableHeaders.add(op[0]); |
| | | opitems.add(item); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new VciBaseException("鉴权出错\n" |
| | | + e.getLocalizedMessage()); |
| | | } |
| | | //处理数据 |
| | | for (int n = 0; n < opitems.size(); n++) { |
| | | tableValues.add(opitems.get(n).getValue().equals("1") ? true : false); |
| | | } |
| | | AuthResultDTO authResultDTO = new AuthResultDTO(); |
| | | authResultDTO.setTableValues(tableValues); |
| | | authResultDTO.setTableHeader(tableHeaders); |
| | | return BaseResult.success(authResultDTO); |
| | | } |
| | | /** |
| | | * 查询业务对象 |
| | | * @param btmName 业务类型名称 |
| | | * @param boFlag 是否为bo类型,true为btm,false为link |
| | | * @param btmType 业务类型 |
| | | * @return 查询出的数据 |
| | | */ |
| | | @Override |
| | | public BaseResult queryBusiness(String btmName, boolean boFlag, String btmType) { |
| | | QueryTemplate qt = new QueryTemplate(); |
| | | qt.setBtmType(btmName); |
| | | List<String> clauseList = new ArrayList<String>(); |
| | | clauseList.add("*"); |
| | | qt.setClauseList(clauseList); |
| | | qt.setType(btmType);// 链接link |
| | | qt.setCondition(null); |
| | | qt.setId("qt1"); |
| | | List<Object> tableValues = new ArrayList<>(); |
| | | try { |
| | | clauseList = new ArrayList<>(Arrays.asList(platformClientUtil.getBtmService().getSysAttributeNames())); |
| | | clauseList.addAll(Arrays.asList(platformClientUtil.getBtmService().getAttributeNames(btmName))); |
| | | |
| | | if (boFlag) { |
| | | BusinessObject[] result = platformClientUtil.getQueryService().findBTMObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML()); |
| | | for (int i = 0; i < result.length; i++) { |
| | | List<Object> lineData = new ArrayList<>(); |
| | | BusinessObject bo = result[i]; |
| | | AttributeValue[] attList = bo.hisAttrValList; |
| | | for (int j = 0; j < clauseList.size(); j++) { |
| | | lineData.add(attList[j].attrVal); |
| | | // qrTable.setValueAt(attList[j].attrVal, i, j); |
| | | } |
| | | tableValues.add(lineData); |
| | | } |
| | | } else { |
| | | List<Object> lineData = new ArrayList<>(); |
| | | LinkObject[] loResult = platformClientUtil.getQueryService().findLTObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML()); |
| | | for (int i = 0; i < loResult.length; i++) { |
| | | LinkObject lo = loResult[i]; |
| | | AttributeValue[] attList = lo.hisAttrValList; |
| | | for (int j = 0; j < attList.length; j++) { |
| | | lineData.add(attList[j].attrVal); |
| | | // qrTable.setValueAt(attList[j], i, j); |
| | | } |
| | | tableValues.add(lineData); |
| | | } |
| | | } |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Map<String, Object> resultData = new HashMap<>(); |
| | | resultData.put("tableHeader", clauseList); |
| | | resultData.put("tableValues", tableValues); |
| | | return BaseResult.success(resultData); |
| | | } |
| | | |
| | | //add by caill start 2015 12.18 将查询出来的action放入到map中 |
| | | private Map<String, String> getAllActionsByType2(String typeName, String type) throws PLException { |
| | |
| | | Map<Object, Object> columnData = new HashMap<>(); |
| | | // 增加页面缓存 |
| | | // ruleModel.setConditionValue(row, rules); |
| | | columnData.put("rules",rules.get(0)); |
| | | columnData.put("rules",rules); |
| | | // add by caill start 2015 12.18 将查出的action放到map中,注意不要落下“查询” |
| | | Map<String, String> actionMap = new HashMap<String, String>(); |
| | | actionMap.put("query", "查询"); // 将操作中的query放入actionMap中 |
| | |
| | | for (int j = 0; j < rules.size(); j++) { |
| | | // 规则名和类型 |
| | | // ruleModel.setValueAt(rules.get(j).ruleName, row, 0); |
| | | columnData.put(0, rules.get(j).ruleName); |
| | | columnData.put("0", rules.get(j).ruleName); |
| | | if (rules.get(j).ruleType.equals(IRightConstant.RULETYPE__HAS)) { |
| | | columnData.put(1, "允许规则"); |
| | | columnData.put("1", "允许规则"); |
| | | } else if (rules.get(j).ruleType.equals(IRightConstant.RULETYPE__NOTHAS)) { |
| | | columnData.put(1, "拒绝规则"); |
| | | columnData.put("1", "拒绝规则"); |
| | | } else if (rules.get(j).ruleType.equals(IRightConstant.RULETYPE_ALL_HAS)) { |
| | | columnData.put(1, "全部有权"); |
| | | columnData.put("1", "全部有权"); |
| | | } else { |
| | | columnData.put(1, "全部无权"); |
| | | columnData.put("1", "全部无权"); |
| | | } |
| | | // 指定的操作赋值 |
| | | // TableColumnModel columnModel = funclet.getRightMainPanel().getRuleTable().getColumnModel(); |
| | |
| | | // int columnIndex = columnModel.getColumnIndex(op); |
| | | if (columnIndex >= 0) { |
| | | // ruleModel.setValueAt(rules.get(j).isGrand == '1' ? true : false, row, columnIndex); |
| | | columnData.put(columnIndex, rules.get(j).isGrand == '1' ? true : false); |
| | | columnData.put(String.valueOf(columnIndex), rules.get(j).isGrand == '1' ? true : false); |
| | | } |
| | | |
| | | } |