Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
maintain_service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘帅
maintain_service
Commits
c1c96728
Commit
c1c96728
authored
Jun 16, 2025
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加物资导入功能
parent
cf54279f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
398 additions
and
39 deletions
+398
-39
ErpMaterialController.java
...m/maintain/business/controller/ErpMaterialController.java
+29
-0
ErpMaterialVo.java
...n/java/com/maintain/business/domain/vo/ErpMaterialVo.java
+39
-36
ErpMaterialImportListener.java
...maintain/business/listener/ErpMaterialImportListener.java
+245
-0
ErpMaterialServiceImpl.java
...aintain/business/service/impl/ErpMaterialServiceImpl.java
+1
-0
request.js
maintain-ui/src/utils/request.js
+2
-2
index.vue
maintain-ui/src/views/business/material/index.vue
+82
-1
No files found.
maintain-business/src/main/java/com/maintain/business/controller/ErpMaterialController.java
View file @
c1c96728
package
com
.
maintain
.
business
.
controller
;
package
com
.
maintain
.
business
.
controller
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
com.maintain.business.domain.bo.ErpCarBo
;
import
com.maintain.business.domain.vo.ErpCarVo
;
import
com.maintain.business.listener.ErpCarImportListener
;
import
com.maintain.business.listener.ErpMaterialImportListener
;
import
com.maintain.common.excel.ExcelResult
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.constraints.*
;
import
javax.validation.constraints.*
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
cn.dev33.satoken.annotation.SaCheckPermission
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
com.maintain.common.annotation.RepeatSubmit
;
import
com.maintain.common.annotation.RepeatSubmit
;
...
@@ -22,6 +29,7 @@ import com.maintain.business.domain.vo.ErpMaterialVo;
...
@@ -22,6 +29,7 @@ import com.maintain.business.domain.vo.ErpMaterialVo;
import
com.maintain.business.domain.bo.ErpMaterialBo
;
import
com.maintain.business.domain.bo.ErpMaterialBo
;
import
com.maintain.business.service.IErpMaterialService
;
import
com.maintain.business.service.IErpMaterialService
;
import
com.maintain.common.core.page.TableDataInfo
;
import
com.maintain.common.core.page.TableDataInfo
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 物资
* 物资
...
@@ -46,6 +54,27 @@ public class ErpMaterialController extends BaseController {
...
@@ -46,6 +54,27 @@ public class ErpMaterialController extends BaseController {
return
iErpMaterialService
.
queryPageList
(
bo
,
pageQuery
);
return
iErpMaterialService
.
queryPageList
(
bo
,
pageQuery
);
}
}
/**
* 物料导入模板下载
*/
@PostMapping
(
"/importTemplate"
)
public
void
importTemplate
(
ErpMaterialBo
bo
,
HttpServletResponse
response
)
{
ExcelUtil
.
exportExcel
(
new
ArrayList
<>(),
"物料导入"
,
ErpMaterialVo
.
class
,
response
);
}
/**
* 导入数据
*
* @param file 导入文件
* @param updateSupport 是否更新已存在数据
*/
@Log
(
title
=
"物料导入"
,
businessType
=
BusinessType
.
IMPORT
)
@PostMapping
(
value
=
"/importData"
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
public
R
<
Void
>
importData
(
@RequestPart
(
"file"
)
MultipartFile
file
,
boolean
updateSupport
)
throws
Exception
{
ExcelResult
<
ErpMaterialVo
>
result
=
ExcelUtil
.
importExcel
(
file
.
getInputStream
(),
ErpMaterialVo
.
class
,
new
ErpMaterialImportListener
(
updateSupport
));
return
R
.
ok
(
result
.
getAnalysis
());
}
/**
/**
* 导出物资列表
* 导出物资列表
*/
*/
...
...
maintain-business/src/main/java/com/maintain/business/domain/vo/ErpMaterialVo.java
View file @
c1c96728
...
@@ -28,17 +28,6 @@ public class ErpMaterialVo implements Serializable {
...
@@ -28,17 +28,6 @@ public class ErpMaterialVo implements Serializable {
*/
*/
private
Long
id
;
private
Long
id
;
/**
* 物资分类ID
*/
private
Long
materialTypeId
;
/**
* 物资分类名称
*/
@ExcelProperty
(
value
=
"物资分类名称"
)
private
String
materialTypeName
;
/**
/**
* 部门ID
* 部门ID
*/
*/
...
@@ -48,30 +37,35 @@ public class ErpMaterialVo implements Serializable {
...
@@ -48,30 +37,35 @@ public class ErpMaterialVo implements Serializable {
* 部门名称
* 部门名称
*/
*/
private
String
deptName
;
private
String
deptName
;
/**
/**
* 仓库ID
* 仓库
货位
ID
*/
*/
private
Long
warehouseId
;
private
Long
warehouseLocationId
;
/**
/**
*
仓库名称
*
物资编码
*/
*/
private
String
warehouseName
;
@ExcelProperty
(
value
=
"物资编码"
)
private
String
materialCode
;
/**
/**
*
仓库货位ID
*
物资名称
*/
*/
private
Long
warehouseLocationId
;
@ExcelProperty
(
value
=
"物资名称"
)
private
String
materialName
;
/**
/**
*
仓库货位编码
*
物资规格
*/
*/
private
String
warehouseLocationCode
;
@ExcelProperty
(
value
=
"物资规格"
)
private
String
materialSpecifications
;
/**
/**
*
仓库货位类型
*
物资单位
*/
*/
@ExcelProperty
(
value
=
"仓库货位类型"
)
@ExcelProperty
(
value
=
"物资单位"
)
@ColumnWidth
(
30
)
private
String
materialUnit
;
private
String
warehouseLocationType
;
/**
/**
* 供应商ID
* 供应商ID
...
@@ -85,28 +79,37 @@ public class ErpMaterialVo implements Serializable {
...
@@ -85,28 +79,37 @@ public class ErpMaterialVo implements Serializable {
private
String
vendorName
;
private
String
vendorName
;
/**
/**
* 物资
编码
* 物资
分类ID
*/
*/
@ExcelProperty
(
value
=
"物资编码"
)
private
Long
materialTypeId
;
private
String
materialCode
;
/**
/**
* 物资名称
* 物资
分类
名称
*/
*/
@ExcelProperty
(
value
=
"物资名称"
)
@ExcelProperty
(
value
=
"物资
分类
名称"
)
private
String
materialName
;
private
String
material
Type
Name
;
/**
/**
*
物资规格
*
仓库ID
*/
*/
@ExcelProperty
(
value
=
"物资规格"
)
private
Long
warehouseId
;
private
String
materialSpecifications
;
/**
/**
*
物资单位
*
仓库名称
*/
*/
@ExcelProperty
(
value
=
"物资单位"
)
private
String
warehouseName
;
private
String
materialUnit
;
/**
* 仓库货位编码
*/
private
String
warehouseLocationCode
;
/**
* 仓库货位类型
*/
@ExcelProperty
(
value
=
"仓库货位类型"
)
@ColumnWidth
(
30
)
private
String
warehouseLocationType
;
/**
/**
* 物资品牌
* 物资品牌
...
@@ -130,7 +133,7 @@ public class ErpMaterialVo implements Serializable {
...
@@ -130,7 +133,7 @@ public class ErpMaterialVo implements Serializable {
/**
/**
* 质保期(月)
* 质保期(月)
*/
*/
@ExcelProperty
(
value
=
"质保期"
)
@ExcelProperty
(
value
=
"质保期
(月)
"
)
private
Integer
materialWarrantyPeriod
;
private
Integer
materialWarrantyPeriod
;
/**
/**
...
...
maintain-business/src/main/java/com/maintain/business/listener/ErpMaterialImportListener.java
0 → 100644
View file @
c1c96728
This diff is collapsed.
Click to expand it.
maintain-business/src/main/java/com/maintain/business/service/impl/ErpMaterialServiceImpl.java
View file @
c1c96728
...
@@ -93,6 +93,7 @@ public class ErpMaterialServiceImpl implements IErpMaterialService {
...
@@ -93,6 +93,7 @@ public class ErpMaterialServiceImpl implements IErpMaterialService {
lqw
.
eq
(
StringUtils
.
isNotBlank
(
bo
.
getIsEnable
()),
ErpMaterial:
:
getIsEnable
,
bo
.
getIsEnable
());
lqw
.
eq
(
StringUtils
.
isNotBlank
(
bo
.
getIsEnable
()),
ErpMaterial:
:
getIsEnable
,
bo
.
getIsEnable
());
lqw
.
eq
(
StringUtils
.
isNotBlank
(
bo
.
getIsUniversal
()),
ErpMaterial:
:
getIsUniversal
,
bo
.
getIsUniversal
());
lqw
.
eq
(
StringUtils
.
isNotBlank
(
bo
.
getIsUniversal
()),
ErpMaterial:
:
getIsUniversal
,
bo
.
getIsUniversal
());
lqw
.
eq
(
ErpMaterial:
:
getIsDelete
,
IsDeleteStatus
.
NO
.
getCode
());
lqw
.
eq
(
ErpMaterial:
:
getIsDelete
,
IsDeleteStatus
.
NO
.
getCode
());
lqw
.
orderByDesc
(
ErpMaterial:
:
getCreateTime
);
return
lqw
;
return
lqw
;
}
}
...
...
maintain-ui/src/utils/request.js
View file @
c1c96728
...
@@ -9,7 +9,7 @@ import { saveAs } from 'file-saver'
...
@@ -9,7 +9,7 @@ import { saveAs } from 'file-saver'
let
downloadLoadingInstance
;
let
downloadLoadingInstance
;
// 是否显示重新登录
// 是否显示重新登录
export
let
isRelogin
=
{
show
:
fals
e
};
export
let
isRelogin
=
{
show
:
tru
e
};
axios
.
defaults
.
headers
[
'
Content-Type
'
]
=
'
application/json;charset=utf-8
'
axios
.
defaults
.
headers
[
'
Content-Type
'
]
=
'
application/json;charset=utf-8
'
// 对应国际化资源文件后缀
// 对应国际化资源文件后缀
...
@@ -19,7 +19,7 @@ const service = axios.create({
...
@@ -19,7 +19,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
// 超时
// 超时
timeout
:
5
0000
timeout
:
1
0000
})
})
// request拦截器
// request拦截器
...
...
maintain-ui/src/views/business/material/index.vue
View file @
c1c96728
...
@@ -120,6 +120,16 @@
...
@@ -120,6 +120,16 @@
v-hasPermi=
"['business:material:export']"
v-hasPermi=
"['business:material:export']"
>
导出
</el-button>
>
导出
</el-button>
</el-col>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-upload2"
size=
"mini"
@
click=
"handleImport"
v-hasPermi=
"['business:material:import']"
>
导入
</el-button>
</el-col>
<right-toolbar
:showSearch.sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
<right-toolbar
:showSearch.sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
</el-row>
...
@@ -310,6 +320,36 @@
...
@@ -310,6 +320,36 @@
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</div>
</el-dialog>
</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 text-center"
slot=
"tip"
>
<!-- <div class="el-upload__tip" slot="tip">-->
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
<!-- </div>-->
<span>
仅允许导入xls、xlsx格式文件。
</span>
<el-link
type=
"primary"
:underline=
"false"
style=
"font-size:12px;vertical-align: baseline;"
@
click=
"importTemplate"
>
下载模板
</el-link>
</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>
</div>
</template>
</template>
...
@@ -321,6 +361,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
...
@@ -321,6 +361,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import
{
listWarehouseLocation
}
from
'
../../../api/business/warehouseLocation
'
import
{
listWarehouseLocation
}
from
'
../../../api/business/warehouseLocation
'
import
{
listMaterialVendor
,
listMaterialVendorAll
}
from
'
../../../api/business/materialVendor
'
import
{
listMaterialVendor
,
listMaterialVendorAll
}
from
'
../../../api/business/materialVendor
'
import
{
listSiteWarehouse
,
listWarehouseAll
}
from
'
@/api/business/siteWarehouse
'
import
{
listSiteWarehouse
,
listWarehouseAll
}
from
'
@/api/business/siteWarehouse
'
import
{
getToken
}
from
"
@/utils/auth
"
;
export
default
{
export
default
{
name
:
"
Material
"
,
name
:
"
Material
"
,
...
@@ -375,6 +416,21 @@ export default {
...
@@ -375,6 +416,21 @@ export default {
isUniversal
:
undefined
,
isUniversal
:
undefined
,
isCheck
:
undefined
,
isCheck
:
undefined
,
},
},
// 导入参数
upload
:
{
// 是否显示弹出层
open
:
false
,
// 弹出层标题
title
:
""
,
// 是否禁用上传
isUploading
:
false
,
// 是否更新已经存在的数据
updateSupport
:
0
,
// 设置上传的请求头部
headers
:
{
Authorization
:
"
Bearer
"
+
getToken
()
},
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
"
business/material/importData
"
},
// 表单参数
// 表单参数
form
:
{},
form
:
{},
// 表单校验
// 表单校验
...
@@ -589,7 +645,32 @@ export default {
...
@@ -589,7 +645,32 @@ export default {
this
.
download
(
'
business/material/export
'
,
{
this
.
download
(
'
business/material/export
'
,
{
...
this
.
queryParams
...
this
.
queryParams
},
`物资列表_
${
new
Date
().
getTime
()}
.xlsx`
)
},
`物资列表_
${
new
Date
().
getTime
()}
.xlsx`
)
}
},
/** 导入按钮操作 */
handleImport
()
{
this
.
upload
.
title
=
"
物资导入
"
;
this
.
upload
.
open
=
true
;
},
/** 下载模板操作 */
importTemplate
()
{
this
.
download
(
'
business/material/importTemplate
'
,
{},
`物资导入模板`
)
},
// 文件上传中处理
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
(
"
<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>
"
+
response
.
msg
+
"
</div>
"
,
"
导入结果
"
,
{
dangerouslyUseHTMLString
:
true
});
this
.
getList
();
},
// 提交上传文件
submitFileForm
()
{
this
.
$refs
.
upload
.
submit
();
},
}
}
};
};
</
script
>
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment