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
ae201c65
Commit
ae201c65
authored
Nov 03, 2021
by
xixinzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
巡检点优化项提交
parent
479efe2d
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
620 additions
and
57 deletions
+620
-57
PointClassify.java
...ava/com/yeejoin/amos/patrol/dao/entity/PointClassify.java
+128
-0
InputItemMapper.java
...join/amos/patrol/business/dao/mapper/InputItemMapper.java
+1
-1
IPointClassifyDao.java
...mos/patrol/business/dao/repository/IPointClassifyDao.java
+19
-1
PointClassifySynDto.java
...yeejoin/amos/patrol/business/dto/PointClassifySynDto.java
+47
-0
CheckServiceImpl.java
...n/amos/patrol/business/service/impl/CheckServiceImpl.java
+26
-26
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+3
-2
PointServiceImpl.java
...n/amos/patrol/business/service/impl/PointServiceImpl.java
+66
-2
IPointService.java
...oin/amos/patrol/business/service/intfc/IPointService.java
+3
-0
PointInputItemNewVo.java
.../yeejoin/amos/patrol/business/vo/PointInputItemNewVo.java
+77
-0
PatrolMqttListener.java
...java/com/yeejoin/amos/patrol/mqtt/PatrolMqttListener.java
+41
-0
PatrolApplication.java
...rol/src/main/java/com/yeejoin/amos/PatrolApplication.java
+29
-0
application.properties
...t-system-patrol/src/main/resources/application.properties
+3
-1
patrol-3.0.1.xml
...m-patrol/src/main/resources/db/changelog/patrol-3.0.1.xml
+118
-0
dbTemplate_check.xml
...-patrol/src/main/resources/db/mapper/dbTemplate_check.xml
+9
-0
dbTemplate_input_item.xml
...ol/src/main/resources/db/mapper/dbTemplate_input_item.xml
+3
-2
pointMapper.xml
...ystem-patrol/src/main/resources/db/mapper/pointMapper.xml
+47
-22
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-patrol-api/src/main/java/com/yeejoin/amos/patrol/dao/entity/PointClassify.java
View file @
ae201c65
...
...
@@ -56,6 +56,61 @@ public class PointClassify extends BasicEntity{
@Column
(
name
=
"inspection_spec_name"
)
private
String
inspectionSpecName
;
/**
* 编号
*/
@Column
(
name
=
"code"
)
private
String
code
;
/**
* 分类名称
*/
@Column
(
name
=
"category_name"
)
private
String
categoryName
;
/**
* 分类id
*/
@Column
(
name
=
"category_code"
)
private
String
categoryCode
;
/**
* 位置
*/
@Column
(
name
=
"address"
)
private
String
address
;
/**
* 数据源code(1 消防装备 2 重点部位 3 自定义)
*/
@Column
(
name
=
"data_source_code"
)
private
String
dataSourceCode
;
/**
* 数据源名称(冗余)
*/
@Column
(
name
=
"data_source_name"
)
private
String
dataSourceName
;
/**
* 是否删除( 0未删除,1已删除 )
*/
@Column
(
name
=
"is_delete"
)
private
byte
isDelete
;
/**
* 建筑id
*/
@Column
(
name
=
"building_id"
)
private
String
buildingId
;
/**
* 建筑名称
*/
@Column
(
name
=
"building_name"
)
private
String
buildingName
;
public
String
getEquipmentId
()
{
return
equipmentId
;
}
...
...
@@ -115,4 +170,76 @@ public class PointClassify extends BasicEntity{
public
void
setOriginalId
(
String
originalId
)
{
this
.
originalId
=
originalId
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getCategoryName
()
{
return
categoryName
;
}
public
void
setCategoryName
(
String
categoryName
)
{
this
.
categoryName
=
categoryName
;
}
public
String
getAddress
()
{
return
address
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
String
getDataSourceCode
()
{
return
dataSourceCode
;
}
public
void
setDataSourceCode
(
String
dataSourceCode
)
{
this
.
dataSourceCode
=
dataSourceCode
;
}
public
String
getDataSourceName
()
{
return
dataSourceName
;
}
public
void
setDataSourceName
(
String
dataSourceName
)
{
this
.
dataSourceName
=
dataSourceName
;
}
public
byte
getIsDelete
()
{
return
isDelete
;
}
public
void
setIsDelete
(
byte
isDelete
)
{
this
.
isDelete
=
isDelete
;
}
public
String
getBuildingId
()
{
return
buildingId
;
}
public
void
setBuildingId
(
String
buildingId
)
{
this
.
buildingId
=
buildingId
;
}
public
String
getBuildingName
()
{
return
buildingName
;
}
public
void
setBuildingName
(
String
buildingName
)
{
this
.
buildingName
=
buildingName
;
}
public
String
getCategoryCode
()
{
return
categoryCode
;
}
public
void
setCategoryCode
(
String
categoryCode
)
{
this
.
categoryCode
=
categoryCode
;
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/InputItemMapper.java
View file @
ae201c65
...
...
@@ -30,7 +30,7 @@ public interface InputItemMapper extends BaseMapper {
public
List
<
InputItemVo
>
getInputItemListByitemNos
(
@Param
(
"itemNos"
)
String
[]
itemNos
);
public
List
<
PointInputItemVo
>
queryCustomInputItemByPointId
(
@Param
(
"
pointId"
)
Long
pointId
,
@Param
(
"equipmentId"
)
String
equipmentName
);
public
List
<
PointInputItemVo
>
queryCustomInputItemByPointId
(
@Param
(
"
classifyId"
)
String
classifyId
);
public
PointInputItemVo
getInputItemByEquipmentName
(
@Param
(
"equipmentName"
)
String
equipmentName
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/repository/IPointClassifyDao.java
View file @
ae201c65
...
...
@@ -14,7 +14,7 @@ public interface IPointClassifyDao extends BaseDao<PointClassify, Long> {
@Modifying
@Transactional
@Query
(
value
=
"select * from p_point_classify where point_id = ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"select * from p_point_classify where point_id = ?1
and is_delete = 0
"
,
nativeQuery
=
true
)
List
<
PointClassify
>
getPointClassifyByPointId
(
long
id
);
@Modifying
...
...
@@ -27,5 +27,23 @@ public interface IPointClassifyDao extends BaseDao<PointClassify, Long> {
@Query
(
value
=
"delete from p_point_classify where point_id in (?1)"
,
nativeQuery
=
true
)
void
deleteByPointId
(
List
<
Long
>
pointIds
);
/**
* 根据原始id逻辑删除
* @param id 原始id
*/
@Modifying
@Transactional
@Query
(
value
=
"UPDATE p_point_classify SET is_delete = 1 WHERE original_id = (?1)"
,
nativeQuery
=
true
)
void
deleteByOriginalId
(
String
id
);
/**
* 根据原始id查询
* @param id 原始id
* @return List<PointClassify> 返回
*/
@Query
(
value
=
"select * from p_point_classify WHERE original_id = (?1) and is_delete =0"
,
nativeQuery
=
true
)
List
<
PointClassify
>
selectByOriginalId
(
String
id
);
PointClassify
findByOriginalId
(
String
originalId
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/PointClassifySynDto.java
0 → 100644
View file @
ae201c65
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dto
;
import
lombok.Data
;
/**
* @author DELL
*/
@Data
public
class
PointClassifySynDto
{
/**
* 原始数据id
*/
private
String
originalId
;
/**
* 原始数据name
*/
private
String
name
;
/**
* 编号
*/
private
String
code
;
/**
* 分类
*/
private
String
categoryName
;
/**
* 分类code
*/
private
String
categoryCode
;
/**
* 位置
*/
private
String
address
;
/**
* 建筑id
*/
private
String
buildingId
;
/**
* 建筑名称
*/
private
String
buildingName
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/CheckServiceImpl.java
View file @
ae201c65
...
...
@@ -1134,32 +1134,32 @@ public class CheckServiceImpl implements ICheckService {
e
.
put
(
"photoData"
,
photoList
);
});
equip
.
put
(
"equipIputLsit"
,
inputContent
);
LinkedHashMap
<
String
,
Object
>
jsonObject
=
equipment
.
getEquipDetail
(
Long
.
parseLong
(
equip
.
get
(
"equipmentId"
).
toString
()));
LinkedHashMap
<
String
,
Object
>
result
=
(
LinkedHashMap
<
String
,
Object
>)
jsonObject
.
get
(
"result"
);
if
(
result
!=
null
){
if
(
result
.
get
(
"sourceName"
)!=
null
){
equip
.
put
(
"arec"
,
result
.
get
(
"sourceName"
).
toString
());
}
else
{
equip
.
put
(
"arec"
,
""
);
}
if
(
result
.
get
(
"categoryName"
)!=
null
){
equip
.
put
(
"equipType"
,
result
.
get
(
"categoryName"
).
toString
());
}
else
{
equip
.
put
(
"equipType"
,
""
);
}
if
(
result
.
get
(
"fullName"
)!=
null
){
if
(
result
.
get
(
"area"
)!=
null
){
equip
.
put
(
"area"
,
result
.
get
(
"fullName"
).
toString
()+
result
.
get
(
"area"
));
}
else
{
equip
.
put
(
"area"
,
result
.
get
(
"fullName"
).
toString
());
}
}
else
{
equip
.
put
(
"area"
,
""
);
}
equip
.
put
(
"place"
,
result
.
get
(
"warehouseStructureName"
));
}
//
LinkedHashMap<String,Object> jsonObject = equipment.getEquipDetail(Long.parseLong(equip.get("equipmentId").toString()));
//
LinkedHashMap<String,Object> result = (LinkedHashMap<String, Object>) jsonObject.get("result");
//
if(result!=null){
//
if(result.get("sourceName")!=null){
//
equip.put("arec",result.get("sourceName").toString());
//
}else{
//
equip.put("arec","");
//
}
//
if(result.get("categoryName")!=null){
//
equip.put("equipType",result.get("categoryName").toString());
//
}else{
//
equip.put("equipType","");
//
}
//
if(result.get("fullName")!=null){
//
if(result.get("area")!=null){
//
equip.put("area",result.get("fullName").toString()+result.get("area"));
//
}else {
//
equip.put("area",result.get("fullName").toString());
//
}
//
//
}else{
//
equip.put("area","");
//
}
//
//
equip.put("place", result.get("warehouseStructureName"));
//
}
});
return
equipList
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
ae201c65
...
...
@@ -781,9 +781,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
userNames
.
clear
();
String
[]
userIds1
=
e
.
get
(
"userId"
).
toString
().
split
(
","
);
for
(
String
userId
:
userIds1
)
{
userNames
.
add
(
userModelMap
.
get
(
userId
));
if
(!
ObjectUtils
.
isEmpty
(
userModelMap
.
get
(
userId
)))
{
userNames
.
add
(
userModelMap
.
get
(
userId
));
}
}
userNames
.
remove
(
null
);
if
(
userNames
.
size
()
>
0
)
{
e
.
put
(
"executiveName"
,
Joiner
.
on
(
","
).
join
(
userNames
));
}
else
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PointServiceImpl.java
View file @
ae201c65
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
...
...
@@ -11,6 +12,7 @@ import com.yeejoin.amos.patrol.business.dao.mapper.InputItemMapper;
import
com.yeejoin.amos.patrol.business.dao.mapper.PointMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.RouteMapper
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
import
com.yeejoin.amos.patrol.business.dto.PointClassifySynDto
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PushTargetBo
;
import
com.yeejoin.amos.patrol.business.feign.EquipFeign
;
...
...
@@ -29,10 +31,13 @@ import com.yeejoin.amos.patrol.exception.YeeException;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.safety.common.cache.PointStatusCache
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.assertj.core.util.Sets
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.BeanWrapperImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.*
;
import
org.springframework.data.jpa.domain.Specification
;
...
...
@@ -46,12 +51,14 @@ import javax.persistence.criteria.CriteriaBuilder;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.beans.PropertyDescriptor
;
import
java.math.BigInteger
;
import
java.util.*
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
@Service
(
"pointService"
)
@Slf4j
public
class
PointServiceImpl
implements
IPointService
{
@Autowired
...
...
@@ -320,6 +327,15 @@ public class PointServiceImpl implements IPointService {
newPointClassify
.
setCreatorId
(
point
.
getCreatorId
());
newPointClassify
.
setPointId
(
pointId
);
newPointClassify
.
setOrderNo
(
pointClassify
.
getOrderNo
());
newPointClassify
.
setDataSourceCode
(
pointClassify
.
getDataSourceCode
());
newPointClassify
.
setDataSourceName
(
pointClassify
.
getDataSourceName
());
newPointClassify
.
setAddress
(
pointClassify
.
getAddress
());
newPointClassify
.
setBuildingId
(
pointClassify
.
getBuildingId
());
newPointClassify
.
setOriginalId
(
pointClassify
.
getOriginalId
());
newPointClassify
.
setCategoryCode
(
pointClassify
.
getCategoryCode
());
newPointClassify
.
setCategoryName
(
pointClassify
.
getCategoryName
());
newPointClassify
.
setCode
(
pointClassify
.
getCode
());
newPointClassify
.
setBuildingName
(
pointClassify
.
getBuildingName
());
if
(!
optionalPointClassify
.
isPresent
())
{
pointResult
=
iPointClassifyDao
.
saveAndFlush
(
newPointClassify
);
}
else
{
...
...
@@ -1502,8 +1518,8 @@ public class PointServiceImpl implements IPointService {
public
List
<
Map
<
String
,
Object
>>
queryEquipPointInputItem
(
Long
pointId
)
{
List
<
Map
<
String
,
Object
>>
content
=
pointMapper
.
queryEquipPointInputItem
(
pointId
);
content
.
forEach
(
e
->{
if
(
e
.
get
(
"
equipmentId"
)!=
null
&&
!
StringUtils
.
isBlank
(
e
.
get
(
"equipmentI
d"
).
toString
())){
List
<
PointInputItemVo
>
inputItems
=
inputItemMapper
.
queryCustomInputItemByPointId
(
pointId
,
e
.
get
(
"equipmentI
d"
).
toString
());
if
(
e
.
get
(
"
id"
)!=
null
&&
!
StringUtils
.
isBlank
(
e
.
get
(
"i
d"
).
toString
())){
List
<
PointInputItemVo
>
inputItems
=
inputItemMapper
.
queryCustomInputItemByPointId
(
e
.
get
(
"i
d"
).
toString
());
e
.
put
(
"equipIputDetailData"
,
inputItems
);
}
});
...
...
@@ -1628,4 +1644,52 @@ public class PointServiceImpl implements IPointService {
public
LinkedHashMap
<
String
,
Object
>
getRegionTress
()
{
return
equipFeign
.
getRegionTress
();
}
@Override
public
void
syncPointClassify
(
Map
<
String
,
Object
>
map
)
{
if
(
ObjectUtils
.
isEmpty
(
map
))
{
log
.
info
(
"消息内容为空!!!"
);
return
;
}
String
method
=
map
.
get
(
"method"
).
toString
();
PointClassifySynDto
pointClassifySynDto
=
JSON
.
parseObject
(
map
.
get
(
"data"
).
toString
(),
PointClassifySynDto
.
class
);
switch
(
method
)
{
case
"DELETE"
:
iPointClassifyDao
.
deleteByOriginalId
(
pointClassifySynDto
.
getOriginalId
());
break
;
case
"UPDATE"
:
List
<
PointClassify
>
pointClassifyList
=
iPointClassifyDao
.
selectByOriginalId
(
pointClassifySynDto
.
getOriginalId
());
if
(
ObjectUtils
.
isEmpty
(
pointClassifyList
))
{
log
.
info
(
"数据不存在!"
);
}
pointClassifyList
.
forEach
(
pointClassify
->
{
BeanUtils
.
copyProperties
(
pointClassifySynDto
,
pointClassify
,
getNullPropertyNames
(
pointClassifySynDto
));
iPointClassifyDao
.
saveAndFlush
(
pointClassify
);
});
break
;
default
:
log
.
info
(
"方法参数错误!!!"
);
break
;
}
}
/**
* 获取控制字段列表
* @param source 对象
* @return 为空数组
*/
private
static
String
[]
getNullPropertyNames
(
Object
source
)
{
final
BeanWrapper
src
=
new
BeanWrapperImpl
(
source
);
PropertyDescriptor
[]
pds
=
src
.
getPropertyDescriptors
();
Set
<
String
>
emptyNames
=
new
HashSet
<
String
>();
for
(
PropertyDescriptor
pd
:
pds
)
{
Object
srcValue
=
src
.
getPropertyValue
(
pd
.
getName
());
if
(
srcValue
==
null
)
{
emptyNames
.
add
(
pd
.
getName
());
}
}
String
[]
result
=
new
String
[
emptyNames
.
size
()];
return
emptyNames
.
toArray
(
result
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/intfc/IPointService.java
View file @
ae201c65
...
...
@@ -343,4 +343,7 @@ public interface IPointService {
List
queryItemList4RoutePoint
(
Long
pointId
,
Long
equipId
);
LinkedHashMap
<
String
,
Object
>
getRegionTress
();
void
syncPointClassify
(
Map
<
String
,
Object
>
map
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/vo/PointInputItemNewVo.java
View file @
ae201c65
...
...
@@ -65,6 +65,35 @@ public class PointInputItemNewVo{
* 序号
*/
private
Integer
orderNo
;
/**
* 数据源名称(冗余)
*/
private
String
dataSourceName
;
/**
* 数据源code(1 消防装备 2 重点部位 3 自定义)
*/
private
String
dataSourceCode
;
/**
* 编号
*/
private
String
code
;
/**
* 建筑id
*/
private
String
buildingId
;
/**
* 建筑name
*/
private
String
buildingName
;
/**
* 原始id
*/
private
String
originalId
;
private
List
<
PointInputItemVo
>
equipIputDetailData
=
new
ArrayList
<
PointInputItemVo
>();
...
...
@@ -178,4 +207,52 @@ public class PointInputItemNewVo{
public
void
setMaintenanceName
(
String
maintenanceName
)
{
this
.
maintenanceName
=
maintenanceName
;
}
public
String
getDataSourceName
()
{
return
dataSourceName
;
}
public
void
setDataSourceName
(
String
dataSourceName
)
{
this
.
dataSourceName
=
dataSourceName
;
}
public
String
getDataSourceCode
()
{
return
dataSourceCode
;
}
public
void
setDataSourceCode
(
String
dataSourceCode
)
{
this
.
dataSourceCode
=
dataSourceCode
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getBuildingId
()
{
return
buildingId
;
}
public
void
setBuildingId
(
String
buildingId
)
{
this
.
buildingId
=
buildingId
;
}
public
String
getOriginalId
()
{
return
originalId
;
}
public
void
setOriginalId
(
String
originalId
)
{
this
.
originalId
=
originalId
;
}
public
String
getBuildingName
()
{
return
buildingName
;
}
public
void
setBuildingName
(
String
buildingName
)
{
this
.
buildingName
=
buildingName
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/mqtt/PatrolMqttListener.java
0 → 100644
View file @
ae201c65
package
com
.
yeejoin
.
amos
.
patrol
.
mqtt
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.patrol.business.service.intfc.IPointService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
java.util.Map
;
/**
* @author DELL
*/
@Component
@Slf4j
public
class
PatrolMqttListener
extends
EmqxListener
{
@Value
(
"${patrol.point.classify.topic}"
)
private
String
pointClassifyTopic
;
@Autowired
private
IPointService
iPointService
;
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
if
(
log
.
isInfoEnabled
()){
log
.
info
(
"收到消息主题:{},消息内容:{}"
,
topic
,
message
.
toString
());
}
try
{
Map
<
String
,
Object
>
msg
=
JSON
.
parseObject
(
message
.
toString
());
if
(
pointClassifyTopic
.
equals
(
topic
))
{
iPointService
.
syncPointClassify
(
msg
);
}
log
.
info
(
"巡检对象同步完成"
);
}
catch
(
Exception
e
)
{
log
.
info
(
"巡检对象同步失败:{}"
,
e
.
getMessage
());
}
}
}
amos-boot-system-patrol/src/main/java/com/yeejoin/amos/PatrolApplication.java
View file @
ae201c65
package
com
.
yeejoin
.
amos
;
import
com.yeejoin.amos.patrol.mqtt.PatrolMqttListener
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
...
...
@@ -20,6 +24,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.config.JsonSerializerManage
;
import
org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler
;
...
...
@@ -59,6 +64,15 @@ public class PatrolApplication {
return
new
RestTemplate
();
}
@Autowired
private
PatrolMqttListener
patrolMqttListener
;
@Autowired
private
EmqKeeper
emqKeeper
;
@Value
(
"${patrol.topic}"
)
private
String
patrolTopic
;
/**
* 启动amosop-server
*
...
...
@@ -81,4 +95,18 @@ public class PatrolApplication {
"----------------------------------------------------------"
);
}
/**
* 初始化MQTT
* @throws MqttException
*/
@Bean
void
initMqtt
()
{
try
{
emqKeeper
.
getMqttClient
().
subscribe
(
patrolTopic
,
1
,
patrolMqttListener
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"EMQ初始化连接失败!"
);
}
}
}
\ No newline at end of file
amos-boot-system-patrol/src/main/resources/application.properties
View file @
ae201c65
spring.application.name
=
AMOS-PATROL
-tb
spring.application.name
=
AMOS-PATROL
server.servlet.context-path
=
/patrol
server.port
=
8082
...
...
@@ -44,6 +44,8 @@ Push.fegin.name=APPMESSAGEPUSHSERVICE
amos.flowWork.topic
=
/STATE_GRID/hazardManagement
amosRefresh.danger.topic
=
patrolDangerInsertOrUpdate
amosRefresh.patrol.topic
=
patrolCheckInsert
patrol.point.classify.topic
=
patrol/point/classify
patrol.topic
=
patrol/#
#停止通过WEB公开所有端点
management.endpoints.web.exposure.exclude
=
*
## redis失效时间
...
...
amos-boot-system-patrol/src/main/resources/db/changelog/patrol-3.0.1.xml
View file @
ae201c65
...
...
@@ -313,4 +313,121 @@
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-19"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"code"
/>
</not>
</preConditions>
<comment>
p_point_classify add column code
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `code` varchar(255) DEFAULT NULL COMMENT '编号';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-20"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"category_name"
/>
</not>
</preConditions>
<comment>
p_point_classify add column category_name
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `category_name` varchar(255) DEFAULT NULL COMMENT '分类名称';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-22"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"address"
/>
</not>
</preConditions>
<comment>
p_point_classify add column address
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `address` varchar(255) DEFAULT NULL COMMENT '位置';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-23"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"data_source_code"
/>
</not>
</preConditions>
<comment>
p_point_classify add column data_source_code
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `data_source_code` int(10) DEFAULT NULL COMMENT '数据源code(1 消防装备 2 重点部位 3 自定义)';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-24"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"data_source_name"
/>
</not>
</preConditions>
<comment>
p_point_classify add column data_source_name
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `data_source_name` varchar(255) DEFAULT NULL COMMENT '数据源名称(冗余)';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-26"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"building_id"
/>
</not>
</preConditions>
<comment>
p_point_classify add column building_id
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `building_id` varchar(255) DEFAULT NULL COMMENT '建筑id';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-27"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"building_name"
/>
</not>
</preConditions>
<comment>
p_point_classify add column building_name
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `building_name` varchar(255) DEFAULT NULL COMMENT '建筑名称';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-28"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"category_code"
/>
</not>
</preConditions>
<comment>
p_point_classify add column category_code
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `category_code` varchar(255) DEFAULT NULL COMMENT '分类id';
</sql>
</changeSet>
<changeSet
author=
"xixinzhao"
id=
"20211102-29"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_point_classify"
columnName=
"is_delete"
/>
</not>
</preConditions>
<comment>
p_point_classify add column is_delete
</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除( 0未删除,1已删除 )';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
amos-boot-system-patrol/src/main/resources/db/mapper/dbTemplate_check.xml
View file @
ae201c65
...
...
@@ -846,6 +846,15 @@
classify.id as classifyId,
classify.name as equipmentName,
classify.equipment_id as equipmentId,
classify.original_id as originalId,
classify.code,
classify.category_name as categoryName,
classify.address as area,
classify.data_source_code as dataSourceCode,
classify.data_source_name as equipType,
classify.building_id as buildingId,
classify.building_name as place,
classify.category_code as categoryCode,
(SELECT create_date FROM p_check WHERE id = #{checkID}) as createDate
FROM
p_point_classify classify
...
...
amos-boot-system-patrol/src/main/resources/db/mapper/dbTemplate_input_item.xml
View file @
ae201c65
...
...
@@ -188,8 +188,9 @@
LEFT JOIN p_input_item pii ON pii.id = ppi.input_item_id
lEFT JOIN p_route_point_item prpi ON prpi.point_input_item_id = pii.id
WHERE pii.is_delete = '0'
<if
test=
"pointId!=null and pointId !='' "
>
AND ppc.point_id = #{pointId}
</if>
<if
test=
"equipmentId!=null and equipmentId !='' "
>
AND ppc.equipment_id = #{equipmentId}
</if>
<if
test=
"classifyId!=null and classifyId !='' "
>
AND ppc.id = #{classifyId}
</if>
<!-- <if test="pointId!=null and pointId !='' "> AND ppc.point_id = #{pointId}</if>-->
<!-- <if test="equipmentId!=null and equipmentId !='' "> AND ppc.equipment_id = #{equipmentId}</if>-->
</select>
<select
id=
"getInputItemListByitemNos"
resultType=
"com.yeejoin.amos.patrol.business.vo.InputItemVo"
>
SELECT
...
...
amos-boot-system-patrol/src/main/resources/db/mapper/pointMapper.xml
View file @
ae201c65
...
...
@@ -942,32 +942,57 @@
AND p.org_code = #{orgCode}
AND c.is_delete = 0
</select>
<!-- <select id="queryEquipPointInputItem" resultType="java.util.Map">-->
<!-- SELECT-->
<!-- distinct cast(spec.id as char) AS equipmentId,-->
<!-- we.name AS name,-->
<!-- structure.source_id AS sourceId,-->
<!-- structure.source_code AS sourceCode,-->
<!-- spec.system_id AS systemId,-->
<!-- spec.code AS code,-->
<!-- cast(ppc.id as char) AS id,-->
<!-- category.NAME AS categoryName,-->
<!-- category.CODE AS categoryCode,-->
<!-- equipment_detail.area AS address,-->
<!-- structure.NAME AS acre,-->
<!-- we.inspection_spec as inspectionName,-->
<!-- ppc.order_no as orderNo-->
<!-- FROM-->
<!-- p_point_classify ppc-->
<!-- LEFT JOIN wl_equipment_specific spec ON spec.id=ppc.equipment_id-->
<!-- LEFT JOIN wl_equipment_detail equipment_detail ON equipment_detail.id = spec.equipment_detail_id-->
<!-- LEFT JOIN wl_stock_detail detail ON detail.equipment_specific_id = spec.id-->
<!-- LEFT JOIN wl_warehouse_structure structure ON detail.warehouse_structure_id = structure.id-->
<!-- LEFT JOIN f_fire_fighting_system AS manage ON manage.id = spec.system_id-->
<!-- LEFT JOIN wl_equipment we ON we.id = equipment_detail.equipment_id-->
<!-- LEFT JOIN wl_equipment_category category ON category.id = we.category_id-->
<!-- WHERE-->
<!-- <if test = "pointId!=''" > ppc.point_id = #{pointId} </if>-->
<!-- </select>-->
<select
id=
"queryEquipPointInputItem"
resultType=
"java.util.Map"
>
SELECT
distinct cast(spec.id as char) AS equipmentId,
we.name AS name,
structure.source_id AS sourceId,
structure.source_code AS sourceCode,
spec.system_id AS systemId,
spec.code AS code,
cast(ppc.id as char) AS id,
category.NAME AS categoryName,
category.CODE AS categoryCode,
equipment_detail.area AS address,
structure.NAME AS acre,
we.inspection_spec as inspectionName,
ppc.order_no as orderNo
ppc.id,
ppc.point_id pointId,
ppc.name,
ppc.code,
ppc.creator_id creatorId,
ppc.create_date createDate,
ppc.order_no orderNo,
ppc.original_id originalId,
ppc.equipment_id equipmentId,
ppc.inspection_spec_name inspectionSpecName,
ppc.category_name categoryName,
ppc.address,
ppc.data_source_code dataSourceCode,
ppc.data_source_name dataSourceName,
ppc.building_id buildingId,
ppc.building_name buildingName,
ppc.category_code categoryCode
FROM
p_point_classify ppc
LEFT JOIN wl_equipment_specific spec ON spec.id=ppc.equipment_id
LEFT JOIN wl_equipment_detail equipment_detail ON equipment_detail.id = spec.equipment_detail_id
LEFT JOIN wl_stock_detail detail ON detail.equipment_specific_id = spec.id
LEFT JOIN wl_warehouse_structure structure ON detail.warehouse_structure_id = structure.id
LEFT JOIN f_fire_fighting_system AS manage ON manage.id = spec.system_id
LEFT JOIN wl_equipment we ON we.id = equipment_detail.equipment_id
LEFT JOIN wl_equipment_category category ON category.id = we.category_id
p_point_classify ppc
WHERE
<if
test =
"pointId!=''"
>
ppc.point_id = #{pointId}
</if>
ppc.is_delete = 0
<if
test =
"pointId!=''"
>
AND ppc.point_id = #{pointId}
</if>
</select>
<select
id=
"queryPointCount4Route"
parameterType=
"long"
resultType=
"int"
>
...
...
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