Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
项目统一框架
amos-boot-biz
Commits
00ebf8c6
Commit
00ebf8c6
authored
Sep 30, 2024
by
hekaiwen
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register
parents
8f6e6682
1dc93cfe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
22 deletions
+161
-22
IRescueStationService.java
...ot/module/elevator/api/service/IRescueStationService.java
+5
-0
RescueStationImportVo.java
...os/boot/module/elevator/api/vo/RescueStationImportVo.java
+49
-0
RescueStationController.java
...dule/elevator/biz/controller/RescueStationController.java
+31
-5
RescueStationServiceImpl.java
...e/elevator/biz/service/impl/RescueStationServiceImpl.java
+59
-0
ImportYsEmergencyUnitVo.java
...n/amos/boot/module/ys/api/vo/ImportYsEmergencyUnitVo.java
+17
-17
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/java/com/yeejoin/amos/boot/module/elevator/api/service/IRescueStationService.java
View file @
00ebf8c6
...
...
@@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.RescueStationDto
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.RescueStation
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
...
...
@@ -29,4 +32,6 @@ public interface IRescueStationService extends IService<RescueStation> {
List
<
RescueStationDto
>
selectExportData
(
String
exportId
);
IPage
<
RescueStation
>
getRescueStationList
(
IPage
<
RescueStation
>
page
,
RescueStationDto
rescueStationDto
);
ResponseModel
<
Object
>
expertDataImport
(
MultipartFile
file
,
AgencyUserModel
userModel
);
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/java/com/yeejoin/amos/boot/module/elevator/api/vo/RescueStationImportVo.java
0 → 100644
View file @
00ebf8c6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
elevator
.
api
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
/**
* @author chang xiangyu 2024/9/30
* 导入救援站信息Model
*/
@Data
public
class
RescueStationImportVo
{
@ExcelProperty
(
value
=
"应急救援机构名称"
)
private
String
name
;
@ExcelProperty
(
value
=
"地市"
)
private
String
city
;
@ExcelProperty
(
value
=
"区县"
)
private
String
district
;
@ExcelProperty
(
value
=
"地址(详细地址,包括道路、门牌号码)"
)
private
String
address
;
@ExcelProperty
(
value
=
"主要负责人"
)
private
String
principal
;
@ExcelProperty
(
value
=
"负责人电话"
)
private
String
principalPhone
;
@ExcelProperty
(
value
=
"应急救援负责人"
)
private
String
rescueLeader
;
@ExcelProperty
(
value
=
"应急救援负责人手机号"
)
private
String
rescueLeaderPhone
;
@ExcelProperty
(
value
=
"所属单位(维保单位)"
)
private
String
affiliatedUnit
;
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/controller/RescueStationController.java
View file @
00ebf8c6
...
...
@@ -22,20 +22,19 @@ import com.yeejoin.amos.boot.module.elevator.biz.service.impl.RescueStationServi
import
com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
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.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
...
...
@@ -310,5 +309,32 @@ public class RescueStationController extends BaseController {
return
ResponseHelper
.
buildResponse
(
list
.
size
()
>
5
?
rescueStationDtos:
list
);
}
/**
* @author chang xiangyu
* @param file
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/import"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"救援站列表数据导入"
,
notes
=
"救援站列表数据导入"
)
@CrossOrigin
(
"*"
)
public
ResponseModel
<
Object
>
expertDataImport
(
@RequestBody
MultipartFile
file
)
{
// 校验文件是否为空
if
(
file
.
isEmpty
())
{
return
ResponseHelper
.
buildResponse
(
"文件不能为空"
);
}
// 校验文件类型为 Excel
String
contentType
=
file
.
getContentType
();
String
fileExtension
=
FilenameUtils
.
getExtension
(
file
.
getOriginalFilename
());
// 校验 Excel 文件的 MIME type 和扩展名
if
(!(
"application/vnd.ms-excel"
.
equals
(
contentType
)
||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
.
equals
(
contentType
))
||
!(
"xls"
.
equalsIgnoreCase
(
fileExtension
)
||
"xlsx"
.
equalsIgnoreCase
(
fileExtension
)))
{
return
ResponseHelper
.
buildResponse
(
"文件类型必须是 Excel 文件"
);
}
AgencyUserModel
userModel
=
getSelectedOrgInfo
().
getUserModel
();
return
iRescueStationService
.
expertDataImport
(
file
,
userModel
);
}
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/RescueStationServiceImpl.java
View file @
00ebf8c6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
elevator
.
biz
.
service
.
impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelReader
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.read.metadata.ReadSheet
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.elevator.api.dto.RescueStationDto
;
import
com.yeejoin.amos.boot.module.elevator.api.entity.RescueStation
;
import
com.yeejoin.amos.boot.module.elevator.api.mapper.RescueStationMapper
;
import
com.yeejoin.amos.boot.module.elevator.api.service.IRescueStationService
;
import
com.yeejoin.amos.boot.module.elevator.api.vo.RescueStationImportVo
;
import
com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -53,6 +68,50 @@ public class RescueStationServiceImpl extends BaseService<RescueStationDto, Resc
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ResponseModel
<
Object
>
expertDataImport
(
MultipartFile
file
,
AgencyUserModel
userModel
)
{
try
{
InputStream
inputStream
=
file
.
getInputStream
();
ExcelReader
excelReader
=
EasyExcel
.
read
(
inputStream
).
build
();
List
<
ReadSheet
>
sheetList
=
excelReader
.
excelExecutor
().
sheetList
();
ReadSheet
sheet
=
sheetList
.
get
(
0
);
if
(
ValidationUtil
.
isEmpty
(
sheet
))
{
throw
new
BadRequest
(
"Excel导入模板有误,请重写下载导入!"
);
}
ArrayList
<
RescueStation
>
dataList
=
new
ArrayList
<>();
EasyExcel
.
read
(
file
.
getInputStream
(),
RescueStationImportVo
.
class
,
new
AnalysisEventListener
<
RescueStationImportVo
>()
{
@Override
public
void
invoke
(
RescueStationImportVo
data
,
AnalysisContext
context
)
{
RescueStation
rescueStation
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
data
),
RescueStation
.
class
);
rescueStation
.
setIsDelete
(
Boolean
.
FALSE
);
rescueStation
.
setRecDate
(
new
Date
());
rescueStation
.
setRecUserName
(
userModel
.
getUserName
());
rescueStation
.
setRecUserId
(
userModel
.
getUserId
());
dataList
.
add
(
rescueStation
);
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
}
}).
headRowNumber
(
1
).
sheet
().
doRead
();
excelReader
.
finish
();
// 保存数据
this
.
saveOrUpdateBatch
(
dataList
);
return
ResponseHelper
.
buildResponse
(
"success"
);
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
e
.
getMessage
());
}
}
public
Boolean
saveRescueStation
(
RescueStationDto
rescueStationDto
){
RescueStation
rescueStation
=
BeanDtoVoUtils
.
convert
(
rescueStationDto
,
RescueStation
.
class
);
rescueStation
.
setRecUserId
(
RequestContext
.
getExeUserId
());
...
...
amos-boot-system-tzs/amos-boot-module-ys/amos-boot-module-ys-api/src/main/java/com/yeejoin/amos/boot/module/ys/api/vo/ImportYsEmergencyUnitVo.java
View file @
00ebf8c6
...
...
@@ -13,79 +13,79 @@ public class ImportYsEmergencyUnitVo {
/**
* 名称 .
*/
@ExcelProperty
(
value
=
"名称"
,
index
=
0
)
@ExcelProperty
(
value
=
"名称"
)
private
String
name
;
/**
* 关联消防队 .
*/
@ExcelProperty
(
value
=
"关联消防队"
,
index
=
1
)
@ExcelProperty
(
value
=
"关联消防队"
)
private
Integer
teamId
;
/**
* 地址 .
*/
@ExcelProperty
(
value
=
"地址"
,
index
=
2
)
@ExcelProperty
(
value
=
"地址"
)
private
String
address
;
/**
* 经纬度 .
*/
@ExcelProperty
(
value
=
"经纬度"
,
index
=
3
)
@ExcelProperty
(
value
=
"经纬度"
)
private
String
longitudeLatitude
;
/**
* 应急服务内容 .
*/
@ExcelProperty
(
value
=
"应急服务内容"
,
index
=
4
)
@ExcelProperty
(
value
=
"应急服务内容"
)
private
String
emergencyService
;
/**
* 单位传真 .
*/
@ExcelProperty
(
value
=
"单位传真"
,
index
=
5
)
@ExcelProperty
(
value
=
"单位传真"
)
private
String
fax
;
/**
* 保障能力 .
*/
@ExcelProperty
(
value
=
"保障能力"
,
index
=
6
)
@ExcelProperty
(
value
=
"保障能力"
)
private
String
guaranteeCapability
;
/**
* 保障类别 .
*/
@ExcelProperty
(
value
=
"保障类别"
,
index
=
7
)
@ExcelProperty
(
value
=
"保障类别"
)
private
String
guaranteeType
;
/**
* 联系人 .
*/
@ExcelProperty
(
value
=
"联系人"
,
index
=
8
)
@ExcelProperty
(
value
=
"联系人"
)
private
String
linkman
;
/**
* 部门代码 .
*/
@ExcelProperty
(
value
=
"部门代码"
,
index
=
9
)
@ExcelProperty
(
value
=
"部门代码"
)
private
String
orgCode
;
/**
* 单位概述 .
*/
@ExcelProperty
(
value
=
"单位概述"
,
index
=
10
)
@ExcelProperty
(
value
=
"单位概述"
)
private
String
overview
;
/**
* 负责人 .
*/
@ExcelProperty
(
value
=
"负责人"
,
index
=
11
)
@ExcelProperty
(
value
=
"负责人"
)
private
String
person
;
/**
* 联系电话 .
*/
@ExcelProperty
(
value
=
"联系电话"
,
index
=
12
)
@ExcelProperty
(
value
=
"联系电话"
)
private
String
phone
;
...
...
@@ -93,25 +93,25 @@ public class ImportYsEmergencyUnitVo {
/**
* 单位编号 .
*/
@ExcelProperty
(
value
=
"单位编号"
,
index
=
13
)
@ExcelProperty
(
value
=
"单位编号"
)
private
String
unitNum
;
/**
* 单位类型 .
*/
@ExcelProperty
(
value
=
"单位类型"
,
index
=
14
)
@ExcelProperty
(
value
=
"单位类型"
)
private
String
unitType
;
/**
* 行政区划编号 .
*/
@ExcelProperty
(
value
=
"行政区划编号"
,
index
=
15
)
@ExcelProperty
(
value
=
"行政区划编号"
)
private
String
xzqhbh
;
/**
* 类型 .
*/
@ExcelProperty
(
value
=
"type"
,
index
=
16
)
@ExcelProperty
(
value
=
"type"
)
private
String
type
;
}
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