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
b0c6ee8b
Commit
b0c6ee8b
authored
Feb 24, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加建筑导入接口
parent
d4163dea
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
295 additions
and
0 deletions
+295
-0
BuildingImportDto.java
...com/yeejoin/equipmanage/common/dto/BuildingImportDto.java
+59
-0
BuildingController.java
...om/yeejoin/equipmanage/controller/BuildingController.java
+20
-0
FormInstanceMapper.java
...va/com/yeejoin/equipmanage/mapper/FormInstanceMapper.java
+7
-0
IBuilldService.java
.../java/com/yeejoin/equipmanage/service/IBuilldService.java
+8
-0
BuildingServiceImpl.java
...yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
+198
-0
FormInstanceMapper.xml
...em-equip/src/main/resources/mapper/FormInstanceMapper.xml
+3
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/dto/BuildingImportDto.java
0 → 100644
View file @
b0c6ee8b
package
com
.
yeejoin
.
equipmanage
.
common
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.ColumnWidth
;
import
lombok.Data
;
@Data
public
class
BuildingImportDto
{
@ColumnWidth
(
40
)
@ExcelProperty
(
value
=
"数据类型"
,
index
=
0
)
private
String
dataType
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"建筑类型"
,
index
=
1
)
private
String
buildingType
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"编号"
,
index
=
2
)
private
String
code
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"建筑类别"
,
index
=
3
)
private
String
buildingCategory
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"建筑地址"
,
index
=
4
)
private
String
buildingAddress
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"建筑名称"
,
index
=
5
)
private
String
buildName
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"所在建筑"
,
index
=
6
)
private
String
inWhichBuild
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"建造日期"
,
index
=
7
)
private
String
buildDate
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"保护对象"
,
index
=
8
)
private
String
protectedObjects
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"责任人"
,
index
=
9
)
private
String
dutyUser
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"投用日期"
,
index
=
10
)
private
String
putDate
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"维保单位"
,
index
=
11
)
private
String
maintenanceCompany
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"每班人数"
,
index
=
12
)
private
String
personNumber
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"安装位置描述"
,
index
=
13
)
private
String
locationDescription
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"火灾预案(有、无)"
,
index
=
14
)
private
String
firePlan
;
@ColumnWidth
(
25
)
@ExcelProperty
(
value
=
"消防控制室操作人员持证数"
,
index
=
15
)
private
String
licensesNumber
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/BuildingController.java
View file @
b0c6ee8b
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelReader
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.equipmanage.common.dto.OrgUsrDto
;
import
com.yeejoin.equipmanage.common.utils.CommonResponseUtil
;
import
com.yeejoin.equipmanage.config.PersonIdentify
;
import
com.yeejoin.equipmanage.fegin.JcsFeign
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.lang3.ObjectUtils
;
...
...
@@ -25,6 +33,8 @@ import org.springframework.web.bind.annotation.RequestBody;
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
;
...
...
@@ -419,4 +429,14 @@ public class BuildingController extends AbstractBaseController {
return
buildService
.
getBuildingTreeInMyOrgCodeList
(
reginParams
.
getPersonIdentity
().
getBizOrgCode
());
}
@PersonIdentify
@PostMapping
(
value
=
"/upload"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"建筑导入(实施导数据使用)"
,
notes
=
"建筑导入"
)
public
void
upload
(
MultipartFile
file
)
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
buildService
.
importBuilding
(
file
,
reginParams
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/FormInstanceMapper.java
View file @
b0c6ee8b
...
...
@@ -216,4 +216,11 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> {
int
updateFormFieldValue
(
@Param
(
"id"
)
Long
id
,
@Param
(
"name"
)
String
name
,
@Param
(
"value"
)
String
value
);
Long
queryVideoCountByBizOrgCode
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
/**
* 建筑导入-导入楼层或房间 根据编码查询父级建筑id
* @param code
* @return
*/
String
selectParentBuildId
(
@Param
(
"code"
)
String
code
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IBuilldService.java
View file @
b0c6ee8b
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.service;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto
;
import
com.yeejoin.amos.feign.morphic.model.ResourceDTO
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
...
...
@@ -17,6 +18,7 @@ import com.yeejoin.equipmanage.common.entity.vo.PointTreeVo;
import
com.yeejoin.equipmanage.common.vo.BuildingTreeAndEquipVO
;
import
com.yeejoin.equipmanage.common.vo.BuildingTreeVo
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
...
...
@@ -351,4 +353,10 @@ public interface IBuilldService extends IService<Building> {
List
<
OrgMenuDto
>
companyTreeByUserAndType
();
List
<
BuildingTreeVo
>
treeByName
(
String
bizOrgCode
,
String
name
);
/**
* 导入建筑信息
* @param file
*/
void
importBuilding
(
MultipartFile
file
,
ReginParams
reginParams
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
View file @
b0c6ee8b
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelReader
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.morphic.Morphic
;
import
com.yeejoin.amos.feign.morphic.model.ResourceDTO
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.equipmanage.common.dto.BuildingImportDto
;
import
com.yeejoin.equipmanage.common.dto.OrgUsrDto
;
import
com.yeejoin.equipmanage.common.entity.*
;
import
com.yeejoin.equipmanage.common.entity.dto.BuildIsRiskDTO
;
...
...
@@ -44,6 +49,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.exception.BaseException
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.CommonUtil
;
...
...
@@ -51,6 +57,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -1650,4 +1657,195 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
allListVo
.
forEach
(
s
->
s
.
setAbsolutePosition
(
absolutePositionMap
.
get
(
s
.
getId
())));
return
allListVo
;
}
@Override
@Transactional
public
void
importBuilding
(
MultipartFile
file
,
ReginParams
reginParams
)
{
// 机构信息
String
companyCode
=
null
;
String
orgCode
=
null
;
String
companyName
=
null
;
String
dutyUser
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
reginParams
)
&&
!
ObjectUtils
.
isEmpty
(
reginParams
.
getPersonIdentity
()))
{
if
(!
ObjectUtils
.
isEmpty
(
reginParams
.
getPersonIdentity
().
getBizOrgCode
()))
{
companyCode
=
reginParams
.
getPersonIdentity
().
getBizOrgCode
();
companyName
=
reginParams
.
getPersonIdentity
().
getCompanyName
();
}
if
(!
ObjectUtils
.
isEmpty
(
reginParams
.
getCompany
())
&&
!
ObjectUtils
.
isEmpty
(
reginParams
.
getCompany
().
getOrgCode
()))
{
orgCode
=
reginParams
.
getCompany
().
getOrgCode
();
}
}
if
(!
ObjectUtils
.
isEmpty
(
reginParams
.
getUserModel
())
||
!
ObjectUtils
.
isEmpty
(
reginParams
.
getUserModel
().
getSequenceNbr
()))
{
dutyUser
=
String
.
valueOf
(
reginParams
.
getUserModel
().
getSequenceNbr
());
}
try
{
ExcelReader
reader
=
EasyExcel
.
read
(
file
.
getInputStream
()).
build
();
List
<
BuildingImportDto
>
importList
=
ExcelUtil
.
readExcel
(
reader
,
BuildingImportDto
.
class
,
0
);
if
(!
ObjectUtils
.
isEmpty
(
importList
))
{
// 获取所有建筑信息
List
<
BuildingImportDto
>
buildList
=
importList
.
stream
().
filter
(
item
->
item
.
getDataType
().
equals
(
"建筑@building"
)).
collect
(
Collectors
.
toList
());
// 建筑信息入库
importBuildMessage
(
buildList
,
orgCode
,
companyName
,
companyCode
,
dutyUser
);
// 获取所有楼层信息
List
<
BuildingImportDto
>
floorList
=
importList
.
stream
().
filter
(
item
->
item
.
getDataType
().
equals
(
"楼层@floor"
)).
collect
(
Collectors
.
toList
());
// 楼层信息入库
importFloorMessage
(
floorList
,
orgCode
,
companyName
,
companyCode
,
dutyUser
);
// 获取房间信息
List
<
BuildingImportDto
>
roomList
=
importList
.
stream
().
filter
(
item
->
item
.
getDataType
().
equals
(
"房间@room"
)).
collect
(
Collectors
.
toList
());
// 房间信息入库
importRoomMessage
(
roomList
,
orgCode
,
companyName
,
companyCode
,
dutyUser
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
e
.
getMessage
());
}
}
private
void
importBuildMessage
(
List
<
BuildingImportDto
>
collect
,
String
orgCode
,
String
bizOrgName
,
String
bizOrgCode
,
String
dutyUser
)
{
// 处理建筑数据、入库
collect
.
forEach
(
item
->
{
HashMap
<
String
,
Object
>
buildingData
=
new
HashMap
<>();
// 建筑默认父级id 为顶级id
buildingData
.
put
(
"parentId"
,
0
);
// 建筑类型
String
groupCode
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildingType
()))
{
if
(
item
.
getBuildingType
().
contains
(
"@"
))
{
String
[]
certificates
=
item
.
getBuildingType
().
split
(
"@"
);
groupCode
=
certificates
[
1
];
}
}
// 建筑类别
String
buildType
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildingCategory
()))
{
if
(
item
.
getBuildingType
().
contains
(
"@"
))
{
String
[]
certificates
=
item
.
getBuildingCategory
().
split
(
"@"
);
buildType
=
certificates
[
1
];
buildingData
.
put
(
"buildType"
,
buildType
);
}
}
// 建造日期
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildDate
()))
{
buildingData
.
put
(
"buildDate"
,
item
.
getBuildDate
());
}
// 公共字段处理
publicData
(
item
,
buildingData
,
bizOrgCode
,
bizOrgName
,
dutyUser
);
// 保存建筑信息
saveForm
(
groupCode
,
orgCode
,
buildingData
,
null
);
});
}
private
void
importFloorMessage
(
List
<
BuildingImportDto
>
collect
,
String
orgCode
,
String
bizOrgName
,
String
bizOrgCode
,
String
dutyUser
)
{
// 处理楼层数据、入库
collect
.
forEach
(
item
->
{
HashMap
<
String
,
Object
>
buildingData
=
new
HashMap
<>();
// 楼层所在建筑父级id
if
(!
ObjectUtils
.
isEmpty
(
item
.
getInWhichBuild
()))
{
String
parentBuildId
=
formInstanceMapper
.
selectParentBuildId
(
item
.
getInWhichBuild
());
buildingData
.
put
(
"inwhichBuild"
,
parentBuildId
);
buildingData
.
put
(
"parentId"
,
parentBuildId
);
}
// 数据类型
String
groupCode
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildingType
()))
{
if
(
item
.
getBuildingType
().
contains
(
"@"
))
{
String
[]
certificates
=
item
.
getBuildingType
().
split
(
"@"
);
groupCode
=
certificates
[
1
];
}
}
// 公共字段处理
publicData
(
item
,
buildingData
,
bizOrgCode
,
bizOrgName
,
dutyUser
);
// 保存楼层信息
saveForm
(
groupCode
,
orgCode
,
buildingData
,
null
);
});
}
private
void
importRoomMessage
(
List
<
BuildingImportDto
>
collect
,
String
orgCode
,
String
bizOrgName
,
String
bizOrgCode
,
String
dutyUser
)
{
// 处理房间数据、入库
collect
.
forEach
(
item
->
{
HashMap
<
String
,
Object
>
buildingData
=
new
HashMap
<>();
// 房间所在建筑父级id
if
(!
ObjectUtils
.
isEmpty
(
item
.
getInWhichBuild
()))
{
String
parentBuildId
=
formInstanceMapper
.
selectParentBuildId
(
item
.
getInWhichBuild
());
buildingData
.
put
(
"inwhichBuild"
,
parentBuildId
);
buildingData
.
put
(
"parentId"
,
parentBuildId
);
}
// 数据类型
String
groupCode
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildingType
()))
{
if
(
item
.
getBuildingType
().
contains
(
"@"
))
{
String
[]
certificates
=
item
.
getBuildingType
().
split
(
"@"
);
groupCode
=
certificates
[
1
];
}
}
// 操作人员持证数
if
(!
ObjectUtils
.
isEmpty
(
item
.
getLicensesNumber
()))
{
buildingData
.
put
(
"certificatesPersonNum"
,
item
.
getLicensesNumber
());
}
// 安装位置
if
(!
ObjectUtils
.
isEmpty
(
item
.
getLocationDescription
()))
{
buildingData
.
put
(
"installLoc"
,
item
.
getLocationDescription
());
}
// 维保单位
if
(!
ObjectUtils
.
isEmpty
(
item
.
getMaintenanceCompany
()))
{
buildingData
.
put
(
"maintenanceUnit"
,
item
.
getMaintenanceCompany
());
}
// 每班人数
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPersonNumber
()))
{
buildingData
.
put
(
"personNum"
,
item
.
getPersonNumber
());
}
// 火灾预案
if
(!
ObjectUtils
.
isEmpty
(
item
.
getFirePlan
()))
{
buildingData
.
put
(
"hasFirePlan"
,
item
.
getFirePlan
().
equals
(
"有"
)
?
"true"
:
"false"
);
}
// 每班人数
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPutDate
()))
{
buildingData
.
put
(
"useDate"
,
item
.
getPutDate
());
}
// 每班人数
if
(!
ObjectUtils
.
isEmpty
(
item
.
getProtectedObjects
()))
{
buildingData
.
put
(
"protectedObjects"
,
item
.
getProtectedObjects
());
}
// 公共字段处理
publicData
(
item
,
buildingData
,
bizOrgCode
,
bizOrgName
,
dutyUser
);
// 保存楼层信息
saveForm
(
groupCode
,
orgCode
,
buildingData
,
null
);
});
}
private
void
publicData
(
BuildingImportDto
item
,
HashMap
<
String
,
Object
>
buildingData
,
String
bizOrgCode
,
String
bizOrgName
,
String
dutyUser
)
{
// 编码
if
(!
ObjectUtils
.
isEmpty
(
item
.
getCode
()))
{
buildingData
.
put
(
"code"
,
item
.
getCode
());
}
// 责任人
if
(!
ObjectUtils
.
isEmpty
(
dutyUser
))
{
buildingData
.
put
(
"dutyUser"
,
dutyUser
);
}
// 房间名称
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildName
()))
{
buildingData
.
put
(
"name"
,
item
.
getBuildName
());
}
// 房间地址
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildingAddress
()))
{
buildingData
.
put
(
"address"
,
item
.
getBuildingAddress
());
}
// 添加同步风险区域操作 默认false
if
(!
ObjectUtils
.
isEmpty
(
item
.
getBuildName
()))
{
buildingData
.
put
(
"isRisk"
,
"false"
);
}
// 机构编码
if
(!
ObjectUtils
.
isEmpty
(
bizOrgCode
))
{
buildingData
.
put
(
"bizOrgCode"
,
bizOrgCode
);
}
// 机构名称
if
(!
ObjectUtils
.
isEmpty
(
bizOrgName
))
{
buildingData
.
put
(
"bizOrgName"
,
bizOrgName
);
}
}
}
amos-boot-system-equip/src/main/resources/mapper/FormInstanceMapper.xml
View file @
b0c6ee8b
...
...
@@ -650,4 +650,7 @@ AND field_name =#{name}
<select
id=
"queryVideoCountByBizOrgCode"
resultType=
"java.lang.Long"
>
select count(1) from wl_video where biz_org_code like concat(#{bizOrgCode}, '%')
</select>
<select
id=
"selectParentBuildId"
resultType=
"java.lang.String"
>
SELECT instance_id FROM `wl_form_instance` f where f.field_name = 'code' and f.field_value = #{code}
</select>
</mapper>
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