From 25ef4e85586c27433c865b69c67ccf5a380b93a7 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 05 十二月 2023 13:52:07 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/api/statistic/chart.js | 11 + Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue | 2 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 125 ++++++++++++++++- Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue | 74 ++++++++-- Source/UBCS-WEB/src/api/GetItem.js | 10 + Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue | 18 ++ Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java | 6 Source/UBCS-WEB/src/views/statistic/statisticPage.vue | 5 Source/UBCS-WEB/src/components/FormTemplate/index.vue | 15 +- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 80 +++++++++++ Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue | 4 Source/UBCS-WEB/src/components/BatchImport/index.vue | 50 +++--- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java | 11 + 13 files changed, 348 insertions(+), 63 deletions(-) diff --git a/Source/UBCS-WEB/src/api/GetItem.js b/Source/UBCS-WEB/src/api/GetItem.js index f8c50ce..a0cc5fa 100644 --- a/Source/UBCS-WEB/src/api/GetItem.js +++ b/Source/UBCS-WEB/src/api/GetItem.js @@ -126,3 +126,13 @@ } }) } + +//闆嗗洟鐮佹ā鏉夸笅杞� +export const exportGroupCodeExcel = (params) => { + return request({ + url: '/api/ubcs-code/mdmEngineController/exportGroupCodeExcel', + method: 'get', + params, + responseType: 'blob' + }) +} diff --git a/Source/UBCS-WEB/src/api/statistic/chart.js b/Source/UBCS-WEB/src/api/statistic/chart.js new file mode 100644 index 0000000..9806a7e --- /dev/null +++ b/Source/UBCS-WEB/src/api/statistic/chart.js @@ -0,0 +1,11 @@ + +import request from '@/router/axios'; + +//缁熻鍒嗘瀽鏁版嵁 +export const getStatisticAnalysis = (params) => { + return request({ + url: '/api/ubcs-code/mdmEngineController/getStatisticAnalysis', + method: 'get', + params + }) +} diff --git a/Source/UBCS-WEB/src/components/BatchImport/index.vue b/Source/UBCS-WEB/src/components/BatchImport/index.vue index 45efd2b..29cfe88 100644 --- a/Source/UBCS-WEB/src/components/BatchImport/index.vue +++ b/Source/UBCS-WEB/src/components/BatchImport/index.vue @@ -13,7 +13,7 @@ </li> </ul> <div - v-show="currentTypeObj[type]['upParams'] === 'classifyAttr' && this.type !== 'bulkEdit'" + v-show="currentTypeObj[type]['upParams'] === 'classifyAttr' && this.type !== 'bulkEdit'&& this.type !== 'groupCode'" class="radio_box" > <span>鍒嗙被鐨勮矾寰勪娇鐢ㄧ殑灞炴��:</span> @@ -61,21 +61,23 @@ > </el-upload> <template #footer> - <el-button - v-if="type !== 'bulkEdit'" - :loading="downloadLoading" - size="small" - type="primary" - @click="downloadTemplateFun" - >涓嬭浇瀵煎叆妯℃澘 - </el-button> - <el-button v-if="type === 'bulkEdit'" - :loading="downloadLoading" - size="small" - type="primary" - @click="downloadTemplateFun" - >涓嬭浇缂栬緫妯℃澘 - </el-button> + <div v-if="type !== 'groupCode'"> + <el-button + v-if="type !== 'bulkEdit' " + :loading="downloadLoading" + size="small" + type="primary" + @click="downloadTemplateFun" + >涓嬭浇瀵煎叆妯℃澘 + </el-button> + <el-button v-if="type === 'bulkEdit'" + :loading="downloadLoading" + size="small" + type="primary" + @click="downloadTemplateFun" + >涓嬭浇缂栬緫妯℃澘 + </el-button> + </div> <el-button size="small" @click="dialogVisible = false">鍏抽棴</el-button> </template> <ShowImportData @@ -248,6 +250,15 @@ downloadTemplateFun: downloadBatchApplyCodeTemplate, upParams: "classifyAttr", }, + groupCode: { + title: "闆嗗洟鐮佸鍏�", + tipList: [ + "1.鏍囬甯︿簲瑙掓槦鐨勮〃绀哄叧閿睘鎬э紝甯︽槦鍙疯〃绀哄繀杈撻」", + "2.姣忔浠呰兘鏈�澶氬鍏�5000鏉℃暟鎹�(鍙�氳繃nacos杩涜閰嶇疆锛屾帹鑽�5000/娆″鍏�)锛屽鏋滃嚭閿欎細杩斿洖閿欒鐨勬暟鎹拰鍘熷洜锛屼絾鏄纭暟鎹彲浠ョ户缁繚瀛�", + "3.Excel绗竴琛屽拰绗簩琛屼緷娆′负浼佷笟缂栫爜鍜岄泦鍥㈢紪鐮侊紙蹇呭~锛�" + ], + action: "/api/ubcs-code/mdmEngineController/importGroupCode" + } }, secDTOList: [], }; @@ -291,16 +302,9 @@ return; } if (this.type === 'bulkEdit') { - this.tableHeadFindData.map(item => item.prop) - .forEach((prop, index) => { - this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop; - }); downloadExcelBatchEdit({ codeClassifyOid: this.codeClassifyOid, - 'conditionMap[oid]': this.ids, ...this.exportArrTwo, - limit: -1 }).then(res => { - // console.log('res',res) if (res) { func.downloadFileByBlobHandler(res); this.$message.success('涓嬭浇鎴愬姛锛岃鏌ョ湅锛�') diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue index e75483c..d4e40cc 100644 --- a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue +++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue @@ -103,9 +103,14 @@ type: String, default: "", }, + selectRow:{ + type:Array, + default:[] + } }, data() { return { + selectValue:"", //骞翠唬鍙� dataYearCode: { type: "", @@ -206,6 +211,15 @@ handler(newV) { this.$emit("dataYearCode", newV) } + }, + selectRow:{ + handler(newval){ + console.log(newval); + let ids = newval.map(item => item.id); + this.selectValue= ids.join(","); + }, + deep:true, + immediate:true } }, methods: { @@ -320,7 +334,9 @@ value:formItem.defaultValue || (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) || (formItem.secType == "codedatesec" ? formItem.codeDateValue : null) || (TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null) || (formItem.secType == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) || - (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null), + (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) || + //鐖剁粍浠跺鏋滄槸鍙傜収鏁版嵁浼氬皢selectRow缃┖,selectRow涓嶄负绌哄氨璇存槑涓嶆槸鍙傜収瑕佸洖濉簮鏍囧噯鍙锋暟鎹� + (this.status === "amend" && this.selectRow && (formItem.field === "oldcode" ? this.selectValue : null)), placeholder: formItem.inputTip, comboxKey: formItem.comboxKey, tip: formItem.tooltips, diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue index 561cb91..fc64b18 100644 --- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue +++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue @@ -14,6 +14,7 @@ v-if="dialogVisible" key="masterForm" ref="FormTemplate" v-bind="$attrs" + :selectRow="selectRow" :TreeValue="TreeValue" :eventList="eventList" :rowOid="rowOid" @@ -139,6 +140,10 @@ type: Object, default: () => ({}), }, + selectRow:{ + type:Array, + default:[] + } }, data() { return { @@ -242,15 +247,11 @@ }, }, watch: { - codeApplyForm: { - handler(newval, oldval) { - // console.log('newval',newval) - } - } + }, methods: { openDialog() { - //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢� + //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢�(鏈夋敼鍔� 涓嶉渶瑕佸湪浣跨敤edit锛屾柟娉曟病浠�涔堝奖鍝�) this.getFormTemplate(); if (this.type === "add" || (this.type !== "add" && this.status === "amend")) { this.getCodeRule(); @@ -473,7 +474,7 @@ secValue: this.codeApplyForm[item.oid], }; }); - //鏍囧噯鐗瑰畾 + //鏍囧噯鐗瑰畾瀛楁鏄犲皠 const mappings = { codeStandardEditType: 'operationType', reviseSeries: 'series', diff --git a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue index df6a0b6..e3e913a 100644 --- a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue +++ b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue @@ -99,9 +99,9 @@ </FormTemplateDialog> <!-- 淇--> <FormTemplateDialog :codeClassifyOid="this.codeClassifyOid" :codeRuleOid="this.codeRuleOid" - :disabledProp="disabledProp" :rowOid="rowOid" :templateOid="templateOid" :title="'淇敼缂栫爜淇℃伅'" - :visible.sync="amendvisible" status="amend" - type="edit" @submit="amendSumbit"></FormTemplateDialog> + :disabledProp="disabledProp" :templateOid="templateOid" :title="'鏁版嵁淇'" + :visible.sync="amendvisible" status="amend" :selectRow="selectRow" + type="add" @submit="amendSumbit"></FormTemplateDialog> <!-- 鏂板--> <FormTemplateDialog :TreeValue="TreeValue" :codeClassifyOid="this.codeClassifyOid" :codeRuleOid="this.codeRuleOid" :disabledProp="disabledProp" :templateOid="templateOid" @@ -113,7 +113,7 @@ <FormTemplateDialog :codeClassifyOid="this.codeClassifyOid" :codeRuleOid="this.codeRuleOid" :disabledProp="disabledProp" :templateOid="templateOid" :title="'淇敼缂栫爜淇℃伅'" :visible.sync="editvisible" - rowOid="rowOid" + :rowOid="rowOid" type="edit" @submit="EditSumbit"></FormTemplateDialog> <!-- 鎵归噺缂栬緫--> <!-- <MasterEditBulk :visible.sync="bulkeditvisible" ></MasterEditBulk>--> @@ -187,7 +187,8 @@ upSaveCode, applyGroupCode, receiveEditApply, - applySaveCode + applySaveCode, + exportGroupCodeExcel } from "@/api/GetItem"; import {processTS, changeStatus} from "@/api/template/setPersonnel" import {listCodeAttributeByClassId} from "@/api/integration/integration.js"; @@ -485,8 +486,7 @@ this.LinkObject = row; this.LinkVisible = true; this.LinkList = Object.keys(row).map(property => property) - // console.log(result); - // console.log(this.LinkObject) + }, //鐘舵�佹悳绱� cellSelectHandler(row) { @@ -554,7 +554,34 @@ if (uniqueFlag === 'CODEAMEND') return this.codeAMENDHandler() //鎵归噺缂栬緫 if (uniqueFlag === 'bulkEdit') return this.bulkEditHandler("bulkEdit") + //闆嗗洟鐮佸鍑� + if (uniqueFlag === 'excelGroupCode') return this.excelGroupCode() + //闆嗗洟鐮佸鍏� + if (uniqueFlag === 'importGroupCode') return this.importGroupCode("groupCode") }); + }, + importGroupCode(type){ + this.batchImportData.visible = true + this.batchImportData.type = type + this.batchImportData.codeClassifyOid = this.codeClassifyOid + }, + //闆嗗洟鐮佸鍑� + excelGroupCode(){ + debugger + this.isLoading = true; + exportGroupCodeExcel({ + codeClassifyOid: this.codeClassifyOid, + }).then(res => { + console.log(res.data) + if (res) { + func.downloadFileByBlobHandler(res); + this.$message.success('涓嬭浇鎴愬姛锛岃鏌ョ湅锛�'); + this.isLoading = false; + } + }).catch(error=>{ + this.$message.error(error); + this.isLoading = false; + }) }, //鏍囧噯鐢宠 codeApplyHandler() { @@ -589,22 +616,37 @@ //鏍囧噯淇 codeAMENDHandler() { let foundItem = false; - this.tableHeadFindData.forEach(item => { if (item.field === "oldcode" && Object.keys(item.referConfig).length >= 1) { foundItem = true; } }); - if (foundItem) { - this.amendvisible = true; - this.rowOid = this.selectRow[0].oid; + if(this.selectRow.length >= 1){ + this.$confirm('宸叉湁鍙傜収鏄惁鍙栨秷鍕鹃�夌户缁墽琛岋紵', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.selectRow = []; + //鍙栨秷鍕鹃�夌姸鎬� + this.$refs.dataTable.clearSelection(); + this.amendvisible = true; + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝綋鍓嶆搷浣�' + }); + }); + }else { + this.amendvisible = true; + } } else { - if (this.selectRow.length !== 1) { - this.$message.warning("璇烽�夋嫨涓�鏉℃暟鎹�"); + if (this.selectRow.length <= 0) { + this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�"); } else { this.amendvisible = true; - this.rowOid = this.selectRow[0].oid; + } } }, @@ -613,10 +655,6 @@ // console.log(this.nodeClickList) if (this.nodeClickList.children.length >= 1) { this.$message.warning('褰撳墠閫夋嫨鐨勫垎绫讳笉鏄彾瀛愯妭鐐癸紝涓嶅厑璁告壒閲忕紪杈戯紒') - return; - } - if (this.selectRow.length <= 0) { - this.$message.warning('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹紒') return; } const Editing = this.selectRow.every(item => item.lcstatus === 'Editing'); diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue index 3ee51de..0f83ebf 100644 --- a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue +++ b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue @@ -376,7 +376,7 @@ </el-option> </el-select> <el-switch - v-if="item.edit === 'switch'" v-model="row[item.prop]" :disabled="!editOpenFlag" active-value="true" v-show="!AddCellFlag" + v-if="item.edit === 'switch'" v-model="row[item.prop]" :disabled="!editOpenFlag" active-value="true" inactive-value="false"> </el-switch> <span v-else>{{ row[item.prop] }}</span> diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue index 306e91f..72f90ae 100644 --- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue +++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue @@ -40,12 +40,12 @@ </div> </div> <!-- 宸︿晶鏍�--> - <div style="height: calc(100vh - 230px);overflow: auto"> + <div style="height: calc(100vh - 230px);overflow: auto;"> <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata" :defaultExpandAll="false" :option="Treeoption" class="classifyTree" - style="height: calc(100vh - 280px)" + style="height: calc(100vh - 280px);" @node-click="nodeClick" > </avue-tree> diff --git a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue index 316ba94..2619751 100644 --- a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue +++ b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue @@ -65,7 +65,7 @@ import pieChart from "../../components/StatisticsComponent/pieChart" import ColumnarChart from "../../components/StatisticsComponent/ColumnarChart" import mixCart from "../../components/StatisticsComponent/mixCart" - +import {getStatisticAnalysis} from "@/api/statistic/chart" export default { components: { lineChart, @@ -179,6 +179,9 @@ //鏂板 addHandler() { this.addVisible = true; + getStatisticAnalysis({btmNames:'part'} ).then(res=>{ + console.log(res) + }) }, //鍙栨秷 escHandler() { 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 e82445c..5d63bd4 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 @@ -857,4 +857,15 @@ ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); } } + + /** + * 鑾峰彇缁熻鍒嗘瀽鏁版嵁 + * @param btmNames 涓氬姟绫诲瀷 + * @return + */ + @GetMapping("/getStatisticAnalysis") + @VciBusinessLog(operateName = "鑾峰彇缁熻鍒嗘瀽鏁版嵁") + public R getStatisticAnalysis(String btmNames) { + return engineService.getStatisticAnalysis(btmNames); + } } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java index 6e6f7a5..418809c 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/MdmEngineService.java @@ -513,4 +513,10 @@ * @return 鎵ц缁撴灉 */ String addSaveBZCodeNotauthUser(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception; + /** + * 鑾峰彇缁熻鍒嗘瀽鏁版嵁 + * @param btmNames 涓氬姟绫诲瀷 + * @return 鏁版嵁闆� + */ + R getStatisticAnalysis(String btmNames); } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java index 31418e7..9bfb0fe 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java @@ -60,6 +60,7 @@ import com.vci.ubcs.system.feign.ISysClient; import com.vci.ubcs.system.user.entity.User; import com.vci.ubcs.system.user.feign.IUserClient; +import io.swagger.models.auth.In; import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; import oracle.sql.TIMESTAMP; import org.slf4j.Logger; @@ -1140,6 +1141,75 @@ @Override public String addSaveBZCodeNotauthUser(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception { return addSaveBZCode(codeBZApplyDTO,authUser); + } + + /** + * 鑾峰彇缁熻鍒嗘瀽鏁版嵁 + * @param btmNames 涓氬姟绫诲瀷 + * @return 鏁版嵁闆� + */ + @Override + public R getStatisticAnalysis(String btmNames) { + //鏌ヨ涓氬姟绫诲瀷瀵瑰簲鐨勬暟鎹簱琛� + R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Arrays.asList(btmNames.split(","))); + if (!listR.isSuccess() || listR.getData().size() == 0) { + throw new ServiceException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); + } + List tableData = new ArrayList(); + for (BtmTypeVO datum : listR.getData()) { + String sql = "select count(*) countNum, to_char(CREATETIME, 'mm') countDate\n" + + "from "+ datum.getTableName() +"\n" + + "where CREATETIME >= to_date(EXTRACT(YEAR FROM SYSDATE) || '-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss') AND LASTV = '1'\n" + + "group by to_char(CREATETIME, 'mm')\n" + + "order by to_char(CREATETIME, 'mm')"; + //鏌ヨ鍑洪渶瑕佸鐞嗙殑鏁版嵁 + List<Map> maps = commonsMapper.selectBySql(sql); + if(maps.size() == 0){ + throw new ServiceException("浼犲叆绫诲瀷["+ datum.getName() + ":" + + datum.getId() +"]鏈煡鍒扮浉鍏崇粺璁℃暟鎹紝璇风‘璁�!!!!"); + } + //褰撳勾姣忔湀鏈堜唤涔嬪墠涔嬪拰 + List<Integer> monthCount = new ArrayList<>(12); + //褰撳勾姣忔湀鐨勬湀浠芥暟鎹� + List<Integer> month = new ArrayList<>(); + //鑾峰彇褰撳墠鏈堢殑鏁板瓧 + Calendar instance = Calendar.getInstance(); + int nowmonth = instance.get(Calendar.MONTH) + 1; + //浠�1鍒�12鏈堣繘琛屽鐞� + for (Integer i = 1; i <= 12; i++) { + //褰撳墠鏈堝悗鎵�鏈夋暟鎹缃负0 + if(i>nowmonth){ + monthCount.add(0); + month.add(0); + } + //褰撳墠鏈堜唤涔嬪墠涔嬪拰 + Integer count = 0; + //褰撳墠鏈堜唤鏁版嵁 + Integer sameMonth = 0; + //瀵规暟鎹簱鏌ョ殑鏁版嵁杩涜澶勭悊锛屽褰撳墠鏈堜唤杩涜绱姞 + for (Map map : maps) { + Integer mounDate = Integer.parseInt(String.valueOf(map.get("COUNTDATE"))); + if(mounDate <= i){ + count += Integer.parseInt(String.valueOf(map.get("COUNTNUM"))); + } + if (mounDate == i) { + sameMonth = Integer.parseInt(String.valueOf(map.get("COUNTNUM"))); + } + } + monthCount.add(count); + month.add(sameMonth); + } + //瀵规暟鎹繘琛屾暣鍚� + HashMap<String,Object> menuData = new HashMap<>(); + menuData.put("menuName",datum.getName()); + menuData.put("codeType",null); + ArrayList monthData = new ArrayList(); + monthData.add(monthCount); + monthData.add(month); + menuData.put("menuData",monthData); + tableData.add(menuData); + } + return R.data(tableData); } /** @@ -2434,7 +2504,15 @@ } else { return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE; } - } else { + } else if(key.endsWith("_in")){ + String field = UBCSSqlKeyword.getColumn(key, "_in"); + if (referFieldMap.containsKey(field)) { + return VciBaseUtil.toInSql(referFieldMap.get(field),value); //referFieldMap.get(field) + SPACE + "= '" + value + "'" + SPACE; + } else { + return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE; + } + + }else { // if (referFieldMap.containsKey(key)) { // //璇存槑鏄弬鐓х殑锛屾垜浠弬鐓х殑鏌ヨ閮借涓烘槸瀛楃涓诧紝濡傛灉鏄椂闂存牸寮忕殑鏌ヨ鑲畾鏈夐棶棰橈紝 // String selectKey = referFieldMap.get(key); 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 d867d06..0090df0 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 @@ -1290,8 +1290,11 @@ ReadExcelOption reo = new ReadExcelOption(); reo.setReadAllSheet(true); List<SheetDataSet> sheetDataSetList = ExcelUtil.readDataObjectFromExcel(file,null,reo); - if (sheetDataSetList.size() > LIMIT + 1) { - throw new VciBaseException("涓轰簡淇濊瘉绯荤粺鐨勭ǔ瀹氭�э紝璇蜂竴娆′笉瑕佸鍏ヨ秴杩�1涓囨潯鐨勬暟鎹�"); + if (sheetDataSetList.get(0).getRowData().size() > LIMIT + 1) { + throw new ServiceException("涓轰簡淇濊瘉绯荤粺鐨勭ǔ瀹氭�э紝璇蜂竴娆′笉瑕佸鍏ヨ秴杩�1涓囨潯鐨勬暟鎹�"); + } + if (sheetDataSetList.get(0).getRowData().size() == 0) { + throw new ServiceException("鏈鍙栧埌excle鐩稿叧鏁版嵁锛岃纭锛侊紒锛�"); } boolean isExport=false; Map<String,List<WriteExcelData>> shetNameMap=new HashMap<>(); @@ -1373,13 +1376,9 @@ codeAllCodeService.updateBatchById(codeAllCodes); } catch (Throwable e) { log.error("鎵归噺浜х敓缂栫爜鐨勬椂鍊欏嚭閿欎簡", e); -// thisCbos.stream().forEach(cbo -> { -// String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); errorMap.put(sheetRowData.getRowIndex(), ";绯荤粺閿欒锛屽瓨鍌ㄦ暟鎹殑鏃跺�欏嚭閿欎簡:"+e.getMessage()); -// }); } } - if (errorMap.size() > 0) { isExport = true; } @@ -4991,7 +4990,7 @@ } fieldList=execGroupCodePortDataDTO.getFieldList(); List<Map<String,String>>dataList=new ArrayList<>(); - getDatas(classifyFullInfo,templateVO,fieldList,dataList); + getDatas(classifyFullInfo,templateVO,fieldList,dataList,null); execGroupCodePortDataDTO.setDataList(dataList);//鏀炬暟鎹� execGroupCodePortDataDTO.setSheetName(codeClassifyVO.getName()+"闆嗗洟鐮佸鍏ユā鏉�"); String tempFolder = LocalFileUtil.getDefaultTempFolder(); @@ -5082,6 +5081,86 @@ } /*** + * 瀵煎叆闆嗗洟鐮� + * @param codeClassifyOid + * @param file + * @return + */ + public String improtGroupCode(String codeClassifyOid, File file) throws ServiceException { + VciBaseUtil.alertNotNull(codeClassifyOid,"鍒嗙被鐨勪富閿�"); + ReadExcelOption reo = new ReadExcelOption(); + reo.setReadAllSheet(true); + List<SheetDataSet> sheetDataSetList = ExcelUtil.readDataObjectFromExcel(file,null,reo); + + if (sheetDataSetList.size() > LIMIT + 1) { + throw new ServiceException("涓轰簡淇濊瘉绯荤粺鐨勭ǔ瀹氭�э紝璇蜂竴娆′笉瑕佸鍏ヨ秴杩�1涓囨潯鐨勬暟鎹�"); + } + CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid); + CodeClassifyTemplateVO templateVO = new CodeClassifyTemplateVO(); + //闄ゅ幓榛樿鐨勫睘鎬�.杩樻湁鍙湁琛ㄥ崟鏄剧ず鐨勫瓧娈垫墠瀵煎叆 + 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)){ + 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)); + SheetDataSet dataSet= sheetDataSetList.get(0); + List<String> titleRowData = dataSet.getColName(); + Map<Integer/**鍒楀彿**/,String/**瀛楁鐨勫悕绉�**/> fieldIndexMap = new HashMap<>(); + getGroupCodeFieldIndexMap(titleRowData,codeAttrMapGroupAttrDTOS,fieldIndexMap); + //闇�瑕佸垽鏂槸鍚︽墍鏈夌殑灞炴�ч兘鍦ㄦā鏉夸笂浜� + 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)){ + + + } + return ""; + } + + /** + * + * @param fieldIndexMap + * @param rowDataList + * @param cboList + */ + private void getExportGroupCodeDatas(Map<Integer,String> fieldIndexMap,List<SheetRowData> rowDataList,List<ClientBusinessObject>cboList){ + rowDataList.stream().forEach(sheetRowData -> { + sheetRowData.getData().forEach((index,value)->{ + ClientBusinessObject cbo=new ClientBusinessObject(); + String field = fieldIndexMap.get(index); + if (StringUtils.isBlank(field)) { + throw new VciBaseException("绗�" + (index + 1) + "鍒楃殑鏍囬鍦ㄧ郴缁熶腑涓嶅瓨鍦�"); + } + try { + cbo.setAttributeValueWithNoCheck(field, value); + if (WebUtil.isDefaultField(field)) { + WebUtil.setValueToField(field, cbo, value); + } + } catch (VciBaseException e) { + log.error("璁剧疆灞炴�х殑鍊奸敊璇�", e); + } + cboList.add(cbo); + }); + }); + } + /*** * 闆嗗洟瀵煎嚭妯℃澘灞炴�ф槧灏勪俊鎭幏鍙� * @param templateVO * @param execGroupCodePortDataDTO @@ -5117,23 +5196,51 @@ } /*** + * 闆嗗洟鐮佸睘鎬ц浆鎹� + * @param titleRowData + * @param codeAttrMapGroupAttrDTOS + * @param fieldIndexMap + */ + private void getGroupCodeFieldIndexMap(List<String> titleRowData,List<CodeAndGroupCodeAttrMappingDTO> codeAttrMapGroupAttrDTOS,Map<Integer/**鍒楀彿**/,String/**瀛楁鐨勫悕绉�**/> fieldIndexMap){ + 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)){ + id = CODE_GROUP_FIELD; + } + if(com.alibaba.cloud.commons.lang.StringUtils.isBlank(id) && "浼佷笟缂栫爜".equalsIgnoreCase(title)){ + id = CODE_FIELD; + } + if(com.alibaba.cloud.commons.lang.StringUtils.isNotBlank(id)){ + fieldIndexMap.put(i,id); + } + } + + + } + /*** * 鏌ヨ鏈湁闆嗗洟鐮佺殑鏁版嵁 * @param classifyFullInfo * @param templateVO * @param selectFieldList * @param dataList */ - private void getDatas(CodeClassifyFullInfoBO classifyFullInfo,CodeClassifyTemplateVO templateVO,LinkedList<String> selectFieldList,List<Map<String,String>>dataList){ + 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(); - Map<String, String> conditionMap = new HashMap<>(); + Map<String, String> conditionMap=new HashMap<>(); if(conditionMap == null){ conditionMap = new HashMap<>(); } if(conditionMap.containsKey(VciQueryWrapperForDO.OID_FIELD)){ conditionMap.put(VciQueryWrapperForDO.OID_FIELD,QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(conditionMap.get(VciQueryWrapperForDO.OID_FIELD)) + ")"); } + if(!CollectionUtils.isEmpty(codeList)){ + conditionMap.put("id_in",VciBaseUtil.array2String(codeList.toArray(new String[]{}))); + } conditionMap.put("codeclsfpath","*" + codeClassifyOid + "*"); conditionMap.put("groupcode_null", "null"); conditionMap.put("lastr", "1"); -- Gitblit v1.9.3