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
e1feb7f9
Commit
e1feb7f9
authored
Oct 18, 2021
by
chenzhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://172.16.10.76/moa/amos-boot-biz
into developer
parents
20e2a67e
9019dd78
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
240 additions
and
67 deletions
+240
-67
RequestData.java
.../yeejoin/amos/boot/module/common/api/dto/RequestData.java
+3
-0
ExcelUtil.java
.../yeejoin/amos/boot/module/common/api/excel/ExcelUtil.java
+39
-14
DutyPersonShiftMapper.java
.../boot/module/common/api/mapper/DutyPersonShiftMapper.java
+4
-0
IOrgUsrService.java
...n/amos/boot/module/common/api/service/IOrgUsrService.java
+3
-0
DutyPersonShiftMapper.xml
...n-api/src/main/resources/mapper/DutyPersonShiftMapper.xml
+33
-0
AlertCalledZhDto.java
...eejoin/amos/boot/module/jcs/api/dto/AlertCalledZhDto.java
+2
-0
AlertCalledMapper.xml
...e-jcs-api/src/main/resources/mapper/AlertCalledMapper.xml
+11
-1
DutyFirstAidServiceImpl.java
...dule/common/biz/service/impl/DutyFirstAidServiceImpl.java
+27
-27
OrgUsrServiceImpl.java
...oot/module/common/biz/service/impl/OrgUsrServiceImpl.java
+8
-0
AlertSubmittedServiceImpl.java
...odule/jcs/biz/service/impl/AlertSubmittedServiceImpl.java
+7
-6
ExcelServiceImpl.java
...os/boot/module/jcs/biz/service/impl/ExcelServiceImpl.java
+103
-19
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/RequestData.java
View file @
e1feb7f9
...
...
@@ -45,4 +45,7 @@ public class RequestData {
@ApiModelProperty
(
value
=
"类型code"
)
private
String
alertTypeCode
;
@ApiModelProperty
(
value
=
"排序"
)
private
String
orderTime
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/excel/ExcelUtil.java
View file @
e1feb7f9
...
...
@@ -84,7 +84,7 @@ public class ExcelUtil {
*/
public
static
void
createDutyTemplate
(
HttpServletResponse
response
,
String
fileName
,
String
sheetName
,
List
<?
extends
Object
>
data
,
Class
<?>
model
,
List
<
String
>
dayByMonth
,
String
[]
dutyNameList
,
DataSources
dataDictionaryMapper
,
boolean
flag
,
boolean
typeFlag
)
{
DataSources
dataDictionaryMapper
,
boolean
flag
,
String
typeFlag
,
boolean
isTemplete
)
{
HorizontalCellStyleStrategy
horizontalCellStyleStrategy
=
setMyCellStyle
();
try
{
...
...
@@ -126,9 +126,12 @@ public class ExcelUtil {
}
// String s = new String(fileName.getBytes(), "UTF-8");
// response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(s, "UTF-8"));
ExcelWriterSheetBuilder
excelWriterSheetBuilder
=
null
;
;
if
(
typeFlag
)
{
ExcelWriterSheetBuilder
excelWriterSheetBuilder
=
EasyExcel
.
write
(
getOutputStream
(
fileName
,
response
,
ExcelTypeEnum
.
XLSX
))
.
head
(
dutyCarTitleList
)
.
excelType
(
ExcelTypeEnum
.
XLSX
).
sheet
(
sheetName
);
if
(
"WXXFZB"
.
equals
(
typeFlag
)
&&
isTemplete
)
{
List
<
Map
<
Integer
,
String
[]>>
fireStationExplicitListConstraintMap
=
new
ArrayList
<
Map
<
Integer
,
String
[]>>();
List
<
List
<
Object
>>
resultList
=
new
ArrayList
<
List
<
Object
>>();
data
.
stream
().
forEach
(
i
->
{
...
...
@@ -143,27 +146,49 @@ public class ExcelUtil {
detail
.
remove
(
detail
.
size
()-
1
);
resultList
.
add
(
detail
);
});
excelWriterSheetBuilder
=
EasyExcel
.
write
(
getOutputStream
(
fileName
,
response
,
ExcelTypeEnum
.
XLSX
))
.
head
(
dutyCarTitleList
)
.
excelType
(
ExcelTypeEnum
.
XLSX
).
sheet
(
sheetName
)
excelWriterSheetBuilder
.
registerWriteHandler
(
new
TemplateDynamicCellWriteHandlerDate
(
fireStationExplicitListConstraintMap
))
.
registerWriteHandler
(
new
TemplateCellWriteHandler
())
.
registerWriteHandler
(
horizontalCellStyleStrategy
);
excelWriterSheetBuilder
.
doWrite
(
resultList
);
}
else
if
(
"JJZB"
.
equals
(
typeFlag
)
&&
isTemplete
){
List
<
Map
<
Integer
,
String
[]>>
fireStationExplicitListConstraintMap
=
new
ArrayList
<
Map
<
Integer
,
String
[]>>();
List
<
List
<
Object
>>
resultList
=
new
ArrayList
<
List
<
Object
>>();
data
.
stream
().
forEach
(
i
->
{
Map
<
Integer
,
String
[]>
map
=
new
HashMap
<>();
List
<
Object
>
detail
=
(
List
<
Object
>)
i
;
// 微型消防站中的对应单位微型消防站下拉列表数据的集合
List
<
String
>
fireStationDetailList
=
(
List
<
String
>)
detail
.
get
(
detail
.
size
()-
1
);
String
[]
strings
=
new
String
[
fireStationDetailList
.
size
()];
List
<
String
>
postTypeNameDetailList
=
(
List
<
String
>)
detail
.
get
(
detail
.
size
()-
2
);
String
[]
postTypeNamestrings
=
new
String
[
postTypeNameDetailList
.
size
()];
List
<
String
>
userNameDetailList
=
(
List
<
String
>)
detail
.
get
(
detail
.
size
()-
3
);
String
[]
userNamestrings
=
new
String
[
userNameDetailList
.
size
()];
map
.
put
(
4
,
fireStationDetailList
.
toArray
(
strings
));
map
.
put
(
3
,
postTypeNameDetailList
.
toArray
(
postTypeNamestrings
));
map
.
put
(
2
,
userNameDetailList
.
toArray
(
userNamestrings
));
map
.
putAll
(
explicitListConstraintMap
);
fireStationExplicitListConstraintMap
.
add
(
map
);
detail
.
remove
(
detail
.
size
()-
1
);
detail
.
remove
(
detail
.
size
()-
1
);
detail
.
remove
(
detail
.
size
()-
1
);
resultList
.
add
(
detail
);
});
excelWriterSheetBuilder
.
registerWriteHandler
(
new
TemplateDynamicCellWriteHandlerDate
(
fireStationExplicitListConstraintMap
))
.
registerWriteHandler
(
new
TemplateCellWriteHandler
())
.
registerWriteHandler
(
horizontalCellStyleStrategy
);
excelWriterSheetBuilder
.
doWrite
(
resultList
);
}
else
{
excelWriterSheetBuilder
=
EasyExcel
.
write
(
getOutputStream
(
fileName
,
response
,
ExcelTypeEnum
.
XLSX
))
.
head
(
dutyCarTitleList
)
.
excelType
(
ExcelTypeEnum
.
XLSX
).
sheet
(
sheetName
)
}
else
{
excelWriterSheetBuilder
=
excelWriterSheetBuilder
.
registerWriteHandler
(
new
TemplateCellWriteHandlerDate
(
explicitListConstraintMap
))
.
registerWriteHandler
(
new
TemplateCellWriteHandler
())
.
registerWriteHandler
(
horizontalCellStyleStrategy
);
excelWriterSheetBuilder
.
doWrite
(
data
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"系统异常!"
);
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/DutyPersonShiftMapper.java
View file @
e1feb7f9
...
...
@@ -128,4 +128,8 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
* @return
*/
List
<
Map
<
String
,
Object
>>
getDutyForSpecifyDate
(
String
duty
);
Map
<
String
,
Object
>
getFireTeamBySequenceNbr
(
Long
sequenceNbr
);
List
<
Map
<
String
,
Object
>>
getFirstAidForTypeCodeAndCompanyId
(
Long
company
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IOrgUsrService.java
View file @
e1feb7f9
...
...
@@ -242,4 +242,7 @@ public interface IOrgUsrService {
public
List
<
OrgUsr
>
getPersonListByParentIds
(
List
<
String
>
ids
)
;
List
<
OrgUsrFormDto
>
getUnSyncOrgCompanyList
(
List
<
Long
>
companyIdList
);
public
OrgUsr
getDetailById
(
Long
id
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/DutyPersonShiftMapper.xml
View file @
e1feb7f9
...
...
@@ -308,4 +308,37 @@ AND NAME IS NOT NULL
GROUP BY
NAME
</select>
<select
id=
'getFireTeamBySequenceNbr'
resultType=
"map"
>
SELECT
name
FROM
cb_fire_team
WHERE
sequence_nbr = #{sequenceNbr} and is_delete=0
</select>
<select
id=
'getFirstAidForTypeCodeAndCompanyId'
resultType=
"map"
>
>
SELECT
name,
sequence_nbr
FROM
cb_fire_team
WHERE
company = #{company}
AND is_delete = 0
AND type_code = (
SELECT
CODE
FROM
cb_data_dictionary
WHERE
`name` = '企(事)业单位医疗救援队(站)'
AND type = 'XFJGLX'
)
</select>
</mapper>
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/dto/AlertCalledZhDto.java
View file @
e1feb7f9
...
...
@@ -56,6 +56,8 @@ public class AlertCalledZhDto {
@ApiModelProperty
(
value
=
"纬度"
)
private
String
latitude
;
@ApiModelProperty
(
value
=
"标题"
)
private
String
alertTypeName
;
@ApiModelProperty
(
value
=
"响应级别字典code 为了过滤用(只有航空器故障有)"
)
private
String
responseLevelCode
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/resources/mapper/AlertCalledMapper.xml
View file @
e1feb7f9
...
...
@@ -60,7 +60,17 @@
<if
test=
'par.whether24!=false'
>
and a.call_time
>
= (NOW() - interval 24 hour)
</if>
ORDER BY a.call_time DESC
<if
test=
'par.orderTime=="1"'
>
ORDER BY a.call_time DESC
</if>
<if
test=
'par.orderTime=="2"'
>
ORDER BY a.call_time
</if>
<if
test=
'par.orderTime==null'
>
ORDER BY a.call_time DESC
</if>
<if
test=
'pageNum!=null and pageSize !=null'
>
limit #{pageNum},#{pageSize}
</if>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyFirstAidServiceImpl.java
View file @
e1feb7f9
...
...
@@ -14,17 +14,13 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireTeam
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper
;
import
com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService
;
import
com.yeejoin.amos.boot.module.common.api.service.IFireTeamService
;
@Service
public
class
DutyFirstAidServiceImpl
extends
DutyCommonServiceImpl
implements
IDutyFirstAidService
{
@Autowired
IFireTeamService
fireTeamService
;
@Autowired
DutyPersonShiftMapper
dutyPersonShiftMapper
;
...
...
@@ -41,8 +37,11 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
@Override
public
DutyFirstAidDto
save
(
DutyFirstAidDto
dto
)
{
FireTeam
fireStationDtoResult
=
fireTeamService
.
getFireTeamBySequenceNbr
(
Long
.
parseLong
(
dto
.
getFirstAidId
()));
dto
.
setFirstAid
(
fireStationDtoResult
.
getName
());
Map
<
String
,
Object
>
fireStationDtoResult
=
dutyPersonShiftMapper
.
getFireTeamBySequenceNbr
(
Long
.
parseLong
(
dto
.
getFirstAidId
()));
if
(
fireStationDtoResult
==
null
||
!
fireStationDtoResult
.
containsKey
(
"name"
))
{
throw
new
RuntimeException
(
"此120急救站不存在"
);
}
dto
.
setFirstAid
(
fireStationDtoResult
.
get
(
"name"
).
toString
());
Map
<
String
,
Object
>
map
=
Bean
.
BeantoMap
(
dto
);
Long
instanceId
=
excuteDynamicFormInstance
(
dto
.
getUserId
(),
map
,
this
.
getGroupCode
());
saveDutyPersonShiftDetail
(
instanceId
,
dto
.
getDutyShift
(),
dto
.
getStartTime
());
...
...
@@ -114,35 +113,36 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
public
List
<
Map
<
String
,
Object
>>
getFirstAidExportData
(
List
<
String
>
ids
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
String
dicCodeString
=
"830"
;
String
typeString
=
"XFJGLX"
;
List
<
OrgUsr
>
personList
=
orgUsrServiceImpl
.
getPersonListByParentIds
(
ids
);
personList
.
stream
().
forEach
(
i
->
{
String
userNameString
=
i
.
getBizOrgName
()+
"@"
+
i
.
getSequenceNbr
();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
List
<
FireTeam
>
list
=
fireTeamService
.
getFirstAidForTypeCodeAndCompanyId
(
dicCodeString
,
typeString
,
Long
.
parseLong
(
i
.
getParentId
()));
List
<
String
>
firstAidSimpleList
=
new
ArrayList
<
String
>();
List
<
String
>
companySimpleList
=
new
ArrayList
<
String
>();
list
.
stream
().
forEach
(
m
->
{
String
firstAidNameString
=
m
.
getName
()
+
"@"
+
m
.
getSequenceNbr
();
String
companyNameString
=
m
.
getCompanyName
()
+
"@"
+
m
.
getCompany
();
firstAidSimpleList
.
add
(
firstAidNameString
);
companySimpleList
.
add
(
companyNameString
);
ids
.
stream
().
forEach
(
i
->{
Map
<
String
,
Object
>
detailMap
=
new
HashMap
<
String
,
Object
>();
List
<
OrgUsr
>
personList
=
orgUsrServiceImpl
.
getPersonListByParentId
(
Long
.
parseLong
(
i
));
List
<
String
>
userNameList
=
new
ArrayList
<
String
>();
personList
.
stream
().
forEach
(
m
->
{
String
userNameString
=
m
.
getBizOrgName
()+
"@"
+
m
.
getSequenceNbr
();
userNameList
.
add
(
userNameString
);
});
detailMap
.
put
(
"userName"
,
userNameList
);
OrgUsr
companyDetail
=
orgUsrServiceImpl
.
getDetailById
(
Long
.
parseLong
(
i
));
String
companyNameString
=
companyDetail
.
getBizOrgName
()+
"@"
+
companyDetail
.
getSequenceNbr
();
detailMap
.
put
(
"companyName"
,
companyNameString
);
List
<
DataDictionary
>
dataDicList
=
dataDictionaryService
.
getByType
(
typeString
);
List
<
String
>
dataDicSimpleList
=
new
ArrayList
<
String
>();
dataDicList
.
stream
().
forEach
(
l
->{
String
dataDic
=
l
.
getName
()
+
"@"
+
l
.
getCode
();
dataDicSimpleList
.
add
(
dataDic
);
});
map
.
put
(
"firstAidName"
,
firstAidSimpleList
);
map
.
put
(
"companyName"
,
companySimpleList
);
map
.
put
(
"userName"
,
userNameString
);
map
.
put
(
"postTypeName"
,
dataDicSimpleList
);
resultList
.
add
(
map
);
detailMap
.
put
(
"postTypeName"
,
dataDicSimpleList
);
List
<
Map
<
String
,
Object
>>
list
=
dutyPersonShiftMapper
.
getFirstAidForTypeCodeAndCompanyId
(
Long
.
parseLong
(
i
));
List
<
String
>
firstAidSimpleList
=
new
ArrayList
<
String
>();
list
.
stream
().
forEach
(
m
->
{
String
firstAidNameString
=
m
.
get
(
"name"
).
toString
()
+
"@"
+
m
.
get
(
"sequence_nbr"
).
toString
();
firstAidSimpleList
.
add
(
firstAidNameString
);
});
detailMap
.
put
(
"firstAidName"
,
firstAidSimpleList
);
resultList
.
add
(
detailMap
);
});
return
resultList
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/OrgUsrServiceImpl.java
View file @
e1feb7f9
...
...
@@ -1733,4 +1733,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
return
allUnSyncCompanyList
;
}
public
OrgUsr
getDetailById
(
Long
id
){
LambdaQueryWrapper
<
OrgUsr
>
queryWrapper
=
new
LambdaQueryWrapper
<
OrgUsr
>();
queryWrapper
.
eq
(
OrgUsr:
:
getIsDelete
,
false
);
queryWrapper
.
eq
(
OrgUsr:
:
getSequenceNbr
,
id
);
return
this
.
baseMapper
.
selectOne
(
queryWrapper
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/AlertSubmittedServiceImpl.java
View file @
e1feb7f9
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
...
...
@@ -10,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
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.dto.FormValue
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersPost
;
import
com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto
;
...
...
@@ -25,11 +27,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto;
import
com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.Template
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.*
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum
;
import
com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum
;
...
...
@@ -99,7 +97,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired
EquipFeignClient
equipFeignClient
;
@Autowired
PowerTransferCompanyResourcesServiceImpl
powerTransferCompanyResourcesService
;
@Autowired
AlertSubmittedMapper
alertSubmittedMapper
;
...
...
@@ -360,6 +359,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
// 更新所有车辆状态为执勤
equipFeignClient
.
updateCarStatus
(
carStatusInfoDtoList
);
//跟车辆状态
powerTransferCompanyResourcesService
.
update
(
new
UpdateWrapper
<
PowerTransferCompanyResources
>().
eq
(
"resources_id"
,
transferCarIdList
).
set
(
"status"
,
FireCarStatusEnum
.
返队
.
getCode
()));
}
// 4.发送任务消息
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/ExcelServiceImpl.java
View file @
e1feb7f9
...
...
@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import
com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto
;
...
...
@@ -186,7 +187,7 @@ public class ExcelServiceImpl {
@Autowired
OrgUsrSafeReportServiceImpl
orgUsrSafeReportService
;
@Autowired
IDutyFirstAidService
dutyFirstAidService
;
...
...
@@ -331,6 +332,9 @@ public class ExcelServiceImpl {
case
"XFAQBG"
:
excelImportSafeReport
(
multipartFile
);
break
;
case
"JJZB"
:
excelImportDutyPerson
(
multipartFile
,
"JJZB"
);
break
;
}
return
;
}
...
...
@@ -951,8 +955,65 @@ public class ExcelServiceImpl {
}
else
if
(
ExcelEnums
.
WXXFZB
.
getType
().
equals
(
dutyType
))
{
initDutyFireFightingData
(
sheet
,
dataList
,
dayByMonth
);
dutyFireFightingService
.
saveImportData
(
dataList
);
}
else
if
(
ExcelEnums
.
JJZB
.
getType
().
equals
(
dutyType
))
{
initDutyFirstAidData
(
sheet
,
dataList
,
dayByMonth
);
dutyFireFightingService
.
saveImportData
(
dataList
);
}
}
}
private
void
initDutyFirstAidData
(
XSSFSheet
sheet
,
List
<
Map
<
String
,
Object
>>
dataList
,
List
<
Date
>
dayByMonth
)
{
for
(
int
i
=
1
;
i
<
sheet
.
getPhysicalNumberOfRows
();
i
++)
{
DutyFirstAidDto
dutyFirstAidDto
=
new
DutyFirstAidDto
();
// row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
Row
row
=
sheet
.
getRow
(
i
);
if
(
row
==
null
)
{
continue
;
}
Cell
cell
=
row
.
getCell
(
2
);
if
(
cell
==
null
)
{
continue
;
}
cell
=
row
.
getCell
(
1
);
if
(
cell
!=
null
)
{
String
[]
split
=
cell
.
toString
().
split
(
"@"
);
dutyFirstAidDto
.
setTeamId
(
split
[
1
]);
dutyFirstAidDto
.
setTeamName
(
split
[
0
]);
}
cell
=
row
.
getCell
(
2
);
if
(
cell
!=
null
)
{
String
[]
splitStr
=
cell
.
toString
().
split
(
"@"
);
dutyFirstAidDto
.
setUserName
(
splitStr
[
0
]);
dutyFirstAidDto
.
setUserId
(
splitStr
[
1
]);
}
cell
=
row
.
getCell
(
3
);
if
(
cell
!=
null
)
{
String
[]
splitStr
=
cell
.
toString
().
split
(
"@"
);
dutyFirstAidDto
.
setPostTypeName
(
splitStr
[
0
]);
dutyFirstAidDto
.
setPostType
(
splitStr
[
1
]);
}
cell
=
row
.
getCell
(
4
);
if
(
cell
!=
null
)
{
String
[]
splitStr
=
cell
.
toString
().
split
(
"@"
);
dutyFirstAidDto
.
setFirstAid
(
splitStr
[
0
]);
dutyFirstAidDto
.
setFirstAidId
(
splitStr
[
1
]);
}
List
<
DutyPersonShiftDto
>
dutyShift
=
new
ArrayList
<>();
for
(
int
j
=
0
;
j
<
dayByMonth
.
size
();
j
++)
{
cell
=
row
.
getCell
(
5
+
j
);
String
dutyType
=
cell
==
null
?
""
:
cell
.
toString
();
if
(!
StringUtils
.
isEmpty
(
dutyType
))
{
DutyPersonShiftDto
dutyPersonShiftDto
=
new
DutyPersonShiftDto
();
dutyPersonShiftDto
.
setDutyDate
(
dayByMonth
.
get
(
j
));
dutyPersonShiftDto
.
setShiftId
(
Long
.
valueOf
(
dutyType
.
split
(
"@"
)[
1
]));
dutyShift
.
add
(
dutyPersonShiftDto
);
}
}
dutyFirstAidDto
.
setDutyShift
(
dutyShift
);
Map
<
String
,
Object
>
dutyPersonDtoMap
=
Bean
.
BeantoMap
(
dutyFirstAidDto
);
dataList
.
add
(
dutyPersonDtoMap
);
}
}
private
void
excelImportSafeReport
(
MultipartFile
multipartFile
)
throws
Exception
{
...
...
@@ -965,10 +1026,11 @@ public class ExcelServiceImpl {
&&
!
fileName
.
toLowerCase
().
endsWith
(
ExcelTypeEnum
.
XLSX
.
getValue
()))
{
throw
new
Exception
(
"文件类型异常!"
);
}
List
<
OrgUsrSafeReportExcelDto
>
excelDtoList
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
OrgUsrSafeReportExcelDto
.
class
,
1
);
List
<
OrgUsrSafeReportExcelDto
>
excelDtoList
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
OrgUsrSafeReportExcelDto
.
class
,
1
);
List
<
OrgUsrSafeReport
>
excelEntityList
=
new
ArrayList
<>();
excelDtoList
.
forEach
(
fireExpertsDto
->
{
OrgUsrSafeReport
reportExcel
=
new
OrgUsrSafeReport
();
OrgUsrSafeReport
reportExcel
=
new
OrgUsrSafeReport
();
reportExcel
=
Bean
.
toPo
(
fireExpertsDto
,
reportExcel
);
reportExcel
=
Bean
.
toPo
(
getCurrentInfo
(),
reportExcel
);
if
(
reportExcel
.
getCompany
()
!=
null
)
{
...
...
@@ -1192,19 +1254,16 @@ public class ExcelServiceImpl {
}
else
if
(
ExcelEnums
.
WXXFZB
.
getType
().
equals
(
excelDto
.
getType
()))
{
data
=
initDutyDutyFireFightingTemplate
(
ids
);
}
else
if
(
ExcelEnums
.
JJZB
.
getType
().
equals
(
excelDto
.
getType
()))
{
//
data = initDutyDutyFirstAidTemplate(ids);
data
=
initDutyDutyFirstAidTemplate
(
ids
);
}
// 获取日期
List
<
Map
<
String
,
Object
>>
rangeDate
=
dutyPersonShiftService
.
getBaseMapper
().
genRangeDate
(
beginDate
,
endDate
);
List
<
String
>
dayByMonth
=
new
ArrayList
<>();
rangeDate
.
forEach
(
item
->
dayByMonth
.
add
((
String
)
item
.
get
(
"date"
)));
if
(
ExcelEnums
.
WXXFZB
.
getType
().
equals
(
excelDto
.
getType
()))
{
exportDutyTemplate
(
response
,
excelDto
.
getClassUrl
(),
dayByMonth
,
excelDto
,
data
,
true
,
true
);
}
else
{
exportDutyTemplate
(
response
,
excelDto
.
getClassUrl
(),
dayByMonth
,
excelDto
,
data
,
true
,
false
);
}
exportDutyTemplate
(
response
,
excelDto
.
getClassUrl
(),
dayByMonth
,
excelDto
,
data
,
true
,
excelDto
.
getType
(),
true
);
}
private
List
<
List
<
Object
>>
initDutyDutyFirstAidTemplate
(
String
ids
)
{
List
<
List
<
Object
>>
data
=
new
ArrayList
<>();
// 根据id列表获取单位下的微型消防站集合
...
...
@@ -1219,15 +1278,16 @@ public class ExcelServiceImpl {
personDetailList
.
forEach
(
o
->
{
ArrayList
<
Object
>
list
=
new
ArrayList
<>();
list
.
add
(
row
.
getAndIncrement
());
list
.
add
(
null
);
list
.
add
(
null
);
list
.
add
(
null
);
list
.
add
(
o
.
get
(
"fir
eStation
"
));
list
.
add
(
o
.
get
(
"companyName"
)
);
list
.
add
(
o
.
get
(
"userName"
)
);
list
.
add
(
o
.
get
(
"postTypeName"
)
);
list
.
add
(
o
.
get
(
"fir
stAidName
"
));
data
.
add
(
list
);
});
}
return
data
;
}
private
List
<
List
<
Object
>>
initDutyDutyFireFightingTemplate
(
String
ids
)
{
List
<
List
<
Object
>>
data
=
new
ArrayList
<>();
// 根据id列表获取单位下的微型消防站集合
...
...
@@ -1265,13 +1325,37 @@ public class ExcelServiceImpl {
}
else
if
(
ExcelEnums
.
RYZB
.
getType
().
equals
(
excelDto
.
getType
()))
{
data
=
initDutyPersonInfo
(
beginDate
,
endDate
,
dayByMonth
);
}
else
if
(
ExcelEnums
.
WXXFZB
.
getType
().
equals
(
excelDto
.
getType
()))
{
data
=
initDutyDutyFireFightingTemplate
(
beginDate
,
endDate
,
dayByMonth
);
data
=
initDutyDutyFireFighting
(
beginDate
,
endDate
,
dayByMonth
);
}
else
if
(
ExcelEnums
.
JJZB
.
getType
().
equals
(
excelDto
.
getType
()))
{
data
=
initDutyDutyFirstAid
(
beginDate
,
endDate
,
dayByMonth
);
}
exportDutyTemplate
(
response
,
excelDto
.
getClassUrl
(),
dayByMonth
,
excelDto
,
data
,
false
,
false
);
exportDutyTemplate
(
response
,
excelDto
.
getClassUrl
(),
dayByMonth
,
excelDto
,
data
,
false
,
ExcelEnums
.
WXXFZB
.
getType
(),
false
);
}
private
List
<
List
<
Object
>>
initDutyDutyFirstAid
(
String
beginDate
,
String
endDate
,
List
<
String
>
dayByMonth
)
throws
ParseException
{
List
<
DutyFirstAidDto
>
list
=
dutyFirstAidService
.
downloadList
(
beginDate
,
endDate
);
List
<
List
<
Object
>>
data
=
new
ArrayList
<>();
// 组装导出数据
if
(!
list
.
isEmpty
())
{
AtomicInteger
row
=
new
AtomicInteger
(
1
);
list
.
forEach
(
o
->
{
ArrayList
<
Object
>
detailList
=
new
ArrayList
<>();
detailList
.
add
(
row
.
getAndIncrement
());
detailList
.
add
(
o
.
getTeamName
());
detailList
.
add
(
o
.
getUserName
());
detailList
.
add
(
o
.
getPostTypeName
());
detailList
.
add
(
o
.
getFirstAid
());
List
<
DutyPersonShiftDto
>
dutyShift
=
o
.
getDutyShift
();
initDutyShift
(
dayByMonth
,
dutyShift
,
detailList
);
data
.
add
(
detailList
);
});
}
return
data
;
}
private
List
<
List
<
Object
>>
initDutyDutyFireFighting
Template
(
String
beginDate
,
String
endDate
,
private
List
<
List
<
Object
>>
initDutyDutyFireFighting
(
String
beginDate
,
String
endDate
,
List
<
String
>
dayByMonth
)
throws
ParseException
{
List
<
DutyFireFightingDto
>
list
=
dutyFireFightingService
.
downloadList
(
beginDate
,
endDate
);
...
...
@@ -1352,13 +1436,13 @@ public class ExcelServiceImpl {
}
private
void
exportDutyTemplate
(
HttpServletResponse
response
,
String
classUrl
,
List
<
String
>
dayByMonth
,
ExcelDto
excelDto
,
List
<?
extends
Object
>
data
,
Boolean
flag
,
Boolean
typeFlag
)
{
ExcelDto
excelDto
,
List
<?
extends
Object
>
data
,
Boolean
flag
,
String
typeFlag
,
boolean
isTemplete
)
{
try
{
// 获取排班类型
String
[]
dutyNameList
=
getDutyNameList
();
Class
<?>
clz
=
Class
.
forName
(
classUrl
);
ExcelUtil
.
createDutyTemplate
(
response
,
excelDto
.
getFileName
(),
excelDto
.
getSheetName
(),
data
,
clz
,
dayByMonth
,
dutyNameList
,
dataSourcesImpl
,
flag
,
typeFlag
);
dayByMonth
,
dutyNameList
,
dataSourcesImpl
,
flag
,
typeFlag
,
isTemplete
);
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
...
...
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