From ae34f677cd5d64e50f4ce02bd023a4426f32776a Mon Sep 17 00:00:00 2001 From: fujunling <2984387807@qq.com> Date: 星期三, 05 七月 2023 17:18:05 +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/service/impl/VCIFlowserviceImpl.java | 16 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILifeCycleService.java | 5 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleNodeMapper.java | 12 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LifeCycleRuleWrapper.java | 5 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LifeCycleController.java | 7 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleEdgeMapper.java | 12 Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue | 27 + Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleLineEventMapper.java | 13 + Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LifeCycleServiceImpl.java | 273 ++++++++++++++++++++ Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java | 14 + Source/UBCS-WEB/src/components/work/BusinessWork.vue | 101 ++++++- Source/UBCS-WEB/src/components/Tree/attrCrud.vue | 216 ++++++++++++---- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java | 33 ++ 13 files changed, 626 insertions(+), 108 deletions(-) diff --git a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue index 949c618..9e622e0 100644 --- a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue +++ b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue @@ -59,7 +59,7 @@ :label="item.label" :prop="item.prop" :sortable="item.sortable" - :formatter="formatBoolean" + :formatter="item.formatter" :width="item.label.length >=4 ?'150':item.label.length==3 ?'120':'90'" :show-overflow-tooltip="true" align="center" @@ -143,6 +143,7 @@ import SetPersonnel from "@/components/template/SetPersonnel"; import ResembleQueryDialog from "@/components/FormTemplate/ResembleQueryDialog.vue"; import BatchImport from '@/components/BatchImport' +import { validatenull } from "@/util/validate"; export default { components: { integrationTransfer, @@ -269,6 +270,19 @@ }, tableHeadFindData: { handler(newval, oldval) { + newval.forEach((record,_index) =>{ + if(record.field == 'id' && validatenull(record.templet)){ + //浼佷笟缂栫爜鐨勯粯璁ゆ坊鍔犺秴閾炬帴,鏆傛湭瀹炵幇 + record.formatter = ''; + }else { + if (record.templet && typeof (record.templet) == 'string' && !validatenull(record.templet) && record.templet.indexOf("function(row,column)")>-1) { + record.formatter = eval("(" + record.templet + ")"); + //function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'鏄�':'鍚�'} + }else if(record.fieldType=="truefalse"){ + record.formatter = function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'鏄�':'鍚�'} + } + } + }) this.tableHeadFindDatas = newval; }, }, @@ -285,17 +299,6 @@ }, }, methods: { - // 杞崲鏁版嵁true鍜宖alse - formatBoolean(row, column) { - if (column.property === "xiaoshouwl" - ||column.property === "shifoupihaoguanli" - ||column.property === "caigouwl" - ||column.property === "kucunwl" - ||column.property === "passing") { - return row[column.property] =='true'? "鏄�" : "鍚�"; - } - return row[column.property]; - }, // 鍙戝竷 setHandler() { if (this.selectRow.length <= 0) { diff --git a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue index 0f470e3..9848275 100644 --- a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue +++ b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue @@ -209,7 +209,7 @@ ></formula-editor> <!-- 鏂板 --> <el-dialog :visible.sync="addVisible" append-to-body title="浠庝笟鍔$被鍨嬩腑閫夋嫨灞炴��"> - <avue-crud :data="businessData" :option="businessOption" @select="businessSelect"> + <avue-crud :data="businessData" :option="businessOption" @selection-change="businessSelect"> <template slot="menuLeft"> <div style="display: flex;"> <el-select> @@ -238,7 +238,7 @@ type="selection" width="55"> </el-table-column> - <el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column> + <!--<el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>--> <el-table-column v-for="item in this.option.column" :key="item.id" :label="item.label" :prop="item.prop" @@ -248,12 +248,13 @@ align="center" > <template slot-scope="{ row }"> - <el-input v-if="editingRows === row && editShows== item.prop" v-model="row[item.prop]" + <el-input v-if="editingRows === row && editShows== item.prop && (item.edit == 'text' || item.edit == 'select' ||item.edit == 'refer')" v-model="row[item.prop]" @blur="saveRows"></el-input> + <el-input-number controls-position="right" v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]" + @blur="saveRows"></el-input-number> <el-switch - v-if="item.label === 'true' || item.label === 'false'" - active-color="#13ce66" - inactive-color="#ff4949"> + v-if="item.edit === 'switch'" v-model="row[item.prop]" active-value="true" + inactive-value="false"> </el-switch> <span v-else>{{ row[item.prop] }}</span> </template> @@ -335,14 +336,14 @@ }, // 缂栫爜鐢宠棰勮data applicationData: [], - //涓氬姟绫诲瀷鍗曢�夋暟缁� + //涓氬姟绫诲瀷閫夋嫨鏁扮粍 busineSelectList: [], //涓氬姟绫诲瀷娣诲姞鏁版嵁 busineAddList: {}, //琛ㄦ牸鍗曢�夋暟缁� - CrudSelect: [], + attrSelectList: [], //琛ㄦ牸oid - CrudOid: "", + attrOid: "", //鍦烘櫙鍙橀噺 thisSceneTableData: [ { @@ -940,7 +941,7 @@ rowCellList: [], List: [], option: { - index: true, + index: false, border: true, editBtn: false, selection: true, @@ -953,8 +954,14 @@ prop: 'name', order: 'descending' }, - column: [ - { + column: [{ + prop: 'orderNum', + label: '鎺掑簭鍙�', + sortable: true, + edit: 'number', + width: 60, + fixed: true + }, { label: "灞炴�ц嫳鏂囩紪鍙�", prop: "id", fixed: true, @@ -969,6 +976,7 @@ fixed: true, cell: false, width: 125, + edit: 'text', sortable: true }, { @@ -976,6 +984,7 @@ prop: "attributeGroup", cell: false, sortable: true, + edit: 'text', width: 125, }, { @@ -990,78 +999,90 @@ cell: false, sortable: true, width: 105, + edit: 'number' }, { label: "鍏抽敭灞炴��", prop: "keyAttrFlag", cell: false, - type: "switch", + edit: "switch" }, { label: "鏌ヨ灞炴��", prop: "queryAttrFlag", cell: false, + edit: "switch" }, { label: "楂樼骇鏌ヨ灞炴��", prop: "seniorQueryAttrFlag", width: 95, cell: false, + edit: "switch" }, { - label: "鐩镐技鏌ヨ灞炴��", + label: "鐩镐技鏌ラ噸灞炴��", prop: "sameRepeatAttrFlag", width: 95, cell: false, + edit: "switch" }, { label: "蹇呰緭", prop: "requireFlag", cell: false, + edit: "switch" }, { label: "琛ㄥ崟鏄剧ず", prop: "formDisplayFlag", cell: false, + edit: "switch" }, { label: "鍒楄〃鏄剧ず", prop: "tableDisplayFlag", cell: false, + edit: "switch" }, { label: "鍙", prop: "readonlyFlag", cell: false, + edit: "switch" }, { label: "鍒楄〃鎺掑簭", prop: "sortAttrFlag", cell: false, + edit: "switch" }, - { label: "澶氳鏂囨湰", prop: "textareaFlag", cell: false, + edit: "switch" }, { label: "榛樿鍊�", prop: "defaultValue", sortable: true, cell: false, + edit: 'text', width: 95, }, { label: "鍓嶇紑", prop: "prefixValue", sortable: true, + edit: 'select', cell: false, }, { label: "鍚庣紑", prop: "suffixValue", sortable: true, + edit: 'select', cell: false, }, { @@ -1069,6 +1090,7 @@ prop: "componentRule", sortable: true, cell: false, + edit: 'refer', width: 105, }, { @@ -1076,6 +1098,7 @@ prop: "verifyRule", sortable: true, cell: false, + edit: 'refer', width: 105, }, { @@ -1083,84 +1106,97 @@ prop: "codeDateFormat", sortable: true, width: 105, + edit: 'select', cell: false, }, { label: "鍒嗙被娉ㄥ叆", prop: "classifyInvokeLevel", cell: false, + edit: 'refer' }, { label: "鏋氫妇娉ㄥ叆", prop: "enumString", cell: false, + edit: 'refer' }, { label: "绾ц仈灞炴��", prop: "parentCode", cell: false, + edit: 'refer' }, { label: "鍙傜収閰嶇疆", prop: "referConfig", cell: false, + edit: 'refer' }, { label: "绾ц仈鏌ヨ灞炴��", prop: "parentQueryAttr", width: 105, cell: false, + edit: 'text' }, { label: "閫夋嫨搴撴爣璇�", prop: "libraryIdentification", width: 105, cell: false, + edit: 'text' }, { label: "濉啓鎻愮ず", prop: "explain", cell: false, + edit: 'text' }, { label: "琛ㄥ崟鏄剧ず鏍峰紡", prop: "formDisplayStyle", width: 105, cell: false, + edit: 'text' }, { label: "琛ㄦ牸鏄剧ず鏍峰紡", prop: "tableDisplayStyle", width: 105, cell: false, + edit: 'text' }, { label: "琛ㄥ崟瓒呴摼鎺�", prop: "formHref", width: 95, cell: false, + edit: 'text' }, { label: "琛ㄦ牸瓒呴摼鎺�", prop: "tableHref", width: 95, cell: false, + edit: 'text' }, { label: "琛ㄦ牸鏄剧ずjs", prop: "tableDisplayJs", width: 95, cell: false, + edit: 'text' }, { label: "闀垮害", prop: "controlLength", - cell: false, + cell: false }, { label: "灏忔暟绮惧害", prop: "precisionLength", - cell: false, + cell: false }, { label: "鍙栧�艰寖鍥�", @@ -1168,10 +1204,39 @@ sortable: true, cell: false, width: 105, + edit: 'text' }, ], List: [] + }, + vciFieldTypeMap : { + VTBoolean: "甯冨皵鍨�", + VTClob: "闀挎枃鏈�", + VTDate: "鏃ユ湡", + VTDateTime: "鏃ユ湡鏃堕棿", + VTTime: "鏃堕棿", + VTLong: "闀挎暣鍨�", + VTDouble: "閲戦/鍙岀簿搴�", + VTInteger: "鏁村舰", + VTFilePath: "鏂囦欢", + VTString: "瀛楃涓�" } + } + }, + computed:{ + attrOids() { + let oids = []; + this.attrSelectList.forEach(ele => { + oids.push(ele.oid); + }); + return oids.join(","); + }, + busineOids() { + let oids = []; + this.busineSelectList.forEach(ele => { + oids.push(ele.oid); + }); + return oids.join(","); } }, mounted() { @@ -1185,11 +1250,12 @@ }, //灞炴�у垎缁勬寜閽� attrVisibleHandle() { - if (this.CrudSelect.length > 1) { + + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect < 1) { + } else if (this.attrSelectList < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.attrVisible = true; } }, @@ -1215,38 +1281,74 @@ }, //涓氬姟绫诲瀷淇濆瓨 busineAddHandle() { - if (this.busineSelectList.length > 1) { - this.$message.warning('璇烽�夋嫨涓�鏉′笟鍔$被鍨嬫暟鎹�') - } else { - this.$set(this.busineAddList, 'classifytemplateoid', this.crudOid) - this.$set(this.busineAddList, 'oid', '') - this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList))) - this.addVisible = false; + if (this.busineSelectList.length == 0) { + this.$message.warning('璇烽�夋嫨灞炴�ч泦'); + return false; } +debugger; + let ordernum = this.ProData.length; + this.busineSelectList.forEach((citem) => { + let isCopy = false; + this.ProData.forEach((item) => { + if (citem.id == item.id) { + isCopy = true; + return false; + } + }) + if (!isCopy) { + citem.oid = '' + this.busineAddList=Object.assign(citem, { + orderNum: ++ordernum, + attributedatatype: citem.attrDataType, + attributeDataTypeText: this.vciFieldTypeMap[citem.attrDataType], + controlLength: citem.attributeLength, + valueArea: citem.range, + referbtmid: citem.referBtmTypeId, + referbtmname: citem.referBtmTypeName, + referConfig: '', + enumid: citem.enumId, + precisionLength: (citem.precisionLength ? citem.precisionLength : '') + (citem.scaleLength ? '(' + citem.scaleLength + ')' : ''), + classifyTemplateOid: this.crudOid, + classifytemplateoid: this.crudOid, + formDisplayFlag: true, + tableDisplayFlag: true, + sortAttrFlag: false, + queryAttrFlag: true, + seniorQueryAttrFlag: true, + attrTableWidth: 120 + }) + this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList))) + } + }) + + + this.addVisible = false; + }, - //涓氬姟绫诲瀷鍗曢�� + //涓氬姟绫诲瀷閫夋嫨 businessSelect(selection, row) { this.busineSelectList = selection - this.busineAddList = row }, - // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁 + // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁寮圭獥 busineHandle() { - this.addVisible = true; - AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => { - this.businessData = res.data.data; - }) + this.addVisible = true; + this.busineSelectList = [] + this.busineAddList = []; + AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => { + this.businessData = res.data.data; + }) }, // 绾ц仈灞炴�ф寜閽� CascadeHandle() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.CascadeVisible = true; gridCodeClassifyTemplateAttr({ 'conditionMap[classifyTemplateOid]': this.Formlist[0].oid, - 'conditionMap[oid_notequal]': this.CrudOid + 'conditionMap[oid_notequal]': this.attrOid }).then(res => { this.CascadeData = res.data.data; }) @@ -1254,10 +1356,12 @@ }, //琛ㄦ牸鍗曢�� selectHandle(selection, row) { - this.CrudOid = row.oid; - this.CrudSelect = selection; + this.attrOid = row.oid; this.attrRow = row; - console.log('123',row,selection) + }, + //琛ㄦ牸閫夋嫨 + selectionChange(list) { + this.attrSelectList = list; }, //淇濆瓨 addsHandler() { @@ -1282,9 +1386,9 @@ }, //琛ㄦ牸琛岀紪杈� handleCellClicks(row, column) { - this.editingRows = row; - this.editShows = column.property; - this.rowOid = row.oid; + this.editingRows = row; + this.editShows = column.property; + this.rowOid = row.oid; }, saveRows() { this.editingRows = null; @@ -1307,11 +1411,11 @@ }, //鏋氫妇娉ㄥ叆鎸夐挳 enmuVisHandle() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect < 1) { + } else if (this.attrSelectList < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.enumVisible = true; } }, @@ -1353,11 +1457,11 @@ }, //鐐瑰嚮鍒嗙被娉ㄥ叆鎸夐挳 injectBtn() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉挎暟鎹�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉挎暟鎹�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.injectVisible = true } }, @@ -1411,11 +1515,11 @@ }, //鍚屾鍒板叾浠栨ā鏉� syncHandle() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { copyto({oid: this.attrRow.oid}).then(res => { this.$message.success('鍚屾鎴愬姛') }) @@ -1427,11 +1531,11 @@ }, //缁勫悎瑙勫垯 isShowHandler() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.isShowformulaEdit = true; } }, diff --git a/Source/UBCS-WEB/src/components/work/BusinessWork.vue b/Source/UBCS-WEB/src/components/work/BusinessWork.vue index b4d93d0..4f0b688 100644 --- a/Source/UBCS-WEB/src/components/work/BusinessWork.vue +++ b/Source/UBCS-WEB/src/components/work/BusinessWork.vue @@ -1,17 +1,38 @@ <template> <div> - <el-button @click="HandlerRend"></el-button> - <el-table :data="data"> - <el-table-column - fixed - type="selection" - width="55"> + <el-button @click="HandlerRend" size="small" type="primary">淇濆瓨</el-button> + <el-table + v-loading="isLoading" + :data="tableData" + max-height="700" + style="" + @cell-click="handleCellClick" + > + <el-table-column fixed type="selection" width="55"> </el-table-column> + <el-table-column fixed label="搴忓彿" type="index" width="55"> </el-table-column> <el-table-column - fixed - label="搴忓彿" - type="index" - width="55"> + v-for="item in this.tableHeadData" + :key="item.id" + :label="item.label" + :prop="item.prop" + :sortable="item.sortable" + :formatter="item.formatter" + :width="item.label.length >=4 ?'150':item.label.length==3 ?'120':'90'" + :show-overflow-tooltip="true" + align="center" + > + <!-- 缂栬緫鍜屽睍绀洪�昏緫 --> + <!-- <template slot-scope="{ row }">--> + <!-- <el-input v-if="editingRow === row && editShow== item.prop" v-model="row[item.prop]" @blur="saveRow"></el-input>--> + <!-- <span v-else>{{row[item.prop]}}</span>--> + <!-- <el-switch--> + <!-- v-if="editShow === 'true'"--> + <!-- v-model="row[item.prop]"--> + <!-- active-color="#13ce66"--> + <!-- inactive-color="#ff4949">--> + <!-- </el-switch>--> + <!-- </template>--> </el-table-column> </el-table> </div> @@ -19,17 +40,20 @@ <script> import {businese} from '@/api/work/businese' +import {MasterTable} from "@/api/GetItem"; +import {validatenull} from "@/util/validate"; export default { name: "BusinessWork", props:['ids','templateId'], data() { return { BuinessOids:[], - data:[ - { - label:'app' - } - ] + isLoading:false, + tableHeadData:[], + tableData:[], + editingRow: null, + editShow: "", + editAttr: "" } }, watch:{ @@ -37,6 +61,8 @@ handler(newval,oldval){ this.BuinessOids=newval; this.BuinseseRend() + console.log(newval) + console.log(this.BuinessOids) }, deep:true } @@ -46,14 +72,55 @@ mounted() { }, methods:{ + HandlerRend(){ + this.editingRow = null; + }, + //琛ㄦ牸澶存覆鏌� + CrudHeaderRend() { + if (this.codeClassifyOid != "") { + MasterTable({ + codeClassifyOid: this.codeClassifyOid, + functionId: 5, + }).then((res) => { + this.options = res.data.tableDefineVO.seniorQueryColumns; + this.List = res.data.tableDefineVO.cols[0]; + this.tableHeadData=[]; + this.List.forEach((item) => { + let columnItem = { + label: item.title, + prop: item.field, + type: this.columnType[item.type], + sortable: item.sort, + width: item.minWidth + }; + if(item.field == 'id' && validatenull(item.templet)){ + //浼佷笟缂栫爜鐨勯粯璁ゆ坊鍔犺秴閾炬帴,鏆傛湭瀹炵幇 + columnItem.formatter = ''; + }else { + if (item.templet && typeof (item.templet) == 'string' && !validatenull(item.templet) && item.templet.indexOf("function(row,column)")>-1) { + columnItem.formatter = eval("(" + item.templet + ")"); + //function(row,column){return row[column.property]=='true'?'鏄�':'鍚�'} + } + } + this.tableHeadData.push(columnItem) + }); + }); + } + }, + //琛ㄦ牸鏁版嵁 BuinseseRend(){ businese({ btmType:'wupin', 'conditionMap[oid]':this.BuinessOids.toString() }).then(res=>{ - console.log(res) + this.tableData = res.data.data; }) - } + }, + // 鐩戝惉鍗曞厓鏍肩偣鍑讳簨浠跺苟瀛樺偍姝e湪缂栬緫鐨勮 + handleCellClick(row, column) { + this.editingRow = row; + this.editShow = column.property; + }, } } </script> diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java index e9ec1fd..b01bb9d 100644 --- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java +++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java @@ -62,6 +62,8 @@ private final ProcessStageAttrService processStageAttrService; private static String MODELKEY = "modelKey";//鍓嶇浼犺繃鏉ョ殑妯″瀷key + private static String TASKID = "taskId";//鍓嶇浼犺繃鏉ョ殑妯″瀷key + private static String PROCESSINSTANCEID = "processInstanceId";//鍓嶇浼犺繃鏉ョ殑妯″瀷key @Override public R<BladeFlow> startProcess(FlowTaskDTO flowTaskUserC){ Map<String, Object> kvv = flowTaskUserC.getVariables(); @@ -228,16 +230,10 @@ flowTaskDTO.setVariables(variables); } - String templateId = variables.get("templateId").toString(); - //娴佺▼闃舵 - Map<String, Object> m = new HashMap<>(); - m.put("template_id", templateId); - m.put("task_id", crruentActivityId); - m.put("model_key", modelKey); - QueryWrapper q = Condition.getQueryWrapper(m, ProcessStageAttr.class) - .select("attr_id attrId,attr_name attrName,attr_group attrGroup"); - List<ProcessStageAttr> stageAttrs = processStageAttrService.list(q); - flowTaskDTO.setStageAttrs(stageAttrs); + + //鏀惧叆娴佺▼闃舵銆佹祦绋媘odelkey + variables.put(TASKID,crruentActivityId); + variables.put(PROCESSINSTANCEID,processInstanceId); return flowTaskDTO; } } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LifeCycleController.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LifeCycleController.java index c3a9567..2360c4b 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LifeCycleController.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/LifeCycleController.java @@ -9,6 +9,7 @@ import com.vci.ubcs.omd.vo.LifeCycleVO; import com.vci.ubcs.omd.wrapper.LifeCycleRuleWrapper; import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; +import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -43,12 +44,12 @@ @GetMapping("page") @ApiOperationSupport(order = 2) @ApiOperation(value = "鍒嗛〉鏌ヨ鐢熷懡鍛ㄦ湡",notes = "鍒嗛〉鏌ヨ鐢熷懡鍛ㄦ湡") - public R<IPage<LifeCycleVO>> page(BaseQueryObject baseQueryObject){ - Map<String, String> conditionMap = baseQueryObject.getConditionMap(); + public R<IPage<LifeCycleVO>> page(BladeQueryObject baseQueryObject){ + Map<String, Object> conditionMap = baseQueryObject.getConditionMap(); if (conditionMap == null){ conditionMap = new HashMap<>(); } - return R.data(lifeCycleService.listLife(conditionMap,baseQueryObject.getPageHelper())); + return R.data(lifeCycleService.listLife(conditionMap,baseQueryObject.getQuery())); } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleEdgeMapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleEdgeMapper.java new file mode 100644 index 0000000..139bed1 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleEdgeMapper.java @@ -0,0 +1,12 @@ +package com.vci.ubcs.omd.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.vci.ubcs.omd.entity.LifeCycleEdge; + +/** + * 鐢熷懡鍛ㄦ湡鐨勮繛鎺ョ嚎 + * @author weidy + * @date 2023/7/4 + */ +public interface LifeCycleEdgeMapper extends BaseMapper<LifeCycleEdge> { +} diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleLineEventMapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleLineEventMapper.java new file mode 100644 index 0000000..1128048 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleLineEventMapper.java @@ -0,0 +1,13 @@ +package com.vci.ubcs.omd.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.vci.ubcs.omd.dto.LifeCycleLineEventDTO; +import com.vci.ubcs.omd.entity.LifeCycleLineEvent; + +/** + * 鐢熷懡鍛ㄦ湡杩炴帴绾跨殑浜嬩欢 + * @author weidy + * @date 2023/7/4 + */ +public interface LifeCycleLineEventMapper extends BaseMapper<LifeCycleLineEvent> { +} diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleNodeMapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleNodeMapper.java new file mode 100644 index 0000000..882bf55 --- /dev/null +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/LifeCycleNodeMapper.java @@ -0,0 +1,12 @@ +package com.vci.ubcs.omd.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.vci.ubcs.omd.entity.LifeCycleNode; + +/** + * 鐢熷懡鍛ㄦ湡鐨勮妭鐐瑰瓨鍌� + * @author weidy + * @date 2023/7/4 + */ +public interface LifeCycleNodeMapper extends BaseMapper<LifeCycleNode> { +} diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java index 0049267..b8a6aff 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/IBtmTypeService.java @@ -250,4 +250,18 @@ * @return 涓氬姟绫诲瀷 */ BtmTypeVO getAllAttributeByBtmOid(String btmTypeOid); + + /** + * 鑾峰彇寮曠敤鏌愪釜鐢熷懡鍛ㄦ湡鐨勪笟鍔$被鍨� + * @param lifeOid 鐢熷懡鍛ㄦ湡鐨勪富閿� + * @return 涓氬姟绫诲瀷鏄剧ず瀵硅薄 + */ + List<BtmTypeVO> selectByLifeId(String lifeId); + + /** + * 缁熻寮曠敤鏌愪釜鐢熷懡鍛ㄦ湡鐨勪笟鍔$被鍨� + * @param lifeOid 鐢熷懡鍛ㄦ湡鐨勪富閿� + * @return 涓暟 + */ + Integer countByLifeId(String lifeId); } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILifeCycleService.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILifeCycleService.java index fd21582..525cfcd 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILifeCycleService.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/ILifeCycleService.java @@ -7,6 +7,7 @@ import com.vci.ubcs.omd.vo.BtmTypeVO; import com.vci.ubcs.omd.vo.LifeCycleVO; import com.vci.ubcs.starter.web.pagemodel.PageHelper; +import org.springblade.core.mp.support.Query; import java.util.List; import java.util.Map; @@ -21,10 +22,10 @@ /** * 鑾峰彇鐢熷懡鍛ㄦ湡鍒楄〃 * @param conditionMap 鏌ヨ鏉′欢 - * @param pageHelper 鍒嗛〉 + * @param query 鍒嗛〉 * @return 鐢熷懡鍛ㄦ湡鐨勬樉绀哄璞� */ - IPage<LifeCycleVO> listLife(Map<String, String> conditionMap, PageHelper pageHelper); + IPage<LifeCycleVO> listLife(Map<String, Object> conditionMap, Query query); /** * 娣诲姞淇濆瓨 diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java index f947641..af7f220 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.api.exception.NacosException; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vci.ubcs.omd.constant.BtmTypeConstant; @@ -868,4 +869,36 @@ btmType.setAttributes(btmTypeAttributeService.getAllAttribute(btmType)); return btmType; } + + /** + * 鑾峰彇寮曠敤鏌愪釜鐢熷懡鍛ㄦ湡鐨勪笟鍔$被鍨� + * + * @param lifeId 鐢熷懡鍛ㄦ湡鐨勭紪鍙� + * @return 涓氬姟绫诲瀷鏄剧ず瀵硅薄 + */ + @Override + public List<BtmTypeVO> selectByLifeId(String lifeId) { + if(StringUtils.isBlank(lifeId)){ + return new ArrayList<>(); + } + LambdaQueryWrapper<BtmType> query = new LambdaQueryWrapper<BtmType>(); + query.eq(BtmType::getLifeCycleId,lifeId); + return BtmTypeWrapper.build().listEntityVO(getBaseMapper().selectList(query)); + } + + /** + * 缁熻寮曠敤鏌愪釜鐢熷懡鍛ㄦ湡鐨勪笟鍔$被鍨� + * + * @param lifeId 鐢熷懡鍛ㄦ湡鐨勭紪鍙� + * @return 涓暟 + */ + @Override + public Integer countByLifeId(String lifeId) { + if(StringUtils.isBlank(lifeId)){ + return 0; + } + LambdaQueryWrapper<BtmType> query = new LambdaQueryWrapper<BtmType>(); + query.eq(BtmType::getLifeCycleId,lifeId); + return baseMapper.selectCount(query).intValue(); + } } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LifeCycleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LifeCycleServiceImpl.java index 29ad035..f731a5d 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LifeCycleServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/LifeCycleServiceImpl.java @@ -1,18 +1,49 @@ package com.vci.ubcs.omd.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vci.ubcs.omd.constant.BtmTypeConstant; import com.vci.ubcs.omd.dto.LifeCycleDTO; +import com.vci.ubcs.omd.dto.LifeCycleEdgeDTO; +import com.vci.ubcs.omd.dto.LifeCycleLineEventDTO; +import com.vci.ubcs.omd.dto.LifeCycleNodeDTO; +import com.vci.ubcs.omd.entity.LifeCycleEdge; +import com.vci.ubcs.omd.entity.LifeCycleLineEvent; +import com.vci.ubcs.omd.entity.LifeCycleNode; import com.vci.ubcs.omd.entity.LifeCycleRule; +import com.vci.ubcs.omd.mapper.LifeCycleEdgeMapper; +import com.vci.ubcs.omd.mapper.LifeCycleLineEventMapper; import com.vci.ubcs.omd.mapper.LifeCycleMapper; +import com.vci.ubcs.omd.mapper.LifeCycleNodeMapper; +import com.vci.ubcs.omd.repeater.DomainRepeater; +import com.vci.ubcs.omd.service.IBtmTypeService; import com.vci.ubcs.omd.service.ILifeCycleService; +import com.vci.ubcs.omd.service.IStatusService; import com.vci.ubcs.omd.vo.BtmTypeVO; import com.vci.ubcs.omd.vo.LifeCycleVO; -import com.vci.ubcs.starter.web.pagemodel.PageHelper; +import com.vci.ubcs.omd.vo.StatusVO; +import com.vci.ubcs.omd.wrapper.LifeCycleRuleWrapper; +import com.vci.ubcs.starter.enumpack.NewAppConstantEnum; +import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.constant.RegExpConstant; +import com.vci.ubcs.starter.web.util.BeanUtil; +import com.vci.ubcs.starter.web.util.VciBaseUtil; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; -import java.util.List; -import java.util.Map; +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + /** * 鐢熷懡鍛ㄦ湡鐨勬湇鍔� @@ -22,17 +53,49 @@ @Service public class LifeCycleServiceImpl extends ServiceImpl<LifeCycleMapper, LifeCycleRule> implements ILifeCycleService{ + /** + * 鑺傜偣鐨勬暟鎹眰 + */ + @Resource + private LifeCycleNodeMapper nodeMapper; + + /** + * 杩炴帴绾挎暟鎹眰 + */ + @Resource + private LifeCycleEdgeMapper edgeMapper; + + /** + * 鐘舵�� + */ + @Autowired(required = false) + @Lazy + private IStatusService statusService; + + /** + * 杩炴帴绾跨殑浜嬩欢 + */ + @Resource + private LifeCycleLineEventMapper lineEventMapper; + + /** + * 涓氬姟绫诲瀷鐨勬湇鍔� + */ + @Autowired(required = false) + @Lazy + private IBtmTypeService btmTypeService; + /** * 鑾峰彇鐢熷懡鍛ㄦ湡鍒楄〃 * * @param conditionMap 鏌ヨ鏉′欢 - * @param pageHelper 鍒嗛〉 + * @param query 鍒嗛〉 * @return 鐢熷懡鍛ㄦ湡鐨勬樉绀哄璞� */ @Override - public IPage<LifeCycleVO> listLife(Map<String, String> conditionMap, PageHelper pageHelper) { - return null; + public IPage<LifeCycleVO> listLife(Map<String, Object> conditionMap, Query query) { + return LifeCycleRuleWrapper.build().pageVO(baseMapper.selectPage(Condition.getPage(query),Condition.getQueryWrapper(conditionMap,LifeCycleRule.class).lambda().orderByAsc(LifeCycleRule::getId))); } /** @@ -42,9 +105,160 @@ * @return 娣诲姞鍚庣殑鏄剧ず瀵硅薄 */ @Override + @Transactional public LifeCycleVO addSave(LifeCycleDTO lifeCycleDTO) { - return null; + VciBaseUtil.alertNotNull(lifeCycleDTO,"鐢熷懡鍛ㄦ湡淇℃伅",lifeCycleDTO.getId(),"鐢熷懡鍛ㄦ湡鐨勭紪鍙�",lifeCycleDTO.getName(),"鐢熷懡鍛ㄦ湡鍚嶇О",lifeCycleDTO.getNodes(),"鐢熷懡鍛ㄦ湡鐨勮妭鐐�",lifeCycleDTO.getStartStatus(),"璧峰鐘舵��"); + //鍏堟煡璇㈡槸鍚﹀瓨鍦� + QueryWrapper wrapper = new QueryWrapper(LifeCycleRule.class); + wrapper.eq("lower(id)",lifeCycleDTO.getId().toLowerCase(Locale.ROOT)); + if(baseMapper.selectCount(wrapper)>0){ + throw new VciBaseException("鐢熷懡鍛ㄦ湡鐨勭紪鍙蜂笉鑳介噸澶�"); + } + String lifeOid = addLifeCycle(lifeCycleDTO); + return LifeCycleRuleWrapper.build().entityVO(baseMapper.selectById(lifeOid)); } + + /** + * 娣诲姞鐢熷懡鍛ㄦ湡 + * @param lifeCycleDTO + * @return 涓婚敭 + */ + private String addLifeCycle(LifeCycleDTO lifeCycleDTO){ + //缂栧彿涓嶈兘鏈夌壒娈婄殑鍐呭 + if(!lifeCycleDTO.getId().matches(RegExpConstant.LETTER)){ + throw new VciBaseException("鐢熷懡鍛ㄦ湡鐨勭紪鍙峰彧鑳芥槸瀛楁瘝"); + } + LifeCycleRule life = LifeCycleRuleWrapper.build().copyDTO2DO(lifeCycleDTO); + life.setOid(VciBaseUtil.getPk()); + String creator = AuthUtil.getUserAccount(); + Date now = new Date(); + life.setBtmname(BtmTypeConstant.LIFE_CYCLE); + life.setOwner(creator); + life.setCreator(creator); + life.setCreateTime(now); + life.setLastModifier(creator); + life.setLastModifyTime(now); + life.setTs(now); + + List<String> statusList = new ArrayList<>(); + //澶勭悊鑺傜偣 + if(!CollectionUtils.isEmpty(lifeCycleDTO.getNodes())){ + lifeCycleDTO.getNodes().stream().forEach(nodeDTO->{ + addLifeCycleNode(nodeDTO,life.getOid(),creator,now); + statusList.add(nodeDTO.getId()); + }); + } + if(!statusList.contains(life.getStartStatus())){ + throw new VciBaseException("璧峰鐘舵�佷笉鍦ㄧ敓鍛藉懆鏈熺殑鐢诲竷涓�"); + } + //鍒ゆ柇鎵�鏈夌殑鑺傜偣鍦ㄧ郴缁熼噷閮藉瓨鍦� + List<String> existStatusIdList = statusService.listStatusByIdCollection(statusList).stream().map(StatusVO::getId).collect(Collectors.toList()); + String unExistStatus = statusList.stream().filter(s -> !existStatusIdList.contains(s)).collect(Collectors.joining(",")); + if(StringUtils.hasLength(unExistStatus)){ + throw new VciBaseException(unExistStatus + "杩欎簺鐘舵�佸湪鐘舵�佹睜閲屼笉瀛樺湪锛屼笉鑳芥坊鍔犲埌鐢熷懡鍛ㄦ湡涓�"); + } + //澶勭悊杈圭晫鍜岃繛鎺ョ嚎 + if(!CollectionUtils.isEmpty(lifeCycleDTO.getEdges())){ + lifeCycleDTO.getEdges().stream().forEach(edgeDTO->{ + String edgeOid = addLifeCycleEdge(edgeDTO,statusList,life.getOid(),creator,now); + if(!CollectionUtils.isEmpty(edgeDTO.getEvents())){ + //鏈変簨浠� + edgeDTO.getEvents().stream().forEach(eventDTO->{ + addLifeCycleLineEvent(eventDTO,edgeOid,creator,now); + }); + } + }); + } + baseMapper.insert(life); + return life.getOid(); + } + + /** + * 娣诲姞鐢熷懡鍛ㄦ湡鐨勮繛鎺ョ嚎涓婄殑浜嬩欢 + * @param eventDTO + * @param edgeOid + * @param creator + * @param now + */ + private void addLifeCycleLineEvent(LifeCycleLineEventDTO eventDTO,String edgeOid,String creator,Date now){ + VciBaseUtil.alertNotNull(eventDTO.getBizDomain(),"鎵�灞為鍩�",eventDTO.getEventFullName(),"浜嬩欢鐨勫叏璺緞"); + NewAppConstantEnum[] values = NewAppConstantEnum.values(); + Boolean fined = false; + for (int i = 0; i < values.length; i++) { + NewAppConstantEnum value = values[i]; + if(value.getName().equalsIgnoreCase(eventDTO.getBizDomain())){ + fined = true; + break; + } + } + if(!fined){ + throw new VciBaseException(eventDTO.getBizDomain() + "杩欎釜棰嗗煙杩樻病鏈夊紑鏀�,璇疯寮�鍙戜汉鍛樺湪NewAppConstantEnum绫讳腑娣诲姞"); + } + LifeCycleLineEvent event = org.springblade.core.tool.utils.BeanUtil.copy(eventDTO, LifeCycleLineEvent.class); + event.setOid(VciBaseUtil.getPk()); + event.setPkLifeCycleEdge(edgeOid); + event.setBtmname(BtmTypeConstant.LIFE_CYCLE_LINE_EVENT); + event.setOwner(creator); + event.setCreator(creator); + event.setCreateTime(now); + event.setLastModifier(creator); + event.setLastModifyTime(now); + event.setTs(now); + lineEventMapper.insert(event); + } + + /** + * 娣诲姞鐢熷懡鍛ㄦ湡鐨勮妭鐐� + * @param nodeDTO + * @param lifeOid + * @param creator + * @param now + */ + private void addLifeCycleNode(LifeCycleNodeDTO nodeDTO,String lifeOid,String creator,Date now){ + VciBaseUtil.alertNotNull(nodeDTO.getId(),"鐘舵�佹爣璇�",nodeDTO.getName(),"鐘舵�佸悕绉�"); + LifeCycleNode node = org.springblade.core.tool.utils.BeanUtil.copy(nodeDTO, LifeCycleNode.class); + node.setOid(VciBaseUtil.getPk()); + node.setLifeCycleOid(lifeOid); + node.setBtmname(BtmTypeConstant.LIFE_CYCLE_NODE); + node.setOwner(creator); + node.setCreator(creator); + node.setCreateTime(now); + node.setLastModifier(creator); + node.setLastModifyTime(now); + node.setTs(now); + nodeMapper.insert(node); + } + + /** + * 娣诲姞鐢熷懡鍛ㄦ湡鐨勮繛鎺ョ嚎 + * @param edgeDTO + * @param statusList + * @param lifeOid + * @param creator + * @param now + * @return 杩炴帴绾跨殑涓婚敭 + */ + private String addLifeCycleEdge(LifeCycleEdgeDTO edgeDTO,List<String> statusList,String lifeOid,String creator,Date now){ + VciBaseUtil.alertNotNull(edgeDTO.getSource(),"鏉ユ簮鐘舵��",edgeDTO.getTarget(),"鐩爣鐘舵��",edgeDTO.getName(),"杩炴帴绾垮悕绉�"); + if(!statusList.contains(edgeDTO.getSource()) + ||!statusList.contains(edgeDTO.getTarget())){ + throw new VciBaseException("鏁版嵁閿欒锛孾" + edgeDTO.getName() + "]杩炴帴绾夸笂涓娇鐢ㄧ殑鐘舵�佹病鏈夋壘鍒�"); + } + LifeCycleEdge edge = org.springblade.core.tool.utils.BeanUtil.copy(edgeDTO, LifeCycleEdge.class); + edge.setOid(VciBaseUtil.getPk()); + edge.setLifeCycleOid(lifeOid); + edge.setBtmname(BtmTypeConstant.LIFE_CYCLE_EDGE); + edge.setOwner(creator); + edge.setCreator(creator); + edge.setCreateTime(now); + edge.setLastModifier(creator); + edge.setLastModifyTime(now); + edge.setTs(now); + edgeMapper.insert(edge); + return edge.getOid(); + } + + /** * 鎵归噺娣诲姞鍐呭 @@ -53,8 +267,40 @@ * @return 娣诲姞鍚庣殑鏄剧ず瀵硅薄 */ @Override + @Transactional public List<LifeCycleVO> batchAddSave(List<LifeCycleDTO> lifeCycleDTOs) { - return null; + VciBaseUtil.alertNotNull(lifeCycleDTOs,"鐢熷懡鍛ㄦ湡鐨勪俊鎭�"); + //鍏堥泦浣撴牎楠屼竴涓� + if(lifeCycleDTOs.stream().anyMatch(s->!StringUtils.hasLength(s.getId()) || !StringUtils.hasLength(s.getName()) + || CollectionUtils.isEmpty(s.getNodes()) || !StringUtils.hasLength(s.getStartStatus()))){ + throw new VciBaseException("鐢熷懡鍛ㄦ湡鐨勭紪鍙凤紝鍚嶇О锛岃捣濮嬬姸鎬侊紝鍖呭惈鐨勮妭鐐逛笉鑳戒负绌�"); + } + //缁熶竴鏍¢獙閲嶅 + Map<String, List<LifeCycleDTO>> dtoMap = lifeCycleDTOs.stream().collect(Collectors.groupingBy(LifeCycleDTO::getId)); + dtoMap.forEach((id,dtos)->{ + if(dtos.size()>1){ + throw new VciBaseException("缂栧彿涓恒��" + id + "銆戠殑鐢熷懡鍛ㄦ湡閲嶅"); + } + }); + VciBaseUtil.switchCollectionForOracleIn(dtoMap.keySet()).stream().forEach( + ids->{ + QueryWrapper wrapper = new QueryWrapper(LifeCycleRule.class); + ids.stream().forEach(id->{ + wrapper.eq("lower(id)",id.toLowerCase(Locale.ROOT)); + wrapper.or(); + }); + wrapper.eq("1","2"); + if(baseMapper.selectCount(wrapper)>0){ + throw new VciBaseException("鐢熷懡鍛ㄦ湡鐨勭紪鍙蜂笉鑳介噸澶�"); + } + } + ); + //鍏堝惊鐜鐞嗕笅锛屽洜涓虹幇鍦ㄥ綋鍓嶇敤鎴锋病鏈夊鐞嗕负绾跨▼鍏变韩鐨勶紝鍚庨潰淇敼鍚庯紝鍙互鐢ㄥ苟鍙戞祦鍘诲鐞� + List<String> oidList = new ArrayList<>(); + lifeCycleDTOs.stream().forEach(dto->{ + oidList.add(addLifeCycle(dto)); + }); + return LifeCycleRuleWrapper.build().listEntityVO(listByIds(oidList)); } /** @@ -64,7 +310,18 @@ */ @Override public void delete(LifeCycleDTO lifeCycleDTO) { + VciBaseUtil.alertNotNull(lifeCycleDTO,"鏁版嵁浼犺緭瀵硅薄",lifeCycleDTO.getOid(),"涓婚敭"); + LifeCycleRule rule = null; + try { + rule = getById(lifeCycleDTO.getOid()); + }catch (Throwable e){ + throw new VciBaseException("浣跨敤涓婚敭鑾峰彇瀵硅薄鍑洪敊锛岃繖涓暟鎹彲鑳戒笉瀛樺湪锛屾垨鑰呮暟鎹噸澶嶄簡"); + } + //妫�鏌ヨ寮曠敤涓嶈兘鍒犻櫎 + Integer count = btmTypeService.countByLifeId(lifeCycleDTO.getOid()); + if(count !=null && count>0){ + } } /** diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LifeCycleRuleWrapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LifeCycleRuleWrapper.java index 739efa7..4bf2bf2 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LifeCycleRuleWrapper.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/LifeCycleRuleWrapper.java @@ -1,5 +1,6 @@ package com.vci.ubcs.omd.wrapper; +import com.vci.ubcs.omd.dto.LifeCycleDTO; import com.vci.ubcs.omd.entity.LifeCycleRule; import com.vci.ubcs.omd.vo.LifeCycleVO; import org.springblade.core.mp.support.BaseEntityWrapper; @@ -43,4 +44,8 @@ } + public LifeCycleRule copyDTO2DO(LifeCycleDTO lifeCycleDTO) { + LifeCycleRule LifeCycleRule = BeanUtil.copy(lifeCycleDTO, LifeCycleRule.class); + return LifeCycleRule; + } } -- Gitblit v1.9.3