From f09e05514d9a9e2623cfa73c4de1ffa98bb30bf8 Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期二, 23 一月 2024 10:09:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/UBCS-WEB/src/views/system/tenant.vue | 2
Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/entity/ClassifyAuth.java | 7
Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue | 3
Source/UBCS-WEB/src/components/FormTemplate/ThemeChildren.vue | 20
Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue | 2
Source/UBCS-WEB/src/views/resource/attach.vue | 2
Source/UBCS-WEB/src/views/monitor/log/operateLog.vue | 2
Source/UBCS-WEB/vue.config.js | 5
Source/UBCS-WEB/src/api/template/templateAttr.js | 5
Source/UBCS-WEB/src/views/system/client.vue | 2
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IClassifyAuthService.java | 17
Source/UBCS-WEB/src/views/flow/manager.vue | 2
Source/UBCS-WEB/src/api/code/codeCharcter.js | 16
Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue | 10
Source/UBCS-WEB/src/views/modeling/Version.vue | 1
Source/UBCS-WEB/src/views/code/Match.vue | 4
Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue | 4
Source/UBCS-WEB/src/views/desk/notice.vue | 2
Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue | 160
Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue | 429 ++
Source/UBCS-WEB/src/views/flow/follow.vue | 2
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IRoleService.java | 1
Source/UBCS-WEB/src/views/resource/oss.vue | 2
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java | 52
Source/UBCS-WEB/src/views/report/reportlist.vue | 2
Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue | 4
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java | 46
Source/UBCS-WEB/src/main.js | 2
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java | 26
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/MenuServiceImpl.java | 100
Source/UBCS-WEB/src/api/system/classifyAuth.js | 12
Source/UBCS-WEB/src/views/monitor/log/usual.vue | 2
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/ClassifyAuthMapper.java | 3
Source/UBCS-WEB/src/views/docking/data.vue | 1
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java | 19
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IMenuService.java | 21
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/MenuMapper.java | 11
Source/UBCS-WEB/src/views/monitor/log/api.vue | 2
Source/UBCS-WEB/src/api/docking/task.js | 2
Source/UBCS-WEB/src/views/flow/model.vue | 2
Source/UBCS-WEB/src/views/system/user.vue | 2
Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/MenuMapper.xml | 641 ++--
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java | 1
Source/UBCS-WEB/src/views/authority/role.vue | 3
Source/UBCS-WEB/src/api/docking/data.js | 2
Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue | 299 +
Source/UBCS-WEB/src/option/system/dictbiz.js | 2
Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/ClassifyAuthMapper.xml | 16
Source/UBCS-WEB/src/views/system/dept.vue | 3
Source/UBCS-WEB/src/components/Master/MasterTree.vue | 10
Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue | 4
Source/UBCS-WEB/src/views/code/code.vue | 174
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java | 1
Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClient.java | 4
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java | 3
Source/UBCS-WEB/src/views/monitor/log/error.vue | 2
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/MenuController.java | 10
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java | 3
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java | 48
Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue | 6
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/feign/SysClient.java | 8
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 6307 +++++++++++++++++++++---------------------
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/ClassifyAuthController.java | 10
Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClientFallback.java | 5
Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue | 41
Source/UBCS-WEB/src/option/system/param.js | 2
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java | 4
67 files changed, 4,828 insertions(+), 3,790 deletions(-)
diff --git a/Source/UBCS-WEB/src/api/code/codeCharcter.js b/Source/UBCS-WEB/src/api/code/codeCharcter.js
index 3dd0f56..27dbabb 100644
--- a/Source/UBCS-WEB/src/api/code/codeCharcter.js
+++ b/Source/UBCS-WEB/src/api/code/codeCharcter.js
@@ -10,13 +10,23 @@
})
}
-export const gridCodeRule = (params) => {
+export const getRegexStr = (params) => {
return request({
- url: '/api/ubcs-code/mdmRule/gridCodeRule',
+ url: '/api/ubcs-code/codeRuleCharacterController/getRegexStr',
method: 'get',
params: {
...params,
- },
+ }
+ })
+}
+
+export const getSelectList = (params) => {
+ return request({
+ url: '/api/ubcs-code/codeRuleCharacterController/selectList',
+ method: 'get',
+ params: {
+ ...params,
+ }
})
}
diff --git a/Source/UBCS-WEB/src/api/docking/data.js b/Source/UBCS-WEB/src/api/docking/data.js
index 1093124..c89ac5c 100644
--- a/Source/UBCS-WEB/src/api/docking/data.js
+++ b/Source/UBCS-WEB/src/api/docking/data.js
@@ -1,6 +1,6 @@
import request from '@/router/axios';
-export const getDataList = (page, limit, params) => {
+export const getDataList = (page, limit,sort,order, params) => {
return request({
url: '/api/ubcs-code/dockingManagement/gridDockingData',
method: 'get',
diff --git a/Source/UBCS-WEB/src/api/docking/task.js b/Source/UBCS-WEB/src/api/docking/task.js
index c2dc99a..e425196 100644
--- a/Source/UBCS-WEB/src/api/docking/task.js
+++ b/Source/UBCS-WEB/src/api/docking/task.js
@@ -1,6 +1,6 @@
import request from '@/router/axios';
-export const getTaskList = (page, limit, params) => {
+export const getTaskList = (page, limit,sort,order, params) => {
return request({
url: '/api/ubcs-code/dockingManagement/gridDockingTask',
method: 'get',
diff --git a/Source/UBCS-WEB/src/api/system/classifyAuth.js b/Source/UBCS-WEB/src/api/system/classifyAuth.js
index 41c12d6..179fb9f 100644
--- a/Source/UBCS-WEB/src/api/system/classifyAuth.js
+++ b/Source/UBCS-WEB/src/api/system/classifyAuth.js
@@ -26,4 +26,14 @@
...params
}
})
-}
\ No newline at end of file
+}
+//鑿滃崟瑙掕壊鎸夐挳鏉冮檺
+export const getButtonsByRoleId = (params) => {
+ return request({
+ url: '/api/ubcs-system/menu/getButtonsByRoleId',
+ method: 'get',
+ params: {
+ ...params
+ }
+ })
+}
diff --git a/Source/UBCS-WEB/src/api/template/templateAttr.js b/Source/UBCS-WEB/src/api/template/templateAttr.js
index 113e4f8..bef95ca 100644
--- a/Source/UBCS-WEB/src/api/template/templateAttr.js
+++ b/Source/UBCS-WEB/src/api/template/templateAttr.js
@@ -1,10 +1,13 @@
import request from "@/router/axios";
//鑾峰彇鏍戝舰缁勪欢鏁版嵁
-export const getAtrrList = () => {
+export const getAtrrList = (params) => {
return request({
url: '/api/ubcs-code/codeClassify/treeCodeClassify',
method: 'get',
+ params: {
+ ...params
+ }
})
}
//鏍戣妭鐐规坊鍔�
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/ThemeChildren.vue b/Source/UBCS-WEB/src/components/FormTemplate/ThemeChildren.vue
index b5e4f9d..02bd9e2 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/ThemeChildren.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/ThemeChildren.vue
@@ -5,7 +5,7 @@
<el-select v-model="SelectValue" placeholder="璇烽�夋嫨" style="width: 135px">
<el-option
v-for="item in SelectOption"
- :key="item.value"
+ :key="item.key"
:label="item.label"
:value="item.value"
style="width: 150px">
@@ -16,7 +16,7 @@
<el-button plain size="small" style="margin-left: 20px" type="primary" @click="SelectSearchHandler">鏌ヨ
</el-button>
</template>
- <avue-crud :data="TableData" :option="this.codeType === 'btmCode' ? this.btmOption : this.option" @row-click="rowHandlerClick">
+ <avue-crud :data="TableData" :option="this.codeType === 'btmCode' ? this.btmOption : this.option" @row-click="rowHandlerClick" :table-loading="loading">
<template slot="radio" slot-scope="{row}">
<el-radio v-model="radioValue" :label="row.$index" style="padding-left: 10px !important;">{{ '' }}
</el-radio>
@@ -74,6 +74,7 @@
crudName: '',
crudOid: '',
TableData: [],
+ loading:false,
option: {
addBtn: false,
index: true,
@@ -82,6 +83,7 @@
border: true,
menu: false,
height: 380,
+ rowKey: "oid",
column: [
{
label: '',
@@ -111,6 +113,7 @@
border: true,
menu: false,
height:380,
+ rowKey: "oid",
column:[
{
label: '',
@@ -135,6 +138,7 @@
}
},
created() {
+ this.loading = true;
},
mounted() {
},
@@ -162,13 +166,13 @@
},
// 妯$硦鏌ヨ
SelectSearchHandler() {
- if (!this.SelectOption) {
- return; // 濡傛灉SelectOption鏁版嵁涓嶅瓨鍦ㄧ洿鎺ヨ繑鍥� 閬垮厤鎶ラ敊
+ this.loading = true;
+ if (!this.SelectOption || this.SelectOption.length === 0) {
+ this.loading = false;
+ return;
}
-
const Parameter = {};
Parameter[`conditionMap['${this.SelectValue}']`] = this.SelectSearchValue;
-
if(this.codeType === "btmCode"){
this.btmDefaultRend(Parameter)
}else {
@@ -205,11 +209,13 @@
...Parameter
}).then(res => {
this.TableData = res.data.records;
+ this.loading = false;
})
},
btmDefaultRend(Parameter) {
referDataGrid({valueField: 'id', isMuti: 'false', 'limit': '-1', ...Parameter}).then(res => {
- this.TableData = res.data.data.records
+ this.TableData = res.data.data.records;
+ this.loading = false;
})
},
}
diff --git a/Source/UBCS-WEB/src/components/Master/MasterTree.vue b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
index 4d87afc..4f8c904 100644
--- a/Source/UBCS-WEB/src/components/Master/MasterTree.vue
+++ b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -103,7 +103,13 @@
const result = this.$route.query.id.substring(0, index);
this.idData = result;
this.removeList();
- getTreeList({'conditionMap[id]': this.idData}).then(res => {
+ let conditionMaps = {};
+ conditionMaps["conditionMap[id]"] = this.idData;
+ conditionMaps["conditionMap[authType]"] = "data_auth";
+ conditionMaps["conditionMap[buttonCode]"] = this.idData;
+ // 鏁版嵁鎺堟潈涓槸鍚﹀叿澶囨煡鐪嬫潈闄�
+ conditionMaps["conditionMap[menuCode]"] = "data_view";
+ getTreeList(conditionMaps).then(res => {
if (res) {
if (res.data.length === 0) {
this.$message.error("涓绘暟鎹垎绫绘煡璇负绌猴紒");
@@ -231,7 +237,7 @@
<style lang="scss" scoped>
.app {
overflow: auto;
- height: calc(100vh - 150px);
+ height: calc(100vh - 145px);
}
.app::-webkit-scrollbar {
diff --git a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
index f18267a..44bc9d7 100644
--- a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
+++ b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
@@ -1208,7 +1208,7 @@
.main {
display: flex;
flex-direction: column;
- height: calc(100vh - 150px);
+ height: calc(100vh - 145px);
min-height: 400px;
}
diff --git a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
index 0824414..cedd531 100644
--- a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -6,8 +6,11 @@
append-to-body
class="avue-dialog avue-dialog--top"
title="鍒嗙被鎺堟潈"
- top="-45px" @close="closeDialog">
+ top="-45px"
+ @close="closeDialog"
+ >
<el-table
+ :key="itemKey"
ref="dataTable"
v-loading="isLoading"
:data="classifyAuthData"
@@ -15,16 +18,11 @@
:height="tableHeight"
border
class="cus-table"
- @select="handleSelection"
@row-click="handleRowClick"
@select-all="handleSelectionAll"
@selection-change="handleSelectionChange"
- @sort-change="sortChange"
>
- <el-table-column
- type="selection"
- width="55"
- ></el-table-column>
+ <el-table-column type="selection" width="55"></el-table-column>
<el-table-column
v-for="(item, index) in classifyAuthHeader"
v-if="classifyAuthHeader.length !== 0"
@@ -40,6 +38,7 @@
v-if="item.type === 'select'"
slot="prepend"
v-model="row[item.prop]"
+ @change="selectChange(row.roleData, row)"
>
<el-option
v-for="optionItem in roleList"
@@ -58,26 +57,44 @@
</el-input>
<el-checkbox
v-if="item.type === 'checkbox'"
- v-model="row[item.prop]">
+ v-model="row[item.prop]"
+ :disabled="row.authButton.allDisabled ? true : row.authButton[item.code]"
+ >
</el-checkbox>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
- <el-button type="info" plain @click="selectAllButton">鎸夐挳鍏ㄩ��</el-button>
- <el-button class="el-icon-plus" type="success" plain @click="addClassifyAuth"></el-button>
- <el-button class="el-icon-minus" type="warning" plain @click="subClassifyAuth"></el-button>
- <el-button type="primary" plain @click="submit">鎻� 浜�</el-button>
- <el-button type="danger" plain @click="isShowDialog = false">鍏� 闂�</el-button>
+ <el-button plain type="info" @click="selectAllButton">鎸夐挳鍏ㄩ��</el-button>
+ <el-button
+ class="el-icon-plus"
+ plain
+ type="success"
+ @click="addClassifyAuth"
+ ></el-button>
+ <el-button
+ class="el-icon-minus"
+ plain
+ type="warning"
+ @click="subClassifyAuth"
+ ></el-button>
+ <el-button plain type="primary" @click="submit">鎻� 浜�</el-button>
+ <el-button plain type="danger" @click="isShowDialog = false"
+ >鍏� 闂�</el-button
+ >
</div>
</el-dialog>
</template>
<script>
-import {getButtonByParentCode} from "@/api/system/menu"
-import {getPage} from "@/api/system/role"
-import {saveOrUpdate, getClassifyAuthList} from "@/api/system/classifyAuth"
-import {v4 as uuidv4} from 'uuid';
+import { getButtonByParentCode } from "@/api/system/menu";
+import { getPage } from "@/api/system/role";
+import {
+ saveOrUpdate,
+ getClassifyAuthList,
+ getButtonsByRoleId,
+} from "@/api/system/classifyAuth";
+import { v4 as uuidv4 } from "uuid";
export default {
name: "classifyAuthDialog.vue",
@@ -97,7 +114,7 @@
// 瀵硅瘽妗嗘樉绀烘帶鍒�
isShowDialog: this.visible,
isLoading: false,
- tableHeight: 'calc(100vh - 550px)',
+ tableHeight: "calc(100vh - 550px)",
classifyAuthData: [],
//鍒楀ご
classifyAuthHeader: [],
@@ -107,110 +124,209 @@
roleList: [],
//褰撳墠閫変腑鐨勮〃鏍艰
selectList: [],
+ itemKey: "",
+ addIndex: Number,
+ currentRow: {},
};
},
+ computed: {},
+ mounted() {},
+ created() {},
watch: {
// 鐩戝惉鐖剁粍浠朵紶鐨勭獥鍙f樉绀洪殣钘忕殑鍊�
visible() {
if (this.visible) {
this.isShowDialog = this.visible;
return new Promise((resolve, reject) => {
- getButtonByParentCode({code: "classifyTree"}).then(res => {
- // 璁板綍鎸夐挳鏁版嵁
- this.classifyAuthButton = res.data.data;
- const list = res.data.data;
- let tempData = [];
- // 瑙掕壊鍒�
- tempData.push({
- label: "瑙掕壊",
- prop: "roleData",
- type: "select",
- width: 150,
- });
- // 缂栫爜椤瑰垎绫绘巿鏉�
- tempData.push({
- label: "缂栫爜椤瑰垎绫绘巿鏉�",
- prop: "classifyItem",
- type: "text",
- width: 180,
- });
- list.forEach(item => {
- let columnItem = {
- label: item.name,
- prop: item.id,
- type: "checkbox",
+ getButtonByParentCode({ code: "classifyTree" })
+ .then((res) => {
+ // 璁板綍鎸夐挳鏁版嵁
+ this.classifyAuthButton = res.data.data;
+ const list = res.data.data;
+ let tempData = [];
+ // 瑙掕壊鍒�
+ tempData.push({
+ label: "瑙掕壊",
+ prop: "roleData",
+ type: "select",
+ width: 150,
+ });
+ // 缂栫爜椤瑰垎绫绘巿鏉�
+ tempData.push({
+ label: "缂栫爜椤瑰垎绫绘巿鏉�",
+ prop: "classifyItem",
+ type: "text",
width: 180,
- };
- tempData.push(columnItem);
+ });
+ list.forEach((item) => {
+ let columnItem = {
+ label: item.name,
+ prop: item.id,
+ code: item.code,
+ type: "checkbox",
+ width: 180,
+ };
+ tempData.push(columnItem);
+ });
+ this.classifyAuthHeader = tempData;
+ resolve();
})
- this.classifyAuthHeader = tempData
- resolve();
- }).catch(err => {
- reject(err)
- });
+ .catch((err) => {
+ reject(err);
+ });
// 鑾峰彇瑙掕壊鍒楄〃
- getPage(1, -1, null).then(res => {
+ getPage(1, -1, null).then((res) => {
this.roleList = res.data.data.records;
});
// 鑾峰彇璇ュ垎绫讳笅宸叉巿鏉冪殑鍒嗙被鎺堟潈淇℃伅
- getClassifyAuthList({classifyId: this.classifyData.oid}).then(res => {
+ getClassifyAuthList({
+ classifyId: this.classifyData.oid,
+ authType: "classify_auth",
+ }).then((res) => {
//console.log(res.data.data);
let authDatas = res.data.data;
if (authDatas.length > 0) {
- authDatas.forEach(authData => {
+ authDatas.forEach((authData, index) => {
let item = {
oid: authData.oid,
roleData: authData.roleId,
classifyItem: this.classifyData.label,
- uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d
- }
+ authButton:{},
+ index: index,
+ uuid: uuidv4(), //鐢熸垚鍞竴鐨刬d
+ };
//灏嗘寜閽缃繘鍘�
- authData.buttonIdList.forEach(data => {
+ authData.buttonIdList.forEach((data) => {
Vue.set(item, data, true);
});
- //console.log(item)
this.classifyAuthData.push(item);
- })
+ this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1
+ this.roleHandlerMethods(authData.roleId, "create", index);
+ // console.log('index', index)
+ });
}
});
});
}
},
},
- computed: {},
- mounted() {
- },
- created() {
- },
methods: {
+ roleHandlerMethods(id, type, index) {
+ if (this.classifyAuthData.length < 0) {
+ return;
+ }
+
+ getButtonsByRoleId({ roleId: id, code: "classifyTree" }).then((res) => {
+ // 鎵惧埌this.classifyAuthButton涓病鏈夊搴旂殑灞炴��
+ const filteredItems = this.classifyAuthButton.filter((item) => {
+ return !res.data.data.find((x) => x.id === item.id);
+ });
+
+ this.classifyAuthHeader.forEach((item) => {
+ const isMatched = filteredItems.some((x) => x.id === item.prop);
+ this.$nextTick(() => {
+ if (this.classifyAuthData[index]) {
+ if (isMatched) {
+ Object.keys(this.classifyAuthData[index]).forEach((key) => {
+ this.$set(this.classifyAuthData[index].authButton,item.code,true);
+ });
+ } else {
+ Object.keys(this.classifyAuthData[index]).forEach((key) => {
+ this.$set(this.classifyAuthData[index].authButton,item.code,false);
+ });
+ }
+ }
+ });
+ });
+
+ //娣诲姞 鈥滄煡鐪嬪叏閮ㄧ鐢ㄦ潯浠垛��
+ if (this.classifyAuthData.authButton) {
+ this.classifyAuthData.forEach((classkey, classIndex) => {
+ if (classkey.authButton.classify_view) {
+ this.$set(this.classifyAuthData[classIndex].authButton,"allDisabled",true);
+ } else {
+ this.classifyAuthData[classIndex].authButton.allDisabled = false;
+ }
+ });
+ }
+
+ //寮哄埗鍒锋柊琛ㄦ牸
+ this.itemKey = uuidv4();
+ });
+ },
+ async selectChange(row, currentRow) {
+ try {
+ this.currentRow = currentRow;
+ const res = await getButtonsByRoleId({
+ roleId: row,
+ code: "classifyTree",
+ });
+
+ const filteredItems = this.classifyAuthButton.filter((item) => {
+ return !res.data.data.find((x) => x.id === item.id);
+ });
+
+ this.classifyAuthHeader.forEach((item) => {
+ const isMatched = filteredItems.some((x) => x.id === item.prop);
+ this.$nextTick(() => {
+ if (currentRow) {
+ if (isMatched) {
+ Object.keys(currentRow).forEach((key) => {
+ currentRow.authButton[item.code] = true;
+ if (!currentRow.authButton.classify_view) {
+ currentRow.authButton.allDisabled = false;
+ }
+ });
+ } else {
+ Object.keys(currentRow).forEach((key) => {
+ currentRow.authButton[item.code] = false;
+ if (!currentRow.authButton.classify_view) {
+ currentRow.authButton.allDisabled = false;
+ }
+ });
+ }
+ }
+
+ this.itemKey = uuidv4(); // 寮哄埗鍒锋柊琛ㄦ牸
+ });
+ });
+ } catch (error) {
+ console.error(error);
+ }
+ },
// 鍏抽棴瀵硅瘽妗�
closeDialog() {
- this.$emit('update:visible', false);
+ this.$emit("update:visible", false);
this.classifyAuthData = [];
},
// 澧炲姞琛�
addClassifyAuth() {
- if(this.roleList.length<=0){
+ if (this.roleList.length <= 0) {
this.$message.warning("褰撳墠绉熸埛涓嶅瓨鍦ㄨ鑹蹭俊鎭紒");
return;
}
+ // console.log('this.roleList', this.roleList)
+ this.addIndex++; //鑷畾涔夌敓鎴愭坊鍔犺涓嬫爣
let item = {
roleData: this.roleList[0].id,
classifyItem: this.classifyData.label,
- uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d
- }
+ authButton:{},
+ index: this.addIndex,
+ uuid: uuidv4(), //鐢熸垚鍞竴鐨刬d
+ };
//灏嗘寜閽缃繘鍘�
- this.classifyAuthButton.forEach(data => {
+ this.classifyAuthButton.forEach((data) => {
Vue.set(item, data.id, false);
- })
- //console.log(item)
- this.classifyAuthData.push(item)
- // console.log(this.classifyAuthData);
+ });
+ this.classifyAuthData.push(item);
+ this.roleHandlerMethods(this.roleList[0].id, "add", this.addIndex);
},
// 鍒犻櫎琛�
subClassifyAuth() {
for (let item of this.selectList) {
- let index = this.classifyAuthData.findIndex(data => data.index === item.index);
+ let index = this.classifyAuthData.findIndex(
+ (data) => data.index === item.index
+ );
if (index !== -1) {
this.classifyAuthData.splice(index, 1);
}
@@ -232,7 +348,7 @@
// 淇濆瓨鍒嗙被鎺堟潈淇℃伅
submit() {
if (this.classifyAuthData.length <= 0) {
- this.$message.warning('鎺堟潈鍒楄〃涓虹┖锛�')
+ this.$message.warning("鎺堟潈鍒楄〃涓虹┖锛�");
return;
}
let isRepeat = false;
@@ -255,7 +371,7 @@
}
let form = [];
let flag = false;
- this.classifyAuthData.forEach(item => {
+ this.classifyAuthData.forEach((item) => {
let itemButtonList = [];
//绛涢�夊嚭鎸夐挳鍕鹃�変负true鐨勫垪
for (let key in item) {
@@ -274,32 +390,36 @@
roleId: item.roleData,
classifyId: this.classifyData.oid,
buttonIds: itemButtonList.join(","),
- }
+ authType: "classify_auth",
+ };
form.push(data);
});
if (flag) {
- this.$message.warning('鏈夋湭鍕鹃�夋搷浣滅殑鏉冮檺锛屼笉鍏佽鎺堟潈')
+ this.$message.warning("鏈夋湭鍕鹃�夋搷浣滅殑鏉冮檺锛屼笉鍏佽鎺堟潈");
return;
}
// console.log(form)
// 璋冪敤淇濆瓨鍒嗙被鎺堟潈鐨勬帴鍙�
- saveOrUpdate(form).then(res => {
- this.$message({
- type: "success",
- message: res.data.msg,
- });
- // this.isShowDialog = false
- }, (error) => {
- window.console.log(error);
- })
+ saveOrUpdate(form).then(
+ (res) => {
+ this.$message({
+ type: "success",
+ message: res.data.msg,
+ });
+ // this.isShowDialog = false
+ },
+ (error) => {
+ window.console.log(error);
+ }
+ );
},
// 鍏ㄩ�夋寜閽�
- selectAllButton(){
- if(this.selectList.length!==1){
+ selectAllButton() {
+ if (this.selectList.length !== 1) {
this.$message.warning("璇峰彧閫夋嫨涓�琛岄渶瑕佸叏閫夌殑鎸夐挳鐨勬暟鎹锛�");
return;
}
- this.classifyAuthButton.forEach(item => {
+ this.classifyAuthButton.forEach((item) => {
//console.log("item",item);
Vue.set(this.selectList[0], item.id, true);
});
@@ -310,7 +430,6 @@
</script>
<style lang="scss" scoped>
-
// 婊氬姩鏉℃牱寮忎慨鏀�
// 婊氬姩鏉$殑瀹藉害
/deep/ .el-table__body-wrapper::-webkit-scrollbar {
@@ -318,7 +437,6 @@
background: white;
border: white;
width: 10px;
-
}
// 婊氬姩鏉$殑婊戝潡
@@ -331,5 +449,4 @@
/deep/ .el-table__body-wrapper {
height: calc(100% - 50px) !important;
}
-
</style>
diff --git a/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
new file mode 100644
index 0000000..334cab8
--- /dev/null
+++ b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
@@ -0,0 +1,429 @@
+<template>
+ <el-dialog
+ v-dialogDrag
+ :close-on-click-modal="false"
+ :visible.sync="isShowDialog"
+ append-to-body
+ class="avue-dialog avue-dialog--top"
+ title="鏁版嵁鎺堟潈"
+ top="-45px" @close="closeDialog">
+ <el-table
+ ref="dataTable"
+ v-loading="isLoading"
+ :data="classifyAuthData"
+ :header-cell-style="{ background: '#FAFAFA', color: '#505050' }"
+ :height="tableHeight"
+ border
+ class="cus-table"
+ @select="handleSelection"
+ @row-click="handleRowClick"
+ @select-all="handleSelectionAll"
+ @selection-change="handleSelectionChange"
+ @sort-change="sortChange"
+ >
+ <el-table-column
+ type="selection"
+ width="55"
+ ></el-table-column>
+ <el-table-column
+ v-for="(item, index) in classifyAuthHeader"
+ v-if="classifyAuthHeader.length !== 0"
+ :key="index"
+ :label="item.label"
+ :prop="item.prop"
+ :show-overflow-tooltip="true"
+ :width="item.width"
+ align="center"
+ >
+ <template slot-scope="{ row }">
+ <el-select
+ v-if="item.type === 'select'"
+ slot="prepend"
+ v-model="row[item.prop]"
+ @change="roleChange(row.roleData,row)"
+ >
+ <el-option
+ v-for="optionItem in roleList"
+ :key="optionItem.id"
+ :label="optionItem.roleName"
+ :value="optionItem.id"
+ >
+ </el-option>
+ </el-select>
+ <el-input
+ v-if="item.type === 'text'"
+ v-model="row[item.prop]"
+ readonly
+ type="text"
+ >
+ </el-input>
+ <el-checkbox
+ v-if="item.type === 'checkbox'"
+ v-model="row[item.prop]"
+ :disabled="row.authButton.allDisabled ? true : row.authButton[item.code]">
+ </el-checkbox>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div slot="footer" class="dialog-footer">
+ <el-button plain type="info" @click="selectAllButton">鎸夐挳鍏ㄩ��</el-button>
+ <el-button class="el-icon-plus" plain type="success" @click="addClassifyAuth"></el-button>
+ <el-button class="el-icon-minus" plain type="warning" @click="subClassifyAuth"></el-button>
+ <el-button plain type="primary" @click="submit">鎻� 浜�</el-button>
+ <el-button plain type="danger" @click="isShowDialog = false">鍏� 闂�</el-button>
+ </div>
+ </el-dialog>
+</template>
+
+<script>
+import {getButtonByParentCode} from "@/api/system/menu"
+import {getPage} from "@/api/system/role"
+import {saveOrUpdate, getClassifyAuthList, getButtonsByRoleId} from "@/api/system/classifyAuth"
+import {v4 as uuidv4} from 'uuid';
+
+export default {
+ name: "dataAuthDialog.vue",
+ props: {
+ classifyData: {
+ type: "Object",
+ default: "",
+ },
+ /**瀵硅瘽妗嗘樉绀洪殣钘忔帶鍒�*/
+ visible: {
+ type: "Boolean",
+ default: false,
+ },
+ TreeNode:{
+ type:Object
+ }
+ },
+ data() {
+ return {
+ // 瀵硅瘽妗嗘樉绀烘帶鍒�
+ isShowDialog: this.visible,
+ isLoading: false,
+ tableHeight: 'calc(100vh - 550px)',
+ classifyAuthData: [],
+ //鍒楀ご
+ classifyAuthHeader: [],
+ //鎸夐挳鏁版嵁
+ classifyAuthButton: [],
+ //瑙掕壊鍒楄〃
+ roleList: [],
+ //褰撳墠閫変腑鐨勮〃鏍艰
+ selectList: [],
+ itemKey: '',
+ addIndex: Number,
+ currentRow: {}
+ };
+ },
+ watch: {
+ // 鐩戝惉鐖剁粍浠朵紶鐨勭獥鍙f樉绀洪殣钘忕殑鍊�
+ visible() {
+ if (this.visible) {
+ this.isShowDialog = this.visible;
+ return new Promise((resolve, reject) => {
+ getButtonByParentCode({code: this.classifyData.attributes.id}).then(res => {
+ // 璁板綍鎸夐挳鏁版嵁
+ this.classifyAuthButton = res.data.data;
+ const list = res.data.data;
+ let tempData = [];
+ // 瑙掕壊鍒�
+ tempData.push({
+ label: "瑙掕壊",
+ prop: "roleData",
+ type: "select",
+ width: 150,
+ });
+ // 缂栫爜椤瑰垎绫绘巿鏉�
+ tempData.push({
+ label: "缂栫爜椤规暟鎹巿鏉�",
+ prop: "classifyItem",
+ type: "text",
+ width: 180,
+ });
+ list.forEach(item => {
+ let columnItem = {
+ label: item.name,
+ prop: item.id,
+ code: item.code,
+ type: "checkbox",
+ width: 180,
+ };
+ tempData.push(columnItem);
+ })
+ this.classifyAuthHeader = tempData
+ resolve();
+ }).catch(err => {
+ reject(err)
+ });
+ // 鑾峰彇瑙掕壊鍒楄〃
+ getPage(1, -1, null).then(res => {
+ this.roleList = res.data.data.records;
+ });
+ // 鑾峰彇璇ュ垎绫讳笅宸叉巿鏉冪殑鍒嗙被鎺堟潈淇℃伅
+ getClassifyAuthList({classifyId: this.classifyData.oid, authType: "data_auth"}).then(res => {
+ //console.log(res.data.data);
+ let authDatas = res.data.data;
+ if (authDatas.length > 0) {
+ authDatas.forEach((authData, index) => {
+ let item = {
+ oid: authData.oid,
+ roleData: authData.roleId,
+ classifyItem: this.classifyData.label,
+ index: index,
+ authButton:{},
+ uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d
+ }
+ //灏嗘寜閽缃繘鍘�
+ authData.buttonIdList.forEach(data => {
+ Vue.set(item, data, true);
+ });
+ this.classifyAuthData.push(item);
+ this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1
+ this.roleHandlerMethods(authData.roleId, 'create', index)
+ })
+ }
+ });
+ });
+ }
+ },
+ },
+ computed: {},
+ mounted() {
+ },
+ created() {
+ },
+ methods: {
+ // 鍏抽棴瀵硅瘽妗�
+ closeDialog() {
+ this.$emit('update:visible', false);
+ this.classifyAuthData = [];
+ },
+ roleHandlerMethods(id, type, index) {
+ if (this.classifyAuthData.length === 0) {
+ return;
+ }
+ //filteredItems 鏈巿鏉冩暟缁�
+ getButtonsByRoleId({roleId: id, code: this.TreeNode.id}).then(res => {
+ const filteredItems = this.classifyAuthButton.filter(item =>
+ !res.data.data.some(x => x.id === item.id)
+ );
+ //鍜岃〃鏍煎垪杩涜瀵规瘮
+ this.classifyAuthHeader.forEach((item) => {
+ const isMatched = filteredItems.some((x) => x.id === item.prop);
+ this.$nextTick(() => {
+ if (this.classifyAuthData[index]) {
+ if (isMatched) {
+ Object.keys(this.classifyAuthData[index]).forEach((key) => {
+ this.$set(this.classifyAuthData[index].authButton,item.code,true);
+ });
+ } else {
+ Object.keys(this.classifyAuthData[index]).forEach((key) => {
+ this.$set(this.classifyAuthData[index].authButton,item.code,false);
+ });
+ }
+ }
+ });
+ });
+
+ //娣诲姞鈥樻煡鐪嬧�欑鐢�
+ if (this.classifyAuthData.authButton) {
+ this.classifyAuthData.forEach((classkey, classIndex) => {
+ if (classkey.authButton.classify_view) {
+ this.$set(this.classifyAuthData[classIndex].authButton,"allDisabled",true);
+ } else {
+ this.classifyAuthData[classIndex].authButton.allDisabled = false;
+ }
+ });
+ }
+ //寮哄埗鍒锋柊琛ㄦ牸
+ this.itemKey = uuidv4();
+ });
+ },
+ // 瑙掕壊鏀瑰彉鏃�
+ async roleChange(row, currentRow) {
+ try {
+ this.currentRow = currentRow;
+ const res = await getButtonsByRoleId({roleId: row, code: this.TreeNode.id});
+
+ const filteredItems = this.classifyAuthButton.filter(item => {
+ return !res.data.data.find(x => x.id === item.id);
+ });
+
+ this.classifyAuthHeader.forEach(item => {
+ const isMatched = filteredItems.some(x => x.id === item.prop);
+ this.$nextTick(() => {
+ if (currentRow) {
+ if (isMatched) {
+ Object.keys(currentRow).forEach((key) => {
+ currentRow.authButton[item.code] = true;
+ if (!currentRow.authButton.classify_view) {
+ currentRow.authButton.allDisabled = false;
+ }
+ });
+ } else {
+ Object.keys(currentRow).forEach((key) => {
+ currentRow.authButton[item.code] = false;
+ if (!currentRow.authButton.classify_view) {
+ currentRow.authButton.allDisabled = false;
+ }
+ });
+ }
+ }
+ this.itemKey = uuidv4(); // 寮哄埗鍒锋柊琛ㄦ牸
+ });
+ });
+ } catch (error) {
+ console.error(error);
+ }
+ },
+ // 澧炲姞琛�
+ addClassifyAuth() {
+ if (this.roleList.length <= 0) {
+ this.$message.warning("褰撳墠绉熸埛涓嶅瓨鍦ㄨ鑹蹭俊鎭紒");
+ return;
+ }
+ this.addIndex++; //鑷畾涔夌敓鎴愭坊鍔犺涓嬫爣
+ let item = {
+ roleData: this.roleList[0].id,
+ classifyItem: this.classifyData.label,
+ authButton:{},
+ uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d,
+ index: this.addIndex,
+ }
+ //灏嗘寜閽缃繘鍘�
+ this.classifyAuthButton.forEach(data => {
+ Vue.set(item, data.id, false);
+ })
+ //console.log(item)
+ this.classifyAuthData.push(item)
+ this.roleHandlerMethods(this.roleList[0].id, 'add', this.addIndex)
+ },
+ // 鍒犻櫎琛�
+ subClassifyAuth() {
+ for (let item of this.selectList) {
+ let index = this.classifyAuthData.findIndex(data => data.index === item.index);
+ if (index !== -1) {
+ this.classifyAuthData.splice(index, 1);
+ }
+ }
+ },
+ handleRowClick(row, column) {
+ this.selectList.push(row);
+ this.$refs.dataTable.toggleRowSelection(row);
+ },
+ // 澶氶��
+ handleSelectionChange(list) {
+ this.selectList = list;
+ //console.log("澶氶��");
+ },
+ // 閫夋嫨鍏ㄩ儴
+ handleSelectionAll(list) {
+ this.selectList = list;
+ },
+ // 淇濆瓨鍒嗙被鎺堟潈淇℃伅
+ submit() {
+ if (this.classifyAuthData.length <= 0) {
+ this.$message.warning('鎺堟潈鍒楄〃涓虹┖锛�')
+ return;
+ }
+ let isRepeat = false;
+ // 閬嶅巻鏁扮粍锛屾瘮杈冨悗闈㈢殑瀵硅薄鐨剅oleData鏄惁涓庡墠闈㈢殑瀵硅薄鐩哥瓑
+ for (let i = 0; i < this.classifyAuthData.length - 1; i++) {
+ let currentRoleId = this.classifyAuthData[i].roleData;
+ for (let j = i + 1; j < this.classifyAuthData.length; j++) {
+ if (currentRoleId === this.classifyAuthData[j].roleData) {
+ isRepeat = true;
+ break;
+ }
+ }
+ if (isRepeat) {
+ break;
+ }
+ }
+ if (isRepeat) {
+ this.$message.warning("瑙掕壊鍜屽垎绫诲凡缁忓瓨鍦紝璇烽噸鏂伴厤缃紒");
+ return;
+ }
+ let form = [];
+ let flag = false;
+ this.classifyAuthData.forEach(item => {
+ let itemButtonList = [];
+ //绛涢�夊嚭鎸夐挳鍕鹃�変负true鐨勫垪
+ for (let key in item) {
+ if (item[key] === true) {
+ itemButtonList.push(key);
+ }
+ }
+ /**濡傛灉itemButtonList涓虹┖璇佹槑鏄紝
+ 娣诲姞浜嗚鑹蹭絾鏄病鍕鹃�変换浣曠殑鎸夐挳*/
+ if (itemButtonList.length <= 0) {
+ flag = true;
+ return;
+ }
+ let data = {
+ oid: item.oid,
+ roleId: item.roleData,
+ classifyId: this.classifyData.oid,
+ buttonIds: itemButtonList.join(","),
+ authType: "data_auth",
+ }
+ form.push(data);
+ });
+ if (flag) {
+ this.$message.warning('鏈夋湭鍕鹃�夋搷浣滅殑鏉冮檺锛屼笉鍏佽鎺堟潈')
+ return;
+ }
+ // console.log(form)
+ // 璋冪敤淇濆瓨鍒嗙被鎺堟潈鐨勬帴鍙�
+ saveOrUpdate(form).then(res => {
+ this.$message({
+ type: "success",
+ message: res.data.msg,
+ });
+ // this.isShowDialog = false
+ }, (error) => {
+ window.console.log(error);
+ })
+ },
+ // 鍏ㄩ�夋寜閽�
+ selectAllButton() {
+ if (this.selectList.length !== 1) {
+ this.$message.warning("璇峰彧閫夋嫨涓�琛岄渶瑕佸叏閫夌殑鎸夐挳鐨勬暟鎹锛�");
+ return;
+ }
+ this.classifyAuthButton.forEach(item => {
+ //console.log("item",item);
+ Vue.set(this.selectList[0], item.id, true);
+ });
+ //console.log("this.selectList",this.selectList);
+ },
+ },
+};
+</script>
+
+<style lang="scss" scoped>
+
+// 婊氬姩鏉℃牱寮忎慨鏀�
+// 婊氬姩鏉$殑瀹藉害
+/deep/ .el-table__body-wrapper::-webkit-scrollbar {
+ height: 15px; // 绾靛悜婊氬姩鏉� 蹇呭啓
+ background: white;
+ border: white;
+ width: 10px;
+
+}
+
+// 婊氬姩鏉$殑婊戝潡
+/deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
+ background-color: #ececec;
+ border-radius: 20px;
+ border: #ececec;
+}
+
+/deep/ .el-table__body-wrapper {
+ height: calc(100% - 50px) !important;
+}
+
+</style>
diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
index 9462ea6..d13d14f 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -277,7 +277,7 @@
<!-- 鍏ㄥ睆缂栬緫-->
<el-dialog :before-close="escEdit" :visible.sync="attrEditVisible" append-to-body fullscreen="true">
<attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :crudArrayFlag="this.crudArrayFlag"
- :editOpenFlag="editOpenFlag" :editStyleFlag="editStyleFlag"
+ :editOpenFlag="editOpenFlag" :editStyleFlag="editStyleFlag" :btnAuthList="btnAuthList"
@editCloseChildren="editClose"></attrCrud>
</el-dialog>
<!-- 缁勫悎瑙勫垯-->
@@ -1563,7 +1563,7 @@
...mapGetters(["permission"]),
permissionList() {
return {
- busineStatus: this.vaildData(this.btnAuthList.attr_add, false),
+ busineStatus: this.vaildData(this.btnAuthList.attr_add, false) ,
fullscreenStatus: this.vaildData(this.btnAuthList.attr_view_edit, false),
ruleStatus: this.vaildData(this.btnAuthList.attr_rule, false),
attrStatus: this.vaildData(this.btnAuthList.attr_group, false),
diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
index 6184ec2..24b45f4 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -6,7 +6,7 @@
<basic-container>
<div style="height: calc(100vh - 142px);!important;">
<div class="headerCon" style="display: flex; flex-wrap: wrap;margin-bottom: 5px">
- <el-button v-if="permissionList.TreeAddStatus" plain size="small" type="primary" @click="TreeAdd">娣诲姞
+ <el-button plain size="small" type="primary" @click="TreeAdd">娣诲姞
</el-button>
<el-button v-if="permissionList.TreeEditStatus" plain size="small" type="primary" @click="TreeEdit">淇敼
</el-button>
@@ -31,6 +31,10 @@
<el-button v-if="permissionList.classifyAuth" plain size="small"
style="width: 56px;text-align: center;padding-left: 3px" type="primary"
@click="classifyAuthHandler">鍒嗙被鎺堟潈
+ </el-button>
+ <el-button v-if="permissionList.classifyAuth" plain size="small"
+ style="width: 56px;text-align: center;padding-left: 3px" type="primary"
+ @click="dataAuthHandler">鏁版嵁鎺堟潈
</el-button>
</div>
<!-- 宸︿晶鏍�-->
@@ -116,6 +120,12 @@
:classifyData="classifyData"
:visible.sync="classifyAuthVisible"
></classify-auth-dialog>
+ <!-- 鏁版嵁鎺堟潈瀵硅瘽妗� -->
+ <data-auth-dialog
+ :classifyData="classifyData"
+ :visible.sync="dataAuthVisible"
+ :TreeNode="TreeEditObj"
+ ></data-auth-dialog>
</basic-container>
</el-aside>
<el-main>
@@ -386,13 +396,14 @@
BtmdialogVisible: false,
SelectOption: [
{
- value: 'name',
- label: '涓枃鍚嶇О'
+ value: 'id',
+ label: '鑻辨枃鍚嶇О',
},
{
- value: 'id',
- label: '鑻辨枃鍚嶇О'
+ value: 'name',
+ label: '涓枃鍚嶇О'
}
+
],
btmSelectOption: [
{
@@ -451,6 +462,8 @@
TreeAddFormVisible: false,
//鍒嗙被鎺堟潈瀵硅瘽妗�
classifyAuthVisible: false,
+ //鏁版嵁鎺堟潈瀵硅瘽妗�
+ dataAuthVisible: false,
//褰撳墠鐐瑰嚮椤�
nodeClickList: "",
ClonenodeClickList: "",
@@ -759,6 +772,15 @@
this.classifyData = this.nodeClickList;
this.classifyAuthVisible = true;
},
+ // 鏁版嵁鎺堟潈瀵硅瘽妗嗘墦寮�
+ dataAuthHandler() {
+ if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) {
+ this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒')
+ return;
+ }
+ this.classifyData = this.nodeClickList;
+ this.dataAuthVisible = true;
+ },
flowingDependHandler() {
if (this.nodeClickList.length <= 0) {
this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒')
@@ -855,7 +877,12 @@
getAttr() {
this.loading = true;
return new Promise((resolve, reject) => {
- getAtrrList()
+ let conditionMaps = {};
+ conditionMaps["conditionMap[authType]"] = "classify_auth";
+ conditionMaps["conditionMap[buttonCode]"] = "classifyTree";
+ // 鍒嗙被鎺堟潈涓槸鍚﹀叿澶囨煡鐪嬫潈闄�
+ conditionMaps["conditionMap[menuCode]"] = "classify_view";
+ getAtrrList(conditionMaps)
.then(res => {
this.Treedata = res.data;
this.CloneTreedata = res.data;
@@ -1115,7 +1142,7 @@
},
//鏍戠偣鍑讳簨浠�
async nodeClick(data) {
- getAuthButtonList({classifyId: data.oid}).then(res => {
+ getAuthButtonList({classifyId: data.oid,code: "classifyTree",authType: "classify_auth"}).then(res => {
this.btnAuthList = res.data.data;
}).catch(error => {
console.log(error)
diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
index 8c30e40..295ca05 100644
--- a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
+++ b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
@@ -189,45 +189,27 @@
@echoSelectedAttr="echoSelectedAttr">
</refer-select-btm-attr-dialog>
- <el-dialog title="閫夋嫨鏄剧ず瀛楁"
+ <el-dialog title="閫夊彇IN鎴朜OTIN鏉′欢"
append-to-body
- :visible.sync="isShowShowField"
+ :visible.sync="isShowInOrNotInCondition"
width="70%"
destroy-on-close
style="height: 110vh; margin-top: -12vh; overflow-y: hidden">
- <avue-crud :option="selectionShowFieldOption"
- :table-loading="selectShowFieldLoading"
- :data="selectShowFieldData"
- ref="selectShowFieldCrud"
- @row-click="showFieldRowClick"
- @selection-change="selectionShowFieldDataChange"
- @search-change="showFieldSearchChange"
- @search-reset="showFieldSearchReset">
+ <avue-crud :option="selectInOrNotInCondOption"
+ :page.sync="inOrNotInPage"
+ @current-change="inOrNotInCurrentChange"
+ @size-change="inOrNotInSizeChange"
+ @selection-change="selectionInOrNotInChange"
+ @row-click="rowInOrNotInClick"
+ @search-change="selectInOrNotInSearchChange"
+ @search-reset="searchInOrNotInReset"
+ :data="selectInOrNotInCondData"
+ ref="inOrNotInConditionCrud">
</avue-crud>
<div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="selectedShowField">纭� 瀹�</el-button>
- <el-button @click="isShowShowField = false">鍙� 娑�</el-button>
- </div>
- </el-dialog>
-
- <el-dialog title="閫夋嫨鏌ヨ鏉′欢"
- append-to-body
- :visible.sync="isShowSearchCondition"
- width="70%"
- destroy-on-close
- style="height: 110vh; margin-top: -12vh; overflow-y: hidden">
- <avue-crud :option="selectionSearchConditionOption"
- :table-loading="selectSearchConditionLoading"
- :data="selectSearchConditionData"
- ref="selectSearchConditionCrud"
- @row-click="searchConditionRowClick"
- @selection-change="searchConditionDataChange"
- @search-change="searchConditionSearchChange"
- @search-reset="searchConditionSearchReset">
- </avue-crud>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="selectedSearchCondition">纭� 瀹�</el-button>
- <el-button @click="isShowSearchCondition = false">鍙� 娑�</el-button>
+ <!-- <div class="avue-dialog__footer--left valueInfo">{{ valueInfo }}</div> -->
+ <el-button type="primary" @click="selectedInOrNotInCond">纭� 瀹�</el-button>
+ <el-button @click="isShowInOrNotInCondition = false">鍙� 娑�</el-button>
</div>
</el-dialog>
@@ -236,6 +218,7 @@
<script>
import func from "@/util/func";
+ import {getList} from "@/api/refer/table";
export default {
name: "referConfigFormDialog",
props: {
@@ -420,7 +403,7 @@
clearable: false,
dicData: [
{
- value: '_in', label: '瀛樺湪浜�'
+ value: '_in', label: '瀛樺湪浜�'
},{
value: '_notin', label: '涓嶅瓨鍦ㄤ簬'
},{
@@ -473,6 +456,37 @@
preClickAttrRow: '',
preClickAddSearchConditionRow: '',
+ //鐐瑰嚮琛屽脊鍑篿n鎴杗otin鐨勫��
+ isShowInOrNotInCondition: false,
+ selectInOrNotInCondData: [],
+ selectInOrNotInCondOption: {
+ height:'220',
+ tip: false,
+ addBtn: false,
+ editBtn: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: false,
+ index: true,
+ viewBtn: false,
+ delBtn: false,
+ selection: true,
+ disablePage: false,
+ refreshBtn: false,
+ columnBtn: false,
+ menu: false,
+ dialogClickModal: false,
+ highlightCurrentRow: true,
+ column: []
+ },
+ inOrNotInPage: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionInOrNotInList: [],
+ inOrNotInParam: {},
+
};
},
// 琛ㄥ崟鐣岄潰鏄剧ず鍐呭閰嶇疆
@@ -981,9 +995,78 @@
//console.log(this.codeShowFieldConfigVOS[this.preClickAttrRow.$index]);
this.form.codeSrchCondConfigVOS[this.preClickAddSearchConditionRow.$index].$cellEdit = false;
}
+ if(row.filterType === '_in' || row.filterType === '_notin'){
+ //console.log(row);
+ this.selectInOrNotInCondOption.column = [{
+ prop: row.filterField,
+ label: row.filterTypeText,
+ search: true,
+ searchLabelWidth: 45,
+ searchSpan: 8,
+ sortable: true,
+ }]
+ this.initPageData.pageSize = 10;
+ this.initPageData.currentPage = 1;
+ this.loadInOrNotInConditionData(this.initPageData);
+ this.isShowInOrNotInCondition = true;
+ }
row.$cellEdit = true;
this.preClickAddSearchConditionRow = row;
},
+ loadInOrNotInConditionData(page, params = {}){
+ let mustParams = {
+ referType: this.form.referType,
+ referBo: this.form.referType,
+ };
+ getList(Object.assign(mustParams,params),page.currentPage,page.pageSize,'/api/ubcs-code/mdmEngineController/defaultReferDataGrid','GET').then(res=>{
+ //console.log(res.data);
+ this.selectInOrNotInCondData = res.data.records;
+ this.inOrNotInPage.total = res.data.total;
+ });
+ },
+ inOrNotInCurrentChange(currentPage) {
+ this.inOrNotInPage.currentPage = currentPage;
+ },
+ inOrNotInSizeChange(pageSize) {
+ this.inOrNotInPage.pageSize = pageSize;
+ },
+ rowInOrNotInClick(row){
+ this.$refs.inOrNotInConditionCrud.toggleSelection();
+ this.$refs.inOrNotInConditionCrud.toggleRowSelection(row); //閫変腑褰撳墠琛�
+ },
+ selectionInOrNotInChange(list){
+ if (this.isMuti && list.length > 1) {
+ const nowVal = list.shift();
+ this.$refs.inOrNotInConditionCrud.toggleRowSelection(nowVal, false);
+ }
+ this.selectionInOrNotInList = list
+ },
+ selectedInOrNotInCond(){
+ if(this.selectionInOrNotInList && this.selectionInOrNotInList.length > 0){
+ // console.log(this.selectionInOrNotInList)
+ this.preClickAddSearchConditionRow.filterValue = this.selectionInOrNotInList.map(item => item[this.selectInOrNotInCondOption.column[0].prop]).join(',');
+ this.isShowInOrNotInCondition = false;
+ }
+ },
+ /** 鐐瑰嚮鎼滅储鍚庤Е鍙戣浜嬩欢 */
+ selectInOrNotInSearchChange(params, done) {
+ this.initPageData.currentPage = 1;
+ let requestData = {};
+ if(params) {
+ Object.keys(params).forEach((key)=>{
+ requestData["conditionMap" + "["+ key +"_like]"] = params[key].trim();
+ })
+ }
+ this.inOrNotInParam = requestData;
+ this.loadInOrNotInConditionData(this.initPageData,this.inOrNotInParam);
+ done();
+ },
+ /** 閲嶇疆浣嶅睘鎬ч�夊彇鍊艰〃鏍肩殑鎼滅储妗嗕箣鍚庣殑鍥炶皟 */
+ searchInOrNotInReset() {
+ this.inOrNotInParam = {};
+ this.loadInOrNotInConditionData(this.initPageData);
+ },
+
//涓婁竴涓〉闈㈠凡缁忛�変腑鍙傜収搴旂敤鐨勪笟鍔$被鍨嬬殑鎯呭喌锛屽拰涓婁竴娆″凡缁忛厤缃繃鍙傜収閰嶇疆鐨勬儏鍐典笅杩涜椤甸潰鍒濆鍖栨覆鏌�
initPageData(val){
// console.log(val.referConfig);
@@ -1263,4 +1346,13 @@
transition:opacity .0s !important;
}
+ /* .valueInfo {
+ float: left;
+ border: 1px solid #E9E7E7;
+ display: inline-block;
+ vertical-align: middle;
+ padding: 9px 15px;
+ line-height: 1;
+ } */
+
</style>
diff --git a/Source/UBCS-WEB/src/main.js b/Source/UBCS-WEB/src/main.js
index a25b4d7..917ff08 100644
--- a/Source/UBCS-WEB/src/main.js
+++ b/Source/UBCS-WEB/src/main.js
@@ -38,6 +38,7 @@
import classifyTrees from "@/components/Theme/ThemeClassifyTrees"
import classifyTreeform from "@/components/Theme/ThemeClassifyTreeform"
import classifyAuthDialog from "@/components/Theme/ClassifyAuthDialog"
+import dataAuthDialog from "@/components/Theme/DataAuthDialog"
import TemplatePro from "@/components/Theme/ThemeTemplatePro"
import attrCrud from "@/components/Theme/ThemeAttrCrud"
import formulaEditor from "@/components/code-dialog-page/formulaEditor"
@@ -100,6 +101,7 @@
Vue.component('originalLink',originalLink)
Vue.component('classifyTrees',classifyTrees)
Vue.component('classifyAuthDialog',classifyAuthDialog)
+Vue.component('dataAuthDialog',dataAuthDialog)
Vue.component('classifyTreeform',classifyTreeform)
Vue.component('TemplatePro',TemplatePro)
Vue.component('formulaEditor',formulaEditor)
diff --git a/Source/UBCS-WEB/src/option/system/dictbiz.js b/Source/UBCS-WEB/src/option/system/dictbiz.js
index ace45a3..0ac6855 100644
--- a/Source/UBCS-WEB/src/option/system/dictbiz.js
+++ b/Source/UBCS-WEB/src/option/system/dictbiz.js
@@ -1,6 +1,6 @@
export const optionParent = {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/option/system/param.js b/Source/UBCS-WEB/src/option/system/param.js
index e0b8447..cd1cc88 100644
--- a/Source/UBCS-WEB/src/option/system/param.js
+++ b/Source/UBCS-WEB/src/option/system/param.js
@@ -1,6 +1,6 @@
export default {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
tip: false,
searchShow: true,
searchMenuSpan: 6,
diff --git a/Source/UBCS-WEB/src/views/authority/role.vue b/Source/UBCS-WEB/src/views/authority/role.vue
index 6ac1858..9ad91ca 100644
--- a/Source/UBCS-WEB/src/views/authority/role.vue
+++ b/Source/UBCS-WEB/src/views/authority/role.vue
@@ -29,7 +29,7 @@
鍒� 闄�
</el-button>
<!-- v-if="userInfo.role_name.includes('admin')" -->
- <el-button v-if="permissionList.authSettingBtn"
+ <el-button v-if="permissionList.authSettingBtn"
size="small"
icon="el-icon-setting"
@click="handleRole"
@@ -115,6 +115,7 @@
option: {
height: "auto",
tip: false,
+ calcHeight: 20,
columnBtn:false,
// simplePage: true,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/code/Match.vue b/Source/UBCS-WEB/src/views/code/Match.vue
index 1713b75..4b79c58 100644
--- a/Source/UBCS-WEB/src/views/code/Match.vue
+++ b/Source/UBCS-WEB/src/views/code/Match.vue
@@ -101,8 +101,8 @@
findvisible: false,
selectRow: [],
option: {
- height: 700,
- calcHeight: 80,
+ height: 'auto',
+ calcHeight: 20,
tip: false,
searchShow: true,
searchMenuSpan: 6,
diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue
index 652c87d..8847b03 100644
--- a/Source/UBCS-WEB/src/views/code/code.vue
+++ b/Source/UBCS-WEB/src/views/code/code.vue
@@ -404,9 +404,7 @@
margin-top: 20px;
display: flex;
align-items: center;
- justify-content: center;
- "
- >
+ justify-content: center;">
<el-button
class="button"
icon="el-icon-circle-plus"
@@ -642,19 +640,35 @@
<el-form-item
:label-width="leftFormLabelWidth"
label="鍓嶇紑:">
- <el-input
+ <!-- <el-input
v-model="form.prefixCode"
:readonly="basicSecOnlyRead"
- ></el-input>
+ ></el-input> -->
+ <el-select v-model="form.prefixCode" :disabled="basicSecOnlyRead">
+ <el-option
+ v-for="(option, index) in preFixOrSuffixChars"
+ :key="index"
+ :label="option.label"
+ :value="option.value">
+ </el-option>
+ </el-select>
</el-form-item>
<el-form-item
:label-width="leftFormLabelWidth"
label="鍚庣紑:">
- <el-input
+ <!-- <el-input
v-model="form.suffixCode"
:readonly="basicSecOnlyRead">
- </el-input>
+ </el-input> -->
+ <el-select v-model="form.suffixCode" :disabled="basicSecOnlyRead">
+ <el-option
+ v-for="(option, index) in preFixOrSuffixChars"
+ :key="index"
+ :label="option.label"
+ :value="option.value">
+ </el-option>
+ </el-select>
</el-form-item>
<el-form-item :label-width="leftFormLabelWidth" label="鎻忚堪:">
@@ -838,13 +852,12 @@
:disabled="basicSecOnlyRead"
filterable
placeholder="璇烽�夋嫨"
- @blur="inputSelectBlur"
>
<el-option
v-for="item in enumParam.codeFillSeparator"
- :key="item.dictKey"
- :label="item.dictValue"
- :value="item.dictValue"
+ :key="item.lable"
+ :label="item.lable"
+ :value="item.value"
>
</el-option>
</el-select>
@@ -1144,13 +1157,12 @@
:disabled="basicSecOnlyRead"
filterable
placeholder="璇烽�夋嫨"
- @blur="inputSelectBlur"
>
<el-option
v-for="item in enumParam.codeFillSeparator"
- :key="item.dictKey"
- :label="item.dictValue"
- :value="item.dictValue"
+ :key="item.lable"
+ :label="item.lable"
+ :value="item.value"
>
</el-option>
</el-select>
@@ -1333,8 +1345,9 @@
deleteCodeClassifyValue,
saveCodeClassifyValueOrder,
} from "@/api/code/codeClassifyValue";
+import { getSelectList, getRegexStr } from "@/api/code/codeCharcter"
import {getDictionary} from "@/api/omd/enum";
-import {getDictionaryBiz} from "@/api/system/dictbiz";
+// import {getDictionaryBiz} from "@/api/system/dictbiz";
import optionBasic from "@/const/code/codebasic";
import optionRule from "@/const/code/mdmrule";
import attrOption from "@/const/code/selectAttrOptionDialog";
@@ -1682,6 +1695,9 @@
//寮曠敤鐮佹涓弬鐓ч厤缃粍浠剁浉鍏冲弬鏁�
referConfigOption: {},
referConfigVisble: false,
+
+ preFixOrSuffixChars: [], //鍓嶅悗缂�瀛楃鍒楄〃
+
};
},
computed: {
@@ -2001,9 +2017,12 @@
this.codeFixdForm.codeFixedSecOid = row.codefixedsecoid;
},
/** 鏂板鐮佸��*/
- addCodeSecValue(condition) {
+ async addCodeSecValue(condition) {
if (condition === "codefixedsec") {
if (!this.tipsCodeSecValueMessage(this.codeFixdForm.id)) {
+ return;
+ }
+ if(!await this.regexCharacter(this.codeFixdForm.id)){
return;
}
this.codeFixdForm.codeFixedSecOid = this.codefixedsecOrCodeclassifysec.oid;
@@ -2028,6 +2047,9 @@
if (!this.tipsCodeSecValueMessage(this.codeClassifyForm.id)) {
return;
}
+ if(!await this.regexCharacter(this.codeClassifyForm.id)){
+ return;
+ }
this.codeClassifyForm.codeClassifySecOid =
this.codefixedsecOrCodeclassifysec.oid;
addSaveCodeClassifyValue(this.codeClassifyForm).then(
@@ -2050,39 +2072,13 @@
);
}
},
- /** 娓呯┖鐮佸�艰〃鍗� */
- clearFixedOrClassifyForm(condition) {
- //鐐瑰嚮鍙栨秷鏃舵竻绌鸿〃鍗曚笌褰撳墠閫変腑鐨勭爜鍊硷紝骞剁鐢ㄦ寜閽�
- this.selectedFixedOrCodeclassifyValue = "";
- if (condition === "close") {
- this.codeFixdForm = this.$options.data().codeFixdForm;
- this.codeClassifyForm = this.$options.data().codeClassifyForm;
- }
- if (condition === "codefixedsec") {
- this.codeFixdForm.description = "";
- this.codeFixdForm.codeFixedSecOid = "";
- } else {
- this.codeClassifyForm = this.$options.data().codeClassifyForm;
- }
- },
- /** 娣诲姞鎴栦慨鏀圭爜鍊间箣鍓嶅鐮佸�奸暱搴︽牴鎹鍒欒繘琛屾牎楠� */
- tipsCodeSecValueMessage(id) {
- if (id.trim() == "") {
- this.$message.warning("鐮佸�间笉鑳戒负绌猴紒");
- return false;
- }
- if (id.trim().length > this.codefixedsecOrCodeclassifysec.codeSecLength) {
- this.$message.warning(
- "鐮佸�奸暱搴︿笉鑳藉ぇ浜�" + this.codefixedsecOrCodeclassifysec.codeSecLength
- );
- return false;
- }
- return true;
- },
/** 淇敼鐮佸�� */
- editCodeSecValue(condition) {
+ async editCodeSecValue(condition) {
if (condition == "codefixedsec") {
if (!this.tipsCodeSecValueMessage(this.codeFixdForm.id)) {
+ return;
+ }
+ if(!await this.regexCharacter(this.codeFixdForm.id)){
return;
}
//浠ュ墠鏄洿鎺ユ妸褰撳墠閫変腑琛岀殑鎵�鏈夋暟鎹兘杩涜鎻愪氦锛屼絾鍏跺疄鍙渶瑕佷紶杈撲竴浜涘繀瑕佸弬鏁板嵆鍙紝杩欏効鍋氫簡淇敼锛岄渶瑕佷紶鍏朵粬鍙傛暟鐨勮鑷娣诲姞
@@ -2112,6 +2108,9 @@
if (!this.tipsCodeSecValueMessage(this.codeClassifyForm.id)) {
return;
}
+ if(!await this.regexCharacter(this.codeFixdForm.id)){
+ return;
+ }
this.codeClassifyForm.oid =
this.selectedFixedOrCodeclassifyValue.attributes.oid;
// 鍒嗙被鐮佹锛屽瓙鍒嗙被鍜岀埗鍒嗙被涔嬮棿涓嶈兘鐩镐簰鏇存敼
@@ -2139,6 +2138,54 @@
}
);
}
+ },
+ /**
+ * 鍙敤瀛楃闆嗙爜鍊兼鍒欐牎楠�
+ * @return true:婊¤冻闄愬埗锛宖alse锛氫笉婊¤冻闄愬埗
+ */
+ async regexCharacter(str){
+ var regex = null;
+ // 鑾峰彇鍒伴厤缃ソ鐨勫彲鐢ㄥ瓧绗︽鍒�
+ await getRegexStr({codeRuleId: this.selectionList[0].oid,chartType: "charset"}).then(res=>{
+ // console.log(res.data.data);
+ regex = new RegExp(res.data.data);
+ });
+ // console.log(regex);
+ // console.log(regex.test(str));
+ if(regex != "" && !regex.test(str)){
+ this.$message.warning("娣诲姞鐨勭爜鍊兼湭鍦ㄥ彲鐢ㄥ瓧绗﹂泦涓厤缃紒");
+ return false;
+ }
+ return true;
+ },
+ /** 娓呯┖鐮佸�艰〃鍗� */
+ clearFixedOrClassifyForm(condition) {
+ //鐐瑰嚮鍙栨秷鏃舵竻绌鸿〃鍗曚笌褰撳墠閫変腑鐨勭爜鍊硷紝骞剁鐢ㄦ寜閽�
+ this.selectedFixedOrCodeclassifyValue = "";
+ if (condition === "close") {
+ this.codeFixdForm = this.$options.data().codeFixdForm;
+ this.codeClassifyForm = this.$options.data().codeClassifyForm;
+ }
+ if (condition === "codefixedsec") {
+ this.codeFixdForm.description = "";
+ this.codeFixdForm.codeFixedSecOid = "";
+ } else {
+ this.codeClassifyForm = this.$options.data().codeClassifyForm;
+ }
+ },
+ /** 娣诲姞鎴栦慨鏀圭爜鍊间箣鍓嶅鐮佸�奸暱搴︽牴鎹鍒欒繘琛屾牎楠� */
+ tipsCodeSecValueMessage(id) {
+ if (id.trim() == "") {
+ this.$message.warning("鐮佸�间笉鑳戒负绌猴紒");
+ return false;
+ }
+ if (id.trim().length > this.codefixedsecOrCodeclassifysec.codeSecLength) {
+ this.$message.warning(
+ "鐮佸�奸暱搴︿笉鑳藉ぇ浜�" + this.codefixedsecOrCodeclassifysec.codeSecLength
+ );
+ return false;
+ }
+ return true;
},
/** 鍒犻櫎鐮佸�� */
delCodeSecValue(condition) {
@@ -2335,7 +2382,6 @@
},
/** 涓婄Щ涓嬬Щ绛夋搷浣滅殑淇濆瓨*/
async saveCodeFixedOrClassifyValueOption(condition, editOrderNumdata) {
-
//淇濆瓨瀵瑰浐瀹氱爜娈电爜鍊肩殑涓婄Щ涓嬬Щ绉诲嚭绛夋搷浣�
if (condition == "fixedValue") {
let data = {
@@ -2810,7 +2856,18 @@
//console.log(this.form);
//涓篺orm缁戝畾鍊�
this.changeSectypeFormItems(condition == "add" ? null : row);
+ // 鑾峰彇鍓嶅悗缂�鍙敤瀛楃
+ this.loadPreOrSuffixChars();
+ // 琛ヤ綅鏃跺瓧绗�
+ // this.loadCodeFillSeparator();
this.addBasicCodeSettingBox = true;
+ },
+ /** 鑾峰彇鍓嶅悗缂�瀛楃 */
+ loadPreOrSuffixChars(){
+ getSelectList({codeRuleId: this.selectionList[0].oid,chartType: "prefix"}).then(res=>{
+ this.preFixOrSuffixChars = res.data.data;
+ // console.log(this.preFixOrSuffixChars);
+ })
},
/** 鏂板鍩虹鐮佹*/
async saveOrEditBasicCode() {
@@ -3343,12 +3400,12 @@
this.form.referConfig = "";
}
},
- /** 琛ヤ綅鏃剁殑瀛楃锛屽疄鐜板彲杈撳彲閫�*/
- inputSelectBlur(e) {
+ /** 琛ヤ綅鏃剁殑瀛楃锛屽疄鐜板彲杈撳彲閫� TODO:鍥犱负澧炲姞浜嗗彲鐢ㄥ瓧绗﹂泦鎺у埗锛屾墍浠ヨ繖鍎垮純鐢ㄤ簡鍙敤瀛楃闆嗙殑鏁堟灉*/
+ /*inputSelectBlur(e) {
if (e.target.value) {
this.form.codeFillSeparator = e.target.value;
}
- },
+ },*/
/** 鐮佹绫诲瀷鏀瑰彉鏃讹紝澧炲姞瀵瑰簲鐨刦orm琛ㄥ崟涓殑灞炴��*/
changeSectypeFormItems(row) {
//console.log(row)
@@ -3541,7 +3598,7 @@
if (enumCach == null) {
getDictionary({code: enumKey}).then((res) => {
enumCach = res.data.data;
- localStorage.setItem(enumKey, JSON.stringify(res.data.data));
+ localStorage.setItem(enumKey, JSON.stringify(enumCach));
});
}
return enumCach;
@@ -3551,7 +3608,7 @@
this.loadCodeSecType();
this.loadCodeSecLength();
this.loadCodeFillType();
- this.loadCodeFillSeparator();
+ // this.loadCodeFillSeparator();
this.loadCodeLevelType();
this.loadCodeCutType();
this.loadCodeGetValueType();
@@ -3570,15 +3627,14 @@
loadCodeFillSeparator() {
//let enumCach = JSON.parse(localStorage.getItem("codeFillSeparator"));
//if (enumCach == null) {
- getDictionaryBiz({code: "codeFillSeparator"}).then((res) => {
+ getSelectList({codeRuleId: this.selectionList[0].oid,chartType: "fillerChar"}).then((res) => {
this.enumParam.codeFillSeparator = res.data.data;
//console.log(this.enumParam.codeFillSeparator);
- localStorage.setItem(
- "codeFillSeparator",
- JSON.stringify(res.data.data)
- );
+ // localStorage.setItem(
+ // "codeFillSeparator",
+ // JSON.stringify(res.data.data)
+ // );
});
- //}
},
loadCodeLevelType() {
this.enumParam.codeLevelType = this.getLocalStorageEnum("codeLevelType") || [];
diff --git a/Source/UBCS-WEB/src/views/desk/notice.vue b/Source/UBCS-WEB/src/views/desk/notice.vue
index cd1a525..71e8485 100644
--- a/Source/UBCS-WEB/src/views/desk/notice.vue
+++ b/Source/UBCS-WEB/src/views/desk/notice.vue
@@ -53,7 +53,7 @@
selectionList: [],
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
dialogWidth: 950,
columnBtn:false,
tip: false,
diff --git a/Source/UBCS-WEB/src/views/docking/data.vue b/Source/UBCS-WEB/src/views/docking/data.vue
index 2118a26..6c651c6 100644
--- a/Source/UBCS-WEB/src/views/docking/data.vue
+++ b/Source/UBCS-WEB/src/views/docking/data.vue
@@ -87,7 +87,6 @@
data:[],
option: {
height:'auto',
- calcHeight: 0,
columnBtn:false,
tip: false,
searchShow: false,
diff --git a/Source/UBCS-WEB/src/views/flow/follow.vue b/Source/UBCS-WEB/src/views/flow/follow.vue
index f7d4b95..bcf406a 100644
--- a/Source/UBCS-WEB/src/views/flow/follow.vue
+++ b/Source/UBCS-WEB/src/views/flow/follow.vue
@@ -65,7 +65,7 @@
deleteReason: '',
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/flow/manager.vue b/Source/UBCS-WEB/src/views/flow/manager.vue
index a8c6a30..0e4db1b 100644
--- a/Source/UBCS-WEB/src/views/flow/manager.vue
+++ b/Source/UBCS-WEB/src/views/flow/manager.vue
@@ -121,7 +121,7 @@
}],
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/flow/model.vue b/Source/UBCS-WEB/src/views/flow/model.vue
index a32f017..466eeed 100644
--- a/Source/UBCS-WEB/src/views/flow/model.vue
+++ b/Source/UBCS-WEB/src/views/flow/model.vue
@@ -202,7 +202,7 @@
flowBox: false,
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/modeling/Version.vue b/Source/UBCS-WEB/src/views/modeling/Version.vue
index e837168..74baaf3 100644
--- a/Source/UBCS-WEB/src/views/modeling/Version.vue
+++ b/Source/UBCS-WEB/src/views/modeling/Version.vue
@@ -60,6 +60,7 @@
form: {},
option: {
height: 'auto',
+ calcHeight: 20,
headerAlign: 'center',
align: 'center',
border: true,
diff --git a/Source/UBCS-WEB/src/views/monitor/log/api.vue b/Source/UBCS-WEB/src/views/monitor/log/api.vue
index 5f43186..56024f0 100644
--- a/Source/UBCS-WEB/src/views/monitor/log/api.vue
+++ b/Source/UBCS-WEB/src/views/monitor/log/api.vue
@@ -36,7 +36,7 @@
},
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/monitor/log/error.vue b/Source/UBCS-WEB/src/views/monitor/log/error.vue
index 7e29bdd..a9dc542 100644
--- a/Source/UBCS-WEB/src/views/monitor/log/error.vue
+++ b/Source/UBCS-WEB/src/views/monitor/log/error.vue
@@ -36,7 +36,7 @@
},
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/monitor/log/operateLog.vue b/Source/UBCS-WEB/src/views/monitor/log/operateLog.vue
index a36e69b..e77e7d9 100644
--- a/Source/UBCS-WEB/src/views/monitor/log/operateLog.vue
+++ b/Source/UBCS-WEB/src/views/monitor/log/operateLog.vue
@@ -45,7 +45,7 @@
},
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/monitor/log/usual.vue b/Source/UBCS-WEB/src/views/monitor/log/usual.vue
index 1bb5eb4..a2bd6d1 100644
--- a/Source/UBCS-WEB/src/views/monitor/log/usual.vue
+++ b/Source/UBCS-WEB/src/views/monitor/log/usual.vue
@@ -36,7 +36,7 @@
},
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/report/reportlist.vue b/Source/UBCS-WEB/src/views/report/reportlist.vue
index e4aeebf..461c6f1 100644
--- a/Source/UBCS-WEB/src/views/report/reportlist.vue
+++ b/Source/UBCS-WEB/src/views/report/reportlist.vue
@@ -68,7 +68,7 @@
},
option: {
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
columnBtn:false,
tip: false,
searchShow: true,
diff --git a/Source/UBCS-WEB/src/views/resource/attach.vue b/Source/UBCS-WEB/src/views/resource/attach.vue
index 26c683b..03253a7 100644
--- a/Source/UBCS-WEB/src/views/resource/attach.vue
+++ b/Source/UBCS-WEB/src/views/resource/attach.vue
@@ -75,7 +75,7 @@
option: {
columnBtn:false,
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
tip: false,
searchShow: true,
searchMenuSpan: 6,
diff --git a/Source/UBCS-WEB/src/views/resource/oss.vue b/Source/UBCS-WEB/src/views/resource/oss.vue
index fd1690d..54bd5e2 100644
--- a/Source/UBCS-WEB/src/views/resource/oss.vue
+++ b/Source/UBCS-WEB/src/views/resource/oss.vue
@@ -80,7 +80,7 @@
option: {
columnBtn:false,
height: 'auto',
- calcHeight: 30,
+ calcHeight: 20,
tip: false,
searchShow: true,
searchMenuSpan: 6,
diff --git a/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue b/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue
index fe02374..0e5fb46 100644
--- a/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue
+++ b/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue
@@ -132,7 +132,7 @@
<script>
import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter"
-import {gridCodeRule} from "@/api/code/codeCharcter"
+import {gridCodeRule} from "@/api/code/mdmrule"
export default {
name: "usableCharacter",
@@ -195,7 +195,7 @@
async getCodeRule() {
try {
// 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮
- const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"});
+ const res = await gridCodeRule(1,-1);
this.characterReleasedList = res.data.data.records;
this.queryReleasedList = this.characterReleasedList;
this.select = this.characterReleasedList[0].oid;
diff --git a/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue b/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue
index 2786221..74897c3 100644
--- a/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue
+++ b/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue
@@ -132,7 +132,7 @@
<script>
import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter"
-import {gridCodeRule} from "@/api/code/codeCharcter"
+import {gridCodeRule} from "@/api/code/mdmrule"
export default {
name: "usableCharacter",
@@ -195,7 +195,7 @@
async getCodeRule() {
try {
// 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮
- const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"});
+ const res = await gridCodeRule(1,-1);
this.characterReleasedList = res.data.data.records;
this.queryReleasedList = this.characterReleasedList;
this.select = this.characterReleasedList[0].oid;
@@ -227,7 +227,7 @@
// const targetObject = this.characterReleasedList.find(obj => obj.oid === this.selectValue);
// const chartValue = targetObject.name;
getList({codeRuleId: this.select, chartType: "fillerChar", chartValue: this.characterValue}).then(res => {
- console.log(res.data.data);
+ // console.log(res.data.data);
this.tableData = res.data.data;
this.loading = false;
});
diff --git a/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue b/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue
index 7291218..9d83440 100644
--- a/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue
+++ b/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue
@@ -8,7 +8,7 @@
@change="selectHandler">
<el-option v-for="(item,index) in queryReleasedList"
:key="item.oid"
- :label="item.name"
+ :label="item.name + ' (' + item.id + ')'"
:value="item.oid"></el-option>
</el-select>
</div>
@@ -132,7 +132,7 @@
<script>
import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter"
-import {gridCodeRule} from "@/api/code/codeCharcter"
+import {gridCodeRule} from "@/api/code/mdmrule"
export default {
name: "usableCharacter",
@@ -194,8 +194,8 @@
},
async getCodeRule() {
try {
- // 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮
- const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"});
+ // 缂栫爜瑙勫垯宸插彂甯冿紙TODO:2024/1/22鏀癸細鎸夌収闇�姹傚簲璇ユ槸閮芥煡璇級鏁版嵁婧�
+ const res = await gridCodeRule(1,-1);
this.characterReleasedList = res.data.data.records;
this.queryReleasedList = this.characterReleasedList;
this.select = this.characterReleasedList[0].oid;
@@ -227,7 +227,7 @@
// const targetObject = this.characterReleasedList.find(obj => obj.oid === this.selectValue);
// const chartValue = targetObject.name;
getList({codeRuleId: this.select, chartType: "prefix", chartValue: this.characterValue}).then(res => {
- console.log(res.data.data);
+ // console.log(res.data.data);
this.tableData = res.data.data;
this.loading = false;
});
diff --git a/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue b/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue
index d832be8..5be2861 100644
--- a/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue
+++ b/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue
@@ -70,7 +70,7 @@
<script>
import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter"
-import {gridCodeRule} from "@/api/code/codeCharcter"
+import {gridCodeRule} from "@/api/code/mdmrule"
export default {
name: "usableCharacter",
@@ -136,7 +136,7 @@
async getCodeRule() {
try {
// 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮
- const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"});
+ const res = await gridCodeRule(1,-1);
this.characterReleasedList = res.data.data.records;
this.queryReleasedList = this.characterReleasedList;
this.select = this.characterReleasedList[0].oid;
diff --git a/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue b/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue
index 18325bc..f850c83 100644
--- a/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue
+++ b/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue
@@ -93,6 +93,8 @@
},
option() {
return {
+ height: 'auto',
+ calcHeight: 20,
headerAlign: 'center',
align: 'center',
columnBtn: false,
@@ -101,7 +103,6 @@
rowKey: 'id',
addBtn: this.permissionList.addBtn,
editBtn: false,
- height: 700,
delBtn: false,
refreshBtn: false,
column: [
diff --git a/Source/UBCS-WEB/src/views/system/client.vue b/Source/UBCS-WEB/src/views/system/client.vue
index 50b482f..b1bd0b8 100644
--- a/Source/UBCS-WEB/src/views/system/client.vue
+++ b/Source/UBCS-WEB/src/views/system/client.vue
@@ -51,7 +51,7 @@
option: {
height: 'auto',
columnBtn:false,
- calcHeight: 30,
+ calcHeight: 20,
tip: false,
searchShow: true,
searchMenuSpan: 6,
diff --git a/Source/UBCS-WEB/src/views/system/dept.vue b/Source/UBCS-WEB/src/views/system/dept.vue
index ce22ee0..8c166cf 100644
--- a/Source/UBCS-WEB/src/views/system/dept.vue
+++ b/Source/UBCS-WEB/src/views/system/dept.vue
@@ -77,6 +77,7 @@
lazy: true,
tip: false,
height:'auto',
+ calcHeight: 20,
maxHeight:600,
columnBtn:false,
//simplePage: true,
@@ -196,7 +197,7 @@
};
},
created() {
-
+
},
computed: {
...mapGetters(["userInfo", "permission"]),
diff --git a/Source/UBCS-WEB/src/views/system/tenant.vue b/Source/UBCS-WEB/src/views/system/tenant.vue
index b740917..7282f2b 100644
--- a/Source/UBCS-WEB/src/views/system/tenant.vue
+++ b/Source/UBCS-WEB/src/views/system/tenant.vue
@@ -231,7 +231,7 @@
return{
height: 'auto',
columnBtn:false,
- calcHeight: 30,
+ calcHeight: 20,
tip: false,
searchShow: true,
searchMenuSpan: 6,
diff --git a/Source/UBCS-WEB/src/views/system/user.vue b/Source/UBCS-WEB/src/views/system/user.vue
index 9fc25cd..e2892d9 100644
--- a/Source/UBCS-WEB/src/views/system/user.vue
+++ b/Source/UBCS-WEB/src/views/system/user.vue
@@ -434,7 +434,7 @@
option() {
return{
height:'auto',
- calcHeight: 80,
+ calcHeight: 70,
tip: false,
searchShow: true,
searchMenuSpan: 6,
diff --git a/Source/UBCS-WEB/vue.config.js b/Source/UBCS-WEB/vue.config.js
index 88122e0..7b17b10 100644
--- a/Source/UBCS-WEB/vue.config.js
+++ b/Source/UBCS-WEB/vue.config.js
@@ -30,8 +30,9 @@
// target: 'http://192.168.1.51:37000',
// target: 'http://dev.vci-tech.com:37000',
//yxc
- // target: 'http:// 192.168.0.100:37000',
- // target: 'http://192.168.0.105:37000',
+ // target: 'http:// 192.168.43.131:37000',
+ //ldc
+ // target: 'http://192.168.0.100:37000',
// target: 'http://192.168.0.103:37000',
// target: 'http://192.168.1.63:37000',
// target: 'http://192.168.3.7:37000',
diff --git a/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/entity/ClassifyAuth.java b/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/entity/ClassifyAuth.java
index bbc7c61..49fd723 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/entity/ClassifyAuth.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/entity/ClassifyAuth.java
@@ -9,7 +9,7 @@
import java.util.List;
/**
- * 鍒嗙被鎺堟潈鍙傛暟瀵硅薄
+ * 鍒嗙被鎺堟潈锛屾暟鎹巿鏉冨弬鏁板璞�
* @author ludc
* @date 2023/12/25 15:36
*/
@@ -40,4 +40,9 @@
*/
private String buttonIds;
+ /**
+ * 鎺堟潈绫诲瀷
+ */
+ private String authType;
+
}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClient.java b/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClient.java
index 29319f2..fd963c1 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClient.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClient.java
@@ -112,7 +112,7 @@
* @return List<Menu>
*/
@GetMapping(MENU_BUTTON)
- R<List<Menu>> getMenuButtonByType(@RequestParam("btmType") String btmType);
+ R<List<Menu>> getMenuButtonByType(@RequestParam("classifyId") String classifyId,@RequestParam("btmType") String btmType,@RequestParam("authType") String authType);
/**
* 鑾峰彇閮ㄩ棬
@@ -392,6 +392,6 @@
R<List<String>> getRegexByList(@RequestBody List<String> combinationIds);
@GetMapping(GETVIEWCLASSIFY)
- R<List<String>> getViewClassByRoleIds(@RequestParam("roleIds") List<String> roleIds);
+ R<List<String>> getViewClassByRoleIds(@RequestParam("roleIds") List<String> roleIds,@RequestParam("authType") String authType,@RequestParam("buttonCode") String buttonCode,@RequestParam("menuCode") String menuCode);
}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClientFallback.java b/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClientFallback.java
index d88ac80..03ffadf 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClientFallback.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/feign/ISysClientFallback.java
@@ -48,7 +48,7 @@
}
@Override
- public R<List<Menu>> getMenuButtonByType(String btmType) {
+ public R<List<Menu>> getMenuButtonByType(String classifyId, String btmType, String authType) {
return R.fail("鑾峰彇鏁版嵁澶辫触");
}
@@ -200,9 +200,8 @@
}
@Override
- public R<List<String>> getViewClassByRoleIds(List<String> roleIds) {
+ public R<List<String>> getViewClassByRoleIds(List<String> roleIds,String authType,String buttonCode,String menuCode) {
return R.fail("鑾峰彇鏁版嵁澶辫触");
}
-
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java
index 9b44d22..67b2d73 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java
@@ -14,6 +14,7 @@
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -126,7 +127,7 @@
@PostMapping("/saveOrder")
public R batchSave4Order(@RequestBody Map<String,Object> param){
JSONArray json = JSONArray.parseArray(String.valueOf(param.get("dtoList")));
- List<CodeFixedValueDTO> dtoList = new ArrayList<>();
+ List<CodeFixedValueDTO> dtoList = new ArrayList<>();
for (int i = 0; i < json.size(); i++) {
CodeFixedValueDTO codeFixedValueDTO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(json.get(i))), CodeFixedValueDTO.class);
dtoList.add(codeFixedValueDTO);
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java
index 5d6b29a..8cac5e8 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java
@@ -6,6 +6,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
+import java.rmi.ServerException;
import java.util.List;
import java.util.Map;
@@ -17,8 +18,10 @@
@RestController
@RequestMapping("/codeRuleCharacterController")
public class CodeRuleCharacterController {
+
@Resource
private ICodeRuleCharacterService iCodeRuleCharacterService;
+
/**
* 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁
* @param codeRuleId 瑙勫垯oid
@@ -28,6 +31,27 @@
public R<List<Map<String,String>>> getDataByOid(@RequestParam("codeRuleId")String codeRuleId,@RequestParam("chartType")String chartType){
return R.data(iCodeRuleCharacterService.getDataByRuleId(codeRuleId,chartType));
}
+
+ /**
+ * 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁涓嬫媺鏁版嵁婧�
+ * @param codeRuleId 瑙勫垯oid
+ * @return 鏁版嵁鍐呭
+ */
+ @GetMapping("/selectList")
+ public R<List<Map<String, String>>> getSelectListByRuleId(@RequestParam("codeRuleId")String codeRuleId,@RequestParam("chartType")String chartType) throws ServerException {
+ return R.data(iCodeRuleCharacterService.getSelectListByRuleId(codeRuleId,chartType));
+ }
+
+ /**
+ * 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁涓嬫媺鏁版嵁婧�
+ * @param codeRuleId 瑙勫垯oid
+ * @return 鏁版嵁鍐呭
+ */
+ @GetMapping("/getRegexStr")
+ public R<String> getRegexStrByCodeRuleId(@RequestParam("codeRuleId")String codeRuleId,@RequestParam("chartType")String chartType) throws ServerException {
+ return R.data(iCodeRuleCharacterService.getRegexStrByCodeRuleId(codeRuleId,chartType));
+ }
+
/**
* 淇濆瓨瑙勫垯瀵硅薄
* @param codeRuleCharacterVO 瑙勫垯瀛楃瀵硅薄
@@ -37,6 +61,7 @@
public R addSave(@RequestBody CodeRuleCharacterVO codeRuleCharacterVO){
return iCodeRuleCharacterService.saveOrUpdate(codeRuleCharacterVO,1);
}
+
/**
* 淇敼瑙勫垯瀵硅薄
* @param codeRuleCharacterVO 瑙勫垯瀛楃瀵硅薄
@@ -56,4 +81,5 @@
public R delete(@RequestBody CodeRuleCharacterVO codeRuleCharacterVO){
return iCodeRuleCharacterService.saveOrUpdate(codeRuleCharacterVO,3);
}
+
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
index 5ea88bb..268199c 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeClassifyService.java
@@ -134,14 +134,14 @@
* @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄
* @return 涓婚搴撳垎绫绘樉绀烘爲
*/
- List<Tree> referTree(TreeQueryObject treeQueryObject);
+ List<Tree> referTree(TreeQueryObject treeQueryObject) throws ServiceException;
/**
* 鏌ヨ涓婚搴撳垎绫� 鏍�
* @param treeQueryObject 鏍戞煡璇㈠璞�
* @return 涓婚搴撳垎绫� 鏄剧ず鏍�
*/
- List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject);
+ List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) throws ServiceException;
/**
* 瀵煎嚭鍒嗙被
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java
index f91c7cd..3c6c6dd 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java
@@ -10,6 +10,7 @@
import com.vci.ubcs.starter.exception.VciBaseException;
import org.springblade.core.tool.api.R;
+import java.rmi.ServerException;
import java.util.List;
import java.util.Map;
@@ -29,6 +30,24 @@
*/
List<Map<String,String>> getDataByRuleId(String codeRuleId,String chartType)throws VciBaseException;
+ /**
+ * 涓嬫媺鏁版嵁婧�
+ * @param codeRuleId
+ * @param chartType
+ * @return
+ * @throws VciBaseException
+ */
+ List<Map<String, String>> getSelectListByRuleId(String codeRuleId,String chartType) throws ServerException;
+
+ /**
+ * 瀛楃闆嗘鍒欐嫾瑁�
+ * @param codeRuleId
+ * @param chartType
+ * @return
+ * @throws VciBaseException
+ */
+ String getRegexStrByCodeRuleId(String codeRuleId,String chartType) throws ServerException;
+
/***
* 淇濆瓨缂栫爜瑙勫垯瀛楃闆�
* @param codeRuleCharacterVO
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
index ad4b63b..aced92e 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -71,6 +71,7 @@
import java.awt.event.ItemEvent;
import java.io.File;
import java.util.*;
+import java.util.concurrent.ForkJoinPool;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -116,6 +117,7 @@
@Resource
private CodeBasicSecMapper codeBasicSecMapper;
+
/**
* 涓婄骇鑺傜偣鐨勫睘鎬у悕绉�
*/
@@ -510,7 +512,7 @@
* @return 涓婚搴撳垎绫绘樉绀烘爲
*/
@Override
- public List<Tree> referTree(TreeQueryObject treeQueryObject) {
+ public List<Tree> referTree(TreeQueryObject treeQueryObject) throws ServiceException{
if(treeQueryObject == null){
treeQueryObject = new TreeQueryObject();
}
@@ -520,7 +522,7 @@
if(treeQueryObject.getConditionMap().containsKey(LC_STATUS)) {
treeQueryObject.getConditionMap().remove(LC_STATUS);
}
- if(treeQueryObject.getExtandParamsMap() ==null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) {
+ if(treeQueryObject.getExtandParamsMap() == null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) {
}
treeQueryObject.getConditionMap().put(LC_STATUS, FRAMEWORK_DATA_ENABLED);
return treeCodeClassify(treeQueryObject);
@@ -550,7 +552,7 @@
* @return 涓婚搴撳垎绫� 鏄剧ず鏍�
*/
@Override
- public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) {
+ public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) throws ServiceException{
List<CodeClassify> doList = null;
String id = null;
String lcStatus = null;
@@ -578,33 +580,35 @@
List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList);
TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME);
treeWrapperOptions.copyFromTreeQuery(treeQueryObject);
- List<Tree> tree= revisionModelUtil.doList2Trees(voList,treeWrapperOptions,(CodeClassifyVO s) ->{
+ List<Tree> tree = revisionModelUtil.doList2Trees(voList,treeWrapperOptions,(CodeClassifyVO s) ->{
//鍙互鍦ㄨ繖閲屽鐞嗘爲鑺傜偣鐨勬樉绀�
return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s
.getLcStatus()) ? (" 銆愬仠鐢ㄣ�� ") : "");
});
- //瓒呯鏄剧ず鎵�鏈夊垎绫�
- if(VciBaseUtil.checkAdminTenant()){
- Iterator var6 = tree.listIterator();
- while(var6.hasNext()){
- Tree trees = (Tree) var6.next();
- boolean checkHasChild=codeClassifyMapper.checkHasChild(trees.getOid());
- if(checkHasChild){
- trees.setLeaf(false);
- }else{
- trees.setLeaf(true);
- }
- }
- }else {
+ // 闈炶秴绠¤繃婊ゆ湭鎺堟潈鐨勫垎绫�
+ if(!VciBaseUtil.checkAdminTenant()){
// 閭d簺鍒嗙被鍏峰鏌ョ湅鏉冮檺
- R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds(Arrays.asList(AuthUtil.getUser().getRoleId().split(",")));
+ R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds(
+ Arrays.asList(AuthUtil.getUser().getRoleId().split(",")),
+ treeQueryObject.getConditionMap().getOrDefault("authType","classify_auth"),
+ treeQueryObject.getConditionMap().getOrDefault("buttonCode","classify_view"),
+ treeQueryObject.getConditionMap().getOrDefault("menuCode","classifyTree")
+ );
// 璇锋眰澶辫触鎴栬�呰姹傚緱鍒扮殑鍏峰鏌ョ湅鏉冮檺鐨勫垎绫籭d闆嗗悎涓虹┖
- if(!viewClassByRoleIds.isSuccess() && !viewClassByRoleIds.getData().isEmpty()){
- return new ArrayList<>();
+ if(!viewClassByRoleIds.isSuccess() && viewClassByRoleIds.getData().isEmpty()){
+ throw new ServiceException("涓绘暟鎹煡鐪嬫潈闄愭湭閰嶇疆锛屾垨閰嶇疆鏈夎锛�");
}
+ long startTime = System.currentTimeMillis();
// 杩囨护
filterTreeNodes(tree,viewClassByRoleIds.getData());
+ long endTime = System.currentTimeMillis();
+ System.out.println(("鎵ц鏃堕棿锛�"+(endTime-startTime)/1000)+"s");
}
+ // 鍔犺浇鍒嗙被鏄惁鍏锋湁瀛愬垎绫�
+ tree.parallelStream().forEach(item -> {
+ boolean checkHasChild = checkHasChild(item.getOid());
+ item.setLeaf(!checkHasChild);
+ });
return tree;
}
@@ -617,8 +621,8 @@
Iterator<Tree> iterator = trees.iterator();
while (iterator.hasNext()) {
Tree tree = iterator.next();
- Boolean checkHasChild = codeClassifyMapper.checkHasChild(tree.getOid());
- tree.setLeaf(!checkHasChild);
+ /*Boolean checkHasChild = checkHasChild(tree.getOid());
+ tree.setLeaf(!checkHasChild);*/
if (classifyIds.contains(tree.getOid())) {
// 濡傛灉椤跺眰鑺傜偣瀛樺湪浜� classifyIds 涓紝鐩存帴淇濈暀鍏跺瓙鑺傜偣闆嗗悎
continue;
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 c26a219..e46394a 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
@@ -343,6 +343,9 @@
List<CodeFixedValue> doList = codeFixedValueMapper.selectList(Wrappers.<CodeFixedValue>query()
.lambda().eq(CodeFixedValue::getCodeFixedSecOid,codefixedsecoid)
);
+ if(doList.isEmpty()){
+ return false;
+ }
boolean resBoolean = codeFixedValueMapper.deleteBatchIds(doList.stream().map(CodeFixedValue::getOid).collect(Collectors.toList())) > 0;
return resBoolean;
}
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java
index edff3be..bdd4be6 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java
@@ -1,6 +1,5 @@
package com.vci.ubcs.code.service.impl;
-import com.alibaba.nacos.common.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,14 +9,15 @@
import com.vci.ubcs.code.service.ICodeRuleCharacterService;
import com.vci.ubcs.code.vo.pagemodel.CodeRuleCharacterVO;
import com.vci.ubcs.starter.exception.VciBaseException;
-import com.vci.ubcs.starter.poi.bo.SheetRowData;
import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
+import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.rmi.ServerException;
import java.util.*;
import java.util.stream.Collectors;
@@ -27,10 +27,11 @@
* @date 2023-11-30
*/
@Service
+@AllArgsConstructor
public class CodeRuleCharacterServiceImpl extends ServiceImpl<CodeRuleCharacterMapper, CodeRuleCharacter> implements ICodeRuleCharacterService {
- @Autowired
- private CodeRuleCharacterMapper codeRuleCharacterMapper;
+ private final CodeRuleCharacterMapper codeRuleCharacterMapper;
+
/***
* 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁
* @param codeRuleId
@@ -57,9 +58,44 @@
charValueList.add(chartMap);
}
}
-
return charValueList;
}
+
+ /***
+ * 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁
+ * @param codeRuleId
+ * @param chartType
+ * @return
+ * @throws VciBaseException
+ */
+ @Override
+ public List<Map<String, String>> getSelectListByRuleId(String codeRuleId,String chartType) throws ServerException {
+ List<Map<String, String>> charValueMap = new ArrayList<>();
+ CodeRuleCharacter codeRuleCharacter=codeRuleCharacterMapper.selectOne(Wrappers.<CodeRuleCharacter>query().lambda().eq(CodeRuleCharacter::getCodeRuleId,codeRuleId).eq(CodeRuleCharacter::getChartType,chartType));
+ if(codeRuleCharacter!=null&&StringUtils.isNotBlank(codeRuleCharacter.getOid())){
+ List<Character> characterList=codeRuleCharacter.getChartValue().chars().mapToObj(c -> (char) c).collect(Collectors.toList());
+ characterList.stream().forEach(item->{
+ Map<String, String> map = new HashMap<>();
+ map.put("lable",item.toString());
+ map.put("value",item.toString());
+ charValueMap.add(map);
+ });
+ }
+ return charValueMap;
+ }
+
+ @Override
+ public String getRegexStrByCodeRuleId(String codeRuleId, String chartType) throws ServerException {
+ StringBuilder regexStr = new StringBuilder();
+ CodeRuleCharacter codeRuleCharacter=codeRuleCharacterMapper.selectOne(Wrappers.<CodeRuleCharacter>query().lambda().eq(CodeRuleCharacter::getCodeRuleId,codeRuleId).eq(CodeRuleCharacter::getChartType,chartType));
+ if(codeRuleCharacter!=null&&StringUtils.isNotBlank(codeRuleCharacter.getOid())){
+ regexStr.append("^[");
+ regexStr.append(codeRuleCharacter.getChartValue());
+ regexStr.append("]+$");
+ }
+ return regexStr.toString();
+ }
+
/***
* 瀛楃闆嗘暟鎹繚瀛�
* @param codeRuleCharacterVO
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 c536b4f..8c7b56b 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
@@ -164,186 +164,186 @@
@Value("${bzApply.yearSecName:骞翠唬鍙穧")
private String yearSecName;
- /**
- * 妯℃澘鐨勬湇鍔�
- */
- @Resource
- private ICodeClstemplateService templateService;
+ /**
+ * 妯℃澘鐨勬湇鍔�
+ */
+ @Resource
+ private ICodeClstemplateService templateService;
- /**
- * 鐢熸垚缂栫爜鐨勬湇鍔�
- */
- @Resource
- private MdmProductCodeService productCodeService;
+ /**
+ * 鐢熸垚缂栫爜鐨勬湇鍔�
+ */
+ @Resource
+ private MdmProductCodeService productCodeService;
- /**
- * 鍙緭鍙�夌殑鏈嶅姟
- */
- @Resource
- IDictBizClient iDictBizClient;
- /**
- * 绯荤粺鐨勬湇鍔�
- */
- @Resource
- ISysClient iSysClient;
- /**
- * 瀵嗙骇鏈嶅姟
- */
- @Resource
- private IWebSecretClient secretService;
- /**
- * 鐢ㄦ埛鏈嶅姟
- */
- @Resource
- IUserClient iUserClient;
- /**
- * 瀛楀吀鐨勬湇鍔�
- */
- @Resource
- IEnumClient enumClient;
+ /**
+ * 鍙緭鍙�夌殑鏈嶅姟
+ */
+ @Resource
+ IDictBizClient iDictBizClient;
+ /**
+ * 绯荤粺鐨勬湇鍔�
+ */
+ @Resource
+ ISysClient iSysClient;
+ /**
+ * 瀵嗙骇鏈嶅姟
+ */
+ @Resource
+ private IWebSecretClient secretService;
+ /**
+ * 鐢ㄦ埛鏈嶅姟
+ */
+ @Resource
+ IUserClient iUserClient;
+ /**
+ * 瀛楀吀鐨勬湇鍔�
+ */
+ @Resource
+ IEnumClient enumClient;
/**
* 鐗堟湰瑙勫垯鏈嶅姟
*/
@Resource
private IRevisionRuleClient revisionRuleClient;
- /**
- * 鍏紡鐨勬湇鍔�
- */
- @Autowired
- private FormulaServiceImpl formulaService;
+ /**
+ * 鍏紡鐨勬湇鍔�
+ */
+ @Autowired
+ private FormulaServiceImpl formulaService;
- /**
- * 瀵筼md涓彁渚涚殑feign鎺ュ彛杩涜璋冪敤锛屼互鍙婂鐞嗙浉鍏抽�昏緫
- */
- @Autowired
- ICodeReferBtmTypeService codeReferBtmTypeService;
+ /**
+ * 瀵筼md涓彁渚涚殑feign鎺ュ彛杩涜璋冪敤锛屼互鍙婂鐞嗙浉鍏抽�昏緫
+ */
+ @Autowired
+ ICodeReferBtmTypeService codeReferBtmTypeService;
- /**
- * 鐩镐技椤规煡璇㈣鍒�
- */
- @Autowired
- private ICodeResembleRuleService resembleRuleService;
+ /**
+ * 鐩镐技椤规煡璇㈣鍒�
+ */
+ @Autowired
+ private ICodeResembleRuleService resembleRuleService;
- /**
- * 瀵硅薄鐨勬搷浣�
- */
- @Autowired
- private RevisionModelUtil revisionModelUtil;
+ /**
+ * 瀵硅薄鐨勬搷浣�
+ */
+ @Autowired
+ private RevisionModelUtil revisionModelUtil;
- /**
- * 闃舵鐨勬湇鍔�
- */
- @Autowired
- private ICodePhaseAttrService phaseAttrService;
- /**
- * 涓氬姟绫诲瀷鐨勬湇鍔�
- */
- @Autowired
- private IBtmTypeClient btmTypeClient;
+ /**
+ * 闃舵鐨勬湇鍔�
+ */
+ @Autowired
+ private ICodePhaseAttrService phaseAttrService;
+ /**
+ * 涓氬姟绫诲瀷鐨勬湇鍔�
+ */
+ @Autowired
+ private IBtmTypeClient btmTypeClient;
- /**
- * 閫氱敤鏌ヨ
- */
- @Resource
- private CommonsMapper commonsMapper;
+ /**
+ * 閫氱敤鏌ヨ
+ */
+ @Resource
+ private CommonsMapper commonsMapper;
- /**
- * 缂栫爜瑙勫垯鐨勬湇鍔�
- */
- @Autowired
- private ICodeRuleService ruleService;
- /**
- * 缂栫爜瑙勫垯鐨勬湇鍔�
- */
- @Autowired
- private ICodeAllCodeService codeAllCodeService;
+ /**
+ * 缂栫爜瑙勫垯鐨勬湇鍔�
+ */
+ @Autowired
+ private ICodeRuleService ruleService;
+ /**
+ * 缂栫爜瑙勫垯鐨勬湇鍔�
+ */
+ @Autowired
+ private ICodeAllCodeService codeAllCodeService;
- /**
- * 鍒嗙被鐮佸�肩殑鏈嶅姟
- */
- @Autowired
- private ICodeClassifyValueService classifyValueService;
+ /**
+ * 鍒嗙被鐮佸�肩殑鏈嶅姟
+ */
+ @Autowired
+ private ICodeClassifyValueService classifyValueService;
- /**
- * 鍒嗙被鐨勬湇鍔�
- */
- @Resource
- private ICodeClassifyService classifyService;
+ /**
+ * 鍒嗙被鐨勬湇鍔�
+ */
+ @Resource
+ private ICodeClassifyService classifyService;
- /**
- * 妯℃澘鎸夐挳鏈嶅姟
- */
- @Autowired
- private ICodeClassifyTemplateButtonService templateButtonService;
+ /**
+ * 妯℃澘鎸夐挳鏈嶅姟
+ */
+ @Autowired
+ private ICodeClassifyTemplateButtonService templateButtonService;
- @Autowired
- private ICodeClassifyTemplateAttrService codeClassifyTemplateAttrService;
+ @Autowired
+ private ICodeClassifyTemplateAttrService codeClassifyTemplateAttrService;
// /**
// * 鐢ㄦ埛鏌ヨ鐨勬湇鍔�,闇�瑕侀棶涓�涓嬫槸鍚﹂渶瑕侀噸鍐欙紝浣跨敤鏌ヨ姝ゅ钩鍙扮殑鐢ㄦ埛琛�
// */
// @Autowired
// private SmUserQueryServiceI userQueryService;
- /**
- * 鍏抽敭灞炴�х殑閰嶇疆
- */
- @Autowired
- private ICodeKeyAttrRepeatService keyRuleService;
- /**
- * 鏃ュ織
- */
- private Logger logger = LoggerFactory.getLogger(getClass());
+ /**
+ * 鍏抽敭灞炴�х殑閰嶇疆
+ */
+ @Autowired
+ private ICodeKeyAttrRepeatService keyRuleService;
+ /**
+ * 鏃ュ織
+ */
+ private Logger logger = LoggerFactory.getLogger(getClass());
- /**
- * 绌烘牸
- */
- public static final String SPACE = " ";
+ /**
+ * 绌烘牸
+ */
+ public static final String SPACE = " ";
- /**
- * 缂撳瓨锝嬶絽锝�
- */
- public static final String BTM_INIT_CACHE = "ubcs-code:btm";
- /**
- *
- */
- public static final String BTM_NAME = "btm:name";
+ /**
+ * 缂撳瓨锝嬶絽锝�
+ */
+ public static final String BTM_INIT_CACHE = "ubcs-code:btm";
+ /**
+ *
+ */
+ public static final String BTM_NAME = "btm:name";
- /**
- * 瀵嗙骇鐨勫瓧娈�
- */
- public static final String SECRET_FILED = "secretgrade";
- /**
- * 鐢ㄦ埛鏂板鏁版嵁鐨勬椂鍊欏彲浠ユ煡鐪嬬殑瀵嗙骇
- */
- public static final String MY_DATA_SECRET = "myDataSecret";
- /**
- * 鎷疯礉鐨勭増鏈�
- */
- public static final String COPY_FROM_VERSION = "copyfromversion";
- /**
- * 鍙槸sql
- */
- public static final String ONLY = "${vcionly}";
+ /**
+ * 瀵嗙骇鐨勫瓧娈�
+ */
+ public static final String SECRET_FILED = "secretgrade";
+ /**
+ * 鐢ㄦ埛鏂板鏁版嵁鐨勬椂鍊欏彲浠ユ煡鐪嬬殑瀵嗙骇
+ */
+ public static final String MY_DATA_SECRET = "myDataSecret";
+ /**
+ * 鎷疯礉鐨勭増鏈�
+ */
+ public static final String COPY_FROM_VERSION = "copyfromversion";
+ /**
+ * 鍙槸sql
+ */
+ public static final String ONLY = "${vcionly}";
- /**
- * 榛樿鐨勬椂闂存牸寮�
- */
- private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss";
+ /**
+ * 榛樿鐨勬椂闂存牸寮�
+ */
+ private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss";
- /**
- * 鏃ユ湡鏍煎紡
- */
- private static final String DATE_FORMAT = "yyyy-mm-dd";
+ /**
+ * 鏃ユ湡鏍煎紡
+ */
+ private static final String DATE_FORMAT = "yyyy-mm-dd";
- /**
- * 蹇呰緭
- */
- public static final String REQUIRED_CHAR = "*";
- /**
- * 鏇挎崲瀛楃
- */
- public static final String SPECIAL_CHAR = "VCI";
+ /**
+ * 蹇呰緭
+ */
+ public static final String REQUIRED_CHAR = "*";
+ /**
+ * 鏇挎崲瀛楃
+ */
+ public static final String SPECIAL_CHAR = "VCI";
/**
* 涓绘暟鎹祦绋嬮樁娈垫湇鍔�
*/
@@ -360,66 +360,66 @@
private SaveLogUtil saveLogUtil;
- /**
- * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @return 妯℃澘鐨勬樉绀哄璞�
- */
- @Override
- public CodeClassifyTemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid) {
- return getUsedTemplateByClassifyOid(codeClassifyOid, true);
- }
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 妯℃澘鐨勬樉绀哄璞�
+ */
+ @Override
+ public CodeClassifyTemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid) {
+ return getUsedTemplateByClassifyOid(codeClassifyOid, true);
+ }
- /**
- * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @param hasAttr 鍖呭惈灞炴��
- * @return 妯℃澘鐨勬樉绀哄璞�
- */
- @Override
- public CodeClassifyTemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr) {
- List<CodeClassifyTemplateVO> templateVOs = templateService.listReleaseTemplateByClassifyOid(codeClassifyOid, hasAttr);
- return templateVOs.get(templateVOs.size() - 1);
- }
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param hasAttr 鍖呭惈灞炴��
+ * @return 妯℃澘鐨勬樉绀哄璞�
+ */
+ @Override
+ public CodeClassifyTemplateVO getUsedTemplateByClassifyOid(String codeClassifyOid, boolean hasAttr) {
+ List<CodeClassifyTemplateVO> templateVOs = templateService.listReleaseTemplateByClassifyOid(codeClassifyOid, hasAttr);
+ return templateVOs.get(templateVOs.size() - 1);
+ }
- /**
- * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」
- *
- * @param attrVO 妯℃澘灞炴�х殑瀵硅薄
- * @return 涓嬫媺閫夐」
- */
- @Override
- public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) {
- List<KeyValue> comboboxKVs = new ArrayList<>();
- if (StringUtils.isNotBlank(attrVO.getEnumString())) {
- comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class);
- } else {
+ /**
+ * 鑾峰彇鏋氫妇鐨勪笅鎷夐�夐」
+ *
+ * @param attrVO 妯℃澘灞炴�х殑瀵硅薄
+ * @return 涓嬫媺閫夐」
+ */
+ @Override
+ public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) {
+ List<KeyValue> comboboxKVs = new ArrayList<>();
+ if (StringUtils.isNotBlank(attrVO.getEnumString())) {
+ comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class);
+ } else {
// comboboxKVs = enumService.getEnum(attrVO.getEnumid());
// Dict dict = new Dict();
// dict.setParentId(Long.valueOf(attrVO.getEnumid()));
- R<List<EnumVO>> list = enumClient.getList(attrVO.getEnumId());
- if (list.isSuccess()) {
- for (EnumVO datum : list.getData()) {
- KeyValue keyValue = new KeyValue();
- keyValue.setKey(datum.getItemValue());
- keyValue.setValue(datum.getItemName());
- comboboxKVs.add(keyValue);
- }
- }
- }
- return comboboxKVs;
- }
+ R<List<EnumVO>> list = enumClient.getList(attrVO.getEnumId());
+ if (list.isSuccess()) {
+ for (EnumVO datum : list.getData()) {
+ KeyValue keyValue = new KeyValue();
+ keyValue.setKey(datum.getItemValue());
+ keyValue.setValue(datum.getItemName());
+ comboboxKVs.add(keyValue);
+ }
+ }
+ }
+ return comboboxKVs;
+ }
- /**
- * 淇敼鐘舵��
- *
- * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄
- */
- @Transactional
- @Override
- public void changeStatus(BaseModelDTO baseModelDTO) {
+ /**
+ * 淇敼鐘舵��
+ *
+ * @param baseModelDTO 鏁版嵁浼犺緭瀵硅薄
+ */
+ @Transactional
+ @Override
+ public void changeStatus(BaseModelDTO baseModelDTO) {
try {
VciBaseUtil.alertNotNull(baseModelDTO, "鏁版嵁淇℃伅", baseModelDTO.getOid(), "涓婚敭", baseModelDTO.getBtmname(), "涓氬姟绫诲瀷", baseModelDTO.getLcStatus(), "鐩爣鐘舵��");
List<String> oids = VciBaseUtil.str2List(baseModelDTO.getOid());
@@ -446,8 +446,8 @@
baseModel.setLcStatus(baseModelDTO.getLcStatus());
}
R r = updateBatchByBaseModel(baseModelDTO.getBtmname(), baseModels);
- if(!r.isSuccess()){
- throw new VciBaseException("鏇存柊鏁版嵁鍑洪敊锛岄噸璇曪紒"+r.getMsg());
+ if (!r.isSuccess()) {
+ throw new VciBaseException("鏇存柊鏁版嵁鍑洪敊锛岄噸璇曪紒" + r.getMsg());
}
}
// 鍒氬ソ椤哄簭鏄竴鑷寸殑锛屾墍浠ョ洿鎺ユ寜鐓odeallcode鐨勯『搴忔潵鎷夸笟鍔℃暟鎹�
@@ -455,7 +455,7 @@
for (CodeAllCode codeCbo : codeCbos) {
codeCbo.setLcStatus(baseModelDTO.getLcStatus());
// 濡傛灉鏄洖鏀讹紝灏遍渶瑕佸皢涓氬姟鏁版嵁瀛樺偍鍒扮爜鍊艰〃涓�
- if(baseModelDTO.getLcStatus().equals(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK)){
+ if (baseModelDTO.getLcStatus().equals(FrameWorkDefaultValueConstant.FRAMEWORK_RELEASE_TAKEBACK)) {
codeCbo.setBusinessData(JSON.toJSONString(baseModels.get(++i)));
}
}
@@ -467,12 +467,12 @@
false,
JSON.toJSONString(baseModels)
);
- }catch (Exception e){
+ } catch (Exception e) {
// 鎻掑叆鏇存敼鏃ュ織璁板綍
- saveLogUtil.operateLog(CodeDefaultLC.getTextByValue(baseModelDTO.getLcStatus()),true,e.toString());
+ saveLogUtil.operateLog(CodeDefaultLC.getTextByValue(baseModelDTO.getLcStatus()), true, e.toString());
throw e;
}
- }
+ }
/**
* 鐢宠鍗曚竴缂栫爜
@@ -482,7 +482,7 @@
*/
@Override
public String addSaveCode(CodeOrderDTO orderDTO) throws Exception {
- return addSaveCode(orderDTO,true);
+ return addSaveCode(orderDTO, true);
}
/***
@@ -493,332 +493,332 @@
*/
@Override
public String addSaveCodeNotauthUser(CodeOrderDTO orderDTO, boolean authUser) throws Exception {
- return addSaveCode(orderDTO,authUser);
+ return addSaveCode(orderDTO, authUser);
}
- /**
- * 鐢宠鍗曚竴缂栫爜
- *
- * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭
- * @return 杩斿洖缂栫爜鐨勫唴瀹�
- */
+ /**
+ * 鐢宠鍗曚竴缂栫爜
+ *
+ * @param orderDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭
+ * @return 杩斿洖缂栫爜鐨勫唴瀹�
+ */
private String addSaveCode(CodeOrderDTO orderDTO, boolean authUser) throws Exception {
- VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭",
- orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�");
- CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
- CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
+ VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭",
+ orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�");
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
+ CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(orderDTO.getCodeRuleOid());
final BladeUser user = AuthUtil.getUser();
- //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈�
- checkSecValueOnOrder(ruleVO, orderDTO);
- //2.鍒ゆ柇蹇呰緭椤�
- checkRequiredAttrOnOrder(templateVO, orderDTO);
- //3.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
- switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
- //4.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
- switchComponentAttrOnOrder(templateVO, orderDTO);
- //5.鏍¢獙瑙勫垯
- checkVerifyOnOrder(templateVO, orderDTO);
- //6.鍏抽敭灞炴��
- checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
- //7.鏋氫妇杞崲
- checkEnumOnOrder(templateVO, orderDTO);
- //8.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
- switchDateAttrOnOrder(templateVO, orderDTO);
- //9.鐢熸垚缂栫爜鐨勪俊鎭� 锛屽垵濮嬪寲涓氬姟绫诲瀷锛氱紦瀛樺厛鍙栨秷锛屽洜涓虹増鏈鍒欎細鍑虹幇鍙樺姩鐨勬儏鍐垫墍浠ユ棤娉曚娇鐢ㄧ紦瀛�
- // BaseModel cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmTypeId());
+ //1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈�
+ checkSecValueOnOrder(ruleVO, orderDTO);
+ //2.鍒ゆ柇蹇呰緭椤�
+ checkRequiredAttrOnOrder(templateVO, orderDTO);
+ //3.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
+ switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
+ //4.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
+ switchComponentAttrOnOrder(templateVO, orderDTO);
+ //5.鏍¢獙瑙勫垯
+ checkVerifyOnOrder(templateVO, orderDTO);
+ //6.鍏抽敭灞炴��
+ checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
+ //7.鏋氫妇杞崲
+ checkEnumOnOrder(templateVO, orderDTO);
+ //8.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
+ switchDateAttrOnOrder(templateVO, orderDTO);
+ //9.鐢熸垚缂栫爜鐨勪俊鎭� 锛屽垵濮嬪寲涓氬姟绫诲瀷锛氱紦瀛樺厛鍙栨秷锛屽洜涓虹増鏈鍒欎細鍑虹幇鍙樺姩鐨勬儏鍐垫墍浠ユ棤娉曚娇鐢ㄧ紦瀛�
+ // BaseModel cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmTypeId());
BaseModel cbo = createBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId().trim().toLowerCase());
//榛樿鐨勫睘鎬ч兘涓嶇敤浠庡墠绔嫹璐�
//璁剧疆缂栫爜闇�瑕佺殑榛樿灞炴�х殑鍐呭
- copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
+ copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
cbo.setOid(VciBaseUtil.getPk());
cbo.setRevisionOid(VciBaseUtil.getPk());
cbo.setNameOid(VciBaseUtil.getPk());
cbo.setCreateTime(new Date());
cbo.setLastModifyTime(new Date());
//cbo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));銆�
- if(authUser) {
+ if (authUser) {
// 瑕佹眰鏄剧ず璐﹀彿锛屾墍浠ュ仛浜嗘洿鏀�
cbo.setCreator(String.valueOf(user.getAccount()));
cbo.setLastModifier(String.valueOf(user.getAccount()));
- }else{
+ } else {
cbo.setCreator(orderDTO.getCreator());
cbo.setLastModifier(orderDTO.getLastModifier());
}
cbo.setTenantId(user.getTenantId());
- if(StringUtils.isNotBlank(orderDTO.getLcStatus())||StringUtils.isNotBlank(orderDTO.getData().get("lcStatus"))){
- cbo.setLcStatus(StringUtils.isNotBlank(orderDTO.getLcStatus())?orderDTO.getLcStatus():orderDTO.getData().get("lcStatus"));
+ if (StringUtils.isNotBlank(orderDTO.getLcStatus()) || StringUtils.isNotBlank(orderDTO.getData().get("lcStatus"))) {
+ cbo.setLcStatus(StringUtils.isNotBlank(orderDTO.getLcStatus()) ? orderDTO.getLcStatus() : orderDTO.getData().get("lcStatus"));
}
//TODO:鍥犱负榛樿鐨勫睘鎬ч兘涓嶆嫹璐濓紝鐩墠闆嗗洟鐮佸彨name锛屽苟娌℃湁浠嶥TO鎷疯礉鍒癱bo閲屻�傚鍔犱竴涓崟鐙鐞嗭紝浠ュ悗鍐嶇湅瑕佷笉瑕佽皟鏁�
- cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
+ cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
//end -- modify by lihang @20220407
- List<BaseModel> cboList = new ArrayList<>();
+ List<BaseModel> cboList = new ArrayList<>();
- //澶囨敞
- cbo.setDescription(orderDTO.getDescription());
- cboList.add(cbo);
+ //澶囨敞
+ cbo.setDescription(orderDTO.getDescription());
+ cboList.add(cbo);
- List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), cboList,user);
+ List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(), cboList, user);
- batchSaveSelectChar(templateVO, cboList);
- return codeList.size() > 0 ? codeList.get(0) : "";
- }
+ batchSaveSelectChar(templateVO, cboList);
+ return codeList.size() > 0 ? codeList.get(0) : "";
+ }
- /**
- * 澶勭悊鍒嗙被娉ㄥ叆鐨勪俊鎭�
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝蹇呴』瑕佸悗妯℃澘鐨勫睘鎬�
- * @param classifyFullInfoBO 鍒嗙被鐨勫叏璺緞
- * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
- */
- private void switchClassifyLevelOnOrder(CodeClassifyTemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) {
- Map<String, CodeClassifyTemplateAttrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter(
- s -> StringUtils.isNotBlank(s.getClassifyInvokeAttr()) && StringUtils.isNotBlank(s.getClassifyInvokeLevel())
- ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- if (classifyFullInfoBO.getTopClassifyVO() == null) {
- //闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨�
- }
- if (!CollectionUtils.isEmpty(classifyAttrVOMap)) {
- classifyAttrVOMap.forEach((attrId, attrVO) -> {
- //鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝
- //灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰
- CodeClassifyVO classifyVO = null;
- if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyInvokeLevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyInvokeLevel())) {
- //鎸囧畾浜嗗眰绾х殑
- //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊�
- List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> -o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
- int level = VciBaseUtil.getInt(attrVO.getClassifyInvokeLevel());
- if (classifyVOS.size() >= level && level > 0) {
- classifyVO = classifyVOS.get(level - 1);
- }
- } else {
- //褰撳墠鐨勫垎绫�
- classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
- }
- if (classifyVO == null) {
- //璇存槑灞傜骇鏈夎
- orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyInvokeLevel() + "]");
- // classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
- } else {
- Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO);
- String value = classifyDataMap.getOrDefault(attrVO.getClassifyInvokeAttr(), "");
- orderDTO.getData().put(attrId, value);
- }
- });
- }
- }
+ /**
+ * 澶勭悊鍒嗙被娉ㄥ叆鐨勪俊鎭�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝蹇呴』瑕佸悗妯℃澘鐨勫睘鎬�
+ * @param classifyFullInfoBO 鍒嗙被鐨勫叏璺緞
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void switchClassifyLevelOnOrder(CodeClassifyTemplateVO templateVO, CodeClassifyFullInfoBO classifyFullInfoBO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClassifyTemplateAttrVO> classifyAttrVOMap = templateVO.getAttributes().stream().filter(
+ s -> StringUtils.isNotBlank(s.getClassifyInvokeAttr()) && StringUtils.isNotBlank(s.getClassifyInvokeLevel())
+ ).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (classifyFullInfoBO.getTopClassifyVO() == null) {
+ //闇�瑕侀噸鏂版煡璇竴涓嬶紝鍥犱负杩欎釜鏄寚瀹氱殑鍒嗙被杩涙潵鐨�
+ }
+ if (!CollectionUtils.isEmpty(classifyAttrVOMap)) {
+ classifyAttrVOMap.forEach((attrId, attrVO) -> {
+ //鍒嗙被娉ㄥ叆鐨勭紪鍙锋垨鑰呭悕绉帮紝
+ //灞傜骇鍖呭惈鎸囧畾灞傚拰鏈�灏忓眰
+ CodeClassifyVO classifyVO = null;
+ if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyInvokeLevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyInvokeLevel())) {
+ //鎸囧畾浜嗗眰绾х殑
+ //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊�
+ List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> -o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
+ int level = VciBaseUtil.getInt(attrVO.getClassifyInvokeLevel());
+ if (classifyVOS.size() >= level && level > 0) {
+ classifyVO = classifyVOS.get(level - 1);
+ }
+ } else {
+ //褰撳墠鐨勫垎绫�
+ classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
+ }
+ if (classifyVO == null) {
+ //璇存槑灞傜骇鏈夎
+ orderDTO.getData().put(attrId, "鍒嗙被鏍戜笂娌℃湁灞傜骇[" + attrVO.getClassifyInvokeLevel() + "]");
+ // classifyVO = classifyFullInfoBO.getCurrentClassifyVO();
+ } else {
+ Map<String, String> classifyDataMap = VciBaseUtil.objectToMapString(classifyVO);
+ String value = classifyDataMap.getOrDefault(attrVO.getClassifyInvokeAttr(), "");
+ orderDTO.getData().put(attrId, value);
+ }
+ });
+ }
+ }
- /**
- * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊�
- *
- * @param ruleVO 瑙勫垯鐨勬樉绀哄璞�
- * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹�
- */
- @Override
- public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) {
- List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter(
- s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType())
- || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType())
- || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType())
- || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType())
- || VciBaseUtil.getBoolean(s.getNullableFlag()))
- ).map(CodeBasicSecVO::getOid).collect(Collectors.toList());
- if (!CollectionUtils.isEmpty(unSerialSecOidList)) {
- if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) {
- throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��");
- }
- if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid())
- && StringUtils.isBlank(s.getSecValue()))) {
- throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��");
- }
- }
- }
+ /**
+ * 鍒ゆ柇缂栫爜鐨勭爜娈垫槸鍚﹁緭鍏ユ垨鑰呴�夋嫨浜嗙爜鍊�
+ *
+ * @param ruleVO 瑙勫垯鐨勬樉绀哄璞�
+ * @param orderDTO 缂栫爜鐢宠鐨勫唴瀹�
+ */
+ @Override
+ public void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO) {
+ List<String> unSerialSecOidList = ruleVO.getSecVOList().stream().filter(
+ s -> !(CodeSecTypeEnum.CODE_SERIAL_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || CodeSecTypeEnum.CODE_ATTR_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || CodeSecTypeEnum.CODE_DATE_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || CodeSecTypeEnum.CODE_LEVEL_SEC.getValue().equalsIgnoreCase(s.getSecType())
+ || VciBaseUtil.getBoolean(s.getNullableFlag()))
+ ).map(CodeBasicSecVO::getOid).collect(Collectors.toList());
+ if (!CollectionUtils.isEmpty(unSerialSecOidList)) {
+ if (CollectionUtils.isEmpty(orderDTO.getSecDTOList())) {
+ throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��");
+ }
+ if (orderDTO.getSecDTOList().stream().anyMatch(s -> !unSerialSecOidList.contains(s.getSecOid())
+ && StringUtils.isBlank(s.getSecValue()))) {
+ throw new VciBaseException("闈炴祦姘寸爜娈�(鎴栬�呭繀杈撶爜娈碉級蹇呴』瑕佽緭鍏�(鎴栭�夋嫨)鐮佸��");
+ }
+ }
+ }
- /**
- * 鏍¢獙灞炴�ф槸鍚︿负蹇呰緭
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬�
- * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
- */
- private void checkRequiredAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
+ /**
+ * 鏍¢獙灞炴�ф槸鍚︿负蹇呰緭
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void checkRequiredAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
- Map<String, CodeClassifyTemplateAttrVO> requiredAttrMap = templateVO.getAttributes().stream().filter(
- s -> VciBaseUtil.getBoolean(s.getRequireFlag()) && StringUtils.isBlank(s.getComponentRule())
- && StringUtils.isBlank(s.getClassifyInvokeAttr()))
- .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- if (!CollectionUtils.isEmpty(requiredAttrMap)) {
- requiredAttrMap.forEach((attrId, attrVO) -> {
- //鍙湁浼佷笟缂栫爜锛岀姸鎬侊紝澶囨敞锛屾ā鏉夸富閿紝鍒嗙被涓婚敭杩欏嚑涓槸鍥哄畾鐨勶紝鍏朵綑閮芥槸鑷閰嶇疆鐨�
- if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) {
- throw new VciBaseException("灞炴�с�恵0}銆戝繀椤昏杈撳叆(閫夋嫨)鍐呭", new String[]{attrVO.getName()});
- }
- });
- }
- }
+ Map<String, CodeClassifyTemplateAttrVO> requiredAttrMap = templateVO.getAttributes().stream().filter(
+ s -> VciBaseUtil.getBoolean(s.getRequireFlag()) && StringUtils.isBlank(s.getComponentRule())
+ && StringUtils.isBlank(s.getClassifyInvokeAttr()))
+ .collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(requiredAttrMap)) {
+ requiredAttrMap.forEach((attrId, attrVO) -> {
+ //鍙湁浼佷笟缂栫爜锛岀姸鎬侊紝澶囨敞锛屾ā鏉夸富閿紝鍒嗙被涓婚敭杩欏嚑涓槸鍥哄畾鐨勶紝鍏朵綑閮芥槸鑷閰嶇疆鐨�
+ if (StringUtils.isBlank(getValueFromOrderDTO(orderDTO, attrId))) {
+ throw new VciBaseException("灞炴�с�恵0}銆戝繀椤昏杈撳叆(閫夋嫨)鍐呭", new String[]{attrVO.getName()});
+ }
+ });
+ }
+ }
- /**
- * 浠庣紪鐮佺敵璇蜂俊鎭璞′笂鑾峰彇鏌愪釜灞炴�х殑鍊�
- *
- * @param orderDTO 缂栫爜鐢宠瀵硅薄
- * @param attrId 灞炴�х殑缂栧彿
- * @return 鍊�
- */
- private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) {
- attrId = attrId.toLowerCase(Locale.ROOT);
- String value = null;
- if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
- value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO));
- if(StringUtils.isBlank(value)){
+ /**
+ * 浠庣紪鐮佺敵璇蜂俊鎭璞′笂鑾峰彇鏌愪釜灞炴�х殑鍊�
+ *
+ * @param orderDTO 缂栫爜鐢宠瀵硅薄
+ * @param attrId 灞炴�х殑缂栧彿
+ * @return 鍊�
+ */
+ private String getValueFromOrderDTO(CodeOrderDTO orderDTO, String attrId) {
+ attrId = attrId.toLowerCase(Locale.ROOT);
+ String value = null;
+ if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
+ value = WebUtil.getStringValueFromObject(WebUtil.getValueFromField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO));
+ if (StringUtils.isBlank(value)) {
value = orderDTO.getData().getOrDefault(attrId, "");
}
} else {
- //璇存槑鏄嚜琛岄厤缃殑
- //鍓嶇蹇呴』瑕佷紶閫掑皬鍐欑殑灞炴��
+ //璇存槑鏄嚜琛岄厤缃殑
+ //鍓嶇蹇呴』瑕佷紶閫掑皬鍐欑殑灞炴��
String orDefault = orderDTO.getData().getOrDefault(attrId, "");
value = Func.isBlank(orDefault) ? orderDTO.getData()
- .getOrDefault(attrId.toUpperCase(Locale.ROOT), ""):orDefault;
- }
- return value;
- }
+ .getOrDefault(attrId.toUpperCase(Locale.ROOT), "") : orDefault;
+ }
+ return value;
+ }
- /**
- * 杞崲缁勫悎瑙勫垯鐨勫��
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬�
- * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
- */
- private void switchComponentAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
- Map<String, CodeClassifyTemplateAttrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- if (!CollectionUtils.isEmpty(compAttrVOMap)) {
- Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO);
+ /**
+ * 杞崲缁勫悎瑙勫垯鐨勫��
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚ā鏉垮睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void switchComponentAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClassifyTemplateAttrVO> compAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getComponentRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(compAttrVOMap)) {
+ Map<String, String> dataMap = WebUtil.objectToMapString(orderDTO);
- Map<String, String> dataLowMap = new HashMap<>();
- if (!CollectionUtils.isEmpty(dataMap)) {
- dataMap.forEach((key, value) -> {
- dataLowMap.put(key.toLowerCase(Locale.ROOT), value);
- });
- }
- dataLowMap.putAll(orderDTO.getData());
- compAttrVOMap.forEach((attrId, attrVO) -> {
- dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentRule()));
- });
- dataLowMap.forEach((key, value) -> {
- setValueToOrderDTO(orderDTO, key, value);
- });
- }
- }
+ Map<String, String> dataLowMap = new HashMap<>();
+ if (!CollectionUtils.isEmpty(dataMap)) {
+ dataMap.forEach((key, value) -> {
+ dataLowMap.put(key.toLowerCase(Locale.ROOT), value);
+ });
+ }
+ dataLowMap.putAll(orderDTO.getData());
+ compAttrVOMap.forEach((attrId, attrVO) -> {
+ dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentRule()));
+ });
+ dataLowMap.forEach((key, value) -> {
+ setValueToOrderDTO(orderDTO, key, value);
+ });
+ }
+ }
- /**
- * 璁剧疆鏂扮殑鍊煎埌鐢宠瀵硅薄涓�
- *
- * @param orderDTO 缂栫爜鐢宠瀵硅薄
- * @param attrId 灞炴�х殑缂栧彿
- * @param value 鍊�
- */
- private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) {
- attrId = attrId.toLowerCase(Locale.ROOT);
- if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
- WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value);
- } else {
- orderDTO.getData().put(attrId, value);
- }
- }
+ /**
+ * 璁剧疆鏂扮殑鍊煎埌鐢宠瀵硅薄涓�
+ *
+ * @param orderDTO 缂栫爜鐢宠瀵硅薄
+ * @param attrId 灞炴�х殑缂栧彿
+ * @param value 鍊�
+ */
+ private void setValueToOrderDTO(CodeOrderDTO orderDTO, String attrId, String value) {
+ attrId = attrId.toLowerCase(Locale.ROOT);
+ if (VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(attrId)) {
+ WebUtil.setValueToField(WebUtil.getFieldForObject(attrId, orderDTO.getClass()).getName(), orderDTO, value);
+ } else {
+ orderDTO.getData().put(attrId, value);
+ }
+ }
- /**
- * 鏍¢獙姝e垯琛ㄨ揪寮忔槸鍚︽纭�
- *
- * @param templateVO 妯℃澘鐨勪俊鎭紝蹇呴』鍖呭惈灞炴�х殑鍐呭
- * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
- */
- private void checkVerifyOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
- Map<String, CodeClassifyTemplateAttrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- if (!CollectionUtils.isEmpty(verifyAttrVOMap)) {
- verifyAttrVOMap.forEach((attrId, attrVO) -> {
- String value = getValueFromOrderDTO(orderDTO, attrId);
- if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyRule())) {
- //鏍¢獙姝e垯琛ㄨ揪寮�
- throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()});
- }
- });
- }
- }
+ /**
+ * 鏍¢獙姝e垯琛ㄨ揪寮忔槸鍚︽纭�
+ *
+ * @param templateVO 妯℃澘鐨勪俊鎭紝蹇呴』鍖呭惈灞炴�х殑鍐呭
+ * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
+ */
+ private void checkVerifyOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClassifyTemplateAttrVO> verifyAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getVerifyRule())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(verifyAttrVOMap)) {
+ verifyAttrVOMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (StringUtils.isNotBlank(value) && !value.matches(attrVO.getVerifyRule())) {
+ //鏍¢獙姝e垯琛ㄨ揪寮�
+ throw new VciBaseException("灞炴�{0}]鐨勫�间笉绗﹀悎鏍¢獙瑙勫垯鐨勮姹�", new String[]{attrVO.getName()});
+ }
+ });
+ }
+ }
- /**
- * 鏍¢獙鍏抽敭灞炴��
- *
- * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
- * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴��
- * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
- */
- private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
- //鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮�
- CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo);
- //娉ㄦ剰鐨勬槸keyRuleVO鍙兘涓虹┖锛岃〃绀轰笉浣跨敤瑙勫垯鎺у埗
- //鑾峰彇鎵�鏈夌殑鍏抽敭灞炴��
- Map<String, CodeClassifyTemplateAttrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyAttrFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- Map<String, String> conditionMap = new HashMap<>();
- boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag());
- //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖
- boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag());
- boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag());
- boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag());
- ketAttrMap.forEach((attrId, attrVO) -> {
- String value = getValueFromOrderDTO(orderDTO, attrId);
- if (value == null) {
- value = "";
- }
- wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
- });
+ /**
+ * 鏍¢獙鍏抽敭灞炴��
+ *
+ * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
+ * @param templateVO 妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴��
+ * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
+ */
+ private void checkKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
+ //鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮�
+ CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo);
+ //娉ㄦ剰鐨勬槸keyRuleVO鍙兘涓虹┖锛岃〃绀轰笉浣跨敤瑙勫垯鎺у埗
+ //鑾峰彇鎵�鏈夌殑鍏抽敭灞炴��
+ Map<String, CodeClassifyTemplateAttrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyAttrFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ Map<String, String> conditionMap = new HashMap<>();
+ boolean trimAll = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag());
+ //鍏ㄩ儴鍘荤┖鐨勪紭鍏堢骇澶т簬鍘荤┖
+ boolean trim = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorespaceflag());
+ boolean ignoreCase = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorecaseflag());
+ boolean ignoreWidth = keyRuleVO == null ? false : VciBaseUtil.getBoolean(keyRuleVO.getIgnorewidthflag());
+ ketAttrMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (value == null) {
+ value = "";
+ }
+ wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
+ });
- //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
- if (!CollectionUtils.isEmpty(conditionMap)) {
+ //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
+ if (!CollectionUtils.isEmpty(conditionMap)) {
// TODO: 鍚屼竴涓簱鍒ら噸涓嶉渶瑕佸尯鍒嗗垎绫籵id
// conditionMap.put("CODETEMPLATEOID","'" + orderDTO.getTemplateOid() + "'");
// final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId()));
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId()));
// String referTable = VciBaseUtil.getTableName(referVO.getReferType());
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
- //final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
+ //final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
final String[] sql = {"select id from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
- conditionMap.forEach((key, value) -> {
- if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)) {
+ conditionMap.forEach((key, value) -> {
+ if (StringUtils.isBlank(value) || value.equals(QueryOptionConstant.ISNULL)) {
sql[0] += " and " + key + " is null";
- }else{
+ } else {
sql[0] += " and " + key + " = " + value;
}
- });
- if (StringUtils.isNotBlank(orderDTO.getOid())) {
- //淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸�
- sql[0] += " and oid != '" + orderDTO.getOid() + "'";
- } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) {
- sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
- }
- sql[0] += " and lastR = '1' and lastV = '1' ";
+ });
+ if (StringUtils.isNotBlank(orderDTO.getOid())) {
+ //淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸�
+ sql[0] += " and oid != '" + orderDTO.getOid() + "'";
+ } else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) {
+ sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
+ }
+ sql[0] += " and lastR = '1' and lastV = '1' ";
// 鑾峰彇涓嶅弬涓庢牎楠岀殑鍒嗙被oid
String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid());
- if(Func.isNotEmpty(isParticipateCheckOids)){
+ if (Func.isNotEmpty(isParticipateCheckOids)) {
sql[0] += " and codeclsfid not in(" + isParticipateCheckOids + ")";
}
// if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) {
List<String> repeatData = commonsMapper.selectList(sql[0]);
if (!repeatData.isEmpty()) {
- String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
- String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
- throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇璇ユ暟鎹凡缁忎笌绯荤粺涓紪鍙蜂负"+repeatData.stream().collect(Collectors.joining(","))+"鐨勬暟鎹噸澶嶃�傝淇!銆�" + ruleInfoMsg, objs);
- }
- }
- }
+ String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
+ String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
+ throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇璇ユ暟鎹凡缁忎笌绯荤粺涓紪鍙蜂负" + repeatData.stream().collect(Collectors.joining(",")) + "鐨勬暟鎹噸澶嶃�傝淇!銆�" + ruleInfoMsg, objs);
+ }
+ }
+ }
/**
* 鏍¢獙鍏抽敭灞炴��
*
- * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
+ * @param orderDTO 缂栫爜鐢宠鐨勭浉鍏崇殑淇℃伅
*/
@Override
public List<Map> checkKeyAttrOnOrderFordatas(CodeOrderDTO orderDTO) {
- List<Map>dataList=new ArrayList<>();
+ List<Map> dataList = new ArrayList<>();
CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
//鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮�
@@ -842,7 +842,7 @@
//娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
if (!CollectionUtils.isEmpty(conditionMap)) {
- conditionMap.put("CODETEMPLATEOID","'" + orderDTO.getTemplateOid() + "'");
+ conditionMap.put("CODETEMPLATEOID", "'" + orderDTO.getTemplateOid() + "'");
// final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId()));
// String referTable = VciBaseUtil.getTableName(referVO.getReferType());
@@ -851,9 +851,9 @@
}
final String[] sql = {"select * from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
conditionMap.forEach((key, value) -> {
- if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)) {
+ if (StringUtils.isBlank(value) || value.equals(QueryOptionConstant.ISNULL)) {
sql[0] += " and " + key + " is null";
- }else{
+ } else {
sql[0] += " and " + key + " = " + value;
}
});
@@ -865,7 +865,7 @@
}
sql[0] += " and lastR = '1' and lastV = '1' ";
// if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) {
- dataList=commonsMapper.selectBySql(sql[0]);
+ dataList = commonsMapper.selectBySql(sql[0]);
if (!CollectionUtils.isEmpty(dataList)) {
// String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
// String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
@@ -879,6 +879,7 @@
/**
* 鏍规嵁褰撳墠鐢宠缂栫爜鐨勫垎绫伙紝閫愬眰寰�涓婃牎楠屾槸鍚︾鍚堝睘浜庨厤缃殑涓殑鍒嗙被瀛愯妭鐐圭殑鍒�
* 绫伙紝濡傛灉绗﹀悎锛屽垯璇ュ垎绫荤敵璇风殑缂栫爜涓洪泦鍥㈢爜杩斿洖true锛屽弽涔嬪垯涓轰紒涓氱紪鐮佽繑鍥瀎alse
+ *
* @param parameter 浼犲叆鏁版嵁,classifyGroupCode:閰嶇疆鐨勪腑鐨勫垎绫婚《鑺傜偣锛宱id锛氶�夋嫨鑺傜偣鐨刼id
*/
@Override
@@ -886,8 +887,8 @@
List<CodeClassify> codeClassifyList = classifyService.selectAllLevelParentByOid(parameter.get("oid"));
Set<String> configGroupCode = Arrays.stream(parameter.get("classifyGroupCode").split("#")).collect(Collectors.toSet());
// Boolean checkGroupFlag = false;//鏄惁鏌ヨ鍒伴厤缃殑椤跺眰鍒嗙被涓�
- for (int i = codeClassifyList.size()-1; i >= 0; i--) {
- if(configGroupCode.contains(codeClassifyList.get(i).getId())){
+ for (int i = codeClassifyList.size() - 1; i >= 0; i--) {
+ if (configGroupCode.contains(codeClassifyList.get(i).getId())) {
// checkGroupFlag = true;
return R.data("true");
}
@@ -906,7 +907,7 @@
*/
@Override
public String addSaveBZ(CodeBZApplyDTO codeBZApplyDTO) throws Exception {
- return addSaveBZCode(codeBZApplyDTO,true);
+ return addSaveBZCode(codeBZApplyDTO, true);
}
/**
@@ -917,57 +918,57 @@
* @return
*/
public String addSaveBZCode(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception {
- String code="";
+ String code = "";
VciBaseUtil.alertNotNull(codeBZApplyDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭",
codeBZApplyDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", codeBZApplyDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�");
//鎿嶄綔绫诲瀷
- if(StringUtils.isBlank(codeBZApplyDTO.getOperationType())){
- String operationTypeValue=codeBZApplyDTO.getData().get(operationType);
+ if (StringUtils.isBlank(codeBZApplyDTO.getOperationType())) {
+ String operationTypeValue = codeBZApplyDTO.getData().get(operationType);
codeBZApplyDTO.setOperationType(operationTypeValue);
}
//鏄惁绯诲垪
- if(!codeBZApplyDTO.isSeries()){
- boolean isSeriesValue=codeBZApplyDTO.getData().get(isSeries).equals("true")?true:false;
+ if (!codeBZApplyDTO.isSeries()) {
+ boolean isSeriesValue = codeBZApplyDTO.getData().get(isSeries).equals("true") ? true : false;
codeBZApplyDTO.setSeries(isSeriesValue);
}
//鍘熸爣鍑嗗彿
- if(StringUtils.isBlank(codeBZApplyDTO.getOldCode())){
- String oldCodeValue=codeBZApplyDTO.getData().get(oldCode);
+ if (StringUtils.isBlank(codeBZApplyDTO.getOldCode())) {
+ String oldCodeValue = codeBZApplyDTO.getData().get(oldCode);
codeBZApplyDTO.setOldCode(oldCodeValue);
}
//绯诲垪娴佹按
- if(StringUtils.isBlank(codeBZApplyDTO.getSeriesFlow())){
- String seriesFlowValue=codeBZApplyDTO.getData().get(seriesFlow);
+ if (StringUtils.isBlank(codeBZApplyDTO.getSeriesFlow())) {
+ String seriesFlowValue = codeBZApplyDTO.getData().get(seriesFlow);
codeBZApplyDTO.setSeriesFlow(seriesFlowValue);
}
//鍙戝竷鏃堕棿
- if(StringUtils.isBlank(codeBZApplyDTO.getReleaseTime())){
- String releaseTimeValue=codeBZApplyDTO.getData().get(releaseTime);
+ if (StringUtils.isBlank(codeBZApplyDTO.getReleaseTime())) {
+ String releaseTimeValue = codeBZApplyDTO.getData().get(releaseTime);
codeBZApplyDTO.setReleaseTime(releaseTimeValue);
}
//鏄惁鍙樻洿绯诲垪
- if(!codeBZApplyDTO.isEditSeries()){
- boolean isEditSeriesValue=codeBZApplyDTO.getData().get(isEditSeries).equals("true")?true:false;
+ if (!codeBZApplyDTO.isEditSeries()) {
+ boolean isEditSeriesValue = codeBZApplyDTO.getData().get(isEditSeries).equals("true") ? true : false;
codeBZApplyDTO.setEditSeries(isEditSeriesValue);
}
VciBaseUtil.alertNotNull(codeBZApplyDTO.getOperationType(), "鎿嶄綔绫诲瀷",
codeBZApplyDTO.isSeries(), "鏄惁绯诲垪", codeBZApplyDTO.getReleaseTime(), "鍙戝竷鏃堕棿");
- if(codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_FORMULATE.getValue())){//鍒跺畾
- code= addsaveDataBZ(codeBZApplyDTO,authUser);
- }else if(codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_AMENDMENT.getValue())){//淇
+ if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_FORMULATE.getValue())) {//鍒跺畾
+ code = addsaveDataBZ(codeBZApplyDTO, authUser);
+ } else if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_AMENDMENT.getValue())) {//淇
VciBaseUtil.alertNotNull(codeBZApplyDTO.getOldCode(), "婧愭爣鍑嗗彿");
- code= amendmentDataBZ(codeBZApplyDTO,authUser);
- createChangeOder(code,codeBZApplyDTO,authUser);
- }else if(codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_EDIT.getValue())){//鏇存敼
- code= amendmentDataBZ(codeBZApplyDTO,authUser);
- createChangeOder(code,codeBZApplyDTO,authUser);
- }else if(codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_DISABLE.getValue())) {//浣滃簾
- code= amendmentDataBZ(codeBZApplyDTO,authUser);
- createChangeOder(code,codeBZApplyDTO,authUser);
- }else if(codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_AMENDMENT.getValue())) {//澶囨煡
- code= amendmentDataBZ(codeBZApplyDTO,authUser);
- createChangeOder(code,codeBZApplyDTO,authUser);
+ code = amendmentDataBZ(codeBZApplyDTO, authUser);
+ createChangeOder(code, codeBZApplyDTO, authUser);
+ } else if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_EDIT.getValue())) {//鏇存敼
+ code = amendmentDataBZ(codeBZApplyDTO, authUser);
+ createChangeOder(code, codeBZApplyDTO, authUser);
+ } else if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_DISABLE.getValue())) {//浣滃簾
+ code = amendmentDataBZ(codeBZApplyDTO, authUser);
+ createChangeOder(code, codeBZApplyDTO, authUser);
+ } else if (codeBZApplyDTO.getOperationType().equals(CodeBZOperationTypeEnum.CODE_BZ_AMENDMENT.getValue())) {//澶囨煡
+ code = amendmentDataBZ(codeBZApplyDTO, authUser);
+ createChangeOder(code, codeBZApplyDTO, authUser);
}
return code;
}
@@ -979,34 +980,35 @@
* @return
*/
private String amendmentDataBZ(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception {
- CodeOrderDTO orderDTO=new CodeOrderDTO();
- BeanUtil.convert(codeBZApplyDTO,orderDTO);
+ CodeOrderDTO orderDTO = new CodeOrderDTO();
+ BeanUtil.convert(codeBZApplyDTO, orderDTO);
CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(codeBZApplyDTO.getCodeRuleOid());
Map<String, CodeBasicSecVO> codeCodeBasicSecMap = ruleVO.getSecVOList().stream().filter(s -> StringUtils.isNotBlank(s.getOid())).collect(Collectors.toMap(s -> s.getOid().toLowerCase(Locale.ROOT), t -> t));
VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭",
orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�");
- String oldCode=codeBZApplyDTO.getOldCode();//婧愭爣鍑嗙紪鐮�
- String releaseTime=codeBZApplyDTO.getReleaseTime();
- List<CodeOrderSecDTO> secDTOS= orderDTO.getSecDTOList();
- LinkedList<CodeOrderSecDTO> newSecDTOList=new LinkedList<>();
- changeCodeOrderSecDTO(ruleVO,secDTOS,oldCode,newSecDTOList);//鏍规嵁瑕佹眰閲嶆柊绠楃爜娈电爜鍊�
- if(!codeBZApplyDTO.isEditSeries()){//鍙樻洿涓烘爣鍑�
+ String oldCode = codeBZApplyDTO.getOldCode();//婧愭爣鍑嗙紪鐮�
+ String releaseTime = codeBZApplyDTO.getReleaseTime();
+ List<CodeOrderSecDTO> secDTOS = orderDTO.getSecDTOList();
+ LinkedList<CodeOrderSecDTO> newSecDTOList = new LinkedList<>();
+ changeCodeOrderSecDTO(ruleVO, secDTOS, oldCode, newSecDTOList);//鏍规嵁瑕佹眰閲嶆柊绠楃爜娈电爜鍊�
+ if (!codeBZApplyDTO.isEditSeries()) {//鍙樻洿涓烘爣鍑�
//if(!codeBZApplyDTO.isSeries()){//濡傛灉鏄〃鍑嗭紝鍒欓渶瑕佸皢绯诲垪濂芥祦姘寸疆涓簄ull
- //鍥犱负鏄爣鍑嗗垯鎺у埗鐮佹涓殑绯诲垪娴佹按鐮佹鍊间负绌�
- newSecDTOList.stream().forEach(codeOrderSecDTO -> {
- if(codeCodeBasicSecMap.containsKey(codeOrderSecDTO.getSecOid())&&codeCodeBasicSecMap.get(codeOrderSecDTO.getSecOid()).getName().equals(secName)){
- codeOrderSecDTO.setSecValue("");
- }
- });
+ //鍥犱负鏄爣鍑嗗垯鎺у埗鐮佹涓殑绯诲垪娴佹按鐮佹鍊间负绌�
+ newSecDTOList.stream().forEach(codeOrderSecDTO -> {
+ if (codeCodeBasicSecMap.containsKey(codeOrderSecDTO.getSecOid()) && codeCodeBasicSecMap.get(codeOrderSecDTO.getSecOid()).getName().equals(secName)) {
+ codeOrderSecDTO.setSecValue("");
+ }
+ });
//}
orderDTO.setSecDTOList(newSecDTOList);
- return createDataBZ(orderDTO,ruleVO,authUser);
- }else{//鍙樻洿涓虹郴鍒�.鍒欐寜鐓ч�昏緫鍘诲鐞�
+ return createDataBZ(orderDTO, ruleVO, authUser);
+ } else {//鍙樻洿涓虹郴鍒�.鍒欐寜鐓ч�昏緫鍘诲鐞�
orderDTO.setSecDTOList(newSecDTOList);
- return createDataBZ(orderDTO,ruleVO,authUser);
+ return createDataBZ(orderDTO, ruleVO, authUser);
}
}
- private String createDataBZ(CodeOrderDTO orderDTO, CodeRuleVO ruleVO,boolean authUser) throws Exception {
+
+ private String createDataBZ(CodeOrderDTO orderDTO, CodeRuleVO ruleVO, boolean authUser) throws Exception {
CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
//1.鍒ゆ柇瑙勫垯涓櫎浜嗘祦姘寸爜娈碉紝鏄惁鏈夊叾浠栫爜娈�
@@ -1037,17 +1039,17 @@
cbo.setCreateTime(new Date());
cbo.setLastModifyTime(new Date());
//cbo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));銆�
- if(authUser) {
+ if (authUser) {
// 瑕佹眰鏄剧ず璐﹀彿锛屾墍浠ュ仛浜嗘洿鏀�
cbo.setCreator(String.valueOf(AuthUtil.getUser().getAccount()));
cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
- }else{
+ } else {
cbo.setCreator(orderDTO.getCreator());
cbo.setLastModifier(orderDTO.getLastModifier());
}
cbo.setTenantId(AuthUtil.getTenantId());
- if(StringUtils.isNotBlank(orderDTO.getLcStatus())||StringUtils.isNotBlank(orderDTO.getData().get("lcStatus"))){
- cbo.setLcStatus(StringUtils.isNotBlank(orderDTO.getLcStatus())?orderDTO.getLcStatus():orderDTO.getData().get("lcStatus"));
+ if (StringUtils.isNotBlank(orderDTO.getLcStatus()) || StringUtils.isNotBlank(orderDTO.getData().get("lcStatus"))) {
+ cbo.setLcStatus(StringUtils.isNotBlank(orderDTO.getLcStatus()) ? orderDTO.getLcStatus() : orderDTO.getData().get("lcStatus"));
}
//TODO:鍥犱负榛樿鐨勫睘鎬ч兘涓嶆嫹璐濓紝鐩墠闆嗗洟鐮佸彨name锛屽苟娌℃湁浠嶥TO鎷疯礉鍒癱bo閲屻�傚鍔犱竴涓崟鐙鐞嗭紝浠ュ悗鍐嶇湅瑕佷笉瑕佽皟鏁�
cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
@@ -1061,42 +1063,44 @@
return codeList.size() > 0 ? codeList.get(0) : "";
}
+
/***
* 鏍规嵁缂栧彿鑾峰彇鐮佹鐮佸��
* @param secDTOList
*/
- private void changeCodeOrderSecDTO(CodeRuleVO ruleVO,List<CodeOrderSecDTO> secDTOList,String oldCode,LinkedList<CodeOrderSecDTO> newSecDTOList) throws Exception {
+ private void changeCodeOrderSecDTO(CodeRuleVO ruleVO, List<CodeOrderSecDTO> secDTOList, String oldCode, LinkedList<CodeOrderSecDTO> newSecDTOList) throws Exception {
//杩橀渶瑕佷慨鏀筧llCode鐨勭敓鍛藉懆鏈�
QueryWrapper<CodeAllCode> allCodeWrapper = new QueryWrapper<>();
allCodeWrapper.in("id", VciBaseUtil.str2List(oldCode));
- Map<String,String> secDTOMap=secDTOList.stream().collect(Collectors.toMap(s -> s.getSecOid(), t -> t.getSecValue(),(o1, o2)->o2));
- List<CodeAllCode>codeAllcodeList=codeAllCodeService.selectByWrapper(allCodeWrapper);
- if(!CollectionUtils.isEmpty(codeAllcodeList)){
- String codeDelimit=codeAllcodeList.get(0).getCodeDelimit();
- String[] secValues=StringUtils.splitByWholeSeparatorPreserveAllTokens(codeDelimit,SERIAL_VALUE_SPACE);
+ Map<String, String> secDTOMap = secDTOList.stream().collect(Collectors.toMap(s -> s.getSecOid(), t -> t.getSecValue(), (o1, o2) -> o2));
+ List<CodeAllCode> codeAllcodeList = codeAllCodeService.selectByWrapper(allCodeWrapper);
+ if (!CollectionUtils.isEmpty(codeAllcodeList)) {
+ String codeDelimit = codeAllcodeList.get(0).getCodeDelimit();
+ String[] secValues = StringUtils.splitByWholeSeparatorPreserveAllTokens(codeDelimit, SERIAL_VALUE_SPACE);
//VciBaseUtil.str2List()
- for (int i=0; i<ruleVO.getSecVOList().size();i++){
- CodeBasicSecVO codeBasicSecVO=ruleVO.getSecVOList().get(i);
- CodeOrderSecDTO codeOrderSecDTO=new CodeOrderSecDTO();
- String secValue=secValues[i];
- boolean isRoman=VciBaseUtil.isRoman(secValue);
- if(isRoman){
+ for (int i = 0; i < ruleVO.getSecVOList().size(); i++) {
+ CodeBasicSecVO codeBasicSecVO = ruleVO.getSecVOList().get(i);
+ CodeOrderSecDTO codeOrderSecDTO = new CodeOrderSecDTO();
+ String secValue = secValues[i];
+ boolean isRoman = VciBaseUtil.isRoman(secValue);
+ if (isRoman) {
continue;
}
- if(secDTOMap.containsKey(codeBasicSecVO.getOid())){
- secValue= secDTOMap.get(codeBasicSecVO.getOid()) ;
+ if (secDTOMap.containsKey(codeBasicSecVO.getOid())) {
+ secValue = secDTOMap.get(codeBasicSecVO.getOid());
}
- if(StringUtils.isNotBlank(secValue)) {
+ if (StringUtils.isNotBlank(secValue)) {
codeOrderSecDTO.setSecOid(codeBasicSecVO.getOid());
codeOrderSecDTO.setSecValue(secValue);
newSecDTOList.add(codeOrderSecDTO);
}
}
- }else{
+ } else {
throw new Exception("鏍规嵁鍘熸爣鍑嗙紪鍙凤紝鍦ㄧ郴缁熶腑鏈煡璇㈠埌鐩稿簲鐨勪俊鎭�");
}
}
+
/***
* 鍒跺畾锛屽垯涓嶉渶瑕佷骇鐢熸洿鏀瑰崟鐩存帴鐢熸垚缂栫爜
* @param codeBZApplyDTO
@@ -1104,23 +1108,23 @@
* @return
*/
private String addsaveDataBZ(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception {
- String code="";
- CodeOrderDTO orderDTO=new CodeOrderDTO();
- BeanUtil.convert(codeBZApplyDTO,orderDTO);
+ String code = "";
+ CodeOrderDTO orderDTO = new CodeOrderDTO();
+ BeanUtil.convert(codeBZApplyDTO, orderDTO);
CodeRuleVO ruleVO = ruleService.getObjectHasSecByOid(codeBZApplyDTO.getCodeRuleOid());
Map<String, CodeBasicSecVO> codeCodeBasicSecMap = ruleVO.getSecVOList().stream().filter(s -> StringUtils.isNotBlank(s.getOid())).collect(Collectors.toMap(s -> s.getOid(), t -> t));
//鏄惁鏄爣鍑�,涓嶆槸鏍囧噯鐨勪笉浼氬幓绠�
- if(!codeBZApplyDTO.isSeries()){
+ if (!codeBZApplyDTO.isSeries()) {
//鍥犱负鏄爣鍑嗗垯鎺у埗鐮佹涓殑绯诲垪娴佹按鐮佹鍊间负绌�
orderDTO.getSecDTOList().stream().forEach(codeOrderSecDTO -> {
- if(codeCodeBasicSecMap.containsKey(codeOrderSecDTO.getSecOid())&&codeCodeBasicSecMap.get(codeOrderSecDTO.getSecOid()).getName().equals(secName)){
+ if (codeCodeBasicSecMap.containsKey(codeOrderSecDTO.getSecOid()) && codeCodeBasicSecMap.get(codeOrderSecDTO.getSecOid()).getName().equals(secName)) {
codeOrderSecDTO.setSecValue("");
}
});
}
VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭",
orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�", orderDTO.getCodeRuleOid(), "缂栫爜瑙勫垯鐨勪富閿�");
- return createDataBZ(orderDTO,ruleVO,authUser);
+ return createDataBZ(orderDTO, ruleVO, authUser);
}
/***
@@ -1130,11 +1134,12 @@
* @param authUser
* @return
*/
- private String createChangeOder(String code,CodeBZApplyDTO codeBZApplyDTO, boolean authUser){
+ private String createChangeOder(String code, CodeBZApplyDTO codeBZApplyDTO, boolean authUser) {
return "";
}
+
/***
* 闆嗘垚鍙彉鐮佹鐢宠鎺ュ彛
* @param codeBZApplyDTO 鐢宠鐨勪俊鎭紝闇�瑕佸寘鍚睘鎬х殑鍐呭鍜岀爜娈电浉鍏崇殑鍐呭
@@ -1144,11 +1149,12 @@
*/
@Override
public String addSaveBZCodeNotauthUser(CodeBZApplyDTO codeBZApplyDTO, boolean authUser) throws Exception {
- return addSaveBZCode(codeBZApplyDTO,authUser);
+ return addSaveBZCode(codeBZApplyDTO, authUser);
}
/**
* 鑾峰彇缁熻鍒嗘瀽鏁版嵁
+ *
* @param btmNames 涓氬姟绫诲瀷
* @return 鏁版嵁闆�
*/
@@ -1162,10 +1168,10 @@
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')";
+ "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);
@@ -1176,13 +1182,13 @@
//鑾峰彇褰撳墠鏈堢殑鏁板瓧
Calendar instance = Calendar.getInstance();
int nowmonth = instance.get(Calendar.MONTH) + 1;
- if(maps.size() == 0){
+ if (maps.size() == 0) {
nowmonth = 0;
}
//浠�1鍒�12鏈堣繘琛屽鐞�
for (Integer i = 1; i <= 12; i++) {
//褰撳墠鏈堝悗鎵�鏈夋暟鎹缃负0
- if(i>nowmonth){
+ if (i > nowmonth) {
monthCount.add(0);
month.add(0);
continue;
@@ -1194,7 +1200,7 @@
//瀵规暟鎹簱鏌ョ殑鏁版嵁杩涜澶勭悊锛屽褰撳墠鏈堜唤杩涜绱姞
for (Map map : maps) {
Integer mounDate = Integer.parseInt(String.valueOf(map.get("COUNTDATE")));
- if(mounDate <= i){
+ if (mounDate <= i) {
count += Integer.parseInt(String.valueOf(map.get("COUNTNUM")));
}
if (mounDate == i) {
@@ -1205,323 +1211,324 @@
month.add(sameMonth);
}
//瀵规暟鎹繘琛屾暣鍚�
- HashMap<String,Object> menuData = new HashMap<>();
- menuData.put("menuName",datum.getName());
- menuData.put("codeType",null);
+ 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);
+ menuData.put("menuData", monthData);
tableData.add(menuData);
}
return R.data(tableData);
}
/**
- * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞
- *
- * @param value 褰撳墠鐨勫��
- * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌�
- * @param attrId 灞炴�х殑缂栧彿
- * @param trim 鏄惁鍘婚櫎绌烘牸
- * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓
- * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙�
- * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸
- * @param conditionMap 鏌ヨ鏉′欢
- */
- @Override
- public void wrapperKeyAttrConditionMap(String value, CodeKeyAttrRepeatVO keyRuleVO, String attrId,
- boolean trim, boolean ignoreCase, boolean ignoreWidth,
- boolean trimAll, Map<String, String> conditionMap) {
- boolean ignoreSpace = trim || trimAll;
- if (StringUtils.isBlank(value)) {
- //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜�
+ * 灏佽鍏抽敭灞炴�х殑鏌ヨ璇彞
+ *
+ * @param value 褰撳墠鐨勫��
+ * @param keyRuleVO 鍏抽敭灞炴�х殑鎺у埗瑙勫垯锛屽彲浠ヤ负绌�
+ * @param attrId 灞炴�х殑缂栧彿
+ * @param trim 鏄惁鍘婚櫎绌烘牸
+ * @param ignoreCase 鏄惁涓嶅尯鍒嗗ぇ灏忓啓
+ * @param ignoreWidth 鏄惁蹇界暐鍏ㄥ崐瑙�
+ * @param trimAll 鏄惁蹇界暐鍏ㄩ儴绌烘牸
+ * @param conditionMap 鏌ヨ鏉′欢
+ */
+ @Override
+ public void wrapperKeyAttrConditionMap(String value, CodeKeyAttrRepeatVO keyRuleVO, String attrId,
+ boolean trim, boolean ignoreCase, boolean ignoreWidth,
+ boolean trimAll, Map<String, String> conditionMap) {
+ boolean ignoreSpace = trim || trimAll;
+ if (StringUtils.isBlank(value)) {
+ //涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜�
conditionMap.put("t." + attrId, QueryOptionConstant.ISNULL);
- } else {
- if (keyRuleVO != null) {
- String queryKey = "";
- String queryValue = "";
+ } else {
+ if (keyRuleVO != null) {
+ String queryKey = "";
+ String queryValue = "";
- String temp = "";
- if (ignoreCase && ignoreSpace && ignoreWidth) {
- //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙�
- temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")");
- } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
- //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
- temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
- } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
- //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
- temp = "UPPER(to_single_byte(%s))";
- } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅
- temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")");
- } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
- //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
- temp = "UPPER(%s)";
- } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
- temp = "to_single_byte(%s)";
- } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
- temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
- } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
- temp = "%s";
- }
- queryKey = String.format(temp, "nvl("+ "t." + attrId +",'/')");
- queryValue = String.format(temp, "'" + (trim ? SpecialCharacterConverter.escapeSpecialCharacters(value.trim()):SpecialCharacterConverter.escapeSpecialCharacters(value)) + "'");
- conditionMap.put(queryKey, queryValue);
- } else {
- if(StringUtils.isNotBlank(value)) {
+ String temp = "";
+ if (ignoreCase && ignoreSpace && ignoreWidth) {
+ //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙�
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")");
+ } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
+ //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
+ } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
+ //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+ temp = "UPPER(to_single_byte(%s))";
+ } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")");
+ } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
+ //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = "UPPER(%s)";
+ } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+ temp = "to_single_byte(%s)";
+ } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
+ } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = "%s";
+ }
+ queryKey = String.format(temp, "nvl(" + "t." + attrId + ",'/')");
+ queryValue = String.format(temp, "'" + (trim ? SpecialCharacterConverter.escapeSpecialCharacters(value.trim()) : SpecialCharacterConverter.escapeSpecialCharacters(value)) + "'");
+ conditionMap.put(queryKey, queryValue);
+ } else {
+ if (StringUtils.isNotBlank(value)) {
//涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅
- conditionMap.put("nvl("+ "t." + attrId+",'/')", "'" + SpecialCharacterConverter.escapeSpecialCharacters(value) + "'");
- }else{
+ conditionMap.put("nvl(" + "t." + attrId + ",'/')", "'" + SpecialCharacterConverter.escapeSpecialCharacters(value) + "'");
+ } else {
conditionMap.put("t." + attrId, QueryOptionConstant.ISNULL);
}
- }
- }
- }
+ }
+ }
+ }
- /**
- * 鏍¢獙鏋氫妇鐨勫唴瀹�
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬�
- * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
- */
- private void checkEnumOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
- //濡傛灉鏋氫妇鍙互淇敼锛屽垯涓嶉渶瑕佹牎楠屾槸鍚︾鍚堟灇涓剧殑閫夐」
+ /**
+ * 鏍¢獙鏋氫妇鐨勫唴瀹�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void checkEnumOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
+ //濡傛灉鏋氫妇鍙互淇敼锛屽垯涓嶉渶瑕佹牎楠屾槸鍚︾鍚堟灇涓剧殑閫夐」
- Map<String, CodeClassifyTemplateAttrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumString()) || StringUtils.isNotBlank(s.getEnumId())) && !VciBaseUtil.getBoolean(s.getEnumEditFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- if (!CollectionUtils.isEmpty(enumAttrVOMap)) {
- enumAttrVOMap.forEach((attrId, attrVO) -> {
- String value = getValueFromOrderDTO(orderDTO, attrId);
- if (StringUtils.isNotBlank(value)) {
- //鏈夊�兼墠鑳芥牎楠�
- List<KeyValue> comboboxKVs = listComboboxItems(attrVO);
- if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) {
- throw new VciBaseException("灞炴�с�恵0}銆戠殑鍊间笉绗﹀悎鏋氫妇鐨勮姹�", new String[]{attrVO.getName()});
- }
- }
- });
- }
- }
+ Map<String, CodeClassifyTemplateAttrVO> enumAttrVOMap = templateVO.getAttributes().stream().filter(s -> (StringUtils.isNotBlank(s.getEnumString()) || StringUtils.isNotBlank(s.getEnumId())) && !VciBaseUtil.getBoolean(s.getEnumEditFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(enumAttrVOMap)) {
+ enumAttrVOMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (StringUtils.isNotBlank(value)) {
+ //鏈夊�兼墠鑳芥牎楠�
+ List<KeyValue> comboboxKVs = listComboboxItems(attrVO);
+ if (!comboboxKVs.stream().anyMatch(s -> value.equalsIgnoreCase(s.getKey()))) {
+ throw new VciBaseException("灞炴�с�恵0}銆戠殑鍊间笉绗﹀悎鏋氫妇鐨勮姹�", new String[]{attrVO.getName()});
+ }
+ }
+ });
+ }
+ }
- /**
- * 杞崲鏃堕棿鐨勬牸寮�
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬�
- * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
- */
- private void switchDateAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
- Map<String, CodeClassifyTemplateAttrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodeDateFormat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- if (!CollectionUtils.isEmpty(dateAttrVOMap)) {
- dateAttrVOMap.forEach((attrId, attrVO) -> {
- String value = getValueFromOrderDTO(orderDTO, attrId);
- if (StringUtils.isNotBlank(value)) {
- DateConverter dateConverter = new DateConverter();
- dateConverter.setAsText(value);
- value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat);
- setValueToOrderDTO(orderDTO, attrId, value);
- }
- });
- }
- }
+ /**
+ * 杞崲鏃堕棿鐨勬牸寮�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞★紝闇�瑕佸寘鍚睘鎬�
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ */
+ private void switchDateAttrOnOrder(CodeClassifyTemplateVO templateVO, CodeOrderDTO orderDTO) {
+ Map<String, CodeClassifyTemplateAttrVO> dateAttrVOMap = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getCodeDateFormat())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
+ if (!CollectionUtils.isEmpty(dateAttrVOMap)) {
+ dateAttrVOMap.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (StringUtils.isNotBlank(value)) {
+ DateConverter dateConverter = new DateConverter();
+ dateConverter.setAsText(value);
+ value = VciDateUtil.date2Str(dateConverter.getValue(), VciDateUtil.DateTimeMillFormat);
+ setValueToOrderDTO(orderDTO, attrId, value);
+ }
+ });
+ }
+ }
- /**
- * 鎷疯礉鏁版嵁鍒癱bo瀵硅薄涓�
- *
- * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
- * @param cbo 涓氬姟鏁版嵁
- * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
- * @param templateVO 妯℃澘鐨勬樉绀哄璞�
- * @param edit 鏄惁涓轰慨鏀�
- */
- private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, BaseModel cbo,
- CodeOrderDTO orderDTO, CodeClassifyTemplateVO templateVO,
- boolean edit) {
- String fullPath = "";
- if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) {
- fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel())))
- .map(CodeClassifyVO::getOid).collect(Collectors.joining("##"));
- } else {
- fullPath = classifyFullInfo.getCurrentClassifyVO().getOid();
- }
+ /**
+ * 鎷疯礉鏁版嵁鍒癱bo瀵硅薄涓�
+ *
+ * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
+ * @param cbo 涓氬姟鏁版嵁
+ * @param orderDTO 缂栫爜鐢宠鐨勪俊鎭�
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞�
+ * @param edit 鏄惁涓轰慨鏀�
+ */
+ private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, BaseModel cbo,
+ CodeOrderDTO orderDTO, CodeClassifyTemplateVO templateVO,
+ boolean edit) {
+ String fullPath = "";
+ if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) {
+ fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel())))
+ .map(CodeClassifyVO::getOid).collect(Collectors.joining("##"));
+ } else {
+ fullPath = classifyFullInfo.getCurrentClassifyVO().getOid();
+ }
orderDTO.getData().forEach((key, value) -> {
if (!edit || (!checkUnAttrUnEdit(key) &&
!VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) {
try {
- cbo.getData().put(cbo.getData().containsKey(key.toUpperCase())?key.toUpperCase():key, value);
+ cbo.getData().put(cbo.getData().containsKey(key.toUpperCase()) ? key.toUpperCase() : key, value);
} catch (Exception e) {
logger.error("璁剧疆灞炴�х殑鍊奸敊璇�", e);
}
}
});
- try {
+ try {
Map<String, String> data = new HashMap<>();
- data.put(cbo.getData().containsKey(CODE_CLASSIFY_OID_FIELD.toUpperCase())?CODE_CLASSIFY_OID_FIELD.toUpperCase():CODE_CLASSIFY_OID_FIELD, classifyFullInfo.getCurrentClassifyVO().getOid());
- data.put(cbo.getData().containsKey(CODE_TEMPLATE_OID_FIELD.toUpperCase())?CODE_TEMPLATE_OID_FIELD.toUpperCase():CODE_TEMPLATE_OID_FIELD, templateVO.getOid());
- data.put(cbo.getData().containsKey(CODE_FULL_PATH_FILED.toUpperCase())?CODE_FULL_PATH_FILED.toUpperCase():CODE_FULL_PATH_FILED, fullPath);
- cbo.getData().putAll(data);
- cbo.setLastModifyTime(new Date());
- //cbo.setLastModifier(AuthUtil.getUser().getUserName());
+ data.put(cbo.getData().containsKey(CODE_CLASSIFY_OID_FIELD.toUpperCase()) ? CODE_CLASSIFY_OID_FIELD.toUpperCase() : CODE_CLASSIFY_OID_FIELD, classifyFullInfo.getCurrentClassifyVO().getOid());
+ data.put(cbo.getData().containsKey(CODE_TEMPLATE_OID_FIELD.toUpperCase()) ? CODE_TEMPLATE_OID_FIELD.toUpperCase() : CODE_TEMPLATE_OID_FIELD, templateVO.getOid());
+ data.put(cbo.getData().containsKey(CODE_FULL_PATH_FILED.toUpperCase()) ? CODE_FULL_PATH_FILED.toUpperCase() : CODE_FULL_PATH_FILED, fullPath);
+ cbo.getData().putAll(data);
+ cbo.setLastModifyTime(new Date());
+ //cbo.setLastModifier(AuthUtil.getUser().getUserName());
cbo.setLastModifier(AuthUtil.getUser().getAccount());
- cbo.setTs(new Date());
- if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
- //TODO 鍏堝啓鍥哄畾锛屽悗闈㈢敓鍛藉懆鏈熷ソ浜嗗湪缂栧啓
- if (StringUtils.isNotBlank(cbo.getLctid())) {
+ cbo.setTs(new Date());
+ if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
+ //TODO 鍏堝啓鍥哄畾锛屽悗闈㈢敓鍛藉懆鏈熷ソ浜嗗湪缂栧啓
+ if (StringUtils.isNotBlank(cbo.getLctid())) {
// OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid());
// if (lifeCycleVO != null) {
// cbo.setLcStatus("Editing");
//// cbo.setLcStatus(lifeCycleVO.getStartStatus());
// } else {
- cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue());
+ cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue());
// }
- } else {
- cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue());
- }
+ } else {
+ cbo.setLcStatus(CodeDefaultLC.RELEASED.getValue());
+ }
- }
+ }
- int secret = VciBaseUtil.getInt(String.valueOf(cbo.getSecretGrade()));
- if (secret == 0 || !secretService.checkDataSecret(secret).getData()) {
- Integer userSecret = VciBaseUtil.getCurrentUserSecret();
+ int secret = VciBaseUtil.getInt(String.valueOf(cbo.getSecretGrade()));
+ if (secret == 0 || !secretService.checkDataSecret(secret).getData()) {
+ Integer userSecret = VciBaseUtil.getCurrentUserSecret();
// cbo.setAttributeValue(SECRET_FIELD, String.valueOf((userSecret == null || userSecret == 0) ? UserSecretEnum.NONE.getValue() : userSecret));
- cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret);
- }
- } catch (Throwable e) {
- logger.error("璁剧疆榛樿鐨勫睘鎬х殑鍊奸敊璇�", e);
- }
- }
+ cbo.setSecretGrade(userSecret == null || userSecret == 0 ? UserSecretEnum.NONE.getValue() : userSecret);
+ }
+ } catch (Throwable e) {
+ logger.error("璁剧疆榛樿鐨勫睘鎬х殑鍊奸敊璇�", e);
+ }
+ }
- /**
- * 鍒濆鍖栦笟鍔$被鍨�
- * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊
- *
- * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐�
- * @return CodeWupinEntity
- * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父
- */
- @Override
- public BaseModel createCBOByBtmName(String btmName)
- throws VciBaseException {
- if (btmName != null) {
- btmName = btmName.trim().toLowerCase();
- }
- try {
- String keyPrefix = BTM_INIT_CACHE.concat(StringPool.COLON).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
- Cache.ValueWrapper valueWrapper = CacheUtil.getCache(keyPrefix).get(keyPrefix.concat(String.valueOf(btmName)));
- if (valueWrapper == null) {
- CacheUtil.getCache(keyPrefix).put(keyPrefix.concat(String.valueOf(btmName)), createBaseModel(btmName));
- valueWrapper = CacheUtil.getCache(keyPrefix).get(keyPrefix.concat(String.valueOf(btmName)));
- }
- return (BaseModel) valueWrapper.get();
- } catch (Exception e) {
- logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄", e);
- throw new ServiceException("initBtmError:"+"涓氬姟绫诲瀷锛�"+btmName+":"+e.getMessage());
- }
- }
+ /**
+ * 鍒濆鍖栦笟鍔$被鍨�
+ * --鍒涘缓浜洪粯璁や负褰撳墠鐢ㄦ埛锛屽鏋滈渶瑕佷慨鏀癸紝鍙互鍦ㄨ幏鍙栧悗鑷澶勭悊
+ *
+ * @param btmName 涓氬姟绫诲瀷鐨勫悕绉帮紝浼氳嚜鍔ㄥ彉鎴愬皬鍐�
+ * @return CodeWupinEntity
+ * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父
+ */
+ @Override
+ public BaseModel createCBOByBtmName(String btmName)
+ throws VciBaseException {
+ if (btmName != null) {
+ btmName = btmName.trim().toLowerCase();
+ }
+ try {
+ String keyPrefix = BTM_INIT_CACHE.concat(StringPool.COLON).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
+ Cache.ValueWrapper valueWrapper = CacheUtil.getCache(keyPrefix).get(keyPrefix.concat(String.valueOf(btmName)));
+ if (valueWrapper == null) {
+ CacheUtil.getCache(keyPrefix).put(keyPrefix.concat(String.valueOf(btmName)), createBaseModel(btmName));
+ valueWrapper = CacheUtil.getCache(keyPrefix).get(keyPrefix.concat(String.valueOf(btmName)));
+ }
+ return (BaseModel) valueWrapper.get();
+ } catch (Exception e) {
+ logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄", e);
+ throw new ServiceException("initBtmError:" + "涓氬姟绫诲瀷锛�" + btmName + ":" + e.getMessage());
+ }
+ }
- /**
- * 淇濆瓨鍙緭鍙�夌殑淇℃伅
- *
- * @param templateVO 妯℃澘鐨勫璞�
- * @param cboList 鏁版嵁鐨勫唴瀹�
- */
- @Override
- public void batchSaveSelectChar(CodeClassifyTemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
- List<BaseModel> cboList) {
- if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
- //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜�
- List<CodeClassifyTemplateAttrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryIdentification())).collect(Collectors.toList());
+ /**
+ * 淇濆瓨鍙緭鍙�夌殑淇℃伅
+ *
+ * @param templateVO 妯℃澘鐨勫璞�
+ * @param cboList 鏁版嵁鐨勫唴瀹�
+ */
+ @Override
+ public void batchSaveSelectChar(CodeClassifyTemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
+ List<BaseModel> cboList) {
+ if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
+ //鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜�
+ List<CodeClassifyTemplateAttrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryIdentification())).collect(Collectors.toList());
- if (!CollectionUtils.isEmpty(selectAttrVOs)) {
+ if (!CollectionUtils.isEmpty(selectAttrVOs)) {
//SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
- selectAttrVOs.parallelStream().forEach(attrVO -> {
- List<String> valuesList = new ArrayList<>();
- cboList.parallelStream().forEach(cbo -> {
+ selectAttrVOs.parallelStream().forEach(attrVO -> {
+ List<String> valuesList = new ArrayList<>();
+ cboList.parallelStream().forEach(cbo -> {
//String value = cbo.get.getAttributeValue(attrVO.getId());
- //灏哹ean杞负map,mybatis缁熶竴澶勭悊
- Map<String, String> map = null;
+ //灏哹ean杞负map,mybatis缁熶竴澶勭悊
+ Map<String, String> map = null;
//baseModels.stream().forEach(model-> {
- try {
- map = VciBaseUtil.convertBean2Map(cbo,null);
- } catch (Exception e) {
- throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage());
- }
+ try {
+ map = VciBaseUtil.convertBean2Map(cbo, null);
+ } catch (Exception e) {
+ throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage());
+ }
//});
- String value = map.get(attrVO.getId());
- if (StringUtils.isNotBlank(value)) {
- valuesList.add(value);
- }
- });
- if (!CollectionUtils.isEmpty(valuesList)) {
- for (String s : valuesList) {
- DictBiz dictBiz = new DictBiz();
- dictBiz.setCode(templateVO.getBtmTypeId());
- dictBiz.setDictKey(s);
- dictBiz.setDictValue(s);
- //浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜�
- iDictBizClient.getCheck(dictBiz);
- }
+ String value = map.get(attrVO.getId());
+ if (StringUtils.isNotBlank(value)) {
+ valuesList.add(value);
+ }
+ });
+ if (!CollectionUtils.isEmpty(valuesList)) {
+ for (String s : valuesList) {
+ DictBiz dictBiz = new DictBiz();
+ dictBiz.setCode(templateVO.getBtmTypeId());
+ dictBiz.setDictKey(s);
+ dictBiz.setDictValue(s);
+ //浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜�
+ iDictBizClient.getCheck(dictBiz);
+ }
// charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo);
- }
- });
- }
- }
- }
+ }
+ });
+ }
+ }
+ }
/**
* 灏佽寮�鍏崇殑鍐呭锛屽父鐢ㄤ簬瀵煎嚭
- * @param dataMap 鏁版嵁鐨勫唴瀹�
+ *
+ * @param dataMap 鏁版嵁鐨勫唴瀹�
* @param templateVO 妯℃澘鐨勬樉绀�
*/
@Override
- public void wrapperBoolean(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO){
+ public void wrapperBoolean(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO) {
List<String> booleanAttributes = templateVO.getAttributes().stream().filter(s -> VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(s.getAttributeDataType())).map(s -> s.getId().toLowerCase(Locale.ROOT)).collect(Collectors.toList());
- if(!CollectionUtils.isEmpty(booleanAttributes)){
+ if (!CollectionUtils.isEmpty(booleanAttributes)) {
dataMap.stream().forEach(data -> {
- booleanAttributes.stream().forEach(attrId->{
- if(data.containsKey(attrId)){
+ booleanAttributes.stream().forEach(attrId -> {
+ if (data.containsKey(attrId)) {
String value = data.get(attrId);
- data.put(attrId,BooleanEnum.TRUE.getValue().equalsIgnoreCase(value)?"鏄�":"鍚�");
+ data.put(attrId, BooleanEnum.TRUE.getValue().equalsIgnoreCase(value) ? "鏄�" : "鍚�");
}
});
});
}
}
- @Override
- public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) {
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
- MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
- uiInfoVO.setTemplateVO(templateVO);
- uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid));
- wrapperResemble(templateVO, uiInfoVO);
- return uiInfoVO;
- }
+ @Override
+ public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid) {
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
+ MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
+ uiInfoVO.setTemplateVO(templateVO);
+ uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid));
+ wrapperResemble(templateVO, uiInfoVO);
+ return uiInfoVO;
+ }
- /**
- * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟瀹氫箟鐨勪俊鎭�
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞�
- * @param codeClassifyOid 鍒嗙被鐨勪富閿紝涓虹┖鐨勬椂鍊欙紝鑾峰彇妯℃澘鎵�灞炵殑鍒嗙被涓婚敭.鐢ㄤ簬浜х敓鍒嗙被娉ㄥ叆
- * @return 琛ㄦ牸鐨勪俊鎭�
- */
- private UIFormDefineVO wrapperFormDefineByTemplate(CodeClassifyTemplateVO templateVO, String codeClassifyOid) {
- UIFormDefineVO formDefineVO = new UIFormDefineVO();
- formDefineVO.setOid(templateVO.getOid());
- formDefineVO.setBtmType(templateVO.getBtmTypeId());
- if (StringUtils.isBlank(codeClassifyOid)) {
- codeClassifyOid = templateVO.getCodeclassifyoid();
- }
- CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
+ /**
+ * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟瀹氫箟鐨勪俊鎭�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞�
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿紝涓虹┖鐨勬椂鍊欙紝鑾峰彇妯℃澘鎵�灞炵殑鍒嗙被涓婚敭.鐢ㄤ簬浜х敓鍒嗙被娉ㄥ叆
+ * @return 琛ㄦ牸鐨勪俊鎭�
+ */
+ private UIFormDefineVO wrapperFormDefineByTemplate(CodeClassifyTemplateVO templateVO, String codeClassifyOid) {
+ UIFormDefineVO formDefineVO = new UIFormDefineVO();
+ formDefineVO.setOid(templateVO.getOid());
+ formDefineVO.setBtmType(templateVO.getBtmTypeId());
+ if (StringUtils.isBlank(codeClassifyOid)) {
+ codeClassifyOid = templateVO.getCodeclassifyoid();
+ }
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
- List<UIFormItemVO> itemVOS = new ArrayList<>();
+ List<UIFormItemVO> itemVOS = new ArrayList<>();
Map<String, List<CodeClassifyTemplateAttrVO>> attrGroupMap = new HashMap<>();
if (Func.isNotEmpty(templateVO.getAttributes())) {
@@ -1532,300 +1539,301 @@
itemVOS.add(formItemVO);
});
}
- //澶勭悊灞炴�у垎缁�
- if (!CollectionUtils.isEmpty(attrGroupMap)) {
- //鎸夌収鍒嗙粍鐨勫睘鎬ф帓鍒楋紝鎵惧埌姣忎竴涓垎缁勭殑绗竴涓睘鎬�
- for (String key : attrGroupMap.keySet()) {
- List<CodeClassifyTemplateAttrVO> value = attrGroupMap.get(key);
- //鎵惧埌杩欎釜鍒嗙粍鐨勫睘鎬х殑绗竴涓�
- CodeClassifyTemplateAttrVO attrVO = value.stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).findFirst().get();
- //鎴戜滑鎵惧埌杩欎釜灞炴�у湪鏈�缁堢殑itemVOs閲岀殑浣嶇疆
- UIFormItemVO lineVO = new UIFormItemVO();
- lineVO.setField(attrVO.getId() + "_line");
- lineVO.setType("line");
- lineVO.setText(key);
+ //澶勭悊灞炴�у垎缁�
+ if (!CollectionUtils.isEmpty(attrGroupMap)) {
+ //鎸夌収鍒嗙粍鐨勫睘鎬ф帓鍒楋紝鎵惧埌姣忎竴涓垎缁勭殑绗竴涓睘鎬�
+ for (String key : attrGroupMap.keySet()) {
+ List<CodeClassifyTemplateAttrVO> value = attrGroupMap.get(key);
+ //鎵惧埌杩欎釜鍒嗙粍鐨勫睘鎬х殑绗竴涓�
+ CodeClassifyTemplateAttrVO attrVO = value.stream().sorted(((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()))).findFirst().get();
+ //鎴戜滑鎵惧埌杩欎釜灞炴�у湪鏈�缁堢殑itemVOs閲岀殑浣嶇疆
+ UIFormItemVO lineVO = new UIFormItemVO();
+ lineVO.setField(attrVO.getId() + "_line");
+ lineVO.setType("line");
+ lineVO.setText(key);
List<CodeClassifyTemplateAttrVO> collect = value.stream().filter(s -> "true".equals(s.getFormDisplayFlag())).collect(Collectors.toList());
- if(collect.size() == 0){
+ if (collect.size() == 0) {
continue;
}
//鎵句綅缃�
- for (int i = 0; i < itemVOS.size(); i++) {
- UIFormItemVO record = itemVOS.get(i);
- if (record.getField().equalsIgnoreCase(attrVO.getId())) {
- itemVOS.add(i, lineVO);
- break;
- }
- }
- }
- }
+ for (int i = 0; i < itemVOS.size(); i++) {
+ UIFormItemVO record = itemVOS.get(i);
+ if (record.getField().equalsIgnoreCase(attrVO.getId())) {
+ itemVOS.add(i, lineVO);
+ break;
+ }
+ }
+ }
+ }
- CodeOrderDTO orderDTO = new CodeOrderDTO();
- switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
- if (!CollectionUtils.isEmpty(orderDTO.getData())) {
- orderDTO.getData().forEach((key, value) -> {
- for (int i = 0; i < itemVOS.size(); i++) {
- UIFormItemVO itemVO = itemVOS.get(i);
- if (itemVO.getField().equalsIgnoreCase(key)) {
- itemVO.setDefaultValue(value);
- break;
- }
- }
- });
- }
- formDefineVO.setItems(itemVOS);
- //鏌ヨ鏄惁鏈夊垎绫绘敞鍏ョ殑
- return formDefineVO;
- }
+ CodeOrderDTO orderDTO = new CodeOrderDTO();
+ switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
+ if (!CollectionUtils.isEmpty(orderDTO.getData())) {
+ orderDTO.getData().forEach((key, value) -> {
+ for (int i = 0; i < itemVOS.size(); i++) {
+ UIFormItemVO itemVO = itemVOS.get(i);
+ if (itemVO.getField().equalsIgnoreCase(key)) {
+ itemVO.setDefaultValue(value);
+ break;
+ }
+ }
+ });
+ }
+ formDefineVO.setItems(itemVOS);
+ //鏌ヨ鏄惁鏈夊垎绫绘敞鍏ョ殑
+ return formDefineVO;
+ }
- /**
- * 灞炴�х被鍨嬩笌js涓殑瀛楁绫诲瀷鐨勬槧灏�
- */
- private static Map<String, String> vciFieldTypeMap = new HashMap<String, String>() {{
- put(VciFieldTypeEnum.VTString.name(), "text");
- put(VciFieldTypeEnum.VTInteger.name(), "text");
- put(VciFieldTypeEnum.VTLong.name(), "text");
- put(VciFieldTypeEnum.VTDouble.name(), "text");
- put(VciFieldTypeEnum.VTClob.name(), "text");
- put(VciFieldTypeEnum.VTBoolean.name(), "truefalse");
- put(VciFieldTypeEnum.VTDateTime.name(), "datetime");
- put(VciFieldTypeEnum.VTDate.name(), "datetime");
- put(VciFieldTypeEnum.VTTime.name(), "datetime");
- put(VciFieldTypeEnum.VTFilePath.name(), "file");
- }};
+ /**
+ * 灞炴�х被鍨嬩笌js涓殑瀛楁绫诲瀷鐨勬槧灏�
+ */
+ private static Map<String, String> vciFieldTypeMap = new HashMap<String, String>() {{
+ put(VciFieldTypeEnum.VTString.name(), "text");
+ put(VciFieldTypeEnum.VTInteger.name(), "text");
+ put(VciFieldTypeEnum.VTLong.name(), "text");
+ put(VciFieldTypeEnum.VTDouble.name(), "text");
+ put(VciFieldTypeEnum.VTClob.name(), "text");
+ put(VciFieldTypeEnum.VTBoolean.name(), "truefalse");
+ put(VciFieldTypeEnum.VTDateTime.name(), "datetime");
+ put(VciFieldTypeEnum.VTDate.name(), "datetime");
+ put(VciFieldTypeEnum.VTTime.name(), "datetime");
+ put(VciFieldTypeEnum.VTFilePath.name(), "file");
+ }};
- /**
- * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟鐨勫瓧娈�
- *
- * @param attrVO 妯℃澘灞炴��
- * @param btmType 涓氬姟绫诲瀷
- * @return 琛ㄥ崟鐨勫瓧娈�
- */
- @Override
- public UIFormItemVO templateAttr2FormField(CodeClassifyTemplateAttrVO attrVO, String btmType) {
+ /**
+ * 妯℃澘灞炴�ц浆鎹负琛ㄥ崟鐨勫瓧娈�
+ *
+ * @param attrVO 妯℃澘灞炴��
+ * @param btmType 涓氬姟绫诲瀷
+ * @return 琛ㄥ崟鐨勫瓧娈�
+ */
+ @Override
+ public UIFormItemVO templateAttr2FormField(CodeClassifyTemplateAttrVO attrVO, String btmType) {
- UIFormItemVO itemVO = new UIFormItemVO();
- if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
+ UIFormItemVO itemVO = new UIFormItemVO();
+ if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
// attrVO.setEnumid(OsEnumServiceImpl.MY_DATA_SECRET);
- attrVO.setEnumId(MY_DATA_SECRET);
- }
- itemVO.setField(attrVO.getId());
- itemVO.setText(attrVO.getName());
- itemVO.setType(vciFieldTypeMap.getOrDefault(attrVO.getAttributeDataType(), "text"));
- if (VciBaseUtil.getBoolean(attrVO.getTextAreaFlag())) {
- itemVO.setType("textarea");
- }
- if (VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(attrVO.getAttributeDataType())
- || VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(attrVO.getAttributeDataType())
- || VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrVO.getAttributeDataType())) {
- itemVO.setVerify("number");
- }
- itemVO.setReadOnly(VciBaseUtil.getBoolean(attrVO.getReadOnlyFlag()));
- itemVO.setKeyAttr(VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag()));
- itemVO.setRequired(VciBaseUtil.getBoolean(attrVO.getRequireFlag()));
- itemVO.setDefaultValue(attrVO.getDefaultValue());
- itemVO.setDateFormate(attrVO.getCodeDateFormat());
- itemVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormDisplayFlag()));
- itemVO.setVerify(attrVO.getVerifyRule());
- itemVO.setPrefix(attrVO.getPrefixValue());
- itemVO.setSuffix(attrVO.getSuffixValue());
- itemVO.setTooltips(attrVO.getExplain());
- itemVO.setInputTip(attrVO.getInputTip());
- itemVO.setSelectLibFlag(attrVO.getLibraryIdentification());
- //鐪嬬湅鏄惁鏈夋灇涓�
- if ((StringUtils.isNotBlank(attrVO.getEnumString())
- && !"[]".equalsIgnoreCase(attrVO.getEnumString())) ||
- StringUtils.isNotBlank(attrVO.getEnumId())) {
- itemVO.setType("combox");
- itemVO.setComboxKey(attrVO.getEnumId());
- if (StringUtils.isNotBlank(attrVO.getEnumString())) {
- //鎸囧畾鐨勪笅鎷夋鍐呭
- itemVO.setData(JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class));
- if (StringUtils.isBlank(attrVO.getEnumId())) {
- itemVO.setComboxKey(itemVO.getField() + "_data");
- }
- }
- }
- //鐪嬫槸鍚︽湁鍙傜収
- if (StringUtils.isNotBlank(attrVO.getReferBtmId()) || StringUtils.isNotBlank(attrVO.getReferConfig())) {
- itemVO.setType("refer");
- itemVO.setShowField(itemVO.getField() + "name");
- if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
- // 閰嶇疆鐨勫唴瀹�
- // itemVO.setReferConfig(JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class));
+ attrVO.setEnumId(MY_DATA_SECRET);
+ }
+ itemVO.setField(attrVO.getId());
+ itemVO.setText(attrVO.getName());
+ itemVO.setType(vciFieldTypeMap.getOrDefault(attrVO.getAttributeDataType(), "text"));
+ if (VciBaseUtil.getBoolean(attrVO.getTextAreaFlag())) {
+ itemVO.setType("textarea");
+ }
+ if (VciFieldTypeEnum.VTLong.name().equalsIgnoreCase(attrVO.getAttributeDataType())
+ || VciFieldTypeEnum.VTInteger.name().equalsIgnoreCase(attrVO.getAttributeDataType())
+ || VciFieldTypeEnum.VTDouble.name().equalsIgnoreCase(attrVO.getAttributeDataType())) {
+ itemVO.setVerify("number");
+ }
+ itemVO.setReadOnly(VciBaseUtil.getBoolean(attrVO.getReadOnlyFlag()));
+ itemVO.setKeyAttr(VciBaseUtil.getBoolean(attrVO.getKeyAttrFlag()));
+ itemVO.setRequired(VciBaseUtil.getBoolean(attrVO.getRequireFlag()));
+ itemVO.setDefaultValue(attrVO.getDefaultValue());
+ itemVO.setDateFormate(attrVO.getCodeDateFormat());
+ itemVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormDisplayFlag()));
+ itemVO.setVerify(attrVO.getVerifyRule());
+ itemVO.setPrefix(attrVO.getPrefixValue());
+ itemVO.setSuffix(attrVO.getSuffixValue());
+ itemVO.setTooltips(attrVO.getExplain());
+ itemVO.setInputTip(attrVO.getInputTip());
+ itemVO.setSelectLibFlag(attrVO.getLibraryIdentification());
+ //鐪嬬湅鏄惁鏈夋灇涓�
+ if ((StringUtils.isNotBlank(attrVO.getEnumString())
+ && !"[]".equalsIgnoreCase(attrVO.getEnumString())) ||
+ StringUtils.isNotBlank(attrVO.getEnumId())) {
+ itemVO.setType("combox");
+ itemVO.setComboxKey(attrVO.getEnumId());
+ if (StringUtils.isNotBlank(attrVO.getEnumString())) {
+ //鎸囧畾鐨勪笅鎷夋鍐呭
+ itemVO.setData(JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class));
+ if (StringUtils.isBlank(attrVO.getEnumId())) {
+ itemVO.setComboxKey(itemVO.getField() + "_data");
+ }
+ }
+ }
+ //鐪嬫槸鍚︽湁鍙傜収
+ if (StringUtils.isNotBlank(attrVO.getReferBtmId()) || StringUtils.isNotBlank(attrVO.getReferConfig())) {
+ itemVO.setType("refer");
+ itemVO.setShowField(itemVO.getField() + "name");
+ if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
+ // 閰嶇疆鐨勫唴瀹�
+ // itemVO.setReferConfig(JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class));
itemVO.setReferConfig(referConfigToUIUiTable(attrVO.getReferConfig()));
- } else {
- UIFormReferVO formReferVO = new UIFormReferVO();
- formReferVO.setType("default");
- formReferVO.setReferType(attrVO.getReferBtmId());
- itemVO.setReferConfig(formReferVO);
- }
- }
+ } else {
+ UIFormReferVO formReferVO = new UIFormReferVO();
+ formReferVO.setType("default");
+ formReferVO.setReferType(attrVO.getReferBtmId());
+ itemVO.setReferConfig(formReferVO);
+ }
+ }
- //濡傛灉鏄粍鍚堣鍒欙紝鍒嗙被娉ㄥ叆鐨勶紝鏄剧ず涓哄彧璇�
- if (StringUtils.isNotBlank(attrVO.getComponentRule())) {
- itemVO.setReadOnly(true);
- itemVO.setTooltips("鏈睘鎬т负缁勫悎瑙勫垯");
- itemVO.setRequired(false);
- }
- if (StringUtils.isNotBlank(attrVO.getClassifyInvokeAttr())) {
- itemVO.setReadOnly(!VciBaseUtil.getBoolean(attrVO.getClassifyInvokeEditFlag()));
- itemVO.setTooltips("鏈睘鎬ф槸鍒嗙被娉ㄥ叆");
- itemVO.setRequired(false);
- }
+ //濡傛灉鏄粍鍚堣鍒欙紝鍒嗙被娉ㄥ叆鐨勶紝鏄剧ず涓哄彧璇�
+ if (StringUtils.isNotBlank(attrVO.getComponentRule())) {
+ itemVO.setReadOnly(true);
+ itemVO.setTooltips("鏈睘鎬т负缁勫悎瑙勫垯");
+ itemVO.setRequired(false);
+ }
+ if (StringUtils.isNotBlank(attrVO.getClassifyInvokeAttr())) {
+ itemVO.setReadOnly(!VciBaseUtil.getBoolean(attrVO.getClassifyInvokeEditFlag()));
+ itemVO.setTooltips("鏈睘鎬ф槸鍒嗙被娉ㄥ叆");
+ itemVO.setRequired(false);
+ }
- if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(itemVO.getField())) {
- //鏄敓鍛藉懆鏈熺姸鎬�
- itemVO.setType("combox");
- itemVO.setComboxKey(btmType + LC_STATUS_SUBFIX);
- }
- return itemVO;
- }
+ if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(itemVO.getField())) {
+ //鏄敓鍛藉懆鏈熺姸鎬�
+ itemVO.setType("combox");
+ itemVO.setComboxKey(btmType + LC_STATUS_SUBFIX);
+ }
+ return itemVO;
+ }
- /**
- * 灏佽鐩镐技椤规煡璇㈢殑鍒楄〃
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞�
- * @param uiInfoVO 椤甸潰鐨勪俊鎭�
- */
- private void wrapperResemble(CodeClassifyTemplateVO templateVO, MdmUIInfoVO uiInfoVO) {
- List<CodeClassifyTemplateAttrVO> resembleAttrList = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSameRepeatAttrFlag())
- || VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).collect(Collectors.toList());
- if (!CollectionUtils.isEmpty(resembleAttrList) && resembleAttrList.size() > 1) {
- UITableDefineVO resembleTable = new UITableDefineVO();
- resembleTable.setOid(templateVO.getOid());
- resembleTable.setBtmType(templateVO.getBtmTypeId());
- resembleTable.setDisplayQueryArea(false);
- resembleTable.setPageVO(new UITablePageVO());
- //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌
- List<UITableFieldVO> fieldVOList = new ArrayList<>();
- resembleAttrList.forEach(attrVO -> {
- UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO, false);
- tableFieldVO.setHidden(false);
- fieldVOList.add(tableFieldVO);
- });
- List<List<UITableFieldVO>> cols = new ArrayList<>();
- cols.add(fieldVOList);
- resembleTable.setCols(cols);
- uiInfoVO.setResembleTableVO(resembleTable);
- }
- }
+ /**
+ * 灏佽鐩镐技椤规煡璇㈢殑鍒楄〃
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞�
+ * @param uiInfoVO 椤甸潰鐨勪俊鎭�
+ */
+ private void wrapperResemble(CodeClassifyTemplateVO templateVO, MdmUIInfoVO uiInfoVO) {
+ List<CodeClassifyTemplateAttrVO> resembleAttrList = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSameRepeatAttrFlag())
+ || VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).collect(Collectors.toList());
+ if (!CollectionUtils.isEmpty(resembleAttrList) && resembleAttrList.size() > 1) {
+ UITableDefineVO resembleTable = new UITableDefineVO();
+ resembleTable.setOid(templateVO.getOid());
+ resembleTable.setBtmType(templateVO.getBtmTypeId());
+ resembleTable.setDisplayQueryArea(false);
+ resembleTable.setPageVO(new UITablePageVO());
+ //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌
+ List<UITableFieldVO> fieldVOList = new ArrayList<>();
+ resembleAttrList.forEach(attrVO -> {
+ UITableFieldVO tableFieldVO = templateAttr2TableField(attrVO, false);
+ tableFieldVO.setHidden(false);
+ fieldVOList.add(tableFieldVO);
+ });
+ List<List<UITableFieldVO>> cols = new ArrayList<>();
+ cols.add(fieldVOList);
+ resembleTable.setCols(cols);
+ uiInfoVO.setResembleTableVO(resembleTable);
+ }
+ }
- /**
- * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸鏄剧ず鐨勯厤缃�
- *
- * @param attrVO 妯℃澘灞炴��
- * @param forEdit 鏄惁鏄紪杈戞墍闇�
- * @return 琛ㄦ牸鐨勫瓧娈�
- */
- @Override
- public UITableFieldVO templateAttr2TableField(CodeClassifyTemplateAttrVO attrVO, boolean forEdit) {
- UITableFieldVO fieldVO = new UITableFieldVO();
- if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
- attrVO.setEnumId(MY_DATA_SECRET);
- }
- fieldVO.setField(attrVO.getId());
- fieldVO.setTitle(attrVO.getName());
- fieldVO.setFieldType(vciFieldTypeMap.getOrDefault(attrVO.getAttributeDataType(), "text"));
- fieldVO.setSort(true);
- fieldVO.setSortField(fieldVO.getField());
- fieldVO.setQueryField(fieldVO.getField());
- if (forEdit) {
- fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormDisplayFlag()));
- } else {
- fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getTableDisplayFlag()));
- }
- if (attrVO.getAttrTableWidth() != null && attrVO.getAttrTableWidth() > 0) {
- fieldVO.setMinWidth(Integer.valueOf(attrVO.getAttrTableWidth()));
- fieldVO.setWidth(Integer.valueOf(attrVO.getAttrTableWidth()));
- }
- //鐪嬬湅鏄惁鏈夋灇涓�
- if ((StringUtils.isNotBlank(attrVO.getEnumString())
- && !"[]".equalsIgnoreCase(attrVO.getEnumString())) ||
- StringUtils.isNotBlank(attrVO.getEnumId())) {
- fieldVO.setFieldType("combox");
- fieldVO.setField(fieldVO.getField() + "Text");
- fieldVO.setComboxKey(attrVO.getEnumId());
- if (StringUtils.isNotBlank(attrVO.getEnumString())) {
- //鎸囧畾鐨勪笅鎷夋鍐呭
- fieldVO.setData(JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class));
- if (StringUtils.isBlank(attrVO.getEnumId())) {
- fieldVO.setComboxKey(fieldVO.getField() + "_data");
- }
- } else {
- List<KeyValue> osEnumItemVOList = VciOmdUtil.enumsToListKeyVale(EnumCache.getList(attrVO.getEnumId()));
- fieldVO.setData(osEnumItemVOList);
- }
- }
- //鐪嬫槸鍚︽湁鍙傜収
- if (StringUtils.isNotBlank(attrVO.getReferBtmId()) || StringUtils.isNotBlank(attrVO.getReferConfig())) {
- fieldVO.setFieldType("refer");
- fieldVO.setQueryField(fieldVO.getField());
- fieldVO.setField(fieldVO.getField() + "name");
- fieldVO.setShowField(fieldVO.getField());
- if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
- //閰嶇疆鐨勫唴瀹�
- // fieldVO.setReferConfig(JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class));
+ /**
+ * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸鏄剧ず鐨勯厤缃�
+ *
+ * @param attrVO 妯℃澘灞炴��
+ * @param forEdit 鏄惁鏄紪杈戞墍闇�
+ * @return 琛ㄦ牸鐨勫瓧娈�
+ */
+ @Override
+ public UITableFieldVO templateAttr2TableField(CodeClassifyTemplateAttrVO attrVO, boolean forEdit) {
+ UITableFieldVO fieldVO = new UITableFieldVO();
+ if (SECRET_FILED.equalsIgnoreCase(attrVO.getId())) {
+ attrVO.setEnumId(MY_DATA_SECRET);
+ }
+ fieldVO.setField(attrVO.getId());
+ fieldVO.setTitle(attrVO.getName());
+ fieldVO.setFieldType(vciFieldTypeMap.getOrDefault(attrVO.getAttributeDataType(), "text"));
+ fieldVO.setSort(true);
+ fieldVO.setSortField(fieldVO.getField());
+ fieldVO.setQueryField(fieldVO.getField());
+ if (forEdit) {
+ fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getFormDisplayFlag()));
+ } else {
+ fieldVO.setHidden(!VciBaseUtil.getBoolean(attrVO.getTableDisplayFlag()));
+ }
+ if (attrVO.getAttrTableWidth() != null && attrVO.getAttrTableWidth() > 0) {
+ fieldVO.setMinWidth(Integer.valueOf(attrVO.getAttrTableWidth()));
+ fieldVO.setWidth(Integer.valueOf(attrVO.getAttrTableWidth()));
+ }
+ //鐪嬬湅鏄惁鏈夋灇涓�
+ if ((StringUtils.isNotBlank(attrVO.getEnumString())
+ && !"[]".equalsIgnoreCase(attrVO.getEnumString())) ||
+ StringUtils.isNotBlank(attrVO.getEnumId())) {
+ fieldVO.setFieldType("combox");
+ fieldVO.setField(fieldVO.getField() + "Text");
+ fieldVO.setComboxKey(attrVO.getEnumId());
+ if (StringUtils.isNotBlank(attrVO.getEnumString())) {
+ //鎸囧畾鐨勪笅鎷夋鍐呭
+ fieldVO.setData(JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class));
+ if (StringUtils.isBlank(attrVO.getEnumId())) {
+ fieldVO.setComboxKey(fieldVO.getField() + "_data");
+ }
+ } else {
+ List<KeyValue> osEnumItemVOList = VciOmdUtil.enumsToListKeyVale(EnumCache.getList(attrVO.getEnumId()));
+ fieldVO.setData(osEnumItemVOList);
+ }
+ }
+ //鐪嬫槸鍚︽湁鍙傜収
+ if (StringUtils.isNotBlank(attrVO.getReferBtmId()) || StringUtils.isNotBlank(attrVO.getReferConfig())) {
+ fieldVO.setFieldType("refer");
+ fieldVO.setQueryField(fieldVO.getField());
+ fieldVO.setField(fieldVO.getField() + "name");
+ fieldVO.setShowField(fieldVO.getField());
+ if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
+ //閰嶇疆鐨勫唴瀹�
+ // fieldVO.setReferConfig(JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class));
fieldVO.setReferConfig(referConfigToUIUiTable(attrVO.getReferConfig()));
- } else {
- UIFormReferVO formReferVO = new UIFormReferVO();
- formReferVO.setType("default");
- formReferVO.setReferType(attrVO.getReferBtmId());
- fieldVO.setReferConfig(formReferVO);
- }
- }
- if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(fieldVO.getSortField())) {
- fieldVO.setField("lcstatus_text");
- }
- Map<String, String> eventJsMap = new HashMap<>();
- //瓒呴摼鎺ヤ笌妯℃澘鏄簰鏂�
- if (StringUtils.isNotBlank(attrVO.getTableHref())) {
- String event = fieldVO.getSortField() + "_href";
- eventJsMap.put(event, attrVO.getTableHref());
- fieldVO.setTemplet("function(d){ return '<a class=\"layui-btn layui-btn-intable \" lay-event=\"" + event + "\">d." + fieldVO.getField() + "</a>';}");
- }
- if (StringUtils.isNotBlank(attrVO.getTableDisplayJs())) {
- //鐩存帴鍐檉unction(d){ return xxxxx;}
- fieldVO.setTemplet(attrVO.getTableDisplayJs());
- }
- if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributeDataType())) {
- fieldVO.setTemplet("function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'鏄�':'鍚�'}");
+ } else {
+ UIFormReferVO formReferVO = new UIFormReferVO();
+ formReferVO.setType("default");
+ formReferVO.setReferType(attrVO.getReferBtmId());
+ fieldVO.setReferConfig(formReferVO);
+ }
+ }
+ if (VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(fieldVO.getSortField())) {
+ fieldVO.setField("lcstatus_text");
+ }
+ Map<String, String> eventJsMap = new HashMap<>();
+ //瓒呴摼鎺ヤ笌妯℃澘鏄簰鏂�
+ if (StringUtils.isNotBlank(attrVO.getTableHref())) {
+ String event = fieldVO.getSortField() + "_href";
+ eventJsMap.put(event, attrVO.getTableHref());
+ fieldVO.setTemplet("function(d){ return '<a class=\"layui-btn layui-btn-intable \" lay-event=\"" + event + "\">d." + fieldVO.getField() + "</a>';}");
+ }
+ if (StringUtils.isNotBlank(attrVO.getTableDisplayJs())) {
+ //鐩存帴鍐檉unction(d){ return xxxxx;}
+ fieldVO.setTemplet(attrVO.getTableDisplayJs());
+ }
+ if (StringUtils.isBlank(fieldVO.getTemplet()) && VciFieldTypeEnum.VTBoolean.name().equalsIgnoreCase(attrVO.getAttributeDataType())) {
+ fieldVO.setTemplet("function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'鏄�':'鍚�'}");
// fieldVO.setTemplet("function(d){return $webUtil.formateBoolean(d." + fieldVO.getField() + ");}");
- }
- fieldVO.setOptionJsMap(eventJsMap);
- fieldVO.setStyle(attrVO.getTableDisplayStyle());
- fieldVO.setTableDisplayFlag(attrVO.getTableDisplayFlag());
- //鍒楄〃閲屼笉鍏佽鐩存帴缂栬緫
- fieldVO.setDateFormate(attrVO.getCodeDateFormat());
- return fieldVO;
- }
+ }
+ fieldVO.setOptionJsMap(eventJsMap);
+ fieldVO.setStyle(attrVO.getTableDisplayStyle());
+ fieldVO.setTableDisplayFlag(attrVO.getTableDisplayFlag());
+ //鍒楄〃閲屼笉鍏佽鐩存帴缂栬緫
+ fieldVO.setDateFormate(attrVO.getCodeDateFormat());
+ return fieldVO;
+ }
/**
* 灏唕eferconfig杞崲涓篔SON鏍煎紡鐨刄IFormReferVO
+ *
* @param codeReferConfigVO
* @return
*/
- private UIFormReferVO referConfigToUIUiTable(String codeReferConfigVO){
+ private UIFormReferVO referConfigToUIUiTable(String codeReferConfigVO) {
CodeReferConfigVO codeReferConfig = JSONObject.parseObject(codeReferConfigVO, CodeReferConfigVO.class);
// 鎷疯礉涓轰互鍓嶇殑鑰佸璞�
UIFormReferVO uiFormReferVO = new UIFormReferVO();
- org.springblade.core.tool.utils.BeanUtil.copy(codeReferConfig,uiFormReferVO);
+ org.springblade.core.tool.utils.BeanUtil.copy(codeReferConfig, uiFormReferVO);
// 琛ㄦ牸鐨勮嚜瀹氫箟瀹氫箟
UITableCustomDefineVO uiTableConfigVO = new UITableCustomDefineVO();
- uiTableConfigVO.setPage(new UITablePageVO(codeReferConfig.getLimit(),1));
+ uiTableConfigVO.setPage(new UITablePageVO(codeReferConfig.getLimit(), 1));
// 鍒楄〃鐨勫垪鐨勪俊鎭浆鎹�
List<UITableFieldVO> uiTableFieldVOs = new ArrayList<>();
// 蹇�熸煡璇㈠垪
List<UITableFieldVO> queryColumns = new ArrayList<>();
- if(!CollectionUtils.isEmpty(codeReferConfig.getCodeShowFieldConfigVOS())){
- codeReferConfig.getCodeShowFieldConfigVOS().stream().forEach(showField ->{
+ if (!CollectionUtils.isEmpty(codeReferConfig.getCodeShowFieldConfigVOS())) {
+ codeReferConfig.getCodeShowFieldConfigVOS().stream().forEach(showField -> {
UITableFieldVO tableColVO = new UITableFieldVO();
- org.springblade.core.tool.utils.BeanUtil.copy(showField,tableColVO);
+ org.springblade.core.tool.utils.BeanUtil.copy(showField, tableColVO);
tableColVO.setSortField(showField.getAttrSortField());
uiTableFieldVOs.add(tableColVO);
- if(showField.getIsQuery().equals("true")){
+ if (showField.getIsQuery().equals("true")) {
queryColumns.add(tableColVO);
}
});
@@ -1838,187 +1846,187 @@
uiFormReferVO.setTableConfig(uiTableConfigVO);
//瀛楁鍚嶄笉涓�鑷达紝闇�瑕佹墜鍔╯et
- uiFormReferVO.setMuti(StringUtils.isBlank(codeReferConfig.getIsMuti())?false:true);
- uiFormReferVO.setInitSort(new UIFieldSortVO(codeReferConfig.getSortField(),codeReferConfig.getSortType()));
+ uiFormReferVO.setMuti(StringUtils.isBlank(codeReferConfig.getIsMuti()) ? false : true);
+ uiFormReferVO.setInitSort(new UIFieldSortVO(codeReferConfig.getSortField(), codeReferConfig.getSortType()));
// 绛涢�夋潯浠�
HashMap<String, String> whereMap = new HashMap<>();
- if(!CollectionUtils.isEmpty(codeReferConfig.getCodeSrchCondConfigVOS())){
- codeReferConfig.getCodeSrchCondConfigVOS().stream().forEach(srch->{
- whereMap.put(srch.getFilterField()+srch.getFilterType(),srch.getFilterValue());
+ if (!CollectionUtils.isEmpty(codeReferConfig.getCodeSrchCondConfigVOS())) {
+ codeReferConfig.getCodeSrchCondConfigVOS().stream().forEach(srch -> {
+ whereMap.put(srch.getFilterField() + srch.getFilterType(), srch.getFilterValue());
});
}
uiFormReferVO.setWhere(whereMap);
return uiFormReferVO;
}
- /**
- * 鐩镐技椤规煡璇�
- *
- * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭�
- * @return 鏁版嵁鍒楄〃
- */
- @Override
- public DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO) {
- VciBaseUtil.alertNotNull(orderDTO, "鐢宠鐨勪俊鎭�", orderDTO.getCodeClassifyOid(), "鍒嗙被涓婚敭", orderDTO.getTemplateOid(), "妯℃澘涓婚敭");
- CodeClassifyFullInfoBO fullInfoBO = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
- switchClassifyLevelOnOrder(templateVO, fullInfoBO, orderDTO);
- switchDateAttrOnOrder(templateVO, orderDTO);
- switchComponentAttrOnOrder(templateVO, orderDTO);
- //闇�瑕佽幏鍙栨槸鍚︽湁鐩镐技鏌ヨ灞炴��
- Map<String, CodeClassifyTemplateAttrVO> attrVOs = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSameRepeatAttrFlag())).collect(Collectors.toMap(s -> s.getId(), t -> t));
- if (CollectionUtils.isEmpty(attrVOs)) {
- //閮芥病鏈夊睘鎬э紝鑲畾涓嶈兘鏌ヨ浜�
- return new DataGrid<>();
- }
- Map<String, String> conditionMap = new HashMap<>();
- //鎴戜滑棣栧厛鑾峰彇鏈夋病鏈夋煡璇㈣鍒�
- CodeResembleRuleVO resembleRuleVO = Optional.ofNullable(getUseResembleRule(fullInfoBO, fullInfoBO.getCurrentClassifyVO())).orElseGet(() -> new CodeResembleRuleVO());
- attrVOs.forEach((attrId, attrVO) -> {
- String value = getValueFromOrderDTO(orderDTO, attrId);
- if (value == null) {
- value = "";
- }
- wrapperResembleConditionMap(value, resembleRuleVO, attrId, conditionMap);
- });
+ /**
+ * 鐩镐技椤规煡璇�
+ *
+ * @param orderDTO 缂栫爜鐨勭浉鍏充俊鎭�
+ * @return 鏁版嵁鍒楄〃
+ */
+ @Override
+ public DataGrid<Map<String, String>> resembleQuery(CodeOrderDTO orderDTO) {
+ VciBaseUtil.alertNotNull(orderDTO, "鐢宠鐨勪俊鎭�", orderDTO.getCodeClassifyOid(), "鍒嗙被涓婚敭", orderDTO.getTemplateOid(), "妯℃澘涓婚敭");
+ CodeClassifyFullInfoBO fullInfoBO = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
+ switchClassifyLevelOnOrder(templateVO, fullInfoBO, orderDTO);
+ switchDateAttrOnOrder(templateVO, orderDTO);
+ switchComponentAttrOnOrder(templateVO, orderDTO);
+ //闇�瑕佽幏鍙栨槸鍚︽湁鐩镐技鏌ヨ灞炴��
+ Map<String, CodeClassifyTemplateAttrVO> attrVOs = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getSameRepeatAttrFlag())).collect(Collectors.toMap(s -> s.getId(), t -> t));
+ if (CollectionUtils.isEmpty(attrVOs)) {
+ //閮芥病鏈夊睘鎬э紝鑲畾涓嶈兘鏌ヨ浜�
+ return new DataGrid<>();
+ }
+ Map<String, String> conditionMap = new HashMap<>();
+ //鎴戜滑棣栧厛鑾峰彇鏈夋病鏈夋煡璇㈣鍒�
+ CodeResembleRuleVO resembleRuleVO = Optional.ofNullable(getUseResembleRule(fullInfoBO, fullInfoBO.getCurrentClassifyVO())).orElseGet(() -> new CodeResembleRuleVO());
+ attrVOs.forEach((attrId, attrVO) -> {
+ String value = getValueFromOrderDTO(orderDTO, attrId);
+ if (value == null) {
+ value = "";
+ }
+ wrapperResembleConditionMap(value, resembleRuleVO, attrId, conditionMap);
+ });
- //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
- if (!CollectionUtils.isEmpty(conditionMap)) {
- Map<String, String> andConditionMap = new HashMap<>();
- andConditionMap.put("t.lastr", "1");
- andConditionMap.put("t.lastv", "1");
- if (StringUtils.isNotBlank(orderDTO.getOid())) {
- andConditionMap.put("t.oid", QueryOptionConstant.NOTEQUAL + orderDTO.getOid());
- }
- conditionMap.putAll(andConditionMap);
- PageHelper pageHelper = new PageHelper(-1);
- pageHelper.addDefaultDesc("id");
- return queryGrid(fullInfoBO.getTopClassifyVO().getBtmTypeId(), templateVO, conditionMap, pageHelper);
- }
- return new DataGrid<>();
- }
+ //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
+ if (!CollectionUtils.isEmpty(conditionMap)) {
+ Map<String, String> andConditionMap = new HashMap<>();
+ andConditionMap.put("t.lastr", "1");
+ andConditionMap.put("t.lastv", "1");
+ if (StringUtils.isNotBlank(orderDTO.getOid())) {
+ andConditionMap.put("t.oid", QueryOptionConstant.NOTEQUAL + orderDTO.getOid());
+ }
+ conditionMap.putAll(andConditionMap);
+ PageHelper pageHelper = new PageHelper(-1);
+ pageHelper.addDefaultDesc("id");
+ return queryGrid(fullInfoBO.getTopClassifyVO().getBtmTypeId(), templateVO, conditionMap, pageHelper);
+ }
+ return new DataGrid<>();
+ }
- /**
- * 鑾峰彇浣跨敤鐨勭浉浼兼煡璇㈣鍒�
- *
- * @param fullInfoBO 绫诲叏閮ㄤ俊鎭�
- * @param currentClassifyVO 褰撳墠鐨勫垎绫�
- * @return 瑙勫垯锛屽鏋滀笉瀛樺湪浼氳繑鍥濶ull
- */
- @Override
- public CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO) {
- if (currentClassifyVO == null) {
- return null;
- }
- if (currentClassifyVO != null && StringUtils.isNotBlank(currentClassifyVO.getCodeResembleRuleOid())) {
- //璇存槑宸茬粡瀛樺湪
- return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid());
- }
- if (StringUtils.isBlank(currentClassifyVO.getParentCodeClassifyOid())) {
- return null;
- }
- Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
- return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentCodeClassifyOid(), null));
- }
+ /**
+ * 鑾峰彇浣跨敤鐨勭浉浼兼煡璇㈣鍒�
+ *
+ * @param fullInfoBO 绫诲叏閮ㄤ俊鎭�
+ * @param currentClassifyVO 褰撳墠鐨勫垎绫�
+ * @return 瑙勫垯锛屽鏋滀笉瀛樺湪浼氳繑鍥濶ull
+ */
+ @Override
+ public CodeResembleRuleVO getUseResembleRule(CodeClassifyFullInfoBO fullInfoBO, CodeClassifyVO currentClassifyVO) {
+ if (currentClassifyVO == null) {
+ return null;
+ }
+ if (currentClassifyVO != null && StringUtils.isNotBlank(currentClassifyVO.getCodeResembleRuleOid())) {
+ //璇存槑宸茬粡瀛樺湪
+ return resembleRuleService.getObjectByOid(currentClassifyVO.getCodeResembleRuleOid());
+ }
+ if (StringUtils.isBlank(currentClassifyVO.getParentCodeClassifyOid())) {
+ return null;
+ }
+ Map<String, CodeClassifyVO> classifyVOMap = fullInfoBO.getParentClassifyVOs().stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
+ return getUseResembleRule(fullInfoBO, classifyVOMap.getOrDefault(currentClassifyVO.getParentCodeClassifyOid(), null));
+ }
- /**
- * 灏佽鐩镐技椤规煡璇㈢殑鏌ヨ鏉′欢鐨勬槧灏�
- *
- * @param value 鍊�
- * @param resembleRuleVO 鐩镐技椤硅鍒�
- * @param attrId 灞炴�х殑缂栧彿
- * @param conditionMap 鏌ヨ鏉′欢
- */
- @Override
- public void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap) {
- boolean ignoreSpace = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorespaceflag()) || VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
- if (StringUtils.isBlank(value)) {
- //涓虹┖鐨勬椂鍊欏氨涓嶆煡璇㈠畠灏辨槸
- } else {
- String queryKey = "";
- String queryValue = "";
- boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag());
- boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag());
- boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
- boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
- String temp = "";
- if (ignoreCase && ignoreSpace && ignoreWidth) {
- //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙�
- temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte('%s')) " + (trimAll ? ",' ','')" : ")");
- } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
- //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
- temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
- } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
- //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
- temp = "UPPER(to_single_byte('%s'))";
- } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅
- temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte('%s') " + (trimAll ? ",' ','')" : ")");
- } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
- //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
- temp = "UPPER(%s)";
- } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
- temp = "to_single_byte('%s')";
- } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
- temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
- } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
- //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
- temp = "%s";
- }
- if (StringUtils.isNotBlank(resembleRuleVO.getLinkCharacter())) {
- List<String> chars = VciBaseUtil.str2List(resembleRuleVO.getLinkCharacter());
- for (int i = 0; i < chars.size(); i++) {
- String s = chars.get(i);
- temp = "replace(" + temp + ",'" + s + "','')";
- }
- }
- queryValue = String.format(temp, (trim ? value.trim() : value));
- temp = temp.replace("to_single_byte('%s')", "to_single_byte(%s)");
- queryKey = String.format(temp, "t." + attrId);
- conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue);
- }
- }
+ /**
+ * 灏佽鐩镐技椤规煡璇㈢殑鏌ヨ鏉′欢鐨勬槧灏�
+ *
+ * @param value 鍊�
+ * @param resembleRuleVO 鐩镐技椤硅鍒�
+ * @param attrId 灞炴�х殑缂栧彿
+ * @param conditionMap 鏌ヨ鏉′欢
+ */
+ @Override
+ public void wrapperResembleConditionMap(String value, CodeResembleRuleVO resembleRuleVO, String attrId, Map<String, String> conditionMap) {
+ boolean ignoreSpace = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorespaceflag()) || VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
+ if (StringUtils.isBlank(value)) {
+ //涓虹┖鐨勬椂鍊欏氨涓嶆煡璇㈠畠灏辨槸
+ } else {
+ String queryKey = "";
+ String queryValue = "";
+ boolean ignoreCase = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorecaseflag());
+ boolean ignoreWidth = VciBaseUtil.getBoolean(resembleRuleVO.getIgnorewidthflag());
+ boolean trimAll = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
+ boolean trim = VciBaseUtil.getBoolean(resembleRuleVO.getIgnoreallspaceflag());
+ String temp = "";
+ if (ignoreCase && ignoreSpace && ignoreWidth) {
+ //蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙�
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte('%s')) " + (trimAll ? ",' ','')" : ")");
+ } else if (ignoreCase && ignoreSpace && !ignoreWidth) {
+ //蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
+ } else if (ignoreCase && !ignoreSpace && ignoreWidth) {
+ //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+ temp = "UPPER(to_single_byte('%s'))";
+ } else if (!ignoreCase && ignoreSpace && ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte('%s') " + (trimAll ? ",' ','')" : ")");
+ } else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
+ //蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = "UPPER(%s)";
+ } else if (!ignoreCase && !ignoreCase && ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+ temp = "to_single_byte('%s')";
+ } else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
+ } else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
+ //涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+ temp = "%s";
+ }
+ if (StringUtils.isNotBlank(resembleRuleVO.getLinkCharacter())) {
+ List<String> chars = VciBaseUtil.str2List(resembleRuleVO.getLinkCharacter());
+ for (int i = 0; i < chars.size(); i++) {
+ String s = chars.get(i);
+ temp = "replace(" + temp + ",'" + s + "','')";
+ }
+ }
+ queryValue = String.format(temp, (trim ? value.trim() : value));
+ temp = temp.replace("to_single_byte('%s')", "to_single_byte(%s)");
+ queryKey = String.format(temp, "t." + attrId);
+ conditionMap.put(queryKey, QueryOptionConstant.OR + queryValue);
+ }
+ }
- /**
- * 鏌ヨ缂栫爜鏁版嵁鐨勫垪琛�
- *
- * @param btmType 涓氬姟绫诲瀷
- * @param templateVO 妯℃澘鐨勫璞★紝闇�瑕佸寘鍚ā鏉跨殑灞炴��
- * @param conditionMap 鏌ヨ鏉′欢
- * @param pageHelper 鍒嗛〉瀵硅薄
- * @return 鏁版嵁鍒楄〃
- */
- @Override
- public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
- CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper);
+ /**
+ * 鏌ヨ缂栫爜鏁版嵁鐨勫垪琛�
+ *
+ * @param btmType 涓氬姟绫诲瀷
+ * @param templateVO 妯℃澘鐨勫璞★紝闇�瑕佸寘鍚ā鏉跨殑灞炴��
+ * @param conditionMap 鏌ヨ鏉′欢
+ * @param pageHelper 鍒嗛〉瀵硅薄
+ * @return 鏁版嵁鍒楄〃
+ */
+ @Override
+ public DataGrid<Map<String, String>> queryGrid(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
+ CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmType, templateVO, conditionMap, pageHelper);
// List<Map> maps = boService.queryByOnlySqlForMap(sqlBO.getSqlHasPage());
List<Map<String, String>> maps = null;
try {
maps = commonsMapper.queryByOnlySqlForMap(sqlBO.getSqlHasPage());
- }catch (Exception e){
+ } catch (Exception e) {
String errorMessage = e.getMessage();
if (errorMessage.contains("鏃犳硶瑙f瀽鐨勬垚鍛樿闂〃杈惧紡")) {
- throw new ServiceException("缂哄皯"+errorMessage.substring(errorMessage.indexOf("[t.") + 1, errorMessage.indexOf("]"))+"瀛楁");
+ throw new ServiceException("缂哄皯" + errorMessage.substring(errorMessage.indexOf("[t.") + 1, errorMessage.indexOf("]")) + "瀛楁");
}
throw new ServiceException(e.getMessage());
}
- DataGrid<Map<String, String>> dataGrid = new DataGrid<>();
- List<Map<String, String>> dataList = new ArrayList<>();
- if (!CollectionUtils.isEmpty(maps)) {
- maps.stream().forEach(map -> {
- Map<String, String> data = new HashMap<>();
- for (String s : map.keySet()) {
- data.put(s.toLowerCase(Locale.ROOT), map.get(s)==null?null:String.valueOf(map.get(s)));
- }
+ DataGrid<Map<String, String>> dataGrid = new DataGrid<>();
+ List<Map<String, String>> dataList = new ArrayList<>();
+ if (!CollectionUtils.isEmpty(maps)) {
+ maps.stream().forEach(map -> {
+ Map<String, String> data = new HashMap<>();
+ for (String s : map.keySet()) {
+ data.put(s.toLowerCase(Locale.ROOT), map.get(s) == null ? null : String.valueOf(map.get(s)));
+ }
// map.forEach((key, value) -> {
// data.put(((String) key).toLowerCase(Locale.ROOT), String.valueOf(value));
// });
- dataList.add(data);
- });
- wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), false);
+ dataList.add(data);
+ });
+ wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), false);
// maps.stream().forEach(map -> {
// Map<String, String> data = new HashMap<>();
//// map.forEach((key, value) -> {
@@ -2029,7 +2037,7 @@
// }
// dataList.add(data);
// });
- }
+ }
// dataGrid.setData(dataList);
// if (!CollectionUtils.isEmpty(maps)) {
// wrapperData(maps, templateVO, sqlBO.getSelectFieldList(), false);
@@ -2043,29 +2051,29 @@
// }
// dataList.add(data);
// });
- dataGrid.setData(dataList);
- dataGrid.setTotal(Long.parseLong(commonsMapper.selectBySql(sqlBO.getSqlCount()).get(0).values().toArray()[0].toString()));
+ dataGrid.setData(dataList);
+ dataGrid.setTotal(Long.parseLong(commonsMapper.selectBySql(sqlBO.getSqlCount()).get(0).values().toArray()[0].toString()));
// }
- return dataGrid;
- }
+ return dataGrid;
+ }
- /**
- * 灏佽鏌ヨ鍑烘潵鐨勬暟鎹�
- *
- * @param dataMap 鏁版嵁鐨勬槧灏�
- * @param templateVO 妯℃澘鐨勫睘鎬�
- * @param onlySelectAttrIdList 浠呬粎鏌ヨ鐨勫睘鎬у瓧娈�
- * @param form 琛ㄥ崟閲屼娇鐢�
- */
- @Override
- public void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO,
- Collection<String> onlySelectAttrIdList, boolean form) {
- if (onlySelectAttrIdList == null) {
- onlySelectAttrIdList = new ArrayList<>();
- }
- //鍏堣浆鎹竴涓嬫椂闂存牸寮�
- List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList());
+ /**
+ * 灏佽鏌ヨ鍑烘潵鐨勬暟鎹�
+ *
+ * @param dataMap 鏁版嵁鐨勬槧灏�
+ * @param templateVO 妯℃澘鐨勫睘鎬�
+ * @param onlySelectAttrIdList 浠呬粎鏌ヨ鐨勫睘鎬у瓧娈�
+ * @param form 琛ㄥ崟閲屼娇鐢�
+ */
+ @Override
+ public void wrapperData(List<Map<String, String>> dataMap, CodeClassifyTemplateVO templateVO,
+ Collection<String> onlySelectAttrIdList, boolean form) {
+ if (onlySelectAttrIdList == null) {
+ onlySelectAttrIdList = new ArrayList<>();
+ }
+ //鍏堣浆鎹竴涓嬫椂闂存牸寮�
+ List<String> finalOnlySelectAttrIdList = onlySelectAttrIdList.stream().collect(Collectors.toList());
List<CodeClassifyTemplateAttrVO> dateFormatAttrVOs = new ArrayList<>();
List<CodeClassifyTemplateAttrVO> enumAttrVOs = new ArrayList<>();
if (Func.isNotEmpty(templateVO.getAttributes())) {
@@ -2081,452 +2089,452 @@
).collect(Collectors.toList());
}
- List<String> userIds = new ArrayList<>();
+ List<String> userIds = new ArrayList<>();
List<CodeClassifyTemplateAttrVO> finalDateFormatAttrVOs = dateFormatAttrVOs;
List<CodeClassifyTemplateAttrVO> finalEnumAttrVOs = enumAttrVOs;
dataMap.stream().forEach(data -> {
- //澶勭悊鏃堕棿
- if (!form) {
- //琛ㄥ崟鐨勬椂鍊欏彧鑳界敤缁熶竴鐨勬椂闂存牸寮�
- wrapperDateFormat(finalDateFormatAttrVOs, data);
- }
- //澶勭悊鏋氫妇
- wrapperEnum(finalEnumAttrVOs, data);
- String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD);
- String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION, "");
- if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus))
- && StringUtils.isBlank(copyFromVersion)
- ) {
- data.put(VciQueryWrapperForDO.ID_FIELD, "******");
- }
- data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), CodeDefaultLC.getTextByValue(lcstatus));
- if (CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus)
- && StringUtils.isNotBlank(copyFromVersion)) {
- data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), "淇敼涓�");
- }
- if (data.containsKey("creator")) {
- userIds.add(data.get("creator"));
- }
- if (data.containsKey("lastmodifier")) {
- userIds.add(data.get("lastmodifier"));
- }
- });
- if (!CollectionUtils.isEmpty(userIds)) {
- Map<String, User> userVOMap = new HashMap<>();
- for (String userId : userIds) {
- if (!StringUtils.isNumeric(userId)) {
- continue;
- }
- User data = iUserClient.userInfoById(Long.valueOf(userId)).getData();
- if (data != null) {
- userVOMap.put(String.valueOf(data.getId()), data);
- }
- }
+ //澶勭悊鏃堕棿
+ if (!form) {
+ //琛ㄥ崟鐨勬椂鍊欏彧鑳界敤缁熶竴鐨勬椂闂存牸寮�
+ wrapperDateFormat(finalDateFormatAttrVOs, data);
+ }
+ //澶勭悊鏋氫妇
+ wrapperEnum(finalEnumAttrVOs, data);
+ String lcstatus = data.get(VciQueryWrapperForDO.LC_STATUS_FIELD);
+ String copyFromVersion = data.getOrDefault(COPY_FROM_VERSION, "");
+ if ((CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus) || CodeDefaultLC.AUDITING.getValue().equalsIgnoreCase(lcstatus))
+ && StringUtils.isBlank(copyFromVersion)
+ ) {
+ data.put(VciQueryWrapperForDO.ID_FIELD, "******");
+ }
+ data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), CodeDefaultLC.getTextByValue(lcstatus));
+ if (CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(lcstatus)
+ && StringUtils.isNotBlank(copyFromVersion)) {
+ data.put(VciQueryWrapperForDO.LC_STATUS_FIELD_TEXT.toLowerCase(Locale.ROOT), "淇敼涓�");
+ }
+ if (data.containsKey("creator")) {
+ userIds.add(data.get("creator"));
+ }
+ if (data.containsKey("lastmodifier")) {
+ userIds.add(data.get("lastmodifier"));
+ }
+ });
+ if (!CollectionUtils.isEmpty(userIds)) {
+ Map<String, User> userVOMap = new HashMap<>();
+ for (String userId : userIds) {
+ if (!StringUtils.isNumeric(userId)) {
+ continue;
+ }
+ User data = iUserClient.userInfoById(Long.valueOf(userId)).getData();
+ if (data != null) {
+ userVOMap.put(String.valueOf(data.getId()), data);
+ }
+ }
// Map<String, SmUserVO> userVOMap = Optional.ofNullable(userQueryService.listUserByUserIds(userIds)).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
- dataMap.stream().forEach(data -> {
- String creator = data.getOrDefault("creator", null);
- if (StringUtils.isNotBlank(creator) && userVOMap.containsKey(creator.toLowerCase(Locale.ROOT))) {
- data.put("creator", creator + "(" + userVOMap.get(creator.toLowerCase(Locale.ROOT)).getRealName() + ")");
- }
- String lastmodifier = data.getOrDefault("lastmodifier", null);
- if (StringUtils.isNotBlank(lastmodifier) && userVOMap.containsKey(lastmodifier.toLowerCase(Locale.ROOT))) {
- data.put("lastmodifier", lastmodifier + "(" + userVOMap.get(lastmodifier.toLowerCase(Locale.ROOT)).getRealName() + ")");
- }
- });
- }
- }
+ dataMap.stream().forEach(data -> {
+ String creator = data.getOrDefault("creator", null);
+ if (StringUtils.isNotBlank(creator) && userVOMap.containsKey(creator.toLowerCase(Locale.ROOT))) {
+ data.put("creator", creator + "(" + userVOMap.get(creator.toLowerCase(Locale.ROOT)).getRealName() + ")");
+ }
+ String lastmodifier = data.getOrDefault("lastmodifier", null);
+ if (StringUtils.isNotBlank(lastmodifier) && userVOMap.containsKey(lastmodifier.toLowerCase(Locale.ROOT))) {
+ data.put("lastmodifier", lastmodifier + "(" + userVOMap.get(lastmodifier.toLowerCase(Locale.ROOT)).getRealName() + ")");
+ }
+ });
+ }
+ }
- /**
- * 澶勭悊鏃堕棿鏍煎紡
- *
- * @param dateFormatAttrVOs 鏃堕棿鏍煎紡鐨勫睘鎬�
- * @param data 褰撳墠琛屾暟鎹�
- */
- private void wrapperDateFormat(Collection<CodeClassifyTemplateAttrVO> dateFormatAttrVOs, Map<String, String> data) {
- if (!CollectionUtils.isEmpty(dateFormatAttrVOs)) {
- dateFormatAttrVOs.stream().forEach(dateFormatAttrVO -> {
- String attrId = dateFormatAttrVO.getId().toLowerCase(Locale.ROOT);
- String oldValue = data.getOrDefault(attrId, null);
- if (StringUtils.isNotBlank(oldValue)) {
- DateConverter dateConverter = new DateConverter();
- try {
- dateConverter.setAsText(oldValue);
- Date value = dateConverter.getValue();
- if (value != null) {
- data.put(attrId, VciDateUtil.date2Str(value, dateFormatAttrVO.getCodeDateFormat()));
- }
- } catch (Throwable e) {
- //杞崲鍙兘鏈夐棶棰橈紝杩欏氨浣跨敤鍘熸湰瀛樺偍鐨勫��
- }
- }
- });
- }
- }
+ /**
+ * 澶勭悊鏃堕棿鏍煎紡
+ *
+ * @param dateFormatAttrVOs 鏃堕棿鏍煎紡鐨勫睘鎬�
+ * @param data 褰撳墠琛屾暟鎹�
+ */
+ private void wrapperDateFormat(Collection<CodeClassifyTemplateAttrVO> dateFormatAttrVOs, Map<String, String> data) {
+ if (!CollectionUtils.isEmpty(dateFormatAttrVOs)) {
+ dateFormatAttrVOs.stream().forEach(dateFormatAttrVO -> {
+ String attrId = dateFormatAttrVO.getId().toLowerCase(Locale.ROOT);
+ String oldValue = data.getOrDefault(attrId, null);
+ if (StringUtils.isNotBlank(oldValue)) {
+ DateConverter dateConverter = new DateConverter();
+ try {
+ dateConverter.setAsText(oldValue);
+ Date value = dateConverter.getValue();
+ if (value != null) {
+ data.put(attrId, VciDateUtil.date2Str(value, dateFormatAttrVO.getCodeDateFormat()));
+ }
+ } catch (Throwable e) {
+ //杞崲鍙兘鏈夐棶棰橈紝杩欏氨浣跨敤鍘熸湰瀛樺偍鐨勫��
+ }
+ }
+ });
+ }
+ }
- /**
- * 澶勭悊鏋氫妇鐨勫唴瀹癸紝濡傛灉涓嶅湪鏋氫妇涓紝浼氳繑鍥炲師鏈殑鍊�
- *
- * @param enumAttrVOs 鏋氫妇灞炴��
- * @param data 褰撳墠琛屾暟鎹�
- */
- private void wrapperEnum(Collection<CodeClassifyTemplateAttrVO> enumAttrVOs, Map<String, String> data) {
- //澶勭悊鏋氫妇鐨勫唴瀹癸紝涓轰簡鍏煎浠ュ墠鐨勬暟鎹�,濡傛灉鏁版嵁涓嶈兘浣跨敤鏋氫妇杞崲鐨勮瘽锛岄偅杩樻槸鏄剧ず浠ュ墠鐨勫��
- if (!CollectionUtils.isEmpty(enumAttrVOs)) {
- enumAttrVOs.stream().forEach(enumAttrVO -> {
+ /**
+ * 澶勭悊鏋氫妇鐨勫唴瀹癸紝濡傛灉涓嶅湪鏋氫妇涓紝浼氳繑鍥炲師鏈殑鍊�
+ *
+ * @param enumAttrVOs 鏋氫妇灞炴��
+ * @param data 褰撳墠琛屾暟鎹�
+ */
+ private void wrapperEnum(Collection<CodeClassifyTemplateAttrVO> enumAttrVOs, Map<String, String> data) {
+ //澶勭悊鏋氫妇鐨勫唴瀹癸紝涓轰簡鍏煎浠ュ墠鐨勬暟鎹�,濡傛灉鏁版嵁涓嶈兘浣跨敤鏋氫妇杞崲鐨勮瘽锛岄偅杩樻槸鏄剧ず浠ュ墠鐨勫��
+ if (!CollectionUtils.isEmpty(enumAttrVOs)) {
+ enumAttrVOs.stream().forEach(enumAttrVO -> {
// String attrId = enumAttrVO.getId().toUpperCase(Locale.ROOT);
- String attrId = enumAttrVO.getId().toLowerCase(Locale.ROOT);
- String oldValue = String.valueOf(data.getOrDefault(attrId, null));
- if (StringUtils.isNotBlank(oldValue)) {
- List<KeyValue> comboxKVs = listComboboxItems(enumAttrVO);
- String newValue = oldValue;
- KeyValue keyValue = Optional.ofNullable(comboxKVs).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getKey().equalsIgnoreCase(oldValue)).findFirst().orElseGet(() -> null);
- if (keyValue != null) {
- newValue = keyValue.getValue();
- }
- data.put(attrId + "Text", newValue);
- }
- });
- }
- }
+ String attrId = enumAttrVO.getId().toLowerCase(Locale.ROOT);
+ String oldValue = String.valueOf(data.getOrDefault(attrId, null));
+ if (StringUtils.isNotBlank(oldValue)) {
+ List<KeyValue> comboxKVs = listComboboxItems(enumAttrVO);
+ String newValue = oldValue;
+ KeyValue keyValue = Optional.ofNullable(comboxKVs).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getKey().equalsIgnoreCase(oldValue)).findFirst().orElseGet(() -> null);
+ if (keyValue != null) {
+ newValue = keyValue.getValue();
+ }
+ data.put(attrId + "Text", newValue);
+ }
+ });
+ }
+ }
- /**
- * 鏍规嵁妯℃澘灞炴�х敓鎴愮浉搴旂殑sql淇℃伅
- *
- * @param btmType 涓氬姟绫诲瀷
- * @param templateVO 妯℃澘鏄剧ず瀵硅薄锛屽繀椤诲寘鍚睘鎬�
- * @param conditionMap 鏌ヨ鏉′欢
- * @param pageHelper 鍒嗛〉鍜屾帓搴忓璞�
- * @return sql鐨勭浉鍏充俊鎭�
- */
- @Override
- public CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
- //鍥犱负鍙傜収涓嶄竴瀹氭槸鍦ㄥ钩鍙扮殑灞炴�ф睜閲岄潰璁剧疆锛屾墍浠ユ垜浠緱闇�瑕佽嚜琛屽鐞�
- //鍙傝�僔ciQueryWrapper鏉ュ鐞�
- //1. 鎵惧埌鎵�鏈夌殑瀛楁锛�
+ /**
+ * 鏍规嵁妯℃澘灞炴�х敓鎴愮浉搴旂殑sql淇℃伅
+ *
+ * @param btmType 涓氬姟绫诲瀷
+ * @param templateVO 妯℃澘鏄剧ず瀵硅薄锛屽繀椤诲寘鍚睘鎬�
+ * @param conditionMap 鏌ヨ鏉′欢
+ * @param pageHelper 鍒嗛〉鍜屾帓搴忓璞�
+ * @return sql鐨勭浉鍏充俊鎭�
+ */
+ @Override
+ public CodeTemplateAttrSqlBO getSqlByTemplateVO(String btmType, CodeClassifyTemplateVO templateVO, Map<String, String> conditionMap, PageHelper pageHelper) {
+ //鍥犱负鍙傜収涓嶄竴瀹氭槸鍦ㄥ钩鍙扮殑灞炴�ф睜閲岄潰璁剧疆锛屾墍浠ユ垜浠緱闇�瑕佽嚜琛屽鐞�
+ //鍙傝�僔ciQueryWrapper鏉ュ鐞�
+ //1. 鎵惧埌鎵�鏈夌殑瀛楁锛�
Map<String, CodeClassifyTemplateAttrVO> attrVOMap = new HashMap<>();
List<String> selectFieldList = new ArrayList<>();
- if(Func.isNotEmpty(templateVO.getAttributes())){
+ if (Func.isNotEmpty(templateVO.getAttributes())) {
attrVOMap = templateVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
selectFieldList = attrVOMap.keySet().stream().collect(Collectors.toList());
}
- //鎵�鏈夌殑鍙傜収鐨勫瓧娈�
- Map<String/**灞炴�у瓧娈�**/, String> joinTableList = new ConcurrentHashMap<>();
+ //鎵�鏈夌殑鍙傜収鐨勫瓧娈�
+ Map<String/**灞炴�у瓧娈�**/, String> joinTableList = new ConcurrentHashMap<>();
List<CodeClassifyTemplateAttrVO> referAttrVOs = null;
if (Func.isNotEmpty(templateVO.getAttributes())) {
referAttrVOs = templateVO.getAttributes().stream().filter(
s -> StringUtils.isNotBlank(s.getReferBtmId()) || StringUtils.isNotBlank(s.getReferConfig())
).collect(Collectors.toList());
}
- Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫瓧娈�**/> referFieldMap = new ConcurrentHashMap<>();
- if (!CollectionUtils.isEmpty(referAttrVOs)) {
+ Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫瓧娈�**/> referFieldMap = new ConcurrentHashMap<>();
+ if (!CollectionUtils.isEmpty(referAttrVOs)) {
List<String> finalSelectFieldList = selectFieldList;
referAttrVOs.parallelStream().forEach(attrVO -> {
- UIFormReferVO referVO = null;
- if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
- referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class);
- } else {
- referVO = new UIFormReferVO();
- referVO.setReferType(attrVO.getReferBtmId());
- referVO.setValueField(VciQueryWrapperForDO.OID_FIELD);
- referVO.setTextField("name");
- }
- //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referVO.getReferType()));
+ UIFormReferVO referVO = null;
+ if (StringUtils.isNotBlank(attrVO.getReferConfig())) {
+ referVO = JSONObject.parseObject(attrVO.getReferConfig(), UIFormReferVO.class);
+ } else {
+ referVO = new UIFormReferVO();
+ referVO.setReferType(attrVO.getReferBtmId());
+ referVO.setValueField(VciQueryWrapperForDO.OID_FIELD);
+ referVO.setTextField("name");
+ }
+ //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referVO.getReferType()));
// String referTable = VciBaseUtil.getTableName(referVO.getReferType());
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
- String referTable = listR.getData().get(0).getTableName();
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
+ String referTable = listR.getData().get(0).getTableName();
// String referTable = "pl_code_classify";
- String referTableNick = attrVO.getId() + "0";
- String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " = t." + attrVO.getId();
- joinTableList.put(attrVO.getId(), left);
- String referShowField = attrVO.getId() + "Name";
- List<String> textFields = VciBaseUtil.str2List(referVO.getTextField());
- String showFieldInSource = "";
- if (textFields.contains("name")) {
- showFieldInSource = "name";
- } else {
- showFieldInSource = textFields.get(0);
- }
- referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource);
- finalSelectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField);
- });
- }
- R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getDefaultAttrByBtmId(btmType);
+ String referTableNick = attrVO.getId() + "0";
+ String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " = t." + attrVO.getId();
+ joinTableList.put(attrVO.getId(), left);
+ String referShowField = attrVO.getId() + "Name";
+ List<String> textFields = VciBaseUtil.str2List(referVO.getTextField());
+ String showFieldInSource = "";
+ if (textFields.contains("name")) {
+ showFieldInSource = "name";
+ } else {
+ showFieldInSource = textFields.get(0);
+ }
+ referFieldMap.put(attrVO.getId(), referTableNick + "." + showFieldInSource);
+ finalSelectFieldList.add(referTableNick + "." + showFieldInSource + " as " + referShowField);
+ });
+ }
+ R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getDefaultAttrByBtmId(btmType);
- if (allAttributeByBtmId.getData() != null) {
- for (BtmTypeAttributeVO attribute : allAttributeByBtmId.getData().getAttributes()) {
- if (!selectFieldList.contains(attribute.getId()) && !"secretgrade".equalsIgnoreCase(attribute.getId())) {
- selectFieldList.add(attribute.getId());
- }
- }
- }
+ if (allAttributeByBtmId.getData() != null) {
+ for (BtmTypeAttributeVO attribute : allAttributeByBtmId.getData().getAttributes()) {
+ if (!selectFieldList.contains(attribute.getId()) && !"secretgrade".equalsIgnoreCase(attribute.getId())) {
+ selectFieldList.add(attribute.getId());
+ }
+ }
+ }
- if (!selectFieldList.contains(CODE_FIELD)) {
- selectFieldList.add(CODE_FIELD);
- }
- if (!selectFieldList.contains(CODE_CLASSIFY_OID_FIELD)) {
- selectFieldList.add(CODE_CLASSIFY_OID_FIELD);
- }
- if (!selectFieldList.contains(CODE_TEMPLATE_OID_FIELD)) {
- selectFieldList.add(CODE_TEMPLATE_OID_FIELD);
- }
- if (!selectFieldList.contains(CODE_FULL_PATH_FILED)) {
- selectFieldList.add(CODE_FULL_PATH_FILED);
- }
+ if (!selectFieldList.contains(CODE_FIELD)) {
+ selectFieldList.add(CODE_FIELD);
+ }
+ if (!selectFieldList.contains(CODE_CLASSIFY_OID_FIELD)) {
+ selectFieldList.add(CODE_CLASSIFY_OID_FIELD);
+ }
+ if (!selectFieldList.contains(CODE_TEMPLATE_OID_FIELD)) {
+ selectFieldList.add(CODE_TEMPLATE_OID_FIELD);
+ }
+ if (!selectFieldList.contains(CODE_FULL_PATH_FILED)) {
+ selectFieldList.add(CODE_FULL_PATH_FILED);
+ }
- //澶勭悊鏌ヨ鏉′欢
- //TODO 楠岃瘉sql娉ㄥ叆
- List<String> andSql = new ArrayList<>();
- List<String> orSql = new ArrayList<>();
- if (!CollectionUtils.isEmpty(conditionMap)) {
- Map<String, String> orConditionMap = new HashMap<>();
- Map<String, String> andCondtionMap = new HashMap<>();
- //鍏堝垎绂籵r鐨勬煡璇㈡潯浠讹紝鍙﹀褰撴煡璇㈡潯浠舵槸绌虹殑鏃跺�欎篃涓嶆煡璇�
- conditionMap.forEach((k, v) -> {
- if (StringUtils.isNotBlank(v)) {
- if (v.startsWith(QueryOptionConstant.OR)) {
- orConditionMap.put(k, v.substring(QueryOptionConstant.OR.length()));
- } else {
- andCondtionMap.put(k, v);
- }
- }
- });
+ //澶勭悊鏌ヨ鏉′欢
+ //TODO 楠岃瘉sql娉ㄥ叆
+ List<String> andSql = new ArrayList<>();
+ List<String> orSql = new ArrayList<>();
+ if (!CollectionUtils.isEmpty(conditionMap)) {
+ Map<String, String> orConditionMap = new HashMap<>();
+ Map<String, String> andCondtionMap = new HashMap<>();
+ //鍏堝垎绂籵r鐨勬煡璇㈡潯浠讹紝鍙﹀褰撴煡璇㈡潯浠舵槸绌虹殑鏃跺�欎篃涓嶆煡璇�
+ conditionMap.forEach((k, v) -> {
+ if (StringUtils.isNotBlank(v)) {
+ if (v.startsWith(QueryOptionConstant.OR)) {
+ orConditionMap.put(k, v.substring(QueryOptionConstant.OR.length()));
+ } else {
+ andCondtionMap.put(k, v);
+ }
+ }
+ });
Map<String, CodeClassifyTemplateAttrVO> finalAttrVOMap = attrVOMap;
andCondtionMap.forEach((k, v) -> {
- andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, finalAttrVOMap, btmType));
- });
- orConditionMap.forEach((k, v) -> {
- orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, finalAttrVOMap, btmType));
- });
- }
- //缁勫悎璧锋潵
- StringBuilder andSb = new StringBuilder();
- andSql.stream().forEach(s -> {
- andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE);
- });
+ andSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, finalAttrVOMap, btmType));
+ });
+ orConditionMap.forEach((k, v) -> {
+ orSql.add(getConditionSql(k.toLowerCase(), v, referFieldMap, finalAttrVOMap, btmType));
+ });
+ }
+ //缁勫悎璧锋潵
+ StringBuilder andSb = new StringBuilder();
+ andSql.stream().forEach(s -> {
+ andSb.append(s).append(SPACE).append(QueryOptionConstant.AND).append(SPACE);
+ });
- String andString = andSb.toString().trim();
- String endWithSql = QueryOptionConstant.AND;
- if (andString.endsWith(endWithSql)) {
- andString = andString.substring(0, andString.length() - endWithSql.length());
- }
+ String andString = andSb.toString().trim();
+ String endWithSql = QueryOptionConstant.AND;
+ if (andString.endsWith(endWithSql)) {
+ andString = andString.substring(0, andString.length() - endWithSql.length());
+ }
- String orString = orSql.stream().collect(Collectors.joining(" or "));
- String whereSql = "";
- if (StringUtils.isNotBlank(orString)) {
- if (StringUtils.isBlank(andString)) {
- andString = " 1 = 1 ";
- }
- whereSql = SPACE + "(" + SPACE + andString + SPACE + ") and (" + SPACE + orString + SPACE + ")" + SPACE;
- } else {
- whereSql = andString + SPACE;
- }
- if (attrVOMap.keySet().contains("secretgrade")) {
- Integer userSecret = VciBaseUtil.getCurrentUserSecret();
- if (userSecret == null || userSecret == 0) {
- userSecret = secretService.getMinUserSecret().getData();
- }
- whereSql += " and ( t.secretGrade <= " + userSecret + ") ";
- }
+ String orString = orSql.stream().collect(Collectors.joining(" or "));
+ String whereSql = "";
+ if (StringUtils.isNotBlank(orString)) {
+ if (StringUtils.isBlank(andString)) {
+ andString = " 1 = 1 ";
+ }
+ whereSql = SPACE + "(" + SPACE + andString + SPACE + ") and (" + SPACE + orString + SPACE + ")" + SPACE;
+ } else {
+ whereSql = andString + SPACE;
+ }
+ if (attrVOMap.keySet().contains("secretgrade")) {
+ Integer userSecret = VciBaseUtil.getCurrentUserSecret();
+ if (userSecret == null || userSecret == 0) {
+ userSecret = secretService.getMinUserSecret().getData();
+ }
+ whereSql += " and ( t.secretGrade <= " + userSecret + ") ";
+ }
// String tableName = VciBaseUtil.getTableName(btmType);
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
// String referTable = VciBaseUtil.getTableName(referVO.getReferType());
- String tableName = listR.getData().get(0).getTableName();
- String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(","))
- + " from " + tableName + SPACE + "t" + SPACE
- + joinTableList.values().stream().collect(Collectors.joining(SPACE))
- + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
- if (pageHelper == null) {
- pageHelper = new PageHelper(-1);
- }
- //鐪嬬湅鎺掑簭
- String orderSql = pageHelper.getOrderSql("t");
- sql += (orderSql == null ? "" : orderSql);
- String whereSubfixForPage = " ) A where rownum < " + (pageHelper.getLimit() * pageHelper.getPage() + 1) + ") where RN >= "
- + (pageHelper.getLimit() * (pageHelper.getPage() - 1) + 1);
- String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql;
- String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE))
- + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
+ String tableName = listR.getData().get(0).getTableName();
+ String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(","))
+ + " from " + tableName + SPACE + "t" + SPACE
+ + joinTableList.values().stream().collect(Collectors.joining(SPACE))
+ + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
+ if (pageHelper == null) {
+ pageHelper = new PageHelper(-1);
+ }
+ //鐪嬬湅鎺掑簭
+ String orderSql = pageHelper.getOrderSql("t");
+ sql += (orderSql == null ? "" : orderSql);
+ String whereSubfixForPage = " ) A where rownum < " + (pageHelper.getLimit() * pageHelper.getPage() + 1) + ") where RN >= "
+ + (pageHelper.getLimit() * (pageHelper.getPage() - 1) + 1);
+ String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql;
+ String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE))
+ + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
String sqlId = "select t.ID from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE))
+ (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
- CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO();
- sqlBO.setTableName(tableName);
- sqlBO.setJoinTable(joinTableList);
- sqlBO.setNickName("t");
+ CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO();
+ sqlBO.setTableName(tableName);
+ sqlBO.setJoinTable(joinTableList);
+ sqlBO.setNickName("t");
// sqlBO.setPageHelper(pageHelper);
- sqlBO.setSqlHasPage(sqlHasPage);
- sqlBO.setSqlCount(sqlCount);
- sqlBO.setSqlUnPage(sql);
+ sqlBO.setSqlHasPage(sqlHasPage);
+ sqlBO.setSqlCount(sqlCount);
+ sqlBO.setSqlUnPage(sql);
sqlBO.setSqlId(sqlId);
- return sqlBO;
- }
+ return sqlBO;
+ }
- /**
- * 缁勫悎鏌ヨ鏉′欢鐨剆ql
- *
- * @param key 瀛楁
- * @param value 鍚嶅瓧
- * @param referFieldMap 鍙傜収鐨勫瓧娈�
- * @param attrVOMap 灞炴�х殑鏄犲皠
- * @return Sql璇彞
- */
- private String getConditionSql(String key, String value, Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫睘鎬�**/> referFieldMap, Map<String, CodeClassifyTemplateAttrVO> attrVOMap, String btmType) {
- if (!Func.hasEmpty(new Object[]{key, value}) && !key.endsWith("_ignore")) {
- if (key.endsWith("_like")) {
- String field = UBCSSqlKeyword.getColumn(key, "_like");
- if (referFieldMap.containsKey(field)) {
- //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚�
- return referFieldMap.get(field) + SPACE + "LIKE" + SPACE + "'%" + value + "%'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "LIKE " + "'%" + value + "%'" + SPACE;
- }
- } else if (key.endsWith("_notequal")) {
- String field = UBCSSqlKeyword.getColumn(key, "_notequal");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + " != " + value + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + " != " + getStringValueInWhere(field, value, attrVOMap);
- }
- } else if (key.endsWith("_likeleft")) {
- String field = UBCSSqlKeyword.getColumn(key, "_likeleft");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "LIKE" + SPACE + "%" + value + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "LIKE " + "%" + getStringValueInWhere(field, value, attrVOMap) + SPACE;
- }
- } else if (key.endsWith("_likeright")) {
- String field = UBCSSqlKeyword.getColumn(key, "_likeright");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "LIKE" + SPACE + value + "%" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "LIKE " + getStringValueInWhere(field, value, attrVOMap) + "%" + SPACE;
- }
- } else if (key.endsWith("_notlike")) {
- String field = UBCSSqlKeyword.getColumn(key, "_notlike");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "NO LIKE" + SPACE + "%" + value + "%" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "NO LIKE " + "%" + getStringValueInWhere(field, value, attrVOMap) + "%" + SPACE;
- }
- } else if (key.endsWith("_ge")) {
- String field = UBCSSqlKeyword.getColumn(key, "_ge");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + " >= " + value + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + " >= " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
- }
- } else if (key.endsWith("_le")) {
- //璇存槑鏄�<=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓�
- String field = UBCSSqlKeyword.getColumn(key, "_le");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + " <= " + value + "" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + " <= " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
- }
- } else if (key.endsWith("_gt")) {
- String field = UBCSSqlKeyword.getColumn(key, "_gt");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "> " + value + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "> " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
- }
- } else if (key.endsWith("_lt")) {
- String field = UBCSSqlKeyword.getColumn(key, "_lt");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "< " + value + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "< " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
- }
- } else if (key.endsWith("_datege")) {
- String field = UBCSSqlKeyword.getColumn(key, "_datege");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + ">= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + ">= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- }
- } else if (key.endsWith("_dategt")) {
- String field = UBCSSqlKeyword.getColumn(key, "_dategt");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "> '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "> '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- }
- } else if (key.endsWith("_dateequal")) {
- String field = UBCSSqlKeyword.getColumn(key, "_dateequal");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- }
- } else if (key.endsWith("_datele")) {
- String field = UBCSSqlKeyword.getColumn(key, "_datele");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "<= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "<= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- }
- } else if (key.endsWith("_datelt")) {
- String field = UBCSSqlKeyword.getColumn(key, "_datelt");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "< '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "< '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- }
- } else if (key.endsWith("_null")) {
- String field = UBCSSqlKeyword.getColumn(key, "_null");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "IS NULL" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "IS NULL" + SPACE;
- }
- } else if (key.endsWith("_notnull")) {
- String field = UBCSSqlKeyword.getColumn(key, "_null");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "IS NOT NULL" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "IS NOT NULL" + SPACE;
- }
- } else if (key.endsWith("_dateequal")) {
- String field = UBCSSqlKeyword.getColumn(key, "_dateequal");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
- }
- } else if (key.endsWith("_equal")) {
- String field = UBCSSqlKeyword.getColumn(key, "_equal");
- if (referFieldMap.containsKey(field)) {
- return referFieldMap.get(field) + SPACE + "= '" + value + "'" + SPACE;
- } else {
- return (field.contains(".") ? "" : "t.") + field + SPACE + "= " + getStringValueInWhere(field, value, attrVOMap) + "" + SPACE;
- }
- } else if(key.endsWith("_in")){
- String field = UBCSSqlKeyword.getColumn(key, "_in");
+ /**
+ * 缁勫悎鏌ヨ鏉′欢鐨剆ql
+ *
+ * @param key 瀛楁
+ * @param value 鍚嶅瓧
+ * @param referFieldMap 鍙傜収鐨勫瓧娈�
+ * @param attrVOMap 灞炴�х殑鏄犲皠
+ * @return Sql璇彞
+ */
+ private String getConditionSql(String key, String value, Map<String/**鍙傜収鐨勫睘鎬�**/, String/**瀹為檯鐨勫睘鎬�**/> referFieldMap, Map<String, CodeClassifyTemplateAttrVO> attrVOMap, String btmType) {
+ if (!Func.hasEmpty(new Object[]{key, value}) && !key.endsWith("_ignore")) {
+ if (key.endsWith("_like")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_like");
if (referFieldMap.containsKey(field)) {
- return VciBaseUtil.toInSql(referFieldMap.get(field),value); //referFieldMap.get(field) + SPACE + "= '" + value + "'" + SPACE;
+ //璇存槑杩樻槸鍙傜収閲岄潰鐨勶紝鎴戜滑榛樿杩欑鎯呭喌涓嬮兘鏄瓧绗︿覆鍚э紝鍥犱负鍙傜収鐨勫睘鎬т笉涓�瀹氱敤鐨勫钩鍙扮殑灞炴�ф睜閲岀殑锛屾墍浠ュぇ閮ㄥ垎鎯呭喌涓嬶紝鏄剧ず鐨勫睘鎬ч兘鏄瓧绗︿覆鍚�
+ return referFieldMap.get(field) + SPACE + "LIKE" + SPACE + "'%" + value + "%'" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "LIKE " + "'%" + value + "%'" + SPACE;
+ }
+ } else if (key.endsWith("_notequal")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_notequal");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + " != " + value + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + " != " + getStringValueInWhere(field, value, attrVOMap);
+ }
+ } else if (key.endsWith("_likeleft")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_likeleft");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "LIKE" + SPACE + "%" + value + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "LIKE " + "%" + getStringValueInWhere(field, value, attrVOMap) + SPACE;
+ }
+ } else if (key.endsWith("_likeright")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_likeright");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "LIKE" + SPACE + value + "%" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "LIKE " + getStringValueInWhere(field, value, attrVOMap) + "%" + SPACE;
+ }
+ } else if (key.endsWith("_notlike")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_notlike");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "NO LIKE" + SPACE + "%" + value + "%" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "NO LIKE " + "%" + getStringValueInWhere(field, value, attrVOMap) + "%" + SPACE;
+ }
+ } else if (key.endsWith("_ge")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_ge");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + " >= " + value + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + " >= " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
+ }
+ } else if (key.endsWith("_le")) {
+ //璇存槑鏄�<=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓�
+ String field = UBCSSqlKeyword.getColumn(key, "_le");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + " <= " + value + "" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + " <= " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
+ }
+ } else if (key.endsWith("_gt")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_gt");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "> " + value + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "> " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
+ }
+ } else if (key.endsWith("_lt")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_lt");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "< " + value + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "< " + getStringValueInWhere(field, value, attrVOMap) + SPACE;
+ }
+ } else if (key.endsWith("_datege")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_datege");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + ">= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + ">= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ }
+ } else if (key.endsWith("_dategt")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_dategt");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "> '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "> '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ }
+ } else if (key.endsWith("_dateequal")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_dateequal");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ }
+ } else if (key.endsWith("_datele")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_datele");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "<= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "<= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ }
+ } else if (key.endsWith("_datelt")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_datelt");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "< '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "< '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ }
+ } else if (key.endsWith("_null")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_null");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "IS NULL" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "IS NULL" + SPACE;
+ }
+ } else if (key.endsWith("_notnull")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_null");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "IS NOT NULL" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "IS NOT NULL" + SPACE;
+ }
+ } else if (key.endsWith("_dateequal")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_dateequal");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "= '" + DateUtil.parse(String.valueOf(value), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ } else {
+ return (field.contains(".") ? "" : "t.") + field + SPACE + "= '" + DateUtil.parse(String.valueOf(getStringValueInWhere(field, value, attrVOMap)), "yyyy-MM-dd HH:mm:ss") + "'" + SPACE;
+ }
+ } else if (key.endsWith("_equal")) {
+ String field = UBCSSqlKeyword.getColumn(key, "_equal");
+ if (referFieldMap.containsKey(field)) {
+ return referFieldMap.get(field) + SPACE + "= '" + value + "'" + SPACE;
} 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);
// return getSqlByValue(selectKey, value, null, btmType);
// } else {
- return getSqlByValue(key, value, attrVOMap, btmType);
+ return getSqlByValue(key, value, attrVOMap, btmType);
// }
- }
- }
- return "";
+ }
+ }
+ return "";
/*if (key.endsWith("_begin")) {
//璇存槑鏄�>=鐨勩�傛垜浠渶瑕佸厛鑾峰彇涓�涓�
@@ -2555,430 +2563,430 @@
return getSqlByValue(key, value, attrVOMap,btmType);
}
}*/
- }
+ }
- /**
- * 鑾峰彇鏌ヨ鏉′欢涓殑鍊肩殑锛屽鐞嗕笉鍚岀殑绫诲瀷
- *
- * @param value 鍊�
- * @param field 瀛楁鍚嶇О
- * @return 鏃ユ湡鎴栬�呮椂闂存牸寮忎細鍖呮嫭to_date锛屽瓧绗︿覆浼氬姞'
- */
- private String getStringValueInWhere(String field, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
- if ((field.contains(".") && !field.toLowerCase(Locale.ROOT).startsWith("t.")) || attrVOMap == null
- || !field.replace("t.", "").matches(RegExpConstant.LETTER) || value.startsWith(ONLY)) {
- //璇存槑鍙兘鏄寚瀹氱殑鏌愪釜鏉′欢锛岀洿鎺ヨ繑鍥�
- if (value.startsWith(ONLY)) {
- value = value.replace(ONLY, "");
- }
- if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
- return value;
- }
- if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) {
- //鏄弬鐓�
- return "'" + value + "'";
- } else {
- return value;
- }
- } else {
- //鐪嬬湅鏄笉鏄繖涓璞¢噷鐨勫睘鎬�
- if (attrVOMap.containsKey(field)) {
- VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(attrVOMap.get(field).getAttributeDataType());
- if ("ts".equalsIgnoreCase(field)) {
- return "to_timestamp('" + value + "', '" + DATETIME_FORMAT + ".ff')";
- }
- DateConverter dateConverter = new DateConverter();
- if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) {
- //瀹為檯涓婏紝鏁版嵁搴撻兘鏄痶imestamp鐨勭被鍨�. TODO:铏界劧娌¤兘瑙e喅鏌ヨ鏃ユ湡鐨勯棶棰橈紝浣嗘槸鑳芥殏鏃惰В鍐虫姤閿欓棶棰�
- if(value.contains("*")){
- value = value.replace("*","%");
+ /**
+ * 鑾峰彇鏌ヨ鏉′欢涓殑鍊肩殑锛屽鐞嗕笉鍚岀殑绫诲瀷
+ *
+ * @param value 鍊�
+ * @param field 瀛楁鍚嶇О
+ * @return 鏃ユ湡鎴栬�呮椂闂存牸寮忎細鍖呮嫭to_date锛屽瓧绗︿覆浼氬姞'
+ */
+ private String getStringValueInWhere(String field, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap) {
+ if ((field.contains(".") && !field.toLowerCase(Locale.ROOT).startsWith("t.")) || attrVOMap == null
+ || !field.replace("t.", "").matches(RegExpConstant.LETTER) || value.startsWith(ONLY)) {
+ //璇存槑鍙兘鏄寚瀹氱殑鏌愪釜鏉′欢锛岀洿鎺ヨ繑鍥�
+ if (value.startsWith(ONLY)) {
+ value = value.replace(ONLY, "");
+ }
+ if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
+ return value;
+ }
+ if (field.contains(".") && attrVOMap != null && attrVOMap.containsKey(field.split("\\.")[0].toLowerCase(Locale.ROOT))) {
+ //鏄弬鐓�
+ return "'" + value + "'";
+ } else {
+ return value;
+ }
+ } else {
+ //鐪嬬湅鏄笉鏄繖涓璞¢噷鐨勫睘鎬�
+ if (attrVOMap.containsKey(field)) {
+ VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(attrVOMap.get(field).getAttributeDataType());
+ if ("ts".equalsIgnoreCase(field)) {
+ return "to_timestamp('" + value + "', '" + DATETIME_FORMAT + ".ff')";
+ }
+ DateConverter dateConverter = new DateConverter();
+ if (VciFieldTypeEnum.VTDateTime.equals(fieldTypeEnum)) {
+ //瀹為檯涓婏紝鏁版嵁搴撻兘鏄痶imestamp鐨勭被鍨�. TODO:铏界劧娌¤兘瑙e喅鏌ヨ鏃ユ湡鐨勯棶棰橈紝浣嗘槸鑳芥殏鏃惰В鍐虫姤閿欓棶棰�
+ if (value.contains("*")) {
+ value = value.replace("*", "%");
return "'" + value + "'";
- }else{
- value = value.replace("*","");
+ } else {
+ value = value.replace("*", "");
dateConverter.setAsText(value);
return "to_date('" + dateConverter.getAsText(VciDateUtil.DateTimeFormat) + "','" + DATETIME_FORMAT + "')";
}
- } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) {
- if(value.contains("*")){
- value = value.replace("*","%");
+ } else if (VciFieldTypeEnum.VTDate.equals(fieldTypeEnum)) {
+ if (value.contains("*")) {
+ value = value.replace("*", "%");
return "'" + value + "'";
- }else {
- value = value.replace("*","");
+ } else {
+ value = value.replace("*", "");
dateConverter.setAsText(value);
return "to_date('" + dateConverter.getAsText(VciDateUtil.DateFormat) + "','" + DATE_FORMAT + "')";
}
- } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum)
- || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum)
- || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) {
- return value;
- } else {
- return "'" + value + "'";
- }
- } else {
- if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
- return value;
- }
- return "'" + value + "'";
- }
- }
+ } else if (VciFieldTypeEnum.VTDouble.equals(fieldTypeEnum)
+ || VciFieldTypeEnum.VTLong.equals(fieldTypeEnum)
+ || VciFieldTypeEnum.VTInteger.equals(fieldTypeEnum)) {
+ return value;
+ } else {
+ return "'" + value + "'";
+ }
+ } else {
+ if ((value.startsWith("(") && value.endsWith(")")) || (value.startsWith("'") && value.endsWith("'"))) {
+ return value;
+ }
+ return "'" + value + "'";
+ }
+ }
- }
+ }
- /**
- * 鏌ョ湅鏄惁榛樿灞炴��
- *
- * @param selectKey
- * @param btmType
- * @return
- */
- private boolean isDefaultAttr(String selectKey, String btmType) {
- if (StringUtils.isBlank(btmType)) {
- return false;
- }
- R<BtmTypeVO> r = btmTypeClient.getDefaultAttrByBtmId(btmType);
- List<BtmTypeAttributeVO> attributes = r.getData().getAttributes();
- if (!r.isSuccess() || attributes.isEmpty()) {
- return false;
- }
- return attributes.stream().anyMatch(item -> item.getId().equals(selectKey));
- }
+ /**
+ * 鏌ョ湅鏄惁榛樿灞炴��
+ *
+ * @param selectKey
+ * @param btmType
+ * @return
+ */
+ private boolean isDefaultAttr(String selectKey, String btmType) {
+ if (StringUtils.isBlank(btmType)) {
+ return false;
+ }
+ R<BtmTypeVO> r = btmTypeClient.getDefaultAttrByBtmId(btmType);
+ List<BtmTypeAttributeVO> attributes = r.getData().getAttributes();
+ if (!r.isSuccess() || attributes.isEmpty()) {
+ return false;
+ }
+ return attributes.stream().anyMatch(item -> item.getId().equals(selectKey));
+ }
- /**
- * 灏佽鏈�缁堢殑sql璇彞涓殑鍊奸儴鍒�
- *
- * @param selectKey 鏌ヨ鐨勫瓧娈�
- * @param value 鍊�
- * @param attrVOMap 灞炴�х殑鏄剧ず瀵硅薄鏄犲皠
- * @return sql閲岀殑鍊�
- */
- private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap, String btmType) {
- StringBuilder sql = new StringBuilder();
- // TODO 宸插畬鍠�
- if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || isDefaultAttr(selectKey, btmType) || selectKey.matches(RegExpConstant.LETTER))) {
- sql.append("t.");
- }
- if (value.startsWith(QueryOptionConstant.IN)) {
- if(value.startsWith(QueryOptionConstant.IN+"('") && value.endsWith("')")){
+ /**
+ * 灏佽鏈�缁堢殑sql璇彞涓殑鍊奸儴鍒�
+ *
+ * @param selectKey 鏌ヨ鐨勫瓧娈�
+ * @param value 鍊�
+ * @param attrVOMap 灞炴�х殑鏄剧ず瀵硅薄鏄犲皠
+ * @return sql閲岀殑鍊�
+ */
+ private String getSqlByValue(String selectKey, String value, Map<String, CodeClassifyTemplateAttrVO> attrVOMap, String btmType) {
+ StringBuilder sql = new StringBuilder();
+ // TODO 宸插畬鍠�
+ if (!selectKey.contains(".") && (attrVOMap.containsKey(selectKey.toLowerCase(Locale.ROOT)) || isDefaultAttr(selectKey, btmType) || selectKey.matches(RegExpConstant.LETTER))) {
+ sql.append("t.");
+ }
+ if (value.startsWith(QueryOptionConstant.IN)) {
+ if (value.startsWith(QueryOptionConstant.IN + "('") && value.endsWith("')")) {
sql.append(selectKey)
.append(SPACE)
.append("in")
.append(SPACE)
.append(value.replace(QueryOptionConstant.IN, ""));
- }else{
+ } else {
sql.append(selectKey)
- .append(SPACE)
- .append("in")
- .append(SPACE)
- .append("(")
- .append(value.replace(QueryOptionConstant.IN, ""))
- .append(")");
+ .append(SPACE)
+ .append("in")
+ .append(SPACE)
+ .append("(")
+ .append(value.replace(QueryOptionConstant.IN, ""))
+ .append(")");
}
- } else if (value.startsWith(QueryOptionConstant.NOTIN)) {
- sql.append(selectKey)
- .append(SPACE)
- .append("not in")
- .append(SPACE)
- .append("(")
- .append(value.replace(QueryOptionConstant.NOTIN, ""))
- .append(")");
- } else if (value.startsWith(QueryOptionConstant.NOTEQUAL)) {
- value = value.replace(QueryOptionConstant.NOTEQUAL, "");
- value = getStringValueInWhere(selectKey, value, attrVOMap);
- sql.append(selectKey)
- .append(SPACE)
- .append(QueryOptionConstant.NOTEQUAL)
- .append(SPACE)
- .append(value);
- } else if (value.startsWith(QueryOptionConstant.MORETHAN)) {
- value = value.replace(QueryOptionConstant.MORETHAN, "");
- value = getStringValueInWhere(selectKey, value, attrVOMap);
- sql.append(selectKey)
- .append(SPACE)
- .append(QueryOptionConstant.MORETHAN)
- .append(SPACE)
- .append(value);
- } else if (value.startsWith(QueryOptionConstant.MORE)) {
- value = value.replace(QueryOptionConstant.MORE, "");
- value = getStringValueInWhere(selectKey, value, attrVOMap);
- sql.append(selectKey)
- .append(SPACE)
- .append(QueryOptionConstant.MORE)
- .append(SPACE)
- .append(value);
- } else if (value.startsWith(QueryOptionConstant.LESSTHAN)) {
- value = value.replace(QueryOptionConstant.LESSTHAN, "");
- value = getStringValueInWhere(selectKey, value, attrVOMap);
+ } else if (value.startsWith(QueryOptionConstant.NOTIN)) {
+ sql.append(selectKey)
+ .append(SPACE)
+ .append("not in")
+ .append(SPACE)
+ .append("(")
+ .append(value.replace(QueryOptionConstant.NOTIN, ""))
+ .append(")");
+ } else if (value.startsWith(QueryOptionConstant.NOTEQUAL)) {
+ value = value.replace(QueryOptionConstant.NOTEQUAL, "");
+ value = getStringValueInWhere(selectKey, value, attrVOMap);
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(QueryOptionConstant.NOTEQUAL)
+ .append(SPACE)
+ .append(value);
+ } else if (value.startsWith(QueryOptionConstant.MORETHAN)) {
+ value = value.replace(QueryOptionConstant.MORETHAN, "");
+ value = getStringValueInWhere(selectKey, value, attrVOMap);
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(QueryOptionConstant.MORETHAN)
+ .append(SPACE)
+ .append(value);
+ } else if (value.startsWith(QueryOptionConstant.MORE)) {
+ value = value.replace(QueryOptionConstant.MORE, "");
+ value = getStringValueInWhere(selectKey, value, attrVOMap);
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(QueryOptionConstant.MORE)
+ .append(SPACE)
+ .append(value);
+ } else if (value.startsWith(QueryOptionConstant.LESSTHAN)) {
+ value = value.replace(QueryOptionConstant.LESSTHAN, "");
+ value = getStringValueInWhere(selectKey, value, attrVOMap);
- sql.append(selectKey)
- .append(SPACE)
- .append(QueryOptionConstant.LESSTHAN)
- .append(SPACE)
- .append(value);
- } else if (value.startsWith(QueryOptionConstant.LESS)) {
- value = value.replace(QueryOptionConstant.LESS, "");
- value = getStringValueInWhere(selectKey, value, attrVOMap);
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(QueryOptionConstant.LESSTHAN)
+ .append(SPACE)
+ .append(value);
+ } else if (value.startsWith(QueryOptionConstant.LESS)) {
+ value = value.replace(QueryOptionConstant.LESS, "");
+ value = getStringValueInWhere(selectKey, value, attrVOMap);
- sql.append(selectKey)
- .append(SPACE)
- .append(QueryOptionConstant.LESS)
- .append(SPACE)
- .append(value);
- } else if (value.startsWith(QueryOptionConstant.ISNOTNULL)) {
- sql.append(selectKey)
- .append(SPACE)
- .append(" is not null");
- } else if (value.startsWith(QueryOptionConstant.ISNULL)) {
- sql.append(selectKey)
- .append(SPACE)
- .append(" is null");
- } else if (value.contains("*")) {
- //璇存槑鏄痩ike锛屾垨鑰卨efe like ,right like
- value = getStringValueInWhere(selectKey, value, attrVOMap);
- sql.append(selectKey)
- .append(SPACE)
- .append("like")
- .append(SPACE)
- // .append("'")
- .append(value.replace("*", "%"))
- // .append("'")
- .append(SPACE);
- } else {
- value = value.replace(SPECIAL_CHAR, REQUIRED_CHAR);
- value = getStringValueInWhere(selectKey, value, attrVOMap);
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(QueryOptionConstant.LESS)
+ .append(SPACE)
+ .append(value);
+ } else if (value.startsWith(QueryOptionConstant.ISNOTNULL)) {
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(" is not null");
+ } else if (value.startsWith(QueryOptionConstant.ISNULL)) {
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(" is null");
+ } else if (value.contains("*")) {
+ //璇存槑鏄痩ike锛屾垨鑰卨efe like ,right like
+ value = getStringValueInWhere(selectKey, value, attrVOMap);
+ sql.append(selectKey)
+ .append(SPACE)
+ .append("like")
+ .append(SPACE)
+ // .append("'")
+ .append(value.replace("*", "%"))
+ // .append("'")
+ .append(SPACE);
+ } else {
+ value = value.replace(SPECIAL_CHAR, REQUIRED_CHAR);
+ value = getStringValueInWhere(selectKey, value, attrVOMap);
- sql.append(selectKey)
- .append(SPACE)
- .append(QueryOptionConstant.EQUAL)
- .append(SPACE)
- .append(value);
- }
- sql.append(SPACE);
- return sql.toString();
- }
+ sql.append(selectKey)
+ .append(SPACE)
+ .append(QueryOptionConstant.EQUAL)
+ .append(SPACE)
+ .append(value);
+ }
+ sql.append(SPACE);
+ return sql.toString();
+ }
- /**
- * 淇敼涓婚搴撴暟鎹�
- *
- * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶇敤鍖呭惈鐮佹鐨勫唴瀹逛簡
- */
- @Override
- public void editSaveCode(CodeOrderDTO orderDTO) {
- VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭",
- orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
+ /**
+ * 淇敼涓婚搴撴暟鎹�
+ *
+ * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶇敤鍖呭惈鐮佹鐨勫唴瀹逛簡
+ */
+ @Override
+ public void editSaveCode(CodeOrderDTO orderDTO) {
+ VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭",
+ orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
- CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
- //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
- List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), orderDTO.getOid());
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
+ //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
+ List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), orderDTO.getOid());
- if (CollectionUtils.isEmpty(cbos)) {
- throw new VciBaseException(DATA_OID_NOT_EXIST);
- }
- BaseModel cbo = cbos.get(0);
- if (cbo == null) {
- throw new VciBaseException(DATA_OID_NOT_EXIST);
- }
- if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) {
- throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯");
- }
- if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) {
- throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()});
- }
+ if (CollectionUtils.isEmpty(cbos)) {
+ throw new VciBaseException(DATA_OID_NOT_EXIST);
+ }
+ BaseModel cbo = cbos.get(0);
+ if (cbo == null) {
+ throw new VciBaseException(DATA_OID_NOT_EXIST);
+ }
+ if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) {
+ throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯");
+ }
+ if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) {
+ throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()});
+ }
- //娉ㄦ剰妯℃澘涓嶈兘浣跨敤鏁版嵁瀛樺偍鐨勬椂鍊欑殑妯℃澘锛屽洜涓哄彲鑳戒細鍙樺寲
+ //娉ㄦ剰妯℃澘涓嶈兘浣跨敤鏁版嵁瀛樺偍鐨勬椂鍊欑殑妯℃澘锛屽洜涓哄彲鑳戒細鍙樺寲
- String codeClassifyOid=cbo.getData().get(CODE_CLASSIFY_OID_FIELD.toUpperCase());
+ String codeClassifyOid = cbo.getData().get(CODE_CLASSIFY_OID_FIELD.toUpperCase());
orderDTO.setCodeClassifyOid(codeClassifyOid);
// CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
// CodeClassifyTemplateVO templateVO= this.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid());
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
orderDTO.setTemplateOid(templateVO.getOid());
//1. 鍒ゆ柇蹇呰緭椤�
checkRequiredAttrOnOrder(templateVO, orderDTO);
- //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
- switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
- //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
- switchComponentAttrOnOrder(templateVO, orderDTO);
- //4.鏍¢獙瑙勫垯
- checkVerifyOnOrder(templateVO, orderDTO);
- //5.鍒ゆ柇鍏抽敭灞炴��
- checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
- //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
- checkEnumOnOrder(templateVO, orderDTO);
- //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
- switchDateAttrOnOrder(templateVO, orderDTO);
- //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙�
- copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
- //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀�
- cbo.setDescription(orderDTO.getDescription());
+ //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
+ switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
+ //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
+ switchComponentAttrOnOrder(templateVO, orderDTO);
+ //4.鏍¢獙瑙勫垯
+ checkVerifyOnOrder(templateVO, orderDTO);
+ //5.鍒ゆ柇鍏抽敭灞炴��
+ checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
+ //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
+ checkEnumOnOrder(templateVO, orderDTO);
+ //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
+ switchDateAttrOnOrder(templateVO, orderDTO);
+ //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙�
+ copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
+ //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀�
+ cbo.setDescription(orderDTO.getDescription());
// cbo.setName(orderDTO.getName());
- try {
- cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
- cbo.setName(orderDTO.getName());
- } catch (Exception e) {
- e.printStackTrace();
- }
+ try {
+ cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
+ cbo.setName(orderDTO.getName());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
// cbo.getData().putAll(orderDTO.getData());
- cbo.setLastModifyTime(new Date());
- cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
+ cbo.setLastModifyTime(new Date());
+ cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
R r = updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), Collections.singletonList(cbo));
- if(!r.isSuccess()){
+ if (!r.isSuccess()) {
throw new ServiceException(r.getMsg());
}
batchSaveSelectChar(templateVO, Collections.singletonList(cbo));
- }
+ }
- /**
- * 鍒犻櫎涓婚搴撴暟鎹�
- *
- * @param deleteBatchDTO 鏁版嵁鐨勫唴瀹癸紝蹇呴』瑕佹湁涓婚敭鍜屽垎绫讳富閿�
- */
- @Override
- public void deleteCode(CodeDeleteBatchDTO deleteBatchDTO) {
- VciBaseUtil.alertNotNull(deleteBatchDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", deleteBatchDTO.getOidList(), "鏁版嵁涓婚敭",
- deleteBatchDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
- CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(deleteBatchDTO.getCodeClassifyOid());
- //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
- Collection<String> oidCollection = new ArrayList<>();
- for (Collection<String> strings : VciBaseUtil.switchCollectionForOracleIn(deleteBatchDTO.getOidList())) {
- oidCollection.addAll(strings);
- }
+ /**
+ * 鍒犻櫎涓婚搴撴暟鎹�
+ *
+ * @param deleteBatchDTO 鏁版嵁鐨勫唴瀹癸紝蹇呴』瑕佹湁涓婚敭鍜屽垎绫讳富閿�
+ */
+ @Override
+ public void deleteCode(CodeDeleteBatchDTO deleteBatchDTO) {
+ VciBaseUtil.alertNotNull(deleteBatchDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у拰鐮佹鐨勫唴瀹归兘涓虹┖", deleteBatchDTO.getOidList(), "鏁版嵁涓婚敭",
+ deleteBatchDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(deleteBatchDTO.getCodeClassifyOid());
+ //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
+ Collection<String> oidCollection = new ArrayList<>();
+ for (Collection<String> strings : VciBaseUtil.switchCollectionForOracleIn(deleteBatchDTO.getOidList())) {
+ oidCollection.addAll(strings);
+ }
// List<CodeWupin> cboList = codeWupinMapper.selectBatchIds(oidCollection);
- List<BaseModel> cboList = new ArrayList<>();
- oidCollection.stream().forEach(oids -> {
- Map<String, String> conditionMap = new HashMap<>();
+ List<BaseModel> cboList = new ArrayList<>();
+ oidCollection.stream().forEach(oids -> {
+ Map<String, String> conditionMap = new HashMap<>();
// conditionMap.put("oid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")");
- List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), oids);
+ List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), oids);
// boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), conditionMap);
- cboList.addAll(cbos);
- });
- if (CollectionUtils.isEmpty(cboList)) {
- throw new VciBaseException("鏁版嵁鍏ㄩ儴鍦ㄧ郴缁熶腑涓嶅瓨鍦�");
- }
- List<BaseModel> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList());
- if (!CollectionUtils.isEmpty(editCBOs)) {
- BaseModel cbo = editCBOs.get(0);
- throw new VciBaseException("缂栫爜涓簕0}绛夊叡{1}鏉℃暟鎹殑鐘舵�佷笉鏄痆{2}]锛屼笉鍏佽鍒犻櫎", new String[]{cbo.getId(), String.valueOf(editCBOs.size()), CodeDefaultLC.EDITING.getText()});
- }
+ cboList.addAll(cbos);
+ });
+ if (CollectionUtils.isEmpty(cboList)) {
+ throw new VciBaseException("鏁版嵁鍏ㄩ儴鍦ㄧ郴缁熶腑涓嶅瓨鍦�");
+ }
+ List<BaseModel> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList());
+ if (!CollectionUtils.isEmpty(editCBOs)) {
+ BaseModel cbo = editCBOs.get(0);
+ throw new VciBaseException("缂栫爜涓簕0}绛夊叡{1}鏉℃暟鎹殑鐘舵�佷笉鏄痆{2}]锛屼笉鍏佽鍒犻櫎", new String[]{cbo.getId(), String.valueOf(editCBOs.size()), CodeDefaultLC.EDITING.getText()});
+ }
- //鍙兘鍒犻櫎鑷繁鍒涘缓鐨勬暟鎹�
- String userId = String.valueOf(AuthUtil.getUser().getAccount());
- for (BaseModel clientBusinessObject : cboList) {
- String creator = clientBusinessObject.getCreator();
- if (!userId.equalsIgnoreCase(creator)) {
- throw new VciBaseException("缂栫爜涓�" + clientBusinessObject.getId() + "鐨勬暟鎹笉鏄綋鍓嶇敤鎴峰垱寤猴紝涓嶈兘鍒犻櫎锛�");
- }
+ //鍙兘鍒犻櫎鑷繁鍒涘缓鐨勬暟鎹�
+ String userId = String.valueOf(AuthUtil.getUser().getAccount());
+ for (BaseModel clientBusinessObject : cboList) {
+ String creator = clientBusinessObject.getCreator();
+ if (!userId.equalsIgnoreCase(creator)) {
+ throw new VciBaseException("缂栫爜涓�" + clientBusinessObject.getId() + "鐨勬暟鎹笉鏄綋鍓嶇敤鎴峰垱寤猴紝涓嶈兘鍒犻櫎锛�");
+ }
- }
+ }
// BatchCBO batchCBO = new BatchCBO();
// batchCBO.getDeleteCbos().addAll(cboList);
// WebUtil.setPersistence(false);
// batchCBO.copyFromOther(
- productCodeService.recycleCode(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), deleteBatchDTO.getOidList());
+ productCodeService.recycleCode(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), deleteBatchDTO.getOidList());
// baseMapper.deleteBatchIds(cboList);
- //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId()));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
- commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(),
- "'" + (StringUtils.join(cboList.stream().map(BaseModel::getOid).collect(Collectors.toSet()), "','")) + "'");
- // );
+ //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId()));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
+ commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(),
+ "'" + (StringUtils.join(cboList.stream().map(BaseModel::getOid).collect(Collectors.toSet()), "','")) + "'");
+ // );
// WebUtil.setPersistence(true);
// boService.persistenceBatch(batchCBO);
- }
+ }
- /**
- * 浣跨敤鍒嗙被鍜岄樁娈电殑缂栧彿锛岃幏鍙栧寘鍚殑灞炴��
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @param phase 闃舵鐨勫悕绉�
- * @return 灞炴�х殑鑻辨枃鍚嶇О
- */
- @Override
- public List<String> listPhaseAttrByClassifyOid(String codeClassifyOid, String phase) {
- CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid, false);
- //鎵鹃樁娈�
- return phaseAttrService.listAttrByTemplateOidAndPhaseId(templateVO.getOid(), phase);
- }
+ /**
+ * 浣跨敤鍒嗙被鍜岄樁娈电殑缂栧彿锛岃幏鍙栧寘鍚殑灞炴��
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param phase 闃舵鐨勫悕绉�
+ * @return 灞炴�х殑鑻辨枃鍚嶇О
+ */
+ @Override
+ public List<String> listPhaseAttrByClassifyOid(String codeClassifyOid, String phase) {
+ CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid, false);
+ //鎵鹃樁娈�
+ return phaseAttrService.listAttrByTemplateOidAndPhaseId(templateVO.getOid(), phase);
+ }
- /**
- * 璺緞涓婂寘鍚綋鍓嶅垎绫荤殑鎵�鏈夊垎绫讳俊鎭�
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @return 鍒嗙被鏍�
- */
- @Override
- public List<Tree> hasSelfClassifyTree(String codeClassifyOid) {
- if (StringUtils.isBlank(codeClassifyOid)) {
- return new ArrayList<>();
- }
- CodeClassifyFullInfoBO fullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
- //鏌ヨ瀛�
- List<CodeClassifyVO> childrenClassifys = classifyService.listChildrenClassify(codeClassifyOid, true, "id", true);
- Map<String, CodeClassifyVO> classifyVOMap = new HashMap<>();
- classifyVOMap.putAll(Optional.ofNullable(fullInfo.getParentClassifyVOs()).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)));
- classifyVOMap.putAll(Optional.ofNullable(childrenClassifys).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)));
- TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(CodeClassifyServiceImpl.PARENT_FIELD_NAME.toLowerCase(Locale.ROOT));
- return revisionModelUtil.doList2Trees(classifyVOMap.values().stream().collect(Collectors.toList()), treeWrapperOptions, (CodeClassifyVO s) -> {
- return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s
- .getLcStatus()) ? (" 銆愬仠鐢ㄣ�� ") : "");
- });
- }
+ /**
+ * 璺緞涓婂寘鍚綋鍓嶅垎绫荤殑鎵�鏈夊垎绫讳俊鎭�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 鍒嗙被鏍�
+ */
+ @Override
+ public List<Tree> hasSelfClassifyTree(String codeClassifyOid) {
+ if (StringUtils.isBlank(codeClassifyOid)) {
+ return new ArrayList<>();
+ }
+ CodeClassifyFullInfoBO fullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
+ //鏌ヨ瀛�
+ List<CodeClassifyVO> childrenClassifys = classifyService.listChildrenClassify(codeClassifyOid, true, "id", true);
+ Map<String, CodeClassifyVO> classifyVOMap = new HashMap<>();
+ classifyVOMap.putAll(Optional.ofNullable(fullInfo.getParentClassifyVOs()).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)));
+ classifyVOMap.putAll(Optional.ofNullable(childrenClassifys).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)));
+ TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(CodeClassifyServiceImpl.PARENT_FIELD_NAME.toLowerCase(Locale.ROOT));
+ return revisionModelUtil.doList2Trees(classifyVOMap.values().stream().collect(Collectors.toList()), treeWrapperOptions, (CodeClassifyVO s) -> {
+ return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s
+ .getLcStatus()) ? (" 銆愬仠鐢ㄣ�� ") : "");
+ });
+ }
- /**
- * 浣跨敤鍒嗙被鑾峰彇瀵瑰簲鐨勬暟鎹�
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @param templateOid 妯℃澘鐨勪富閿�
- * @param conditionMap 鏌ヨ鏉′欢
- * @param pageHelper 鍒嗛〉鐨勫璞�
- * @return 鏁版嵁锛堝寘鍚笅绾у垎绫伙級
- */
- @Override
- public DataGrid<Map<String, String>> gridTableDataByClassifyOid(String codeClassifyOid, String templateOid, Map<String, String> conditionMap, PageHelper pageHelper) {
- //1. 浣跨敤鍒嗙被鑾峰彇鎵�鏈夌殑涓嬬骇鍒嗙被锛岀劧鍚庢牴鎹垎绫绘煡璇㈠搴旂殑鏁版嵁
- //2. 鍏ㄩ儴浣跨敤褰撳墠鍒嗙被鐨勫綋鍓嶆ā鏉挎潵灞曠ず鍐呭
- //3. 濡傛灉妯℃澘涓婃湁鏋氫妇娉ㄥ叆锛岀粍鍚堣鍒欙紝鍜屽弬鐓х殑锛岄渶瑕佹墽琛岃浆鎹�
- //4. 鏌ヨ鐨勬椂鍊欙紝鐩存帴浣跨敤codeclsfpath鏉ユ煡璇�
- CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(codeClassifyOid);
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
- if (topClassifyVO == null || StringUtils.isBlank(topClassifyVO.getBtmTypeId())) {
- throw new VciBaseException("褰撳墠涓婚搴撳垎绫绘病鏈夐《灞傚垎绫伙紝鎴栬�呴《灞傚垎绫绘病鏈夎缃笟鍔$被鍨�");
- }
- String btmTypeId = topClassifyVO.getBtmTypeId();
- if (StringUtils.isBlank(btmTypeId)) {
- return new DataGrid<>("杩欎釜鍒嗙被鎵�灞為《灞傚垎绫绘病鏈夋坊鍔犱笟鍔$被鍨�");
- }
- if (conditionMap == null) {
- conditionMap = new HashMap<>();
- }
- pageHelper.addDefaultDesc("createTime");
+ /**
+ * 浣跨敤鍒嗙被鑾峰彇瀵瑰簲鐨勬暟鎹�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param templateOid 妯℃澘鐨勪富閿�
+ * @param conditionMap 鏌ヨ鏉′欢
+ * @param pageHelper 鍒嗛〉鐨勫璞�
+ * @return 鏁版嵁锛堝寘鍚笅绾у垎绫伙級
+ */
+ @Override
+ public DataGrid<Map<String, String>> gridTableDataByClassifyOid(String codeClassifyOid, String templateOid, Map<String, String> conditionMap, PageHelper pageHelper) {
+ //1. 浣跨敤鍒嗙被鑾峰彇鎵�鏈夌殑涓嬬骇鍒嗙被锛岀劧鍚庢牴鎹垎绫绘煡璇㈠搴旂殑鏁版嵁
+ //2. 鍏ㄩ儴浣跨敤褰撳墠鍒嗙被鐨勫綋鍓嶆ā鏉挎潵灞曠ず鍐呭
+ //3. 濡傛灉妯℃澘涓婃湁鏋氫妇娉ㄥ叆锛岀粍鍚堣鍒欙紝鍜屽弬鐓х殑锛岄渶瑕佹墽琛岃浆鎹�
+ //4. 鏌ヨ鐨勬椂鍊欙紝鐩存帴浣跨敤codeclsfpath鏉ユ煡璇�
+ CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(codeClassifyOid);
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
+ if (topClassifyVO == null || StringUtils.isBlank(topClassifyVO.getBtmTypeId())) {
+ throw new VciBaseException("褰撳墠涓婚搴撳垎绫绘病鏈夐《灞傚垎绫伙紝鎴栬�呴《灞傚垎绫绘病鏈夎缃笟鍔$被鍨�");
+ }
+ String btmTypeId = topClassifyVO.getBtmTypeId();
+ if (StringUtils.isBlank(btmTypeId)) {
+ return new DataGrid<>("杩欎釜鍒嗙被鎵�灞為《灞傚垎绫绘病鏈夋坊鍔犱笟鍔$被鍨�");
+ }
+ if (conditionMap == null) {
+ conditionMap = new HashMap<>();
+ }
+ pageHelper.addDefaultDesc("createTime");
// pageHelper.addDefaultDesc("id");
- if (!classifyService.checkHasChild(codeClassifyOid)) {
- conditionMap.put("t." + CODE_CLASSIFY_OID_FIELD, codeClassifyOid);
- } else {
+ if (!classifyService.checkHasChild(codeClassifyOid)) {
+ conditionMap.put("t." + CODE_CLASSIFY_OID_FIELD, codeClassifyOid);
+ } else {
// conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY)
List<BtmTypeVO> classifyData = btmTypeClient.selectByIdCollection(Collections.singletonList(MdmBtmTypeConstant.CODE_CLASSIFY)).getData();
- if(Func.isEmpty(classifyData)){
- throw new ServiceException("涓氬姟绫诲瀷涓嫳鏂囧悕绉板拰鏌ヨ鏉′欢閰嶇疆涓嶄竴鑷达紝璇蜂慨鏀逛笟鍔$被鍨嬩腑鍒嗙被琛ㄨ嫳鏂囧悕绉颁负"+MdmBtmTypeConstant.CODE_CLASSIFY);
+ if (Func.isEmpty(classifyData)) {
+ throw new ServiceException("涓氬姟绫诲瀷涓嫳鏂囧悕绉板拰鏌ヨ鏉′欢閰嶇疆涓嶄竴鑷达紝璇蜂慨鏀逛笟鍔$被鍨嬩腑鍒嗙被琛ㄨ嫳鏂囧悕绉颁负" + MdmBtmTypeConstant.CODE_CLASSIFY);
}
- conditionMap.put("t." + CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " +
+ conditionMap.put("t." + CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " +
classifyData.get(0).getTableName() + " where lcstatus='" + FrameWorkDefaultValueConstant
- .FRAMEWORK_DATA_ENABLED + "' start with parentCodeClassifyOid = '" + codeClassifyOid +
- "' CONNECT BY PRIOR OID = parentCodeClassifyOid )");
- }
- conditionMap.put("t.lastr", "1");
- conditionMap.put("t.lastv", "1");
+ .FRAMEWORK_DATA_ENABLED + "' start with parentCodeClassifyOid = '" + codeClassifyOid +
+ "' CONNECT BY PRIOR OID = parentCodeClassifyOid )");
+ }
+ conditionMap.put("t.lastr", "1");
+ conditionMap.put("t.lastv", "1");
DataGrid<Map<String, String>> mapDataGrid = queryGrid(btmTypeId, templateVO, conditionMap, pageHelper);
//澶勭悊杩斿洖鏁版嵁涓庢ā鏉挎暟鎹厤缃殑瀛楁涓嶄竴鏍烽棶棰�
- templateVO.getAttributes().stream().forEach(e->{
+ templateVO.getAttributes().stream().forEach(e -> {
for (Map<String, String> datum : mapDataGrid.getData()) {
- if(datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())){
- datum.put(e.getId(),datum.get(e.getId().toLowerCase()));
+ if (datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())) {
+ datum.put(e.getId(), datum.get(e.getId().toLowerCase()));
datum.remove(e.getId().toLowerCase());
}
}
@@ -3004,217 +3012,217 @@
// wrapperData(dataGrid.getData(),templateVO,finalSelectFieldList,false);
// }
// return dataGrid;
- }
+ }
- /**
- * 鎵归噺淇濆瓨娴佺▼鎵ц椤甸潰淇敼鐨勫唴瀹�
- *
- * @param orderDTOList 缂栫爜鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅
- * @return 鎵ц缁撴灉
- */
- @Override
- public R batchUpdateCode(List<CodeOrderDTO> orderDTOList) {
- VciBaseUtil.alertNotNull(orderDTOList, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у唴瀹�");
- orderDTOList.forEach(orderDTO -> {
- VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭",
- orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
- });
- Map<String, CodeOrderDTO> orderDTOMap = orderDTOList.stream().filter(orderDTO -> orderDTO != null && StringUtils.isNotBlank(orderDTO.getOid())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
- List<BaseModel> updateList = new ArrayList<>();
- // 搴旇閮芥槸涓�涓垎绫讳笅鐨勪笟鍔℃暟鎹紝鎵剧涓�鏉$殑灏辫
- CodeClassifyFullInfoBO topClassifyFullInfo = classifyService.getClassifyFullInfo(orderDTOList.get(0).getCodeClassifyOid());
- if (CollectionUtils.isEmpty(orderDTOMap.keySet())) {
- throw new VciBaseException(DATA_OID_NOT_EXIST);
- }
+ /**
+ * 鎵归噺淇濆瓨娴佺▼鎵ц椤甸潰淇敼鐨勫唴瀹�
+ *
+ * @param orderDTOList 缂栫爜鐩稿叧鐨勪俊鎭紝涓嶉渶瑕佺爜娈电殑淇℃伅
+ * @return 鎵ц缁撴灉
+ */
+ @Override
+ public R batchUpdateCode(List<CodeOrderDTO> orderDTOList) {
+ VciBaseUtil.alertNotNull(orderDTOList, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬у唴瀹�");
+ orderDTOList.forEach(orderDTO -> {
+ VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭閮戒负绌�", orderDTO.getOid(), "鏁版嵁涓婚敭",
+ orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
+ });
+ Map<String, CodeOrderDTO> orderDTOMap = orderDTOList.stream().filter(orderDTO -> orderDTO != null && StringUtils.isNotBlank(orderDTO.getOid())).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
+ List<BaseModel> updateList = new ArrayList<>();
+ // 搴旇閮芥槸涓�涓垎绫讳笅鐨勪笟鍔℃暟鎹紝鎵剧涓�鏉$殑灏辫
+ CodeClassifyFullInfoBO topClassifyFullInfo = classifyService.getClassifyFullInfo(orderDTOList.get(0).getCodeClassifyOid());
+ if (CollectionUtils.isEmpty(orderDTOMap.keySet())) {
+ throw new VciBaseException(DATA_OID_NOT_EXIST);
+ }
- List<BaseModel> cboList = selectByTypeAndOid(topClassifyFullInfo.getTopClassifyVO().getBtmTypeId(), VciBaseUtil.array2String(orderDTOMap.keySet().toArray(new String[0])));
+ List<BaseModel> cboList = selectByTypeAndOid(topClassifyFullInfo.getTopClassifyVO().getBtmTypeId(), VciBaseUtil.array2String(orderDTOMap.keySet().toArray(new String[0])));
if (CollectionUtils.isEmpty(cboList)) {
- throw new VciBaseException(DATA_OID_NOT_EXIST);
- }
+ throw new VciBaseException(DATA_OID_NOT_EXIST);
+ }
Map<String, BaseModel> cboMap = cboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
- orderDTOMap.keySet().stream().forEach(oid -> {
- CodeOrderDTO orderDTO = orderDTOMap.get(oid);
- CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
- CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid());
- BaseModel cbo = cboMap.get(oid);
- String code = cbo.getId();
- if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) {
- throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯");
- }
- if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) {
- throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()});
- }
- //1. 鍒ゆ柇蹇呰緭椤�
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
- checkRequiredAttrOnOrder(templateVO, orderDTO);
- //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
- switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
- //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
- switchComponentAttrOnOrder(templateVO, orderDTO);
- //4.鏍¢獙瑙勫垯
- checkVerifyOnOrder(templateVO, orderDTO);
- //5.鍒ゆ柇鍏抽敭灞炴��
- checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
- //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
- checkEnumOnOrder(templateVO, orderDTO);
- //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
- switchDateAttrOnOrder(templateVO, orderDTO);
- //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙�
- copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
- //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀�
- cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
- cbo.setName(orderDTO.getName());
- cbo.setId(code);
- cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
- cbo.setName(orderDTO.getName());
+ orderDTOMap.keySet().stream().forEach(oid -> {
+ CodeOrderDTO orderDTO = orderDTOMap.get(oid);
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
+ CodeClassifyTemplateVO firstTemplateVO = templateService.getObjectHasAttrByOid(orderDTOMap.values().stream().findFirst().get().getTemplateOid());
+ BaseModel cbo = cboMap.get(oid);
+ String code = cbo.getId();
+ if (!cbo.getTs().toString().contains(VciDateUtil.date2Str(orderDTO.getTs(), VciDateUtil.DateTimeFormat))) {
+ throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯");
+ }
+ if (!CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(cbo.getLcStatus()) && !orderDTO.isEditInProcess()) {
+ throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()});
+ }
+ //1. 鍒ゆ柇蹇呰緭椤�
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
+ checkRequiredAttrOnOrder(templateVO, orderDTO);
+ //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
+ switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
+ //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
+ switchComponentAttrOnOrder(templateVO, orderDTO);
+ //4.鏍¢獙瑙勫垯
+ checkVerifyOnOrder(templateVO, orderDTO);
+ //5.鍒ゆ柇鍏抽敭灞炴��
+ checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
+ //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
+ checkEnumOnOrder(templateVO, orderDTO);
+ //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
+ switchDateAttrOnOrder(templateVO, orderDTO);
+ //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙�
+ copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
+ //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀�
+ cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
+ cbo.setName(orderDTO.getName());
+ cbo.setId(code);
+ cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
+ cbo.setName(orderDTO.getName());
- updateList.add(cbo);
- batchSaveSelectChar(firstTemplateVO, cboList);
- });
- updateBatchByBaseModel(topClassifyFullInfo.getTopClassifyVO().getBtmTypeId(), updateList);
- return R.success("鎿嶄綔鎴愬姛锛�");
- }
+ updateList.add(cbo);
+ batchSaveSelectChar(firstTemplateVO, cboList);
+ });
+ updateBatchByBaseModel(topClassifyFullInfo.getTopClassifyVO().getBtmTypeId(), updateList);
+ return R.success("鎿嶄綔鎴愬姛锛�");
+ }
- /**
- * 鏍囪娴佺▼涓笟鍔℃暟鎹槸鍚﹂�氳繃
- *
- * @param oid 涓氬姟鏁版嵁涓婚敭
- * @param btmName 涓氬姟绫诲瀷
- * @param pass 鏄惁閫氳繃
- * @return 鎵ц缁撴灉
- */
- @Override
- public R markDataPassing(String oid, String btmName, Boolean pass) {
- VciBaseUtil.alertNotNull(oid, "涓氬姟鏁版嵁涓婚敭", btmName, "涓氬姟绫诲瀷", pass, "鏍囪绫诲瀷");
- boolean flag = true;
- try {
- List<BaseModel> datas = selectByTypeAndOid(btmName, oid);
- if (datas.size() == 0) {
- return R.fail(DATA_OID_NOT_EXIST);
- }
- datas.stream().forEach(data -> data.getData().put("PASSING", String.valueOf(pass)));
- R r = updateBatchByBaseModel(btmName, datas);
- if (!r.isSuccess()) {
- flag = false;
- }
- } catch (Exception e) {
- flag = false;
- e.printStackTrace();
- }
- if (flag) {
- return R.success("鏍囪鎴愬姛锛�");
- } else {
- return R.fail("鏍囪澶辫触锛�");
- }
- }
+ /**
+ * 鏍囪娴佺▼涓笟鍔℃暟鎹槸鍚﹂�氳繃
+ *
+ * @param oid 涓氬姟鏁版嵁涓婚敭
+ * @param btmName 涓氬姟绫诲瀷
+ * @param pass 鏄惁閫氳繃
+ * @return 鎵ц缁撴灉
+ */
+ @Override
+ public R markDataPassing(String oid, String btmName, Boolean pass) {
+ VciBaseUtil.alertNotNull(oid, "涓氬姟鏁版嵁涓婚敭", btmName, "涓氬姟绫诲瀷", pass, "鏍囪绫诲瀷");
+ boolean flag = true;
+ try {
+ List<BaseModel> datas = selectByTypeAndOid(btmName, oid);
+ if (datas.size() == 0) {
+ return R.fail(DATA_OID_NOT_EXIST);
+ }
+ datas.stream().forEach(data -> data.getData().put("PASSING", String.valueOf(pass)));
+ R r = updateBatchByBaseModel(btmName, datas);
+ if (!r.isSuccess()) {
+ flag = false;
+ }
+ } catch (Exception e) {
+ flag = false;
+ e.printStackTrace();
+ }
+ if (flag) {
+ return R.success("鏍囪鎴愬姛锛�");
+ } else {
+ return R.fail("鏍囪澶辫触锛�");
+ }
+ }
- /**
- * 棰勮缁勫悎瑙勫垯
- *
- * @param orderDTO 棰勮鐨勪俊鎭紝鍖呭惈妯℃澘鐨勪富閿�
- * @return key鏄粍鍚堣鍒欑殑灞炴�с�倂alue鏄粍鍚堝悗鐨勫�硷紝銆傚鏋滅己灏戞煇涓睘鎬х殑鍊硷紝浼氫綔涓簐alue杩斿洖
- */
- @Override
- public Map<String, String> previewCompRule(CodeOrderDTO orderDTO) {
- VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧淇℃伅", orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�");
- //鏌ヨ鍒嗙被鐨勪俊鎭紝鏌ヨ妯℃澘鐨勪俊鎭�
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
- switchComponentAttrOnOrder(templateVO, orderDTO);
- return orderDTO.getData();
- }
+ /**
+ * 棰勮缁勫悎瑙勫垯
+ *
+ * @param orderDTO 棰勮鐨勪俊鎭紝鍖呭惈妯℃澘鐨勪富閿�
+ * @return key鏄粍鍚堣鍒欑殑灞炴�с�倂alue鏄粍鍚堝悗鐨勫�硷紝銆傚鏋滅己灏戞煇涓睘鎬х殑鍊硷紝浼氫綔涓簐alue杩斿洖
+ */
+ @Override
+ public Map<String, String> previewCompRule(CodeOrderDTO orderDTO) {
+ VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧淇℃伅", orderDTO.getTemplateOid(), "妯℃澘鐨勪富閿�");
+ //鏌ヨ鍒嗙被鐨勪俊鎭紝鏌ヨ妯℃澘鐨勪俊鎭�
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(orderDTO.getTemplateOid());
+ switchComponentAttrOnOrder(templateVO, orderDTO);
+ return orderDTO.getData();
+ }
- /**
- * 鍒嗙被娉ㄥ叆鐨勫唴瀹归瑙�
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @param codeTemplateOid 妯℃澘鐨勪富閿�
- * @return key鏄垎绫绘敞鍏ョ殑灞炴�э紝value鏄敞鍏ュ悗鐨勫��
- */
- @Override
- public Map<String, String> previewClassify(String codeClassifyOid, String codeTemplateOid) {
- if (StringUtils.isBlank(codeClassifyOid) || StringUtils.isBlank(codeTemplateOid)) {
- return new HashMap<>();
- }
- //鏌ヨ鍒嗙被鐨勪俊鎭紝鏌ヨ妯℃澘鐨勪俊鎭�
- CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(codeTemplateOid);
- //
+ /**
+ * 鍒嗙被娉ㄥ叆鐨勫唴瀹归瑙�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param codeTemplateOid 妯℃澘鐨勪富閿�
+ * @return key鏄垎绫绘敞鍏ョ殑灞炴�э紝value鏄敞鍏ュ悗鐨勫��
+ */
+ @Override
+ public Map<String, String> previewClassify(String codeClassifyOid, String codeTemplateOid) {
+ if (StringUtils.isBlank(codeClassifyOid) || StringUtils.isBlank(codeTemplateOid)) {
+ return new HashMap<>();
+ }
+ //鏌ヨ鍒嗙被鐨勪俊鎭紝鏌ヨ妯℃澘鐨勪俊鎭�
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(codeClassifyOid);
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(codeTemplateOid);
+ //
- CodeOrderDTO orderDTO = new CodeOrderDTO();
- orderDTO.setData(new HashMap<>());
- switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
- return orderDTO.getData();
- }
+ CodeOrderDTO orderDTO = new CodeOrderDTO();
+ orderDTO.setData(new HashMap<>());
+ switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
+ return orderDTO.getData();
+ }
- /**
- * 鍗囩増鐨勪富棰樺簱鏁版嵁
- *
- * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶉渶瑕佸寘鍚爜娈电殑鍐呭
- */
- @Override
- public void upSaveCode(CodeOrderDTO orderDTO) {
- VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鏁版嵁鎵�鍦ㄤ笟鍔$被鍚嶇О", orderDTO.getBtmname());
- String btmName = orderDTO.getBtmname();
- //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
- List<BaseModel> cbos = selectByTypeAndOid(btmName, orderDTO.getCopyFromVersion());
- if (CollectionUtils.isEmpty(cbos)) {
- throw new VciBaseException(DATA_OID_NOT_EXIST);
- }
- BaseModel oldCbo = cbos.get(0);
+ /**
+ * 鍗囩増鐨勪富棰樺簱鏁版嵁
+ *
+ * @param orderDTO 鏁版嵁鐨勫唴瀹癸紝涓嶉渶瑕佸寘鍚爜娈电殑鍐呭
+ */
+ @Override
+ public void upSaveCode(CodeOrderDTO orderDTO) {
+ VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鏁版嵁鎵�鍦ㄤ笟鍔$被鍚嶇О", orderDTO.getBtmname());
+ String btmName = orderDTO.getBtmname();
+ //鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
+ List<BaseModel> cbos = selectByTypeAndOid(btmName, orderDTO.getCopyFromVersion());
+ if (CollectionUtils.isEmpty(cbos)) {
+ throw new VciBaseException(DATA_OID_NOT_EXIST);
+ }
+ BaseModel oldCbo = cbos.get(0);
- if (!CodeDefaultLC.RELEASED.getValue().equalsIgnoreCase(oldCbo.getLcStatus())) {
- throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁告暟鎹洿鏀�", new String[]{CodeDefaultLC.RELEASED.getText()});
- }
+ if (!CodeDefaultLC.RELEASED.getValue().equalsIgnoreCase(oldCbo.getLcStatus())) {
+ throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁告暟鎹洿鏀�", new String[]{CodeDefaultLC.RELEASED.getText()});
+ }
- //鏍规嵁鏁版嵁鑾峰彇鍒嗙被oid
- String codeClassifyOid = oldCbo.getData().get(CODE_CLASSIFY_OID_FIELD.toUpperCase());
- orderDTO.setCodeClassifyOid(codeClassifyOid);
- CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
- CodeClassifyTemplateVO templateVO = this.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid());
- orderDTO.setTemplateOid(templateVO.getOid());
- VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭涓虹┖", orderDTO.getCopyFromVersion(), "鍘熷鏁版嵁鐨勪富閿�",
- orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
+ //鏍规嵁鏁版嵁鑾峰彇鍒嗙被oid
+ String codeClassifyOid = oldCbo.getData().get(CODE_CLASSIFY_OID_FIELD.toUpperCase());
+ orderDTO.setCodeClassifyOid(codeClassifyOid);
+ CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(orderDTO.getCodeClassifyOid());
+ CodeClassifyTemplateVO templateVO = this.getUsedTemplateByClassifyOid(orderDTO.getCodeClassifyOid());
+ orderDTO.setTemplateOid(templateVO.getOid());
+ VciBaseUtil.alertNotNull(orderDTO, "缂栫爜鐢宠鐩稿叧鐨勫睘鎬х殑鍐呭涓虹┖", orderDTO.getCopyFromVersion(), "鍘熷鏁版嵁鐨勪富閿�",
+ orderDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
- //闇�瑕佸崌鐗�
- BaseModel cbo = null;
- cbo = reviseBusinessObject(oldCbo);
- //1. 鍒ゆ柇蹇呰緭椤�
+ //闇�瑕佸崌鐗�
+ BaseModel cbo = null;
+ cbo = reviseBusinessObject(oldCbo);
+ //1. 鍒ゆ柇蹇呰緭椤�
checkRequiredAttrOnOrder(templateVO, orderDTO);
- //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
- switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
- //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
- switchComponentAttrOnOrder(templateVO, orderDTO);
- //4.鏍¢獙瑙勫垯
- checkVerifyOnOrder(templateVO, orderDTO);
- //5.鍒ゆ柇鍏抽敭灞炴��
- checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
- //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
- checkEnumOnOrder(templateVO, orderDTO);
- //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
- switchDateAttrOnOrder(templateVO, orderDTO);
- //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙�
- copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
- //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀�
- cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
- cbo.setName(orderDTO.getName());
- cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
- cbo.setName(orderDTO.getName());
- //鏁版嵁鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑
- cbo.setCreateTime(cbo.getCreateTime());
+ //2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
+ switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO);
+ //3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
+ switchComponentAttrOnOrder(templateVO, orderDTO);
+ //4.鏍¢獙瑙勫垯
+ checkVerifyOnOrder(templateVO, orderDTO);
+ //5.鍒ゆ柇鍏抽敭灞炴��
+ checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO);
+ //6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
+ checkEnumOnOrder(templateVO, orderDTO);
+ //7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
+ switchDateAttrOnOrder(templateVO, orderDTO);
+ //榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙�
+ copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true);
+ //浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀�
+ cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
+ cbo.setName(orderDTO.getName());
+ cbo.setDescription(StringUtils.isBlank(orderDTO.getDescription()) ? "" : orderDTO.getDescription());
+ cbo.setName(orderDTO.getName());
+ //鏁版嵁鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑
+ cbo.setCreateTime(cbo.getCreateTime());
cbo.setCreator(cbo.getCreator());
- cbo.setLastModifyTime(cbo.getLastModifyTime());
+ cbo.setLastModifyTime(cbo.getLastModifyTime());
cbo.setTenantId(AuthUtil.getTenantId());
oldCbo.setLastV("0");
oldCbo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
oldCbo.setLastModifyTime(new Date());
- try {
+ try {
// 淇敼鐗堟鍙�
updateBatchByBaseModel(oldCbo.getBtmname(), Collections.singletonList(oldCbo));
// 鎻掑叆鏂扮殑鏁版嵁
- insertBatchByType(cbo.getBtmname(), Collections.singletonList(cbo));
+ insertBatchByType(cbo.getBtmname(), Collections.singletonList(cbo));
//澶勭悊鐮佸�艰〃锛屽鐮佸�艰〃杩涜澶勭悊鏇挎崲鍒涘缓鏁版嵁鐨刼id
QueryWrapper<CodeAllCode> wrapper = new QueryWrapper<>();
- wrapper.eq("CREATECODEOID",orderDTO.getCopyFromVersion());
+ wrapper.eq("CREATECODEOID", orderDTO.getCopyFromVersion());
CodeAllCode codeAllCode = codeAllCodeService.getOne(wrapper);
codeAllCode.setCreateCodeOid(cbo.getOid());
codeAllCode.setLastModifyTime(new Date());
@@ -3222,56 +3230,57 @@
codeAllCode.setLastModifier(AuthUtil.getUser().getUserName());
codeAllCodeService.updateById(codeAllCode);
// 璁板綍鏁版嵁鏇存敼鏃ュ織
- saveLogUtil.operateLog("鏁版嵁鏇存敼",false, StringUtil.format("{}\n淇敼涓�:\n{}",JSON.toJSONString(Collections.singletonList(oldCbo)),JSON.toJSONString(Collections.singletonList(cbo))));
+ saveLogUtil.operateLog("鏁版嵁鏇存敼", false, StringUtil.format("{}\n淇敼涓�:\n{}", JSON.toJSONString(Collections.singletonList(oldCbo)), JSON.toJSONString(Collections.singletonList(cbo))));
} catch (Exception vciError) {
// 璁板綍鏁版嵁鏇存敼鎶ラ敊鏃剁殑鏃ュ織
- saveLogUtil.operateLog("鏁版嵁鏇存敼",true,vciError.toString());
+ saveLogUtil.operateLog("鏁版嵁鏇存敼", true, vciError.toString());
throw new VciBaseException("鏁版嵁鏇存敼淇濆瓨鍑洪敊浜�", new String[0], vciError);
}
- batchSaveSelectChar(templateVO, Collections.singletonList(cbo));
- }
+ batchSaveSelectChar(templateVO, Collections.singletonList(cbo));
+ }
- /**
- * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹�
- *
- * @param classifySecOid 鐮佹鐨勪富閿�
- * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿�
- * @return 鍒嗙被鐮佸�肩殑鍐呭
- */
- @Override
- public List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid) {
- return classifyValueService.listCodeClassifyValueBySecOid(classifySecOid, parentClassifyValueOid);
- }
+ /**
+ * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹�
+ *
+ * @param classifySecOid 鐮佹鐨勪富閿�
+ * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿�
+ * @return 鍒嗙被鐮佸�肩殑鍐呭
+ */
+ @Override
+ public List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid) {
+ return classifyValueService.listCodeClassifyValueBySecOid(classifySecOid, parentClassifyValueOid);
+ }
- /**
- * 浣跨敤涓婚搴撳垎绫昏幏鍙栫紪鐮佽鍒�
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @return 缂栫爜瑙勫垯鐨勫唴瀹�
- */
- @Override
- public CodeRuleVO getCodeRuleByClassifyOid(String codeClassifyOid) {
- VciBaseUtil.alertNotNull(codeClassifyOid, "鍒嗙被鐨勪富閿�");
- CodeClassifyVO classifyVO = classifyService.getObjectByOid(codeClassifyOid);
- String codeRuleOid = classifyVO.getCodeRuleOid();
- if (StringUtils.isBlank(codeRuleOid)) {
- //寰�涓婃壘
+ /**
+ * 浣跨敤涓婚搴撳垎绫昏幏鍙栫紪鐮佽鍒�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 缂栫爜瑙勫垯鐨勫唴瀹�
+ */
+ @Override
+ public CodeRuleVO getCodeRuleByClassifyOid(String codeClassifyOid) {
+ VciBaseUtil.alertNotNull(codeClassifyOid, "鍒嗙被鐨勪富閿�");
+ CodeClassifyVO classifyVO = classifyService.getObjectByOid(codeClassifyOid);
+ String codeRuleOid = classifyVO.getCodeRuleOid();
+ if (StringUtils.isBlank(codeRuleOid)) {
+ //寰�涓婃壘
CodeRuleVO classifyFullInfoCodeRule = getCodeRuleByClassifyFullInfo(classifyService.getClassifyFullInfo(codeClassifyOid));
return toCodeValueApplyStatus(classifyFullInfoCodeRule);
- }
- //鏌ヨ缂栫爜瑙勫垯
+ }
+ //鏌ヨ缂栫爜瑙勫垯
CodeRuleVO objectHasSecByOid = ruleService.getObjectHasSecByOid(codeRuleOid);
return toCodeValueApplyStatus(objectHasSecByOid);
- }
+ }
/**
* 缂栫爜鐢宠琛ㄥ崟锛岄殣钘忋�佸彲杈撱�佸彧璇昏浆鎹�
+ *
* @param codeRuleVO
* @return
*/
- private CodeRuleVO toCodeValueApplyStatus(CodeRuleVO codeRuleVO){
- if(codeRuleVO.getSecVOList().isEmpty()){
+ private CodeRuleVO toCodeValueApplyStatus(CodeRuleVO codeRuleVO) {
+ if (codeRuleVO.getSecVOList().isEmpty()) {
return codeRuleVO;
}
// 鍙緭鐮佹绫诲瀷
@@ -3294,17 +3303,17 @@
// 褰撳墠瑙勫垯鐨勬墍鏈夌被鍨嬬爜娈�
List<String> secTypeList = codeRuleVO.getSecVOList().stream().map(CodeBasicSecVO::getSecType).collect(Collectors.toList());
// 鎯呭喌涓� 鍏ㄩ儴鏄彧璇荤殑鐮佹绫诲瀷
- boolean hasAllReadOnlyType =secTypeList.stream().allMatch(item -> readOnlyTypes.stream().anyMatch(item1-> item.equals(item1)));
+ boolean hasAllReadOnlyType = secTypeList.stream().allMatch(item -> readOnlyTypes.stream().anyMatch(item1 -> item.equals(item1)));
// 鍏ㄩ儴鏄彧璇荤殑鐮佹绫诲瀷
- if(hasAllReadOnlyType){
+ if (hasAllReadOnlyType) {
List<CodeBasicSecVO> basicSecVOS = codeRuleVO.getSecVOList().stream().map(secVO -> {
secVO.setCodeValueApplyStatus(3);
// 鏃ユ湡鐮佹璁剧疆榛樿鍊�
if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) {
try {
- secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr()));
- }catch (Exception e){
- throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage());
+ secVO.setCodeDateValue(Func.format(new Date(), secVO.getCodeDateFormatStr()));
+ } catch (Exception e) {
+ throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細" + e.getMessage());
}
}
return secVO;
@@ -3313,16 +3322,16 @@
return codeRuleVO;
}
// 鎯呭喌浜� 鍏ㄩ儴閮芥槸鍙緭鍏ョ被鍨嬬殑
- boolean hasAllInputType = secTypeList.stream().allMatch(item -> inputTypes.stream().anyMatch(item1-> item.equals(item1)));
- if(hasAllInputType){
+ boolean hasAllInputType = secTypeList.stream().allMatch(item -> inputTypes.stream().anyMatch(item1 -> item.equals(item1)));
+ if (hasAllInputType) {
List<CodeBasicSecVO> basicSecVOS = codeRuleVO.getSecVOList().stream().map(secVO -> {
secVO.setCodeValueApplyStatus(1);
// 鏃ユ湡鐮佹璁剧疆榛樿鍊�
if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) {
try {
- secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr()));
- }catch (Exception e){
- throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage());
+ secVO.setCodeDateValue(Func.format(new Date(), secVO.getCodeDateFormatStr()));
+ } catch (Exception e) {
+ throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細" + e.getMessage());
}
}
return secVO;
@@ -3332,111 +3341,111 @@
}
// 鎯呭喌涓夊寘鍚汉涓洪�夋嫨鐨勭爜娈碉紝鍙堟湁鍙绫诲瀷鐮佹鐨勶紝鎵�鏈夌爜娈甸兘瑕佹樉绀哄嚭鏉ワ紝鍙緭璁剧疆涓�1锛屽彧璇昏缃负2锛岄殣钘忚缃负3
List<CodeBasicSecVO> basicSecVOS = codeRuleVO.getSecVOList().stream().map(secVO -> {
- if(inputTypes.contains(secVO.getSecType())){
+ if (inputTypes.contains(secVO.getSecType())) {
secVO.setCodeValueApplyStatus(1);
- }else if(readOnlyTypes.contains(secVO.getSecType())){
+ } else if (readOnlyTypes.contains(secVO.getSecType())) {
secVO.setCodeValueApplyStatus(2);
- }else{
+ } else {
secVO.setCodeValueApplyStatus(3);
}
// 鏃ユ湡鐮佹璁剧疆榛樿鍊�
if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) {
try {
- secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr()));
- }catch (Exception e){
- throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage());
+ secVO.setCodeDateValue(Func.format(new Date(), secVO.getCodeDateFormatStr()));
+ } catch (Exception e) {
+ throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細" + e.getMessage());
}
}
return secVO;
}).collect(Collectors.toList());
codeRuleVO.setSecVOList(basicSecVOS);
- codeRuleVO.setIsShowHideStatus(hasAllReadOnlyType ? "readOnly":(hasAllInputType ? "input":"readAndInput"));
+ codeRuleVO.setIsShowHideStatus(hasAllReadOnlyType ? "readOnly" : (hasAllInputType ? "input" : "readAndInput"));
return codeRuleVO;
}
- /**
- * 浣跨敤鍒嗙被鐨勫叏閮ㄤ俊鎭幏鍙栫紪鐮佽鍒�
- *
- * @param fullInfoBO 鍒嗙被鐨勫叏閮ㄤ俊鎭�
- * @return 瑙勫垯鐨勫唴瀹�
- */
- @Override
- public CodeRuleVO getCodeRuleByClassifyFullInfo(CodeClassifyFullInfoBO fullInfoBO) {
- //寰�涓婃壘
- String codeRuleOid = "";
- if (StringUtils.isNotBlank(fullInfoBO.getCurrentClassifyVO().getCodeRuleOid())) {
- codeRuleOid = fullInfoBO.getCurrentClassifyVO().getCodeRuleOid();
- } else {
- if (CollectionUtils.isEmpty(fullInfoBO.getParentClassifyVOs())) {
- //璇存槑宸茬粡鏄渶楂樺眰绾�,
- throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
- }
- List<CodeClassifyVO> parentClassifyVOList = fullInfoBO.getParentClassifyVOs().stream().sorted((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel())).collect(Collectors.toList());
- //浠庢渶楂樼殑level寮�濮嬭幏鍙�
- for (int i = parentClassifyVOList.size()-1; i >= 0; i--) {
- CodeClassifyVO record = parentClassifyVOList.get(i);
- if (StringUtils.isNotBlank(record.getCodeRuleOid())) {
- codeRuleOid = record.getCodeRuleOid();
- break;
- }
- }
- if (StringUtils.isBlank(codeRuleOid)) {
- throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
- }
- }
- return ruleService.getObjectHasSecByOid(codeRuleOid);
- }
+ /**
+ * 浣跨敤鍒嗙被鐨勫叏閮ㄤ俊鎭幏鍙栫紪鐮佽鍒�
+ *
+ * @param fullInfoBO 鍒嗙被鐨勫叏閮ㄤ俊鎭�
+ * @return 瑙勫垯鐨勫唴瀹�
+ */
+ @Override
+ public CodeRuleVO getCodeRuleByClassifyFullInfo(CodeClassifyFullInfoBO fullInfoBO) {
+ //寰�涓婃壘
+ String codeRuleOid = "";
+ if (StringUtils.isNotBlank(fullInfoBO.getCurrentClassifyVO().getCodeRuleOid())) {
+ codeRuleOid = fullInfoBO.getCurrentClassifyVO().getCodeRuleOid();
+ } else {
+ if (CollectionUtils.isEmpty(fullInfoBO.getParentClassifyVOs())) {
+ //璇存槑宸茬粡鏄渶楂樺眰绾�,
+ throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
+ }
+ List<CodeClassifyVO> parentClassifyVOList = fullInfoBO.getParentClassifyVOs().stream().sorted((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel())).collect(Collectors.toList());
+ //浠庢渶楂樼殑level寮�濮嬭幏鍙�
+ for (int i = parentClassifyVOList.size() - 1; i >= 0; i--) {
+ CodeClassifyVO record = parentClassifyVOList.get(i);
+ if (StringUtils.isNotBlank(record.getCodeRuleOid())) {
+ codeRuleOid = record.getCodeRuleOid();
+ break;
+ }
+ }
+ if (StringUtils.isBlank(codeRuleOid)) {
+ throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�");
+ }
+ }
+ return ruleService.getObjectHasSecByOid(codeRuleOid);
+ }
- /**
- * 浣跨敤鏁版嵁涓婚敭鑾峰彇鏁版嵁鐨勫叏閮ㄤ俊鎭�
- *
- * @param oid 涓婚敭
- * @param templateOid 妯℃澘鐨勪富閿�
- * @return 鏁版嵁鐨勫唴瀹�
- */
- @Override
- public R<List<Map<String, String>>> getDataByOid(String oid, String templateOid) {
- CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
- //涓轰簡闃叉妯℃澘涓婄殑涓氬姟绫诲瀷涓庡垎绫讳笂涓嶅搴�
- CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(templateVO.getCodeclassifyoid());
- String btmId = topClassifyVO.getBtmTypeId();
- //鏌ヨ鏁版嵁
- Map<String, String> conditionMap = new HashMap<>();
- conditionMap.put("t.oid", oid);
- CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmId, templateVO, conditionMap, new PageHelper(-1));
- //鎴戜滑浣跨敤鍜屼笟鍔$被鍨嬬殑鏉ユ煡璇�
- List<Map> cbosB = commonsMapper.selectBySql(sqlBO.getSqlUnPage());
- List<Map<String, String>> cbos = new ArrayList<>();
- cbosB.stream().forEach(map -> {
- Map<String, String> data = new HashMap<>();
- for (Object o : map.keySet()) {
- data.put(((String) o).toLowerCase(Locale.ROOT), map.get(o)==null?"":String.valueOf(map.get(o)));
- }
- cbos.add(data);
- });
+ /**
+ * 浣跨敤鏁版嵁涓婚敭鑾峰彇鏁版嵁鐨勫叏閮ㄤ俊鎭�
+ *
+ * @param oid 涓婚敭
+ * @param templateOid 妯℃澘鐨勪富閿�
+ * @return 鏁版嵁鐨勫唴瀹�
+ */
+ @Override
+ public R<List<Map<String, String>>> getDataByOid(String oid, String templateOid) {
+ CodeClassifyTemplateVO templateVO = templateService.getObjectHasAttrByOid(templateOid);
+ //涓轰簡闃叉妯℃澘涓婄殑涓氬姟绫诲瀷涓庡垎绫讳笂涓嶅搴�
+ CodeClassifyVO topClassifyVO = classifyService.getTopClassifyVO(templateVO.getCodeclassifyoid());
+ String btmId = topClassifyVO.getBtmTypeId();
+ //鏌ヨ鏁版嵁
+ Map<String, String> conditionMap = new HashMap<>();
+ conditionMap.put("t.oid", oid);
+ CodeTemplateAttrSqlBO sqlBO = getSqlByTemplateVO(btmId, templateVO, conditionMap, new PageHelper(-1));
+ //鎴戜滑浣跨敤鍜屼笟鍔$被鍨嬬殑鏉ユ煡璇�
+ List<Map> cbosB = commonsMapper.selectBySql(sqlBO.getSqlUnPage());
+ List<Map<String, String>> cbos = new ArrayList<>();
+ cbosB.stream().forEach(map -> {
+ Map<String, String> data = new HashMap<>();
+ for (Object o : map.keySet()) {
+ data.put(((String) o).toLowerCase(Locale.ROOT), map.get(o) == null ? "" : String.valueOf(map.get(o)));
+ }
+ cbos.add(data);
+ });
// List<ClientBusinessObject> cbos = boService.queryByOnlySql(sqlBO.getSqlUnPage());
- if (CollectionUtils.isEmpty(cbos)) {
- throw new VciBaseException("鏁版嵁鍦ㄧ郴缁熶腑涓嶅瓨鍦紝鏄惁鍥犱负淇敼杩囦笟鍔$被鍨嬶紵");
- }
+ if (CollectionUtils.isEmpty(cbos)) {
+ throw new VciBaseException("鏁版嵁鍦ㄧ郴缁熶腑涓嶅瓨鍦紝鏄惁鍥犱负淇敼杩囦笟鍔$被鍨嬶紵");
+ }
// Map<String, String> data = new HashMap<>();
- Map<String, String> cbo = cbos.get(0);
+ Map<String, String> cbo = cbos.get(0);
// WebUtil.copyValueToMapFromCbos(cbo, data);
- List<Map<String, String>> dataList = new ArrayList<>();
- dataList.add(cbo);
- wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), true);
- R<List<Map<String, String>>> result = R.data(Collections.singletonList(cbo));
+ List<Map<String, String>> dataList = new ArrayList<>();
+ dataList.add(cbo);
+ wrapperData(dataList, templateVO, sqlBO.getSelectFieldList(), true);
+ R<List<Map<String, String>>> result = R.data(Collections.singletonList(cbo));
//澶勭悊杩斿洖鏁版嵁涓庢ā鏉挎暟鎹厤缃殑瀛楁涓嶄竴鏍烽棶棰�
- templateVO.getAttributes().stream().forEach(e->{
+ templateVO.getAttributes().stream().forEach(e -> {
for (Map<String, String> datum : result.getData()) {
- if(datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())){
- datum.put(e.getId(),datum.get(e.getId().toLowerCase()));
+ if (datum.containsKey(e.getId().toLowerCase()) && !datum.containsKey(e.getId())) {
+ datum.put(e.getId(), datum.get(e.getId().toLowerCase()));
datum.remove(e.getId().toLowerCase());
}
}
});
- //鎴戜滑瑕佺湅鏄惁涓嶆槸鍗囩増鐨勶紝鍗囩増鐨勮瘽锛岄渶瑕佸姣斾笉鐩哥瓑鐨勫睘鎬�
+ //鎴戜滑瑕佺湅鏄惁涓嶆槸鍗囩増鐨勶紝鍗囩増鐨勮瘽锛岄渶瑕佸姣斾笉鐩哥瓑鐨勫睘鎬�
/* String copy = cbo.get("copyfromversion");
// if (StringUtils.isBlank(copy)) {
// copy = cbo.getAttributeValue("copyfromversion");
@@ -3473,167 +3482,168 @@
result.setData(difFieldList);
}
}*/
- return result;
- }
+ return result;
+ }
- /**
- * 浣跨敤妯℃澘鐨勪富閿幏鍙栬〃鍗曠殑淇℃伅
- *
- * @param templateOid 妯℃澘鐨勪富閿�
- * @param executionId 娴佺▼鎵цid
- * @param processUse 娴佺▼妯℃澘鐨勭敤閫�
- * @return ui鐩稿叧鐨勫唴瀹�
- */
- @Override
- public List<String> getFieldByProcessTemplate(String templateOid, String executionId, String processUse) {
- VciBaseUtil.alertNotNull(templateOid, "妯℃澘涓婚敭", executionId, "娴佺▼鐨勬墽琛孖d", processUse, "娴佺▼妯℃澘鐢ㄩ��");
- while (StringUtils.countMatches(executionId, ".") > 1) {
- executionId = executionId.substring(0, executionId.lastIndexOf("."));
- }
- String sql = "select wm_concat(distinct (t.codetempattrOidArr)) codetempattroidarr\n" +
- "from pl_code_clsflowtemp t\n" +
- "join PLFLOWINSTANCE plfi on t.ID = plfi.PLTEMPLATEPUID\n" +
- "where plfi.PLEXECUTIONID = '" + executionId + "' and t.CLASSIFYTEMPLATEOID = '" + templateOid + "' and t.CODEPROCESSUSE = '" + processUse + "'";
+ /**
+ * 浣跨敤妯℃澘鐨勪富閿幏鍙栬〃鍗曠殑淇℃伅
+ *
+ * @param templateOid 妯℃澘鐨勪富閿�
+ * @param executionId 娴佺▼鎵цid
+ * @param processUse 娴佺▼妯℃澘鐨勭敤閫�
+ * @return ui鐩稿叧鐨勫唴瀹�
+ */
+ @Override
+ public List<String> getFieldByProcessTemplate(String templateOid, String executionId, String processUse) {
+ VciBaseUtil.alertNotNull(templateOid, "妯℃澘涓婚敭", executionId, "娴佺▼鐨勬墽琛孖d", processUse, "娴佺▼妯℃澘鐢ㄩ��");
+ while (StringUtils.countMatches(executionId, ".") > 1) {
+ executionId = executionId.substring(0, executionId.lastIndexOf("."));
+ }
+ String sql = "select wm_concat(distinct (t.codetempattrOidArr)) codetempattroidarr\n" +
+ "from pl_code_clsflowtemp t\n" +
+ "join PLFLOWINSTANCE plfi on t.ID = plfi.PLTEMPLATEPUID\n" +
+ "where plfi.PLEXECUTIONID = '" + executionId + "' and t.CLASSIFYTEMPLATEOID = '" + templateOid + "' and t.CODEPROCESSUSE = '" + processUse + "'";
// List<ClientBusinessObject> tempAttrOidArr = boService.queryByOnlySql(sql);
- List<Map> tempAttrOidArr = commonsMapper.selectBySql(sql);
- if (CollectionUtils.isEmpty(tempAttrOidArr) || StringUtils.isBlank((CharSequence) tempAttrOidArr.get(0).get("codetempattroidarr"))) {
- return new ArrayList<>();
- }
- return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("CODETEMPATTROIDARR").toString());
- }
+ List<Map> tempAttrOidArr = commonsMapper.selectBySql(sql);
+ if (CollectionUtils.isEmpty(tempAttrOidArr) || StringUtils.isBlank((CharSequence) tempAttrOidArr.get(0).get("codetempattroidarr"))) {
+ return new ArrayList<>();
+ }
+ return VciBaseUtil.str2List(tempAttrOidArr.get(0).get("CODETEMPATTROIDARR").toString());
+ }
- /**
- * 浣跨敤鍒嗙被鐨勪富閿幏鍙栦笟鍔℃暟鎹�
- *
- * @param btmType 涓氬姟绫诲瀷
- * @param queryObject 鏌ヨ瀵硅薄
- * @return 琛ㄦ牸鐨勬樉绀哄璞″��
- */
- @Override
- public DataGrid<Map<String, String>> getTableDataByExecutionId(String btmType, BaseQueryObject queryObject) {
- VciBaseUtil.alertNotNull(btmType, "涓氬姟绫诲瀷");
- if (queryObject == null) {
- queryObject = new BaseQueryObject();
- }
- if (queryObject.getConditionMap() == null) {
- queryObject.setConditionMap(new HashMap<>());
- }
- Map<String, String> conditionMap = queryObject.getConditionMap();
- PageHelper pageHelper = queryObject.getPageHelper();
- if (!conditionMap.containsKey("oid")) {
- throw new VciBaseException("涓氬姟鏁版嵁涓婚敭涓嶈兘涓虹┖");
- }
- List<String> oidList = VciBaseUtil.str2List(conditionMap.get("oid"));
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栦笟鍔℃暟鎹�
+ *
+ * @param btmType 涓氬姟绫诲瀷
+ * @param queryObject 鏌ヨ瀵硅薄
+ * @return 琛ㄦ牸鐨勬樉绀哄璞″��
+ */
+ @Override
+ public DataGrid<Map<String, String>> getTableDataByExecutionId(String btmType, BaseQueryObject queryObject) {
+ VciBaseUtil.alertNotNull(btmType, "涓氬姟绫诲瀷");
+ if (queryObject == null) {
+ queryObject = new BaseQueryObject();
+ }
+ if (queryObject.getConditionMap() == null) {
+ queryObject.setConditionMap(new HashMap<>());
+ }
+ Map<String, String> conditionMap = queryObject.getConditionMap();
+ PageHelper pageHelper = queryObject.getPageHelper();
+ if (!conditionMap.containsKey("oid")) {
+ throw new VciBaseException("涓氬姟鏁版嵁涓婚敭涓嶈兘涓虹┖");
+ }
+ List<String> oidList = VciBaseUtil.str2List(conditionMap.get("oid"));
- List<BaseModel> cbos = selectByTypeAndOid(btmType, conditionMap.get("oid"));
- if (CollectionUtils.isEmpty(cbos)) {
- throw new VciBaseException("鏈壘鍒颁笟鍔℃暟鎹�");
- }
- BaseModel cbo = cbos.get(0);
- String templateOid = cbo.getData().get("CODETEMPLATEOID");
+ List<BaseModel> cbos = selectByTypeAndOid(btmType, conditionMap.get("oid"));
+ if (CollectionUtils.isEmpty(cbos)) {
+ throw new VciBaseException("鏈壘鍒颁笟鍔℃暟鎹�");
+ }
+ BaseModel cbo = cbos.get(0);
+ String templateOid = cbo.getData().get("CODETEMPLATEOID");
- QueryWrapper<CodeClassifyTemplate> codeClassifyTemplateWrapper = new QueryWrapper<>();
- codeClassifyTemplateWrapper.eq("oid", templateOid);
- List<CodeClassifyTemplate> templateDOList = templateService.list(codeClassifyTemplateWrapper);
+ QueryWrapper<CodeClassifyTemplate> codeClassifyTemplateWrapper = new QueryWrapper<>();
+ codeClassifyTemplateWrapper.eq("oid", templateOid);
+ List<CodeClassifyTemplate> templateDOList = templateService.list(codeClassifyTemplateWrapper);
- QueryWrapper<CodeClassifyTemplateAttr> codeClassifyTemplateAttrWrapper = new QueryWrapper<>();
- codeClassifyTemplateAttrWrapper.eq("CLASSIFYTEMPLATEOID", templateOid);
+ QueryWrapper<CodeClassifyTemplateAttr> codeClassifyTemplateAttrWrapper = new QueryWrapper<>();
+ codeClassifyTemplateAttrWrapper.eq("CLASSIFYTEMPLATEOID", templateOid);
- List<CodeClassifyTemplateAttr> attrDOList = codeClassifyTemplateAttrService.list(codeClassifyTemplateAttrWrapper);
+ List<CodeClassifyTemplateAttr> attrDOList = codeClassifyTemplateAttrService.list(codeClassifyTemplateAttrWrapper);
- if (CollectionUtils.isEmpty(templateDOList)) {
- logger.error("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘锛屾ā鏉夸富閿細" + templateOid);
- throw new VciBaseException("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘");
- }
- CodeClassifyTemplateVO templateVO = templateService.codeClassifyTemplateDO2VO(templateDOList.get(0));
- templateVO.setAttributes(codeClassifyTemplateAttrService.codeClassifyTemplateAttrDO2VOs(attrDOList));
- try {
- if (oidList.size() > 1) {
- DataGrid<Map<String, String>> allDataGrid = new DataGrid<>();
- List<Map<String, String>> allData = new ArrayList<>();
- oidList.forEach(oid -> {
- Map<String, String> condition = new HashMap<>();
- condition.put("oid", oid);
- DataGrid<Map<String, String>> dataGrid = queryGrid(btmType, templateVO, condition, pageHelper);
- allData.addAll(dataGrid.getData());
- });
- allDataGrid.setData(allData);
- return allDataGrid;
- } else {
- return queryGrid(btmType, templateVO, conditionMap, pageHelper);
- }
- } catch (Exception e) {
- System.out.println(e.getMessage());
- return null;
- }
- }
+ if (CollectionUtils.isEmpty(templateDOList)) {
+ logger.error("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘锛屾ā鏉夸富閿細" + templateOid);
+ throw new VciBaseException("鎵句笉鍒颁笟鍔℃暟鎹叧鑱旂殑妯℃澘");
+ }
+ CodeClassifyTemplateVO templateVO = templateService.codeClassifyTemplateDO2VO(templateDOList.get(0));
+ templateVO.setAttributes(codeClassifyTemplateAttrService.codeClassifyTemplateAttrDO2VOs(attrDOList));
+ try {
+ if (oidList.size() > 1) {
+ DataGrid<Map<String, String>> allDataGrid = new DataGrid<>();
+ List<Map<String, String>> allData = new ArrayList<>();
+ oidList.forEach(oid -> {
+ Map<String, String> condition = new HashMap<>();
+ condition.put("oid", oid);
+ DataGrid<Map<String, String>> dataGrid = queryGrid(btmType, templateVO, condition, pageHelper);
+ allData.addAll(dataGrid.getData());
+ });
+ allDataGrid.setData(allData);
+ return allDataGrid;
+ } else {
+ return queryGrid(btmType, templateVO, conditionMap, pageHelper);
+ }
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ return null;
+ }
+ }
- /**
- * 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟
- *
- * @param codeClassifyOid 鍒嗙被涓婚敭
- * @param phase 闃舵鐨勫悕绉�
- * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�)
- */
- @Override
- public MdmUIInfoVO getTableDefineByClassifyOid_v2(String codeClassifyOid, String phase) {
- MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
- CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid);
- uiInfoVO.setTemplateVO(templateVO);
- UITableDefineVO uiTableDefineVO = wrapperTableDefineByTemplate(templateVO, true);
- List<String> phaseAttrIdList = listPhaseAttrByClassifyOid(codeClassifyOid, phase);
- uiTableDefineVO.getCols().stream().forEach(list -> {
- List<UITableFieldVO> visiableTableField = new ArrayList<>();
- if (StringUtils.isNotBlank(phase)) {
- visiableTableField = list.stream().filter(col ->
- phaseAttrIdList.stream().anyMatch(s -> StringUtils.equalsIgnoreCase(col.getField(), s) ||
- (StringUtils.equalsIgnoreCase(col.getFieldType(), "combox") && StringUtils.equalsIgnoreCase(col.getSortField(), s))
- || (StringUtils.equalsIgnoreCase(col.getFieldType(), "refer") && StringUtils.equalsIgnoreCase(col.getQueryField(), s))
- )).collect(Collectors.toList());
- } else {
- visiableTableField = list.stream().filter(col ->
- templateVO.getAttributes().stream().anyMatch(s ->
- (!s.getReadOnlyFlag().equalsIgnoreCase("true") && StringUtils.equalsIgnoreCase(col.getField(), s.getId())) ||
- (StringUtils.equalsIgnoreCase(col.getFieldType(), "combox") && StringUtils.equalsIgnoreCase(col.getSortField(), s.getId()))
- || (StringUtils.equalsIgnoreCase(col.getFieldType(), "refer") && StringUtils.equalsIgnoreCase(col.getQueryField(), s.getId()))
- )).collect(Collectors.toList());
- }
+ /**
+ * 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟
+ *
+ * @param codeClassifyOid 鍒嗙被涓婚敭
+ * @param phase 闃舵鐨勫悕绉�
+ * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�)
+ */
+ @Override
+ public MdmUIInfoVO getTableDefineByClassifyOid_v2(String codeClassifyOid, String phase) {
+ MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
+ CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid);
+ uiInfoVO.setTemplateVO(templateVO);
+ UITableDefineVO uiTableDefineVO = wrapperTableDefineByTemplate(templateVO, true);
+ List<String> phaseAttrIdList = listPhaseAttrByClassifyOid(codeClassifyOid, phase);
+ uiTableDefineVO.getCols().stream().forEach(list -> {
+ List<UITableFieldVO> visiableTableField = new ArrayList<>();
+ if (StringUtils.isNotBlank(phase)) {
+ visiableTableField = list.stream().filter(col ->
+ phaseAttrIdList.stream().anyMatch(s -> StringUtils.equalsIgnoreCase(col.getField(), s) ||
+ (StringUtils.equalsIgnoreCase(col.getFieldType(), "combox") && StringUtils.equalsIgnoreCase(col.getSortField(), s))
+ || (StringUtils.equalsIgnoreCase(col.getFieldType(), "refer") && StringUtils.equalsIgnoreCase(col.getQueryField(), s))
+ )).collect(Collectors.toList());
+ } else {
+ visiableTableField = list.stream().filter(col ->
+ templateVO.getAttributes().stream().anyMatch(s ->
+ (!s.getReadOnlyFlag().equalsIgnoreCase("true") && StringUtils.equalsIgnoreCase(col.getField(), s.getId())) ||
+ (StringUtils.equalsIgnoreCase(col.getFieldType(), "combox") && StringUtils.equalsIgnoreCase(col.getSortField(), s.getId()))
+ || (StringUtils.equalsIgnoreCase(col.getFieldType(), "refer") && StringUtils.equalsIgnoreCase(col.getQueryField(), s.getId()))
+ )).collect(Collectors.toList());
+ }
- visiableTableField.stream().forEach(vo -> {
- uiTableDefineVO.setHasEditor(true);
- if ("refer".equalsIgnoreCase(vo.getFieldType())) {
- setReferConfig2EditConfig(vo);
- } else if ("combox".equalsIgnoreCase(vo.getFieldType())) {
- setComboxConfig2EditConfig(vo);
- } else if (StringUtils.isNotBlank(vo.getDateFormate())) {
- vo.setEdit("date");
- } else {
- vo.setEdit(vo.getFieldType());
- }
- });
- });
- uiInfoVO.setTableDefineVO(uiTableDefineVO);
- wrapperResemble(templateVO, uiInfoVO);
- return uiInfoVO;
- }
+ visiableTableField.stream().forEach(vo -> {
+ uiTableDefineVO.setHasEditor(true);
+ if ("refer".equalsIgnoreCase(vo.getFieldType())) {
+ setReferConfig2EditConfig(vo);
+ } else if ("combox".equalsIgnoreCase(vo.getFieldType())) {
+ setComboxConfig2EditConfig(vo);
+ } else if (StringUtils.isNotBlank(vo.getDateFormate())) {
+ vo.setEdit("date");
+ } else {
+ vo.setEdit(vo.getFieldType());
+ }
+ });
+ });
+ uiInfoVO.setTableDefineVO(uiTableDefineVO);
+ wrapperResemble(templateVO, uiInfoVO);
+ return uiInfoVO;
+ }
/**
* 浣跨敤鍒嗙被鐨勪富閿幏鍙栬〃鏍肩殑瀹氫箟-ubcs鍚庝慨鏀硅幏鍙栨祦绋嬮樁娈电啛鎮夎幏鍙栨柟娉�
+ *
* @param codeClassifyOid
* @param templateId
* @param taskId
* @param modelKey
* @return
*/
- public MdmUIInfoVO getTableDefineByClassifyOid_v2(String codeClassifyOid,String templateId,String taskId,String modelKey) {
+ public MdmUIInfoVO getTableDefineByClassifyOid_v2(String codeClassifyOid, String templateId, String taskId, String modelKey) {
MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid);
uiInfoVO.setTemplateVO(templateVO);
UITableDefineVO uiTableDefineVO = wrapperTableDefineByTemplate(templateVO, true);
- R<List<ProcessStageAttrVO>> r = imdmiFlowAttrClient.ssslist(templateId,modelKey,taskId);
+ R<List<ProcessStageAttrVO>> r = imdmiFlowAttrClient.ssslist(templateId, modelKey, taskId);
List<ProcessStageAttrVO> stageAttrVOS = r.getData();
List<String> attrList = new ArrayList<>();
- stageAttrVOS.stream().forEach(attr->{
+ stageAttrVOS.stream().forEach(attr -> {
attrList.add(attr.getAttrId());
});
uiTableDefineVO.getCols().stream().forEach(list -> {
@@ -3662,24 +3672,24 @@
return uiInfoVO;
}
- /**
- * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸瀹氫箟鐨勪俊鎭�
- *
- * @param templateVO 妯℃澘鐨勬樉绀哄璞�
- * @param forEdit 鏄惁鏄紪杈戞墍闇�
- * @return 琛ㄦ牸鐨勪俊鎭�
- */
- private UITableDefineVO wrapperTableDefineByTemplate(CodeClassifyTemplateVO templateVO, boolean forEdit) {
- //灏佽淇℃伅
- UITableDefineVO tableDefineVO = new UITableDefineVO();
- tableDefineVO.setOid(templateVO.getOid());
- tableDefineVO.setBtmType(templateVO.getBtmTypeId());
- tableDefineVO.setDisplayQueryArea(true);
- //鍓嶇浼氶粯璁ゅ垎椤电殑淇℃伅
+ /**
+ * 妯℃澘灞炴�ц浆鎹负琛ㄦ牸瀹氫箟鐨勪俊鎭�
+ *
+ * @param templateVO 妯℃澘鐨勬樉绀哄璞�
+ * @param forEdit 鏄惁鏄紪杈戞墍闇�
+ * @return 琛ㄦ牸鐨勪俊鎭�
+ */
+ private UITableDefineVO wrapperTableDefineByTemplate(CodeClassifyTemplateVO templateVO, boolean forEdit) {
+ //灏佽淇℃伅
+ UITableDefineVO tableDefineVO = new UITableDefineVO();
+ tableDefineVO.setOid(templateVO.getOid());
+ tableDefineVO.setBtmType(templateVO.getBtmTypeId());
+ tableDefineVO.setDisplayQueryArea(true);
+ //鍓嶇浼氶粯璁ゅ垎椤电殑淇℃伅
- //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌
- List<UITableFieldVO> fieldVOList = new ArrayList<>();
- Map<String, String> comboxOrReferFieldMap = new HashMap<>();
+ //澶勭悊鎵�鏈夌殑鍒楋紝杩欎釜妯℃澘娌℃湁鍚堝苟鐨勮〃澶寸殑鎯呭喌
+ List<UITableFieldVO> fieldVOList = new ArrayList<>();
+ Map<String, String> comboxOrReferFieldMap = new HashMap<>();
if (Func.isNotEmpty(templateVO.getAttributes())) {
templateVO.getAttributes().forEach(attrVO -> {
@@ -3696,10 +3706,10 @@
fieldVOList.add(tableFieldVO);
});
}
- List<List<UITableFieldVO>> cols = new ArrayList<>();
- cols.add(fieldVOList);
- tableDefineVO.setCols(cols);
- Map<String, UITableFieldVO> fieldVOMap = fieldVOList.stream().collect(Collectors.toMap(s -> s.getField().toLowerCase(Locale.ROOT), t -> t));
+ List<List<UITableFieldVO>> cols = new ArrayList<>();
+ cols.add(fieldVOList);
+ tableDefineVO.setCols(cols);
+ Map<String, UITableFieldVO> fieldVOMap = fieldVOList.stream().collect(Collectors.toMap(s -> s.getField().toLowerCase(Locale.ROOT), t -> t));
List<CodeClassifyTemplateAttrVO> seniorQueryAttrVOs = null;
if (Func.isNotEmpty(templateVO.getAttributes())) {
//鏌ヨ灞炴��
@@ -3718,223 +3728,222 @@
//楂樼骇灞炴��
seniorQueryAttrVOs = templateVO.getAttributes().stream().filter(s -> BooleanEnum.TRUE.getValue().equalsIgnoreCase(s.getSeniorQueryAttrFlag())).collect(Collectors.toList());
}
- if (!CollectionUtils.isEmpty(seniorQueryAttrVOs)) {
- List<UITableFieldVO> queryFieldVOs = new ArrayList<>();
- seniorQueryAttrVOs.stream().forEach(attrVO -> {
- String attrId = attrVO.getId().toLowerCase(Locale.ROOT);
- attrId = comboxOrReferFieldMap.getOrDefault(attrId, attrId).toLowerCase(Locale.ROOT);
- if (fieldVOMap.containsKey(attrId)) {
- queryFieldVOs.add(fieldVOMap.get(attrId));
- }
- });
- tableDefineVO.setSeniorQueryColumns(queryFieldVOs);
- }
- return tableDefineVO;
- }
+ if (!CollectionUtils.isEmpty(seniorQueryAttrVOs)) {
+ List<UITableFieldVO> queryFieldVOs = new ArrayList<>();
+ seniorQueryAttrVOs.stream().forEach(attrVO -> {
+ String attrId = attrVO.getId().toLowerCase(Locale.ROOT);
+ attrId = comboxOrReferFieldMap.getOrDefault(attrId, attrId).toLowerCase(Locale.ROOT);
+ if (fieldVOMap.containsKey(attrId)) {
+ queryFieldVOs.add(fieldVOMap.get(attrId));
+ }
+ });
+ tableDefineVO.setSeniorQueryColumns(queryFieldVOs);
+ }
+ return tableDefineVO;
+ }
- /**
- * 鍔犺浇鎴愬弬鐓х殑淇敼閰嶇疆
- *
- * @param vo 琛ㄦ牸瀛楁鏄剧ず瀵硅薄
- */
- private void setReferConfig2EditConfig(UITableFieldVO vo) {
- if (!CollectionUtils.isEmpty(vo.getReferConfig().getWhere())) {
- vo.getReferConfig().getWhere().keySet().forEach(key -> {
- vo.getReferConfig().getWhere().put(key, "'" + vo.getReferConfig().getWhere().get(key) + "'");
- });
- }
- if (StringUtils.isNotBlank(vo.getReferConfig().getParentValue())) {
- String parentValue = vo.getReferConfig().getParentValue();
- parentValue = "\\" + parentValue.replaceAll("'", "{vci-quote}").replaceAll("=", "{vci-equals}");
- vo.getReferConfig().setParentValue(parentValue);
- }
- String referConfig = vo.getReferConfig().toString()
- .replaceAll("=", ":")
- .replaceAll("UITableCustomDefineVO", "")
- .replaceAll("UIFieldSortVO", "")
- .replaceAll("UITablePageVO", "")
- .replaceAll("UITableFieldVO", "")
- .replaceAll("UIFormReferVO", "")
- .replaceAll("\\{vci-equals}", "=")
- .replaceAll("\\{vci-quote}", "\\\\'")
- .replaceAll("'null'", "null");
- referConfig = referConfig + ",fieldMap:{" + vo.getQueryField() + ":'" + vo.getReferConfig().getValueField() + "'}";
- vo.setEditConfig("{referConfig:" + referConfig + "}");
- vo.setEdit(vo.getFieldType());
- }
+ /**
+ * 鍔犺浇鎴愬弬鐓х殑淇敼閰嶇疆
+ *
+ * @param vo 琛ㄦ牸瀛楁鏄剧ず瀵硅薄
+ */
+ private void setReferConfig2EditConfig(UITableFieldVO vo) {
+ if (!CollectionUtils.isEmpty(vo.getReferConfig().getWhere())) {
+ vo.getReferConfig().getWhere().keySet().forEach(key -> {
+ vo.getReferConfig().getWhere().put(key, "'" + vo.getReferConfig().getWhere().get(key) + "'");
+ });
+ }
+ if (StringUtils.isNotBlank(vo.getReferConfig().getParentValue())) {
+ String parentValue = vo.getReferConfig().getParentValue();
+ parentValue = "\\" + parentValue.replaceAll("'", "{vci-quote}").replaceAll("=", "{vci-equals}");
+ vo.getReferConfig().setParentValue(parentValue);
+ }
+ String referConfig = vo.getReferConfig().toString()
+ .replaceAll("=", ":")
+ .replaceAll("UITableCustomDefineVO", "")
+ .replaceAll("UIFieldSortVO", "")
+ .replaceAll("UITablePageVO", "")
+ .replaceAll("UITableFieldVO", "")
+ .replaceAll("UIFormReferVO", "")
+ .replaceAll("\\{vci-equals}", "=")
+ .replaceAll("\\{vci-quote}", "\\\\'")
+ .replaceAll("'null'", "null");
+ referConfig = referConfig + ",fieldMap:{" + vo.getQueryField() + ":'" + vo.getReferConfig().getValueField() + "'}";
+ vo.setEditConfig("{referConfig:" + referConfig + "}");
+ vo.setEdit(vo.getFieldType());
+ }
- /**
- * 鍔犺浇鎴愪笅鎷夋鐨勪慨鏀归厤缃�
- *
- * @param vo 琛ㄦ牸瀛楁鏄剧ず瀵硅薄
- */
- private void setComboxConfig2EditConfig(UITableFieldVO vo) {
- vo.setEditConfig("{editable:true,comboxKey:'" + vo.getComboxKey() + "'");
- if (!CollectionUtils.isEmpty(vo.getData())) {
- vo.setEditConfig(vo.getEditConfig() + ", comboxConfig:");
- for (int i = 0; i < vo.getData().size(); i++) {
- KeyValue data = vo.getData().get(i);
- if (i == vo.getData().size() - 1) {
- vo.setEditConfig(vo.getEditConfig() + "{attributes:" + data.getAttributes() + ",key:'" + data.getKey() + "',value:'" + data.getValue() + "'}]}");
- } else if (i == 0) {
- vo.setEditConfig(vo.getEditConfig() + "{data:[{attributes:" + data.getAttributes() + ",key:'" + data.getKey() + "',value:'" + data.getValue() + "'},");
- } else {
- vo.setEditConfig(vo.getEditConfig() + "{attributes:" + data.getAttributes() + ",key:'" + data.getKey() + "',value:'" + data.getValue() + "'},");
- }
- }
- vo.setEditConfig(vo.getEditConfig() + ",valueField:'" + vo.getQueryField() + "'");
- }
- vo.setEditConfig(vo.getEditConfig() + "}");
- vo.setEdit(vo.getFieldType());
- }
+ /**
+ * 鍔犺浇鎴愪笅鎷夋鐨勪慨鏀归厤缃�
+ *
+ * @param vo 琛ㄦ牸瀛楁鏄剧ず瀵硅薄
+ */
+ private void setComboxConfig2EditConfig(UITableFieldVO vo) {
+ vo.setEditConfig("{editable:true,comboxKey:'" + vo.getComboxKey() + "'");
+ if (!CollectionUtils.isEmpty(vo.getData())) {
+ vo.setEditConfig(vo.getEditConfig() + ", comboxConfig:");
+ for (int i = 0; i < vo.getData().size(); i++) {
+ KeyValue data = vo.getData().get(i);
+ if (i == vo.getData().size() - 1) {
+ vo.setEditConfig(vo.getEditConfig() + "{attributes:" + data.getAttributes() + ",key:'" + data.getKey() + "',value:'" + data.getValue() + "'}]}");
+ } else if (i == 0) {
+ vo.setEditConfig(vo.getEditConfig() + "{data:[{attributes:" + data.getAttributes() + ",key:'" + data.getKey() + "',value:'" + data.getValue() + "'},");
+ } else {
+ vo.setEditConfig(vo.getEditConfig() + "{attributes:" + data.getAttributes() + ",key:'" + data.getKey() + "',value:'" + data.getValue() + "'},");
+ }
+ }
+ vo.setEditConfig(vo.getEditConfig() + ",valueField:'" + vo.getQueryField() + "'");
+ }
+ vo.setEditConfig(vo.getEditConfig() + "}");
+ vo.setEdit(vo.getFieldType());
+ }
- /**
- * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄥ崟鐨勭浉鍏冲畾涔�
- *
- * @param idPath 缂栧彿鐨勮矾寰勶紝蹇呴』浠庨《灞傝妭鐐瑰紑濮嬶紝xx/yyy/zz
- * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�)
- */
- @Override
- public MdmUIInfoVO getFormDefineByClassifyIdPath(String idPath) {
- CodeClassifyVO classifyVO = classifyService.getObjectByIdPath(idPath);
- if (classifyVO != null) {
- return getFormDefineByClassifyOid(classifyVO.getOid());
- }
- return null;
- }
+ /**
+ * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄥ崟鐨勭浉鍏冲畾涔�
+ *
+ * @param idPath 缂栧彿鐨勮矾寰勶紝蹇呴』浠庨《灞傝妭鐐瑰紑濮嬶紝xx/yyy/zz
+ * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鍗�)
+ */
+ @Override
+ public MdmUIInfoVO getFormDefineByClassifyIdPath(String idPath) {
+ CodeClassifyVO classifyVO = classifyService.getObjectByIdPath(idPath);
+ if (classifyVO != null) {
+ return getFormDefineByClassifyOid(classifyVO.getOid());
+ }
+ return null;
+ }
- /**
- * 浣跨敤涓婚搴撳垎绫荤殑涓婚敭鑾峰彇琛ㄥ崟鐨勪俊鎭�
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @return ui鐩稿叧鐨勫唴瀹�
- */
- @Override
- public MdmUIInfoVO getFormDefineByClassifyOid(String codeClassifyOid) {
- MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
- CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid);
- uiInfoVO.setTemplateVO(templateVO);
- uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid));
- wrapperResemble(templateVO, uiInfoVO);
- return uiInfoVO;
- }
+ /**
+ * 浣跨敤涓婚搴撳垎绫荤殑涓婚敭鑾峰彇琛ㄥ崟鐨勪俊鎭�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return ui鐩稿叧鐨勫唴瀹�
+ */
+ @Override
+ public MdmUIInfoVO getFormDefineByClassifyOid(String codeClassifyOid) {
+ MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
+ CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid);
+ uiInfoVO.setTemplateVO(templateVO);
+ uiInfoVO.setFormDefineVO(wrapperFormDefineByTemplate(templateVO, codeClassifyOid));
+ wrapperResemble(templateVO, uiInfoVO);
+ return uiInfoVO;
+ }
- /**
- * 浣跨敤妯℃澘涓婚敭鑾峰彇ui鐩稿叧鐨勫唴瀹�
- *
- * @param templateOid 妯℃澘鐨勪富閿�
- * @return ui鐩稿叧鐨勫唴瀹�
- */
- @Override
- public MdmUIInfoVO getTableDefineByTemplateOid(String templateOid) {
- return getTableDefineByTemplateVO(templateService.getObjectHasAttrByOid(templateOid));
- }
+ /**
+ * 浣跨敤妯℃澘涓婚敭鑾峰彇ui鐩稿叧鐨勫唴瀹�
+ *
+ * @param templateOid 妯℃澘鐨勪富閿�
+ * @return ui鐩稿叧鐨勫唴瀹�
+ */
+ @Override
+ public MdmUIInfoVO getTableDefineByTemplateOid(String templateOid) {
+ return getTableDefineByTemplateVO(templateService.getObjectHasAttrByOid(templateOid));
+ }
- /**
- * 浣跨敤妯℃澘鏄剧ず瀵硅薄杞崲涓鸿〃鏍肩殑淇℃伅锛堝寘鍚墿灞曠殑鎸夐挳锛�
- *
- * @param templateVO 妯℃澘鐨勪俊鎭�
- * @return UI鐩稿叧鐨勫唴瀹癸紙浠呭寘鍚〃鏍间俊鎭級
- */
- private MdmUIInfoVO getTableDefineByTemplateVO(CodeClassifyTemplateVO templateVO) {
- //鍏堢湅杩欎釜鍒嗙被鏈韩鏄惁鏈夋ā鏉�
- MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
- uiInfoVO.setTemplateVO(templateVO);
- //鎴戜滑闇�瑕佸皢妯℃澘杞崲涓鸿〃鏍肩浉鍏崇殑鏄剧ず淇℃伅
- uiInfoVO.setTableDefineVO(wrapperTableDefineByTemplate(uiInfoVO.getTemplateVO(), false));
- //闇�瑕佸幓鐪嬫墿灞曠殑鎸夐挳,鍙湁鍒楄〃閲岄潰鏈韩鎵嶆坊鍔犺繘鍘伙紝宸ュ叿鏍忎笂鐨勫崟鐙幏鍙�
- List<CodeClassifyTemplateButtonVO> buttonVOS = templateButtonService.listButtonByTemplateOid(templateVO.getOid(), true);
- if (!CollectionUtils.isEmpty(buttonVOS)) {
- //鎴戜滑瑕佸垎寮�涓烘寜閽紝杩樻槸鍦ㄦ搷浣滃垪閲岄潰
- List<CodeClassifyTemplateButtonVO> tableButtonVOs = buttonVOS.stream().filter(s -> CodeUseButtonPositionTypeEnum.TABLE.getValue().equalsIgnoreCase(s.getButtonUse())).collect(Collectors.toList());
- if (!CollectionUtils.isEmpty(tableButtonVOs)) {
- UITableFieldVO optionFieldVO = new UITableFieldVO();
- optionFieldVO.setField("options");
- optionFieldVO.setTitle("鎿嶄綔");
- optionFieldVO.setFieldType("text");
- optionFieldVO.setOptionField(true);
- List<KeyValue> buttons = new ArrayList<>();
- Map<String, String> optionJsMap = new HashMap<>();
- tableButtonVOs.stream().forEach(buttonVO -> {
- KeyValue kv = new KeyValue();
- kv.setKey(buttonVO.getId());
- kv.setValue(buttonVO.getClassifyButtonOidName());
- kv.setAttributes(VciBaseUtil.objectToMap(buttonVO));
- buttons.add(kv);
- optionJsMap.put(buttonVO.getId(), buttonVO.getButtonVO().getExecuteJs());
- });
- optionFieldVO.setOptionJsMap(optionJsMap);
- uiInfoVO.getTableDefineVO().getCols().get(0).add(optionFieldVO);
- }
- }
- return uiInfoVO;
- }
+ /**
+ * 浣跨敤妯℃澘鏄剧ず瀵硅薄杞崲涓鸿〃鏍肩殑淇℃伅锛堝寘鍚墿灞曠殑鎸夐挳锛�
+ *
+ * @param templateVO 妯℃澘鐨勪俊鎭�
+ * @return UI鐩稿叧鐨勫唴瀹癸紙浠呭寘鍚〃鏍间俊鎭級
+ */
+ private MdmUIInfoVO getTableDefineByTemplateVO(CodeClassifyTemplateVO templateVO) {
+ //鍏堢湅杩欎釜鍒嗙被鏈韩鏄惁鏈夋ā鏉�
+ MdmUIInfoVO uiInfoVO = new MdmUIInfoVO();
+ uiInfoVO.setTemplateVO(templateVO);
+ //鎴戜滑闇�瑕佸皢妯℃澘杞崲涓鸿〃鏍肩浉鍏崇殑鏄剧ず淇℃伅
+ uiInfoVO.setTableDefineVO(wrapperTableDefineByTemplate(uiInfoVO.getTemplateVO(), false));
+ //闇�瑕佸幓鐪嬫墿灞曠殑鎸夐挳,鍙湁鍒楄〃閲岄潰鏈韩鎵嶆坊鍔犺繘鍘伙紝宸ュ叿鏍忎笂鐨勫崟鐙幏鍙�
+ List<CodeClassifyTemplateButtonVO> buttonVOS = templateButtonService.listButtonByTemplateOid(templateVO.getOid(), true);
+ if (!CollectionUtils.isEmpty(buttonVOS)) {
+ //鎴戜滑瑕佸垎寮�涓烘寜閽紝杩樻槸鍦ㄦ搷浣滃垪閲岄潰
+ List<CodeClassifyTemplateButtonVO> tableButtonVOs = buttonVOS.stream().filter(s -> CodeUseButtonPositionTypeEnum.TABLE.getValue().equalsIgnoreCase(s.getButtonUse())).collect(Collectors.toList());
+ if (!CollectionUtils.isEmpty(tableButtonVOs)) {
+ UITableFieldVO optionFieldVO = new UITableFieldVO();
+ optionFieldVO.setField("options");
+ optionFieldVO.setTitle("鎿嶄綔");
+ optionFieldVO.setFieldType("text");
+ optionFieldVO.setOptionField(true);
+ List<KeyValue> buttons = new ArrayList<>();
+ Map<String, String> optionJsMap = new HashMap<>();
+ tableButtonVOs.stream().forEach(buttonVO -> {
+ KeyValue kv = new KeyValue();
+ kv.setKey(buttonVO.getId());
+ kv.setValue(buttonVO.getClassifyButtonOidName());
+ kv.setAttributes(VciBaseUtil.objectToMap(buttonVO));
+ buttons.add(kv);
+ optionJsMap.put(buttonVO.getId(), buttonVO.getButtonVO().getExecuteJs());
+ });
+ optionFieldVO.setOptionJsMap(optionJsMap);
+ uiInfoVO.getTableDefineVO().getCols().get(0).add(optionFieldVO);
+ }
+ }
+ return uiInfoVO;
+ }
- /**
- * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄦ牸鐨勭浉鍏冲畾涔�
- *
- * @param codeClassifyIdPath 鍒嗙被鐨勭紪鍙疯矾寰勶紝蹇呴』鏄粠椤跺眰鑺傜偣寮�濮嬶紝xxx/yy/zz杩欐牱鐨勬牸寮�
- * @param functionId 鍔熻兘鐨勭紪鍙�
- * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鏍�)
- */
- @Override
- public MdmUIInfoVO getUIInfoByClassifyIdPath(String codeClassifyIdPath, String functionId) {
- CodeClassifyVO classifyVO = classifyService.getObjectByIdPath(codeClassifyIdPath);
- if (classifyVO != null) {
- return getUIInfoByClassifyOid(classifyVO.getOid(), functionId);
- }
- return null;
- }
+ /**
+ * 浣跨敤鍒嗙被鐨勭紪鍙疯矾寰勶紝鑾峰彇琛ㄦ牸鐨勭浉鍏冲畾涔�
+ *
+ * @param codeClassifyIdPath 鍒嗙被鐨勭紪鍙疯矾寰勶紝蹇呴』鏄粠椤跺眰鑺傜偣寮�濮嬶紝xxx/yy/zz杩欐牱鐨勬牸寮�
+ * @param functionId 鍔熻兘鐨勭紪鍙�
+ * @return UI鐩稿叧鐨勪俊鎭紙浠呭寘鍚〃鏍�)
+ */
+ @Override
+ public MdmUIInfoVO getUIInfoByClassifyIdPath(String codeClassifyIdPath, String functionId) {
+ CodeClassifyVO classifyVO = classifyService.getObjectByIdPath(codeClassifyIdPath);
+ if (classifyVO != null) {
+ return getUIInfoByClassifyOid(classifyVO.getOid(), functionId);
+ }
+ return null;
+ }
- /**
- * 浣跨敤鍒嗙被涓婚敭鑾峰彇椤甸潰鐨勫唴瀹癸紝鍖呭惈鎸夐挳
- *
- * @param codeClassifyOid 涓婚搴撳垎绫讳富閿�
- * @param functionId 鍔熻兘鐨勭紪鍙�
- * @return UI鐩稿叧鐨勫唴瀹�
- */
- @Override
- public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid, String functionId) {
- VciBaseUtil.alertNotNull(codeClassifyOid, "涓婚搴撳垎绫讳富閿�");
-
- MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid));
- uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0);
- if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) {
- List<Menu> buttonVOS = iSysClient.getMenuButtonByType(uiInfoVO.getTemplateVO().getBtmTypeId()).getData();
- // List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId);
- // if (operationVOS == null) {
- // operationVOS = new ArrayList<>();
- // }
- // //鏌ヨ鎵╁睍鎸夐挳
- // List<CodeButtonVO> buttonVOS = listButtonInToolbarByClassifyOid(codeClassifyOid);
- List<SmOperationVO> operationVOS = new ArrayList<>();
- if (!CollectionUtils.isEmpty(buttonVOS)) {
- for (int i = 0; i < buttonVOS.size(); i++) {
- Menu buttonVO = buttonVOS.get(i);
- SmOperationVO operationVO = new SmOperationVO();
- operationVO.setModuleNo(functionId);
- operationVO.setUniqueFlag(buttonVO.getCode());
- operationVO.setName(buttonVO.getName());
- operationVO.setAlias(buttonVO.getAlias());
- operationVO.setOrderNo(String.valueOf(buttonVO.getSort()));
+ /**
+ * 浣跨敤鍒嗙被涓婚敭鑾峰彇椤甸潰鐨勫唴瀹癸紝鍖呭惈鎸夐挳
+ *
+ * @param codeClassifyOid 涓婚搴撳垎绫讳富閿�
+ * @param functionId 鍔熻兘鐨勭紪鍙�
+ * @return UI鐩稿叧鐨勫唴瀹�
+ */
+ @Override
+ public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid, String functionId) {
+ VciBaseUtil.alertNotNull(codeClassifyOid, "涓婚搴撳垎绫讳富閿�");
+ MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid));
+ uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0);
+ if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) {
+ List<Menu> buttonVOS = iSysClient.getMenuButtonByType(codeClassifyOid, uiInfoVO.getTemplateVO().getBtmTypeId(), "data_auth").getData();
+ // List<SmOperationVO> operationVOS = operationService.listButtonByFunctionId(functionId);
+ // if (operationVOS == null) {
+ // operationVOS = new ArrayList<>();
+ // }
+ // //鏌ヨ鎵╁睍鎸夐挳
+ // List<CodeButtonVO> buttonVOS = listButtonInToolbarByClassifyOid(codeClassifyOid);
+ List<SmOperationVO> operationVOS = new ArrayList<>();
+ if (!CollectionUtils.isEmpty(buttonVOS)) {
+ for (int i = 0; i < buttonVOS.size(); i++) {
+ Menu buttonVO = buttonVOS.get(i);
+ SmOperationVO operationVO = new SmOperationVO();
+ operationVO.setModuleNo(functionId);
+ operationVO.setUniqueFlag(buttonVO.getCode());
+ operationVO.setName(buttonVO.getName());
+ operationVO.setAlias(buttonVO.getAlias());
+ operationVO.setOrderNo(String.valueOf(buttonVO.getSort()));
// operationVO.setExecuteJs(buttonVO.getExecuteJs());
// operationVO.setIconCls(buttonVO.getIconCls());
- operationVOS.add(operationVO);
- }
- }
- uiInfoVO.setButtons(operationVOS);
- }
- return uiInfoVO;
- }
+ operationVOS.add(operationVO);
+ }
+ }
+ uiInfoVO.setButtons(operationVOS);
+ }
+ return uiInfoVO;
+ }
- @Override
- public MdmUIInfoVO getFlowUIInfoByClassifyOid(String codeClassifyOid, String functionId,String templateId,String taskId,String modelKey){
+ @Override
+ public MdmUIInfoVO getFlowUIInfoByClassifyOid(String codeClassifyOid, String functionId, String templateId, String taskId, String modelKey) {
// MdmUIInfoVO uiInfoVO = getTableDefineByClassifyOid_v2(codeClassifyOid,templateId,taskId,modelKey);
MdmUIInfoVO uiInfoVO = getTableDefineByTemplateVO(getUsedTemplateByClassifyOid(codeClassifyOid));
- R<List<ProcessStageAttrVO>> r = imdmiFlowAttrClient.ssslist(templateId,modelKey,taskId);
+ R<List<ProcessStageAttrVO>> r = imdmiFlowAttrClient.ssslist(templateId, modelKey, taskId);
List<ProcessStageAttrVO> stageAttrVOS = r.getData();
Set<String> attrSet = new HashSet<>();
- stageAttrVOS.stream().forEach(attr->{
+ stageAttrVOS.stream().forEach(attr -> {
attrSet.add(attr.getAttrId());
});
@@ -3943,67 +3952,67 @@
UITableDefineVO tableDefineVO = uiInfoVO.getTableDefineVO();
List<List<UITableFieldVO>> tableFieldVOs = tableDefineVO.getCols();
List<UITableFieldVO> uiTableFieldVOS = tableFieldVOs.get(0);
- uiTableFieldVOS.stream().forEach(ui->{
+ uiTableFieldVOS.stream().forEach(ui -> {
// if(!attrSet.contains(ui.getField())){
// ui.setEdit(null);
// ui.setEditConfig(null);
// }
});
- }catch (Exception e){
+ } catch (Exception e) {
throw new ServiceException("妯℃澘娌℃湁瀹氫箟灞炴�э紝璇诲彇琛ㄥご澶辫触!");
}
return uiInfoVO;
}
- /**
- * 浣跨敤鍒嗙被涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭�
- *
- * @param codeClassifyOid 鍒嗙被鐨勪富閿�
- * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭
- */
- @Override
- public List<CodeButtonVO> listButtonInToolbarByClassifyOid(String codeClassifyOid) {
- CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid);
- return listButtonInToolbarByTemplateOid(templateVO.getOid());
- }
+ /**
+ * 浣跨敤鍒嗙被涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭�
+ *
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭
+ */
+ @Override
+ public List<CodeButtonVO> listButtonInToolbarByClassifyOid(String codeClassifyOid) {
+ CodeClassifyTemplateVO templateVO = getUsedTemplateByClassifyOid(codeClassifyOid);
+ return listButtonInToolbarByTemplateOid(templateVO.getOid());
+ }
- /**
- * 浣跨敤妯℃澘涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭�
- *
- * @param templateOid 妯℃澘鐨勪富閿�
- * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭
- */
- @Override
- public List<CodeButtonVO> listButtonInToolbarByTemplateOid(String templateOid) {
- List<CodeClassifyTemplateButtonVO> buttonVOS = templateButtonService.listButtonByTemplateOid(templateOid, true);
- if (CollectionUtils.isEmpty(buttonVOS)) {
- return new ArrayList<>();
- }
- List<CodeClassifyTemplateButtonVO> toolbarButtons = buttonVOS.stream().filter(s -> CodeUseButtonPositionTypeEnum.TOOLBAR.getValue().equalsIgnoreCase(s.getButtonUse())).collect(Collectors.toList());
- if (CollectionUtils.isEmpty(toolbarButtons)) {
- return new ArrayList<>();
- }
- List<CodeButtonVO> buttonVOList = new ArrayList<>();
- for (int i = 0; i < toolbarButtons.size(); i++) {
- buttonVOList.add(toolbarButtons.get(i).getButtonVO());
- }
- return buttonVOList;
- }
+ /**
+ * 浣跨敤妯℃澘涓婚敭鑾峰彇宸ュ叿鏍忎腑鐨勬寜閽俊鎭�
+ *
+ * @param templateOid 妯℃澘鐨勪富閿�
+ * @return 鎸夐挳鐨勪俊鎭紝浼氭寜鐓ф帓搴忓彿杩涜鎺掑簭
+ */
+ @Override
+ public List<CodeButtonVO> listButtonInToolbarByTemplateOid(String templateOid) {
+ List<CodeClassifyTemplateButtonVO> buttonVOS = templateButtonService.listButtonByTemplateOid(templateOid, true);
+ if (CollectionUtils.isEmpty(buttonVOS)) {
+ return new ArrayList<>();
+ }
+ List<CodeClassifyTemplateButtonVO> toolbarButtons = buttonVOS.stream().filter(s -> CodeUseButtonPositionTypeEnum.TOOLBAR.getValue().equalsIgnoreCase(s.getButtonUse())).collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(toolbarButtons)) {
+ return new ArrayList<>();
+ }
+ List<CodeButtonVO> buttonVOList = new ArrayList<>();
+ for (int i = 0; i < toolbarButtons.size(); i++) {
+ buttonVOList.add(toolbarButtons.get(i).getButtonVO());
+ }
+ return buttonVOList;
+ }
- /**
- * 浼犲叆涓氬姟绫诲瀷浠ュ強鐩稿叧鏁版嵁杩涜鎵归噺鎻掑叆鎿嶄綔
- *
- * @param btmType 涓氬姟绫诲瀷
- * @param baseModels 澶勭悊鏁版嵁
- * @return 澶勭悊鎴愬姛鏁版嵁鏉℃暟
- */
- @Override
- public Integer insertBatchByType(String btmType, List<BaseModel> baseModels) {
- //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
+ /**
+ * 浼犲叆涓氬姟绫诲瀷浠ュ強鐩稿叧鏁版嵁杩涜鎵归噺鎻掑叆鎿嶄綔
+ *
+ * @param btmType 涓氬姟绫诲瀷
+ * @param baseModels 澶勭悊鏁版嵁
+ * @return 澶勭悊鎴愬姛鏁版嵁鏉℃暟
+ */
+ @Override
+ public Integer insertBatchByType(String btmType, List<BaseModel> baseModels) {
+ //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
//鑾峰彇褰撳墠涓氬姟绫诲瀷鎵�鏈夊瓧娈电敤鏉ュ仛瀵规瘮
R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType);
if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) {
@@ -4013,36 +4022,37 @@
return btmTypeAttributeVO.getId().toLowerCase();
}).collect(Collectors.toSet());
//灏哹ean杞负map,mybatis缁熶竴澶勭悊
- List<Map<String, String>> maps = new ArrayList<>();
+ List<Map<String, String>> maps = new ArrayList<>();
- baseModels.stream().forEach(model -> {
- try {
- maps.add(VciBaseUtil.convertBean2Map(model,existFild));
- } catch (Exception e) {
- throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.toString());
- }
- });
- // 鏄惁寮�鍚绾跨▼鎵ц鎻掑叆璇彞
- if(IS_THREAD_IMPORT){
+ baseModels.stream().forEach(model -> {
try {
- threadBactchExecuteInsert(listR.getData().get(0).getTableName(),maps);
- }catch (Exception e){
- throw new ServiceException("鍒嗘壒鎵цinsert璇彞鎶ラ敊:"+e.getMessage());
+ maps.add(VciBaseUtil.convertBean2Map(model, existFild));
+ } catch (Exception e) {
+ throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.toString());
}
- }else {
- bacthExcecuteInsert(listR.getData().get(0).getTableName(),maps);
+ });
+ // 鏄惁寮�鍚绾跨▼鎵ц鎻掑叆璇彞
+ if (IS_THREAD_IMPORT) {
+ try {
+ threadBactchExecuteInsert(listR.getData().get(0).getTableName(), maps);
+ } catch (Exception e) {
+ throw new ServiceException("鍒嗘壒鎵цinsert璇彞鎶ラ敊:" + e.getMessage());
+ }
+ } else {
+ bacthExcecuteInsert(listR.getData().get(0).getTableName(), maps);
}
- return maps.size();
- }
+ return maps.size();
+ }
/**
* 澶氱嚎绋嬫柟寮忓垎鎵规墽琛宨nsert璇彞
+ *
* @param tableName
* @param maps
* @throws ServiceException
*/
- private void threadBactchExecuteInsert(String tableName, List<Map<String, String>> maps) throws ServiceException{
+ private void threadBactchExecuteInsert(String tableName, List<Map<String, String>> maps) throws ServiceException {
ExecutorService executor = Executors.newFixedThreadPool(THREAD_NUM); // 鍒涘缓涓�涓浐瀹氬ぇ灏忕殑绾跨▼姹�
List<Map<String, String>> threadSafeMaps = new CopyOnWriteArrayList<>(maps);
@@ -4055,7 +4065,7 @@
// 璋冪敤鎻掑叆鏁版嵁搴撶殑鏂规硶
commonsMapper.insertByBaseModel(tableName, threadSafeMaps.get(0), subList);
});
- }catch (Throwable e){
+ } catch (Throwable e) {
throw new ServiceException(e.getMessage());
}
}
@@ -4067,16 +4077,17 @@
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
// 澶勭悊寮傚父
- throw new ServiceException("澶氱嚎绋嬫柟寮忔墽琛屾壒閲忔彃鍏ユ椂浜х敓閿欒:"+e.getMessage());
+ throw new ServiceException("澶氱嚎绋嬫柟寮忔墽琛屾壒閲忔彃鍏ユ椂浜х敓閿欒:" + e.getMessage());
}
}
/**
* 鍗曠嚎绋嬫柟寮忓垎鎵规墽琛�
+ *
* @param tableName
* @param maps
*/
- private void bacthExcecuteInsert(String tableName, List<Map<String, String>> maps){
+ private void bacthExcecuteInsert(String tableName, List<Map<String, String>> maps) {
for (int i = 0; i < maps.size(); i += MAX_IMPORT_NUM) {
final int startIndex = i;
final int endIndex = Math.min(i + MAX_IMPORT_NUM, maps.size());
@@ -4090,26 +4101,26 @@
* 浼犲叆涓氬姟绫诲瀷浠ュ強ID鏌ヨ涓氬姟琛ㄦ暟鎹槸鍚﹂噸澶�
*
* @param btmType 涓氬姟绫诲瀷
- * @param ids 澶勭悊鏁版嵁
+ * @param ids 澶勭悊鏁版嵁
* @return 鏌ヨ鍒版暟鎹殑鎬绘暟
*/
- @Override
- public Integer selectIdsCounts(String btmType, List<String> ids) {
- //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
+ @Override
+ public Integer selectIdsCounts(String btmType, List<String> ids) {
+ //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
return commonsMapper.queryCountBySql("select count(*) from " +
- listR.getData().get(0).getTableName() + " where id in ("+ ids.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")) +")");
- }
+ listR.getData().get(0).getTableName() + " where id in (" + ids.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")) + ")");
+ }
/**
* 浼犲叆涓氬姟绫诲瀷浠ュ強ID銆丱ID鏌ヨ涓氬姟琛ㄦ暟鎹槸鍚﹂噸澶�
*
* @param btmType 涓氬姟绫诲瀷
* @param id 澶勭悊鏁版嵁id
- * @param oid 澶勭悊鏁版嵁oid
+ * @param oid 澶勭悊鏁版嵁oid
* @return 鏌ヨ鍒版暟鎹殑鎬绘暟
*/
@Override
@@ -4123,152 +4134,152 @@
listR.getData().get(0).getTableName() + " where id ='" + id + "' and oid <> '" + oid + "'");
}
- /**
- * 浼犲叆涓氬姟绫诲瀷浠ュ強鐩竜id闆嗗悎鏌ヨ鏁版嵁杩涜杩斿洖
- *
- * @param btmType 涓氬姟绫诲瀷
- * @param oids 闇�瑕佹煡璇㈢殑oid闆嗗悎 閫楀彿鍒嗗紑
- * @return 鏌ヨ鍑虹殑鏁版嵁
- */
- @Override
- public List<BaseModel> selectByTypeAndOid(String btmType, String oids) {
+ /**
+ * 浼犲叆涓氬姟绫诲瀷浠ュ強鐩竜id闆嗗悎鏌ヨ鏁版嵁杩涜杩斿洖
+ *
+ * @param btmType 涓氬姟绫诲瀷
+ * @param oids 闇�瑕佹煡璇㈢殑oid闆嗗悎 閫楀彿鍒嗗紑
+ * @return 鏌ヨ鍑虹殑鏁版嵁
+ */
+ @Override
+ public List<BaseModel> selectByTypeAndOid(String btmType, String oids) {
- //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
- //鏌ヨ鏁版嵁
- List<Map> maps = commonsMapper.selectBySql("select * from " + listR.getData().get(0).getTableName() + " where oid in ("
- + VciBaseUtil.toInSql(oids.toString()) + ")");
+ //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
+ //鏌ヨ鏁版嵁
+ List<Map> maps = commonsMapper.selectBySql("select * from " + listR.getData().get(0).getTableName() + " where oid in ("
+ + VciBaseUtil.toInSql(oids.toString()) + ")");
- List<BaseModel> baseModels = new ArrayList<>();
- //灏嗘煡璇㈠埌鐨勬暟鎹浆鎹负basemodel锛屼娇鐢ㄧ殑鍙嶅皠鏂瑰紡鏉ヨ繘琛屽垱寤虹殑
- try {
- for (Map map : maps) {
- Object obj = BaseModel.class.newInstance();
- BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
- PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for (PropertyDescriptor property : propertyDescriptors) {
- Method setter = property.getWriteMethod();
- if (setter != null) {
- //oracle鐨勬椂闂翠负TIMESTAMP鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚data锛屽惁鍒欏皢鎶ラ敊
- if (map.get(property.getName().toUpperCase()) instanceof TIMESTAMP) {
- LocalDateTime localDateTime = ((TIMESTAMP) map.get(property.getName().toUpperCase())).toLocalDateTime();
- ZoneId zoneId = ZoneId.systemDefault();
- ZonedDateTime zdt = localDateTime.atZone(zoneId);
- Date date = Date.from(zdt.toInstant());
- setter.invoke(obj, date);
- map.remove(property.getName().toUpperCase());
- } //oracle鐨勬暟瀛椾负BigDecimal鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚Integer锛屽惁鍒欏皢鎶ラ敊
- else if (map.get(property.getName().toUpperCase()) instanceof BigDecimal
- && ("Integer").equals(setter.getParameterTypes()[0].getSimpleName())) {
- setter.invoke(obj, ((BigDecimal) map.get(property.getName().toUpperCase())).intValue());
- map.remove(property.getName().toUpperCase());
- } else if (map.containsKey(property.getName().toUpperCase())) {
- if(setter.getParameterTypes()[0].getSimpleName().equals("String")){
- setter.invoke(obj, map.get(property.getName().toUpperCase()) == null ? null:String.valueOf(map.get(property.getName().toUpperCase())));
- }else{
+ List<BaseModel> baseModels = new ArrayList<>();
+ //灏嗘煡璇㈠埌鐨勬暟鎹浆鎹负basemodel锛屼娇鐢ㄧ殑鍙嶅皠鏂瑰紡鏉ヨ繘琛屽垱寤虹殑
+ try {
+ for (Map map : maps) {
+ Object obj = BaseModel.class.newInstance();
+ BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
+ PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor property : propertyDescriptors) {
+ Method setter = property.getWriteMethod();
+ if (setter != null) {
+ //oracle鐨勬椂闂翠负TIMESTAMP鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚data锛屽惁鍒欏皢鎶ラ敊
+ if (map.get(property.getName().toUpperCase()) instanceof TIMESTAMP) {
+ LocalDateTime localDateTime = ((TIMESTAMP) map.get(property.getName().toUpperCase())).toLocalDateTime();
+ ZoneId zoneId = ZoneId.systemDefault();
+ ZonedDateTime zdt = localDateTime.atZone(zoneId);
+ Date date = Date.from(zdt.toInstant());
+ setter.invoke(obj, date);
+ map.remove(property.getName().toUpperCase());
+ } //oracle鐨勬暟瀛椾负BigDecimal鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚Integer锛屽惁鍒欏皢鎶ラ敊
+ else if (map.get(property.getName().toUpperCase()) instanceof BigDecimal
+ && ("Integer").equals(setter.getParameterTypes()[0].getSimpleName())) {
+ setter.invoke(obj, ((BigDecimal) map.get(property.getName().toUpperCase())).intValue());
+ map.remove(property.getName().toUpperCase());
+ } else if (map.containsKey(property.getName().toUpperCase())) {
+ if (setter.getParameterTypes()[0].getSimpleName().equals("String")) {
+ setter.invoke(obj, map.get(property.getName().toUpperCase()) == null ? null : String.valueOf(map.get(property.getName().toUpperCase())));
+ } else {
setter.invoke(obj, map.get(property.getName().toUpperCase()));
}
- map.remove(property.getName().toUpperCase());
- }
- }
- }
- for (Object key : map.keySet()) {
- map.put(key, map.get(key) == null ? null : String.valueOf(map.get(key)));
- }
+ map.remove(property.getName().toUpperCase());
+ }
+ }
+ }
+ for (Object key : map.keySet()) {
+ map.put(key, map.get(key) == null ? null : String.valueOf(map.get(key)));
+ }
- ((BaseModel) obj).setData(map);
- baseModels.add((BaseModel) obj);
- }
- } catch (Exception e) {
- throw new VciBaseException("鏌ヨ澶辫触锛�" + e.getMessage());
- }
- return baseModels;
- }
+ ((BaseModel) obj).setData(map);
+ baseModels.add((BaseModel) obj);
+ }
+ } catch (Exception e) {
+ throw new VciBaseException("鏌ヨ澶辫触锛�" + e.getMessage());
+ }
+ return baseModels;
+ }
- /**
- * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍒涘缓涓氬姟鏁版嵁婧愬璞�
- *
- * @param boName 涓氬姟绫诲瀷鍚嶇О
- * @return 涓氬姟鏁版嵁瀵硅薄
- */
- public BaseModel createBaseModel(String boName) {
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(boName));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
+ /**
+ * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍒涘缓涓氬姟鏁版嵁婧愬璞�
+ *
+ * @param boName 涓氬姟绫诲瀷鍚嶇О
+ * @return 涓氬姟鏁版嵁瀵硅薄
+ */
+ public BaseModel createBaseModel(String boName) {
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(boName));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
// String userName = String.valueOf(AuthUtil.getUser().getUserId());
- BaseModel bo = new BaseModel();
+ BaseModel bo = new BaseModel();
// bo.setOid(VciBaseUtil.getPk());
// bo.setRevisionid(VciBaseUtil.getPk());
// bo.setNameoid(VciBaseUtil.getPk());
- bo.setBtmname(boName);
- bo.setLastR("1");
- bo.setFirstR("1");
- bo.setFirstV("1");
- bo.setLastV("1");
- bo.setRevisionRule(listR.getData().get(0).getRevisionRuleId());
- bo.setVersionRule("".equals(listR.getData().get(0).getVersionRule())?"1":listR.getData().get(0).getVersionRule());
- if (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId())) {
- R<List<RevisionRuleVO>> revisionRuleVO = revisionRuleClient
- .selectByIdCollection(Collections.singletonList(listR.getData().get(0).getRevisionRuleId().toLowerCase()));
- if(revisionRuleVO.getData().size() != 0 ){
+ bo.setBtmname(boName);
+ bo.setLastR("1");
+ bo.setFirstR("1");
+ bo.setFirstV("1");
+ bo.setLastV("1");
+ bo.setRevisionRule(listR.getData().get(0).getRevisionRuleId());
+ bo.setVersionRule("".equals(listR.getData().get(0).getVersionRule()) ? "1" : listR.getData().get(0).getVersionRule());
+ if (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId())) {
+ R<List<RevisionRuleVO>> revisionRuleVO = revisionRuleClient
+ .selectByIdCollection(Collections.singletonList(listR.getData().get(0).getRevisionRuleId().toLowerCase()));
+ if (revisionRuleVO.getData().size() != 0) {
bo.setRevisionValue(revisionRuleVO.getData().get(0).getStartCode());
- }else{
+ } else {
bo.setRevisionValue("1");
}
- }
- bo.setRevisionSeq(1);
- bo.setVersionSeq(1);
- bo.setVersionValue(getVersionValue(WebUtil.getInt(listR.getData().get(0).getVersionRule())));
- bo.setLctid(listR.getData().get(0).getLifeCycleId());
+ }
+ bo.setRevisionSeq(1);
+ bo.setVersionSeq(1);
+ bo.setVersionValue(getVersionValue(WebUtil.getInt(listR.getData().get(0).getVersionRule())));
+ bo.setLctid(listR.getData().get(0).getLifeCycleId());
// if(StringUtils.isNotBlank(listR.getData().get(0).getLifeCycleId())){
// OsLifeCycleVO lifeCycleVO = lifeService.getLifeCycleById(listR.getData().get(0).getLifeCycleId());
- bo.setLcStatus("Editing");
+ bo.setLcStatus("Editing");
// }
- bo.setId("");
- bo.setName("");
- bo.setDescription("");
- bo.setOwner(AuthUtil.getUser().getUserId().toString());
+ bo.setId("");
+ bo.setName("");
+ bo.setDescription("");
+ bo.setOwner(AuthUtil.getUser().getUserId().toString());
// bo.setCheckinby(userName);
- bo.setCopyFromVersion("");
+ bo.setCopyFromVersion("");
// this.initTypeAttributeValue(bo,btmTypeVO);
- return bo;
- }
+ return bo;
+ }
- /**
- * 鑾峰彇鐗堟鐨勫��
- *
- * @param verRuleName 鐗堟鐨勮鍒�
- * @return 鐗堟鐨勫�硷紝娌℃湁瑙勫垯鍒欎负绌�
- */
- private String getVersionValue(int verRuleName) {
- if (verRuleName == 0) {
- return "1";
- } else if (verRuleName == 1) {
- return "a";
- } else if (verRuleName == 2) {
- return "0";
- }
- return "";
- }
+ /**
+ * 鑾峰彇鐗堟鐨勫��
+ *
+ * @param verRuleName 鐗堟鐨勮鍒�
+ * @return 鐗堟鐨勫�硷紝娌℃湁瑙勫垯鍒欎负绌�
+ */
+ private String getVersionValue(int verRuleName) {
+ if (verRuleName == 0) {
+ return "1";
+ } else if (verRuleName == 1) {
+ return "a";
+ } else if (verRuleName == 2) {
+ return "0";
+ }
+ return "";
+ }
- /**
- * 浼犲叆涓氬姟绫诲瀷浠ュ強鐩稿叧鏁版嵁杩涜鎵归噺鏇存柊鎿嶄綔
- *
- * @param btmType 涓氬姟绫诲瀷
- * @param baseModels 澶勭悊鏁版嵁
- * @return 澶勭悊鐘舵��
- */
- @Override
- public R updateBatchByBaseModel(String btmType, List<BaseModel> baseModels) {
- //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
+ /**
+ * 浼犲叆涓氬姟绫诲瀷浠ュ強鐩稿叧鏁版嵁杩涜鎵归噺鏇存柊鎿嶄綔
+ *
+ * @param btmType 涓氬姟绫诲瀷
+ * @param baseModels 澶勭悊鏁版嵁
+ * @return 澶勭悊鐘舵��
+ */
+ @Override
+ public R updateBatchByBaseModel(String btmType, List<BaseModel> baseModels) {
+ //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
//鑾峰彇褰撳墠涓氬姟绫诲瀷鎵�鏈夊瓧娈电敤鏉ュ仛瀵规瘮
R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType);
if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) {
@@ -4277,30 +4288,31 @@
Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> {
return btmTypeAttributeVO.getId();
}).collect(Collectors.toSet());
- //灏哹ean杞负map,mybatis缁熶竴澶勭悊
- List<Map<String, String>> maps = new ArrayList<>();
+ //灏哹ean杞负map,mybatis缁熶竴澶勭悊
+ List<Map<String, String>> maps = new ArrayList<>();
- baseModels.stream().forEach(model -> {
- try {
- maps.add(VciBaseUtil.convertBean2Map(model,existFild));
- } catch (Exception e) {
- throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage());
- }
- });
- try {
- //娉ㄦ剰姝ゅ鏇存柊鎴愬姛鏄繑鍥炵殑-1
- commonsMapper.updateBatchByBaseModel(listR.getData().get(0).getTableName(), maps);
- } catch (Exception e) {
- return R.fail("鏇存柊澶辫触锛�" + e.getMessage());
- }
+ baseModels.stream().forEach(model -> {
+ try {
+ maps.add(VciBaseUtil.convertBean2Map(model, existFild));
+ } catch (Exception e) {
+ throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage());
+ }
+ });
+ try {
+ //娉ㄦ剰姝ゅ鏇存柊鎴愬姛鏄繑鍥炵殑-1
+ commonsMapper.updateBatchByBaseModel(listR.getData().get(0).getTableName(), maps);
+ } catch (Exception e) {
+ return R.fail("鏇存柊澶辫触锛�" + e.getMessage());
+ }
- return R.success("鏇存柊鎴愬姛锛�");
- }
+ return R.success("鏇存柊鎴愬姛锛�");
+ }
+
/**
* 鏇存柊涓氬姟鏁版嵁鍚屾椂瀵圭爜鍊艰〃鏁版嵁鎿嶄綔鎺ュ彛
*
- * @param btmType 涓氬姟绫诲瀷
- * @param baseModels 澶勭悊鏁版嵁
+ * @param btmType 涓氬姟绫诲瀷
+ * @param baseModels 澶勭悊鏁版嵁
* @return 澶勭悊鐘舵��
*/
@Transactional(rollbackFor = VciBaseException.class)
@@ -4320,25 +4332,25 @@
Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> {
return btmTypeAttributeVO.getId();
}).collect(Collectors.toSet());
- if(!CollectionUtils.isEmpty(baseModels)){
- List<String> oidList=baseModels.stream().filter(data-> com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(data.getOid())).map(BaseModel::getOid).distinct().collect(Collectors.toList());
+ if (!CollectionUtils.isEmpty(baseModels)) {
+ List<String> oidList = baseModels.stream().filter(data -> com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(data.getOid())).map(BaseModel::getOid).distinct().collect(Collectors.toList());
LambdaQueryWrapper<CodeAllCode> lqw = new LambdaQueryWrapper<>();
- lqw.in(CodeAllCode::getCreateCodeOid,oidList);
- List<CodeAllCode> codeAllCodeList= codeAllCodeService.selectByWrapper(lqw);
+ lqw.in(CodeAllCode::getCreateCodeOid, oidList);
+ List<CodeAllCode> codeAllCodeList = codeAllCodeService.selectByWrapper(lqw);
Map<String, CodeAllCode> cboMap = codeAllCodeList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getCreateCodeOid(), t -> t));
- List<CodeAllCode> newCodeAllCodeList=new ArrayList<>();
+ List<CodeAllCode> newCodeAllCodeList = new ArrayList<>();
//灏哹ean杞负map,mybatis缁熶竴澶勭悊
List<Map<String, String>> maps = new ArrayList<>();
try {
- baseModels.stream().forEach(baseModel->{
- String oid=baseModel.getOid();
+ baseModels.stream().forEach(baseModel -> {
+ String oid = baseModel.getOid();
try {
- maps.add(VciBaseUtil.convertBean2Map(baseModel,existFild));
+ maps.add(VciBaseUtil.convertBean2Map(baseModel, existFild));
} catch (Exception e) {
throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage());
}
- if(cboMap.containsKey(oid)){
- CodeAllCode codeAllCode= cboMap.get(oid);
+ if (cboMap.containsKey(oid)) {
+ CodeAllCode codeAllCode = cboMap.get(oid);
codeAllCode.setId(baseModel.getId());
// codeAllCode.setLastModifier(AuthUtil.getUser().getUserName());
codeAllCode.setLastModifier(AuthUtil.getUser().getAccount());
@@ -4358,201 +4370,201 @@
}
/**
- * 鑾峰彇鍙傜収鐨勪俊鎭�
- *
- * @param referConfigVO 鍙傜収鐨勯厤缃�
- * @return 鍒楄〃鏁版嵁
- */
- @Override
- public IPage<BaseModelVO> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException {
- //checkReferConfig(referConfigVO);
- //浣跨敤涓氬姟绫诲瀷鏌ヨ
- R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
- if (!allAttributeByBtmId.isSuccess()) {
- throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒;"+allAttributeByBtmId.getMsg());
- }
- if (Func.isEmpty(allAttributeByBtmId.getData())) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
- BtmTypeVO btmTypeVO = allAttributeByBtmId.getData();
- /**
- * 鍔犱笂鏌ヨ鏈�鏂扮増娆�
- */
- baseQueryObject.getConditionMap().put("lastr", "1");
- baseQueryObject.getConditionMap().put("lastv", "1");
- if (VciBaseUtil.containsKeyUnCaseForMap(baseQueryObject.getConditionMap(), VciQueryWrapperForDO.LC_STATUS_FIELD) &&
- BtmTypeLcStatusConstant.FRAME_WORK_LIFE_CYCLE_NAME.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) {
- baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, FrameworkDataLCStatus.ENABLED.getValue());
- }
- if (VciBaseUtil.containsKeyUnCaseForMap(baseQueryObject.getConditionMap(), VciQueryWrapperForDO.LC_STATUS_FIELD) &&
- BtmTypeLcStatusConstant.RELEASE_LIFE_CYCLE.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) {
- baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, CodeDefaultLC.RELEASED.getValue());
- }
+ * 鑾峰彇鍙傜収鐨勪俊鎭�
+ *
+ * @param referConfigVO 鍙傜収鐨勯厤缃�
+ * @return 鍒楄〃鏁版嵁
+ */
+ @Override
+ public IPage<BaseModelVO> referDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject) throws VciBaseException {
+ //checkReferConfig(referConfigVO);
+ //浣跨敤涓氬姟绫诲瀷鏌ヨ
+ R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType());
+ if (!allAttributeByBtmId.isSuccess()) {
+ throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒;" + allAttributeByBtmId.getMsg());
+ }
+ if (Func.isEmpty(allAttributeByBtmId.getData())) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
+ BtmTypeVO btmTypeVO = allAttributeByBtmId.getData();
+ /**
+ * 鍔犱笂鏌ヨ鏈�鏂扮増娆�
+ */
+ baseQueryObject.getConditionMap().put("lastr", "1");
+ baseQueryObject.getConditionMap().put("lastv", "1");
+ if (VciBaseUtil.containsKeyUnCaseForMap(baseQueryObject.getConditionMap(), VciQueryWrapperForDO.LC_STATUS_FIELD) &&
+ BtmTypeLcStatusConstant.FRAME_WORK_LIFE_CYCLE_NAME.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) {
+ baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, FrameworkDataLCStatus.ENABLED.getValue());
+ }
+ if (VciBaseUtil.containsKeyUnCaseForMap(baseQueryObject.getConditionMap(), VciQueryWrapperForDO.LC_STATUS_FIELD) &&
+ BtmTypeLcStatusConstant.RELEASE_LIFE_CYCLE.equalsIgnoreCase(btmTypeVO.getLifeCycleId())) {
+ baseQueryObject.getConditionMap().put(VciQueryWrapperForDO.LC_STATUS_FIELD, CodeDefaultLC.RELEASED.getValue());
+ }
- R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referConfigVO.getReferType()));
- if (!listR.isSuccess()) {
- throw new ServiceException(Func.isNotBlank(listR.getMsg()) ? listR.getMsg() : "涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒锛�");
- }
- if (listR.getData().isEmpty()) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
+ R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(referConfigVO.getReferType()));
+ if (!listR.isSuccess()) {
+ throw new ServiceException(Func.isNotBlank(listR.getMsg()) ? listR.getMsg() : "涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒锛�");
+ }
+ if (listR.getData().isEmpty()) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
// TODO:鍙傜収閰嶇疆鐨勬ā绯婃煡璇㈣繃婊ゆ潯浠舵殏鏈鐞�
-/* String namesql = "";
- if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
- String s = baseQueryObject.getConditionMap().get("name");
- s = "%" + s + "%";
- namesql = "and name like" + VciBaseUtil.toInSql(s);
- }
+ /* String namesql = "";
+ if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) {
+ String s = baseQueryObject.getConditionMap().get("name");
+ s = "%" + s + "%";
+ namesql = "and name like" + VciBaseUtil.toInSql(s);
+ }
- String codesql = "";
- if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("id"))) {
- String s = baseQueryObject.getConditionMap().get("id");
- s = "%" + s + "%";
- codesql = "and id like" + VciBaseUtil.toInSql(s);
- }
+ String codesql = "";
+ if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("id"))) {
+ String s = baseQueryObject.getConditionMap().get("id");
+ s = "%" + s + "%";
+ codesql = "and id like" + VciBaseUtil.toInSql(s);
+ }
- String lcstatusSql = "";
- if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
- lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
- }*/
-// String where = "";
+ String lcstatusSql = "";
+ if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("lcstatus"))) {
+ lcstatusSql = "and lcstatus =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lcstatus"));
+ }*/
+ // String where = "";
-// if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) {
-// where = "where ";
-// }
+ // if (StringUtils.isNotBlank(codesql) || StringUtils.isNotBlank(lcstatusSql) || StringUtils.isNotBlank(namesql)) {
+ // where = "where ";
+ // }
String whereSqlByMap = UBCSCondition.getWhereSqlByMap(baseQueryObject.getConditionMap());
String num1 = baseQueryObject.getPage() * baseQueryObject.getLimit() + "";
- String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + "";
+ String num2 = ((baseQueryObject.getPage()) - 1) * baseQueryObject.getLimit() + 1 + "";
- List<Map> maps = commonsMapper.selectBySql("select * from (select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
- + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
- + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and "
- + whereSqlByMap + ") t "+ (baseQueryObject.getLimit()==-1?")": ("where rownum <=" + num1 + ") where rn >=" + num2)
+ List<Map> maps = commonsMapper.selectBySql("select * from (select rownum rn, t.* from (select * from " + listR.getData().get(0).getTableName() + SPACE
+ + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
+ + " and lastv =" + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
+ + (Func.isNotBlank(whereSqlByMap) ? "and " + whereSqlByMap : "") + ") t " + (baseQueryObject.getLimit() == -1 ? ")" : ("where rownum <=" + num1 + ") where rn >=" + num2)
));
- List<BaseModel> baseModels = new ArrayList<>();
- //灏嗘煡璇㈠埌鐨勬暟鎹浆鎹负basemodel锛屼娇鐢ㄧ殑鍙嶅皠鏂瑰紡鏉ヨ繘琛屽垱寤虹殑
- try {
- for (Map map : maps) {
- Object obj = BaseModel.class.newInstance();
- BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
- PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for (PropertyDescriptor property : propertyDescriptors) {
- Method setter = property.getWriteMethod();
- if (setter != null) {
- //oracle鐨勬椂闂翠负TIMESTAMP鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚data锛屽惁鍒欏皢鎶ラ敊
- if (map.get(property.getName().toUpperCase()) instanceof TIMESTAMP) {
- LocalDateTime localDateTime = ((TIMESTAMP) map.get(property.getName().toUpperCase())).toLocalDateTime();
- ZoneId zoneId = ZoneId.systemDefault();
- ZonedDateTime zdt = localDateTime.atZone(zoneId);
- Date date = Date.from(zdt.toInstant());
- setter.invoke(obj, date);
- //map.remove(property.getName().toUpperCase());
- } //oracle鐨勬暟瀛椾负BigDecimal鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚Integer锛屽惁鍒欏皢鎶ラ敊
- else if (map.get(property.getName().toUpperCase()) instanceof BigDecimal
- && ("Integer").equals(setter.getParameterTypes()[0].getSimpleName())) {
- setter.invoke(obj, ((BigDecimal) map.get(property.getName().toUpperCase())).intValue());
- //map.remove(property.getName().toUpperCase());
- } else if (map.get(property.getName().toUpperCase()) != null) {
- if(setter.getParameterTypes()[0].getSimpleName().equals("String")){
- setter.invoke(obj, map.get(property.getName().toUpperCase()) == null ? null:String.valueOf(map.get(property.getName().toUpperCase())));
- }else{
+ List<BaseModel> baseModels = new ArrayList<>();
+ //灏嗘煡璇㈠埌鐨勬暟鎹浆鎹负basemodel锛屼娇鐢ㄧ殑鍙嶅皠鏂瑰紡鏉ヨ繘琛屽垱寤虹殑
+ try {
+ for (Map map : maps) {
+ Object obj = BaseModel.class.newInstance();
+ BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
+ PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor property : propertyDescriptors) {
+ Method setter = property.getWriteMethod();
+ if (setter != null) {
+ //oracle鐨勬椂闂翠负TIMESTAMP鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚data锛屽惁鍒欏皢鎶ラ敊
+ if (map.get(property.getName().toUpperCase()) instanceof TIMESTAMP) {
+ LocalDateTime localDateTime = ((TIMESTAMP) map.get(property.getName().toUpperCase())).toLocalDateTime();
+ ZoneId zoneId = ZoneId.systemDefault();
+ ZonedDateTime zdt = localDateTime.atZone(zoneId);
+ Date date = Date.from(zdt.toInstant());
+ setter.invoke(obj, date);
+ //map.remove(property.getName().toUpperCase());
+ } //oracle鐨勬暟瀛椾负BigDecimal鐨勶紝闇�瑕佽繘琛岃浆鎹㈡垚Integer锛屽惁鍒欏皢鎶ラ敊
+ else if (map.get(property.getName().toUpperCase()) instanceof BigDecimal
+ && ("Integer").equals(setter.getParameterTypes()[0].getSimpleName())) {
+ setter.invoke(obj, ((BigDecimal) map.get(property.getName().toUpperCase())).intValue());
+ //map.remove(property.getName().toUpperCase());
+ } else if (map.get(property.getName().toUpperCase()) != null) {
+ if (setter.getParameterTypes()[0].getSimpleName().equals("String")) {
+ setter.invoke(obj, map.get(property.getName().toUpperCase()) == null ? null : String.valueOf(map.get(property.getName().toUpperCase())));
+ } else {
setter.invoke(obj, map.get(property.getName().toUpperCase()));
}
- //map.remove(property.getName().toUpperCase());
- }
- }
- }
- for (Object key : map.keySet()) {
- map.put(key, String.valueOf(map.get(key)));
- }
+ //map.remove(property.getName().toUpperCase());
+ }
+ }
+ }
+ for (Object key : map.keySet()) {
+ map.put(key, String.valueOf(map.get(key)));
+ }
Map<String, String> newMap = new HashMap<>();
map.forEach((key, value) -> newMap.put(String.valueOf(key).toLowerCase(), String.valueOf(value)));
((BaseModel) obj).setData(newMap);
- baseModels.add((BaseModel) obj);
- }
- } catch (Exception e) {
- throw new VciBaseException("鏌ヨ澶辫触锛�" + e.getMessage());
- }
- int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE
- + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
- + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 and "
- + whereSqlByMap
- );
- IPage<BaseModelVO> objectDataGrid = new Page<>();
- objectDataGrid.setPages(baseQueryObject.getPage());
- objectDataGrid.setCurrent(baseQueryObject.getPage());
- objectDataGrid.setRecords(BaseMdodelWrapper.build().listVO(baseModels));
- objectDataGrid.setSize(baseQueryObject.getLimit());
- objectDataGrid.setTotal(total);
- return objectDataGrid;
- }
+ baseModels.add((BaseModel) obj);
+ }
+ } catch (Exception e) {
+ throw new VciBaseException("鏌ヨ澶辫触锛�" + e.getMessage());
+ }
+ int total = commonsMapper.queryCountBySql("select count(*) from " + listR.getData().get(0).getTableName() + SPACE
+ + (StringUtils.isNotBlank(listR.getData().get(0).getRevisionRuleId()) ? (" where lastr = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastr").toString())
+ + "and lastv = " + VciBaseUtil.toInSql(baseQueryObject.getConditionMap().get("lastv").toString())) + " and" : "where") + SPACE + "1=1 "
+ + (Func.isNotBlank(whereSqlByMap) ? "and " + whereSqlByMap : "")
+ );
+ IPage<BaseModelVO> objectDataGrid = new Page<>();
+ objectDataGrid.setPages(baseQueryObject.getPage());
+ objectDataGrid.setCurrent(baseQueryObject.getPage());
+ objectDataGrid.setRecords(BaseMdodelWrapper.build().listVO(baseModels));
+ objectDataGrid.setSize(baseQueryObject.getLimit());
+ objectDataGrid.setTotal(total);
+ return objectDataGrid;
+ }
- /**
- * 鑾峰彇鏍戝舰鐨勫弬鐓�
- *
- * @param referConfigVO 鍙傜収鐨勯厤缃�
- * @return 鏍戝舰鐨勬暟鎹�
- */
- @Override
- public List<Tree> referTree(UIFormReferVO referConfigVO, TreeQueryObject queryObject) {
- if (queryObject.getConditionMap() == null) {
- queryObject.setConditionMap(new HashMap<>());
- }
+ /**
+ * 鑾峰彇鏍戝舰鐨勫弬鐓�
+ *
+ * @param referConfigVO 鍙傜収鐨勯厤缃�
+ * @return 鏍戝舰鐨勬暟鎹�
+ */
+ @Override
+ public List<Tree> referTree(UIFormReferVO referConfigVO, TreeQueryObject queryObject) {
+ if (queryObject.getConditionMap() == null) {
+ queryObject.setConditionMap(new HashMap<>());
+ }
- if (queryObject.getParentOid() == null) {
- LambdaQueryWrapper<CodeClassify> lqw = new LambdaQueryWrapper<>();
- String parentValue = referConfigVO.getParentValue().substring(3);
- lqw.inSql(CodeClassify::getOid, parentValue);
- List<String> codeClassifies = classifyService.select1(lqw);
- String oid = codeClassifies.get(0);
- queryObject.setParentOid(oid);
- }
- String oidFieldName = StringUtils.isNotBlank(referConfigVO.getParentUsedField()) ? referConfigVO.getParentUsedField() : referConfigVO.getValueField();
- if (queryObject.isQueryAllLevel()) {
- String parentOidSql = "";
- if (StringUtils.isNotBlank(referConfigVO.getParentValue())) {
- String temp = referConfigVO.getParentValue();
- if (temp.startsWith(QueryOptionConstant.IN)) {
- temp = temp.substring((QueryOptionConstant.IN).length()).trim();
- parentOidSql = " in " + ((temp.startsWith("(") && temp.endsWith(")")) ? temp : "(" + temp + ")");
- } else if (temp.startsWith(QueryOptionConstant.NOTIN)) {
- parentOidSql = " not in " + ((temp.startsWith("(") && temp.endsWith(")")) ? temp : "(" + temp + ")");
- } else if (temp.startsWith(QueryOptionConstant.NOTEQUAL)) {
- temp = temp.substring((QueryOptionConstant.NOTEQUAL).length()).trim();
- parentOidSql = QueryOptionConstant.NOTEQUAL + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
- } else if (temp.startsWith(QueryOptionConstant.MORETHAN)) {
- temp = temp.substring((QueryOptionConstant.MORETHAN).length()).trim();
- parentOidSql = QueryOptionConstant.MORETHAN + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
- } else if (temp.startsWith(QueryOptionConstant.MORE)) {
- temp = temp.substring((QueryOptionConstant.MORE).length()).trim();
- parentOidSql = QueryOptionConstant.MORE + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
- } else if (temp.startsWith(QueryOptionConstant.LESSTHAN)) {
- temp = temp.substring((QueryOptionConstant.LESSTHAN).length()).trim();
- parentOidSql = QueryOptionConstant.LESSTHAN + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
- } else if (temp.startsWith(QueryOptionConstant.LESS)) {
- temp = temp.substring((QueryOptionConstant.LESS).length()).trim();
- parentOidSql = QueryOptionConstant.LESS + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
- } else if (temp.startsWith(QueryOptionConstant.ISNOTNULL)) {
- parentOidSql = " is not null";
- } else if (temp.startsWith(QueryOptionConstant.ISNULL)) {
- parentOidSql = " is null";
- } else if (temp.contains("*")) {
- parentOidSql = " like " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'").replace("*", "%");
- } else {
- parentOidSql = " = " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
- }
+ if (queryObject.getParentOid() == null) {
+ LambdaQueryWrapper<CodeClassify> lqw = new LambdaQueryWrapper<>();
+ String parentValue = referConfigVO.getParentValue().substring(3);
+ lqw.inSql(CodeClassify::getOid, parentValue);
+ List<String> codeClassifies = classifyService.select1(lqw);
+ String oid = codeClassifies.get(0);
+ queryObject.setParentOid(oid);
+ }
+ String oidFieldName = StringUtils.isNotBlank(referConfigVO.getParentUsedField()) ? referConfigVO.getParentUsedField() : referConfigVO.getValueField();
+ if (queryObject.isQueryAllLevel()) {
+ String parentOidSql = "";
+ if (StringUtils.isNotBlank(referConfigVO.getParentValue())) {
+ String temp = referConfigVO.getParentValue();
+ if (temp.startsWith(QueryOptionConstant.IN)) {
+ temp = temp.substring((QueryOptionConstant.IN).length()).trim();
+ parentOidSql = " in " + ((temp.startsWith("(") && temp.endsWith(")")) ? temp : "(" + temp + ")");
+ } else if (temp.startsWith(QueryOptionConstant.NOTIN)) {
+ parentOidSql = " not in " + ((temp.startsWith("(") && temp.endsWith(")")) ? temp : "(" + temp + ")");
+ } else if (temp.startsWith(QueryOptionConstant.NOTEQUAL)) {
+ temp = temp.substring((QueryOptionConstant.NOTEQUAL).length()).trim();
+ parentOidSql = QueryOptionConstant.NOTEQUAL + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
+ } else if (temp.startsWith(QueryOptionConstant.MORETHAN)) {
+ temp = temp.substring((QueryOptionConstant.MORETHAN).length()).trim();
+ parentOidSql = QueryOptionConstant.MORETHAN + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
+ } else if (temp.startsWith(QueryOptionConstant.MORE)) {
+ temp = temp.substring((QueryOptionConstant.MORE).length()).trim();
+ parentOidSql = QueryOptionConstant.MORE + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
+ } else if (temp.startsWith(QueryOptionConstant.LESSTHAN)) {
+ temp = temp.substring((QueryOptionConstant.LESSTHAN).length()).trim();
+ parentOidSql = QueryOptionConstant.LESSTHAN + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
+ } else if (temp.startsWith(QueryOptionConstant.LESS)) {
+ temp = temp.substring((QueryOptionConstant.LESS).length()).trim();
+ parentOidSql = QueryOptionConstant.LESS + " " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
+ } else if (temp.startsWith(QueryOptionConstant.ISNOTNULL)) {
+ parentOidSql = " is not null";
+ } else if (temp.startsWith(QueryOptionConstant.ISNULL)) {
+ parentOidSql = " is null";
+ } else if (temp.contains("*")) {
+ parentOidSql = " like " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'").replace("*", "%");
+ } else {
+ parentOidSql = " = " + ((temp.startsWith("'") && temp.endsWith("'")) ? temp : "'" + temp + "'");
+ }
- }
- //鏌ヨ鍏ㄩ儴鐨勪俊鎭�
- queryObject.getConditionMap().put("oid", QueryOptionConstant.IN + "(select oid from " +
- getTableName(referConfigVO.getReferType()) +
- " START WITH " + referConfigVO.getParentFieldName() + " " +
- parentOidSql +
- " CONNECT BY PRIOR " + oidFieldName + " = " + referConfigVO.getParentFieldName() + ")");
- } else {
- if (StringUtils.isNotBlank(referConfigVO.getParentFieldName()) && StringUtils.isNotBlank(queryObject.getParentOid())) {
- queryObject.getConditionMap().put(referConfigVO.getParentFieldName(), queryObject.getParentOid());
+ }
+ //鏌ヨ鍏ㄩ儴鐨勪俊鎭�
+ queryObject.getConditionMap().put("oid", QueryOptionConstant.IN + "(select oid from " +
+ getTableName(referConfigVO.getReferType()) +
+ " START WITH " + referConfigVO.getParentFieldName() + " " +
+ parentOidSql +
+ " CONNECT BY PRIOR " + oidFieldName + " = " + referConfigVO.getParentFieldName() + ")");
+ } else {
+ if (StringUtils.isNotBlank(referConfigVO.getParentFieldName()) && StringUtils.isNotBlank(queryObject.getParentOid())) {
+ queryObject.getConditionMap().put(referConfigVO.getParentFieldName(), queryObject.getParentOid());
//鏌ヨ鍏ㄩ儴鐨勪俊鎭�
String parentOidSql = "";
if (StringUtils.isNotBlank(referConfigVO.getParentValue())) {
@@ -4595,69 +4607,69 @@
parentOidSql +
" CONNECT BY PRIOR " + oidFieldName + " = " + referConfigVO.getParentFieldName() + ")");
}
- }
- LambdaQueryWrapper<CodeClassify> lqw = new LambdaQueryWrapper<>();
- String sql = queryObject.getConditionMap().get("oid").substring(3);
- lqw.inSql(CodeClassify::getOid, sql);
- List<CodeClassify> codeClassifies = classifyService.selectByWrapper(lqw);
- TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(referConfigVO.getParentFieldName());
- treeWrapperOptions.setOidFieldName(oidFieldName);
- treeWrapperOptions.setTextFieldName(referConfigVO.getTextField());
- treeWrapperOptions.setMultipleSelect(referConfigVO.isMuti());
- treeWrapperOptions.setParentOid(queryObject.getParentOid());
- return revisionModelUtil.doList2Trees(codeClassifies, treeWrapperOptions, null);
- }
+ }
+ LambdaQueryWrapper<CodeClassify> lqw = new LambdaQueryWrapper<>();
+ String sql = queryObject.getConditionMap().get("oid").substring(3);
+ lqw.inSql(CodeClassify::getOid, sql);
+ List<CodeClassify> codeClassifies = classifyService.selectByWrapper(lqw);
+ TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(referConfigVO.getParentFieldName());
+ treeWrapperOptions.setOidFieldName(oidFieldName);
+ treeWrapperOptions.setTextFieldName(referConfigVO.getTextField());
+ treeWrapperOptions.setMultipleSelect(referConfigVO.isMuti());
+ treeWrapperOptions.setParentOid(queryObject.getParentOid());
+ return revisionModelUtil.doList2Trees(codeClassifies, treeWrapperOptions, null);
+ }
- @Override
- public boolean checkUnAttrUnEdit(String attrName) {
- return (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName)
- || "ts".equalsIgnoreCase(attrName)
- || "lastmodifier".equalsIgnoreCase(attrName)
- || "lastmodifytime".equalsIgnoreCase(attrName)
- || "createtime".equalsIgnoreCase(attrName)
- || "checkintime".equalsIgnoreCase(attrName)
- || "checkouttime".equalsIgnoreCase(attrName));
- }
+ @Override
+ public boolean checkUnAttrUnEdit(String attrName) {
+ return (VciQueryWrapperForDO.OID_FIELD.equalsIgnoreCase(attrName)
+ || "ts".equalsIgnoreCase(attrName)
+ || "lastmodifier".equalsIgnoreCase(attrName)
+ || "lastmodifytime".equalsIgnoreCase(attrName)
+ || "createtime".equalsIgnoreCase(attrName)
+ || "checkintime".equalsIgnoreCase(attrName)
+ || "checkouttime".equalsIgnoreCase(attrName));
+ }
- private String getTableName(String refertype) {
- if ("codeclassify".equals(refertype)) {
- return "pl_code_classify";
- }
- if ("table".equals(refertype)) {
- return "pl_code_test_table";
- }
- if ("testBtmType".equals(refertype)) {
- return "PLBT_code_testBtmType";
- }
+ private String getTableName(String refertype) {
+ if ("codeclassify".equals(refertype)) {
+ return "pl_code_classify";
+ }
+ if ("table".equals(refertype)) {
+ return "pl_code_test_table";
+ }
+ if ("testBtmType".equals(refertype)) {
+ return "PLBT_code_testBtmType";
+ }
- return "pl_code_" + refertype.trim().toLowerCase();
- }
+ return "pl_code_" + refertype.trim().toLowerCase();
+ }
- public BaseModel reviseBusinessObject(BaseModel fromBo) {
- BaseModel toBo = new BaseModel();
- toBo.setOid(VciBaseUtil.getPk());
- toBo.setRevisionOid(VciBaseUtil.getPk());
- toBo.setNameOid(fromBo.getNameOid());
- toBo.setBtmname(fromBo.getBtmname());
- toBo.setLastR(String.valueOf(1));
+ public BaseModel reviseBusinessObject(BaseModel fromBo) {
+ BaseModel toBo = new BaseModel();
+ toBo.setOid(VciBaseUtil.getPk());
+ toBo.setRevisionOid(VciBaseUtil.getPk());
+ toBo.setNameOid(fromBo.getNameOid());
+ toBo.setBtmname(fromBo.getBtmname());
+ toBo.setLastR(String.valueOf(1));
// 鍗囩増灏咶irstR淇敼涓�0
- toBo.setFirstR(String.valueOf(0));
- toBo.setFirstV(String.valueOf(1));
- toBo.setLastV(String.valueOf(1));
+ toBo.setFirstR(String.valueOf(0));
+ toBo.setFirstV(String.valueOf(1));
+ toBo.setLastV(String.valueOf(1));
// 鏁版嵁鍗囩増涓嶉渶瑕侀噸鏂拌缃垱寤轰汉锛屽彧瀵规渶鍚庝慨鏀逛汉鍋氭洿鏂板氨鍙互浜�
- //toBo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));
- toBo.setCreateTime(fromBo.getCreateTime());
- // toBo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId()));
+ //toBo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));
+ toBo.setCreateTime(fromBo.getCreateTime());
+ // toBo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId()));
toBo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
- toBo.setLastModifyTime(new Date());
- toBo.setRevisionRule(fromBo.getRevisionRule());
- toBo.setVersionRule(fromBo.getVersionRule());
+ toBo.setLastModifyTime(new Date());
+ toBo.setRevisionRule(fromBo.getRevisionRule());
+ toBo.setVersionRule(fromBo.getVersionRule());
//鏌ヨ涓氬姟绫诲瀷淇℃伅锛屽彲浠ヨ幏鍙栧埌鐗堟湰瑙勫垯淇℃伅锛坮evisionRuleId锛�
R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(fromBo.getBtmname()));
- if (!listR.isSuccess() || listR.getData().size() == 0) {
- throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
- }
- //Map<String, Object> nextRevision = commonsMapper.getNextRevision(listR.getData().get(0).getTableName(), fromBo.getNameOid());
+ if (!listR.isSuccess() || listR.getData().size() == 0) {
+ throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+ }
+ //Map<String, Object> nextRevision = commonsMapper.getNextRevision(listR.getData().get(0).getTableName(), fromBo.getNameOid());
/*
TODO:杩欐槸涓�涓緟鍚庢湡瀹屽杽鐨勫姛鑳斤紝鐩墠瀹炵幇鏂瑰紡鏄紝鍏堟煡璇㈠嚭褰撳墠鏁版嵁鐨勫ぇ鐗堟湰瑙勫垯锛�
鐒跺悗鍐嶆煡璇笟鍔¤〃浣跨敤鐨勮鍒欑殑姝ラ暱鏄灏戠劧鍚庤绠楀嚭璇ュ崌鐗堜负澶氬皯
@@ -4666,30 +4678,31 @@
R<RevisionRuleVO> revisionRuleVOR = revisionRuleClient.selectById(listR.getData().get(0).getRevisionRuleId());
String revisionval = nextRevision.get("REVISIONVAL").toString();
// 鏈煡璇㈠埌鐗堟湰瑙勫垯锛岄粯璁ょ洿鎺ョ粰澶х増鏈姞涓�
- if(!revisionRuleVOR.isSuccess() || Func.isEmpty(revisionRuleVOR.getData())){
- revisionval = String.valueOf((Integer.parseInt(revisionval)+1));
- }else {
- revisionval = String.valueOf(Integer.parseInt(revisionval)+revisionRuleVOR.getData().getSerialStep());
+ if (!revisionRuleVOR.isSuccess() || Func.isEmpty(revisionRuleVOR.getData())) {
+ revisionval = String.valueOf((Integer.parseInt(revisionval) + 1));
+ } else {
+ revisionval = String.valueOf(Integer.parseInt(revisionval) + revisionRuleVOR.getData().getSerialStep());
}
toBo.setRevisionValue(revisionval);
toBo.setRevisionSeq(Integer.parseInt(nextRevision.get("REVISIONSEQ").toString()));
- toBo.setVersionSeq(Integer.valueOf(nextRevision.get("VERSIONSEQ").toString()));
- toBo.setVersionValue(nextRevision.get("VERSIONVAL").toString());
- toBo.setLctid(fromBo.getLctid());
- //toBo.setLcStatus("Editing");
+ toBo.setVersionSeq(Integer.valueOf(nextRevision.get("VERSIONSEQ").toString()));
+ toBo.setVersionValue(nextRevision.get("VERSIONVAL").toString());
+ toBo.setLctid(fromBo.getLctid());
+ //toBo.setLcStatus("Editing");
toBo.setLcStatus(CodeDefaultLC.RELEASED.getValue());
- toBo.setId(fromBo.getId());
- toBo.setName(fromBo.getName());
- toBo.setDescription(fromBo.getDescription());
- toBo.setOwner(String.valueOf(AuthUtil.getUser().getUserId()));
- toBo.setCopyFromVersion(fromBo.getOid());
- toBo.getData().putAll(fromBo.getData());
- toBo.getData().put("CHECKINBY", String.valueOf(AuthUtil.getUser().getUserId()));
- return toBo;
- }
+ toBo.setId(fromBo.getId());
+ toBo.setName(fromBo.getName());
+ toBo.setDescription(fromBo.getDescription());
+ toBo.setOwner(String.valueOf(AuthUtil.getUser().getUserId()));
+ toBo.setCopyFromVersion(fromBo.getOid());
+ toBo.getData().putAll(fromBo.getData());
+ toBo.getData().put("CHECKINBY", String.valueOf(AuthUtil.getUser().getUserId()));
+ return toBo;
+ }
/**
* 娴佺▼涓彉鏇寸姸鎬佸��
+ *
* @param flowDTO
* @return
*/
@@ -4699,7 +4712,7 @@
BaseModelDTO baseModel = new BaseModelDTO();
baseModel.setOid(s);
baseModel.setBtmname(flowDTO.getBtmType());
- baseModel.setLcStatus(String.valueOf(flowDTO.getVariableMap().getOrDefault("statusValue","Auditing")));
+ baseModel.setLcStatus(String.valueOf(flowDTO.getVariableMap().getOrDefault("statusValue", "Auditing")));
changeStatus(baseModel);
});
return R.success("鎴愬姛");
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/ClassifyAuthController.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/ClassifyAuthController.java
index 9c232f7..44ae6dc 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/ClassifyAuthController.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/ClassifyAuthController.java
@@ -1,7 +1,6 @@
package com.vci.ubcs.system.controller;
import com.vci.ubcs.system.entity.ClassifyAuth;
-import com.vci.ubcs.system.entity.Menu;
import com.vci.ubcs.system.service.IClassifyAuthService;
import com.vci.ubcs.system.vo.ClassifyAuthVO;
import io.swagger.annotations.Api;
@@ -11,11 +10,12 @@
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
+import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
- * 鍒嗙被鎺堟潈
+ * 鍒嗙被鎺堟潈,鏁版嵁鎺堟潈
* @author ludc
* @date 2023/12/20 11:33
*/
@@ -52,11 +52,13 @@
/**
* 鏌ヨ璇ュ垎绫讳笅锛屽綋鍓嶇櫥褰曠殑瑙掕壊鏈夊摢浜涙寜閽潈闄�
* @param classifyId
+ * @param menuCode
+ * @param authType
* @return
*/
@GetMapping("/getAuthButtonList")
- public R<Map<String,Boolean>> getAuthButtonList(@RequestParam("classifyId") String classifyId){
- return R.data(classifyAuthService.getAuthButtonList(classifyId));
+ public R<Map<String,Boolean>> getAuthButtonList(@Valid @RequestParam("classifyId") String classifyId,@Valid @RequestParam("code") String menuCode,@Valid @RequestParam("authType") String authType){
+ return R.data(classifyAuthService.getAuthButtonList(classifyId,menuCode,authType));
}
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/MenuController.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/MenuController.java
index adbaaa5..a535ce9 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/MenuController.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/MenuController.java
@@ -317,4 +317,14 @@
return menuService.cloneMenuButton(buttonCloneVO.getMenuId(), buttonCloneVO.getButtonIds());
}
+ /**
+ * 鏍规嵁瑙掕壊id鑾峰彇宸叉巿鏉冪殑鎸夐挳淇℃伅
+ * @param roleId
+ * @return
+ */
+ @GetMapping("/getButtonsByRoleId")
+ public R<List<Menu>> getButtonsByRoleId(@Valid @RequestParam("roleId") String roleId,@Valid @RequestParam("code") String menuCode){
+ return R.data(menuService.getButtonsByRoleId(roleId,menuCode));
+ }
+
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java
index 508ea8d..7217d10 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java
@@ -22,6 +22,7 @@
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.vci.ubcs.system.cache.NacosConfigCache;
import com.vci.ubcs.system.cache.SysCache;
+import com.vci.ubcs.system.entity.Menu;
import com.vci.ubcs.system.entity.Role;
import com.vci.ubcs.system.service.IRoleService;
import com.vci.ubcs.system.user.cache.UserCache;
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/feign/SysClient.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/feign/SysClient.java
index f96ff31..3716e18 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/feign/SysClient.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/feign/SysClient.java
@@ -83,8 +83,8 @@
@Override
@GetMapping(MENU_BUTTON)
- public R<List<Menu>> getMenuButtonByType(String btmType) {
- return R.data(menuService.getMenuButtonByType(btmType, AuthUtil.getUserId()));
+ public R<List<Menu>> getMenuButtonByType(String classifyId,String btmType,String authType) {
+ return R.data(menuService.getMenuButtonByType(classifyId,btmType,authType));
}
@Override
@@ -264,8 +264,8 @@
return R.data(mdmCountConfigService.getMdmCountConfig(userId));
}
- public R<List<String>> getViewClassByRoleIds(List<String> roleIds){
- return R.data(classifyAuthService.getViewClassByRoleIds(roleIds));
+ public R<List<String>> getViewClassByRoleIds(List<String> roleIds,String authType,String buttonCode,String menuCode){
+ return R.data(classifyAuthService.getViewClassByRoleIds(roleIds,authType,buttonCode,menuCode));
}
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/ClassifyAuthMapper.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/ClassifyAuthMapper.java
index 0333c0b..c30608c 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/ClassifyAuthMapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/ClassifyAuthMapper.java
@@ -7,6 +7,7 @@
import java.util.List;
/**
+ * 鍒嗙被鎺堟潈,鏁版嵁鎺堟潈
* @author ludc
* @date 2023/12/25 15:50
*/
@@ -14,6 +15,6 @@
List<ClassifyAuth> getClassifyAuthList(@Param("classifyId") String classifyId);
- List<String> getViewClassByRoleIds(@Param("roleIds") List<String> roleIds);
+ List<String> getViewClassByRoleIds(@Param("roleIds") List<String> roleIds,@Param("authType") String authType,@Param("buttonCode") String buttonCode,@Param("menuCode") String menuCode);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/MenuMapper.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/MenuMapper.java
index e1e77e7..1c19e5c 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/MenuMapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/mapper/MenuMapper.java
@@ -135,11 +135,18 @@
List<Menu> selectMenuChildByBtnType(String btmType,List<String> roleIds);
/**
- * 鏍规嵁鐖惰彍鍗昪ode鏌ヨ鑿滃崟鐨勫瓙鎸夐挳
+ * 鏍规嵁鐖惰彍鍗昪ode鍜岃鑹瞚d鑾峰彇宸叉巿鏉冪殑鎸夐挳淇℃伅
*
* @return
*/
- List<Menu> getButtonByParentCode(@Param("code") String code);
+ List<Menu> getButtonsByRoleIdAndCode(@Param("roleId") String roleId, @Param("code") String code);
+
+ /**
+ * 鏍规嵁鐖惰彍鍗昪ode鍜岃鑹瞚d鑾峰彇宸叉巿鏉冪殑鎸夐挳淇℃伅
+ *
+ * @return
+ */
+ List<Menu> getButtonByIdsOrByParentCode(@Param("roleIds") String roleIds, @Param("code") String code,@Param("ids") List<String> ids);
/**
* 鏉冮檺閰嶇疆鑿滃崟
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IClassifyAuthService.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IClassifyAuthService.java
index 7fcb85f..71b0907 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IClassifyAuthService.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IClassifyAuthService.java
@@ -10,7 +10,7 @@
import java.util.Map;
/**
- * 鍒嗙被鎺堟潈
+ * 鍒嗙被鎺堟潈,鏁版嵁鎺堟潈
* @author ludc
* @date 2023/12/25 15:34
*/
@@ -33,15 +33,26 @@
/**
* 鏌ヨ璇ュ垎绫讳笅锛屽綋鍓嶇櫥褰曠殑瑙掕壊鏈夊摢浜涙寜閽潈闄�
* @param classifyId
+ * @param menuCode
+ * @param authType
* @return
*/
- Map<String,Boolean> getAuthButtonList(String classifyId);
+ Map<String,Boolean> getAuthButtonList(String classifyId,String menuCode,String authType);
+
+ /**
+ * 鏌ヨ璇ヤ富鏁版嵁涓嬶紝褰撳墠鐧诲綍鐨勮鑹叉湁鍝簺鎸夐挳鏉冮檺
+ * @param classifyId
+ * @param menuCode
+ * @param authType
+ * @return
+ */
+ List<Menu> getAuthMenuButtonList(String classifyId,String menuCode,String authType);
/**
* 鏍规嵁瑙掕壊id鏌ョ湅鏈夊摢浜涘垎绫诲叿澶囨煡鐪嬫潈闄�
* @param roleIds
* @return
*/
- List<String> getViewClassByRoleIds(List<String> roleIds);
+ List<String> getViewClassByRoleIds(List<String> roleIds,String authType,String buttonCode,String menuCode);
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IMenuService.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IMenuService.java
index c49017d..0708dd5 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IMenuService.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IMenuService.java
@@ -175,10 +175,12 @@
/**
* 鑾峰彇鑿滃崟涓嬮潰鐨勬寜閽�
- * @param btmType 涓氬姟绫诲瀷
- * @return List<Menu>
+ * @param classifyId
+ * @param btmType
+ * @param authType
+ * @return
*/
- List<Menu> getMenuButtonByType(String btmType,Long userId);
+ List<Menu> getMenuButtonByType(String classifyId,String btmType, String authType);
/**
* 鏍规嵁code鍜岀敤鎴穒d鏌ヨ鑿滃崟淇℃伅
@@ -214,7 +216,18 @@
/**
* 鏍规嵁涓婚敭鑾峰彇鑿滃崟淇℃伅
* @param ids
+ * @param menuCode
+ * @param roleIds
* @return
*/
- List<Menu> getMenuListById(List<String> ids,String parentId);
+ List<Menu> getMenuListByCode(List<String> ids,String menuCode,String roleIds);
+
+ /**
+ * 鏍规嵁瑙掕壊id鑾峰彇宸叉巿鏉冪殑鎸夐挳淇℃伅
+ * @param roleId
+ * @param menuCode
+ * @return
+ */
+ List<Menu> getButtonsByRoleId(String roleId, String menuCode);
+
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IRoleService.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IRoleService.java
index 140a760..f0e102b 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IRoleService.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/IRoleService.java
@@ -18,6 +18,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.vci.ubcs.system.entity.Menu;
import com.vci.ubcs.system.entity.Role;
import com.vci.ubcs.system.vo.RoleVO;
import org.springblade.core.tool.api.R;
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java
index 72cf41b..124a39c 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java
@@ -19,6 +19,8 @@
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -26,7 +28,7 @@
import java.util.stream.Collectors;
/**
- * 鍒嗙被鎺堟潈
+ * 鍒嗙被鎺堟潈,鏁版嵁鎺堟潈
* @author ludc
* @date 2023/12/25 15:35
*/
@@ -87,7 +89,8 @@
throw new ServiceException("缂哄皯蹇呬紶鍙傛暟鍒嗙被id");
}
LambdaQueryWrapper<ClassifyAuth> wrapper = Wrappers.<ClassifyAuth>query()
- .lambda().eq(ClassifyAuth::getClassifyId,classifyAuthVO.getClassifyId());
+ .lambda().eq(ClassifyAuth::getClassifyId,classifyAuthVO.getClassifyId())
+ .eq(ClassifyAuth::getAuthType,classifyAuthVO.getAuthType());
List<ClassifyAuth> classifyAuths = this.classifyAuthMapper.selectList(wrapper);
if(classifyAuths.isEmpty()){
return new ArrayList<ClassifyAuthVO>();
@@ -98,9 +101,33 @@
/**
* 鏌ヨ璇ュ垎绫讳笅锛屽綋鍓嶇櫥褰曠殑瑙掕壊鏈夊摢浜涙寜閽潈闄�
* @param classifyId
+ * @param menuCode
+ * @param authType
* @return
*/
- public Map<String,Boolean> getAuthButtonList(String classifyId){
+ public Map<String,Boolean> getAuthButtonList(String classifyId,String menuCode,String authType){
+ List<Menu> menuList = this.getButtonList(classifyId, menuCode, authType);
+ if(menuList.isEmpty()){
+ return new HashMap<>();
+ }
+ Map<String, Boolean> buttonMaps = menuList.stream()
+ .collect(Collectors.toMap(Menu::getCode, menu -> true));
+ return buttonMaps;
+ }
+
+ /**
+ * 鏌ヨ璇ヤ富鏁版嵁涓嬶紝褰撳墠鐧诲綍鐨勮鑹叉湁鍝簺鎸夐挳鑿滃崟鏉冮檺
+ * @param classifyId
+ * @param menuCode
+ * @param authType
+ * @return
+ */
+ public List<Menu> getAuthMenuButtonList(String classifyId,String menuCode,String authType){
+ List<Menu> buttonList = getButtonList(classifyId, menuCode, authType);
+ return buttonList;
+ }
+
+ private List<Menu> getButtonList(String classifyId,String menuCode,String authType){
if(Func.isBlank(classifyId)){
throw new ServiceException("蹇呬紶鍙傛暟鍒嗙被oid涓嶈兘涓虹┖锛�");
}
@@ -115,6 +142,7 @@
// 鍏堟煡璇㈡寜閽甶d鍒楄〃
LambdaQueryWrapper<ClassifyAuth> wrapper = Wrappers.<ClassifyAuth>query()
.lambda().eq(ClassifyAuth::getClassifyId, classifyId)
+ .eq(ClassifyAuth::getAuthType,authType)
.in(ClassifyAuth::getRoleId, roleIds);
List<ClassifyAuth> classifyAuths = this.classifyAuthMapper.selectList(wrapper);
//濡傛灉褰撳墠鍒嗙被娌℃湁鎵惧埌鎺堟潈閰嶇疆锛屽氨渚濇浠庡綋鍓嶈妭鐐瑰線涓婂眰鑺傜偣鎵炬巿鏉冮厤缃紝鎵惧埌浜嗗氨鍋滄锛屾病鎵惧埌灏变竴鐩存壘鍒版渶鍚�
@@ -139,20 +167,14 @@
Boolean isAdmin = VciBaseUtil.checkAdminTenant();
// 鏈厤缃寜閽潈闄�
if(!isAdmin && (classifyAuths.isEmpty() || Func.isBlank(classifyAuths.get(0).getButtonIds()))){
- return new HashMap<>();
+ return new ArrayList<>();
}
- List<String> condition1 = new ArrayList<>();
+ List<String> ids = new ArrayList<>();
// 濡傛灉涓嶆槸瓒呯鐢ㄦ埛
if(!isAdmin){
- condition1.addAll(Arrays.asList(classifyAuths.get(0).getButtonIds().split(",")));
+ ids.addAll(Arrays.asList(classifyAuths.get(0).getButtonIds().split(",")));
}
- List<Menu> menuList = menuService.getMenuListById(condition1,"1648879284590858241");
- if(menuList.isEmpty()){
- return new HashMap<>();
- }
- Map<String, Boolean> buttonMaps = menuList.stream()
- .collect(Collectors.toMap(Menu::getCode, menu -> true));
- return buttonMaps;
+ return menuService.getMenuListByCode(ids,menuCode,roleIds);
}
/**
@@ -161,11 +183,11 @@
* @return
*/
@Override
- public List<String> getViewClassByRoleIds(List<String> roleIds) {
+ public List<String> getViewClassByRoleIds(List<String> roleIds,String authType,String buttonCode,String menuCode) {
if(roleIds.isEmpty()){
return new ArrayList<>();
}
- return this.classifyAuthMapper.getViewClassByRoleIds(roleIds);
+ return this.classifyAuthMapper.getViewClassByRoleIds(roleIds, authType,buttonCode,menuCode);
}
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/MenuServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/MenuServiceImpl.java
index 50fdfa6..c577eee 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/MenuServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/MenuServiceImpl.java
@@ -21,18 +21,17 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.vci.ubcs.code.feign.ICodeClassifyClient;
import com.vci.ubcs.starter.util.MybatisParameterUtil;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import com.vci.ubcs.system.cache.NacosConfigCache;
import com.vci.ubcs.system.cache.SysCache;
import com.vci.ubcs.system.dto.MenuDTO;
import com.vci.ubcs.system.entity.*;
+import com.vci.ubcs.system.mapper.ClassifyAuthMapper;
+import com.vci.ubcs.system.service.*;
import com.vci.ubcs.system.vo.MenuVO;
import com.vci.ubcs.system.mapper.MenuMapper;
-import com.vci.ubcs.system.service.IMenuService;
-import com.vci.ubcs.system.service.IRoleMenuService;
-import com.vci.ubcs.system.service.IRoleScopeService;
-import com.vci.ubcs.system.service.ITopMenuSettingService;
import com.vci.ubcs.system.wrapper.MenuWrapper;
import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
@@ -70,6 +69,8 @@
private final IRoleScopeService roleScopeService;
private final MenuMapper menuMapper;
private final ITopMenuSettingService topMenuSettingService;
+ private final ICodeClassifyClient codeClassifyClient;
+ private final ClassifyAuthMapper classifyAuthMapper;
private final static String PARENT_ID = "parentId";
private final static Integer MENU_CATEGORY = 1;
@@ -98,7 +99,6 @@
List<Menu> allMenus = baseMapper.allMenu();
List<Menu> roleMenus;
// 瓒呯骇绠$悊鍛樺苟涓斾笉鏄《閮ㄨ彍鍗曡姹傚垯杩斿洖鍏ㄩ儴鑿滃崟
- // if (AuthUtil.isAdministrator() && Func.isEmpty(topMenuId)) {
if (VciBaseUtil.checkAdminTenant() && Func.isEmpty(topMenuId)) {
roleMenus = allMenus;
}
@@ -228,6 +228,7 @@
* 绉熸埛鑿滃崟鏉冮檺鑷畾涔夌瓫閫�
*/
private List<Menu> tenantPackageMenu(List<Menu> menu) {
+ // 绉熸埛鍖呴厤缃煡璇�
TenantPackage tenantPackage = SysCache.getTenantPackage(AuthUtil.getTenantId());
if (Func.isNotEmpty(tenantPackage) && tenantPackage.getId() > 0L) {
List<Long> menuIds = Func.toLongList(tenantPackage.getMenuId());
@@ -324,18 +325,63 @@
}
/**
- * 鑾峰彇鑿滃崟涓嬮潰鐨勬寜閽�
+ * 鑾峰彇鑿滃崟涓嬮潰鐨勬寜閽紝鍒贡璋冪敤锛岃繖涓柟娉曟槸閽堝涓绘暟鎹鐞嗘寜閽煡璇㈢殑
+ * @param classifyId
* @param btmType 涓氬姟绫诲瀷
- * @return List<Menu>
+ * @param authType
+ * @return
*/
@Override
//@Cacheable(cacheNames = MENU_CACHE, key = "'auth:menuButton:'+ #btmType +':'+ #userId ")
- public List<Menu> getMenuButtonByType(String btmType,Long userId) {
- List<String> roleIds = null;
- if(!VciBaseUtil.checkAdminTenant()){
- roleIds = Arrays.asList(AuthUtil.getUser().getRoleId().split(","));
+ public List<Menu> getMenuButtonByType(String classifyId,String btmType,String authType) {
+ // baseMapper.selectMenuChildByBtnType(btmType,roleIds);
+ if(Func.isBlank(classifyId)){
+ throw new ServiceException("蹇呬紶鍙傛暟鍒嗙被oid涓嶈兘涓虹┖锛�");
}
- return baseMapper.selectMenuChildByBtnType(btmType,roleIds);
+ //鏌ヨ鍒嗙被鑺傜偣鐨勬墍鏈夌埗绾ц妭鐐�
+ R<List<String>> listR = codeClassifyClient.selectAllParentOid(classifyId);
+ if (!listR.isSuccess() && !listR.getData().isEmpty()) {
+ throw new ServiceException("鑾峰彇鍒嗙被淇℃伅澶辫触锛�");
+ }
+ // 杩斿洖鐨勫垎绫籵id鏄綋鍓嶈妭鐐逛负绗竴涓紝鍚庨潰渚濇鏄粬鐨勪笂灞傝妭鐐�
+ List<String> classifyOidList = listR.getData();
+ final String roleIds = AuthUtil.getUser().getRoleId();
+ // 鍏堟煡璇㈡寜閽甶d鍒楄〃
+ LambdaQueryWrapper<ClassifyAuth> wrapper = Wrappers.<ClassifyAuth>query()
+ .lambda().eq(ClassifyAuth::getClassifyId, classifyId)
+ .eq(ClassifyAuth::getAuthType,authType)
+ .in(ClassifyAuth::getRoleId, roleIds);
+ List<ClassifyAuth> classifyAuths = classifyAuthMapper.selectList(wrapper);
+ //濡傛灉褰撳墠鍒嗙被娌℃湁鎵惧埌鎺堟潈閰嶇疆锛屽氨渚濇浠庡綋鍓嶈妭鐐瑰線涓婂眰鑺傜偣鎵炬巿鏉冮厤缃紝鎵惧埌浜嗗氨鍋滄锛屾病鎵惧埌灏变竴鐩存壘鍒版渶鍚�
+ if(classifyAuths.isEmpty()){
+ // 涓嬫爣浠�1寮�濮嬪洜涓哄綋鍓嶈妭鐐�0宸茬粡鏌ヨ杩�
+ for (int i = 1; i < classifyOidList.size(); i++) {
+ classifyAuths = classifyAuthMapper.selectList(
+ Wrappers.<ClassifyAuth>query()
+ .lambda().eq(ClassifyAuth::getClassifyId, classifyOidList.get(i))
+ .in(ClassifyAuth::getRoleId, roleIds)
+ );
+ if(!classifyAuths.isEmpty()){
+ break;
+ }
+ }
+ }
+ //鍑虹幇浜嗛敊璇暟鎹紝鍚屼竴涓鑹插拰鍚屼竴涓垎绫籭d瀛樺湪澶氭潯鎺堟潈璁板綍
+ if(classifyAuths.size()>1){
+ throw new ServiceException("瑙掕壊鍜屽垎绫婚厤缃瓨鍦ㄥ鏉¤褰曪紝璇疯仈绯荤鐞嗕汉鍛樻竻鐞嗛敊璇厤缃紒");
+ }
+ // 鏄惁涓鸿秴绠�
+ Boolean isAdmin = VciBaseUtil.checkAdminTenant();
+ // 鏈厤缃寜閽潈闄�
+ if(!isAdmin && (classifyAuths.isEmpty() || Func.isBlank(classifyAuths.get(0).getButtonIds()))){
+ return new ArrayList<>();
+ }
+ List<String> ids = new ArrayList<>();
+ // 濡傛灉涓嶆槸瓒呯鐢ㄦ埛
+ if(!isAdmin){
+ ids.addAll(Arrays.asList(classifyAuths.get(0).getButtonIds().split(",")));
+ }
+ return this.getMenuListByCode(ids,btmType,roleIds);
}
/**
@@ -381,8 +427,7 @@
*/
@Override
public List<Menu> getButtonByParentCode(String code) {
- List<Menu> buttonList = menuMapper.getButtonByParentCode(code);
- return buttonList;
+ return menuMapper.getButtonsByRoleIdAndCode(null,code);
}
/**
@@ -444,20 +489,31 @@
/**
* 鏍规嵁涓婚敭鑾峰彇鑿滃崟淇℃伅
* @param ids
+ * @param menuCode
+ * @param roleIds
* @return
*/
@Override
- public List<Menu> getMenuListById(List<String> ids,String parentId) {
- LambdaQueryWrapper<Menu> wrapper = Wrappers.<Menu>query()
- .lambda().eq(Menu::getCategory, "2")
- .eq(Menu::getIsDeleted,BladeConstant.DB_NOT_DELETED);
+ public List<Menu> getMenuListByCode(List<String> ids,String menuCode,String roleIds){
+ List<Menu> menuButtonList = null;
if(VciBaseUtil.checkAdminTenant()){
- wrapper.eq(Menu::getParentId,parentId);
+ // 姝e父鎯呭喌涓嬫潵璇磋繖涓笉瀛樺湪涓虹┖鐨勬儏鍐�
+ // 鏌ヨ璇ヨ彍鍗曚笅鐨勬墍鏈夋寜閽�
+ menuButtonList = menuMapper.getButtonByIdsOrByParentCode(null, menuCode, null);
}else {
- wrapper.in(Menu::getId, ids);
+ menuButtonList = menuMapper.getButtonByIdsOrByParentCode(roleIds,null,ids);
}
- List<Menu> menuList = this.list(wrapper);
- return menuList;
+ return menuButtonList;
+ }
+
+ /**
+ * 鏍规嵁瑙掕壊id鑾峰彇宸叉巿鏉冪殑鎸夐挳淇℃伅
+ * @param roleId
+ * @return
+ */
+ @Override
+ public List<Menu> getButtonsByRoleId(String roleId, String menuCode) {
+ return menuMapper.getButtonsByRoleIdAndCode(roleId,menuCode);
}
}
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java
index 77a94c9..b145ad3 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/RoleServiceImpl.java
@@ -21,6 +21,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.vci.ubcs.system.entity.Menu;
import com.vci.ubcs.system.mapper.RoleMapper;
import com.vci.ubcs.system.service.IMenuService;
import com.vci.ubcs.system.service.IRoleMenuService;
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/ClassifyAuthMapper.xml b/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/ClassifyAuthMapper.xml
index 3f4c681..77a8f4d 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/ClassifyAuthMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/ClassifyAuthMapper.xml
@@ -25,10 +25,18 @@
#{item}
</foreach>
</if>
- AND BUTTON_IDS LIKE CONCAT('%', CONCAT((SELECT ID
- FROM PL_SYS_MENU
- WHERE CODE = 'classify_view'), '%'))
-
+ AND AUTH_TYPE = #{authType}
+ AND BUTTON_IDS LIKE CONCAT('%', CONCAT((
+ SELECT
+ pm.ID
+ FROM
+ PL_SYS_MENU ps,
+ PL_SYS_MENU pm
+ WHERE
+ ps.CODE = #{buttonCode}
+ AND ps.ID = pm.PARENT_ID
+ AND pm.CODE = #{menuCode}
+ ), '%'))
</select>
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/MenuMapper.xml b/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/MenuMapper.xml
index df3421c..68dd8a2 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/MenuMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/resources/mapper/MenuMapper.xml
@@ -44,19 +44,19 @@
<result column="key" property="key"/>
</resultMap>
- <select id="lazyList" resultMap="menuVOResultMap">
+ <select id="lazyList" resultMap="menuVOResultMap">
SELECT
- menu.*,
- (
- SELECT
- CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
- FROM
- pl_sys_menu
- WHERE
- parent_id = menu.id AND is_deleted = 0
+ menu.*,
+ (
+ SELECT
+ CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
+ FROM
+ pl_sys_menu
+ WHERE
+ parent_id = menu.id AND is_deleted = 0
) AS "has_children"
FROM
- pl_sys_menu menu
+ pl_sys_menu menu
WHERE menu.is_deleted = 0
<if test="param1!=null">
and menu.parent_id = #{param1}
@@ -75,17 +75,17 @@
<select id="lazyMenuPage" resultMap="menuVOResultMap">
SELECT
- menu.*,
- (
- SELECT
- CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
+ menu.*,
+ (
+ SELECT
+ CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
FROM
- pl_sys_menu
+ pl_sys_menu
WHERE
- parent_id = menu.id AND is_deleted = 0 AND category = 1
+ parent_id = menu.id AND is_deleted = 0 AND category = 1
) AS "has_children"
FROM
- pl_sys_menu menu
+ pl_sys_menu menu
WHERE menu.is_deleted = 0 AND menu.category = 1
<if test="param1!=null">
and menu.parent_id = #{param1}
@@ -103,11 +103,17 @@
</select>
<select id="tree" resultMap="treeNodeResultMap">
- select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where is_deleted = 0 and category = 1
+ select id, parent_id, name as title, id as "value", id as "key"
+ from pl_sys_menu
+ where is_deleted = 0
+ and category = 1
</select>
<select id="allMenu" resultMap="menuResultMap">
- select * from pl_sys_menu where is_deleted = 0 and category = 1
+ select *
+ from pl_sys_menu
+ where is_deleted = 0
+ and category = 1
</select>
<select id="roleMenu" resultMap="menuResultMap">
@@ -127,49 +133,56 @@
<select id="roleMenuByRoleId" resultMap="menuResultMap">
select * from pl_sys_menu where is_deleted = 0 and id IN
- ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
+ ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
</select>
<select id="roleMenuByTopMenuId" resultMap="menuResultMap">
- select * from pl_sys_menu where is_deleted = 0 and id IN
+ select *
+ from pl_sys_menu
+ where is_deleted = 0
+ and id IN
(
- SELECT menu_id FROM pl_sys_top_menu_setting WHERE top_menu_id = #{param1}
+ SELECT menu_id
+ FROM pl_sys_top_menu_setting
+ WHERE top_menu_id = #{param1}
)
</select>
<select id="routes" resultMap="menuResultMap">
SELECT
- *
+ *
FROM
- pl_sys_menu
+ pl_sys_menu
WHERE
- is_deleted = 0 and category = 1
- and id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach> )
+ is_deleted = 0 and category = 1
+ and id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
</select>
<select id="allButtons" resultMap="menuResultMap">
- SELECT
- id,
- parent_id,
- CODE,
- NAME,
- alias,
- path,
- source,
+ SELECT id,
+ parent_id,
+ CODE,
+ NAME,
+ alias,
+ path,
+ source,
action,
sort
FROM
pl_sys_menu
WHERE
(
- category = 2 OR id IN ( SELECT parent_id FROM pl_sys_menu WHERE is_deleted = 0 AND category = 2 )
+ category = 2
+ OR id IN ( SELECT parent_id FROM pl_sys_menu WHERE is_deleted = 0
+ AND category = 2 )
)
AND is_deleted = 0
ORDER BY sort
@@ -177,82 +190,78 @@
<select id="buttons" resultMap="menuResultMap">
SELECT * FROM (
- SELECT
- id,
- parent_id,
- code,
- name,
- alias,
- path,
- source,
- action,
- sort
- FROM
- pl_sys_menu
- WHERE
- is_deleted = 0 and id IN (
- SELECT parent_id FROM pl_sys_menu
- WHERE ( category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- ) ) )
- UNION ALL
+ SELECT
+ id,
+ parent_id,
+ code,
+ name,
+ alias,
+ path,
+ source,
+ action,
+ sort
+ FROM
+ pl_sys_menu
+ WHERE
+ is_deleted = 0 and id IN (
+ SELECT parent_id FROM pl_sys_menu
+ WHERE ( category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ ) ) )
+ UNION ALL
- SELECT
- id,
- parent_id,
- code,
- name,
- alias,
- path,
- source,
- action,
- sort
- FROM
- pl_sys_menu
- WHERE
- is_deleted = 0 and category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>)
+ SELECT
+ id,
+ parent_id,
+ code,
+ name,
+ alias,
+ path,
+ source,
+ action,
+ sort
+ FROM
+ pl_sys_menu
+ WHERE
+ is_deleted = 0 and category = 2 AND id IN ( SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>)
) menu ORDER BY sort
</select>
- <select id="getButtonByParentCode" resultMap="menuResultMap">
- SELECT
- id,
- parent_id,
- code,
- name,
- alias,
- PATH,
- SOURCE,
- ACTION,
- sort
- FROM
- PL_SYS_MENU
+ <select id="getButtonsByRoleIdAndCode" resultMap="menuResultMap">
+ SELECT pm.*
+ FROM PL_SYS_MENU ps,
+ PL_SYS_MENU pm
+ <if test="roleId != null and roleId != ''">
+ ,PL_ORG_ROLE_MENU prom
+ </if>
WHERE
- "CATEGORY" = '2'
- AND IS_DELETED = 0
- AND PARENT_ID IN (
- SELECT
- ID
- FROM
- PL_SYS_MENU
- WHERE
- CODE = #{code})
- ORDER BY SORT
+ ps."CATEGORY" = 1
+ <if test="roleId != null and roleId != ''">
+ AND pm.ID = prom.MENU_ID
+ AND prom.ROLE_ID = #{roleId}
+ </if>
+ AND pm.IS_DELETED = 0
+ <if test="code != null and code != ''">
+ AND ps.ID = pm.PARENT_ID
+ AND ps.CODE = #{code}
+ </if>
+ ORDER BY pm.SORT ASC
</select>
<select id="grantTree" resultMap="treeNodeResultMap">
- select
- id,
+ select id,
parent_id,
name as title,
- id as "value",
- id as "key"
- from pl_sys_menu where is_deleted = 0 order by sort
+ id as "value",
+ id as "key"
+ from pl_sys_menu
+ where is_deleted = 0
+ order by sort
</select>
<select id="grantTreeByRole" resultMap="treeNodeResultMap">
@@ -260,102 +269,95 @@
and id in ( select menu_id from pl_org_role_menu where role_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
- </foreach> )
- or id in (
- select parent_id from pl_sys_menu where is_deleted = 0
- and id in ( select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach> )
- )
- order by sort
- </select>
-
- <select id="grantTopTree" resultMap="treeNodeResultMap">
- select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where category = 1 and is_deleted = 0 order by sort
- </select>
-
- <select id="grantTopTreeByRole" resultMap="treeNodeResultMap">
- select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where category = 1 and is_deleted = 0
- and id in ( select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach> )
+ </foreach>
+ )
or id in (
select parent_id from pl_sys_menu where is_deleted = 0
and id in ( select menu_id from pl_org_role_menu where role_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
- </foreach> )
+ </foreach>
+ )
+ )
+ order by sort
+ </select>
+
+ <select id="grantTopTree" resultMap="treeNodeResultMap">
+ select id, parent_id, name as title, id as "value", id as "key"
+ from pl_sys_menu
+ where category = 1
+ and is_deleted = 0
+ order by sort
+ </select>
+
+ <select id="grantTopTreeByRole" resultMap="treeNodeResultMap">
+ select id, parent_id, name as title, id as "value", id as "key" from pl_sys_menu where category = 1 and
+ is_deleted = 0
+ and id in ( select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ or id in (
+ select parent_id from pl_sys_menu where is_deleted = 0
+ and id in ( select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
)
order by sort
</select>
<select id="grantDataScopeTree" resultMap="treeNodeResultMap">
- SELECT
- *
- FROM
- (
- SELECT
- id,
- parent_id,
- NAME AS title,
- id AS "value",
- id AS "key"
- FROM
- pl_sys_menu
- WHERE
- category = 1
- AND is_deleted = 0
- AND id IN ( SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL )
- ) menu
+ SELECT *
+ FROM (
+ SELECT id,
+ parent_id,
+ NAME AS title,
+ id AS "value",
+ id AS "key"
+ FROM pl_sys_menu
+ WHERE category = 1
+ AND is_deleted = 0
+ AND id IN (SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL)
+ ) menu
UNION ALL
- SELECT
- id,
- menu_id AS parent_id,
- scope_name AS title,
- id AS "value",
- id AS "key"
- FROM
- pl_auth_scope_data
- WHERE
- is_deleted = 0
+ SELECT id,
+ menu_id AS parent_id,
+ scope_name AS title,
+ id AS "value",
+ id AS "key"
+ FROM pl_auth_scope_data
+ WHERE is_deleted = 0
AND menu_id IS NOT NULL
</select>
<select id="grantApiScopeTree" resultMap="treeNodeResultMap">
- SELECT
- *
- FROM
- (
- SELECT
- id,
- parent_id,
- NAME AS title,
- id AS "value",
- id AS "key"
- FROM
- pl_sys_menu
- WHERE
- category = 1
- AND is_deleted = 0
- AND id IN ( SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL )
- ) menu
+ SELECT *
+ FROM (
+ SELECT id,
+ parent_id,
+ NAME AS title,
+ id AS "value",
+ id AS "key"
+ FROM pl_sys_menu
+ WHERE category = 1
+ AND is_deleted = 0
+ AND id IN (SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL)
+ ) menu
UNION ALL
- SELECT
- id,
- menu_id AS parent_id,
- scope_name AS title,
- id AS "value",
- id AS "key"
- FROM
- pl_auth_scope_api
- WHERE
- is_deleted = 0
+ SELECT id,
+ menu_id AS parent_id,
+ scope_name AS title,
+ id AS "value",
+ id AS "key"
+ FROM pl_auth_scope_api
+ WHERE is_deleted = 0
AND menu_id IS NOT NULL
</select>
@@ -364,61 +366,63 @@
*
FROM
(
- SELECT
- id,
- parent_id,
- NAME AS title,
- id AS "value",
- id AS "key"
- FROM
- pl_sys_menu
- WHERE
- category = 1
- AND is_deleted = 0
- AND id IN ( SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL )
- AND (
- id IN (
- select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
- OR id IN (
- select parent_id from pl_sys_menu where is_deleted = 0
- and id in ( select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach> )
- )
- )
+ SELECT
+ id,
+ parent_id,
+ NAME AS title,
+ id AS "value",
+ id AS "key"
+ FROM
+ pl_sys_menu
+ WHERE
+ category = 1
+ AND is_deleted = 0
+ AND id IN ( SELECT menu_id FROM pl_auth_scope_data WHERE is_deleted = 0 AND menu_id IS NOT NULL )
+ AND (
+ id IN (
+ select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ OR id IN (
+ select parent_id from pl_sys_menu where is_deleted = 0
+ and id in ( select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ )
+ )
) menu
UNION ALL
SELECT
- id,
- menu_id AS parent_id,
- scope_name AS title,
- id AS "value",
- id AS "key"
+ id,
+ menu_id AS parent_id,
+ scope_name AS title,
+ id AS "value",
+ id AS "key"
FROM
- pl_auth_scope_data
+ pl_auth_scope_data
WHERE
- is_deleted = 0
+ is_deleted = 0
AND (
- menu_id IN (
- select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
- OR menu_id IN (
- select parent_id from pl_sys_menu where is_deleted = 0
- and id in ( select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach> )
- )
+ menu_id IN (
+ select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ OR menu_id IN (
+ select parent_id from pl_sys_menu where is_deleted = 0
+ and id in ( select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ )
)
AND menu_id IS NOT NULL
</select>
@@ -428,100 +432,133 @@
*
FROM
(
- SELECT
- id,
- parent_id,
- NAME AS title,
- id AS "value",
- id AS "key"
- FROM
- pl_sys_menu
- WHERE
- category = 1
- AND is_deleted = 0
- AND id IN ( SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL )
- AND (
- id IN (
- select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
- OR id IN (
- select parent_id from pl_sys_menu where is_deleted = 0
- and id in (
- select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach> )
- )
- )
+ SELECT
+ id,
+ parent_id,
+ NAME AS title,
+ id AS "value",
+ id AS "key"
+ FROM
+ pl_sys_menu
+ WHERE
+ category = 1
+ AND is_deleted = 0
+ AND id IN ( SELECT menu_id FROM pl_auth_scope_api WHERE is_deleted = 0 AND menu_id IS NOT NULL )
+ AND (
+ id IN (
+ select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ OR id IN (
+ select parent_id from pl_sys_menu where is_deleted = 0
+ and id in (
+ select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ )
+ )
) menu
UNION ALL
SELECT
- id,
- menu_id AS parent_id,
- scope_name AS title,
- id AS "value",
- id AS "key"
+ id,
+ menu_id AS parent_id,
+ scope_name AS title,
+ id AS "value",
+ id AS "key"
FROM
- pl_auth_scope_api
+ pl_auth_scope_api
WHERE
- is_deleted = 0
+ is_deleted = 0
AND
- (
- menu_id IN (
- select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
- OR menu_id IN (
- select parent_id from pl_sys_menu where is_deleted = 0
- and id in ( select menu_id from pl_org_role_menu where role_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach> )
- )
+ (
+ menu_id IN (
+ select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ OR menu_id IN (
+ select parent_id from pl_sys_menu where is_deleted = 0
+ and id in ( select menu_id from pl_org_role_menu where role_id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ )
+ )
)
AND menu_id IS NOT NULL
</select>
<select id="authRoutes" resultType="com.vci.ubcs.system.dto.MenuDTO">
SELECT
- GROUP_CONCAT(r.role_alias) as alias,
- m.path
+ GROUP_CONCAT(r.role_alias) as alias,
+ m.path
FROM
- pl_org_role_menu rm
- LEFT JOIN pl_sys_menu m ON rm.menu_id = m.id
- LEFT JOIN pl_org_role r ON rm.role_id = r.id
+ pl_org_role_menu rm
+ LEFT JOIN pl_sys_menu m ON rm.menu_id = m.id
+ LEFT JOIN pl_org_role r ON rm.role_id = r.id
WHERE
- rm.role_id IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND m.path IS NOT NULL and m.is_deleted = 0
+ rm.role_id IN
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ AND m.path IS NOT NULL and m.is_deleted = 0
GROUP BY m.path
</select>
<select id="selectMenuChildByBtnType" resultMap="menuResultMap">
select pm.*
- from pl_sys_menu ps, pl_sys_menu pm
+ from pl_sys_menu ps, pl_sys_menu pm
where pm.is_deleted = 0
- and ps.category = 1
- and ps.CODE = #{btmType}
- and ps.ID = pm.PARENT_ID
- <if test="roleIds != null and roleIds != ''">
- and ps.ID in (
- SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
- <foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
- </if>
+ and ps.category = 1
+ and ps.CODE = #{btmType}
+ and ps.ID = pm.PARENT_ID
+ <if test="roleIds != null and roleIds != ''">
+ and ps.ID in
+ SELECT menu_id FROM pl_org_role_menu WHERE role_id IN
+ <foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </if>
order by pm.sort asc
</select>
+ <select id="getButtonByIdsOrByParentCode" resultMap="menuResultMap">
+ SELECT
+ pm.*
+ FROM
+ PL_SYS_MENU pm
+ <if test="code != null and code != ''">
+ ,PL_SYS_MENU ps
+ </if>
+ <if test="roleIds != null and roleIds != ''">
+ ,PL_ORG_ROLE_MENU prom
+ </if>
+ WHERE
+ pm.IS_DELETED = 0
+ AND pm."CATEGORY" = 2
+ <if test="code != null and code != ''">
+ AND ps."CATEGORY" = 1
+ AND ps.ID = pm.PARENT_ID
+ AND ps.CODE = #{code}
+ </if>
+ <if test="roleIds != null and roleIds != ''">
+ AND pm.ID = prom.MENU_ID
+ AND prom.ROLE_ID in (#{roleIds})
+ </if>
+ <if test="ids != null and ids != ''">
+ AND pm.ID IN
+ <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </if>
+ ORDER BY SORT ASC
+ </select>
+
</mapper>
--
Gitblit v1.9.3