diff --git a/console-web/src/main.js b/console-web/src/main.js index c83bb305..e05af936 100644 --- a/console-web/src/main.js +++ b/console-web/src/main.js @@ -11,9 +11,11 @@ import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/a import { isAuth } from '@/utils' import cloneDeep from 'lodash/cloneDeep' import './utils/directives.js' +import dict from './utils/dict' Vue.use(VueCookie) Vue.config.productionTip = false +Vue.prototype.dict = dict // 非生产环境, 适配mockjs模拟数据 // api: https://github.com/nuysoft/Mock if (process.env.NODE_ENV !== 'production') { diff --git a/console-web/src/utils/dict.js b/console-web/src/utils/dict.js new file mode 100644 index 00000000..bb00cf2c --- /dev/null +++ b/console-web/src/utils/dict.js @@ -0,0 +1,90 @@ +import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios +import { isGDASucc } from '@/utils' + +var storage = { + set(key, value) { + sessionStorage.setItem(key, JSON.stringify(value)) + }, + get(key) { + return JSON.parse(sessionStorage.getItem(key)) + }, + remove(key) { + sessionStorage.removeItem(key) + } +} + +const dict = { + flag: false, + formatter: function(row, column, cellValue, index) { + if (cellValue == null || cellValue === '') { + return '' + } + let name = column.columnKey + if (name == null) { + name = column.property + } + let data = storage.get(name) + console.log('data1:' + data) + + if (!data) { + dict.getHlpData(name) + return cellValue + } + + if (!data.hasOwnProperty(cellValue)) { + return cellValue + } + console.log('data2:' + data[cellValue]) + + return data[cellValue] + }, + get: function(name) { + let data = storage.get(name) + if (!data) { + return {} + } + let data2 = [] + for (var key in data) { + data2.push({value: key, label: data[key]}) + } + return data2 + }, + getHlpData: function(name) { + if (dict.flag) { + return + } + dict.flag = true + + if (storage.get(name)) { + return + } + // 后台获取 + httpRequest({ + url: httpRequest.adornUrl('/buipubbpc1/buiHlpQueryByName.do'), + method: 'get', + params: httpRequest.adornParams({ + 'name': name + }) + }).then(({data}) => { + dict.flag = false + if (isGDASucc(data)) { + if (data.data) { + let data1 = {} + for (let k in data.data) { + data1[data.data[k]['fld_val']] = data.data[k]['fld_exp'] + } + + console.log('data1:' + JSON.stringify(data1)) + storage.set(name, data1) + } else { + dict.data[name] = {} + } + } else { + dict.data[name] = {} + } + this.dataListLoading = false + }) + } +} + +export default dict \ No newline at end of file diff --git a/console-web/src/utils/httpRequest.js b/console-web/src/utils/httpRequest.js index 7e75dba1..9bf324b2 100644 --- a/console-web/src/utils/httpRequest.js +++ b/console-web/src/utils/httpRequest.js @@ -25,7 +25,7 @@ http.interceptors.request.use(config => { }, error => { console.log('request.use:' + error) Message.error({message: 'communcation error:' + error}) - return null + return '' }) /** @@ -46,7 +46,7 @@ http.interceptors.response.use(response => { }, error => { console.log('response.use:' + error) Message.error({message: 'communcation error:' + error}) - return null + return '' }) /** diff --git a/console-web/src/utils/storage.js b/console-web/src/utils/storage.js new file mode 100644 index 00000000..81356974 --- /dev/null +++ b/console-web/src/utils/storage.js @@ -0,0 +1,13 @@ +var storage = { + set(key, value) { + sessionStorage.setItem(key, JSON.stringify(value)) + }, + get(key) { + return JSON.parse(sessionStorage.getItem(key)) + }, + remove(key) { + sessionStorage.removeItem(key) + } +} + +export default storage diff --git a/console-web/src/views/main-sidebar.vue b/console-web/src/views/main-sidebar.vue index 8d492e39..5cd71190 100644 --- a/console-web/src/views/main-sidebar.vue +++ b/console-web/src/views/main-sidebar.vue @@ -62,7 +62,7 @@ }, menuActiveName: { get () { return this.$store.state.common.menuActiveName }, - set (val) { this.$store.commit('common/', val) } + set (val) { this.$store.commit('common/updateMenuActiveName', val) } }, mainTabs: { get () { return this.$store.state.common.mainTabs }, diff --git a/console-web/src/views/modules/pub/user-add-or-update.vue b/console-web/src/views/modules/pub/user-add-or-update.vue index 9d28fdc1..899a1a01 100644 --- a/console-web/src/views/modules/pub/user-add-or-update.vue +++ b/console-web/src/views/modules/pub/user-add-or-update.vue @@ -53,7 +53,7 @@ - + @@ -133,22 +133,6 @@ status: '0' }, orgNoList: [], - operTypeList: [{ - value: '1', - label: '管理人员' - }, { - value: '2', - label: '业务操作人员' - }, { - value: '3', - label: '客户经理' - }, { - value: '4', - label: '技术操作员' - }, { - value: '9', - label: '其他' - }], dataRule: { operNo: [ { required: true, message: '登录账号不能为空', trigger: 'blur' } diff --git a/console-web/src/views/modules/pub/user.vue b/console-web/src/views/modules/pub/user.vue index f651add0..b42b734f 100644 --- a/console-web/src/views/modules/pub/user.vue +++ b/console-web/src/views/modules/pub/user.vue @@ -15,8 +15,10 @@ border v-loading="dataListLoading" @selection-change="selectionChangeHandle" - style="width: 100%;"> + style="width: 100%;" + height="400"> @@ -136,19 +139,6 @@ }, methods: { // 数据转义 - operTypStateFormat (row, column) { - if (row.oper_typ === '1') { - return '管理人员' - } else if (row.oper_typ === '2') { - return '业务操作人员' - } else if (row.oper_typ === '3') { - return '客户经理' - } else if (row.oper_typ === '4') { - return '技术操作员' - } else { - return '其他' - } - }, // 获取数据列表 getDataList () { this.dataListLoading = true diff --git a/doc/中间业务平台开发指南.docx b/doc/中间业务平台开发指南.docx index ab29258f..c83c48ef 100644 Binary files a/doc/中间业务平台开发指南.docx and b/doc/中间业务平台开发指南.docx differ diff --git a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/action/buipubbpc1/BuiHlpGenerateAction.java b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/action/buipubbpc1/BuiHlpGenerateAction.java new file mode 100644 index 00000000..e420731f --- /dev/null +++ b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/pub/action/buipubbpc1/BuiHlpGenerateAction.java @@ -0,0 +1,171 @@ +package com.murong.ecp.netpay.mbu.web.pub.action.buipubbpc1; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.murong.ecp.netpay.mbu.web.common.utils.BaseAction; +import com.murong.ecp.netpay.mbu.web.common.utils.CommonMessageCode; +import com.murong.ecp.netpay.mbu.web.common.utils.ResultT; +import com.murong.ecp.netpay.mbu.web.common.utils.ValidatorUtil; +import com.murong.ecp.netpay.mbu.web.pub.dal.dao.BuiHlpMapper; +import com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiHlpDO; +import com.murong.ecp.netpay.mbu.web.pub.model.BuiHlpDeleteReqBO; +import com.yuangou.ecp.biz.transengine.sqlsession.YGSqlSession; +import com.yuangou.ecp.bp.comp.pubatc.bat.YGData; +import com.yuangou.ecp.bp.core.common.exception.YGException; +import com.yuangou.ecp.bp.core.common.message.YGBizMessage; +import com.yuangou.ecp.bp.core.common.message.YGBizMessageContext; +import com.yuangou.ecp.bp.core.common.yglog4j.Logger; +import com.yuangou.ecp.bp.core.common.yglog4j.YGLogger; +import com.yuangou.ecp.bp.database.YGDatabaseUtil; +import com.yuangou.ecp.bp.database.YGResultSet; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * 字典枚举值生成服务 + * Created by xu_lw on 2019-08-24 17:26:40. + */ +@Service("buiHlpGenerate") +public class BuiHlpGenerateAction extends BaseAction { + @Autowired + private BuiHlpMapper buiHlpMapper; + + /** + * 删除记录 + * + * @param bizCtx + * @return + * @throws YGException + */ + public ResultT execute(YGBizMessageContext bizCtx) throws YGException { + YGBizMessage bizMsg = bizCtx.getCurrentMsg(); + Logger msgLog = YGLogger.getLogger(bizMsg); + YGDatabaseUtil dbUtil = bizCtx.getDataBaseUtil(); + + Connection connection = dbUtil.getConnection(); + PreparedStatement ps = null; + ResultSet rs = null; + ResultT resultT = new ResultT(); + Map> fldHlps = new HashMap>(); + + try { + ps = connection.prepareStatement("select * from t_pub_hlp order by fld_nm,fld_order"); + rs = ps.executeQuery(); + while (rs.next()) { + String fldNm = rs.getString("fld_nm"); + String fldVal = rs.getString("fld_val"); + String fldExp = rs.getString("fld_exp"); + Map map = (Map) fldHlps.get(fldNm); + if (map == null) { + map = new LinkedHashMap(); + fldHlps.put(name, map); + } + map.put(fldExp, fldVal); + } + } catch (Exception e) { + msgLog.info(e.toString(), e); + resultT.setMsgCod(CommonMessageCode.FAIL); + resultT.setMsgInf(e.toString()); + return resultT; + } finally { + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + ; + } + } + if (ps != null) { + try { + ps.close(); + } catch (SQLException e) { + ; + } + } + } + + + + StringBuffer buf = new StringBuffer(); + buf.append("const dict = {\n"); + buf.append(" data: {\n"); + for (String name : fldHlps.keySet()) { + Map map = fldHlps.get(name); + buf.append("{"); + for(String name1: map.keySet() ) { + buf.append("'" + name1 + "'"); + buf.append(":"); + buf.append("'" + map.get(name1) + "'"); + buf.append(","); + } + buf.deleteCharAt(buf.length() - 1); + buf.append("},\n"); + } + buf.deleteCharAt(buf.length() - 1); + buf.append(" },\n"); + buf.append(" formatter: function(row, column, cellValue, index) {\n" + + " if (cellValue == null || cellValue === '') {\n" + + " return ''\n" + + " }\n" + + " var name = column.property\n" + + "\n" + + " if (!dict.data.hasOwnProperty(name)) {\n" + + " return cellValue\n" + + " }\n" + + " if (!dict.data[name].hasOwnProperty(cellValue)) {\n" + + " return cellValue\n" + + " }\n" + + " return dict.data[name][cellValue]\n" + + " },\n" + + " get: function(name) {\n" + + " if (!dict.data.hasOwnProperty(name)) {\n" + + " return {}\n" + + " }\n" + + " let data2 = []\n" + + " for (var key in dict.data[name]) {\n" + + " data2.push({value: key, label: dict.data[name][key]})\n" + + " }\n" + + " return data2\n" + + " }\n" + + "}\n" + + "\n" + + "export default dict"); + + try { + FileUtils.write(new File("dict.js"), buf.toString(), "UTF-8"); + } catch (IOException e) { + msgLog.info(e.toString(), e); + resultT.setMsgCod(CommonMessageCode.FAIL); + resultT.setMsgInf(e.toString()); + return resultT; + } + resultT.setMsgCod(CommonMessageCode.SUCC); + + return resultT; + } + + public static void main(String[] args) { + Map map = new LinkedHashMap(); + map.put("2", "测试2"); + map.put("1", "测试1"); + map.put("4", "测试4"); + map.put("5", "测试5"); + + System.out.println(JSON.toJSONString(map)); + } +} diff --git a/ecp-mbu-web/src/test/resources/template/mng.vue.ftl b/ecp-mbu-web/src/test/resources/template/mng.vue.ftl index 756246d8..e0d181d8 100755 --- a/ecp-mbu-web/src/test/resources/template/mng.vue.ftl +++ b/ecp-mbu-web/src/test/resources/template/mng.vue.ftl @@ -15,8 +15,10 @@ border v-loading="dataListLoading" @selection-change="selectionChangeHandle" - style="width: 100%;"> + style="width: 100%;" + height="400">