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 { ...@@ -483,15 +483,7 @@ public class ContingencyAction implements CustomerAction {
log.error("optionarea 加入队列失败-->" + e.getMessage()); 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 { ...@@ -1005,6 +997,17 @@ public class ContingencyAction implements CustomerAction {
contingencyPlanInstance.setStepCode(stepCode); contingencyPlanInstance.setStepCode(stepCode);
contingencyPlanInstance.setContent(buttonJson); contingencyPlanInstance.setContent(buttonJson);
contingencyPlanInstanceRepository.save(contingencyPlanInstance); 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{ ...@@ -45,9 +45,13 @@ public class EmergencyTaskController extends BaseController{
public CommonResponse tree(){ public CommonResponse tree(){
Dict dict = new Dict(); Dict dict = new Dict();
dict.setDictCode("YJZC"); dict.setDictCode("YJZC");
//查询应急角色
List<Dict> dictList = dictService.getDictList(dict); List<Dict> dictList = dictService.getDictList(dict);
List<EmergencyRelationTree> list = new ArrayList<>(); List<EmergencyRelationTree> list = new ArrayList<>();
List<EmergencyRelationTree> root = new ArrayList<>();
List<EmergencyRelationTree> treeNodes = iEmergencyTaskService.treeList(); List<EmergencyRelationTree> treeNodes = iEmergencyTaskService.treeList();
//组装对应人员节点
dictList.forEach(e->{ dictList.forEach(e->{
EmergencyRelationTree tree = new EmergencyRelationTree(); EmergencyRelationTree tree = new EmergencyRelationTree();
tree.setId(e.getId()); tree.setId(e.getId());
...@@ -57,13 +61,17 @@ public class EmergencyTaskController extends BaseController{ ...@@ -57,13 +61,17 @@ public class EmergencyTaskController extends BaseController{
tree.setChildren(treeNodes.stream().filter(t->t.getObligationId().equals(e.getId())).collect(Collectors.toList())); tree.setChildren(treeNodes.stream().filter(t->t.getObligationId().equals(e.getId())).collect(Collectors.toList()));
list.add(tree); list.add(tree);
}); });
//增加根节点
EmergencyRelationTree tree = new EmergencyRelationTree(); EmergencyRelationTree tree = new EmergencyRelationTree();
tree.setId(0); tree.setId(0);
tree.setName("全部"); tree.setName("全部");
tree.setType("3"); tree.setType("3");
tree.setCode("0"); tree.setCode("0");
tree.setChildren(list); 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; ...@@ -5,6 +5,7 @@ import com.yeejoin.amos.fas.dao.entity.PlanRule;
import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -42,6 +43,12 @@ public interface PlanOperationRecordMapper { ...@@ -42,6 +43,12 @@ public interface PlanOperationRecordMapper {
*/ */
String getLastBatchNo(); String getLastBatchNo();
/**
* 获取batchNo
* @return
*/
List<String> getArraysUserIds(String roleCode);
Map<String, Object> getLatestFireEquipId(); Map<String, Object> getLatestFireEquipId();
PlanRule getPlanRuleByBatchNo(String batchNo); PlanRule getPlanRuleByBatchNo(String batchNo);
......
...@@ -643,10 +643,10 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -643,10 +643,10 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
@Override @Override
public void sendMessage(String buttonCode, MessageVO messageVO) { public void sendMessage(String roleCode, MessageVO messageVO) {
// 添加极光推送开关 // 添加极光推送开关
if (auroraPushSwitch) { if (auroraPushSwitch) {
List<String> userIds = getUserIds(buttonCode); List<String> userIds = getUserIds(roleCode);
if (!CollectionUtils.isEmpty(userIds)) { if (!CollectionUtils.isEmpty(userIds)) {
messageVO.setRecivers(userIds); messageVO.setRecivers(userIds);
sendMessage(messageVO); sendMessage(messageVO);
...@@ -762,50 +762,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -762,50 +762,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return contingencyPlanInstance; return contingencyPlanInstance;
} }
private List<String> getUserIds(String buttonCode) { private List<String> getUserIds(String roleCode) {
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")));
}
}
}
// 查询角色下用户 return planOperationRecordMapper.getArraysUserIds(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;
} }
@Override @Override
......
...@@ -112,10 +112,10 @@ public interface IPlanVisual3dService { ...@@ -112,10 +112,10 @@ public interface IPlanVisual3dService {
/** /**
* 极光推送消息 * 极光推送消息
* *
* @param buttonCode * @param roleCode
* @param messageVO * @param messageVO
*/ */
void sendMessage(String buttonCode, MessageVO messageVO); void sendMessage(String roleCode, MessageVO messageVO);
/** /**
......
...@@ -140,4 +140,9 @@ ...@@ -140,4 +140,9 @@
<select id="getLastPlanPattern" resultType="java.lang.Integer"> <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 plan_pattern as planPattern from c_plan_operation_record where is_delete = 0 order by create_date desc limit 1
</select> </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> </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