Commit 2b581175a21d0f04ea4b92855a95d8e26d202405
1 parent
ddf73a78
合同管理功能-初版
Showing
17 changed files
with
2009 additions
and
3 deletions
trash-common/src/main/java/com/trash/common/utils/file/FileUploadUtils.java
| ... | ... | @@ -225,4 +225,15 @@ public class FileUploadUtils { |
| 225 | 225 | } |
| 226 | 226 | return extension; |
| 227 | 227 | } |
| 228 | + | |
| 229 | + /** | |
| 230 | + * 文件删除 | |
| 231 | + * @param filePath | |
| 232 | + */ | |
| 233 | + public static void deleteFile(String filePath) { | |
| 234 | + File file = new File(defaultBaseDir+filePath); | |
| 235 | + if (file.exists()) { | |
| 236 | + file.delete(); | |
| 237 | + } | |
| 238 | + } | |
| 228 | 239 | } | ... | ... |
trash-ui/src/api/office/management.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 查询合同管理列表 | |
| 4 | +export function listManagement(query) { | |
| 5 | + return request({ | |
| 6 | + url: '/office/management/list', | |
| 7 | + method: 'get', | |
| 8 | + params: query | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 查询合同管理详细 | |
| 13 | +export function getManagement(id) { | |
| 14 | + return request({ | |
| 15 | + url: '/office/management/' + id, | |
| 16 | + method: 'get' | |
| 17 | + }) | |
| 18 | +} | |
| 19 | + | |
| 20 | +// 新增合同管理 | |
| 21 | +export function addManagement(data) { | |
| 22 | + return request({ | |
| 23 | + url: '/office/management', | |
| 24 | + method: 'post', | |
| 25 | + data: data | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 修改合同管理 | |
| 30 | +export function updateManagement(data) { | |
| 31 | + return request({ | |
| 32 | + url: '/office/management', | |
| 33 | + method: 'put', | |
| 34 | + data: data | |
| 35 | + }) | |
| 36 | +} | |
| 37 | + | |
| 38 | +// 删除合同管理 | |
| 39 | +export function delManagement(id) { | |
| 40 | + return request({ | |
| 41 | + url: '/office/management/' + id, | |
| 42 | + method: 'delete' | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 导出合同管理 | |
| 47 | +export function exportManagement(query) { | |
| 48 | + return request({ | |
| 49 | + url: '/office/management/export', | |
| 50 | + method: 'get', | |
| 51 | + params: query | |
| 52 | + }) | |
| 53 | +} | |
| 0 | 54 | \ No newline at end of file | ... | ... |
trash-ui/src/components/FileUpload/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="upload-file"> | |
| 3 | + <el-upload | |
| 4 | + :action="uploadFileUrl" | |
| 5 | + :before-upload="handleBeforeUpload" | |
| 6 | + :file-list="fileList" | |
| 7 | + :limit="1" | |
| 8 | + :on-error="handleUploadError" | |
| 9 | + :on-exceed="handleExceed" | |
| 10 | + :on-success="handleUploadSuccess" | |
| 11 | + :show-file-list="false" | |
| 12 | + :headers="headers" | |
| 13 | + class="upload-file-uploader" | |
| 14 | + ref="upload" | |
| 15 | + > | |
| 16 | + <!-- 上传按钮 --> | |
| 17 | + <el-button size="mini" type="primary">选取文件</el-button> | |
| 18 | + <!-- 上传提示 --> | |
| 19 | + <div class="el-upload__tip" slot="tip" v-if="showTip"> | |
| 20 | + 请上传 | |
| 21 | + <template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template> | |
| 22 | + <template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template> | |
| 23 | + 的文件 | |
| 24 | + </div> | |
| 25 | + </el-upload> | |
| 26 | + | |
| 27 | + <!-- 文件列表 --> | |
| 28 | + <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul"> | |
| 29 | + <li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list"> | |
| 30 | + <el-link :href="file.url" :underline="false" target="_blank"> | |
| 31 | + <span class="el-icon-document"> {{ getFileName(file.name) }} </span> | |
| 32 | + </el-link> | |
| 33 | + <div class="ele-upload-list__item-content-action"> | |
| 34 | + <el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link> | |
| 35 | + </div> | |
| 36 | + </li> | |
| 37 | + </transition-group> | |
| 38 | + </div> | |
| 39 | +</template> | |
| 40 | + | |
| 41 | +<script> | |
| 42 | +import { getToken } from "@/utils/auth"; | |
| 43 | + | |
| 44 | +export default { | |
| 45 | + props: { | |
| 46 | + // 值 | |
| 47 | + value: [String, Object, Array], | |
| 48 | + // 大小限制(MB) | |
| 49 | + fileSize: { | |
| 50 | + type: Number, | |
| 51 | + default: 15, | |
| 52 | + }, | |
| 53 | + // 文件类型, 例如['png', 'jpg', 'jpeg'] | |
| 54 | + fileType: { | |
| 55 | + type: Array, | |
| 56 | + default: () => ["doc", "xls", "ppt", "txt", "pdf"], | |
| 57 | + }, | |
| 58 | + // 是否显示提示 | |
| 59 | + isShowTip: { | |
| 60 | + type: Boolean, | |
| 61 | + default: true | |
| 62 | + } | |
| 63 | + }, | |
| 64 | + data() { | |
| 65 | + return { | |
| 66 | + uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址 | |
| 67 | + headers: { | |
| 68 | + Authorization2: "Bearer " + getToken(), | |
| 69 | + }, | |
| 70 | + fileList: [], | |
| 71 | + }; | |
| 72 | + }, | |
| 73 | + computed: { | |
| 74 | + // 是否显示提示 | |
| 75 | + showTip() { | |
| 76 | + return this.isShowTip && (this.fileType || this.fileSize); | |
| 77 | + }, | |
| 78 | + // 列表 | |
| 79 | + list() { | |
| 80 | + let temp = 1; | |
| 81 | + if (this.value) { | |
| 82 | + // 首先将值转为数组 | |
| 83 | + const list = Array.isArray(this.value) ? this.value : [this.value]; | |
| 84 | + // 然后将数组转为对象数组 | |
| 85 | + return list.map((item) => { | |
| 86 | + if (typeof item === "string") { | |
| 87 | + item = { name: item, url: item }; | |
| 88 | + } | |
| 89 | + item.uid = item.uid || new Date().getTime() + temp++; | |
| 90 | + return item; | |
| 91 | + }); | |
| 92 | + } else { | |
| 93 | + this.fileList = []; | |
| 94 | + return []; | |
| 95 | + } | |
| 96 | + }, | |
| 97 | + }, | |
| 98 | + methods: { | |
| 99 | + // 上传前校检格式和大小 | |
| 100 | + handleBeforeUpload(file) { | |
| 101 | + // 校检文件类型 | |
| 102 | + if (this.fileType) { | |
| 103 | + let fileExtension = ""; | |
| 104 | + if (file.name.lastIndexOf(".") > -1) { | |
| 105 | + fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); | |
| 106 | + } | |
| 107 | + const isTypeOk = this.fileType.some((type) => { | |
| 108 | + if (file.type.indexOf(type) > -1) return true; | |
| 109 | + if (fileExtension && fileExtension.indexOf(type) > -1) return true; | |
| 110 | + return false; | |
| 111 | + }); | |
| 112 | + if (!isTypeOk) { | |
| 113 | + this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`); | |
| 114 | + return false; | |
| 115 | + } | |
| 116 | + } | |
| 117 | + // 校检文件大小 | |
| 118 | + if (this.fileSize) { | |
| 119 | + const isLt = file.size / 1024 / 1024 < this.fileSize; | |
| 120 | + if (!isLt) { | |
| 121 | + this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`); | |
| 122 | + return false; | |
| 123 | + } | |
| 124 | + } | |
| 125 | + return true; | |
| 126 | + }, | |
| 127 | + // 文件个数超出 | |
| 128 | + handleExceed() { | |
| 129 | + this.$message.error(`只允许上传单个文件`); | |
| 130 | + }, | |
| 131 | + // 上传失败 | |
| 132 | + handleUploadError(err) { | |
| 133 | + this.$message.error("上传失败, 请重试"); | |
| 134 | + }, | |
| 135 | + // 上传成功回调 | |
| 136 | + handleUploadSuccess(res, file) { | |
| 137 | + this.$message.success("上传成功"); | |
| 138 | + this.$emit("input", res.url); | |
| 139 | + }, | |
| 140 | + // 删除文件 | |
| 141 | + handleDelete(index) { | |
| 142 | + this.fileList.splice(index, 1); | |
| 143 | + this.$emit("input", ''); | |
| 144 | + }, | |
| 145 | + // 获取文件名称 | |
| 146 | + getFileName(name) { | |
| 147 | + if (name.lastIndexOf("/") > -1) { | |
| 148 | + return name.slice(name.lastIndexOf("/") + 1).toLowerCase(); | |
| 149 | + } else { | |
| 150 | + return ""; | |
| 151 | + } | |
| 152 | + } | |
| 153 | + }, | |
| 154 | + created() { | |
| 155 | + this.fileList = this.list; | |
| 156 | + }, | |
| 157 | +}; | |
| 158 | +</script> | |
| 159 | + | |
| 160 | +<style scoped lang="scss"> | |
| 161 | +.upload-file-uploader { | |
| 162 | + margin-bottom: 5px; | |
| 163 | +} | |
| 164 | +.upload-file-list .el-upload-list__item { | |
| 165 | + border: 1px solid #e4e7ed; | |
| 166 | + line-height: 2; | |
| 167 | + margin-bottom: 10px; | |
| 168 | + position: relative; | |
| 169 | +} | |
| 170 | +.upload-file-list .ele-upload-list__item-content { | |
| 171 | + display: flex; | |
| 172 | + justify-content: space-between; | |
| 173 | + align-items: center; | |
| 174 | + color: inherit; | |
| 175 | +} | |
| 176 | +.ele-upload-list__item-content-action .el-link { | |
| 177 | + margin-right: 10px; | |
| 178 | +} | |
| 179 | +</style> | ... | ... |
trash-ui/src/permission.js
| ... | ... | @@ -15,7 +15,6 @@ const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] |
| 15 | 15 | |
| 16 | 16 | router.beforeEach((to, from, next) => { |
| 17 | 17 | NProgress.start() |
| 18 | - debugger; | |
| 19 | 18 | var token = getToken(); |
| 20 | 19 | if(!token){ |
| 21 | 20 | if( to.query.token ){ |
| ... | ... | @@ -82,8 +81,8 @@ router.beforeEach((to, from, next) => { |
| 82 | 81 | removeToken(); |
| 83 | 82 | next({path:to }) |
| 84 | 83 | }else{ |
| 85 | - | |
| 86 | - | |
| 84 | + | |
| 85 | + | |
| 87 | 86 | store.dispatch('FedLogOut').then(() => { |
| 88 | 87 | Message.error(err) |
| 89 | 88 | removeToken(); | ... | ... |
trash-ui/src/views/office/management/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="105px"> | |
| 4 | + <el-form-item label="合同编号" prop="contractNumber"> | |
| 5 | + <el-input | |
| 6 | + v-model="queryParams.contractNumber" | |
| 7 | + placeholder="请输入合同编号" | |
| 8 | + clearable | |
| 9 | + size="small" | |
| 10 | + @keyup.enter.native="handleQuery" | |
| 11 | + /> | |
| 12 | + </el-form-item> | |
| 13 | + <el-form-item label="合同名称" prop="contractName"> | |
| 14 | + <el-input | |
| 15 | + v-model="queryParams.contractName" | |
| 16 | + placeholder="请输入合同名称" | |
| 17 | + clearable | |
| 18 | + size="small" | |
| 19 | + @keyup.enter.native="handleQuery" | |
| 20 | + /> | |
| 21 | + </el-form-item> | |
| 22 | + <el-form-item label="甲方" prop="firstParty"> | |
| 23 | + <el-input | |
| 24 | + v-model="queryParams.firstParty" | |
| 25 | + placeholder="请输入甲方" | |
| 26 | + clearable | |
| 27 | + size="small" | |
| 28 | + @keyup.enter.native="handleQuery" | |
| 29 | + /> | |
| 30 | + </el-form-item> | |
| 31 | + <el-form-item label="乙方" prop="secondParty"> | |
| 32 | + <el-input | |
| 33 | + v-model="queryParams.secondParty" | |
| 34 | + placeholder="请输入乙方" | |
| 35 | + clearable | |
| 36 | + size="small" | |
| 37 | + @keyup.enter.native="handleQuery" | |
| 38 | + /> | |
| 39 | + </el-form-item> | |
| 40 | + <el-form-item label="合同开始时间" prop="contractBeginDate"> | |
| 41 | + <el-date-picker clearable size="small" style="width: 200px" | |
| 42 | + v-model="queryParams.contractBeginDate" | |
| 43 | + type="date" | |
| 44 | + value-format="yyyy-MM-dd" | |
| 45 | + placeholder="选择合同开始时间"> | |
| 46 | + </el-date-picker> | |
| 47 | + </el-form-item> | |
| 48 | + <el-form-item label="合同结束时间" prop="contractEndDate"> | |
| 49 | + <el-date-picker clearable size="small" style="width: 200px" | |
| 50 | + v-model="queryParams.contractEndDate" | |
| 51 | + type="date" | |
| 52 | + value-format="yyyy-MM-dd" | |
| 53 | + placeholder="选择合同结束时间"> | |
| 54 | + </el-date-picker> | |
| 55 | + </el-form-item> | |
| 56 | + <el-form-item label="合同状态" prop="contractState"> | |
| 57 | + <el-input | |
| 58 | + v-model="queryParams.contractState" | |
| 59 | + placeholder="请输入合同状态" | |
| 60 | + clearable | |
| 61 | + size="small" | |
| 62 | + @keyup.enter.native="handleQuery" | |
| 63 | + /> | |
| 64 | + </el-form-item> | |
| 65 | + <el-form-item label="责任科室" prop="deptname"> | |
| 66 | + <el-input | |
| 67 | + v-model="queryParams.deptname" | |
| 68 | + placeholder="请输入责任科室" | |
| 69 | + clearable | |
| 70 | + size="small" | |
| 71 | + @keyup.enter.native="handleQuery" | |
| 72 | + /> | |
| 73 | + </el-form-item> | |
| 74 | + <el-form-item> | |
| 75 | + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | |
| 76 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | |
| 77 | + </el-form-item> | |
| 78 | + </el-form> | |
| 79 | + | |
| 80 | + <el-row :gutter="10" class="mb8"> | |
| 81 | + <el-col :span="1.5"> | |
| 82 | + <el-button | |
| 83 | + type="primary" | |
| 84 | + icon="el-icon-plus" | |
| 85 | + size="mini" | |
| 86 | + @click="handleAdd" | |
| 87 | + v-hasPermi="['office:management:add']" | |
| 88 | + >新增 | |
| 89 | + </el-button> | |
| 90 | + </el-col> | |
| 91 | + <el-col :span="1.5"> | |
| 92 | + <el-button | |
| 93 | + type="success" | |
| 94 | + icon="el-icon-edit" | |
| 95 | + size="mini" | |
| 96 | + :disabled="single" | |
| 97 | + @click="handleUpdate" | |
| 98 | + v-hasPermi="['office:management:edit']" | |
| 99 | + >修改 | |
| 100 | + </el-button> | |
| 101 | + </el-col> | |
| 102 | + <el-col :span="1.5"> | |
| 103 | + <el-button | |
| 104 | + type="danger" | |
| 105 | + icon="el-icon-delete" | |
| 106 | + size="mini" | |
| 107 | + :disabled="multiple" | |
| 108 | + @click="handleDelete" | |
| 109 | + v-hasPermi="['office:management:remove']" | |
| 110 | + >删除 | |
| 111 | + </el-button> | |
| 112 | + </el-col> | |
| 113 | + <el-col :span="1.5"> | |
| 114 | + <el-button | |
| 115 | + type="warning" | |
| 116 | + icon="el-icon-download" | |
| 117 | + size="mini" | |
| 118 | + @click="handleExport" | |
| 119 | + v-hasPermi="['office:management:export']" | |
| 120 | + >导出 | |
| 121 | + </el-button> | |
| 122 | + </el-col> | |
| 123 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 124 | + </el-row> | |
| 125 | + | |
| 126 | + <el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange"> | |
| 127 | + <el-table-column type="selection" width="55" align="center"/> | |
| 128 | + <el-table-column label="合同编号" align="center" prop="contractNumber"/> | |
| 129 | + <el-table-column label="合同名称" align="center" prop="contractName"/> | |
| 130 | + <el-table-column label="甲方" align="center" prop="firstParty"/> | |
| 131 | + <el-table-column label="乙方" align="center" prop="secondParty"/> | |
| 132 | + <el-table-column label="合同开始时间" align="center" prop="contractBeginDate" width="180"> | |
| 133 | + <template slot-scope="scope"> | |
| 134 | + <span>{{ parseTime(scope.row.contractBeginDate, '{y}-{m}-{d}') }}</span> | |
| 135 | + </template> | |
| 136 | + </el-table-column> | |
| 137 | + <el-table-column label="合同结束时间" align="center" prop="contractEndDate" width="180"> | |
| 138 | + <template slot-scope="scope"> | |
| 139 | + <span>{{ parseTime(scope.row.contractEndDate, '{y}-{m}-{d}') }}</span> | |
| 140 | + </template> | |
| 141 | + </el-table-column> | |
| 142 | + <el-table-column label="合同金额" align="center" prop="contractMoney"/> | |
| 143 | + <el-table-column label="合同状态" align="center" prop="contractState"/> | |
| 144 | + <el-table-column label="责任科室" align="center" prop="deptname"/> | |
| 145 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 146 | + <template slot-scope="scope"> | |
| 147 | + <el-button | |
| 148 | + size="mini" | |
| 149 | + type="text" | |
| 150 | + icon="el-icon-edit" | |
| 151 | + @click="handleUpdate(scope.row)" | |
| 152 | + v-hasPermi="['office:management:edit']" | |
| 153 | + >修改 | |
| 154 | + </el-button> | |
| 155 | + <el-button | |
| 156 | + size="mini" | |
| 157 | + type="text" | |
| 158 | + icon="el-icon-delete" | |
| 159 | + @click="handleDelete(scope.row)" | |
| 160 | + v-hasPermi="['office:management:remove']" | |
| 161 | + >删除 | |
| 162 | + </el-button> | |
| 163 | + </template> | |
| 164 | + </el-table-column> | |
| 165 | + </el-table> | |
| 166 | + | |
| 167 | + <pagination | |
| 168 | + v-show="total>0" | |
| 169 | + :total="total" | |
| 170 | + :page.sync="queryParams.pageNum" | |
| 171 | + :limit.sync="queryParams.pageSize" | |
| 172 | + @pagination="getList" | |
| 173 | + /> | |
| 174 | + | |
| 175 | + <!-- 添加或修改合同管理对话框 --> | |
| 176 | + <el-dialog :title="title" :visible.sync="open" width="850px" append-to-body> | |
| 177 | + <el-form ref="form" :model="form" :rules="rules" label-width="105px"> | |
| 178 | + <el-row :gutter="2"> | |
| 179 | + <el-col :span="11"> | |
| 180 | + <el-form-item label="合同编号" prop="contractNumber"> | |
| 181 | + <el-input v-model="form.contractNumber" placeholder="请输入合同编号"/> | |
| 182 | + </el-form-item> | |
| 183 | + </el-col> | |
| 184 | + <el-col :span="11"> | |
| 185 | + <el-form-item label="合同名称" prop="contractName"> | |
| 186 | + <el-input v-model="form.contractName" placeholder="请输入合同名称"/> | |
| 187 | + </el-form-item> | |
| 188 | + </el-col> | |
| 189 | + </el-row> | |
| 190 | + <el-row :gutter="2"> | |
| 191 | + <el-col :span="11"> | |
| 192 | + <el-form-item label="甲方" prop="firstParty"> | |
| 193 | + <el-input v-model="form.firstParty" placeholder="请输入甲方"/> | |
| 194 | + </el-form-item> | |
| 195 | + </el-col> | |
| 196 | + <el-col :span="11"> | |
| 197 | + <el-form-item label="乙方" prop="secondParty"> | |
| 198 | + <el-input v-model="form.secondParty" placeholder="请输入乙方"/> | |
| 199 | + </el-form-item> | |
| 200 | + </el-col> | |
| 201 | + </el-row> | |
| 202 | + <el-row :gutter="2"> | |
| 203 | + <el-col :span="11"> | |
| 204 | + <el-form-item label="开始时间" prop="contractBeginDate"> | |
| 205 | + <el-date-picker clearable size="small" style="width: 100%;" | |
| 206 | + v-model="form.contractBeginDate" | |
| 207 | + type="date" | |
| 208 | + value-format="yyyy-MM-dd" | |
| 209 | + placeholder="选择合同开始时间"> | |
| 210 | + </el-date-picker> | |
| 211 | + </el-form-item> | |
| 212 | + </el-col> | |
| 213 | + <el-col :span="11"> | |
| 214 | + <el-form-item label="结束时间" prop="contractEndDate"> | |
| 215 | + <el-date-picker clearable size="small" style="width: 100%;" | |
| 216 | + v-model="form.contractEndDate" | |
| 217 | + type="date" | |
| 218 | + value-format="yyyy-MM-dd" | |
| 219 | + placeholder="选择合同结束时间"> | |
| 220 | + </el-date-picker> | |
| 221 | + </el-form-item> | |
| 222 | + </el-col> | |
| 223 | + </el-row> | |
| 224 | + <el-row :gutter="2"> | |
| 225 | + <el-col :span="11"> | |
| 226 | + <el-form-item label="合同金额" prop="contractMoney"> | |
| 227 | + <el-input v-model="form.contractMoney" | |
| 228 | + @input="form.contractMoney=form.contractMoney.replace(/[^0-9.]/g,'').replace(/^\./g, '').replace('.', 'dollar#dollar').replace(/\./g, '').replace('dollar#dollar', '.');" | |
| 229 | + placeholder="请输入合同金额"/> | |
| 230 | + </el-form-item> | |
| 231 | + </el-col> | |
| 232 | + <el-col :span="11"> | |
| 233 | + <el-form-item label="合同状态" prop="contractState"> | |
| 234 | + <el-select v-model="form.contractState" placeholder="请选择状态" style="width: 100%;"> | |
| 235 | + <el-option label="正常" value="正常"/> | |
| 236 | + <el-option label="到期" value="到期"/> | |
| 237 | + <el-option label="终止" value="终止"/> | |
| 238 | + </el-select> | |
| 239 | + </el-form-item> | |
| 240 | + </el-col> | |
| 241 | + </el-row> | |
| 242 | + <el-row :gutter="2"> | |
| 243 | + <el-col :span="11"> | |
| 244 | + <el-form-item label="责任科室" prop="deptname"> | |
| 245 | + <el-select v-model="form.deptname" placeholder="请选择责任科室" style="width: 100%;"> | |
| 246 | + <el-option label="科室1" value="科室1"/> | |
| 247 | + <el-option label="科室2" value="科室2"/> | |
| 248 | + <el-option label="科室3" value="科室3"/> | |
| 249 | + </el-select> | |
| 250 | + </el-form-item> | |
| 251 | + </el-col> | |
| 252 | + <el-col :span="11"> | |
| 253 | + <el-form-item prop="fileEntityList" label="附件"> | |
| 254 | + <el-upload | |
| 255 | + ref="upload" | |
| 256 | + action="" | |
| 257 | + accept=".docx,.xlsx,.ppt,.txt,.pdf,.png" | |
| 258 | + :on-change="fileChange" | |
| 259 | + :auto-upload="false" | |
| 260 | + :show-file-list="false" | |
| 261 | + multiple | |
| 262 | + :file-list="fileEntityList"> | |
| 263 | + <el-button size="small" type="primary" icon="el-icon-upload">上传附件</el-button> | |
| 264 | + </el-upload> | |
| 265 | + </el-form-item> | |
| 266 | + </el-col> | |
| 267 | + </el-row> | |
| 268 | + <el-row> | |
| 269 | + <el-table :data="fileEntityList"> | |
| 270 | + <el-table-column property="name" label="附件名称" header-align="center" align="center"></el-table-column> | |
| 271 | + <el-table-column label="操作" class-name="small-padding fixed-width" header-align="center" align="center"> | |
| 272 | + <template slot-scope="scope"> | |
| 273 | + <el-button | |
| 274 | + size="small" type="success" | |
| 275 | + icon="el-icon-download" | |
| 276 | + @click="downloadFA(scope.row)" | |
| 277 | + v-hasPermi="['office:management:edit']" | |
| 278 | + v-if="form.id!=null" | |
| 279 | + round>下载 | |
| 280 | + </el-button> | |
| 281 | + <el-button | |
| 282 | + size="small" type="danger" | |
| 283 | + icon="el-icon-delete" | |
| 284 | + @click="handleDeleteFile(scope.$index)" | |
| 285 | + v-hasPermi="['office:management:remove']" | |
| 286 | + round>删除 | |
| 287 | + </el-button> | |
| 288 | + </template> | |
| 289 | + </el-table-column> | |
| 290 | + </el-table> | |
| 291 | + </el-row> | |
| 292 | + </el-form> | |
| 293 | + <div slot="footer" class="dialog-footer"> | |
| 294 | + <el-button type="primary" @click="submitForm">确 定</el-button> | |
| 295 | + <el-button @click="cancel">取 消</el-button> | |
| 296 | + </div> | |
| 297 | + </el-dialog> | |
| 298 | + </div> | |
| 299 | +</template> | |
| 300 | + | |
| 301 | +<script> | |
| 302 | +import { | |
| 303 | + listManagement, | |
| 304 | + getManagement, | |
| 305 | + delManagement, | |
| 306 | + addManagement, | |
| 307 | + updateManagement, | |
| 308 | + exportManagement | |
| 309 | +} from "@/api/office/management"; | |
| 310 | +import FileUpload from '@/components/FileUpload'; | |
| 311 | + | |
| 312 | +export default { | |
| 313 | + name: "Management", | |
| 314 | + comments: { | |
| 315 | + FileUpload | |
| 316 | + }, | |
| 317 | + data() { | |
| 318 | + return { | |
| 319 | + // 遮罩层 | |
| 320 | + loading: true, | |
| 321 | + // 选中数组 | |
| 322 | + ids: [], | |
| 323 | + // 非单个禁用 | |
| 324 | + single: true, | |
| 325 | + // 非多个禁用 | |
| 326 | + multiple: true, | |
| 327 | + // 显示搜索条件 | |
| 328 | + showSearch: true, | |
| 329 | + // 总条数 | |
| 330 | + total: 0, | |
| 331 | + // 合同管理表格数据 | |
| 332 | + managementList: [], | |
| 333 | + // 弹出层标题 | |
| 334 | + title: "", | |
| 335 | + // 是否显示弹出层 | |
| 336 | + open: false, | |
| 337 | + // 查询参数 | |
| 338 | + queryParams: { | |
| 339 | + pageNum: 1, | |
| 340 | + pageSize: 10, | |
| 341 | + contractNumber: null, | |
| 342 | + contractName: null, | |
| 343 | + firstParty: null, | |
| 344 | + secondParty: null, | |
| 345 | + contractBeginDate: null, | |
| 346 | + contractEndDate: null, | |
| 347 | + contractMoney: null, | |
| 348 | + contractState: null, | |
| 349 | + deptid: null, | |
| 350 | + deptname: null, | |
| 351 | + attachments: null | |
| 352 | + }, | |
| 353 | + // 表单参数 | |
| 354 | + form: {}, | |
| 355 | + // 表单校验 | |
| 356 | + rules: { | |
| 357 | + contractNumber: [ | |
| 358 | + {required: true, message: "请输入合同编号", trigger: "blur"} | |
| 359 | + ], | |
| 360 | + contractName: [ | |
| 361 | + {required: true, message: "请输入合同名称", trigger: "blur"} | |
| 362 | + ], | |
| 363 | + firstParty: [ | |
| 364 | + {required: true, message: "请输入甲方", trigger: "blur"} | |
| 365 | + ], | |
| 366 | + secondParty: [ | |
| 367 | + {required: true, message: "请输入乙方", trigger: "blur"} | |
| 368 | + ], | |
| 369 | + contractBeginDate: [ | |
| 370 | + {required: true, message: "请选择合同开始时间", trigger: "blur"} | |
| 371 | + ], | |
| 372 | + contractEndDate: [ | |
| 373 | + {required: true, message: "请选择合同结束时间", trigger: "blur"} | |
| 374 | + ], | |
| 375 | + contractMoney: [ | |
| 376 | + {required: true, message: "请输入合同金额", trigger: "blur"} | |
| 377 | + ], | |
| 378 | + contractState: [ | |
| 379 | + {required: true, message: "请输入合同状态", trigger: "blur"} | |
| 380 | + ], | |
| 381 | + deptname: [ | |
| 382 | + {required: true, message: "请输入责任科室", trigger: "blur"} | |
| 383 | + ], | |
| 384 | + }, | |
| 385 | + fileEntityList: [] | |
| 386 | + }; | |
| 387 | + }, | |
| 388 | + created() { | |
| 389 | + this.getList(); | |
| 390 | + }, | |
| 391 | + methods: { | |
| 392 | + /** 查询合同管理列表 */ | |
| 393 | + getList() { | |
| 394 | + this.loading = true; | |
| 395 | + listManagement(this.queryParams).then(response => { | |
| 396 | + this.managementList = response.rows; | |
| 397 | + this.total = response.total; | |
| 398 | + this.loading = false; | |
| 399 | + }); | |
| 400 | + }, | |
| 401 | + // 取消按钮 | |
| 402 | + cancel() { | |
| 403 | + this.open = false; | |
| 404 | + this.reset(); | |
| 405 | + }, | |
| 406 | + // 表单重置 | |
| 407 | + reset() { | |
| 408 | + this.form = { | |
| 409 | + id: null, | |
| 410 | + contractNumber: null, | |
| 411 | + contractName: null, | |
| 412 | + firstParty: null, | |
| 413 | + secondParty: null, | |
| 414 | + contractBeginDate: null, | |
| 415 | + contractEndDate: null, | |
| 416 | + contractMoney: null, | |
| 417 | + contractState: null, | |
| 418 | + deptid: null, | |
| 419 | + deptname: null, | |
| 420 | + attachments: null | |
| 421 | + }; | |
| 422 | + this.fileEntityList = []; | |
| 423 | + this.resetForm("form"); | |
| 424 | + }, | |
| 425 | + /** 搜索按钮操作 */ | |
| 426 | + handleQuery() { | |
| 427 | + this.queryParams.pageNum = 1; | |
| 428 | + this.getList(); | |
| 429 | + }, | |
| 430 | + /** 重置按钮操作 */ | |
| 431 | + resetQuery() { | |
| 432 | + this.resetForm("queryForm"); | |
| 433 | + this.handleQuery(); | |
| 434 | + }, | |
| 435 | + // 多选框选中数据 | |
| 436 | + handleSelectionChange(selection) { | |
| 437 | + this.ids = selection.map(item => item.id) | |
| 438 | + this.single = selection.length !== 1 | |
| 439 | + this.multiple = !selection.length | |
| 440 | + }, | |
| 441 | + /** 新增按钮操作 */ | |
| 442 | + handleAdd() { | |
| 443 | + this.reset(); | |
| 444 | + this.open = true; | |
| 445 | + this.title = "添加合同管理"; | |
| 446 | + }, | |
| 447 | + /** 修改按钮操作 */ | |
| 448 | + handleUpdate(row) { | |
| 449 | + this.reset(); | |
| 450 | + const id = row.id || this.ids | |
| 451 | + getManagement(id).then(response => { | |
| 452 | + this.form = response.data.contractManagement; | |
| 453 | + let files = JSON.stringify(response.data.uploadFiles); | |
| 454 | + this.fileEntityList = JSON.parse(files.replaceAll("filePath", "url").replaceAll("fileName", "name")) | |
| 455 | + this.open = true; | |
| 456 | + this.title = "修改合同管理"; | |
| 457 | + }); | |
| 458 | + }, | |
| 459 | + /** 提交按钮 */ | |
| 460 | + submitForm() { | |
| 461 | + this.$refs["form"].validate(valid => { | |
| 462 | + if (valid) { | |
| 463 | + let formData = new FormData(); | |
| 464 | + let form = this.form; | |
| 465 | + delete form.params; | |
| 466 | + formData.append('fileList', null); | |
| 467 | + this.fileEntityList.forEach(item => { | |
| 468 | + if(item.id==null){ | |
| 469 | + formData.append('fileList', item.raw) | |
| 470 | + } | |
| 471 | + }) | |
| 472 | + if (form.id != null) { | |
| 473 | + formData.append("contractManagement", JSON.stringify(form)); | |
| 474 | + formData.append("uploadFilesList", null); | |
| 475 | + this.fileEntityList.forEach(item => { | |
| 476 | + //去掉params属性 | |
| 477 | + delete item.params; | |
| 478 | + if(item != "null" && item != null){ | |
| 479 | + formData.append('uploadFilesList', JSON.stringify(item).replaceAll("url", "filePath").replaceAll("name", "fileName")); | |
| 480 | + } | |
| 481 | + }) | |
| 482 | + | |
| 483 | + updateManagement(formData).then(response => { | |
| 484 | + this.msgSuccess("修改成功"); | |
| 485 | + this.open = false; | |
| 486 | + this.fileEntityList = []; | |
| 487 | + this.getList(); | |
| 488 | + }); | |
| 489 | + } else { | |
| 490 | + for (let key in form) { | |
| 491 | + formData.append(key, form[key] == null ? "" : form[key]) | |
| 492 | + } | |
| 493 | + addManagement(formData).then(response => { | |
| 494 | + this.msgSuccess("新增成功"); | |
| 495 | + this.open = false; | |
| 496 | + this.fileEntityList = []; | |
| 497 | + this.getList(); | |
| 498 | + }); | |
| 499 | + } | |
| 500 | + } | |
| 501 | + }); | |
| 502 | + }, | |
| 503 | + /** 删除按钮操作 */ | |
| 504 | + handleDelete(row) { | |
| 505 | + const ids = row.id || this.ids; | |
| 506 | + this.$confirm('是否确认删除合同管理编号为"' + ids + '"的数据项?', "警告", { | |
| 507 | + confirmButtonText: "确定", | |
| 508 | + cancelButtonText: "取消", | |
| 509 | + type: "warning" | |
| 510 | + }).then(function () { | |
| 511 | + return delManagement(ids); | |
| 512 | + }).then(() => { | |
| 513 | + this.getList(); | |
| 514 | + this.msgSuccess("删除成功"); | |
| 515 | + }) | |
| 516 | + }, | |
| 517 | + /** 导出按钮操作 */ | |
| 518 | + handleExport() { | |
| 519 | + const queryParams = this.queryParams; | |
| 520 | + this.$confirm('是否确认导出所有合同管理数据项?', "警告", { | |
| 521 | + confirmButtonText: "确定", | |
| 522 | + cancelButtonText: "取消", | |
| 523 | + type: "warning" | |
| 524 | + }).then(function () { | |
| 525 | + return exportManagement(queryParams); | |
| 526 | + }).then(response => { | |
| 527 | + this.download(response.msg); | |
| 528 | + }) | |
| 529 | + }, | |
| 530 | + /** | |
| 531 | + * 文件改变时,限制文件上传格式和大小 | |
| 532 | + * 文件格式只能为doc/xls/ppt/txt/pdf | |
| 533 | + * 大小不超过5M | |
| 534 | + * */ | |
| 535 | + fileChange(file, fileList) { | |
| 536 | + let count = 0; | |
| 537 | + for (let i = 0; i < fileList.length; i++) { | |
| 538 | + // console.log(fileList.length) | |
| 539 | + // console.log(this.fileEntityList[i].name+"111"+file.name) | |
| 540 | + if (fileList[i].name == file.name) { | |
| 541 | + count++; | |
| 542 | + if (count == 2) { | |
| 543 | + this.$message({ | |
| 544 | + message: '已存在此文件!', | |
| 545 | + type: 'warning' | |
| 546 | + }); | |
| 547 | + for (let j = fileList.length; j > 0; j--) { | |
| 548 | + //如果存在此文件,去除新选择的重复文件 | |
| 549 | + if (fileList[j - 1].name == file.name) { | |
| 550 | + fileList.splice(j - 1, 1); | |
| 551 | + i--; | |
| 552 | + return false; | |
| 553 | + } | |
| 554 | + } | |
| 555 | + } | |
| 556 | + } | |
| 557 | + } | |
| 558 | + let fileType = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase(); | |
| 559 | + //格式符合后判断大小 | |
| 560 | + if ("docx,xlsx,ppt,txt,pdf,png".indexOf(fileType) != -1) { | |
| 561 | + let max5M = file.size / 1024 / 1024 < 5; | |
| 562 | + if (!max5M) { | |
| 563 | + this.$message({ | |
| 564 | + message: '上传文件大小不得超过5M!', | |
| 565 | + type: 'warning' | |
| 566 | + }); | |
| 567 | + } else { | |
| 568 | + //符合条件后进行添加 | |
| 569 | + this.fileEntityList = fileList | |
| 570 | + } | |
| 571 | + } else { | |
| 572 | + this.$message({ | |
| 573 | + message: '上传文件只能是 doc、docx、xls、xlsx、ppt、txt、pdf、png格式!', | |
| 574 | + type: 'warning' | |
| 575 | + }); | |
| 576 | + } | |
| 577 | + }, | |
| 578 | + // 删除文件 | |
| 579 | + handleDeleteFile(index) { | |
| 580 | + this.fileEntityList.splice(index, 1); | |
| 581 | + }, | |
| 582 | + /** 文件下载 */ | |
| 583 | + downloadFA(row) { | |
| 584 | + let name = row.name; | |
| 585 | + let url = row.url; | |
| 586 | + const a = document.createElement('a') | |
| 587 | + a.setAttribute('download', name) | |
| 588 | + a.setAttribute('target', '_blank') | |
| 589 | + a.setAttribute('href', process.env.VUE_APP_BASE_API + url); | |
| 590 | + a.click() | |
| 591 | + }, | |
| 592 | + } | |
| 593 | +}; | |
| 594 | +</script> | |
| 595 | +<style scoped lang="scss"> | |
| 596 | +.upload-file-uploader { | |
| 597 | + margin-bottom: 5px; | |
| 598 | +} | |
| 599 | + | |
| 600 | +.upload-file-list .el-upload-list__item { | |
| 601 | + border: 1px solid #e4e7ed; | |
| 602 | + line-height: 2; | |
| 603 | + margin-bottom: 10px; | |
| 604 | + position: relative; | |
| 605 | +} | |
| 606 | + | |
| 607 | +.upload-file-list .ele-upload-list__item-content { | |
| 608 | + display: flex; | |
| 609 | + justify-content: space-between; | |
| 610 | + align-items: center; | |
| 611 | + color: inherit; | |
| 612 | +} | |
| 613 | + | |
| 614 | +.ele-upload-list__item-content-action .el-link { | |
| 615 | + margin-right: 10px; | |
| 616 | +} | |
| 617 | +</style> | ... | ... |
trash-workFlow/src/main/java/com/trash/office/controller/ContractManagementController.java
0 → 100644
| 1 | +package com.trash.office.controller; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +import com.alibaba.fastjson.JSON; | |
| 8 | +import com.trash.office.domain.UploadFile; | |
| 9 | +import com.trash.office.domain.vo.ContractManagementVo; | |
| 10 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.web.bind.annotation.*; | |
| 13 | +import com.trash.common.annotation.Log; | |
| 14 | +import com.trash.common.core.controller.BaseController; | |
| 15 | +import com.trash.common.core.domain.AjaxResult; | |
| 16 | +import com.trash.common.enums.BusinessType; | |
| 17 | +import com.trash.office.domain.ContractManagement; | |
| 18 | +import com.trash.office.service.IContractManagementService; | |
| 19 | +import com.trash.common.utils.poi.ExcelUtil; | |
| 20 | +import com.trash.common.core.page.TableDataInfo; | |
| 21 | +import org.springframework.web.multipart.MultipartFile; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 合同管理Controller | |
| 25 | + * | |
| 26 | + * @author trash | |
| 27 | + * @date 2023-04-27 | |
| 28 | + */ | |
| 29 | +@RestController | |
| 30 | +@RequestMapping("/office/management") | |
| 31 | +public class ContractManagementController extends BaseController | |
| 32 | +{ | |
| 33 | + @Autowired | |
| 34 | + private IContractManagementService contractManagementService; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 查询合同管理列表 | |
| 38 | + */ | |
| 39 | + @PreAuthorize("@ss.hasPermi('office:management:list')") | |
| 40 | + @GetMapping("/list") | |
| 41 | + public TableDataInfo list(ContractManagement contractManagement) | |
| 42 | + { | |
| 43 | + startPage(); | |
| 44 | + List<ContractManagement> list = contractManagementService.selectContractManagementList(contractManagement); | |
| 45 | + return getDataTable(list); | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 导出合同管理列表 | |
| 50 | + */ | |
| 51 | + @PreAuthorize("@ss.hasPermi('office:management:export')") | |
| 52 | + @Log(title = "合同管理", businessType = BusinessType.EXPORT) | |
| 53 | + @GetMapping("/export") | |
| 54 | + public AjaxResult export(ContractManagement contractManagement) | |
| 55 | + { | |
| 56 | + List<ContractManagement> list = contractManagementService.selectContractManagementList(contractManagement); | |
| 57 | + ExcelUtil<ContractManagement> util = new ExcelUtil<ContractManagement>(ContractManagement.class); | |
| 58 | + return util.exportExcel(list, "management"); | |
| 59 | + } | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 获取合同管理详细信息 | |
| 63 | + */ | |
| 64 | + @PreAuthorize("@ss.hasPermi('office:management:query')") | |
| 65 | + @GetMapping(value = "/{id}") | |
| 66 | + public AjaxResult getInfo(@PathVariable("id") Long id) | |
| 67 | + { | |
| 68 | + return AjaxResult.success(contractManagementService.selectContractManagementById(id)); | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 新增合同管理 | |
| 73 | + */ | |
| 74 | + @PreAuthorize("@ss.hasPermi('office:management:add')") | |
| 75 | + @Log(title = "合同管理", businessType = BusinessType.INSERT) | |
| 76 | + @PostMapping | |
| 77 | + public AjaxResult add(@RequestParam(value = "fileList") MultipartFile[] files,ContractManagement contractManagement) throws IOException { | |
| 78 | + return toAjax(contractManagementService.insertContractManagement(files,contractManagement)); | |
| 79 | + } | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 修改合同管理 | |
| 83 | + */ | |
| 84 | + @PreAuthorize("@ss.hasPermi('office:management:edit')") | |
| 85 | + @Log(title = "合同管理", businessType = BusinessType.UPDATE) | |
| 86 | + @PutMapping | |
| 87 | + public AjaxResult edit(@RequestParam(value = "fileList") MultipartFile[] files,String contractManagement,String[] uploadFilesList) throws IOException { | |
| 88 | + ContractManagementVo contractManagementVo = new ContractManagementVo(); | |
| 89 | + contractManagementVo.setContractManagement(JSON.parseObject(contractManagement,ContractManagement.class)); | |
| 90 | + List<UploadFile> uploadFileList = new ArrayList<>(); | |
| 91 | + for (String uploadFile : uploadFilesList) { | |
| 92 | + UploadFile uploadFile1 = JSON.parseObject(uploadFile,UploadFile.class); | |
| 93 | + if(uploadFile1!=null){ | |
| 94 | + if(uploadFile1.getId()!=null){ | |
| 95 | + uploadFileList.add(uploadFile1); | |
| 96 | + } | |
| 97 | + } | |
| 98 | + } | |
| 99 | + contractManagementVo.setUploadFiles(uploadFileList); | |
| 100 | + return toAjax(contractManagementService.updateContractManagement(files,contractManagementVo)); | |
| 101 | + } | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * 删除合同管理 | |
| 105 | + */ | |
| 106 | + @PreAuthorize("@ss.hasPermi('office:management:remove')") | |
| 107 | + @Log(title = "合同管理", businessType = BusinessType.DELETE) | |
| 108 | + @DeleteMapping("/{ids}") | |
| 109 | + public AjaxResult remove(@PathVariable Long[] ids) throws IOException { | |
| 110 | + return toAjax(contractManagementService.deleteContractManagementByIds(ids)); | |
| 111 | + } | |
| 112 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/domain/ContractManagement.java
0 → 100644
| 1 | +package com.trash.office.domain; | |
| 2 | + | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 6 | +import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 7 | +import org.apache.commons.lang3.builder.ToStringStyle; | |
| 8 | +import com.trash.common.annotation.Excel; | |
| 9 | +import com.trash.common.core.domain.BaseEntity; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 合同管理对象 contract_management | |
| 13 | + * | |
| 14 | + * @author trash | |
| 15 | + * @date 2023-04-27 | |
| 16 | + */ | |
| 17 | +public class ContractManagement extends BaseEntity { | |
| 18 | + private static final long serialVersionUID = 1L; | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * $column.columnComment | |
| 22 | + */ | |
| 23 | + private Long id; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 合同编号 | |
| 27 | + */ | |
| 28 | + @Excel(name = "合同编号") | |
| 29 | + private String contractNumber; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 合同名称 | |
| 33 | + */ | |
| 34 | + @Excel(name = "合同名称") | |
| 35 | + private String contractName; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 甲方 | |
| 39 | + */ | |
| 40 | + @Excel(name = "甲方") | |
| 41 | + private String firstParty; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 乙方 | |
| 45 | + */ | |
| 46 | + @Excel(name = "乙方") | |
| 47 | + private String secondParty; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 合同开始时间 | |
| 51 | + */ | |
| 52 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 53 | + @Excel(name = "合同开始时间", width = 30, dateFormat = "yyyy-MM-dd") | |
| 54 | + private Date contractBeginDate; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 合同结束时间 | |
| 58 | + */ | |
| 59 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 60 | + @Excel(name = "合同结束时间", width = 30, dateFormat = "yyyy-MM-dd") | |
| 61 | + private Date contractEndDate; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 合同金额 | |
| 65 | + */ | |
| 66 | + @Excel(name = "合同金额") | |
| 67 | + private String contractMoney; | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 合同状态 | |
| 71 | + */ | |
| 72 | + @Excel(name = "合同状态") | |
| 73 | + private String contractState; | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 责任科室id | |
| 77 | + */ | |
| 78 | + @Excel(name = "责任科室id") | |
| 79 | + private Long deptid; | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 责任科室 | |
| 83 | + */ | |
| 84 | + @Excel(name = "责任科室") | |
| 85 | + private String deptname; | |
| 86 | + | |
| 87 | + | |
| 88 | + public void setId(Long id) { | |
| 89 | + this.id = id; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public Long getId() { | |
| 93 | + return id; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public void setContractNumber(String contractNumber) { | |
| 97 | + this.contractNumber = contractNumber; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public String getContractNumber() { | |
| 101 | + return contractNumber; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public void setContractName(String contractName) { | |
| 105 | + this.contractName = contractName; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public String getContractName() { | |
| 109 | + return contractName; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public void setFirstParty(String firstParty) { | |
| 113 | + this.firstParty = firstParty; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public String getFirstParty() { | |
| 117 | + return firstParty; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setSecondParty(String secondParty) { | |
| 121 | + this.secondParty = secondParty; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public String getSecondParty() { | |
| 125 | + return secondParty; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public void setContractBeginDate(Date contractBeginDate) { | |
| 129 | + this.contractBeginDate = contractBeginDate; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public Date getContractBeginDate() { | |
| 133 | + return contractBeginDate; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public void setContractEndDate(Date contractEndDate) { | |
| 137 | + this.contractEndDate = contractEndDate; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public Date getContractEndDate() { | |
| 141 | + return contractEndDate; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void setContractMoney(String contractMoney) { | |
| 145 | + this.contractMoney = contractMoney; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public String getContractMoney() { | |
| 149 | + return contractMoney; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void setContractState(String contractState) { | |
| 153 | + this.contractState = contractState; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public String getContractState() { | |
| 157 | + return contractState; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public void setDeptid(Long deptid) { | |
| 161 | + this.deptid = deptid; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public Long getDeptid() { | |
| 165 | + return deptid; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public void setDeptname(String deptname) { | |
| 169 | + this.deptname = deptname; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public String getDeptname() { | |
| 173 | + return deptname; | |
| 174 | + } | |
| 175 | + | |
| 176 | + | |
| 177 | + @Override | |
| 178 | + public String toString() { | |
| 179 | + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) | |
| 180 | + .append("id", getId()) | |
| 181 | + .append("contractNumber", getContractNumber()) | |
| 182 | + .append("contractName", getContractName()) | |
| 183 | + .append("firstParty", getFirstParty()) | |
| 184 | + .append("secondParty", getSecondParty()) | |
| 185 | + .append("contractBeginDate", getContractBeginDate()) | |
| 186 | + .append("contractEndDate", getContractEndDate()) | |
| 187 | + .append("contractMoney", getContractMoney()) | |
| 188 | + .append("contractState", getContractState()) | |
| 189 | + .append("deptid", getDeptid()) | |
| 190 | + .append("deptname", getDeptname()) | |
| 191 | + .toString(); | |
| 192 | + } | |
| 193 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/domain/UploadFile.java
0 → 100644
| 1 | +package com.trash.office.domain; | |
| 2 | + | |
| 3 | +import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 4 | +import org.apache.commons.lang3.builder.ToStringStyle; | |
| 5 | +import com.trash.common.annotation.Excel; | |
| 6 | +import com.trash.common.core.domain.BaseEntity; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 文件上传对象 upload_file | |
| 10 | + * | |
| 11 | + * @author 2cTop1 | |
| 12 | + * @date 2023-04-28 | |
| 13 | + */ | |
| 14 | +public class UploadFile extends BaseEntity | |
| 15 | +{ | |
| 16 | + private static final long serialVersionUID = 1L; | |
| 17 | + | |
| 18 | + /** $column.columnComment */ | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + /** 表名 */ | |
| 22 | + @Excel(name = "表名") | |
| 23 | + private String tableName; | |
| 24 | + | |
| 25 | + /** 表编号 */ | |
| 26 | + @Excel(name = "表编号") | |
| 27 | + private String tableNumber; | |
| 28 | + | |
| 29 | + /** 文件名 */ | |
| 30 | + @Excel(name = "文件名") | |
| 31 | + private String fileName; | |
| 32 | + | |
| 33 | + /** 文件路径 */ | |
| 34 | + @Excel(name = "文件路径") | |
| 35 | + private String filePath; | |
| 36 | + | |
| 37 | + public void setId(Long id) | |
| 38 | + { | |
| 39 | + this.id = id; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public Long getId() | |
| 43 | + { | |
| 44 | + return id; | |
| 45 | + } | |
| 46 | + public void setTableName(String tableName) | |
| 47 | + { | |
| 48 | + this.tableName = tableName; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public String getTableName() | |
| 52 | + { | |
| 53 | + return tableName; | |
| 54 | + } | |
| 55 | + public void setTableNumber(String tableNumber) | |
| 56 | + { | |
| 57 | + this.tableNumber = tableNumber; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getTableNumber() | |
| 61 | + { | |
| 62 | + return tableNumber; | |
| 63 | + } | |
| 64 | + public void setFileName(String fileName) | |
| 65 | + { | |
| 66 | + this.fileName = fileName; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public String getFileName() | |
| 70 | + { | |
| 71 | + return fileName; | |
| 72 | + } | |
| 73 | + public void setFilePath(String filePath) | |
| 74 | + { | |
| 75 | + this.filePath = filePath; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getFilePath() | |
| 79 | + { | |
| 80 | + return filePath; | |
| 81 | + } | |
| 82 | + | |
| 83 | + @Override | |
| 84 | + public String toString() { | |
| 85 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |
| 86 | + .append("id", getId()) | |
| 87 | + .append("tableName", getTableName()) | |
| 88 | + .append("tableNumber", getTableNumber()) | |
| 89 | + .append("fileName", getFileName()) | |
| 90 | + .append("filePath", getFilePath()) | |
| 91 | + .toString(); | |
| 92 | + } | |
| 93 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/domain/vo/ContractManagementVo.java
0 → 100644
| 1 | +package com.trash.office.domain.vo; | |
| 2 | + | |
| 3 | +import com.trash.office.domain.ContractManagement; | |
| 4 | +import com.trash.office.domain.UploadFile; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | +import java.util.Map; | |
| 8 | + | |
| 9 | +public class ContractManagementVo { | |
| 10 | + private ContractManagement contractManagement; | |
| 11 | + | |
| 12 | + private List<UploadFile> uploadFiles; | |
| 13 | + | |
| 14 | + public List<UploadFile> getUploadFiles() { | |
| 15 | + return uploadFiles; | |
| 16 | + } | |
| 17 | + | |
| 18 | + public void setUploadFiles(List<UploadFile> uploadFiles) { | |
| 19 | + this.uploadFiles = uploadFiles; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public ContractManagement getContractManagement() { | |
| 23 | + return contractManagement; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void setContractManagement(ContractManagement contractManagement) { | |
| 27 | + this.contractManagement = contractManagement; | |
| 28 | + } | |
| 29 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/mapper/ContractManagementMapper.java
0 → 100644
| 1 | +package com.trash.office.mapper; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.trash.office.domain.ContractManagement; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 合同管理Mapper接口 | |
| 8 | + * | |
| 9 | + * @author trash | |
| 10 | + * @date 2023-04-27 | |
| 11 | + */ | |
| 12 | +public interface ContractManagementMapper | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * 查询合同管理 | |
| 16 | + * | |
| 17 | + * @param id 合同管理ID | |
| 18 | + * @return 合同管理 | |
| 19 | + */ | |
| 20 | + public ContractManagement selectContractManagementById(Long id); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询合同管理列表 | |
| 24 | + * | |
| 25 | + * @param contractManagement 合同管理 | |
| 26 | + * @return 合同管理集合 | |
| 27 | + */ | |
| 28 | + public List<ContractManagement> selectContractManagementList(ContractManagement contractManagement); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 新增合同管理 | |
| 32 | + * | |
| 33 | + * @param contractManagement 合同管理 | |
| 34 | + * @return 结果 | |
| 35 | + */ | |
| 36 | + public int insertContractManagement(ContractManagement contractManagement); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 修改合同管理 | |
| 40 | + * | |
| 41 | + * @param contractManagement 合同管理 | |
| 42 | + * @return 结果 | |
| 43 | + */ | |
| 44 | + public int updateContractManagement(ContractManagement contractManagement); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 删除合同管理 | |
| 48 | + * | |
| 49 | + * @param id 合同管理ID | |
| 50 | + * @return 结果 | |
| 51 | + */ | |
| 52 | + public int deleteContractManagementById(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 批量删除合同管理 | |
| 56 | + * | |
| 57 | + * @param ids 需要删除的数据ID | |
| 58 | + * @return 结果 | |
| 59 | + */ | |
| 60 | + public int deleteContractManagementByIds(Long[] ids); | |
| 61 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/mapper/UploadFileMapper.java
0 → 100644
| 1 | +package com.trash.office.mapper; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.trash.office.domain.UploadFile; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 文件上传Mapper接口 | |
| 8 | + * | |
| 9 | + * @author 2cTop1 | |
| 10 | + * @date 2023-04-28 | |
| 11 | + */ | |
| 12 | +public interface UploadFileMapper | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * 查询文件上传 | |
| 16 | + * | |
| 17 | + * @param id 文件上传ID | |
| 18 | + * @return 文件上传 | |
| 19 | + */ | |
| 20 | + public UploadFile selectUploadFileById(Long id); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询文件上传列表 | |
| 24 | + * | |
| 25 | + * @param uploadFile 文件上传 | |
| 26 | + * @return 文件上传集合 | |
| 27 | + */ | |
| 28 | + public List<UploadFile> selectUploadFileList(UploadFile uploadFile); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 新增文件上传 | |
| 32 | + * | |
| 33 | + * @param uploadFile 文件上传 | |
| 34 | + * @return 结果 | |
| 35 | + */ | |
| 36 | + public int insertUploadFile(UploadFile uploadFile); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 修改文件上传 | |
| 40 | + * | |
| 41 | + * @param uploadFile 文件上传 | |
| 42 | + * @return 结果 | |
| 43 | + */ | |
| 44 | + public int updateUploadFile(UploadFile uploadFile); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 删除文件上传 | |
| 48 | + * | |
| 49 | + * @param id 文件上传ID | |
| 50 | + * @return 结果 | |
| 51 | + */ | |
| 52 | + public int deleteUploadFileById(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 批量删除文件上传 | |
| 56 | + * | |
| 57 | + * @param ids 需要删除的数据ID | |
| 58 | + * @return 结果 | |
| 59 | + */ | |
| 60 | + public int deleteUploadFileByIds(Long[] ids); | |
| 61 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/service/IContractManagementService.java
0 → 100644
| 1 | +package com.trash.office.service; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | +import java.util.List; | |
| 5 | +import com.trash.office.domain.ContractManagement; | |
| 6 | +import com.trash.office.domain.vo.ContractManagementVo; | |
| 7 | +import org.springframework.web.multipart.MultipartFile; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 合同管理Service接口 | |
| 11 | + * | |
| 12 | + * @author trash | |
| 13 | + * @date 2023-04-27 | |
| 14 | + */ | |
| 15 | +public interface IContractManagementService | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * 查询合同管理 | |
| 19 | + * | |
| 20 | + * @param id 合同管理ID | |
| 21 | + * @return 合同管理 | |
| 22 | + */ | |
| 23 | + public ContractManagementVo selectContractManagementById(Long id); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 查询合同管理列表 | |
| 27 | + * | |
| 28 | + * @param contractManagement 合同管理 | |
| 29 | + * @return 合同管理集合 | |
| 30 | + */ | |
| 31 | + public List<ContractManagement> selectContractManagementList(ContractManagement contractManagement); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 新增合同管理 | |
| 35 | + * | |
| 36 | + * @param contractManagement 合同管理 | |
| 37 | + * @return 结果 | |
| 38 | + */ | |
| 39 | + public int insertContractManagement(MultipartFile[] files, ContractManagement contractManagement) throws IOException; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 修改合同管理 | |
| 43 | + * | |
| 44 | + * @param contractManagement 合同管理 | |
| 45 | + * @return 结果 | |
| 46 | + */ | |
| 47 | + public int updateContractManagement(MultipartFile[] files,ContractManagementVo contractManagementVo) throws IOException; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 批量删除合同管理 | |
| 51 | + * | |
| 52 | + * @param ids 需要删除的合同管理ID | |
| 53 | + * @return 结果 | |
| 54 | + */ | |
| 55 | + public int deleteContractManagementByIds(Long[] ids) throws IOException; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 删除合同管理信息 | |
| 59 | + * | |
| 60 | + * @param id 合同管理ID | |
| 61 | + * @return 结果 | |
| 62 | + */ | |
| 63 | + public int deleteContractManagementById(Long id); | |
| 64 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/service/IUploadFileService.java
0 → 100644
| 1 | +package com.trash.office.service; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.trash.office.domain.UploadFile; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 文件上传Service接口 | |
| 8 | + * | |
| 9 | + * @author 2cTop1 | |
| 10 | + * @date 2023-04-28 | |
| 11 | + */ | |
| 12 | +public interface IUploadFileService | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * 查询文件上传 | |
| 16 | + * | |
| 17 | + * @param id 文件上传ID | |
| 18 | + * @return 文件上传 | |
| 19 | + */ | |
| 20 | + public UploadFile selectUploadFileById(Long id); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询文件上传列表 | |
| 24 | + * | |
| 25 | + * @param uploadFile 文件上传 | |
| 26 | + * @return 文件上传集合 | |
| 27 | + */ | |
| 28 | + public List<UploadFile> selectUploadFileList(UploadFile uploadFile); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 新增文件上传 | |
| 32 | + * | |
| 33 | + * @param uploadFile 文件上传 | |
| 34 | + * @return 结果 | |
| 35 | + */ | |
| 36 | + public int insertUploadFile(UploadFile uploadFile); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 修改文件上传 | |
| 40 | + * | |
| 41 | + * @param uploadFile 文件上传 | |
| 42 | + * @return 结果 | |
| 43 | + */ | |
| 44 | + public int updateUploadFile(UploadFile uploadFile); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 批量删除文件上传 | |
| 48 | + * | |
| 49 | + * @param ids 需要删除的文件上传ID | |
| 50 | + * @return 结果 | |
| 51 | + */ | |
| 52 | + public int deleteUploadFileByIds(Long[] ids); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 删除文件上传信息 | |
| 56 | + * | |
| 57 | + * @param id 文件上传ID | |
| 58 | + * @return 结果 | |
| 59 | + */ | |
| 60 | + public int deleteUploadFileById(Long id); | |
| 61 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/service/impl/ContractManagementServiceImpl.java
0 → 100644
| 1 | +package com.trash.office.service.impl; | |
| 2 | + | |
| 3 | +import java.io.IOException; | |
| 4 | +import java.text.SimpleDateFormat; | |
| 5 | +import java.util.*; | |
| 6 | +import java.util.stream.Collectors; | |
| 7 | +import java.util.stream.Stream; | |
| 8 | + | |
| 9 | +import com.trash.common.config.trashConfig; | |
| 10 | +import com.trash.common.utils.file.FileUploadUtils; | |
| 11 | +import com.trash.framework.config.ServerConfig; | |
| 12 | +import com.trash.office.domain.UploadFile; | |
| 13 | +import com.trash.office.domain.vo.ContractManagementVo; | |
| 14 | +import com.trash.office.mapper.UploadFileMapper; | |
| 15 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | +import com.trash.office.mapper.ContractManagementMapper; | |
| 18 | +import com.trash.office.domain.ContractManagement; | |
| 19 | +import com.trash.office.service.IContractManagementService; | |
| 20 | +import org.springframework.transaction.annotation.Transactional; | |
| 21 | +import org.springframework.web.multipart.MultipartFile; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 合同管理Service业务层处理 | |
| 25 | + * | |
| 26 | + * @author trash | |
| 27 | + * @date 2023-04-27 | |
| 28 | + */ | |
| 29 | +@Service | |
| 30 | +public class ContractManagementServiceImpl implements IContractManagementService { | |
| 31 | + @Autowired | |
| 32 | + private ContractManagementMapper contractManagementMapper; | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + private UploadFileMapper uploadFileMapper; | |
| 36 | + | |
| 37 | + @Autowired | |
| 38 | + private ServerConfig serverConfig; | |
| 39 | + /** | |
| 40 | + * 查询合同管理 | |
| 41 | + * | |
| 42 | + * @param id 合同管理ID | |
| 43 | + * @return 合同管理 | |
| 44 | + */ | |
| 45 | + @Override | |
| 46 | + public ContractManagementVo selectContractManagementById(Long id) { | |
| 47 | + ContractManagementVo contractManagementVo = new ContractManagementVo(); | |
| 48 | + contractManagementVo.setContractManagement(contractManagementMapper.selectContractManagementById(id)); | |
| 49 | + UploadFile uploadFile = new UploadFile(); | |
| 50 | + uploadFile.setTableName("contract_management"); | |
| 51 | + uploadFile.setTableNumber(contractManagementVo.getContractManagement().getContractNumber()); | |
| 52 | + List<UploadFile> list = uploadFileMapper.selectUploadFileList(uploadFile); | |
| 53 | + contractManagementVo.setUploadFiles(list); | |
| 54 | + return contractManagementVo; | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 查询合同管理列表 | |
| 59 | + * | |
| 60 | + * @param contractManagement 合同管理 | |
| 61 | + * @return 合同管理 | |
| 62 | + */ | |
| 63 | + @Override | |
| 64 | + public List<ContractManagement> selectContractManagementList(ContractManagement contractManagement) { | |
| 65 | + return contractManagementMapper.selectContractManagementList(contractManagement); | |
| 66 | + } | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 新增合同管理 | |
| 70 | + * | |
| 71 | + * @param contractManagement 合同管理 | |
| 72 | + * @return 结果 | |
| 73 | + */ | |
| 74 | + @Override | |
| 75 | + @Transactional | |
| 76 | + public int insertContractManagement(MultipartFile[] files, ContractManagement contractManagement) throws IOException { | |
| 77 | + for(MultipartFile file:files) { | |
| 78 | + UploadFile uploadFile = new UploadFile(); | |
| 79 | + uploadFile.setTableName("contract_management"); | |
| 80 | + uploadFile.setTableNumber(contractManagement.getContractNumber()); | |
| 81 | + uploadFile.setFileName(file.getOriginalFilename()); | |
| 82 | + uploadFile.setFilePath(uploadFile(file)); | |
| 83 | + uploadFileMapper.insertUploadFile(uploadFile); | |
| 84 | + } | |
| 85 | + return contractManagementMapper.insertContractManagement(contractManagement); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 修改合同管理 | |
| 90 | + * | |
| 91 | + * @param contractManagementVo 合同管理 | |
| 92 | + * @return 结果 | |
| 93 | + */ | |
| 94 | + @Override | |
| 95 | + public int updateContractManagement(MultipartFile[] files,ContractManagementVo contractManagementVo) throws IOException { | |
| 96 | + //查询该合同下的文件上传数据然后删除数据库中的数据和文件 | |
| 97 | + UploadFile uploadFile = new UploadFile(); | |
| 98 | + uploadFile.setTableName("contract_management"); | |
| 99 | + uploadFile.setTableNumber(contractManagementVo.getContractManagement().getContractNumber()); | |
| 100 | + List<UploadFile> uploadFileList = uploadFileMapper.selectUploadFileList(uploadFile); | |
| 101 | + //判断getUploadFiles里是否有旧文件,如果有文件上传则先删除数据库中的数据,再添加新的数据,如果没有文件上传,则删除数据库中的数据和文件 | |
| 102 | + if(contractManagementVo.getUploadFiles().size()!=0){ | |
| 103 | + //获取两个list的交集 | |
| 104 | + List<UploadFile> distinctList = uploadFileList.stream().filter(item -> contractManagementVo.getUploadFiles().stream().anyMatch(item2 -> item.getId().equals(item2.getId()))).collect(Collectors.toList()); | |
| 105 | + //去掉交集得到需要删除的数据 | |
| 106 | + uploadFileList.removeAll(distinctList); | |
| 107 | + | |
| 108 | + for (UploadFile distinctFile:uploadFileList){ | |
| 109 | + uploadFileMapper.deleteUploadFileById(distinctFile.getId()); | |
| 110 | + //删除文件 | |
| 111 | + deleteFile(distinctFile.getFilePath()); | |
| 112 | + } | |
| 113 | + }else{ | |
| 114 | + for(UploadFile uploadFile1:uploadFileList){ | |
| 115 | + //删除数据库数据 | |
| 116 | + uploadFileMapper.deleteUploadFileById(uploadFile1.getId()); | |
| 117 | + //删除文件 | |
| 118 | + deleteFile(uploadFile1.getFilePath()); | |
| 119 | + } | |
| 120 | + } | |
| 121 | + | |
| 122 | + //添加新的文件 | |
| 123 | + for(MultipartFile file:files) { | |
| 124 | + UploadFile newUploadFile = new UploadFile(); | |
| 125 | + newUploadFile.setTableName("contract_management"); | |
| 126 | + newUploadFile.setTableNumber(contractManagementVo.getContractManagement().getContractNumber()); | |
| 127 | + newUploadFile.setFileName(file.getOriginalFilename()); | |
| 128 | + newUploadFile.setFilePath(uploadFile(file)); | |
| 129 | + uploadFileMapper.insertUploadFile(newUploadFile); | |
| 130 | + } | |
| 131 | + | |
| 132 | + return contractManagementMapper.updateContractManagement(contractManagementVo.getContractManagement()); | |
| 133 | + } | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * 批量删除合同管理 | |
| 137 | + * | |
| 138 | + * @param ids 需要删除的合同管理ID | |
| 139 | + * @return 结果 | |
| 140 | + */ | |
| 141 | + @Override | |
| 142 | + public int deleteContractManagementByIds(Long[] ids) throws IOException { | |
| 143 | + for(Long id:ids){ | |
| 144 | + ContractManagement contractManagement = contractManagementMapper.selectContractManagementById(id); | |
| 145 | + UploadFile uploadFile = new UploadFile(); | |
| 146 | + uploadFile.setTableNumber(contractManagement.getContractNumber()); | |
| 147 | + List<UploadFile> list = uploadFileMapper.selectUploadFileList(uploadFile); | |
| 148 | + for (UploadFile file : list) { | |
| 149 | + uploadFileMapper.deleteUploadFileById(file.getId()); | |
| 150 | + deleteFile(file.getFilePath()); | |
| 151 | + } | |
| 152 | + } | |
| 153 | + return contractManagementMapper.deleteContractManagementByIds(ids); | |
| 154 | + } | |
| 155 | + | |
| 156 | + /** | |
| 157 | + * 删除合同管理信息 | |
| 158 | + * | |
| 159 | + * @param id 合同管理ID | |
| 160 | + * @return 结果 | |
| 161 | + */ | |
| 162 | + @Override | |
| 163 | + @Transactional | |
| 164 | + public int deleteContractManagementById(Long id) { | |
| 165 | + ContractManagement contractManagement = contractManagementMapper.selectContractManagementById(id); | |
| 166 | + UploadFile uploadFile = new UploadFile(); | |
| 167 | + uploadFile.setTableNumber(contractManagement.getContractNumber()); | |
| 168 | + List<UploadFile> list = uploadFileMapper.selectUploadFileList(uploadFile); | |
| 169 | + list.stream().forEach(file -> { | |
| 170 | + uploadFileMapper.deleteUploadFileById(file.getId()); | |
| 171 | + String filePath = file.getFilePath(); | |
| 172 | + filePath = filePath.substring(filePath.indexOf("/profile")+8,filePath.length()); | |
| 173 | + FileUploadUtils.deleteFile(filePath); | |
| 174 | + }); | |
| 175 | + return contractManagementMapper.deleteContractManagementById(id); | |
| 176 | + } | |
| 177 | + | |
| 178 | + /** | |
| 179 | + * 文件上传 | |
| 180 | + */ | |
| 181 | + public String uploadFile(MultipartFile file) throws IOException { | |
| 182 | + // 上传文件路径 | |
| 183 | + String filePath = trashConfig.getUploadPath(); | |
| 184 | + // 上传并返回新文件名称 | |
| 185 | + String newFileName = FileUploadUtils.upload(filePath, file); | |
| 186 | + return newFileName; | |
| 187 | + } | |
| 188 | + | |
| 189 | + /** | |
| 190 | + * 文件删除 | |
| 191 | + */ | |
| 192 | + public void deleteFile(String filePath) throws IOException { | |
| 193 | + filePath = filePath.substring(filePath.indexOf("/profile")+8); | |
| 194 | + FileUploadUtils.deleteFile(filePath); | |
| 195 | + } | |
| 196 | +} | ... | ... |
trash-workFlow/src/main/java/com/trash/office/service/impl/UploadFileServiceImpl.java
0 → 100644
| 1 | +package com.trash.office.service.impl; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | +import com.trash.office.mapper.UploadFileMapper; | |
| 7 | +import com.trash.office.domain.UploadFile; | |
| 8 | +import com.trash.office.service.IUploadFileService; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 文件上传Service业务层处理 | |
| 12 | + * | |
| 13 | + * @author 2cTop1 | |
| 14 | + * @date 2023-04-28 | |
| 15 | + */ | |
| 16 | +@Service | |
| 17 | +public class UploadFileServiceImpl implements IUploadFileService | |
| 18 | +{ | |
| 19 | + @Autowired | |
| 20 | + private UploadFileMapper uploadFileMapper; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询文件上传 | |
| 24 | + * | |
| 25 | + * @param id 文件上传ID | |
| 26 | + * @return 文件上传 | |
| 27 | + */ | |
| 28 | + @Override | |
| 29 | + public UploadFile selectUploadFileById(Long id) | |
| 30 | + { | |
| 31 | + return uploadFileMapper.selectUploadFileById(id); | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 查询文件上传列表 | |
| 36 | + * | |
| 37 | + * @param uploadFile 文件上传 | |
| 38 | + * @return 文件上传 | |
| 39 | + */ | |
| 40 | + @Override | |
| 41 | + public List<UploadFile> selectUploadFileList(UploadFile uploadFile) | |
| 42 | + { | |
| 43 | + return uploadFileMapper.selectUploadFileList(uploadFile); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 新增文件上传 | |
| 48 | + * | |
| 49 | + * @param uploadFile 文件上传 | |
| 50 | + * @return 结果 | |
| 51 | + */ | |
| 52 | + @Override | |
| 53 | + public int insertUploadFile(UploadFile uploadFile) | |
| 54 | + { | |
| 55 | + return uploadFileMapper.insertUploadFile(uploadFile); | |
| 56 | + } | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 修改文件上传 | |
| 60 | + * | |
| 61 | + * @param uploadFile 文件上传 | |
| 62 | + * @return 结果 | |
| 63 | + */ | |
| 64 | + @Override | |
| 65 | + public int updateUploadFile(UploadFile uploadFile) | |
| 66 | + { | |
| 67 | + return uploadFileMapper.updateUploadFile(uploadFile); | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 批量删除文件上传 | |
| 72 | + * | |
| 73 | + * @param ids 需要删除的文件上传ID | |
| 74 | + * @return 结果 | |
| 75 | + */ | |
| 76 | + @Override | |
| 77 | + public int deleteUploadFileByIds(Long[] ids) | |
| 78 | + { | |
| 79 | + return uploadFileMapper.deleteUploadFileByIds(ids); | |
| 80 | + } | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 删除文件上传信息 | |
| 84 | + * | |
| 85 | + * @param id 文件上传ID | |
| 86 | + * @return 结果 | |
| 87 | + */ | |
| 88 | + @Override | |
| 89 | + public int deleteUploadFileById(Long id) | |
| 90 | + { | |
| 91 | + return uploadFileMapper.deleteUploadFileById(id); | |
| 92 | + } | |
| 93 | +} | ... | ... |
trash-workFlow/src/main/resources/mapper/ContractManagementMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.trash.office.mapper.ContractManagementMapper"> | |
| 6 | + | |
| 7 | + <resultMap type="ContractManagement" id="ContractManagementResult"> | |
| 8 | + <result property="id" column="id" /> | |
| 9 | + <result property="contractNumber" column="contract_number" /> | |
| 10 | + <result property="contractName" column="contract_name" /> | |
| 11 | + <result property="firstParty" column="first_party" /> | |
| 12 | + <result property="secondParty" column="second_party" /> | |
| 13 | + <result property="contractBeginDate" column="contract_begin_date" /> | |
| 14 | + <result property="contractEndDate" column="contract_end_date" /> | |
| 15 | + <result property="contractMoney" column="contract_money" /> | |
| 16 | + <result property="contractState" column="contract_state" /> | |
| 17 | + <result property="deptid" column="deptId" /> | |
| 18 | + <result property="deptname" column="deptName" /> | |
| 19 | + <result property="updateBy" column="update_by" /> | |
| 20 | + <result property="updateTime" column="update_time" /> | |
| 21 | + <result property="createBy" column="create_by" /> | |
| 22 | + <result property="createTime" column="create_time" /> | |
| 23 | + </resultMap> | |
| 24 | + | |
| 25 | + <sql id="selectContractManagementVo"> | |
| 26 | + select id, contract_number, contract_name, first_party, second_party, contract_begin_date, contract_end_date, contract_money, contract_state, deptId, deptName from contract_management | |
| 27 | + </sql> | |
| 28 | + | |
| 29 | + <select id="selectContractManagementList" parameterType="ContractManagement" resultMap="ContractManagementResult"> | |
| 30 | + <include refid="selectContractManagementVo"/> | |
| 31 | + <where> | |
| 32 | + <if test="contractNumber != null and contractNumber != ''"> and contract_number = #{contractNumber}</if> | |
| 33 | + <if test="contractName != null and contractName != ''"> and contract_name like concat('%', #{contractName}, '%')</if> | |
| 34 | + <if test="firstParty != null and firstParty != ''"> and first_party = #{firstParty}</if> | |
| 35 | + <if test="secondParty != null and secondParty != ''"> and second_party = #{secondParty}</if> | |
| 36 | + <if test="contractBeginDate != null "> and contract_begin_date = #{contractBeginDate}</if> | |
| 37 | + <if test="contractEndDate != null "> and contract_end_date = #{contractEndDate}</if> | |
| 38 | + <if test="contractMoney != null and contractMoney != ''"> and contract_money = #{contractMoney}</if> | |
| 39 | + <if test="contractState != null and contractState != ''"> and contract_state = #{contractState}</if> | |
| 40 | + <if test="deptid != null "> and deptId = #{deptid}</if> | |
| 41 | + <if test="deptname != null and deptname != ''"> and deptName like concat('%', #{deptname}, '%')</if> | |
| 42 | + </where> | |
| 43 | + </select> | |
| 44 | + | |
| 45 | + <select id="selectContractManagementById" parameterType="Long" resultMap="ContractManagementResult"> | |
| 46 | + <include refid="selectContractManagementVo"/> | |
| 47 | + where id = #{id} | |
| 48 | + </select> | |
| 49 | + | |
| 50 | + <insert id="insertContractManagement" parameterType="ContractManagement" useGeneratedKeys="true" keyProperty="id"> | |
| 51 | + insert into contract_management | |
| 52 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 53 | + create_time, | |
| 54 | + <if test="contractNumber != null">contract_number,</if> | |
| 55 | + <if test="contractName != null">contract_name,</if> | |
| 56 | + <if test="firstParty != null">first_party,</if> | |
| 57 | + <if test="secondParty != null">second_party,</if> | |
| 58 | + <if test="contractBeginDate != null">contract_begin_date,</if> | |
| 59 | + <if test="contractEndDate != null">contract_end_date,</if> | |
| 60 | + <if test="contractMoney != null">contract_money,</if> | |
| 61 | + <if test="contractState != null">contract_state,</if> | |
| 62 | + <if test="deptid != null">deptId,</if> | |
| 63 | + <if test="deptname != null">deptName,</if> | |
| 64 | + </trim> | |
| 65 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 66 | + now(), | |
| 67 | + <if test="contractNumber != null">#{contractNumber},</if> | |
| 68 | + <if test="contractName != null">#{contractName},</if> | |
| 69 | + <if test="firstParty != null">#{firstParty},</if> | |
| 70 | + <if test="secondParty != null">#{secondParty},</if> | |
| 71 | + <if test="contractBeginDate != null">#{contractBeginDate},</if> | |
| 72 | + <if test="contractEndDate != null">#{contractEndDate},</if> | |
| 73 | + <if test="contractMoney != null">#{contractMoney},</if> | |
| 74 | + <if test="contractState != null">#{contractState},</if> | |
| 75 | + <if test="deptid != null">#{deptid},</if> | |
| 76 | + <if test="deptname != null">#{deptname},</if> | |
| 77 | + </trim> | |
| 78 | + </insert> | |
| 79 | + | |
| 80 | + <update id="updateContractManagement" parameterType="ContractManagement"> | |
| 81 | + update contract_management | |
| 82 | + <trim prefix="SET" suffixOverrides=","> | |
| 83 | + <if test="contractNumber != null">contract_number = #{contractNumber},</if> | |
| 84 | + <if test="contractName != null">contract_name = #{contractName},</if> | |
| 85 | + <if test="firstParty != null">first_party = #{firstParty},</if> | |
| 86 | + <if test="secondParty != null">second_party = #{secondParty},</if> | |
| 87 | + <if test="contractBeginDate != null">contract_begin_date = #{contractBeginDate},</if> | |
| 88 | + <if test="contractEndDate != null">contract_end_date = #{contractEndDate},</if> | |
| 89 | + <if test="contractMoney != null">contract_money = #{contractMoney},</if> | |
| 90 | + <if test="contractState != null">contract_state = #{contractState},</if> | |
| 91 | + <if test="deptid != null">deptId = #{deptid},</if> | |
| 92 | + <if test="deptname != null">deptName = #{deptname},</if> | |
| 93 | + update_time = now(), | |
| 94 | + </trim> | |
| 95 | + where id = #{id} | |
| 96 | + </update> | |
| 97 | + | |
| 98 | + <delete id="deleteContractManagementById" parameterType="Long"> | |
| 99 | + delete from contract_management where id = #{id} | |
| 100 | + </delete> | |
| 101 | + | |
| 102 | + <delete id="deleteContractManagementByIds" parameterType="String"> | |
| 103 | + delete from contract_management where id in | |
| 104 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | |
| 105 | + #{id} | |
| 106 | + </foreach> | |
| 107 | + </delete> | |
| 108 | + | |
| 109 | +</mapper> | |
| 0 | 110 | \ No newline at end of file | ... | ... |
trash-workFlow/src/main/resources/mapper/UploadFileMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.trash.office.mapper.UploadFileMapper"> | |
| 6 | + | |
| 7 | + <resultMap type="UploadFile" id="UploadFileResult"> | |
| 8 | + <result property="id" column="id" /> | |
| 9 | + <result property="tableName" column="table_name" /> | |
| 10 | + <result property="tableNumber" column="table_number" /> | |
| 11 | + <result property="fileName" column="file_name" /> | |
| 12 | + <result property="filePath" column="file_path" /> | |
| 13 | + </resultMap> | |
| 14 | + | |
| 15 | + <sql id="selectUploadFileVo"> | |
| 16 | + select id, table_name, table_number, file_name, file_path from upload_file | |
| 17 | + </sql> | |
| 18 | + | |
| 19 | + <select id="selectUploadFileList" parameterType="UploadFile" resultMap="UploadFileResult"> | |
| 20 | + <include refid="selectUploadFileVo"/> | |
| 21 | + <where> | |
| 22 | + <if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if> | |
| 23 | + <if test="tableNumber != null and tableNumber != ''"> and table_number = #{tableNumber}</if> | |
| 24 | + <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if> | |
| 25 | + <if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if> | |
| 26 | + </where> | |
| 27 | + </select> | |
| 28 | + | |
| 29 | + <select id="selectUploadFileById" parameterType="Long" resultMap="UploadFileResult"> | |
| 30 | + <include refid="selectUploadFileVo"/> | |
| 31 | + where id = #{id} | |
| 32 | + </select> | |
| 33 | + | |
| 34 | + <insert id="insertUploadFile" parameterType="UploadFile" useGeneratedKeys="true" keyProperty="id"> | |
| 35 | + insert into upload_file | |
| 36 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 37 | + <if test="tableName != null">table_name,</if> | |
| 38 | + <if test="tableNumber != null">table_number,</if> | |
| 39 | + <if test="fileName != null">file_name,</if> | |
| 40 | + <if test="filePath != null">file_path,</if> | |
| 41 | + </trim> | |
| 42 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 43 | + <if test="tableName != null">#{tableName},</if> | |
| 44 | + <if test="tableNumber != null">#{tableNumber},</if> | |
| 45 | + <if test="fileName != null">#{fileName},</if> | |
| 46 | + <if test="filePath != null">#{filePath},</if> | |
| 47 | + </trim> | |
| 48 | + </insert> | |
| 49 | + | |
| 50 | + <update id="updateUploadFile" parameterType="UploadFile"> | |
| 51 | + update upload_file | |
| 52 | + <trim prefix="SET" suffixOverrides=","> | |
| 53 | + <if test="tableName != null">table_name = #{tableName},</if> | |
| 54 | + <if test="tableNumber != null">table_number = #{tableNumber},</if> | |
| 55 | + <if test="fileName != null">file_name = #{fileName},</if> | |
| 56 | + <if test="filePath != null">file_path = #{filePath},</if> | |
| 57 | + </trim> | |
| 58 | + where id = #{id} | |
| 59 | + </update> | |
| 60 | + | |
| 61 | + <delete id="deleteUploadFileById" parameterType="Long"> | |
| 62 | + delete from upload_file | |
| 63 | + <if test="id != null"> | |
| 64 | + where id = #{id} | |
| 65 | + </if> | |
| 66 | + </delete> | |
| 67 | + | |
| 68 | + <delete id="deleteUploadFileByIds" parameterType="String"> | |
| 69 | + delete from upload_file where id in | |
| 70 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | |
| 71 | + #{id} | |
| 72 | + </foreach> | |
| 73 | + </delete> | |
| 74 | + | |
| 75 | +</mapper> | |
| 0 | 76 | \ No newline at end of file | ... | ... |