Commit 8d05d977 authored by lisong's avatar lisong

修改bug

parent 7b08065e
......@@ -122,4 +122,10 @@ public interface PowerTransferMapper extends BaseMapper<PowerTransfer> {
IPage<PowerTransferResourceDto> getPowerTransferCarResource(Page<PowerTransferResourceDto> page,
@Param("alertCalledId") Long alertCalledId);
/**
* 查询未结案的航空器报警航班号
* @param alertTypeCode
* @return
*/
List<String> selectFlightNumber(@Param("alertTypeCode") String alertTypeCode);
}
......@@ -324,5 +324,13 @@
transfer.alert_called_id = #{alertCalledId}
AND is_distribution_agencies = 0
</select>
<select id="selectFlightNumber" resultType="java.lang.String">
SELECT DISTINCT(jaf.field_value) FROM `jc_alert_called` jac
left join jc_alert_form_value jaf on jac.sequence_nbr = jaf.alert_called_id
WHERE jac.alert_status = 0
and jac.alert_type_code = #{alertTypeCode}
and jaf.field_code = "flightNumber"
and jaf.field_value_code is not NULL
</select>
</mapper>
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.dto.PermissionModelDto;
import com.yeejoin.amos.boot.biz.common.enums.HomePageEnum;
......@@ -35,11 +36,14 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyResources
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -1569,6 +1573,20 @@ public class CommandController extends BaseController {
carTaskDto.getCode(),
carTaskDto.getType(),
carTaskDto.getRemarks());
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
// 执行任务完成反馈,同步修改待办任务状态
if (carTaskDto.getType() == 2 && FireCarStatusEnum.已完成.getCode().equals(carTaskDto.getCode())){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(carTaskDto.getAlertCalledId()));
model.setIsRead(true);
model.setMsgType("jcs119");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
Systemctl.messageClient.update(model);
}
return ResponseHelper.buildResponse(null);
}
......
......@@ -10,6 +10,7 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
......@@ -553,4 +554,11 @@ public class AlertCalledController extends BaseController {
public ResponseModel<Object> toCompletePoliceSituationMatch(@RequestParam Long id)throws Exception {
return ResponseHelper.buildResponse(iAlertCalledService.toCompletePoliceSituationMatch(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectFlightNumber")
@ApiOperation(httpMethod = "GET", value = "查询未结案的航空器报警存在的航班号", notes = "查询未结案的航空器报警存在的航班号")
public ResponseModel<Object> toCompletePoliceSituationMatch() throws MqttException {
return ResponseHelper.buildResponse(iAlertCalledService.selectFlightNumber());
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -147,6 +148,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@Value("${mqtt.topic.command.knowledgebase.alert.match}")
private String topicMatch;
@Value("${mqtt.topic.command.alert.noticeAviation}")
private String noticeAviation;
@Autowired
private OrgUsrServiceImpl iOrgUsrService;
......@@ -454,6 +457,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
// 航空报警器报警通知
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<String> flightNumber = powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
String flightNumIds = JSONObject.toJSONString(flightNumber);
emqKeeper.getMqttClient().publish(noticeAviation, flightNumIds.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
/**
* 同步保存ES
*/
......@@ -479,6 +489,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
}
public List<String> selectFlightNumber() throws MqttException {
return powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
}
......
......@@ -186,6 +186,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Value("${mqtt.topic.command.power.deployment}")
private String powertopic;
@Value("${mqtt.topic.command.alert.noticeAviation}")
private String noticeAviation;
@Autowired
EquipFeignClient equipFeignClient;
......@@ -348,6 +350,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"),map.get("mobiles"), map.get("usIds"), map.get("feedBack"));
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
// 航空报警器警情结案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode()) && AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<String> list = powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
emqKeeper.getMqttClient().publish(noticeAviation, JSONObject.toJSONString(list).getBytes(), RuleConfig.DEFAULT_QOS, false);
}
} catch (MqttException e) {
throw new RuntimeException();
}
......@@ -1696,7 +1705,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
if(!ValidationUtil.isEmpty(userList)) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList, null);
}
......
......@@ -9,7 +9,9 @@ import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import org.apache.commons.lang3.ObjectUtils;
import org.opengis.metadata.acquisition.Plan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -2488,10 +2490,18 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
DangerExecuteSubmitDto executeSubmitDto) throws Exception {
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(),
executeSubmitDto.getCheckLeaderId());
// 修改待办任务状态
updateTaskStatus(latentDanger);
ruleDangerService.addDangerSubmitRule(latentDanger, userIds, RuleTypeEnum.隐患审核.getCode(),
ExecuteTypeEnum.getNameByCode(executeType));
}
private void updateTaskStatus(LatentDanger latentDanger){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(latentDanger.getId()));
model.setMsgType("danger");
model.setIsRead(true);
Systemctl.messageClient.update(model);
}
@Override
public IPage<LatentDanger> reviewListDanger(PageParam pageParam, String userId) throws Exception {
String type = pageParam.get("type").toString();
......
package com.yeejoin.amos.maintenance.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
......@@ -11,8 +11,11 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper;
......@@ -115,6 +118,9 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
IRouteDao iRouteDao;
@Autowired
PlanServiceImpl planService;
final String CHECK_UPDATE_TOPIC = "maintenance/date/update";
......@@ -273,6 +279,15 @@ public class CheckServiceImpl implements ICheckService {
jsonObject.put("maintenanceTime", check.getCheckTime());
mqttGateway.publish(CHECK_UPDATE_TOPIC, jsonObject.toJSONString());
}
Plan plan = planService.queryPlanById(planTask.getPlanId());
if (!ObjectUtils.isEmpty(plan) && plan.getIsSingleExecution()){
// 单人执行
updateTaskStatus(plan.getId(), reginParams.getUserModel().getUserId());
}else {
// 多人执行
updateTaskStatus(plan.getId(), null);
}
//7.返回不合格记录
return new CheckDto(check.getId(), unqualifiedCheckItemList);
} catch (Exception e) {
......@@ -280,6 +295,17 @@ public class CheckServiceImpl implements ICheckService {
throw new Exception(e.getMessage(), e);
}
}
private void updateTaskStatus(Long planId, String userId){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(planId));
model.setIsRead(true);
model.setMsgType("maintenance");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
private void checkCanFinishTask(String mtUserSeq, PlanTask planTask, Long pointId) throws Exception {
int status;
......
......@@ -15,6 +15,10 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.dao.entity.Plan;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Sets;
......@@ -137,6 +141,9 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
private IPointClassifyDao iPointClassifyDao;
@Autowired
private PlanServiceImpl planService;
// @Value("${file.ip}")
// private String fileIp;
//
......@@ -409,6 +416,15 @@ public class CheckServiceImpl implements ICheckService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
planTaskMapper.reformStatistics(user.getUserId(), sdf.format(new Date()), requestParam.getOrgCode());
}
// 任务完成、同步修改待办任务状态
Plan plan = planService.queryPlanById(check.getPlanId());
if (!ObjectUtils.isEmpty(plan) && plan.getIsSingleExecution()){
// 单人执行
updateTaskStatus(plan.getId(), user.getUserId());
}else {
// 多人执行
updateTaskStatus(plan.getId(), null);
}
return new CheckDto(check.getId(), unqualifiedcheckItemList);
} catch (Exception e) {
......@@ -416,7 +432,16 @@ public class CheckServiceImpl implements ICheckService {
return null;
}
}
private void updateTaskStatus(Long id, String userId){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(id));
model.setIsRead(true);
model.setMsgType("patrolSystem");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
Systemctl.messageClient.update(model);
}
@Override
public void delCheckById(List<Long> list) {
// List<Long> pointIdList = checkDao.getPointIdList(list);
......
package com.yeejoin.amos.supervision.business.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.supervision.business.dto.CheckDto;
import com.yeejoin.amos.supervision.business.dto.CheckInputItemDto;
import com.yeejoin.amos.supervision.business.param.*;
......@@ -19,6 +23,7 @@ import com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.supervision.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.supervision.core.framework.PersonIdentify;
import com.yeejoin.amos.supervision.core.util.StringUtil;
import com.yeejoin.amos.supervision.dao.entity.PlanTask;
import com.yeejoin.amos.supervision.mqtt.WebMqttComponent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -82,6 +87,10 @@ public class CheckController extends AbstractBaseController {
@Value("${amosRefresh.patrol.topic}")
private String patrolTopic;
@Autowired
PlanTaskDetailMapper planTaskDetailMapper;
@Autowired
private WebMqttComponent webMqttComponent;
......@@ -557,6 +566,20 @@ public class CheckController extends AbstractBaseController {
String orgCode = getOrgCode(reginParams);
requestParam.setOrgCode(orgCode);
List<CheckInputItemDto> checkInputItemDtoList = checkService.saveCheckRecord(requestParam, reginParams);
// 查询检查计划任务信息
PlanTask planTasks = planTaskDetailMapper.selectById(requestParam.getPlanTaskId());
log.info("检查任务信息-->{}", JSON.toJSON(planTasks));
if (!ObjectUtils.isEmpty(planTasks)){
// 如果计划已超时或者已结束-----更新待办任务状态
if (XJConstant.TASK_STATUS_TIMEOUT == planTasks.getFinishStatus() || XJConstant.TASK_STATUS_FINISH == planTasks.getFinishStatus()){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(planTasks.getPlanId()));
model.setMsgType("supervision");
model.setIsRead(true);
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
}
return ResponseHelper.buildResponse(checkInputItemDtoList);
} catch (Exception e) {
log.error(e.getMessage(), e);
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.supervision.business.dao.mapper;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.supervision.dao.entity.PlanTask;
import com.yeejoin.amos.supervision.dao.entity.PlanTaskDetail;
import org.apache.ibatis.annotations.Param;
......@@ -19,4 +20,11 @@ public interface PlanTaskDetailMapper extends BaseMapper {
* @param planTaskDetailId 主键id
*/
void updateDanger(@Param(value="planTaskDetailId") long planTaskDetailId);
/**
* 任务id查询任务信息
* @param id
* @return
*/
PlanTask selectById(@Param("id") Long id);
}
......@@ -12,12 +12,16 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.client.MessageClient;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.PointMapper;
import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.param.PlanInfoPageParam;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanService;
import com.yeejoin.amos.supervision.business.util.Toke;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
......@@ -260,9 +264,13 @@ public class PlanServiceImpl implements IPlanService {
rulePlanService.addPlanRule(plan, userIds, RuleTypeEnum.计划提交, null); // 计划提交
} else {
if (PlanStatusEnum.EXAMINE_THREE.getValue() != status){
// 待办任务状态更新
updateTaskStatus(plan);
// rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核任务, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核任务通知
} else {
// 待办任务状态更新
updateTaskStatus(plan);
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核完成, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核完成
}
}
......@@ -273,6 +281,19 @@ public class PlanServiceImpl implements IPlanService {
return userIds;
}
private void updateTaskStatus(Plan plan){
Toke toke= remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
RequestContext.setAppKey(toke.getAppKey());
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(plan.getId()));
model.setMsgType("supervision");
model.setIsRead(true);
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
private void insertAuditLog(ReginParams reginParams, Plan param, ReginParams.PersonIdentity personIdentity, PlanAudit audit) {
PlanAuditLog planAuditLog = new PlanAuditLog();
planAuditLog.setPlanAuditId(audit.getId());
......
......@@ -72,6 +72,8 @@ mqtt.topic.alert.iot=iot-system-alarm
mqtt.topic.alert.iot.web=iot-system-alarm-web
#警情预案匹配的消息topic名称
mqtt.topic.command.knowledgebase.alert.match=knowledgeAlertMatch
#航空报警器警情通知
mqtt.topic.command.alert.noticeAviation=aviationAlarm
security.systemctl.name=AMOS-API-SYSTEMCTL
......
......@@ -34,4 +34,9 @@
WHERE
pptd.id = a.id
</update>
<select id="selectById" resultType="com.yeejoin.amos.supervision.dao.entity.PlanTask">
SELECT * FROM p_plan_task where id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -214,7 +214,7 @@
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>1.6.5</version>
<version>1.7.8</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
......
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