Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
fc567654
Commit
fc567654
authored
Oct 21, 2022
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改极光推送接口
parent
85cd05e4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
184 additions
and
46 deletions
+184
-46
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+2
-2
PlanVisual3dController.java
.../amos/fas/business/controller/PlanVisual3dController.java
+7
-0
ContingencyPlanInstanceMapper.java
...as/business/dao/mapper/ContingencyPlanInstanceMapper.java
+7
-0
PrivilegeFeign.java
...a/com/yeejoin/amos/fas/business/feign/PrivilegeFeign.java
+6
-0
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+1
-1
PlanVisual3dServiceImpl.java
...os/fas/business/service/impl/PlanVisual3dServiceImpl.java
+124
-29
IPlanVisual3dService.java
...amos/fas/business/service/intfc/IPlanVisual3dService.java
+29
-13
ContingencyPlanInstanceMapper.xml
...ain/resources/db/mapper/ContingencyPlanInstanceMapper.xml
+8
-1
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
fc567654
...
...
@@ -493,12 +493,12 @@ public class ContingencyAction implements CustomerAction {
this
.
sendcmd
(
"optionarea"
,
paramObj
,
result
);
//极光推送
iPlanVisual3dService
.
sendMessage
(
b
uttonCode
);
iPlanVisual3dService
.
sendMessage
(
b
atchNo
,
buttonCode
,
null
);
PushMsgParam
pushMsgParam
=
new
PushMsgParam
();
pushMsgParam
.
setSubject
(
"应急处置执行任务提醒"
);
pushMsgParam
.
setContent
(
"【"
+
actionName
+
"】- "
+
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
pushMsgParam
.
setType
(
JPushTypeEnum
.
TAG
.
getCode
());
iPlanVisual3dService
.
sendMessage
(
buttonCode
,
pushMsgParam
);
iPlanVisual3dService
.
sendMessage
(
b
atchNo
,
b
uttonCode
,
pushMsgParam
);
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/PlanVisual3dController.java
View file @
fc567654
...
...
@@ -256,4 +256,11 @@ public class PlanVisual3dController extends BaseController {
}
return
CommonResponseUtil2
.
success
(
planVisual3dService
.
selectDisposalActionList
(
batchNo
,
roleModelList
,
dataType
));
}
@Permission
@ApiOperation
(
value
=
"修改动作执行状态"
,
notes
=
"修改动作执行状态"
)
@PostMapping
(
value
=
"/updateStatusById"
)
public
ResponseModel
updateStatusById
(
@RequestParam
(
"id"
)
String
id
)
{
return
CommonResponseUtil
.
successNew
(
planVisual3dService
.
updateStatusById
(
id
));
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/ContingencyPlanInstanceMapper.java
View file @
fc567654
...
...
@@ -17,4 +17,11 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla
Integer
getPlanInstanceCount
(
@Param
(
"batchNo"
)
String
batchNo
);
Map
<
String
,
String
>
getUserByUserId
(
@Param
(
"userId"
)
String
userId
);
/**
* 修改动作执行状态
* @param id
* @return
*/
Boolean
updateStatusById
(
@Param
(
"id"
)
String
id
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/PrivilegeFeign.java
View file @
fc567654
...
...
@@ -32,4 +32,10 @@ public interface PrivilegeFeign {
@RequestHeader
(
name
=
"product"
,
required
=
true
)
String
product
,
@RequestHeader
(
name
=
"token"
,
required
=
true
)
String
token
,
@RequestParam
(
value
=
"roleIds"
,
required
=
true
)
String
roleIds
);
@RequestMapping
(
value
=
"/privilege/v1/role/list"
,
method
=
RequestMethod
.
GET
)
FeignClientResult
getRoleList
(
@RequestHeader
(
name
=
"appKey"
,
required
=
true
)
String
appKey
,
@RequestHeader
(
name
=
"product"
,
required
=
true
)
String
product
,
@RequestHeader
(
name
=
"token"
,
required
=
true
)
String
token
,
@RequestParam
(
value
=
"roleName"
,
required
=
true
)
String
roleName
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
fc567654
...
...
@@ -367,7 +367,7 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
ContingencyPlanInstance
planInstance
=
contingencyInstance
.
updateExtendColumn
(
contingencyPlanInstance
);
BeanUtils
.
copyProperties
(
planInstance
,
contingencyPlanInstance
);
// 确认后,移动端极光推送
planVisual3dService
.
sendMessage
(
code
);
planVisual3dService
.
sendMessage
(
batchNo
,
code
,
null
);
}
ContingencyPlanInstance
instance
=
repository
.
save
(
contingencyPlanInstance
);
// 异步数据同步之消息发送
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanVisual3dServiceImpl.java
View file @
fc567654
...
...
@@ -5,11 +5,15 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.feign.IMaasVisualServer
;
import
com.yeejoin.amos.fas.business.feign.PrivilegeFeign
;
import
com.yeejoin.amos.fas.business.feign.PushFeign
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.jpush.JPushTypeEnum
;
import
com.yeejoin.amos.fas.business.jpush.PushMsgParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IDictService
;
...
...
@@ -20,12 +24,18 @@ import com.yeejoin.amos.fas.business.util.StringUtil;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO
;
import
com.yeejoin.amos.fas.business.vo.PlanStepJsonVO
;
import
com.yeejoin.amos.fas.business.vo.PlanStepVo
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.business.vo.TreeSubjectVo
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
...
...
@@ -38,7 +48,9 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.management.relation.Role
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
...
...
@@ -105,6 +117,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Value
(
"${station.name}"
)
private
String
stationName
;
@Autowired
private
PrivilegeFeign
privilegeFeign
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@Value
(
"${plan.instance.personImg}"
)
private
String
personImg
;
...
...
@@ -512,39 +531,78 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return
contingencyInstanceInfoMapper
.
selectDisposalActionList
(
type
,
status
,
roles
,
batchNo
);
}
// @Override
// public void sendMessage(String json, String buttonCode) {
// String userIdsJoin = getUserIds(buttonCode);
// //极光推送
// PushMsgParam pushMsgParam = new PushMsgParam();
// pushMsgParam.setRecivers(Arrays.asList(userIdsJoin.split(",")));
// pushMsgParam.setContent(json);
// pushMsgParam.setSubject("REPLYMESSAGE");
// pushMsgParam.setType(JPushTypeEnum.REPLY_MESSAGE.getCode());
// pushFeign.sendMessageone(pushMsgParam);
// }
//
// @Override
// public void sendMessage(String buttonCode) {
// String userIdsJoin = getUserIds(buttonCode);
// //极光推送
// PushMsgParam pushMsgParam = new PushMsgParam();
// pushMsgParam.setRecivers(Arrays.asList(userIdsJoin.split(",")));
// pushMsgParam.setContent(JPushTypeEnum.ALL.getName());
// pushMsgParam.setSubject(JPushTypeEnum.ALL.getName());
// pushMsgParam.setType(JPushTypeEnum.ALL.getCode());
// pushFeign.sendMessageone(pushMsgParam);
// }
//
// @Override
// public void sendMessage(String buttonCode, PushMsgParam pushMsgParam) {
// String userIdsJoin = getUserIds(buttonCode);
// //极光推送
// pushMsgParam.setRecivers(Arrays.asList(userIdsJoin.split(",")));
// pushFeign.sendMessageone(pushMsgParam);
// }
@Override
public
void
sendMessage
(
String
json
,
String
buttonCode
)
{
String
userIdsJoin
=
getUserIds
(
buttonCode
);
//极光推送
PushMsgParam
pushMsgParam
=
new
PushMsgParam
();
pushMsgParam
.
setRecivers
(
Arrays
.
asList
(
userIdsJoin
.
split
(
","
)));
pushMsgParam
.
setContent
(
json
);
pushMsgParam
.
setSubject
(
"REPLYMESSAGE"
);
pushMsgParam
.
setType
(
JPushTypeEnum
.
REPLY_MESSAGE
.
getCode
());
pushFeign
.
sendMessageone
(
pushMsgParam
);
public
void
sendMessage
(
String
batchNo
,
String
buttonCode
,
PushMsgParam
pushMsgParam
)
{
List
<
String
>
userIds
=
getUserIds
(
buttonCode
);
pushMsgParam
.
setRecivers
(
userIds
);
sendMessage
(
batchNo
,
pushMsgParam
);
}
@Override
public
void
sendMessage
(
String
buttonCode
)
{
String
userIdsJoin
=
getUserIds
(
buttonCode
);
//极光推送
PushMsgParam
pushMsgParam
=
new
PushMsgParam
();
pushMsgParam
.
setRecivers
(
Arrays
.
asList
(
userIdsJoin
.
split
(
","
)));
pushMsgParam
.
setContent
(
JPushTypeEnum
.
ALL
.
getName
());
pushMsgParam
.
setSubject
(
JPushTypeEnum
.
ALL
.
getName
());
pushMsgParam
.
setType
(
JPushTypeEnum
.
ALL
.
getCode
());
pushFeign
.
sendMessageone
(
pushMsgParam
);
private
void
sendMessage
(
String
batchNo
,
PushMsgParam
pushMsgParam
){
try
{
MessageModel
model
=
new
MessageModel
();
model
.
setMsgType
(
"emergencyPlan"
);
// 关联id
if
(!
ObjectUtils
.
isEmpty
(
batchNo
)){
model
.
setRelationId
(
batchNo
);
}
// 发送人ids
model
.
setRecivers
(
pushMsgParam
.
getRecivers
());
model
.
setIsSendApp
(
true
);
model
.
setIsSendWeb
(
false
);
if
(!
ObjectUtils
.
isEmpty
(
pushMsgParam
)
&&
!
ObjectUtils
.
isEmpty
(
pushMsgParam
.
getSubject
())){
model
.
setTitle
(
pushMsgParam
.
getSubject
());
}
if
(!
ObjectUtils
.
isEmpty
(
pushMsgParam
)
&&
!
ObjectUtils
.
isEmpty
(
pushMsgParam
.
getContent
())){
model
.
setBody
(
pushMsgParam
.
getContent
());
}
model
.
setTerminal
(
"APP/WEB"
);
// 0 任务 1 通知
model
.
setCategory
(
1
);
Systemctl
.
messageClient
.
create
(
model
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
sendMessage
(
String
buttonCode
,
PushMsgParam
pushMsgParam
)
{
String
userIdsJoin
=
getUserIds
(
buttonCode
);
//极光推送
pushMsgParam
.
setRecivers
(
Arrays
.
asList
(
userIdsJoin
.
split
(
","
)));
pushFeign
.
sendMessageone
(
pushMsgParam
);
public
boolean
updateStatusById
(
String
id
)
{
return
contingencyPlanInstanceMapper
.
updateStatusById
(
id
);
}
private
String
getUserIds
(
String
buttonCode
)
{
private
List
<
String
>
getUserIds
(
String
buttonCode
)
{
String
planStepJson
=
""
;
try
{
planStepJson
=
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
...
...
@@ -553,9 +611,46 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
List
<
PlanStepJsonVO
>
planStepJsonList
=
JSONObject
.
parseArray
(
planStepJson
,
PlanStepJsonVO
.
class
);
List
<
String
>
collect
=
planStepJsonList
.
stream
().
filter
(
code
->
code
.
getButtonCode
().
equals
(
buttonCode
)).
map
(
PlanStepJsonVO:
:
getRoleCode
).
collect
(
Collectors
.
toList
());
String
roleJoin
=
String
.
join
(
","
,
collect
);
// TODO: 2022/10/19 根据多个角色code查询用户ids 先写成假数据
String
userIdsJoin
=
"3530104,3542239,3714410,3491098,3433590"
;
return
userIdsJoin
;
Toke
toke
=
remoteSecurityService
.
getServerToken
();
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
product
);
RequestContext
.
setAppKey
(
toke
.
appKey
);
ArrayList
<
String
>
userIds
=
new
ArrayList
<>();
ArrayList
<
String
>
roleIds
=
new
ArrayList
<>();
// 查询按钮下角色id
for
(
String
roleName
:
collect
)
{
FeignClientResult
roleList
;
List
<
Map
>
roleModelList
=
null
;
try
{
roleList
=
privilegeFeign
.
getRoleList
(
RequestContext
.
getAppKey
(),
RequestContext
.
getProduct
(),
RequestContext
.
getToken
(),
roleName
);
roleModelList
=
(
List
<
Map
>)
roleList
.
getResult
();
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
}
if
(!
CollectionUtils
.
isEmpty
(
roleModelList
))
{
for
(
Map
map
:
roleModelList
)
{
roleIds
.
add
(
String
.
valueOf
(
map
.
get
(
"sequenceNbr"
)));
}
}
}
// 查询角色下用户
FeignClientResult
userResult
;
List
<
Map
>
userList
=
null
;
try
{
userResult
=
privilegeFeign
.
getUserByRoleIds
(
RequestContext
.
getAppKey
(),
RequestContext
.
getProduct
(),
RequestContext
.
getToken
(),
String
.
join
(
","
,
roleIds
));
userList
=
(
List
<
Map
>)
userResult
.
getResult
();
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
}
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
for
(
Map
map
:
userList
)
{
userIds
.
add
(
String
.
valueOf
(
map
.
get
(
"userId"
)));
}
}
// String.join(",", userIds)
return
userIds
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanVisual3dService.java
View file @
fc567654
...
...
@@ -98,23 +98,39 @@ public interface IPlanVisual3dService {
List
<
ContingencyPlanInstanceVO
>
selectDisposalActionList
(
String
batchNo
,
List
<
RoleModel
>
roleModelList
,
int
dataType
);
/**
* 极光推送
* @param json 消息体
* @param buttonCode 按钮编码
*/
void
sendMessage
(
String
json
,
String
buttonCode
);
// /**
// * 极光推送
// * @param json 消息体
// * @param buttonCode 按钮编码
// */
// void sendMessage(String json, String buttonCode);
//
// /**
// * 极光推送
// * @param buttonCode 按钮编码
// */
// void sendMessage(String buttonCode);
//
// /**
// * 极光推送
// * @param buttonCode 按钮编码
// * @param pushMsgParam 消息体
// */
// void sendMessage(String buttonCode, PushMsgParam pushMsgParam);
/**
* 极光推送
* @param buttonCode 按钮编码
* 消息推送
* @param batchNo
* @param buttonCode
* @param pushMsgParam
*/
void
sendMessage
(
String
buttonCode
);
void
sendMessage
(
String
batchNo
,
String
buttonCode
,
PushMsgParam
pushMsgParam
);
/**
*
极光推送
* @param
buttonCode 按钮编码
* @
param pushMsgParam 消息体
*
修改动作执行状态
* @param
id
* @
return
*/
void
sendMessage
(
String
buttonCode
,
PushMsgParam
pushMsgParam
);
boolean
updateStatusById
(
String
id
);
}
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/ContingencyPlanInstanceMapper.xml
View file @
fc567654
...
...
@@ -2,8 +2,15 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper"
>
<update
id=
"updateStatusById"
>
UPDATE
contingency_plan_instance
SET
runstate = 1
where id = #{id}
</update>
<select
id=
"getPlanInstanceListByPage"
resultType=
"com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance"
>
<select
id=
"getPlanInstanceListByPage"
resultType=
"com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance"
>
select * from
contingency_plan_instance
where batch_no = #{batchNo}
...
...
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