1. 接入多源数据

2. 办公基价批量更新和单个更新配置
This commit is contained in:
purple 2020-05-20 18:38:04 +08:00
parent 615ecc2b5b
commit 7e7dfc556a
23 changed files with 2402 additions and 327 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询【请填写功能名称】列表
export function listUltimate(query) {
return request({
url: '/data/compute/price/office/list',
method: 'get',
params: query
})
}
// 查询【请填写功能名称】详细
export function getUltimate(id) {
return request({
url: '/data/compute/price/office/' + id,
method: 'get'
})
}
// // 新增【请填写功能名称】
// export function addUltimate(data) {
// return request({
// url: '/data/compute/price/office',
// method: 'post',
// data: data
// })
// }
// 修改【请填写功能名称】
export function updateUltimate(data) {
return request({
url: '/data/compute/price/office',
method: 'put',
data: data
})
}
// // 删除【请填写功能名称】
// export function delUltimate(id) {
// return request({
// url: '/data/compute/price/office/' + id,
// method: 'delete'
// })
// }
// 导出【请填写功能名称】
export function exportUltimate(query) {
return request({
url: '/data/compute/price/office/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,61 @@
<template>
<el-form ref="basicInfoForm" :model="info" :rules="rules" label-width="150px">
<el-row>
<el-col :span="12">
<el-form-item label="表名称" prop="tableName">
<el-input placeholder="请输入仓库名称" v-model="info.tableName" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="表描述" prop="tableComment">
<el-input placeholder="请输入" v-model="info.tableComment" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实体类名称" prop="className">
<el-input placeholder="请输入" v-model="info.className" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="作者" prop="functionAuthor">
<el-input placeholder="请输入" v-model="info.functionAuthor" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input type="textarea" :rows="3" v-model="info.remark"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: "BasicInfoForm",
props: {
info: {
type: Object,
default: null
}
},
data() {
return {
rules: {
tableName: [
{ required: true, message: "请输入表名称", trigger: "blur" }
],
tableComment: [
{ required: true, message: "请输入表描述", trigger: "blur" }
],
className: [
{ required: true, message: "请输入实体类名称", trigger: "blur" }
],
functionAuthor: [
{ required: true, message: "请输入作者", trigger: "blur" }
]
}
};
}
};
</script>

View File

@ -0,0 +1,217 @@
<template>
<el-card>
<el-tabs v-model="activeName">
<el-tab-pane label="基本信息" name="basic">
<basic-info-form ref="basicInfo" :info="info" />
</el-tab-pane>
<el-tab-pane label="字段信息" name="cloum">
<el-table ref="dragTable" :data="cloumns" row-key="columnId" :max-height="tableHeight">
<el-table-column label="序号" type="index" min-width="5%" class-name="allowDrag" />
<el-table-column
label="字段列名"
prop="columnName"
min-width="10%"
:show-overflow-tooltip="true"
/>
<el-table-column label="字段描述" min-width="10%">
<template slot-scope="scope">
<el-input v-model="scope.row.columnComment"></el-input>
</template>
</el-table-column>
<el-table-column
label="物理类型"
prop="columnType"
min-width="10%"
:show-overflow-tooltip="true"
/>
<el-table-column label="Java类型" min-width="11%">
<template slot-scope="scope">
<el-select v-model="scope.row.javaType">
<el-option label="Long" value="Long" />
<el-option label="String" value="String" />
<el-option label="Integer" value="Integer" />
<el-option label="Double" value="Double" />
<el-option label="BigDecimal" value="BigDecimal" />
<el-option label="Date" value="Date" />
</el-select>
</template>
</el-table-column>
<el-table-column label="java属性" min-width="10%">
<template slot-scope="scope">
<el-input v-model="scope.row.javaField"></el-input>
</template>
</el-table-column>
<el-table-column label="插入" min-width="5%">
<template slot-scope="scope">
<el-checkbox true-label="1" v-model="scope.row.isInsert"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="编辑" min-width="5%">
<template slot-scope="scope">
<el-checkbox true-label="1" v-model="scope.row.isEdit"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="列表" min-width="5%">
<template slot-scope="scope">
<el-checkbox true-label="1" v-model="scope.row.isList"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="查询" min-width="5%">
<template slot-scope="scope">
<el-checkbox true-label="1" v-model="scope.row.isQuery"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="查询方式" min-width="10%">
<template slot-scope="scope">
<el-select v-model="scope.row.queryType">
<el-option label="=" value="EQ" />
<el-option label="!=" value="NE" />
<el-option label=">" value="GT" />
<el-option label=">=" value="GTE" />
<el-option label="<" value="LT" />
<el-option label="<=" value="LTE" />
<el-option label="LIKE" value="LIKE" />
<el-option label="BETWEEN" value="BETWEEN" />
</el-select>
</template>
</el-table-column>
<el-table-column label="必填" min-width="5%">
<template slot-scope="scope">
<el-checkbox true-label="1" v-model="scope.row.isRequired"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="显示类型" min-width="12%">
<template slot-scope="scope">
<el-select v-model="scope.row.htmlType">
<el-option label="文本框" value="input" />
<el-option label="文本域" value="textarea" />
<el-option label="下拉框" value="select" />
<el-option label="单选框" value="radio" />
<el-option label="复选框" value="checkbox" />
<el-option label="日期控件" value="datetime" />
</el-select>
</template>
</el-table-column>
<el-table-column label="字典类型" min-width="12%">
<template slot-scope="scope">
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
<el-option
v-for="dict in dictOptions"
:key="dict.dictType"
:label="dict.dictName"
:value="dict.dictType">
<span style="float: left">{{ dict.dictName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ dict.dictType }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="生成信息" name="genInfo">
<gen-info-form ref="genInfo" :info="info" />
</el-tab-pane>
</el-tabs>
<el-form label-width="100px">
<el-form-item style="text-align: center;margin-left:-100px;margin-top:10px;">
<el-button type="primary" @click="submitForm()">提交</el-button>
<el-button @click="close()">返回</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import { getGenTable, updateGenTable } from "@/api/tool/gen";
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
import basicInfoForm from "./basicInfoForm";
import genInfoForm from "./genInfoForm";
import Sortable from 'sortablejs'
export default {
name: "GenEdit",
components: {
basicInfoForm,
genInfoForm
},
data() {
return {
// name
activeName: "cloum",
//
tableHeight: document.documentElement.scrollHeight - 245 + "px",
//
cloumns: [],
//
dictOptions: [],
//
info: {}
};
},
beforeCreate() {
const { tableId } = this.$route.query;
if (tableId) {
//
getGenTable(tableId).then(res => {
this.cloumns = res.data.rows;
this.info = res.data.info;
});
/** 查询字典下拉列表 */
getDictOptionselect().then(response => {
this.dictOptions = response.data;
});
}
},
methods: {
/** 提交按钮 */
submitForm() {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
const genForm = this.$refs.genInfo.$refs.genInfoForm;
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
const validateResult = res.every(item => !!item);
if (validateResult) {
const genTable = Object.assign({}, basicForm.model, genForm.model);
genTable.columns = this.cloumns;
genTable.params = {
treeCode: genTable.treeCode,
treeName: genTable.treeName,
treeParentCode: genTable.treeParentCode
};
updateGenTable(genTable).then(res => {
this.msgSuccess(res.msg);
if (res.code === 200) {
this.close();
}
});
} else {
this.msgError("表单校验未通过,请重新检查提交内容");
}
});
},
getFormPromise(form) {
return new Promise(resolve => {
form.validate(res => {
resolve(res);
});
});
},
/** 关闭按钮 */
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/tool/gen", query: { t: Date.now()}})
}
},
mounted() {
const el = this.$refs.dragTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0];
const sortable = Sortable.create(el, {
handle: ".allowDrag",
onEnd: evt => {
const targetRow = this.cloumns.splice(evt.oldIndex, 1)[0];
this.cloumns.splice(evt.newIndex, 0, targetRow);
for (let index in this.cloumns) {
this.cloumns[index].sort = parseInt(index) + 1;
}
}
});
}
};
</script>

View File

@ -0,0 +1,154 @@
<template>
<el-form ref="genInfoForm" :model="info" :rules="rules" label-width="150px">
<el-row>
<el-col :span="12">
<el-form-item prop="tplCategory">
<span slot="label">生成模板</span>
<el-select v-model="info.tplCategory">
<el-option label="单表(增删改查)" value="crud" />
<el-option label="树表(增删改查)" value="tree"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="packageName">
<span slot="label">
生成包路径
<el-tooltip content="生成在哪个java包下例如 com.ruoyi.system" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>
<el-input v-model="info.packageName" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="moduleName">
<span slot="label">
生成模块名
<el-tooltip content="可理解为子系统名,例如 system" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>
<el-input v-model="info.moduleName" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="businessName">
<span slot="label">
生成业务名
<el-tooltip content="可理解为功能英文名,例如 user" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>
<el-input v-model="info.businessName" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="functionName">
<span slot="label">
生成功能名
<el-tooltip content="用作类描述,例如 用户" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>
<el-input v-model="info.functionName" />
</el-form-item>
</el-col>
</el-row>
<el-row v-show="info.tplCategory == 'tree'">
<h4 class="form-header">其他信息</h4>
<el-col :span="12">
<el-form-item>
<span slot="label">
树编码字段
<el-tooltip content="树显示的编码字段名, 如dept_id" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>
<el-select v-model="info.treeCode" placeholder="请选择">
<el-option
v-for="column in info.columns"
:key="column.columnName"
:label="column.columnName + '' + column.columnComment"
:value="column.columnName"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<span slot="label">
树父编码字段
<el-tooltip content="树显示的父编码字段名, 如parent_Id" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>
<el-select v-model="info.treeParentCode" placeholder="请选择">
<el-option
v-for="column in info.columns"
:key="column.columnName"
:label="column.columnName + '' + column.columnComment"
:value="column.columnName"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<span slot="label">
树名称字段
<el-tooltip content="树节点的显示名称字段名, 如dept_name" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
</span>
<el-select v-model="info.treeName" placeholder="请选择">
<el-option
v-for="column in info.columns"
:key="column.columnName"
:label="column.columnName + '' + column.columnComment"
:value="column.columnName"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: "BasicInfoForm",
props: {
info: {
type: Object,
default: null
}
},
data() {
return {
rules: {
tplCategory: [
{ required: true, message: "请选择生成模板", trigger: "blur" }
],
packageName: [
{ required: true, message: "请输入生成包路径", trigger: "blur" }
],
moduleName: [
{ required: true, message: "请输入生成模块名", trigger: "blur" }
],
businessName: [
{ required: true, message: "请输入生成业务名", trigger: "blur" }
],
functionName: [
{ required: true, message: "请输入生成功能名", trigger: "blur" }
]
}
};
},
created() {}
};
</script>

View File

@ -0,0 +1,117 @@
<template>
<!-- 导入表 -->
<el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="表名称" prop="tableName">
<el-input
v-model="queryParams.tableName"
placeholder="请输入表名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="表描述" prop="tableComment">
<el-input
v-model="queryParams.tableComment"
placeholder="请输入表描述"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row>
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="tableName" label="表名称"></el-table-column>
<el-table-column prop="tableComment" label="表描述"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column prop="updateTime" label="更新时间"></el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleImportTable"> </el-button>
<el-button @click="visible = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listDbTable, importTable } from "@/api/tool/gen";
export default {
data() {
return {
//
visible: false,
//
tables: [],
//
total: 0,
//
dbTableList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
tableName: undefined,
tableComment: undefined
}
};
},
methods: {
//
show() {
this.getList();
this.visible = true;
},
clickRow(row) {
this.$refs.table.toggleRowSelection(row);
},
//
handleSelectionChange(selection) {
this.tables = selection.map(item => item.tableName);
},
//
getList() {
listDbTable(this.queryParams).then(res => {
if (res.code === 200) {
this.dbTableList = res.rows;
this.total = res.total;
}
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 导入按钮操作 */
handleImportTable() {
importTable({ tables: this.tables.join(",") }).then(res => {
this.msgSuccess(res.msg);
if (res.code === 200) {
this.visible = false;
this.$emit("ok");
}
});
}
}
};
</script>

View File

@ -0,0 +1,291 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
<el-form-item label="表名称" prop="tableName">
<el-input
v-model="queryParams.tableName"
placeholder="请输入表名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="表描述" prop="tableComment">
<el-input
v-model="queryParams.tableComment"
placeholder="请输入表描述"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
size="small"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-download"
size="mini"
@click="handleGenTable"
v-hasPermi="['tool:gen:code']"
>生成</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload"
size="mini"
@click="openImportTable"
v-hasPermi="['tool:gen:import']"
>导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleEditTable"
v-hasPermi="['tool:gen:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['tool:gen:remove']"
>删除</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="序号" type="index" width="50" align="center">
<template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column
label="表名称"
align="center"
prop="tableName"
:show-overflow-tooltip="true"
width="130"
/>
<el-table-column
label="表描述"
align="center"
prop="tableComment"
:show-overflow-tooltip="true"
width="130"
/>
<el-table-column
label="实体"
align="center"
prop="className"
:show-overflow-tooltip="true"
width="130"
/>
<el-table-column label="创建时间" align="center" prop="createTime" width="160" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
type="text"
size="small"
icon="el-icon-view"
@click="handlePreview(scope.row)"
v-hasPermi="['tool:gen:preview']"
>预览</el-button>
<el-button
type="text"
size="small"
icon="el-icon-edit"
@click="handleEditTable(scope.row)"
v-hasPermi="['tool:gen:edit']"
>编辑</el-button>
<el-button
type="text"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['tool:gen:remove']"
>删除</el-button>
<el-button
type="text"
size="small"
icon="el-icon-download"
@click="handleGenTable(scope.row)"
v-hasPermi="['tool:gen:code']"
>生成代码</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 预览界面 -->
<el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
<el-tabs v-model="preview.activeName">
<el-tab-pane
v-for="(value, key) in preview.data"
:label="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:key="key"
>
<pre>{{ value }}</pre>
</el-tab-pane>
</el-tabs>
</el-dialog>
<import-table ref="import" @ok="handleQuery" />
</div>
</template>
<script>
import { listTable, previewTable, delTable } from "@/api/tool/gen";
import importTable from "./importTable";
import { downLoadZip } from "@/utils/zipdownload";
export default {
name: "Gen",
components: { importTable },
data() {
return {
//
loading: true,
//
uniqueId: "",
//
ids: [],
//
tableNames: [],
//
single: true,
//
multiple: true,
//
total: 0,
//
tableList: [],
//
dateRange: "",
//
queryParams: {
pageNum: 1,
pageSize: 10,
tableName: undefined,
tableComment: undefined
},
//
preview: {
open: false,
title: "代码预览",
data: {},
activeName: "domain.java"
}
};
},
created() {
this.getList();
},
activated() {
const time = this.$route.query.t;
if (time != null && time != this.uniqueId) {
this.uniqueId = time;
this.resetQuery();
}
},
methods: {
/** 查询表集合 */
getList() {
this.loading = true;
listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.tableList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 生成代码操作 */
handleGenTable(row) {
const tableNames = row.tableName || this.tableNames;
if (tableNames == "") {
this.msgError("请选择要生成的数据");
return;
}
downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
},
/** 打开导入表弹窗 */
openImportTable() {
this.$refs.import.show();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 预览按钮 */
handlePreview(row) {
previewTable(row.tableId).then(response => {
this.preview.data = response.data;
this.preview.open = true;
});
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.tableId);
this.tableNames = selection.map(item => item.tableName);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 修改按钮操作 */
handleEditTable(row) {
const tableId = row.tableId || this.ids[0];
this.$router.push({ path: "/gen/edit", query: { tableId: tableId } });
},
/** 删除按钮操作 */
handleDelete(row) {
const tableIds = row.tableId || this.ids;
this.$confirm('是否确认删除表编号为"' + tableIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delTable(tableIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
}
}
};
</script>

View File

@ -0,0 +1,150 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="案例年月" prop="yearMonth">
<el-input
v-model="queryParams.yearMonth"
placeholder="请输入案例年月"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="案例小区名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入案例小区名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="案例小区地址" prop="address">
<el-input
v-model="queryParams.address"
placeholder="请输入案例小区地址"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)"
style="width: 100%;"
>
<el-table-column label="序号" type="index" align="center">
<template slot-scope="scope">
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="会话编号" align="center" prop="tokenId" :show-overflow-tooltip="true" />
<el-table-column label="登录名称" align="center" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="部门名称" align="center" prop="deptName" />
<el-table-column label="主机" align="center" prop="ipaddr" :show-overflow-tooltip="true" />
<el-table-column label="登录地点" align="center" prop="loginLocation" />
<el-table-column label="浏览器" align="center" prop="browser" />
<el-table-column label="操作系统" align="center" prop="os" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleForceLogout(scope.row)"
v-hasPermi="['monitor:online:forceLogout']"
>强退</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
</div>
</template>
<script>
import { list, forceLogout } from "@/api/monitor/online";
export default {
name: "Online",
data() {
return {
//
loading: true,
//
total: 0,
//
list: [],
pageNum: 1,
pageSize: 10,
//
queryParams: {
yearMonth: undefined,
name: undefined,
address: undefined,
//
saleOrRent: undefined,
countyName: undefined,
ipaddr: undefined,
userName: undefined
}
};
},
created() {
this.getList();
},
methods: {
/** 查询登录日志列表 */
getList() {
this.loading = true;
list(this.queryParams).then(response => {
this.list = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 强退按钮操作 */
handleForceLogout(row) {
this.$confirm(
'是否确认强退名称为"' + row.userName + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(function() {
return forceLogout(row.tokenId);
})
.then(() => {
this.getList();
this.msgSuccess("强退成功");
})
.catch(function() {});
}
}
};
</script>

View File

@ -0,0 +1,405 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="100px">
<el-form-item label="年月" prop="yearMonth" clearable>
<el-date-picker
v-model="queryParams.yearMonth"
format="yyyyMM"
type="month"
placeholder="选择年月"
@keyup.enter.native="handleQuery"
></el-date-picker>
</el-form-item>
<el-form-item label="联城小区ID" prop="communityId" clearable>
<el-input
v-model="queryParams.communityId"
placeholder="请输入案例小区名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="联城楼栋ID" prop="buildingId" clearable>
<el-input
v-model="queryParams.buildingId"
placeholder="请输入联城楼栋ID"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryParams.status" clearable>
<el-option label="正常" value="1"></el-option>
<el-option label="失效" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:ultimate:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:user:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['system:user:import']"
>导入</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="ultimateList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="年月" align="center" prop="yearMonth" />
<el-table-column label="小区ID" align="center" prop="communityId" />
<el-table-column label="楼栋ID" align="center" prop="buildingId" />
<el-table-column label="主力基价" align="center" prop="mainPrice" />
<el-table-column label="主力租金" align="center" prop="mainPriceRent" />
<el-table-column label="主力基价涨跌幅" align="center" prop="mainPricePst" />
<el-table-column label="主力租金涨跌幅" align="center" prop="mainPriceRentPst" />
<el-table-column label="主力基价类型" align="center" prop="mainPriceType" />
<el-table-column label="主力租金类型" align="center" prop="mainPriceRentType" />
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormatter" />
<el-table-column
label="标准楼栋"
align="center"
prop="standardBuilding"
:formatter="yesOrNotFormatter"
/>
<el-table-column label="价格更改说明" align="center" prop="adjustPriceComment" />
<el-table-column label="更新日期" align="center" prop="updateDate" :formatter="dateFormatter" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:user:edit']"
>修改</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:user:remove']"
>删除</el-button>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改办公基价对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="160px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="小区ID">
<el-input v-model="form.communityId" disabled="true" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="楼栋ID">
<el-input v-model="form.buildingId" disabled="true" readonly />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主力基价(元/㎡)">
<el-input v-model="form.mainPrice" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主力租金(元/月·㎡)">
<el-input v-model="form.mainPriceRent" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主力基价涨跌幅">
<el-input v-model="form.mainPricePst" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主力租金涨跌幅">
<el-input v-model="form.mainPriceRentPst" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="主力基价类型">
<el-input v-model="form.mainPriceType" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主力租金类型">
<el-input v-model="form.mainPriceRentType" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div class="el-upload__tip" style="color:red" slot="tip">提示仅允许导入xlsxlsx格式文件</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import {
listUltimate,
getUltimate,
updateUltimate,
exportUltimate
} from "@/api/data/ultimateOfficeBasePrice";
export default {
name: "Ultimate",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
total: 0,
//
ultimateList: [],
//
title: "",
//
open: false,
//
queryParams: {
yearMonth: undefined,
communityId: undefined,
buildingId: undefined,
pageNum: 1,
pageSize: 10
},
statusOptions: [
{ value: 1, text: "正常" },
{ value: 1, text: "失效" }
],
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
headers: { Authorization: "Bearer " + getToken() },
//
url:
process.env.VUE_APP_BASE_API + "/data/compute/price/office/importData"
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
yesOrNotFormatter: function(row, column, cellValue, index) {
if (cellValue) return "是";
return "否";
},
statusFormatter: function(row, column, cellValue, index) {
if (cellValue) return "正常";
return "失效";
},
dateFormatter: function(row, column, cellValue, index) {
if (cellValue) {
return cellValue.substring(0, 10);
}
return "";
},
/** 查询办公基价列表 */
getList() {
this.loading = true;
listUltimate(this.queryParams).then(response => {
this.ultimateList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
// handleAdd() {
// this.reset();
// this.open = true;
// this.title = "";
// },
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getUltimate(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改办公基价";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateUltimate(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
} else {
this.msgError(response.msg);
}
});
} else {
addUltimate(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
} else {
this.msgError(response.msg);
}
});
}
}
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有办公基价数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
return exportUltimate(queryParams);
})
.then(response => {
this.download(response.msg);
})
.catch(function() {});
},
handleImport() {
this.upload.title = "办公基价导入";
this.upload.open = true;
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
}
}
};
</script>

View File

@ -1,6 +1,7 @@
package com.ruoyi;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@ -10,11 +11,10 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class })
public class RuoYiApplication
{
public static void main(String[] args)
{
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class,
PageHelperAutoConfiguration.class})
public class RuoYiApplication {
public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +

View File

@ -7,6 +7,8 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Date;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.poi.ss.usermodel.DateUtil;
@ -17,12 +19,11 @@ import com.ruoyi.common.utils.DateUtils;
/**
* 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数.
*
*
* @author ruoyi
*/
@SuppressWarnings("rawtypes")
public class ReflectUtils
{
public class ReflectUtils {
private static final String SETTER_PREFIX = "set";
private static final String GETTER_PREFIX = "get";
@ -36,13 +37,11 @@ public class ReflectUtils
* 支持多级对象名.对象名.方法
*/
@SuppressWarnings("unchecked")
public static <E> E invokeGetter(Object obj, String propertyName)
{
public static <E> E invokeGetter(Object obj, String propertyName) {
Object object = obj;
for (String name : StringUtils.split(propertyName, "."))
{
for (String name : StringUtils.split(propertyName, ".")) {
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name);
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
object = invokeMethod(object, getterMethodName, new Class[]{}, new Object[]{});
}
return (E) object;
}
@ -51,21 +50,16 @@ public class ReflectUtils
* 调用Setter方法, 仅匹配方法名
* 支持多级对象名.对象名.方法
*/
public static <E> void invokeSetter(Object obj, String propertyName, E value)
{
public static <E> void invokeSetter(Object obj, String propertyName, E value) {
Object object = obj;
String[] names = StringUtils.split(propertyName, ".");
for (int i = 0; i < names.length; i++)
{
if (i < names.length - 1)
{
for (int i = 0; i < names.length; i++) {
if (i < names.length - 1) {
String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]);
object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
}
else
{
object = invokeMethod(object, getterMethodName, new Class[]{}, new Object[]{});
} else {
String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]);
invokeMethodByName(object, setterMethodName, new Object[] { value });
invokeMethodByName(object, setterMethodName, new Object[]{value});
}
}
}
@ -74,21 +68,16 @@ public class ReflectUtils
* 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数.
*/
@SuppressWarnings("unchecked")
public static <E> E getFieldValue(final Object obj, final String fieldName)
{
public static <E> E getFieldValue(final Object obj, final String fieldName) {
Field field = getAccessibleField(obj, fieldName);
if (field == null)
{
if (field == null) {
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
return null;
}
E result = null;
try
{
try {
result = (E) field.get(obj);
}
catch (IllegalAccessException e)
{
} catch (IllegalAccessException e) {
logger.error("不可能抛出的异常{}", e.getMessage());
}
return result;
@ -97,21 +86,16 @@ public class ReflectUtils
/**
* 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数.
*/
public static <E> void setFieldValue(final Object obj, final String fieldName, final E value)
{
public static <E> void setFieldValue(final Object obj, final String fieldName, final E value) {
Field field = getAccessibleField(obj, fieldName);
if (field == null)
{
if (field == null) {
// throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
return;
}
try
{
try {
field.set(obj, value);
}
catch (IllegalAccessException e)
{
} catch (IllegalAccessException e) {
logger.error("不可能抛出的异常: {}", e.getMessage());
}
}
@ -123,24 +107,18 @@ public class ReflectUtils
*/
@SuppressWarnings("unchecked")
public static <E> E invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes,
final Object[] args)
{
if (obj == null || methodName == null)
{
final Object[] args) {
if (obj == null || methodName == null) {
return null;
}
Method method = getAccessibleMethod(obj, methodName, parameterTypes);
if (method == null)
{
if (method == null) {
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
return null;
}
try
{
try {
return (E) method.invoke(obj, args);
}
catch (Exception e)
{
} catch (Exception e) {
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
throw convertReflectionExceptionToUnchecked(msg, e);
}
@ -152,64 +130,51 @@ public class ReflectUtils
* 只匹配函数名如果有多个同名函数调用第一个
*/
@SuppressWarnings("unchecked")
public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args)
{
public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args) {
Method method = getAccessibleMethodByName(obj, methodName, args.length);
if (method == null)
{
if (method == null) {
// 如果为空不报错直接返回空
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
return null;
}
try
{
try {
// 类型转换将参数数据类型转换为目标方法参数类型
Class<?>[] cs = method.getParameterTypes();
for (int i = 0; i < cs.length; i++)
{
if (args[i] != null && !args[i].getClass().equals(cs[i]))
{
if (cs[i] == String.class)
{
for (int i = 0; i < cs.length; i++) {
if (args[i] != null && !args[i].getClass().equals(cs[i])) {
if (cs[i] == String.class) {
args[i] = Convert.toStr(args[i]);
if (StringUtils.endsWith((String) args[i], ".0"))
{
if (StringUtils.endsWith((String) args[i], ".0")) {
args[i] = StringUtils.substringBefore((String) args[i], ".0");
}
}
else if (cs[i] == Integer.class)
{
} else if (cs[i] == Integer.class) {
args[i] = Convert.toInt(args[i]);
}
else if (cs[i] == Long.class)
{
} else if (cs[i] == Long.class) {
args[i] = Convert.toLong(args[i]);
}
else if (cs[i] == Double.class)
{
} else if (cs[i] == Double.class) {
args[i] = Convert.toDouble(args[i]);
}
else if (cs[i] == Float.class)
{
} else if (cs[i] == Float.class) {
args[i] = Convert.toFloat(args[i]);
}
else if (cs[i] == Date.class)
{
if (args[i] instanceof String)
{
} else if (cs[i] == Date.class) {
if (args[i] instanceof String) {
args[i] = DateUtils.parseDate(args[i]);
}
else
{
} else {
args[i] = DateUtil.getJavaDate((Double) args[i]);
}
} else if (cs[i] == Boolean.class) {
if (null != args[i]) {
String cellValue = args[i].toString().toLowerCase();
if ("true".equals(cellValue)) {
args[i] = true;
} else if ("false".equals(cellValue)) {
args[i] = false;
}
}
}
}
}
return (E) method.invoke(obj, args);
}
catch (Exception e)
{
} catch (Exception e) {
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
throw convertReflectionExceptionToUnchecked(msg, e);
}
@ -219,24 +184,19 @@ public class ReflectUtils
* 循环向上转型, 获取对象的DeclaredField, 并强制设置为可访问.
* 如向上转型到Object仍无法找到, 返回null.
*/
public static Field getAccessibleField(final Object obj, final String fieldName)
{
public static Field getAccessibleField(final Object obj, final String fieldName) {
// 为空不报错直接返回 null
if (obj == null)
{
if (obj == null) {
return null;
}
Validate.notBlank(fieldName, "fieldName can't be blank");
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass())
{
try
{
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass =
superClass.getSuperclass()) {
try {
Field field = superClass.getDeclaredField(fieldName);
makeAccessible(field);
return field;
}
catch (NoSuchFieldException e)
{
} catch (NoSuchFieldException e) {
continue;
}
}
@ -250,24 +210,19 @@ public class ReflectUtils
* 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args)
*/
public static Method getAccessibleMethod(final Object obj, final String methodName,
final Class<?>... parameterTypes)
{
final Class<?>... parameterTypes) {
// 为空不报错直接返回 null
if (obj == null)
{
if (obj == null) {
return null;
}
Validate.notBlank(methodName, "methodName can't be blank");
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass())
{
try
{
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType =
searchType.getSuperclass()) {
try {
Method method = searchType.getDeclaredMethod(methodName, parameterTypes);
makeAccessible(method);
return method;
}
catch (NoSuchMethodException e)
{
} catch (NoSuchMethodException e) {
continue;
}
}
@ -280,21 +235,17 @@ public class ReflectUtils
* 只匹配函数名
* 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args)
*/
public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum)
{
public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) {
// 为空不报错直接返回 null
if (obj == null)
{
if (obj == null) {
return null;
}
Validate.notBlank(methodName, "methodName can't be blank");
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass())
{
for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType =
searchType.getSuperclass()) {
Method[] methods = searchType.getDeclaredMethods();
for (Method method : methods)
{
if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum)
{
for (Method method : methods) {
if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) {
makeAccessible(method);
return method;
}
@ -306,11 +257,9 @@ public class ReflectUtils
/**
* 改变private/protected的方法为public尽量不调用实际改动的语句避免JDK的SecurityManager抱怨
*/
public static void makeAccessible(Method method)
{
public static void makeAccessible(Method method) {
if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers()))
&& !method.isAccessible())
{
&& !method.isAccessible()) {
method.setAccessible(true);
}
}
@ -318,11 +267,9 @@ public class ReflectUtils
/**
* 改变private/protected的成员变量为public尽量不调用实际改动的语句避免JDK的SecurityManager抱怨
*/
public static void makeAccessible(Field field)
{
public static void makeAccessible(Field field) {
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible())
{
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
field.setAccessible(true);
}
}
@ -332,8 +279,7 @@ public class ReflectUtils
* 如无法找到, 返回Object.class.
*/
@SuppressWarnings("unchecked")
public static <T> Class<T> getClassGenricType(final Class clazz)
{
public static <T> Class<T> getClassGenricType(final Class clazz) {
return getClassGenricType(clazz, 0);
}
@ -341,26 +287,22 @@ public class ReflectUtils
* 通过反射, 获得Class定义中声明的父类的泛型参数的类型.
* 如无法找到, 返回Object.class.
*/
public static Class getClassGenricType(final Class clazz, final int index)
{
public static Class getClassGenricType(final Class clazz, final int index) {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType))
{
if (!(genType instanceof ParameterizedType)) {
logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
return Object.class;
}
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0)
{
if (index >= params.length || index < 0) {
logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
+ params.length);
return Object.class;
}
if (!(params[index] instanceof Class))
{
if (!(params[index] instanceof Class)) {
logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
return Object.class;
}
@ -368,18 +310,14 @@ public class ReflectUtils
return (Class) params[index];
}
public static Class<?> getUserClass(Object instance)
{
if (instance == null)
{
public static Class<?> getUserClass(Object instance) {
if (instance == null) {
throw new RuntimeException("Instance must not be null");
}
Class clazz = instance.getClass();
if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR))
{
if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) {
Class<?> superClass = clazz.getSuperclass();
if (superClass != null && !Object.class.equals(superClass))
{
if (superClass != null && !Object.class.equals(superClass)) {
return superClass;
}
}
@ -390,15 +328,11 @@ public class ReflectUtils
/**
* 将反射时的checked exception转换为unchecked exception.
*/
public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e)
{
public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) {
if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException
|| e instanceof NoSuchMethodException)
{
|| e instanceof NoSuchMethodException) {
return new IllegalArgumentException(msg, e);
}
else if (e instanceof InvocationTargetException)
{
} else if (e instanceof InvocationTargetException) {
return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException());
}
return new RuntimeException(msg, e);

View File

@ -21,7 +21,6 @@ import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatPropertie
import com.alibaba.druid.util.Utils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.framework.config.properties.DruidProperties;
import com.ruoyi.framework.datasource.DynamicDataSource;
/**

View File

@ -1,77 +1,77 @@
package com.ruoyi.framework.config.properties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import com.alibaba.druid.pool.DruidDataSource;
/**
* druid 配置属性
*
* @author ruoyi
*/
@Configuration
public class DruidProperties
{
@Value("${spring.datasource.druid.initialSize}")
private int initialSize;
@Value("${spring.datasource.druid.minIdle}")
private int minIdle;
@Value("${spring.datasource.druid.maxActive}")
private int maxActive;
@Value("${spring.datasource.druid.maxWait}")
private int maxWait;
@Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}")
private int timeBetweenEvictionRunsMillis;
@Value("${spring.datasource.druid.minEvictableIdleTimeMillis}")
private int minEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}")
private int maxEvictableIdleTimeMillis;
@Value("${spring.datasource.druid.validationQuery}")
private String validationQuery;
@Value("${spring.datasource.druid.testWhileIdle}")
private boolean testWhileIdle;
@Value("${spring.datasource.druid.testOnBorrow}")
private boolean testOnBorrow;
@Value("${spring.datasource.druid.testOnReturn}")
private boolean testOnReturn;
public DruidDataSource dataSource(DruidDataSource datasource)
{
/** 配置初始化大小、最小、最大 */
datasource.setInitialSize(initialSize);
datasource.setMaxActive(maxActive);
datasource.setMinIdle(minIdle);
/** 配置获取连接等待超时的时间 */
datasource.setMaxWait(maxWait);
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
/**
* 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'如果validationQuery为nulltestOnBorrowtestOnReturntestWhileIdle都不会起作用
*/
datasource.setValidationQuery(validationQuery);
/** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
datasource.setTestWhileIdle(testWhileIdle);
/** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnBorrow(testOnBorrow);
/** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
datasource.setTestOnReturn(testOnReturn);
return datasource;
}
}
//package com.ruoyi.framework.config.properties;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import com.alibaba.druid.pool.DruidDataSource;
//
///**
// * druid 配置属性
// *
// * @author ruoyi
// */
//@Configuration
//public class DruidProperties
//{
// @Value("${spring.datasource.druid.initialSize}")
// private int initialSize;
//
// @Value("${spring.datasource.druid.minIdle}")
// private int minIdle;
//
// @Value("${spring.datasource.druid.maxActive}")
// private int maxActive;
//
// @Value("${spring.datasource.druid.maxWait}")
// private int maxWait;
//
// @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}")
// private int timeBetweenEvictionRunsMillis;
//
// @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}")
// private int minEvictableIdleTimeMillis;
//
// @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}")
// private int maxEvictableIdleTimeMillis;
//
// @Value("${spring.datasource.druid.validationQuery}")
// private String validationQuery;
//
// @Value("${spring.datasource.druid.testWhileIdle}")
// private boolean testWhileIdle;
//
// @Value("${spring.datasource.druid.testOnBorrow}")
// private boolean testOnBorrow;
//
// @Value("${spring.datasource.druid.testOnReturn}")
// private boolean testOnReturn;
//
// public DruidDataSource dataSource(DruidDataSource datasource)
// {
// /** 配置初始化大小、最小、最大 */
// datasource.setInitialSize(initialSize);
// datasource.setMaxActive(maxActive);
// datasource.setMinIdle(minIdle);
//
// /** 配置获取连接等待超时的时间 */
// datasource.setMaxWait(maxWait);
//
// /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
// datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
//
// /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
// datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
// datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
//
// /**
// * 用来检测连接是否有效的sql要求是一个查询语句常用select 'x'如果validationQuery为nulltestOnBorrowtestOnReturntestWhileIdle都不会起作用
// */
// datasource.setValidationQuery(validationQuery);
// /** 建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。 */
// datasource.setTestWhileIdle(testWhileIdle);
// /** 申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
// datasource.setTestOnBorrow(testOnBorrow);
// /** 归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。 */
// datasource.setTestOnReturn(testOnReturn);
// return datasource;
// }
//}

View File

@ -0,0 +1,76 @@
//package com.ruoyi.framework.datasource;
//
//
//import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
//import com.baomidou.dynamic.datasource.provider.YmlDynamicDataSourceProvider;
//import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
//import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.druid.DruidDynamicDataSourceConfiguration;
//import com.github.pagehelper.PageInterceptor;
//import org.apache.ibatis.plugin.Interceptor;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.autoconfigure.AutoConfigureAfter;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.annotation.PostConstruct;
//import javax.sql.DataSource;
//import java.util.List;
//import java.util.Properties;
//
//@Configuration
//@ConditionalOnBean(SqlSessionFactory.class)
////@AutoConfigureAfter(MybatisAutoConfiguration.class)
//@AutoConfigureAfter(DynamicDataSourceAutoConfiguration.class)
//public class DynamicDataSourcePagerDialectConfig {
// @Autowired
// private List<SqlSessionFactory> sqlSessionFactoryList;
//// @Autowired
//// private DynamicDataSourceProvider dynamicDataSourceProvider;
//
// @PostConstruct
// public void addPageInterceptor() {
//
// sqlSessionFactoryList.forEach(x->{
// System.out.println("");
// });
//
//// dynamicDataSourceProvider.loadDataSources().forEach((k, v) -> {
//// PageInterceptor interceptor = new PageInterceptor();
//// Properties properties = new Properties();
////
//// });
//
// //先把一般方式配置的属性放进去
//// properties.putAll(pageHelperProperties());
// //在把特殊配置放进去由于close-conn 利用上面方式时属性名就是 close-conn 而不是 closeConn所以需要额外的一步
//// properties.putAll(this.properties.getProperties());
//// interceptor.setProperties(properties);
//// for (SqlSessionFactory sqlSessionFactory : sqlSessionFactoryList) {
//// sqlSessionFactory.getConfiguration().addInterceptor(interceptor);
//// }
// }
//
//// @Bean(name = "mssqlSessionFactory")
//// public SqlSessionFactory mssqlSessionFactory(@Qualifier("mssqlDataSource") DataSource dataSource)
//// throws Exception {
//// final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
//// //分页插件
//// Interceptor interceptor = new PageInterceptor();
//// Properties properties = new Properties();
//// //数据库
//// properties.setProperty("helperDialect", "sqlserver2012");
//// //是否分页合理化
//// properties.setProperty("reasonable", "false");
////
//// interceptor.setProperties(properties);
////
//// sessionFactory.setPlugins(new Interceptor[] {interceptor});
//// sessionFactory.setDataSource(dataSource);
//// return sessionFactory.getObject();
//// }
//}

View File

@ -1,86 +1,88 @@
package com.ruoyi.framework.web.controller;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
/**
* web层通用数据处理
*
* @author ruoyi
*/
public class BaseController
{
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
/**
* 将前台传递过来的日期格式的字符串自动转化为Date类型
*/
@InitBinder
public void initBinder(WebDataBinder binder)
{
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
{
@Override
public void setAsText(String text)
{
setValue(DateUtils.parseDate(text));
}
});
}
/**
* 设置请求分页数据
*/
protected void startPage()
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy);
}
}
/**
* 响应请求分页数据
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list)
{
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
}
package com.ruoyi.framework.web.controller;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
/**
* web层通用数据处理
*
* @author ruoyi
*/
public class BaseController {
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
/**
* 将前台传递过来的日期格式的字符串自动转化为Date类型
*/
@InitBinder
public void initBinder(WebDataBinder binder) {
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
setValue(DateUtils.parseDate(text));
}
});
}
/**
* 设置请求分页数据
*/
protected void startPage() {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.startPage(pageNum, pageSize, orderBy);
}
}
/**
* 响应请求分页数据
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfo getDataTable(List<?> list) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
protected TableDataInfo getDataTable(List<?> list, int total) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(list);
rspData.setTotal(total);
return rspData;
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows) {
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.project.data.cases.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/data/cases")
public class CasesController {
/**
* 原始办公挂牌案例
*/
public void originalOfficeOpeningCase() {
}
/**
* 原始住宅销售挂牌案例
*/
public void originalResidenceSalesOpeningCase(){
}
/**
* 原始住宅销售挂牌案例
*/
public void originalResidenceSalesClosingCase(){
}
}

View File

@ -0,0 +1,115 @@
package com.ruoyi.project.data.price.compute.controller;
import java.util.List;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.security.service.TokenService;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
import com.ruoyi.project.data.price.compute.service.IOfficeBasePriceUltimateService;
import com.ruoyi.project.system.domain.SysUser;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 请填写功能名称Controller
*
* @author ruoyi
* @date 2020-05-20
*/
@RestController
@RequestMapping("/data/compute/price/office")
public class OfficeBasePriceUltimateController extends BaseController {
@Autowired
private IOfficeBasePriceUltimateService officeBasePriceUltimateService;
@Autowired
private TokenService tokenService;
/**
* 查询请填写功能名称列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(OfficeBasePriceUltimate officeBasePriceUltimate) {
int pageIndex = ServletUtils.getParameterToInt(TableSupport.PAGE_NUM);
int pageSize = ServletUtils.getParameterToInt(TableSupport.PAGE_SIZE);
officeBasePriceUltimate.setPageIndex(pageIndex <= 1 ? 0 : (pageIndex - 1) * pageSize);
officeBasePriceUltimate.setPageSize(pageSize);
List<OfficeBasePriceUltimate> list =
officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
return getDataTable(list, total);
}
/**
* 获取请填写功能名称详细信息
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(officeBasePriceUltimateService.selectOfficeBasePriceUltimateById(id));
}
/**
* 修改请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "办公基价", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OfficeBasePriceUltimate officeBasePriceUltimate) {
return toAjax(officeBasePriceUltimateService.updateOfficeBasePriceUltimate(officeBasePriceUltimate));
}
/**
* 导出请填写功能名称列表
*/
@PreAuthorize("@ss.hasPermi('system:user:export')")
@Log(title = "办公基价", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(OfficeBasePriceUltimate officeBasePriceUltimate) {
int total = officeBasePriceUltimateService.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
officeBasePriceUltimate.setPageIndex(0);
officeBasePriceUltimate.setPageSize(total);
List<OfficeBasePriceUltimate> list =
officeBasePriceUltimateService.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
ExcelUtil<OfficeBasePriceUltimate> util = new ExcelUtil<OfficeBasePriceUltimate>(OfficeBasePriceUltimate.class);
return util.exportExcel(list, "办公基价");
}
/**
* 办公基价导入
* @param file
* @return
* @throws Exception
*/
@Log(title = "办公基价", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file) throws Exception {
ExcelUtil<OfficeBasePriceUltimate> util = new ExcelUtil<>(OfficeBasePriceUltimate.class);
List<OfficeBasePriceUltimate> officeBasePriceUltimates = util.importExcel(file.getInputStream());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUsername();
String message = officeBasePriceUltimateService.batchImport(officeBasePriceUltimates, operName);
return AjaxResult.success(message);
}
}

View File

@ -0,0 +1,178 @@
package com.ruoyi.project.data.price.compute.domain;
import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Date;
/**
* 请填写功能名称对象 office_base_price_ultimate
*
* @author ruoyi
* @date 2020-05-20
*/
public class OfficeBasePriceUltimate extends BaseEntity {
private Integer pageIndex;
private Integer pageSize;
@Excel(name = "ID")
private String id;
@JSONField(serialize = false)
private Integer yearMonth;
@Excel(name = "楼栋ID")
private String buildingId;
@Excel(name = "小区ID")
private String communityId;
@Excel(name = "主力基价")
private String mainPrice;
@Excel(name = "主力租金")
private String mainPriceRent;
@Excel(name = "主力基价涨跌幅")
private String mainPricePst;
@Excel(name = "主力租金涨跌幅")
private String mainPriceRentPst;
@Excel(name = "主力基价类型")
private String mainPriceType;
@Excel(name = "主力租金类型")
private String mainPriceRentType;
@Excel(name = "更新日期")
private Date updateDate;
@Excel(name = "状态")
private Boolean status;
@Excel(name = "是否标准楼栋")
private Boolean isStandardBuilding;
@Excel(name = "更改价格说明")
private String adjustPriceComment;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getYearMonth() {
return yearMonth;
}
public void setYearMonth(Integer yearMonth) {
this.yearMonth = yearMonth;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public String getMainPrice() {
return mainPrice;
}
public void setMainPrice(String mainPrice) {
this.mainPrice = mainPrice;
}
public String getMainPriceRent() {
return mainPriceRent;
}
public void setMainPriceRent(String mainPriceRent) {
this.mainPriceRent = mainPriceRent;
}
public String getMainPricePst() {
return mainPricePst;
}
public void setMainPricePst(String mainPricePst) {
this.mainPricePst = mainPricePst;
}
public String getMainPriceRentPst() {
return mainPriceRentPst;
}
public void setMainPriceRentPst(String mainPriceRentPst) {
this.mainPriceRentPst = mainPriceRentPst;
}
public String getMainPriceType() {
return mainPriceType;
}
public void setMainPriceType(String mainPriceType) {
this.mainPriceType = mainPriceType;
}
public String getMainPriceRentType() {
return mainPriceRentType;
}
public void setMainPriceRentType(String mainPriceRentType) {
this.mainPriceRentType = mainPriceRentType;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public Boolean getStandardBuilding() {
return isStandardBuilding;
}
public void setStandardBuilding(Boolean standardBuilding) {
isStandardBuilding = standardBuilding;
}
public String getAdjustPriceComment() {
return adjustPriceComment;
}
public void setAdjustPriceComment(String adjustPriceComment) {
this.adjustPriceComment = adjustPriceComment;
}
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

View File

@ -0,0 +1,46 @@
package com.ruoyi.project.data.price.compute.mapper;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
/**
* 请填写功能名称Mapper接口
*
* @author ruoyi
* @date 2020-05-20
*/
@DS("teemlink")
public interface OfficeBasePriceUltimateMapper
{
/**
*
* @param id
* @return
*/
OfficeBasePriceUltimate selectOfficeBasePriceUltimateById(String id);
/**
* 查询请填写功能名称列表
*
* @param officeBasePriceUltimate 请填写功能名称
* @return 请填写功能名称集合
*/
List<OfficeBasePriceUltimate> selectOfficeBasePriceUltimateList(OfficeBasePriceUltimate officeBasePriceUltimate);
/**
* 求和
* @param officeBasePriceUltimate
* @return
*/
Integer selectOfficeBasePriceUltimateListCount(OfficeBasePriceUltimate officeBasePriceUltimate);
/**
* 更新
* @param officeBasePriceUltimate
* @return
*/
int updateOfficeBasePriceUltimate(OfficeBasePriceUltimate officeBasePriceUltimate);
}

View File

@ -0,0 +1,41 @@
package com.ruoyi.project.data.price.compute.service;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
import com.ruoyi.project.system.domain.SysUser;
import java.util.List;
/**
* 请填写功能名称Service接口
*
* @author ruoyi
* @date 2020-05-20
*/
public interface IOfficeBasePriceUltimateService {
/**
* 查询请填写功能名称列表
*
* @param officeBasePriceUltimate 请填写功能名称
* @return 请填写功能名称集合
*/
List<OfficeBasePriceUltimate> selectOfficeBasePriceUltimateList(OfficeBasePriceUltimate officeBasePriceUltimate);
int selectOfficeBasePriceUltimateListCount(OfficeBasePriceUltimate officeBasePriceUltimate);
OfficeBasePriceUltimate selectOfficeBasePriceUltimateById(String id);
int updateOfficeBasePriceUltimate(OfficeBasePriceUltimate officeBasePriceUltimate);
/**
*
* @param officeBasePriceUltimates
* @param operName
* @return
*/
String batchImport(List<OfficeBasePriceUltimate> officeBasePriceUltimates,String operName);
}

View File

@ -0,0 +1,104 @@
package com.ruoyi.project.data.price.compute.service.impl;
import java.util.List;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate;
import com.ruoyi.project.data.price.compute.mapper.OfficeBasePriceUltimateMapper;
import com.ruoyi.project.data.price.compute.service.IOfficeBasePriceUltimateService;
import com.ruoyi.project.system.service.impl.SysUserServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 请填写功能名称Service业务层处理
*
* @author ruoyi
* @date 2020-05-20
*/
@Service
public class OfficeBasePriceUltimateServiceImpl implements IOfficeBasePriceUltimateService {
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
@Autowired
private OfficeBasePriceUltimateMapper officeBasePriceUltimateMapper;
/**
* 查询请填写功能名称列表
*
* @param officeBasePriceUltimate 请填写功能名称
* @return 请填写功能名称
*/
@Override
public List<OfficeBasePriceUltimate> selectOfficeBasePriceUltimateList(OfficeBasePriceUltimate officeBasePriceUltimate) {
return officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateList(officeBasePriceUltimate);
}
@Override
public int selectOfficeBasePriceUltimateListCount(OfficeBasePriceUltimate officeBasePriceUltimate) {
return officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateListCount(officeBasePriceUltimate);
}
@Override
public OfficeBasePriceUltimate selectOfficeBasePriceUltimateById(String id) {
return officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateById(id);
}
@Override
public int updateOfficeBasePriceUltimate(OfficeBasePriceUltimate officeBasePriceUltimate) {
return officeBasePriceUltimateMapper.updateOfficeBasePriceUltimate(officeBasePriceUltimate);
}
@Override
public String batchImport(List<OfficeBasePriceUltimate> officeBasePriceUltimates, String operName) {
if (StringUtils.isNull(officeBasePriceUltimates) || officeBasePriceUltimates.size() == 0)
{
throw new CustomException("导入办公数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (OfficeBasePriceUltimate officeBasePriceUltimate : officeBasePriceUltimates)
{
try
{
// 验证是否存在这个用户
OfficeBasePriceUltimate officeBasePriceUltimateInDb = officeBasePriceUltimateMapper.selectOfficeBasePriceUltimateById(officeBasePriceUltimate.getId());
if (StringUtils.isNotNull(officeBasePriceUltimateInDb))
{
this.updateOfficeBasePriceUltimate(officeBasePriceUltimate);
successNum++;
successMsg.append("<br/>" + successNum + "、ID= " + officeBasePriceUltimate.getId() + " 更新成功");
}
else
{
failureNum++;
failureMsg.append("<br/>" + failureNum + "、ID= " + officeBasePriceUltimate.getId() + " 已存在");
}
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、ID= " + officeBasePriceUltimate.getId() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new CustomException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
}

View File

@ -0,0 +1,4 @@
package com.ruoyi.project.data.price.release.controller;
public class HomeController {
}

View File

@ -27,7 +27,7 @@ spring:
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
validationQuery: SELECT 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
@ -43,7 +43,7 @@ spring:
wall:
config:
multi-statement-allow: true
primary: master
datasource:
# 主库数据源
master:
@ -52,12 +52,12 @@ spring:
username: root
password: LOLm2dI2UQF#RxOf
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# slave:
# # 从数据源开关/默认关闭
# enabled: false
# url:
# username:
# password:
teemlink:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://172.16.30.233:1433;DatabaseName=obpm_LianCheng_Data

View File

@ -0,0 +1,96 @@
<?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.ruoyi.project.data.price.compute.mapper.OfficeBasePriceUltimateMapper">
<resultMap type="com.ruoyi.project.data.price.compute.domain.OfficeBasePriceUltimate"
id="OfficeBasePriceUltimateResult">
<result property="id" column="id"/>
<result property="yearMonth" column="ITEM_YEARMONTH"/>
<result property="buildingId" column="ITEM_BUILDINGID_P"/>
<result property="communityId" column="ITEM_PROJECTID_P"/>
<result property="mainPrice" column="ITEM_MAINPRICE"/>
<result property="mainPriceRent" column="ITEM_MAINPRICERENT"/>
<result property="mainPricePst" column="ITEM_MAINPRICEPST"/>
<result property="mainPriceRentPst" column="ITEM_MAINPRICERENTPST"/>
<result property="mainPriceType" column="ITEM_MAINPRICETYPE"/>
<result property="mainPriceRentType" column="ITEM_MAINPRICERENTTYPE"/>
<result property="updateDate" column="ITEM_MODIFYDATE"/>
<result property="status" column="ITEM_STATUS"/>
<result property="isStandardBuilding" column="ITEM_BUILDINGSTD"/>
<result property="adjustPriceComment" column="ITEM_ADJEVD"/>
</resultMap>
<sql id="selectOfficeBasePriceUltimateVo">
select ITEM_YEARMONTH,ITEM_BUILDINGID,ITEM_UNIFIEDID,ITEM_PROJECTID,ITEM_BUILDINGID_P,ITEM_PROJECTID_P,ITEM_MAINPRICE,ITEM_MAINPRICERENT,ITEM_MAINPRICEPST,ITEM_MAINPRICERENTPST,ITEM_MAINPRICETYPE,ITEM_MAINPRICERENTTYPE,ITEM_MODIFYDATE,ITEM_STATUS,ITEM_BUILDINGSTD,ITEM_ADJEVD,ID from TLK_计价办公核准基价
</sql>
<select id="selectOfficeBasePriceUltimateListCount" parameterType="OfficeBasePriceUltimate" resultType="int">
select count(1) from TLK_计价办公核准基价
<where>
<if test="yearMonth != null">
AND ITEM_YEARMONTH = #{yearMonth}
</if>
<if test="communityId != null">
AND ITEM_PROJECTID_P = #{communityId}
</if>
<if test="buildingId != null">
AND ITEM_BUILDINGID_P = #{buildingId}
</if>
<if test="status != null">
AND ITEM_STATUS = #{status}
</if>
</where>
</select>
<select id="selectOfficeBasePriceUltimateList" parameterType="OfficeBasePriceUltimate"
resultMap="OfficeBasePriceUltimateResult">
<include refid="selectOfficeBasePriceUltimateVo"/>
<where>
<if test="yearMonth != null">
AND ITEM_YEARMONTH = #{yearMonth}
</if>
<if test="communityId != null">
AND ITEM_PROJECTID_P = #{communityId}
</if>
<if test="buildingId != null">
AND ITEM_BUILDINGID_P = #{buildingId}
</if>
</where>
order by ITEM_YEARMONTH DESC,ID DESC OFFSET #{pageIndex} rows fetch next #{pageSize} rows only;
</select>
<select id="selectOfficeBasePriceUltimateById" parameterType="String" resultMap="OfficeBasePriceUltimateResult">
<include refid="selectOfficeBasePriceUltimateVo"/>
where id = #{id}
</select>
<!-- <insert id="insertOfficeBasePriceUltimate" parameterType="OfficeBasePriceUltimate" useGeneratedKeys="true"-->
<!-- keyProperty="id">-->
<!-- insert into office_base_price_ultimate-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- </trim>-->
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!-- </trim>-->
<!-- </insert>-->
<update id="updateOfficeBasePriceUltimate" parameterType="OfficeBasePriceUltimate">
update TLK_计价办公核准基价 set ITEM_YEARMONTH=ITEM_YEARMONTH
<trim prefix="SET" suffixOverrides=",">
</trim>
where id = #{id}
</update>
<!-- <delete id="deleteOfficeBasePriceUltimateById" parameterType="Integer">-->
<!-- delete from office_base_price_ultimate where id = #{id}-->
<!-- </delete>-->
<!-- <delete id="deleteOfficeBasePriceUltimateByIds" parameterType="String">-->
<!-- delete from office_base_price_ultimate where id in-->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </delete>-->
</mapper>