From 42c17fe468ceea7e5eed7fec520b9858bed02e85 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期五, 04 八月 2023 17:52:30 +0800 Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs --- Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionEndListener.java | 102 ++++++++++++++ Source/UBCS-WEB/src/components/template/FlowPath.vue | 2 Source/UBCS-WEB/src/components/template/Stage.vue | 8 Source/UBCS-WEB/src/components/Master/MasterTransfer.vue | 109 ++++++++++----- Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue | 31 +++- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java | 2 Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue | 22 ++ Source/UBCS-WEB/src/api/GetItem.js | 9 + Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionStartListener.java | 88 +++++++++++ Source/UBCS-WEB/src/components/Theme/ThemeTemplatePro.vue | 2 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowStatusListener.java | 8 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java | 4 12 files changed, 317 insertions(+), 70 deletions(-) diff --git a/Source/UBCS-WEB/src/api/GetItem.js b/Source/UBCS-WEB/src/api/GetItem.js index 63ba7d3..5ebd527 100644 --- a/Source/UBCS-WEB/src/api/GetItem.js +++ b/Source/UBCS-WEB/src/api/GetItem.js @@ -45,7 +45,14 @@ data }) } - +//宸插彂甯冩暟鎹洿鏀� +export function upSaveCode(data) { + return request({ + url: 'api/ubcs-code/mdmEngineController/upSaveCode', + method: 'POST', + data + }) +} //娴佺▼鎵ц涓〃澶� export function FlowTable(data){ return request({ diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue index 14a58c6..24ea436 100644 --- a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue +++ b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue @@ -57,6 +57,7 @@ data: [] }, exportArr:{}, + exportArrTwo:{}, ids:"" }; }, @@ -68,7 +69,6 @@ //琛ㄥご鏁版嵁 鐢ㄦ潵娓叉煋绌挎妗� tableHeadData: { handler(newval, oldval) { - console.log(newval) if (newval) { // 娓呯┖data鏁扮粍 this.data = []; @@ -80,7 +80,6 @@ key: index, }); }); - console.log(this.data) // excel琛ㄦ牸鏁版嵁杞崲 this.option.column[0].children = newval.map(obj => { return { @@ -107,6 +106,11 @@ codeClassifyOid:{ handler(newval,oldval){ } + }, + value:{ + handler(newval,oldval){ + console.log('value',newval) + } } }, computed:{ @@ -125,16 +129,54 @@ this.$emit('update:visible', false); }, handleExcel(){ - if(this.value <= 0){ - this.$message.warning('璇烽�夋嫨灞炴��') - }else { this.value.map(index => this.tableHeadData[index].prop).forEach((item, index) => { this.exportArr[`attrIdIndexMap[${index}]`] = item }) if(this.radio === 0){ if(this.selectRow.length<=0){ - this.ids=this.tableData.map(item => item.oid).join(',') - exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArr,limit:-1}).then(res=>{ + this.$message.warning('璇烽�夋嫨瑕佸鍑虹殑妯℃澘') + }else { + //宸查�夋嫨澶氶�� + const selectList=[] + //宸查�夋嫨灞炴�� + let exportArr={} + this.ids = this.selectRow.map(item => item.oid).join(',') + this.selectRow.forEach(item=>{ + selectList.push( + item.oid + ) + }) + if(this.value <= 0){ + this.tableHeadData.map(item => item.prop) + .forEach((prop, index) => { + this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop; + }); + exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':this.ids,...this.exportArrTwo,limit:-1}).then(res=>{ + // console.log('res',res) + if(res){ + func.downloadFileByBlobHandler(res); + this.escHandler() + } + }) + }else { + + exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':this.ids,...this.exportArr}).then(res=>{ + // console.log('res',res) + if(res){ + func.downloadFileByBlobHandler(res); + this.escHandler() + } + }) + + } + } + }else if(this.radio === 1){ + if(this.value <= 0){ + this.tableHeadData.map(item => item.prop) + .forEach((prop, index) => { + this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop; + }); + exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArrTwo,limit:-1}).then(res=>{ // console.log('res',res) if(res){ func.downloadFileByBlobHandler(res); @@ -142,34 +184,14 @@ } }) }else { - //宸查�夋嫨澶氶�� - const selectList=[] - //宸查�夋嫨灞炴�� - let exportArr={} - const ids = this.selectRow.map(item => item.oid).join(',') - this.selectRow.forEach(item=>{ - selectList.push( - item.oid - ) - }) - exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':this.ids,...this.exportArr}).then(res=>{ + exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArr,limit:-1}).then(res=>{ // console.log('res',res) if(res){ func.downloadFileByBlobHandler(res); this.escHandler() } }) - } - }else if(this.radio === 1){ - this.ids=this.tableData.map(item => item.oid).join(',') - exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArr,limit:-1}).then(res=>{ - // console.log('res',res) - if(res){ - func.downloadFileByBlobHandler(res); - this.escHandler() - } - }) }else if(this.radio === 2){ const input = this.pageExport.trim(); let start, end; @@ -195,17 +217,28 @@ return; } } - exportCode({ codeClassifyOid: this.codeClassifyOid, ...this.exportArr, limit: this.limit, page: start, endPage: end }).then((res) => { - // console.log('res',res) - if (res) { - func.downloadFileByBlobHandler(res); - this.escHandler() - } - }); + if(this.value >=1 ){ + exportCode({ codeClassifyOid: this.codeClassifyOid, ...this.exportArr, limit: this.limit, page: start, endPage: end }).then((res) => { + // console.log('res',res) + if (res) { + func.downloadFileByBlobHandler(res); + this.escHandler() + } + }); + }else { + this.tableHeadData.map(item => item.prop) + .forEach((prop, index) => { + this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop; + }); + exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArrTwo,limit:this.limit,page: start, endPage: end}).then(res=>{ + // console.log('res',res) + if(res){ + func.downloadFileByBlobHandler(res); + this.escHandler() + } + }) + } } - - } - }, } } diff --git a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue index cc7c67f..d7adab9 100644 --- a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue +++ b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue @@ -67,7 +67,7 @@ :disabledProp="disabledProp" :rowOid="rowOid" :templateOid="templateOid" :title="'宸插彂甯冩暟鎹洿鏀�'" type="edit" - :visible.sync="DataVisible"></FormTemplateDialog> + :visible.sync="DataVisible" @submit="updataSumbit"></FormTemplateDialog> <!-- 鍙戝竷--> <set-personnel :parameter="this.parameter" :title="title" :visible.sync="visibleFlow" @onLoad="onLoad"></set-personnel> @@ -116,7 +116,7 @@ </basic-container> </template> <script> -import {MasterTable, TableData, FindData, addSaveCode, editSaveCode, deleteCode} from "@/api/GetItem"; +import {MasterTable, TableData, FindData, addSaveCode, editSaveCode, deleteCode, upSaveCode} from "@/api/GetItem"; import {processTS, changeStatus} from "@/api/template/setPersonnel" import {listCodeAttributeByClassId} from "@/api/integration/integration.js"; import integrationTransfer from "@/views/integration/integrationTransfer"; @@ -300,8 +300,6 @@ }, tableDataArray: { handler(newval, oldval) { - this.keyWordFind=''; - this.WupinFindValue='' this.tableData = newval; this.searchResults = newval this.doLayout() @@ -323,8 +321,13 @@ } } } + + if(_index==0){ + this.keyWordFind=record.field + } }) this.tableHeadFindDatas = newval; + this.WupinFindValue='' }, }, total: { @@ -849,6 +852,7 @@ this.$message.warning("鍙湁鐘舵�佷负宸插彂甯冪殑鏁版嵁鎵嶈兘杩涜鏁版嵁鏇存敼"); } else { this.DataVisible = true; + this.rowOid = this.selectRow[0]['oid'] } }, //澧炲姞淇濆瓨 @@ -860,9 +864,23 @@ }) }) }, + //淇敼鍥炶皟 EditSumbit(val) { this.editvisible = false; editSaveCode(val).then(res => { + this.$nextTick(() => { + this.onLoad() + }) + }) + }, + //鏁版嵁鏇存敼鍥炶皟 + updataSumbit(val){ + this.DataVisible = false; + val.copyfromversion = this.rowOid; + val.oid='' + console.log(val) + upSaveCode(val).then(res=>{ + console.log(res) this.$nextTick(() => { this.onLoad() }) @@ -875,10 +893,10 @@ }, //杈撳叆鍥炶溅鎼滅储 tableFindInp() { - if (this.WupinFindValue.trim() === '') { + /*if (this.WupinFindValue.trim() === '') { this.$message.warning('杈撳叆鍊间笉鑳戒负绌�') return; - } + }*/ TableData({ templateOid: this.templateOid, codeClassifyOid: this.codeClassifyOid, @@ -886,7 +904,6 @@ limit: this.page.pageSize, [ 'conditionMap[' + this.keyWordFind + ']']: '*' + this.WupinFindValue + '*' }).then(res => { - console.log(res) this.tableData = res.data.data }) } diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue index 3e6f995..9738222 100644 --- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue +++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue @@ -121,12 +121,12 @@ </div> </el-dialog> <!-- 妯℃澘鍏嬮殕 --> - <el-dialog :visible.sync="CloneVisible" append-to-body title="鍏嬮殕妯℃澘"> + <el-dialog :visible.sync="CloneVisible" append-to-body title="鍏嬮殕妯℃澘" :before-close="cloneClose"> <el-container> <el-aside width="300px"> <div style="margin-bottom: 5px"><el-tag>涓婚搴撳垎绫�</el-tag></div> <!-- 鍏嬮殕妯℃澘鐨勬爲 娌跨敤棣栭〉鏍戠殑loading鍜宱ption锛屼絾鏄痙ata鍜寁-model缁戝畾鐨勬暟鎹垱寤轰竴涓柊鐨勫彉閲忥紝鍙﹀鐐瑰嚮鏂规硶涔熸槸閲嶆柊鑾峰彇鏉ユ搷浣滃厠闅嗘ā鏉跨殑鏁版嵁--> - <avue-tree v-model="TreeAvueform" v-loading="loading" :data="Treedata" + <avue-tree ref="cloneTree" v-model="TreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false" :option="Treeoption" style="height: 50.5vh;margin-right: 10px" @@ -160,7 +160,7 @@ </el-container > <div style="display: flex; justify-content: flex-end; align-items: center;margin-top: 10px" > <el-button size="small " type="primary" @click="Clonehandler">纭畾</el-button> - <el-button size="small" @click="CloneVisible=false" >鍙栨秷</el-button> + <el-button size="small" @click="cloneClose" >鍙栨秷</el-button> </div> <el-dialog width="30%" @@ -1361,6 +1361,13 @@ }); }) }, + //鍏嬮殕鍙栨秷 + cloneClose(){ + this.$refs.cloneTree.setCurrentKey(null) + this.ClonenodeClickList = {} + this.CloneFormlist=[] + this.CloneVisible=false; + }, //鍏嬮殕妯℃澘鏌ヨ CloneEnterFind(){ gridCodeClassifyTemplate().then(res => { @@ -1410,14 +1417,19 @@ }, //鍏嬮殕妯℃澘鍗曢�夋鏀瑰彉 selectionChange(row) { - Object.assign(this.CloneModel, row[0]); - this.CloneSelect = [row[0]]; + this.CloneSelect = row; + const { id, name } = row[0]; + this.CloneModel = { id, name }; this.CloneSelect[0].codeclassifyoid = this.nodeClickList.oid; + console.log('row',row) + console.log('CloneSelect',this.CloneSelect) + console.log('CloneModel',this.CloneModel) }, //鍏嬮殕琛ㄥ崟鎻愪氦 Clonesubmit(row, done) { // 閲嶆柊璧嬪�糃loneSelect浼犻�掔殑鏁版嵁涓鸿緭鍏ユ鍙互淇敼鐨勬暟鎹紝CloneModel鎻愪氦琛ㄥ崟杈撳叆妗嗗弻鍚戠粦瀹氭暟鎹� Object.assign(this.CloneSelect[0], this.CloneModel); + // CloneSelect鏁扮粍绗竴椤� 鍖归厤CloneModel瀵硅薄 copy(this.CloneSelect[0]) .then(() => { // 鍥犱负鏄祵濂楀脊绐楁墍浠ユ墜鍔ㄥ叧闂瑿loneinnerVisible锛孋loneVisible涓や釜寮圭獥銆� diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeTemplatePro.vue b/Source/UBCS-WEB/src/components/Theme/ThemeTemplatePro.vue index 160c034..3caff98 100644 --- a/Source/UBCS-WEB/src/components/Theme/ThemeTemplatePro.vue +++ b/Source/UBCS-WEB/src/components/Theme/ThemeTemplatePro.vue @@ -5,7 +5,7 @@ <attrCrud :ProData="ProData" :crudOid="crudOid" :checkStatus="checkStatus" :crudLCStatus="crudLCStatus" :crudArray="crudArray" :Formlist="Formlist" :codeClassifyOid="codeClassifyOid"></attrCrud> </span> <span v-else-if="type.prop==='tab2'"> - <FlowPath ref="FlowPath" :code="this.crudOid" :checkStatus="checkStatus" :crudLCStatus="crudLCStatus" :Formlist="Formlist"></FlowPath> + <FlowPath ref="FlowPath" :code="this.crudOid" :checkStatus="checkStatus" :crudLCStatus="crudLCStatus" :Formlist="Formlist"></FlowPath> </span> <span v-else-if="type.prop==='tab3'"> <stage ref="stage" :code="this.crudOid" :Formlist="Formlist"></stage> diff --git a/Source/UBCS-WEB/src/components/template/FlowPath.vue b/Source/UBCS-WEB/src/components/template/FlowPath.vue index b1e37dd..f3d30c7 100644 --- a/Source/UBCS-WEB/src/components/template/FlowPath.vue +++ b/Source/UBCS-WEB/src/components/template/FlowPath.vue @@ -2,7 +2,7 @@ <avue-crud ref="crud" :table-loading="loading" :data="data" v-model="form" :option="option" :page.sync="page" :search.sync="search" @on-load="getDataList" @row-save="handleSave" @row-del="handleDelete" @row-update="handleEdit" @refresh-change="handleRefresh" @size-change="handleSizePage" - @current-change="handleCurrentPage"> + @current-change="handleCurrentPage" v-if="Formlist.length>0"> </avue-crud> </template> diff --git a/Source/UBCS-WEB/src/components/template/Stage.vue b/Source/UBCS-WEB/src/components/template/Stage.vue index e440f54..a4bd748 100644 --- a/Source/UBCS-WEB/src/components/template/Stage.vue +++ b/Source/UBCS-WEB/src/components/template/Stage.vue @@ -1,5 +1,5 @@ <template> - <div> + <div v-if="Formlist.length>0"> <avue-crud ref="crud" :table-loading="loading" :data="data" :option="option" :page.sync="page" @on-load="getDataList" @size-change="handleSizePage" @current-change="handleCurrentPage" @row-click="handleRowClick"> @@ -35,7 +35,11 @@ typeof: String, required: true, default: "" - } + }, + Formlist:{ + type:Array, + default:[] + } }, watch: { code: { diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionEndListener.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionEndListener.java index 2d19f54..d1a818d 100644 --- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionEndListener.java +++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionEndListener.java @@ -1,19 +1,115 @@ package com.vci.ubcs.flow.engine.envent; +import com.vci.ubcs.flow.core.dto.FlowStatusDTO; +import com.vci.ubcs.flow.engine.constant.FlowEngineConstant; +import com.vci.ubcs.flow.engine.utils.FlowableUtils; +import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.util.LangBaseUtil; +import com.vci.ubcs.starter.web.util.VciBaseUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.TaskService; import org.flowable.engine.delegate.DelegateExecution; import org.flowable.engine.delegate.ExecutionListener; +import org.flowable.engine.impl.el.FixedValue; +import org.springblade.core.jwt.JwtUtil; +import org.springblade.core.launch.constant.TokenConstant; +import org.springblade.core.tool.utils.WebUtil; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; +import java.util.List; import java.util.Map; @Slf4j @Component -public class FlowExecutionEndListener implements ExecutionListener { +public class FlowExecutionEndListener implements ExecutionListener, ApplicationContextAware { + + /** + * 杩滅▼璋冪敤鍦板潃銆傚垏璁帮細鍚嶇О瑕佷笌娴佺▼涓畾涔夌殑涓�鏍� + */ + private FixedValue remoteMethod; + + /** + * 鐘舵�佸�笺�傚垏璁帮細鍚嶇О瑕佷笌娴佺▼涓畾涔夌殑涓�鏍� + */ + private FixedValue statusValue; + + private static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext arg0) throws BeansException { + applicationContext = arg0; + } @Override public void notify(DelegateExecution execution) { - Map var = execution.getVariableInstances(); - log.info("鎵ц娴佺▼FlowExecutionEndListener",var); + Map variables = execution.getVariables(); + String restURL = remoteMethod.getExpressionText(); + String status = statusValue.getExpressionText(); + //鑾峰彇涓氬姟鏁版嵁淇℃伅 + List<String> oids = (List<String>) variables.get(FlowEngineConstant.OIDS); + String btmType = (String) variables.get(FlowEngineConstant.BTMTYPE); + + variables.put(FlowEngineConstant.REMOTE_METHOD,restURL); + variables.put(FlowEngineConstant.STATUS_VALUE,status); + + if(CollectionUtils.isEmpty(oids)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛屼笟鍔℃暟鎹畂id涓虹┖锛�"); + } + if(StringUtils.isEmpty(btmType)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛屼笟鍔$被鍨媌tmType涓虹┖锛�"); + } + if(StringUtils.isEmpty(restURL)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛岃繙绋嬭皟鐢ㄥ湴鍧�涓虹┖锛�"); + } + if(StringUtils.isEmpty(status)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛岀姸鎬佷负绌猴紒"); + } + + HistoryService historyService = applicationContext.getBean(HistoryService.class); + TaskService taskService = applicationContext.getBean(TaskService.class); + + FlowStatusDTO flowStatusDTO = new FlowStatusDTO(); + flowStatusDTO.setBtmType(btmType); + flowStatusDTO.setOids(oids); + flowStatusDTO.setVariableMap(variables); + flowStatusDTO.setTaskHisVOList(FlowableUtils.listTaskHistory(execution.getProcessInstanceId(),historyService,taskService)); + + String token = JwtUtil.getToken(WebUtil.getRequest().getHeader(TokenConstant.HEADER)); + + HttpComponentsClientHttpRequestFactory requestFactory=new HttpComponentsClientHttpRequestFactory(); + requestFactory.setReadTimeout(300000); + requestFactory.setConnectionRequestTimeout(300000); + requestFactory.setConnectTimeout(300000); + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add(TokenConstant.HEADER,token); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity httpEntity = new HttpEntity<>(flowStatusDTO,headers); + Map<String, Object> result = null; + try { + result = restTemplate.postForObject(restURL, httpEntity, Map.class); + } catch (HttpClientErrorException e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); + }catch (Throwable e){ + throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); + } + if(result == null){ + throw new VciBaseException("涓氬姟浜嬩欢鏃跺�欐病鏈夎繑鍥炲�硷紝涓嶇‘瀹氭槸鍚︽墽琛屾垚鍔�"); + } + if(CollectionUtils.isEmpty(result) && !(Boolean) result.get("success")){ + throw new VciBaseException((String) result.get("message")); + } } } diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionStartListener.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionStartListener.java index 7cf0d5e..85cf487 100644 --- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionStartListener.java +++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowExecutionStartListener.java @@ -1,25 +1,101 @@ package com.vci.ubcs.flow.engine.envent; import com.vci.ubcs.code.feign.IFlowEventClient; +import com.vci.ubcs.flow.core.dto.FlowStatusDTO; +import com.vci.ubcs.flow.engine.constant.FlowEngineConstant; +import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.util.LangBaseUtil; +import com.vci.ubcs.starter.web.util.VciBaseUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.flowable.engine.delegate.DelegateExecution; import org.flowable.engine.delegate.ExecutionListener; +import org.flowable.engine.impl.el.FixedValue; +import org.springblade.core.jwt.JwtUtil; +import org.springblade.core.launch.constant.TokenConstant; +import org.springblade.core.tool.utils.WebUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; import javax.annotation.Resource; +import java.util.List; import java.util.Map; @Slf4j -//@Component +@Component public class FlowExecutionStartListener implements ExecutionListener { - @Autowired(required = false) - private IFlowEventClient iFlowEventClient; + + /** + * 杩滅▼璋冪敤鍦板潃銆傚垏璁帮細鍚嶇О瑕佷笌娴佺▼涓畾涔夌殑涓�鏍� + */ + private FixedValue remoteMethod; + + /** + * 鐘舵�佸�笺�傚垏璁帮細鍚嶇О瑕佷笌娴佺▼涓畾涔夌殑涓�鏍� + */ + private FixedValue statusValue; @Override public void notify(DelegateExecution execution) { - Map var = execution.getVariableInstances(); - iFlowEventClient.flowStart(var); - log.info("鎵ц娴佺▼FlowExecutionStartListener",var); + Map variables = execution.getVariables(); + + String restURL = remoteMethod.getExpressionText(); + String status = statusValue.getExpressionText(); + //鑾峰彇涓氬姟鏁版嵁淇℃伅 + List<String> oids = (List<String>) variables.get(FlowEngineConstant.OIDS); + String btmType = (String) variables.get(FlowEngineConstant.BTMTYPE); + + variables.put(FlowEngineConstant.REMOTE_METHOD,restURL); + variables.put(FlowEngineConstant.STATUS_VALUE,status); + + if(CollectionUtils.isEmpty(oids)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛屼笟鍔℃暟鎹畂id涓虹┖锛�"); + } + if(StringUtils.isEmpty(btmType)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛屼笟鍔$被鍨媌tmType涓虹┖锛�"); + } + if(StringUtils.isEmpty(restURL)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛岃繙绋嬭皟鐢ㄥ湴鍧�涓虹┖锛�"); + } + if(StringUtils.isEmpty(status)){ + throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛岀姸鎬佷负绌猴紒"); + } + + FlowStatusDTO flowStatusDTO = new FlowStatusDTO(); + flowStatusDTO.setBtmType(btmType); + flowStatusDTO.setOids(oids); + flowStatusDTO.setVariableMap(variables); + + String token = JwtUtil.getToken(WebUtil.getRequest().getHeader(TokenConstant.HEADER)); + HttpComponentsClientHttpRequestFactory requestFactory=new HttpComponentsClientHttpRequestFactory(); + requestFactory.setReadTimeout(300000); + requestFactory.setConnectionRequestTimeout(300000); + requestFactory.setConnectTimeout(300000); + RestTemplate restTemplate = new RestTemplate(requestFactory); + HttpHeaders headers = new HttpHeaders(); + headers.add(TokenConstant.HEADER,token); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity httpEntity = new HttpEntity<>(flowStatusDTO,headers); + Map<String, Object> result = null; + try { + result = restTemplate.postForObject(restURL, httpEntity, Map.class); + } catch (HttpClientErrorException e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); + }catch (Throwable e){ + throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); + } + if(result == null){ + throw new VciBaseException("涓氬姟浜嬩欢鏃跺�欐病鏈夎繑鍥炲�硷紝涓嶇‘瀹氭槸鍚︽墽琛屾垚鍔�"); + } + if(CollectionUtils.isEmpty(result) && !(Boolean) result.get("success")){ + throw new VciBaseException((String) result.get("message")); + } } } diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowStatusListener.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowStatusListener.java index f932e49..ffe275d 100644 --- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowStatusListener.java +++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/envent/FlowStatusListener.java @@ -29,6 +29,7 @@ import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; +import java.util.List; import java.util.Map; @Slf4j @@ -62,13 +63,13 @@ String restURL = remoteMethod.getExpressionText(); String status = statusValue.getExpressionText(); //鑾峰彇涓氬姟鏁版嵁淇℃伅 - String oids = (String) taskVariable.get(FlowEngineConstant.OIDS); + List<String> oids = (List<String>) taskVariable.get(FlowEngineConstant.OIDS); String btmType = (String) taskVariable.get(FlowEngineConstant.BTMTYPE); taskVariable.put(FlowEngineConstant.REMOTE_METHOD,restURL); taskVariable.put(FlowEngineConstant.STATUS_VALUE,status); - if(StringUtils.isEmpty(oids)){ + if(CollectionUtils.isEmpty(oids)){ throw new VciBaseException("鎵ц鐘舵�佷慨鏀逛簨浠舵椂锛屼笟鍔℃暟鎹畂id涓虹┖锛�"); } if(StringUtils.isEmpty(btmType)){ @@ -86,7 +87,7 @@ FlowStatusDTO flowStatusDTO = new FlowStatusDTO(); flowStatusDTO.setBtmType(btmType); - flowStatusDTO.setOids(VciBaseUtil.str2List(oids)); + flowStatusDTO.setOids(oids); flowStatusDTO.setVariableMap(taskVariable); flowStatusDTO.setTaskHisVOList(FlowableUtils.listTaskHistory(delegateTask.getProcessInstanceId(),historyService,taskService)); @@ -115,7 +116,6 @@ if(CollectionUtils.isEmpty(result) && !(Boolean) result.get("success")){ throw new VciBaseException((String) result.get("message")); } - } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java index e2a1347..9cb28be 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java @@ -235,12 +235,14 @@ // .selectOne(Condition.getQueryWrapper(condition,CodeClassify.class)); if(detail == null){//涓嶆槸鏈�鏂扮殑涓嶈鏀� throw new ServiceException("褰撳墠鏁版嵁涓嶆槸鏈�鏂帮紝璇峰埛鏂板悗鍐嶄慨鏀癸紒"); -// return R.fail("褰撳墠鏁版嵁涓嶆槸鏈�鏂帮紝璇峰埛鏂板悗鍐嶄慨鏀癸紒"); } //鏍¢獙涓嬬骇鏄惁鏈夊紩鐢� if(checkChildIsLinked(detail.getOid())){ return R.fail("dataCascadeLinkedNotDelete"); } + if(checkHasChild(detail.getOid())){ + return R.fail("姝ゆ暟鎹湁涓嬬骇锛屾棤娉曡繘琛屽垹闄わ紒"); + } return R.status(!checkHasChild(detail.getOid())); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java index 3034c7a..3f9b7f7 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyTemplateAttrServiceImpl.java @@ -309,7 +309,7 @@ query.setCurrent(pageHelper.getPage()); } IPage<CodeClassifyTemplateAttr> doList = baseMapper. - selectPage(Condition.getPage(query), UBCSCondition.getQueryWrapperByMapString(conditionMap,CodeClassifyTemplateAttr.class)); + selectPage(Condition.getPage(query), UBCSCondition.getQueryWrapperByMapString(conditionMap,CodeClassifyTemplateAttr.class).orderByAsc("ordernum")); if (!CollectionUtils.isEmpty(doList.getRecords())) { dataGrid.setData(codeClassifyTemplateAttrDO2VOs(doList.getRecords())); dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(baseMapper.selectCount(UBCSCondition.getQueryWrapperByMapString(conditionMap,CodeClassifyTemplateAttr.class))))); -- Gitblit v1.9.3