Commit 4291ece1 authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/dev_upgrade' into dev_upgrade

parents b62157bf 51415d62
......@@ -483,15 +483,7 @@ public class ContingencyAction implements CustomerAction {
log.error("optionarea 加入队列失败-->" + e.getMessage());
}
MessageVO messageVO = new MessageVO();
messageVO.setTitle("应急处置事项提醒");
messageVO.setBody("【" + actionName + "】" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
messageVO.setMsgType("emergencyPlan");
messageVO.setCategory(1);
messageVO.setIsSendApp(true);
messageVO.setIsSendWeb(true);
messageVO.setRelationId(batchNo);
planVisual3dService.sendMessage(buttonCode, messageVO);
}
}
......@@ -1005,6 +997,17 @@ public class ContingencyAction implements CustomerAction {
contingencyPlanInstance.setStepCode(stepCode);
contingencyPlanInstance.setContent(buttonJson);
contingencyPlanInstanceRepository.save(contingencyPlanInstance);
MessageVO messageVO = new MessageVO();
messageVO.setTitle("应急处置事项提醒");
messageVO.setBody("【" + taskName + "】" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
messageVO.setMsgType("emergencyPlan");
messageVO.setCategory(1);
messageVO.setIsSendApp(true);
messageVO.setIsSendWeb(true);
messageVO.setRelationId(batchNo);
planVisual3dService.sendMessage(roleCode, messageVO);
}
}
}
......@@ -45,9 +45,13 @@ public class EmergencyTaskController extends BaseController{
public CommonResponse tree(){
Dict dict = new Dict();
dict.setDictCode("YJZC");
//查询应急角色
List<Dict> dictList = dictService.getDictList(dict);
List<EmergencyRelationTree> list = new ArrayList<>();
List<EmergencyRelationTree> root = new ArrayList<>();
List<EmergencyRelationTree> treeNodes = iEmergencyTaskService.treeList();
//组装对应人员节点
dictList.forEach(e->{
EmergencyRelationTree tree = new EmergencyRelationTree();
tree.setId(e.getId());
......@@ -57,13 +61,17 @@ public class EmergencyTaskController extends BaseController{
tree.setChildren(treeNodes.stream().filter(t->t.getObligationId().equals(e.getId())).collect(Collectors.toList()));
list.add(tree);
});
//增加根节点
EmergencyRelationTree tree = new EmergencyRelationTree();
tree.setId(0);
tree.setName("全部");
tree.setType("3");
tree.setCode("0");
tree.setChildren(list);
return CommonResponseUtil.success(tree);
root.add(tree);
return CommonResponseUtil.success(root);
}
......
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.fas.dao.entity.PlanRule;
import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -42,6 +43,12 @@ public interface PlanOperationRecordMapper {
*/
String getLastBatchNo();
/**
* 获取batchNo
* @return
*/
List<String> getArraysUserIds(String roleCode);
Map<String, Object> getLatestFireEquipId();
PlanRule getPlanRuleByBatchNo(String batchNo);
......
......@@ -643,10 +643,10 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
@Override
public void sendMessage(String buttonCode, MessageVO messageVO) {
public void sendMessage(String roleCode, MessageVO messageVO) {
// 添加极光推送开关
if (auroraPushSwitch) {
List<String> userIds = getUserIds(buttonCode);
List<String> userIds = getUserIds(roleCode);
if (!CollectionUtils.isEmpty(userIds)) {
messageVO.setRecivers(userIds);
sendMessage(messageVO);
......@@ -762,50 +762,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return contingencyPlanInstance;
}
private List<String> getUserIds(String buttonCode) {
String planStepJson = planStepService.getPlanStep();
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());
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")));
}
}
}
private List<String> getUserIds(String roleCode) {
// 查询角色下用户
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")));
}
}
return userIds;
return planOperationRecordMapper.getArraysUserIds(roleCode);
}
@Override
......
......@@ -112,10 +112,10 @@ public interface IPlanVisual3dService {
/**
* 极光推送消息
*
* @param buttonCode
* @param roleCode
* @param messageVO
*/
void sendMessage(String buttonCode, MessageVO messageVO);
void sendMessage(String roleCode, MessageVO messageVO);
/**
......
......@@ -140,4 +140,9 @@
<select id="getLastPlanPattern" resultType="java.lang.Integer">
select plan_pattern as planPattern from c_plan_operation_record where is_delete = 0 order by create_date desc limit 1
</select>
<select id="getArraysUserIds" resultType="java.lang.String">
SELECT amos_id from c_emergency_relation cer where obligationId in (
select id from f_dict fd where dict_value = #{roleCode}
)
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment