已修改21个文件
已删除11个文件
已重命名4个文件
已复制2个文件
已添加29个文件
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/list', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const getParentList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/parent-list', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const getChildList = (current, size, parentoid, params) => { |
| | | debugger; |
| | | return request({ |
| | | url: '/api/ubcs-omd/enumItem/listAll', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | parentoid: parentoid, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const removeChild = (ids) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enumItem/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const addChild = (row) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enumItem/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | debugger; |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const updateChild = (row) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enumItem/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | |
| | | export const getDict = (oid) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/detail', |
| | | method: 'get', |
| | | params: { |
| | | oid, |
| | | } |
| | | }) |
| | | } |
| | | export const getDictChild = (oid) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enumItem/detail', |
| | | method: 'get', |
| | | params: { |
| | | oid, |
| | | } |
| | | }) |
| | | } |
| | | export const getDictTree = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/tree', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const getDictionary = (params) => { |
| | | return request({ |
| | | url: '/api/ubcs-omd/enum/dictionary', |
| | | method: 'get', |
| | | params, |
| | | }) |
| | | } |
| | |
| | | // }, |
| | | { |
| | | label: "ç¶æ", |
| | | prop: "lcstatusName", |
| | | prop: "lcStatusText", |
| | | slot: true, |
| | | display: false |
| | | }, |
| | | { |
| | | label: "ç¶æ", |
| | | type: "select", |
| | | dicUrl: "/api/ubcs-omd/dict/dictionary?code=codeLcstatus", |
| | | dicUrl: "/api/ubcs-omd/enum/dictionary?code=codeLcstatus", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | label: "itemName", |
| | | value: "itemValue" |
| | | }, |
| | | dataType: "String", |
| | | search: true, |
| | | hide: true, |
| | | display: true, |
| | | prop: "lcstatus", |
| | | prop: "lcStatus", |
| | | rules: [{ |
| | | required: true, |
| | | message: "ç¶æ", |
| | |
| | | // }, |
| | | { |
| | | label: "æé®çä½ç½®", |
| | | prop: "usedpositiontypeName", |
| | | prop: "usedpositiontypeText", |
| | | slot: true, |
| | | display: false |
| | | }, |
| | |
| | | label: "æé®çä½ç½®", |
| | | type: "select", |
| | | weight :'140px', |
| | | dicUrl: "/api/ubcs-omd/dict/dictionary?code=codeButtonPosition", |
| | | dicUrl: "/api/ubcs-omd/enum/dictionary?code=codeButtonPosition", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | label: "itemName", |
| | | value: "itemValue" |
| | | }, |
| | | dataType: "String", |
| | | search: true, |
| | |
| | | label: "忽ç¥å¤§å°å", |
| | | prop: "ignorecaseflag", |
| | | type: "select", |
| | | dicUrl: "/api/ubcs-system/dict/dictionary?code=codeKeyFlag", |
| | | dicUrl: "/api/ubcs-omd/enum/dictionary?code=codeKeyFlag", |
| | | dataType: "String", |
| | | search: true, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | label: "itemName", |
| | | value: "itemValue" |
| | | }, |
| | | rules: [{ |
| | | required: true, |
| | |
| | | label: "忽ç¥ç©ºæ ¼", |
| | | prop: "ignorespaceflag", |
| | | type: "select", |
| | | dicUrl: "/api/ubcs-system/dict/dictionary?code=codeKeyFlag", |
| | | dicUrl: "/api/ubcs-omd/enum/dictionary?code=codeKeyFlag", |
| | | dataType: "String", |
| | | search: true, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | label: "itemName", |
| | | value: "itemValue" |
| | | }, |
| | | rules: [{ |
| | | required: true, |
| | |
| | | label: "忽ç¥å
¨é¨ç©ºæ ¼", |
| | | prop: "ignoreallspaceflag", |
| | | type: "select", |
| | | dicUrl: "/api/ubcs-system/dict/dictionary?code=codeKeyFlag", |
| | | dicUrl: "/api/ubcs-omd/enum/dictionary?code=codeKeyFlag", |
| | | dataType: "String", |
| | | search: true, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | label: "itemName", |
| | | value: "itemValue" |
| | | }, |
| | | rules: [{ |
| | | required: true, |
| | |
| | | prop: "ignorewidthflag", |
| | | type: "select", |
| | | search: true, |
| | | dicUrl: "/api/ubcs-system/dict/dictionary?code=codeKeyFlag", |
| | | dicUrl: "/api/ubcs-omd/enum/dictionary?code=codeKeyFlag", |
| | | dataType: "String", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | label: "itemName", |
| | | value: "itemValue" |
| | | }, |
| | | rules: [{ |
| | | required: true, |
ÎļþÃû´Ó Source/UBCS-WEB/src/const/omd/dict.js ÐÞ¸Ä |
| | |
| | | column: [ |
| | | { |
| | | label: "代å·", |
| | | prop: "code", |
| | | prop: "name", |
| | | search: true, |
| | | slot: true, |
| | | span: 24, |
| | |
| | | }, |
| | | { |
| | | label: "åç§°", |
| | | prop: "dictValue", |
| | | prop: "label", |
| | | search: true, |
| | | align: "center", |
| | | rules: [ |
| | |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "æä¸¾æåº", |
| | | prop: "sort", |
| | | type: "number", |
| | | align: "right", |
| | | width: 100, |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请è¾å
¥æä¸¾æåº", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | // { |
| | | // label: "æä¸¾æåº", |
| | | // prop: "sort", |
| | | // type: "number", |
| | | // align: "right", |
| | | // width: 100, |
| | | // hide: true, |
| | | // rules: [ |
| | | // { |
| | | // required: true, |
| | | // message: "请è¾å
¥æä¸¾æåº", |
| | | // trigger: "blur" |
| | | // } |
| | | // ] |
| | | // }, |
| | | // { |
| | | // label: "å°å", |
| | | // prop: "isSealed", |
| | |
| | | dialogWidth: 880, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "代å·", |
| | | prop: "code", |
| | | addDisabled: true, |
| | | editDisabled: true, |
| | | search: true, |
| | | span: 24, |
| | | hide: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请è¾å
¥ä»£å·", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | }, |
| | | // { |
| | | // label: "代å·", |
| | | // prop: "value", |
| | | // addDisabled: true, |
| | | // editDisabled: true, |
| | | // search: true, |
| | | // span: 24, |
| | | // hide: true, |
| | | // rules: [ |
| | | // { |
| | | // required: true, |
| | | // message: "请è¾å
¥ä»£å·", |
| | | // trigger: "blur" |
| | | // } |
| | | // ] |
| | | // }, |
| | | { |
| | | label: "åç§°", |
| | | prop: "dictValue", |
| | | prop: "name", |
| | | search: true, |
| | | align: "center", |
| | | rules: [ |
| | |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "ä¸çº§", |
| | | prop: "parentId", |
| | | type: "tree", |
| | | dicData: [], |
| | | hide: true, |
| | | props: { |
| | | label: "title" |
| | | }, |
| | | addDisabled: true, |
| | | editDisabled: true, |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: "è¯·éæ©ä¸çº§", |
| | | trigger: "click" |
| | | } |
| | | ] |
| | | }, |
| | | // { |
| | | // label: "ä¸çº§", |
| | | // prop: "parentoid", |
| | | // type: "tree", |
| | | // dicData: [], |
| | | // hide: true, |
| | | // props: { |
| | | // label: "title" |
| | | // }, |
| | | // addDisabled: true, |
| | | // editDisabled: true, |
| | | // rules: [ |
| | | // { |
| | | // required: false, |
| | | // message: "è¯·éæ©ä¸çº§", |
| | | // trigger: "click" |
| | | // } |
| | | // ] |
| | | // }, |
| | | { |
| | | label: "å¼", |
| | | prop: "dictKey", |
| | | prop: "value", |
| | | width: 80, |
| | | search: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | },{ |
| | | label: "æè¿°", |
| | | prop: "description", |
| | | // hide: true |
| | | }, |
| | | { |
| | | label: "æä¸¾æåº", |
| | |
| | | // } |
| | | // ] |
| | | // }, |
| | | { |
| | | label: "æè¿°", |
| | | prop: "remark", |
| | | // hide: true |
| | | } |
| | | |
| | | ] |
| | | }; |
| | |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.codebutton_add, false), |
| | | viewBtn: this.vaildData(this.permission.codebutton_view, false), |
| | | delBtn: this.vaildData(this.permission.codebutton_delete, false), |
| | | editBtn: this.vaildData(this.permission.codebutton_edit, false) |
| | | // addBtn: this.vaildData(this.permission.codebutton_add, false), |
| | | // viewBtn: this.vaildData(this.permission.codebutton_view, false), |
| | | // delBtn: this.vaildData(this.permission.codebutton_delete, false), |
| | | // editBtn: this.vaildData(this.permission.codebutton_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_add, false), |
| | | viewBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_view, false), |
| | | delBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_delete, false), |
| | | editBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_edit, false) |
| | | // addBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_add, false), |
| | | // viewBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_view, false), |
| | | // delBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_delete, false), |
| | | // editBtn: this.vaildData(this.permission.plCodeKeyattrrepeat_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | |
| | | update, getPage |
| | | } from "@/api/omd/OmdAttribute"; |
| | | |
| | | import { getDictionary } from "@/api/omd/dict"; |
| | | import { getDictionary } from "@/api/omd/enum"; |
| | | |
| | | export default { |
| | | name: "original", |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud |
| | | :option="optionParent" |
| | | :table-loading="loading" |
| | | :data="dataParent" |
| | | :page="pageParent" |
| | | ref="crud" |
| | | v-model="formParent" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | @row-del="rowDel" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @row-click="handleRowClick" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoadParent" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | v-if="permission.dict_delete" |
| | | plain |
| | | @click="handleDelete" |
| | | >å é¤ |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="scope" slot="menu"> |
| | | <el-button |
| | | type="text" |
| | | icon="el-icon-setting" |
| | | size="small" |
| | | @click.stop="handleRowClick(scope.row)" |
| | | v-if="userInfo.role_name.includes('admin')" |
| | | >æä¸¾é
ç½® |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" slot="code"> |
| | | <el-tag @click="handleRowClick(row)" style="cursor:pointer">{{ row.code }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="isSealed"> |
| | | <el-tag>{{ row.isSealed === 0 ? 'å¦' : 'æ¯' }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog :title="`[${name}]æä¸¾é¡¹é
ç½®`" |
| | | append-to-body |
| | | :visible.sync="box" |
| | | width="1000px"> |
| | | <avue-crud |
| | | :option="optionChild" |
| | | :table-loading="loadingChild" |
| | | :data="dataChild" |
| | | ref="crudChild" |
| | | v-model="formChild" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpenChild" |
| | | :before-close="beforeCloseChild" |
| | | @row-del="rowDelChild" |
| | | @row-update="rowUpdateChild" |
| | | @row-save="rowSaveChild" |
| | | @search-change="searchChangeChild" |
| | | @search-reset="searchResetChild" |
| | | @selection-change="selectionChangeChild" |
| | | @current-change="currentChangeChild" |
| | | @size-change="sizeChangeChild" |
| | | @refresh-change="refreshChangeChild" |
| | | @on-load="onLoadChild" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | v-if="permission.dict_delete" |
| | | plain |
| | | @click="handleDeleteChild" |
| | | >å é¤ |
| | | </el-button> |
| | | </template> |
| | | <!-- <template slot-scope="scope" slot="menu">--> |
| | | <!-- <el-button--> |
| | | <!-- type="text"--> |
| | | <!-- icon="el-icon-circle-plus-outline"--> |
| | | <!-- size="small"--> |
| | | <!-- @click.stop="handleAdd(scope.row,scope.index)"--> |
| | | <!-- v-if="userInfo.role_name.includes('admin')"--> |
| | | <!-- >æ°å¢å项--> |
| | | <!-- </el-button>--> |
| | | <!-- </template>--> |
| | | <template slot-scope="{row}" slot="isSealed"> |
| | | <el-tag>{{ row.isSealed === 0 ? 'å¦' : 'æ¯' }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getParentList, |
| | | getChildList, |
| | | remove, |
| | | update, |
| | | add, |
| | | getDict, |
| | | getDictTree, addChild, updateChild, getDictChild, removeChild |
| | | } from "@/api/omd/enum"; |
| | | import {optionParent, optionChild} from "@/const/omd/enum"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | dictValue: 'ææ ', |
| | | parentoid: -1, |
| | | formParent: {}, |
| | | formChild: {}, |
| | | selectionList: [], |
| | | query: {}, |
| | | box: false, |
| | | loading: true, |
| | | loadingChild: true, |
| | | pageParent: { |
| | | pageSize: 10, |
| | | pageSizes: [10, 30, 50, 100, 200], |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | pageChild: { |
| | | pageSize: 10, |
| | | pageSizes: [10, 30, 50, 100, 200], |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | dataParent: [], |
| | | dataChild: [], |
| | | optionParent: optionParent, |
| | | optionChild: optionChild, |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["userInfo", "permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.dict_add, false), |
| | | delBtn: this.vaildData(this.permission.dict_delete, false), |
| | | editBtn: this.vaildData(this.permission.dict_edit, false), |
| | | viewBtn: false, |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.oid); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.initData(); |
| | | }, |
| | | methods: { |
| | | initData() { |
| | | getDictTree(this.pageParent.currentPage, |
| | | this.pageParent.pageSize, |
| | | this.query).then(res => { |
| | | const column = this.findObject(this.optionChild.column, "parentoid"); |
| | | column.dicData = res.data.data; |
| | | }); |
| | | }, |
| | | handleAdd(row) { |
| | | this.formChild.value = ""; |
| | | this.formChild.name = ""; |
| | | this.formChild.sort = 0; |
| | | this.formChild.isSealed = 0; |
| | | this.formChild.remark = ""; |
| | | this.formChild.parentoid = row.oid; |
| | | this.$refs.crudChild.rowAdd(); |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | const form = { |
| | | ...row, |
| | | dictKey: -1, |
| | | }; |
| | | add(form).then(() => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | this.onLoadChild(this.pageChild); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("ç¡®å®å°éæ©æ°æ®å é¤?", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.oid); |
| | | }) |
| | | .then(() => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | }); |
| | | }, |
| | | handleRowClick(row) { |
| | | this.query = {}; |
| | | this.parentId = row.oid; |
| | | this.name = row.name; |
| | | |
| | | const code = this.findObject(this.optionChild.column, "value"); |
| | | code.value = row.code; |
| | | // const parentoid = this.findObject(this.optionChild.column, "parentoid"); |
| | | this.parentoid = row.oid; |
| | | |
| | | this.box = true; |
| | | this.onLoadChild(this.pageChild); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoadParent(this.pageParent); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.pageParent.currentPage = 1; |
| | | this.onLoadParent(this.pageParent, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | this.$confirm("ç¡®å®å°éæ©æ°æ®å é¤?", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoadParent(this.pageParent); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDict(this.formParent.oid).then(res => { |
| | | this.formParent = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.pageParent.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.pageParent.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoadParent(this.pageParent, this.query); |
| | | }, |
| | | rowSaveChild(row, done, loading) { |
| | | row.parentoid = this.parentoid; |
| | | addChild(row).then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | }, |
| | | rowUpdateChild(row, index, done, loading) { |
| | | updateChild(row).then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | }, |
| | | rowDelChild(row) { |
| | | this.$confirm("ç¡®å®å°éæ©æ°æ®å é¤?", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return removeChild(row.oid); |
| | | }) |
| | | .then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | }); |
| | | }, |
| | | searchResetChild() { |
| | | this.query = {}; |
| | | this.onLoadChild(this.pageChild); |
| | | }, |
| | | searchChangeChild(params, done) { |
| | | this.query = params; |
| | | this.pageChild.currentPage = 1; |
| | | this.onLoadChild(this.pageChild, params); |
| | | done(); |
| | | }, |
| | | selectionChangeChild(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClearChild() { |
| | | this.selectionList = []; |
| | | this.$refs.crudChild.toggleSelection(); |
| | | }, |
| | | handleDeleteChild() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | this.$confirm("ç¡®å®å°éæ©æ°æ®å é¤?", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return removeChild(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoadChild(this.pageChild); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | this.$refs.crudChild.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpenChild(done, type) { |
| | | if (["add", "edit"].includes(type)) { |
| | | this.initData(); |
| | | } |
| | | if (["edit", "view"].includes(type)) { |
| | | getDictChild(this.formChild.oid).then(res => { |
| | | this.formChild = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | beforeCloseChild(done) { |
| | | this.$refs.crudChild.value.parentId = this.parentId; |
| | | this.$refs.crudChild.option.column.filter(item => { |
| | | if (item.prop === "parentId") { |
| | | item.value = this.parentId; |
| | | } |
| | | }); |
| | | done(); |
| | | }, |
| | | currentChangeChild(currentPage) { |
| | | this.pageChild.currentPage = currentPage; |
| | | }, |
| | | sizeChangeChild(pageSize) { |
| | | this.pageChild.pageSize = pageSize; |
| | | }, |
| | | refreshChangeChild() { |
| | | this.onLoadChild(this.pageChild, this.query); |
| | | }, |
| | | onLoadParent(page, params = {}) { |
| | | this.loading = true; |
| | | getParentList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query) |
| | | ).then(res => { |
| | | const data = res.data.data; |
| | | this.pageParent.total = data.total; |
| | | this.dataParent = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | onLoadChild(page, params = {}) { |
| | | this.loadingChild = true; |
| | | getChildList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | this.parentoid, |
| | | Object.assign(params, this.query) |
| | | ).then(res => { |
| | | this.dataChild = res.data.data; |
| | | this.loadingChild = false; |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | <version>${bladex.project.version}</version> |
| | | <packaging>jar</packaging> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.vci.ubcs</groupId> |
| | | <artifactId>ubcs-util-api</artifactId> |
| | | <version>3.0.1.RELEASE</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.cache; |
| | | |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.enums.EnumEnum; |
| | | import com.vci.ubcs.omd.feign.IEnumClient; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | |
| | | import java.util.List; |
| | | /** |
| | | * ä¸å¡åå
¸ç¼åå·¥å
·ç±» |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public class EnumCache { |
| | | |
| | | private static final String ENUM_ID = "enum:id"; |
| | | private static final String ENUM_VALUE = "enum:value"; |
| | | private static final String ENUM_LIST = "enum:list"; |
| | | private static final String ENUM_CACHE = "blade:enum"; |
| | | |
| | | private static IEnumClient iEnumClient; |
| | | |
| | | private static IEnumClient getIOmdEnumClient() { |
| | | if (iEnumClient == null) { |
| | | iEnumClient = SpringUtil.getBean(IEnumClient.class); |
| | | } |
| | | return iEnumClient; |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸å®ä½ |
| | | * |
| | | * @param oid ä¸»é® |
| | | * @return Enum |
| | | */ |
| | | public static Enum getById(String oid) { |
| | | String keyPrefix = ENUM_ID.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(ENUM_CACHE, keyPrefix, oid, () -> { |
| | | R<Enum> result = getIOmdEnumClient().getById(oid); |
| | | return result.getData(); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸å¼ |
| | | * |
| | | * @param name åå
¸ç¼å·æä¸¾ |
| | | * @param nameChild Integerååå
¸é® |
| | | * @return String |
| | | */ |
| | | public static String getValue(EnumEnum name, Integer nameChild) { |
| | | return getValue(name.getName(), nameChild); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·ååå
¸å¼ |
| | | * |
| | | * @param name ç¶åå
¸ç¼å· |
| | | * @param nameChild ååå
¸ç¼å· |
| | | * @return String |
| | | */ |
| | | public static String getValue(String name, Integer nameChild) { |
| | | String keyPrefix = ENUM_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(ENUM_CACHE, keyPrefix + name + StringPool.COLON, String.valueOf(nameChild), () -> { |
| | | R<String> result = getIOmdEnumClient().getValue(name, String.valueOf(nameChild)); |
| | | return result.getData(); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸å¼ |
| | | * |
| | | * @param name åå
¸ç¼å·æä¸¾ |
| | | * @param nameChild Stringååå
¸é® |
| | | * @return String |
| | | */ |
| | | public static String getValue(EnumEnum name, String nameChild) { |
| | | return getValue(name.getName(), nameChild); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸å¼ |
| | | * |
| | | * @param code åå
¸ç¼å· |
| | | * @param dictKey Stringååå
¸é® |
| | | * @return String |
| | | */ |
| | | public static String getValue(String code, String dictKey) { |
| | | String keyPrefix = ENUM_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(ENUM_CACHE, keyPrefix + code + StringPool.COLON, dictKey, () -> { |
| | | R<String> result = getIOmdEnumClient().getValue(code, dictKey); |
| | | return result.getData(); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸éå |
| | | * |
| | | * @param name åå
¸ç¼å· |
| | | * @return List<EnumVO> |
| | | */ |
| | | public static List<EnumVO> getList(String name) { |
| | | String keyPrefix = ENUM_LIST.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(ENUM_CACHE, keyPrefix, name, () -> { |
| | | R<List<EnumVO>> result = getIOmdEnumClient().getList(name); |
| | | return result.getData(); |
| | | }); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ å®ä½ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @Data |
| | | @TableName("PL_OMD_ENUM") |
| | | @ApiModel(value = "OmdEnum对象", description = "æä¸¾å®ä¹") |
| | | //@EqualsAndHashCode(callSuper = true) |
| | | public class Enum implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "oid", type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "") |
| | | private String oid; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String name; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String label; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private Date ts; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String creator; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private Date createtime; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String modifier; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private Date modifytime; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String remark; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 å®ä½ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @Data |
| | | @TableName("PL_OMD_ENUMITEM") |
| | | @ApiModel(value = "OmdEnumitem对象", description = "æä¸¾å®ä¹å表") |
| | | //@EqualsAndHashCode(callSuper = true) |
| | | public class EnumItem implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | @TableId(value = "oid", type = IdType.ASSIGN_ID) |
| | | private String oid; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String name; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String value; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String description; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private Date ts; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String creator; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private Date createtime; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String modifier; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private Date modifytime; |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private String parentoid; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "") |
| | | private Integer sort; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * ç³»ç»åå
¸æä¸¾ç±» |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum EnumEnum { |
| | | |
| | | /** |
| | | * æ§å« |
| | | */ |
| | | SEX("sex"), |
| | | /** |
| | | * éç¥ç±»å |
| | | */ |
| | | NOTICE("notice"), |
| | | /** |
| | | * èåç±»å |
| | | */ |
| | | MENU_CATEGORY("menu_category"), |
| | | /** |
| | | * æé®åè½ |
| | | */ |
| | | BUTTON_FUNC("button_func"), |
| | | /** |
| | | * æ¯å¦ |
| | | */ |
| | | YES_NO("yes_no"), |
| | | /** |
| | | * æµç¨ç±»å |
| | | */ |
| | | FLOW("flow"), |
| | | /** |
| | | * æºæç±»å |
| | | */ |
| | | ORG_CATEGORY("org_category"), |
| | | /** |
| | | * æ°æ®æé |
| | | */ |
| | | DATA_SCOPE_TYPE("data_scope_type"), |
| | | /** |
| | | * æ¥å£æé |
| | | */ |
| | | API_SCOPE_TYPE("api_scope_type"), |
| | | /** |
| | | * æéç±»å |
| | | */ |
| | | SCOPE_CATEGORY("scope_category"), |
| | | /** |
| | | * 对象åå¨ç±»å |
| | | */ |
| | | OSS("oss"), |
| | | /** |
| | | * çä¿¡æå¡ç±»å |
| | | */ |
| | | SMS("sms"), |
| | | /** |
| | | * å²ä½ç±»å |
| | | */ |
| | | POST_CATEGORY("post_category"), |
| | | /** |
| | | * è¡æ¿åºå |
| | | */ |
| | | REGION("region"), |
| | | /** |
| | | * ç¨æ·å¹³å° |
| | | */ |
| | | USER_TYPE("user_type"), |
| | | ; |
| | | |
| | | final String name; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.feign; |
| | | |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.mp.support.BladePage; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ Feignæ¥å£ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @FeignClient( |
| | | value = AppConstant.APPLICATION_NAME_OMD, |
| | | fallback = IEnumFallback.class |
| | | ) |
| | | public interface IEnumClient { |
| | | |
| | | String API_PREFIX = "/client"; |
| | | String TOP = API_PREFIX + "/enum/top"; |
| | | String GET_BY_ID = API_PREFIX + "/enum/get-by-oid"; |
| | | String GET_BYCHILD_ID = API_PREFIX + "/enum/get-byChild-oid"; |
| | | String GET_VALUE = API_PREFIX + "/enum/get-value"; |
| | | String GET_LIST = API_PREFIX + "/enum/get-list"; |
| | | |
| | | /** |
| | | * è·åæä¸¾å®ä¹å表 |
| | | * |
| | | * @param current é¡µå· |
| | | * @param size é¡µæ° |
| | | * @return BladePage |
| | | */ |
| | | @GetMapping(TOP) |
| | | BladePage<Enum> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); |
| | | |
| | | /** |
| | | * è·åæä¸¾å®ä¹å表 |
| | | * |
| | | * @param name ç¶èç¹name |
| | | * @param nameChild åèç¹name |
| | | * @return BladePage |
| | | */ |
| | | @GetMapping(GET_VALUE) |
| | | R<String> getValue(@RequestParam("name") String name,@RequestParam("nameChild") String nameChild); |
| | | |
| | | /** |
| | | * è·ååå
¸å®ä½ |
| | | * |
| | | * @param oid ä¸»é® |
| | | * @return |
| | | */ |
| | | @GetMapping(GET_BY_ID) |
| | | R<Enum> getById(@RequestParam("oid") String oid); |
| | | |
| | | /** |
| | | * è·ååå
¸å®ä½ |
| | | * |
| | | * @param oid ä¸»é® |
| | | * @return |
| | | */ |
| | | @GetMapping(GET_BYCHILD_ID) |
| | | R<EnumItem> getByChildId(@RequestParam("oid") String oid); |
| | | |
| | | /** |
| | | * è·ååå
¸è¡¨ |
| | | * |
| | | * @param name æä¸¾ç¼å· |
| | | * @return |
| | | */ |
| | | @GetMapping(GET_LIST) |
| | | R<List<EnumVO>> getList(@RequestParam("name") String name); |
| | | |
| | | } |
ÎļþÃû´Ó Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/feign/IDictClientFallback.java ÐÞ¸Ä |
| | |
| | | */ |
| | | package com.vci.ubcs.omd.feign; |
| | | |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import org.springblade.core.mp.support.BladePage; |
| | | import org.springblade.core.tool.api.R; |
| | | import com.vci.ubcs.omd.entity.Dict; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Component("Dictclient2") |
| | | public class IDictClientFallback implements IDictClient { |
| | | @Component |
| | | public class IEnumFallback implements IEnumClient { |
| | | @Override |
| | | public R<Dict> getById(Long id) { |
| | | public BladePage<Enum> top(Integer current, Integer size) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<String> getValue(String name, String nameChild) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> getValue(String code, String dictKey) { |
| | | public R<Enum> getById(String oid) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Dict>> getList(String code) { |
| | | public R<EnumItem> getByChildId(String oid) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | | public R getCheck(Dict dict) { |
| | | public R<List<EnumVO>> getList(String name) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.feign; |
| | | |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.mp.support.BladePage; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 Feignæ¥å£ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @FeignClient( |
| | | value = AppConstant.APPLICATION_NAME_OMD, |
| | | fallback = IEnumItemFallback.class |
| | | ) |
| | | public interface IEnumItemClient { |
| | | |
| | | String API_PREFIX = "/clientEnumItem"; |
| | | String TOP = API_PREFIX + "/top"; |
| | | |
| | | /** |
| | | * è·åæä¸¾å®ä¹å表å表 |
| | | * |
| | | * @param current é¡µå· |
| | | * @param size é¡µæ° |
| | | * @return BladePage |
| | | */ |
| | | @GetMapping(TOP) |
| | | BladePage<EnumItem> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); |
| | | |
| | | } |
copy from Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/feign/IDictClientFallback.java
copy to Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/feign/IEnumItemFallback.java
Îļþ´Ó Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/feign/IDictClientFallback.java ¸´ÖÆ |
| | |
| | | */ |
| | | package com.vci.ubcs.omd.feign; |
| | | |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import org.springblade.core.mp.support.BladePage; |
| | | import org.springblade.core.tool.api.R; |
| | | import com.vci.ubcs.omd.entity.Dict; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Component("Dictclient2") |
| | | public class IDictClientFallback implements IDictClient { |
| | | @Component |
| | | public class IEnumItemFallback implements IEnumItemClient { |
| | | @Override |
| | | public R<Dict> getById(Long id) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | public BladePage<EnumItem> top(Integer current, Integer size) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<String> getValue(String code, String dictKey) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Dict>> getList(String code) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | | public R getCheck(Dict dict) { |
| | | return R.fail("è·åæ°æ®å¤±è´¥"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.vo; |
| | | |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 è§å¾å®ä½ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class EnumItemVO extends EnumItem { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | String parentName; |
| | | } |
ÎļþÃû´Ó Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/vo/DictVO.java ÐÞ¸Ä |
| | |
| | | package com.vci.ubcs.omd.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import com.vci.ubcs.omd.entity.Dict; |
| | | import io.swagger.annotations.ApiModel; |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.starter.util.node.INodeOid; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.core.tool.node.INode; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è§å¾å®ä½ç±» |
| | | * æä¸¾å®ä¹ è§å¾å®ä½ç±» |
| | | * |
| | | * @author Chill |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "DictVO对象", description = "DictVO对象") |
| | | public class DictVO extends Dict implements INode<Dict> { |
| | | public class EnumVO extends Enum implements INodeOid<EnumItem> { |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long id; |
| | | |
| | | /** |
| | | * ç¶èç¹ID |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * ååèç¹ |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | private List<Dict> children; |
| | | private List<EnumItem> children = new ArrayList<>(); |
| | | /** |
| | | * æ¯å¦æååèç¹ |
| | | */ |
| | | private Boolean hasChildren = false; |
| | | /** |
| | | * åèç¹OID |
| | | */ |
| | | private String itemOid; |
| | | /** |
| | | * åèç¹æä¸¾ç¼ç |
| | | */ |
| | | private String itemName; |
| | | /** |
| | | * åèç¹æä¸¾å¼ |
| | | */ |
| | | private String itemValue; |
| | | /** |
| | | * åèç¹ææè¿° |
| | | */ |
| | | private String itemDescription; |
| | | |
| | | @Override |
| | | public List<Dict> getChildren() { |
| | | if (this.children == null) { |
| | | this.children = new ArrayList<>(); |
| | | } |
| | | public String getParentOid() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumItem> getChildren() { |
| | | return this.children; |
| | | } |
| | | |
| | | /** |
| | | * ä¸çº§åå
¸ |
| | | */ |
| | | private String parentName; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.starter.util; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | public class PatternUtil { |
| | | |
| | | //*${xxx}* |
| | | public static Pattern dynamic = Pattern.compile(".*\\$\\{([a-z]+)\\}.*"); |
| | | public static Pattern dynamicLimitCount = Pattern.compile("\\$\\{([a-z]+)\\}"); |
| | | /** |
| | | * 夿å
容䏿¯å¦å
å«å¨æåæ°(${key}å½¢å¼ç) |
| | | * |
| | | * @param content è¦å¤æçå
容 |
| | | * @return |
| | | */ |
| | | public static boolean isContainsDynamicParameter(String content) { |
| | | if(StringUtils.isBlank(content)){ |
| | | return false; |
| | | } |
| | | return dynamic.matcher(content).matches(); |
| | | } |
| | | |
| | | /** |
| | | * æç
§å¨æå
容çåæ°åºç°é¡ºåº,å°åæ°æ¾å°Listä¸ |
| | | * |
| | | * @param content |
| | | * @return |
| | | */ |
| | | public static List<String> getKeyListByContent(String content) { |
| | | if(StringUtils.isBlank(content)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | Set<String> paramSet = new LinkedHashSet<>(); |
| | | Matcher m = dynamicLimitCount.matcher(content); |
| | | while (m.find()) { |
| | | paramSet.add(m.group(1)); |
| | | } |
| | | return new ArrayList<>(paramSet); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.starter.util.node; |
| | | |
| | | |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.google.common.collect.Maps; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class ForestNodeManagerOid<T extends INodeOid<T>> { |
| | | private final ImmutableMap<String, T> nodeMap; |
| | | private final Map<String, Object> parentIdMap = Maps.newHashMap(); |
| | | |
| | | public ForestNodeManagerOid(List<T> nodes) { |
| | | this.nodeMap = Maps.uniqueIndex(nodes, INodeOid::getOid); |
| | | } |
| | | |
| | | public INodeOid<T> getTreeNodeAt(String id) { |
| | | return this.nodeMap.containsKey(id) ? (INodeOid)this.nodeMap.get(id) : null; |
| | | } |
| | | |
| | | public void addParentId(String parentId) { |
| | | this.parentIdMap.put(parentId, ""); |
| | | } |
| | | |
| | | public List<T> getRoot() { |
| | | List<T> roots = new ArrayList(); |
| | | this.nodeMap.forEach((key, node) -> { |
| | | if (node.getParentOid() == null || this.parentIdMap.containsKey(node.getOid())) { |
| | | roots.add(node); |
| | | } |
| | | |
| | | }); |
| | | return roots; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.starter.util.node; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | public class ForestNodeMergerOid { |
| | | public ForestNodeMergerOid() { |
| | | } |
| | | |
| | | public static <T extends INodeOid<T>> List<T> merge(List<T> items) { |
| | | ForestNodeManagerOid forestNodeManager = new ForestNodeManagerOid(items); |
| | | items.forEach((forestNode) -> { |
| | | if (forestNode.getParentOid() != null) { |
| | | INodeOid<T> node = forestNodeManager.getTreeNodeAt(forestNode.getParentOid()); |
| | | if (node != null) { |
| | | node.getChildren().add(forestNode); |
| | | } else { |
| | | forestNodeManager.addParentId(forestNode.getOid()); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | return forestNodeManager.getRoot(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.starter.util.node; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | public interface INodeOid<T> extends Serializable { |
| | | String getOid(); |
| | | |
| | | String getParentOid(); |
| | | |
| | | List<T> getChildren(); |
| | | |
| | | default Boolean getHasChildren() { |
| | | return false; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.starter.web.constant; |
| | | |
| | | |
| | | import com.vci.ubcs.starter.web.pagemodel.SessionInfo; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciDateUtil; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | public class VciSystemVarConstants { |
| | | public static final String CURRENTUSER_OID = "#CURRENTUSER.OID#"; |
| | | public static final String CURRENTUSER_ID = "#CURRENTUSER.ID#"; |
| | | public static final String CURRENTTIME = "#CURRENTTIME#"; |
| | | public static final String CURRENTDATE = "#CURRENTDATE#"; |
| | | public static final String CURRENTDATETIME = "#CURRENTDATETIME#"; |
| | | public static final String CURRENTUSER_NAME = "#CURRENTUSER_NAME#"; |
| | | public static final String CURRENTUSER_SECRETGRADE = "#CURRENTUSER.SECRETGRADE#"; |
| | | public static final String CURRENTUSER_IP_SECRET = "#CURRENTUSER.IPSECRET#"; |
| | | public static final String CURRENTUSER_BUSINESS_UNIT = "#CURRENTUSER.BUSINESSUNIT#"; |
| | | public static final String CURRENTUSER_BUSINESS_UNIT_NAME = "#CURRENTUSER.BUSINESSUNITNAME#"; |
| | | public static final String CURRENTUSER_GROUPOID = "#CURRENTUSER.GROUPOID#"; |
| | | public static final String CURRENTUSER_GROUPNAME = "#CURRENTUSER.GROUPNAME#"; |
| | | public static final String CURRENTUSER_EMAIL = "#CURRENTUSER.EMAIL#"; |
| | | public static final String CURRENTUSER_ROLENAME = "#CURRENTUSER.ROLENAME#"; |
| | | public static final String[] SYSTEM_VAR_KEYS = new String[]{"#CURRENTUSER.OID#", "#CURRENTUSER.ID#", "#CURRENTDATE#", "#CURRENTTIME#", "#CURRENTDATETIME#", "#CURRENTUSER.GROUPOID#", "#CURRENTUSER_NAME#", "#CURRENTUSER.SECRETGRADE#", "#CURRENTUSER.GROUPNAME#", "#CURRENTUSER.EMAIL#", "#CURRENTUSER.ROLENAME#", "#CURRENTUSER.IPSECRET#", "#CURRENTUSER.BUSINESSUNIT#", "#CURRENTUSER.BUSINESSUNITNAME#"}; |
| | | public static final Map<String, String> SYSTEM_VAR_KEYNAMEMAP = new HashMap(); |
| | | |
| | | public VciSystemVarConstants() { |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTTIME#", "å½åæ¶é´"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTDATE#", "å½åæ¥æ"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTDATETIME#", "å½åæ¥ææ¶é´"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.OID#", "å½åç¨æ·ä¸»é®"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.ID#", "å½åç¨æ·è´¦æ·"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER_NAME#", "å½åç¨æ·å§å"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.SECRETGRADE#", "å½åç¨æ·å¯çº§"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.IPSECRET#", "å½åç¨æ·çæºå¨å¯çº§"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.GROUPOID#", "å½åç¨æ·çé¨é¨ç主é®"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.GROUPNAME#", "å½åç¨æ·æå±é¨é¨åç§°"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.EMAIL#", "å½åç¨æ·é®ä»¶å°å"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.ROLENAME#", "å½åç¨æ·æå±è§è²åç§°"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.BUSINESSUNIT#", "å½åç¨æ·æå±ä¸å¡åå
主é®"); |
| | | SYSTEM_VAR_KEYNAMEMAP.put("#CURRENTUSER.BUSINESSUNITNAME#", "å½åç¨æ·æå±ä¸å¡åå
"); |
| | | } |
| | | |
| | | public static Map<String, String> getSystemVarValueMap() { |
| | | Map<String, String> systemVarMap = new HashMap(); |
| | | SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | if (sessionInfo != null) { |
| | | systemVarMap.put("#CURRENTUSER.OID#", sessionInfo.getUserOid()); |
| | | systemVarMap.put("#CURRENTUSER.ID#", sessionInfo.getUserId()); |
| | | systemVarMap.put("#CURRENTUSER_NAME#", sessionInfo.getUserName()); |
| | | systemVarMap.put("#CURRENTDATETIME#", VciDateUtil.getNowString()); |
| | | systemVarMap.put("#CURRENTDATE#", VciDateUtil.getNowString("yyyy-MM-dd")); |
| | | systemVarMap.put("#CURRENTTIME#", VciDateUtil.getNowString("HH:mm:ss")); |
| | | systemVarMap.put("#CURRENTUSER.SECRETGRADE#", sessionInfo.getUserSecret()); |
| | | systemVarMap.put("#CURRENTUSER.GROUPNAME#", sessionInfo.getDeptName()); |
| | | systemVarMap.put("#CURRENTUSER.GROUPOID#", sessionInfo.getDeptOid()); |
| | | systemVarMap.put("#CURRENTUSER.EMAIL#", sessionInfo.getEmail()); |
| | | systemVarMap.put("#CURRENTUSER.ROLENAME#", (String) ((Collection) Optional.ofNullable(sessionInfo.getRolesName().values()).orElseGet(() -> { |
| | | return new ArrayList(); |
| | | })).stream().collect(Collectors.joining(","))); |
| | | systemVarMap.put("#CURRENTUSER.IPSECRET#", sessionInfo.getIpSecret()); |
| | | systemVarMap.put("#CURRENTUSER.BUSINESSUNIT#", sessionInfo.getOrgsOid()); |
| | | systemVarMap.put("#CURRENTUSER.BUSINESSUNITNAME#", sessionInfo.getOrgsName()); |
| | | } |
| | | |
| | | return systemVarMap; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.starter.web.util; |
| | | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by FernFlower decompiler) |
| | | // |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public class Md5 { |
| | | private static Logger logger = LoggerFactory.getLogger(Md5.class); |
| | | |
| | | public Md5() { |
| | | } |
| | | |
| | | public static String md5(String v) { |
| | | if (v == null) { |
| | | return null; |
| | | } else { |
| | | try { |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | return toHex(md.digest(v.getBytes())); |
| | | } catch (Exception var2) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static String twoTimesMd5(String sourceString) throws Exception { |
| | | return sourceString == null ? null : md5(md5(sourceString)); |
| | | } |
| | | |
| | | public static boolean equalMd5(String md5String, String sourceString) { |
| | | if (md5String != null && sourceString != null) { |
| | | try { |
| | | return md5String.equals(twoTimesMd5(sourceString)); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return false; |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public static boolean equalOneMd5(String md5String, String sourceString) { |
| | | if (md5String != null && sourceString != null) { |
| | | try { |
| | | String ms = md5(sourceString); |
| | | return md5String.equals(ms); |
| | | } catch (Exception var3) { |
| | | if (logger.isErrorEnabled()) { |
| | | logger.error("对æ¯md5çæ¶ååºç°äºé误", var3); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | private static String toHex(byte[] buffer) { |
| | | StringBuffer sb = new StringBuffer(32); |
| | | String s = null; |
| | | |
| | | for(int i = 0; i < buffer.length; ++i) { |
| | | s = Integer.toHexString(buffer[i] & 255); |
| | | if (s.length() < 2) { |
| | | sb.append('0'); |
| | | } |
| | | |
| | | sb.append(s); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | } |
| | | |
| | |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | public static SessionInfo getCurrentUserSessionInfo() throws VciBaseException { |
| | | SessionInfo si = getCurrentUserSessionInfoNotException(); |
| | | if (si == null) { |
| | | throw new VciBaseException("noLogin", new String[]{"没æå½åç¨æ·ä¿¡æ¯"}); |
| | | } else { |
| | | return si; |
| | | } |
| | | } |
| | | public static long getLong(String s) { |
| | | long l = 0L; |
| | | if (s == null) { |
| | |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeButtonVO; |
| | | import com.vci.ubcs.code.wrapper.CodeButtonWrapper; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/codeButtonController") |
| | | @RequestMapping("/codebutton") |
| | | @Api(value = "æ¨¡æ¿æ©å±æ± ", tags = "æ¨¡æ¿æ©å±æ± æ¥å£") |
| | | public class CodeButtonController extends BladeController { |
| | | |
| | | private final ICodeButtonService codeButtonService; |
| | | |
| | | CodeButtonMapper codeButtonMapper; |
| | | |
| | | |
| | | /** |
| | | * ä¸»æ°æ®ä¸çæé®æ©å±å表 |
| | |
| | | } |
| | | return R.data(codeButtonService.refDataGridCodeButton(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper())); |
| | | } |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± 详æ
|
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详æ
", notes = "ä¼ å
¥codebutton") |
| | | public R<CodeButtonVO> detail(CodeButton codebutton) { |
| | | CodeButton detail = codeButtonMapper.selectOne(Condition.getQueryWrapper(codebutton)); |
| | | return R.data(CodeButtonWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± å页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥codebutton") |
| | | public R<IPage<CodeButtonVO>> list(CodeButton codebutton, Query query) { |
| | | IPage<CodeButton> pages = codeButtonMapper.selectPage(Condition.getPage(query), Condition.getQueryWrapper(codebutton)); |
| | | return R.data(CodeButtonWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± èªå®ä¹å页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥codebutton") |
| | | public R<IPage<CodeButtonVO>> page(CodeButtonVO codebutton, Query query) { |
| | | IPage<CodeButtonVO> pages = codeButtonService.selectcodebuttonPage(Condition.getPage(query), codebutton); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± æ°å¢ |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "æ°å¢", notes = "ä¼ å
¥codebutton") |
| | | public R save(@Valid @RequestBody CodeButton codebutton) { |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.insert(codebutton))); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± ä¿®æ¹ |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "ä¿®æ¹", notes = "ä¼ å
¥codebutton") |
| | | public R update(@Valid @RequestBody CodeButton codebutton) { |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.updateById(codebutton))); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± æ°å¢æä¿®æ¹ |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥codebutton") |
| | | public R submit(@Valid @RequestBody CodeButton codebutton) { |
| | | if(codebutton.getOid() != null){ |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.updateById(codebutton))); |
| | | } |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.insert(codebutton))); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± å é¤ |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "é»è¾å é¤", notes = "ä¼ å
¥ids") |
| | | public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String ids) { |
| | | // return codebuttonService.deleteCodeButton(ids); |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.deleteBatchIds(Func.toStrList(ids)))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¯ç¨ |
| | |
| | | return codeButtonService.disableOrgDuty(oid); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.code.dto.CodeClstempattrDTO; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplateAttr; |
| | | import com.vci.ubcs.code.service.ICodeClassifyTemplateAttrService; |
| | | import com.vci.ubcs.code.service.ICodeClstempattrService; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeOsbtmtypeattributeVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.wrapper.CodeClstempattrWrapper; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¼ç åºå®ä¹-模æ¿å±æ§ æ§å¶å¨ |
| | |
| | | public class CodeClassifyTemplateAttrController extends BladeController { |
| | | |
| | | private final ICodeClassifyTemplateAttrService CodeClstempattrService; |
| | | private final ICodeClstempattrService iCodeClstempattrService; |
| | | |
| | | /** |
| | | * ç¼ç åºå®ä¹-模æ¿å±æ§ 详æ
|
| | |
| | | public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String ids) { |
| | | return R.status(CodeClstempattrService.removeBatchByIds(Func.toLongList(ids))); |
| | | } |
| | | /** |
| | | * 主é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @param baseQueryObject åºç¡æ¥è¯¢å¯¹è±¡ï¼å
嫿¥è¯¢æ¡ä»¶ï¼åé¡µï¼æåºç |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表 |
| | | */ |
| | | @GetMapping("/gridCodeClassifyTemplateAttr") |
| | | public DataGrid<CodeClstempattrVO> gridCodeClassifyTemplateAttr(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return iCodeClstempattrService.gridCodeClassifyTemplateAttr(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | |
| | | /** |
| | | * å¢å 主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public R<CodeClstempattrVO> addSave(@RequestBody CodeClstempattrDTO codeClassifyTemplateAttrDTO){ |
| | | CodeClstempattrVO codeClassifyTemplateAttrVO = iCodeClstempattrService.addSave(codeClassifyTemplateAttrDTO); |
| | | return R.data(codeClassifyTemplateAttrVO); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éä¿ååè¡¨æ°æ® |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @PostMapping( "/batchAddSave") |
| | | public R<List<CodeClstempattrVO>> batchAddSaves(@RequestBody List<CodeClstempattrDTO> list){ |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return R.fail("å表ä¸è½ä¸ºç©º!"); |
| | | } |
| | | List<CodeClstempattrVO> codeClassifyTemplateAttrVOs = iCodeClstempattrService.batchAddSave(list); |
| | | return R.data(codeClassifyTemplateAttrVOs); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public R<CodeClstempattrVO> editSave(@RequestBody CodeClstempattrDTO codeClassifyTemplateAttrDTO){ |
| | | return iCodeClstempattrService.editSave(codeClassifyTemplateAttrDTO); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public R delCodeClassifyTemplateAttr(@RequestBody CodeClstempattrDTO codeClassifyTemplateAttrDTO) { |
| | | return iCodeClstempattrService.deleteCodeClassifyTemplateAttr(codeClassifyTemplateAttrDTO); |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public R<CodeClstempattrVO> getObjectByOid(String oid){ |
| | | CodeClstempattrVO codeClassifyTemplateAttrVO = iCodeClstempattrService.getObjectByOid(oid); |
| | | return R.data(codeClassifyTemplateAttrVO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oids 主é®ï¼å¤ä¸ªä»¥éå·åéï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public R listCodeClassifyTemplateAttrByOids(String oids){ |
| | | Collection<CodeClstempattrVO> voCollection = iCodeClstempattrService.listCodeClassifyTemplateAttrByOids(VciBaseUtil.str2List(oids)); |
| | | // BaseResult baseResult = BaseResult.success(); |
| | | // baseResult.setData(voCollection); |
| | | return R.data(voCollection); |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @param baseQueryObject åºç¡æ¥è¯¢å¯¹è±¡ï¼å
嫿¥è¯¢æ¡ä»¶ï¼åé¡µï¼æåºç |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public DataGrid<CodeClstempattrVO> refDataGridCodeClassifyTemplateAttr(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return iCodeClstempattrService.refDataGridCodeClassifyTemplateAttr(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¿ä¸ªä¸å¡ç±»åä¸çææå±æ§,æé¤æè¿ä¸ªæ¨¡æ¿å·²ç»åå¨ç屿§ |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @GetMapping("/codeClassifyTemplateAttrByBtm") |
| | | public DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtm(BaseQueryObject baseQueryObject){ |
| | | return iCodeClstempattrService.codeClassifyTemplateAttrByBtm(baseQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¿ä¸ªä¸å¡ç±»åä¸ãè¿ä¸ªæ¨¡æ¿å·²ç»åå¨ç屿§ |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @GetMapping("/codeClassifyTemplateAttrByBtmHave") |
| | | public DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject){ |
| | | return iCodeClstempattrService.codeClassifyTemplateAttrByBtmHave(baseQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 忥å°å
¶ä»æ¨¡æ¿ |
| | | * @param codeClassifyAttrDTO id è±æåç§° |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PostMapping( "/copyto") |
| | | public R copyto(@RequestBody CodeClstempattrDTO codeClassifyAttrDTO) { |
| | | return iCodeClstempattrService.copyto(codeClassifyAttrDTO); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.vci.ubcs.code.mapper.CodeClstemplateMapper; |
| | | import com.vci.ubcs.code.service.ICodeClstemplateService; |
| | | import com.vci.ubcs.code.vo.CodeClstemplateVO; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.code.wrapper.PlCodeClstemplateWrapper; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/codeClstemplate") |
| | | @RequestMapping("/codeClassifyTemplateController") |
| | | @Api(value = "ç¼ç åºå®ä¹-模æ¿ç®¡ç", tags = "ç¼ç åºå®ä¹-模æ¿ç®¡çæ¥å£") |
| | | public class CodeClstemplateController extends BladeController { |
| | | |
| | |
| | | return plCodeClstemplateService.treeCodeClassifyTemplate(treeQueryObject); |
| | | } |
| | | |
| | | // /** |
| | | // * å类模æ¿å表 |
| | | // * @param baseQueryObject åºç¡æ¥è¯¢å¯¹è±¡ |
| | | // * @return æ¾ç¤ºå¯¹è±¡ |
| | | // */ |
| | | // @GetMapping("/gridCodeClassifyTemplate") |
| | | // public DataGrid<CodeClstemplateVO> gridCodeClassifyTemplate(BaseQueryObject baseQueryObject){ |
| | | // |
| | | // return plCodeClstemplateService.gridCodeClassifyTemplate(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | // } |
| | | /** |
| | | * å类模æ¿å表 |
| | | * @param baseQueryObject åºç¡æ¥è¯¢å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/gridCodeClassifyTemplate") |
| | | public DataGrid<CodeClstemplateVO> gridCodeClassifyTemplate(BaseQueryObject baseQueryObject){ |
| | | |
| | | return plCodeClstemplateService.gridCodeClassifyTemplate(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * å¢å å类模æ¿å¯¹è±¡ |
| | | * @param codeClassifyTemplateDTO å类模æ¿å¯¹è±¡æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public R<CodeClstemplateVO> addSave(@RequestBody CodeClstemplateDTO codeClassifyTemplateDTO){ |
| | | return plCodeClstemplateService.addSave(codeClassifyTemplateDTO); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ å类模æ¿å¯¹è±¡ |
| | | * @param codeClassifyTemplateDTO å类模æ¿å¯¹è±¡æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public R<CodeClstemplateVO> editSave(@RequestBody CodeClstemplateDTO codeClassifyTemplateDTO){ |
| | | return plCodeClstemplateService.editSave(codeClassifyTemplateDTO); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping( "/editDate") |
| | | public R editDate( CodeClstemplateDTO codeClassifyDTO) { |
| | | public R editDate(@RequestBody CodeClstemplateDTO codeClassifyDTO) { |
| | | return plCodeClstemplateService.updateLcStatus(codeClassifyDTO.getOid(),CodeClassifyTemplateLC.EDITING.getValue()); |
| | | } |
| | | |
| | |
| | | |
| | | return plCodeClstemplateService.Upgrade(codeClassifyDTO); |
| | | } |
| | | |
| | | @GetMapping( "/upgrade1") |
| | | public R upgrade1(@RequestBody CodeClstemplateDTO codeClassifyDTO) { |
| | | return Upgrade(codeClassifyDTO); |
| | | } |
| | | |
| | | /** |
| | | * å
é |
| | | * @param codeClassifyDTO |
| | | * @return oid模æ¿oid |
| | | */ |
| | | @PostMapping( "/copy") |
| | | public R copyTemplate(@RequestBody CodeClstemplateDTO codeClassifyDTO) { |
| | | |
| | | return plCodeClstemplateService.copyTemplate(codeClassifyDTO); |
| | | } |
| | | |
| | | @GetMapping( "/copyTemplate1") |
| | | public R copyTemplate1(@RequestBody CodeClstemplateDTO codeClassifyDTO) { |
| | | |
| | | return copyTemplate(codeClassifyDTO); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vci.ubcs.code.dto.CodeClstempattrDTO; |
| | | import com.vci.ubcs.code.entity.CodeClstempattrEntity; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeOsbtmtypeattributeVO; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | import org.springblade.core.tool.api.R; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ç¼ç åºå®ä¹-模æ¿å±æ§ æå¡ç±» |
| | |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeClstempattrVO codeClassifyTemplateAttrDO2VO(CodeClstempattrEntity codeClassifyTemplateAttrDO); |
| | | /** |
| | | * æ¥è¯¢ææç主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | DataGrid<CodeClstempattrVO> gridCodeClassifyTemplateAttr(Map<String, String> conditionMap, PageHelper pageHelper); |
| | | |
| | | |
| | | /** |
| | | * å¢å 主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | CodeClstempattrVO addSave(CodeClstempattrDTO codeClassifyTemplateAttrDTO); |
| | | |
| | | List<CodeClstempattrVO> batchAddSave(List<CodeClstempattrDTO> list); |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | R<CodeClstempattrVO> editSave(CodeClstempattrDTO codeClassifyTemplateAttrDTO); |
| | | |
| | | /** |
| | | * å é¤ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | */ |
| | | R deleteCodeClassifyTemplateAttr(CodeClstempattrDTO codeClassifyTemplateAttrDTO); |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeClstempattrVO getObjectByOid(String oid); |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oidCollections 主é®éåï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | Collection<CodeClstempattrVO> listCodeClassifyTemplateAttrByOids(Collection<String> oidCollections); |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | */ |
| | | DataGrid<CodeClstempattrVO> refDataGridCodeClassifyTemplateAttr(Map<String, String> conditionMap, PageHelper pageHelper); |
| | | |
| | | /** |
| | | * æ¥è¯¢è¿ä¸ªæ¨¡æ¿ï¼ä¸å¡ç±»åä¸çæææªéæ©ç屿§ |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtm(BaseQueryObject baseQueryObject); |
| | | /** |
| | | * æ¥è¯¢è¿ä¸ªæ¨¡æ¿ï¼ä¸å¡ç±»åä¸å·²éæ©ç屿§ |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject); |
| | | |
| | | /** |
| | | * 忥å°å
¶ä»æ¨¡æ¿ |
| | | * @param codeClassifyAttrDTO oid |
| | | * @return |
| | | */ |
| | | R copyto(CodeClstempattrDTO codeClassifyAttrDTO); |
| | | } |
| | |
| | | import com.vci.ubcs.code.vo.CodeClstemplateVO; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | |
| | | /** |
| | | * å类模æ¿å表 |
| | | * @param plCodeClstemplate æ¥è¯¢æ¡ä»¶ |
| | | * @param query å页对象 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页对象 |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | DataGrid<CodeClstemplateVO> gridCodeClassifyTemplate(CodeClstemplateVO plCodeClstemplate, Query query); |
| | | DataGrid<CodeClstemplateVO> gridCodeClassifyTemplate(Map<String, String> conditionMap, PageHelper pageHelper); |
| | | |
| | | /** |
| | | * å¢å å类模æ¿å¯¹è±¡ |
| | |
| | | * @param templateOid ä¸»é® |
| | | * @return å类模æ¿å¯¹è±¡æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | CodeClstemplateVO getObjectHasAttrByOid(String templateOid); |
| | | CodeClstemplateVO getObjectHasAttrByOid(String templateOid); |
| | | |
| | | |
| | | } |
| | |
| | | import com.vci.ubcs.code.dto.CodeOrderDTO; |
| | | import com.vci.ubcs.code.dto.datapush.BaseModelDTO; |
| | | import com.vci.ubcs.code.entity.CodeAllCode; |
| | | import com.vci.ubcs.code.entity.CodeRule; |
| | | import com.vci.ubcs.code.entity.CodeWupinEntity; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeClstemplateVO; |
| | | import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.pagemodel.KeyValue; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ä¸»æ°æ®å¼ææå¡ |
| | |
| | | * @date 2022-2-21 |
| | | */ |
| | | public interface MdmEngineService extends IService<CodeAllCode> { |
| | | |
| | | /** |
| | | * 使ç¨åç±»ç主é®è·åå¯ä»¥ä½¿ç¨ç模æ¿å¯¹è±¡ |
| | | * @param codeClassifyOid åç±»çä¸»é® |
| | |
| | | * @param orderDTO ç¼ç ç³è¯·çå
容 |
| | | */ |
| | | void checkSecValueOnOrder(CodeRuleVO ruleVO, CodeOrderDTO orderDTO); |
| | | |
| | | /** |
| | | * å°è£
å
³é®å±æ§çæ¥è¯¢è¯å¥ |
| | | * |
| | | * @param value å½åçå¼ |
| | | * @param keyRuleVO å
³é®å±æ§çæ§å¶è§åï¼å¯ä»¥ä¸ºç©º |
| | | * @param attrId 屿§çç¼å· |
| | | * @param trim æ¯å¦å»é¤ç©ºæ ¼ |
| | | * @param ignoreCase æ¯å¦ä¸åºå大å°å |
| | | * @param ignoreWidth æ¯å¦å¿½ç¥å
¨åè§ |
| | | * @param trimAll æ¯å¦å¿½ç¥å
¨é¨ç©ºæ ¼ |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | */ |
| | | void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId, |
| | | boolean trim, boolean ignoreCase, boolean ignoreWidth, |
| | | boolean trimAll, Map<String, String> conditionMap); |
| | | /** |
| | | * åå§åä¸å¡ç±»å |
| | | * --å建人é»è®¤ä¸ºå½åç¨æ·ï¼å¦æéè¦ä¿®æ¹ï¼å¯ä»¥å¨è·ååèªè¡å¤ç |
| | | * @param btmName ä¸å¡ç±»åçåç§°ï¼ä¼èªå¨åæå°å |
| | | * @return CodeWupinEntity |
| | | * @throws VciBaseException åå§ååºéçæ¯ä¼æåºå¼å¸¸ |
| | | */ |
| | | CodeWupinEntity createCBOByBtmName(String btmName); |
| | | |
| | | /** |
| | | * ä¿åå¯è¾å¯éçä¿¡æ¯ |
| | | * |
| | | * @param templateVO 模æ¿ç对象 |
| | | * @param cboList æ°æ®çå
容 |
| | | */ |
| | | void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ |
| | | List<String> cboList); |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface MdmProductCodeService { |
| | | /** |
| | | * çæç¼ç --å¹¶ä¸ä¿åæ°æ®-æ¹æ³å éï¼å æ¤ä¸è½è¿åbatchCBO |
| | |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<CodeButtonVO> codeButtonDO2VOs(Collection<CodeButton> codeButtonDOs) throws VciBaseException{ |
| | | public List<CodeButtonVO> codeButtonDO2VOs(Collection<CodeButton> codeButtonDOs) throws VciBaseException{ |
| | | List<CodeButtonVO> voList = new ArrayList<CodeButtonVO>(); |
| | | if(!CollectionUtils.isEmpty(codeButtonDOs)){ |
| | | for(CodeButton s: codeButtonDOs){ |
| | |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeButtonDO,vo); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setLcStatusText(FrameworkDataLCStatus.getTextByValue(vo.getLcStatus())); |
| | | vo.setUsedpositiontypeText(CodeUseButtonPositionTypeEnum.getTextByValue(codeButtonDO.getUsedPositionType())); |
| | | |
| | | } |
| | | return vo; |
| | | } |
| | |
| | | return codeButtonDOList; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R enableCodeButton(String id) { |
| | | CodeButton codebutton = codeButtonMapper.selectById(id); |
| | |
| | | * @return æ§è¡çç»æ |
| | | */ |
| | | private R changeLcStatus(CodeButton buttonDTO, boolean disable){ |
| | | // VciBaseUtil.alertNotNull(buttonDTO,"æ°æ®å¯¹è±¡",buttonDTO.getOid(),"主é®"); |
| | | // VciBaseUtil.alertNotNull(buttonDTO,"æ°æ®å¯¹è±¡",buttonDTO.getOid(),"主é®"); |
| | | if(disable){ |
| | | buttonDTO.setLcStatus(FrameworkDataLCStatus.ENABLED.getValue()); |
| | | }else{ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.code.constant.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.code.dto.CodeClstempattrDTO; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplateAttr; |
| | | import com.vci.ubcs.code.entity.CodeClstempattrEntity; |
| | | import com.vci.ubcs.code.entity.CodeClstemplateEntity; |
| | | import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum; |
| | | import com.vci.ubcs.code.mapper.CodeClstempattrMapper; |
| | | import com.vci.ubcs.code.mapper.CodeClstemplateMapper; |
| | | import com.vci.ubcs.code.mapper.CodeOsbtmtypeattributeMapper; |
| | | import com.vci.ubcs.code.service.ICodeClstempattrService; |
| | | import com.vci.ubcs.code.service.ICodeTempphaseService; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeOsbtmtypeattributeVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.util.PatternUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.*; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciDateUtil; |
| | | import com.vci.ubcs.system.entity.DictBiz; |
| | | import com.vci.ubcs.system.feign.IDictBizClient; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.*; |
| | | |
| | | /** |
| | | * ç¼ç åºå®ä¹-模æ¿å±æ§ æå¡å®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-04-19 |
| | | */ |
| | | @Service |
| | | public class CodeClstempattrServiceImpl extends ServiceImpl<CodeClstempattrMapper, CodeClstempattrEntity> implements ICodeClstempattrService { |
| | | |
| | | @Resource |
| | | CodeClstempattrMapper codeClstempattrMapper; |
| | | // @Resource |
| | | // ICodeTempphaseService codeTempphaseService; |
| | | @Resource |
| | | IDictBizClient iDictBizClient; |
| | | @Resource |
| | | CodeClstemplateMapper codeClstemplateMapper; |
| | | @Resource |
| | | CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper; |
| | | @Resource |
| | | ICodeTempphaseService codeTempphaseService; |
| | | |
| | | /** |
| | | * 对象çæä½ |
| | | */ |
| | | @Autowired(required = false) |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | @Override |
| | | public IPage<CodeClstempattrVO> selectCodeClstempattrPage(IPage<CodeClstempattrVO> page, CodeClstempattrVO CodeClstempattr) { |
| | | return page.setRecords(baseMapper.selectCodeClstempattrPage(page, CodeClstempattr)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¨¡æ¿ç主é®è·å模æ¿ç屿§--æ¹é |
| | | * |
| | | * @param templateOidCollection 模æ¿çä¸»é® |
| | | * @return 屿§çä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<CodeClstempattrVO> listCodeClassifyTemplateAttrByTemplateOids(Collection<String> templateOidCollection) { |
| | | if(CollectionUtils.isEmpty(templateOidCollection)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<CodeClstempattrEntity> attrDOList = new ArrayList<>(); |
| | | VciBaseUtil.switchCollectionForOracleIn(templateOidCollection).stream().forEach(templateOids->{ |
| | | // Map<String,String> conditionMap = new HashMap<>(); |
| | | // conditionMap.put("classifytemplateoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(templateOids.toArray(new String[0])) + ")"); |
| | | // PageHelper pageHelper = new PageHelper(-1); |
| | | // pageHelper.addDefaultAsc("orderNum"); |
| | | List<CodeClstempattrEntity> attrDOS = baseMapper.selectByClassifytemplateoid(VciBaseUtil.toInSql(templateOids.toArray(new String[0]))); |
| | | |
| | | if(!CollectionUtils.isEmpty(attrDOS)){ |
| | | attrDOList.addAll(attrDOS); |
| | | } |
| | | }); |
| | | return codeClassifyTemplateAttrDO2VOs(attrDOList); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDOs æ°æ®å¯¹è±¡å表 |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<CodeClstempattrVO> codeClassifyTemplateAttrDO2VOs(Collection<CodeClstempattrEntity> codeClassifyTemplateAttrDOs){ |
| | | List<CodeClstempattrVO> voList = new ArrayList<CodeClstempattrVO>(); |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOs)){ |
| | | for(CodeClstempattrEntity s: codeClassifyTemplateAttrDOs){ |
| | | CodeClstempattrVO vo = codeClassifyTemplateAttrDO2VO(s); |
| | | if(vo != null){ |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDO æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public CodeClstempattrVO codeClassifyTemplateAttrDO2VO(CodeClstempattrEntity codeClassifyTemplateAttrDO){ |
| | | CodeClstempattrVO vo = new CodeClstempattrVO(); |
| | | if(codeClassifyTemplateAttrDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributedatatype())); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææç主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClstempattrVO> gridCodeClassifyTemplateAttr(Map<String, String> conditionMap, PageHelper pageHelper) { |
| | | DataGrid<CodeClstempattrVO> dataGrid=new DataGrid<CodeClstempattrVO>(); |
| | | //没æä¼ éåæ°ï¼å°±ä¸æ§è¡æ¥è¯¢é»è¾ |
| | | if(conditionMap.size()==0){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | |
| | | if (pageHelper == null) { |
| | | pageHelper = new PageHelper(-1); |
| | | } |
| | | pageHelper.addDefaultAsc("ordernum"); |
| | | // IPage iPage = new IPage(); |
| | | Query query = new Query(); |
| | | query.setAscs("ordernum"); |
| | | // query.setSize(100); |
| | | if(pageHelper.getLimit() != -1){ |
| | | query.setSize(pageHelper.getLimit()); |
| | | query.setCurrent(pageHelper.getPage()); |
| | | } |
| | | // Condition.getPage(query) |
| | | CodeClstempattrVO codeClstempattrVO = new CodeClstempattrVO(); |
| | | // BeanUtil.toBean(map,codeClstempattrVO); |
| | | // BeanUtil |
| | | BeanMap beanMap = BeanMap.create(codeClstempattrVO); |
| | | |
| | | beanMap.putAll(conditionMap); |
| | | // Condition.getQueryWrapper( |
| | | IPage<CodeClstempattrEntity> doList = baseMapper. |
| | | selectPage(Condition.getPage(query), Condition.getQueryWrapper(codeClstempattrVO)); |
| | | |
| | | |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | // CodeClstempattrEntity codeClstempattrEntity = new CodeClstempattrEntity(); |
| | | // BeanUtils.copyProperties(conditionMap, codeClstempattrEntity); |
| | | // List<CodeClstempattrEntity> codeClstempattrEntities = new ArrayList<>(); |
| | | // BeanUtils.copyProperties(doList,codeClstempattrEntities); |
| | | // codeClstempattrEntities.addAll(doList); |
| | | dataGrid.setData(codeClassifyTemplateAttrDO2VOs(doList.getRecords())); |
| | | dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(baseMapper.selectCount(Condition.getQueryWrapper(codeClstempattrVO))))); |
| | | } |
| | | return dataGrid; |
| | | } |
| | | |
| | | /** |
| | | * å¢å 主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public CodeClstempattrVO addSave(CodeClstempattrDTO codeClassifyTemplateAttrDTO){ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"éè¦æ·»å çæ°æ®å¯¹è±¡"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = new CodeClstempattrEntity(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | baseMapper.insert(codeClassifyTemplateAttrDO); |
| | | return codeClassifyTemplateAttrDO2VO(codeClassifyTemplateAttrDO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¹éæ·»å |
| | | * @param codeClassifyTemplateAttrDTOs æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return ä¿ååçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public List<CodeClstempattrVO> batchAddSave(List<CodeClstempattrDTO> codeClassifyTemplateAttrDTOs) { |
| | | if(CollectionUtils.isEmpty(codeClassifyTemplateAttrDTOs)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | //忿屿§çè±æåç§°ï¼ç¬¬ä¸ä¸ªéªè¯éè¦ç¨å° |
| | | Map<String,CodeClstempattrDTO> attrDTOMap =codeClassifyTemplateAttrDTOs.stream().collect(Collectors.toMap(s->s.getId().toLowerCase(Locale.ROOT), t->t)); |
| | | |
| | | //æ¾å±æ§ä¸æååéå¤ |
| | | Map<String, Long> nameCountMap = codeClassifyTemplateAttrDTOs.stream().collect(Collectors.groupingBy(s -> s.getName(), Collectors.counting())); |
| | | List<String> repeatNameList = nameCountMap.keySet().stream().filter(s -> nameCountMap.get(s) > 1).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(repeatNameList)){ |
| | | throw new VciBaseException("模æ¿å±æ§ä¸æåç§°ã{0}ãéå¤",new String[]{ repeatNameList.stream().collect(Collectors.joining(","))}); |
| | | } |
| | | //æ¾å±æ§è±æååéå¤ |
| | | Map<String, Long> idCountMap = codeClassifyTemplateAttrDTOs.stream().collect(Collectors.groupingBy(s -> s.getId().toLowerCase(Locale.ROOT), Collectors.counting())); |
| | | List<String> repeatIdList = idCountMap.keySet().stream().filter(s -> idCountMap.get(s) > 1).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(repeatIdList)){ |
| | | throw new VciBaseException("模æ¿å±æ§è±æåç§°ã{0}ãéå¤",new String[]{ repeatIdList.stream().collect(Collectors.joining(","))}); |
| | | } |
| | | |
| | | //模æ¿oid |
| | | String CLASSIFYTEMPLATEOID = null; |
| | | //è½¬æ¢ |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOInsert = new ArrayList<CodeClstempattrEntity>(); |
| | | List<String> prefix = new ArrayList<>(); |
| | | List<String> suffix = new ArrayList<>(); |
| | | List<String> dateFormates = new ArrayList<>(); |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDTO:codeClassifyTemplateAttrDTOs){ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"éè¦æ·»å çæ°æ®å¯¹è±¡"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = new CodeClstempattrEntity(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | codeClassifyTemplateAttrDOInsert.add(codeClassifyTemplateAttrDO); |
| | | |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getPrefixvalue())){ |
| | | prefix.add(codeClassifyTemplateAttrDO.getPrefixvalue()); |
| | | } |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getSuffixvalue())){ |
| | | suffix.add(codeClassifyTemplateAttrDO.getSuffixvalue()); |
| | | } |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getCodedateformat())){ |
| | | dateFormates.add(codeClassifyTemplateAttrDO.getCodedateformat()); |
| | | } |
| | | //å¤æä¼ è¿æ¥çæä¸¾æ³¨å
¥æ¯å¦æ¯jsonArræ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getEnumstring())&&!checkKVArr(codeClassifyTemplateAttrDO.getEnumstring())){ |
| | | throw new VciBaseException("{0}{1}屿§çæä¸¾æ³¨å
¥æ°æ®æ ¼å¼é误!",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | //å类注å
¥ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getClassifyinvokeattr()) |
| | | && !CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(codeClassifyTemplateAttrDO.getClassifyinvokelevel()) |
| | | && VciBaseUtil.getInt(codeClassifyTemplateAttrDO.getClassifyinvokelevel()) < 0){ |
| | | throw new VciBaseException("{0}{1}屿§çæ¯å类注å
¥ï¼ä½æ¯æ³¨å
¥å±çº§ä¸è½å°äº0!",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | |
| | | //å¤æä¼ è¿æ¥çåç
§é
ç½®æ¯å¦æ¯jsonæ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getReferconfig())&&!checkKVObj(codeClassifyTemplateAttrDO.getReferconfig())){ |
| | | throw new VciBaseException("{0}{1}屿§çåç
§é
ç½®æ°æ®æ ¼å¼é误!",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDO.getCodedateformat()) && !checkDateFormat(codeClassifyTemplateAttrDO.getCodedateformat())){ |
| | | throw new VciBaseException("{0}{1}屿§çæ¶é´æ ¼å¼ä¸ç¬¦åè¦æ±",new String[]{codeClassifyTemplateAttrDO.getId(),codeClassifyTemplateAttrDO.getName()}); |
| | | } |
| | | //妿æ¯ç»åè§åï¼éé¢ä½¿ç¨ç屿§ä¸è½ç¼ºå¤±ï¼ä¹é½å¾æ¾ç¤º |
| | | String componentrule = codeClassifyTemplateAttrDTO.getComponentrule(); |
| | | boolean isContainsDynamicParameter = PatternUtil.isContainsDynamicParameter(componentrule); |
| | | if(isContainsDynamicParameter){ |
| | | List<String> userdAttrList = PatternUtil.getKeyListByContent(componentrule);//å
å«çææ${xxx}ä¸çxxx |
| | | if(!CollectionUtils.isEmpty(userdAttrList)){ |
| | | String unExistAttr = userdAttrList.stream().filter(s -> !attrDTOMap.containsKey(s.toLowerCase(Locale.ROOT))).collect(Collectors.joining(",")); |
| | | if(StringUtils.isNotBlank(unExistAttr)){ |
| | | throw new VciBaseException("{0}屿§æ¯ç»åè§åï¼ä½æ¯è§åéå
å«ç屿§[{1}]å¨å½å模æ¿ä¸ä¸åå¨!",new String[]{codeClassifyTemplateAttrDO.getName(), unExistAttr}); |
| | | } |
| | | //è¦ççè¡¨åæ¯å¦æ¾ç¤º |
| | | String unFormDisplayAttr = userdAttrList.stream().filter(s -> !VciBaseUtil.getBoolean(attrDTOMap.getOrDefault(s.toLowerCase(Locale.ROOT), |
| | | new CodeClstempattrDTO()).getFormdisplayflag())).collect(Collectors.joining(",")); |
| | | if(StringUtils.isNotBlank(unFormDisplayAttr)){ |
| | | throw new VciBaseException("{0}屿§æ¯ç»åè§åï¼ä½æ¯è§åéå
å«ç屿§[{1}]å¨å½å模æ¿ä¸æ²¡æè®¾ç½® è¡¨åæ¾ç¤º ",new String[]{codeClassifyTemplateAttrDO.getName(),unFormDisplayAttr}); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(CLASSIFYTEMPLATEOID==null){ |
| | | CLASSIFYTEMPLATEOID = codeClassifyTemplateAttrDTO.getClassifytemplateoid(); |
| | | } |
| | | |
| | | } |
| | | |
| | | //æ§è¡æ°æ®ä¿åæä½ |
| | | // WebUtil.setPersistence(false);//䏿§è¡ä¿å |
| | | |
| | | //å
é½å äº |
| | | // VciQueryWrapperForDO deleteAttrWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // deleteAttrWrapper.addQueryMap("CLASSIFYTEMPLATEOID",CLASSIFYTEMPLATEOID); |
| | | Map<String,Object> condition = new HashMap<>(); |
| | | condition.put("CLASSIFYTEMPLATEOID",CLASSIFYTEMPLATEOID); |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDODelete = baseMapper.selectByMap(condition); |
| | | |
| | | //oids |
| | | List<String> oids = new ArrayList<String>(); |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDODelete){ |
| | | oids.add(codeClassifyTemplateAttrDO.getOid()); |
| | | } |
| | | // BatchCBO batchCBOTemplateDelete = new BatchCBO(); |
| | | if(!CollectionUtils.isEmpty(oids)){ |
| | | baseMapper.deleteBatchIds(oids); |
| | | } |
| | | |
| | | //åæ°å¢ |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOInsert)){ |
| | | this.saveBatch(codeClassifyTemplateAttrDOInsert); |
| | | } |
| | | |
| | | //è°ç¨é¶æ®µ |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOInsert)){ |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrs = new ArrayList<>(); |
| | | for (CodeClstempattrEntity codeClstempattrEntity : codeClassifyTemplateAttrDOInsert) { |
| | | CodeClassifyTemplateAttr codeClassifyTemplateAttr = new CodeClassifyTemplateAttr(); |
| | | BeanUtils.copyProperties(codeClstempattrEntity,codeClassifyTemplateAttr);; |
| | | codeClassifyTemplateAttrs.add(codeClassifyTemplateAttr); |
| | | } |
| | | codeTempphaseService.codeTemplateAttrModifyTrigger(codeClassifyTemplateAttrs); |
| | | |
| | | } |
| | | |
| | | |
| | | // SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | //å¤çå¯è¾å¯éçå符 |
| | | if(!CollectionUtils.isEmpty(prefix)){ |
| | | for (String s : prefix) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue("prefix"); |
| | | iDictBizClient.getCheck(dictBiz) ; |
| | | } |
| | | // .saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"prefix",prefix,sessionInfo); |
| | | } |
| | | if(!CollectionUtils.isEmpty(suffix)){ |
| | | for (String s : suffix) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue("suffix"); |
| | | iDictBizClient.getCheck(dictBiz) ; |
| | | } |
| | | // charService.saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"suffix",suffix,sessionInfo); |
| | | } |
| | | if(!CollectionUtils.isEmpty(dateFormates)){ |
| | | for (String s : dateFormates) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue("dateFormates"); |
| | | iDictBizClient.getCheck(dictBiz) ; |
| | | } |
| | | // charService.saveBySameNamespaceAndFlag(MdmBtmTypeConstant.CODE_CLASSIFY_TEMPLATE_ATTR,"dateFormates",dateFormates,sessionInfo); |
| | | } |
| | | |
| | | // WebUtil.setPersistence(true);//æ§è¡ä¿å |
| | | // boService.persistenceBatch(batchCBOTemplateDelete);//ä¸èµ·æ§è¡ä¿å |
| | | return codeClassifyTemplateAttrDO2VOs(codeClassifyTemplateAttrDOInsert); |
| | | } |
| | | |
| | | public boolean checkKVArr(String kvString){ |
| | | boolean isKV = true; |
| | | try { |
| | | JSONObject.parseArray(kvString, KeyValue.class); |
| | | }catch (Exception e){ |
| | | isKV=false; |
| | | } |
| | | return isKV; |
| | | } |
| | | public boolean checkKVObj(String kvString){ |
| | | boolean isKV = true; |
| | | try { |
| | | JSONObject.parseObject(kvString, UIFormReferVO.class); |
| | | }catch (Exception e){ |
| | | isKV=false; |
| | | } |
| | | return isKV; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¶é´æ ¼å¼ |
| | | * @param dateFormat æ¶é´æ ¼å¼ |
| | | * @return trueè¡¨ç¤ºæ ¡éªéè¿ |
| | | */ |
| | | public boolean checkDateFormat(String dateFormat){ |
| | | try{ |
| | | VciDateUtil.date2Str(new Date(),dateFormat); |
| | | return true; |
| | | }catch (Throwable e){ |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¯ä¸é¡¹ï¼å¿
è¾é¡¹ä¸éè¿æ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public R editSave(CodeClstempattrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"æ°æ®å¯¹è±¡",codeClassifyTemplateAttrDTO.getOid(),"主é¢åºåç±»çæ¨¡æ¿å±æ§ä¸»é®"); |
| | | |
| | | //å¤æä¼ è¿æ¥çæä¸¾æ³¨å
¥æ¯å¦æ¯jsonArræ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getEnumstring())&&!checkKVArr(codeClassifyTemplateAttrDTO.getEnumstring())){ |
| | | throw new VciBaseException("æä¸¾æ³¨å
¥æ°æ®æ ¼å¼é误!"); |
| | | } |
| | | |
| | | //å¤æä¼ è¿æ¥çåç
§é
ç½®æ¯å¦æ¯jsonæ ¼å¼ |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttrDTO.getReferbtmid())&&!checkKVObj(codeClassifyTemplateAttrDTO.getReferbtmid())){ |
| | | throw new VciBaseException("æä¸¾æ³¨å
¥æ°æ®æ ¼å¼é误!"); |
| | | } |
| | | |
| | | |
| | | //æ£æ¥ts |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDOCopyFromDTO = new CodeClstempattrEntity(); |
| | | // BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDOCopyFromDTO); |
| | | // boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOCopyFromDTO); |
| | | |
| | | //æ£æ¥ts |
| | | // Map<String,Object> condition = new HashMap<>(2); |
| | | // condition.put("oid",codeClassifyTemplateAttrDTO.getOid()); |
| | | // condition.put("ts",codeClassifyTemplateAttrDTO.getTs()); |
| | | CodeClstempattrEntity detail = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | if(!detail.getTs().toString().equals(codeClassifyTemplateAttrDTO.getTs().toString())){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | revisionModelUtil.copyFromDTOIgnore(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | baseMapper.updateById(codeClassifyTemplateAttrDO); |
| | | return R.data(codeClassifyTemplateAttrDO2VO(codeClassifyTemplateAttrDO)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param codeClassifyTemplateAttrDTO 主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼è¢«å¼ç¨æ¶æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public R deleteCodeClassifyTemplateAttr(CodeClstempattrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateAttrDTO,"主é¢åºåç±»çæ¨¡æ¿å±æ§æ°æ®å¯¹è±¡",codeClassifyTemplateAttrDTO.getOid(),"主é¢åºåç±»çæ¨¡æ¿å±æ§ç主é®"); |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | R baseResult = checkIsCanDeleteForDO(codeClassifyTemplateAttrDTO,codeClassifyTemplateAttrDO); |
| | | if(baseResult.isSuccess()) { |
| | | }else{ |
| | | return baseResult; |
| | | } |
| | | //æ§è¡å é¤æä½ |
| | | int deleteNum = baseMapper.deleteById(codeClassifyTemplateAttrDO.getOid()); |
| | | return deleteNum>0?R.success(DELETE_SUCCESS):R.fail(DELETE_FAIL); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦å¯ä»¥å é¤ï¼å¦æåå¨ä¸çº§ï¼å¹¶ä¸ä¸çº§ææ°æ®å¼ç¨åä¸è½å é¤ |
| | | * @param codeClassifyTemplateAttrDTO æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDO æ°æ®åºä¸çæ°æ®å¯¹è±¡ |
| | | * @return success为true为å¯ä»¥å é¤ï¼falseè¡¨ç¤ºææ°æ®å¼ç¨ï¼obj为true表示æä¸çº§ |
| | | */ |
| | | private R checkIsCanDeleteForDO(CodeClstempattrDTO codeClassifyTemplateAttrDTO, CodeClstempattrEntity codeClassifyTemplateAttrDO) { |
| | | // boService.checkTs(codeClassifyTemplateAttrDO); |
| | | // Map<String,Object> condition = new HashMap<>(2); |
| | | // condition.put("oid",codeClassifyTemplateAttrDTO.getOid()); |
| | | // condition.put("ts",codeClassifyTemplateAttrDTO.getTs()); |
| | | CodeClstempattrEntity detail = baseMapper.selectById(codeClassifyTemplateAttrDTO.getOid()); |
| | | // .selectOne(Condition.getQueryWrapper(condition,CodeClstempattrEntity.class)); |
| | | |
| | | if(!detail.getTs().toString().equals(codeClassifyTemplateAttrDTO.getTs().toString())){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | if(!checkIsLinked(codeClassifyTemplateAttrDO.getOid())) { |
| | | return R.success("å¯ä»¥å é¤ï¼"); |
| | | }else{ |
| | | return R.fail(DATA_LINKED_NOT_DELETE); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦è¢«å¼ç¨ |
| | | * @param oid ä¸»é® |
| | | * @throws VciBaseException 被å¼ç¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private boolean checkIsLinked(String oid) throws VciBaseException{ |
| | | //TODO æ·»å éè¦æ ¡éªå¼ç¨çå°æ¹ |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ°æ®ä¸å卿¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClstempattrVO getObjectByOid(String oid) throws VciBaseException{ |
| | | return codeClassifyTemplateAttrDO2VO(selectByOid(oid)); |
| | | } |
| | | /** |
| | | * 䏻鮿¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oid ä¸»é® |
| | | * @return æ°æ®å¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¹¶ä¸æ°æ®ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private CodeClstempattrEntity selectByOid(String oid) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(oid,"主é®"); |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = baseMapper.selectById(oid.trim()); |
| | | if(codeClassifyTemplateAttrDO == null || StringUtils.isBlank(codeClassifyTemplateAttrDO.getOid())){ |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | return codeClassifyTemplateAttrDO; |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·å主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param oidCollections 主é®éåï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException æ¥è¯¢åºç°å¼å¸¸æ¶ä¼æåº |
| | | */ |
| | | @Override |
| | | public Collection<CodeClstempattrVO> listCodeClassifyTemplateAttrByOids(Collection<String> oidCollections) { |
| | | VciBaseUtil.alertNotNull(oidCollections,"æ°æ®å¯¹è±¡ä¸»é®éå"); |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = listCodeClassifyTemplateAttrDOByOidCollections(oidCollections); |
| | | return codeClassifyTemplateAttrDO2VOs(codeClassifyTemplateAttrDOList); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®éåæ¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oidCollections 主é®çéå |
| | | * @return æ°æ®å¯¹è±¡å表 |
| | | */ |
| | | private List<CodeClstempattrEntity> listCodeClassifyTemplateAttrDOByOidCollections(Collection<String> oidCollections){ |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = new ArrayList<CodeClstempattrEntity>(); |
| | | if(!CollectionUtils.isEmpty(oidCollections)){ |
| | | Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); |
| | | for(Collection<String> oids: oidCollectionsList){ |
| | | List<CodeClstempattrEntity> tempDOList = baseMapper.selectBatchIds(oids); |
| | | if(!CollectionUtils.isEmpty(tempDOList)){ |
| | | codeClassifyTemplateAttrDOList.addAll(tempDOList); |
| | | } |
| | | } |
| | | } |
| | | return codeClassifyTemplateAttrDOList; |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClstempattrVO> refDataGridCodeClassifyTemplateAttr(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException{ |
| | | if(conditionMap == null){ |
| | | conditionMap = new HashMap<String, String>(); |
| | | } |
| | | return gridCodeClassifyTemplateAttr(conditionMap,pageHelper); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¿ä¸ªæ¨¡æ¿ï¼ä¸å¡ç±»åä¸çæææªéæ©ç屿§ |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtm(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject.getConditionMap() == null){ |
| | | baseQueryObject.setConditionMap(new HashMap<>()); |
| | | } |
| | | DataGrid<CodeOsbtmtypeattributeVO> dataGrid=new DataGrid<CodeOsbtmtypeattributeVO>(); |
| | | //模æ¿oid |
| | | String templateAttrOid = baseQueryObject.getConditionMap().get("oid"); |
| | | String name = baseQueryObject.getConditionMap().getOrDefault("name",""); |
| | | String id = baseQueryObject.getConditionMap().getOrDefault("id",""); |
| | | |
| | | //没æoid䏿§è¡é»è¾ |
| | | if(StringUtils.isBlank(templateAttrOid)){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | |
| | | //æ¥è¯¢æ¨¡æ¿å¯¹è±¡ |
| | | CodeClstemplateEntity codeClassifyTemplateDO = codeClstemplateMapper.selectById(templateAttrOid); |
| | | |
| | | //è¿ä¸ªä¸å¡ç±»åä¸çææå±æ§ |
| | | List<CodeOsbtmtypeattributeVO> boAttrs = (List<CodeOsbtmtypeattributeVO>) codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId());// this.btmService.listAttributeByBtmId(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // BeanUtils.copyProperties(codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()),boAttrs); |
| | | //æé»è®¤ç屿§ä¹æ·»å å°boAttrs |
| | | if(boAttrs == null){ |
| | | boAttrs = new ArrayList<>(); |
| | | } |
| | | if(!false){ |
| | | // List<CodeOsbtmtypeattributeVO> finalBoAttrs = boAttrs; |
| | | // attributeService.getDefaultAttributeVOs().stream().forEach(attr-> { |
| | | // CodeOsbtmtypeattributeVO attributeVO = new CodeOsbtmtypeattributeVO(); |
| | | // BeanUtil.convert(attr, attributeVO); |
| | | // if ("id".equalsIgnoreCase(attributeVO.getId())) { |
| | | // attributeVO.setName("ä¼ä¸ç¼ç "); |
| | | // } |
| | | // if ("name".equalsIgnoreCase(attributeVO.getId())) { |
| | | // attributeVO.setName("éå¢ç "); |
| | | // } |
| | | // attributeVO.setAttrDataType(attr.getAttributeDataType()); |
| | | // attributeVO.setAttributeLength(attr.getAttrLength()); |
| | | // attributeVO.setReferBtmTypeId(attr.getBtmTypeId()); |
| | | // attributeVO.setReferBtmTypeName(attr.getBtmTypeName()); |
| | | // finalBoAttrs.add(attributeVO); |
| | | // }); |
| | | // boAttrs = finalBoAttrs; |
| | | Object o = null; |
| | | } |
| | | |
| | | //è¿ä¸ªæ¨¡æ¿ä¸å·²ç»æç屿§ |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | Map<String,Object> condition = new HashMap<>(1); |
| | | condition.put("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = codeClstempattrMapper.selectByMap(condition); |
| | | |
| | | List<String> btmOids = new ArrayList<String>(); |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDOList){ |
| | | btmOids.add(codeClassifyTemplateAttrDO.getId()); |
| | | } |
| | | |
| | | //è¿æ»¤æå·²ç»åå¨ç屿§ |
| | | List<CodeOsbtmtypeattributeVO> boAttrss = new ArrayList<CodeOsbtmtypeattributeVO>(); |
| | | |
| | | for (CodeOsbtmtypeattributeVO osBtmTypeAttributeVO:boAttrs){ |
| | | if(!btmOids.contains(osBtmTypeAttributeVO.getId())){ |
| | | //ççæ¯ä¸æ¯ææ¨¡ç³æ¥è¯¢ |
| | | boolean inSearch = true; |
| | | if(StringUtils.isNotBlank(name) && !osBtmTypeAttributeVO.getName().contains(name.replace("*",""))){ |
| | | inSearch = false; |
| | | } |
| | | if(StringUtils.isNotBlank(id) && !osBtmTypeAttributeVO.getId().contains(id.replace("*",""))){ |
| | | inSearch = false; |
| | | } |
| | | if(inSearch) { |
| | | boAttrss.add(osBtmTypeAttributeVO); |
| | | } |
| | | } |
| | | } |
| | | dataGrid.setData(boAttrss); |
| | | dataGrid.setTotal(boAttrss.size()); |
| | | return dataGrid; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢è¿ä¸ªæ¨¡æ¿ï¼ä¸å¡ç±»åä¸å·²éæ©ç屿§ |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeOsbtmtypeattributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject){ |
| | | DataGrid<CodeOsbtmtypeattributeVO> dataGrid=new DataGrid<CodeOsbtmtypeattributeVO>(); |
| | | //模æ¿oid |
| | | String templateAttrOid = baseQueryObject.getConditionMap().get("oid"); |
| | | |
| | | //没æoid䏿§è¡é»è¾ |
| | | if(StringUtils.isBlank(templateAttrOid)){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | |
| | | //æ¥è¯¢æ¨¡æ¿å¯¹è±¡ |
| | | CodeClstemplateEntity codeClassifyTemplateDO = codeClstemplateMapper.selectById(templateAttrOid); |
| | | |
| | | //è¿ä¸ªä¸å¡ç±»åä¸çææå±æ§ |
| | | List<CodeOsbtmtypeattributeVO> boAttrs = (List<CodeOsbtmtypeattributeVO>) codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId());//this.btmService.listAttributeByBtmIdHasDefault(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()); |
| | | // BeanUtils.copyProperties(codeOsbtmtypeattributeMapper.selectById(codeClassifyTemplateDO.getBtmTypeId()),boAttrs); |
| | | //è¿ä¸ªæ¨¡æ¿ä¸å·²ç»æç屿§ |
| | | //æé»è®¤ç屿§ä¹æ·»å å°boAttrs |
| | | if(boAttrs == null){ |
| | | boAttrs = new ArrayList<>(); |
| | | } |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // queryWrapper.addQueryMap("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | | // Map<String,Object> condition = new HashMap<>(1); |
| | | // condition.put("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | | QueryWrapper<CodeClstempattrEntity> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("CLASSIFYTEMPLATEOID",templateAttrOid); |
| | | |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = codeClstempattrMapper.selectList(wrapper); |
| | | List<String> btmOids = new ArrayList<String>(); |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDO:codeClassifyTemplateAttrDOList){ |
| | | btmOids.add(codeClassifyTemplateAttrDO.getId()); |
| | | } |
| | | |
| | | //è¿æ»¤æé¤äºèªèº«çå«ç屿§ |
| | | List<CodeOsbtmtypeattributeVO> boAttrss = new ArrayList<CodeOsbtmtypeattributeVO>(); |
| | | |
| | | for (CodeOsbtmtypeattributeVO osBtmTypeAttributeVO:boAttrs){ |
| | | if(btmOids.contains(osBtmTypeAttributeVO.getId())){ |
| | | boAttrss.add(osBtmTypeAttributeVO); |
| | | } |
| | | } |
| | | dataGrid.setData(boAttrss); |
| | | dataGrid.setTotal(boAttrss.size()); |
| | | return dataGrid; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 忥å°å
¶ä»æ¨¡æ¿ |
| | | * @param codeClassifyTemplateAttrDTO oid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R copyto(CodeClstempattrDTO codeClassifyTemplateAttrDTO) throws VciBaseException{ |
| | | |
| | | String templateAttrOid = codeClassifyTemplateAttrDTO.getOid(); |
| | | |
| | | //æ¥è¯¢åºæ¥è¦å¤å¶ç对象 |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDO = selectByOid(templateAttrOid); |
| | | String id = codeClassifyTemplateAttrDO.getId();//è±æåç§° |
| | | String classfyTemplateOid = codeClassifyTemplateAttrDO.getClassifytemplateoid(); |
| | | |
| | | //æ¥è¯¢å
¶ä»id=idçæ¨¡æ¿å±æ§ |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // queryWrapper.addQueryMap("id",id); |
| | | // Map<String,Object> condition = new HashMap<>(1); |
| | | // condition.put("id",id); |
| | | QueryWrapper<CodeClstempattrEntity> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("id",id); |
| | | //ææid=idçæ¨¡æ¿å±æ§ |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList =codeClstempattrMapper.selectList(wrapper); |
| | | |
| | | //è¦å é¤ç模æ¿å±æ§çoids |
| | | List<String> deleteOids = new ArrayList<String>(); |
| | | //è¦ä¿®æ¹ç模æ¿å±æ§å¯¹è±¡ |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOListInsert = new ArrayList<CodeClstempattrEntity>(); |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDOi:codeClassifyTemplateAttrDOList){ |
| | | String oid = codeClassifyTemplateAttrDOi.getOid(); |
| | | String templateOldOid = codeClassifyTemplateAttrDOi.getClassifytemplateoid(); |
| | | |
| | | CodeClstempattrEntity codeClassifyTemplateAttrDOInsert = new CodeClstempattrEntity(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,codeClassifyTemplateAttrDOInsert); |
| | | codeClassifyTemplateAttrDOInsert.setOid(oid); |
| | | codeClassifyTemplateAttrDOInsert.setClassifytemplateoid(templateOldOid); |
| | | codeClassifyTemplateAttrDOListInsert.add(codeClassifyTemplateAttrDOInsert); |
| | | |
| | | deleteOids.add(codeClassifyTemplateAttrDOi.getOid()); |
| | | } |
| | | |
| | | // WebUtil.setPersistence(false);//䏿§è¡ä¿å |
| | | |
| | | //å é¤ |
| | | // BatchCBO batchCBOTemplateAttrDelete = codeClassifyTemplateAttrDOissifyTemplateAttrMapper.batchDeleteByOids(deleteOids); |
| | | codeClstempattrMapper.deleteBatchIds(deleteOids); |
| | | //åæ°å¢ |
| | | // BatchCBO batchCBOTemplateAttrInsert = codeClassifyTemplateAttrMapper.batchInsert(codeClassifyTemplateAttrDOListInsert); |
| | | // batchCBOTemplateAttrDelete.copyFromOther(batchCBOTemplateAttrInsert); |
| | | this.saveBatch(codeClassifyTemplateAttrDOListInsert); |
| | | |
| | | // WebUtil.setPersistence(true);//æ§è¡ä¿å |
| | | // boService.persistenceBatch(batchCBOTemplateAttrDelete);//ä¸èµ·æ§è¡ä¿å |
| | | |
| | | return R.success("æä½æåï¼"); |
| | | } |
| | | } |
| | |
| | | import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; |
| | | import com.vci.ubcs.code.mapper.*; |
| | | import com.vci.ubcs.code.service.ICodeClassifyService; |
| | | import com.vci.ubcs.code.service.ICodeClassifyTemplateAttrService; |
| | | import com.vci.ubcs.code.service.ICodeClstemplateService; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeClstemplateVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | |
| | | import com.vci.ubcs.starter.revision.model.TreeWrapperOptions; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | */ |
| | | @Lazy |
| | | @Autowired(required = false) |
| | | ICodeClassifyTemplateAttrService codeClstempattrService; |
| | | CodeClstempattrServiceImpl codeClstempattrService; |
| | | |
| | | /** |
| | | * 对象çæä½ |
| | |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | @Autowired(required = false) |
| | | private CodeClassifyTemplateAttrMapper codeClstempattrMapper; |
| | | private CodeClstempattrMapper codeClstempattrMapper; |
| | | @Autowired(required = false) |
| | | private CodeTempphaseServiceImpl codeTempphaseServiceImpl; |
| | | @Autowired(required = false) |
| | |
| | | if(hasAttr){ |
| | | //ä¸ä¸ªåç±»é颿»ä¸è½è¶
è¿1000个çæççæ¬å§ï¼ï¼ï¼ |
| | | VciBaseUtil.switchCollectionForOracleIn(voList.stream().map(CodeClstemplateVO::getOid).collect(Collectors.toList())).forEach(tempOids->{ |
| | | List<CodeClassifyTemplateAttrVO> attrVOList = codeClstempattrService.listCodeClassifyTemplateAttrByTemplateOids(tempOids); |
| | | List<CodeClstempattrVO> attrVOList = codeClstempattrService.listCodeClassifyTemplateAttrByTemplateOids(tempOids); |
| | | |
| | | if(!CollectionUtils.isEmpty(attrVOList)){ |
| | | Map<String, List<CodeClassifyTemplateAttrVO>> attrVOMap = attrVOList.stream().collect(Collectors.groupingBy(s -> s.getClassifyTemplateOid())); |
| | | |
| | | Map<String, List<CodeClstempattrVO>> attrVOMap = attrVOList.stream().collect(Collectors.groupingBy(s -> s.getClassifytemplateoid())); |
| | | voList.stream().forEach(templateVO->{ |
| | | if(attrVOMap.containsKey(templateVO.getOid())){ |
| | | templateVO.setAttributes(attrVOMap.get(templateVO.getOid())); |
| | | List<CodeClstempattrVO> codeClstempattrVOS = attrVOMap.get(templateVO.getOid()); |
| | | List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOS = new ArrayList<>(); |
| | | for (CodeClstempattrVO codeClstempattrVO : codeClstempattrVOS) { |
| | | CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = new CodeClassifyTemplateAttrVO(); |
| | | BeanUtils.copyProperties(codeClstempattrVO,codeClassifyTemplateAttrVO); |
| | | codeClassifyTemplateAttrVOS.add(codeClassifyTemplateAttrVO); |
| | | } |
| | | templateVO.setAttributes(codeClassifyTemplateAttrVOS); |
| | | } |
| | | }); |
| | | } |
| | |
| | | //å 餿¨¡æ¿å±æ§ |
| | | // VciQueryWrapperForDO templateQueryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // templateQueryWrapper.addQueryMap("classifyTemplateOid",templateOid); |
| | | List<CodeClassifyTemplateAttr> codeClstempattrEntityList = codeClstempattrMapper.selectRefByOid(templateOid); |
| | | List<CodeClstempattrEntity> codeClstempattrEntityList = codeClstempattrMapper.selectRefByOid(templateOid); |
| | | |
| | | if(!CollectionUtils.isEmpty(codeClstempattrEntityList)) { |
| | | List<String> templateAttrOids = new ArrayList<String>(); |
| | | for (CodeClassifyTemplateAttr codeClstempattrEntity:codeClstempattrEntityList){ |
| | | for (CodeClstempattrEntity codeClstempattrEntity:codeClstempattrEntityList){ |
| | | templateAttrOids.add(codeClstempattrEntity.getOid()); |
| | | } |
| | | |
| | |
| | | // ClientBusinessObject clientBusinessObject_template_insert = null; |
| | | // try { |
| | | // clientBusinessObject_template_insert = clientBusinessObjectOperation.reviseBusinessObject(clientBusinessObject_template, ""); |
| | | codeCls_template_insert.setOid(VciBaseUtil.getPk()); |
| | | codeCls_template_insert.setRevisionOid(VciBaseUtil.getPk()); |
| | | codeCls_template_insert.setNameOid(codeCls_template.getNameOid()); |
| | | codeCls_template_insert.setBtmname(codeCls_template.getBtmname()); |
| | | codeCls_template_insert.setLastR(String.valueOf(1)); |
| | | codeCls_template_insert.setFirstR(String.valueOf(0)); |
| | | codeCls_template_insert.setFirstV(String.valueOf(1)); |
| | | codeCls_template_insert.setLastV(String.valueOf(1)); |
| | | codeCls_template_insert.setCreator(AuthUtil.getUser().getUserName()); |
| | | codeCls_template_insert.setCreateTime(new Date()); |
| | | codeCls_template_insert.setLastModifier(AuthUtil.getUser().getUserName()); |
| | | codeCls_template_insert.setLastModifyTime(new Date()); |
| | | codeCls_template_insert.setRevisionRule(codeCls_template.getRevisionRule()); |
| | | codeCls_template_insert.setVersionRule(codeCls_template.getVersionRule()); |
| | | Map rvObj = baseMapper.getNextRevision(codeCls_template.getNameOid()); |
| | | codeCls_template_insert.setRevisionSeq(Integer.parseInt(rvObj.get("REVISIONSEQ").toString())); |
| | | codeCls_template_insert.setRevisionValue(rvObj.get("REVISIONVAL").toString()); |
| | | codeCls_template_insert.setOid(VciBaseUtil.getPk()); |
| | | codeCls_template_insert.setRevisionOid(VciBaseUtil.getPk()); |
| | | codeCls_template_insert.setNameOid(codeCls_template.getNameOid()); |
| | | codeCls_template_insert.setBtmname(codeCls_template.getBtmname()); |
| | | codeCls_template_insert.setLastR(String.valueOf(1)); |
| | | codeCls_template_insert.setFirstR(String.valueOf(0)); |
| | | codeCls_template_insert.setFirstV(String.valueOf(1)); |
| | | codeCls_template_insert.setLastV(String.valueOf(1)); |
| | | codeCls_template_insert.setCreator(AuthUtil.getUser().getUserName()); |
| | | codeCls_template_insert.setCreateTime(new Date()); |
| | | codeCls_template_insert.setLastModifier(AuthUtil.getUser().getUserName()); |
| | | codeCls_template_insert.setLastModifyTime(new Date()); |
| | | codeCls_template_insert.setRevisionRule(codeCls_template.getRevisionRule()); |
| | | codeCls_template_insert.setVersionRule(codeCls_template.getVersionRule()); |
| | | Map rvObj = baseMapper.getNextRevision(codeCls_template.getNameOid()); |
| | | codeCls_template_insert.setRevisionSeq(Integer.parseInt(rvObj.get("REVISIONSEQ").toString())); |
| | | codeCls_template_insert.setRevisionValue(rvObj.get("REVISIONVAL").toString()); |
| | | // VersionValueObject versionObj = this.getVersionValue(item.verRuleName); |
| | | codeCls_template_insert.setVersionSeq(Integer.parseInt(rvObj.get("VERSIONSEQ").toString())); |
| | | codeCls_template_insert.setVersionValue(rvObj.get("VERSIONVAL").toString()); |
| | | codeCls_template_insert.setLctid(codeCls_template.getLctid()); |
| | | codeCls_template_insert.setLcStatus("Editing"); |
| | | codeCls_template_insert.setId(codeCls_template.getId()); |
| | | codeCls_template_insert.setName(codeCls_template.getName()); |
| | | codeCls_template_insert.setDescription(codeCls_template.getDescription()); |
| | | codeCls_template_insert.setOwner(AuthUtil.getUser().getUserName()); |
| | | codeCls_template_insert.setVersionSeq(Integer.parseInt(rvObj.get("VERSIONSEQ").toString())); |
| | | codeCls_template_insert.setVersionValue(rvObj.get("VERSIONVAL").toString()); |
| | | codeCls_template_insert.setLctid(codeCls_template.getLctid()); |
| | | codeCls_template_insert.setLcStatus("Editing"); |
| | | codeCls_template_insert.setId(codeCls_template.getId()); |
| | | codeCls_template_insert.setName(codeCls_template.getName()); |
| | | codeCls_template_insert.setDescription(codeCls_template.getDescription()); |
| | | codeCls_template_insert.setOwner(AuthUtil.getUser().getUserName()); |
| | | // codeCls_template_insert.setCheckinBy(userName); |
| | | codeCls_template_insert.setCopyFromVersion(codeCls_template.getOid()); |
| | | codeCls_template_insert.setCopyFromVersion(codeCls_template.getOid()); |
| | | // }catch (VCIError e){ |
| | | // e.printStackTrace(); |
| | | // logger.error("===============>å类模æ¿-åçå¤å¶åºéoidï¼ "+templateOldOid+",mes"+e.error_message); |
| | |
| | | // codeClassifyTemplateAttrQuery.addQueryMap("classifyTemplateOid",templateOldOid); |
| | | Map<String,Object> condition = new HashMap<>(1); |
| | | condition.put("classifyTemplateOid",templateOldOid); |
| | | List<CodeClassifyTemplateAttr> codeClstempattrEntities = codeClstempattrMapper.selectByMap(condition); |
| | | List<CodeClstempattrEntity> codeClstempattrEntities = codeClstempattrMapper.selectByMap(condition); |
| | | // List<CodeClassifyTemplateAttrDO> codeClassifyTemplateAttrDOList = codeClassifyTemplateAttrDaoI.selectByWrapper(codeClassifyTemplateAttrQuery); |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO :codeClstempattrEntities){ |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDO :codeClstempattrEntities){ |
| | | // String attrOid = VciBaseUtil.getPk(); |
| | | codeClassifyTemplateAttrDO.setOid(null); |
| | | codeClassifyTemplateAttrDO.setClassifyTemplateOid(templateNewOid); |
| | | codeClassifyTemplateAttrDO.setClassifytemplateoid(templateNewOid); |
| | | codeClstempattrMapper.insert(codeClassifyTemplateAttrDO); |
| | | } |
| | | |
| | |
| | | |
| | | //ä¸èµ·ä¿åæ°æ® |
| | | // WebUtil.setPersistence(false);//䏿§è¡ä¿å |
| | | //ä¿å模æ¿ââ |
| | | //ä¿åæ¨¡æ¿ |
| | | // BatchCBO batchCBOTemplate = new BatchCBO(); |
| | | //batchCBOä¿åçæ¶åæ²¡æè½å¤èªå¨updateæºæ°æ®çisLastR |
| | | //batchCBOTemplate.getCreateCbos().add(clientBusinessObject_template_insert); |
| | |
| | | codeClassifyTemplateDOList.add(codeClassifyTemplateDO_old); |
| | | |
| | | //å¤å¶æ¨¡æ¿å±æ§ |
| | | List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList = copyTemplateAttr(oldOid,newOid); |
| | | List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = copyTemplateAttr(oldOid,newOid); |
| | | |
| | | //å¤å¶æ¨¡æ¿æµç¨ |
| | | List<CodeClsflowtempEntity> codeClassifyProcessTempDOList = copyTemplateProcess(oldOid,newOid); |
| | |
| | | /** |
| | | * å¤å¶æ¨¡æ¿å±æ§ |
| | | */ |
| | | public List<CodeClassifyTemplateAttr> copyTemplateAttr(String templateOldOid,String templateNewOid){ |
| | | public List<CodeClstempattrEntity> copyTemplateAttr(String templateOldOid,String templateNewOid){ |
| | | |
| | | // VciQueryWrapperForDO codeClassifyTemplateAttrQuery = new VciQueryWrapperForDO(CodeClassifyTemplateAttrDO.class); |
| | | // codeClassifyTemplateAttrQuery.addQueryMap("classifyTemplateOid",templateOldOid); |
| | | |
| | | // Map<String,Object> condition = new HashMap<>(1); |
| | | // condition.put("classifyTemplateOid",templateOldOid); |
| | | QueryWrapper<CodeClassifyTemplateAttr> wrapper=new QueryWrapper<>(); |
| | | QueryWrapper<CodeClstempattrEntity> wrapper=new QueryWrapper<>(); |
| | | wrapper.eq("classifyTemplateOid",templateOldOid); |
| | | |
| | | // List<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOList = codeClassifyTemplateAttrDaoI.selectByWrapper(codeClassifyTemplateAttrQuery); |
| | | List<CodeClassifyTemplateAttr> codeClstempattrEntities = codeClstempattrMapper.selectList(wrapper); |
| | | // List<CodeClstempattrEntity> codeClassifyTemplateAttrDOList = codeClassifyTemplateAttrDaoI.selectByWrapper(codeClassifyTemplateAttrQuery); |
| | | List<CodeClstempattrEntity> codeClstempattrEntities = codeClstempattrMapper.selectList(wrapper); |
| | | |
| | | for (CodeClassifyTemplateAttr codeClassifyTemplateAttrDO :codeClstempattrEntities){ |
| | | for (CodeClstempattrEntity codeClassifyTemplateAttrDO :codeClstempattrEntities){ |
| | | // String attrOid = VciBaseUtil.getPk(); |
| | | codeClassifyTemplateAttrDO.setOid(null); |
| | | codeClassifyTemplateAttrDO.setClassifyTemplateOid(templateNewOid); |
| | | codeClassifyTemplateAttrDO.setClassifytemplateoid(templateNewOid); |
| | | // codeClstempattrMapper.insert(codeClassifyTemplateAttrDO); |
| | | } |
| | | return codeClstempattrEntities; |
| | |
| | | /** |
| | | * å类模æ¿å表 |
| | | * |
| | | * @param plCodeClstemplate æ¥è¯¢æ¡ä»¶ |
| | | * @param query å页对象 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页对象 |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClstemplateVO> gridCodeClassifyTemplate(CodeClstemplateVO plCodeClstemplate, Query query) throws VciBaseException { |
| | | public DataGrid<CodeClstemplateVO> gridCodeClassifyTemplate(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException { |
| | | DataGrid<CodeClstemplateVO> dataGrid=new DataGrid<CodeClstemplateVO>(); |
| | | //没æä¼ åç±»idï¼ä¸æ§è¡æ¥è¯¢é»è¾ï¼ç´æ¥è¿å |
| | | // if(conditionMap.size()==0){ |
| | |
| | | // } |
| | | // pageHelper.addDefaultDesc("revisionSeq"); |
| | | |
| | | List<CodeClstemplateVO> doList = codeClstemplateMapper.selectPlCodeClstemplatePage(Condition.getPage(query), plCodeClstemplate); |
| | | if (!CollectionUtils.isEmpty(doList)) { |
| | | // QueryWrapper<CodeClstemplateVO> codeClstemplateVOQueryWrapper = new QueryWrapper<>(); |
| | | // codeClstemplateVOQueryWrapper.allEq(plCodeClstemplate); |
| | | List<CodeClstemplateEntity> codeClstemplateEntity = new ArrayList<>(); |
| | | BeanUtils.copyProperties(doList,codeClstemplateEntity); |
| | | dataGrid.setData(codeClassifyTemplateDO2VOs(codeClstemplateEntity)); |
| | | dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(codeClstemplateMapper.selectCount(Condition.getQueryWrapper(plCodeClstemplate))))); |
| | | CodeClstemplateVO codeClstemplateVO = new CodeClstemplateVO(); |
| | | CodeClstemplateEntity codeClstemplateQuery = new CodeClstemplateEntity(); |
| | | // BeanUtil.toBean(map,codeClstempattrVO); |
| | | // BeanUtil |
| | | BeanMap beanMap = BeanMap.create(codeClstemplateVO); |
| | | beanMap.putAll(conditionMap); |
| | | BeanUtils.copyProperties(codeClstemplateVO,codeClstemplateQuery); |
| | | if (pageHelper == null) { |
| | | pageHelper = new PageHelper(-1); |
| | | } |
| | | // IPage iPage = new IPage(); |
| | | Query query = new Query(); |
| | | // query.setSize(100); |
| | | if(pageHelper.getLimit() != -1){ |
| | | query.setSize(pageHelper.getLimit()); |
| | | query.setCurrent(pageHelper.getPage()); |
| | | } |
| | | |
| | | // List<CodeClstemplateVO> doList = codeClstemplateMapper.selectPlCodeClstemplatePage(Condition.getPage(query), codeClstemplateVO); |
| | | |
| | | IPage<CodeClstemplateEntity> doList = baseMapper. |
| | | selectPage(Condition.getPage(query), Condition.getQueryWrapper(codeClstemplateVO)); |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | // QueryWrapper<CodeClstemplateVO> codeClstemplateVOQueryWrapper = new QueryWrapper<>(); |
| | | // codeClstemplateVOQueryWrapper.allEq(plCodeClstemplate); |
| | | // List<CodeClstemplateEntity> codeClstemplateEntity = new ArrayList<>(); |
| | | // BeanUtils.copyProperties(doList,codeClstemplateEntity); |
| | | |
| | | dataGrid.setData(codeClassifyTemplateDO2VOs(doList.getRecords())); |
| | | dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(codeClstemplateMapper.selectCount(Condition.getQueryWrapper(codeClstemplateQuery))))); |
| | | } |
| | | return dataGrid; |
| | | } |
| | |
| | | // condition.put("ts",codeClassifyTemplateDOCopyFromDTO.getTs()); |
| | | CodeClstemplateEntity detail = baseMapper |
| | | .selectById(codeClassifyTemplateDOCopyFromDTO.getOid()); |
| | | // boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOListemplateDOCopyFromDTO); |
| | | // boolean tsBoolean = boService.checkTs(codeClassifyTemplateAttrDOListemplateDOCopyFromDTO); |
| | | if(detail.getTs().compareTo(codeClassifyTemplateDOCopyFromDTO.getTs()) != 0){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.vci.ubcs.code.mapper.CommonsMapper; |
| | | import com.vci.ubcs.starter.web.constant.VciSystemVarConstants; |
| | | import com.vci.ubcs.starter.web.toolmodel.DateConverter; |
| | | import com.vci.ubcs.starter.web.util.Md5; |
| | | import com.vci.ubcs.starter.web.util.VciDateUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Method; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * å
¬å¼å¤ç |
| | | * @author weidy |
| | | * @date 2022-02-11 |
| | | * |
| | | */ |
| | | @Service |
| | | public class FormulaServiceImpl { |
| | | |
| | | /** |
| | | * æ¥å¿æä»¶ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | /** |
| | | * éç¨æ¥è¯¢ |
| | | */ |
| | | @Resource |
| | | CommonsMapper commonsMapper; |
| | | |
| | | // /** |
| | | // * ä¸å¡æ°æ®æå¡ |
| | | // */ |
| | | // @Autowired |
| | | // private WebBoServiceI boService; |
| | | |
| | | /** |
| | | * æ¯å¦è¿è¡å®æ |
| | | */ |
| | | private Boolean formulaBlag = true; |
| | | /** |
| | | * è¿ç®ç¬¦ |
| | | */ |
| | | public static List<String> lc = new ArrayList<String>(); |
| | | |
| | | static { |
| | | lc.add("+"); |
| | | lc.add("-"); |
| | | lc.add("*"); |
| | | lc.add("/"); |
| | | } |
| | | |
| | | /** |
| | | * é»è¾è¿ç®ç¬¦ |
| | | */ |
| | | public static List<String> lj = new ArrayList<String>(); |
| | | static { |
| | | lj.add(">"); |
| | | lj.add("<"); |
| | | lj.add("="); |
| | | lj.add("!"); |
| | | } |
| | | |
| | | /** |
| | | * 彿°ï¼intæ°ç»æ³¨é,第ä¸ä¸ªæ è¯:0èªå¸¦å½æ° 1èªå®ä¹å½æ°;第äºä¸ªæ è¯:åæ°ä¸ªæ° |
| | | */ |
| | | public static Map<String, int[]> funMap = new HashMap<String, int[]>(); |
| | | // intæ°ç»æ³¨é,第ä¸ä¸ªæ è¯:0èªå¸¦å½æ° 1èªå®ä¹å½æ°;第äºä¸ªæ è¯:åæ°ä¸ªæ° |
| | | static { |
| | | // èªå¸¦å½æ°,å¯å©ç¨åå°æºå¶ |
| | | funMap.put("abs", new int[] { 0, 1 }); |
| | | funMap.put("acos", new int[] { 0, 1 }); |
| | | funMap.put("asin", new int[] { 0, 1 }); |
| | | funMap.put("atan", new int[] { 0, 1 }); |
| | | funMap.put("cbrt", new int[] { 0, 1 }); |
| | | funMap.put("ceil", new int[] { 0, 1 }); |
| | | funMap.put("cos", new int[] { 0, 1 }); |
| | | funMap.put("cosh", new int[] { 0, 1 }); |
| | | funMap.put("exp", new int[] { 0, 1 }); |
| | | funMap.put("expm1", new int[] { 0, 1 }); |
| | | funMap.put("floor", new int[] { 0, 1 }); |
| | | funMap.put("log", new int[] { 0, 1 }); |
| | | funMap.put("log10", new int[] { 0, 1 }); |
| | | funMap.put("log1p", new int[] { 0, 1 }); |
| | | funMap.put("random", new int[] { 0, 0 }); |
| | | funMap.put("rint", new int[] { 0, 1 }); |
| | | funMap.put("round", new int[] { 0, 1 }); |
| | | funMap.put("signum", new int[] { 0, 1 }); |
| | | funMap.put("sin", new int[] { 0, 1 }); |
| | | funMap.put("sinh", new int[] { 0, 1 }); |
| | | funMap.put("sqrt", new int[] { 0, 1 }); |
| | | funMap.put("tan", new int[] { 0, 1 }); |
| | | funMap.put("tanh", new int[] { 0, 1 }); |
| | | funMap.put("max", new int[] { 0, 2 }); |
| | | funMap.put("min", new int[] { 0, 2 }); |
| | | |
| | | // èªå®ä¹å½æ° |
| | | funMap.put("if", new int[] { 1, 3 }); |
| | | funMap.put("sum", new int[] { 1, 2 }); |
| | | funMap.put("sub", new int[] { 1, 2 }); |
| | | funMap.put("mul", new int[] { 1, 2 }); |
| | | funMap.put("div", new int[] { 1, 2 }); |
| | | funMap.put("mod", new int[] { 1, 2 }); |
| | | funMap.put("toInt", new int[] { 1, 1 }); |
| | | funMap.put("toDouble", new int[] { 1, 1 }); |
| | | funMap.put("doubleRound", new int[] { 1, 2 }); |
| | | funMap.put("zeroIfNull", new int[] { 1, 1 }); |
| | | funMap.put("endsWith", new int[] { 1, 2 }); |
| | | funMap.put("startsWith", new int[] { 1, 2 }); |
| | | funMap.put("charAt", new int[] { 1, 2 }); |
| | | funMap.put("equalsIgnoreCase", new int[] { 1, 2 }); |
| | | funMap.put("indexOf", new int[] { 1, 2 }); |
| | | funMap.put("isEmpty", new int[] { 1, 1 }); |
| | | funMap.put("lastIndexOf", new int[] { 1, 2 }); |
| | | funMap.put("leftStr", new int[] { 1, 2 }); |
| | | funMap.put("length", new int[] { 1, 1 }); |
| | | funMap.put("mid", new int[] { 1, 3 }); |
| | | funMap.put("right", new int[] { 1, 2 }); |
| | | funMap.put("rightStr", new int[] { 1, 2 }); |
| | | funMap.put("tolowercase", new int[] { 1, 1 }); |
| | | funMap.put("touppercase", new int[] { 1, 1 }); |
| | | funMap.put("trimzero", new int[] { 1, 1 }); |
| | | funMap.put("compareDate", new int[] { 1, 2 }); |
| | | funMap.put("nowDate", new int[] { 1, 0 }); |
| | | funMap.put("chinaDate", new int[] { 1, 1 }); |
| | | funMap.put("dateDdd", new int[] { 1, 2 }); |
| | | funMap.put("dateBalanceYear",new int[] {1,3}); |
| | | funMap.put("dateBalanceDay",new int[] {1,2}); |
| | | funMap.put("dateformat", new int[] { 1, 2 }); |
| | | funMap.put("nowDatetime", new int[] { 1, 0 }); |
| | | funMap.put("dayOf", new int[] { 1, 1 }); |
| | | funMap.put("nowMon", new int[] { 1, 1 }); |
| | | funMap.put("monOf", new int[] { 1, 1 }); |
| | | funMap.put("nowTime", new int[] { 1, 0 }); |
| | | funMap.put("nowYear", new int[] { 1, 0 }); |
| | | funMap.put("yearOf", new int[] { 1, 1 }); |
| | | funMap.put("getChineseCurrency", new int[] { 1, 1 }); |
| | | funMap.put("setThmark", new int[] { 1, 1 }); |
| | | funMap.put("toChinese", new int[] { 1, 1 }); |
| | | funMap.put("getcolvalue", new int[] { 1, 5 }); |
| | | funMap.put("MD5", new int[]{1,1}); |
| | | funMap.put("getValueByMethod", new int[]{1,3}); |
| | | } |
| | | |
| | | /** |
| | | * å
¬å¼åå§åè½¬æ¢ |
| | | * |
| | | * @param str å
¬å¼çå
容 |
| | | * @return 转æ¢åçå
容 |
| | | */ |
| | | private String strCast(String str) { |
| | | // str = str.toLowerCase();// å»é¤ç©ºæ ¼ï¼åå°å |
| | | if (str == null ? true : str.length() == 0) { |
| | | return "0"; |
| | | } |
| | | str = str.trim(); |
| | | if (!checkFormula(str)) { |
| | | formulaError(); |
| | | return str; |
| | | } |
| | | str = str.replaceAll("ï¼", ","); |
| | | str = str.replaceAll("\\+-", "-"); |
| | | str = str.replaceAll("-\\+", "-"); |
| | | //str = str.replaceAll(" ", ""); |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥å
¬å¼ä¸æ¬å·åºç°æ¬¡æ°æ¯å¦æ£ç¡® |
| | | * |
| | | * @param formulaStr å
¬å¼çå
容 |
| | | * @return true è¡¨ç¤ºæ ¡éªæå |
| | | */ |
| | | private boolean checkFormula(String formulaStr) { |
| | | formulaBlag = true; |
| | | int count = 0; |
| | | for (int i = 0; i < formulaStr.length(); i++) { |
| | | String s = String.valueOf(formulaStr.charAt(i)); |
| | | if ("(".equals(s)) { |
| | | count++; |
| | | } else if (")".equals(s)) { |
| | | count--; |
| | | } |
| | | if (count < 0) { |
| | | formulaBlag = false; |
| | | break; |
| | | } |
| | | } |
| | | formulaBlag = count == 0; |
| | | return formulaBlag; |
| | | } |
| | | |
| | | /** |
| | | * åå²å½æ° |
| | | * |
| | | * @param str å符串 |
| | | * @param bs åå²ç¬¦ |
| | | * @return 转æ¢åçå
容 |
| | | */ |
| | | private String[] spliteFun(String str, String bs) { |
| | | List<String> list = new ArrayList<String>(); |
| | | String bds = ""; |
| | | int bracket = 0; |
| | | int len = str.length(); |
| | | for (int i = 0; i < len; i++) { |
| | | String s = String.valueOf(str.charAt(i)); |
| | | if ("(".equals(s)) { |
| | | bracket++; |
| | | } else if (")".equals(s)) { |
| | | bracket--; |
| | | } |
| | | |
| | | if (bracket == 0 && bs.equals(s)) { |
| | | list.add(bds); |
| | | bds = ""; |
| | | continue; |
| | | } |
| | | |
| | | bds += s; |
| | | } |
| | | |
| | | list.add(bds); |
| | | |
| | | String[] ss = new String[list.size()]; |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ss[i] = list.get(i); |
| | | } |
| | | |
| | | return ss; |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ·èªå®ä¹å½æ° |
| | | * |
| | | * @param str å符串 |
| | | * @param funStr 彿°çå
容 |
| | | * @return |
| | | */ |
| | | private String customFun(String str, String funStr) { |
| | | String reval = "false"; |
| | | String[] gss = spliteFun(str, ","); |
| | | //æ¯ä¸ä¸ªåæ°ï¼æé½åºè¯¥å»ççæ¯å¦è¿æ()ãè¿è¯´æé颿¯æ¹æ³ |
| | | for (int i = 0; i < gss.length; i++) { |
| | | String record = gss[i]; |
| | | if(StringUtils.isNotBlank(record) && record.contains("(") && record.contains(")")){ |
| | | gss[i] = calculate(gss[i]); |
| | | } |
| | | } |
| | | if ("if".equals(funStr)) { |
| | | //logger.debug("第ä¸ä¸ªåæ°ï¼" + gss[0]); |
| | | if (compare(gss[0])) { |
| | | reval = calculate(gss[1]); |
| | | } else { |
| | | reval = calculate(gss[2]); |
| | | } |
| | | } else if ("sum".equals(funStr)) { |
| | | BigDecimal ln = new BigDecimal(gss[0]); |
| | | BigDecimal rn = new BigDecimal(gss[1]); |
| | | reval = ln.add(rn).doubleValue() + ""; |
| | | } else if ("sub".equals(funStr)) { |
| | | BigDecimal ln = new BigDecimal(gss[0]); |
| | | BigDecimal rn = new BigDecimal(gss[1]); |
| | | reval = ln.subtract(rn).doubleValue() + ""; |
| | | } else if ("mul".equals(funStr)) { |
| | | BigDecimal ln = new BigDecimal(gss[0]); |
| | | BigDecimal rn = new BigDecimal(gss[1]); |
| | | reval = ln.multiply(rn).doubleValue() + ""; |
| | | } else if ("div".equals(funStr)) { |
| | | BigDecimal ln = new BigDecimal(gss[0]); |
| | | BigDecimal rn = new BigDecimal(gss[1]); |
| | | if (rn.doubleValue() == 0) { |
| | | formulaError(); |
| | | //reval = "0"; |
| | | return reval; |
| | | } else { |
| | | reval = ln.divide(rn, 10, BigDecimal.ROUND_HALF_UP) + ""; |
| | | } |
| | | |
| | | } else if ("mod".equals(funStr)) { |
| | | int rn = Integer.parseInt(gss[1]); |
| | | if (rn == 0) { |
| | | formulaError(); |
| | | |
| | | return reval; |
| | | } |
| | | int ln = Integer.parseInt(gss[0]); |
| | | reval = (ln % rn) + ""; |
| | | } else if ("toInt".equals(funStr)) { |
| | | reval = (int) Math.floor(new Double(calculate(gss[0]))) + ""; |
| | | } else if("toDouble".equals(funStr)){ |
| | | reval = new Double(calculate(gss[0])) + ""; |
| | | }else if("MD5".equals(funStr)){ |
| | | reval = Md5.md5(calculate(gss[0])); |
| | | }else if ("doubleRound".equals(funStr)) { |
| | | try { |
| | | BigDecimal b = new BigDecimal(calculate(gss[0])); |
| | | reval = b.setScale(Integer.parseInt(gss[1]), |
| | | BigDecimal.ROUND_HALF_UP).doubleValue() |
| | | + ""; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | |
| | | } else if ("zeroIfNull".equals(funStr)) { |
| | | logger.debug(gss[0]); |
| | | if ("null".equals(gss[0]) || gss[0].trim().length() == 0) { |
| | | reval = "0"; |
| | | return reval; |
| | | } |
| | | reval = gss[0]; |
| | | } else if ("endsWith".equals(funStr)) { |
| | | reval = "false"; |
| | | if (gss[0].endsWith(gss[1])) { |
| | | reval = "true"; |
| | | } |
| | | |
| | | } else if ("startsWith".equals(funStr)) { |
| | | reval = "false"; |
| | | if (gss[0].startsWith(gss[1])) { |
| | | reval = "true"; |
| | | } |
| | | } else if ("charAt".equals(funStr)) { |
| | | try { |
| | | reval = String.valueOf(gss[0].charAt(Integer.parseInt(gss[1]))); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | reval = ""; |
| | | } |
| | | |
| | | } else if ("equalsignoreCase".equals(funStr)) { |
| | | if (gss[0].equalsIgnoreCase(gss[1])) { |
| | | reval = "true"; |
| | | } |
| | | } else if ("indexOf".equals(funStr)) { |
| | | reval = gss[0].indexOf(gss[1]) + ""; |
| | | } else if ("isEmpty".equals(funStr)) { |
| | | if (gss[0].trim().length() == 0 || "".equals(gss[0]) |
| | | || "null".equals(gss[0])) { |
| | | reval = "true"; |
| | | } |
| | | } else if ("lastIndexOf".equals(funStr)) { |
| | | reval = gss[0].lastIndexOf(gss[1]) + ""; |
| | | } else if ("leftStr".equals(funStr)) { |
| | | reval = gss[0].substring(0, Integer.parseInt(gss[1])); |
| | | } else if ("length".equals(funStr)) { |
| | | reval = gss[0].length() + ""; |
| | | } else if ("right".equals(funStr)) { |
| | | reval = String.valueOf(gss[0].charAt(gss[0].length() |
| | | - Integer.parseInt(gss[1]))); |
| | | |
| | | } else if ("rightStr".equals(funStr)) { |
| | | reval = gss[0] |
| | | .substring(gss[0].length() - Integer.parseInt(gss[1])); |
| | | } else if ("mid".equals(funStr)) { |
| | | try { |
| | | reval = gss[0].substring(Integer.parseInt(gss[1]), |
| | | Integer.parseInt(gss[2])); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | reval = ""; |
| | | } |
| | | |
| | | } else if ("tolowercase".equals(funStr)) { |
| | | reval = gss[0].toLowerCase(); |
| | | } else if ("touppercase".equals(funStr)) { |
| | | reval = gss[0].toUpperCase(); |
| | | } else if ("trimZero".equals(funStr)) { |
| | | int len = gss[0].length() - 1; |
| | | for (int i = len; i >= 0; i--) { |
| | | if (gss[0].charAt(i) == '0') { |
| | | gss[0] = gss[0].substring(0, gss[0].length() - 1); |
| | | } else { |
| | | reval = gss[0]; |
| | | break; |
| | | } |
| | | } |
| | | } else if ("compareDate".equals(funStr)) { |
| | | if (gss[0].indexOf("date") != -1) { |
| | | gss[0] = calculate(gss[0]); |
| | | } |
| | | if (gss[1].indexOf("date") != -1) { |
| | | gss[1] = calculate(gss[1]); |
| | | } |
| | | gss[0] = gss[0].replaceAll("`", "-"); |
| | | gss[1] = gss[1].replaceAll("`", "-"); |
| | | String result; |
| | | try { |
| | | result = VciDateUtil.compareDate(gss[0], gss[1]); |
| | | if ("=".equals(result)) { |
| | | reval = "true"; |
| | | } |
| | | ; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | |
| | | } else if ("nowDate".equals(funStr)) { |
| | | reval = VciDateUtil.getNowString("yyyy-MM-dd"); |
| | | } else if ("chinaDate".equals(funStr)) { |
| | | try { |
| | | if (gss[0].indexOf("date") != -1) { |
| | | gss[0] = calculate(gss[0]); |
| | | } |
| | | gss[0] = gss[0].replaceAll("`", "-"); |
| | | reval = VciDateUtil.getChinaDate(gss[0]); |
| | | return reval; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | } else if ("dateAdd".equals(funStr)) { |
| | | try { |
| | | if (gss[0].indexOf("date") != -1) { |
| | | gss[0] = calculate(gss[0]); |
| | | } |
| | | gss[0] = gss[0].replaceAll("`", "-"); |
| | | DateConverter dateConverter = new DateConverter(); |
| | | dateConverter.setAsText(gss[0]); |
| | | Date date = VciDateUtil.getDateAddDay(dateConverter.getValue(), |
| | | Integer.parseInt(gss[1])); |
| | | reval = VciDateUtil.date2Str(date, VciDateUtil.DateTimeFormat); |
| | | return reval; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | } else if("dateBalanceYear".equals(funStr)) { |
| | | //æ±æ¶é´çå·®é¢ |
| | | //3ä¸ªåæ°ï¼å¯¹æ¯çæºå¼ï¼å¯¹æ¯çç®æ å¼,æ¯å¦è¿ä¸ |
| | | String sourceDate = gss[0]; |
| | | String targetDate = gss[1]; |
| | | boolean remainderType = "true".equalsIgnoreCase(gss[2]) ? true : false; |
| | | DateConverter dateConverter = new DateConverter(); |
| | | dateConverter.setAsText(sourceDate); |
| | | Date sDate = dateConverter.getValue(); |
| | | Date tDate = new Date(); |
| | | if (StringUtils.isBlank(targetDate)) { |
| | | dateConverter.setAsText(targetDate); |
| | | tDate = dateConverter.getValue(); |
| | | } |
| | | |
| | | Period p = Period.between(LocalDate.parse(VciDateUtil.date2Str(sDate, VciDateUtil.DateTimeMillFormat), DateTimeFormatter.ofPattern(VciDateUtil.DateTimeMillFormat)), |
| | | LocalDate.parse(VciDateUtil.date2Str(tDate, VciDateUtil.DateTimeMillFormat), DateTimeFormatter.ofPattern(VciDateUtil.DateTimeMillFormat))); |
| | | reval = String.valueOf((remainderType && (p.getMonths() > 0 || p.getDays() > 0)) ? (p.getYears() + 1) : p.getYears()); |
| | | //æä»½ç¸å·®æ¯æ²¡åæ³è®¡ç® |
| | | }else if("dateBalanceDay".equals(funStr)){ |
| | | String sourceDate = gss[0]; |
| | | String targetDate = gss[1]; |
| | | DateConverter dateConverter = new DateConverter(); |
| | | dateConverter.setAsText(sourceDate); |
| | | Date sDate = dateConverter.getValue(); |
| | | Date tDate = new Date(); |
| | | if (StringUtils.isNotBlank(targetDate)) { |
| | | dateConverter.setAsText(targetDate); |
| | | tDate = dateConverter.getValue(); |
| | | } |
| | | reval = String.valueOf(TimeUnit.DAYS.convert(Math.abs(sDate.getTime()-tDate.getTime()),TimeUnit.MILLISECONDS)); |
| | | }else if ("dateformat".equals(funStr)) { |
| | | if (gss[0].indexOf("date") != -1) { |
| | | gss[0] = calculate(gss[0]); |
| | | } |
| | | gss[0] = gss[0].replaceAll("`", "-"); |
| | | gss[1] = gss[1].replaceAll("`", "-"); |
| | | Date date; |
| | | try { |
| | | if("''".equalsIgnoreCase(gss[0])) { |
| | | gss[0] = VciDateUtil.getNowString(); |
| | | } |
| | | DateConverter dateConverter =new DateConverter(); |
| | | dateConverter.setAsText(gss[0]); |
| | | date = dateConverter.getValue(); |
| | | reval = VciDateUtil.date2Str(date, gss[1].replace("&"," ")); |
| | | return reval; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | |
| | | } else if ("nowDatetime".equals(funStr)) { |
| | | reval = VciDateUtil.getNowString(); |
| | | } else if ("dayOf".equals(funStr)) { |
| | | if (gss[0].indexOf("date") != -1) { |
| | | gss[0] = calculate(gss[0]); |
| | | } |
| | | gss[0] = gss[0].replaceAll("`", "-"); |
| | | try { |
| | | Date date = VciDateUtil.str2Date(gss[0], "yyyy-MM-dd"); |
| | | reval = date.getDate() + ""; |
| | | return reval; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | } else if ("nowNon".equals(funStr)) { |
| | | try { |
| | | reval = VciDateUtil.getNowString("MM"); |
| | | return reval; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | } else if ("monOf".equals(funStr)) { |
| | | if (gss[0].indexOf("date") != -1) { |
| | | gss[0] = calculate(gss[0]); |
| | | } |
| | | gss[0] = gss[0].replaceAll("`", "-"); |
| | | try { |
| | | Date date = VciDateUtil.str2Date(gss[0], "yyyy-MM-dd"); |
| | | reval = date.getMonth() + ""; |
| | | return reval; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | } else if ("nowTime".equals(funStr)) { |
| | | reval = VciDateUtil.getNowString("HH:mm:ss"); |
| | | return reval; |
| | | } else if ("nowYear".equals(funStr)) { |
| | | reval = VciDateUtil.getNowString("yyyy"); |
| | | return reval; |
| | | } else if ("yearOf".equals(funStr)) { |
| | | if (gss[0].indexOf("date") != -1) { |
| | | gss[0] = calculate(gss[0]); |
| | | } |
| | | gss[0] = gss[0].replaceAll("`", "-"); |
| | | try { |
| | | Date date = VciDateUtil.str2Date(gss[0], "yyyy-MM-dd"); |
| | | reval = date.getYear() + 1900 + ""; |
| | | return reval; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | formulaError(); |
| | | } |
| | | } else if ("getChineseCurrency".equals(funStr)) { |
| | | gss[0] = calculate(gss[0]); |
| | | reval = toChineseCurrency(gss[0]); |
| | | } else if ("setThmark".equals(funStr)) { |
| | | String numstr = ""; |
| | | |
| | | String[] number = gss[0].split("\\."); |
| | | //logger.debug(number[0]); |
| | | for (int i = number[0].length() - 1; i >= 0; i--) { |
| | | if (i % 3 == 2 && i < number[0].length() - 1) { |
| | | numstr += ","; |
| | | } |
| | | numstr += number[0].charAt(i); |
| | | } |
| | | reval = ""; |
| | | for (int i = numstr.toCharArray().length - 1; i >= 0; i--) { |
| | | reval += numstr.toCharArray()[i]; |
| | | } |
| | | if (gss[0].indexOf(".") != -1) { |
| | | reval += "." + number[1]; |
| | | } |
| | | |
| | | } else if ("toChinese".equals(funStr)) { |
| | | gss[0] = calculate(gss[0]); |
| | | //logger.debug(gss[0]); |
| | | reval = toChinese(gss[0]); |
| | | } else if ("getcolvalue".equals(funStr)) { |
| | | if (gss[0].trim().length() == 0 || gss[1].trim().length() == 0 |
| | | || gss[2].trim().length() == 0 |
| | | || gss[3].trim().length() == 0 |
| | | || gss[4].trim().length() == 0) { |
| | | formulaError(); |
| | | return reval; |
| | | } |
| | | reval = getColValue(gss[0], gss[1], gss[2], gss[3], gss[4]); |
| | | }else if("getValueByMethod".equalsIgnoreCase(funStr)){ |
| | | if (gss[0].trim().length() == 0 || gss[1].trim().length() == 0 |
| | | || gss[2].trim().length() == 0) { |
| | | formulaError(); |
| | | return reval; |
| | | } |
| | | reval = getValueByMethod(gss[0], gss[1], gss[2]); |
| | | } |
| | | |
| | | return reval; |
| | | } |
| | | |
| | | // é»è¾è¡¨è¾¾å¼å¤æ |
| | | private boolean compare(String str) { |
| | | if ("true".equals(calculate(str))) { |
| | | return true; |
| | | } else if ("false".equals(calculate(str))) { |
| | | return false; |
| | | } |
| | | boolean flag = false; |
| | | boolean bs = false; |
| | | int len = str.length(); |
| | | int bracket = 0; |
| | | String ljbds = ""; |
| | | double d_left = 0; |
| | | double d_right = 0; |
| | | for (int i = 0; i < len; i++) { |
| | | String s = String.valueOf(str.charAt(i)); |
| | | if ("(".equals(s)) { |
| | | bracket++; |
| | | } else if (")".equals(s)) { |
| | | bracket--; |
| | | } |
| | | |
| | | if (bracket == 0 && lj.contains(s)) { |
| | | for (int j = i; j < len; j++) { |
| | | String ts = String.valueOf(str.charAt(j)); |
| | | if (lj.contains(ts)) { |
| | | ljbds += ts; |
| | | } else { |
| | | bs = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (bs) { |
| | | break; |
| | | } |
| | | } |
| | | //logger.debug("é»è¾è¡¨è¾¾å¼ï¼" + ljbds); |
| | | String[] s = str.split(ljbds); |
| | | //logger.debug("左边ï¼" + (s[0])); |
| | | //logger.debug("å³è¾¹ï¼" + (s[1])); |
| | | if (isNumber(calculate(s[0])) && isNumber(calculate(s[1]))) { |
| | | d_left = new Double(calculate(s[0])); |
| | | d_right = new Double(calculate(s[1])); |
| | | } else { |
| | | formulaError(); |
| | | return false; |
| | | } |
| | | |
| | | if ("<".equals(ljbds)) { |
| | | if (d_left < d_right) { |
| | | return true; |
| | | } |
| | | } else if (">".equals(ljbds)) { |
| | | if (d_left > d_right) { |
| | | return true; |
| | | } |
| | | } else if ("=".equals(ljbds)) { |
| | | if (d_left == d_right) { |
| | | return true; |
| | | } |
| | | } else if (">=".equals(ljbds)) { |
| | | if (d_left >= d_right) { |
| | | return true; |
| | | } |
| | | } else if ("<=".equals(ljbds)) { |
| | | if (d_left <= d_right) { |
| | | return true; |
| | | } |
| | | } else if ("<>".equals(ljbds) || "!=".equals(ljbds)) { |
| | | if (d_left != d_right) { |
| | | return true; |
| | | } |
| | | } else { |
| | | formulaError(); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨å
¬å¼è®¡ç®ç»æ |
| | | * @param dataMap æ¬åºæ¯åéçå¼ |
| | | * @param calculateString å
¬å¼çå
容 |
| | | * @return æ§è¡åçå¼ |
| | | */ |
| | | public String getValueByFormula(Map<String,String> dataMap,String calculateString){ |
| | | final String[] finalRule = new String[]{calculateString}; |
| | | if(!CollectionUtils.isEmpty(dataMap)){ |
| | | dataMap.forEach((key,value)->{ |
| | | if(value == null){ |
| | | value = ""; |
| | | } |
| | | finalRule[0] = finalRule[0].replace("${" + key + "}",value); |
| | | }); |
| | | } |
| | | return calculate(finalRule[0]); |
| | | } |
| | | |
| | | /** |
| | | * éå½è°ç¨è¿ç®ï¼æ³¨æåééè¦èªè¡æ¿æ¢ |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public String calculate(String str) { |
| | | str = this.strCast(str); |
| | | if (!formulaBlag) { |
| | | //logger.debug("å
¬å¼ä¸æ£ç¡®"); |
| | | return str; |
| | | } |
| | | boolean onlyFunction = str.length()>2 && str.startsWith("->"); |
| | | if(onlyFunction){ |
| | | str = str.substring(2); |
| | | } |
| | | //éè¦æ¿æ¢ç³»ç»åé |
| | | Map<String, String> systemVarValueMap = VciSystemVarConstants.getSystemVarValueMap(); |
| | | if(!CollectionUtils.isEmpty(systemVarValueMap)){ |
| | | final String[] finalStr = new String[]{str}; |
| | | systemVarValueMap.forEach((key,value)->{ |
| | | if(value == null){ |
| | | value = ""; |
| | | } |
| | | finalStr[0] = finalStr[0].replace( key,value); |
| | | }); |
| | | str = finalStr[0]; |
| | | } |
| | | String reval = ""; |
| | | String bds = ""; |
| | | int bracket = 0;// å¯¹åºæ¬å·ä¸ªæ° |
| | | int pos = 0; |
| | | boolean title = false; |
| | | // å¦æä»¥è´æ°å¼å¤´ï¼å
廿è´å· |
| | | if (str.substring(0, 1).equals("-")) { |
| | | str = str.substring(1); |
| | | title = true; |
| | | } |
| | | |
| | | int len = str.length(); |
| | | for (int i = 0; i < len; i++) { |
| | | String s = String.valueOf(str.charAt(i)); |
| | | pos = i; |
| | | bracket = 0; |
| | | if (!lc.contains(s)) {// å¦ææ²¡éå°è¿ç®ç¬¦ |
| | | if ("(".equals(s)) {// 妿éå°å·¦æ¬å· |
| | | if (funMap.containsKey(bds)) {// 妿左æ¬å·åæ¯å½æ° |
| | | for (int j = i + 1; j < len; j++) {// ä»å·¦æ¬å·åå¼å§å¾ªç¯ |
| | | pos++;// 累计移å¨åç¬¦ä½æ° |
| | | String ts = String.valueOf(str.charAt(j));// å个å符 |
| | | // reval+=ts; |
| | | if ("(".equals(ts))// 妿æ¯å·¦æ¬å·ç´¯è®¡ |
| | | { |
| | | bracket++; |
| | | } else if (")".equals(ts)) {// 妿æ¯å³æ¬å·è¿è¡åå° |
| | | bracket--; |
| | | if (bracket == -1) {// 妿æ¯-1,æ è¯æ¬å·ç»æ |
| | | reval = reval.substring(0, reval.length() |
| | | - bds.length());// éæ°è·å¾å»æå½æ°å¤´çè¡¨è¾¾å¼ |
| | | reval += this.funCalculate( |
| | | str.substring(i + 1, j), bds);// 表达å¼å ä¸å½æ°ç»æ,å½¢ææ°è¡¨è¾¾å¼ |
| | | i = pos;// 计æ°å¨å¢å |
| | | bds = "";// 彿°å¤´æ¸
空 |
| | | break;// éåºæ¬æ¬¡å¾ªç¯ |
| | | } |
| | | } |
| | | } |
| | | } else if ("".equals(bds) || lc.contains(bds)) {// å¦ææ¯æ®éè¿ç® |
| | | //logger.debug("æ®éè¿ç®"); |
| | | for (int j = i + 1; j < len; j++) { |
| | | pos++; |
| | | String ts = String.valueOf(str.charAt(j)); |
| | | if ("(".equals(ts)) { |
| | | bracket++; |
| | | } else if (")".equals(ts)) { |
| | | bracket--; |
| | | if (bracket == -1) { |
| | | logger.debug("å½å计ç®çå符串为ï¼" |
| | | + str.substring(i + 1, pos)); |
| | | reval += calculate(str |
| | | .substring(i + 1, pos)); |
| | | i = pos; |
| | | bds = ""; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | logger.debug("æ²¡ææ¤å½æ°"); |
| | | formulaError(); |
| | | } |
| | | } else {// ç´¯å æ»è¡¨è¾¾å¼åæåä¸ä¸ªè¿ç®æ°(æå½æ°) |
| | | bds += s; |
| | | reval += s; |
| | | } |
| | | } else {// éå°è¿ç®ç¬¦æåä¸ä¸ªè¿ç®æ°(æå½æ°)æ¸
空 |
| | | bds = ""; |
| | | reval += s; |
| | | } |
| | | } |
| | | // å¦æä¸ºè´æ° å¨åé¢å è´å· |
| | | if (title) { |
| | | reval = "0-" + reval; |
| | | } |
| | | if(onlyFunction){ |
| | | |
| | | return reval; |
| | | } |
| | | String result = basicOperation(reval); |
| | | logger.debug("计ç®ç»æ" + result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 彿°è¿ç® |
| | | * |
| | | * @param gs |
| | | * @param funStr |
| | | * @return |
| | | */ |
| | | private String funCalculate(String gs, String funStr) { |
| | | String rval = "0"; |
| | | logger.debug("彿°åï¼" + funStr); |
| | | if (funMap.containsKey(funStr)) { |
| | | int[] csi = funMap.get(funStr); |
| | | try { |
| | | if (csi[0] == 0) {// javaå
é¨å½æ°,éè¿åå°è°ç¨ |
| | | Class[] cs = new Class[csi[1]]; |
| | | Object[] objs = new Object[csi[1]]; |
| | | String[] gss = splitParameter(gs); |
| | | for (int i = 0; i < csi[1]; i++) { |
| | | cs[i] = double.class; |
| | | objs[i] = new Double(calculate(gss[i])); |
| | | } |
| | | Class cls = Class.forName("java.lang.Math"); |
| | | Method m = cls.getMethod(funStr, cs); |
| | | logger.debug("æ¹æ³åï¼" + m); |
| | | rval = String.valueOf(m.invoke(cls, objs)); |
| | | } else if (csi[0] == 1) {// èªå®ä¹å½æ° |
| | | rval = customFun(gs, funStr); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | return rval; |
| | | } |
| | | |
| | | // å
¬å¼éçåæ°åå² |
| | | public static String[] splitParameter(String str) { |
| | | int len = str.length(); |
| | | boolean flag = true; |
| | | String tstr = ""; |
| | | |
| | | for (int i = 0; i < len; i++) { |
| | | String s = String.valueOf(str.charAt(i)); |
| | | if ("(".equals(s)) { |
| | | flag = false; |
| | | } else if (")".equals(s)) { |
| | | flag = true; |
| | | } |
| | | if (flag && ",".equals(s)) { |
| | | tstr += "@"; |
| | | } else { |
| | | tstr += s; |
| | | } |
| | | } |
| | | return tstr.split("@"); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * ååè¿ç®è¡¨è¾¾å¼å¤ç |
| | | * |
| | | * @param gs |
| | | * @return |
| | | */ |
| | | private String basicOperation(String gs) { |
| | | gs = gs + "+0"; // å 为ä¸é¢çè®¡ç®æ¯éå°ç¬¦å·æè¿è¡,æä»¥å¤å å
¥ä¸ä¸ªè®¡ç®ç¬¦å·,ä¸å½±åå¼. |
| | | if(gs.indexOf("-")>-1){//å
嫿-å·æè
æ¯è´æ° |
| | | if(gs.startsWith("-")) { |
| | | gs = "0" + gs; |
| | | } |
| | | // if(gs.indexOf("-")>0&&lc.contains(gs.substring(gs.indexOf("-")-1,gs.indexOf("-")))){//ç´§æ¨çæè¾¹å°±æ¯è¿ç®ç¬¦,æä¹åå |
| | | // //gs = gs.substring(0,gs.indexOf("-")-1) + "(0" + gs.substring(gs.indexOf("-")) |
| | | // } |
| | | } |
| | | String c1 = "";// 第ä¸ä¸ªè¿ç®ç¬¦å· |
| | | String c2 = "";// 第äºä¸ªè¿ç®ç¬¦å· |
| | | String s1 = "";// 第ä¸ä¸ªè¿ç®æ° |
| | | String s2 = "";// 第äºä¸ªè¿ç®æ° |
| | | String s3 = "";// 第ä¸ä¸ªè¿ç®æ° |
| | | |
| | | int len = gs.length(); |
| | | for (int i = 0; i < len; i++) { |
| | | String s = String.valueOf(gs.charAt(i));// è·å¾è¯¥ä½ç½®åç¬¦å¹¶è½¬æ¢æåç¬¦ä¸²åæ¯è¾ |
| | | if (lc.contains(s)) { // 妿æ¯è¿ç®ç¬¦å· |
| | | if (c1.length() == 0)// å¦æç¬¬ä¸ä¸ªè¿ç®ç¬¦å·ä¸ºç©º,å å
¥ |
| | | { |
| | | c1 = s; |
| | | } else if (c2.length() == 0) {// å¦å,å¦æç¬¬äºä¸ªè¿ç®ç¬¦å·ä¸ºç©º,å å
¥ |
| | | c2 = s;// 第äºä¸ªè¿ç®ç¬¦å· |
| | | if ("+".equals(c2) || "-".equals(c2)) {// å¦æç¬¬äºä¸ªè¿ç®ç¬¦å·çº§å«ä½,é£ä¹è¿è¡è®¡ç® |
| | | if(s2.trim().length()>0){ |
| | | s1 = this.operation(s1, c1, s2);// 第ä¸ä¸ªå第äºä¸ªæ°è®¡ç® |
| | | c1 = c2;// ä¿å第äºä¸ªè¿ç®ç¬¦,å
¶ä»ä¸ºç©º |
| | | c2 = ""; |
| | | s2 = ""; |
| | | }else{//s2è¿æ²¡åºç° |
| | | s2=this.calculate(gs.substring(i)); |
| | | s1 = this.operation(s1, c1, s2); |
| | | break; |
| | | } |
| | | } |
| | | } else {// ä¸è¿°é½ä¿åè¿ |
| | | if ("+".equals(s) || "-".equals(s)) {// å¦æç¬¬ä¸ä¸ªè¿ç®ç¬¦çº§å«ä½,è¿è¡è¿ç® |
| | | s2 = this.operation(s2, c2, s3);// å
ç®ç¬¬äºä¸ä¸ªæ°,ä¿åè³ç¬¬äºä¸ª |
| | | s1 = this.operation(s1, c1, s2);// åç®ç¬¬ä¸äºä¸ª,ä¿åè³ç¬¬ä¸ä¸ª |
| | | c1 = s;// ä¿åå½åè¿ç®ç¬¦,å
¶ä»ä¸ºç©º |
| | | s2 = ""; |
| | | c2 = ""; |
| | | s3 = ""; |
| | | } else {// å¦æç¬¬ä¸ä¸ªè¿ç®ç¬¦çº§å«é« |
| | | s2 = this.operation(s2, c2, s3);// å
ç®ç¬¬äºä¸ä¸ªæ°,ä¿åè³ç¬¬äºä¸ª |
| | | c2 = s;// åé¢ä¸å¨,ä¿åè¿ç®ç¬¦ |
| | | s3 = ""; |
| | | } |
| | | } |
| | | } else if (s1.length() > 0 && c1.length() > 0 && c2.length() == 0) {// å¦æç¬¬ä¸ä¸ªæ°,第ä¸ä¸ªè¿ç®ç¬¦å·²ä¿å,第äºä¸ªè¿ç®ç¬¦æªä¿å,ä¿å第äºå¥æ° |
| | | s2 += s; |
| | | } else if (c1.length() == 0) {// å¦ææ²¡æè¿ç®ç¬¦,ä¿å第ä¸ä¸ªæ° |
| | | s1 += s; |
| | | } else if (s1.length() > 0 && s2.length() > 0 && c1.length() > 0 |
| | | && c2.length() > 0) {// å¦æç¬¬ä¸äºä¸ªæ°åè¿ç®ç¬¦é½æ,ä¿å第ä¸ä¸ªæ° |
| | | s3 += s; |
| | | } |
| | | } |
| | | return s1; |
| | | } |
| | | |
| | | /** |
| | | * åºæ¬ååè¿ç® |
| | | * |
| | | * @param c1 |
| | | * è¿ç®æ°1 |
| | | * @param s1 |
| | | * è¿ç®ç¬¦(å åä¹é¤) |
| | | * @param c2 |
| | | * è¿ç®æ°2 |
| | | * @return |
| | | */ |
| | | private String operation(String c1, String s1, String c2) { |
| | | String reval = "0"; |
| | | String c22 = ""; |
| | | try { |
| | | for (int i = 0; i < c2.length(); i++) { |
| | | String s = String.valueOf(c2.charAt(i)); |
| | | if (lj.contains(s)) { |
| | | break; |
| | | } |
| | | c22 += s; |
| | | } |
| | | if (isNumber(c1) && isNumber(c22)) { |
| | | BigDecimal ln = new BigDecimal(c1.trim()); |
| | | BigDecimal rn = new BigDecimal(c2.trim()); |
| | | if ("+".equals(s1)) { |
| | | return ln.add(rn).doubleValue() + ""; |
| | | } else if ("-".equals(s1)) { |
| | | return ln.subtract(rn).doubleValue() + ""; |
| | | } else if ("*".equals(s1)) { |
| | | return ln.multiply(rn).doubleValue() + ""; |
| | | } else if ("/".equals(s1)) { |
| | | if (rn.doubleValue() == 0) { |
| | | return reval; |
| | | } |
| | | else { |
| | | return ln.divide(rn, 10, BigDecimal.ROUND_HALF_UP) + ""; |
| | | } |
| | | } |
| | | } else { |
| | | this.formulaError(); |
| | | return c1+s1+c2; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | this.formulaError(); |
| | | e.printStackTrace(); |
| | | } finally { |
| | | } |
| | | |
| | | return reval; |
| | | } |
| | | |
| | | private Boolean isNumber(String str) { |
| | | return StringUtils.isNotBlank(str) && str.matches("(-)?([1-9]+[0-9]*|0)(\\.[\\d]+)?"); |
| | | } |
| | | |
| | | private String formulaError() { |
| | | formulaBlag = false; |
| | | //logger.debug("å
¬å¼éªè¯å¤±è´¥ï¼è¯·éæ°è¾å
¥"); |
| | | return "fail"; |
| | | } |
| | | |
| | | public String toChineseCurrency(String value) { |
| | | String doubleValue = this.calculate("doubleround(" + value + ",2)"); |
| | | String fushu = ""; |
| | | if (doubleValue.indexOf("-") == 0) { |
| | | fushu = "è´"; |
| | | doubleValue = doubleValue.substring(1); |
| | | // formulaError(); |
| | | // return ""; |
| | | } |
| | | char[] hunit = { 'æ¾', 'ä½°', 'ä»' }; // 段å
ä½ç½®è¡¨ç¤º |
| | | char[] vunit = { 'ä¸', '亿' }; // 段å表示 |
| | | char[] digit = { 'é¶', '壹', 'è´°', 'å', 'è', 'ä¼', 'é', 'æ', 'æ', 'ç' }; // æ°å表示 |
| | | //double midVal = (Double.parseDouble(doubleValue) * 100); // è½¬åææ´å½¢ |
| | | //String valStr = String.valueOf(midVal); // 转åæå符串 |
| | | //String head = valStr.substring(0, valStr.length() - 2); // åæ´æ°é¨å |
| | | //String rail = valStr.substring(valStr.length() - 2); // åå°æ°é¨å |
| | | String head = ""; |
| | | String rail = "00"; |
| | | if(doubleValue.indexOf(".")>-1){ |
| | | head = doubleValue.substring(0,doubleValue.indexOf(".")); |
| | | rail = doubleValue.substring(doubleValue.indexOf(".")+1); |
| | | if(rail.trim().length() == 1) { |
| | | rail += "0";//å¿
é¡»è¦ä¿è¯æå |
| | | } |
| | | } |
| | | else { |
| | | head = doubleValue; |
| | | } |
| | | String prefix = ""; // æ´æ°é¨å转åçç»æ |
| | | String suffix = ""; // å°æ°é¨å转åçç»æ |
| | | // å¤çå°æ°ç¹åé¢çæ° |
| | | if (rail.equals("00")) { // 妿尿°é¨å为0 |
| | | suffix = "æ´"; |
| | | } else { |
| | | suffix = digit[rail.charAt(0) - '0'] + "è§" |
| | | + digit[rail.charAt(1) - '0'] + "å"; // å¦åæè§å转ååºæ¥ |
| | | } |
| | | // å¤çå°æ°ç¹åé¢çæ° |
| | | char[] chDig = head.toCharArray(); // ææ´æ°é¨å转åæå符æ°ç» |
| | | char zero = '0'; // æ å¿'0'表示åºç°è¿0 |
| | | byte zeroSerNum = 0; // è¿ç»åºç°0çæ¬¡æ° |
| | | for (int i = 0; i < chDig.length; i++) { // 循ç¯å¤çæ¯ä¸ªæ°å |
| | | int idx = (chDig.length - i - 1) % 4; // åæ®µå
ä½ç½® |
| | | int vidx = (chDig.length - i - 1) / 4; // åæ®µä½ç½® |
| | | if (chDig[i] == '0') { // 妿å½åå符æ¯0 |
| | | zeroSerNum++; // è¿ç»0次æ°éå¢ |
| | | if (zero == '0') { // æ å¿ |
| | | zero = digit[0]; |
| | | } else if (idx == 0 && vidx > 0 && zeroSerNum < 4) { |
| | | prefix += vunit[vidx - 1]; |
| | | zero = '0'; |
| | | } |
| | | continue; |
| | | } |
| | | zeroSerNum = 0; // è¿ç»0æ¬¡æ°æ¸
é¶ |
| | | if (zero != '0') { // 妿æ å¿ä¸ä¸º0,åå ä¸,ä¾å¦ä¸,亿ä»ä¹ç |
| | | prefix += zero; |
| | | zero = '0'; |
| | | } |
| | | prefix += digit[chDig[i] - '0']; // 转å该æ°å表示 |
| | | if (idx > 0) { |
| | | prefix += hunit[idx - 1]; |
| | | } |
| | | if (idx == 0 && vidx > 0) { |
| | | prefix += vunit[vidx - 1]; // æ®µç»æä½ç½®åºè¯¥å 䏿®µåå¦ä¸,亿 |
| | | } |
| | | } |
| | | |
| | | if (prefix.length() > 0) { |
| | | prefix += 'å'; // å¦ææ´æ°é¨ååå¨,åæåçåæ · |
| | | } |
| | | return fushu + prefix + suffix; // è¿åæ£ç¡®è¡¨ç¤º |
| | | } |
| | | |
| | | private String toChinese(String value) { |
| | | if (!isNumber(value)) { |
| | | this.formulaError(); |
| | | return ""; |
| | | } |
| | | String fu = ""; |
| | | // 妿æ¯è´æ°åé¢å è´ |
| | | if (value.indexOf("-") == 0) { |
| | | value = value.substring(1); |
| | | fu += "è´"; |
| | | } |
| | | char[] hunit = { 'æ¾', 'ä½°', 'ä»' }; // 段å
ä½ç½®è¡¨ç¤º |
| | | char[] vunit = { 'ä¸', '亿' }; // 段å表示 |
| | | char[] digit = { 'é¶', 'ä¸', 'äº', 'ä¸', 'å', 'äº', 'å
', 'ä¸', 'å
«', 'ä¹' }; // æ°å表示 |
| | | String head = ""; |
| | | String rail = ""; |
| | | String prefix = ""; // æ´æ°é¨å转åçç»æ |
| | | String suffix = ""; // å°æ°é¨å转åçç»æ |
| | | if (value.indexOf(".") != -1 && value.indexOf(".") < value.length() - 1) { |
| | | String[] number = value.split("\\."); |
| | | head = number[0]; // åæ´æ°é¨å |
| | | rail = number[1]; |
| | | suffix += "ç¹"; |
| | | } else { |
| | | head = value; |
| | | } |
| | | // å¤çå°æ°ç¹åé¢çæ° |
| | | for (int i = 0; i < rail.length(); i++) { |
| | | suffix += digit[rail.charAt(i) - '0']; |
| | | } |
| | | |
| | | // å¤çå°æ°ç¹åé¢çæ° |
| | | char[] chDig = head.toCharArray(); // ææ´æ°é¨å转åæå符æ°ç» |
| | | char zero = '0'; // æ å¿'0'表示åºç°è¿0 |
| | | byte zeroSerNum = 0; // è¿ç»åºç°0çæ¬¡æ° |
| | | for (int i = 0; i < chDig.length; i++) { // 循ç¯å¤çæ¯ä¸ªæ°å |
| | | int idx = (chDig.length - i - 1) % 4; // åæ®µå
ä½ç½® |
| | | int vidx = (chDig.length - i - 1) / 4; // åæ®µä½ç½® |
| | | if (chDig[i] == '0') { // 妿å½åå符æ¯0 |
| | | zeroSerNum++; // è¿ç»0次æ°éå¢ |
| | | if (zero == '0') { // æ å¿ |
| | | zero = digit[0]; |
| | | } else if (idx == 0 && vidx > 0 && zeroSerNum < 4) { |
| | | prefix += vunit[vidx - 1]; |
| | | zero = '0'; |
| | | } |
| | | continue; |
| | | } |
| | | zeroSerNum = 0; // è¿ç»0æ¬¡æ°æ¸
é¶ |
| | | if (zero != '0') { // 妿æ å¿ä¸ä¸º0,åå ä¸,ä¾å¦ä¸,亿ä»ä¹ç |
| | | prefix += zero; |
| | | zero = '0'; |
| | | } |
| | | prefix += digit[chDig[i] - '0']; // 转å该æ°å表示 |
| | | if (idx > 0) { |
| | | prefix += hunit[idx - 1]; |
| | | } |
| | | if (idx == 0 && vidx > 0) { |
| | | prefix += vunit[vidx - 1]; // æ®µç»æä½ç½®åºè¯¥å 䏿®µåå¦ä¸,亿 |
| | | } |
| | | } |
| | | return fu + prefix + suffix; // è¿åæ£ç¡®è¡¨ç¤º |
| | | } |
| | | |
| | | private String getColValue(String servername, String tableName, |
| | | String fieldname, String pkfield, String pkvalue) { |
| | | //ææ¶ä¸æ¯æserverçæ¹å¼ |
| | | String sql = "select " + fieldname.trim() + " from " + tableName.trim() + " where " + pkfield + " = '" + pkvalue+"'"; |
| | | // Map<String,String> param = new HashMap<String, String>(); |
| | | // param.put(pkfield, pkvalue); |
| | | String str = ""; |
| | | try{ |
| | | List data = commonsMapper.selectById(sql); |
| | | if(data != null || data.size() > 0) { |
| | | str = (String) ((HashMap) data.get(0)).get(fieldname.trim()); |
| | | } |
| | | }catch(Exception e){ |
| | | |
| | | } |
| | | return str; |
| | | |
| | | } |
| | | |
| | | private String getValueByMethod(String serviceName,String methods,String paramsString){ |
| | | //ææ¶ä¸æ¯æéè¿æ¹æ³æ¥è·åå¼ |
| | | return paramsString; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sun.corba.se.impl.orbutil.ObjectUtility; |
| | | import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; |
| | | import com.vci.ubcs.code.dto.CodeOrderDTO; |
| | | import com.vci.ubcs.code.dto.datapush.BaseModelDTO; |
| | | import com.vci.ubcs.code.entity.CodeAllCode; |
| | | import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity; |
| | | import com.vci.ubcs.code.entity.CodeRule; |
| | | import com.vci.ubcs.code.entity.CodeWupinEntity; |
| | | import com.vci.ubcs.code.enumpack.CodeDefaultLC; |
| | | import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum; |
| | | import com.vci.ubcs.code.enumpack.CodeSecTypeEnum; |
| | | import com.vci.ubcs.code.mapper.CodeAllCodeMapper; |
| | | import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper; |
| | | import com.vci.ubcs.code.mapper.CodeRuleMapper; |
| | | import com.vci.ubcs.code.mapper.CommonsMapper; |
| | | import com.vci.ubcs.code.service.*; |
| | | import com.vci.ubcs.code.vo.CodeClstempattrVO; |
| | | import com.vci.ubcs.code.vo.CodeClstemplateVO; |
| | | import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; |
| | | import com.vci.ubcs.omd.entity.Dict; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.revision.model.BaseModel; |
| | | import com.vci.ubcs.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.KeyValue; |
| | | import com.vci.ubcs.starter.web.toolmodel.DateConverter; |
| | |
| | | import com.vci.ubcs.system.feign.IDictBizClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService { |
| | | |
| | | |
| | | /** |
| | | * 模æ¿çæå¡ |
| | |
| | | private ICodeClassifyService classifyService; |
| | | |
| | | /** |
| | | * å
¬å¼çæå¡ |
| | | */ |
| | | @Autowired |
| | | private FormulaServiceImpl formulaService; |
| | | |
| | | /** |
| | | * éç¨æ¥è¯¢ |
| | | */ |
| | | @Resource |
| | | CommonsMapper commonsMapper; |
| | | /** |
| | | * å
³é®å±æ§çé
ç½® |
| | | */ |
| | | @Autowired |
| | |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | // @Autowired |
| | | // private CodeOsbtmtypeMapper codeOsbtmtypeMapper; |
| | | // @Autowired |
| | | // private CodeOsbtmtypeMapper codeOsbtmtypeMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 使ç¨åç±»ç主é®è·åå¯ä»¥ä½¿ç¨ç模æ¿å¯¹è±¡ |
| | |
| | | List<CodeAllCode> codeCbos = baseMapper.selectList(allCodeWrapper); |
| | | // List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap); |
| | | // åæ¶éè¦ä¸å¡æ°æ®å é¤ |
| | | // if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) { |
| | | //// BatchCBO batchCBO = new BatchCBO(); |
| | | //// batchCBO.getDeleteCbos().addAll(cboList); |
| | | // codeOsbtmtypeMapper.deleteBatchIds(cboList); |
| | | //// boService.persistenceBatch(batchCBO); |
| | | // } else { |
| | | if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) { |
| | | // BatchCBO batchCBO = new BatchCBO(); |
| | | // batchCBO.getDeleteCbos().addAll(cboList); |
| | | codeOsbtmtypeMapper.deleteBatchIds(cboList); |
| | | // boService.persistenceBatch(batchCBO); |
| | | } else { |
| | | // lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus()); |
| | | // } |
| | | } |
| | | // lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus()); |
| | | } |
| | | |
| | |
| | | switchDateAttrOnOrder(templateVO, orderDTO); |
| | | //9.çæç¼ç çä¿¡æ¯ |
| | | // ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | // CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()); |
| | | // //é»è®¤ç屿§é½ä¸ç¨ä»å端æ·è´ |
| | | // //设置ç¼ç éè¦çé»è®¤å±æ§çå
容 |
| | | // copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false); |
| | | copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false); |
| | | // //TODO:å 为é»è®¤ç屿§é½ä¸æ·è´ï¼ç®åéå¢ç å«nameï¼å¹¶æ²¡æä»DTOæ·è´å°cboéãå¢å ä¸ä¸ªåç¬å¤çï¼ä»¥ååçè¦ä¸è¦è°æ´ |
| | | // cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName()); |
| | | cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName()); |
| | | // //end -- modify by lihang @20220407 |
| | | // List<CodeWupinEntity> cboList = new ArrayList<>(); |
| | | // |
| | | // //夿³¨ |
| | | // cbo.setDescription(orderDTO.getDescription()); |
| | | List<CodeWupinEntity> cboList = new ArrayList<>(); |
| | | |
| | | //夿³¨ |
| | | cbo.setDescription(orderDTO.getDescription()); |
| | | cboList.add(cbo); |
| | | // |
| | | // cboList.add(cbo); |
| | | // List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); |
| | | //// batchSaveSelectChar(templateVO, cboList); |
| | | // return codeList.size() > 0 ? codeList.get(0) : ""; |
| | | return null; |
| | | List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList); |
| | | |
| | | |
| | | List<String> charList = new ArrayList<>(); |
| | | for (CodeWupinEntity wupinEntity : cboList) { |
| | | charList.add(wupinEntity.getId()); |
| | | } |
| | | batchSaveSelectChar(templateVO, charList); |
| | | return codeList.size() > 0 ? codeList.get(0) : ""; |
| | | // return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | dataLowMap.putAll(orderDTO.getData()); |
| | | compAttrVOMap.forEach((attrId, attrVO) -> { |
| | | // dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule())); |
| | | dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentRule())); |
| | | }); |
| | | dataLowMap.forEach((key, value) -> { |
| | | setValueToOrderDTO(orderDTO, key, value); |
| | |
| | | if (value == null) { |
| | | value = ""; |
| | | } |
| | | // wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); |
| | | wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); |
| | | }); |
| | | |
| | | //没æéå¶åç±»ï¼ä½æ¯ä¸ä¸ªæ¨¡æ¿åªå¯è½å¨ä¸ä¸ªä¸å¡ç±»åéé¢ï¼æä»¥ç´æ¥æ¥è¯¢è¿ä¸ªä¸å¡ç±»åå³å¯ |
| | | |
| | | // if (!CollectionUtils.isEmpty(conditionMap)) { |
| | | // final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; |
| | | // conditionMap.forEach((key, value) -> { |
| | | // 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 islastR = '1' and islastV = '1' "; |
| | | if (!CollectionUtils.isEmpty(conditionMap)) { |
| | | final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "}; |
| | | conditionMap.forEach((key, value) -> { |
| | | 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 islastR = '1' and islastV = '1' "; |
| | | // if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) { |
| | | // String ruleInfoMsg = keyRuleVO == null ? "" : "æ¥è¯¢è§åï¼å»é¤ç©ºæ ¼--{0},忽ç¥å¤§å°å--{1},忽ç¥å
¨åè§--{2},忽ç¥å
¨é¨ç©ºæ ¼--{3}"; |
| | | // String[] objs = new String[]{trim ? "æ¯" : "å¦", ignoreCase ? "æ¯" : "å¦", ignoreWidth ? "æ¯" : "å¦", trimAll ? "æ¯" : "å¦"}; |
| | | // throw new VciBaseException("æ ¹æ®æ¨å¡«åçå
³é®å±æ§çå
容ï¼ç»åå
³é®å±æ§æ¥è¯¢è§åï¼åç°è¿ä¸ªæ°æ®å·²ç»å¨ç³»ç»ä¸åå¨äºã请修æ£!ã" + ruleInfoMsg, objs); |
| | | // } |
| | | // } |
| | | if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) { |
| | | String ruleInfoMsg = keyRuleVO == null ? "" : "æ¥è¯¢è§åï¼å»é¤ç©ºæ ¼--{0},忽ç¥å¤§å°å--{1},忽ç¥å
¨åè§--{2},忽ç¥å
¨é¨ç©ºæ ¼--{3}"; |
| | | String[] objs = new String[]{trim ? "æ¯" : "å¦", ignoreCase ? "æ¯" : "å¦", ignoreWidth ? "æ¯" : "å¦", trimAll ? "æ¯" : "å¦"}; |
| | | throw new VciBaseException("æ ¹æ®æ¨å¡«åçå
³é®å±æ§çå
容ï¼ç»åå
³é®å±æ§æ¥è¯¢è§åï¼åç°è¿ä¸ªæ°æ®å·²ç»å¨ç³»ç»ä¸åå¨äºã请修æ£!ã" + ruleInfoMsg, objs); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @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)) { |
| | | // //ä¸ºç©ºçæ¶åï¼ä¸è½ç¨QueryOperation.ISNULLï¼å¹³å°ä¸ç¥é奿¶åä¸å¤çè¿ç§äº |
| | | // conditionMap.put("t."+attrId, "null"); |
| | | // } 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, "t."+attrId); |
| | | // queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'"); |
| | | // conditionMap.put(queryKey, queryValue); |
| | | // } else { |
| | | // //ä¸ºç©ºçæ¶åä¸ä»£è¡¨ä¸æ ¡éªï¼åªæ¯ä¸å»é¤ç¸å
³çä¿¡æ¯ |
| | | // conditionMap.put("t."+attrId, value); |
| | | // } |
| | | // } |
| | | // } |
| | | @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)) { |
| | | //ä¸ºç©ºçæ¶åï¼ä¸è½ç¨QueryOperation.ISNULLï¼å¹³å°ä¸ç¥é奿¶åä¸å¤çè¿ç§äº |
| | | conditionMap.put("t."+attrId, "null"); |
| | | } 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, "t."+attrId); |
| | | queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'"); |
| | | conditionMap.put(queryKey, queryValue); |
| | | } else { |
| | | //ä¸ºç©ºçæ¶åä¸ä»£è¡¨ä¸æ ¡éªï¼åªæ¯ä¸å»é¤ç¸å
³çä¿¡æ¯ |
| | | conditionMap.put("t."+attrId, value); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæä¸¾çå
容 |
| | |
| | | * @return CodeWupinEntity |
| | | * @throws VciBaseException åå§ååºéçæ¯ä¼æåºå¼å¸¸ |
| | | */ |
| | | // @Override |
| | | // public CodeWupinEntity createCBOByBtmName(String btmName) |
| | | // throws VciBaseException { |
| | | // if(btmName!=null){ |
| | | // btmName = btmName.trim().toLowerCase(); |
| | | @Override |
| | | public CodeWupinEntity createCBOByBtmName(String btmName) |
| | | throws VciBaseException { |
| | | if(btmName!=null){ |
| | | btmName = btmName.trim().toLowerCase(); |
| | | } |
| | | String userid = AuthUtil.getUser().getUserName(); |
| | | // if(!hasCreatedCbos.containsKey(btmName)){ |
| | | // if(StringUtils.isEmpty(userid)){ |
| | | // throw new VciBaseException(msgCodePrefix +"noHasUserid"); |
| | | // } |
| | | // try { |
| | | // hasCreatedCbos.put(btmName, createBusinessObject(btmName)); |
| | | // } catch (Exception e) { |
| | | // logger.error("å建ä¸å¡ç±»å对象",e); |
| | | // throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); |
| | | // } |
| | | // } |
| | | // String userid = AuthUtil.getUser().getUserName(); |
| | | //// if(!hasCreatedCbos.containsKey(btmName)){ |
| | | //// if(StringUtils.isEmpty(userid)){ |
| | | //// throw new VciBaseException(msgCodePrefix +"noHasUserid"); |
| | | //// } |
| | | //// try { |
| | | //// hasCreatedCbos.put(btmName, createBusinessObject(btmName)); |
| | | //// } catch (Exception e) { |
| | | //// logger.error("å建ä¸å¡ç±»å对象",e); |
| | | //// throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); |
| | | //// } |
| | | //// } |
| | | //// ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); |
| | | // |
| | | // QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>(); |
| | | // btmWrapper.eq("ID",btmName); |
| | | // CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper); |
| | | //// OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); |
| | | // String userName = AuthUtil.getUser().getUserName(); |
| | | // CodeWupinEntity wupinEntity = new CodeWupinEntity(); |
| | | // wupinEntity.setOid(null); |
| | | //// bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); |
| | | //// bo.setNameoid((new ObjectUtility()).getNewObjectID36()); |
| | | // wupinEntity.setBtmname(btmName); |
| | | // wupinEntity.setLastR(String.valueOf(1)); |
| | | // wupinEntity.setFirstR(String.valueOf(1)); |
| | | // wupinEntity.setFirstV(String.valueOf(1)); |
| | | // wupinEntity.setLastV(String.valueOf(1)); |
| | | // wupinEntity.setCreator(userName); |
| | | // wupinEntity.setCreateTime(new Date()); |
| | | // wupinEntity.setLastModifier(userName); |
| | | // wupinEntity.setLastModifyTime(new Date()); |
| | | // wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid()); |
| | | // wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); |
| | | // if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){ |
| | | // //æä¸ªç¹ï¼éè¦é®åå¥çæ¬é®é¢ï¼å±ç¤ºé»è®¤ä¸º1 |
| | | //// OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid()); |
| | | // wupinEntity.setRevisionValue("1"); |
| | | // } |
| | | // |
| | | // wupinEntity.setRevisionSeq(1); |
| | | // wupinEntity.setVersionSeq(1); |
| | | // //æä¸ªç¹ï¼éè¦é®åå¥çæ¬é®é¢ï¼å±ç¤ºé»è®¤ä¸º1 |
| | | // wupinEntity.setVersionValue("1"); |
| | | // wupinEntity.setLctid("wupinLC"); |
| | | // wupinEntity.setLcStatus("Editing"); |
| | | // wupinEntity.setId(""); |
| | | // wupinEntity.setName(""); |
| | | // wupinEntity.setDescription(""); |
| | | // wupinEntity.setOwner(userName); |
| | | // wupinEntity.setCheckinby(userName); |
| | | // wupinEntity.setCopyFromVersion(""); |
| | | // wupinEntity.setMaterialtype((short) 1001); |
| | | // wupinEntity.setCaigouwl("true"); |
| | | // wupinEntity.setShifoupihaoguanli("true"); |
| | | // wupinEntity.setKucunwl("true"); |
| | | // wupinEntity.setXiaoshouwl("false"); |
| | | // wupinEntity.setPassing("true"); |
| | | // |
| | | //// this.initTypeAttributeValue(wupinEntity,btmTypeVO); |
| | | // return wupinEntity; |
| | | // |
| | | // |
| | | //// return cbo; |
| | | // } |
| | | // ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); |
| | | |
| | | QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>(); |
| | | btmWrapper.eq("ID",btmName); |
| | | CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper); |
| | | // OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); |
| | | String userName = AuthUtil.getUser().getUserName(); |
| | | CodeWupinEntity wupinEntity = new CodeWupinEntity(); |
| | | wupinEntity.setOid(null); |
| | | // bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); |
| | | // bo.setNameoid((new ObjectUtility()).getNewObjectID36()); |
| | | wupinEntity.setBtmname(btmName); |
| | | wupinEntity.setLastR(String.valueOf(1)); |
| | | wupinEntity.setFirstR(String.valueOf(1)); |
| | | wupinEntity.setFirstV(String.valueOf(1)); |
| | | wupinEntity.setLastV(String.valueOf(1)); |
| | | wupinEntity.setCreator(userName); |
| | | wupinEntity.setCreateTime(new Date()); |
| | | wupinEntity.setLastModifier(userName); |
| | | wupinEntity.setLastModifyTime(new Date()); |
| | | wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid()); |
| | | wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); |
| | | if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){ |
| | | //æä¸ªç¹ï¼éè¦é®åå¥çæ¬é®é¢ï¼å±ç¤ºé»è®¤ä¸º1 |
| | | // OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid()); |
| | | wupinEntity.setRevisionValue("1"); |
| | | } |
| | | |
| | | wupinEntity.setRevisionSeq(1); |
| | | wupinEntity.setVersionSeq(1); |
| | | //æä¸ªç¹ï¼éè¦é®åå¥çæ¬é®é¢ï¼å±ç¤ºé»è®¤ä¸º1 |
| | | wupinEntity.setVersionValue("1"); |
| | | wupinEntity.setLctid("wupinLC"); |
| | | wupinEntity.setLcStatus("Editing"); |
| | | wupinEntity.setId(""); |
| | | wupinEntity.setName(""); |
| | | wupinEntity.setDescription(""); |
| | | wupinEntity.setOwner(userName); |
| | | wupinEntity.setCheckinby(userName); |
| | | wupinEntity.setCopyFromVersion(""); |
| | | wupinEntity.setMaterialtype((short) 1001); |
| | | wupinEntity.setCaigouwl("true"); |
| | | wupinEntity.setShifoupihaoguanli("true"); |
| | | wupinEntity.setKucunwl("true"); |
| | | wupinEntity.setXiaoshouwl("false"); |
| | | wupinEntity.setPassing("true"); |
| | | |
| | | // this.initTypeAttributeValue(wupinEntity,btmTypeVO); |
| | | return wupinEntity; |
| | | |
| | | |
| | | // return cbo; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºä¿®æ¹å¿½ç¥ç屿§ |
| | |
| | | * @param templateVO 模æ¿ç对象 |
| | | * @param cboList æ°æ®çå
容 |
| | | */ |
| | | // @Override |
| | | // public void batchSaveSelectChar(CodeClstemplateVO templateVO, List<ClientBusinessObject> 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)) { |
| | | //// SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | // selectAttrVOs.parallelStream().forEach(attrVO -> { |
| | | // List<String> valuesList = new CopyOnWriteArrayList<>(); |
| | | @Override |
| | | public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/ |
| | | List<String> 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)) { |
| | | // SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); |
| | | selectAttrVOs.parallelStream().forEach(attrVO -> { |
| | | List<String> valuesList = cboList; |
| | | // cboList.parallelStream().forEach(cbo -> { |
| | | // String value = cbo.getAttributeValue(attrVO.getId()); |
| | | // String value = cbo.get.getAttributeValue(attrVO.getId()); |
| | | // if (StringUtils.isNotBlank(value)) { |
| | | // valuesList.add(value); |
| | | // } |
| | | // }); |
| | | // if (!CollectionUtils.isEmpty(valuesList)) { |
| | | if (!CollectionUtils.isEmpty(valuesList)) { |
| | | for (String s : valuesList) { |
| | | DictBiz dictBiz = new DictBiz(); |
| | | dictBiz.setCode(templateVO.getBtmTypeId()); |
| | | dictBiz.setDictKey(s); |
| | | dictBiz.setDictValue(s); |
| | | //ä»åæ¥çcharServiceï¼å¯è¾å¯éï¼æ´æ¹ä¸ºè°ç¨omdä¸çæ¥å£æ¥å®ç° |
| | | iDictBizClient.getCheck(dictBiz); |
| | | } |
| | | // charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo); |
| | | // } |
| | | // }); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.ubcs.code.constant.MdmEngineConstant.*; |
| | | |
| | | @Service |
| | | public class MdmProductCodeServiceImpl implements MdmProductCodeService { |
| | | |
| | |
| | | Map<String, String> statusMap = allCodeDOList.stream().collect(Collectors.toMap(s -> s.getOid(), s -> s.getLcStatus())); |
| | | allCodeDOList.stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmname())).forEach(s -> { |
| | | s.setLcStatus(statusMap.get(s.getOid())); |
| | | |
| | | }); |
| | | codeAllCodeService.saveBatch(allCodeDOList); |
| | | iCodeWupinService.saveBatch(dataCBOList); |
| | |
| | | */ |
| | | package com.vci.ubcs.code.wrapper; |
| | | |
| | | import com.vci.ubcs.omd.cache.EnumCache; |
| | | import com.vci.ubcs.system.cache.DictCache; |
| | | import com.vci.ubcs.code.entity.CodeButton; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeButtonVO; |
| | |
| | | @Override |
| | | public CodeButtonVO entityVO(CodeButton codebutton) { |
| | | CodeButtonVO codebuttonVO = Objects.requireNonNull(BeanUtil.copy(codebutton, CodeButtonVO.class)); |
| | | codebuttonVO.setUsedpositiontypeText(DictCache.getValue("codeButtonPosition", codebutton.getUsedPositionType())); |
| | | codebuttonVO.setLcStatusText(DictCache.getValue("codeLcstatus", codebutton.getLcStatus())); |
| | | codebuttonVO.setUsedpositiontypeText(EnumCache.getValue("codeButtonPosition", codebutton.getUsedPositionType())); |
| | | codebuttonVO.setLcStatusText(EnumCache.getValue("codeLcstatus", codebutton.getLcStatus())); |
| | | return codebuttonVO; |
| | | } |
| | | |
| | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="codebuttonResultMap" type="com.vci.ubcs.code.entity.CodeButton"> |
| | | <result column="OID" property="oid"/> |
| | | <result column="REVISIONOID" property="revisionoid"/> |
| | | <result column="NAMEOID" property="nameoid"/> |
| | | <result column="REVISIONOID" property="revisionOid"/> |
| | | <result column="NAMEOID" property="nameOid"/> |
| | | <result column="BTMNAME" property="btmname"/> |
| | | <result column="LASTR" property="lastr"/> |
| | | <result column="FIRSTR" property="firstr"/> |
| | | <result column="LASTV" property="lastv"/> |
| | | <result column="FIRSTV" property="firstv"/> |
| | | <result column="LASTR" property="lastR"/> |
| | | <result column="FIRSTR" property="firstR"/> |
| | | <result column="LASTV" property="lastV"/> |
| | | <result column="FIRSTV" property="firstV"/> |
| | | <result column="CREATOR" property="creator"/> |
| | | <result column="CREATETIME" property="createtime"/> |
| | | <result column="LASTMODIFIER" property="lastmodifier"/> |
| | | <result column="LASTMODIFYTIME" property="lastmodifytime"/> |
| | | <result column="REVISIONRULE" property="revisionrule"/> |
| | | <result column="VERSIONRULE" property="versionrule"/> |
| | | <result column="REVISIONSEQ" property="revisionseq"/> |
| | | <result column="REVISIONVALUE" property="revisionvalue"/> |
| | | <result column="VERSIONSEQ" property="versionseq"/> |
| | | <result column="VERSIONVALUE" property="versionvalue"/> |
| | | <result column="CREATETIME" property="createTime"/> |
| | | <result column="LASTMODIFIER" property="lastModifier"/> |
| | | <result column="LASTMODIFYTIME" property="lastModifyTime"/> |
| | | <result column="REVISIONRULE" property="revisionRule"/> |
| | | <result column="VERSIONRULE" property="versionRule"/> |
| | | <result column="REVISIONSEQ" property="revisionSeq"/> |
| | | <result column="REVISIONVALUE" property="revisionValue"/> |
| | | <result column="VERSIONSEQ" property="versionSeq"/> |
| | | <result column="VERSIONVALUE" property="versionValue"/> |
| | | <result column="LCTID" property="lctid"/> |
| | | <result column="LCSTATUS" property="lcstatus"/> |
| | | <result column="LCSTATUS" property="lcStatus"/> |
| | | <result column="TS" property="ts"/> |
| | | <result column="ID" property="id"/> |
| | | <result column="NAME" property="name"/> |
| | | <result column="DESCRIPTION" property="description"/> |
| | | <result column="OWNER" property="owner"/> |
| | | <result column="COPYFROMVERSION" property="copyfromversion"/> |
| | | <result column="ICONCLS" property="iconcls"/> |
| | | <result column="EXECUTEJS" property="executejs"/> |
| | | <result column="USEDPOSITIONTYPE" property="usedpositiontype"/> |
| | | <result column="COPYFROMVERSION" property="copyFromVersion"/> |
| | | <result column="ICONCLS" property="iconCls"/> |
| | | <result column="EXECUTEJS" property="executeJs"/> |
| | | <result column="USEDPOSITIONTYPE" property="usedPositionType"/> |
| | | </resultMap> |
| | | |
| | | |
| | |
| | | |
| | | |
| | | <select id="selectPlCodeClstemplatePage" resultMap="plCodeClstemplateResultMap"> |
| | | select * from PL_CODE_CLSTEMPLATE where is_deleted = 0 order by revisionSeq |
| | | select * from PL_CODE_CLSTEMPLATE where 0 = 0 order by revisionSeq |
| | | </select> |
| | | |
| | | <select id="selectAllLevelChildOid" resultType="java.lang.String" > |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.controller; |
| | | |
| | | import com.vci.ubcs.omd.wrapper.EnumWrapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | 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.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import com.vci.ubcs.omd.service.IEnumService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ æ§å¶å¨ |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/enum") |
| | | @Api(value = "æä¸¾å®ä¹", tags = "æä¸¾å®ä¹æ¥å£") |
| | | public class EnumController extends BladeController { |
| | | |
| | | private final IEnumService omdEnumService; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ 详æ
|
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详æ
", notes = "ä¼ å
¥omdEnum") |
| | | public R<EnumVO> detail(Enum omdEnum) { |
| | | Enum detail = omdEnumService.getOne(Condition.getQueryWrapper(omdEnum)); |
| | | return R.data(EnumWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * æä¸¾å®ä¹ å页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥omdEnum") |
| | | public R<IPage<EnumVO>> list(Enum omdEnum, Query query) { |
| | | IPage<Enum> pages = omdEnumService.page(Condition.getPage(query), Condition.getQueryWrapper(omdEnum)); |
| | | return R.data(EnumWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ èªå®ä¹å页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥omdEnum") |
| | | public R<IPage<EnumVO>> page(EnumVO omdEnum, Query query) { |
| | | IPage<EnumVO> pages = omdEnumService.selectOmdEnumPage(Condition.getPage(query), omdEnum); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ æ°å¢ |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "æ°å¢", notes = "ä¼ å
¥omdEnum") |
| | | public R save(@Valid @RequestBody Enum omdEnum) { |
| | | return R.status(omdEnumService.save(omdEnum)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ ä¿®æ¹ |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "ä¿®æ¹", notes = "ä¼ å
¥omdEnum") |
| | | public R update(@Valid @RequestBody Enum omdEnum) { |
| | | return R.status(omdEnumService.updateById(omdEnum)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ æ°å¢æä¿®æ¹ |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥omdEnum") |
| | | public R submit(@Valid @RequestBody Enum omdEnum) { |
| | | return R.status(omdEnumService.saveOrUpdate(omdEnum)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ å é¤ |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "é»è¾å é¤", notes = "ä¼ å
¥ids") |
| | | public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String ids) { |
| | | return R.status(omdEnumService.deleteLogic(Func.toStrList(ids))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ å页 |
| | | */ |
| | | @GetMapping("/parent-list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥omdEnum") |
| | | public R<IPage<EnumVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> dict , Query query) { |
| | | return R.data(omdEnumService.parentList(dict, query)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·ååå
¸æ å½¢ç»æ |
| | | */ |
| | | @GetMapping("/tree") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "æ å½¢ç»æ", notes = "æ å½¢ç»æ") |
| | | public R<List<EnumVO>> tree(@ApiIgnore @RequestParam Map<String, Object> dict , Query query) { |
| | | List<EnumVO> tree = omdEnumService.tree(dict, query); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * è·åæä¸¾ |
| | | */ |
| | | @GetMapping("/dictionary") |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "è·åæä¸¾", notes = "è·åæä¸¾") |
| | | public R<List<EnumVO>> dictionary(String code) { |
| | | List<EnumVO> tree = omdEnumService.getList(code); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.controller; |
| | | |
| | | import com.vci.ubcs.omd.wrapper.EnumitemWrapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumItemVO; |
| | | import com.vci.ubcs.omd.service.IEnumItemService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 æ§å¶å¨ |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/enumItem") |
| | | @Api(value = "æä¸¾å®ä¹å表", tags = "æä¸¾å®ä¹å表æ¥å£") |
| | | public class EnumItemController extends BladeController { |
| | | |
| | | private final IEnumItemService omdEnumitemService; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 详æ
|
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详æ
", notes = "ä¼ å
¥omdEnumitem") |
| | | public R<EnumItemVO> detail(EnumItem enumitem) { |
| | | EnumItem detail = omdEnumitemService.getOne(Condition.getQueryWrapper(enumitem)); |
| | | return R.data(EnumitemWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * æä¸¾å®ä¹å表 å页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥omdEnumitem") |
| | | public R<IPage<EnumItemVO>> list(EnumItem enumitem, Query query) { |
| | | IPage<EnumItem> pages = omdEnumitemService.page(Condition.getPage(query), Condition.getQueryWrapper(enumitem).orderByAsc("sort")); |
| | | return R.data(EnumitemWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 å页 |
| | | */ |
| | | @GetMapping("/listAll") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥omdEnumitem") |
| | | public R<List<EnumItemVO>> listAll(@ApiIgnore @RequestParam Map<String, Object> omdEnumitem, Query query) { |
| | | return R.data(omdEnumitemService.childList(Condition.getQueryWrapper(omdEnumitem, EnumItem.class).orderByAsc("sort"))); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 èªå®ä¹å页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥omdEnumitem") |
| | | public R<IPage<EnumItemVO>> page(EnumItemVO omdEnumitem, Query query) { |
| | | IPage<EnumItemVO> pages = omdEnumitemService.selectOmdEnumitemPage(Condition.getPage(query), omdEnumitem); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 æ°å¢ |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "æ°å¢", notes = "ä¼ å
¥omdEnumitem") |
| | | public R save(@Valid @RequestBody EnumItem enumitem) { |
| | | return R.status(omdEnumitemService.save(enumitem)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 ä¿®æ¹ |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "ä¿®æ¹", notes = "ä¼ å
¥omdEnumitem") |
| | | public R update(@Valid @RequestBody EnumItem enumitem) { |
| | | return R.status(omdEnumitemService.updateById(enumitem)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 æ°å¢æä¿®æ¹ |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥omdEnumitem") |
| | | public R submit(@Valid @RequestBody EnumItem enumitem) { |
| | | |
| | | if(enumitem.getOid() == null){ |
| | | enumitem.setCreatetime(new Date()); |
| | | enumitem.setCreator(AuthUtil.getUser().getUserName()); |
| | | } |
| | | enumitem.setModifier(AuthUtil.getUser().getUserName()); |
| | | enumitem.setModifytime(new Date()); |
| | | enumitem.setTs(new Date()); |
| | | return R.status(omdEnumitemService.saveOrUpdate(enumitem)); |
| | | } |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 å é¤ |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "é»è¾å é¤", notes = "ä¼ å
¥ids") |
| | | public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String ids) { |
| | | return R.status(omdEnumitemService.deleteLogic(Func.toStrList(ids))); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.feign; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.mapper.EnumMapper; |
| | | import com.vci.ubcs.omd.service.IEnumItemService; |
| | | import com.vci.ubcs.omd.service.IEnumService; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.support.BladePage; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ Feignå®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @ApiIgnore() |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class EnumClient implements IEnumClient { |
| | | private final EnumMapper enumMapper; |
| | | |
| | | private IEnumService iEnumService; |
| | | private IEnumItemService iEnumItemService; |
| | | @Override |
| | | @GetMapping(TOP) |
| | | public BladePage<Enum> top(Integer current, Integer size) { |
| | | Query query = new Query(); |
| | | query.setCurrent(current); |
| | | query.setSize(size); |
| | | IPage<Enum> page = enumMapper.selectPage(Condition.getPage(query), |
| | | Wrappers.emptyWrapper()); |
| | | // service.page(Condition.getPage(query)); |
| | | return BladePage.of(page); |
| | | } |
| | | /** |
| | | * è·åæä¸¾å®ä¹å表 |
| | | * |
| | | * @param name ç¶èç¹name |
| | | * @param nameChild åèç¹name |
| | | * @return BladePage |
| | | */ |
| | | @Override |
| | | public R<String> getValue(String name,String nameChild) { |
| | | return R.data(iEnumService.getValue(name, nameChild)); |
| | | } |
| | | |
| | | @Override |
| | | public R<Enum> getById(String oid) { |
| | | return R.data(iEnumService.getById(oid)); |
| | | } |
| | | |
| | | @Override |
| | | public R<EnumItem> getByChildId(String oid) { |
| | | return R.data(iEnumItemService.getById(oid)); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<EnumVO>> getList(String name) { |
| | | return R.data(iEnumService.getList(name)); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.feign; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.mapper.EnumItemMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.support.BladePage; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 Feignå®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @ApiIgnore() |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class EnumItemClient implements IEnumItemClient { |
| | | |
| | | private final EnumItemMapper enumItemMapper; |
| | | @Override |
| | | @GetMapping(TOP) |
| | | public BladePage<EnumItem> top(Integer current, Integer size) { |
| | | Query query = new Query(); |
| | | query.setCurrent(current); |
| | | query.setSize(size); |
| | | IPage<EnumItem> page = enumItemMapper.selectPage(Condition.getPage(query), |
| | | Wrappers.emptyWrapper()); |
| | | // service.page(Condition.getPage(query)); |
| | | return BladePage.of(page); |
| | | } |
| | | |
| | | } |
copy from Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/DictMapper.java
copy to Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/EnumItemMapper.java
Îļþ´Ó Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/DictMapper.java ¸´ÖÆ |
| | |
| | | */ |
| | | package com.vci.ubcs.omd.mapper; |
| | | |
| | | |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumItemVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.vci.ubcs.omd.entity.Dict; |
| | | import com.vci.ubcs.omd.vo.DictVO; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Mapper æ¥å£ |
| | | * æä¸¾å®ä¹å表 Mapper æ¥å£ |
| | | * |
| | | * @author Chill |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | public interface DictMapper extends BaseMapper<Dict> { |
| | | public interface EnumItemMapper extends BaseMapper<EnumItem> { |
| | | |
| | | /** |
| | | * è·ååå
¸è¡¨å¯¹åºä¸æ |
| | | * èªå®ä¹å页 |
| | | * |
| | | * @param code åå
¸ç¼å· |
| | | * @param dictKey åå
¸åºå· |
| | | * @param page |
| | | * @param omdEnumitem |
| | | * @return |
| | | */ |
| | | String getValue(String code, String dictKey); |
| | | |
| | | /** |
| | | * è·ååå
¸è¡¨ |
| | | * |
| | | * @param code åå
¸ç¼å· |
| | | * @return |
| | | */ |
| | | List<Dict> getList(String code); |
| | | |
| | | /** |
| | | * è·åæ å½¢èç¹ |
| | | * |
| | | * @return |
| | | */ |
| | | List<DictVO> tree(); |
| | | |
| | | /** |
| | | * è·åæ å½¢èç¹ |
| | | * |
| | | * @return |
| | | */ |
| | | List<DictVO> parentTree(); |
| | | List<EnumItemVO> selectOmdEnumitemPage(IPage page, EnumItemVO omdEnumitem); |
| | | |
| | | } |
ÎļþÃû´Ó Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/DictMapper.java ÐÞ¸Ä |
| | |
| | | */ |
| | | package com.vci.ubcs.omd.mapper; |
| | | |
| | | |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.vci.ubcs.omd.entity.Dict; |
| | | import com.vci.ubcs.omd.vo.DictVO; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Mapper æ¥å£ |
| | | * æä¸¾å®ä¹ Mapper æ¥å£ |
| | | * |
| | | * @author Chill |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | public interface DictMapper extends BaseMapper<Dict> { |
| | | public interface EnumMapper extends BaseMapper<Enum> { |
| | | |
| | | /** |
| | | * è·ååå
¸è¡¨å¯¹åºä¸æ |
| | | * èªå®ä¹å页 |
| | | * |
| | | * @param code åå
¸ç¼å· |
| | | * @param dictKey åå
¸åºå· |
| | | * @param page |
| | | * @param omdEnum |
| | | * @return |
| | | */ |
| | | String getValue(String code, String dictKey); |
| | | List<EnumVO> selectOmdEnumPage(IPage page, EnumVO omdEnum); |
| | | |
| | | /** |
| | | * è·ååå
¸è¡¨ |
| | | * |
| | | * @param code åå
¸ç¼å· |
| | | * @return |
| | | */ |
| | | List<Dict> getList(String code); |
| | | |
| | | /** |
| | | * è·åæ å½¢èç¹ |
| | | * |
| | | * @return |
| | | */ |
| | | List<DictVO> tree(); |
| | | String getValue(String name, String nameChild); |
| | | |
| | | /** |
| | | * è·åæ å½¢èç¹ |
| | | * |
| | | * @return |
| | | */ |
| | | List<DictVO> parentTree(); |
| | | |
| | | List<EnumVO> getList(String name); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumItemVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 æå¡ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | public interface IEnumItemService extends IService<EnumItem> { |
| | | |
| | | /** |
| | | * èªå®ä¹å页 |
| | | * |
| | | * @param page |
| | | * @param omdEnumitem |
| | | * @return |
| | | */ |
| | | IPage<EnumItemVO> selectOmdEnumitemPage(IPage<EnumItemVO> page, EnumItemVO omdEnumitem); |
| | | |
| | | |
| | | boolean deleteLogic(List<String> toStringList); |
| | | |
| | | List<EnumItemVO> childList(QueryWrapper<EnumItem> queryWrapper); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.support.Query; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ æå¡ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | public interface IEnumService extends IService<Enum> { |
| | | |
| | | /** |
| | | * èªå®ä¹å页 |
| | | * |
| | | * @param page |
| | | * @param omdEnum |
| | | * @return |
| | | */ |
| | | IPage<EnumVO> selectOmdEnumPage(IPage<EnumVO> page, EnumVO omdEnum); |
| | | |
| | | |
| | | boolean deleteLogic(List<String> toStringList); |
| | | |
| | | IPage<EnumVO> parentList(Map<String, Object> dict, Query query); |
| | | /** |
| | | * æ å½¢ç»æ |
| | | * |
| | | * @return |
| | | */ |
| | | List<EnumVO> tree(Map<String, Object> dict , Query query); |
| | | /** |
| | | * è·åæä¸¾å®ä¹å表 |
| | | * |
| | | * @param name ç¶èç¹name |
| | | * @param nameChild åèç¹name |
| | | * @return BladePage |
| | | */ |
| | | String getValue(String name, String nameChild); |
| | | |
| | | List<EnumVO> getList(String name); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumItemVO; |
| | | import com.vci.ubcs.omd.mapper.EnumItemMapper; |
| | | import com.vci.ubcs.omd.service.IEnumItemService; |
| | | import com.vci.ubcs.omd.wrapper.EnumitemWrapper; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 æå¡å®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @Service |
| | | public class EnumItemServiceImpl extends ServiceImpl<EnumItemMapper, EnumItem> implements IEnumItemService { |
| | | |
| | | @Override |
| | | public IPage<EnumItemVO> selectOmdEnumitemPage(IPage<EnumItemVO> page, EnumItemVO omdEnumitem) { |
| | | return page.setRecords(baseMapper.selectOmdEnumitemPage(page, omdEnumitem)); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteLogic(List<String> toStringList) { |
| | | return SqlHelper.retBool(baseMapper.deleteBatchIds(toStringList)); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumItemVO> childList(QueryWrapper<EnumItem> queryWrapper) { |
| | | |
| | | return EnumitemWrapper.build().listVO(baseMapper.selectList(queryWrapper)); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.mapper.EnumItemMapper; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import com.vci.ubcs.omd.mapper.EnumMapper; |
| | | import com.vci.ubcs.omd.service.IEnumService; |
| | | import com.vci.ubcs.omd.wrapper.EnumWrapper; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ æå¡å®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | @Service |
| | | public class EnumServiceImpl extends ServiceImpl<EnumMapper, Enum> implements IEnumService { |
| | | |
| | | @Resource |
| | | EnumItemMapper enumItemMapper; |
| | | @Override |
| | | public IPage<EnumVO> selectOmdEnumPage(IPage<EnumVO> page, EnumVO omdEnum) { |
| | | return page.setRecords(baseMapper.selectOmdEnumPage(page, omdEnum)); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteLogic(List<String> toStringList) { |
| | | return SqlHelper.retBool(baseMapper.deleteBatchIds(toStringList)); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<EnumVO> parentList(Map<String, Object> dict, Query query) { |
| | | IPage<Enum> page = this.page(Condition.getPage(query), |
| | | Condition.getQueryWrapper(dict, Enum.class).lambda() |
| | | .orderByDesc(Enum::getCreatetime)); |
| | | return EnumWrapper.build().pageVO(page); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumVO> tree(Map<String, Object> dict, Query query) { |
| | | List<Enum> pages = this.page(Condition.getPage(query),Condition.getQueryWrapper(dict, Enum.class).lambda() |
| | | .orderByDesc(Enum::getCreatetime)).getRecords(); |
| | | List<EnumVO> listVo = new ArrayList<>(); |
| | | pages.stream().forEach(page->{ |
| | | EnumVO enumVO = new EnumVO(); |
| | | QueryWrapper<EnumItem> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("parentOid",page.getOid()); |
| | | List<EnumItem> enumItems = enumItemMapper.selectList(wrapper); |
| | | BeanUtils.copyProperties(page, enumVO); |
| | | if(enumItems.size()>0){ |
| | | enumVO.setChildren(enumItems); |
| | | enumVO.setHasChildren(true); |
| | | } |
| | | listVo.add(enumVO); |
| | | }); |
| | | |
| | | return listVo; |
| | | } |
| | | |
| | | @Override |
| | | public String getValue(String name, String nameChild) { |
| | | return Func.toStr(baseMapper.getValue(name, nameChild), StringPool.EMPTY); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumVO> getList(String name) { |
| | | return baseMapper.getList(name); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.wrapper; |
| | | |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹ å
è£
ç±»,è¿åè§å¾å±æéçåæ®µ |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | public class EnumWrapper extends BaseEntityWrapper<Enum, EnumVO> { |
| | | |
| | | public static EnumWrapper build() { |
| | | return new EnumWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public EnumVO entityVO(Enum omdEnum) { |
| | | EnumVO enumVO = Objects.requireNonNull(BeanUtil.copy(omdEnum, EnumVO.class)); |
| | | |
| | | //User createUser = UserCache.getUser(omdEnum.getCreateUser()); |
| | | //User updateUser = UserCache.getUser(omdEnum.getUpdateUser()); |
| | | //omdEnumVO.setCreateUserName(createUser.getName()); |
| | | //omdEnumVO.setUpdateUserName(updateUser.getName()); |
| | | |
| | | return enumVO; |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.omd.wrapper; |
| | | |
| | | import com.vci.ubcs.omd.cache.EnumCache; |
| | | import com.vci.ubcs.omd.entity.Enum; |
| | | import com.vci.ubcs.omd.vo.EnumVO; |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.node.ForestNodeMerger; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import com.vci.ubcs.omd.entity.EnumItem; |
| | | import com.vci.ubcs.omd.vo.EnumItemVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æä¸¾å®ä¹å表 å
è£
ç±»,è¿åè§å¾å±æéçåæ®µ |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-05-08 |
| | | */ |
| | | public class EnumitemWrapper extends BaseEntityWrapper<EnumItem, EnumItemVO> { |
| | | |
| | | public static EnumitemWrapper build() { |
| | | return new EnumitemWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public EnumItemVO entityVO(EnumItem enumitem) { |
| | | |
| | | EnumItemVO enumItemVO = Objects.requireNonNull(BeanUtil.copy(enumitem, EnumItemVO.class)); |
| | | if (enumitem.getParentoid() == null ) { |
| | | enumItemVO.setParentName(BladeConstant.TOP_PARENT_NAME); |
| | | } else { |
| | | Enum parent = EnumCache.getById(enumitem.getParentoid()); |
| | | enumItemVO.setParentName(parent.getLabel()); |
| | | } |
| | | return enumItemVO; |
| | | } |
| | | public List<EnumVO> listNodeVO(List<EnumItem> list) { |
| | | List<EnumItem> collect = list.stream().map(omdEnumItem -> BeanUtil.copy(omdEnumItem, EnumItem.class)).collect(Collectors.toList()); |
| | | return ForestNodeMerger.merge((List)collect); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.vci.ubcs.omd.mapper.EnumItemMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="enumitemResultMap" type="com.vci.ubcs.omd.entity.EnumItem"> |
| | | <result column="OID" property="oid"/> |
| | | <result column="NAME" property="name"/> |
| | | <result column="VALUE" property="value"/> |
| | | <result column="DESCRIPTION" property="description"/> |
| | | <result column="TS" property="ts"/> |
| | | <result column="CREATOR" property="creator"/> |
| | | <result column="CREATETIME" property="createtime"/> |
| | | <result column="MODIFIER" property="modifier"/> |
| | | <result column="MODIFYTIME" property="modifytime"/> |
| | | <result column="PARENTOID" property="parentoid"/> |
| | | <result column="SORT" property="sort"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="selectOmdEnumitemPage" resultMap="enumitemResultMap"> |
| | | select * from PL_OMD_ENUMITEM where 1 = 1 |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.vci.ubcs.omd.mapper.EnumMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="enumResultMap" type="com.vci.ubcs.omd.entity.Enum"> |
| | | <result column="OID" property="oid"/> |
| | | <result column="NAME" property="name"/> |
| | | <result column="LABEL" property="label"/> |
| | | <result column="TS" property="ts"/> |
| | | <result column="CREATOR" property="creator"/> |
| | | <result column="CREATETIME" property="createtime"/> |
| | | <result column="MODIFIER" property="modifier"/> |
| | | <result column="MODIFYTIME" property="modifytime"/> |
| | | <result column="REMARK" property="remark"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="selectOmdEnumPage" resultMap="enumResultMap"> |
| | | select * from PL_OMD_ENUM where 1 = 0 |
| | | </select> |
| | | |
| | | <select id="getValue" resultType="java.lang.String"> |
| | | select POE.NAME |
| | | from PL_OMD_ENUM PO, PL_OMD_ENUMITEM POE |
| | | WHERE PO.OID = POE.PARENTOID |
| | | AND PO.NAME = #{param1} |
| | | AND POE.VALUE = #{param2} |
| | | </select> |
| | | |
| | | <select id="getList" resultType="com.vci.ubcs.omd.vo.EnumVO"> |
| | | select PO.OID, |
| | | PO.NAME, |
| | | PO.LABEL, |
| | | PO.TS, |
| | | PO.CREATOR, |
| | | PO.CREATOR, |
| | | PO.CREATETIME, |
| | | PO.MODIFIER, |
| | | PO.MODIFYTIME, |
| | | PO.REMARK, |
| | | POE.OID ITEM_OID, |
| | | POE.NAME ITEM_NAME, |
| | | POE.VALUE ITEM_VALUE, |
| | | POE.DESCRIPTION ITEM_DESCRIPTION |
| | | from PL_OMD_ENUM PO, PL_OMD_ENUMITEM POE |
| | | WHERE PO.OID = POE.PARENTOID |
| | | AND PO.NAME = #{param1} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |