From 28a9dc3f52b879053c79feb216fa868be906cd02 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 06 十二月 2023 13:57:29 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/views/system/userinfo.vue | 48 ++-- Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/utils/VciBaseUtil.java | 19 + Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/ExecGroupCodePortDataDTO.java | 12 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java | 9 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 268 +++++++++++++++++++++-- Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue | 29 +- Source/UBCS-WEB/src/styles/theme/white.scss | 2 Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/Test.java | 51 ++++ Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/DefaultAttrAssimtUtil.java | 57 ++-- Source/UBCS/ubcs-codeApply/src/main/java/Test.java | 11 + Source/UBCS-WEB/src/views/MasterData/items.vue | 31 +- Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java | 8 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java | 2 Source/UBCS-WEB/src/components/BatchImport/index.vue | 10 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java | 47 ++++ Source/UBCS-WEB/src/components/Master/MasterTree.vue | 6 Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeLibTreeCellRenderer.java | 2 17 files changed, 489 insertions(+), 123 deletions(-) diff --git a/Source/UBCS-WEB/src/components/BatchImport/index.vue b/Source/UBCS-WEB/src/components/BatchImport/index.vue index 29cfe88..9b76f3d 100644 --- a/Source/UBCS-WEB/src/components/BatchImport/index.vue +++ b/Source/UBCS-WEB/src/components/BatchImport/index.vue @@ -169,7 +169,7 @@ return this.currentTypeObj[this.type]["action"]; }, upParams() { - if (this.type === "historyImport" || this.type === "batchApplyCode") { + if (this.type === "historyImport" || this.type === "batchApplyCode" ) { return { codeClassifyOid: this.codeClassifyOid, classifyAttr: this.classifyAttr, @@ -188,6 +188,10 @@ ...this.codeApplyForm, }; } else if (this.type === "bulkEdit") { + return { + codeClassifyOid: this.codeClassifyOid, + }; + }else if(this.type === 'groupCode'){ return { codeClassifyOid: this.codeClassifyOid, }; @@ -257,7 +261,9 @@ "2.姣忔浠呰兘鏈�澶氬鍏�5000鏉℃暟鎹�(鍙�氳繃nacos杩涜閰嶇疆锛屾帹鑽�5000/娆″鍏�)锛屽鏋滃嚭閿欎細杩斿洖閿欒鐨勬暟鎹拰鍘熷洜锛屼絾鏄纭暟鎹彲浠ョ户缁繚瀛�", "3.Excel绗竴琛屽拰绗簩琛屼緷娆′负浼佷笟缂栫爜鍜岄泦鍥㈢紪鐮侊紙蹇呭~锛�" ], - action: "/api/ubcs-code/mdmEngineController/importGroupCode" + action: "/api/ubcs-code/mdmEngineController/importGroupCode", + downloadTemplateFun: null, + upParams: "classifyAttr", } }, secDTOList: [], diff --git a/Source/UBCS-WEB/src/components/Master/MasterTree.vue b/Source/UBCS-WEB/src/components/Master/MasterTree.vue index b34e705..4957ea4 100644 --- a/Source/UBCS-WEB/src/components/Master/MasterTree.vue +++ b/Source/UBCS-WEB/src/components/Master/MasterTree.vue @@ -147,12 +147,16 @@ }, //琛ㄦ牸鍒锋柊 TableRend() { + this.loading = true; + this.$emit('loading', this.loading) TableData({ templateOid: this.templateOids, codeClassifyOid: this.nodeClickList.oid, page: this.currentPage, limit: this.pageSize, }).then(res => { + this.loading = false; + this.$emit('loading', this.loading) this.tableDataArray = res.data.data; this.$emit('tableDataArray', this.tableDataArray) this.$emit('total', res.data.total) @@ -209,7 +213,7 @@ this.tableHeadFindData = [] await this.TableHeadRend(); // 鍏堟墽琛� TableHeadRend() this.TableRend(); // TableHeadRend() 鏂规硶瀹屾垚鍚庡啀鎵ц TableRend() - this.$emit('nodeClick', this.templateOids) + this.$emit('nodeClickTemplateOids', this.templateOids) this.$emit("codeClassifyOid", this.nodeClickList.oid) this.$emit("nodeClickList", this.nodeClickList) } catch (error) { diff --git a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue index a2b1391..3d3ea21 100644 --- a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue +++ b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue @@ -47,7 +47,7 @@ </el-table-column> <!-- 鐢熷懡鍛ㄦ湡--> <el-table-column v-for="(item,index) in lcstatusArray" - v-if=" lcstatusArray.length !== 0 && !item.hidden" + v-if=" lcstatusArray.length >= 0 && !item.hidden" key="index" :show-overflow-tooltip="true" :sortable="item.sortable" :width="item.width" align="center" label="鐢熷懡鍛ㄦ湡鍊�" prop="lcstatus"> @@ -393,6 +393,11 @@ this.doLayout() }, watch: { + isLoading:{ + handler(newval){ + console.log(newval) + } + }, tableHeadDataFateher: { handler(newval, oldval) { this.options = newval.tableDefineVO.seniorQueryColumns @@ -408,7 +413,7 @@ handler(newval, oldval) { this.tableData = newval; this.searchResults = newval - this.doLayout() + this.doLayout(); }, }, tableHeadFindData: { @@ -433,32 +438,31 @@ } }) this.tableHeadFindDatas = newval; - if (!this.isCodeArrayPushed) { + if (newval) { + this.CodeArray = []; if (newval.find(item => item.prop === 'id')) { this.CodeArray.push(newval.find(item => item.prop === 'id')); } else { - // this.CodeArray.push([]); this.CodeArray = []; } - this.isCodeArrayPushed = true; + } - if (!this.islcstatusPushed) { + if (newval) { + this.lcstatusArray = []; if (newval.find(item => item.prop === 'lcstatus')) { this.lcstatusArray.push(newval.find(item => item.prop === 'lcstatus')); } else { - this.lcstatusArray.push([]); + this.lcstatusArray = []; } - // console.log('lcstatusArray', this.lcstatusArray); - this.islcstatusPushed = true; } - if (!this.isReferPushed) { + if (newval) { + this.referArray = []; if (newval.find(item => Object.keys(item.referConfig).length > 0)) { this.referArray.push(newval.find(item => Object.keys(item.referConfig).length > 0)); } else { - this.referArray.push([]) + this.referArray = []; } } - this.isReferPushed = true; this.WupinFindValue = '' }, }, @@ -566,7 +570,6 @@ }, //闆嗗洟鐮佸鍑� excelGroupCode(){ - debugger this.isLoading = true; exportGroupCodeExcel({ codeClassifyOid: this.codeClassifyOid, diff --git a/Source/UBCS-WEB/src/styles/theme/white.scss b/Source/UBCS-WEB/src/styles/theme/white.scss index ed81bc2..12df31b 100644 --- a/Source/UBCS-WEB/src/styles/theme/white.scss +++ b/Source/UBCS-WEB/src/styles/theme/white.scss @@ -117,4 +117,4 @@ color: #fff; } } -} \ No newline at end of file +} diff --git a/Source/UBCS-WEB/src/views/MasterData/items.vue b/Source/UBCS-WEB/src/views/MasterData/items.vue index c0a80c0..f095049 100644 --- a/Source/UBCS-WEB/src/views/MasterData/items.vue +++ b/Source/UBCS-WEB/src/views/MasterData/items.vue @@ -10,13 +10,14 @@ @Treedata="TreedataList" @codeClassifyOid="codeClassifyOidList" @coderuleoid="coderuleoidList" - @nodeClick="nodeClick" + @nodeClickTemplateOids="nodeClickTem" @tableDataArray="tableDataArrays" @tableHeadBttoms="tableHeadBttoms" @tableHeadDataFateher="tableHeadDatas" @tableHeadFindData="tableHeadFindDatas" @nodeClickList="nodeClickLists" @total="totals" + @loading="loadingHandler" > </master-tree> </basic-container> @@ -80,7 +81,7 @@ this.nodeClickList=val; }, TreeValueEmit(val) { - this.TreeValue = val + this.TreeValue = val; }, codeClassifyOidList(val) { this.codeClassifyOid = val; @@ -89,36 +90,36 @@ this.coderuleoid = val; }, TreedataList(val) { - this.Treedata = val + this.Treedata = val; }, pageSizes(val) { - this.pageSize = val + this.pageSize = val; }, currentPages(val) { - this.currentPage = val + this.currentPage = val; }, tableDataArrays(val) { - this.tableDataArray = val + this.tableDataArray = val; }, totals(val) { - this.total = val + this.total = val; }, tableHeadDatas(val) { - this.tableHeadDataFateher = val + this.tableHeadDataFateher = val; }, tableHeadFindDatas(val) { - this.tableHeadFindData = val + this.tableHeadFindData = val; }, - nodeClick(val) { + nodeClickTem(val) { this.templateOid = val; - this.isLoading = true; - setTimeout(() => { - this.isLoading = false; - }, 2000); + }, tableHeadBttoms(val) { - this.masterVrBtnList = val + this.masterVrBtnList = val; }, + loadingHandler(val) { + this.isLoading = val; + } } } </script> diff --git a/Source/UBCS-WEB/src/views/system/userinfo.vue b/Source/UBCS-WEB/src/views/system/userinfo.vue index 6c985b5..1a87d09 100644 --- a/Source/UBCS-WEB/src/views/system/userinfo.vue +++ b/Source/UBCS-WEB/src/views/system/userinfo.vue @@ -29,13 +29,32 @@ }, methods: { handleSubmit(form, done) { - if (this.index === 0) { updateInfo(form).then(res => { if (res.data.success) { - this.$message({ - type: "success", - message: "淇敼淇℃伅鎴愬姛!" - }); + if( form.oldPassword != undefined || form.newPassword1 != undefined || form.newPassword != undefined){ + updatePassword(form.oldPassword, form.newPassword, form.newPassword1).then(res => { + if (res.data.success) { + this.$message({ + type: "success", + message: "淇敼鎴愬姛!" + }); + } else { + this.$message({ + type: "error", + message: res.data.msg + }); + } + done(); + }, error => { + window.console.log(error); + done(); + }) + }else{ + this.$message({ + type: "success", + message: "淇敼淇℃伅鎴愬姛!" + }); + }; } else { this.$message({ type: "error", @@ -47,25 +66,6 @@ window.console.log(error); done(); }) - } else { - updatePassword(md5(form.oldPassword), md5(form.newPassword), md5(form.newPassword1)).then(res => { - if (res.data.success) { - this.$message({ - type: "success", - message: "淇敼瀵嗙爜鎴愬姛!" - }); - } else { - this.$message({ - type: "error", - message: res.data.msg - }); - } - done(); - }, error => { - window.console.log(error); - done(); - }) - } }, handleWitch() { if (this.index === 0) { diff --git a/Source/UBCS/ubcs-codeApply/src/main/java/Test.java b/Source/UBCS/ubcs-codeApply/src/main/java/Test.java new file mode 100644 index 0000000..f68ed4d --- /dev/null +++ b/Source/UBCS/ubcs-codeApply/src/main/java/Test.java @@ -0,0 +1,11 @@ +import java.util.Arrays; +import java.util.List; + +public class Test { + + public static void main(String[] args) { + String []res={"5","6","7","8","3"}; + List<String> newList=Arrays.asList(res); + System.out.println(res); + } +} diff --git a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeLibTreeCellRenderer.java b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeLibTreeCellRenderer.java index 7df4a90..dbb03db 100644 --- a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeLibTreeCellRenderer.java +++ b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/CodeLibTreeCellRenderer.java @@ -1,5 +1,7 @@ package com.vci.rmip.code.client.codeapply.Apply410; +import com.vci.base.ui.image.bundle.BundleImage; +import com.vci.base.ui.tree.VCIBaseTreeNode; import com.vci.rmip.code.client.codeapply.Apply410.object.CodeClassify; import javax.swing.*; diff --git a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/Test.java b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/Test.java index df4e461..e3c6266 100644 --- a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/Test.java +++ b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/Test.java @@ -1,10 +1,17 @@ package com.vci.rmip.code.client.codeapply.Apply410; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + public class Test { public static void main(String[] args) { - String res=intToRoman(101); + String res=intToRoman(1004); System.out.println("缃楅┈鏁板瓧->"+res); + boolean isInterger=isRomanNumber(1004+""); + int resInt=r2a(res); + System.out.println("闃挎媺浼暟瀛�->"+resInt); } public static String intToRoman(int num) { int[] values={1000,900,500,400,100,90,50,40,10,9,5,4,1}; @@ -26,4 +33,46 @@ String I[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; return M[num/1000]+C[(num%1000)/100]+X[(num%100)/10]+I[num%10]; } + /*** + * 鏍¢獙鏄惁鏄綏椹暟瀛� + * @param s + * @return + */ + public static boolean isRomanNumber(String s) { + // 妫�鏌ヨ緭鍏ョ殑瀛楃涓叉槸鍚︿负绌� + if (s == null || s.length() == 0) { + return false; + } + // 灏嗚緭鍏ョ殑瀛楃涓茶浆鎹负澶у啓瀛楁瘝 + s = s.toUpperCase(); + // 杩斿洖缁撴灉 + Pattern pattern = Pattern.compile("^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$"); + return pattern.matcher(s ).matches(); + } + /** + * 鎶婄綏椹暟瀛楄浆鎹负闃挎媺浼暟瀛� + * + * @param m + * @return + */ + public static int r2a(String m) { + int graph[] = new int[400]; + graph['I'] = 1; + graph['V'] = 5; + graph['X'] = 10; + graph['L'] = 50; + graph['C'] = 100; + graph['D'] = 500; + graph['M'] = 1000; + char[] num = m.toCharArray(); + int sum = graph[num[0]]; + for (int i = 0; i < num.length - 1; i++) { + if (graph[num[i]] >= graph[num[i + 1]]) { + sum += graph[num[i + 1]]; + } else { + sum = sum + graph[num[i + 1]] - 2 * graph[num[i]]; + } + } + return sum; + } } diff --git a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/utils/VciBaseUtil.java b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/utils/VciBaseUtil.java index 55a3a9d..748c47e 100644 --- a/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/utils/VciBaseUtil.java +++ b/Source/UBCS/ubcs-codeApply/src/main/java/com/vci/rmip/code/client/codeapply/Apply410/utils/VciBaseUtil.java @@ -1388,6 +1388,25 @@ return sb.toString(); } + public static String intToRomanOne(int num) { + int[] values={1000,900,500,400,100,90,50,40,10,9,5,4,1}; + String[] romans={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"}; + StringBuilder sb=new StringBuilder(); + for(int i=0;i<values.length;i++){ + while(num>=values[i]){ + num=num-values[i]; + sb.append(romans[i]); + } + } + return sb.toString(); + } + public static String intToRomanTwo(int num) { + String M[] = {"", "M", "MM", "MMM"}; + String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}; + String X[] = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}; + String I[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; + return M[num/1000]+C[(num%1000)/100]+X[(num%100)/10]+I[num%10]; + } } diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/ExecGroupCodePortDataDTO.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/ExecGroupCodePortDataDTO.java index 451b70f..71e2e91 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/ExecGroupCodePortDataDTO.java +++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/dto/ExecGroupCodePortDataDTO.java @@ -1,5 +1,7 @@ package com.vci.ubcs.code.dto; +import com.vci.ubcs.code.entity.CodeAllCode; +import com.vci.ubcs.starter.revision.model.BaseModel; import lombok.Data; import java.util.ArrayList; @@ -18,9 +20,13 @@ */ private LinkedList<String> fieldList=new LinkedList<>(); /** - * 鏁版嵁闆嗘垚 + * 鏁版嵁瀛樺偍 */ private List<Map<String,String>> dataList=new ArrayList<>(); + /**** + * 绯荤粺涓殑鏁版嵁瀛樺偍 + */ + private List<BaseModel>oldList=new ArrayList<>(); /*** * 鍒楀悕 */ @@ -29,4 +35,8 @@ * 闆嗗洟灞炴�т笌缂栫爜灞炴�ф槧灏勫叧绯� */ private List<CodeAndGroupCodeAttrMappingDTO> codeAttrMapGroupAttrDTOS=new ArrayList<>(); + /** + * 鏇存柊鐨勭爜鍊煎璞� + */ + List<CodeAllCode> codeAllCodeList=new ArrayList<>(); } 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 74939d7..5e9e678 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 @@ -162,12 +162,13 @@ * @return * @throws VciBaseException */ - public static <T extends BaseModel> T copplyDefaultAttrAssimt(Map<String,String> dataMap, T object) throws VciBaseException { + public static <T extends BaseModel> T copplyDefaultAttrAssimt(Map<String,String> dataMap, T object,boolean isCase) throws VciBaseException { BaseModel baseModel = object; + baseModel.getData().putAll(dataMap); try { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - baseModel.setOid(dataMap.getOrDefault("OID","")); - baseModel.setId(dataMap.getOrDefault("ID","")); + baseModel.setOid(dataMap.getOrDefault(isCase?"OID":"oid","")); + baseModel.setId(dataMap.getOrDefault(isCase?"ID":"id","")); Map<String,Object> newDataMap=new HashMap<>(); /*for (String key:dataMap.keySet()){ Object value=dataMap.get(key); @@ -177,52 +178,56 @@ newDataMap.put(key.toLowerCase(Locale.ROOT),value); });*/ //baseModel.setData((Map)newDataMap); - Object createTimeObj=dataMap.getOrDefault("CREATETIME",""); + Object createTimeObj=dataMap.getOrDefault(isCase?"CREATETIME":"createtime",""); if(createTimeObj!=null) { String createTime = createTimeObj.toString(); baseModel.setCreateTime(chageStringToDate(createTime)); } - baseModel.setNameOid(dataMap.getOrDefault("NAMEOID","")); + baseModel.setNameOid(dataMap.getOrDefault(isCase?"NAMEOID":"nameoid","")); - Object lastModifyTimeObj=dataMap.getOrDefault("LASTMODIFYTIME",""); + Object lastModifyTimeObj=dataMap.getOrDefault(isCase?"LASTMODIFYTIME":"lastmodifytime",""); if(lastModifyTimeObj!=null) { String lastModifyTime = lastModifyTimeObj.toString(); baseModel.setLastModifyTime(chageStringToDate(lastModifyTime)); } - Object tsObj=dataMap.getOrDefault("TS",""); + Object tsObj=dataMap.getOrDefault(isCase?"TS":"ts",""); if(tsObj!=null) { String ts = tsObj.toString(); baseModel.setTs(chageStringToDate(ts)); } - baseModel.setRevisionOid(dataMap.getOrDefault("REVISIONOID","")); + baseModel.setRevisionOid(dataMap.getOrDefault(isCase?"REVISIONOID":"revisionoid","")); //鐢ㄦ埛id ; 瑕佹眰鏀规垚浜嗚处鍙� // String userId = AuthUtil.getUserId().toString(); - baseModel.setBtmname(dataMap.getOrDefault("BTMNAME","")); - baseModel.setCreator(dataMap.getOrDefault("CREATOR","")); - baseModel.setFirstR(dataMap.getOrDefault("FIRSTR","")); - baseModel.setFirstV(dataMap.getOrDefault("FIRSTV","")); - baseModel.setLastR(dataMap.getOrDefault("LASTR","")); - baseModel.setLastV(dataMap.getOrDefault("LASTV","")); - Object revisionseq =dataMap.getOrDefault("REVISIONSEQ",""); + baseModel.setBtmname(dataMap.getOrDefault(isCase?"BTMNAME":"btmname","")); + baseModel.setCreator(dataMap.getOrDefault(isCase?"CREATOR":"creator","")); + baseModel.setFirstR(dataMap.getOrDefault(isCase?"FIRSTR":"firstr","")); + baseModel.setFirstV(dataMap.getOrDefault(isCase?"FIRSTV":"firstv","")); + baseModel.setLastR(dataMap.getOrDefault(isCase?"LASTR":"lastr","")); + baseModel.setLastV(dataMap.getOrDefault(isCase?"LASTV":"lastv","")); + Object revisionseq =dataMap.getOrDefault(isCase?"REVISIONSEQ":"revisionseq",""); if(revisionseq!=null){ baseModel.setRevisionSeq(chageStringToInt(revisionseq.toString())); } - baseModel.setOwner(dataMap.getOrDefault("OWNER","")); - Object versionseq =dataMap.getOrDefault("VERSIONSEQ",""); + baseModel.setOwner(dataMap.getOrDefault(isCase?"OWNER":"owner","")); + Object versionseq =dataMap.getOrDefault(isCase?"VERSIONSEQ":"versionseq",""); if(versionseq!=null){ baseModel.setVersionSeq(chageStringToInt(versionseq.toString())); } - baseModel.setVersionRule(dataMap.getOrDefault("VERSIONRULE","")); - baseModel.setVersionValue(dataMap.getOrDefault("VERSIONVALUE","")); - baseModel.setRevisionOid(dataMap.getOrDefault("REVISIONOID","")); + baseModel.setVersionRule(dataMap.getOrDefault(isCase?"VERSIONRULE":"versionrule","")); + baseModel.setVersionValue(dataMap.getOrDefault(isCase?"VERSIONVALUE":"versionvalue","")); + + baseModel.setRevisionRule(dataMap.getOrDefault(isCase?"REVISIONRULE":"revisionrule","")); + + baseModel.setRevisionOid(dataMap.getOrDefault(isCase?"REVISIONOID":"revisionoid","")); + baseModel.setRevisionValue(dataMap.getOrDefault(isCase?"REVISIONVALUE":"revisionvalue","")); baseModel.setLastModifier(AuthUtil.getUser().getAccount()); - baseModel.setLcStatus(dataMap.getOrDefault("LCSTATUS","")); - baseModel.setName(dataMap.getOrDefault("NAME","")); - baseModel.setTenantId(dataMap.getOrDefault("TENADTID","")); - baseModel.setDescription(dataMap.getOrDefault("DESCRIOTION","")); - baseModel.setCopyFromVersion(dataMap.getOrDefault("COPYFROMVERSION","")); - Object secretgrade=dataMap.get("SECRETGRADE"); + baseModel.setLcStatus(dataMap.getOrDefault(isCase?"LCSTATUS":"lcstatus","")); + baseModel.setName(dataMap.getOrDefault(isCase?"NAME":"name","")); + baseModel.setTenantId(dataMap.getOrDefault(isCase?"TENANT_ID":"tenant_id","")); + baseModel.setDescription(dataMap.getOrDefault(isCase?"DESCRIPTION":"description","")); + baseModel.setCopyFromVersion(dataMap.getOrDefault(isCase?"COPYFROMVERSION":"copyfromversion","")); + Object secretgrade=dataMap.get(isCase?"SECRETGRADE":"secretgrade"); if(secretgrade!=null){ baseModel.setSecretGrade(chageStringToInt(secretgrade.toString())); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java index 5d63bd4..df1421c 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java @@ -844,18 +844,59 @@ */ @GetMapping("/exportGroupCodeExcel") @VciBusinessLog(operateName = "瀵煎嚭闆嗗洟鐮�") - public void exportGroupCodeExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{ - + public R exportGroupCodeExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{ try { String excelName = mdmIOService.exportGroupCodeExcel(codeClassifyOid); + ControllerUtil.writeFileToResponse(response,excelName); } catch (Throwable e) { //濡傛灉鍑洪敊,鎶婇敊璇俊鎭啓鍒皌ext String msg = LangBaseUtil.getErrorMsg(e); if(StringUtils.isBlank(msg)){ msg = "鏈煡閿欒"; } - ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); + return R.fail(msg); + // ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); } + return R.status(true); + } + + /*** + * 闆嗗洟鐮佸鍏� + * @param codeClassifyOid + * @param file + * @param response + * @return + */ + @PostMapping("/importGroupCode") + public R importGroupCode(String codeClassifyOid,MultipartFile file,HttpServletResponse response){ + + String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + file.getOriginalFilename(); + File file1 = new File(excelFileName); + try { + file.transferTo(new File(excelFileName)); + String excelName=mdmIOService.importGroupCode(codeClassifyOid,file1); + if(StringUtils.isNotBlank(excelName)) { + ControllerUtil.writeFileToResponse(response,excelName); + return R.fail("闆嗗洟鐮佸鍏ュ嚭鐜伴棶棰橈紝璇锋煡鐪嬫枃浠�"); + }else{ + return R.status(true); + } + }catch (Throwable e) { + logger.error("瀵煎叆閿欒",e); + String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒.txt"; + LocalFileUtil.writeContentToFile(LangBaseUtil.getErrorMsg(e),errorFile); + String uuid=ControllerUtil.putErrorFile(errorFile); + CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO(); + codeImProtRusultVO.setRedisUuid(""); + codeImProtRusultVO.setFileOid(uuid); + codeImProtRusultVO.setFilePath(errorFile); + R r = R.fail("闆嗗洟鐮佸鍏ュけ璐�"); + r.setData(codeImProtRusultVO); + return r; + }finally { + file1.delete(); + } + } /** diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java index 659128b..741918d 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmIOService.java @@ -143,4 +143,13 @@ * @return */ String exportGroupCodeExcel(String classOid) throws ServiceException; + + /** + * 闆嗗洟鐮佸鍏� + * @param codeClassifyOid + * @param file + * @return + * @throws ServiceException + */ + public String importGroupCode(String codeClassifyOid, File file) throws Throwable; } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java index 6cf3566..8dd357b 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java @@ -29,6 +29,7 @@ import com.vci.ubcs.omd.feign.IBtmTypeClient; import com.vci.ubcs.omd.feign.IWebSecretClient; import com.vci.ubcs.omd.vo.BtmTypeVO; +import com.vci.ubcs.omd.vo.RevisionRuleVO; import com.vci.ubcs.starter.bo.WriteExcelData; import com.vci.ubcs.starter.exception.VciBaseException; import com.vci.ubcs.starter.poi.bo.ReadExcelOption; @@ -57,6 +58,7 @@ import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.Workbook; +import org.aspectj.apache.bcel.classfile.Code; import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.utils.AuthUtil; @@ -821,7 +823,7 @@ //2.鍒ゆ柇蹇呰緭椤广�傘�傞渶瑕佸叏閮ㄧ殑灞炴�э紝濡傛灉鏄繀杈擄紝浣嗘槸琛ㄥ崟閲岄潰涓嶆樉绀虹殑锛屽彧鑳芥槸鍒嗙被娉ㄥ叆鎴栬�呯粍鍚堣鍒� batchCheckRequiredAttrOnOrder(templateVO,allCboList,errorMap); //3.鍒ゆ柇鍏抽敭灞炴�� - CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, allCboList,errorMap); + CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, allCboList,false,errorMap); Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){ @@ -1094,7 +1096,7 @@ batchSwitchComponentAttrOnOrder(attrVOS, cboList); //3.鍒ゆ柇鍏抽敭灞炴�� - CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorMap); + CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,false,errorMap); Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) { @@ -1607,7 +1609,7 @@ //2.鍒ゆ柇蹇呰緭椤广�傘�傞渶瑕佸叏閮ㄧ殑灞炴�э紝濡傛灉鏄繀杈擄紝浣嗘槸琛ㄥ崟閲岄潰涓嶆樉绀虹殑锛屽彧鑳芥槸鍒嗙被娉ㄥ叆鎴栬�呯粍鍚堣鍒� batchCheckRequiredAttrOnOrder(templateVO,cboList,errorMap); //3.鍒ゆ柇鍏抽敭灞炴�� - CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorMap); + CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO,cboList,false,errorMap); Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){ @@ -2093,7 +2095,7 @@ //鏈�鍚庡紕缁勫悎瑙勫垯 batchSwitchComponentAttrOnOrder(attrVOS,cboList); //3.鍒ゆ柇鍏抽敭灞炴�� - CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, codeClassifyTemplateVO, cboList,errorMap); + CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, codeClassifyTemplateVO, cboList,false,errorMap); Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); if(!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)){ @@ -2302,7 +2304,7 @@ //鏈�鍚庡紕缁勫悎瑙勫垯 batchSwitchComponentAttrOnOrder(attrVOS,cboList); //3.鍒ゆ柇鍏抽敭灞炴�� - CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorKeyMap); + CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,false,errorKeyMap); Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); @@ -4235,7 +4237,7 @@ * @param cboList 鎵归噺鐨勬暟鎹� */ private CodeImportResultVO batchCheckKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClassifyTemplateVO templateVO, - List<ClientBusinessObject> cboList,Map<String,String> errorMap) { + List<ClientBusinessObject> cboList,boolean isEdit,Map<String,String> errorMap) { //涓嶮dmEngineServiceImpl閲岀殑checkKeyAttrOnOrder鐩镐技 //鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮� CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); @@ -4283,6 +4285,12 @@ if(Func.isNotBlank(isParticipateCheckOids)){ conditionMap.put("t.codeclsfid",QueryOptionConstant.NOTIN+isParticipateCheckOids); } + if(isEdit){//濡傛灉鏄洿鏀瑰垯闇�鎺掗櫎绯荤粺鏈韩 + conditionMap.put("t.id",QueryOptionConstant.NOTEQUAL+cbo.getId()); + } + conditionMap.put("t.lastr", "1"); + conditionMap.put("t.lastv", "1"); + CodeTemplateAttrSqlBO sqlBO = engineService.getSqlByTemplateVO(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), templateVO, conditionMap, null); List<String> repeatData = commonsMapper.selectList(sqlBO.getSqlId()); if(!repeatData.isEmpty()){ @@ -4291,7 +4299,7 @@ List<BaseModel> newCboList = new ArrayList<>(); newDataList.stream().forEach(stringStringMap -> { BaseModel baseModel=new BaseModel(); - DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(stringStringMap,baseModel,user); + DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(stringStringMap,baseModel,false); baseModel.setData(stringStringMap); newCboList.add(baseModel); }); @@ -4517,7 +4525,7 @@ List<ClientBusinessObject> clientBusinessObjectList=new ArrayList<>(); oldDataMap.stream().forEach(dataMap->{ ClientBusinessObject clientBusinessObject=new ClientBusinessObject(); - DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,clientBusinessObject); + DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,clientBusinessObject,true); for (String key:dataMap.keySet()){ Object value= dataMap.getOrDefault(key,""); clientBusinessObject.setAttributeValue(key.toLowerCase(Locale.ROOT),value==null?"":value.toString()); @@ -4969,7 +4977,7 @@ * @return */ @Override - public String exportGroupCodeExcel(String codeClassifyOid) throws ServiceException { + public String exportGroupCodeExcel(String codeClassifyOid) throws VciBaseException { VciBaseUtil.alertNotNull(codeClassifyOid,"涓婚搴撳垎绫荤殑涓婚敭"); CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); CodeClassifyVO codeClassifyVO= classifyFullInfo.getCurrentClassifyVO(); @@ -4981,7 +4989,7 @@ ExecGroupCodePortDataDTO execGroupCodePortDataDTO=new ExecGroupCodePortDataDTO(); createExportGroupCodeMapConfig(templateVO,execGroupCodePortDataDTO);//缁勭粐鏁版嵁 if(!CollectionUtils.isEmpty(execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS())){ - throw new ServiceException("闆嗗洟灞炴�ф槧灏勬湭閰嶇疆"); + throw new VciBaseException("闆嗗洟灞炴�ф槧灏勬湭閰嶇疆"); } fieldList=execGroupCodePortDataDTO.getFieldList(); List<Map<String,String>>dataList=new ArrayList<>(); @@ -5001,9 +5009,7 @@ List<WriteExcelData> excelDataList = new ArrayList<>(); Workbook workbook = new HSSFWorkbook(); List<CodeAndGroupCodeAttrMappingDTO> codeAndGroupCodeAttrMappingDTOList= execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS(); - Map<String, CodeAndGroupCodeAttrMappingDTO> jAttrVOMap = codeAndGroupCodeAttrMappingDTOList.stream().filter(s-> finalFieldList.contains(s.getTargetAttrKey().toLowerCase(Locale.ROOT))).collect(Collectors.toMap(s -> s.getTargetAttrKey().toLowerCase(Locale.ROOT), t -> t)); - WriteExcelData codeExcelData = new WriteExcelData(0, 0, "浼佷笟缂栫爜"); WriteExcelData groupExcelData = new WriteExcelData(0, 1, "闆嗗洟鐮�"); excelDataList.add(codeExcelData); @@ -5081,7 +5087,9 @@ * @param file * @return */ - public String improtGroupCode(String codeClassifyOid, File file) throws ServiceException { + @Transactional(rollbackFor = VciBaseException.class) + @Override + public String importGroupCode(String codeClassifyOid, File file) throws Throwable { VciBaseUtil.alertNotNull(codeClassifyOid,"鍒嗙被鐨勪富閿�"); ReadExcelOption reo = new ReadExcelOption(); reo.setReadAllSheet(true); @@ -5091,14 +5099,14 @@ throw new ServiceException("涓轰簡淇濊瘉绯荤粺鐨勭ǔ瀹氭�э紝璇蜂竴娆′笉瑕佸鍏ヨ秴杩�1涓囨潯鐨勬暟鎹�"); } CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); - CodeClassifyTemplateVO templateVO = new CodeClassifyTemplateVO(); - //闄ゅ幓榛樿鐨勫睘鎬�.杩樻湁鍙湁琛ㄥ崟鏄剧ず鐨勫瓧娈垫墠瀵煎叆 + //鑾峰彇鏈�鏂扮殑妯℃澘 + CodeClassifyTemplateVO templateVO = engineService.getUsedTemplateByClassifyOid(codeClassifyOid); //闄ゅ幓榛樿鐨勫睘鎬�.杩樻湁鍙湁琛ㄥ崟鏄剧ず鐨勫瓧娈垫墠瀵煎叆 List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s ->!DEFAULT_SYNC_ATTR_LIST.contains(s.getId()) && VciBaseUtil.getBoolean(s.getFormDisplayFlag()) ).collect(Collectors.toList()); ExecGroupCodePortDataDTO execGroupCodePortDataDTO=new ExecGroupCodePortDataDTO(); createExportGroupCodeMapConfig(templateVO,execGroupCodePortDataDTO);//缁勭粐鏁版嵁 List<CodeAndGroupCodeAttrMappingDTO> codeAttrMapGroupAttrDTOS=execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS(); - if(!CollectionUtils.isEmpty(codeAttrMapGroupAttrDTOS)){ + if(CollectionUtils.isEmpty(codeAttrMapGroupAttrDTOS)){ throw new ServiceException("闆嗗洟灞炴�ф槧灏勬湭閰嶇疆"); } Map<String, CodeAndGroupCodeAttrMappingDTO> codeSystemObjectMap = codeAttrMapGroupAttrDTOS.stream().filter(codeAttrMappingDTO -> codeAttrMappingDTO != null && StringUtils.isNotBlank(codeAttrMappingDTO.getSourceAttrName())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getSourceAttrName(), t -> t)); @@ -5107,28 +5115,219 @@ Map<Integer/**鍒楀彿**/,String/**瀛楁鐨勫悕绉�**/> fieldIndexMap = new HashMap<>(); getGroupCodeFieldIndexMap(titleRowData,codeAttrMapGroupAttrDTOS,fieldIndexMap); //闇�瑕佸垽鏂槸鍚︽墍鏈夌殑灞炴�ч兘鍦ㄦā鏉夸笂浜� - List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT)) + /** List<CodeClassifyTemplateAttrVO> unExistAttrVOs = attrVOS.stream().filter(s -> !fieldIndexMap.containsValue(s.getId().toLowerCase(Locale.ROOT)) && com.alibaba.cloud.commons.lang.StringUtils.isBlank(s.getComponentRule()) && com.alibaba.cloud.commons.lang.StringUtils.isBlank(s.getClassifyInvokeAttr())//缁勫悎瑙勫垯鍜屽垎绫绘敞鍏ョ‘瀹炴病缁欑敤鎴峰鍑哄幓 ).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(unExistAttrVOs)){ String message=unExistAttrVOs.stream().map(CodeClassifyTemplateAttrVO::getName).collect(Collectors.joining(SERIAL_UNIT_SPACE)); throw new VciBaseException("銆�" + message + "銆戣繖浜涘睘鎬у湪excel涓病鏈夋壘鍒�"); - } + }**/ List<ClientBusinessObject> cboList = new ArrayList<>(); List<SheetRowData> rowDataList = dataSet.getRowData(); getExportGroupCodeDatas(fieldIndexMap,rowDataList,cboList);//鏋勫缓鏁版嵁瀵硅薄 + List<String> codeList= cboList.stream().map(ClientBusinessObject::getId).collect(Collectors.toList()); List<Map<String,String>>dataList=new ArrayList<>(); - getDatas(classifyFullInfo,templateVO,execGroupCodePortDataDTO.getFieldList(),dataList,codeList); - //鏌ヨ绯荤粺涓瓨鍦� - if(!CollectionUtils.isEmpty(dataList)){ + Map<String,String> errorMap=new HashMap<>(); + batchSwitchCheckExist(errorMap,cboList,classifyFullInfo,templateVO,execGroupCodePortDataDTO,fieldIndexMap); + //鍒ゆ柇蹇呰緭椤� + batchCheckRequiredAttrOnOrder(templateVO, cboList, errorMap); + // //浼樺厛鏍¢獙缂栫爜鏄惁瀛樺湪 + // batchCheckIdExistOnOrder(templateVO, cboList, errorMap); + //boolean + reSwitchBooleanAttrOnOrder(attrVOS, cboList); + // 鏋氫妇鐨勫唴瀹归渶瑕佹牴鎹悕绉拌浆鎹负鏋氫妇鐨勫�� + batchSwitchEnumAttrOnOrder(attrVOS, cboList, errorMap); + batchSwitchReferAttrOnOrder(attrVOS, cboList, errorMap); + //6.澶勭悊鍒嗙被娉ㄥ叆 + batchSwitchClassifyAttrOnOrder(attrVOS, cboList, classifyFullInfo,false); + + //璁剧疆榛樿鍊� + batchSwitchAttrDefault(attrVOS, cboList); + + //7.澶勭悊缁勫悎瑙勫垯 + batchSwitchComponentAttrOnOrder(attrVOS, cboList); + //4.鏍¢獙瑙勫垯 + batchCheckVerifyOnOrder(attrVOS, cboList, errorMap); + //6.鏃堕棿鐨勶紝蹇呴』缁熶竴涓簓yyy-MM-dd HH:mm:ss + batchSwitchDateAttrOnOrder(attrVOS, cboList, errorMap); + //3.鍒ゆ柇鍏抽敭灞炴�� + CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,true,errorMap); + Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); + Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); + if (!CollectionUtils.isEmpty(selfRepeatRowIndexList)) { + selfRepeatRowIndexList.stream().forEach(rowIndex -> { + errorMap.put(rowIndex, errorMap.getOrDefault(rowIndex, "") + ";鍦ㄥ綋鍓峞xcel鏂囦欢涓叧閿睘鎬ч噸澶�"); + }); } - return ""; - } + if (!CollectionUtils.isEmpty(keyAttrRepeatRowIndexList)) { + keyAttrRepeatRowIndexList.stream().forEach(rowIndex -> { + errorMap.put(rowIndex, "鍏抽敭灞炴�т笌绯荤粺涓殑閲嶅;" + errorMap.getOrDefault(rowIndex, "")); + }); + } + Map<String,List<WriteExcelData>> shetNameMap=new HashMap<>(); + createWriteExcelData(rowDataList, errorMap, new ArrayList<>(), titleRowData, shetNameMap, templateVO); + String excelFileName=""; + if(errorMap.size()==0) { + try { + String btmTypeId = classifyFullInfo.getTopClassifyVO().getBtmTypeId(); + List<BaseModel>oldCbos= execGroupCodePortDataDTO.getOldList(); + List<BaseModel>newCbos=new ArrayList<>(); + // 淇敼鐗堟鍙� + engineService.updateBatchByBaseModel(btmTypeId,oldCbos); + List<CodeAllCode> codeAllCodeList=new ArrayList<>(); + cboList.stream().forEach(clientBusinessObject -> { + BaseModel newBaseModel=new BaseModel(); + DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(clientBusinessObject.getData(),newBaseModel,true); + newCbos.add(newBaseModel); + }); + // 鎻掑叆鏂扮殑鏁版嵁 + engineService.insertBatchByType(btmTypeId, newCbos); + codeAllCodeService.saveOrUpdateBatch(execGroupCodePortDataDTO.getCodeAllCodeList()); + engineService.batchSaveSelectChar(templateVO, newCbos); + // 璁板綍鏁版嵁鏇存敼鏃ュ織 + saveLogUtil.operateLog("鏁版嵁鏇存敼", false, StringUtil.format("{}\n淇敼涓�:\n{}", JSON.toJSONString(oldCbos), JSON.toJSONString(newCbos))); + } catch (Exception vciError) { + // 璁板綍鏁版嵁鏇存敼鎶ラ敊鏃剁殑鏃ュ織 + saveLogUtil.operateLog("鏁版嵁鏇存敼", true, vciError.toString()); + throw new VciBaseException("鏁版嵁鏇存敼淇濆瓨鍑洪敊浜�", new String[0], vciError); + } + }else{ + excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒淇℃伅.xls"; + WriteExcelOption eo = new WriteExcelOption(); + shetNameMap.forEach((shetName, errorDataList) -> { + eo.addSheetDataList(shetName, errorDataList); + }); + try { + new File(excelFileName).createNewFile(); + } catch (IOException e) { + throw new VciBaseException(LangBaseUtil.getErrorMsg(e)); + } + ExcelUtil.writeDataToFile(excelFileName, eo); + } + return excelFileName; + } + public void batchSwitchCheckExist(Map<String,String> errorMap,List<ClientBusinessObject> cboList,CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,ExecGroupCodePortDataDTO execGroupCodePortDataDTO,Map<Integer/**鍒楀彿**/,String/**瀛楁鐨勫悕绉�**/> fieldIndexMap){ + List<BaseModel> oldBaseModelList=new ArrayList<>(); + List<CodeAllCode> codeAllCodeList=new ArrayList<>(); + cboList.stream().forEach(clientBusinessObject -> { + String code=clientBusinessObject.getId(); + String rowIndex=clientBusinessObject.getAttributeValue(IMPORT_ROW_INDEX); + List<Map<String,String>>dataList=new ArrayList<>(); + List<String> fieldList= execGroupCodePortDataDTO.getFieldList(); + getDatas(classifyFullInfo,templateVO,execGroupCodePortDataDTO.getFieldList(),dataList,Arrays.asList(code)); + if(!CollectionUtils.isEmpty(dataList)){ + Map<String,String> newDataMap=new HashMap<>();//灏嗘柊瀵硅薄灞炴�ф殏鏃跺瓨鍌ㄥ湪Map<> + newDataMap.putAll(clientBusinessObject.getData()); + Map<String,String> dataMap=dataList.get(0); + BaseModel oldBaseModel=new BaseModel(); + + DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,oldBaseModel,false); + String oldOid=oldBaseModel.getOid(); + + clientBusinessObject.setCopyFromVersion(oldOid); + clientBusinessObject.setAttributeValueWithNoCheck("copyfromversion",oldOid); + String oid=VciBaseUtil.getPk(); + clientBusinessObject.setOid(oid); + clientBusinessObject.setAttributeValueWithNoCheck("oid",oid); + clientBusinessObject.setBtmname(oldBaseModel.getBtmname()); + clientBusinessObject.setAttributeValueWithNoCheck("btmname",oldBaseModel.getBtmname()); + clientBusinessObject.setLastR("1"); + clientBusinessObject.setAttributeValueWithNoCheck("lastr","1"); + clientBusinessObject.setFirstR("1"); + clientBusinessObject.setAttributeValueWithNoCheck("firstr","1"); + clientBusinessObject.setFirstV("1"); + clientBusinessObject.setAttributeValueWithNoCheck("firstv","1"); + clientBusinessObject.setLastV("1"); + clientBusinessObject.setAttributeValueWithNoCheck("lastv","1"); + clientBusinessObject.setRevisionSeq(1); + clientBusinessObject.setAttributeValueWithNoCheck("revisionseq","1"); + clientBusinessObject.setVersionSeq(1); + clientBusinessObject.setAttributeValueWithNoCheck("versionseq","1"); + clientBusinessObject.setRevisionRule(oldBaseModel.getRevisionRule()); + clientBusinessObject.setAttributeValueWithNoCheck("revisionrule",oldBaseModel.getRevisionRule()); + clientBusinessObject.setVersionRule(oldBaseModel.getRevisionRule()); + clientBusinessObject.setAttributeValueWithNoCheck("versionrule",oldBaseModel.getVersionRule()); + clientBusinessObject.setVersionValue(oldBaseModel.getVersionValue()); + clientBusinessObject.setAttributeValueWithNoCheck("versionvalue",oldBaseModel.getVersionValue()); + clientBusinessObject.setLctid(oldBaseModel.getLctid()); + clientBusinessObject.setAttributeValueWithNoCheck("lctid",oldBaseModel.getLctid()); + clientBusinessObject.setId(oldBaseModel.getId()); + clientBusinessObject.setAttributeValueWithNoCheck("id",oldBaseModel.getId()); + clientBusinessObject.setName(oldBaseModel.getName()); + clientBusinessObject.setAttributeValueWithNoCheck("name",oldBaseModel.getName()); + clientBusinessObject.setLcStatus(CodeDefaultLC.RELEASED.getValue()); + clientBusinessObject.setAttributeValueWithNoCheck("lcstatus",CodeDefaultLC.RELEASED.getValue()); + clientBusinessObject.setDescription("瀵煎叆闆嗗洟鐮�"); + clientBusinessObject.setAttributeValueWithNoCheck("description","瀵煎叆闆嗗洟鐮�"); + clientBusinessObject.setOwner("1"); + clientBusinessObject.setAttributeValueWithNoCheck("owner","1"); + clientBusinessObject.setTenantId(AuthUtil.getTenantId()); + clientBusinessObject.setAttributeValueWithNoCheck("tenant_id",AuthUtil.getTenantId()); + clientBusinessObject.setCreator(oldBaseModel.getCreator()); + clientBusinessObject.setAttributeValueWithNoCheck("creator",oldBaseModel.getCreator()); + SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + clientBusinessObject.setCreateTime(oldBaseModel.getCreateTime()); + clientBusinessObject.setAttributeValueWithNoCheck("createtime", formatter.format(oldBaseModel.getCreateTime())); + clientBusinessObject.setLastModifier(AuthUtil.getUserAccount()); + clientBusinessObject.setAttributeValueWithNoCheck("lastmodifier",AuthUtil.getUserAccount()); + clientBusinessObject.setCreateTime(new Date()); + clientBusinessObject.setAttributeValueWithNoCheck("lastmodifytime", formatter.format(new Date())); + clientBusinessObject.setRevisionValue(String.valueOf(Integer.parseInt(oldBaseModel.getRevisionValue())+1)); + clientBusinessObject.setRevisionOid(oldBaseModel.getRevisionOid()); + clientBusinessObject.setAttributeValueWithNoCheck("revisionoid",oldBaseModel.getRevisionOid()); + clientBusinessObject.setAttributeValueWithNoCheck("revisionvalue",String.valueOf(Integer.parseInt(oldBaseModel.getRevisionValue())+1)); + + clientBusinessObject.setNameOid(oldBaseModel.getNameOid()); + clientBusinessObject.setAttributeValueWithNoCheck("nameoid",oldBaseModel.getNameOid()); + + clientBusinessObject.setAttributeValueWithNoCheck(CODE_CLASSIFY_OID_FIELD,oldBaseModel.getData().getOrDefault(CODE_CLASSIFY_OID_FIELD,"")); + clientBusinessObject.setAttributeValueWithNoCheck(CODE_FULL_PATH_FILED,oldBaseModel.getData().getOrDefault(CODE_FULL_PATH_FILED,"")); + clientBusinessObject.setAttributeValueWithNoCheck(CODE_TEMPLATE_OID_FIELD,oldBaseModel.getData().getOrDefault(CODE_TEMPLATE_OID_FIELD,"")); + clientBusinessObject.setTs(new Date()); + clientBusinessObject.setAttributeValueWithNoCheck("ts",formatter.format(new Date())); + oldBaseModel.setLastV("0"); + oldBaseModel.getData().put("lastv","0"); + oldBaseModelList.add(oldBaseModel); + List<CodeAllCode> oldCodeAllCodeList= codeAllCodeService.selectByWrapper(Wrappers.<CodeAllCode>query().lambda().eq(CodeAllCode::getId,code)); + CodeAllCode codeAllCode=new CodeAllCode(); + if(!CollectionUtils.isEmpty(oldCodeAllCodeList)){ + codeAllCode=oldCodeAllCodeList.get(0); + codeAllCode.setId(code); + codeAllCode.setLcStatus(CodeDefaultLC.RELEASED.getValue()); + codeAllCode.setCreateCodeOid(clientBusinessObject.getOid()); + codeAllCode.setCreateCodeBtm(clientBusinessObject.getBtmname()); + codeAllCode.setLastModifyTime(new Date()); + codeAllCode.setLastModifier(AuthUtil.getUserAccount()); + codeAllCodeList.add(codeAllCode); + if(!oldBaseModel.getLcStatus().equals(CodeDefaultLC.RELEASED.getValue())||!codeAllCode.getLcStatus().equals(CodeDefaultLC.RELEASED.getValue())){ + errorMap.put(rowIndex,"绗�"+rowIndex+"琛岋紝鍦ㄧ郴缁熶腑鏁版嵁涓嶆槸鍙戝竷鐘舵��"); + } + }else{ + errorMap.put(rowIndex,"绗�"+rowIndex+"琛岋紝鍦ㄧ郴缁熶腑鏈煡璇㈠埌鐩稿簲鐨勭爜鍊兼暟鎹�"); + } + //闄ゅ幓榛樿鐨勫睘鎬�.杩樻湁鍙湁琛ㄥ崟鏄剧ず鐨勫瓧娈垫墠瀵煎叆 + List<CodeClassifyTemplateAttrVO> attrVOS = templateVO.getAttributes().stream().filter(s ->!fieldIndexMap.containsValue(s.getId()) && VciBaseUtil.getBoolean(s.getFormDisplayFlag()) + ).collect(Collectors.toList()); + attrVOS.stream().forEach(codeClassifyTemplateAttrVO -> {//灏嗕笉闇�瑕佹洿鏀圭殑榛樿瀛楁鎴栬�呬笉鏇存敼鐨勫睘鎬у鍒跺埌鏂扮殑鐗堟湰涓� + String arrtibuteKey=codeClassifyTemplateAttrVO.getId(); + Map<String,String>attrDataMap=oldBaseModel.getData(); + if(attrDataMap.containsKey(arrtibuteKey)){ + String arrtibuteValue=attrDataMap.get(arrtibuteKey); + clientBusinessObject.setAttributeValueWithNoCheck(arrtibuteKey,arrtibuteValue); + } + }); + }else{ + errorMap.put(rowIndex,"绗�"+rowIndex+"琛岋紝鍦ㄧ郴缁熶腑鏈煡璇㈠埌鐩稿簲鐨勬渶鏂扮増鏁版嵁"); + } + }); + execGroupCodePortDataDTO.setOldList(oldBaseModelList); + execGroupCodePortDataDTO.setCodeAllCodeList(codeAllCodeList); + } /** * * @param fieldIndexMap @@ -5137,8 +5336,10 @@ */ private void getExportGroupCodeDatas(Map<Integer,String> fieldIndexMap,List<SheetRowData> rowDataList,List<ClientBusinessObject>cboList){ rowDataList.stream().forEach(sheetRowData -> { + String rowIndex= sheetRowData.getRowIndex(); + ClientBusinessObject cbo=new ClientBusinessObject(); + cbo.setAttributeValue(IMPORT_ROW_INDEX,rowIndex); sheetRowData.getData().forEach((index,value)->{ - ClientBusinessObject cbo=new ClientBusinessObject(); String field = fieldIndexMap.get(index); if (StringUtils.isBlank(field)) { throw new VciBaseException("绗�" + (index + 1) + "鍒楃殑鏍囬鍦ㄧ郴缁熶腑涓嶅瓨鍦�"); @@ -5151,8 +5352,8 @@ } catch (VciBaseException e) { log.error("璁剧疆灞炴�х殑鍊奸敊璇�", e); } - cboList.add(cbo); }); + cboList.add(cbo); }); } /*** @@ -5200,16 +5401,19 @@ Map<String, CodeAndGroupCodeAttrMappingDTO> codeSystemObjectMap = codeAttrMapGroupAttrDTOS.stream().filter(codeAttrMappingDTO -> codeAttrMappingDTO != null && StringUtils.isNotBlank(codeAttrMappingDTO.getSourceAttrName())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getSourceAttrName(), t -> t)); for (int i = 0; i < titleRowData.size(); i++) { String title = titleRowData.get(i); - CodeAndGroupCodeAttrMappingDTO codeAndGroupCodeAttrMappingDTO =codeSystemObjectMap.get(title.replace(KEY_ATTR_CHAR,"").replace(REQUIRED_CHAR,"")); - String id=codeAndGroupCodeAttrMappingDTO.getTargetAttrKey(); - if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "闆嗗洟鐮�".equalsIgnoreCase(title)){ + String id = ""; + if ("闆嗗洟鐮�".equalsIgnoreCase(title)) { id = CODE_GROUP_FIELD; } - if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "浼佷笟缂栫爜".equalsIgnoreCase(title)){ + if ("浼佷笟缂栫爜".equalsIgnoreCase(title)) { id = CODE_FIELD; } - if(com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(id)){ - fieldIndexMap.put(i,id); + if(codeSystemObjectMap.containsKey(title)) { + CodeAndGroupCodeAttrMappingDTO codeAndGroupCodeAttrMappingDTO = codeSystemObjectMap.get(title.replace(KEY_ATTR_CHAR, "").replace(REQUIRED_CHAR, "")); + id = codeAndGroupCodeAttrMappingDTO.getTargetAttrKey(); + } + if (com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(id)) { + fieldIndexMap.put(i, id); } } @@ -5222,7 +5426,7 @@ * @param selectFieldList * @param dataList */ - private void getDatas(CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,LinkedList<String> selectFieldList,List<Map<String,String>>dataList,List<String> codeList ){ + private void getDatas(CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,LinkedList<String> selectFieldList,List<Map<String,String>>dataList,List<String> codeList){ //鍏堟煡璇㈡暟鎹� String btmTypeId = classifyFullInfo.getTopClassifyVO().getBtmTypeId(); String codeClassifyOid=classifyFullInfo.getCurrentClassifyVO().getOid(); diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java index f709207..cd92f0f 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/UniversalInterfaceImpl.java @@ -2295,7 +2295,7 @@ List<ClientBusinessObject> clientBusinessObjectList=new ArrayList<>(); oldDataMap.stream().forEach(dataMap->{ ClientBusinessObject clientBusinessObject=new ClientBusinessObject(); - DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,clientBusinessObject); + DefaultAttrAssimtUtil.copplyDefaultAttrAssimt(dataMap,clientBusinessObject,true); for (String key:dataMap.keySet()){ Object value= dataMap.getOrDefault(key,""); clientBusinessObject.setAttributeValue(key.toLowerCase(Locale.ROOT),value==null?"":value.toString()); diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java index ff717d9..b1de27c 100644 --- a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java @@ -378,9 +378,6 @@ if (!newPassword.equals(newPassword1)) { throw new ServiceException("璇疯緭鍏ユ纭殑纭瀵嗙爜!"); } - if (!user.getPassword().equals(DigestUtil.hex(oldPassword))) { - throw new ServiceException("鍘熷瘑鐮佷笉姝g‘!"); - } //鑾峰彇鐢ㄦ埛閲囩敤鐨勫瘑鐮佺瓥鐣� Strategy strategy = sysClient.getByUserId(userId).getData(); // 鍑犱箮涓嶄細鍑虹幇杩欑鎯呭喌 @@ -391,6 +388,11 @@ if(newPassword1.length() < strategy.getMinPwdLen() || newPassword1.length() > strategy.getMaxPwdLen()){ throw new ServiceException("瀵嗙爜涓繀椤诲惈鏈夈��"+strategy.getCombinationNames()+"銆戜腑鐨勩��"+strategy.getRequiredType()+"銆戠瀵嗙爜缁勫悎鏂瑰紡锛屼笖瀵嗙爜闀垮害蹇呴』鍦ㄣ��"+strategy.getMinPwdLen()+"-"+strategy.getMaxPwdLen()+"銆戣寖鍥村唴"); } + + oldPassword = DigestUtil.hex(DigestUtils.md5DigestAsHex((oldPassword).getBytes())); + if (!user.getPassword().equals(oldPassword)) { + throw new ServiceException("鍘熷瘑鐮佷笉姝g‘!"); + } List<String> regexs = sysClient.getRegexByList(Arrays.asList(strategy.getCombinationIds().split(","))).getData(); //鍒ゆ柇鏄惁婊¤冻缁勫悎鏂瑰紡涓殑蹇呭~绉嶇被鏁� int reqType = 0; -- Gitblit v1.9.3