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
be235edf
Commit
be235edf
authored
Aug 16, 2021
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改水源、联动单位、警情地址bug
parent
94fc52cf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
464 additions
and
449 deletions
+464
-449
BizConstant.java
...m/yeejoin/amos/boot/biz/common/constants/BizConstant.java
+24
-0
WorkflowFeignService.java
.../boot/biz/common/workflow/feign/WorkflowFeignService.java
+8
-8
WaterResourceController.java
...module/common/biz/controller/WaterResourceController.java
+12
-27
LinkageUnitServiceImpl.java
...odule/common/biz/service/impl/LinkageUnitServiceImpl.java
+14
-24
WaterResourceServiceImpl.java
...ule/common/biz/service/impl/WaterResourceServiceImpl.java
+30
-0
AlertCalledServiceImpl.java
...t/module/jcs/biz/service/impl/AlertCalledServiceImpl.java
+376
-390
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/constants/BizConstant.java
0 → 100644
View file @
be235edf
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
constants
;
/**
* @Description: 业务通用常量类
* @Author: DELL
* @Date: 2021/5/26
*/
public
interface
BizConstant
{
/**
* 经度
*/
public
final
static
String
LONGITUDE
=
"longitude"
;
/**
* 纬度
*/
public
final
static
String
LATITUDE
=
"latitude"
;
/**
* 地址
*/
public
final
static
String
ADDRESS
=
"address"
;
}
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/workflow/feign/WorkflowFeignService.java
View file @
be235edf
...
...
@@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import
com.alibaba.fastjson.JSONObject
;
@FeignClient
(
name
=
"AMOS-API-WORKFLOW"
,
path
=
"workflow"
,
configuration
=
{
CommonMultipartSupportConfig
.
class
})
@FeignClient
(
name
=
"AMOS-API-WORKFLOW
-CJHENHAO
"
,
path
=
"workflow"
,
configuration
=
{
CommonMultipartSupportConfig
.
class
})
public
interface
WorkflowFeignService
{
/**
* 发起流程
*
*
* @param params
* @return
*/
...
...
@@ -24,7 +24,7 @@ public interface WorkflowFeignService {
/**
* 完成任务
*
*
* @param taskID
* @param variable
* @return
...
...
@@ -36,7 +36,7 @@ public interface WorkflowFeignService {
/**
* 查询当前流程下所有的可执行任务
*
*
* @param processInstanceId
* @return
*/
...
...
@@ -45,13 +45,13 @@ public interface WorkflowFeignService {
/**
* 查询当前任务的执行用户组
*
*
* @param processInstanceId
* @return
*/
@RequestMapping
(
value
=
"/task/getTaskGroupName/{taskId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
getTaskGroupName
(
@PathVariable
(
"taskId"
)
String
taskId
);
/**
* 我的待办
* @param processDefinitionKey
...
...
@@ -74,7 +74,7 @@ public interface WorkflowFeignService {
* @param processInstanceId
* @return
*/
@RequestMapping
(
value
=
"/activitiHistory/
tasks
/{processInstanceId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
queryTasksByProcessInstanceId
(
@PathVariable
(
"processInstanceId"
)
String
processInstanceId
);
@RequestMapping
(
value
=
"/activitiHistory/
historyTask
/{processInstanceId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
query
History
TasksByProcessInstanceId
(
@PathVariable
(
"processInstanceId"
)
String
processInstanceId
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/WaterResourceController.java
View file @
be235edf
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.constants.BizConstant
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.EnumsUtils
;
import
com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto
;
...
...
@@ -91,19 +92,11 @@ public class WaterResourceController extends BaseController {
model
.
setRealityImg
(
JSONArray
.
toJSONString
(
model
.
getRealityImgList
()));
model
.
setOrientationImg
(
JSONArray
.
toJSONString
(
model
.
getOrientationImgList
()));
if
(
model
.
getAddress
()!=
null
){
String
[]
data
=
model
.
getAddress
().
split
(
"@address@"
);
model
.
setAddress
(
data
[
0
]);
if
(
data
[
1
]!=
null
&&!
""
.
equals
(
data
[
1
])){
JSONObject
jSONObject
=
JSON
.
parseObject
(
data
[
1
]);
if
(
jSONObject
.
getString
(
"longitude"
)!=
null
&&!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
model
.
setLongitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"longitude"
)));
}
if
(
jSONObject
.
getString
(
"longitude"
)!=
null
&&!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
model
.
setLatitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"latitude"
)));
}
}
JSONObject
address
=
WaterResourceServiceImpl
.
getLongLatFromAddress
(
model
.
getAddress
());
model
.
setAddress
(
address
.
getString
(
BizConstant
.
ADDRESS
));
model
.
setLongitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LONGITUDE
)));
model
.
setLatitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LATITUDE
)));
}
if
(!
StringUtils
.
isEmpty
(
resourceType
))
{
...
...
@@ -174,21 +167,13 @@ public class WaterResourceController extends BaseController {
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新"
,
notes
=
"根据sequenceNbr更新"
)
public
ResponseModel
<
WaterResourceDto
>
updateBySequenceNbrWaterResource
(
@RequestBody
WaterResourceDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
if
(
model
.
getAddress
()!=
null
){
String
[]
data
=
model
.
getAddress
().
split
(
"@address@"
);
model
.
setAddress
(
data
[
0
]);
if
(
data
[
1
]!=
null
&&!
""
.
equals
(
data
[
1
])){
JSONObject
jSONObject
=
JSON
.
parseObject
(
data
[
1
]);
if
(
jSONObject
.
getString
(
"longitude"
)!=
null
&&!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
model
.
setLongitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"longitude"
)));
}
if
(
jSONObject
.
getString
(
"longitude"
)!=
null
&&!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
model
.
setLatitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"latitude"
)));
}
}
}
if
(
StringUtils
.
isNotEmpty
(
model
.
getAddress
()))
{
JSONObject
address
=
WaterResourceServiceImpl
.
getLongLatFromAddress
(
model
.
getAddress
());
model
.
setAddress
(
address
.
getString
(
BizConstant
.
ADDRESS
));
model
.
setLongitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LONGITUDE
)));
model
.
setLatitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LATITUDE
)));
}
// 更新基本信息
model
.
setSequenceNbr
(
sequenceNbr
);
model
.
setRealityImg
(
JSONArray
.
toJSONString
(
model
.
getRealityImgList
()));
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/LinkageUnitServiceImpl.java
View file @
be235edf
...
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.constants.BizConstant
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
...
...
@@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.annotation.Condition
;
import
org.typroject.tyboot.core.rdbms.annotation.Operator
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
@@ -124,17 +126,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
public
LinkageUnitDto
saveModel
(
LinkageUnitDto
linkageUnitDto
)
{
if
(
linkageUnitDto
.
getAddress
()
!=
null
)
{
String
[]
data
=
linkageUnitDto
.
getAddress
().
split
(
"@address@"
);
linkageUnitDto
.
setAddress
(
data
[
0
]);
if
(
data
[
1
]
!=
null
&&
!
""
.
equals
(
data
[
1
]))
{
JSONObject
jSONObject
=
JSON
.
parseObject
(
data
[
1
]);
if
(
jSONObject
.
getString
(
"longitude"
)
!=
null
&&
!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
linkageUnitDto
.
setLongitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"longitude"
)));
}
if
(
jSONObject
.
getString
(
"longitude"
)
!=
null
&&
!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
linkageUnitDto
.
setLatitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"latitude"
)));
}
}
JSONObject
address
=
WaterResourceServiceImpl
.
getLongLatFromAddress
(
linkageUnitDto
.
getAddress
());
linkageUnitDto
.
setAddress
(
address
.
getString
(
BizConstant
.
ADDRESS
));
linkageUnitDto
.
setLongitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LONGITUDE
)));
linkageUnitDto
.
setLatitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LATITUDE
)));
}
// 1.保存行数据
String
groupCode
=
this
.
getGroupCode
();
...
...
@@ -178,8 +173,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
fieldCodes
=
Bean
.
listToMap
(
columns
,
"fieldCode"
,
"queryStrategy"
,
DynamicFormColumn
.
class
);
LinkageUnitDto
linkageUnitDto
=
linkageUnitMapper
.
selectOne
(
false
,
fieldCodes
,
groupCode
,
sequenceNbr
);
List
<
SourceFile
>
sourceFiles
=
sourceFileServiceImpl
.
findBySourceId
(
linkageUnitDto
.
getSequenceNbr
());
linkageUnitDto
.
setImage
(
sourceFiles
);
if
(!
ValidationUtil
.
isEmpty
(
linkageUnitDto
))
{
List
<
SourceFile
>
sourceFiles
=
sourceFileServiceImpl
.
findBySourceId
(
linkageUnitDto
.
getSequenceNbr
());
linkageUnitDto
.
setImage
(
sourceFiles
);
}
return
linkageUnitDto
;
}
...
...
@@ -204,17 +201,10 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
public
LinkageUnitDto
updateById
(
LinkageUnitDto
linkageUnitDto
)
{
if
(
linkageUnitDto
.
getAddress
()
!=
null
)
{
String
[]
data
=
linkageUnitDto
.
getAddress
().
split
(
"@address@"
);
linkageUnitDto
.
setAddress
(
data
[
0
]);
if
(
data
[
1
]
!=
null
&&
!
""
.
equals
(
data
[
1
]))
{
JSONObject
jSONObject
=
JSON
.
parseObject
(
data
[
1
]);
if
(
jSONObject
.
getString
(
"longitude"
)
!=
null
&&
!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
linkageUnitDto
.
setLongitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"longitude"
)));
}
if
(
jSONObject
.
getString
(
"longitude"
)
!=
null
&&
!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
linkageUnitDto
.
setLatitude
(
Double
.
valueOf
(
jSONObject
.
getString
(
"latitude"
)));
}
}
JSONObject
address
=
WaterResourceServiceImpl
.
getLongLatFromAddress
(
linkageUnitDto
.
getAddress
());
linkageUnitDto
.
setAddress
(
address
.
getString
(
BizConstant
.
ADDRESS
));
linkageUnitDto
.
setLongitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LONGITUDE
)));
linkageUnitDto
.
setLatitude
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LATITUDE
)));
}
// 修改基本信息
updateWithModel
(
linkageUnitDto
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/WaterResourceServiceImpl.java
View file @
be235edf
...
...
@@ -6,7 +6,10 @@ import java.util.Optional;
import
javax.annotation.Resource
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.constants.BizConstant
;
import
com.yeejoin.amos.boot.biz.common.utils.MenuFrom
;
import
com.yeejoin.amos.boot.module.common.api.dto.*
;
import
com.yeejoin.amos.boot.module.common.api.entity.*
;
...
...
@@ -235,4 +238,31 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
public
List
<
WaterResourceTypeDto
>
getWaterResourceTypeList
(
Boolean
isDelete
)
{
return
waterResourceMapper
.
getWaterResourceTypeList
(
isDelete
);
}
public
static
JSONObject
getLongLatFromAddress
(
String
address
)
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
BizConstant
.
ADDRESS
,
""
);
result
.
put
(
BizConstant
.
LONGITUDE
,
"0"
);
result
.
put
(
BizConstant
.
LATITUDE
,
"0"
);
if
(
StringUtils
.
isNotEmpty
(
address
))
{
String
[]
addressData
=
address
.
split
(
"@address@"
);
if
(
addressData
.
length
>
1
)
{
result
.
put
(
BizConstant
.
ADDRESS
,
addressData
[
0
]);
JSONObject
langLatObj
=
JSON
.
parseObject
(
addressData
[
1
]);
if
(
StringUtils
.
isNotEmpty
(
langLatObj
.
getString
(
BizConstant
.
LONGITUDE
)))
{
result
.
put
(
BizConstant
.
LONGITUDE
,
langLatObj
.
getString
(
BizConstant
.
LONGITUDE
));
}
else
{
result
.
put
(
BizConstant
.
LONGITUDE
,
"0"
);
}
if
(
StringUtils
.
isNotEmpty
(
langLatObj
.
getString
(
BizConstant
.
LATITUDE
)))
{
result
.
put
(
BizConstant
.
LATITUDE
,
langLatObj
.
getString
(
BizConstant
.
LATITUDE
));
}
else
{
result
.
put
(
BizConstant
.
LATITUDE
,
"0"
);
}
}
else
{
result
.
put
(
BizConstant
.
ADDRESS
,
addressData
[
0
]);
}
}
return
result
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/AlertCalledServiceImpl.java
View file @
be235edf
...
...
@@ -8,12 +8,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.constants.BizConstant
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
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.dto.RequestData
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.*
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerData
;
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.Template
;
...
...
@@ -32,415 +40,393 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.StringUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 警情接警记录 服务实现类
*
* @author tb
* @date 2021-06-17
*/
* 警情接警记录 服务实现类
*
* @author tb
* @date 2021-06-17
*/
@Service
public
class
AlertCalledServiceImpl
extends
BaseService
<
AlertCalledDto
,
AlertCalled
,
AlertCalledMapper
>
implements
IAlertCalledService
{
@Autowired
RedisUtils
redisUtils
;
@Autowired
AlertCalledMapper
alertCalledMapper
;
@Autowired
private
AlertFormValueServiceImpl
iAlertFormValueService
;
public
class
AlertCalledServiceImpl
extends
BaseService
<
AlertCalledDto
,
AlertCalled
,
AlertCalledMapper
>
implements
IAlertCalledService
{
@Autowired
private
ESAlertCalledService
eSAlertCalledService
;
RedisUtils
redisUtils
;
@Autowired
AlertCalledMapper
alertCalledMapper
;
@Autowired
RuleAlertCalledService
ruleAlertCalledService
;
@Autowired
private
EmqKeeper
emqKeeper
;
@Value
(
"${mqtt.topic.command.alert.notice}"
)
private
String
topic
;
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
@Autowired
TemplateMapper
templateMapper
;
@Autowired
PowerTransferMapper
powerTransferMapper
;
@Autowired
AlertSubmittedMapper
alertSubmittedMapper
;
/**
*
* 指挥系统 未结束的警情列表
*
* **/
@Override
public
List
<
AlertCalledZhDto
>
alertCalledListByAlertStatus
(
Integer
pageNum
,
Integer
pageSize
,
RequestData
par
)
{
List
<
AlertCalledZhDto
>
list
=
alertCalledMapper
.
alertCalledListByAlertStatus
(
pageNum
,
pageSize
,
par
);
return
list
;
}
@Override
public
int
alertCalledListByAlertStatusCount
(
RequestData
par
)
{
return
alertCalledMapper
.
alertCalledListByAlertStatusCount
(
par
);
}
/**
*
* 根据灾情id 查询灾情详情
*
* **/
@Override
public
Object
selectAlertCalledById
(
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
ALERTCALLED_ID
+
id
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
ALERTCALLED_ID
+
id
);
return
obj
;
}
else
{
// 警情基本信息
AlertCalled
alertCalled
=
this
.
getById
(
id
);
QueryWrapper
<
AlertFormValue
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"alert_called_id"
,
id
);
// 警情动态表单数据
List
<
AlertFormValue
>
list
=
iAlertFormValueService
.
list
(
queryWrapper
);
List
<
FormValue
>
formValue
=
new
ArrayList
<
FormValue
>();
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
for
(
AlertFormValue
alertFormValue
:
list
)
{
FormValue
value
=
new
FormValue
(
alertFormValue
.
getFieldCode
(),
alertFormValue
.
getFieldName
(),
"text"
,
alertFormValue
.
getFieldValue
(),
alertFormValue
.
getBlock
());
formValue
.
add
(
value
);
}
}
AlertCalledFormDto
alertCalledFormVo
=
new
AlertCalledFormDto
(
alertCalled
,
formValue
);
redisUtils
.
set
(
RedisKey
.
ALERTCALLED_ID
+
id
,
JSON
.
toJSON
(
alertCalledFormVo
),
time
);
return
alertCalledFormVo
;
}
}
/**
*
* <pre>
* 保存警情信息
* </pre>
*
* @param alertCalledObjsDto
* @return
*/
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AlertCalledObjsDto
createAlertCalled
(
AlertCalledObjsDto
alertCalledObjsDto
)
{
try
{
// 警情基本信息
AlertCalled
alertCalled
=
alertCalledObjsDto
.
getAlertCalled
();
if
(
alertCalled
.
getAddress
()!=
null
){
String
[]
data
=
alertCalled
.
getAddress
().
split
(
"@address@"
);
alertCalled
.
setAddress
(
data
[
0
]);
if
(
data
[
1
]!=
null
&&!
""
.
equals
(
data
[
1
])){
JSONObject
jSONObject
=
JSON
.
parseObject
(
data
[
1
]);
if
(
jSONObject
.
getString
(
"longitude"
)!=
null
&&!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
alertCalled
.
setCoordinateX
(
Double
.
valueOf
(
jSONObject
.
getString
(
"longitude"
)));
}
if
(
jSONObject
.
getString
(
"longitude"
)!=
null
&&!
""
.
equals
(
jSONObject
.
getString
(
"longitude"
)))
{
alertCalled
.
setCoordinateY
(
Double
.
valueOf
(
jSONObject
.
getString
(
"latitude"
)));
}
}
}
alertCalled
.
setCallTime
(
new
Date
());
if
(
AlertStageEnums
.
RG
.
getValue
().
equals
(
alertCalled
.
getAlertSourceCode
())||
AlertStageEnums
.
RG
.
getValue
().
equals
(
alertCalled
.
getAlertSourceCode
())){
alertCalled
.
setType
(
"0"
);
}
else
{
alertCalled
.
setType
(
"1"
);
}
// 判断是否归并警情
if
(
alertCalled
.
getFatherAlert
()
!=
null
)
{
// 警情归并,设置当前警情状态为结束。
alertCalled
.
setAlertStatus
(
true
);
alertCalled
.
setAlertStage
(
AlertStageEnums
.
JQJB
.
getValue
());
alertCalled
.
setAlarmType
(
AlertStageEnums
.
JQGB
.
getValue
());
alertCalled
.
setAlarmTypeCode
(
AlertStageEnums
.
JQGB
.
getCode
());
this
.
save
(
alertCalled
);
// 动态表单
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
// 填充警情主键
alertFormValuelist
.
stream
().
forEach
(
alertFormValue
->
{
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlertTypeCode
());
});
// 保存动态表单数据
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
}
else
{
// 警情报送
// ****************************************************待确认开发
alertCalled
.
setAlertStatus
(
false
);
alertCalled
.
setIsDelete
(
false
);
alertCalled
.
setAlertStage
(
AlertStageEnums
.
LLDP
.
getValue
());
alertCalled
.
setAlarmType
(
AlertStageEnums
.
JQCB
.
getValue
());
alertCalled
.
setAlarmTypeCode
(
AlertStageEnums
.
JQCB
.
getCode
());
this
.
save
(
alertCalled
);
// 动态表单
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
// 填充警情主键
alertFormValuelist
.
stream
().
forEach
(
alertFormValue
->
{
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlertTypeCode
());
});
// 保存动态表单数据
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
alertCalledObjsDto
.
setAlertCalled
(
alertCalled
);
alertCalledObjsDto
.
setAlertFormValue
(
alertFormValuelist
);
//调用规则
ruleAlertCalledService
.
fireAlertCalledRule
(
alertCalledObjsDto
);
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper
.
getMqttClient
().
publish
(
topic
,
"0"
.
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
true
);
}
/**
* 同步保存ES
*/
eSAlertCalledService
.
saveAlertCalledToES
(
alertCalled
);
return
alertCalledObjsDto
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"报送失败,系统异常!"
);
}
}
/**
* 根据id 修改警情
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*
*/
@Override
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
boolean
updateAlertCalled
(
Long
id
,
String
code
)
{
// TODO Auto-generated method stub
try
{
switch
(
code
)
{
case
"314"
:
alertCalledMapper
.
update
(
null
,
new
UpdateWrapper
<
AlertCalled
>().
eq
(
"sequence_nbr"
,
id
)
.
set
(
"alert_status"
,
1
).
set
(
"alert_stage"
,
AlertStageEnums
.
ZBQJ
.
getValue
()).
set
(
"alarm_type"
,
AlertStageEnums
.
FJQ
.
getValue
()).
set
(
"alarm_type_code"
,
AlertStageEnums
.
FJQ
.
getCode
()));
break
;
case
"315"
:
alertCalledMapper
.
update
(
null
,
new
UpdateWrapper
<
AlertCalled
>().
eq
(
"sequence_nbr"
,
id
)
.
set
(
"alert_status"
,
1
).
set
(
"alert_stage"
,
AlertStageEnums
.
CZJS
.
getValue
()));
break
;
default
:
alertCalledMapper
.
update
(
null
,
new
UpdateWrapper
<
AlertCalled
>().
eq
(
"sequence_nbr"
,
id
)
.
set
(
"alert_stage"
,
AlertStageEnums
.
CZGZ
.
getValue
()));
break
;
}
AlertCalled
alertCalled
=
this
.
getById
(
id
);
//删除缓存
redisUtils
.
del
(
RedisKey
.
ALERTCALLED_ID
+
id
);
/**
* 同步更新存ES
*/
eSAlertCalledService
.
saveAlertCalledToES
(
alertCalled
);
//通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper
.
getMqttClient
().
publish
(
topic
,
"1"
.
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
true
);
return
true
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常!"
);
}
}
private
static
int
comparingByGroupVal
(
Map
<
String
,
Object
>
map
,
Map
<
String
,
Object
>
map2
,
String
key
)
{
int
result
=
0
;
if
(
map
.
get
(
key
)
instanceof
Date
)
{
long
r1
=
((
Date
)
map
.
get
(
key
)).
getTime
();
long
r2
=
((
Date
)
map2
.
get
(
key
)).
getTime
();
result
=
Long
.
compare
(
r1
,
r2
);
}
return
result
;
}
/**
* 根据时间区间查询警情列表信息
*
* @param beginDate 开始时间
* @param endDate 结束时间
*/
public
List
<
Map
<
String
,
Object
>>
listByDateRange
(
String
beginDate
,
String
endDate
)
{
// 查询指定日期内的警情列表
List
<
AlertCalled
>
alertCalledList
=
@Autowired
TemplateMapper
templateMapper
;
@Autowired
PowerTransferMapper
powerTransferMapper
;
@Autowired
AlertSubmittedMapper
alertSubmittedMapper
;
@Autowired
private
AlertFormValueServiceImpl
iAlertFormValueService
;
@Autowired
private
ESAlertCalledService
eSAlertCalledService
;
@Autowired
private
EmqKeeper
emqKeeper
;
@Value
(
"${mqtt.topic.command.alert.notice}"
)
private
String
topic
;
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
private
static
int
comparingByGroupVal
(
Map
<
String
,
Object
>
map
,
Map
<
String
,
Object
>
map2
,
String
key
)
{
int
result
=
0
;
if
(
map
.
get
(
key
)
instanceof
Date
)
{
long
r1
=
((
Date
)
map
.
get
(
key
)).
getTime
();
long
r2
=
((
Date
)
map2
.
get
(
key
)).
getTime
();
result
=
Long
.
compare
(
r1
,
r2
);
}
return
result
;
}
/**
* 指挥系统 未结束的警情列表
**/
@Override
public
List
<
AlertCalledZhDto
>
alertCalledListByAlertStatus
(
Integer
pageNum
,
Integer
pageSize
,
RequestData
par
)
{
List
<
AlertCalledZhDto
>
list
=
alertCalledMapper
.
alertCalledListByAlertStatus
(
pageNum
,
pageSize
,
par
);
return
list
;
}
@Override
public
int
alertCalledListByAlertStatusCount
(
RequestData
par
)
{
return
alertCalledMapper
.
alertCalledListByAlertStatusCount
(
par
);
}
/**
* 根据灾情id 查询灾情详情
**/
@Override
public
Object
selectAlertCalledById
(
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
ALERTCALLED_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
ALERTCALLED_ID
+
id
);
return
obj
;
}
else
{
// 警情基本信息
AlertCalled
alertCalled
=
this
.
getById
(
id
);
QueryWrapper
<
AlertFormValue
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"alert_called_id"
,
id
);
// 警情动态表单数据
List
<
AlertFormValue
>
list
=
iAlertFormValueService
.
list
(
queryWrapper
);
List
<
FormValue
>
formValue
=
new
ArrayList
<
FormValue
>();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
AlertFormValue
alertFormValue
:
list
)
{
FormValue
value
=
new
FormValue
(
alertFormValue
.
getFieldCode
(),
alertFormValue
.
getFieldName
(),
"text"
,
alertFormValue
.
getFieldValue
(),
alertFormValue
.
getBlock
());
formValue
.
add
(
value
);
}
}
AlertCalledFormDto
alertCalledFormVo
=
new
AlertCalledFormDto
(
alertCalled
,
formValue
);
redisUtils
.
set
(
RedisKey
.
ALERTCALLED_ID
+
id
,
JSON
.
toJSON
(
alertCalledFormVo
),
time
);
return
alertCalledFormVo
;
}
}
/**
* <pre>
* 保存警情信息
* </pre>
*
* @param alertCalledObjsDto
* @return
*/
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AlertCalledObjsDto
createAlertCalled
(
AlertCalledObjsDto
alertCalledObjsDto
)
{
try
{
// 警情基本信息
AlertCalled
alertCalled
=
alertCalledObjsDto
.
getAlertCalled
();
if
(
alertCalled
.
getAddress
()
!=
null
)
{
JSONObject
address
=
WaterResourceServiceImpl
.
getLongLatFromAddress
(
alertCalled
.
getAddress
());
alertCalled
.
setAddress
(
address
.
getString
(
BizConstant
.
ADDRESS
));
alertCalled
.
setCoordinateX
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LONGITUDE
)));
alertCalled
.
setCoordinateY
(
Double
.
valueOf
(
address
.
getString
(
BizConstant
.
LATITUDE
)));
}
alertCalled
.
setCallTime
(
new
Date
());
if
(
AlertStageEnums
.
RG
.
getValue
().
equals
(
alertCalled
.
getAlertSourceCode
())
||
AlertStageEnums
.
RG
.
getValue
().
equals
(
alertCalled
.
getAlertSourceCode
()))
{
alertCalled
.
setType
(
"0"
);
}
else
{
alertCalled
.
setType
(
"1"
);
}
// 判断是否归并警情
if
(
alertCalled
.
getFatherAlert
()
!=
null
)
{
// 警情归并,设置当前警情状态为结束。
alertCalled
.
setAlertStatus
(
true
);
alertCalled
.
setAlertStage
(
AlertStageEnums
.
JQJB
.
getValue
());
alertCalled
.
setAlarmType
(
AlertStageEnums
.
JQGB
.
getValue
());
alertCalled
.
setAlarmTypeCode
(
AlertStageEnums
.
JQGB
.
getCode
());
this
.
save
(
alertCalled
);
// 动态表单
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
// 填充警情主键
alertFormValuelist
.
stream
().
forEach
(
alertFormValue
->
{
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlertTypeCode
());
});
// 保存动态表单数据
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
}
else
{
// 警情报送
// ****************************************************待确认开发
alertCalled
.
setAlertStatus
(
false
);
alertCalled
.
setIsDelete
(
false
);
alertCalled
.
setAlertStage
(
AlertStageEnums
.
LLDP
.
getValue
());
alertCalled
.
setAlarmType
(
AlertStageEnums
.
JQCB
.
getValue
());
alertCalled
.
setAlarmTypeCode
(
AlertStageEnums
.
JQCB
.
getCode
());
this
.
save
(
alertCalled
);
// 动态表单
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
// 填充警情主键
alertFormValuelist
.
stream
().
forEach
(
alertFormValue
->
{
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlertTypeCode
());
});
// 保存动态表单数据
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
alertCalledObjsDto
.
setAlertCalled
(
alertCalled
);
alertCalledObjsDto
.
setAlertFormValue
(
alertFormValuelist
);
//调用规则
ruleAlertCalledService
.
fireAlertCalledRule
(
alertCalledObjsDto
);
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper
.
getMqttClient
().
publish
(
topic
,
"0"
.
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
true
);
}
/**
* 同步保存ES
*/
eSAlertCalledService
.
saveAlertCalledToES
(
alertCalled
);
return
alertCalledObjsDto
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"报送失败,系统异常!"
);
}
}
/**
* 根据id 修改警情
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
@Override
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
boolean
updateAlertCalled
(
Long
id
,
String
code
)
{
// TODO Auto-generated method stub
try
{
switch
(
code
)
{
case
"314"
:
alertCalledMapper
.
update
(
null
,
new
UpdateWrapper
<
AlertCalled
>().
eq
(
"sequence_nbr"
,
id
)
.
set
(
"alert_status"
,
1
).
set
(
"alert_stage"
,
AlertStageEnums
.
ZBQJ
.
getValue
()).
set
(
"alarm_type"
,
AlertStageEnums
.
FJQ
.
getValue
()).
set
(
"alarm_type_code"
,
AlertStageEnums
.
FJQ
.
getCode
()));
break
;
case
"315"
:
alertCalledMapper
.
update
(
null
,
new
UpdateWrapper
<
AlertCalled
>().
eq
(
"sequence_nbr"
,
id
)
.
set
(
"alert_status"
,
1
).
set
(
"alert_stage"
,
AlertStageEnums
.
CZJS
.
getValue
()));
break
;
default
:
alertCalledMapper
.
update
(
null
,
new
UpdateWrapper
<
AlertCalled
>().
eq
(
"sequence_nbr"
,
id
)
.
set
(
"alert_stage"
,
AlertStageEnums
.
CZGZ
.
getValue
()));
break
;
}
AlertCalled
alertCalled
=
this
.
getById
(
id
);
//删除缓存
redisUtils
.
del
(
RedisKey
.
ALERTCALLED_ID
+
id
);
/**
* 同步更新存ES
*/
eSAlertCalledService
.
saveAlertCalledToES
(
alertCalled
);
//通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper
.
getMqttClient
().
publish
(
topic
,
"1"
.
getBytes
(),
RuleConfig
.
DEFAULT_QOS
,
true
);
return
true
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常!"
);
}
}
/**
* 根据时间区间查询警情列表信息
*
* @param beginDate 开始时间
* @param endDate 结束时间
*/
public
List
<
Map
<
String
,
Object
>>
listByDateRange
(
String
beginDate
,
String
endDate
)
{
// 查询指定日期内的警情列表
List
<
AlertCalled
>
alertCalledList
=
this
.
list
(
new
LambdaQueryWrapper
<
AlertCalled
>().
apply
(!
ValidationUtil
.
isEmpty
(
beginDate
),
"call_time >= '"
+
beginDate
+
"'"
).
le
(
true
,
AlertCalled:
:
getCallTime
,
endDate
));
Map
<
String
,
String
>
queryParams
=
Maps
.
newHashMap
();
queryParams
.
put
(
"beginDate"
,
beginDate
);
queryParams
.
put
(
"endDate"
,
endDate
);
List
<
Map
<
String
,
Object
>>
allList
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
alertCalledList
))
{
Map
<
String
,
List
<
AlertCalled
>>
alertCalledMap
=
alertCalledList
.
stream
().
collect
(
Collectors
.
groupingBy
(
AlertCalled:
:
getAlertTypeCode
));
Map
<
Long
,
AlertCalled
>
calledMap
=
alertCalledList
.
stream
().
collect
(
Collectors
.
toMap
(
AlertCalled:
:
getSequenceNbr
,
Function
.
identity
()));
alertCalledMap
.
forEach
((
alertTypeCode
,
list
)
->
{
allList
.
addAll
(
iAlertFormValueService
.
listAll
(
alertTypeCode
,
queryParams
));
});
allList
.
forEach
(
i
->
{
AlertCalled
alertCalled
=
calledMap
.
get
(
Long
.
parseLong
(
i
.
get
(
"instanceId"
).
toString
()));
i
.
putAll
(
Bean
.
BeantoMap
(
alertCalled
));
});
}
// 按接警时间正序排序
allList
.
sort
((
e
,
o
)
->
comparingByGroupVal
(
e
,
o
,
"callTime"
));
return
allList
;
}
public
Map
<
String
,
Object
>
getAlertInfoList
(
String
beginDate
,
String
endDate
)
{
Map
<
String
,
Object
>
result
=
Maps
.
newHashMap
();
List
<
Map
<
String
,
Object
>>
list
=
listByDateRange
(
beginDate
,
endDate
);
// 获取接警情况模板
List
<
Template
>
templateList
=
templateMapper
.
selectList
(
new
LambdaQueryWrapper
<
Template
>().
eq
(
Template:
:
getFormat
,
false
).
like
(
Template:
:
getTypeCode
,
DutyInfoEnum
.
接警情况
.
getKey
()
+
"-"
));
Map
<
String
,
Template
>
templateMap
=
templateList
.
stream
().
collect
(
Collectors
.
toMap
(
Template:
:
getTypeCode
,
Function
.
identity
()));
List
<
String
>
contentList
=
Lists
.
newArrayList
();
list
.
forEach
(
i
->
{
String
tempContent
=
templateMap
.
get
(
DutyInfoEnum
.
接警情况
.
getKey
()
+
"-"
+
i
.
get
(
"alertTypeCode"
)).
getContent
();
contentList
.
add
(
replaceTemplate
(
tempContent
,
i
));
});
Map
<
String
,
Integer
>
statusCountMap
=
alertCalledMapper
.
queryAlertStatusCount
(
beginDate
,
endDate
);
Integer
unFinishedCount
=
this
.
count
(
new
LambdaQueryWrapper
<
AlertCalled
>().
eq
(
AlertCalled:
:
getAlertStatus
,
"0"
));
result
.
put
(
"alertInfoList"
,
contentList
);
result
.
putAll
(
statusCountMap
);
result
.
put
(
"unFinishedCount"
,
unFinishedCount
);
return
result
;
}
/**
* 替换模板
*
* @param tempContent 模板
* @param objMap 对象map
* @return
*/
private
String
replaceTemplate
(
String
tempContent
,
Map
<
String
,
Object
>
objMap
)
{
int
size
=
objMap
.
size
();
String
[]
keys
=
objMap
.
keySet
().
toArray
(
new
String
[
size
]);
Object
[]
values
=
objMap
.
values
().
toArray
(
new
Object
[
size
]);
List
<
String
>
strList
=
Lists
.
newArrayList
();
for
(
Object
obj
:
values
)
{
if
(!
ValidationUtil
.
isEmpty
(
obj
))
{
if
(
obj
instanceof
Date
)
{
obj
=
DateUtils
.
date2LongStr
((
Date
)
obj
);
}
strList
.
add
(
obj
.
toString
());
}
else
{
strList
.
add
(
""
);
}
}
return
StringUtils
.
replaceEach
(
tempContent
,
keys
,
strList
.
toArray
(
new
String
[
strList
.
size
()]));
}
@Override
public
Map
<
String
,
Object
>
selectAlertCalledKeyValueLabelById
(
Long
id
)
{
// 警情基本信息
AlertCalled
alertCalled
=
this
.
getById
(
id
);
QueryWrapper
<
AlertFormValue
>
queryWrapper
=
new
QueryWrapper
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"title"
,
"【"
+
alertCalled
.
getAlertType
()+
"】"
+
alertCalled
.
getAddress
());
queryWrapper
.
eq
(
"alert_called_id"
,
id
);
// 警情动态表单数据
List
<
KeyValueLabel
>
listdate
=
new
ArrayList
<>();
List
<
AlertFormValue
>
list
=
iAlertFormValueService
.
list
(
queryWrapper
);
listdate
.
add
(
new
KeyValueLabel
(
"接警时间"
,
"callTime"
,
alertCalled
.
getCallTime
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情地点"
,
"address"
,
alertCalled
.
getAddress
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情类型"
,
"alertType"
,
alertCalled
.
getAlertType
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情阶段"
,
"alertStage"
,
alertCalled
.
getAlertStage
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情等级"
,
"responseLevel"
,
"无"
));
listdate
.
add
(
new
KeyValueLabel
(
"被困人数"
,
"trappedNum"
,
alertCalled
.
getTrappedNum
()));
listdate
.
add
(
new
KeyValueLabel
(
"伤亡人数"
,
"casualtiesNum"
,
alertCalled
.
getCasualtiesNum
()));
listdate
.
add
(
new
KeyValueLabel
(
"联系人"
,
"contactUser"
,
alertCalled
.
getContactUser
()));
listdate
.
add
(
new
KeyValueLabel
(
"联系电话"
,
"contactPhone"
,
alertCalled
.
getContactPhone
()));
listdate
.
add
(
new
KeyValueLabel
(
"联系人电话"
,
"contactPhone"
,
alertCalled
.
getContactPhone
()));
list
.
stream
().
forEach
(
AlertFormValue
->{
listdate
.
add
(
new
KeyValueLabel
(
AlertFormValue
.
getFieldName
(),
AlertFormValue
.
getFieldCode
(),
AlertFormValue
.
getFieldValue
()));
});
map
.
put
(
"data"
,
listdate
);
return
map
;
}
@Override
public
List
<
KeyValueLabel
>
selectAlertCalledcount
(
Long
id
)
{
// 警情基本信息
AlertCalled
alertCalled
=
this
.
getById
(
id
);
List
<
KeyValueLabel
>
listdate
=
new
ArrayList
<>();
listdate
.
add
(
new
KeyValueLabel
(
"被困人数"
,
"trappedNum"
,
alertCalled
.
getTrappedNum
()));
listdate
.
add
(
new
KeyValueLabel
(
"伤亡人数"
,
"casualtiesNum"
,
alertCalled
.
getCasualtiesNum
()));
return
listdate
;
}
@Override
public
List
<
KeyValueLabel
>
powercount
(
Long
id
)
{
Map
<
String
,
Integer
>
map
=
powerTransferMapper
.
getCarNum
(
id
);
"call_time >= '"
+
beginDate
+
"'"
).
le
(
true
,
AlertCalled:
:
getCallTime
,
endDate
));
Map
<
String
,
String
>
queryParams
=
Maps
.
newHashMap
();
queryParams
.
put
(
"beginDate"
,
beginDate
);
queryParams
.
put
(
"endDate"
,
endDate
);
List
<
Map
<
String
,
Object
>>
allList
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
alertCalledList
))
{
Map
<
String
,
List
<
AlertCalled
>>
alertCalledMap
=
alertCalledList
.
stream
().
collect
(
Collectors
.
groupingBy
(
AlertCalled:
:
getAlertTypeCode
));
Map
<
Long
,
AlertCalled
>
calledMap
=
alertCalledList
.
stream
().
collect
(
Collectors
.
toMap
(
AlertCalled:
:
getSequenceNbr
,
Function
.
identity
()));
alertCalledMap
.
forEach
((
alertTypeCode
,
list
)
->
{
allList
.
addAll
(
iAlertFormValueService
.
listAll
(
alertTypeCode
,
queryParams
));
});
allList
.
forEach
(
i
->
{
AlertCalled
alertCalled
=
calledMap
.
get
(
Long
.
parseLong
(
i
.
get
(
"instanceId"
).
toString
()));
i
.
putAll
(
Bean
.
BeantoMap
(
alertCalled
));
});
}
// 按接警时间正序排序
allList
.
sort
((
e
,
o
)
->
comparingByGroupVal
(
e
,
o
,
"callTime"
));
return
allList
;
}
public
Map
<
String
,
Object
>
getAlertInfoList
(
String
beginDate
,
String
endDate
)
{
Map
<
String
,
Object
>
result
=
Maps
.
newHashMap
();
List
<
Map
<
String
,
Object
>>
list
=
listByDateRange
(
beginDate
,
endDate
);
// 获取接警情况模板
List
<
Template
>
templateList
=
templateMapper
.
selectList
(
new
LambdaQueryWrapper
<
Template
>().
eq
(
Template:
:
getFormat
,
false
).
like
(
Template:
:
getTypeCode
,
DutyInfoEnum
.
接警情况
.
getKey
()
+
"-"
));
Map
<
String
,
Template
>
templateMap
=
templateList
.
stream
().
collect
(
Collectors
.
toMap
(
Template:
:
getTypeCode
,
Function
.
identity
()));
List
<
String
>
contentList
=
Lists
.
newArrayList
();
list
.
forEach
(
i
->
{
String
tempContent
=
templateMap
.
get
(
DutyInfoEnum
.
接警情况
.
getKey
()
+
"-"
+
i
.
get
(
"alertTypeCode"
)).
getContent
();
contentList
.
add
(
replaceTemplate
(
tempContent
,
i
));
});
Map
<
String
,
Integer
>
statusCountMap
=
alertCalledMapper
.
queryAlertStatusCount
(
beginDate
,
endDate
);
Integer
unFinishedCount
=
this
.
count
(
new
LambdaQueryWrapper
<
AlertCalled
>().
eq
(
AlertCalled:
:
getAlertStatus
,
"0"
));
result
.
put
(
"alertInfoList"
,
contentList
);
result
.
putAll
(
statusCountMap
);
result
.
put
(
"unFinishedCount"
,
unFinishedCount
);
return
result
;
}
/**
* 替换模板
*
* @param tempContent 模板
* @param objMap 对象map
* @return
*/
private
String
replaceTemplate
(
String
tempContent
,
Map
<
String
,
Object
>
objMap
)
{
int
size
=
objMap
.
size
();
String
[]
keys
=
objMap
.
keySet
().
toArray
(
new
String
[
size
]);
Object
[]
values
=
objMap
.
values
().
toArray
(
new
Object
[
size
]);
List
<
String
>
strList
=
Lists
.
newArrayList
();
for
(
Object
obj
:
values
)
{
if
(!
ValidationUtil
.
isEmpty
(
obj
))
{
if
(
obj
instanceof
Date
)
{
obj
=
DateUtils
.
date2LongStr
((
Date
)
obj
);
}
strList
.
add
(
obj
.
toString
());
}
else
{
strList
.
add
(
""
);
}
}
return
StringUtils
.
replaceEach
(
tempContent
,
keys
,
strList
.
toArray
(
new
String
[
strList
.
size
()]));
}
@Override
public
Map
<
String
,
Object
>
selectAlertCalledKeyValueLabelById
(
Long
id
)
{
// 警情基本信息
AlertCalled
alertCalled
=
this
.
getById
(
id
);
QueryWrapper
<
AlertFormValue
>
queryWrapper
=
new
QueryWrapper
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"title"
,
"【"
+
alertCalled
.
getAlertType
()
+
"】"
+
alertCalled
.
getAddress
());
queryWrapper
.
eq
(
"alert_called_id"
,
id
);
// 警情动态表单数据
List
<
KeyValueLabel
>
listdate
=
new
ArrayList
<>();
List
<
AlertFormValue
>
list
=
iAlertFormValueService
.
list
(
queryWrapper
);
listdate
.
add
(
new
KeyValueLabel
(
"接警时间"
,
"callTime"
,
alertCalled
.
getCallTime
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情地点"
,
"address"
,
alertCalled
.
getAddress
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情类型"
,
"alertType"
,
alertCalled
.
getAlertType
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情阶段"
,
"alertStage"
,
alertCalled
.
getAlertStage
()));
listdate
.
add
(
new
KeyValueLabel
(
"警情等级"
,
"responseLevel"
,
"无"
));
listdate
.
add
(
new
KeyValueLabel
(
"被困人数"
,
"trappedNum"
,
alertCalled
.
getTrappedNum
()));
listdate
.
add
(
new
KeyValueLabel
(
"伤亡人数"
,
"casualtiesNum"
,
alertCalled
.
getCasualtiesNum
()));
listdate
.
add
(
new
KeyValueLabel
(
"联系人"
,
"contactUser"
,
alertCalled
.
getContactUser
()));
listdate
.
add
(
new
KeyValueLabel
(
"联系电话"
,
"contactPhone"
,
alertCalled
.
getContactPhone
()));
listdate
.
add
(
new
KeyValueLabel
(
"联系人电话"
,
"contactPhone"
,
alertCalled
.
getContactPhone
()));
list
.
stream
().
forEach
(
AlertFormValue
->
{
listdate
.
add
(
new
KeyValueLabel
(
AlertFormValue
.
getFieldName
(),
AlertFormValue
.
getFieldCode
(),
AlertFormValue
.
getFieldValue
()));
});
map
.
put
(
"data"
,
listdate
);
return
map
;
}
@Override
public
List
<
KeyValueLabel
>
selectAlertCalledcount
(
Long
id
)
{
// 警情基本信息
AlertCalled
alertCalled
=
this
.
getById
(
id
);
List
<
KeyValueLabel
>
listdate
=
new
ArrayList
<>();
listdate
.
add
(
new
KeyValueLabel
(
"被困人数"
,
"trappedNum"
,
alertCalled
.
getTrappedNum
()));
listdate
.
add
(
new
KeyValueLabel
(
"伤亡人数"
,
"casualtiesNum"
,
alertCalled
.
getCasualtiesNum
()));
return
listdate
;
}
@Override
public
List
<
KeyValueLabel
>
powercount
(
Long
id
)
{
Map
<
String
,
Integer
>
map
=
powerTransferMapper
.
getCarNum
(
id
);
// Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id);
// Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id);
//统计参与人员
List
<
KeyValueLabel
>
listdate
=
new
ArrayList
<>();
listdate
.
add
(
new
KeyValueLabel
(
"调动人力"
,
"useNum"
,
"0"
,
"人"
));
//统计参与车辆
listdate
.
add
(
new
KeyValueLabel
(
"调动人力"
,
"carNum"
,
map
.
get
(
"carNum"
),
"辆"
));
//统计参与队伍
listdate
.
add
(
new
KeyValueLabel
(
"调动单位"
,
"companyNum"
,
map
.
get
(
"companyNum"
),
"个"
));
//统计参与人员
List
<
KeyValueLabel
>
listdate
=
new
ArrayList
<>();
listdate
.
add
(
new
KeyValueLabel
(
"调动人力"
,
"useNum"
,
"0"
,
"人"
));
//统计参与车辆
listdate
.
add
(
new
KeyValueLabel
(
"调动人力"
,
"carNum"
,
map
.
get
(
"carNum"
),
"辆"
));
//统计参与队伍
listdate
.
add
(
new
KeyValueLabel
(
"调动单位"
,
"companyNum"
,
map
.
get
(
"companyNum"
),
"个"
));
return
listdate
;
}
}
@Override
public
List
<
PowerData
>
getPowerDataList
(
Long
id
)
{
List
<
PowerData
>
list
=
powerTransferMapper
.
getPowerDataList
(
id
);
return
list
;
}
@Override
public
List
<
PowerData
>
getPowerDataList
(
Long
id
)
{
List
<
PowerData
>
list
=
powerTransferMapper
.
getPowerDataList
(
id
);
return
list
;
}
@Override
public
AlertCalled
getAlertCalledById
(
Long
id
)
{
return
this
.
getById
(
id
);
}
@Override
public
AlertCalled
getAlertCalledById
(
Long
id
)
{
return
this
.
getById
(
id
);
}
@Override
public
Integer
AlertCalledcountTime
(
int
type
)
{
return
alertCalledMapper
.
AlertCalledcountTime
(
type
);
}
@Override
public
Integer
AlertCalledcountTime
(
int
type
)
{
return
alertCalledMapper
.
AlertCalledcountTime
(
type
);
}
@Override
public
List
<
AlertCalledTodyDto
>
getTodayAlertCalled
()
{
return
alertCalledMapper
.
getTodayAlertCalled
();
}
@Override
public
List
<
AlertCalledTodyDto
>
getTodayAlertCalled
()
{
return
alertCalledMapper
.
getTodayAlertCalled
();
}
}
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