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
d69e8b47
Commit
d69e8b47
authored
Jul 08, 2021
by
付培阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消防人员导入导出
parent
2b5deeb5
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
536 additions
and
237 deletions
+536
-237
FireTeamDto.java
.../yeejoin/amos/boot/module/common/api/dto/FireTeamDto.java
+1
-0
FirefightersExcelDto.java
...amos/boot/module/common/api/dto/FirefightersExcelDto.java
+173
-0
ExcelSelectData.java
...in/amos/boot/module/common/api/enums/ExcelSelectData.java
+2
-0
FirefightersMapper.java
...mos/boot/module/common/api/mapper/FirefightersMapper.java
+14
-11
IFirefightersService.java
.../boot/module/common/api/service/IFirefightersService.java
+17
-9
FirefightersMapper.xml
...mmon-api/src/main/resources/mapper/FirefightersMapper.xml
+61
-43
ExcelEnums.java
...om/yeejoin/amos/boot/module/jcs/api/enums/ExcelEnums.java
+1
-0
FirefightersServiceImpl.java
...dule/common/biz/service/impl/FirefightersServiceImpl.java
+63
-41
ExcelController.java
.../amos/boot/module/jcs/biz/controller/ExcelController.java
+56
-10
FirefightersController.java
...oot/module/jcs/biz/controller/FirefightersController.java
+125
-123
DataSourcesImpl.java
...mos/boot/module/jcs/biz/service/impl/DataSourcesImpl.java
+23
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/FireTeamDto.java
View file @
d69e8b47
...
...
@@ -38,6 +38,7 @@ public class FireTeamDto extends BaseDto {
@ApiModelProperty
(
value
=
"机构code"
)
private
String
companyCode
;
@ExplicitConstraint
(
indexNum
=
1
,
sourceClass
=
RoleNameExplicitConstraint
.
class
,
method
=
"getFireTeam"
)
//动态下拉内容
@ExcelProperty
(
value
=
"上级单位"
,
index
=
1
)
@ApiModelProperty
(
value
=
"父级名称"
)
private
String
parentName
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/FirefightersExcelDto.java
0 → 100644
View file @
d69e8b47
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint
;
import
com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* 消防队员
*
* @author tb
* @date 2021-06-07
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"FirefightersDto"
,
description
=
"消防队员"
)
public
class
FirefightersExcelDto
extends
BaseDto
{
@ExcelIgnore
private
static
final
long
serialVersionUID
=
1L
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"系统账号"
)
private
String
systemAccount
;
@ExcelProperty
(
value
=
"姓名"
,
index
=
0
)
@ApiModelProperty
(
value
=
"姓名"
)
private
String
name
;
@ExcelProperty
(
value
=
"员工编码"
,
index
=
1
)
@ApiModelProperty
(
value
=
"员工编码"
)
private
String
employeeNumber
;
@ExplicitConstraint
(
indexNum
=
2
,
sourceClass
=
RoleNameExplicitConstraint
.
class
,
method
=
"getFireTeam"
)
//动态下拉内容
@ExcelProperty
(
value
=
"消防队伍"
,
index
=
2
)
@ApiModelProperty
(
value
=
"队伍"
)
private
String
fireTeam
;
@ExcelProperty
(
value
=
"所属部门"
,
index
=
3
)
@ApiModelProperty
(
value
=
"所属机构"
)
private
String
company
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"机构code"
)
private
String
companyCode
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"机构名称"
)
private
String
companyName
;
@ExplicitConstraint
(
type
=
"RYZJLX"
,
indexNum
=
4
,
sourceClass
=
RoleNameExplicitConstraint
.
class
)
//动态下拉内容
@ExcelProperty
(
value
=
"证件类型"
,
index
=
4
)
@ApiModelProperty
(
value
=
"常用证件类型代码"
)
private
String
certificatesType
;
@ExcelProperty
(
value
=
"证件号码"
,
index
=
5
)
@ApiModelProperty
(
value
=
"证件号码"
)
private
String
certificateNumber
;
@ExcelProperty
(
value
=
"出生日期"
,
index
=
6
)
@ApiModelProperty
(
value
=
"出生日期"
)
private
Date
birthdayTime
;
@ExplicitConstraint
(
indexNum
=
7
,
source
=
{
"男"
,
"女"
})
//固定下拉内容
@ExcelProperty
(
value
=
"性别"
,
index
=
5
)
@ApiModelProperty
(
value
=
"性别"
)
private
String
gender
;
@ExplicitConstraint
(
indexNum
=
8
,
sourceClass
=
RoleNameExplicitConstraint
.
class
,
method
=
"getNations"
)
//固定下拉内容
@ExcelProperty
(
value
=
"民族"
,
index
=
8
)
@ApiModelProperty
(
value
=
"民族"
)
private
String
nation
;
@ExplicitConstraint
(
indexNum
=
9
,
sourceClass
=
RoleNameExplicitConstraint
.
class
,
method
=
"getMaritalStatus"
)
//固定下拉内容
@ExcelProperty
(
value
=
"婚姻状况"
,
index
=
9
)
@ApiModelProperty
(
value
=
"婚姻状况"
)
private
String
maritalStatus
;
@ExcelProperty
(
value
=
"户籍所在地"
,
index
=
10
)
@ApiModelProperty
(
value
=
"籍贯/户口所在地"
)
private
String
nativePlace
;
@ExplicitConstraint
(
indexNum
=
11
,
sourceClass
=
RoleNameExplicitConstraint
.
class
,
method
=
"getPoliticalOutlook"
)
//固定下拉内容
@ExcelProperty
(
value
=
"政治面貌"
,
index
=
11
)
@ApiModelProperty
(
value
=
"政治面貌代码"
)
private
String
politicalOutlook
;
@ExcelProperty
(
value
=
"现居住地"
,
index
=
12
)
@ApiModelProperty
(
value
=
"现居住地"
)
private
String
residence
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"现居住地详情"
)
private
String
residenceDetails
;
@ExcelProperty
(
value
=
"机场住宿情况"
,
index
=
13
)
@ApiModelProperty
(
value
=
"机场住宿情况"
)
private
String
airportAccommodation
;
@ExcelProperty
(
value
=
"联系电话"
,
index
=
14
)
@ApiModelProperty
(
value
=
"手机"
)
private
String
mobilePhone
;
@ExplicitConstraint
(
type
=
"RYZT"
,
indexNum
=
15
,
sourceClass
=
RoleNameExplicitConstraint
.
class
)
//动态下拉内容
@ExcelProperty
(
value
=
"人员状态"
,
index
=
15
)
@ApiModelProperty
(
value
=
"人员状态,在职/离职"
)
private
String
state
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"人员状态,在职/离职字典code"
)
private
String
stateCode
;
@ExplicitConstraint
(
type
=
"GWMC"
,
indexNum
=
16
,
sourceClass
=
RoleNameExplicitConstraint
.
class
)
//动态下拉内容
@ExcelProperty
(
value
=
"岗位名称"
,
index
=
16
)
@ApiModelProperty
(
value
=
"岗位名称"
)
private
String
jobTitle
;
@ExcelProperty
(
value
=
"紧急联系人姓名"
,
index
=
17
)
@ApiModelProperty
(
value
=
"紧急联系人姓名"
)
private
String
emergencyContact
;
@ExplicitConstraint
(
type
=
"RJGX"
,
indexNum
=
18
,
sourceClass
=
RoleNameExplicitConstraint
.
class
)
//动态下拉内容
@ExcelProperty
(
value
=
"与紧急联系人关系"
,
index
=
18
)
@ApiModelProperty
(
value
=
"紧急联系人与本人所属关系"
)
private
String
relationship
;
@ExcelProperty
(
value
=
"紧急联系人电话"
,
index
=
19
)
@ApiModelProperty
(
value
=
"紧急联系人电话"
)
private
String
emergencyContactPhone
;
@ExcelProperty
(
value
=
"身份证正面"
,
index
=
20
)
@ApiModelProperty
(
value
=
"身份证正面"
)
private
String
idPositive
;
@ExcelProperty
(
value
=
"身份证反面"
,
index
=
21
)
@ApiModelProperty
(
value
=
"身份证反面"
)
private
String
idReverse
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"办公电话"
)
private
String
officeTelephone
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"互联网_电子信箱"
)
private
String
email
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"人员照片"
)
private
String
personnelPhotos
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"操作人名称"
)
private
String
recUserName
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"岗位资质"
)
private
String
postQualification
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"专家领域"
)
private
String
areasExpertise
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/enums/ExcelSelectData.java
View file @
d69e8b47
...
...
@@ -14,5 +14,6 @@ public class ExcelSelectData {
"高山族"
};
public
static
final
String
[]
POLITICAL_OUTLOOK
=
{
"中共党员"
,
"中共预备党员"
,
"共青团员"
,
"民革会员"
,
"民盟盟员"
,
"民建会员"
,
"民进会员"
,
"农工党党员"
,
"致公党党员"
,
"九三学社社员"
,
"台盟盟员"
,
"无党派人士"
,
"群众"
};
public
static
final
String
[]
MARITAL_STATUS
=
{
"未婚"
,
"已婚"
,
"离异"
,
"丧偶"
,
"再婚"
,
"恋爱中"
};
}
\ No newline at end of file
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/FirefightersMapper.java
View file @
d69e8b47
...
...
@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto
;
import
org.apache.ibatis.annotations.Param
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
...
@@ -11,22 +13,23 @@ import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import
com.yeejoin.amos.boot.module.common.api.entity.Firefighters
;
/**
* 消防队员 Mapper 接口
*
* @author tb
* @date 2021-06-07
*/
* 消防队员 Mapper 接口
*
* @author tb
* @date 2021-06-07
*/
public
interface
FirefightersMapper
extends
BaseMapper
<
Firefighters
>
{
List
<
Firefighters
>
getFirefighters
(
@Param
(
"pageNum"
)
int
pageNum
,
@Param
(
"pageSize"
)
int
pageSize
,
@Param
(
"par"
)
FirefightersDto
par
);
Map
<
String
,
Long
>
getFirefightersCount
(
@Param
(
"pageNum"
)
int
pageNum
,
@Param
(
"pageSize"
)
int
pageSize
,
@Param
(
"par"
)
FirefightersDto
par
);
Map
<
String
,
Object
>
listToSelectById
(
@Param
(
"id"
)
Long
id
);
List
<
FirefightersTreeDto
>
getFirefightersJobTitleCount
();
List
<
Firefighters
>
getFirefighters
(
@Param
(
"pageNum"
)
int
pageNum
,
@Param
(
"pageSize"
)
int
pageSize
,
@Param
(
"par"
)
FirefightersDto
par
);
Map
<
String
,
Long
>
getFirefightersCount
(
@Param
(
"pageNum"
)
int
pageNum
,
@Param
(
"pageSize"
)
int
pageSize
,
@Param
(
"par"
)
FirefightersDto
par
);
Map
<
String
,
Object
>
listToSelectById
(
@Param
(
"id"
)
Long
id
);
List
<
FirefightersTreeDto
>
getFirefightersJobTitleCount
();
List
<
FirefightersExcelDto
>
exportToExcel
(
Boolean
isDelete
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IFirefightersService.java
View file @
d69e8b47
...
...
@@ -5,19 +5,27 @@ import java.util.Map;
import
com.yeejoin.amos.boot.biz.common.utils.Menu
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.Firefighters
;
/**
* 消防队员 服务类
*
* @author tb
* @date 2021-06-07
*/
* 消防队员 服务类
*
* @author tb
* @date 2021-06-07
*/
public
interface
IFirefightersService
{
List
<
Firefighters
>
getFirefighters
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
);
Map
<
String
,
Long
>
getFirefightersCount
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
);
Map
<
String
,
Object
>
listToSelectById
(
Long
id
);
List
<
Menu
>
getFirefightersJobTitleCount
()
throws
Exception
;
List
<
Firefighters
>
getFirefighters
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
);
Map
<
String
,
Long
>
getFirefightersCount
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
);
Map
<
String
,
Object
>
listToSelectById
(
Long
id
);
List
<
Menu
>
getFirefightersJobTitleCount
()
throws
Exception
;
void
saveFirefighters
(
FirefightersInfoDto
firefighters
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/FirefightersMapper.xml
View file @
d69e8b47
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper"
>
namespace=
"com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper"
>
<select
id=
"getFirefightersJobTitleCount"
resultType=
"com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto"
>
select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode
from cb_firefighters a
where a.is_delete = 0
GROUP BY a.job_title_code
</select>
<select
id=
"getFirefighters"
resultType=
"com.yeejoin.amos.boot.module.common.api.entity.Firefighters"
>
select a.* from cb_firefighters a LEFT JOIN cb_firefighters_post b on
a.sequence_nbr=b.firefighters_id where a.is_delete=0
<if
test=
'par.postQualification!=null'
>
and b.post_qualification_code = #{par.postQualification}
</if>
<if
test=
'par.areasExpertise!=null'
>
and b.areas_expertise_code= #{par.areasExpertise}"
</if>
<if
test=
'par.name!=null'
>
and a.name= #{par.name}
</if>
<if
test=
'par.state!=null'
>
and a.state_code= #{par.state}
</if>
<if
test=
'par.fireTeamId!=null'
>
and a.fire_team_id= #{par.fireTeamId}
</if>
<if
test=
'par.jobTitle!=null'
>
and a.job_title_code =#{par.jobTitle}
</if>
limit #{pageNum},#{pageSize}
</select>
<select
id=
"getFirefighters"
resultType=
"com.yeejoin.amos.boot.module.common.api.entity.Firefighters"
>
select a.* from cb_firefighters a LEFT JOIN cb_firefighters_post b on
a.sequence_nbr=b.firefighters_id where a.is_delete=0
<if
test=
'par.postQualification!=null'
>
and b.post_qualification_code = #{par.postQualification}
</if>
<if
test=
'par.areasExpertise!=null'
>
and b.areas_expertise_code= #{par.areasExpertise}"
</if>
<if
test=
'par.name!=null'
>
and a.name= #{par.name}
</if>
<if
test=
'par.state!=null'
>
and a.state_code= #{par.state}
</if>
<if
test=
'par.fireTeamId!=null'
>
and a.fire_team_id= #{par.fireTeamId}
</if>
<if
test=
'par.jobTitle!=null'
>
and a.job_title_code =#{par.jobTitle}
</if>
limit #{pageNum},#{pageSize}
</select>
<select
id=
"getFirefightersCount"
resultType=
"Map"
>
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
a.is_delete=0
<if
test=
'par.postQualification!=null'
>
and b.post_qualification_code = #{par.postQualification}
</if>
<if
test=
'par.areasExpertise!=null'
>
and b.areas_expertise_code= #{par.areasExpertise}"
</if>
<if
test=
'par.name!=null'
>
and a.name= #{par.name}
</if>
<if
test=
'par.state!=null'
>
and a.state_code= #{par.state}
</if>
<if
test=
'par.fireTeamId!=null'
>
and a.fire_team_id= #{par.fireTeamId}
</if>
<if
test=
'par.jobTitle!=null'
>
and a.job_title_code =#{par.jobTitle}
</if>
</select>
<select
id=
"getFirefightersCount"
resultType=
"Map"
>
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
a.is_delete=0
<if
test=
'par.postQualification!=null'
>
and b.post_qualification_code = #{par.postQualification}
</if>
<if
test=
'par.areasExpertise!=null'
>
and b.areas_expertise_code= #{par.areasExpertise}"
</if>
<if
test=
'par.name!=null'
>
and a.name= #{par.name}
</if>
<if
test=
'par.state!=null'
>
and a.state_code= #{par.state}
</if>
<if
test=
'par.fireTeamId!=null'
>
and a.fire_team_id= #{par.fireTeamId}
</if>
<if
test=
'par.jobTitle!=null'
>
and a.job_title_code =#{par.jobTitle}
</if>
</select>
<select
id=
"listToSelectById"
resultType=
"Map"
>
SELECT IFNULL(a.personnel_photos,'') personnelPhotos, a.sequence_nbr
sequenceNbr,IFNULL(a.`name`,'无')`name`, IFNULL(a.job_title,'无')
jobTitle, IFNULL(b.administrative_position,'无')
administrativePosition, IFNULL(c.`name`,'无') fireTeamName,
IFNULL(a.state,'无') state, IFNULL(b.employee_hierarchy,'无')
employeeHierarchy, IFNULL(b.areas_expertise,'无') areasExpertise,
IFNULL(a.gender,'无') gender, IFNULL(b.post_qualification,'无')
postQualification,year( from_days( datediff( now( ),
a.birthday_time))) age
FROM cb_firefighters a LEFT JOIN cb_firefighters_post b ON a.sequence_nbr
= b.firefighters_id LEFT JOIN cb_fire_team c on
c.sequence_nbr=a.fire_team_id WHERE a.is_delete =0
and a.sequence_nbr=#{id}
</select>
<select
id=
"getFirefightersJobTitleCount"
resultType=
"com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto"
>
select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode from cb_firefighters a where a.is_delete=0 GROUP BY a.job_title_code
</select>
<select
id=
"listToSelectById"
resultType=
"Map"
>
SELECT IFNULL(a.personnel_photos, '') personnelPhotos,
a.sequence_nbr
sequenceNbr,
IFNULL(a.`name`, '无') `name`,
IFNULL(a.job_title, '无')
jobTitle,
IFNULL(b.administrative_position, '无')
administrativePosition,
IFNULL(c.`name`, '无') fireTeamName,
IFNULL(a.state, '无') state,
IFNULL(b.employee_hierarchy, '无')
employeeHierarchy,
IFNULL(b.areas_expertise, '无') areasExpertise,
IFNULL(a.gender, '无') gender,
IFNULL(b.post_qualification, '无')
postQualification, year ( from_days( datediff( now( ),
a.birthday_time))) age
FROM cb_firefighters a LEFT JOIN cb_firefighters_post b
ON a.sequence_nbr
= b.firefighters_id LEFT JOIN cb_fire_team c on
c.sequence_nbr=a.fire_team_id
WHERE a.is_delete =0
and a.sequence_nbr=#{id}
</select>
<select
id=
"exportToExcel"
resultType=
"com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto"
>
select f.*, emergency_contact, relationship, emergency_contact_phone
from cb_firefighters f
left join cb_firefighters_contacts fc on f.sequence_nbr = fc.firefighters_id
where f.is_delete = #{isDelete}
</select>
</mapper>
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/enums/ExcelEnums.java
View file @
d69e8b47
...
...
@@ -10,4 +10,5 @@ public class ExcelEnums {
public
static
final
String
HKQ
=
"HKQ"
;
//("HKQ","航空器");
public
static
final
String
XFDW
=
"XFDW"
;
//("XFDW","消防队伍")
public
static
final
String
WXXFZ
=
"WXXFZ"
;
//("WXXFZ","微型消防站")
public
static
final
String
XFRY
=
"XFRY"
;
//("XFRY","消防人员")
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/FirefightersServiceImpl.java
View file @
d69e8b47
...
...
@@ -4,21 +4,21 @@ import java.util.Collection;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.annotation.Condition
;
import
org.typroject.tyboot.core.rdbms.annotation.Operator
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto
;
import
com.yeejoin.amos.boot.biz.common.utils.Menu
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.TreeParser
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DataDictionary
;
import
com.yeejoin.amos.boot.module.common.api.entity.Firefighters
;
import
com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper
;
import
com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper
;
import
com.yeejoin.amos.boot.module.common.api.service.IFirefightersService
;
...
...
@@ -29,41 +29,63 @@ import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
* @date 2021-06-07
*/
@Service
public
class
FirefightersServiceImpl
extends
BaseService
<
FirefightersDto
,
Firefighters
,
FirefightersMapper
>
implements
IFirefightersService
{
@Autowired
FirefightersMapper
firefightersMapper
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Override
public
List
<
Firefighters
>
getFirefighters
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
)
{
return
firefightersMapper
.
getFirefighters
(
pageNum
,
pageSize
,
par
);
}
@Override
public
Map
<
String
,
Long
>
getFirefightersCount
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
)
{
// TODO Auto-generated method stub
return
firefightersMapper
.
getFirefightersCount
(
pageNum
,
pageSize
,
par
);
}
@Override
public
Map
<
String
,
Object
>
listToSelectById
(
Long
id
)
{
// TODO Auto-generated method stub
return
firefightersMapper
.
listToSelectById
(
id
);
}
@Override
public
List
<
Menu
>
getFirefightersJobTitleCount
()
throws
Exception
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"GWMC"
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
firefightersMapper
.
getFirefightersJobTitleCount
());
return
menus
;
}
public
class
FirefightersServiceImpl
extends
BaseService
<
FirefightersDto
,
Firefighters
,
FirefightersMapper
>
implements
IFirefightersService
{
@Autowired
FirefightersMapper
firefightersMapper
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
FirefightersContactsServiceImpl
firefightersContactsService
;
@Override
public
List
<
Firefighters
>
getFirefighters
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
)
{
return
firefightersMapper
.
getFirefighters
(
pageNum
,
pageSize
,
par
);
}
@Override
public
Map
<
String
,
Long
>
getFirefightersCount
(
int
pageNum
,
int
pageSize
,
FirefightersDto
par
)
{
// TODO Auto-generated method stub
return
firefightersMapper
.
getFirefightersCount
(
pageNum
,
pageSize
,
par
);
}
@Override
public
Map
<
String
,
Object
>
listToSelectById
(
Long
id
)
{
// TODO Auto-generated method stub
return
firefightersMapper
.
listToSelectById
(
id
);
}
@Override
public
void
saveFirefighters
(
FirefightersInfoDto
firefighters
)
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
save
(
firefighter
);
FirefightersContacts
firefightersContact
=
firefighters
.
getFirefightersContacts
();
firefightersContact
.
setFirefightersId
(
firefighter
.
getSequenceNbr
());
firefightersContactsService
.
save
(
firefightersContact
);
firefighters
.
setFirefightersContacts
(
firefightersContact
);
firefighters
.
setFirefighters
(
firefighter
);
}
/**
* 导出列表
*/
public
List
<
FirefightersExcelDto
>
exportToExcel
(
@Condition
(
Operator
.
eq
)
Boolean
isDelete
)
{
return
firefightersMapper
.
exportToExcel
(
isDelete
);
}
@Override
public
List
<
Menu
>
getFirefightersJobTitleCount
()
throws
Exception
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"GWMC"
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
firefightersMapper
.
getFirefightersJobTitleCount
());
return
menus
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/ExcelController.java
View file @
d69e8b47
...
...
@@ -6,10 +6,8 @@ import java.util.List;
import
javax.servlet.http.HttpServletResponse
;
import
com.yeejoin.amos.boot.module.common.api.dto.*
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireExperts
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireStation
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireTeam
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FireStationServiceImpl
;
import
com.yeejoin.amos.boot.module.common.api.entity.*
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.*
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,11 +21,7 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireChemical
;
import
com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FireChemicalServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums
;
import
com.yeejoin.amos.boot.module.jcs.biz.service.impl.AircraftServiceImpl
;
...
...
@@ -61,6 +55,8 @@ public class ExcelController extends BaseController {
FireTeamServiceImpl
fireTeamService
;
@Autowired
FireStationServiceImpl
fireStationService
;
@Autowired
FirefightersServiceImpl
firefightersService
;
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
...
...
@@ -113,8 +109,12 @@ public class ExcelController extends BaseController {
case
ExcelEnums
.
WXXFZ
:
List
<
FireStationDto
>
fireStationDtoList
=
fireStationService
.
queryForFireStationList
(
false
);
ExcelUtil
.
createTemplate
(
response
,
excelDto
.
getFileName
(),
excelDto
.
getSheetName
(),
fireStationDtoList
,
FireStationDto
.
class
,
null
,
false
);
fireStationDtoList
,
FireStationDto
.
class
,
null
,
false
);
break
;
case
ExcelEnums
.
XFRY
:
List
<
FirefightersExcelDto
>
firefightersExcelDtoList
=
firefightersService
.
exportToExcel
(
false
);
ExcelUtil
.
createTemplate
(
response
,
excelDto
.
getFileName
(),
excelDto
.
getSheetName
(),
firefightersExcelDtoList
,
FirefightersExcelDto
.
class
,
null
,
false
);
break
;
}
}
catch
(
Exception
e
)
{
...
...
@@ -147,6 +147,10 @@ public class ExcelController extends BaseController {
break
;
case
ExcelEnums
.
WXXFZ
:
excelImportFireStation
(
multipartFile
);
break
;
case
ExcelEnums
.
XFRY
:
excelImportFirefighters
(
multipartFile
);
break
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -154,6 +158,44 @@ public class ExcelController extends BaseController {
}
}
private
void
excelImportFirefighters
(
MultipartFile
multipartFile
)
throws
Exception
{
List
<
FirefightersExcelDto
>
excelDtoList
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
FirefightersExcelDto
.
class
,
1
);
excelDtoList
.
forEach
(
item
->
{
Firefighters
firefighters
=
new
Firefighters
();
FirefightersContacts
firefightersContacts
=
new
FirefightersContacts
();
firefighters
=
Bean
.
toPo
(
item
,
firefighters
);
firefightersContacts
=
Bean
.
toPo
(
item
,
firefightersContacts
);
if
(
item
.
getFireTeam
()
!=
null
)
{
Long
fireTeamId
=
Long
.
valueOf
(
item
.
getFireTeam
().
split
(
"@"
)[
1
]);
firefighters
.
setFireTeamId
(
fireTeamId
);
}
if
(
firefighters
.
getCertificatesType
()
!=
null
)
{
String
[]
certificates
=
firefighters
.
getCertificatesType
().
split
(
"@"
);
firefighters
.
setCertificatesType
(
certificates
[
0
]);
firefighters
.
setCertificatesTypeCode
(
certificates
[
1
]);
}
if
(
firefighters
.
getState
()
!=
null
)
{
String
[]
state
=
firefighters
.
getState
().
split
(
"@"
);
firefighters
.
setState
(
state
[
0
]);
firefighters
.
setStateCode
(
state
[
1
]);
}
if
(
firefighters
.
getJobTitle
()
!=
null
)
{
String
[]
jobTitle
=
firefighters
.
getJobTitle
().
split
(
"@"
);
firefighters
.
setJobTitle
(
jobTitle
[
0
]);
firefighters
.
setJobTitleCode
(
jobTitle
[
1
]);
}
if
(
firefightersContacts
.
getRelationship
()
!=
null
)
{
String
relationship
=
firefightersContacts
.
getRelationship
().
split
(
"@"
)[
1
];
firefightersContacts
.
setRelationship
(
relationship
);
}
FirefightersInfoDto
firefightersInfo
=
new
FirefightersInfoDto
(
firefighters
,
firefightersContacts
);
firefightersService
.
saveFirefighters
(
firefightersInfo
);
}
);
}
private
void
excelImportFireStation
(
MultipartFile
multipartFile
)
throws
Exception
{
List
<
FireStationDto
>
excelDtoList
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
FireStationDto
.
class
,
1
);
List
<
FireStation
>
excelEntityList
=
new
ArrayList
<>();
...
...
@@ -195,6 +237,10 @@ public class ExcelController extends BaseController {
fireTeam
.
setContactUser
(
contactUser
[
0
]);
fireTeam
.
setContactUserId
(
Long
.
valueOf
(
contactUser
[
1
]));
}
if
(
item
.
getParentName
()
!=
null
)
{
String
[]
parentName
=
item
.
getParentName
().
split
(
"@"
);
fireTeam
.
setParent
(
Long
.
valueOf
(
parentName
[
1
]));
}
excelEntityList
.
add
(
fireTeam
);
}
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/FirefightersController.java
View file @
d69e8b47
...
...
@@ -52,11 +52,11 @@ import io.swagger.annotations.ApiOperation;
/**
* 消防队员
*
* @author tb
* @date 2021-06-07
*/
* 消防队员
*
* @author tb
* @date 2021-06-07
*/
@RestController
@Api
(
tags
=
"消防队员Api"
)
@RequestMapping
(
value
=
"/firefighters"
)
...
...
@@ -82,145 +82,143 @@ public class FirefightersController extends BaseController {
private
long
time
;
/**
* 新增消防队员
* @return
*/
* 新增消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防队员"
,
notes
=
"新增消防队员"
)
@Transactional
public
ResponseModel
<
FirefightersInfoDto
>
saveFirefighters
(
@RequestBody
FirefightersInfoDto
firefighters
){
try
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
iFirefightersService
.
save
(
firefighter
);
FirefightersContacts
firefightersContact
=
firefighters
.
getFirefightersContacts
();
firefightersContact
.
setFirefightersId
(
firefighter
.
getSequenceNbr
());
ifirefightersContactsService
.
save
(
firefightersContact
);
firefighters
.
setFirefightersContacts
(
firefightersContact
);
firefighters
.
setFirefighters
(
firefighter
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
public
ResponseModel
<
FirefightersInfoDto
>
saveFirefighters
(
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
iFirefightersService
.
saveFirefighters
(
firefighters
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
}
/**
* 根据id删除
* @param id
* @return
*/
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@Transactional
public
ResponseModel
<
Object
>
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
QueryWrapper
<
FirefightersJacket
>
queryWrapper
=
new
QueryWrapper
<>(
);
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
List
<
FirefightersJacket
>
firefightersJacket
=
iFirefightersJacketService
.
list
(
queryWrapper
);
if
(
firefightersJacket
!=
null
)
{
throw
new
RuntimeException
(
"该消防还有在装装备!"
);
}
try
{
iFirefightersService
.
update
(
new
UpdateWrapper
<
Firefighters
>().
eq
(
"sequence_nbr"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersPostService
.
update
(
new
UpdateWrapper
<
FirefightersPost
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersContactsService
.
update
(
new
UpdateWrapper
<
FirefightersContacts
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersEducationService
.
update
(
new
UpdateWrapper
<
FirefightersEducation
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersThoughtService
.
update
(
new
UpdateWrapper
<
FirefightersThough
t
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersContractService
.
update
(
new
UpdateWrapper
<
FirefightersContract
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersJacketService
.
update
(
new
UpdateWrapper
<
FirefightersJacket
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
public
ResponseModel
<
Object
>
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
QueryWrapper
<
FirefightersJacket
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
List
<
FirefightersJacket
>
firefightersJacket
=
iFirefightersJacketService
.
list
(
queryWrapper
);
if
(
firefightersJacket
!=
null
)
{
throw
new
RuntimeException
(
"该消防还有在装装备!"
);
}
try
{
iFirefightersService
.
update
(
new
UpdateWrapper
<
Firefighters
>().
eq
(
"sequence_nbr"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersPostService
.
update
(
new
UpdateWrapper
<
FirefightersPost
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersContactsService
.
update
(
new
UpdateWrapper
<
FirefightersContacts
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersEducationService
.
update
(
new
UpdateWrapper
<
FirefightersEducation
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersThoughtService
.
update
(
new
UpdateWrapper
<
FirefightersThought
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersContractService
.
update
(
new
UpdateWrapper
<
FirefightersContrac
t
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersJacketService
.
update
(
new
UpdateWrapper
<
FirefightersJacket
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
//删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"删除失败!"
);
}
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"删除失败!"
);
}
}
/**
* 修改消防队员
* @return
*/
* 修改消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防队员"
,
notes
=
"修改消防队员"
)
@Transactional
public
ResponseModel
<
Object
>
updateByIdFirefighters
(
HttpServletRequest
request
,
@RequestBody
FirefightersInfoDto
firefighters
){
try
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
iFirefightersService
.
updateById
(
firefighter
);
ifirefightersContactsService
.
updateById
(
firefighters
.
getFirefightersContacts
());
//删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
firefighter
.
getSequenceNbr
(),
RedisKey
.
FIREFIGHTERS_LIST_ID
+
firefighter
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
}
public
ResponseModel
<
Object
>
updateByIdFirefighters
(
HttpServletRequest
request
,
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
iFirefightersService
.
updateById
(
firefighter
);
ifirefightersContactsService
.
updateById
(
firefighters
.
getFirefightersContacts
());
//删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
firefighter
.
getSequenceNbr
(),
RedisKey
.
FIREFIGHTERS_LIST_ID
+
firefighter
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
}
/**
* 根据id查询
* @param id
* @return
*/
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_ID
+
id
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Firefighters
firefighters
=
iFirefightersService
.
getById
(
id
);
QueryWrapper
<
FirefightersContacts
>
queryWrapper
=
new
QueryWrapper
<>();
}
else
{
Firefighters
firefighters
=
iFirefightersService
.
getById
(
id
);
QueryWrapper
<
FirefightersContacts
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
FirefightersContacts
firefightersContacts
=
ifirefightersContactsService
.
getOne
(
queryWrapper
);
FirefightersInfoDto
firefightersInfoDto
=
new
FirefightersInfoDto
(
firefighters
,
firefightersContacts
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
JSON
.
toJSON
(
firefightersInfoDto
),
time
);
FirefightersContacts
firefightersContacts
=
ifirefightersContactsService
.
getOne
(
queryWrapper
);
FirefightersInfoDto
firefightersInfoDto
=
new
FirefightersInfoDto
(
firefighters
,
firefightersContacts
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
JSON
.
toJSON
(
firefightersInfoDto
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersInfoDto
);
}
}
/**
* 列表详情展示
*
* */
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表详情根据id查询"
,
notes
=
"列表详情根据id查询"
)
public
ResponseModel
<
Object
>
listToSelectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
public
ResponseModel
<
Object
>
listToSelectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Map
<
String
,
Object
>
firefighters
=
iFirefightersService
.
listToSelectById
(
id
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
,
JSON
.
toJSON
(
firefighters
),
time
);
}
else
{
Map
<
String
,
Object
>
firefighters
=
iFirefightersService
.
listToSelectById
(
id
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
,
JSON
.
toJSON
(
firefighters
),
time
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
}
/**
* 列表分页查询
* @return
*/
* 列表分页查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
Firefighters
>
listPage
(
String
pageNum
,
String
pageSize
,
Firefighters
firefighters
)
{
Page
<
Firefighters
>
pageBean
;
public
IPage
<
Firefighters
>
listPage
(
String
pageNum
,
String
pageSize
,
Firefighters
firefighters
)
{
Page
<
Firefighters
>
pageBean
;
QueryWrapper
<
Firefighters
>
firefightersQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
Firefighters
>
aClass
=
firefighters
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
...
...
@@ -240,13 +238,14 @@ public class FirefightersController extends BaseController {
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
if
(!
name
.
equals
(
NameUtils
.
camel2Underline
(
"serialVersionUID"
)))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}}
if
(!
name
.
equals
(
NameUtils
.
camel2Underline
(
"serialVersionUID"
)))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
throw
new
RuntimeException
(
"系统异常"
);
}
});
IPage
<
Firefighters
>
page
;
...
...
@@ -256,41 +255,44 @@ public class FirefightersController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iFirefightersService
.
page
(
pageBean
,
firefightersQueryWrapper
);
return
page
;
}
return
page
;
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefighters"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"新列表分页查询"
,
notes
=
"新表分页查询"
)
public
ResponseModel
<
Page
<
Firefighters
>
>
getFirefighters
(
Integer
pageNum
,
Integer
pageSize
,
FirefightersDto
firefighters
){
//条件分页
public
ResponseModel
<
Page
<
Firefighters
>>
getFirefighters
(
Integer
pageNum
,
Integer
pageSize
,
FirefightersDto
firefighters
)
{
//条件分页
if
(
null
==
pageNum
||
null
==
pageSize
)
{
pageNum
=
1
;
pageSize
=
Integer
.
MAX_VALUE
;
}
List
<
Firefighters
>
list
=
iFirefightersService
.
getFirefighters
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Map
<
String
,
Long
>
num
=
iFirefightersService
.
getFirefightersCount
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
List
<
Firefighters
>
list
=
iFirefightersService
.
getFirefighters
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Map
<
String
,
Long
>
num
=
iFirefightersService
.
getFirefightersCount
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Page
<
Firefighters
>
pageBean
=
new
Page
<>(
pageNum
,
pageSize
,
num
.
get
(
"num"
));
pageBean
.
setRecords
(
list
);
return
ResponseHelper
.
buildResponse
(
pageBean
);
}
/**
* 岗位树,带统计
* @param id
*
* @param
* @return
* @throws Exception
* @throws Exception
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefightersJobTitleCount"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
getFirefightersJobTitleCount
()
throws
Exception
{
List
<
Menu
>
menus
=
iFirefightersService
.
getFirefightersJobTitleCount
();
return
ResponseHelper
.
buildResponse
(
menus
);
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefightersJobTitleCount"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
getFirefightersJobTitleCount
()
throws
Exception
{
List
<
Menu
>
menus
=
iFirefightersService
.
getFirefightersJobTitleCount
();
return
ResponseHelper
.
buildResponse
(
menus
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/DataSourcesImpl.java
View file @
d69e8b47
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.utils.MenuFrom
;
import
com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DataDictionary
;
...
...
@@ -35,6 +39,8 @@ public class DataSourcesImpl implements DataSources {
OrgUsrServiceImpl
orgUsrService
;
@Autowired
FirefightersServiceImpl
firefightersService
;
@Autowired
FireTeamServiceImpl
fireTeamService
;
@Autowired
...
...
@@ -83,11 +89,28 @@ public class DataSourcesImpl implements DataSources {
case
"getBizCompanyList"
:
str
=
getBizCompanyList
();
break
;
case
"getFireTeam"
:
str
=
getFireTeam
();
break
;
case
"getMaritalStatus"
:
str
=
ExcelSelectData
.
MARITAL_STATUS
;
}
}
return
str
;
}
private
String
[]
getFireTeam
()
{
Page
<
FireTeamCardDto
>
pageBean
=
new
Page
<>(
1
,
Integer
.
MAX_VALUE
);
IPage
<
FireTeamCardDto
>
fireTeamCardDtoIPage
=
fireTeamService
.
listFireTeamByPage
(
pageBean
,
new
FireTeamListDto
());
List
<
FireTeamCardDto
>
records
=
fireTeamCardDtoIPage
.
getRecords
();
List
<
String
>
names
=
records
.
stream
().
map
(
item
->
{
return
item
.
getName
()
+
"@"
+
item
.
getSequenceNbr
();
}).
collect
(
Collectors
.
toList
());
String
[]
str
=
names
.
toArray
(
new
String
[
names
.
size
()]);
return
str
;
}
private
String
[]
getBizCompanyList
()
throws
Exception
{
List
<
OrgMenuDto
>
orgUsrTree
=
orgUsrService
.
getTree
(
null
,
orgUsrService
.
selectCompanyDepartmentMsg
(),
OrgUsr
.
class
.
getName
(),
"getSequenceNbr"
,
2
,
"getBizOrgName"
,
"getParentId"
,
"getBizOrgType"
);
...
...
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