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
f119683d
Commit
f119683d
authored
Sep 29, 2022
by
limei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_dl_plan6' of
http://39.98.45.134:8090/moa/amos-boot-biz
into develop_dl_plan6
parents
8dcb26c5
78b39f18
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
106 additions
and
15 deletions
+106
-15
pom.xml
...ule/amos-boot-module-api/amos-boot-module-ccs-api/pom.xml
+18
-0
MqttReceiveServiceImpl.java
...t/module/ccs/biz/service/impl/MqttReceiveServiceImpl.java
+26
-0
CheckModelService.java
...n/amos/boot/module/tdc/api/service/CheckModelService.java
+3
-2
CheckResultService.java
.../amos/boot/module/tdc/api/service/CheckResultService.java
+7
-0
CheckModelAction.java
...oin/amos/boot/module/tdc/biz/action/CheckModelAction.java
+26
-4
CheckModelController.java
.../boot/module/tdc/biz/controller/CheckModelController.java
+7
-3
CheckModelImpl.java
...amos/boot/module/tdc/biz/service/impl/CheckModelImpl.java
+9
-5
CheckReportImpl.java
...mos/boot/module/tdc/biz/service/impl/CheckReportImpl.java
+1
-1
CheckResultImpl.java
...mos/boot/module/tdc/biz/service/impl/CheckResultImpl.java
+9
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-ccs-api/pom.xml
View file @
f119683d
...
...
@@ -9,4 +9,21 @@
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
amos-boot-module-ccs-api
</artifactId>
<dependencies>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-emq
</artifactId>
<version>
1.1.20
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-api
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-ccs-biz/src/main/java/com/yeejoin/amos/boot/module/ccs/biz/service/impl/MqttReceiveServiceImpl.java
View file @
f119683d
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto
;
import
com.yeejoin.amos.boot.module.ccs.api.entity.FireEquipmentSignalLog
;
...
...
@@ -17,12 +18,15 @@ import com.yeejoin.amos.boot.module.ccs.api.vo.RawDataVO;
import
com.yeejoin.amos.boot.module.ccs.api.vo.ReceiveDataVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
...
...
@@ -43,6 +47,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired
private
FireEquipmentSignalLogMapper
fireEquipmentSignalLogMapper
;
@Autowired
protected
EmqKeeper
emqKeeper
;
public
static
final
String
EMERGENCY_ALARM_DATA_REFRESH
=
"emergency/alarm/data/refresh"
;
//TODO 逻辑待补充
@Override
...
...
@@ -92,6 +100,15 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
fireEquipmentSignalLog
.
setLng
(
oneByCode
.
getLng
());
fireEquipmentSignalLog
.
setLat
(
oneByCode
.
getLat
());
fireEquipmentSignalLogMapper
.
insert
(
fireEquipmentSignalLog
);
// 发送mqtt消息--刷新应急指挥屏数据
HashMap
<
String
,
String
>
refresh
=
new
HashMap
<>();
refresh
.
put
(
"uuId"
,
String
.
valueOf
(
System
.
currentTimeMillis
()));
try
{
emqKeeper
.
getMqttClient
().
publish
(
EMERGENCY_ALARM_DATA_REFRESH
,
JSON
.
toJSONString
(
refresh
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
}
else
if
(
ObjectUtil
.
isNotEmpty
(
receiveData
)
&&
StrUtil
.
isNotEmpty
(
receiveData
.
getActive
())
&&
"update"
.
equals
(
receiveData
.
getActive
())
&&
ObjectUtil
.
isNotEmpty
(
receiveData
.
getRawData
())
&&
StrUtil
.
isNotEmpty
(
receiveData
.
getRawData
().
getEquipmentSpecificCode
()))
{
...
...
@@ -102,6 +119,15 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
updateWrapper
.
lambda
().
eq
(
FireEquipmentSignalLog:
:
getFireEquipmentMrid
,
rawData
.
getEquipmentSpecificCode
())
.
eq
(
FireEquipmentSignalLog:
:
getFireEquipmentIndexKey
,
rawData
.
getEquipmentIndexKey
());
fireEquipmentSignalLogServiceImpl
.
update
(
fireEquipmentSignalLog
,
updateWrapper
);
// 发送mqtt消息--刷新应急指挥屏数据
HashMap
<
String
,
String
>
refresh
=
new
HashMap
<>();
refresh
.
put
(
"uuId"
,
String
.
valueOf
(
System
.
currentTimeMillis
()));
try
{
emqKeeper
.
getMqttClient
().
publish
(
EMERGENCY_ALARM_DATA_REFRESH
,
JSON
.
toJSONString
(
refresh
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
log
.
info
(
String
.
format
(
"收到mqtt(警情)消息并处理完成:%s"
,
message
));
}
...
...
amos-boot-system-tdc/amos-boot-module-tdc-api/src/main/java/com/yeejoin/amos/boot/module/tdc/api/service/CheckModelService.java
View file @
f119683d
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto
;
import
com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
...
...
@@ -34,13 +35,13 @@ public interface CheckModelService extends IService<CheckModel> {
* 校验机构下全部模型
* @param amosOrgCode 机构code
*/
void
checkAllMode
(
String
amosOrgCode
);
void
checkAllMode
(
String
amosOrgCode
,
AgencyUserModel
userInfo
);
/**
* 校验单个模型
* @param modelId 模型id
*/
void
checkSingleMode
(
String
modelId
);
void
checkSingleMode
(
String
modelId
,
AgencyUserModel
userInfo
);
/**
* 根据机构code和模型名称查询模型对象
...
...
amos-boot-system-tdc/amos-boot-module-tdc-api/src/main/java/com/yeejoin/amos/boot/module/tdc/api/service/CheckResultService.java
View file @
f119683d
...
...
@@ -48,4 +48,11 @@ public interface CheckResultService extends IService<CheckResult> {
*/
Integer
selectItemCount
(
String
batchNo
);
/**
* 查询不合格项
* @param batchNo 批次号
* @return 属性个数
*/
Integer
selectItemNo
(
String
batchNo
,
Long
modelId
);
}
amos-boot-system-tdc/amos-boot-module-tdc-biz/src/main/java/com/yeejoin/amos/boot/module/tdc/biz/action/CheckModelAction.java
View file @
f119683d
...
...
@@ -73,6 +73,7 @@ public class CheckModelAction {
String
batchNo
=
String
.
valueOf
(
propertyValues
.
get
(
"batch_no"
));
Integer
checkType
=
Integer
.
valueOf
(
String
.
valueOf
(
propertyValues
.
get
(
"checkType"
)));
String
orgCode
=
String
.
valueOf
(
propertyValues
.
get
(
"org_code"
));
String
checkPeopleName
=
String
.
valueOf
(
propertyValues
.
get
(
"checkPeopleName"
));
String
itemName
=
idxProjectModel
.
getItemName
();
// 获取模型
...
...
@@ -105,12 +106,12 @@ public class CheckModelAction {
if
(
ObjectUtils
.
isNotEmpty
(
checkType
))
{
if
(
checkType
==
1
)
{
// 2.2 单独模型校验,根据批次号查询已经入库的属性
sendWebMessage
(
batchNo
,
checkModel
.
getCheckItemAmount
());
sendWebMessage
(
batchNo
,
checkModel
.
getCheckItemAmount
()
,
orgCode
,
checkPeopleName
,
checkType
,
itemName
);
}
else
if
(
checkType
==
0
)
{
// 2.1 全站校验
List
<
CheckModel
>
checkModels
=
checkModelService
.
selectByOrgCode
(
orgCode
);
int
sum
=
checkModels
.
stream
().
mapToInt
(
CheckModel:
:
getCheckItemAmount
).
sum
();
sendWebMessage
(
batchNo
,
sum
);
sendWebMessage
(
batchNo
,
sum
,
orgCode
,
checkPeopleName
,
checkType
,
itemName
);
}
}
// else {
...
...
@@ -124,7 +125,7 @@ public class CheckModelAction {
// }
}
private
void
sendWebMessage
(
String
batchNo
,
Integer
itemSize
)
{
private
void
sendWebMessage
(
String
batchNo
,
Integer
itemSize
,
String
orgCode
,
String
checkPeopleName
,
Integer
checkType
,
String
itemName
)
{
Integer
itemCount
=
checkResultService
.
selectItemCount
(
batchNo
);
if
(
itemCount
.
equals
(
itemSize
))
{
// 所有属性已全部入库,给前端发送消息
...
...
@@ -139,8 +140,29 @@ public class CheckModelAction {
e
.
printStackTrace
();
}
// 全站校验生成报告
if
(
checkType
==
0
)
{
// 全站校验生成报告
checkResultService
.
saveSql
(
orgCode
,
checkPeopleName
);
List
<
CheckModel
>
checkModels
=
checkModelService
.
selectByOrgCode
(
orgCode
);
checkModels
.
forEach
(
checkModel
->
{
saveCheckModel
(
checkModel
,
batchNo
);
});
}
else
{
// 更改校验结果
CheckModel
checkModel
=
checkModelService
.
selectCheckModelByNameCode
(
itemName
,
orgCode
);
saveCheckModel
(
checkModel
,
batchNo
);
}
}
}
private
void
saveCheckModel
(
CheckModel
checkModel
,
String
batchNo
)
{
Integer
integer
=
checkResultService
.
selectItemNo
(
batchNo
,
checkModel
.
getSequenceNbr
());
if
(
0
==
integer
)
{
checkModel
.
setCheckStatus
(
1
);
}
else
{
checkModel
.
setCheckStatus
(
2
);
}
checkModel
.
setCheckDate
(
new
Date
());
checkModelService
.
updateById
(
checkModel
);
}
}
amos-boot-system-tdc/amos-boot-module-tdc-biz/src/main/java/com/yeejoin/amos/boot/module/tdc/biz/controller/CheckModelController.java
View file @
f119683d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tdc
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto
;
import
com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel
;
import
com.yeejoin.amos.boot.module.tdc.api.service.CheckModelService
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -21,7 +23,7 @@ import java.util.List;
@RestController
@Api
(
tags
=
"校验模型api"
)
@RequestMapping
(
value
=
"/model"
)
public
class
CheckModelController
{
public
class
CheckModelController
extends
BaseController
{
@Autowired
CheckModelService
checkModelService
;
...
...
@@ -55,7 +57,8 @@ public class CheckModelController {
@GetMapping
(
value
=
"/CheckAllModel/{amosOrgCode}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"点击全站校验"
,
notes
=
"根据机构code校验模型"
)
public
void
CheckAllModel
(
@PathVariable
(
value
=
"amosOrgCode"
)
String
amosOrgCode
)
{
checkModelService
.
checkAllMode
(
amosOrgCode
);
AgencyUserModel
userInfo
=
getUserInfo
();
checkModelService
.
checkAllMode
(
amosOrgCode
,
userInfo
);
}
/**
...
...
@@ -65,6 +68,7 @@ public class CheckModelController {
@GetMapping
(
value
=
"/checkSingleMode/{modelId}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"点击单独模型校验"
,
notes
=
"根据modelId校验模型"
)
public
void
checkSingleMode
(
@PathVariable
(
value
=
"modelId"
)
String
modelId
)
{
checkModelService
.
checkSingleMode
(
modelId
);
AgencyUserModel
userInfo
=
getUserInfo
();
checkModelService
.
checkSingleMode
(
modelId
,
userInfo
);
}
}
amos-boot-system-tdc/amos-boot-module-tdc-biz/src/main/java/com/yeejoin/amos/boot/module/tdc/biz/service/impl/CheckModelImpl.java
View file @
f119683d
...
...
@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.tdc.api.vo.SubjectTreeVo;
import
com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo
;
import
com.yeejoin.amos.boot.module.tdc.biz.action.model.IdxProjectModel
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -80,27 +81,29 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
}
@Override
public
void
checkAllMode
(
String
amosOrgCode
)
{
public
void
checkAllMode
(
String
amosOrgCode
,
AgencyUserModel
userInfo
)
{
String
userName
=
userInfo
.
getUserName
();
LambdaQueryWrapper
<
CheckModel
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
CheckModel:
:
getAmosOrgCode
,
amosOrgCode
);
List
<
CheckModel
>
checkModels
=
this
.
baseMapper
.
selectList
(
wrapper
);
String
batchNo
=
UUID
.
randomUUID
().
toString
();
if
(!
CollectionUtils
.
isEmpty
(
checkModels
))
{
checkModels
.
forEach
(
checkModel
->
{
checkModelRule
(
checkModel
,
0
,
batchNo
,
amosOrgCode
);
checkModelRule
(
checkModel
,
0
,
batchNo
,
amosOrgCode
,
userName
);
});
}
}
@Override
public
void
checkSingleMode
(
String
modelId
)
{
public
void
checkSingleMode
(
String
modelId
,
AgencyUserModel
userInfo
)
{
String
userName
=
userInfo
.
getUserName
();
LambdaQueryWrapper
<
CheckModel
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
CheckModel:
:
getSequenceNbr
,
modelId
);
CheckModel
checkModel
=
this
.
baseMapper
.
selectOne
(
wrapper
);
if
(!
ObjectUtils
.
isEmpty
(
checkModel
))
{
// 调用规则校验模型
String
batchNo
=
UUID
.
randomUUID
().
toString
();
checkModelRule
(
checkModel
,
1
,
batchNo
,
checkModel
.
getAmosOrgCode
());
checkModelRule
(
checkModel
,
1
,
batchNo
,
checkModel
.
getAmosOrgCode
()
,
userName
);
}
}
...
...
@@ -112,7 +115,7 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
return
this
.
baseMapper
.
selectOne
(
wrapper
);
}
private
void
checkModelRule
(
CheckModel
checkModel
,
int
checkType
,
String
batchNo
,
String
amosOrgCode
)
{
private
void
checkModelRule
(
CheckModel
checkModel
,
int
checkType
,
String
batchNo
,
String
amosOrgCode
,
String
userName
)
{
IdxProjectModel
idxProjectModel
=
new
IdxProjectModel
();
// 查询表最新一条数据
String
idxTableName
=
checkModel
.
getIdxTableName
();
...
...
@@ -123,6 +126,7 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
}
map
.
put
(
"batch_no"
,
batchNo
);
map
.
put
(
"checkType"
,
checkType
);
map
.
put
(
"checkPeopleName"
,
userName
);
// 查询表所有字段
ResponseModel
<
JSONObject
>
model
=
idxFeignService
.
queryByTableId
(
checkModel
.
getTableId
());
...
...
amos-boot-system-tdc/amos-boot-module-tdc-biz/src/main/java/com/yeejoin/amos/boot/module/tdc/biz/service/impl/CheckReportImpl.java
View file @
f119683d
...
...
@@ -28,7 +28,7 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport>
return
this
.
page
(
page
);
}
else
{
LambdaQueryWrapper
<
CheckReport
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
CheckReport:
:
getAmosOrgCode
,
amosOrgCode
);
wrapper
.
likeRight
(
CheckReport:
:
getAmosOrgCode
,
amosOrgCode
);
return
this
.
page
(
page
,
wrapper
);
}
...
...
amos-boot-system-tdc/amos-boot-module-tdc-biz/src/main/java/com/yeejoin/amos/boot/module/tdc/biz/service/impl/CheckResultImpl.java
View file @
f119683d
...
...
@@ -165,6 +165,15 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
return
this
.
baseMapper
.
selectCount
(
wrapper
);
}
@Override
public
Integer
selectItemNo
(
String
batchNo
,
Long
modelId
)
{
LambdaQueryWrapper
<
CheckResult
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
CheckResult:
:
getBatchNo
,
batchNo
);
wrapper
.
eq
(
CheckResult:
:
getModelId
,
modelId
);
wrapper
.
eq
(
CheckResult:
:
getCheckItemResult
,
1
);
return
this
.
baseMapper
.
selectCount
(
wrapper
);
}
/**
* 获取报告数据
...
...
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