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
2bbe46f8
Commit
2bbe46f8
authored
Oct 19, 2022
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
极光推送方法
parent
ae00fdc8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
14 deletions
+62
-14
PlanVisual3dServiceImpl.java
...os/fas/business/service/impl/PlanVisual3dServiceImpl.java
+43
-14
IPlanVisual3dService.java
...amos/fas/business/service/intfc/IPlanVisual3dService.java
+6
-0
PlanStepJsonVO.java
...java/com/yeejoin/amos/fas/business/vo/PlanStepJsonVO.java
+13
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanVisual3dServiceImpl.java
View file @
2bbe46f8
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
...
@@ -16,6 +17,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
...
@@ -16,6 +17,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.util.JSONUtil
;
import
com.yeejoin.amos.fas.business.util.JSONUtil
;
import
com.yeejoin.amos.fas.business.util.StringUtil
;
import
com.yeejoin.amos.fas.business.util.StringUtil
;
import
com.yeejoin.amos.fas.business.vo.PlanStepJsonVO
;
import
com.yeejoin.amos.fas.business.vo.PlanStepVo
;
import
com.yeejoin.amos.fas.business.vo.PlanStepVo
;
import
com.yeejoin.amos.fas.business.vo.TreeSubjectVo
;
import
com.yeejoin.amos.fas.business.vo.TreeSubjectVo
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
...
@@ -25,6 +27,7 @@ import com.yeejoin.amos.fas.dao.entity.*;
...
@@ -25,6 +27,7 @@ import com.yeejoin.amos.fas.dao.entity.*;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
...
@@ -32,6 +35,7 @@ import org.springframework.stereotype.Service;
...
@@ -32,6 +35,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
...
@@ -90,6 +94,15 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -90,6 +94,15 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired
@Autowired
private
IContingencyPlanInstanceRepository
repository
;
private
IContingencyPlanInstanceRepository
repository
;
@Autowired
private
EmqKeeper
emqKeeper
;
@Value
(
"${spring.application.name}"
)
private
String
serviceName
;
@Value
(
"${station.name}"
)
private
String
stationName
;
@Override
@Override
public
List
<
TreeSubjectVo
>
getPlanTree
()
{
public
List
<
TreeSubjectVo
>
getPlanTree
()
{
...
@@ -419,13 +432,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -419,13 +432,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"获取预案相关角色信息失败!"
);
throw
new
RuntimeException
(
"获取预案相关角色信息失败!"
);
}
}
List
<
Object
>
list
=
JSON
.
parseArray
(
json
);
List
<
PlanStepJsonVO
>
result
=
JSONObject
.
parseArray
(
json
,
PlanStepJsonVO
.
class
);
List
<
Map
<
String
,
String
>>
result
=
new
ArrayList
<
Map
<
String
,
String
>>();
List
<
String
>
roleCode
=
result
.
stream
().
map
(
PlanStepJsonVO:
:
getRoleCode
).
distinct
().
collect
(
Collectors
.
toList
());
for
(
Object
object
:
list
)
{
Map
<
String
,
String
>
ret
=
(
Map
<
String
,
String
>)
object
;
result
.
add
(
ret
);
}
List
<
String
>
roleCode
=
result
.
stream
().
map
(
t
->
t
.
get
(
"roleCode"
)).
distinct
().
collect
(
Collectors
.
toList
());
List
<
RoleModel
>
roleModelList
=
new
ArrayList
<>();
List
<
RoleModel
>
roleModelList
=
new
ArrayList
<>();
for
(
Long
key
:
user
.
getOrgRoles
().
keySet
())
{
for
(
Long
key
:
user
.
getOrgRoles
().
keySet
())
{
...
@@ -452,13 +460,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -452,13 +460,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
Map
<
String
,
String
>
userInfo
=
contingencyPlanInstanceMapper
.
getUserByUserId
(
user
.
getUserId
());
Map
<
String
,
String
>
userInfo
=
contingencyPlanInstanceMapper
.
getUserByUserId
(
user
.
getUserId
());
dto
.
setPersonImg
(
userInfo
.
get
(
"personImg"
));
dto
.
setPersonImg
(
userInfo
.
get
(
"personImg"
));
repository
.
save
(
dto
);
repository
.
save
(
dto
);
PushMsgParam
pushMsgParam
=
new
PushMsgParam
();
try
{
// TODO: 2022/10/18 接收人需从平台获取
String
topic
=
String
.
format
(
"/%s/%s/%s"
,
serviceName
,
stationName
,
"plan"
);
pushMsgParam
.
setRecivers
(
Lists
.
newArrayList
(
""
));
emqKeeper
.
getMqttClient
().
publish
(
topic
,
JSON
.
toJSONString
(
dto
).
getBytes
(),
0
,
Boolean
.
FALSE
);
pushMsgParam
.
setContent
(
JSONUtil
.
toJson
(
dto
));
}
catch
(
MqttException
e
)
{
pushMsgParam
.
setSubject
(
"REPLYMESSAGE"
);
e
.
printStackTrace
();
pushMsgParam
.
setType
(
JPushTypeEnum
.
REPLY_MESSAGE
.
getCode
());
}
pushFeign
.
sendMessageone
(
pushMsgParam
);
}
}
@Override
@Override
...
@@ -520,4 +527,26 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
...
@@ -520,4 +527,26 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
}
return
contingencyInstanceInfoMapper
.
selectDisposalActionList
(
type
,
status
,
roles
,
disposalId
);
return
contingencyInstanceInfoMapper
.
selectDisposalActionList
(
type
,
status
,
roles
,
disposalId
);
}
}
@Override
public
void
sendMessage
(
String
json
,
String
buttonCode
)
{
String
planStepJson
=
""
;
try
{
planStepJson
=
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"获取预案相关角色信息失败!"
);
}
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
=
""
;
//极光推送
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
);
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanVisual3dService.java
View file @
2bbe46f8
...
@@ -104,4 +104,10 @@ public interface IPlanVisual3dService {
...
@@ -104,4 +104,10 @@ public interface IPlanVisual3dService {
List
<
ContingencyPlanInstance
>
selectDisposalActionList
(
String
disposalId
,
List
<
RoleModel
>
roleModelList
,
int
dataType
);
List
<
ContingencyPlanInstance
>
selectDisposalActionList
(
String
disposalId
,
List
<
RoleModel
>
roleModelList
,
int
dataType
);
/**
* 极光推送
* @param json 消息体
* @param buttonCode 按钮编码
*/
void
sendMessage
(
String
json
,
String
buttonCode
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/PlanStepJsonVO.java
0 → 100644
View file @
2bbe46f8
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
import
lombok.Data
;
@Data
public
class
PlanStepJsonVO
{
private
String
stepCode
;
private
String
stepName
;
private
String
stepStatus
;
private
String
isParallel
;
private
String
roleCode
;
private
String
buttonCode
;
}
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