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
b4b85e94
Commit
b4b85e94
authored
Dec 14, 2022
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加应急救援小组相关接口
parent
8ab1cb2e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
314 additions
and
0 deletions
+314
-0
OrganizationExportDto.java
...n/amos/boot/module/jcs/api/dto/OrganizationExportDto.java
+30
-0
OrganizationUserExportDto.java
...os/boot/module/jcs/api/dto/OrganizationUserExportDto.java
+27
-0
OrganizationMapper.java
...n/amos/boot/module/jcs/api/mapper/OrganizationMapper.java
+15
-0
OrganizationService.java
...amos/boot/module/jcs/api/service/OrganizationService.java
+10
-0
OrganizationMapper.xml
...-jcs-api/src/main/resources/mapper/OrganizationMapper.xml
+51
-0
OrganizationController.java
...oot/module/jcs/biz/controller/OrganizationController.java
+119
-0
OrganizationImpl.java
...os/boot/module/jcs/biz/service/impl/OrganizationImpl.java
+62
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/dto/OrganizationExportDto.java
0 → 100644
View file @
b4b85e94
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
api
.
dto
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
lombok.Data
;
@Data
public
class
OrganizationExportDto
{
@ColumnWidth
(
40
)
@ExcelProperty
(
value
=
"*应急救援小组名称"
,
index
=
0
)
private
String
emergencyTeamName
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"小组职责"
,
index
=
1
)
private
String
duty
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"*组长"
,
index
=
2
)
private
String
groupLeader
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"组长电话"
,
index
=
3
)
private
String
groupLeaderTel
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"副组长"
,
index
=
4
)
private
String
deputyGroupLeader
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"副组长电话"
,
index
=
5
)
private
String
deputyGroupLeaderTel
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/dto/OrganizationUserExportDto.java
0 → 100644
View file @
b4b85e94
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
lombok.Data
;
@Data
public
class
OrganizationUserExportDto
{
@ColumnWidth
(
40
)
@ExcelProperty
(
value
=
"*应急救援小组名称"
,
index
=
0
)
private
String
emergencyTeamName
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"*组员姓名"
,
index
=
1
)
private
String
memberName
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"组员岗位"
,
index
=
2
)
private
String
postName
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"*组员电话"
,
index
=
3
)
private
String
telephone
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/mapper/OrganizationMapper.java
View file @
b4b85e94
...
...
@@ -3,9 +3,12 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.entity.Firefighters
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.Organization
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -13,4 +16,16 @@ public interface OrganizationMapper extends BaseMapper<Organization> {
Page
<
Map
<
String
,
Object
>>
getOrganizationInfo
(
Page
<
Map
<
String
,
Object
>>
page
,
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
Page
<
Map
<
String
,
Object
>>
getOrganizationList
(
Page
<
Map
<
String
,
Object
>>
page
,
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
Page
<
Map
<
String
,
Object
>>
getOrganizationGroup
(
Page
<
Map
<
String
,
Object
>>
page
,
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
OrganizationExportDto
>
selectOrganization
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
OrganizationUserExportDto
>
selectOrganizationUserList
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
int
selectMaxSort
();
}
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/service/OrganizationService.java
View file @
b4b85e94
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
api
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -9,4 +12,11 @@ public interface OrganizationService {
Page
<
Map
<
String
,
Object
>>
getOrganizationInfo
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
);
Page
<
Map
<
String
,
Object
>>
getOrganizationList
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
);
List
<
OrganizationExportDto
>
selectOrganization
(
String
bizOrgCode
);
List
<
OrganizationUserExportDto
>
selectOrganizationUserList
(
String
bizOrgCode
);
void
saveOrganization
(
List
<
OrganizationExportDto
>
data
,
List
<
OrganizationUserExportDto
>
userData
,
String
bizOrgCode
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/resources/mapper/OrganizationMapper.xml
View file @
b4b85e94
...
...
@@ -67,4 +67,55 @@
LIMIT 4
)
</select>
<select
id=
"getOrganizationList"
resultType=
"java.util.Map"
>
SELECT
co.emergency_team_id as groupId,
co.emergency_team_name as emergencyTeamName,
cou.member_name as memberName ,
cou.post_name as postName,
cou.telephone,
co.duty
FROM
cb_organization co
LEFT JOIN cb_organization_user cou ON co.sequence_nbr = cou.emergency_team_id
where co.biz_org_code like concat(#{bizOrgCode}, '%')
</select>
<select
id=
"getOrganizationGroup"
resultType=
"java.util.Map"
>
SELECT
co.sequence_nbr as id,
co.duty
FROM
cb_organization co
LEFT JOIN cb_organization_user cou ON co.sequence_nbr = cou.emergency_team_id
where co.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY co.sequence_nbr
</select>
<select
id=
"selectOrganization"
resultType=
"com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto"
>
SELECT
co.emergency_team_name AS emergencyTeamName,
co.duty,
co.group_leader AS groupLeader,
co.group_leader_tel AS groupLeaderTel,
co.deputy_group_leader AS deputyGroupLeader,
co.deputy_group_leader_tel AS deputyGroupLeaderTel
FROM
cb_organization co
WHERE
co.biz_org_code LIKE concat( #{bizOrgCode}, '%' )
</select>
<select
id=
"selectOrganizationUserList"
resultType=
"com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto"
>
SELECT
cou.emergency_team_name AS emergencyTeamName,
cou.member_name as memberName,
cou.post_name AS postName,
cou.telephone
FROM
cb_organization_user cou
</select>
<select
id=
"selectMaxSort"
resultType=
"java.lang.Integer"
>
SELECT MAX(sort) FROM cb_organization
</select>
</mapper>
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/OrganizationController.java
View file @
b4b85e94
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelReader
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.read.builder.ExcelReaderSheetBuilder
;
import
com.alibaba.excel.read.metadata.ReadSheet
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto
;
import
com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
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
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@RestController
...
...
@@ -56,5 +72,108 @@ public class OrganizationController extends BaseController {
return
CommonResponseUtil
.
success
(
organizationService
.
getOrganizationInfo
(
mapPage
,
bizOrgCode
));
}
@PersonIdentify
@GetMapping
(
value
=
"/getOrganizationList"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"四横八纵"
,
notes
=
"四横八纵-组织列表"
)
public
ResponseModel
getOrganizationList
(
@RequestParam
(
value
=
"pageNumber"
)
int
pageNumber
,
@RequestParam
(
value
=
"pageSize"
)
int
pageSize
)
{
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
String
bizOrgCode
=
null
;
if
(
null
!=
reginParam
)
{
bizOrgCode
=
reginParam
.
getPersonIdentity
().
getBizOrgCode
();
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
return
CommonResponseUtil
.
success
(
null
);
}
}
else
{
return
CommonResponseUtil
.
success
(
null
);
}
Page
<
Map
<
String
,
Object
>>
mapPage
=
new
Page
<>(
pageNumber
,
pageSize
);
return
CommonResponseUtil
.
success
(
organizationService
.
getOrganizationList
(
mapPage
,
bizOrgCode
));
}
@PersonIdentify
@GetMapping
(
value
=
"/export"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"四横八纵"
,
notes
=
"四横八纵-组织机构导出"
)
public
void
export
(
HttpServletResponse
response
)
{
String
file_name
=
null
;
try
{
file_name
=
new
String
(
"组织机构信息"
.
getBytes
(),
"ISO-8859-1"
);
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
file_name
+
".xlsx"
);
List
<
OrganizationExportDto
>
firstSheetVOS
=
new
ArrayList
<>();
List
<
OrganizationUserExportDto
>
secondSheetVOS
=
new
ArrayList
<>();
// 表一写入
ExcelWriter
writer
=
EasyExcel
.
write
(
response
.
getOutputStream
(),
OrganizationExportDto
.
class
).
build
();
WriteSheet
sheet
=
EasyExcel
.
writerSheet
(
0
,
"应急救援小组"
).
build
();
writer
.
write
(
firstSheetVOS
,
sheet
);
// 表二写入
WriteSheet
sheet2
=
EasyExcel
.
writerSheet
(
1
,
"组员"
).
head
(
OrganizationUserExportDto
.
class
).
build
();
writer
.
write
(
secondSheetVOS
,
sheet2
);
// 关闭流
writer
.
finish
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@PersonIdentify
@GetMapping
(
value
=
"/exportData"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"四横八纵"
,
notes
=
"四横八纵-组织机构导出"
)
public
void
exportData
(
@RequestParam
(
"bizOrgCode"
)
String
bizOrgCode
,
HttpServletResponse
response
)
{
String
file_name
=
null
;
try
{
file_name
=
new
String
(
"组织机构信息"
.
getBytes
(),
"ISO-8859-1"
);
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
file_name
+
".xlsx"
);
// 应急小组信息
List
<
OrganizationExportDto
>
organizationList
=
organizationService
.
selectOrganization
(
bizOrgCode
);
// 应急小组人员信息
List
<
OrganizationUserExportDto
>
organizationUserList
=
organizationService
.
selectOrganizationUserList
(
bizOrgCode
);
// 应急小组写入
ExcelWriter
writer
=
EasyExcel
.
write
(
response
.
getOutputStream
(),
OrganizationExportDto
.
class
).
build
();
WriteSheet
sheet
=
EasyExcel
.
writerSheet
(
0
,
"应急救援小组"
).
build
();
writer
.
write
(
organizationList
,
sheet
);
// 组员写入
WriteSheet
sheet2
=
EasyExcel
.
writerSheet
(
1
,
"组员"
).
head
(
OrganizationUserExportDto
.
class
).
build
();
writer
.
write
(
organizationUserList
,
sheet2
);
// 关闭流
writer
.
finish
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@PersonIdentify
@GetMapping
(
value
=
"/upload"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"四横八纵"
,
notes
=
"四横八纵-组织机构导入"
)
public
ResponseModel
upload
(
@RequestParam
(
"bizOrgCode"
)
String
bizOrgCode
,
MultipartFile
file
)
{
try
{
ExcelReader
reader
=
EasyExcel
.
read
(
file
.
getInputStream
()).
build
();
List
<
OrganizationExportDto
>
organizationList
=
ExcelUtil
.
readExcel
(
reader
,
OrganizationExportDto
.
class
,
0
);
List
<
OrganizationUserExportDto
>
organizationUserList
=
ExcelUtil
.
readExcel
(
reader
,
OrganizationUserExportDto
.
class
,
1
);
organizationService
.
saveOrganization
(
organizationList
,
organizationUserList
,
bizOrgCode
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
CommonResponseUtil
.
failure
();
}
return
CommonResponseUtil
.
success
();
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/OrganizationImpl.java
View file @
b4b85e94
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.Organization
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser
;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationMapper
;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationUserMapper
;
import
com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -15,8 +25,60 @@ public class OrganizationImpl implements OrganizationService {
@Autowired
private
OrganizationMapper
organizationMapper
;
@Autowired
private
OrganizationUserMapper
organizationUserMapper
;
@Override
public
Page
<
Map
<
String
,
Object
>>
getOrganizationInfo
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
)
{
return
organizationMapper
.
getOrganizationInfo
(
page
,
bizOrgCode
);
}
@Override
public
Page
<
Map
<
String
,
Object
>>
getOrganizationList
(
Page
<
Map
<
String
,
Object
>>
page
,
String
bizOrgCode
)
{
Page
<
Map
<
String
,
Object
>>
groupPage
=
new
Page
<>();
Page
<
Map
<
String
,
Object
>>
group
=
organizationMapper
.
getOrganizationGroup
(
groupPage
,
bizOrgCode
);
Page
<
Map
<
String
,
Object
>>
mapPage
=
organizationMapper
.
getOrganizationList
(
page
,
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
records
=
group
.
getRecords
();
ArrayList
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
record
:
records
)
{
List
<
Map
<
String
,
Object
>>
collect
=
mapPage
.
getRecords
().
stream
().
filter
(
item
->
String
.
valueOf
(
record
.
get
(
"id"
)).
equals
(
String
.
valueOf
(
item
.
get
(
"groupId"
)))).
collect
(
Collectors
.
toList
());
record
.
put
(
"persons"
,
collect
);
result
.
add
(
record
);
}
mapPage
.
setRecords
(
result
);
return
mapPage
;
}
@Override
public
List
<
OrganizationExportDto
>
selectOrganization
(
String
bizOrgCode
)
{
return
organizationMapper
.
selectOrganization
(
bizOrgCode
);
}
@Override
public
List
<
OrganizationUserExportDto
>
selectOrganizationUserList
(
String
bizOrgCode
)
{
return
organizationMapper
.
selectOrganizationUserList
(
bizOrgCode
);
}
@Override
@Transactional
public
void
saveOrganization
(
List
<
OrganizationExportDto
>
data
,
List
<
OrganizationUserExportDto
>
userData
,
String
bizOrgCode
)
{
int
sort
=
organizationMapper
.
selectMaxSort
();
for
(
OrganizationExportDto
dto
:
data
)
{
Organization
organization
=
new
Organization
();
BeanUtils
.
copyProperties
(
dto
,
organization
);
sort
=
sort
+
1
;
organization
.
setSort
(
sort
);
organization
.
setBizOrgCode
(
bizOrgCode
);
organizationMapper
.
insert
(
organization
);
List
<
OrganizationUserExportDto
>
collect
=
userData
.
stream
().
filter
(
item
->
item
.
getEmergencyTeamName
().
equals
(
dto
.
getEmergencyTeamName
())).
collect
(
Collectors
.
toList
());
for
(
OrganizationUserExportDto
userExportDto
:
collect
)
{
OrganizationUser
organizationUser
=
new
OrganizationUser
();
BeanUtils
.
copyProperties
(
userExportDto
,
organizationUser
);
organizationUser
.
setEmergencyTeamId
(
String
.
valueOf
(
organization
.
getSequenceNbr
()));
organizationUserMapper
.
insert
(
organizationUser
);
}
}
}
}
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