Jelajahi Sumber

fix 新增字段翻译器处理

Administrator 4 tahun lalu
induk
melakukan
1bc78bfa44

+ 28 - 0
boman-modules/boman-gen/src/main/java/com/boman/gen/service/GenTableColumnServiceImpl.java

@@ -16,8 +16,11 @@ import com.boman.gen.mapper.GenTableMapper;
 import com.boman.gen.mapper.TableSqlMapper;
 import com.google.common.collect.Maps;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -38,6 +41,9 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
     @Autowired
     private TableSqlMapper tableSqlMapper;
 
+    @Resource
+    private RestTemplate restTemplate;
+
     /**
      * 查询业务字段列表
      *
@@ -133,6 +139,8 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
         list.add(genTableColumn);
         isAk(list);
         insertCreateLog(list, BusinessType.INSERT);
+        //处理字段翻译器
+        fieldTranslator(list);
         return i;
     }
 
@@ -148,6 +156,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
         list.add(genTableColumn);
         isAk(list);
         insertCreateLog(list, BusinessType.UPDATE);
+        fieldTranslator(list);
         return genTableColumnMapper.updateGenTableColumn(genTableColumn);
     }
 
@@ -170,6 +179,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
     /**
      * 插入表sql日志
      */
+    @Async
     public void insertCreateLog(List<GenTableColumn> genTableColumnList, BusinessType type) {
         GenTable genTable = genTableMapper.selectGenTableById(genTableColumnList.get(0).getTableId());
         TableSql tableSql = tableSqlMapper.selectTableSqlByTableId(genTableColumnList.get(0).getTableId());
@@ -203,6 +213,7 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
      *
      * @param genTableColumnList
      */
+    @Async
     public void isAk(List<GenTableColumn> genTableColumnList) {
         GenTable genTable = new GenTable();
         for (GenTableColumn genTableColumn : genTableColumnList) {
@@ -250,6 +261,23 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService {
     }
 
 
+
+    /**
+     * 处理字段翻译器
+     * @param genTableColumnList
+     */
+    @Async
+    public void fieldTranslator (List<GenTableColumn> genTableColumnList) {
+        for (GenTableColumn genTableColumn : genTableColumnList) {
+            String fieldTranslator = genTableColumn.getFieldTranslator();
+            if (StringUtils.isNotBlank(fieldTranslator)){
+                 restTemplate.postForObject("http://" + fieldTranslator, genTableColumn, GenTableColumn.class);
+            }
+        }
+    }
+
+
+
     /**
      * 删除业务字段对象
      *

+ 0 - 8
boman-modules/boman-gen/src/main/java/com/boman/gen/service/GenTableServiceImpl.java

@@ -452,14 +452,6 @@ public class GenTableServiceImpl implements IGenTableService {
     public AjaxResult insertGenTable(GenTable genTable) {
         String menuRole = genTable.getMenuRole();
         genTable.setMenuRole(menuRole.toUpperCase());
-
-        Integer tableColumn = genTable.getTableColumn();
-        if (tableColumn != null && tableColumn > 0){
-            //判断表单有几列 用24进行除法
-            int num = 24 / tableColumn;
-            genTable.setTableColumn(num);
-
-        }
         //新增表成功的时候,新增字段公共字段
         int i = genTableMapper.insertGenTable(genTable);
         if (i > 0) {

+ 5 - 5
ruoyi-ui/package.json

@@ -37,7 +37,7 @@
   },
   "dependencies": {
     "@riophae/vue-treeselect": "0.4.0",
-    "axios": "0.21.0",
+    "axios": "^0.21.1",
     "burgeon-ui": "1.0.46",
     "clipboard": "2.0.6",
     "core-js": "3.8.1",
@@ -65,21 +65,21 @@
   "devDependencies": {
     "@vue/cli-plugin-babel": "4.4.6",
     "@vue/cli-plugin-eslint": "4.4.6",
-    "@vue/cli-service": "4.4.6",
+    "@vue/cli-service": "^4.5.13",
     "babel-eslint": "10.1.0",
     "chalk": "4.1.0",
     "connect": "3.6.6",
     "eslint": "7.15.0",
     "eslint-plugin-vue": "7.2.0",
+    "less": "^4.1.1",
+    "less-loader": "^4.1.0",
     "lint-staged": "10.5.3",
     "runjs": "4.4.2",
     "sass": "1.32.0",
     "sass-loader": "10.1.0",
     "script-ext-html-webpack-plugin": "2.1.5",
     "svg-sprite-loader": "5.1.1",
-    "vue-template-compiler": "2.6.12",
-    "less": "^4.1.1",
-    "less-loader": "^4.1.0"
+    "vue-template-compiler": "2.6.12"
   },
   "engines": {
     "node": ">=8.9",

+ 84 - 84
ruoyi-ui/src/main.js

@@ -1,98 +1,98 @@
-import Vue from 'vue'
-
+import Vue from 'vue'
+
 import Cookies from 'js-cookie'
 
 // import '@/assets/styles/theme.scss';
 import less from 'less'
-Vue.use(less)
-
-import Element from 'element-ui'
-import './assets/styles/element-variables.scss'
+Vue.use(less)
+
+import Element from 'element-ui'
+import './assets/styles/element-variables.scss'
 import 'burgeon-ui/dist/styles/burgeon-ui.css';
-
-import '@/assets/styles/index.scss' // global css
-import '@/assets/styles/ruoyi.scss' // ruoyi css
-import App from './App'
-import store from './store'
-import router from './router'
-import permission from './directive/permission'
+
+import '@/assets/styles/index.scss' // global css
+import '@/assets/styles/ruoyi.scss' // ruoyi css
+import App from './App'
+import store from './store'
+import router from './router'
+import permission from './directive/permission'
 import { download } from '@/utils/request'
 
-import '@/utils/dateApi'
-
-
-import './assets/icons' // icon
-import './permission' // permission control
-import { getDicts } from "@/api/system/dict/data";
-import { getConfigKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
-import Pagination from "@/components/Pagination";
-// 自定义表格工具扩展
-import RightToolbar from "@/components/RightToolbar"
-import DynamicForm from "@/components/DynamicForm"
-import DynamicForms from "@/components/DynamicForms"
-import DynamicFormsteo from "@/components/DynamicFormsteo"
+import '@/utils/dateApi'
+
+
+import './assets/icons' // icon
+import './permission' // permission control
+import { getDicts } from "@/api/system/dict/data";
+import { getConfigKey } from "@/api/system/config";
+import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
+import Pagination from "@/components/Pagination";
+// 自定义表格工具扩展
+import RightToolbar from "@/components/RightToolbar"
+import DynamicForm from "@/components/DynamicForm"
+import DynamicForms from "@/components/DynamicForms"
+import DynamicFormsteo from "@/components/DynamicFormsteo"
 import MemoranDum from "@/components/MemoranDum"
 import 'burgeon-ui/dist/styles/burgeon-ui.css';
 import 'burgeon-ui/dist/styles/bjIconfonts/iconfont.css';
 import BigPicture from "@/components/BigPicture";
 Vue.component('BigPicture', BigPicture)
 import BurgeonUi from 'burgeon-ui';
-
-// 全局方法挂载
-Vue.prototype.getDicts = getDicts
-Vue.prototype.getConfigKey = getConfigKey
-Vue.prototype.parseTime = parseTime
-Vue.prototype.resetForm = resetForm
-Vue.prototype.addDateRange = addDateRange
-Vue.prototype.selectDictLabel = selectDictLabel
-Vue.prototype.selectDictLabels = selectDictLabels
-Vue.prototype.download = download
-Vue.prototype.handleTree = handleTree
-
-Vue.prototype.msgSuccess = function (msg) {
-  this.$message({ showClose: true, message: msg, type: "success" });
-}
-
-Vue.prototype.msgError = function (msg) {
-  this.$message({ showClose: true, message: msg, type: "error" });
-}
-
-Vue.prototype.msgInfo = function (msg) {
-  this.$message.info(msg);
-}
-
-import directive from "@/components/Directives";
-Vue.use(directive)
-
-// 全局组件挂载
-Vue.component('Pagination', Pagination)
-Vue.component('RightToolbar', RightToolbar)
-Vue.component('DynamicForm', DynamicForm)
-Vue.component('DynamicForms', DynamicForms)
-Vue.component('DynamicFormsteo', DynamicFormsteo)
-Vue.component('MemoranDum', MemoranDum)
-
+
+// 全局方法挂载
+Vue.prototype.getDicts = getDicts
+Vue.prototype.getConfigKey = getConfigKey
+Vue.prototype.parseTime = parseTime
+Vue.prototype.resetForm = resetForm
+Vue.prototype.addDateRange = addDateRange
+Vue.prototype.selectDictLabel = selectDictLabel
+Vue.prototype.selectDictLabels = selectDictLabels
+Vue.prototype.download = download
+Vue.prototype.handleTree = handleTree
+
+Vue.prototype.msgSuccess = function (msg) {
+  this.$message({ showClose: true, message: msg, type: "success" });
+}
+
+Vue.prototype.msgError = function (msg) {
+  this.$message({ showClose: true, message: msg, type: "error" });
+}
+
+Vue.prototype.msgInfo = function (msg) {
+  this.$message.info(msg);
+}
+
+import directive from "@/components/Directives";
+Vue.use(directive)
+
+// 全局组件挂载
+Vue.component('Pagination', Pagination)
+Vue.component('RightToolbar', RightToolbar)
+Vue.component('DynamicForm', DynamicForm)
+Vue.component('DynamicForms', DynamicForms)
+Vue.component('DynamicFormsteo', DynamicFormsteo)
+Vue.component('MemoranDum', MemoranDum)
+
 Vue.use(permission)
-
-/**
- * If you don't want to use mock-server
- * you want to use MockJs for mock api
- * you can execute: mockXHR()
- *
- * Currently MockJs will be used in the production environment,
- * please remove it before going online! ! !
- */
-
-Vue.use(Element, {
-  size: Cookies.get('size') || 'medium' // set element-ui default size
-})
-Vue.use(BurgeonUi);
-Vue.config.productionTip = false
-
-new Vue({
-  el: '#app',
-  router,
-  store,
-  render: h => h(App)
-})
+
+/**
+ * If you don't want to use mock-server
+ * you want to use MockJs for mock api
+ * you can execute: mockXHR()
+ *
+ * Currently MockJs will be used in the production environment,
+ * please remove it before going online! ! !
+ */
+
+Vue.use(Element, {
+  size: Cookies.get('size') || 'medium' // set element-ui default size
+})
+Vue.use(BurgeonUi);
+Vue.config.productionTip = false
+
+new Vue({
+  el: '#app',
+  router,
+  store,
+  render: h => h(App)
+})