From dd678ba29a3631558ab0c0c90b5be73ae489324b Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期二, 02 七月 2024 17:00:33 +0800 Subject: [PATCH] 升版本/次等功能上传 --- Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/service/RevisionModelUtil.java | 19 +++--- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java | 3 - Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java | 1 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java | 12 +++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java | 27 ++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java | 4 - Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java | 84 ++++++++++++++++++++------- Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java | 5 + 8 files changed, 112 insertions(+), 43 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/service/RevisionModelUtil.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/service/RevisionModelUtil.java index 736f373..8f6f784 100644 --- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/service/RevisionModelUtil.java +++ b/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; } diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java index 6f6112f..9679f27 100644 --- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java +++ b/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; } //鑾峰彇閰嶇疆鏂囦欢涓紝涓嶆牎楠屾潈闄愮殑璺緞 diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java index 712ad4a..906cf78 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciFileUploadController.java +++ b/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 ) { diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java index f342ec9..63796de 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java +++ b/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 @@ } /** - * 鏁版嵁鍗囩増锛屽墠绔娇鐢↗SON鎻愪氦 + * 鏁版嵁鍗囩増鏈�/娆★紝鍓嶇浣跨敤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鍜宼s * @return 鎵ц鐨勭粨鏋� diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java index 0cd9432..e5a20a8 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java +++ b/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; } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java index 93c7710..a9e66f5 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java +++ b/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(); + } } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java index 09addb7..55ac98a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/VciFileUploadServiceImpl.java +++ b/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(); diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java index f53eb5b..9938b92 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java +++ b/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"); -- Gitblit v1.9.3