From 53d628adb1082d7df51dc1a2151505f17b1de9a2 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期一, 11 九月 2023 14:59:07 +0800 Subject: [PATCH] bug修改,规则克隆接口修改 --- Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeFixedValue.java | 1 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java | 13 + Source/UBCS-WEB/src/views/code/code.vue | 321 +--------------------------- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeFixedValueService.java | 9 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java | 27 ++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java | 3 Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java | 2 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java | 20 + Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClassifyValue.java | 2 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java | 7 Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeBasicSecDTO.java | 5 Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/model/BaseModel.java | 2 Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/CodeFixedValueVO.java | 2 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java | 111 ++++++++- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java | 3 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java | 3 Source/UBCS-WEB/src/const/code/cloneCodeRuleDialogOption.js | 10 Source/UBCS-WEB/src/main.js | 4 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java | 81 +++++- 19 files changed, 268 insertions(+), 358 deletions(-) diff --git a/Source/UBCS-WEB/src/const/code/cloneCodeRuleDialogOption.js b/Source/UBCS-WEB/src/const/code/cloneCodeRuleDialogOption.js index 8b4fedf..990ff22 100644 --- a/Source/UBCS-WEB/src/const/code/cloneCodeRuleDialogOption.js +++ b/Source/UBCS-WEB/src/const/code/cloneCodeRuleDialogOption.js @@ -11,15 +11,23 @@ border: true, index: true, viewBtn: false, - selection: true, + selection: false, menu: false, refreshBtn: false, columnBtn: false, dialogClickModal: false, highlightCurrentRow: true, //琛岄�変腑鏃堕珮浜� rowKey: "oid", //琛屾暟鎹殑 Key锛岀敤鏉ヤ紭鍖� Table 鐨勬覆鏌� + align: 'center', + menuAlign: 'center', column: [ { + label: '', + prop: 'radio', + width: 60, + hide: false + }, + { label: "缂栧彿", prop: "id", search: true, diff --git a/Source/UBCS-WEB/src/main.js b/Source/UBCS-WEB/src/main.js index c409b2d..3bd1b00 100644 --- a/Source/UBCS-WEB/src/main.js +++ b/Source/UBCS-WEB/src/main.js @@ -41,6 +41,8 @@ import referConfigDialog from "@/components/code-dialog-page/referConfigDialog" import referBtmTypeCrudDialog from "@/components/code-dialog-page/referBtmTypeCrudDialog" import referSelectBtmAttrDialog from "@/components/code-dialog-page/referSelectBtmAttrDialog" +import cloneRuleDialog from "@/components/code-dialog-page/cloneRuleDialog" +import cloneOtherBasicSecDialog from "@/components/code-dialog-page/cloneOtherBasicSecDialog" import advancedQuery from "@/components/advanced-query/advancedQuery" import businessAdd from "@/views/modeling/BusinessAdd" import VciMasterCrud from "@/components/MasterCrud/VciMasterCrud" @@ -98,6 +100,8 @@ Vue.component('originalAdd',originalAdd) Vue.component('referBtmTypeCrudDialog',referBtmTypeCrudDialog) Vue.component('referSelectBtmAttrDialog',referSelectBtmAttrDialog) +Vue.component('cloneOtherBasicSecDialog',cloneOtherBasicSecDialog) +Vue.component('cloneRuleDialog',cloneRuleDialog) Vue.component('FormTemplateDialog',FormTemplateDialog) Vue.component('LinkTypeAdd',linkTypeAdd) Vue.component('MasterTree',MasterTree) diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue index cdbc7b8..91711ee 100644 --- a/Source/UBCS-WEB/src/views/code/code.vue +++ b/Source/UBCS-WEB/src/views/code/code.vue @@ -156,7 +156,7 @@ > </advanced-query> - <!-- 缂栫爜瑙勫垯鐩稿叧瀵硅瘽妗� --> + <!-- 浠ヤ笅鏄紪鐮佽鍒欑浉鍏冲璇濇 --> <el-dialog :visible.sync="codeRangeSettingBox" append-to-body @@ -177,150 +177,18 @@ </el-dialog> <!-- 缂栫爜瑙勫垯,鍏嬮殕瀵硅瘽妗� --> - <el-dialog + <clone-rule-dialog :visible.sync="cloneSettingBox" - append-to-body - class="avue-dialog avue-dialog--top" - style="height: 100vh" - title="鍏嬮殕缂栫爜瑙勫垯" - top="-3%" - width="800px" - > - <div> - <el-row> - <el-form ref="form" :inline="true" :model="form" label-width="80px"> - <el-form-item label="缂栧彿" required> - <el-input v-model="cloneCodeRuleForm.id"></el-input> - </el-form-item> - <el-form-item label="鍚嶇О" required> - <el-input v-model="cloneCodeRuleForm.name"></el-input> - </el-form-item> - <el-form-item class="clone-input-textarea" label="鎻忚堪"> - <el-input - v-model="cloneCodeRuleForm.description" - :autosize="{ minRows: 3, maxRows: 5 }" - type="textarea" - ></el-input> - </el-form-item> - </el-form> - </el-row> - <el-row> - <p - style=" - margin: 0 0px 16px 50%; - font-weight: 500; - font-size: 20px; - color: #000; - " - > - 鐮佹绠$悊 - </p> - <avue-crud - :data="cloneData" - :option="cloneOption" - :table-loading="cloneTableLoading" - class="clone-avue-crud" - @on-load="cloneDataOnLoad" - > - <template slot="menu" slot-scope="scope"> - <el-button - v-show="scope.row.orderNum > 1" - icon="el-icon-arrow-up" - plain - size="small" - type="text" - @click="upOrderNum(scope.row)" - >涓婄Щ - </el-button> - <el-button - icon="el-icon-arrow-down" - plain - size="small" - type="text" - @click="downOrderNum(scope.row)" - >涓嬬Щ - </el-button> - </template> - </avue-crud> - </el-row> - </div> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="saveCloneCodeRule">淇� 瀛�</el-button> - <el-button @click="cloneSettingBox = false">鍙� 娑�</el-button> - </div> - </el-dialog> + :ruleData="selectionList[0]" + @refreshRuleTable="onLoad"> + </clone-rule-dialog> <!-- 缂栫爜瑙勫垯,浠庡叾浠栬鍒欏厠闅嗗璇濇 --> - <el-dialog + <clone-other-basic-sec-dialog :visible.sync="cloneOtherCodeRuleSettingBox" - append-to-body - class="avue-dialog avue-dialog--top" - destroy-on-close - style="height: 100vh" - title="鍏嬮殕缂栫爜瑙勫垯鐨勫熀纭�淇℃伅" - top="-3%" - width="800px" - > - <div> - <el-row> - <p - style=" - margin-top: -20px; - margin-bottom: 4px; - font-weight: 570; - font-size: 19px; - color: #0e2d5f; - " - > - 缂栫爜瑙勫垯 - </p> - <avue-crud - ref="crudCloneCodeRuleOther" - :data="data" - :option="cloneCodeRuleOption" - :page.sync="page" - :table-loading="loading" - class="other-clone-coderule-crud" - @row-click="codeOtherCloneRuleRowClick" - @size-change="sizeChange" - @selection-change="selectionOtherCloneCodeRuleChange" - @search-change="searchOtherCloneChange" - @search-reset="searchOtherCloneReset" - @on-load="onLoad" - > - </avue-crud> - </el-row> - <el-row style="margin-top: 10px; border-top: 1px solid #ebeef5"> - <p - style=" - margin-top: 10px; - margin-bottom: 4px; - font-weight: 570; - font-size: 19px; - color: #0e2d5f; - " - > - 鐮佹淇℃伅 - </p> - <avue-crud - ref="crudCloneCodeBasicOther" - :data="basicData" - :option="cloneBasicOption" - :table-loading="loadingBasic" - class="other-clone-codebasic-crud" - @row-click="codeOtherCloneBasicRowClick" - @selection-change="selectionOtherCloneCodeBasicChange" - > - </avue-crud> - </el-row> - </div> - <div slot="footer" class="dialog-footer" style="height: 50px"> - <el-button type="primary" @click="saveOtherCodeBasic">淇� 瀛�</el-button> - <el-button @click="cloneOtherCodeRuleSettingBox = false" - >鍙� 娑�</el-button - > - </div> - </el-dialog> + :quiltCloneCodeRule="selectionList[0]" + @refreshRuleTable="onLoad"> + </clone-other-basic-sec-dialog> <!-- 缂栫爜瑙勫垯,杞Щ鎵�鏈夎�呭璇濇 --> <el-dialog @@ -1414,7 +1282,6 @@ remove, listUseRange, updateStatus, - clone, clearAllCode, checkLikeCodeRule, } from "@/api/code/mdmrule"; @@ -1424,7 +1291,6 @@ upOrderNum, deleteData, editSave, - cloneCodeBasic, addSave, refDataGridClassifySec, } from "@/api/code/codebasic"; @@ -1445,9 +1311,6 @@ } from "@/api/code/codeClassifyValue"; import { getDictionary } from "@/api/omd/enum"; import optionBasic from "@/const/code/codebasic"; -import cloneOption from "@/const/code/cloneOption"; -import cloneBasicOption from "@/const/code/cloneBasicDialogOption"; -import cloneCodeRuleOption from "@/const/code/cloneCodeRuleDialogOption"; import optionRule from "@/const/code/mdmrule"; import attrOption from "@/const/code/selectAttrOptionDialog"; import treeOption from "@/const/code/classifyTreeOptionDialog"; @@ -1476,24 +1339,11 @@ data: [], currentRuleLcStatus: "", - /*鍏嬮殕瀵硅瘽妗嗘帶鍒跺彉閲�*/ + /*鍏嬮殕缂栫爜瑙勫垯瀵硅瘽妗嗘帶鍒跺彉閲�*/ cloneSettingBox: false, - cloneTableLoading: false, - cloneOption: cloneOption, - cloneData: [], - cloneCodeRuleForm: { - id: "", - name: "", - description: "", - }, /*浠庡叾浠栬鍒欏厠闅嗙爜娈�*/ cloneOtherCodeRuleSettingBox: false, - cloneBasicOption: cloneBasicOption, - cloneCodeRuleOption: cloneCodeRuleOption, - selectionOtherCloneCodeBasicList: [], // 姝ょ晫闈㈠唴褰撳墠閫変腑鐨勫熀纭�鐮佹 - selectionOtherCloneCodeRuleList: [], // 姝ょ晫闈㈠唴褰撳墠閫変腑鐨勭紪鐮佽鍒� - otherCloneQuery: {}, // 鏌ヨ鏉′欢瀵硅薄 /** 杞Щ鎵�鏈夎�呭璇濇 */ escapeOwnerVisible: false, @@ -1549,7 +1399,7 @@ loadingBasic: false, selectionBasicList: [], addBasicCodeSettingBox: false, - showbtn: false, //鍩虹鐮佹鏂板鏄惁鏄剧ず鍩虹鐮佹 + showbtn: false, //鍩虹鐮佹鏂板鎸夐挳鏄惁绂佺敤 isLoadingSecCodeAddBtn: false, basicSecDialogTitle: "", //鍩虹鐮佹绗竴灞傚璇濇鏍囬 basicSecOnlyRead: false, //鏂板鍩虹鐮佹琛ㄥ崟鏄惁鍙 @@ -2575,46 +2425,6 @@ return; } this.cloneSettingBox = true; - this.cloneCodeRuleForm.id = this.selectionList[0].id; - this.cloneCodeRuleForm.name = this.selectionList[0].name; - this.cloneCodeRuleForm.description = this.selectionList[0].description; - this.loadBasic({ oid: this.selectionList[0].oid }); - }, - /** 鍏嬮殕缂栫爜瑙勫垯淇濆瓨鍔熻兘*/ - saveCloneCodeRule() { - let form = this.cloneCodeRuleForm; - if (form.id.trim() == "") { - this.$message.warning("缂栧彿涓嶈兘涓虹┖!"); - return; - } - if (form.name.trim() == "") { - this.$message.warning("鐮佸�间笉鑳戒负绌�!"); - return; - } - this.selectionList[0].oid = ""; - this.selectionList[0].id = form.id; - this.selectionList[0].name = form.name; - this.selectionList[0].description = form.description; - this.selectionList[0].createTime = new Date().getTime(); - this.selectionList[0].ts = new Date(this.selectionList[0].ts).getTime(); - this.selectionList[0].lcStatus = "Editing"; - let data = Object.assign({}, this.selectionList[0], { - elements: this.cloneData, - }); - clone(data).then( - () => { - this.cloneSettingBox = false; - this.onLoad(this.page); - this.$message({ - type: "success", - message: "鎿嶄綔鎴愬姛!", - }); - }, - (error) => { - window.console.log(error); - } - ); - //console.log(data); }, /** 鎵撳紑浠庡叾浠栫紪鐮佽鍒欎腑鍏嬮殕鐮佹瀵硅瘽妗�*/ @@ -2627,99 +2437,6 @@ return; } this.cloneOtherCodeRuleSettingBox = true; - }, - /** 浠庡叾浠栫紪鐮佽鍒欎腑鍏嬮殕鐮佹瀵硅瘽妗�-鍗曞嚮缂栫爜瑙勫垯瀹炵幇琛岄�夋嫨*/ - codeOtherCloneRuleRowClick(row) { - this.$refs.crudCloneCodeRuleOther.toggleSelection(); - this.selectionOtherCloneCodeRuleList = row; - this.$refs.crudCloneCodeRuleOther.setCurrentRow(row); - this.$refs.crudCloneCodeRuleOther.toggleRowSelection(row); //閫変腑褰撳墠琛� - this.loadBasic(row); - }, - /** 浠庡叾浠栫紪鐮佽鍒欎腑鍏嬮殕鐮佹瀵硅瘽妗�-鍗曞嚮鍩虹鐮佹瀹炵幇琛岄�夋嫨*/ - codeOtherCloneBasicRowClick(row) { - this.$refs.crudCloneCodeBasicOther.toggleSelection(); - this.selectionOtherCloneCodeBasicList = row; - this.$refs.crudCloneCodeBasicOther.setCurrentRow(row); - this.$refs.crudCloneCodeBasicOther.toggleRowSelection(row); //閫変腑褰撳墠琛� - }, - /** 浠庡叾浠栬鍒欏厠闅嗙爜娈电晫闈腑缂栫爜瑙勫垯褰撳墠閫変腑琛屽彉鍖栫殑鏃跺�欒Е鍙�*/ - selectionOtherCloneCodeRuleChange(list) { - //console.log(list); - this.selectionOtherCloneCodeRuleList = list; - this.$refs.crudBasic.setCurrentRow( - this.selectionBasicList[list.length - 1] - ); - if (list == "") { - this.basicData = []; - } - if (this.selectionOtherCloneCodeRuleList.length > 0) { - this.loadBasic(this.selectionOtherCloneCodeRuleList[list.length - 1]); - } - }, - selectionOtherCloneCodeBasicChange(list) { - this.selectionOtherCloneCodeBasicList = list; - this.$refs.crudCloneCodeBasicOther.setCurrentRow( - this.selectionOtherCloneCodeBasicList[list.length - 1] - ); - }, - /** 浠庡叾浠栬鍒欏厠闅嗙爜娈电晫闈㈤噸缃悳绱㈠姛鑳� */ - searchOtherCloneReset() { - this.otherCloneQuery = {}; - this.onLoad(this.page); - }, - /** 浠庡叾浠栬鍒欏厠闅嗙爜娈电晫闈㈡悳绱㈠姛鑳�*/ - searchOtherCloneChange(params, done) { - this.page.currentPage = 1; - // 澶氫釜conditionMap杩欐牱浼犲弬锛屽揩閫熸煡璇㈤粯璁ら噰鐢ㄦā绯婃煡璇� - let requestData = {}; - if (params) { - Object.keys(params).forEach((key) => { - requestData["conditionMap" + "[" + key + "_like]"] = - params[key].trim(); - }); - } - this.otherCloneQuery = requestData; - this.onLoad(this.page,requestData); - done(); - }, - /** 淇濆瓨浠庡叾浠栫紪鐮佽鍒欎腑鍏嬮殕鐮佹淇℃伅*/ - saveOtherCodeBasic() { - let oid = this.selectionList[0].oid; - let fromDialogPkCodebasic = this.selectionOtherCloneCodeBasicList; - if (fromDialogPkCodebasic.length <= 0) { - this.$message.warning("璇烽�夋嫨鐮佹鏁版嵁!"); - return; - } - let res = fromDialogPkCodebasic.filter((item) => { - return item.pkCodeRule == oid; - }); - if (res != "") { - this.$message.warning("闇�瑕佸厠闅嗙殑缂栫爜瑙勫垯涓庤鍏嬮殕鐨勭紪鐮佽鍒欑浉鍚�!"); - return; - } - let oidArr = []; - fromDialogPkCodebasic.forEach((ele) => { - oidArr.push(ele.oid); - }); - let data = { - pkCodeRule: oid, - oidArr: oidArr.join(","), - }; - //console.log(data); - cloneCodeBasic(data).then( - () => { - this.cloneOtherCodeRuleSettingBox = false; - this.onLoad(this.page); - this.$message({ - type: "success", - message: "鎿嶄綔鎴愬姛!", - }); - }, - (error) => { - window.console.log(error); - } - ); }, /** 娓呯┖鐮佸��*/ @@ -3235,11 +2952,7 @@ }, /** 鐐瑰嚮瑙﹀彂鍔犺浇鍩虹鐮佹淇℃伅*/ loadBasic(row) { - if (this.cloneSettingBox) { - this.cloneTableLoading = true; - } else { - this.loadingBasic = true; - } + this.loadingBasic = true; // console.log(row.oid); if (row != "" || row != null) { //瀛樺偍褰撳墠鍏宠仈鐨勭紪鐮佽鍒欑浉鍏充俊鎭� @@ -3272,14 +2985,8 @@ gridCodeBasicSec(1, -1, isAdancedQuery ? condition : conditionMaps).then( (res) => { const data = res.data.data; - if (this.cloneSettingBox) { - this.cloneData = data.records; - this.cloneTableLoading = false; - } else { - this.basicData = data.records; - // console.log(this.basicData); - this.loadingBasic = false; - } + this.basicData = data.records; + this.loadingBasic = false; } ); }, diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeBasicSecDTO.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeBasicSecDTO.java index 95b8e8f..dc7c752 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeBasicSecDTO.java +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/CodeBasicSecDTO.java @@ -82,7 +82,6 @@ */ private String codeSecLength; - /** * 灞傜骇绫诲瀷 */ @@ -148,7 +147,6 @@ */ private String filterSql ; - /** * 娴佹按鍙疯捣濮嬪�� */ @@ -158,7 +156,6 @@ * 娴佹按鐨勬闀� */ private Integer serialStep; - /** * 缂栫爜琛ヤ綅鏂瑰紡 @@ -210,7 +207,6 @@ */ private String parentClassifySecText; - /** * 鏄惁鍙互涓虹┖ */ @@ -240,6 +236,7 @@ * 閫夋嫨鐮佹淇℃伅鐨勪富閿泦鍚� */ private String oidArr; + /** * 鑾峰彇 鐮佹绫诲瀷 */ diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClassifyValue.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClassifyValue.java index 171542c..7f627a8 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClassifyValue.java +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClassifyValue.java @@ -19,11 +19,11 @@ @EqualsAndHashCode(callSuper = true) public class CodeClassifyValue extends BaseModel { - /** * 搴忓垪鍖� */ private static final long serialVersionUID = 5238387322464830032L; + /** * 鍒嗙被鐮佹涓婚敭 */ diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeFixedValue.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeFixedValue.java index a286bae..eca4ff3 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeFixedValue.java +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeFixedValue.java @@ -23,6 +23,7 @@ * 搴忓垪鍖� */ private static final long serialVersionUID = 3392365440606832597L; + /** * 鍥哄畾鐮佹涓婚敭 */ diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/CodeFixedValueVO.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/CodeFixedValueVO.java index ac8e6ee..e4e2355 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/CodeFixedValueVO.java +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/CodeFixedValueVO.java @@ -30,8 +30,6 @@ */ private Integer orderNum; - - /** * 鑾峰彇 鍥哄畾鐮佹涓婚敭 */ diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/model/BaseModel.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/model/BaseModel.java index 9bb7b6f..4647cee 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/model/BaseModel.java +++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/model/BaseModel.java @@ -21,7 +21,7 @@ using = ToStringSerializer.class ) @ApiModelProperty("涓婚敭id") - @TableId(value = "OID",type = IdType.ASSIGN_UUID) + @TableId(value = "OID",type = IdType.ASSIGN_ID) private String oid; @TableField(value = "id") diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java index 106b325..a004b76 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java +++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java @@ -36,7 +36,7 @@ public static <T extends BaseModel> T addDefaultAttrAssimt(T object,String btmName) throws VciBaseException { BaseModel baseModel = object; try { - baseModel.setOid(VciBaseUtil.getPk().toUpperCase()); + baseModel.setOid(VciBaseUtil.getPk()); baseModel.setCreateTime(new Date()); baseModel.setNameOid(VciBaseUtil.getPk()); baseModel.setLastModifyTime(new Date()); diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java index 5aaed90..5f81558 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java @@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.rmi.ServerException; import java.util.Collection; import java.util.List; @@ -162,7 +163,7 @@ @PostMapping("/clone") @ApiOperationSupport(order = 10) @ApiOperation(value = "鍏嬮殕鐮佹淇℃伅", notes = "codeBasicSecDTO") - public R cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ + public R cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO) throws ServerException { VciBaseUtil.alertNotNull(codeBasicSecDTO.getOidArr(),"閫夋嫨鐮佹涓婚敭"); List<String> oidArr = VciBaseUtil.str2List(codeBasicSecDTO.getOidArr()); if (CollectionUtils.isEmpty(oidArr)){ diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java index e49b382..34039f6 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java @@ -48,6 +48,7 @@ import javax.validation.Valid; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.rmi.ServerException; import java.util.Collection; import java.util.Map; @@ -200,7 +201,7 @@ @PostMapping("/clone") @ApiOperationSupport(order = 13) @ApiOperation(value = "鍏嬮殕缂栫爜瑙勫垯", notes = "浼犲叆codeRuleDTO") - public R cloneCodeRule(@RequestBody CodeRuleDTO codeRuleDTO){ + public R cloneCodeRule(@RequestBody CodeRuleDTO codeRuleDTO) throws ServerException { return codeRuleService.cloneCodeRule(codeRuleDTO); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java index 95bd055..c985b94 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeBasicSecService.java @@ -17,6 +17,7 @@ import org.springblade.core.tool.utils.BeanUtil; import org.springframework.util.CollectionUtils; +import java.rmi.ServerException; import java.util.*; /** @@ -41,7 +42,7 @@ * @param codeRuleOid 缂栫爜瑙勫垯涓婚敭 * @return 鎵ц缁撴灉 */ - boolean batchDeleteSecByCodeRuleOid(String codeRuleOid); + boolean batchDeleteSecByCodeRuleOid(String codeRuleOid)throws VciBaseException; /** * 鏍规嵁鐮佹鍒嗙被鐨勭被鍨嬪垽鏂睘鎬ф槸鍚︽槸绌虹殑 @@ -122,7 +123,15 @@ * @param pkCodeRule 鐩爣缂栫爜瑙勫垯 * @return 鍏嬮殕缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐� */ - R cloneCodeBasicSec(List<String> oidList, String pkCodeRule); + R cloneCodeBasicSec(List<String> oidList, String pkCodeRule) throws ServerException; + + /** + * 鏀瑰彉鐮佹涓埗鍒嗙被鐮佹鍜屽瓙鍒嗙被鐮佹涔嬮棿鐨勫叧鑱攐id涓烘柊鐨刼id,骞朵笖涓嶇牬鍧忓垎绫荤爜鍊肩殑鍏宠仈鍏崇郴 + * @param basicSecs + * @return + * @throws ServerException + */ + boolean changeParentOidAssnOid(List<CodeBasicSec> basicSecs) throws ServerException; /** * 鏌ヨ鐩爣鍒嗙被鐮佹鎵�鍦ㄧ殑鏍戠粨鏋� diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java index 52a5ed5..00d59d5 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyValueService.java @@ -25,6 +25,13 @@ public interface ICodeClassifyValueService extends IService<CodeClassifyValue> { /** + * 鍏嬮殕鍒嗙被鐮佸�� + * @param codeClassifyValues + * @return + */ + boolean cloneCodeClassifyVaue(List<CodeClassifyValue> codeClassifyValues); + + /** * 鏌ヨ鍒嗙被鐮佹鐨勭爜鍊� 鏍� * @param treeQueryObject 鏍戞煡璇㈠璞� * @return 鍒嗙被鐮佹鐨勭爜鍊� 鏄剧ず鏍� diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeFixedValueService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeFixedValueService.java index 9dae445..e147304 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeFixedValueService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeFixedValueService.java @@ -7,8 +7,6 @@ import com.vci.ubcs.code.vo.pagemodel.CodeFixedValueVO; import com.vci.ubcs.starter.exception.VciBaseException; import org.springblade.core.tool.api.R; -import org.springframework.data.domain.Page; - import java.util.Collection; import java.util.List; import java.util.Map; @@ -102,4 +100,11 @@ */ boolean batchDeleteBySecOid(String codefixedsecoid); + /** + * 鏍规嵁codeFixedSecOid鏌ヨ鐮佸�� + * @param codeFixedSecOids + * @return + */ + List<CodeFixedValue> listFixedValueByCodeFixedSecOid(List<String> codeFixedSecOids); + } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java index e65a4a4..e68c5e7 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleService.java @@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import java.rmi.ServerException; import java.util.Collection; import java.util.Map; @@ -144,7 +145,7 @@ * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈� * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞� */ - R cloneCodeRule(CodeRuleDTO codeRuleDTO) throws VciBaseException; + R cloneCodeRule(CodeRuleDTO codeRuleDTO) throws VciBaseException, ServerException; /** * 缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮� diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java index ea4666f..1123541 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java @@ -52,6 +52,7 @@ import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import java.rmi.ServerException; import java.util.*; import java.util.stream.Collectors; @@ -114,7 +115,7 @@ /** * 涓婂眰鍒嗙被鐮佹鐨勫睘鎬у悕绉� */ - private static final String PARENT_FIELD_NAME = "parentclassifysecoid"; + private static final String PARENT_FIELD_NAME = "parentClassifySecOid"; /** * 涓婄骇鍒嗙被鐮佸�肩殑灞炴�у悕绉� @@ -170,10 +171,10 @@ // 灏嗚浣滀负鍒犻櫎鏉′欢鐨勫�兼斁鍦ㄤ竴涓泦鍚堥噷闈� Set<String> fixedSecOidSet = fixedSecList.stream().map(CodeBasicSec::getOid).collect(Collectors.toSet()); // 閫氳繃澶栭敭杩涜鏌ヨ - List<CodeFixedValue> fixedValueS = fixedValueMapper.selectList(Wrappers.<CodeFixedValue>query().lambda().in(CodeFixedValue::getCodeFixedSecOid,fixedSecOidSet)); - if(!fixedValueS.isEmpty()){ + List<CodeFixedValue> fixedValues = fixedValueMapper.selectList(Wrappers.<CodeFixedValue>query().lambda().in(CodeFixedValue::getCodeFixedSecOid,fixedSecOidSet)); + if(!fixedValues.isEmpty()){ // 鏍规嵁鏌ヨ鍑烘潵鐨刬d鎵ц鍥哄畾鐮佹鎵ц鍒犻櫎 - deletFlag = fixedValueMapper.deleteBatchIds(fixedValueS.stream().map(CodeFixedValue::getOid).collect(Collectors.toSet()))>0; + deletFlag = fixedValueMapper.deleteBatchIds(fixedValues.stream().map(CodeFixedValue::getOid).collect(Collectors.toSet()))>0; } } // 4銆佸啀鍒犻櫎鍒嗙被鐮佹 @@ -184,10 +185,10 @@ // 灏嗚浣滀负鍒犻櫎鏉′欢鐨勫�兼斁鍦ㄤ竴涓泦鍚堥噷闈� Set<String> classifySecOidSet = classifySecList.stream().map(CodeBasicSec::getOid).collect(Collectors.toSet()); // 閫氳繃澶栭敭杩涜鏌ヨ - List<CodeClassifyValue> fixedValueS = codeClassifyValueMapper.selectList(Wrappers.<CodeClassifyValue>query().lambda().in(CodeClassifyValue::getCodeClassifySecOid,classifySecOidSet)); - if(!fixedValueS.isEmpty()){ + List<CodeClassifyValue> codeClassifyValues = codeClassifyValueMapper.selectList(Wrappers.<CodeClassifyValue>query().lambda().in(CodeClassifyValue::getCodeClassifySecOid,classifySecOidSet)); + if(!codeClassifyValues.isEmpty()){ // 鏍规嵁鏌ヨ鍑烘潵鐨勪富閿甶d鎵ц鍥哄畾鐮佹鎵ц鍒犻櫎 - deletFlag = fixedValueMapper.deleteBatchIds(fixedValueS.stream().map(CodeClassifyValue::getOid).collect(Collectors.toSet()))>0; + deletFlag = codeClassifyValueMapper.deleteBatchIds(codeClassifyValues.stream().map(CodeClassifyValue::getOid).collect(Collectors.toSet()))>0; } } return deletFlag; @@ -574,7 +575,7 @@ */ @Override @Transactional(rollbackFor = Exception.class) - public R cloneCodeBasicSec(List<String> oidList, String pkCodeRule) throws ServiceException { + public R cloneCodeBasicSec(List<String> oidList, String pkCodeRule) throws ServiceException, ServerException { boolean isLinked = checkIsLinked(pkCodeRule,null); if (isLinked) { return R.fail("缂栫爜瑙勫垯宸茶寮曠敤锛屼笉鍏佽缂栬緫鎴栧垹闄�"); @@ -584,20 +585,96 @@ if(basicSecDOS.isEmpty()){ return R.fail("鍏嬮殕鐨勭爜娈典俊鎭笉瀛樺湪锛�"); } - basicSecDOS.forEach(sec -> { + List<CodeBasicSec> codeClassifySec = new ArrayList<>(); + Map<String,List<CodeFixedValue>> codeFixedValueMaps = new HashMap<>(); + for (CodeBasicSec sec : basicSecDOS) { CodeBasicSec newSecDO = new CodeBasicSec(); BeanUtilForVCI.copyPropertiesIgnoreCase(sec,newSecDO); - newSecDO.setOid(VciBaseUtil.getPk()); - newSecDO.setNameOid(VciBaseUtil.getPk()); - newSecDO.setRevisionOid(VciBaseUtil.getPk()); - newSecDO.setId(newSecDO.getId() + "_copy"); - newSecDO.setName(newSecDO.getName() + "_copy"); + String oldBasicOid = newSecDO.getOid(); + newSecDO.setId(newSecDO.getId()); + newSecDO.setName(newSecDO.getName()); newSecDO.setPkCodeRule(pkCodeRule); + // 鍒ゆ柇鏄惁鏄垎绫荤爜娈�,涓氬姟閫昏緫绋嶅井澶嶆潅涓�鐐规墍浠ラ渶瑕佸厛鎻愬嚭鏉ュ崟鐙鐞� + if(newSecDO.getSecType().equals(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue())){ + // 瀛樺偍鏃х殑鐮佹oid鍜屾柊鐨勭爜娈电殑oid鐨勫叧鑱斿叧绯� + codeClassifySec.add(newSecDO); + continue; + } + // 鏇存敼鍒涘缓鏃堕棿锛屼慨鏀规椂闂寸瓑榛樿鍊� + DefaultAttrAssimtUtil.addDefaultAttrAssimt(newSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC); + //鍥哄畾鐮佹 + if(newSecDO.getSecType().equals(CodeSecTypeEnum.CODE_FIXED_SEC.getValue())){ + // 鍥哄畾鐮佹瀛樺偍濂給id鍜岀爜鍊肩殑鍏宠仈鍏崇郴 + codeFixedValueMaps.put(newSecDO.getOid(),fixedValueService.list(Wrappers.<CodeFixedValue>query() + .lambda().eq(CodeFixedValue::getCodeFixedSecOid, oldBasicOid) + )); + } createList.add(newSecDO); - }); + } + // 澶勭悊鍒嗙被鐮佹鐨刼id锛屽洜涓簅id鍏宠仈parentClassifyOid锛屼笌鐮佸�糲odeClassifyOid锛岀爜鍊煎張闇�瑕侀�氳繃鏃х殑鐮佹oid鏉ユ煡璇紝鎵�浠ヤ笉鑳界洿鎺ユ敼鍙榦id + boolean resChangeAssn = changeParentOidAssnOid(codeClassifySec); + // 灏嗗鐞嗚繃鐨勫垎绫荤爜娈典篃娣诲姞杩涜鍋氭柊澧炲鐞嗙殑鐮佹闆嗗悎涓� + createList.addAll(codeClassifySec); boolean resBoolean = saveBatch(createList); - //codeBasicSecMapper.insertBatch(createList); - return resBoolean ? R.data(resBoolean,"鍏嬮殕鐮佹淇℃伅鎴愬姛"):R.fail("鍏嬮殕鐮佹淇℃伅澶辫触锛�"); + // 鏈�缁堣瀛樺叆鐮佸�艰〃涓殑锛岀爜鍊煎璞� + List<CodeFixedValue> codeFixedDOValues = new ArrayList<>(); + // 鏋勯�犵爜鍊煎璞★紝涓庣爜娈典富閿叧鑱斿叧绯伙紝浠ュ強鏀瑰彉鍥哄畾鐮佸�肩殑oid + codeFixedValueMaps.forEach((key, value) -> { + value.stream().forEach(item -> { + item.setOid(""); + item.setCodeFixedSecOid(key); + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item); + codeFixedDOValues.add(item); + }); + }); + // 鍏嬮殕鍥哄畾鐮佸�� + boolean resFixed = fixedValueService.saveBatch(codeFixedDOValues); + return (resBoolean&&resFixed&&resChangeAssn) ? R.data(resBoolean,"鍏嬮殕鐮佹淇℃伅鎴愬姛"):R.fail("鍏嬮殕鐮佹淇℃伅澶辫触锛�"); + } + + /** + * 鏀瑰彉鐮佹涓埗鍒嗙被鐮佹鍜屽瓙鍒嗙被鐮佹涔嬮棿鐨勫叧鑱攐id涓烘柊鐨刼id,骞朵笖涓嶇牬鍧忓垎绫荤爜鍊肩殑鍏宠仈鍏崇郴 + * @param basicSecs + * @return + * @throws ServerException + */ + @Override + public boolean changeParentOidAssnOid(List<CodeBasicSec> basicSecs) throws ServerException { + Map<String, List<CodeClassifyValue>> codeClassValues = new HashMap<>(); + List<CodeClassifyValue> codeClassifyDOValues = new ArrayList<>(); + HashMap<String, String> oidMap = new HashMap<>(); + boolean resClone = false; + try { + // 閬嶅巻瀵硅薄鏁扮粍锛屼负姣忎釜瀵硅薄鐢熸垚鏂扮殑oid锛屽苟灏嗗師濮媜id鍜屾柊oid鐨勬槧灏勫叧绯诲瓨鍌ㄥ埌Map涓� + for (CodeBasicSec obj : basicSecs) { + String originalOid = obj.getOid(); + String newOid = VciBaseUtil.getPk(); + oidMap.put(originalOid, newOid); + } + // 閬嶅巻瀵硅薄鏁扮粍锛屾洿鏂版瘡涓璞$殑oid鍜宑odeClassifySecOid灞炴�у�� + for (CodeBasicSec obj : basicSecs) { + String originalOid = obj.getOid(); + String newOid = oidMap.get(originalOid); + // 鏂扮殑oid鍏宠仈瑕佸厠闅嗙爜鍊� + codeClassValues.put(newOid,codeClassifyValueService.list(Wrappers.<CodeClassifyValue>query() + .lambda().eq(CodeClassifyValue::getCodeClassifySecOid, originalOid))); + obj.setOid(newOid); + String originalParentClassifyValueOid = obj.getParentClassifySecOid(); + String newParentClassifyValueOid = oidMap.get(originalParentClassifyValueOid); + obj.setParentClassifySecOid(newParentClassifyValueOid); + } + codeClassValues.forEach((key, value) -> { + value.stream().forEach(item -> { + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item); + item.setCodeClassifySecOid(key); + codeClassifyDOValues.add(item); + }); + }); + resClone = codeClassifyValueService.cloneCodeClassifyVaue(codeClassifyDOValues); + }catch (Exception e){ + throw new ServerException("鐖跺垎绫荤爜娈靛拰瀛愬垎绫荤爜娈礳lone杞崲oid鏃跺嚭閿欙細"+e.getCause()); + } + return resClone; } /** diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java index 132ea09..88770ac 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java @@ -61,6 +61,33 @@ private static final String PARENT_FIELD_NAME = "parentClassifyValueOid"; /** + * 鍏嬮殕鍒嗙被鐮佸�� + * @param codeClassifyValues + * @return + */ + @Override + public boolean cloneCodeClassifyVaue(List<CodeClassifyValue> codeClassifyValues) { + // 鍒涘缓Map瀵硅薄锛岀敤浜庡瓨鍌ㄥ師濮媜id鍜屾柊oid鐨勬槧灏勫叧绯� + Map<String, String> oidMap = new HashMap<>(); + // 閬嶅巻瀵硅薄鏁扮粍锛屼负姣忎釜瀵硅薄鐢熸垚鏂扮殑oid锛屽苟灏嗗師濮媜id鍜屾柊oid鐨勬槧灏勫叧绯诲瓨鍌ㄥ埌Map涓� + for (CodeClassifyValue obj : codeClassifyValues) { + String originalOid = obj.getOid(); + String newOid = VciBaseUtil.getPk(); + oidMap.put(originalOid, newOid); + } + // 閬嶅巻瀵硅薄鏁扮粍锛屾洿鏂版瘡涓璞$殑oid鍜宑odeClassifySecOid灞炴�у�� + for (CodeClassifyValue obj : codeClassifyValues) { + String originalOid = obj.getOid(); + String newOid = oidMap.get(originalOid); + obj.setOid(newOid); + String originalParentClassifyValueOid = obj.getParentClassifyValueOid(); + String newParentClassifyValueOid = oidMap.get(originalParentClassifyValueOid); + obj.setParentClassifyValueOid(newParentClassifyValueOid); + } + return this.saveBatch(codeClassifyValues); + } + + /** * 鏌ヨ鍒嗙被鐮佹鐨勭爜鍊� 鏍� * @param treeQueryObject 鏍戞煡璇㈠璞� * @return 鍒嗙被鐮佹鐨勭爜鍊� 鏄剧ず鏍� diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java index 97fc88d..47d537f 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vci.ubcs.code.dto.CodeFixedValueDTO; @@ -24,7 +25,6 @@ import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -74,6 +74,24 @@ } /** + * 鏍规嵁codeFixedSecOid鏌ヨ鐮佸�� + * @param codeFixedSecOids + * @return + */ + @Override + public List<CodeFixedValue> listFixedValueByCodeFixedSecOid(List<String> codeFixedSecOids){ + if(codeFixedSecOids.isEmpty()){ + return new ArrayList<CodeFixedValue>(); + } + /*List<CodeFixedValue> codeFixedValues = codeFixedValueMapper.selectList( + Wrappers.<CodeFixedValue>query().lambda() + .in(CodeFixedValue::getCodeFixedSecOid, codeFixedSecOids) + );*/ + List<CodeFixedValue> codeFixedValues = codeFixedValueMapper.selectByPageByCodeFixedSecOid(codeFixedSecOids, new Page<>(1, -1)); + return codeFixedValues; + } + + /** * 澧炲姞鍥哄畾鐮佹鐨勭爜鍊� * @param codeFixedValueDTO 鍥哄畾鐮佹鐨勭爜鍊兼暟鎹紶杈撳璞� * @return 鎵ц缁撴灉 diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java index be398aa..5d8bd08 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleServiceImpl.java @@ -17,6 +17,7 @@ package com.vci.ubcs.code.service.impl; import com.alibaba.cloud.commons.lang.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -48,6 +49,7 @@ import com.vci.ubcs.starter.web.util.BeanUtilForVCI; import com.vci.ubcs.starter.web.util.VciBaseUtil; import com.vci.ubcs.starter.web.util.WebUtil; +import com.vci.ubcs.system.cache.NacosConfigCache; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; @@ -64,6 +66,7 @@ import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import java.rmi.ServerException; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -110,10 +113,14 @@ @Resource private RevisionModelUtil revisionModelUtil; - @Value("${user-info.tenant-id}") - private String tenantId; - @Value("${user-info.id}") - private String userId; + @Resource + private NacosConfigCache nacosConfigCache; + + @Resource + private ICodeFixedValueService codeFixedValueService; + + @Resource + private ICodeClassifyValueService codeClassifyValueService; /** * 鍒嗛〉鏌ヨ @@ -124,7 +131,9 @@ @Override public IPage<CodeRuleVO> gridCodeRule(Query query, Map<String,Object> conidtionMap) { //濡傛灉绛変簬鑷繁閰嶇疆鐨勭鐞嗙粍绉熸埛id鍜岀鐞嗙粍瓒呯璐﹀彿锛屽氨涓嶉渶瑕佹寜鐓ц鍒欐墍鏈夎�呮潵杩涜鏌ヨ - if(!(AuthUtil.getTenantId().equals(this.tenantId) && AuthUtil.getUserId().toString().equals(this.userId))){ + if(!(AuthUtil.getTenantId().equals(nacosConfigCache.getAdminUserInfo().getTenantId()) + && AuthUtil.getUserId().toString().equals(nacosConfigCache.getAdminUserInfo().getUserId().toString())) + ){ // 鎸夌収瑙勫垯鎵�鏈夎�呮潵鏌ヨ conidtionMap.put("owner",AuthUtil.getUserId()); } @@ -162,14 +171,17 @@ */ @Override public boolean checkCodeRuleRepeat(CodeRuleDTO codeRuleDTO){ + LambdaQueryWrapper<CodeRule> wrapper = Wrappers.<CodeRule>query() + .lambda().eq(CodeRule::getId, codeRuleDTO.getId()); + if(AuthUtil.getTenantId().equals(nacosConfigCache.getAdminUserInfo().getTenantId())){ + wrapper.eq(CodeRule::getTenantId,codeRuleDTO.getTenantId()); + } // 鏍规嵁瑙勫垯id鏌ヨ缂栧彿 - List<CodeRule> codeRulesList = this.codeRuleMapper.selectList(Wrappers.<CodeRule>query() - .lambda().eq(CodeRule::getId, codeRuleDTO.getId()) - .eq(CodeRule::getTenantId,AuthUtil.getTenantId().equals(this.tenantId) ? "":codeRuleDTO.getTenantId())); + List<CodeRule> codeRulesList = this.codeRuleMapper.selectList(wrapper); if(!codeRulesList.isEmpty()){ return codeRulesList.parallelStream().anyMatch(codeRule -> { if(StringUtils.isNotBlank(codeRuleDTO.getOid())){ - // 浠h〃鏄慨鏀癸紝涓嶆槸灏嗙紪鍙蜂慨鏀圭浉鍚岀殑缂栧彿 + // 浠h〃鏄慨鏀硅鍒欙紝涓嶆槸灏嗙紪鍙蜂慨鏀逛负宸插瓨鍦ㄧ殑鐨勭紪鍙� return !codeRule.getOid().equals(codeRuleDTO.getOid()); }else { return true; @@ -465,14 +477,21 @@ */ @Override @Transactional(rollbackFor = Exception.class) - public R cloneCodeRule(CodeRuleDTO codeRuleDTO) { + public R cloneCodeRule(CodeRuleDTO codeRuleDTO) throws ServerException { + if(checkCodeRuleRepeat(codeRuleDTO)){ + return R.fail("瑙勫垯缂栧彿宸插瓨鍦紒"); + } VciBaseUtil.alertNotNull(codeRuleDTO, "闇�瑕佹坊鍔犵殑鏁版嵁瀵硅薄"); CodeRule codeRuleDO = new CodeRule(); + DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeRuleDO,MdmBtmTypeConstant.CODE_RULE); BeanUtilForVCI.copyPropertiesIgnoreCase(codeRuleDTO, codeRuleDO); boolean exFlag = codeRuleMapper.insert(codeRuleDO)>0; List<CodeBasicSecDTO> secList = codeRuleDTO.getElements(); List<CodeBasicSec> codeBasicSecs = new ArrayList<>(); - secList.forEach(codeBasicSecDTO -> { + List<CodeBasicSec> codeClassifySec = new ArrayList<>(); + // 鍥哄畾鐮佸�兼槧灏勫叧绯� + Map<String,List<CodeFixedValue>> codeFixedValueMaps = new HashMap<>(); + for (CodeBasicSecDTO codeBasicSecDTO : secList) { codeBasicSecDTO.setPkCodeRule(codeRuleDO.getOid()); KeyValue attrKv = codeBasicSecService.checkAttrNullableBySecType(codeBasicSecDTO); if (!"success".equals(attrKv.getKey())) { @@ -480,13 +499,43 @@ } CodeBasicSec codeBasicSecDO = new CodeBasicSec(); BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDTO, codeBasicSecDO); - codeBasicSecDO.setOid(""); - codeBasicSecDO.setRevisionOid(""); - codeBasicSecDO.setNameOid(""); + String oldBasicOid = codeBasicSecDO.getOid(); //琚厠闅嗙殑鐮佹鐨刼id + // 鍒ゆ柇鏄惁鏄垎绫荤爜娈� + if(codeBasicSecDO.getSecType().equals(CodeSecTypeEnum.CODE_CLASSIFY_SEC.getValue())){ + // 瀛樺偍鏃х殑鐮佹oid鍜屾柊鐨勭爜娈电殑oid鐨勫叧鑱斿叧绯� + codeClassifySec.add(codeBasicSecDO); + continue; + } + // 鏇存敼鍒涘缓鏃堕棿锛屼慨鏀规椂闂寸瓑榛樿鍊� + DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeBasicSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC); + // 鍥哄畾鐮佹 + if(codeBasicSecDO.getSecType().equals(CodeSecTypeEnum.CODE_FIXED_SEC.getValue())){ + // 鍥哄畾鐮佹瀛樺偍濂給id鍜岀爜鍊肩殑鍏宠仈鍏崇郴 + codeFixedValueMaps.put(codeBasicSecDO.getOid(),codeFixedValueService.list(Wrappers.<CodeFixedValue>query() + .lambda().eq(CodeFixedValue::getCodeFixedSecOid, oldBasicOid) + )); + } codeBasicSecs.add(codeBasicSecDO); - }); + } + // 澶勭悊鍒嗙被鐮佹鐨刼id锛屽洜涓簅id鍏宠仈parentClassifyOid锛屼笌鐮佸�糲odeClassifyOid锛岀爜鍊煎張闇�瑕侀�氳繃鏃х殑鐮佹oid鏉ユ煡璇紝鎵�浠ヤ笉鑳界洿鎺ユ敼鍙榦id + boolean resChangeAssn = codeBasicSecService.changeParentOidAssnOid(codeClassifySec); + // 灏嗗鐞嗚繃鐨勫垎绫荤爜娈典篃娣诲姞杩涜鍋氭柊澧炲鐞嗙殑鐮佹闆嗗悎涓� + codeBasicSecs.addAll(codeClassifySec); + // 鏂板鐮佹 boolean exFlag1 = this.codeBasicSecService.saveBatch(codeBasicSecs); - return R.data(exFlag&&exFlag1); + // 鏈�缁堣瀛樺叆鐮佸�艰〃涓殑锛岀爜鍊煎璞� + List<CodeFixedValue> codeFixedDOValues = new ArrayList<>(); + // 鏋勯�犵爜鍊煎璞★紝涓庣爜娈典富閿叧鑱斿叧绯伙紝浠ュ強鏀瑰彉鐮佸�肩殑oid + codeFixedValueMaps.forEach((key, value) -> { + value.stream().forEach(item -> { + item.setOid(""); + item.setCodeFixedSecOid(key); + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item); + codeFixedDOValues.add(item); + }); + }); + boolean exFlag2 = codeFixedValueService.saveBatch(codeFixedDOValues) && resChangeAssn; + return R.data(exFlag&&exFlag1&&exFlag2); } /** -- Gitblit v1.9.3