Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/service/RevisionModelUtil.java
@@ -395,16 +395,15 @@ */ public boolean checkDataSecret(BaseModel baseModel) throws VciBaseException{ VciBaseUtil.alertNotNull(baseModel,"要校验密级的数据对象"); //todo 登录还未启用,所以密级无法获取需要修改 // if(isCheckSecret(baseModel) && VciBaseUtil.getCurrentUserSecret()>0) { // if (baseModel.getSecretGrade() == null ) { // baseModel.setSecretGrade(DataSecretEnum.NONE.getValue()); // } // Integer userSecret = VciBaseUtil.getCurrentUserSecret(); // if (!checkUserSecret(baseModel.getSecretGrade())) { // throw new VciBaseException("当前用户的密级低于数据的密级,用户密级为" + UserSecretEnum.getSecretText(userSecret) + ",数据密级为" + DataSecretEnum.getSecretText(baseModel.getSecretGrade())); // } // } if(isCheckSecret(baseModel) && VciBaseUtil.getCurrentUserSecret()>0) { if (baseModel.getSecretGrade() == null ) { baseModel.setSecretGrade(DataSecretEnum.NONE.getValue()); } Integer userSecret = VciBaseUtil.getCurrentUserSecret(); if (!checkUserSecret(baseModel.getSecretGrade())) { throw new VciBaseException("当前用户的密级低于数据的密级,用户密级为" + UserSecretEnum.getSecretText(userSecret) + ",数据密级为" + DataSecretEnum.getSecretText(baseModel.getSecretGrade())); } } return true; } Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java
@@ -99,6 +99,11 @@ //虽然不校验权限,但是如果token不为空,需要更新当前用户 SessionInfo sessionInfo = getSessionInfo(userToken); if(sessionInfo != null){ //初始化平台的token vciSessionForLoginI.initInvocationInfo(sessionInfo); } return true; } //获取配置文件中,不校验权限的路径 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java
@@ -48,7 +48,6 @@ * @return 文件信息显示对象 */ @PostMapping("/uploadFile") @VciUnCheckRight public BaseResult<VciFileObjectVO> uploadFile(MultipartFile file, VciFileObjectDTO fileObjectDTO){ try { if (file != null ) { Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java
@@ -1,5 +1,7 @@ package com.vci.web.controller; import com.vci.corba.common.PLException; import com.vci.corba.omd.data.BusinessObject; import com.vci.starter.web.annotation.controller.VciUnCheckRight; import com.vci.starter.web.annotation.log.VciBusinessLog; import com.vci.starter.web.pagemodel.*; @@ -13,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -115,17 +119,36 @@ } /** * 数据升版,前端使用JSON提交 * 数据升版本/次,前端使用JSON提交 * @param formDataDTO 表单数据 * @return 执行的结果 */ @PutMapping("/upRevision") @VciBusinessLog(operateName = "数据升版",description = "${param.btmname}里的${param.copyFromVersion}") public BaseResult<Map<String,Object>> upRevision(@RequestBody FormDataDTO formDataDTO){ public BaseResult<Map<String, Object>> upRevision(@RequestBody FormDataDTO formDataDTO) throws PLException { return uiDataService.upRevision(formDataDTO); } /** * 数据升版本/次,前端使用JSON提交 * @param btmname 业务类型的信息 * @param oid 业务数据的主键 * @param type 1:版次对象;2:版本对象;3:主对象 * @return 执行的结果 */ @DeleteMapping("/deleteBusinessObject") public BaseResult deleteBusinessObject(String btmname , String oid, int type) { try { return uiDataService.deleteBusinessObject(btmname, oid, type); }catch (PLException e){ BaseResult<Object> objectBaseResult = new BaseResult<>(); objectBaseResult.setCode(Integer.parseInt(e.code)); objectBaseResult.setMsg(Arrays.toString(e.messages)); return objectBaseResult; } } /** * 删除数据 * @param deleteDataDTO 删除的数据,需要有oid和ts * @return 执行的结果 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java
@@ -1,5 +1,6 @@ package com.vci.web.service; import com.vci.corba.common.PLException; import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.omd.data.LinkObject; import com.vci.corba.omd.data.RevisionDataInfo; @@ -175,7 +176,7 @@ * @return 执行结果和显示后的值 * @throws VciBaseException 保存出错的时候会抛出异常 */ BaseResult<Map<String, Object>> upRevision(FormDataDTO formDataDTO) throws VciBaseException; BaseResult<Map<String, Object>> upRevision(FormDataDTO formDataDTO) throws VciBaseException, PLException; /** * 批量修改,注意表单定义的字段才会被修改,ts这种默认字段除外 @@ -248,4 +249,13 @@ * @return 业务数据的属性信息 */ List<Map<String,String>> getDataAttr(String btmName, String oid); /** * 数据升版本/次,前端使用JSON提交 * @param btmname 业务类型的信息 * @param oid 业务数据的主键 * @param type 1:版次对象;2:版本对象;3:主对象 * @return 执行的结果 */ BaseResult deleteBusinessObject(String btmname, String oid, int type) throws PLException; } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
@@ -2,10 +2,7 @@ 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.corba.omd.data.RevisionDataInfo; import com.vci.corba.omd.data.VersionDataInfo; import com.vci.corba.omd.data.*; import com.vci.corba.omd.lcm.LifeCycle; import com.vci.file.pagemodel.VciFileObjectVO; import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; @@ -1243,7 +1240,7 @@ if(baseModel.getRevisionValue() == null){ baseModel.setRevisionValue(""); } return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextRevisionValueObject(WebUtil.getTableName(btmTypeVO.getId()),baseModel.getNameOid(),btmTypeVO.getRevisionRuleId(),btmTypeVO.isInputRevisionFlag(),baseModel.getRevisionValue())); return changeRevisionValueInfoToObject(platformClientUtil.getBOFactoryService().getNextRevisionValueObject(btmTypeVO.getId(),baseModel.getNameOid(),btmTypeVO.getRevisionRuleId(),btmTypeVO.isInputRevisionFlag(),baseModel.getRevisionValue())); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1429,7 +1426,7 @@ * @throws VciBaseException 保存出错的时候会抛出异常 */ @Override public BaseResult<Map<String, Object>> upRevision(FormDataDTO formDataDTO) throws VciBaseException { public BaseResult<Map<String, Object>> upRevision(FormDataDTO formDataDTO) throws VciBaseException, PLException { //首先判断对象是否为空 VciBaseUtil.alertNotNull(formDataDTO,"修改的数据对象",formDataDTO.getBtmname(),"业务类型的名称",formDataDTO.getFormDefineId(),"表单定义的编号",formDataDTO.getCopyFromVersion(),"老版本的主键"); UIFormDefineVO formDefineVO = uiEngineService.getFormById(formDataDTO.getBtmname(), formDataDTO.getFormDefineId()); @@ -1440,28 +1437,40 @@ //说明前置事件没有执行成功 return beforeResult; } //封装数据 BaseResult<BusinessObject> resultCbo = wrapperCbo(formDataDTO,formDefineVO,false,formDataDTO.isUpVersion()?false:true,formDataDTO.isUpVersion()); if(!resultCbo.isSuccess()){ return BaseResult.fail(resultCbo.getMsg(),resultCbo.getMsgObjs()); List<BusinessObject> businessObjects = null; Date ts = formDataDTO.getTs(); Map<String,String> conditionMap = WebUtil.getOidQuery(formDataDTO.getCopyFromVersion()); conditionMap.put("ts", VciDateUtil.date2Str(ts,VciDateUtil.DateTimeMillFormat)); conditionMap.put("oid",formDataDTO.getCopyFromVersion()); businessObjects = boService.queryCBO(formDataDTO.getBtmname(), conditionMap); if(businessObjects.size() ==0){ throw new VciBaseException("数据不是最新的,建议您刷新后重新操作"); } //扩展属性的值 Map<String, String> data = formDataDTO.getData(); Map<String,String> dataLow = new HashMap<>(); data.forEach((key,value)->{ dataLow.put(key.toLowerCase(),value); }); Map<String,String> baseDataMap = formDataDTO2MapLow(formDataDTO); Map<String,String> allDataMapLow = new HashMap<>(); allDataMapLow.putAll(dataLow); allDataMapLow.putAll(baseDataMap); //判断唯一项 BaseResult baseResult = checkUnique(formDefineVO, null, allDataMapLow, true); if(!baseResult.isSuccess()){ return baseResult; } BusinessObject businessObject = platformClientUtil.getBOFService() .revisionBusinessObject(businessObjects.get(0), null, !formDataDTO.isUpVersion(),true, false, false); //执行保存 BaseResult<Map<String,Object>> result = BaseResult.success(); try { 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().btName,resultCbo.getObj().oid,formDataDTO.getReleaseFileOids()); } BaseResult<Map<String, Object>> result = BaseResult.success(); result.setObj(boService.cbo2Map(businessObject)); //后置事件 String afterEvent = formDataDTO.getPostEvent(); try { callPostEvent(Arrays.stream(new BusinessObject[]{resultCbo.getObj()}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); callPostEvent(Arrays.stream(new BusinessObject[]{businessObject}).collect(Collectors.toList()), null,afterEvent, VciChangeDocumentTypeEnum.EDIT); }catch (Throwable e){ throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); } @@ -2454,4 +2463,33 @@ } return dataMap; } /** * 数据升版本/次,前端使用JSON提交 * @param btmname 业务类型的信息 * @param oid 业务数据的主键 * @param type 1:版次对象;2:版本对象;3:主对象 * @return 执行的结果 */ @Override public BaseResult deleteBusinessObject(String btmname, String oid, int type) throws PLException { List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid)); BaseResult<Object> objectBaseResult = new BaseResult<>(); if(cbos.size() == 0){ objectBaseResult.setSuccess(false); throw new PLException("500", new String[]{"没有获取到数据的主键"}); } for (BusinessObject cbo : cbos) { if(StringUtils.isBlank(cbo.revisionid)){ String revisionoid = Arrays.stream(cbo.hisAttrValList).filter(e -> e.attrName.equals("REVISIONOID")).findFirst().map(e -> e.attrVal).orElse(""); cbo.revisionid = revisionoid; } // cbo.revisionid = hisAttrValList. boolean b = platformClientUtil.getBOFService().deleteBusinessObject(cbo,type); if(!b){ throw new PLException("500", new String[]{"数据删除失败!!"}); } } return BaseResult.success(); } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java
@@ -205,9 +205,6 @@ if(vciFileObjectDO.getSecretGrade() == null) { vciFileObjectDO.setSecretGrade(DataSecretEnum.NONE.getValue()); } //todo 登录还未弄好需要修改 vciFileObjectDO.setCreator("1"); vciFileObjectDO.setLastModifier("1"); revisionModelUtil.wrapperForAdd(vciFileObjectDO); //随机路径 String randomPath = VciBaseUtil.getPk(); Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -154,9 +154,7 @@ if(btmName!=null){ btmName = btmName.trim().toLowerCase(); } //todo 由于登录问题后续需要修改 // String userid = WebUtil.getCurrentUserId(); String userid = "1"; String userid = WebUtil.getCurrentUserId(); if(!hasCreatedCbos.containsKey(btmName)){ if(StringUtils.isEmpty(userid)){ throw new VciBaseException(msgCodePrefix +"noHasUserid");