1、去掉client包的相关更改。
2、修改登录鉴权修改。
| | |
| | | } |
| | | |
| | | /** |
| | | * å®å
¨ç¸å
³çæ¦æªå¨ |
| | | * @return å®å
¨ç¸å
³çæ¦æªå¨ |
| | | */ |
| | | @Bean |
| | | public VciSecurityInterceptor vciSecurityInterceptor(){ |
| | | return new VciSecurityInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * å¢å PUTåDELETEçæ¯æ |
| | | * @return è¿æ»¤å¨ |
| | | */ |
| | |
| | | return new VciLocaleInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * å®å
¨ç¸å
³çæ¦æªå¨ |
| | | * @return å®å
¨ç¸å
³çæ¦æªå¨ |
| | | */ |
| | | @Bean |
| | | public VciSecurityInterceptor vciSecurityInterceptor(){ |
| | | return new VciSecurityInterceptor(); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | import com.vci.starter.web.enumpck.ResultCodeEnum; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.SessionInfo; |
| | | import com.vci.starter.web.util.ApplicationContextProvider; |
| | | import com.vci.starter.web.util.LangBaseUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.WebThreadLocalUtil; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | * @author weidy |
| | | * @date 2019/11/7 2:32 PM |
| | | */ |
| | | //@Configuration |
| | | public class VciSecurityInterceptor implements HandlerInterceptor { |
| | | |
| | | /** |
| | |
| | | /** |
| | | * ä¼è¯ï¼æéï¼tokençæ¥å£ |
| | | */ |
| | | @Autowired(required = false) |
| | | private VciSessionForLoginI sessionForLoginI; |
| | | @Autowired |
| | | private VciSessionForLoginI vciSessionForLoginI; |
| | | |
| | | /** |
| | | * æ§è¡æ¦æª |
| | |
| | | return false; |
| | | }else{ |
| | | if(!unCheckUrls.contains(url)){ |
| | | if(sessionForLoginI == null){ |
| | | if(vciSessionForLoginI == null){ |
| | | //è¯´ææ²¡åæ³æ ¡éª |
| | | String msg = "请æ±è·¯å¾"+ url +"没æé访é®"; |
| | | if(logger.isErrorEnabled()) { |
| | |
| | | return false; |
| | | }else{ |
| | | //åå§åå¹³å°çtoken |
| | | sessionForLoginI.initInvocationInfo(sessionInfo); |
| | | vciSessionForLoginI.initInvocationInfo(sessionInfo); |
| | | |
| | | String systemPrivateToken = request.getHeader(TokenKeyConstant.SYSTEM_PRIVATE_KEY); |
| | | try { |
| | | if (sessionForLoginI.checkRequestRights(request, systemPrivateToken, sessionInfo, handler)) { |
| | | if (vciSessionForLoginI.checkRequestRights(request, systemPrivateToken, sessionInfo, handler)) { |
| | | updateRequestTime(url,userToken); |
| | | }else{ |
| | | return false; |
| | |
| | | SessionInfo sessionInfo = null; |
| | | if(StringUtils.isNotBlank(userToken)){ |
| | | try{ |
| | | sessionInfo = sessionForLoginI.getSessionInfoByToken(userToken); |
| | | if(vciSessionForLoginI == null){ |
| | | vciSessionForLoginI = ApplicationContextProvider.getBean(VciSessionForLoginI.class); |
| | | } |
| | | |
| | | sessionInfo = vciSessionForLoginI.getSessionInfoByToken(userToken); |
| | | }catch (Throwable e){ |
| | | logger.error("è·åtokenåºé",e); |
| | | } |
| | |
| | | while(url1.startsWith("/")){ |
| | | url1 = url1.substring(1); |
| | | } |
| | | if(sessionForLoginI != null && !unStorageRequestTimeUrls.contains(url1)){ |
| | | sessionForLoginI.updateRequestTime(userToken); |
| | | if(vciSessionForLoginI != null && !unStorageRequestTimeUrls.contains(url1)){ |
| | | vciSessionForLoginI.updateRequestTime(userToken); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.vci.frameworkcore.compatibility.impl; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI; |
| | | import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; |
| | | import com.vci.frameworkcore.model.OrgDeptForPlatform1; |
| | | import com.vci.frameworkcore.model.SmRoleForPlatform1; |
| | | import com.vci.frameworkcore.pagemodel.OrgDepartmentVO; |
| | | import com.vci.frameworkcore.pagemodel.SmRoleVO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.revision.bo.TreeWrapperOptions; |
| | | import com.vci.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | |
| | | if(!CollectionUtils.isEmpty(deptVOs)){ |
| | | deptVOList.addAll(deptVOs); |
| | | String sql = "select pluseruid,pldeptuid from pluserdept where pluseruid in (" + WebUtil.toInSql(userOids.toArray(new String[0])) + ")"; |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryBySql(sql, null); |
| | | List<BusinessObject> cbos = boService.queryBySql(sql, null); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | String userOid = cbo.getAttributeValue("pluseruid"); |
| | | String userOid = ObjectTool.getBOAttributeValue(cbo,"pluseruid"); |
| | | List<String> deptOids = userDeptOidMap.getOrDefault(userOid,new ArrayList<>()); |
| | | deptOids.add(cbo.getAttributeValue("pldeptuid")); |
| | | deptOids.add(ObjectTool.getBOAttributeValue(cbo,"pldeptuid")); |
| | | userDeptOidMap.put(userOid,deptOids); |
| | | }); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.framework.data.FunctionInfo; |
| | | import com.vci.corba.framework.data.RoleRightInfo; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.portal.data.PLUILayout; |
| | | import com.vci.frameworkcore.compatibility.ISmFunctionQueryService; |
| | | import com.vci.frameworkcore.enumpck.ResourceControlTypeEnum; |
| | |
| | | import com.vci.frameworkcore.model.SmRoleForPlatform1; |
| | | import com.vci.frameworkcore.pagemodel.MenuVO; |
| | | import com.vci.frameworkcore.pagemodel.SmFunctionVO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.*; |
| | |
| | | import com.vci.web.service.UIEngineServiceI; |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.RightControlUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | |
| | | @Autowired |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | @Autowired |
| | | RightControlUtil rightControlUtil; |
| | | /** |
| | | * æ¥è¯¢ææçåè½ |
| | | * |
| | |
| | | @Override |
| | | public List<MenuVO> treeCurrentUserMenu(TreeQueryObject treeQueryObject, ResourceControlTypeEnum resourceControlTypeEnum) throws PLException { |
| | | SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); |
| | | if(resourceControlTypeEnum == null){ |
| | | resourceControlTypeEnum = ResourceControlTypeEnum.BS; |
| | | String parentId; |
| | | |
| | | if (rightControlUtil.isAdminOrDeveloperOrRoot(sessionInfo.getUserId())) { |
| | | // ç³»ç»èå |
| | | parentId = "systemManagmentNode" ; |
| | | } else if (rightControlUtil.isThreeAdminCurUser()) { |
| | | parentId = "systemManagmentNode" ; |
| | | } else { |
| | | parentId = "modelManagmentNode" ; |
| | | } |
| | | FunctionInfo[] menus = platformClientUtil.getFrameworkService().getModuleListByParentId("modelManagmentNode", true); |
| | | RoleRightInfo[] userRoleRights = rightControlUtil.getRoleRightByUserName(sessionInfo.getUserId()); |
| | | Map<String, List<FunctionInfo>> map = rightControlUtil.getAllChildrenFunctionsByUserName( |
| | | parentId, sessionInfo.getUserId(), userRoleRights); |
| | | List<MenuVO> functionVOList = new ArrayList<>(); |
| | | for (FunctionInfo menu : menus) { |
| | | for (FunctionInfo menu : map.get(parentId)) { |
| | | if(!menu.isValid){ |
| | | continue; |
| | | } |
| | |
| | | if(!CollectionUtils.isEmpty(functionVOS)){ |
| | | functionVOList.addAll(functionVOS); |
| | | String sql = "select plfuncoid,plroleoid from plroleright where plroleoid in (" + WebUtil.toInSql(roleOids.toArray(new String[0])) + ")"; |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryBySql(sql, null); |
| | | List<BusinessObject> cbos = boService.queryBySql(sql, null); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | String roleOid = cbo.getAttributeValue("plroleoid"); |
| | | String roleOid = ObjectTool.getBOAttributeValue(cbo,"plroleoid"); |
| | | List<String> functionOids = roleFunctionOidMap.getOrDefault(roleOid,new ArrayList<>()); |
| | | functionOids.add(cbo.getAttributeValue("plfuncoid")); |
| | | functionOids.add(ObjectTool.getBOAttributeValue(cbo,"plfuncoid")); |
| | | roleFunctionOidMap.put(roleOid,functionOids); |
| | | }); |
| | | } |
| | |
| | | package com.vci.frameworkcore.compatibility.impl; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; |
| | | import com.vci.frameworkcore.constant.FrameWorkBtmTypeConstant; |
| | | import com.vci.frameworkcore.enumpck.RoleClassifyEnum; |
| | | import com.vci.frameworkcore.enumpck.RoleControlAreaEnum; |
| | | import com.vci.frameworkcore.model.SmRoleForPlatform1; |
| | | import com.vci.frameworkcore.pagemodel.SmRoleVO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | |
| | | if(!CollectionUtils.isEmpty(roleVOS)){ |
| | | roleVOList.addAll(roleVOS); |
| | | String sql = "select pluseruid,plroleuid from pluserrole where pluseruid in (" + WebUtil.toInSql(userOids.toArray(new String[0])) + ")"; |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryBySql(sql, null); |
| | | List<BusinessObject> cbos = boService.queryBySql(sql, null); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | String userOid = cbo.getAttributeValue("pluseruid"); |
| | | String userOid = ObjectTool.getBOAttributeValue(cbo,"pluseruid"); |
| | | List<String> roleOids = userRoleOidMap.getOrDefault(userOid,new ArrayList<>()); |
| | | roleOids.add(cbo.getAttributeValue("plroleuid")); |
| | | roleOids.add(ObjectTool.getBOAttributeValue(cbo,"plroleuid")); |
| | | userRoleOidMap.put(userOid,roleOids); |
| | | }); |
| | | } |
| | |
| | | if(!CollectionUtils.isEmpty(roleVOS)){ |
| | | roleVOList.addAll(roleVOS); |
| | | String sql = "select plroleoid,plfuncoid from plroleright where plfuncoid in (" + WebUtil.toInSql(userOids.toArray(new String[0])) + ")"; |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryBySql(sql, null); |
| | | List<BusinessObject> cbos = boService.queryBySql(sql, null); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | String funcOid = cbo.getAttributeValue("plfuncoid"); |
| | | String funcOid = ObjectTool.getBOAttributeValue(cbo,"plfuncoid"); |
| | | List<String> roleOids = funcRoleOidMap.getOrDefault(funcOid,new ArrayList<>()); |
| | | roleOids.add(cbo.getAttributeValue("plroleoid")); |
| | | roleOids.add(ObjectTool.getBOAttributeValue(cbo,"plroleoid")); |
| | | funcRoleOidMap.put(funcOid,roleOids); |
| | | }); |
| | | } |
| | |
| | | import com.vci.common.util.ThreeDES; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.framework.data.UserInfo; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO; |
| | | import com.vci.frameworkcore.pagemodel.SmUserVO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | import static com.vci.web.util.WebUtil.arryAndSqlToClientBusinessObject; |
| | | import static com.vci.web.util.WebUtil.arryAndSqlToBusinessObject; |
| | | |
| | | /** |
| | | * ç¨æ·çæ¥è¯¢ç¸å
³çæå¡ï¼å¯ä»¥å
¼å®¹èå¹³å°åèçpdm |
| | |
| | | try{ |
| | | String[][] sqlQueryResult = platformClientUtil.getBOFService().getSqlQueryResult(sql + fromSql, null); |
| | | if(sqlQueryResult.length>0){ |
| | | com.vci.client.bof.ClientBusinessObject cbo = arryAndSqlToClientBusinessObject(queryWrapper.getSelectFieldSql(),sqlQueryResult[0]); |
| | | BusinessObject cbo = arryAndSqlToBusinessObject(queryWrapper.getSelectFieldSql(),sqlQueryResult[0]); |
| | | return cbo2VO(cbo); |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | + " left join pluserdept up on " + queryWrapper.getTableNick() + ".pluid = up.pluseruid left join pldept pkDepartment on up.pldeptuid = pkDepartment.pluid " + |
| | | " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapper.getTableNick() + ".pluid = pkUserPassword.pluseruid " + |
| | | queryWrapper.getLinkTableSql() + (StringUtils.isNotBlank(queryWrapper.getWhereSql())?(" where " + queryWrapper.getWhereSql()):""); |
| | | List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql(sql + fromSql, null); |
| | | List<BusinessObject> dataList = boService.queryBySql(sql + fromSql, null); |
| | | if(!CollectionUtils.isEmpty(dataList)){ |
| | | dataList.stream().forEach(cbo->{ |
| | | userVOList.add(cbo2VO(cbo)); |
| | |
| | | + " left join pluserdept up on " + queryWrapper.getTableNick() + ".pluid = up.pluseruid left join pldept pkDepartment on up.pldeptuid = pkDepartment.pluid " + |
| | | " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapper.getTableNick() + ".pluid = pkUserPassword.pluseruid " + (QUERY_FIELD_ROLE.equalsIgnoreCase(queryField)?roleSql:"") + |
| | | queryWrapper.getLinkTableSql() + (StringUtils.isNotBlank(queryWrapper.getWhereSql())?(" where " + queryWrapper.getWhereSql()):""); |
| | | List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql(sql + fromSql, null); |
| | | List<BusinessObject> dataList = boService.queryBySql(sql + fromSql, null); |
| | | if(!CollectionUtils.isEmpty(dataList)){ |
| | | dataList.stream().forEach(cbo->{ |
| | | userVOList.add(cbo2VO(cbo)); |
| | |
| | | * @param cbo ä¸å¡æ°æ® |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | private SmUserVO cbo2VO(com.vci.client.bof.ClientBusinessObject cbo){ |
| | | private SmUserVO cbo2VO(BusinessObject cbo){ |
| | | SmUserDO userDO = new SmUserDO(); |
| | | SmUserVO userVO = new SmUserVO(); |
| | | WebUtil.copyValueToObjectFromCbos(cbo,userDO); |
| | |
| | | } |
| | | } |
| | | } |
| | | List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql((isPage?("select " + pageSelectList.stream().collect(Collectors.joining(","))+ " from (select A.*,rownum RN from ( "):"") + sql + fromSql + (isPage?pageSubfix:""), null); |
| | | List<BusinessObject> dataList = boService.queryBySql((isPage?("select " + pageSelectList.stream().collect(Collectors.joining(","))+ " from (select A.*,rownum RN from ( "):"") + sql + fromSql + (isPage?pageSubfix:""), null); |
| | | if(!CollectionUtils.isEmpty(dataList)){ |
| | | dataList.stream().forEach(cbo->{ |
| | | userVOList.add(cbo2VO(cbo)); |
| | |
| | | + " left join pluserdept up on " + queryWrapper.getTableNick() + ".pluid = up.pluseruid left join pldept pkDepartment on up.pldeptuid = pkDepartment.pluid " + |
| | | " left join PLUSERPASSWORDSTRATEGY pkUserPassword on " +queryWrapper.getTableNick() + ".pluid = pkUserPassword.pluseruid " + |
| | | queryWrapper.getLinkTableSql() + (StringUtils.isNotBlank(queryWrapper.getWhereSql())?(" where " + queryWrapper.getWhereSql()):""); |
| | | List<com.vci.client.bof.ClientBusinessObject> dataList = boService.queryBySql(sql + fromSql, null); |
| | | List<BusinessObject> dataList = boService.queryBySql(sql + fromSql, null); |
| | | List<Tree> treeList = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(dataList)){ |
| | | dataList.stream().forEach(cbo->{ |
| | | Tree tree = new Tree(); |
| | | tree.setOid(cbo.getOid()); |
| | | tree.setText(cbo.getId() + " " + cbo.getName()); |
| | | tree.setOid(cbo.oid); |
| | | tree.setText(cbo.id + " " + cbo.name); |
| | | Map<String,String> attributeMap = new HashMap<>(); |
| | | WebUtil.copyValueToCboFromMap(cbo,attributeMap); |
| | | tree.setAttributes(attributeMap); |
| | |
| | | String sql = " select plpassword from pluser where pluid = :userOid"; |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("userOid",userOid.trim()); |
| | | List<com.vci.client.bof.ClientBusinessObject> clientBusinessObjectList = boService.queryBySql(sql, conditionMap); |
| | | if(CollectionUtils.isEmpty(clientBusinessObjectList)){ |
| | | List<BusinessObject> BusinessObjectList = boService.queryBySql(sql, conditionMap); |
| | | if(CollectionUtils.isEmpty(BusinessObjectList)){ |
| | | return false; |
| | | } |
| | | |
| | | ThreeDES des = new ThreeDES();// å®ä¾åä¸ä¸ªå¯¹ï¿½? |
| | | des.getKey("daliantan0v0");// çæå¯å |
| | | md5Password = des.getEncString(md5Password); |
| | | if(md5Password.equals(clientBusinessObjectList.get(0).getAttributeValue("plpassword"))){ |
| | | if(md5Password.equals(ObjectTool.getNewBOAttributeValue(BusinessObjectList.get(0),"plpassword"))){ |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | public SmPasswordStrategyVO getPasswordStrategyVOByOid(String oid){ |
| | | VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(null, SmPasswordStrategyDO.class); |
| | | queryWrapperForDO.eq("oid",oid.trim()); |
| | | List<com.vci.client.bof.ClientBusinessObject> cboList = boService.queryBySql(queryWrapperForDO.getSelectFieldSql() + " from plpasswordstrategy " + |
| | | List<BusinessObject> cboList = boService.queryBySql(queryWrapperForDO.getSelectFieldSql() + " from plpasswordstrategy " + |
| | | queryWrapperForDO.getTableNick() + queryWrapperForDO.getLinkTableSql() + |
| | | (StringUtils.isBlank(queryWrapperForDO.getWhereSql()) ? "" : (" where " + queryWrapperForDO.getWhereSql())), null); |
| | | if(!CollectionUtils.isEmpty(cboList)){ |
| | |
| | | package com.vci.plugins.controller; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientBusinessObjectOperation; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.query.data.KV; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.plugins.dto.AuditTaskDTO; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | |
| | | @PostMapping("/create") |
| | | public BaseResult createByPrincipal(@RequestBody AuditTaskDTO auditTaskDTO) { |
| | | VciBaseUtil.alertNotNull(auditTaskDTO.getProcessreviewoid(), "å·¥èºè¯å®¡ä¸»é®", auditTaskDTO.getPrincipal(), "è´è´£äºº"); |
| | | ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation(); |
| | | List<ClientBusinessObject> createList = new ArrayList<>(); |
| | | // BusinessObjectOperation operation = new BusinessObjectOperation(); |
| | | List<BusinessObject> createList = new ArrayList<>(); |
| | | List<String> principalList = VciBaseUtil.str2List(auditTaskDTO.getPrincipal()); |
| | | List<List<String>> oracleIn = WebUtil.switchListForOracleIn(principalList); |
| | | try { |
| | |
| | | "where us.pluid in " + principalStr; |
| | | KV[][] kvs = platformClientUtil.getQueryService().queryBySql(sql); |
| | | for (int index = 0; index < kvs.length; index++) { |
| | | ClientBusinessObject cbo = operation.initBusinessObject("audittask"); |
| | | BusinessObject cbo = platformClientUtil.getBOFService().initBusinessObject("audittask"); |
| | | copyAttribute(cbo, auditTaskDTO); |
| | | cbo.setAttributeValue("principal", "PLUSERNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | cbo.setAttributeValue("departmentname","PLNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | ObjectTool.setBOAttributeValue(cbo, "principal", "PLUSERNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | ObjectTool.setBOAttributeValue(cbo,"departmentname","PLNAME".equals(kvs[index][0].key.toUpperCase(Locale.ROOT)) ? kvs[index][0].value : kvs[index][1].value); |
| | | createList.add(cbo); |
| | | } |
| | | } catch ( PLException vciError) { |
| | | vciError.printStackTrace(); |
| | | } |
| | | }); |
| | | operation.batchSaveCreateBuinessObject(createList.toArray(new ClientBusinessObject[0])); |
| | | |
| | | platformClientUtil.getBOFService().batchCreateBusinessObject(createList.toArray(new BusinessObject[0]),false,false); |
| | | } catch ( PLException vciError) { |
| | | vciError.printStackTrace(); |
| | | return BaseResult.fail("å建è¯å®¡ä»»å¡å¤±è´¥"); |
| | |
| | | * @param cbo è¯å®¡ä»»å¡ä¸å¡ç±»å对象 |
| | | * @param auditTaskDTO è¯å®¡ä»»å¡é¡µé¢ä¼ è¾å¯¹è±¡ |
| | | */ |
| | | private void copyAttribute(ClientBusinessObject cbo, AuditTaskDTO auditTaskDTO) { |
| | | private void copyAttribute(BusinessObject cbo, AuditTaskDTO auditTaskDTO) { |
| | | setAttribute(cbo, "assigner", StringUtils.isBlank(auditTaskDTO.getAssigner())? WebUtil.getCurrentUserId(): auditTaskDTO.getAssigner()); |
| | | setAttribute(cbo, "principal", auditTaskDTO.getPrincipal()); |
| | | setAttribute(cbo, "departmentName", auditTaskDTO.getDepartmentname()); |
| | |
| | | * @param attributeName åæ®µå |
| | | * @param attributeValue åæ®µå¼ |
| | | */ |
| | | private void setAttribute(ClientBusinessObject cbo, String attributeName, String attributeValue) { |
| | | try { |
| | | private void setAttribute(BusinessObject cbo, String attributeName, String attributeValue) { |
| | | if (StringUtils.isNotBlank(attributeValue)) { |
| | | cbo.setAttributeValue(attributeName, attributeValue); |
| | | } |
| | | } catch (PLException vciError) { |
| | | vciError.printStackTrace(); |
| | | ObjectTool.setBOAttributeValue(cbo, attributeName, attributeValue); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @param treeQueryObject æ æ¥è¯¢å¯¹è±¡ |
| | | * @return æ èç¹ï¼åºç°é误ä¼å¨å¼å¸¸å¤çå¨ä¸ç»ä¸è¿åJson |
| | | */ |
| | | @VciUnCheckRight |
| | | @GetMapping("/treeMyMenu") |
| | | public List<MenuVO> treeMyMenu(TreeQueryObject treeQueryObject) throws PLException { |
| | | return functionQueryService.treeCurrentUserMenu(treeQueryObject, ResourceControlTypeEnum.BS); |
| | |
| | | package com.vci.web.controller; |
| | | |
| | | |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.uif.actions.client.DataRightUtil; |
| | | import com.vci.client.uif.engine.common.DefaultTableNode; |
| | | import com.vci.client.uif.engine.common.IDataNode; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.starter.web.enumpck.DataSecretEnum; |
| | | import com.vci.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | |
| | | //å
夿å¯çº§ |
| | | //weidyä¿®æ¹ï¼æ¢æä»çº¿ç¨éè·åå½åç¨æ·ä¿¡æ¯ |
| | | SessionInfo si = WebUtil.getCurrentUserSessionInfo(); |
| | | DataRightUtil dataRightUtil = new DataRightUtil(new HashMap()); |
| | | // DataRightUtil dataRightUtil = new DataRightUtil(new HashMap()); |
| | | StringBuilder sb = new StringBuilder(); |
| | | return BaseResult.fail(""); |
| | | } |
| | |
| | | * @throws PLException 缺å°çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | protected Object getSelectedObject(BaseModelDTO boData) throws PLException { |
| | | IDataNode selectedObject = new DefaultTableNode(); |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | //æ¤æ¹æ³æ²¡æè¢«å¼ç¨ï¼ä¸IDataNode对象没æ |
| | | // IDataNode selectedObject = new DefaultTableNode(); |
| | | BusinessObject cbo = new BusinessObject(); |
| | | if(StringUtils.isBlank(boData.getOid())){ |
| | | throw new PLException("没æè·åå°æ°æ®ç主é®",new String[0]); |
| | | } |
| | |
| | | if(StringUtils.isBlank(boData.getBtmname())){ |
| | | throw new PLException("没æè·åå°æ°æ®çä¸å¡ç±»å",new String[0]); |
| | | } |
| | | cbo.setOid(boData.getOid()); |
| | | cbo.setRevisionid(boData.getRevisionOid()); |
| | | cbo.setNameoid(boData.getNameOid()); |
| | | cbo.setBtmName(boData.getBtmname()); |
| | | selectedObject.setMasterObject(cbo); |
| | | return selectedObject; |
| | | cbo.oid = boData.getOid(); |
| | | cbo.revisionid = boData.getRevisionOid(); |
| | | cbo.nameoid = boData.getNameOid(); |
| | | cbo.btName = boData.getBtmname(); |
| | | // selectedObject.setMasterObject(cbo); |
| | | // return selectedObject; |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | package com.vci.web.dao; |
| | | |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.corba.workflow.WorkflowServicePrx; |
| | | import com.vci.corba.workflow.data.TasksAssignedInfo; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientLinkObject> getDataCloInTask(String taskOid, String executionId) throws VciBaseException; |
| | | List<LinkObject> getDataCloInTask(String taskOid, String executionId) throws VciBaseException; |
| | | |
| | | /** |
| | | * è·åæµç¨ä¸å
å«çæææ°æ® |
| | |
| | | package com.vci.web.dao.impl; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | |
| | | VciBaseUtil.alertNotNull(ruleOid,"è§ååç±»",serialAccord,"æµæ°´ä¾æ®"); |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("pkcoderule",ruleOid); |
| | | List<com.vci.client.bof.ClientBusinessObject> queryList = this.boService.queryCBO("codebreakcode", conditionMap); |
| | | List<BusinessObject> queryList = this.boService.queryCBO("codebreakcode", conditionMap); |
| | | if (CollectionUtils.isEmpty(queryList)){ |
| | | throw new VciBaseException("è§ååç±»[{0}]å¨ç³»ç»ä¸ä¸åå¨",new String[]{ruleOid}); |
| | | } |
| | | conditionMap.clear(); |
| | | String oid = ""; |
| | | for (com.vci.client.bof.ClientBusinessObject object : queryList) { |
| | | oid += object.getOid() + ","; |
| | | for (BusinessObject object : queryList) { |
| | | oid += object.oid + ","; |
| | | } |
| | | oid = "(" + oid.substring(0,oid.length() -1) + ")"; |
| | | conditionMap.put("oid", QueryOptionConstant.IN + oid); |
| | |
| | | package com.vci.web.dao.impl; |
| | | |
| | | import com.vci.client.omd.provider.BtmProvider; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | |
| | | //å
æ¥è¯¢æç»ï¼æç»åºè¯¥ä¸ä¼æ1000æ¡ |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("ruleOid",ruleOid); |
| | | String sql = " select a.oid as oid from " + BtmProvider.getInstance().getBTTableName(BtmIdConstant.OS_CODE_ENUM_BTM_TYPE) + " a left join " |
| | | + BtmProvider.getInstance().getBTTableName(BtmIdConstant.OS_CODE_RULE_ELEMENT_BTM_TYPE) + " b on a.pkCodeRuleElement = b.oid where b.pkCodeRule = :ruleOid"; |
| | | List<com.vci.client.bof.ClientBusinessObject> enumCbos = boService.queryBySql(sql, conditionMap); |
| | | //todo æ¤ææ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String sql = " select a.oid as oid from " + BtmProvider.getInstance().getBTTableName(BtmIdConstant.OS_CODE_ENUM_BTM_TYPE) + " a left join " |
| | | // + BtmProvider.getInstance().getBTTableName(BtmIdConstant.OS_CODE_RULE_ELEMENT_BTM_TYPE) + " b on a.pkCodeRuleElement = b.oid where b.pkCodeRule = :ruleOid"; |
| | | String sql = ""; |
| | | List<BusinessObject> enumCbos = boService.queryBySql(sql, conditionMap); |
| | | if(CollectionUtils.isEmpty(enumCbos)){ |
| | | return new ArrayList<OsCodeEnumDO>(); |
| | | } |
| | | List<String> oidList = new ArrayList<String>(); |
| | | for(com.vci.client.bof.ClientBusinessObject cbo : enumCbos){ |
| | | oidList.add(cbo.getOid()); |
| | | for(BusinessObject cbo : enumCbos){ |
| | | oidList.add(cbo.oid); |
| | | } |
| | | |
| | | return boService.selectByOidCollection(oidList,OsCodeEnumDO.class); |
| | |
| | | package com.vci.web.dao.impl; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | |
| | | */ |
| | | @Override |
| | | public long batchUpdateLcStatus(Collection<String> oids, String lcStatus) { |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.selectCBOByOidCollection(oids, "oscoderule"); |
| | | List<BusinessObject> cbos = boService.selectCBOByOidCollection(oids, "oscoderule"); |
| | | if(CollectionUtils.isEmpty(cbos)){ |
| | | return 0; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public int updateLcStatus(String oid, String lcStatus) { |
| | | com.vci.client.bof.ClientBusinessObject cbo = boService.selectCBOByOid(oid, "oscoderule"); |
| | | if(cbo == null || StringUtils.isBlank(cbo.getOid())){ |
| | | BusinessObject cbo = boService.selectCBOByOid(oid, "oscoderule"); |
| | | if(cbo == null || StringUtils.isBlank(cbo.oid)){ |
| | | return 0; |
| | | } |
| | | lifeCycleService.transStatus(cbo.getBusinessObject(),lcStatus); |
| | | lifeCycleService.transStatus(cbo,lcStatus); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | package com.vci.web.dao.impl; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.file.constant.VciFileBtmTypeConstant; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | |
| | | public String selectSecret(String ownbizOid, String ownbizBtm) { |
| | | if(StringUtils.isNotBlank(ownbizOid) && StringUtils.isNotBlank(ownbizBtm)){ |
| | | //æ ¡éªæ°æ®çå¯çº§ |
| | | com.vci.client.bof.ClientBusinessObject cbo = boService.selectCBOByOid(ownbizOid, ownbizBtm); |
| | | if(cbo !=null && StringUtils.isNotBlank(cbo.getOid())){ |
| | | BusinessObject cbo = boService.selectCBOByOid(ownbizOid, ownbizBtm); |
| | | if(cbo !=null && StringUtils.isNotBlank(cbo.oid)){ |
| | | //æå¯è½æ¯å
ä¸ä¼ æä»¶ï¼æä»¥æä»¬è¿ä¸ªä¸å¤ææ¯å¦åå¨ |
| | | return cbo.getAttributeValue("secretgrade"); |
| | | return ObjectTool.getBOAttributeValue(cbo,"secretgrade"); |
| | | } |
| | | } |
| | | return null; |
| | |
| | | package com.vci.web.dao.impl; |
| | | |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.common.utility.ObjectUtility; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.common.data.UserEntityInfo; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.corba.workflow.WorkflowService; |
| | | import com.vci.corba.workflow.WorkflowServicePrx; |
| | | import com.vci.corba.workflow.data.*; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.pagemodel.SmUserVO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public List<ClientLinkObject> getDataCloInTask(String taskOid, String executionid) throws VciBaseException { |
| | | public List<LinkObject> getDataCloInTask(String taskOid, String executionid) throws VciBaseException { |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | if(StringUtils.isNotBlank(taskOid)) { |
| | | conditionMap.put("f_oid", taskOid.trim()); |
| | |
| | | } |
| | | |
| | | private DataGrid getData(String linkType,Map<String,String> conditionMap,String referColumns) throws VciBaseException{ |
| | | List<ClientLinkObject> clos = loService.queryCLO(taskDataLink, conditionMap); |
| | | List<LinkObject> clos = loService.queryCLO(taskDataLink, conditionMap); |
| | | Map<String,List<String>> btmOidMap = new HashMap<String, List<String>>(); |
| | | if(clos!=null&&clos.size()>0){ |
| | | for(ClientLinkObject clo : clos){ |
| | | for(LinkObject clo : clos){ |
| | | List<String> oids = null; |
| | | String btm = clo.getToBTMName().toLowerCase(); |
| | | String btm = clo.toBTName.toLowerCase(); |
| | | if(btmOidMap.containsKey(btm)){ |
| | | oids = btmOidMap.get(btm); |
| | | }else{ |
| | | oids = new ArrayList<String>(); |
| | | } |
| | | oids.add(clo.getToOid()); |
| | | oids.add(clo.toOid); |
| | | btmOidMap.put(btm, oids); |
| | | } |
| | | } |
| | |
| | | }else { |
| | | caluesList.add("*"); |
| | | } |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btm, conditionMap,null,caluesList); |
| | | List<BusinessObject> cbos = boService.queryCBO(btm, conditionMap,null,caluesList); |
| | | data.addAll(boService.cbos2Map(cbos)); |
| | | } |
| | | } |
| | |
| | | PageHelper pageHelper = new PageHelper(-1); |
| | | pageHelper.setSort("endTime"); |
| | | pageHelper.setOrder(pageHelper.asc); |
| | | List<com.vci.client.bof.ClientBusinessObject> undoTaskCbos= boService.queryCBO(workitemBtmType, conditionMap); |
| | | List<BusinessObject> undoTaskCbos= boService.queryCBO(workitemBtmType, conditionMap); |
| | | if(undoTaskCbos != null && undoTaskCbos.size() > 0) { |
| | | for(com.vci.client.bof.ClientBusinessObject cbo : undoTaskCbos) { |
| | | for(BusinessObject cbo : undoTaskCbos) { |
| | | ProcessHistoryVO his = new ProcessHistoryVO(); |
| | | String taskName = cbo.getName(); |
| | | String taskName = cbo.name; |
| | | if(StringUtils.contains(taskName,"-")) { |
| | | taskName = taskName.substring(taskName.lastIndexOf("-") + 1); |
| | | } |
| | | his.setTaskName(taskName); |
| | | his.setCreateTime(String.valueOf(cbo.getCreateTime())); |
| | | String userIdString = cbo.getAttributeValue("principal"); |
| | | his.setCreateTime(String.valueOf(cbo.createTime)); |
| | | String userIdString = ObjectTool.getBOAttributeValue(cbo,"principal"); |
| | | if(StringUtils.contains(userIdString,":")) { |
| | | userIdString = userIdString.substring(userIdString.indexOf(":") + 1); |
| | | } |
| | | his.setAssignee(cbo.getAttributeValue("principal")); |
| | | his.setAssignee(ObjectTool.getBOAttributeValue(cbo,"principal")); |
| | | String userShowInfoString = ""; |
| | | SmUserVO user = userQueryService.getUserByUserId(userIdString); |
| | | if(user != null){ |
| | |
| | | userShowInfoString = userIdString; |
| | | } |
| | | his.setAssigneeName(userShowInfoString); |
| | | his.setExecutionId(cbo.getAttributeValue("executionid")); |
| | | his.setExecutionId(ObjectTool.getBOAttributeValue(cbo,"executionid")); |
| | | |
| | | hisList.add(his); |
| | | } |
| | |
| | | oidList.add(oid); |
| | | } |
| | | //è½¬æ¢æ500é¿åº¦ç |
| | | List<com.vci.client.bof.ClientBusinessObject> cboList = new ArrayList<com.vci.client.bof.ClientBusinessObject>(); |
| | | List<BusinessObject> cboList = new ArrayList<BusinessObject>(); |
| | | if(oidList.size()>500){ |
| | | List<List<String>> oidListForIn = WebUtil.switchListForOracleIn(oidList); |
| | | for(List<String> oidListForInRecord : oidListForIn){ |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oidListForInRecord.toArray(new String[0])) + ")" ); |
| | | List<com.vci.client.bof.ClientBusinessObject> tempCbos = boService.queryCBO(btmType,conditionMap); |
| | | List<BusinessObject> tempCbos = boService.queryCBO(btmType,conditionMap); |
| | | cboList.addAll(tempCbos); |
| | | } |
| | | }else{ |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oidList.toArray(new String[0])) + ")" ); |
| | | List<com.vci.client.bof.ClientBusinessObject> tempCbos = boService.queryCBO(btmType,conditionMap); |
| | | List<BusinessObject> tempCbos = boService.queryCBO(btmType,conditionMap); |
| | | cboList.addAll(tempCbos); |
| | | } |
| | | //æ¾å°è¿ä¸ªä¸å¡ç±»åçèµ·å§ç¶æ |
| | |
| | | package com.vci.web.other; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | |
| | | /** |
| | | * 对象æå¡ä¸ï¼map转æVOç对象 |
| | | * @author weidy |
| | |
| | | * @param data æ°æ®çæ å° |
| | | * @param obj 对象 |
| | | */ |
| | | void convert(com.vci.client.bof.ClientBusinessObject data, T obj); |
| | | void convert(BusinessObject data, T obj); |
| | | } |
| | |
| | | package com.vci.web.other; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientBusinessObjectOperation; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.web.annotation.FlowNotifyBefore; |
| | | import com.vci.web.annotation.FlowNotifyWeb; |
| | | import com.vci.web.bo.FlowNoticeInfo; |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | @Autowired |
| | | private WebBoServiceI boService; |
| | | |
| | | @Autowired |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | |
| | | @FlowNotifyBefore |
| | | public void callBefore(FlowNoticeInfo noticeInfo) { |
| | | try { |
| | |
| | | } |
| | | |
| | | String sql = "SELECT T_OID,T_BTWNAME FROM PLATFORMLT_INPUT WHERE F_OID = '" + wfOid + "'"; |
| | | ClientBusinessObjectOperation operation = new ClientBusinessObjectOperation(); |
| | | List<com.vci.client.bof.ClientBusinessObject> queryResult = boService.queryBySql(sql, new HashMap<>()); |
| | | List<BusinessObject> queryResult = boService.queryBySql(sql, new HashMap<>()); |
| | | if (queryResult.size() == 0) { |
| | | logger.info("æ²¡ææ¾å°ä¸å¡æ°æ®"); |
| | | return; |
| | | } |
| | | String btmName = queryResult.get(0).getAttributeValue("t_btwname"); |
| | | String oid = queryResult.get(0).getAttributeValue("t_oid"); |
| | | String btmName = ObjectTool.getBOAttributeValue(queryResult.get(0),"t_btwname"); |
| | | String oid = ObjectTool.getBOAttributeValue(queryResult.get(0),"t_oid"); |
| | | String querySql = "select cac.oid from PLATFORMBTM_CODEALLCODE cac\n" + |
| | | " left join PLATFORMBTM_" + btmName + " wp on cac.CREATECODEOID = wp.OID\n" + |
| | | " where wp.OID = '" + oid + "'"; |
| | | Map<String, String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("oid", oid); |
| | | List<com.vci.client.bof.ClientBusinessObject> codeResult = boService.queryCBO(btmName, conditionMap); |
| | | List<BusinessObject> codeResult = boService.queryCBO(btmName, conditionMap); |
| | | conditionMap.clear(); |
| | | conditionMap.put("createCodeOid", codeResult.get(0).getAttributeValue("oid")); |
| | | List<com.vci.client.bof.ClientBusinessObject> allCodeList = boService.queryCBO("codeAllCode", conditionMap); |
| | | conditionMap.put("createCodeOid", ObjectTool.getBOAttributeValue(queryResult.get(0),"oid")); |
| | | List<BusinessObject> allCodeList = boService.queryCBO("codeAllCode", conditionMap); |
| | | if (allCodeList.size() == 0) { |
| | | logger.info("æ²¡ææ¾å°ç¼ç "); |
| | | return; |
| | | } |
| | | for (com.vci.client.bof.ClientBusinessObject codeAllCode : allCodeList) { |
| | | codeAllCode.setLcStatus("Editing"); |
| | | codeAllCode.setAttributeValue("lcstatus", "Editing"); |
| | | for (BusinessObject codeAllCode : allCodeList) { |
| | | codeAllCode.lcStatus = "Editing"; |
| | | ObjectTool.setBOAttributeValue(codeAllCode,"lcstatus", "Editing"); |
| | | } |
| | | operation.batchUpdateBuinessObject(allCodeList.toArray(new ClientBusinessObject[0])); |
| | | |
| | | platformClientUtil.getBOFService().batchUpdateBusinessObject(allCodeList.toArray(new BusinessObject[0])); |
| | | logger.info("ç¼ç çå½å¨ææ¢å¤å®æ"); |
| | | } |
| | | } catch (PLException e) { |
| | |
| | | package com.vci.web.pageModel; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import org.springframework.util.CollectionUtils; |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | |
| | | /** |
| | | * 空çä¸å¡ç±»åæ°ç» |
| | | */ |
| | | private ClientBusinessObject[] nullCboArray = new ClientBusinessObject[0]; |
| | | private BusinessObject[] nullCboArray = new BusinessObject[0]; |
| | | |
| | | /** |
| | | * 空ç龿¥ç±»åæ°ç» |
| | | */ |
| | | private ClientLinkObject[] nullCloArray = new ClientLinkObject[0]; |
| | | private LinkObject[] nullCloArray = new LinkObject[0]; |
| | | |
| | | /** |
| | | * å建çä¸å¡ç±»å |
| | | */ |
| | | private Set<ClientBusinessObject> createCbos = new HashSet<ClientBusinessObject>(); |
| | | private Set<BusinessObject> createCbos = new HashSet<BusinessObject>(); |
| | | |
| | | /** |
| | | * å建ç龿¥ç±»å |
| | | */ |
| | | private Set<ClientLinkObject> createClos = new HashSet<ClientLinkObject>(); |
| | | private Set<LinkObject> createClos = new HashSet<LinkObject>(); |
| | | |
| | | /** |
| | | * æ´æ°çä¸å¡ç±»å |
| | | */ |
| | | private Set<ClientBusinessObject> updateCbos = new HashSet<ClientBusinessObject>(); |
| | | private Set<BusinessObject> updateCbos = new HashSet<BusinessObject>(); |
| | | |
| | | /** |
| | | * æ´æ°ç龿¥ç±»å |
| | | */ |
| | | private Set<ClientLinkObject> updateClos = new HashSet<ClientLinkObject>(); |
| | | private Set<LinkObject> updateClos = new HashSet<LinkObject>(); |
| | | |
| | | /** |
| | | * å é¤ä¸å¡ç±»å |
| | | */ |
| | | private Set<ClientBusinessObject> deleteCbos = new HashSet<ClientBusinessObject>(); |
| | | private Set<BusinessObject> deleteCbos = new HashSet<BusinessObject>(); |
| | | |
| | | /** |
| | | * å é¤ç龿¥ç±»å |
| | | */ |
| | | private Set<ClientLinkObject> deleteClos = new HashSet<ClientLinkObject>(); |
| | | private Set<LinkObject> deleteClos = new HashSet<LinkObject>(); |
| | | |
| | | /** |
| | | * æ¥æºæ°æ®éå |
| | |
| | | } |
| | | } |
| | | |
| | | public void addCreateCbo(ClientBusinessObject cbo){ |
| | | public void addCreateCbo(BusinessObject cbo){ |
| | | this.createCbos.add(cbo); |
| | | } |
| | | |
| | | public void addCreateClo(ClientLinkObject clo){ |
| | | public void addCreateClo(LinkObject clo){ |
| | | this.createClos.add(clo); |
| | | } |
| | | |
| | | public void addUpdateCbo(ClientBusinessObject cbo){ |
| | | public void addUpdateCbo(BusinessObject cbo){ |
| | | this.updateCbos.add(cbo); |
| | | } |
| | | |
| | | public void addUpdateClo(ClientLinkObject clo){ |
| | | public void addUpdateClo(LinkObject clo){ |
| | | this.updateClos.add(clo); |
| | | } |
| | | |
| | | public void addDeleteCbo(ClientBusinessObject cbo){ |
| | | public void addDeleteCbo(BusinessObject cbo){ |
| | | this.deleteCbos.add(cbo); |
| | | } |
| | | |
| | | public void addDeleteClo(ClientLinkObject clo){ |
| | | public void addDeleteClo(LinkObject clo){ |
| | | this.deleteClos.add(clo); |
| | | } |
| | | |
| | | |
| | | public ClientBusinessObject[] getCreateCboArray(){ |
| | | public BusinessObject[] getCreateCboArray(){ |
| | | if( this.createCbos == null){ |
| | | this.createCbos = new HashSet<ClientBusinessObject>(); |
| | | this.createCbos = new HashSet<BusinessObject>(); |
| | | } |
| | | return this.createCbos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.getCreateTime() - o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCboArray); |
| | | return this.createCbos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCboArray); |
| | | } |
| | | |
| | | public ClientLinkObject[] getCreateCloArray(){ |
| | | public LinkObject[] getCreateCloArray(){ |
| | | if( this.createClos == null){ |
| | | this.createClos = new HashSet<ClientLinkObject>(); |
| | | this.createClos = new HashSet<LinkObject>(); |
| | | } |
| | | return this.createClos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.getCreateTime() - o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCloArray); |
| | | return this.createClos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCloArray); |
| | | } |
| | | |
| | | |
| | | public ClientBusinessObject[] getUpdateCboArray(){ |
| | | public BusinessObject[] getUpdateCboArray(){ |
| | | if( this.updateCbos == null){ |
| | | this.updateCbos = new HashSet<ClientBusinessObject>(); |
| | | this.updateCbos = new HashSet<BusinessObject>(); |
| | | } |
| | | return this.updateCbos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.getCreateTime() - o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCboArray); |
| | | return this.updateCbos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCboArray); |
| | | } |
| | | |
| | | public ClientLinkObject[] getUpdateCloArray(){ |
| | | public LinkObject[] getUpdateCloArray(){ |
| | | if( this.updateClos == null){ |
| | | this.updateClos = new HashSet<ClientLinkObject>(); |
| | | this.updateClos = new HashSet<LinkObject>(); |
| | | } |
| | | return this.updateClos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.getCreateTime() - o2.getCreateTime()))).collect(Collectors.toList()).toArray(nullCloArray); |
| | | return this.updateClos.stream().sorted(((o1, o2) -> Math.toIntExact(o1.createTime - o2.createTime))).collect(Collectors.toList()).toArray(nullCloArray); |
| | | } |
| | | |
| | | public ClientBusinessObject[] getDeleteCboArray(){ |
| | | public BusinessObject[] getDeleteCboArray(){ |
| | | if( this.deleteCbos == null){ |
| | | this.deleteCbos = new HashSet<ClientBusinessObject>(); |
| | | this.deleteCbos = new HashSet<BusinessObject>(); |
| | | } |
| | | return this.deleteCbos.toArray(nullCboArray); |
| | | } |
| | | |
| | | public ClientLinkObject[] getDeleteCloArray(){ |
| | | public LinkObject[] getDeleteCloArray(){ |
| | | if( this.deleteClos == null){ |
| | | this.deleteClos = new HashSet<ClientLinkObject>(); |
| | | this.deleteClos = new HashSet<LinkObject>(); |
| | | } |
| | | return this.deleteClos.toArray(nullCloArray); |
| | | } |
| | | |
| | | public Set<ClientBusinessObject> getCreateCbos() { |
| | | public Set<BusinessObject> getCreateCbos() { |
| | | return createCbos; |
| | | } |
| | | |
| | | public void setCreateCbos(Set<ClientBusinessObject> createCbos) { |
| | | public void setCreateCbos(Set<BusinessObject> createCbos) { |
| | | this.createCbos = createCbos; |
| | | } |
| | | |
| | | public Set<ClientLinkObject> getCreateClos() { |
| | | public Set<LinkObject> getCreateClos() { |
| | | return createClos; |
| | | } |
| | | |
| | | public void setCreateClos(Set<ClientLinkObject> createClos) { |
| | | public void setCreateClos(Set<LinkObject> createClos) { |
| | | this.createClos = createClos; |
| | | } |
| | | |
| | | public Set<ClientBusinessObject> getUpdateCbos() { |
| | | public Set<BusinessObject> getUpdateCbos() { |
| | | return updateCbos; |
| | | } |
| | | |
| | | public void setUpdateCbos(Set<ClientBusinessObject> updateCbos) { |
| | | public void setUpdateCbos(Set<BusinessObject> updateCbos) { |
| | | this.updateCbos = updateCbos; |
| | | } |
| | | |
| | | public Set<ClientLinkObject> getUpdateClos() { |
| | | public Set<LinkObject> getUpdateClos() { |
| | | return updateClos; |
| | | } |
| | | |
| | | public void setUpdateClos(Set<ClientLinkObject> updateClos) { |
| | | public void setUpdateClos(Set<LinkObject> updateClos) { |
| | | this.updateClos = updateClos; |
| | | } |
| | | |
| | | public Set<ClientBusinessObject> getDeleteCbos() { |
| | | public Set<BusinessObject> getDeleteCbos() { |
| | | return deleteCbos; |
| | | } |
| | | |
| | | public void setDeleteCbos(Set<ClientBusinessObject> deleteCbos) { |
| | | public void setDeleteCbos(Set<BusinessObject> deleteCbos) { |
| | | this.deleteCbos = deleteCbos; |
| | | } |
| | | |
| | | public Set<ClientLinkObject> getDeleteClos() { |
| | | public Set<LinkObject> getDeleteClos() { |
| | | return deleteClos; |
| | | } |
| | | |
| | | public void setDeleteClos(Set<ClientLinkObject> deleteClos) { |
| | | public void setDeleteClos(Set<LinkObject> deleteClos) { |
| | | this.deleteClos = deleteClos; |
| | | } |
| | | |
| | |
| | | package com.vci.web.service; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | |
| | | String sql = (StringUtils.isNotBlank(pageSql)?" select oid,ts,creator,createTime,modifier,modifyTime,name,label,description from (select A.* , rownum RN from (":"") |
| | | + baseSql+ pageSql ; |
| | | WebBoServiceI boService = ApplicationContextProvider.getApplicationContext().getBean(WebBoServiceI.class); |
| | | List<com.vci.client.bof.ClientBusinessObject> dataMap = boService.queryBySql(sql, null); |
| | | List<BusinessObject> dataMap = boService.queryBySql(sql, null); |
| | | DataGrid<T> dataGrid = new DataGrid<>(); |
| | | if(!CollectionUtils.isEmpty(dataMap)){ |
| | | List<T> dataList = new ArrayList<>(); |
| | |
| | | package com.vci.web.service; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.lcm.LifeCycle; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | |
| | | * @param targetStatus ç®æ ç¶æï¼ä¸åºå大å°å |
| | | * @throws VciBaseException 转æ¢çå½å¨æåºéçæ¶åæåºå¼å¸¸ |
| | | */ |
| | | void transCboStatus(List<com.vci.client.bof.ClientBusinessObject> cboList, String targetStatus) throws VciBaseException; |
| | | void transCboStatus(List<BusinessObject> cboList, String targetStatus) throws VciBaseException; |
| | | |
| | | /** |
| | | * éè¿ç¼å·è·åçå½å¨æç¶æå¯¹è±¡ï¼ |
| | |
| | | package com.vci.web.service; |
| | | |
| | | import com.vci.client.bof.RevisionValueObject; |
| | | import com.vci.client.bof.VersionValueObject; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.corba.omd.data.RevisionDataInfo; |
| | | import com.vci.corba.omd.data.VersionDataInfo; |
| | | import com.vci.starter.web.enumpck.VciChangeDocumentTypeEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.model.BaseModel; |
| | |
| | | * @return æ§è¡çç»æ |
| | | * @throws VciBaseException æ§è¡åºéç伿åºå¼å¸¸ï¼æè
äºä»¶ç´æ¥è¿åäºå¼å¸¸ |
| | | */ |
| | | BaseResult callPostEvent(Collection<com.vci.client.bof.ClientBusinessObject> cbos, Collection<com.vci.client.bof.ClientLinkObject> clos, String postEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException; |
| | | BaseResult callPostEvent(Collection<BusinessObject> cbos, Collection<LinkObject> clos, String postEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException; |
| | | |
| | | /** |
| | | * è¡¨åæ°æ®è½¬æ¢ä¸ºåºç¡å¯¹è±¡ |
| | |
| | | * @param cbo ä¸å¡æ°æ®å¯¹è±¡ |
| | | * @return åºç¡å¯¹è±¡ |
| | | */ |
| | | BaseModel cbo2BaseModel(com.vci.client.bof.ClientBusinessObject cbo); |
| | | BaseModel cbo2BaseModel(BusinessObject cbo); |
| | | |
| | | /** |
| | | * ä¸å¡æ°æ®è¡¨å对象转æ¢ä¸ºåºç¡ç屿§ |
| | |
| | | * @param baseModel åºç¡å¯¹è±¡ |
| | | * @return çæ¬ç对象 |
| | | */ |
| | | RevisionValueObject getNextRevision(OsBtmTypeVO btmTypeVO, BaseModel baseModel); |
| | | RevisionDataInfo getNextRevision(OsBtmTypeVO btmTypeVO, BaseModel baseModel); |
| | | |
| | | /** |
| | | * è·åä¸ä¸ä¸ªç次çå· |
| | |
| | | * @param baseModel åºç¡å¯¹è±¡ |
| | | * @return çæ¬çå¼å¯¹è±¡ |
| | | */ |
| | | VersionValueObject getNextVersion(OsBtmTypeVO btmTypeVO, BaseModel baseModel); |
| | | VersionDataInfo getNextVersion(OsBtmTypeVO btmTypeVO, BaseModel baseModel); |
| | | |
| | | /** |
| | | * è·å第ä¸ä¸ªç次 |
| | |
| | | * @param cbo ä¸å¡ç±»åç对象 |
| | | * @param editFlag æ¯å¦ä¸ºç¼è¾ |
| | | */ |
| | | void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, com.vci.client.bof.ClientBusinessObject cbo, boolean editFlag); |
| | | void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, BusinessObject cbo, boolean editFlag); |
| | | |
| | | /** |
| | | * 龿¥ç±»åçç¼è¾æ°æ® |
| | |
| | | package com.vci.web.service; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.common.qt.object.Condition; |
| | | import com.vci.common.qt.object.QueryTemplate; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | ClientBusinessObject createCBOByBtmName(String btmName) throws VciBaseException; |
| | | BusinessObject createCBOByBtmName(String btmName) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ ¹æ®æ¥è¯¢æ¡ä»¶æ¥æ¥è¯¢ä¸å¡ç±»åä¸çæ°æ® |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, Map<String, String> conditionMap) throws VciBaseException; |
| | | List<BusinessObject> queryCBO(String btmType, Map<String, String> conditionMap) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¯ææåºååé¡µçæ¥è¯¢ä¸å¡ç±»åä¸çæ°æ® |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph) throws VciBaseException; |
| | | List<BusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¯æèªå®ä¹æ¥è¯¢å段ï¼å
æ¬åç
§ãæä¸¾åçå½å¨æï¼ |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph, List<String> clauseList) throws VciBaseException; |
| | | List<BusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph, List<String> clauseList) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ·è´å页åæåºçè®¾ç½®å°æ¥è¯¢æ¨¡æ¿ |
| | |
| | | * @param enumAttrName æä¸¾çåç§° |
| | | * @throws VciBaseException æ¥è¯¢æä¸¾åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | void queryEnumText(com.vci.client.bof.ClientBusinessObject cbo, com.vci.client.bof.ClientLinkObject clo, List<String> enumAttrName) throws VciBaseException; |
| | | void queryEnumText(BusinessObject cbo, LinkObject clo, List<String> enumAttrName) throws VciBaseException; |
| | | |
| | | /** |
| | | * ç»é¾æ¥ç±»åè®¾ç½®å±æ§ |
| | |
| | | * @param attributeName 屿§çåç§° |
| | | * @param attributeValue 屿§çå¼ |
| | | */ |
| | | void setAttributeValueForClo(com.vci.client.bof.ClientLinkObject clo, String attributeName, String attributeValue); |
| | | void setAttributeValueForClo(LinkObject clo, String attributeName, String attributeValue); |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥è¯¢æ¹æ¡æ¥æ¥è¯¢æ°æ®ï¼è¿åCBO |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap) throws VciBaseException; |
| | | List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap) throws VciBaseException; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥è¯¢æ¹æ¡æ¥æ¥è¯¢æ°æ®ï¼è¿åCBOï¼æ¯æå页 |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph) throws VciBaseException; |
| | | List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph) throws VciBaseException; |
| | | |
| | | /** |
| | | * 使ç¨ååè·åæ¥è¯¢æ¨¡æ¿ |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph, List<String> clauseList) throws VciBaseException; |
| | | List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph, List<String> clauseList) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°é |
| | |
| | | * @return CBO |
| | | * @throws VciBaseException |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryBySql(String sql, Map<String, String> conditionMap) throws VciBaseException; |
| | | List<BusinessObject> queryBySql(String sql, Map<String, String> conditionMap) throws VciBaseException; |
| | | |
| | | /** |
| | | * åªç¨sqlè¯å¥æ¥è¯¢ï¼è¿ä¸ªåqueryBySqlåºå«æ¯ï¼ç¹æ®çsql(å¦å
嫿彿°ç)å¯ä»¥ç¨è¿ä¸ªæ¹æ³ï¼ä½æ¯æsql注å
¥é£é© |
| | |
| | | * @return CBO |
| | | * @throws VciBaseException æ¥è¯¢åºéæ´»æåºå¼å¸¸ |
| | | */ |
| | | List<com.vci.client.bof.ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException; |
| | | List<BusinessObject> queryByOnlySql(String sql) throws VciBaseException; |
| | | |
| | | /** |
| | | * åªç¨sqlè¯å¥æ¥è¯¢ï¼è¿ä¸ªåqueryBySqlForMapåºå«æ¯ï¼ç¹æ®çsql(å¦å
嫿彿°ç)å¯ä»¥ç¨è¿ä¸ªæ¹æ³ï¼ä½æ¯æsql注å
¥é£é© |
| | |
| | | DataGrid queryGridClassByScheme(String queryScheme, Class c, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph) throws VciBaseException; |
| | | |
| | | /** |
| | | * ClientBusinessObject 转为HashMap |
| | | * BusinessObject 转为HashMap |
| | | * @param cbos CBOS |
| | | * @return map |
| | | * @throws VciBaseException |
| | | */ |
| | | List<Map> cbos2Map(List<ClientBusinessObject> cbos) throws VciBaseException; |
| | | List<Map> cbos2Map(List<BusinessObject> cbos) throws VciBaseException; |
| | | |
| | | /** |
| | | * ClientBusinessObject 转为HashMap |
| | | * BusinessObject 转为HashMap |
| | | * @param cbo |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | Map cbo2Map(com.vci.client.bof.ClientBusinessObject cbo) throws VciBaseException; |
| | | Map cbo2Map(BusinessObject cbo) throws VciBaseException; |
| | | |
| | | /** |
| | | * map转为clientBusinessObject |
| | | * map转为BusinessObject |
| | | * @param map |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientBusinessObject> map2Cbos(List<Map> map) throws VciBaseException; |
| | | List<BusinessObject> map2Cbos(List<Map> map) throws VciBaseException; |
| | | |
| | | /** |
| | | * map转为clientBusinessObject |
| | | * map转为BusinessObject |
| | | * @param map |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | ClientBusinessObject map2Cbo(Map map) throws VciBaseException; |
| | | BusinessObject map2Cbo(Map map) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¹éä¿åä¸å¡ç±»åå龿¥ç±»åçä¿¡æ¯ |
| | |
| | | * @return cbo |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ°æ®ä¸åå¨ä¼æåºå¼å¸¸ |
| | | */ |
| | | ClientBusinessObject selectCBOByOid(String oid,String btmName) throws VciBaseException; |
| | | BusinessObject selectCBOByOid(String oid,String btmName) throws VciBaseException; |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®éåè·å对象 |
| | |
| | | * @return ä¸å¡æ°æ®çéå |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ¥è¯¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | List<ClientBusinessObject> selectCBOByOidCollection(Collection<String> oidCollection,String btmName) throws VciBaseException; |
| | | List<BusinessObject> selectCBOByOidCollection(Collection<String> oidCollection,String btmName) throws VciBaseException; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ°çæ¥è¯¢å°è£
卿¥æ¥è¯¢ |
| | |
| | | package com.vci.web.service; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.bof.ClientLinkObjectOperation; |
| | | import com.vci.corba.omd.data.AttributeValue; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | |
| | | public interface WebLoServiceI { |
| | | |
| | | |
| | | /** |
| | | * è·åå¹³å°ç龿¥ç±»åçæä½ç±» |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | ClientLinkObjectOperation getLoOption() throws VciBaseException; |
| | | |
| | | /** |
| | | * æ ¹æ®æ¥è¯¢æ¡ä»¶æ¥æ¥è¯¢é¾æ¥ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientLinkObject> queryCLO(String linkType, Map<String, String> conditionMap) throws VciBaseException; |
| | | List<LinkObject> queryCLO(String linkType, Map<String, String> conditionMap) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ ¹æ®æ¥è¯¢æ¡ä»¶æ¥æ¥è¯¢é¾æ¥ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientBusinessObject> queryLinkCbo(String linkType, String toBtmname, Map<String, String> conditionMap) throws VciBaseException; |
| | | List<BusinessObject> queryLinkCbo(String linkType, String toBtmname, Map<String, String> conditionMap) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¥è¯¢é¾æ¥ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientLinkObject> queryCLO(String linkType, String toBtmName, int level, Map<String, String> conditionMap) throws VciBaseException; |
| | | List<LinkObject> queryCLO(String linkType, String toBtmName, int level, Map<String, String> conditionMap) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¥è¯¢to端çä¸å¡ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientBusinessObject> queryLinkCbo(String linkType, String toBtmname, int level, Map<String, String> conditionMap) throws VciBaseException; |
| | | List<BusinessObject> queryLinkCbo(String linkType, String toBtmname, int level, Map<String, String> conditionMap) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¥è¯¢é¾æ¥ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientLinkObject> queryCLO(String linkType, String toBtmName, |
| | | List<LinkObject> queryCLO(String linkType, String toBtmName, |
| | | int level, boolean isDirection, Map<String, String> conditionMap) |
| | | throws VciBaseException; |
| | | |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientLinkObject> queryCLO(String linkType, String toBtmName, |
| | | List<LinkObject> queryCLO(String linkType, String toBtmName, |
| | | int level, boolean isDirection, Map<String, String> conditionMap, PageHelper ph) |
| | | throws VciBaseException; |
| | | |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientBusinessObject> queryLinkCbo(String linkType, String toBtmname, |
| | | List<BusinessObject> queryLinkCbo(String linkType, String toBtmname, |
| | | int level, boolean isDirection, Map<String, String> conditionMap) |
| | | throws VciBaseException; |
| | | |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | Map<String,com.vci.client.bof.ClientBusinessObject> queryLinkedCbo(LinkObject[] lo, boolean isDirection) throws VciBaseException; |
| | | Map<String,BusinessObject> queryLinkedCbo(LinkObject[] lo, boolean isDirection) throws VciBaseException; |
| | | |
| | | /** |
| | | *æ¥è¯¢é¾æ¥ç±»åæç«¯çä¸å¡ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | Map<String,com.vci.client.bof.ClientBusinessObject> queryLinkedCbo(List los, boolean isDirection) throws VciBaseException; |
| | | Map<String,BusinessObject> queryLinkedCbo(List los, boolean isDirection) throws VciBaseException; |
| | | |
| | | /** |
| | | *æ¥è¯¢é¾æ¥ç±»åæç«¯çä¸å¡ç±»å |
| | | * @param clo 龿¥ç±»å对象 |
| | | * @param isDirection æ¯å¦åå |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | Map<String,com.vci.client.bof.ClientBusinessObject> queryLinkedCbo(ClientLinkObject[] clo, boolean isDirection) throws VciBaseException; |
| | | // /** |
| | | // *æ¥è¯¢é¾æ¥ç±»åæç«¯çä¸å¡ç±»å |
| | | // * @param clo 龿¥ç±»å对象 |
| | | // * @param isDirection æ¯å¦åå |
| | | // * @return |
| | | // * @throws VciBaseException |
| | | // */ |
| | | // Map<String,BusinessObject> queryLinkedCbo(LinkObject[] clo, boolean isDirection) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¥è¯¢é¾æ¥ç±»åæç«¯çä¸å¡ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | Map<String, com.vci.client.bof.ClientBusinessObject> queryLinkedCbo(ClientLinkObject[] clol, |
| | | Map<String, BusinessObject> queryLinkedCbo(LinkObject[] clol, |
| | | boolean isDirection, List<String> queryColumn) throws VciBaseException; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | Map<String, ClientBusinessObject> queryLinkedCbo(List los, |
| | | Map<String, BusinessObject> queryLinkedCbo(List los, |
| | | boolean isDirection, List<String> queryColumn) throws VciBaseException; |
| | | |
| | | /** |
| | | * ClientLinkObject 转为HashMap |
| | | * LinkObject 转为HashMap |
| | | * @param clos clos |
| | | * @return map |
| | | * @throws VciBaseException |
| | | */ |
| | | List<Map> clos2Map(List<ClientLinkObject> clos) throws VciBaseException; |
| | | List<Map> clos2Map(List<LinkObject> clos) throws VciBaseException; |
| | | |
| | | /** |
| | | * ClientLinkObject 转为HashMap |
| | | * LinkObject 转为HashMap |
| | | * @param clo |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | Map clo2Map(ClientLinkObject clo) throws VciBaseException; |
| | | Map clo2Map(LinkObject clo) throws VciBaseException; |
| | | |
| | | /** |
| | | * map转为ClientLinkObject |
| | | * map转为LinkObject |
| | | * @param map |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientLinkObject> map2Clos(List<Map> map) throws VciBaseException; |
| | | List<LinkObject> map2Clos(List<Map> map) throws VciBaseException; |
| | | |
| | | /** |
| | | * map转为ClientLinkObject |
| | | * map转为LinkObject |
| | | * @param map |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | ClientLinkObject map2Clo(Map map) throws VciBaseException; |
| | | LinkObject map2Clo(Map map) throws VciBaseException; |
| | | |
| | | /** |
| | | * ä¿å龿¥ç±»å对象 |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | List<ClientLinkObject> saveClientLinkObjects(List<ClientLinkObject> clos) throws VciBaseException; |
| | | List<LinkObject> saveLinkObjects(List<LinkObject> clos) throws VciBaseException; |
| | | |
| | | /** |
| | | * åå»ºè¿æ¥ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | ClientLinkObject createClientLinkObject(String loName) throws VciBaseException; |
| | | LinkObject createLinkObject(String loName) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ·è´é¾æ¥ç±»å |
| | |
| | | * @return |
| | | * @throws VciBaseException |
| | | */ |
| | | ClientLinkObject cloneClientLinkObject(ClientLinkObject clo) throws VciBaseException; |
| | | LinkObject cloneLinkObject(LinkObject clo) throws VciBaseException; |
| | | |
| | | /** |
| | | * å é¤é¾æ¥ç±»å |
| | | * @param clos 龿¥ç±»åçå
容 |
| | | * @throws VciBaseException |
| | | */ |
| | | void deleteClientLinkObjects(List<ClientLinkObject> clos) throws VciBaseException; |
| | | void deleteLinkObjects(List<LinkObject> clos) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ´æ°é¾æ¥ç±»å |
| | | * @param clos 龿¥ç±»åç对象 |
| | | * @throws VciBaseException æ§è¡åºé伿åºå¼å¸¸ |
| | | */ |
| | | void updateClientLinkObject(List<ClientLinkObject> clos) throws VciBaseException; |
| | | void updateLinkObject(List<LinkObject> clos) throws VciBaseException; |
| | | |
| | | /** |
| | | * æ¥è¯¢é¾æ¥ç±»ååä¸å¡ç±»å |
| | |
| | | * @param attributeName 屿§åç§° |
| | | * @param attributeValue 屿§çå¼ |
| | | */ |
| | | public default void setAttribute(com.vci.client.bof.ClientLinkObject clo,String attributeName,String attributeValue){ |
| | | com.vci.corba.omd.data.AttributeValue[] attrValues =clo.getLinkObject().newAttrValList; |
| | | public default void setAttribute(LinkObject clo,String attributeName,String attributeValue){ |
| | | com.vci.corba.omd.data.AttributeValue[] attrValues =clo.newAttrValList; |
| | | ArrayList<com.vci.corba.omd.data.AttributeValue> attrValList = new ArrayList(); |
| | | com.vci.corba.omd.data.AttributeValue attrVal; |
| | | int i; |
| | |
| | | attrValList.add(attrVal); |
| | | } |
| | | |
| | | clo.getLinkObject().newAttrValList = (com.vci.corba.omd.data.AttributeValue[])attrValList.toArray(new com.vci.corba.omd.data.AttributeValue[attrValList.size()]); |
| | | clo.newAttrValList = attrValList.toArray(new AttributeValue[attrValList.size()]); |
| | | }; |
| | | } |
| | |
| | | import com.vci.frameworkcore.compatibility.ISmFunctionQueryService; |
| | | import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.enumpck.ResourceControlTypeEnum; |
| | | import com.vci.frameworkcore.pagemodel.SmFunctionVO; |
| | | import com.vci.frameworkcore.pagemodel.SmUserVO; |
| | | import com.vci.frameworkcore.properties.VciSecurityManageProperties; |
| | | import com.vci.starter.web.annotation.bus.VciLoginAfter; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.*; |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*; |
| | | //import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*; |
| | | import static com.vci.omd.constants.AttributeConstants.*; |
| | | |
| | | /** |
| | | * 屿§æ± æå¡ --å·²ç»è°ç¨äºå¹³å°çæå¡ï¼å æ¤ä¸å¨æä¾Daoå± |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.etm.EnumItem; |
| | | import com.vci.corba.omd.etm.EnumType; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | @Override |
| | | public List<KeyValue> getDataEnum(String oid, String btmname) { |
| | | VciBaseUtil.alertNotNull(oid,"ä¸å¡æ°æ®ç主é®",btmname,"ä¸å¡ç±»å"); |
| | | com.vci.client.bof.ClientBusinessObject cbo = boService.selectCBOByOid(oid, btmname); |
| | | String secret = cbo.getAttributeValue("secretGrade"); |
| | | BusinessObject cbo = boService.selectCBOByOid(oid, btmname); |
| | | String secret = ObjectTool.getBOAttributeValue(cbo,"secretGrade"); |
| | | if(StringUtils.isBlank(secret)){ |
| | | return new ArrayList<>(); |
| | | }else{ |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.lcm.Bound; |
| | | import com.vci.corba.omd.lcm.LifeCycle; |
| | | import com.vci.corba.omd.lcm.TransitionVO; |
| | |
| | | * @throws VciBaseException 转æ¢çå½å¨æåºéçæ¶åæåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void transCboStatus(List<com.vci.client.bof.ClientBusinessObject> cboList, |
| | | public void transCboStatus(List<BusinessObject> cboList, |
| | | String targetStatus) throws VciBaseException { |
| | | WebUtil.alertNotNull(cboList,"ä¸å¡æ°æ®å¯¹è±¡",targetStatus,"ç®æ 对象"); |
| | | com.vci.corba.omd.data.BusinessObject[] bos = new com.vci.corba.omd.data.BusinessObject[cboList.size()]; |
| | | BusinessObject[] bos = new BusinessObject[cboList.size()]; |
| | | for(int i = 0 ; i < cboList.size() ; i ++){ |
| | | bos[i] = cboList.get(i).getBusinessObject(); |
| | | bos[i] = cboList.get(i); |
| | | } |
| | | transStatus(bos, targetStatus); |
| | | } |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.ltm.LinkType; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | |
| | | "inner JOIN user_col_comments c on t.TABLE_NAME = c.table_name and t.COLUMN_NAME = c.column_name where " + |
| | | "t.table_name = '" + VciBaseUtil.getTableName(btmTypeVO.getId()).toUpperCase(Locale.ROOT) + "' order by t.column_name asc"; |
| | | Map<String, OsBtmTypeAttributeVO> attributeVOMap = btmTypeVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbosList = boService.queryBySql(sql, new HashMap<>()); |
| | | List<BusinessObject> cbosList = boService.queryBySql(sql, new HashMap<>()); |
| | | if(!CollectionUtils.isEmpty(cbosList)){ |
| | | cbosList.stream().forEach(cbo->{ |
| | | String attrId = cbo.getAttributeValue("column_name"); |
| | | String dataType = cbo.getAttributeValue("data_type"); |
| | | String attrId = ObjectTool.getBOAttributeValue(cbo,"column_name"); |
| | | String dataType = ObjectTool.getBOAttributeValue(cbo,"data_type"); |
| | | if(StringUtils.isNotBlank(dataType) && dataType.contains("(")){ |
| | | dataType = dataType.substring(0,dataType.indexOf("(")); |
| | | } |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.web.pageModel.SmOperationVO; |
| | | import com.vci.web.service.SmOperationServiceI; |
| | |
| | | String sql = "select f.ploid from plfunction f where lower(f.plmoduleno) = :functionId"; |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("functionId",functionId.toLowerCase(Locale.ROOT).trim()); |
| | | List<com.vci.client.bof.ClientBusinessObject> functionCbos = boService.queryBySql(sql, conditionMap); |
| | | List<BusinessObject> functionCbos = boService.queryBySql(sql, conditionMap); |
| | | if(CollectionUtils.isEmpty(functionCbos)){ |
| | | //齿²¡æè¿ä¸ªåè½ |
| | | return new ArrayList<>(); |
| | | } |
| | | String functionOid = functionCbos.get(0).getAttributeValue("ploid"); |
| | | String functionOid = ObjectTool.getBOAttributeValue(functionCbos.get(0), "ploid"); |
| | | conditionMap.clear(); |
| | | conditionMap.put("functionOid",functionOid); |
| | | sql = "select rf.plrightvalue from PLROLERIGHT rf left join pluserrole ur on rf.plroleoid = ur.plroleuid " + |
| | | " where ur.pluseruid =:useroid and rf.plfuncoid = :functionOid"; |
| | | conditionMap.put("useroid",VciBaseUtil.getCurrentUserOid()); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryBySql(sql, conditionMap); |
| | | List<BusinessObject> cbos = boService.queryBySql(sql, conditionMap); |
| | | if(CollectionUtils.isEmpty(cbos)){ |
| | | //æ²¡æææ |
| | | return new ArrayList<>(); |
| | | } |
| | | long rightValue = VciBaseUtil.getLong(cbos.get(0).getAttributeValue("plrightvalue")); |
| | | long rightValue = VciBaseUtil.getLong(ObjectTool.getBOAttributeValue(cbos.get(0), "plrightvalue")); |
| | | //è·åå
·ä½å
å«åªäºæé® |
| | | sql = "select o.ploperoid,o.plno from PLFUNCOPERATION o where o.plfuncoid = :functionOid "; |
| | | conditionMap.remove("useroid"); |
| | | List<com.vci.client.bof.ClientBusinessObject> operationLinkCbos = boService.queryBySql(sql, conditionMap); |
| | | List<BusinessObject> operationLinkCbos = boService.queryBySql(sql, conditionMap); |
| | | if(CollectionUtils.isEmpty(operationLinkCbos)){ |
| | | //æ ¹æ¬æ²¡ææé® |
| | | return new ArrayList<>(); |
| | |
| | | List<String> hasRightOids = new ArrayList<>(); |
| | | Map<String,Integer> oidOrderMap = new HashMap<>(); |
| | | operationLinkCbos.stream().forEach(cbo->{ |
| | | String operationOid = cbo.getAttributeValue("ploperoid"); |
| | | int orderNo = VciBaseUtil.getInt(cbo.getAttributeValue("plno")); |
| | | String operationOid = ObjectTool.getBOAttributeValue(cbo,"ploperoid"); |
| | | int orderNo = VciBaseUtil.getInt(ObjectTool.getBOAttributeValue(cbo,"plno")); |
| | | if(hasRight(rightValue,orderNo)){ |
| | | hasRightOids.add(operationOid); |
| | | oidOrderMap.put(operationOid,orderNo); |
| | |
| | | return new ArrayList<>(); |
| | | } |
| | | sql = "select ploid as oid,plname,pluniqueflag,pldesc,plalias,plsequence from ploperation where ploid in (" + VciBaseUtil.toInSql(hasRightOids.toArray(new String[0])) + ")"; |
| | | List<com.vci.client.bof.ClientBusinessObject> opertionCBOs = boService.queryBySql(sql, new HashMap<>()); |
| | | List<BusinessObject> opertionCBOs = boService.queryBySql(sql, new HashMap<>()); |
| | | List<SmOperationVO> operationVOS = new ArrayList<>(); |
| | | Optional.ofNullable(opertionCBOs).orElseGet(()->new ArrayList<>()).stream().forEach(cbo->{ |
| | | SmOperationVO operationVO = new SmOperationVO(); |
| | | operationVO.setFunctionOid(functionOid); |
| | | operationVO.setOid(cbo.getOid()); |
| | | operationVO.setUniqueFlag(cbo.getAttributeValue("pluniqueflag")); |
| | | operationVO.setName(cbo.getAttributeValue("plname")); |
| | | operationVO.setAlias(cbo.getAttributeValue("plalias")); |
| | | operationVO.setOid(cbo.oid); |
| | | operationVO.setUniqueFlag(ObjectTool.getBOAttributeValue(cbo,"pluniqueflag")); |
| | | operationVO.setName(ObjectTool.getBOAttributeValue(cbo,"plname")); |
| | | operationVO.setAlias(ObjectTool.getBOAttributeValue(cbo,"plalias")); |
| | | operationVO.setOrderNo(String.valueOf(oidOrderMap.get(operationVO.getOid()))); |
| | | operationVO.setDescription(cbo.getAttributeValue("pldesc")); |
| | | operationVO.setDescription(ObjectTool.getBOAttributeValue(cbo,"pldesc")); |
| | | operationVO.setModuleNo(functionId); |
| | | operationVOS.add(operationVO); |
| | | }); |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.bof.RevisionValueObject; |
| | | import com.vci.client.bof.VersionValueObject; |
| | | import com.vci.client.common.providers.ClientServiceProvider; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | |
| | | import com.vci.file.pagemodel.VciFileObjectVO; |
| | | import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; |
| | | import com.vci.frameworkcore.lcstatuspck.ReleaseDataLCStatus; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.revision.bo.TreeWrapperOptions; |
| | | import com.vci.starter.web.annotation.bus.VciChangeDataAfter; |
| | | import com.vci.starter.web.annotation.bus.VciChangeDataBefore; |
| | |
| | | UIFormDataVO formDataVO = new UIFormDataVO(); |
| | | replaceMap.put("oid", formQuery.getOid().trim()); |
| | | if(!formDefineVO.isLinkTypeFlag()) { |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = null; |
| | | List<BusinessObject> cbos = null; |
| | | if (StringUtils.isNotBlank(queryTemplate)) { |
| | | replaceMap.put("oid", formQuery.getOid().trim()); |
| | | cbos = boService.queryCBOByScheme(queryTemplate, conditionMap, replaceMap, null, queryFieldList.stream().collect(Collectors.toList())); |
| | |
| | | cbos = boService.queryCBO(formQuery.getBtmname(), conditionMap, null, queryFieldList.stream().collect(Collectors.toList())); |
| | | } |
| | | if (!CollectionUtils.isEmpty(cbos)) { |
| | | com.vci.client.bof.ClientBusinessObject cbo = cbos.get(0); |
| | | BusinessObject cbo = cbos.get(0); |
| | | formDataVO.setData(boService.cbo2Map(cbo)); |
| | | } else { |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | |
| | | |
| | | if(treeQuery.isQueryRoot()){ |
| | | //æ¯æ¥è¯¢æ ¹èç¹ |
| | | List<com.vci.client.bof.ClientBusinessObject> rootCbos = null; |
| | | List<BusinessObject> rootCbos = null; |
| | | if(StringUtils.isNotBlank(queryTemplate)){ |
| | | //è¯´ææ¯èåéå®ä¹äºæ¥è¯¢æ¨¡æ¿ç |
| | | rootCbos = boService.queryCBOByScheme(queryTemplate, null, replaceMap); |
| | |
| | | return rootTreeList; |
| | | }else{ |
| | | //è¿ä¸ªä¸æ¯è·èç¹ï¼ä½æ¯ä¸è¬åªæ¯å¢å ä¸ä¸ªé级æ¥è¯¢ï¼å 为å
¨é¨æ¥è¯¢çæ¶åï¼å¨æ ¹èç¹å·²ç»å
¨é¨æ¥è¯¢å®äº |
| | | List<com.vci.client.bof.ClientBusinessObject> thisChildren = null; |
| | | List<BusinessObject> thisChildren = null; |
| | | if (StringUtils.isNotBlank(queryTemplate)) { |
| | | thisChildren = boService.queryCBOByScheme(queryTemplate, treeQuery.getConditionMap(), replaceMap, null, queryFieldList); |
| | | } else { |
| | |
| | | */ |
| | | private void queryTreeForBO(List<Tree> rootTreeList, String queryTemplate,List<String> queryFieldList,TreeQueryObject treeQueryObject) { |
| | | for (Tree rootTree : rootTreeList) { |
| | | List<com.vci.client.bof.ClientBusinessObject> thisChildren = null; |
| | | List<BusinessObject> thisChildren = null; |
| | | Map<String,String> sourceDataMap = rootTree.getAttributes(); |
| | | sourceDataMap.put("f_oid",rootTree.getOid()); |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | |
| | | * @param parentOid ä¸çº§çä¸»é® |
| | | * @return æ |
| | | */ |
| | | private List<Tree> cbo2Trees(Collection<com.vci.client.bof.ClientBusinessObject> cbos,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){ |
| | | private List<Tree> cbo2Trees(Collection<BusinessObject> cbos,String valueField,String textField,String parentFieldName,boolean showCheckBox,String parentOid){ |
| | | final int[] i = {0}; |
| | | List<Tree> rootList = new ArrayList<>(); |
| | | List<Tree> children = new ArrayList<>(); |
| | |
| | | tree.setOid(getValueByExpress(cbo,valueField)); |
| | | tree.setText(getValueByExpress(cbo,textField)); |
| | | if(StringUtils.isNotBlank(parentFieldName)){ |
| | | tree.setParentId(cbo.getAttributeValue(parentFieldName)); |
| | | tree.setParentId(ObjectTool.getBOAttributeValue(cbo,parentFieldName)); |
| | | } |
| | | tree.setAttributes(boService.cbo2Map(cbo)); |
| | | tree.setIndex(i[0] + ""); |
| | |
| | | List<Tree> children = new ArrayList<>(); |
| | | boAndLOS.stream().forEach(boAndLO->{ |
| | | Tree tree = new Tree(); |
| | | com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); |
| | | cbo.setBusinessObject(boAndLO.bo); |
| | | com.vci.client.bof.ClientLinkObject clo = new com.vci.client.bof.ClientLinkObject(); |
| | | clo.setLinkObject(boAndLO.lo); |
| | | BusinessObject cbo = new BusinessObject(); |
| | | cbo = boAndLO.bo; |
| | | LinkObject clo = new LinkObject(); |
| | | clo = boAndLO.lo; |
| | | Map<String,String> cloMap = loService.clo2Map(clo); |
| | | Map<String,String> cbo2Map = boService.cbo2Map(cbo); |
| | | if(!CollectionUtils.isEmpty(cbo2Map)){ |
| | |
| | | tree.setParentId(boAndLO.lo.oid + TREE_NODE_ID_SEP + boAndLO.lo.fromOid); |
| | | }else { |
| | | if (parentFieldName.contains(".")) { |
| | | tree.setParentId(cbo.getAttributeValue(parentFieldName)); |
| | | tree.setParentId(ObjectTool.getBOAttributeValue(cbo,parentFieldName)); |
| | | } else { |
| | | tree.setParentId(clo.getAttributeValue(parentFieldName)); |
| | | tree.setParentId(ObjectTool.getLOAttributeValue(clo,parentFieldName)); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param fieldExpress 表达å¼çå¼ |
| | | * @return 转æ¢åçå¼ |
| | | */ |
| | | private String getValueByExpress(com.vci.client.bof.ClientBusinessObject cbo,String fieldExpress){ |
| | | private String getValueByExpress(BusinessObject cbo,String fieldExpress){ |
| | | if(StringUtils.isBlank(fieldExpress)){ |
| | | return ""; |
| | | } |
| | |
| | | List<String> fieldList = VciBaseUtil.str2List(fieldExpress); |
| | | StringBuilder sb = new StringBuilder(); |
| | | fieldList.stream().forEach(field->{ |
| | | sb.append(cbo.getAttributeValue(field)).append(" "); |
| | | sb.append(ObjectTool.getBOAttributeValue(cbo,field)).append(" "); |
| | | }); |
| | | return sb.toString().trim(); |
| | | } |
| | |
| | | * @throws VciBaseException æ§è¡åºéç伿åºå¼å¸¸ï¼æè
äºä»¶ç´æ¥è¿åäºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public BaseResult callPostEvent(Collection<com.vci.client.bof.ClientBusinessObject> cbos, Collection<com.vci.client.bof.ClientLinkObject> clos, String postEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException{ |
| | | public BaseResult callPostEvent(Collection<BusinessObject> cbos, Collection<LinkObject> clos, String postEvent, VciChangeDocumentTypeEnum businessType) throws VciBaseException{ |
| | | if(CollectionUtils.isEmpty(cbos)){ |
| | | return BaseResult.success(); |
| | | } |
| | | String btmType = !CollectionUtils.isEmpty(cbos)?cbos.stream().findFirst().get().getBtmName():null; |
| | | String linkType = !CollectionUtils.isEmpty(clos)?clos.stream().findFirst().get().getLinkObject().ltName:null; |
| | | String btmType = !CollectionUtils.isEmpty(cbos)?cbos.stream().findFirst().get().btName:null; |
| | | String linkType = !CollectionUtils.isEmpty(clos)?clos.stream().findFirst().get().ltName:null; |
| | | if(StringUtils.isNotBlank(postEvent)){ |
| | | //åç½®äºä»¶ |
| | | //beançåå#æ¹æ³; æè
å
¨è·¯å¾ãæåä¸ä¸ªæ¯æ¹æ³çåå |
| | |
| | | return beforeResult; |
| | | } |
| | | //å°è£
æ°æ® |
| | | BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,false,false); |
| | | BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,false,false); |
| | | if(!resultCbo.isSuccess()){ |
| | | return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs()); |
| | | } |
| | | //æ§è¡ä¿å |
| | | BaseResult<Map<String,Object>> result = BaseResult.success(); |
| | | com.vci.client.bof.ClientBusinessObject afterCBO = null; |
| | | BusinessObject afterCBO = null; |
| | | try { |
| | | BusinessObject resultBO = platformClientUtil.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),false,false); |
| | | afterCBO = new com.vci.client.bof.ClientBusinessObject(); |
| | | afterCBO.setBusinessObject(resultBO); |
| | | BusinessObject resultBO = platformClientUtil.getBOFService().createBusinessObject(resultCbo.getObj(),false,false); |
| | | afterCBO = new BusinessObject(); |
| | | afterCBO = resultBO; |
| | | result.setObj(boService.cbo2Map(afterCBO)); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | if(!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())){ |
| | | fileObjectService.releasedFile(afterCBO.getBtmName(),afterCBO.getOid(),formDataDTO.getReleaseFileOids()); |
| | | fileObjectService.releasedFile(afterCBO.btName,afterCBO.oid,formDataDTO.getReleaseFileOids()); |
| | | } |
| | | //åç½®äºä»¶ |
| | | String afterEvent = formDataDTO.getPostEvent(); |
| | | try { |
| | | callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{afterCBO}).collect(Collectors.toList()),null, afterEvent, VciChangeDocumentTypeEnum.ADD); |
| | | callPostEvent(Arrays.stream(new BusinessObject[]{afterCBO}).collect(Collectors.toList()),null, afterEvent, VciChangeDocumentTypeEnum.ADD); |
| | | }catch (Throwable e){ |
| | | //说æåç½®äºä»¶åºç°äºé误ï¼é£ä¹å°±éè¦å é¤ä»¥åçè¿æ¡æ°æ® |
| | | try { |
| | | platformClientUtil.getBOFService().deleteBusinessObject(afterCBO.getBusinessObject(),1); |
| | | platformClientUtil.getBOFService().deleteBusinessObject(afterCBO,1); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | * @param newVersion æ°ç次 |
| | | * @return æ§è¡çç»æ |
| | | */ |
| | | private BaseResult<com.vci.client.bof.ClientBusinessObject> wrapperCbo(FormDataDTO formDataDTO,UIFormDefineVO formDefineVO,boolean editFlag,boolean newRevision,boolean newVersion){ |
| | | private BaseResult<BusinessObject> wrapperCbo(FormDataDTO formDataDTO,UIFormDefineVO formDefineVO,boolean editFlag,boolean newRevision,boolean newVersion){ |
| | | //æ©å±å±æ§çå¼ |
| | | Map<String, String> data = formDataDTO.getData(); |
| | | Map<String,String> dataLow = new HashMap<>(); |
| | |
| | | if(!result.isSuccess()){ |
| | | return result; |
| | | } |
| | | com.vci.client.bof.ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,newRevision,newVersion); |
| | | BusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,newRevision,newVersion); |
| | | return BaseResult.success(cbo); |
| | | } |
| | | |
| | |
| | | * @return åºç¡å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public BaseModel cbo2BaseModel(com.vci.client.bof.ClientBusinessObject cbo){ |
| | | public BaseModel cbo2BaseModel(BusinessObject cbo){ |
| | | BaseModel baseModel = new BaseModel(); |
| | | baseModel.setOid(cbo.getOid()); |
| | | baseModel.setNameOid(cbo.getNameoid()); |
| | | baseModel.setRevisionOid(cbo.getRevisionid()); |
| | | baseModel.setBtmname(cbo.getBtmName()); |
| | | baseModel.setLastR(String.valueOf(cbo.getIsLastR())); |
| | | baseModel.setLastV(String.valueOf(cbo.getIsLastV())); |
| | | baseModel.setFirstR(String.valueOf(cbo.getIsFirstR())); |
| | | baseModel.setFirstV(String.valueOf(cbo.getIsFirstV())); |
| | | baseModel.setCreator(cbo.getCreator()); |
| | | baseModel.setOid(cbo.oid); |
| | | baseModel.setNameOid(cbo.nameoid); |
| | | baseModel.setRevisionOid(cbo.revisionid); |
| | | baseModel.setBtmname(cbo.btName); |
| | | baseModel.setLastR(String.valueOf(cbo.isLastR)); |
| | | baseModel.setLastV(String.valueOf(cbo.isLastV)); |
| | | baseModel.setFirstR(String.valueOf(cbo.isFirstR)); |
| | | baseModel.setFirstV(String.valueOf(cbo.isFirstV)); |
| | | baseModel.setCreator(cbo.creator); |
| | | try { |
| | | baseModel.setCreateTime(new Date(cbo.getCreateTime())); |
| | | baseModel.setLastModifyTime(new Date(cbo.getLastModifyTime())); |
| | | baseModel.setTs(new Date(cbo.getTs())); |
| | | baseModel.setCreateTime(new Date(cbo.createTime)); |
| | | baseModel.setLastModifyTime(new Date(cbo.modifyTime)); |
| | | baseModel.setTs(new Date(cbo.ts)); |
| | | // baseModel.setCheckInTime(VciDateUtil.str2Date(cbo.getCheckinTime(), VciDateUtil.DateTimeFormat)); |
| | | // baseModel.setCheckOutTime(VciDateUtil.str2Date(cbo.getCheckoutTime(), VciDateUtil.DateTimeFormat)); |
| | | }catch (Throwable e){ |
| | | |
| | | } |
| | | baseModel.setLastModifier(cbo.getLastModifier()); |
| | | baseModel.setRevisionRule(cbo.getRevisionRule()); |
| | | baseModel.setVersionRule(cbo.getVersionRule()); |
| | | baseModel.setRevisionSeq(cbo.getRevisionSeq()); |
| | | baseModel.setRevisionValue(cbo.getRevisionValue()); |
| | | baseModel.setVersionSeq(cbo.getVersionSeq()); |
| | | baseModel.setVersionValue(cbo.getVersionValue()); |
| | | baseModel.setLcStatus(cbo.getLcStatus()); |
| | | baseModel.setId(cbo.getId()); |
| | | baseModel.setName(cbo.getName()); |
| | | baseModel.setDescription(cbo.getDescription()); |
| | | baseModel.setOwner(cbo.getOwner()); |
| | | baseModel.setLastModifier(cbo.modifier); |
| | | baseModel.setRevisionRule(cbo.revisionRule); |
| | | baseModel.setVersionRule(cbo.versionRule); |
| | | baseModel.setRevisionSeq(cbo.revisionSeq); |
| | | baseModel.setRevisionValue(cbo.revisionValue); |
| | | baseModel.setVersionSeq(cbo.versionSeq); |
| | | baseModel.setVersionValue(cbo.versionValue); |
| | | baseModel.setLcStatus(cbo.lcStatus); |
| | | baseModel.setId(cbo.id); |
| | | baseModel.setName(cbo.name); |
| | | baseModel.setDescription(cbo.description); |
| | | baseModel.setOwner(cbo.owner); |
| | | // baseModel.setCheckInBy(cbo.getCheckinBy()); |
| | | // baseModel.setCheckOutBy(cbo.getCheckoutBy()); |
| | | baseModel.setCopyFromVersion(cbo.getCopyFromVersion()); |
| | | baseModel.setCopyFromVersion(cbo.fromVersion); |
| | | return baseModel; |
| | | } |
| | | |
| | |
| | | * @return çæ¬ç对象 |
| | | */ |
| | | @Override |
| | | public RevisionValueObject getNextRevision(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ |
| | | public RevisionDataInfo getNextRevision(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ |
| | | try { |
| | | if(baseModel.getRevisionValue() == null){ |
| | | baseModel.setRevisionValue(""); |
| | |
| | | * @param info corba对象 |
| | | * @return java对象 |
| | | */ |
| | | private RevisionValueObject changeRevisionValueInfoToObject(RevisionDataInfo info) { |
| | | RevisionValueObject object = new RevisionValueObject(); |
| | | object.setRevisionVal(info.revisionVal); |
| | | object.setRevisionSeq(info.revisionSeq); |
| | | private RevisionDataInfo changeRevisionValueInfoToObject(RevisionDataInfo info) { |
| | | RevisionDataInfo object = new RevisionDataInfo(); |
| | | object.revisionVal = info.revisionVal; |
| | | object.revisionSeq = info.revisionSeq; |
| | | return object; |
| | | } |
| | | |
| | |
| | | * @return çæ¬çå¼å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public VersionValueObject getNextVersion(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ |
| | | public VersionDataInfo getNextVersion(OsBtmTypeVO btmTypeVO, BaseModel baseModel){ |
| | | try{ |
| | | return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextVersionValue(WebUtil.getTableName(btmTypeVO.getId()),baseModel.getRevisionOid(),baseModel.getNameOid(),WebUtil.getInt(btmTypeVO.getVersionRule()))); |
| | | }catch (PLException vciError){ |
| | |
| | | * @param info çæ¬¡çå¼ |
| | | * @return java对象 |
| | | */ |
| | | private VersionValueObject changeRevisionValueInfoToObject(VersionDataInfo info) { |
| | | VersionValueObject object = new VersionValueObject(); |
| | | object.setVersionVal(info.versionVal); |
| | | object.setVersionSeq(info.versionSeq); |
| | | private VersionDataInfo changeRevisionValueInfoToObject(VersionDataInfo info) { |
| | | VersionDataInfo object = new VersionDataInfo(); |
| | | object.versionVal = info.versionVal; |
| | | object.versionSeq = info.versionSeq; |
| | | return object; |
| | | } |
| | | /** |
| | |
| | | //å°è£
æ°æ® |
| | | List<BusinessObject> addBos = new ArrayList<>(); |
| | | List<BusinessObject> afterBOs = new ArrayList<>(); |
| | | List<com.vci.client.bof.ClientBusinessObject> afterCBOs = new ArrayList<>(); |
| | | List<BusinessObject> afterCBOs = new ArrayList<>(); |
| | | Map<String,List<String>> releasedFileOids = new HashMap<>(); |
| | | for(FormDataDTO formDataDTO:formDataDTOList.getFormDataDTOS()) { |
| | | BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, false, false, false); |
| | | BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, false, false, false); |
| | | if (!resultCbo.isSuccess()) { |
| | | return BaseResult.fail(resultCbo.getMsg(), resultCbo.getMsgObjs()); |
| | | } |
| | | addBos.add(resultCbo.getObj().getBusinessObject()); |
| | | addBos.add(resultCbo.getObj()); |
| | | //æ§è¡ä¿å |
| | | if (!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())) { |
| | | releasedFileOids.put(resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); |
| | | releasedFileOids.put(resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); |
| | | } |
| | | } |
| | | try { |
| | | BusinessObject[] resultBOs = platformClientUtil.getBOFService().batchCreateBusinessObject(addBos.toArray(new BusinessObject[0]), false, false); |
| | | afterBOs = Arrays.stream(resultBOs).collect(Collectors.toList()); |
| | | Arrays.stream(resultBOs).forEach(bo->{ |
| | | com.vci.client.bof.ClientBusinessObject cbo = new com.vci.client.bof.ClientBusinessObject(); |
| | | cbo.setBusinessObject(bo); |
| | | BusinessObject cbo = new BusinessObject(); |
| | | cbo = bo; |
| | | afterCBOs.add(cbo); |
| | | }); |
| | | } catch (PLException vciError) { |
| | |
| | | return beforeResult; |
| | | } |
| | | //å°è£
æ°æ® |
| | | BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,true,false,false); |
| | | BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,true,false,false); |
| | | if(!resultCbo.isSuccess()){ |
| | | return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs()); |
| | | } |
| | | //æ§è¡ä¿å |
| | | BaseResult<Map<String,Object>> result = BaseResult.success(); |
| | | try { |
| | | platformClientUtil.getBOFService().updateBusinessObject(resultCbo.getObj().getBusinessObject()); |
| | | platformClientUtil.getBOFService().updateBusinessObject(resultCbo.getObj()); |
| | | result.setObj(boService.cbo2Map(resultCbo.getObj())); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | if(!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())){ |
| | | fileObjectService.releasedFile(resultCbo.getObj().getBtmName(),resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); |
| | | fileObjectService.releasedFile(resultCbo.getObj().btName,resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); |
| | | } |
| | | //åç½®äºä»¶ |
| | | String afterEvent = formDataDTO.getPostEvent(); |
| | | try { |
| | | callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); |
| | | callPostEvent(Arrays.stream(new BusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); |
| | | } |
| | |
| | | return beforeResult; |
| | | } |
| | | //å°è£
æ°æ® |
| | | BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); |
| | | BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); |
| | | if(!resultCbo.isSuccess()){ |
| | | return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs()); |
| | | } |
| | | //æ§è¡ä¿å |
| | | BaseResult<Map<String,Object>> result = BaseResult.success(); |
| | | try { |
| | | BusinessObject bo = platformClientUtil.getBOFService().createBusinessObject(resultCbo.getObj().getBusinessObject(),formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); |
| | | com.vci.client.bof.ClientBusinessObject afterCbo = new com.vci.client.bof.ClientBusinessObject(); |
| | | afterCbo.setBusinessObject(bo); |
| | | BusinessObject bo = platformClientUtil.getBOFService().createBusinessObject(resultCbo.getObj(),formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); |
| | | BusinessObject afterCbo = new BusinessObject(); |
| | | afterCbo = bo; |
| | | result.setObj(boService.cbo2Map(afterCbo)); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | if(!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())){ |
| | | fileObjectService.releasedFile(resultCbo.getObj().getBtmName(),resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); |
| | | fileObjectService.releasedFile(resultCbo.getObj().btName,resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); |
| | | } |
| | | //åç½®äºä»¶ |
| | | String afterEvent = formDataDTO.getPostEvent(); |
| | | try { |
| | | callPostEvent(Arrays.stream(new com.vci.client.bof.ClientBusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); |
| | | callPostEvent(Arrays.stream(new BusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); |
| | | } |
| | |
| | | //å°è£
æ°æ® |
| | | List<BusinessObject> updateCBOS = new ArrayList<>(); |
| | | Map<String,List<String>> releasedFileOids = new HashMap<>(); |
| | | List<com.vci.client.bof.ClientBusinessObject> afterCBOs = new ArrayList<>(); |
| | | List<BusinessObject> afterCBOs = new ArrayList<>(); |
| | | for(FormDataDTO formDataDTO:formDataDTOList.getFormDataDTOS()) { |
| | | BaseResult<com.vci.client.bof.ClientBusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, true, false, false); |
| | | BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO, formDefineVO, true, false, false); |
| | | if (!resultCbo.isSuccess()) { |
| | | return BaseResult.fail(resultCbo.getMsg(), resultCbo.getMsgObjs()); |
| | | } |
| | | updateCBOS.add(resultCbo.getObj().getBusinessObject()); |
| | | updateCBOS.add(resultCbo.getObj()); |
| | | //æ§è¡ä¿å |
| | | if (!CollectionUtils.isEmpty(formDataDTO.getReleaseFileOids())) { |
| | | releasedFileOids.put(resultCbo.getObj().getOid(),formDataDTO.getReleaseFileOids()); |
| | | releasedFileOids.put(resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); |
| | | } |
| | | } |
| | | try { |
| | |
| | | String btmName = deleteDataDTO.getDataList().get(0).getBtmname(); |
| | | List<String> oidList = deleteDataDTO.getDataList().stream().map(BaseModelDTO::getOid).collect(Collectors.toList()); |
| | | //çç级èå é¤ãåªæèªå·±å¼ç¨èªå·±çæ¶åå¯ä»¥çº§èå é¤ |
| | | List<com.vci.client.bof.ClientBusinessObject> cbo = null; |
| | | List<BusinessObject> cbo = null; |
| | | if(deleteDataDTO.isCascade()){ |
| | | //级èå é¤ |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmById(btmName); |
| | |
| | | if(CollectionUtils.isEmpty(cbo)){ |
| | | return BaseResult.fail("没æå¨ç³»ç»ä¸æ¾å°è¿äºæ°æ®ï¼æªæ§è¡å 餿ä½"); |
| | | } |
| | | List<com.vci.client.bof.ClientBusinessObject> finalCbo = cbo; |
| | | Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(finalCbo.stream().map(com.vci.client.bof.ClientBusinessObject::getOid).collect(Collectors.toList())); |
| | | List<BusinessObject> finalCbo = cbo; |
| | | Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(finalCbo.stream().map(bo -> bo.oid).collect(Collectors.toList())); |
| | | List<OsUsedAttributeVO> usedAttributeVOS = null; |
| | | boolean adminCascade = false; |
| | | if("admin".equalsIgnoreCase(VciBaseUtil.getCurrentUserId()) && deleteDataDTO.isAdminCascade()){ |
| | |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | | conditionMap.put(usedAttributeVO.getId(),QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | if(StringUtils.isNotBlank(usedAttributeVO.getPkBtmType())) { |
| | | List<com.vci.client.bof.ClientBusinessObject> tempCbos = boService.queryCBO(usedAttributeVO.getPkBtmType(), conditionMap); |
| | | List<BusinessObject> tempCbos = boService.queryCBO(usedAttributeVO.getPkBtmType(), conditionMap); |
| | | if(!CollectionUtils.isEmpty(tempCbos)){ |
| | | finalCbo.addAll(tempCbos); |
| | | } |
| | |
| | | } |
| | | VciBaseUtil.switchCollectionForOracleIn(finalCbo).stream().forEach(cbos->{ |
| | | try { |
| | | platformClientUtil.getBOFService().batchDeleteBusinessObject(cbos.stream().map(s->s.getBusinessObject()).collect(Collectors.toList()).toArray(new BusinessObject[0]),1); |
| | | platformClientUtil.getBOFService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),1); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | }); |
| | | System.out.println("zheshi shazi "); |
| | | return BaseResult.success(); |
| | | } |
| | | |
| | |
| | | //说æåç½®äºä»¶æ²¡ææ§è¡æå |
| | | return beforeResult; |
| | | } |
| | | com.vci.client.bof.ClientLinkObject clo = null; |
| | | LinkObject clo = null; |
| | | String prefix = ""; |
| | | if(formLinkDataDTO.isDirection()){ |
| | | prefix = LO_FROM_PREFIX; |
| | |
| | | } |
| | | |
| | | //æ¥è¯¢from端ç |
| | | com.vci.client.bof.ClientBusinessObject fromCbo = new com.vci.client.bof.ClientBusinessObject(); |
| | | BusinessObject fromCbo = new BusinessObject(); |
| | | try { |
| | | fromCbo.setBusinessObject(platformClientUtil.getBOFService().readBusinessObject(fromOid,fromBtmName)); |
| | | fromCbo = platformClientUtil.getBOFService().readBusinessObject(fromOid,fromBtmName); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | } |
| | | }); |
| | | //å°è£
to端ç |
| | | BaseResult<com.vci.client.bof.ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO,formDefineVO,toOid,toBtmName,boData); |
| | | BaseResult<BusinessObject> result = wrapperToCbo(formLinkDataDTO,formDefineVO,toOid,toBtmName,boData); |
| | | if(!result.isSuccess()){ |
| | | return BaseResult.fail(result.getMsg(),result.getMsgObjs()); |
| | | } |
| | | com.vci.client.bof.ClientBusinessObject toCbo = result.getObj(); |
| | | BusinessObject toCbo = result.getObj(); |
| | | //åå§å龿¥ç±»åçå¼ |
| | | BaseResult<com.vci.client.bof.ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, false); |
| | | BaseResult<LinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, false); |
| | | if(!resultClo.isSuccess()){ |
| | | return BaseResult.fail(resultClo.getMsg(),resultClo.getMsgObjs()); |
| | | } |
| | | clo = resultClo.getObj(); |
| | | if(formLinkDataDTO.isDirection()){ |
| | | clo.setFromBO(toCbo); |
| | | clo.setToBO(fromCbo); |
| | | } else { |
| | | clo.setFromBO(fromCbo); |
| | | clo.setToBO(toCbo); |
| | | } |
| | | //æ§è¡ä¿å |
| | | BusinessObject[] bos = new BusinessObject[1]; |
| | | toCbo.dealBusinessObjectNullValue(); |
| | | clo.dealLinkObjectNullValue(); |
| | | bos[0] = toCbo.getBusinessObject(); |
| | | ObjectTool.dealBusinessObjectNullValue(toCbo); |
| | | ObjectTool.dealLinkObjectNullValue(clo); |
| | | bos[0] = toCbo; |
| | | try { |
| | | platformClientUtil.getBOFService().createBusinessObjectWithLink(bos,clo.getLinkObject()); |
| | | platformClientUtil.getBOFService().createBusinessObjectWithLink(bos,clo); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | if(!CollectionUtils.isEmpty(formLinkDataDTO.getReleaseFileOids())){ |
| | | fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.getOid(),formLinkDataDTO.getReleaseFileOids()); |
| | | fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.oid,formLinkDataDTO.getReleaseFileOids()); |
| | | } |
| | | //åç½®äºä»¶ |
| | | String afterEvent = formLinkDataDTO.getPostEvent(); |
| | | try { |
| | | callPostEvent(null,Arrays.stream(new com.vci.client.bof.ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); |
| | | callPostEvent(null,Arrays.stream(new LinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); |
| | | }catch (Throwable e){ |
| | | //说æåç½®äºä»¶åºç°äºé误ï¼é£ä¹å°±éè¦å é¤ä»¥åçè¿æ¡æ°æ® |
| | | try { |
| | | platformClientUtil.getBOFService().deleteBusinessObject(toCbo.getBusinessObject(),1); |
| | | platformClientUtil.getBOFService().deleteLinkObject(clo.getLinkObject()); |
| | | platformClientUtil.getBOFService().deleteBusinessObject(toCbo,1); |
| | | platformClientUtil.getBOFService().deleteLinkObject(clo); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success(clo.getOid()); |
| | | return BaseResult.success(clo.oid); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param editFlag æ¯å¦ä¸ºç¼è¾ |
| | | * @return 龿¥ç±»åçå
容 |
| | | */ |
| | | private BaseResult<com.vci.client.bof.ClientLinkObject> wrapperOnlyCLO(FormLinkDataDTO formLinkDataDTO,Map<String,String> loData,UIFormDefineVO formDefineVO,boolean editFlag){ |
| | | private BaseResult<LinkObject> wrapperOnlyCLO(FormLinkDataDTO formLinkDataDTO,Map<String,String> loData,UIFormDefineVO formDefineVO,boolean editFlag){ |
| | | Map<String,String> baseDataMap = formLinkDataDTO2MapLow(formLinkDataDTO); |
| | | Map<String,String> allDataMap = new HashMap<>(); |
| | | allDataMap.putAll(loData); |
| | |
| | | return result; |
| | | } |
| | | //å¤çä¸å¡ç±»åå¾å°æ°æ® |
| | | ClientLinkObject clo ; |
| | | LinkObject clo ; |
| | | if(editFlag){ |
| | | try { |
| | | LinkObject linkObject = platformClientUtil.getBOFService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType()); |
| | | clo = new ClientLinkObject(); |
| | | clo.setLinkObject(linkObject); |
| | | clo = new LinkObject(); |
| | | clo = linkObject; |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | }else{ |
| | | clo = new ClientLinkObject(); |
| | | clo = new LinkObject(); |
| | | //å¤çåå§åçæ°æ® |
| | | clo.setOid(VciBaseUtil.getPk()); |
| | | clo.setCreator(VciBaseUtil.getCurrentUserId()); |
| | | clo.setCreateTime(System.currentTimeMillis()); |
| | | clo.setTs(System.currentTimeMillis()); |
| | | clo.setLoName(formLinkDataDTO.getLinkType()); |
| | | clo.oid = VciBaseUtil.getPk(); |
| | | clo.creator = VciBaseUtil.getCurrentUserId(); |
| | | clo.createTime = System.currentTimeMillis(); |
| | | clo.ts = System.currentTimeMillis(); |
| | | clo.ltName = formLinkDataDTO.getLinkType(); |
| | | } |
| | | // |
| | | LinkObject finalClo = clo; |
| | | allDataMap.forEach((key,value)->{ |
| | | if(editFlag&&("lastmodifier".equalsIgnoreCase(key) || "lastmodifytime".equalsIgnoreCase(key) |
| | | || "ts".equalsIgnoreCase(key) || "creator".equalsIgnoreCase(key) |
| | | || "createtime".equalsIgnoreCase(key))){ |
| | | //å¹³å°ä¸è½ä¼ éè¿ä¸ª |
| | | }else{ |
| | | loService.setAttribute(clo,key,value); |
| | | loService.setAttribute(finalClo,key,value); |
| | | } |
| | | }); |
| | | return BaseResult.success(clo); |
| | |
| | | * @param boData toçæ°æ® |
| | | * @return å
å«ç对象 |
| | | */ |
| | | private BaseResult<com.vci.client.bof.ClientBusinessObject> wrapperToCbo(FormLinkDataDTO formLinkDataDTO,UIFormDefineVO formDefineVO,String toOid,String toBtmName,Map<String,String> boData){ |
| | | private BaseResult<BusinessObject> wrapperToCbo(FormLinkDataDTO formLinkDataDTO,UIFormDefineVO formDefineVO,String toOid,String toBtmName,Map<String,String> boData){ |
| | | Map<String,String> dataLow = new HashMap<>(); |
| | | boData.forEach((key,value)->{ |
| | | dataLow.put(key.toLowerCase(),value); |
| | |
| | | if(!result.isSuccess()){ |
| | | return result; |
| | | } |
| | | com.vci.client.bof.ClientBusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,formLinkDataDTO.isToUpRevision(),formLinkDataDTO.isToUpVersion()); |
| | | BusinessObject cbo = createOrGetCbo(dataLow,baseDataMap,editFlag,formLinkDataDTO.isToUpRevision(),formLinkDataDTO.isToUpVersion()); |
| | | return BaseResult.success(cbo); |
| | | |
| | | } |
| | |
| | | * @param newVersion æ¯å¦åçæ¬¡ |
| | | * @return cbo对象 |
| | | */ |
| | | public com.vci.client.bof.ClientBusinessObject createOrGetCbo(Map<String,String> dataLowMap,Map<String,String> baseDataMap,boolean editFlag,boolean newRevision,boolean newVersion){ |
| | | public BusinessObject createOrGetCbo(Map<String,String> dataLowMap,Map<String,String> baseDataMap,boolean editFlag,boolean newRevision,boolean newVersion){ |
| | | String btmName = baseDataMap.get("btmname"); |
| | | String oid = baseDataMap.get("oid"); |
| | | // ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | // BusinessObject cbo = new BusinessObject(); |
| | | BusinessObject cbo = new BusinessObject(); |
| | | String copyfromversion = baseDataMap.get("copyfromversion"); |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmById(btmName); |
| | | List<String> attributeList = btmTypeVO.getAttributes().stream().map(attribute -> attribute.getId()).collect(Collectors.toList()); |
| | | if(editFlag || newRevision || newVersion){ |
| | | try { |
| | | cbo.setBusinessObject(platformClientUtil.getBOFService().readBusinessObject(editFlag?oid:copyfromversion,btmName)); |
| | | cbo = platformClientUtil.getBOFService().readBusinessObject(editFlag?oid:copyfromversion,btmName); |
| | | } catch (PLException vciError) { |
| | | throw new VciBaseException("使ç¨ä¸»é®å¨ç³»ç»ä¸æ²¡ææ¥è¯¢å°æ°æ®",new String[]{oid},vciError); |
| | | } |
| | | if(btmTypeVO.isRevisionFlag() && newRevision){ |
| | | cbo.setOid(VciBaseUtil.getPk()); |
| | | cbo.setCopyFromVersion(copyfromversion); |
| | | cbo.oid = VciBaseUtil.getPk(); |
| | | cbo.fromVersion = copyfromversion; |
| | | if(btmTypeVO.isInputRevisionFlag() && StringUtils.isNotBlank(baseDataMap.getOrDefault("revisionvalue",""))){ |
| | | //æå¨çï¼æä»¥ä¸å¤ççæ¬è§åäº |
| | | cbo.setRevisionValue(baseDataMap.get("revisionvalue")); |
| | | cbo.revisionValue = baseDataMap.get("revisionvalue"); |
| | | }else{ |
| | | //è¯´ææ¯åç |
| | | BaseModel baseModel = cbo2BaseModel(cbo); |
| | | RevisionValueObject revisionValueObject = getNextRevision(btmTypeVO,baseModel); |
| | | cbo.setRevisionid(VciBaseUtil.getPk()); |
| | | cbo.setRevisionSeq((short) revisionValueObject.getRevisionSeq()); |
| | | cbo.setRevisionValue(revisionValueObject.getRevisionVal()); |
| | | cbo.setIsLastR(true); |
| | | cbo.setIsFirstR(false); |
| | | RevisionDataInfo revisionValueObject = getNextRevision(btmTypeVO,baseModel); |
| | | cbo.revisionid = VciBaseUtil.getPk(); |
| | | cbo.revisionSeq = revisionValueObject.revisionSeq; |
| | | cbo.revisionValue = revisionValueObject.revisionVal; |
| | | cbo.isLastR = true; |
| | | cbo.isFirstR = false; |
| | | //å¤ççæ¬¡ |
| | | cbo.setVersionValue(getFirstVersion(btmTypeVO.getVersionRule())); |
| | | cbo.setVersionRule(btmTypeVO.getVersionRule()); |
| | | cbo.setVersionSeq((short) 0); |
| | | cbo.setIsLastV(true); |
| | | cbo.setIsFirstV(true); |
| | | cbo.versionValue = getFirstVersion(btmTypeVO.getVersionRule()); |
| | | cbo.versionRule = btmTypeVO.getVersionRule(); |
| | | cbo.versionSeq = (short) 0; |
| | | cbo.isLastV = true; |
| | | cbo.isFirstV = true; |
| | | } |
| | | //åççæ¶åï¼çå½å¨æçç¶æéè¦æ¹å¨å°é»è®¤ç¶æ |
| | | if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ |
| | |
| | | if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.oid)){ |
| | | throw new VciBaseException("{0}éççå½å¨æè®¾ç½®å¾ä¸æ£ç¡®ï¼å¨ç³»ç»ä¸æ²¡ææ¾å°{1}è¿ä¸ªçå½å¨æ",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()}); |
| | | } |
| | | cbo.setLcStatus(lifeCycleVO.startState); |
| | | cbo.lcStatus = lifeCycleVO.startState; |
| | | } |
| | | } |
| | | if(btmTypeVO.isRevisionFlag() && newVersion){ |
| | | cbo.setCopyFromVersion(copyfromversion); |
| | | cbo.setOid(VciBaseUtil.getPk()); |
| | | cbo.fromVersion = copyfromversion; |
| | | cbo.oid = VciBaseUtil.getPk(); |
| | | //è¿æ¯åçæ¬¡ï¼ä¸åå¨å³åçæ¬ï¼ååçæ¬¡çæ
åµ |
| | | BaseModel baseModel = cbo2BaseModel(cbo); |
| | | VersionValueObject versionValueObject = getNextVersion(btmTypeVO,baseModel); |
| | | cbo.setVersionValue(versionValueObject.getVersionVal()); |
| | | cbo.setVersionSeq((short) versionValueObject.getVersionSeq()); |
| | | cbo.setIsLastV(true); |
| | | cbo.setIsFirstV(false); |
| | | VersionDataInfo versionValueObject = getNextVersion(btmTypeVO,baseModel); |
| | | cbo.versionValue = versionValueObject.versionVal; |
| | | cbo.versionSeq = versionValueObject.versionSeq; |
| | | cbo.isLastV = true; |
| | | cbo.isFirstV = false; |
| | | //åççæ¶åï¼çå½å¨æçç¶æéè¦æ¹å¨å°é»è®¤ç¶æ |
| | | if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ |
| | | //æ¥è¯¢çå½å¨æ |
| | |
| | | if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.oid)){ |
| | | throw new VciBaseException("{0}éççå½å¨æè®¾ç½®å¾ä¸æ£ç¡®ï¼å¨ç³»ç»ä¸æ²¡ææ¾å°{1}è¿ä¸ªçå½å¨æ",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()}); |
| | | } |
| | | cbo.setLcStatus(lifeCycleVO.startState); |
| | | cbo.lcStatus = lifeCycleVO.startState; |
| | | } |
| | | } |
| | | }else{ |
| | | //æä»¬éè¦å°å±æ§åå§å |
| | | if(StringUtils.isBlank(cbo.getOid()) || (newRevision || newVersion)){ |
| | | cbo.setOid(VciBaseUtil.getPk()); |
| | | if(StringUtils.isBlank(cbo.oid) || (newRevision || newVersion)){ |
| | | cbo.oid = VciBaseUtil.getPk(); |
| | | } |
| | | if(StringUtils.isBlank(cbo.getCreator())){ |
| | | cbo.setCreator(VciBaseUtil.getCurrentUserId()); |
| | | if(StringUtils.isBlank(cbo.creator)){ |
| | | cbo.creator = VciBaseUtil.getCurrentUserId(); |
| | | } |
| | | if(cbo.getCreateTime() != 0){ |
| | | cbo.setCreateTime(System.currentTimeMillis()); |
| | | if(cbo.createTime != 0){ |
| | | cbo.createTime = System.currentTimeMillis(); |
| | | } |
| | | if(StringUtils.isBlank(cbo.getOwner())){ |
| | | cbo.setOwner(cbo.getCreator()); |
| | | if(StringUtils.isBlank(cbo.owner)){ |
| | | cbo.owner = cbo.creator; |
| | | } |
| | | cbo.setTs(System.currentTimeMillis()); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId()) && (StringUtils.isBlank(cbo.getLcStatus()) || newRevision || newVersion)){ |
| | | cbo.ts = System.currentTimeMillis(); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId()) && (StringUtils.isBlank(cbo.lcStatus) || newRevision || newVersion)){ |
| | | //æ¥è¯¢çå½å¨æ |
| | | OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(btmTypeVO.getLifeCycleId()); |
| | | if(lifeCycleVO == null || StringUtils.isBlank(lifeCycleVO.getOid())){ |
| | | throw new VciBaseException("{0}éççå½å¨æè®¾ç½®å¾ä¸æ£ç¡®ï¼å¨ç³»ç»ä¸æ²¡ææ¾å°{1}è¿ä¸ªçå½å¨æ",new String[]{btmTypeVO.getName(),btmTypeVO.getLifeCycleId()}); |
| | | } |
| | | cbo.setLcStatus(lifeCycleVO.getStartStatus()); |
| | | cbo.setLctId(btmTypeVO.getLifeCycleId()); |
| | | cbo.lcStatus = lifeCycleVO.getStartStatus(); |
| | | cbo.lctId = btmTypeVO.getLifeCycleId(); |
| | | } |
| | | if(StringUtils.isBlank(cbo.getBtmName())){ |
| | | cbo.setBtmName(btmTypeVO.getId()); |
| | | if(StringUtils.isBlank(cbo.btName)){ |
| | | cbo.btName = btmTypeVO.getId(); |
| | | } |
| | | if(btmTypeVO.isRevisionFlag()){ |
| | | //è¦ç®¡ççæ¬ |
| | | if(btmTypeVO.isInputRevisionFlag() && StringUtils.isNotBlank(baseDataMap.getOrDefault("revisionvalue",""))){ |
| | | //æå¨çï¼æä»¥ä¸å¤ççæ¬è§åäº |
| | | cbo.setRevisionValue(baseDataMap.get("revisionvalue")); |
| | | cbo.revisionValue = baseDataMap.get("revisionvalue"); |
| | | }else { |
| | | OsRevisionRuleVO ruleVO = revisionRuleServiceI.getRevisionRuleById(btmTypeVO.getRevisionRuleId()); |
| | | if (ruleVO == null || StringUtils.isBlank(ruleVO.getOid())) { |
| | | throw new VciBaseException("{0}éççæ¬è§å设置å¾ä¸æ£ç¡®ï¼å¨ç³»ç»ä¸æ²¡ææ¾å°{1}è¿ä¸ªçæ¬è§å", new String[]{btmTypeVO.getName(), btmTypeVO.getRevisionRuleId()}); |
| | | } |
| | | cbo.setRevisionValue(ruleVO.getStartCode()); |
| | | cbo.revisionValue = ruleVO.getStartCode(); |
| | | } |
| | | if (StringUtils.isBlank(cbo.getNameoid())) { |
| | | cbo.setNameoid(VciBaseUtil.getPk()); |
| | | if (StringUtils.isBlank(cbo.nameoid)) { |
| | | cbo.nameoid = VciBaseUtil.getPk(); |
| | | } |
| | | if (StringUtils.isBlank(cbo.getRevisionid())) { |
| | | cbo.setRevisionid(VciBaseUtil.getPk()); |
| | | if (StringUtils.isBlank(cbo.revisionid)) { |
| | | cbo.revisionid = VciBaseUtil.getPk(); |
| | | } |
| | | cbo.setIsFirstR(true); |
| | | cbo.setIsLastR(true); |
| | | cbo.setRevisionRule(btmTypeVO.getRevisionRuleId()); |
| | | cbo.setRevisionSeq((short) 0); |
| | | cbo.isFirstR = true; |
| | | cbo.isLastR = true; |
| | | cbo.revisionRule = btmTypeVO.getRevisionRuleId(); |
| | | cbo.revisionSeq = (short) 0; |
| | | //ççæ¯å¦éè¦å¤ççæ¬¡ |
| | | |
| | | cbo.setVersionValue(getFirstVersion(btmTypeVO.getVersionRule())); |
| | | cbo.setVersionRule(btmTypeVO.getVersionRule()); |
| | | cbo.setVersionSeq((short) 0); |
| | | cbo.setIsLastV(true); |
| | | cbo.setIsFirstV(true); |
| | | cbo.versionValue = getFirstVersion(btmTypeVO.getVersionRule()); |
| | | cbo.versionRule = btmTypeVO.getVersionRule(); |
| | | cbo.versionSeq = (short) 0; |
| | | cbo.isLastV = true; |
| | | cbo.isFirstV = true; |
| | | } |
| | | } |
| | | // Iterator<Map.Entry<String, String>> iterator = baseDataMap.entrySet().iterator(); |
| | |
| | | * @param editFlag æ¯å¦ä¸ºç¼è¾ |
| | | */ |
| | | @Override |
| | | public void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, com.vci.client.bof.ClientBusinessObject cbo, boolean editFlag){ |
| | | public void setValueToCbo(Map<String, String> dataLow, Map<String, String> baseDataLow, BusinessObject cbo, boolean editFlag){ |
| | | dataLow.forEach((key,value)->{ |
| | | if(editFlag&¬SendOnEdit(key)){ |
| | | //å¹³å°ä¸è½ä¼ éè¿ä¸ª |
| | | }else{ |
| | | try { |
| | | // if(!SystemAttribute.bosysAttList().contains(key)){ |
| | | cbo.setAttributeValueWithNoCheck(key, value, !editFlag); |
| | | // } |
| | | } catch (PLException vciError) { |
| | | throw new VciBaseException("{0}çå¼ä¸ç¬¦åè¦æ±ï¼å½åæ¯{1}", new String[]{key, value}, vciError); |
| | | } |
| | | ObjectTool.setBOAttributeValue(cbo,key,value); |
| | | } |
| | | }); |
| | | baseDataLow.forEach((key,value)->{ |
| | |
| | | }else{ |
| | | if(editFlag) { |
| | | //ç¼è¾çæ¶åå¯ä»¥é½è®¾ç½® |
| | | try { |
| | | // if(!SystemAttribute.bosysAttList().contains(key)){ |
| | | cbo.setAttributeValueWithNoCheck(key, value, !editFlag); |
| | | // } |
| | | } catch (PLException vciError) { |
| | | throw new VciBaseException("{0}çå¼ä¸ç¬¦åè¦æ±ï¼å½åæ¯{1}", new String[]{key, value}, vciError); |
| | | } |
| | | ObjectTool.setBOAttributeValue(cbo,key,value); |
| | | }else{ |
| | | //åªéè¦å¤çid,name,descriptionï¼å¯çº§å³å¯ï¼å
¶ä½çé½å·²ç»è¢«è®¾ç½®äº |
| | | if(basicFields.contains(key) &&StringUtils.isNotBlank(value)){ |
| | | try { |
| | | // if(!SystemAttribute.bosysAttList().contains(key)){ |
| | | cbo.setAttributeValueWithNoCheck(key, value, true); |
| | | // } |
| | | } catch (PLException vciError) { |
| | | throw new VciBaseException("{0}çå¼ä¸ç¬¦åè¦æ±ï¼å½åæ¯{1}", new String[]{key, value}, vciError); |
| | | } |
| | | ObjectTool.setBOAttributeValue(cbo,key,value); |
| | | } |
| | | } |
| | | } |
| | |
| | | //说æåç½®äºä»¶æ²¡ææ§è¡æå |
| | | return beforeResult; |
| | | } |
| | | com.vci.client.bof.ClientLinkObject clo = null; |
| | | LinkObject clo = null; |
| | | String prefix = formLinkDataDTO.isDirection()?LO_FROM_PREFIX:LO_TO_PREFIX; |
| | | String toOid = formLinkDataDTO.isDirection()?formLinkDataDTO.getFoid():formLinkDataDTO.getToid(); |
| | | String toBtmName = formLinkDataDTO.isDirection()?formLinkDataDTO.getFbtmname():formLinkDataDTO.getTbtmname(); |
| | |
| | | } |
| | | }); |
| | | } |
| | | com.vci.client.bof.ClientBusinessObject toCbo =null; |
| | | BusinessObject toCbo =null; |
| | | if(!CollectionUtils.isEmpty(boData)) { |
| | | //å°è£
to端ç |
| | | BaseResult<com.vci.client.bof.ClientBusinessObject> result = wrapperToCbo(formLinkDataDTO, formDefineVO, toOid, toBtmName, boData); |
| | | BaseResult<BusinessObject> result = wrapperToCbo(formLinkDataDTO, formDefineVO, toOid, toBtmName, boData); |
| | | if (!result.isSuccess()) { |
| | | return BaseResult.fail(result.getMsg(), result.getMsgObjs()); |
| | | } |
| | |
| | | } |
| | | |
| | | //åå§å龿¥ç±»åçå¼ |
| | | BaseResult<com.vci.client.bof.ClientLinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, true); |
| | | BaseResult<LinkObject> resultClo = wrapperOnlyCLO(formLinkDataDTO, loData, formDefineVO, true); |
| | | if(!resultClo.isSuccess()){ |
| | | return BaseResult.fail(resultClo.getMsg(),resultClo.getMsgObjs()); |
| | | } |
| | | clo = resultClo.getObj(); |
| | | if(toCbo!=null) { |
| | | if (formLinkDataDTO.isDirection()) { |
| | | clo.setFromBO(toCbo); |
| | | } else { |
| | | clo.setToBO(toCbo); |
| | | } |
| | | } |
| | | try { |
| | | platformClientUtil.getBOFService().updateLinkObject(clo.getLinkObject()); |
| | | platformClientUtil.getBOFService().updateLinkObject(clo); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | //ä¿åto端æè
from端 |
| | | try{ |
| | | platformClientUtil.getBOFactoryService().updateBusinessObject(toCbo.getBusinessObject()); |
| | | platformClientUtil.getBOFactoryService().updateBusinessObject(toCbo); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | if(!CollectionUtils.isEmpty(formLinkDataDTO.getReleaseFileOids())){ |
| | | fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.getOid(),formLinkDataDTO.getReleaseFileOids()); |
| | | fileObjectService.releasedFile(formLinkDataDTO.getLinkType(),clo.oid,formLinkDataDTO.getReleaseFileOids()); |
| | | } |
| | | //åç½®äºä»¶ |
| | | String afterEvent = formLinkDataDTO.getPostEvent(); |
| | | try { |
| | | callPostEvent(null,Arrays.stream(new com.vci.client.bof.ClientLinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); |
| | | callPostEvent(null,Arrays.stream(new LinkObject[]{clo}).collect(Collectors.toList()), afterEvent, VciChangeDocumentTypeEnum.ADD); |
| | | }catch (Throwable e){ |
| | | //åç½®äºä»¶æé®é¢äºå°±åªè½æ¯è¿æ ·äºï¼æ²¡åæ³æ¢å¤ |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success(clo.getOid()); |
| | | return BaseResult.success(clo.oid); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(deleteLinkDataDTO.getDataList().stream().anyMatch(s->StringUtils.isBlank(s.getOid()) || StringUtils.isBlank(s.getLinkType()))){ |
| | | throw new VciBaseException("ææ°æ®ç主é®(æé¾æ¥ç±»åï¼æ²¡æå¼ï¼æ æ³å é¤"); |
| | | } |
| | | List<ClientLinkObject> clos = new ArrayList<>(); |
| | | List<LinkObject> clos = new ArrayList<>(); |
| | | VciBaseUtil.switchListForOracleIn(deleteLinkDataDTO.getDataList()).stream().forEach(linkModelDTOs->{ |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("oid",QueryOptionConstant.IN +"(" + VciBaseUtil.toInSql(linkModelDTOs.stream().map(BaseLinkModelDTO::getOid).toArray(String[]::new)) +")"); |
| | | List<ClientLinkObject> clientLinkObjects = loService.queryCLO(linkModelDTOs.get(0).getLinkType(), conditionMap); |
| | | if(!CollectionUtils.isEmpty(clientLinkObjects)){ |
| | | clos.addAll(clientLinkObjects); |
| | | List<LinkObject> LinkObjects = loService.queryCLO(linkModelDTOs.get(0).getLinkType(), conditionMap); |
| | | if(!CollectionUtils.isEmpty(LinkObjects)){ |
| | | clos.addAll(LinkObjects); |
| | | } |
| | | }); |
| | | if(CollectionUtils.isEmpty(clos)){ |
| | | throw new VciBaseException("使ç¨ä¸»é®æ²¡æå¨ç³»ç»ä¸æ¾å°é¾æ¥ç±»åçæ°æ®"); |
| | | } |
| | | Map<String,List<ClientLinkObject>> fromBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.getFromBTMName())); |
| | | Map<String,List<ClientLinkObject>> toBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.getToBTMName())); |
| | | Map<String,List<com.vci.client.bof.ClientBusinessObject>> fromBtmDataGroups = new HashMap<>(); |
| | | Map<String,List<com.vci.client.bof.ClientBusinessObject>> toBtmDataGroups = new HashMap<>(); |
| | | Map<String,List<LinkObject>> fromBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.fromBTName)); |
| | | Map<String,List<LinkObject>> toBtmGroups = clos.stream().collect(Collectors.groupingBy(s->s.toBTName)); |
| | | Map<String,List<BusinessObject>> fromBtmDataGroups = new HashMap<>(); |
| | | Map<String,List<BusinessObject>> toBtmDataGroups = new HashMap<>(); |
| | | if(!CollectionUtils.isEmpty(fromBtmGroups)){ |
| | | fromBtmGroups.forEach((btmType,cloList)->{ |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getFromOid).collect(Collectors.toList()), btmType); |
| | | List<BusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(clo -> clo.fromOid).collect(Collectors.toList()), btmType); |
| | | fromBtmDataGroups.put(btmType,cbos); |
| | | }); |
| | | } |
| | | if(!CollectionUtils.isEmpty(toBtmGroups)){ |
| | | toBtmGroups.forEach((btmType,cloList)->{ |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(ClientLinkObject::getToOid).collect(Collectors.toList()), btmType); |
| | | List<BusinessObject> cbos = boService.selectCBOByOidCollection(cloList.stream().map(clo -> clo.toOid).collect(Collectors.toList()), btmType); |
| | | toBtmDataGroups.put(btmType,cbos); |
| | | }); |
| | | } |
| | |
| | | if(attr.toLowerCase().startsWith(LO_FROM_PREFIX)){ |
| | | fromBtmDataGroups.forEach((btm,cbos)->{ |
| | | String attrNotPrefix = attr.substring(LO_FROM_PREFIX.length()); |
| | | if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(s.getAttributeValue(attrNotPrefix)))){ |
| | | if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(ObjectTool.getBOAttributeValue(s, attrNotPrefix)))){ |
| | | throw new VciBaseException("æ°æ®çå
容ä¸å
许å é¤,{0}", new String[]{deleteLinkDataDTO.getCheckNotDeleteMsg()}); |
| | | } |
| | | }); |
| | | }else if(attr.toLowerCase().startsWith(LO_TO_PREFIX)){ |
| | | toBtmDataGroups.forEach((btm,cbos)->{ |
| | | String attrNotPrefix = attr.substring(LO_TO_PREFIX.length()); |
| | | if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(s.getAttributeValue(attrNotPrefix)))){ |
| | | if(!CollectionUtils.isEmpty(cbos) && cbos.stream().anyMatch(s->!attrValue.equalsIgnoreCase(ObjectTool.getBOAttributeValue(s, attrNotPrefix)))){ |
| | | throw new VciBaseException("æ°æ®çå
容ä¸å
许å é¤,{0}", new String[]{deleteLinkDataDTO.getCheckNotDeleteMsg()}); |
| | | } |
| | | }); |
| | | }else { |
| | | if (clos.stream().anyMatch(s -> attrValue.equalsIgnoreCase(s.getAttributeValue(attr)))) { |
| | | if (clos.stream().anyMatch(s -> attrValue.equalsIgnoreCase(ObjectTool.getLOAttributeValue(s,attr)))) { |
| | | throw new VciBaseException("æ°æ®çå
容ä¸å
许å é¤,{0}", new String[]{deleteLinkDataDTO.getCheckNotDeleteMsg()}); |
| | | } |
| | | } |
| | |
| | | //龿¥ç±»åæ¬èº«ä¸è¬ä¸ä¼æå
³è |
| | | List<LinkObject> los = new ArrayList<>(); |
| | | clos.stream().forEach(clo->{ |
| | | los.add(clo.getLinkObject()); |
| | | los.add(clo); |
| | | }); |
| | | try { |
| | | platformClientUtil.getBOFactoryService().batchDeleteLinkObject(los.toArray(new LinkObject[0])); |
| | |
| | | if(deleteLinkDataDTO.isDeleteFromData()){ |
| | | fromBtmDataGroups.forEach((btm,cbos)->{ |
| | | try{ |
| | | platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1); |
| | | platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),1); |
| | | }catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | if(deleteLinkDataDTO.isDeleteToData()){ |
| | | toBtmDataGroups.forEach((btm,cbos)->{ |
| | | try{ |
| | | platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.stream().map(com.vci.client.bof.ClientBusinessObject::getBusinessObject).toArray(BusinessObject[] :: new),1); |
| | | platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),1); |
| | | }catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | referConfigVO.setConditionMap(new HashMap<>()); |
| | | } |
| | | |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = null; |
| | | List<BusinessObject> cbos = null; |
| | | String oidFieldName = StringUtils.isNotBlank(referConfigVO.getParentUsedField())?referConfigVO.getParentUsedField():referConfigVO.getValueField(); |
| | | if(referConfigVO.isSelectAllLevel()) { |
| | | String parentOidSql = ""; |
| | |
| | | @Override |
| | | public List<Map<String,String>> getDataAttr(String btmname, String oid) { |
| | | VciBaseUtil.alertNotNull(btmname,"ä¸å¡ç±»åçä¿¡æ¯",oid,"ä¸å¡æ°æ®ç主é®"); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); |
| | | List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); |
| | | List<Map<String,String>> dataMap = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.portal.utility.UITools; |
| | | //import com.vci.client.portal.utility.UITools; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.portal.data.PLAction; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.web.pageModel.UIActionVO; |
| | | import com.vci.web.service.WebActionServiceI; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class WebActionServiceImpl implements WebActionServiceI { |
| | | |
| | | /** |
| | | * å¹³å°çè°ç¨å·¥å
·ç±» |
| | | */ |
| | | @Autowired |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | /** |
| | | * action对象 |
| | |
| | | public UIActionVO getActionByOid(String oid) throws VciBaseException { |
| | | WebUtil.alertNotNull(oid,"actionç主é®"); |
| | | try { |
| | | PLAction action = UITools.getService() |
| | | PLAction action = platformClientUtil.getUIService() |
| | | .getPLActionById(oid); |
| | | if(action == null || StringUtils.isBlank(action.plOId)){ |
| | | throw new VciBaseException("è¿ä¸ªactionå¨ç³»ç»ä¸ä¸åå¨"); |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.common.oq.OQTool; |
| | | import com.vci.client.common.providers.ClientServiceProvider; |
| | | import com.vci.common.qt.object.*; |
| | | import com.vci.common.utility.ObjectUtility; |
| | | import com.vci.corba.common.PLException; |
| | |
| | | import com.vci.corba.query.data.BtmRefQueryOption; |
| | | import com.vci.corba.query.data.KV; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.annotation.Column; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.enumpck.BooleanEnum; |
| | |
| | | /** |
| | | * å·²ç»å建è¿çä¸å¡å¯¹è±¡ |
| | | */ |
| | | private static Map<String, ClientBusinessObject> hasCreatedCbos = new HashMap<String, ClientBusinessObject>(); |
| | | private static Map<String, BusinessObject> hasCreatedCbos = new HashMap<String, BusinessObject>(); |
| | | |
| | | /** |
| | | * ä¸å¡å¯¹è±¡é»è®¤å±æ§ |
| | |
| | | * @throws VciBaseException åå§ååºéçæ¯ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public ClientBusinessObject createCBOByBtmName(String btmName) |
| | | public BusinessObject createCBOByBtmName(String btmName) |
| | | throws VciBaseException { |
| | | if(btmName!=null){ |
| | | btmName = btmName.trim().toLowerCase(); |
| | |
| | | throw new VciBaseException(msgCodePrefix +"noHasUserid"); |
| | | } |
| | | try { |
| | | // ClientServiceProvider.getBOFService().initBusinessObject(btmName); å¯ä»¥è¿è¡æ¿æ¢ |
| | | hasCreatedCbos.put(btmName, createBusinessObject(btmName)); |
| | | } catch (Exception e) { |
| | | logger.error("å建ä¸å¡ç±»å对象",e); |
| | | throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); |
| | | } |
| | | } |
| | | ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); |
| | | BusinessObject cbo = cloneBusinessObject(hasCreatedCbos.get(btmName)); |
| | | return cbo; |
| | | } |
| | | |
| | |
| | | * @param boName ä¸å¡ç±»ååç§° |
| | | * @return ä¸å¡æ°æ®å¯¹è±¡ |
| | | */ |
| | | public ClientBusinessObject createBusinessObject(String boName) { |
| | | public BusinessObject createBusinessObject(String boName) throws PLException { |
| | | // ClientServiceProvider.getBOFService().initBusinessObject(boName); |
| | | OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); |
| | | String userName = WebUtil.getCurrentUserId(); |
| | | ClientBusinessObject bo = new ClientBusinessObject(); |
| | | bo.setOid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setNameoid((new ObjectUtility()).getNewObjectID36()); |
| | | bo.setBtmName(boName); |
| | | bo.setIsLastR(true); |
| | | bo.setIsFirstR(true); |
| | | bo.setIsFirstV(true); |
| | | bo.setIsLastV(true); |
| | | bo.setCreator(userName); |
| | | bo.setCreateTime(System.currentTimeMillis()); |
| | | bo.setLastModifier(userName); |
| | | bo.setLastModifyTime(System.currentTimeMillis()); |
| | | bo.setRevisionRule(btmTypeVO.getRevisionRuleId()); |
| | | bo.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); |
| | | BusinessObject bo = new BusinessObject(); |
| | | bo.oid = (new ObjectUtility()).getNewObjectID36(); |
| | | bo.revisionid = (new ObjectUtility()).getNewObjectID36(); |
| | | bo.nameoid = (new ObjectUtility()).getNewObjectID36(); |
| | | bo.btName = boName; |
| | | bo.isLastR = true; |
| | | bo.isFirstR = true; |
| | | bo.isFirstV = true; |
| | | bo.isLastV = true; |
| | | bo.creator = userName; |
| | | bo.createTime = System.currentTimeMillis(); |
| | | bo.modifier = userName; |
| | | bo.modifyTime = System.currentTimeMillis(); |
| | | bo.revisionRule = btmTypeVO.getRevisionRuleId(); |
| | | bo.versionRule = String.valueOf(btmTypeVO.getVersionRule()); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){ |
| | | OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionRuleId()); |
| | | bo.setRevisionValue(revisionRuleVO.getStartCode()); |
| | | bo.revisionValue = revisionRuleVO.getStartCode(); |
| | | } |
| | | |
| | | bo.setRevisionSeq((short) 1); |
| | | bo.setVersionSeq((short) 1); |
| | | bo.setVersionValue(getVersionValue(WebUtil.getInt(btmTypeVO.getVersionRule()))); |
| | | bo.setLctId(btmTypeVO.getLifeCycleId()); |
| | | bo.revisionSeq = (short) 1; |
| | | bo.versionSeq = (short) 1; |
| | | bo.versionValue = getVersionValue(WebUtil.getInt(btmTypeVO.getVersionRule())); |
| | | bo.lctId = btmTypeVO.getLifeCycleId(); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ |
| | | OsLifeCycleVO lifeCycleVO = lifeService.getLifeCycleById(btmTypeVO.getLifeCycleId()); |
| | | //todo æ æ³è·åæ°æ® |
| | | // bo.setLcStatus(lifeCycleVO.getStartStatus()); |
| | | bo.lcStatus = lifeCycleVO == null ? "" : lifeCycleVO.getStartStatus(); |
| | | } |
| | | bo.setId(""); |
| | | bo.setName(""); |
| | | bo.setDescription(""); |
| | | bo.setOwner(userName); |
| | | bo.id = ""; |
| | | bo.name = ""; |
| | | bo.description = ""; |
| | | bo.owner = userName; |
| | | // bo.setCheckinBy(userName); |
| | | bo.setCopyFromVersion(""); |
| | | bo.fromVersion = ""; |
| | | this.initTypeAttributeValue(bo,btmTypeVO); |
| | | return bo; |
| | | } |
| | |
| | | * @param cbo ä¸å¡æ°æ®å¯¹è±¡ |
| | | * @param btmTypeVO ä¸å¡ç±»åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | private void initTypeAttributeValue(ClientBusinessObject cbo,OsBtmTypeVO btmTypeVO) { |
| | | private void initTypeAttributeValue(BusinessObject cbo,OsBtmTypeVO btmTypeVO) { |
| | | Optional.ofNullable(btmTypeVO.getAttributes()).orElseGet(()->new ArrayList<>()).stream().forEach(attribute->{ |
| | | try { |
| | | cbo.setAttributeValueWithNoCheck(attribute.getId(),attribute.getDefaultValue()); |
| | | } catch (PLException vciError) { |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error("è®¾ç½®å±æ§çå¼çæ¶ååºç°äºé误",vciError); |
| | | } |
| | | } |
| | | ObjectTool.setBOAttributeValue(cbo,attribute.getId(),attribute.getDefaultValue()); |
| | | }); |
| | | } |
| | | |
| | |
| | | * @param cbo 以åçä¸å¡æ°æ®å¯¹è±¡ |
| | | * @return æ·è´åç对象 |
| | | */ |
| | | private ClientBusinessObject cloneClientBusinessObject(ClientBusinessObject cbo){ |
| | | private BusinessObject cloneBusinessObject(BusinessObject cbo){ |
| | | if(cbo !=null){ |
| | | BusinessObject businessObject = new BusinessObject(); |
| | | BusinessObject bo = cbo.getBusinessObject(); |
| | | businessObject.oid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.revisionid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.nameoid = new ObjectUtility().getNewObjectID36(); |
| | | businessObject.btName = bo.btName; |
| | | businessObject.isLastR = bo.isLastR; |
| | | businessObject.isFirstR = bo.isFirstR; |
| | | businessObject.isLastV = bo.isLastV; |
| | | businessObject.isFirstV = bo.isFirstV; |
| | | businessObject.btName = cbo.btName; |
| | | businessObject.isLastR = cbo.isLastR; |
| | | businessObject.isFirstR = cbo.isFirstR; |
| | | businessObject.isLastV = cbo.isLastV; |
| | | businessObject.isFirstV = cbo.isFirstV; |
| | | businessObject.creator = WebUtil.getCurrentUserId(); |
| | | businessObject.createTime = System.currentTimeMillis(); |
| | | businessObject.modifier = bo.modifier; |
| | | businessObject.modifyTime = bo.modifyTime; |
| | | businessObject.revisionRule = bo.revisionRule; |
| | | businessObject.versionRule = bo.versionRule; |
| | | businessObject.revisionSeq = bo.revisionSeq; |
| | | businessObject.revisionValue = bo.revisionValue; |
| | | businessObject.versionSeq = bo.versionSeq; |
| | | businessObject.versionValue = bo.versionValue; |
| | | businessObject.lctId = bo.lctId; |
| | | businessObject.lcStatus = bo.lcStatus; |
| | | businessObject.modifier = cbo.modifier; |
| | | businessObject.modifyTime = cbo.modifyTime; |
| | | businessObject.revisionRule = cbo.revisionRule; |
| | | businessObject.versionRule = cbo.versionRule; |
| | | businessObject.revisionSeq = cbo.revisionSeq; |
| | | businessObject.revisionValue = cbo.revisionValue; |
| | | businessObject.versionSeq = cbo.versionSeq; |
| | | businessObject.versionValue = cbo.versionValue; |
| | | businessObject.lctId = cbo.lctId; |
| | | businessObject.lcStatus = cbo.lcStatus; |
| | | businessObject.ts = System.currentTimeMillis(); |
| | | businessObject.id = bo.id; |
| | | businessObject.name = bo.name; |
| | | businessObject.description = bo.description; |
| | | businessObject.id = cbo.id; |
| | | businessObject.name = cbo.name; |
| | | businessObject.description = cbo.description; |
| | | businessObject.owner = businessObject.creator; |
| | | // businessObject.checkinBy = bo.checkinBy; |
| | | // businessObject.checkinTime = bo.checkinTime; |
| | | // businessObject.checkoutBy = bo.checkoutBy; |
| | | // businessObject.checkoutTime = bo.checkoutTime; |
| | | businessObject.fromVersion = bo.fromVersion; |
| | | if(bo.newAttrValList !=null){ |
| | | businessObject.newAttrValList = clone(bo.newAttrValList); |
| | | businessObject.fromVersion = cbo.fromVersion; |
| | | if(cbo.newAttrValList !=null){ |
| | | businessObject.newAttrValList = clone(cbo.newAttrValList); |
| | | } |
| | | if(bo.hisAttrValList !=null){ |
| | | businessObject.hisAttrValList = clone(bo.hisAttrValList); |
| | | if(cbo.hisAttrValList !=null){ |
| | | businessObject.hisAttrValList = clone(cbo.hisAttrValList); |
| | | } |
| | | ClientBusinessObject cbo2 = new ClientBusinessObject(); |
| | | cbo2.setBusinessObject(businessObject); |
| | | return cbo2; |
| | | return businessObject; |
| | | }else { |
| | | return null; |
| | | } |
| | |
| | | String fieldName = referInfo.split("\\.")[1].trim().toLowerCase(); |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put(fieldName,QueryOptionConstant.IN + "(" + WebUtil.toInSql(value.toArray(new String[0])) + ")"); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null, Arrays.asList(new String[]{"oid",fieldName})); |
| | | List<BusinessObject> cbos = queryCBO(btmName,conditionMap,null, Arrays.asList(new String[]{"oid",fieldName})); |
| | | |
| | | Map<String,String> data = new HashMap<String, String>(); |
| | | if(cbos!=null && cbos.size() > 0){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | data.put(cbo.getAttributeValue(fieldName),cbo.getOid()); |
| | | for(BusinessObject cbo : cbos){ |
| | | data.put(ObjectTool.getBOAttributeValue(cbo,fieldName),cbo.oid); |
| | | } |
| | | } |
| | | return data; |
| | |
| | | throw new VciBaseException("屿§" + columnName + "çå¼ä¸ºç©º"); |
| | | } |
| | | conditionMap.put(columnName,QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oidSet.toArray(new String[0])) + ")"); |
| | | List<ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); |
| | | List<BusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); |
| | | if(cbos !=null && cbos.size() >0){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | String oid = cbo.getAttributeValue(columnName); |
| | | for(BusinessObject cbo : cbos){ |
| | | String oid = ObjectTool.getBOAttributeValue(cbo,columnName); |
| | | if(oidSet.contains(oid)){ |
| | | oidSet.remove(oid); |
| | | } |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¯æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBO(String btmType, |
| | | public List<BusinessObject> queryCBO(String btmType, |
| | | Map<String, String> conditionMap) throws VciBaseException { |
| | | List<String> clauseList = new ArrayList<String>(); |
| | | clauseList.add("*"); |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¯æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBO(String btmType, |
| | | public List<BusinessObject> queryCBO(String btmType, |
| | | Map<String, String> conditionMap, PageHelper ph) |
| | | throws VciBaseException { |
| | | List<String> clauseList = new ArrayList<String>(); |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¯æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBO(String btmType, |
| | | public List<BusinessObject> queryCBO(String btmType, |
| | | Map<String, String> conditionMap, PageHelper ph, |
| | | List<String> clauseList) throws VciBaseException { |
| | | QueryTemplate qt = new QueryTemplate(); |
| | |
| | | * @return æ¥è¯¢åºæ¥çå¼ |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private List<ClientBusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ |
| | | List<ClientBusinessObject> allCbos = new ArrayList<ClientBusinessObject>(); |
| | | private List<BusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ |
| | | List<BusinessObject> allCbos = new ArrayList<BusinessObject>(); |
| | | if(clauseList == null){ |
| | | clauseList = new ArrayList<String>(); |
| | | clauseList.add("*"); |
| | |
| | | ObjectQueryService.FindBTMObjectsV3Result bos = qtService.findBTMObjectsV3(qt.getId(), OQTool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[refOpts.size()])); |
| | | if (bos != null && bos.count > 0) { |
| | | for (BusinessObject bo : bos.returnValue) { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | cbo.setBusinessObject(bo); |
| | | queryEnumText(cbo,enumAttrName); |
| | | allCbos.add(cbo); |
| | | // BusinessObject cbo = new BusinessObject(); |
| | | // cbo = bo; |
| | | queryEnumText(bo,enumAttrName); |
| | | // allCbos.add(cbo); |
| | | } |
| | | //å 为修æ¹äºæ¥è¯¢çæ¹å¼ï¼æä»¥å°±ä¸éè¦åç¬æ¥è¯¢åç
§ |
| | | } |
| | |
| | | * æ¥è¯¢çå½å¨æçå¼ |
| | | * @param cbos ä¸å¡å¯¹è±¡ |
| | | */ |
| | | private void queryLcStatus(List<ClientBusinessObject> cbos){ |
| | | private void queryLcStatus(List<BusinessObject> cbos){ |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | |
| | | Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap(); |
| | | cbos.stream().forEach(cbo->{ |
| | | try{ |
| | | cbo.setAttributeValueWithNoCheck("lcStatus_text", statusVOMap.getOrDefault(cbo.getLcStatus(),new OsStatusVO()).getName()); |
| | | ObjectTool.setBOAttributeValue(cbo,"lcStatus_text", statusVOMap.getOrDefault(cbo.lcStatus,new OsStatusVO()).getName()); |
| | | }catch(Exception e){ |
| | | logger.error("è·åçå½å¨æä¸ç¶æçæ¾ç¤ºææ¬åºé",e); |
| | | } |
| | |
| | | * @param enumAttrName æä¸¾å±æ§çå¼ |
| | | * @throws VciBaseException |
| | | */ |
| | | private void queryEnumText(ClientBusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ |
| | | private void queryEnumText(BusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ |
| | | queryEnumText(cbo,null,enumAttrName); |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException æ¥è¯¢æä¸¾åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void queryEnumText(ClientBusinessObject cbo, ClientLinkObject clo, List<String> enumAttrName) throws VciBaseException{ |
| | | public void queryEnumText(BusinessObject cbo, LinkObject clo, List<String> enumAttrName) throws VciBaseException{ |
| | | if(enumAttrName.size()>0){//æ¥è¯¢æä¸¾ |
| | | for(String enumAttr:enumAttrName){//æ ¼å¼ä¸º code_field codeæ¯æä¸¾çç¼ç ï¼fieldæ¯å½åä¸å¡ç±»åå卿䏾å¼çåæ®µ |
| | | if(enumAttr.toLowerCase().equals("creator_name")){ |
| | | //å建人çåç§° |
| | | String creator = ""; |
| | | if(cbo!=null){ |
| | | creator = cbo.getCreator(); |
| | | creator = cbo.creator; |
| | | }else{ |
| | | creator = clo.getCreator(); |
| | | creator = clo.creator; |
| | | } |
| | | if(StringUtils.isNotBlank(creator)){ |
| | | String userTrueName = userQueryService.getUserNameByUserId(creator); |
| | |
| | | //æåä¿®æ¹äººåç§° |
| | | String modifier = ""; |
| | | if(cbo!=null){ |
| | | modifier = cbo.getLastModifier(); |
| | | modifier = cbo.modifier; |
| | | }else{ |
| | | modifier = clo.getLastModifier(); |
| | | modifier = clo.modifier; |
| | | } |
| | | if(StringUtils.isNotBlank(modifier)){ |
| | | String userTrueName = userQueryService.getUserNameByUserId(modifier); |
| | |
| | | if(fields.contains("_")){ |
| | | String valueField = ""; |
| | | valueField = fields.split("_")[0]; |
| | | String value = cbo.getAttributeValue(valueField); |
| | | String value = ObjectTool.getBOAttributeValue(cbo,valueField);; |
| | | if(StringUtils.isNotBlank(value)){ |
| | | String userTrueName = userQueryService.getUserNameByUserId(value); |
| | | setValueToCboOrClo(cbo,clo,enumAttr,userTrueName); |
| | |
| | | } |
| | | String enumKey = ""; |
| | | if (cbo != null) { |
| | | enumKey = cbo.getAttributeValue(valueFieldName); |
| | | enumKey = ObjectTool.getBOAttributeValue(cbo,valueFieldName); |
| | | } else if (clo != null) { |
| | | enumKey = clo.getAttributeValue(valueFieldName); |
| | | enumKey = ObjectTool.getLOAttributeValue(clo,valueFieldName); |
| | | } |
| | | String enumText = ""; |
| | | if (WebUtil.isNotNull(enumKey)) { |
| | |
| | | * @param attr 屿§å |
| | | * @param value å¼ |
| | | */ |
| | | private void setValueToCboOrClo(ClientBusinessObject cbo,ClientLinkObject clo,String attr,String value){ |
| | | private void setValueToCboOrClo(BusinessObject cbo,LinkObject clo,String attr,String value){ |
| | | try { |
| | | if (cbo != null) { |
| | | cbo.setAttributeValueWithNoCheck(attr, value); |
| | | ObjectTool.setBOAttributeValue(cbo, attr, value); |
| | | }else{ |
| | | setAttributeValueForClo(clo,attr, value); |
| | | } |
| | |
| | | * @param attributeValue 屿§çå¼ |
| | | */ |
| | | @Override |
| | | public void setAttributeValueForClo(ClientLinkObject clo, String attributeName, String attributeValue) { |
| | | AttributeValue[] attrValues = clo.getLinkObject().newAttrValList; |
| | | public void setAttributeValueForClo(LinkObject clo, String attributeName, String attributeValue) { |
| | | AttributeValue[] attrValues = clo.newAttrValList; |
| | | ArrayList<AttributeValue> attrValList = new ArrayList(); |
| | | AttributeValue attrVal; |
| | | int i; |
| | |
| | | attrValList.add(attrVal); |
| | | } |
| | | |
| | | clo.getLinkObject().newAttrValList = (AttributeValue[]) attrValList.toArray(new AttributeValue[attrValList.size()]); |
| | | clo.newAttrValList = attrValList.toArray(new AttributeValue[attrValList.size()]); |
| | | } |
| | | |
| | | |
| | |
| | | * @param enumAttrName æä¸¾å±æ§ |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private void queryEnumTextClo(ClientLinkObject clo,List<String> enumAttrName) throws VciBaseException{ |
| | | private void queryEnumTextClo(LinkObject clo,List<String> enumAttrName) throws VciBaseException{ |
| | | queryEnumText(null,clo,enumAttrName); |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | public List<BusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap) |
| | | throws VciBaseException { |
| | | PageHelper ph = new PageHelper(-1); |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | public List<BusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | PageHelper ph) throws VciBaseException { |
| | | List<String> clauseList = new ArrayList<String>(); |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, |
| | | public List<BusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | PageHelper ph, List<String> clauseList) throws VciBaseException { |
| | | QueryTemplate qt = getQtByName(queryScheme,replaceMap); |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryBySql(String sql, |
| | | public List<BusinessObject> queryBySql(String sql, |
| | | Map<String, String> conditionMap) throws VciBaseException { |
| | | List<Map> allData = queryBySqlForMap(sql,conditionMap); |
| | | if(allData == null || allData.size() == 0){ |
| | | return new ArrayList<ClientBusinessObject>(); |
| | | return new ArrayList<BusinessObject>(); |
| | | }else{ |
| | | return map2Cbos(allData); |
| | | } |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéæ´»æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException{ |
| | | public List<BusinessObject> queryByOnlySql(String sql) throws VciBaseException{ |
| | | List<Map> allData = queryByOnlySqlForMap(sql); |
| | | if(allData == null || allData.size() == 0){ |
| | | return new ArrayList<ClientBusinessObject>(); |
| | | return new ArrayList<BusinessObject>(); |
| | | }else{ |
| | | return map2Cbos(allData); |
| | | } |
| | |
| | | allFieldAttrMap.put(columnName.toLowerCase(),fieldName); |
| | | } |
| | | List<T> allObject = new ArrayList<T>(); |
| | | List<ClientBusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//æ§è¡æ¥è¯¢ |
| | | List<BusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//æ§è¡æ¥è¯¢ |
| | | List<String> oids = new ArrayList<String>(); |
| | | |
| | | if(allCbos!=null&&allCbos.size()>0){ |
| | | for(ClientBusinessObject cbo : allCbos){ |
| | | for(BusinessObject cbo : allCbos){ |
| | | T obj = null; |
| | | try { |
| | | obj = c.newInstance(); |
| | |
| | | } catch (IllegalAccessException e) { |
| | | } |
| | | if(obj !=null){ |
| | | oids.add(cbo.getOid()); |
| | | oids.add(cbo.oid); |
| | | allObject.add(obj); |
| | | } |
| | | } |
| | |
| | | allFieldAttrMap.put(columnName.toLowerCase(),fieldName); |
| | | } |
| | | List<T> allObject = new ArrayList<T>(); |
| | | List<ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); |
| | | List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); |
| | | List<String> oids = new ArrayList<String>(); |
| | | if(allCbos!=null&&allCbos.size()>0){ |
| | | for(ClientBusinessObject cbo : allCbos){ |
| | | for(BusinessObject cbo : allCbos){ |
| | | T obj = null; |
| | | try { |
| | | obj = c.newInstance(); |
| | |
| | | } catch (IllegalAccessException e) { |
| | | } |
| | | if(obj !=null){ |
| | | oids.add(cbo.getOid()); |
| | | oids.add(cbo.oid); |
| | | allObject.add(obj); |
| | | } |
| | | } |
| | |
| | | * @param isEdit æ¯å¦ä¸ºç¼è¾ |
| | | * @throws VciBaseException 设置åºé伿åºå¼å¸¸ |
| | | */ |
| | | private void setValueToCbo(Object obj,String btmType,ClientBusinessObject cbo ,boolean isEdit) throws VciBaseException{ |
| | | private void setValueToCbo(Object obj,String btmType,BusinessObject cbo ,boolean isEdit) throws VciBaseException{ |
| | | Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); |
| | | if(pkField == null){ |
| | | throw new VciBaseException("{0}ç±»ä¸æ²¡æå®ä¹ä¸»é®å±æ§",new Object[]{obj.getClass()}); |
| | |
| | | //ä¸»é® |
| | | Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); |
| | | if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ |
| | | WebUtil.setValueToField(pkField.getName(), obj, cbo.getOid()); |
| | | pkValue = cbo.getOid(); |
| | | WebUtil.setValueToField(pkField.getName(), obj, cbo.oid); |
| | | pkValue = cbo.oid; |
| | | }else{ |
| | | cbo.setOid(pkValue.toString()); |
| | | cbo.oid = pkValue.toString(); |
| | | } |
| | | //è¿è¡é空ï¼é¿åº¦ï¼éå¤çæ ¡éªããæ ¡éªéè¿çèµå¼ |
| | | Map<String,String> fieldMap = WebUtil.getFieldNameMap(obj.getClass()); |
| | |
| | | //说æä¸è½éå¤ï¼é£ä¹å°±éè¦æ¥è¯¢ä¸ä¸ |
| | | Map<String,String> queryRepeatMap = getOneQuery(attrName, value); |
| | | if(isEdit){ |
| | | queryRepeatMap.put("oid", QueryOptionConstant.NOTEQUAL + cbo.getOid()); |
| | | queryRepeatMap.put("oid", QueryOptionConstant.NOTEQUAL + cbo.oid); |
| | | } |
| | | if(queryCount(btmType, queryRepeatMap)>0){ |
| | | throw new VciBaseException("{0}åæ®µçå¼{1}å¨ç³»ç»ä¸å·²ç»åå¨", new Object[]{columnText,value}); |
| | |
| | | if(isEdit && checkUnAttrUnEdit(attrName)){ |
| | | //ç¼è¾çæ¶åï¼TSåOIDä¸è½è®¾ç½®.å 为平å°é£æ¥å£è®¾ç½®äºå°±ä¼æ¥é |
| | | }else { |
| | | try { |
| | | //éè¦å¤ææ¯å¦é»è®¤ç屿§ï¼å¦ææ¯é»è®¤å±æ§ï¼å使ç¨å¯¹è±¡çèµå¼çæ¹å¼ |
| | | if (WebUtil.isDefaultField(fieldName) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) { |
| | | WebUtil.setValueToField(fieldName, cbo, value); |
| | | cbo.setAttributeValueWithNoCheck(attrName.toLowerCase(), value); |
| | | ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value); |
| | | } else { |
| | | cbo.setAttributeValueWithNoCheck(attrName.toLowerCase(), value); |
| | | } |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value); |
| | | } |
| | | } |
| | | } |
| | |
| | | if(list==null){ |
| | | throw new VciBaseException(VciBaseException.paramNull); |
| | | } |
| | | Set<ClientBusinessObject> allCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<BusinessObject> allCbos = new HashSet<BusinessObject>(); |
| | | for(T obj : list){ |
| | | //éè¦å¤çé»è®¤å¼ |
| | | Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); |
| | |
| | | throw new VciBaseException("{0}å¯¹è±¡ä¸æ²¡æè®¾ç½®ä¸»é®ç屿§",new Object[]{obj.getClass()}); |
| | | } |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | | ClientBusinessObject cbo = createCBOByBtmName(btmType); |
| | | BusinessObject cbo = createCBOByBtmName(btmType); |
| | | setValueToCbo(obj,btmType,cbo,false); |
| | | allCbos.add(cbo); |
| | | } |
| | |
| | | if(list==null){ |
| | | throw new VciBaseException(VciBaseException.paramNull); |
| | | } |
| | | Set<ClientBusinessObject> allUpdateCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<ClientBusinessObject> allAddCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<BusinessObject> allUpdateCbos = new HashSet<BusinessObject>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | Set<BusinessObject> allAddCbos = new HashSet<BusinessObject>(); |
| | | Map<String,String> btmOidsMap = new HashMap<String, String>(); |
| | | for(T obj : list){ |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | |
| | | } |
| | | btmOidsMap.put(btmType, tempOids); |
| | | } |
| | | List<ClientBusinessObject> needUpdateCbos = new ArrayList<ClientBusinessObject>(); |
| | | List<BusinessObject> needUpdateCbos = new ArrayList<BusinessObject>(); |
| | | Iterator<String> it = btmOidsMap.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | | String btmType = it.next(); |
| | |
| | | } |
| | | //ä¸»é® |
| | | Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); |
| | | ClientBusinessObject cbo = null; |
| | | BusinessObject cbo = null; |
| | | if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ |
| | | continue; |
| | | }else{ |
| | | for(ClientBusinessObject tempCbo : needUpdateCbos){ |
| | | if(tempCbo.getOid().equalsIgnoreCase(pkValue.toString().trim())){ |
| | | for(BusinessObject tempCbo : needUpdateCbos){ |
| | | if(tempCbo.oid.equalsIgnoreCase(pkValue.toString().trim())){ |
| | | cbo = tempCbo; |
| | | break; |
| | | } |
| | |
| | | } |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | | //æ·è´ä¹åå
æ¸
é¤å·²ç»æçå¼ |
| | | cbo.getBusinessObject().newAttrValList = new AttributeValue[0]; |
| | | cbo.newAttrValList = new AttributeValue[0]; |
| | | setValueToCbo(obj,btmType,cbo,true); |
| | | allUpdateCbos.add(cbo); |
| | | } |
| | |
| | | if(list==null){ |
| | | throw new VciBaseException(VciBaseException.paramNull); |
| | | } |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); |
| | | for(Object obj : list){ |
| | | //æå¯è½ä¸å±äºåä¸ä¸ªä¸å¡ç±»åä¸ |
| | | Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); |
| | |
| | | String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); |
| | | String pkValue = WebUtil.getValueFromFieldForCbo(pkField, obj); |
| | | //æä»¥è¿é乿¯ç´æ¥æ¥è¯¢çå个' |
| | | List<ClientBusinessObject> deleteCbos = queryCBO(btmType, getOneQuery( |
| | | List<BusinessObject> deleteCbos = queryCBO(btmType, getOneQuery( |
| | | WebUtil.getCboAttrNameFromField(pkField, obj.getClass()), pkValue)); |
| | | if(deleteCbos!=null){ |
| | | allDeleteCbos.addAll(deleteCbos); |
| | |
| | | * @param btmBos ä¸å¡æ°æ® |
| | | * @throws VciBaseException 被å¼ç¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private void checkCanDelete(Map<String,List<ClientBusinessObject>> btmBos) throws VciBaseException{ |
| | | private void checkCanDelete(Map<String,List<BusinessObject>> btmBos) throws VciBaseException{ |
| | | //æ¥æ¾è¡¨æ¯å¦è¢«å
¶ä»ç屿§å¼ç¨ |
| | | if(!btmBos.isEmpty()){ |
| | | Iterator<String> it = btmBos.keySet().iterator(); |
| | |
| | | List<OsUsedAttributeVO> usedAttrVOs = btmService.listBtmUsedInfo(btmType); |
| | | |
| | | Map<String, List<OsUsedAttributeVO>> allReferAttr = Optional.ofNullable(usedAttrVOs).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.groupingBy(s -> s.getPkBtmType())); |
| | | List<ClientBusinessObject> thisBtmTypeBo = btmBos.get(btmType); |
| | | List<BusinessObject> thisBtmTypeBo = btmBos.get(btmType); |
| | | if(thisBtmTypeBo.size()== 0){ |
| | | return; |
| | | } |
| | | String oids = ""; |
| | | for(ClientBusinessObject cbo : thisBtmTypeBo){ |
| | | oids += "'" + cbo.getOid() + "',"; |
| | | for(BusinessObject cbo : thisBtmTypeBo){ |
| | | oids += "'" + cbo.oid + "',"; |
| | | } |
| | | oids = WebUtil.removeComma(oids); |
| | | if(!allReferAttr.isEmpty()){ |
| | |
| | | conditionMap = new HashMap<String, String>(); |
| | | } |
| | | conditionMap.put(QUERY_FILTER_SECRET,BooleanEnum.FASLE.getValue());//æ¥è¯¢çæ¶åä¸è½æ¥è¯¢å¯çº§ |
| | | List<ClientBusinessObject> allCbos = queryCBO(btmType, conditionMap); |
| | | List<BusinessObject> allCbos = queryCBO(btmType, conditionMap); |
| | | BatchCBO batchCbo = new BatchCBO(); |
| | | if(allCbos.size()>0){ |
| | | Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); |
| | | Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); |
| | | btmBos.put(btmType, allCbos); |
| | | checkCanDelete(btmBos); |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | allDeleteCbos.addAll(allCbos); |
| | | batchCbo.setDeleteCbos(allDeleteCbos); |
| | | } |
| | |
| | | selectSql += ",btmname "; |
| | | } |
| | | sql = selectSql + fromSql; |
| | | List<ClientBusinessObject> allDelete =queryBySql(sql, conditionMap); |
| | | List<BusinessObject> allDelete =queryBySql(sql, conditionMap); |
| | | if(allDelete.size() == 0){ |
| | | return batchCbo;//没æå é¤ä»»ä½æ°æ® |
| | | } |
| | | //æ¾btmType; |
| | | String btmType = allDelete.get(0).getAttributeValue("btmName"); |
| | | Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); |
| | | String btmType = ObjectTool.getBOAttributeValue(allDelete.get(0),"btmName"); |
| | | Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); |
| | | btmBos.put(btmType, allDelete); |
| | | checkCanDelete(btmBos); |
| | | Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); |
| | | Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); |
| | | //æä»¬éè¦ä»åå°æ¥è¯¢æ´ä¸ªçå
容æå¯ä»¥æ§è¡å é¤ï¼ |
| | | String oids = ""; |
| | | for(ClientBusinessObject cbo : allDelete){ |
| | | oids += "'" + cbo.getOid() + "',"; |
| | | for(BusinessObject cbo : allDelete){ |
| | | oids += "'" + cbo.oid + "',"; |
| | | } |
| | | conditionMap.clear(); |
| | | conditionMap.put("oid", QueryOptionConstant.IN + "(" + WebUtil.removeComma(oids) + ")"); |
| | | List<ClientBusinessObject> inDbCbos = queryCBO(btmType, conditionMap); |
| | | List<BusinessObject> inDbCbos = queryCBO(btmType, conditionMap); |
| | | |
| | | allDeleteCbos.addAll(inDbCbos); |
| | | batchCbo.setDeleteCbos(allDeleteCbos); |
| | |
| | | Map<String,String> conditionMap = getOneQuery("oid", pkValue); |
| | | List<String> causeList = new ArrayList<>(); |
| | | causeList.add("ts"); |
| | | List<ClientBusinessObject> cbos = queryCBO(WebUtil.getBtmTypeByObject(obj.getClass()), conditionMap,new PageHelper(-1),causeList); |
| | | List<BusinessObject> cbos = queryCBO(WebUtil.getBtmTypeByObject(obj.getClass()), conditionMap,new PageHelper(-1),causeList); |
| | | if(CollectionUtils.isEmpty(cbos)){ |
| | | return false; |
| | | } |
| | | if(ts.contains(".")){ |
| | | ts = ts.substring(0,ts.lastIndexOf(".")); |
| | | } |
| | | return cbos.get(0).getTs() == Long.valueOf(ts); |
| | | return cbos.get(0).ts == Long.valueOf(ts); |
| | | } |
| | | |
| | | /** |
| | |
| | | ph = new PageHelper(-1); |
| | | ph.setQueryTotal(true); |
| | | } |
| | | List<ClientBusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList); |
| | | List<BusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList); |
| | | DataGrid dg = new DataGrid(); |
| | | if(allCbos.size()>0){ |
| | | List<Map> mapList = cbos2Map(allCbos); |
| | |
| | | if(ph == null){ |
| | | ph = new PageHelper(-1,true); |
| | | } |
| | | List<ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap,replaceMap, ph, clauseList); |
| | | List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap,replaceMap, ph, clauseList); |
| | | DataGrid dg = new DataGrid(); |
| | | if(allCbos.size()>0){ |
| | | List<Map> mapList = cbos2Map(allCbos); |
| | |
| | | } |
| | | |
| | | /** |
| | | * ClientBusinessObject 转为HashMap |
| | | * BusinessObject 转为HashMap |
| | | * @param cbos CBOS |
| | | * @return map |
| | | * @throws VciBaseException 转æ¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<Map> cbos2Map(List<ClientBusinessObject> cbos) |
| | | public List<Map> cbos2Map(List<BusinessObject> cbos) |
| | | throws VciBaseException { |
| | | List<Map> mapList = new ArrayList<Map>(); |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | for(BusinessObject cbo : cbos){ |
| | | mapList.add(cbo2Map(cbo)); |
| | | } |
| | | return mapList; |
| | | } |
| | | |
| | | /** |
| | | * ClientBusinessObject 转为HashMap |
| | | * BusinessObject 转为HashMap |
| | | * @param cbo ä¸å¡æ°æ®å¯¹è±¡ |
| | | * @return map |
| | | * @throws VciBaseException 转æ¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public Map cbo2Map(ClientBusinessObject cbo) throws VciBaseException { |
| | | public Map cbo2Map(BusinessObject cbo) throws VciBaseException { |
| | | Map<String,String> map = new HashMap<String, String>(); |
| | | WebUtil.copyValueToMapFromCbos(cbo, map); |
| | | return map; |
| | |
| | | |
| | | |
| | | /** |
| | | * map转为clientBusinessObject |
| | | * map转为BusinessObject |
| | | * @param mapList mapå表 |
| | | * @return ä¸å¡æ°æ®å表 |
| | | * @throws VciBaseException 转æ¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> map2Cbos(List<Map> mapList) |
| | | public List<BusinessObject> map2Cbos(List<Map> mapList) |
| | | throws VciBaseException { |
| | | List<ClientBusinessObject> cboList = new ArrayList<ClientBusinessObject>(); |
| | | List<BusinessObject> cboList = new ArrayList<BusinessObject>(); |
| | | for(Map map : mapList){ |
| | | cboList.add(map2Cbo(map)); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * map转为clientBusinessObject |
| | | * map转为BusinessObject |
| | | * @param map map |
| | | * @return ä¸å¡æ°æ® |
| | | * @throws VciBaseException 转æ¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public ClientBusinessObject map2Cbo(Map map) throws VciBaseException { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | public BusinessObject map2Cbo(Map map) throws VciBaseException { |
| | | BusinessObject cbo = new BusinessObject(); |
| | | WebUtil.copyValueToCboFromMap(cbo, map); |
| | | return cbo; |
| | | } |
| | |
| | | * @param cbos 客æ·ç«¯å¯¹è±¡ |
| | | * @return ä¸å¡å¯¹è±¡ |
| | | */ |
| | | private BusinessObject[] cboArray2Bo(ClientBusinessObject[] cbos){ |
| | | private BusinessObject[] cboArray2Bo(BusinessObject[] cbos){ |
| | | if(cbos == null ||cbos.length == 0){ |
| | | return new BusinessObject[0]; |
| | | } |
| | | BusinessObject[] bos = new BusinessObject[cbos.length]; |
| | | for(int i = 0; i < cbos.length; i++){ |
| | | bos[i] = cbos[i].getBusinessObject(); |
| | | bos[i] = cbos[i]; |
| | | } |
| | | return bos; |
| | | } |
| | |
| | | * @param clos 客æ·ç«¯å¯¹è±¡ |
| | | * @return ä¸å¡å¯¹è±¡ |
| | | */ |
| | | private LinkObject[] cloArray2Lo(ClientLinkObject[] clos){ |
| | | private LinkObject[] cloArray2Lo(LinkObject[] clos){ |
| | | if(clos == null ||clos.length == 0){ |
| | | return new LinkObject[0]; |
| | | } |
| | | LinkObject[] bos = new LinkObject[clos.length]; |
| | | for(int i = 0; i < clos.length; i++){ |
| | | bos[i] = clos[i].getLinkObject(); |
| | | bos[i] = clos[i]; |
| | | } |
| | | return bos; |
| | | } |
| | |
| | | * å 餿䏾ååç
§ç屿§ |
| | | * @param cbos ä¸å¡æ°æ® |
| | | */ |
| | | private void deleteReferAttrInCbo(Set<ClientBusinessObject> cbos){ |
| | | private void deleteReferAttrInCbo(Set<BusinessObject> cbos){ |
| | | if(cbos !=null){ |
| | | for(ClientBusinessObject cbo : cbos){ |
| | | BusinessObject bo = cbo.getBusinessObject(); |
| | | for(BusinessObject cbo : cbos){ |
| | | BusinessObject bo = cbo; |
| | | List<AttributeValue> newAttr = new ArrayList<AttributeValue>(); |
| | | if (bo.newAttrValList != null) { |
| | | for (int i = 0; i < bo.newAttrValList.length; ++i) { |
| | |
| | | } |
| | | } |
| | | bo.newAttrValList = newAttr.toArray(new AttributeValue[0]); |
| | | cbo.setBusinessObject(bo); |
| | | cbo = bo; |
| | | } |
| | | } |
| | | } |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ°æ®ä¸åå¨ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public ClientBusinessObject selectCBOByOid(String oid, String btmName) throws VciBaseException { |
| | | public BusinessObject selectCBOByOid(String oid, String btmName) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(oid,"主é®",btmName,"ä¸å¡ç±»å"); |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("oid", oid.trim()); |
| | | List<ClientBusinessObject> cbos = queryCBO(btmName, conditionMap); |
| | | List<BusinessObject> cbos = queryCBO(btmName, conditionMap); |
| | | if(CollectionUtils.isEmpty(cbos)){ |
| | | throw new VciBaseException("æ°æ®å¨ç³»ç»ä¸ä¸åå¨{0}",new String[]{oid}); |
| | | } |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ¥è¯¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<ClientBusinessObject> selectCBOByOidCollection(Collection<String> oidCollection, String btmName) throws VciBaseException { |
| | | public List<BusinessObject> selectCBOByOidCollection(Collection<String> oidCollection, String btmName) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(oidCollection,"主é®éå",btmName,"ä¸å¡ç±»å"); |
| | | Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(oidCollection); |
| | | List<ClientBusinessObject> doList = new ArrayList<ClientBusinessObject>(); |
| | | List<BusinessObject> doList = new ArrayList<BusinessObject>(); |
| | | |
| | | for(Collection<String> oids: oidCollections){ |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | List<ClientBusinessObject> list = queryCBO(btmName, conditionMap); |
| | | List<BusinessObject> list = queryCBO(btmName, conditionMap); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | throw new VciBaseException("{0}æ¡æ°æ®å¨ç³»ç»ä¸ä¸åå¨",new String[]{String.valueOf(oids.size())}); |
| | | } |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.omd.linktype.util.Tool; |
| | | import com.vci.client.omd.provider.BtmProvider; |
| | | import com.vci.client.omd.provider.LinkTypeProvider; |
| | | import com.vci.client.common.providers.WebServiceProvider; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.atm.AttributeDef; |
| | | import com.vci.corba.omd.btm.BTMServicePrx; |
| | |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*; |
| | | import static com.vci.omd.constants.AttributeConstants.*; |
| | | |
| | | |
| | | /** |
| | |
| | | btmService.addBizType(btmItem); |
| | | //æ§è¡å®æäºéè¦å建表 |
| | | //è·åçæ¶åä¸ä¸å®å·æ°äºç¼åï¼è¿æ ·å°±è·åä¸å°ä¿¡æ¯ |
| | | String btmTableName = BtmProvider.getInstance().getBTTableName(btmItem.name); |
| | | //OmdHelper |
| | | //todo æ¤å æ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String btmTableName = BtmProvider.getInstance().getBTTableName(btmItem.name); |
| | | String btmTableName = null; |
| | | String sql = "create Table " + btmTableName + "(" + "\n\tOID VARCHAR2(36) not null,\n\tREVISIONOID VARCHAR2(36),\n\tNAMEOID VARCHAR2(36),\n\tBtmName VARCHAR2(36),\n\tISLastR CHAR(1),\n\tISFirstR CHAR(1),\n\tISLastV CHAR(1),\n\tISFirstV CHAR(1),\n\tCreator VARCHAR2(36),\n\tCreateTime TIMESTAMP,\n\tLastModifier VARCHAR2(36),\n\tLastModifyTime TIMESTAMP,\n\tRevisionRule VARCHAR2(36),\n\tVersionRule VARCHAR2(36),\n\tRevisionSeq NUMBER,\n\tRevisionValue VARCHAR2(10),\n\tVersionSeq NUMBER,\n\tVersionValue VARCHAR2(10),\n\tLCTID VARCHAR2(36),\n\tLCStatus VARCHAR2(36),\n\tTS TIMESTAMP,\n\tID VARCHAR2(36),\n\tNAME VARCHAR2(128),\n\tDESCRIPTION VARCHAR2(255),\n\tOWNER VARCHAR2(36),\n\tCHECKINBY VARCHAR2(36),\n\tCHECKINTIME TIMESTAMP,\n\tCHECKOUTBY VARCHAR2(36),\n\tCHECKOUTTIME TIMESTAMP,\n\tCOPYFROMVERSION VARCHAR2(36),\n\t"; |
| | | String[] apNameArray = btmItem.apNameArray; |
| | | if(apNameArray!=null && apNameArray.length>0){ |
| | | for(String attrId : apNameArray){ |
| | | OsAttributeVO attrVO = attributeMap.get(attrId.toLowerCase().trim()); |
| | | if(attrVO!=null) { |
| | | String abSql = Tool.getInstance().getAbSql(attrService.attributeVO2DO(attrVO)); |
| | | sql = sql + abSql; |
| | | //todo æ¤å æ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String abSql = Tool.getInstance().getAbSql(attrService.attributeVO2DO(attrVO)); |
| | | // sql = sql + abSql; |
| | | }else{ |
| | | logger.info("ä¸å¡ç±»å{}éç屿§{}没æ¾å°",btmTableName,attrId.toLowerCase().trim()); |
| | | } |
| | | } |
| | | } |
| | | String alterSql = BtmProvider.getInstance().getAddPKSql(btmItem.name); |
| | | // String alterSql = BtmProvider.getInstance().getAddPKSql(btmItem.name); |
| | | sql = sql.substring(0, sql.lastIndexOf(",")); |
| | | sql = sql + "\n)"; |
| | | //TODO ææ¶ä¸æ¸
æ¥ç¨ä½ç§æ¹å¼åå»ºè¡¨ï¼æ¤å¤å
æ³¨éæ |
| | |
| | | */ |
| | | private void addAttrToDB(Collection<String> addedAbList,String btmType,boolean linkType){ |
| | | if (!CollectionUtils.isEmpty(addedAbList)) { |
| | | String tableName = linkType? LinkTypeProvider.getInstance().getLTTableName(btmType):BtmProvider.getInstance().getBTTableName(btmType); |
| | | //todo æ¤ææ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String tableName = linkType? LinkTypeProvider.getInstance().getLTTableName(btmType):BtmProvider.getInstance().getBTTableName(btmType); |
| | | String tableName = null; |
| | | String addSql = "alter table " + tableName + " add("; |
| | | Map<String, OsAttributeVO> attributeMap = attrService.selectAllAttributeMap(); |
| | | for (String abName : addedAbList) { |
| | | AttributeDef abItem = attrService.attributeVO2DO(attributeMap.get(abName)); |
| | | addSql = addSql + Tool.getInstance().getAbSql(abItem); |
| | | //todo æ¤ææ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // addSql = addSql + Tool.getInstance().getAbSql(abItem); |
| | | } |
| | | addSql = VciBaseUtil.removeComma(addSql.replace("\n\t","")); |
| | | addSql = addSql + ")"; |
| | |
| | | */ |
| | | private void removeAttrToDB(Collection<String> removeAbList,String btmType,boolean linkType){ |
| | | if (!CollectionUtils.isEmpty(removeAbList)) { |
| | | String tableName = linkType?LinkTypeProvider.getInstance().getLTTableName(btmType):BtmProvider.getInstance().getBTTableName(btmType); |
| | | String removeSql = "alter table " + tableName + " drop("; |
| | | for (String abName : removeAbList) { |
| | | removeSql = removeSql + abName + ","; |
| | | } |
| | | removeSql = VciBaseUtil.removeComma(removeSql.replace("\n\t","")); |
| | | removeSql = removeSql + ")"; |
| | | //todo æ¤ææ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String tableName = linkType?LinkTypeProvider.getInstance().getLTTableName(btmType):BtmProvider.getInstance().getBTTableName(btmType); |
| | | // String removeSql = "alter table " + tableName + " drop("; |
| | | // for (String abName : removeAbList) { |
| | | // removeSql = removeSql + abName + ","; |
| | | // } |
| | | // removeSql = VciBaseUtil.removeComma(removeSql.replace("\n\t","")); |
| | | // removeSql = removeSql + ")"; |
| | | //TODO 䏿¸
æ¥å
·ä½ä½¿ç¨ä»ä¹æ¹æ³ï¼ææ¶æ³¨éï¼ä½ä¸è¦å é¤ |
| | | // DDLToolClient.getService().batchExecuteUpdateOracle(new String[]{removeSql}); |
| | | } |
| | |
| | | for(LinkType linkType : linkTypes){ |
| | | try{ |
| | | platformClientUtil.getLinkTypeService().addLinkType(linkType); |
| | | String tableName = LinkTypeProvider.getInstance().getLTTableName(linkType.name); |
| | | //todo æ¤ææ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String tableName = LinkTypeProvider.getInstance().getLTTableName(linkType.name); |
| | | String tableName = null; |
| | | String sql = "create table " + tableName + "(" + "\n\tOID VARCHAR2(36) not null,\n\tCreator VARCHAR2(36),\n\tCreateTime TIMESTAMP,\n\tLastModifier VARCHAR2(36),\n\tLastModifyTime TIMESTAMP,\n\tTS TIMESTAMP,\n\t"; |
| | | String[] apNameArray = linkType.attributes; |
| | | if(apNameArray!=null && apNameArray.length>0){ |
| | | for(String attrId : apNameArray){ |
| | | OsAttributeVO attrVO = attributeMap.get(attrId.toLowerCase().trim()); |
| | | String abSql = Tool.getInstance().getAbSql(attrService.attributeVO2DO(attrVO)); |
| | | sql = sql + abSql; |
| | | //todo æ¤ææ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String abSql = Tool.getInstance().getAbSql(attrService.attributeVO2DO(attrVO)); |
| | | // sql = sql + abSql; |
| | | } |
| | | } |
| | | sql = sql.substring(0, sql.lastIndexOf(",")); |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.vci.client.bof.BOFactoryClient; |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.bof.ClientLinkObjectOperation; |
| | | import com.vci.client.common.oq.OQTool; |
| | | import com.vci.common.qt.object.*; |
| | | import com.vci.common.utility.ObjectUtility; |
| | | import com.vci.corba.common.PLException; |
| | | 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.query.ObjectQueryService; |
| | | import com.vci.corba.query.data.BOAndLO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * LOæä½ç±» |
| | | */ |
| | | private ClientLinkObjectOperation loOperation = new ClientLinkObjectOperation(); |
| | | |
| | | @Autowired |
| | | private WebBoServiceI boService; |
| | |
| | | LO_BASE_FIELD_MAP.put("linkTypeName","linkTypeName"); |
| | | } |
| | | |
| | | @Override |
| | | public ClientLinkObjectOperation getLoOption() throws VciBaseException { |
| | | return loOperation; |
| | | } |
| | | |
| | | @Override |
| | | public List<ClientLinkObject> queryCLO(String linkType, |
| | | public List<LinkObject> queryCLO(String linkType, |
| | | Map<String, String> conditionMap) throws VciBaseException { |
| | | return queryCLO(linkType, "", 1, conditionMap); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClientBusinessObject> queryLinkCbo(String linkType, |
| | | public List<BusinessObject> queryLinkCbo(String linkType, |
| | | String toBtmname, Map<String, String> conditionMap) |
| | | throws VciBaseException { |
| | | return queryLinkCbo(linkType, toBtmname, 1, conditionMap); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClientLinkObject> queryCLO(String linkType, String toBtmName, |
| | | public List<LinkObject> queryCLO(String linkType, String toBtmName, |
| | | int level, Map<String, String> conditionMap) throws VciBaseException { |
| | | return queryCLO(linkType, toBtmName, level, false, conditionMap); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClientLinkObject> queryCLO(String linkType, String toBtmName, |
| | | public List<LinkObject> queryCLO(String linkType, String toBtmName, |
| | | int level, boolean isDirection,Map<String, String> conditionMap) throws VciBaseException { |
| | | return queryCLO(linkType,toBtmName,level,isDirection,conditionMap,new PageHelper(-1)); |
| | | } |
| | |
| | | * @param ph æåºåå页ï¼é¾æ¥ä¸è¬ä¸å»ºè®®å页 |
| | | */ |
| | | @Override |
| | | public List<ClientLinkObject> queryCLO(String linkType, String toBtmName, |
| | | public List<LinkObject> queryCLO(String linkType, String toBtmName, |
| | | int level, boolean isDirection,Map<String, String> conditionMap,PageHelper ph) throws VciBaseException { |
| | | List<ClientLinkObject> rtnOBJs = new ArrayList<ClientLinkObject>(); |
| | | List<LinkObject> rtnOBJs = new ArrayList<LinkObject>(); |
| | | QueryTemplate qt = new QueryTemplate(); |
| | | qt.setId("queryLO"); |
| | | qt.setType(QTConstants.TYPE_LINK); |
| | |
| | | LinkObject[] bos = platformClientUtil.getQueryService().findLTObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML()); |
| | | if (bos != null && bos.length > 0) { |
| | | for (LinkObject bo : bos) { |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | clo.setLinkObject(bo); |
| | | LinkObject clo = new LinkObject(); |
| | | clo = bo; |
| | | |
| | | rtnOBJs.add(clo); |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public List<ClientBusinessObject> queryLinkCbo(String linkType, |
| | | public List<BusinessObject> queryLinkCbo(String linkType, |
| | | String toBtmname, int level, Map<String, String> conditionMap) |
| | | throws VciBaseException { |
| | | return queryLinkCbo(linkType, toBtmname, level, false, conditionMap); |
| | | } |
| | | |
| | | @Override |
| | | public List<ClientBusinessObject> queryLinkCbo(String linkType, |
| | | public List<BusinessObject> queryLinkCbo(String linkType, |
| | | String toBtmName, int level,boolean isDirection, Map<String, String> conditionMap) |
| | | throws VciBaseException { |
| | | List<ClientBusinessObject> rtnOBJs = new ArrayList<ClientBusinessObject>(); |
| | | List<BusinessObject> rtnOBJs = new ArrayList<BusinessObject>(); |
| | | QueryTemplate qt = new QueryTemplate(); |
| | | qt.setId("queryLO"); |
| | | qt.setType(QTConstants.TYPE_LINK); |
| | |
| | | BOAndLO[] bos = platformClientUtil.getQueryService().getBOAndLOS(qt.getId(), OQTool.qtTOXMl(qt).asXML(),btmOid); |
| | | if (bos != null && bos.length > 0) { |
| | | for (BOAndLO blo : bos) { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | cbo.setBusinessObject(blo.bo); |
| | | BusinessObject cbo = new BusinessObject(); |
| | | cbo = blo.bo; |
| | | rtnOBJs.add(cbo); |
| | | } |
| | | return rtnOBJs; |
| | |
| | | } |
| | | return rtnOBJs; |
| | | } |
| | | // |
| | | // @Override |
| | | // public Map<String, BusinessObject> queryLinkedCbo(LinkObject[] lo, |
| | | // boolean isDirection) throws VciBaseException { |
| | | // LinkObject[] clos = new LinkObject[lo.length]; |
| | | // for(int i =0 ; i < lo.length; i ++){ |
| | | // LinkObject clo = new LinkObject(); |
| | | // clo = lo[i]; |
| | | // clos[i] = clo; |
| | | // } |
| | | // return queryLinkedCbo(clos,isDirection); |
| | | // } |
| | | |
| | | @Override |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo(LinkObject[] lo, |
| | | boolean isDirection) throws VciBaseException { |
| | | ClientLinkObject[] clos = new ClientLinkObject[lo.length]; |
| | | for(int i =0 ; i < lo.length; i ++){ |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | clo.setLinkObject(lo[i]); |
| | | clos[i] = clo; |
| | | } |
| | | return queryLinkedCbo(clos,isDirection); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo(List los, |
| | | public Map<String, BusinessObject> queryLinkedCbo(List los, |
| | | boolean isDirection) throws VciBaseException { |
| | | return queryLinkedCbo(los,isDirection,new ArrayList<String>()); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo(List los, |
| | | public Map<String, BusinessObject> queryLinkedCbo(List los, |
| | | boolean isDirection,List<String> queryColumn) throws VciBaseException { |
| | | ClientLinkObject[] clos = new ClientLinkObject[los.size()]; |
| | | LinkObject[] clos = new LinkObject[los.size()]; |
| | | for(int i = 0 ; i < los.size(); i ++){ |
| | | Object o = los.get(i); |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | LinkObject clo = new LinkObject(); |
| | | if(o instanceof LinkObject){ |
| | | clo.setLinkObject((LinkObject)o); |
| | | }else if(o instanceof ClientLinkObject){ |
| | | clo = (ClientLinkObject)o; |
| | | clo = (LinkObject)o; |
| | | }else if(o instanceof LinkObject){ |
| | | clo = (LinkObject)o; |
| | | } |
| | | clos[i] = clo; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo( |
| | | ClientLinkObject[] clol, boolean isDirection) throws VciBaseException { |
| | | public Map<String, BusinessObject> queryLinkedCbo( |
| | | LinkObject[] clol, boolean isDirection) throws VciBaseException { |
| | | return queryLinkedCbo(clol,isDirection,new ArrayList<String>()); |
| | | } |
| | | /***** |
| | | * |
| | | */ |
| | | @Override |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo( |
| | | ClientLinkObject[] clol, boolean isDirection,List<String> queryColumn) throws VciBaseException{ |
| | | public Map<String, BusinessObject> queryLinkedCbo( |
| | | LinkObject[] clol, boolean isDirection,List<String> queryColumn) throws VciBaseException{ |
| | | Map<String/*t_oidæè
f_oid*/,String/*oid*/> linkBoOidMap = new HashMap<String, String>(); |
| | | Map<String,String> btmTypeOidMap = new HashMap<String, String>(); |
| | | for(int i = 0 ; i < clol.length; i ++){ |
| | | ClientLinkObject clo = clol[i]; |
| | | LinkObject clo = clol[i]; |
| | | if(clo!=null){ |
| | | String btmType = ""; |
| | | String btmOid = ""; |
| | | if(isDirection){ |
| | | linkBoOidMap.put(clo.getToOid(),clo.getOid()); |
| | | btmType = clo.getToBTMName().toLowerCase().trim(); |
| | | btmOid = clo.getToOid(); |
| | | linkBoOidMap.put(clo.toOid,clo.oid); |
| | | btmType = clo.toBTName.toLowerCase().trim(); |
| | | btmOid = clo.toOid; |
| | | }else{ |
| | | linkBoOidMap.put(clo.getFromOid(),clo.getOid()); |
| | | btmType = clo.getFromBTMName().toLowerCase().trim(); |
| | | btmOid = clo.getFromOid(); |
| | | linkBoOidMap.put(clo.fromOid,clo.oid); |
| | | btmType = clo.fromBTName.toLowerCase().trim(); |
| | | btmOid = clo.fromOid; |
| | | } |
| | | String oids = ""; |
| | | if(btmTypeOidMap.containsKey(btmType)){ |
| | |
| | | btmTypeOidMap.put(btmType, oids); |
| | | } |
| | | } |
| | | Map<String,ClientBusinessObject> linkedCboMap = new HashMap<>(); |
| | | Map<String,BusinessObject> linkedCboMap = new HashMap<>(); |
| | | Iterator<String> it = btmTypeOidMap.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | | String btmType = it.next(); |
| | |
| | | } |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("oid",oids); |
| | | List<ClientBusinessObject> allCbo = boService.queryCBO(btmType, conditionMap,new PageHelper(-1),clauseList); |
| | | List<BusinessObject> allCbo = boService.queryCBO(btmType, conditionMap,new PageHelper(-1),clauseList); |
| | | if(allCbo.size()>0){ |
| | | for(ClientBusinessObject cbo : allCbo){ |
| | | String linkOid = linkBoOidMap.get(cbo.getOid()); |
| | | for(BusinessObject cbo : allCbo){ |
| | | String linkOid = linkBoOidMap.get(cbo.oid); |
| | | linkedCboMap.put(linkOid, cbo); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map> clos2Map(List<ClientLinkObject> clos) throws VciBaseException { |
| | | public List<Map> clos2Map(List<LinkObject> clos) throws VciBaseException { |
| | | List<Map> allMap = new ArrayList<Map>(); |
| | | for(ClientLinkObject clo : clos){ |
| | | for(LinkObject clo : clos){ |
| | | allMap.add(clo2Map(clo)); |
| | | } |
| | | return allMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map clo2Map(ClientLinkObject clo) throws VciBaseException { |
| | | public Map clo2Map(LinkObject clo) throws VciBaseException { |
| | | Map<String,String> map = new HashMap<String, String>(); |
| | | WebUtil.copyValueToMapFromClos(clo, map); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public List<ClientLinkObject> map2Clos(List<Map> map) throws VciBaseException { |
| | | List<ClientLinkObject> allClo = new ArrayList<ClientLinkObject>(); |
| | | public List<LinkObject> map2Clos(List<Map> map) throws VciBaseException { |
| | | List<LinkObject> allClo = new ArrayList<LinkObject>(); |
| | | for(Map m : map){ |
| | | allClo.add(map2Clo(m)); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ClientLinkObject map2Clo(Map map) throws VciBaseException { |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | public LinkObject map2Clo(Map map) throws VciBaseException { |
| | | LinkObject clo = new LinkObject(); |
| | | WebUtil.copyValueToCloFromMap(clo, map); |
| | | return clo; |
| | | } |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public List<ClientLinkObject> saveClientLinkObjects(List<ClientLinkObject> clos) throws VciBaseException { |
| | | public List<LinkObject> saveLinkObjects(List<LinkObject> clos) throws VciBaseException { |
| | | if(clos == null || clos.size() == 0){ |
| | | throw new VciBaseException("没æè¦ä¿åçä¸å¡ç±»åæ°æ®"); |
| | | } |
| | | List<LinkObject> linkObjects = new ArrayList<LinkObject>(); |
| | | for(ClientLinkObject clo : clos){ |
| | | for(LinkObject clo : clos){ |
| | | //éè¦ççåºæ¬çä¿¡æ¯æ¯å¦æ |
| | | if(StringUtils.isBlank(clo.getLoName())){ |
| | | if(StringUtils.isBlank(clo.ltName)){ |
| | | throw new VciBaseException("龿¥ç±»åçå称为空"); |
| | | } |
| | | if(StringUtils.isBlank(clo.getOid())){ |
| | | clo.setOid((new ObjectUtility()).getNewObjectID36()); |
| | | if(StringUtils.isBlank(clo.oid)){ |
| | | clo.oid = (new ObjectUtility()).getNewObjectID36(); |
| | | } |
| | | if(StringUtils.isBlank(clo.getCreator())){ |
| | | clo.setCreator(WebUtil.getCurrentUserId()); |
| | | if(StringUtils.isBlank(clo.creator)){ |
| | | clo.creator = WebUtil.getCurrentUserId(); |
| | | } |
| | | if(clo.getCreateTime() == 0){ |
| | | clo.setCreateTime(VciDateUtil.getNowTime()); |
| | | if(clo.createTime == 0){ |
| | | clo.createTime = VciDateUtil.getNowTime(); |
| | | } |
| | | if(StringUtils.isBlank(clo.getLastModifier())){ |
| | | clo.setLastModifier(clo.getCreator()); |
| | | if(StringUtils.isBlank(clo.modifier)){ |
| | | clo.modifier = clo.creator; |
| | | } |
| | | if(clo.getLastModifyTime() == 0){ |
| | | clo.setLastModifyTime(clo.getCreateTime()); |
| | | if(clo.modifyTime == 0){ |
| | | clo.modifyTime = clo.createTime; |
| | | } |
| | | if(clo.getTs() == 0){ |
| | | clo.setTs(clo.getCreateTime()); |
| | | if(clo.ts == 0){ |
| | | clo.ts = clo.createTime; |
| | | } |
| | | linkObjects.add(clo.getLinkObject()); |
| | | linkObjects.add(clo); |
| | | } |
| | | try { |
| | | LinkObject[] savedLinkObject = BOFactoryClient.getBOFactoryService().batchCreateLinkObject(linkObjects.toArray(new LinkObject[0])); |
| | | List<ClientLinkObject> savedClientLinkObject = new ArrayList<ClientLinkObject>(); |
| | | LinkObject[] savedLinkObject = platformClientUtil.getBOFactoryService().batchCreateLinkObject(linkObjects.toArray(new LinkObject[0])); |
| | | List<LinkObject> savedListLinkObject = new ArrayList<LinkObject>(); |
| | | if(savedLinkObject != null && savedLinkObject.length > 0){ |
| | | for(LinkObject linkObject : savedLinkObject){ |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | clo.setLinkObject(linkObject); |
| | | savedClientLinkObject.add(clo); |
| | | LinkObject clo = new LinkObject(); |
| | | clo = linkObject; |
| | | savedListLinkObject.add(clo); |
| | | } |
| | | } |
| | | return savedClientLinkObject; |
| | | return savedListLinkObject; |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public ClientLinkObject createClientLinkObject(String loName) throws VciBaseException { |
| | | public LinkObject createLinkObject(String loName) throws VciBaseException { |
| | | WebUtil.alertNotNull(loName,"龿¥"); |
| | | try { |
| | | return loOperation.createLinkObject(loName,WebUtil.getCurrentUserId()); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | return null; |
| | | //todo å¨å¹³å°éé¢éè¦ä¼ å
¥å¯¹è±¡ï¼ç°å¨æ¯å符串ï¼éè¦çå¹³å°å¦ä½å¤ç |
| | | // return loOperation.createLinkObject(loName,WebUtil.getCurrentUserId()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public ClientLinkObject cloneClientLinkObject(ClientLinkObject clo) throws VciBaseException { |
| | | ClientLinkObject newClo = new ClientLinkObject(); |
| | | String JSONString = JSONObject.toJSONStringWithDateFormat(clo.getLinkObject(),VciDateUtil.DateTimeMillFormat,SerializerFeature.WriteDateUseDateFormat); |
| | | public LinkObject cloneLinkObject(LinkObject clo) throws VciBaseException { |
| | | LinkObject newClo = new LinkObject(); |
| | | String JSONString = JSONObject.toJSONStringWithDateFormat(clo,VciDateUtil.DateTimeMillFormat,SerializerFeature.WriteDateUseDateFormat); |
| | | LinkObject lo = JSONObject.parseObject(JSONString,LinkObject.class); |
| | | if(lo.newAttrValList == null) { |
| | | lo.newAttrValList = new AttributeValue[0]; |
| | |
| | | if(lo.hisAttrValList == null) { |
| | | lo.hisAttrValList = new AttributeValue[0]; |
| | | } |
| | | newClo.setLinkObject(lo); |
| | | newClo.setOid((new ObjectUtility()).getNewObjectID36()); |
| | | newClo.setCreator(WebUtil.getCurrentUserId()); |
| | | newClo.setCreateTime(VciDateUtil.getNowTime()); |
| | | newClo.setLastModifier(newClo.getCreator()); |
| | | newClo.setLastModifyTime(newClo.getCreateTime()); |
| | | newClo.setTs(newClo.getCreateTime()); |
| | | newClo = lo; |
| | | newClo.oid = (new ObjectUtility()).getNewObjectID36(); |
| | | newClo.creator = WebUtil.getCurrentUserId(); |
| | | newClo.createTime = VciDateUtil.getNowTime(); |
| | | newClo.modifier = newClo.creator; |
| | | newClo.modifyTime = newClo.createTime; |
| | | newClo.ts = newClo.createTime; |
| | | return newClo; |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public void deleteClientLinkObjects(List<ClientLinkObject> clos) throws VciBaseException { |
| | | public void deleteLinkObjects(List<LinkObject> clos) throws VciBaseException { |
| | | if(clos!=null){ |
| | | try { |
| | | loOperation.batchdDeleteLinkObject(clos.toArray(new ClientLinkObject[0])); |
| | | platformClientUtil.getBOFactoryService().batchDeleteLinkObject(clos.toArray(new LinkObject[0])); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | * @throws VciBaseException |
| | | */ |
| | | @Override |
| | | public void updateClientLinkObject(List<ClientLinkObject> clos) throws VciBaseException { |
| | | public void updateLinkObject(List<LinkObject> clos) throws VciBaseException { |
| | | if(clos!=null){ |
| | | try { |
| | | loOperation.batchUpdateLinkObject(clos.toArray(new ClientLinkObject[0])); |
| | | platformClientUtil.getBOFactoryService().batchUpdateLinkObject(clos.toArray(new LinkObject[0])); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | |
| | | List<String> finalEnumFields = enumFields; |
| | | final Integer[] total = {totalHolder.value}; |
| | | Arrays.stream(linkObjects.returnValue).forEach(lo->{ |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | clo.setLinkObject(lo); |
| | | LinkObject clo = new LinkObject(); |
| | | clo = lo; |
| | | Map<String, String> map = new HashMap<>(); |
| | | boService.queryEnumText(null,clo, finalEnumFields); |
| | | WebUtil.copyValueToMapFromClos(clo,map); |
| | |
| | | //å页ä¸è¦è¶
è¿1000 |
| | | Map<String,String> boConditionMap =new HashMap<>(); |
| | | boConditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | List<ClientBusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, fromFieldsFix); |
| | | List<BusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, fromFieldsFix); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | dataGrid.getData().forEach(data->{ |
| | | Map<String, String> map = (Map<String, String>) data; |
| | | if(map.getOrDefault("f_oid","").equals(cbo.getOid())){ |
| | | if(map.getOrDefault("f_oid","").equals(cbo.oid)){ |
| | | fromFieldsFix.stream().forEach(fromField->{ |
| | | map.put("f_oid." + fromField,cbo.getAttributeValue(fromField)); |
| | | map.put("f_oid." + fromField, ObjectTool.getBOAttributeValue(cbo,fromField)); |
| | | }); |
| | | } |
| | | }); |
| | |
| | | //å页ä¸è¦è¶
è¿1000 |
| | | Map<String,String> boConditionMap =new HashMap<>(); |
| | | boConditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | List<ClientBusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, toFieldsFix); |
| | | List<BusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, toFieldsFix); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | dataGrid.getData().forEach(data->{ |
| | | Map<String, String> map = (Map<String, String>) data; |
| | | if(map.getOrDefault("t_oid","").equals(cbo.getOid())){ |
| | | if(map.getOrDefault("t_oid","").equals(cbo.oid)){ |
| | | toFieldsFix.stream().forEach(toField->{ |
| | | map.put("t_oid." + toField,cbo.getAttributeValue(toField)); |
| | | map.put("t_oid." + toField,ObjectTool.getBOAttributeValue(cbo,toField)); |
| | | }); |
| | | } |
| | | }); |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.corba.common.data.UserEntityInfo; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.corba.workflow.data.FlowInstanceInfo; |
| | | import com.vci.corba.workflow.data.MapTransfersInfo; |
| | | import com.vci.corba.workflow.data.TasksAssignedInfo; |
| | | import com.vci.file.dto.VciFileObjectDTO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.enumpck.DataSecretEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | Map<String, String> conditionMap = WebUtil.getOidQuery(config.getOids()); |
| | | conditionMap.put(WebBoServiceI.QUERY_FILTER_SECRET, "false"); |
| | | conditionMap.put(WebBoServiceI.QUERY_FILTER_DATARIGHT, "false"); |
| | | List<com.vci.client.bof.ClientBusinessObject> allCbo = boService.queryCBO(config.getBtmType().toLowerCase().trim(), conditionMap); |
| | | List<BusinessObject> allCbo = boService.queryCBO(config.getBtmType().toLowerCase().trim(), conditionMap); |
| | | if (allCbo == null || allCbo.size() == 0) { |
| | | throw new VciBaseException(msgCodePrefix + "dataNotNull", new String[]{}); |
| | | } |
| | |
| | | //æ¥è¯¢æ°æ®æ¯å¦å·²ç»åèµ·äºæµç¨ |
| | | //æ¥è¯¢inputè¿æ¥éæ¯ä¸æ¯ææµç¨å®ä¾ï¼å¹¶ä¸æµç¨å®ä¾ä¸çäºç»æ¢ |
| | | conditionMap.put("oid", " in (select f_oid from platformlt_" + processDao.getTaskDataLink() + " where oid " + conditionMap.get("oid").replace("\\IN", " in ") + ")"); |
| | | List<com.vci.client.bof.ClientBusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); |
| | | List<BusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); |
| | | if (workInstanceCbos != null && workInstanceCbos.size() > 0) { |
| | | for (com.vci.client.bof.ClientBusinessObject workInstance : workInstanceCbos) { |
| | | if (!workInstance.getLcStatus().equalsIgnoreCase("Obsoleted")) { |
| | | throw new VciBaseException(msgCodePrefix + "dataSubmitedToProcess", new String[]{workInstance.getName(), workInstance.getCreator()}); |
| | | for (BusinessObject workInstance : workInstanceCbos) { |
| | | if (!workInstance.lcStatus.equalsIgnoreCase("Obsoleted")) { |
| | | throw new VciBaseException(msgCodePrefix + "dataSubmitedToProcess", new String[]{workInstance.name, workInstance.creator}); |
| | | } |
| | | } |
| | | } |
| | |
| | | String[][] objectPropertyValues = new String[allCbo.size()][4]; |
| | | String[] objIds = new String[allCbo.size()];//ä¸å¡æ°æ®çç»ä»¶ |
| | | for (int i = 0; i < allCbo.size(); i++) { |
| | | com.vci.client.bof.ClientBusinessObject cbo = allCbo.get(i); |
| | | BusinessObject cbo = allCbo.get(i); |
| | | String[] values = new String[4]; |
| | | values[0] = cbo.getOid(); |
| | | values[1] = cbo.getRevisionid(); |
| | | values[2] = cbo.getNameoid(); |
| | | values[3] = cbo.getBtmName(); |
| | | values[0] = cbo.oid; |
| | | values[1] = cbo.revisionid; |
| | | values[2] = cbo.nameoid; |
| | | values[3] = cbo.btName; |
| | | objectPropertyValues[i] = values; |
| | | objIds[i] = cbo.getOid(); |
| | | objIds[i] = cbo.oid; |
| | | } |
| | | |
| | | FlowInstanceInfo flowInstanceInfo = new FlowInstanceInfo(); |
| | |
| | | Map<String, String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("f_btwname", processDao.getWorkitemBtmType()); |
| | | conditionMap.put("f_oid", QueryOptionConstant.IN + "(" + WebUtil.toInSql(taskIds) + ")"); |
| | | List<ClientLinkObject> allLinkData = loService.queryCLO(processDao.getTaskDataLink(), conditionMap); |
| | | List<LinkObject> allLinkData = loService.queryCLO(processDao.getTaskDataLink(), conditionMap); |
| | | String[][] objectPropertyValues = new String[allLinkData.size()][4]; |
| | | for (int i = 0; i < allLinkData.size(); i++) { |
| | | ClientLinkObject clo = allLinkData.get(i); |
| | | LinkObject clo = allLinkData.get(i); |
| | | String[] values = new String[4]; |
| | | values[0] = clo.getToOid(); |
| | | values[1] = clo.getToRevisionOid(); |
| | | values[2] = clo.getToNameOid(); |
| | | values[3] = clo.getToBTMName(); |
| | | values[0] = clo.toOid; |
| | | values[1] = clo.toRevOid; |
| | | values[2] = clo.toNameOid; |
| | | values[3] = clo.toBTName; |
| | | objectPropertyValues[i] = values; |
| | | } |
| | | if ("æªå½åè·¯ç±".equalsIgnoreCase(outCome)) { |
| | |
| | | //æ¥è¯¢æµç¨å®ä¾ |
| | | Map<String, String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("executionid", executionId.trim() + "*");//ä¼æåæµç¨ |
| | | List<com.vci.client.bof.ClientBusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); |
| | | List<BusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); |
| | | if (workInstanceCbos == null || workInstanceCbos.size() == 0) { |
| | | throw new VciBaseException(msgCodePrefix + "executionNotExist"); |
| | | } |
| | | //夿æ¯å¦é½æ¯æ§è¡ç¶æï¼å端ç夿è½è¢«è·³è¿ |
| | | List<com.vci.client.bof.ClientBusinessObject> needUpdateCbos = new ArrayList<>(); |
| | | List<BusinessObject> needUpdateCbos = new ArrayList<>(); |
| | | List<String> workInstanceOids = new ArrayList<String>(); |
| | | for (com.vci.client.bof.ClientBusinessObject cbo : workInstanceCbos) { |
| | | if (!cbo.getLcStatus().equalsIgnoreCase("Executing")) { |
| | | for (BusinessObject cbo : workInstanceCbos) { |
| | | if (!cbo.lcStatus.equalsIgnoreCase("Executing")) { |
| | | throw new VciBaseException(msgCodePrefix + "processNotExecutionStatus"); |
| | | } |
| | | needUpdateCbos.add(cbo); |
| | | workInstanceOids.add(cbo.getAttributeValue("executionid")); |
| | | workInstanceOids.add(ObjectTool.getBOAttributeValue(cbo,"executionid")); |
| | | } |
| | | //æ¾ç¸å
³çæµç¨ä»»å¡å¯¹è±¡ï¼å¹¶ä¸æ¯æ£å¨æ§è¡ä¸ç |
| | | conditionMap.put("executionid", QueryOptionConstant.IN + "(" + WebUtil.toInSql(workInstanceOids.toArray(new String[0])) + ")"); |
| | | conditionMap.put("lcstatus", "Executing"); |
| | | List<com.vci.client.bof.ClientBusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); |
| | | List<BusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); |
| | | if (workItemCbos != null && workItemCbos.size() > 0) { |
| | | needUpdateCbos.addAll(workItemCbos); |
| | | } |
| | |
| | | //æ¥è¯¢æµç¨å®ä¾ |
| | | Map<String, String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("executionid", executionId.trim() + "*");//ä¼æåæµç¨ |
| | | List<com.vci.client.bof.ClientBusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); |
| | | List<BusinessObject> workInstanceCbos = boService.queryCBO(processDao.getWorkIntanceBtmType(), conditionMap); |
| | | if (workInstanceCbos == null || workInstanceCbos.size() == 0) { |
| | | throw new VciBaseException(msgCodePrefix + "executionNotExist"); |
| | | } |
| | | //夿æ¯å¦é½æ¯æ§è¡ç¶æï¼å端ç夿è½è¢«è·³è¿ |
| | | List<com.vci.client.bof.ClientBusinessObject> needUpdateCbos = new ArrayList<>(); |
| | | List<BusinessObject> needUpdateCbos = new ArrayList<>(); |
| | | List<String> workInstanceOids = new ArrayList<String>(); |
| | | for (com.vci.client.bof.ClientBusinessObject cbo : workInstanceCbos) { |
| | | if (!cbo.getLcStatus().equalsIgnoreCase("Suspended")) { |
| | | for (BusinessObject cbo : workInstanceCbos) { |
| | | if (!cbo.lcStatus.equalsIgnoreCase("Suspended")) { |
| | | throw new VciBaseException(msgCodePrefix + "processNotSuspendedStatus"); |
| | | } |
| | | needUpdateCbos.add(cbo); |
| | | workInstanceOids.add(cbo.getOid()); |
| | | workInstanceOids.add(cbo.oid); |
| | | } |
| | | //æ¾ç¸å
³çæµç¨ä»»å¡å¯¹è±¡ï¼å¹¶ä¸æ¯æ£å¨æ§è¡ä¸ç |
| | | conditionMap.put("executionid", QueryOptionConstant.IN + "(" + WebUtil.toInSql(workInstanceOids.toArray(new String[0])) + ")"); |
| | | conditionMap.put("lcstatus", "Suspended"); |
| | | List<com.vci.client.bof.ClientBusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); |
| | | List<BusinessObject> workItemCbos = boService.queryCBO(processDao.getWorkitemBtmType(), conditionMap); |
| | | if (workItemCbos != null && workItemCbos.size() > 0) { |
| | | needUpdateCbos.addAll(workItemCbos); |
| | | } |
| | |
| | | } |
| | | } |
| | | List<String> causeList = Arrays.asList(new String[]{primaryKeyName}); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btmType, conditionMap, null, causeList); |
| | | List<BusinessObject> cbos = boService.queryCBO(btmType, conditionMap, null, causeList); |
| | | if (cbos == null || cbos.size() == 0) { |
| | | throw new VciBaseException("åèµ·æµç¨çä¸å¡æ°æ®å
¨é¨ä¸ç¬¦åè¦æ±"); |
| | | } |
| | |
| | | for (String oid : oidArray) { |
| | | oidSet.add(oid); |
| | | } |
| | | for (com.vci.client.bof.ClientBusinessObject cbo : cbos) { |
| | | if (oidSet.contains(cbo.getAttributeValue(primaryKeyName))) { |
| | | oidSet.remove(cbo.getAttributeValue(primaryKeyName)); |
| | | for (BusinessObject cbo : cbos) { |
| | | if (oidSet.contains(ObjectTool.getBOAttributeValue(cbo,primaryKeyName))) { |
| | | oidSet.remove(ObjectTool.getBOAttributeValue(cbo,primaryKeyName)); |
| | | } |
| | | } |
| | | if (oidSet.size() > 0) { |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.workflow.editor.FlowConstants; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.file.pagemodel.VciFileObjectVO; |
| | | import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI; |
| | | import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; |
| | |
| | | import com.vci.web.pageModel.*; |
| | | import com.vci.web.properties.WebProperties; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.dom4j.Document; |
| | |
| | | |
| | | @Autowired |
| | | private WebProcessCommandServiceI proCmdService; |
| | | |
| | | @Autowired |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | /** |
| | | * ä¸å¡æ°æ®æå¡ |
| | |
| | | map.put("detailUrl",detailUrl== null?"":detailUrl); |
| | | map.put("UIContentCode",UIContent); |
| | | //å¢å æ¥è¯¢å
³èçä¸å¡æ°æ® |
| | | List<ClientLinkObject> linkObjects = processDao.getDataCloInTask("",executionid); |
| | | List<LinkObject> linkObjects = processDao.getDataCloInTask("",executionid); |
| | | StringBuilder sb = new StringBuilder(); |
| | | String thisBusinessOid = ""; |
| | | if(linkObjects!=null && linkObjects.size()>0){ |
| | | Set<String> oidSet = new HashSet<String>(); |
| | | //å»é¤éå¤ |
| | | for(ClientLinkObject clo : linkObjects){ |
| | | oidSet.add(clo.getToOid()); |
| | | for(LinkObject clo : linkObjects){ |
| | | oidSet.add(clo.toOid); |
| | | } |
| | | for(String oidString : oidSet) { |
| | | sb.append(oidString).append(","); |
| | |
| | | } |
| | | for (Iterator<?> a = root.elementIterator(); a.hasNext();) { |
| | | Element next = (Element) a.next(); |
| | | String cellName = next.attributeValue(FlowConstants.XMLNAME); |
| | | if(cellName != null && cellName.equals(name)) { |
| | | map.put("customerbuttoninfo",next.attributeValue(FlowConstants.URL_PATH)); |
| | | break; |
| | | } |
| | | //todo FlowConstantsæ¤å æ æ³å¼ç¨ï¼åç»ä¼è¿è¡è°æ´ï¼åè¿è¡å¼ç¨ |
| | | // String cellName = next.attributeValue(FlowConstants.XMLNAME); |
| | | // if(cellName != null && cellName.equals(name)) { |
| | | // map.put("customerbuttoninfo",next.attributeValue(FlowConstants.URL_PATH)); |
| | | // break; |
| | | // } |
| | | } |
| | | }catch (Exception e) { |
| | | throw new VciBaseException("è¯»åæµç¨çxmlå
容åºç°äºé误"); |
| | |
| | | */ |
| | | @Override |
| | | public DataGrid getFilesInProcess(Map<String, String> conditionMap, String taskOid, String executionId,PageHelper pageHelper) throws VciBaseException{ |
| | | List<ClientLinkObject> cloByTask = processDao.getDataCloInTask(taskOid,executionId); |
| | | List<LinkObject> cloByTask = processDao.getDataCloInTask(taskOid,executionId); |
| | | if(cloByTask == null || cloByTask.size() == 0){ |
| | | throw new VciBaseException("没æå
³èçä¸å¡æ°æ®"); |
| | | } |
| | | Map<String,List<String>> busOid_btmMap = new HashMap<String, List<String>>(); |
| | | Set<String> fileOidSet = new HashSet(); |
| | | for(ClientLinkObject clo:cloByTask){ |
| | | if(FileTypeConstants.FILE_DATA_TABLE.equals(clo.getToBTMName())){ |
| | | fileOidSet.add(clo.getToOid()); |
| | | for(LinkObject clo:cloByTask){ |
| | | if(FileTypeConstants.FILE_DATA_TABLE.equals(clo.toBTName)){ |
| | | fileOidSet.add(clo.toOid); |
| | | }else { |
| | | List<String> thisBtmOids = busOid_btmMap.getOrDefault(clo.getToBTMName(),new ArrayList<>()); |
| | | thisBtmOids.add(clo.getToOid()); |
| | | busOid_btmMap.put(clo.getToBTMName(), thisBtmOids); |
| | | List<String> thisBtmOids = busOid_btmMap.getOrDefault(clo.toBTName,new ArrayList<>()); |
| | | thisBtmOids.add(clo.toOid); |
| | | busOid_btmMap.put(clo.toBTName, thisBtmOids); |
| | | } |
| | | } |
| | | DataGrid dg = new DataGrid(); |
| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.frameworkcore.pagemodel.SmUserVO; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.web.enumpck.DataSecretEnum; |
| | | import com.vci.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | |
| | | Map<String,String> conditionMap = new HashMap<String, String>(); |
| | | conditionMap.put("startip",ip.trim()); |
| | | |
| | | List<com.vci.client.bof.ClientBusinessObject> ipCbos = boService.queryCBO(EnumIdConstant.IPSECRET_BTMNAME,conditionMap,null, Arrays.asList(new String[]{"ipsecret"})); |
| | | List<BusinessObject> ipCbos = boService.queryCBO(EnumIdConstant.IPSECRET_BTMNAME,conditionMap,null, Arrays.asList(new String[]{"ipsecret"})); |
| | | int ipSecret = 0; |
| | | if(ipCbos!=null&& ipCbos.size()>0){ |
| | | ipSecret = WebUtil.getInt(ipCbos.get(0).getAttributeValue("ipsecret")); |
| | | ipSecret = WebUtil.getInt(ObjectTool.getBOAttributeValue(ipCbos.get(0), "ipsecret")); |
| | | } |
| | | if(ipSecret == 0){ |
| | | ipSecret = getMinIpSecret(); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.web.util; |
| | | import com.vci.client.common.objects.RoleObject; |
| | | import com.vci.common.exception.VciException; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.framework.data.FunctionInfo; |
| | | import com.vci.corba.framework.data.RoleInfo; |
| | | import com.vci.corba.framework.data.RoleRightInfo; |
| | | import com.vci.starter.web.pagemodel.SessionInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class RightControlUtil { |
| | | |
| | | |
| | | @Resource |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | // add by xchao 2012.09.20 ç»ä¸å½æ´ç®¡çåãå¼åè
ç¨æ·å¤æ |
| | | // ä»¥ä¾¿å°æ¥æå¯è½ä¿®æ¹ç®¡çåãå¼åè
ç¨æ·ï¼å¯¹äºå¤æä¾ç¶ææ |
| | | private static String userAdminEnum = "user.admin"; |
| | | private String userNameAdmin = null; |
| | | private static String userDeveloperEnum = "user.developer"; |
| | | private String userNameDeveloper = null; |
| | | private String userNameRoot = null; |
| | | private static String userRootEnum = "user.rooter"; |
| | | public boolean isAdmin(String userName){ |
| | | return userName.equals(getUserNameAdmin(userAdminEnum)); |
| | | } |
| | | |
| | | public boolean isDeveloper(String userName){ |
| | | return userName.equals(getUserNameDeveloper(userDeveloperEnum)); |
| | | } |
| | | |
| | | public boolean isRoot(String userName){ |
| | | return userName.equals(getUserNameRoot(userRootEnum)); |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºç®¡çåãå¼åè
ç¨æ· |
| | | * @param userName ç»å½ç¨æ·å |
| | | * @return å¤æç»æ |
| | | */ |
| | | public boolean isAdminOrDeveloperOrRoot(String userName){ |
| | | return isAdmin(userName) || isDeveloper(userName)||isRoot(userName); |
| | | } |
| | | |
| | | /** |
| | | * è·åé
ç½®ç管çå |
| | | * @param key é
ç½®key |
| | | * @return 管çåè´¦å· |
| | | */ |
| | | public String getUserNameAdmin(String key) { |
| | | if (userNameAdmin == null) { |
| | | synchronized (RightControlUtil.class) { |
| | | if (userNameAdmin == null) { |
| | | try { |
| | | userNameAdmin = platformClientUtil.getFrameworkService().getConfigValue(key); |
| | | }catch (PLException e){ |
| | | log.error(e.code, e.messages); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return userNameAdmin; |
| | | } |
| | | /** |
| | | * è·åé
ç½®çå¼å人å |
| | | * @param key é
ç½®key |
| | | * @return å¼å人åè´¦å· |
| | | */ |
| | | public String getUserNameDeveloper(String key) { |
| | | if (userNameDeveloper == null) { |
| | | synchronized (RightControlUtil.class) { |
| | | if (userNameDeveloper == null) { |
| | | try { |
| | | userNameDeveloper = platformClientUtil.getFrameworkService().getConfigValue(key); |
| | | }catch (PLException e){ |
| | | log.error(e.code, e.messages); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return userNameDeveloper; |
| | | } |
| | | |
| | | /** |
| | | * è·åé
ç½®ç管çå |
| | | * @param key é
ç½®key |
| | | * @return 管çåè´¦å· |
| | | */ |
| | | public String getUserNameRoot(String key) { |
| | | if (userNameRoot == null) { |
| | | synchronized (RightControlUtil.class) { |
| | | if (userNameRoot == null) { |
| | | try { |
| | | userNameRoot = platformClientUtil.getFrameworkService().getConfigValue(key); |
| | | }catch (PLException e){ |
| | | log.error(e.code, e.messages); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return userNameRoot; |
| | | } |
| | | |
| | | /** |
| | | * 夿å½åæ¯å¦ä¸ºä¸å
ç¨æ· |
| | | * @return |
| | | */ |
| | | public boolean isThreeAdminCurUser() { |
| | | SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); |
| | | try { |
| | | RoleInfo[] roles = platformClientUtil.getFrameworkService().fetchRoleInfoByUserId(sessionInfo.getUserId()); |
| | | for (RoleInfo role : roles) { |
| | | if (role.name.equalsIgnoreCase("ç³»ç»ç®¡çå")){ |
| | | return true; |
| | | } |
| | | else if (role.name.equalsIgnoreCase("å®å
¨ç®¡çå")){ |
| | | return true; |
| | | } |
| | | else if (role.name.equalsIgnoreCase("审计管çå")){ |
| | | return true; |
| | | } |
| | | } |
| | | } catch (PLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åç¨æ·çæé |
| | | * @param userName |
| | | * @return |
| | | */ |
| | | public RoleRightInfo[] getRoleRightByUserName(String userName){ |
| | | RoleRightInfo[] roleRightByUserName = new RoleRightInfo[0]; |
| | | try { |
| | | roleRightByUserName = platformClientUtil.getFrameworkService().getRoleRightByUserName(userName); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | log.error(e.code,e.messages); |
| | | } |
| | | return roleRightByUserName; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åå½åç¨æ·å
·ææéçæææ¨¡å |
| | | * @param parentId, ç¶æ¨¡åid |
| | | * @param userNameï¼ ç¨æ·å |
| | | * @param userRoleRights, å½åç¨æ·å
·æçæé |
| | | * @return |
| | | */ |
| | | public Map<String, List<FunctionInfo>> getAllChildrenFunctionsByUserName(String parentId, String userName, RoleRightInfo[] userRoleRights) { |
| | | Map<String, List<RoleRightInfo>> mapRight = new LinkedHashMap<String, List<RoleRightInfo>>(); |
| | | for (int i = 0; i < userRoleRights.length; i++) { |
| | | RoleRightInfo right = userRoleRights[i]; |
| | | |
| | | List<RoleRightInfo> lstRight = null; |
| | | if (mapRight.containsKey(right.funcId)) { |
| | | lstRight = mapRight.get(right.funcId); |
| | | } else { |
| | | lstRight = new ArrayList<RoleRightInfo>(); |
| | | } |
| | | lstRight.add(right); |
| | | mapRight.put(right.funcId, lstRight); |
| | | } |
| | | |
| | | FunctionInfo[] AllFunction = getFunctionsByParentId(parentId, userName); |
| | | Map<String, List<FunctionInfo>> map = new LinkedHashMap<String, List<FunctionInfo>>(); |
| | | boolean isAllShow = isDeveloper(userName) || isAdmin(userName) || !isFunctionSwithOn(); |
| | | boolean isHasRight = false; |
| | | FunctionInfo func; |
| | | for (int i = 0; i < AllFunction.length; i++) { |
| | | func = AllFunction[i]; |
| | | //System.out.println("=== FUNC:ID=" + func.getId()+ " ParentID=" + func.getParentId() + "; Name=" + func.getName()); |
| | | isHasRight = false; |
| | | if (isAllShow) { |
| | | isHasRight = true; |
| | | } else { |
| | | List<RoleRightInfo> lstRight = null; |
| | | if (mapRight.containsKey(func.id)) { |
| | | lstRight = mapRight.get(func.id); |
| | | //System.out.println(" === æææä¿¡æ¯"); |
| | | } |
| | | |
| | | if (lstRight == null) |
| | | isHasRight = false; |
| | | else{ |
| | | if (lstRight.size() > 0) |
| | | isHasRight = true; |
| | | // for (int j = 0; j < lstRight.size(); j++) { |
| | | // long lRight = lstRight.get(j).getRightValue(); |
| | | // if (lRight != 0){ |
| | | // isHasRight = true; |
| | | // //System.out.println(" === æææ"); |
| | | // |
| | | // break; |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | |
| | | if (!isHasRight) { |
| | | continue; |
| | | } |
| | | String cparentId = func.parentId; |
| | | |
| | | //System.out.println("####==== ParentId=" + cparentId + "; Func=" + func.getName()); |
| | | List<FunctionInfo> lstFunc = null; |
| | | if (map.containsKey(cparentId)) { |
| | | lstFunc = map.get(cparentId); |
| | | } else { |
| | | lstFunc = new ArrayList<FunctionInfo>(); |
| | | } |
| | | lstFunc.add(func); |
| | | map.put(cparentId, lstFunc); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | public FunctionInfo[] getFunctionsByParentId(String parentId, String userName) { |
| | | |
| | | FunctionInfo[] funcObjs = null; |
| | | try { |
| | | if(isDeveloper(userName)){ |
| | | funcObjs = platformClientUtil.getFrameworkService().getChildrenFunctionsByParentId(parentId, true); |
| | | } else { |
| | | funcObjs = platformClientUtil.getFrameworkService().getChildrenFunctionsByParentId(parentId, false); |
| | | } |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | log.error(e.code, e.messages); |
| | | } |
| | | return funcObjs; |
| | | } |
| | | |
| | | /** |
| | | * 夿åè½æéæ¯å¦å¼å¯ |
| | | * @return |
| | | */ |
| | | public boolean isFunctionSwithOn() { |
| | | String functionRightSwith = null; |
| | | try { |
| | | functionRightSwith = platformClientUtil.getFrameworkService().getConfigValue("function.right.swith"); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | log.error(e.code, e.messages); |
| | | } |
| | | if(functionRightSwith != null && "on".equalsIgnoreCase(functionRightSwith)){ |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.common.objects.UserEntityObject; |
| | | import com.vci.common.exception.VciException; |
| | | import com.vci.corba.common.PLException; |
| | |
| | | import com.vci.corba.omd.data.AttributeValue; |
| | | import com.vci.corba.omd.data.BusinessObject; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.starter.revision.bo.TreeWrapperOptions; |
| | | import com.vci.starter.web.annotation.*; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | |
| | | * @param cbo ä¸å¡æ°æ® |
| | | * @param obj 对象 |
| | | */ |
| | | public static void copyValueToObjectFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Object obj){ |
| | | public static void copyValueToObjectFromCbos(BusinessObject cbo,Object obj){ |
| | | if(cbo!=null){ |
| | | copyValueToObjectFromBos(cbo.getBusinessObject(),obj); |
| | | copyValueToObjectFromBos(cbo,obj); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param obj 对象 |
| | | * @param fieldAttrMap 屿§æ å° |
| | | */ |
| | | public static void copyValueToObjectFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Object obj,Map<String,String> fieldAttrMap){ |
| | | public static void copyValueToObjectFromCbos(BusinessObject cbo,Object obj,Map<String,String> fieldAttrMap){ |
| | | if(cbo!=null){ |
| | | copyValueToObjectFromBos(cbo.getBusinessObject(),obj,fieldAttrMap); |
| | | copyValueToObjectFromBos(cbo,obj,fieldAttrMap); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param cbo ä¸å¡æ°æ® |
| | | * @param map map |
| | | */ |
| | | public static void copyValueToMapFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Map<String,String> map){ |
| | | public static void copyValueToMapFromCbos(BusinessObject cbo,Map<String,String> map){ |
| | | if(cbo!=null){ |
| | | copyValueToMapFromBos(cbo.getBusinessObject(),map); |
| | | copyValueToMapFromBos(cbo,map); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param clo 龿¥ç±»å |
| | | * @param map map |
| | | */ |
| | | public static void copyValueToMapFromClos(com.vci.client.bof.ClientLinkObject clo,Map<String,String> map){ |
| | | public static void copyValueToMapFromClos(LinkObject clo,Map<String,String> map){ |
| | | if(clo!=null){ |
| | | copyValueToMapFromLos(clo.getLinkObject(),map); |
| | | copyValueToMapFromLos(clo,map); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param obj 对象 |
| | | * @param fieldAttrMap 屿§map |
| | | */ |
| | | public static void copyValueToObjectFromClos(ClientLinkObject clo,Object obj,Map<String,String> fieldAttrMap){ |
| | | public static void copyValueToObjectFromClos(LinkObject clo,Object obj,Map<String,String> fieldAttrMap){ |
| | | if(clo!=null){ |
| | | copyValueToObjectFromLos(clo.getLinkObject(),obj,fieldAttrMap); |
| | | copyValueToObjectFromLos(clo,obj,fieldAttrMap); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param cbo 龿¥ç±»å |
| | | * @param map 对象 |
| | | */ |
| | | public static void copyValueToCboFromMap(com.vci.client.bof.ClientBusinessObject cbo,Map<String,String> map) throws VciBaseException{ |
| | | public static void copyValueToCboFromMap(BusinessObject cbo,Map<String,String> map) throws VciBaseException{ |
| | | if(map!=null){ |
| | | Iterator<String> it = map.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | |
| | | if(value == null){ |
| | | value = ""; |
| | | } |
| | | try { |
| | | if(isDefaultField(key)){ |
| | | setValueToField(key, cbo, value); |
| | | } |
| | | cbo.setAttributeValueWithNoCheck(key.toLowerCase(), value); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | ObjectTool.setBOAttributeValue(cbo,key.toLowerCase(), value); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @param clo 龿¥ç±»å |
| | | * @param map 对象 |
| | | */ |
| | | public static void copyValueToCloFromMap(ClientLinkObject clo,Map<String,String> map) throws VciBaseException{ |
| | | public static void copyValueToCloFromMap(LinkObject clo,Map<String,String> map) throws VciBaseException{ |
| | | if(map!=null){ |
| | | Iterator<String> it = map.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | |
| | | if(value == null){ |
| | | value = ""; |
| | | } |
| | | try { |
| | | if(isDefaultField(key)){ |
| | | setValueToField(key, clo, value); |
| | | }else { |
| | | clo.setAttributeValue(key.toLowerCase(), value); |
| | | } |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | ObjectTool.setLOAttributeValue(clo,key.toLowerCase(), value); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @throws VciBaseException æ·è´åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | public static void copyValueToBoFromObj(BusinessObject bo,Object obj) throws VciBaseException{ |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | | cbo.setBusinessObject(bo); |
| | | BusinessObject cbo = new BusinessObject(); |
| | | cbo = bo; |
| | | copyValueToCboFromObj(cbo,obj); |
| | | bo = cbo.getBusinessObject(); |
| | | bo = cbo; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param obj æ°æ®å¯¹è±¡ |
| | | * @throws VciBaseException æ·è´åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | public static void copyValueToCboFromObj(ClientBusinessObject cbo ,Object obj) throws VciBaseException{ |
| | | public static void copyValueToCboFromObj(BusinessObject cbo ,Object obj) throws VciBaseException{ |
| | | Map<String,String> fieldMap = getFieldNameMap(obj.getClass());//å
æ¥æ¾ææéè¦æä¹
åå°å¹³å°ç屿§ï¼ä¸éè¦æä¹
åçå°±ä¸ç¨èµå¼äº |
| | | Iterator<String> it = fieldMap.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | |
| | | if(value==null){ |
| | | value = ""; |
| | | } |
| | | try { |
| | | if(isDefaultField(fieldName)){ |
| | | setValueToField(fieldName, cbo, value); |
| | | } |
| | | cbo.setAttributeValue(attrName.toLowerCase(), value); |
| | | } catch (PLException e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | ObjectTool.setBOAttributeValue(cbo,attrName.toLowerCase(), value); |
| | | } |
| | | } |
| | | } |
| | |
| | | * @param wrapperOptions å°è£
çä¿¡æ¯ |
| | | * @return æ å表 |
| | | */ |
| | | public static <T,R> List<Tree> cboList2Trees(List<? extends com.vci.client.bof.ClientBusinessObject> doList, TreeWrapperOptions wrapperOptions, Function<T,R> f){ |
| | | public static <T,R> List<Tree> cboList2Trees(List<? extends BusinessObject> doList, TreeWrapperOptions wrapperOptions, Function<T,R> f){ |
| | | if(CollectionUtils.isEmpty(doList)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<Tree> allTree = new ArrayList<Tree>(); |
| | | List<Tree> children = new ArrayList<Tree>(); |
| | | for (int i = 0 ; i < doList.size();i++) { |
| | | com.vci.client.bof.ClientBusinessObject cbo = doList.get(i); |
| | | BusinessObject cbo = doList.get(i); |
| | | Tree tree =new Tree(); |
| | | List<String> oidFieldNames = VciBaseUtil.str2List(wrapperOptions.getOidFieldName()); |
| | | List<String> oidValues = new LinkedList<>(); |
| | | oidFieldNames.stream().forEach( s->{ |
| | | oidValues.add(cbo.getAttributeValue(s)); |
| | | oidValues.add(ObjectTool.getBOAttributeValue(cbo, s)); |
| | | }); |
| | | tree.setOid(oidValues.stream().collect(Collectors.joining(wrapperOptions.getOidValueSep()))); |
| | | if(f !=null){ |
| | |
| | | List<String> textFieldNames = VciBaseUtil.str2List(wrapperOptions.getTextFieldName()); |
| | | List<String> textValues = new LinkedList<>(); |
| | | textFieldNames.stream().forEach( s->{ |
| | | textValues.add(cbo.getAttributeValue(s)); |
| | | textValues.add(ObjectTool.getBOAttributeValue(cbo, s)); |
| | | }); |
| | | tree.setText(textValues.stream().collect(Collectors.joining(wrapperOptions.getTextValueSep()))); |
| | | } |
| | | if(StringUtils.isNotBlank(wrapperOptions.getParentFieldName())){ |
| | | tree.setParentId(cbo.getAttributeValue(wrapperOptions.getParentFieldName())); |
| | | tree.setParentId(ObjectTool.getBOAttributeValue(cbo, wrapperOptions.getParentFieldName())); |
| | | } |
| | | if(wrapperOptions.isAllAttributes()) { |
| | | try { |
| | |
| | | return allTree; |
| | | } |
| | | |
| | | public static com.vci.client.bof.ClientBusinessObject arryAndSqlToClientBusinessObject(String sqlStr,String[] valueArry) { |
| | | com.vci.client.bof.ClientBusinessObject clientBusinessObject = new com.vci.client.bof.ClientBusinessObject(); |
| | | public static BusinessObject arryAndSqlToBusinessObject(String sqlStr,String[] valueArry) { |
| | | BusinessObject BusinessObject = new BusinessObject(); |
| | | try { |
| | | PlainSelect select = (PlainSelect) CCJSqlParserUtil.parse(sqlStr); |
| | | com.vci.corba.omd.data.AttributeValue[] attributeValues = new com.vci.corba.omd.data.AttributeValue[valueArry.length]; |
| | | AttributeValue[] attributeValues = new AttributeValue[valueArry.length]; |
| | | for (int i = 0; i < select.getSelectItems().size(); i++) { |
| | | SelectItem selectItem = select.getSelectItem(i); |
| | | com.vci.corba.omd.data.AttributeValue attributeValue = new com.vci.corba.omd.data.AttributeValue(); |
| | | AttributeValue attributeValue = new AttributeValue(); |
| | | attributeValue.attrName = selectItem.getAlias().getName(); |
| | | attributeValue.attrVal = valueArry[i]; |
| | | attributeValues[i] = attributeValue; |
| | | } |
| | | clientBusinessObject.getBusinessObject().newAttrValList= attributeValues; |
| | | BusinessObject.newAttrValList= attributeValues; |
| | | }catch (Exception e){ |
| | | logger.error("æ°æ®è§£æé误",e); |
| | | return null; |
| | | } |
| | | return clientBusinessObject; |
| | | return BusinessObject; |
| | | } |
| | | } |