Commit d38b57da authored by tangwei's avatar tangwei

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 94cb5138 0d7d9a5a
......@@ -8,8 +8,11 @@ import java.util.stream.Collectors;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -54,6 +58,7 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -69,7 +74,7 @@ import io.swagger.annotations.ApiOperation;
@Api(tags = "警情接警记录Api")
@RequestMapping(value = "/alert-called")
public class AlertCalledController extends BaseController {
private final Logger logger = LogManager.getLogger(AlertCalledController.class);
@Autowired
LatentDangerFeignClient latentDangerFeignClient;
@Autowired
......@@ -92,6 +97,12 @@ public class AlertCalledController extends BaseController {
private static String ALETR_TYPE_AID = "1214";
private static String ALETR_TYPE_AID_STATUS = "patientStatus";
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.knowledgebase.alert.match}")
private String topicMatch;
/**
* 新增警情接警记录
*
......@@ -135,9 +146,22 @@ public class AlertCalledController extends BaseController {
}
alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto = iAlertCalledService.createAlertCalled(alertCalledObjsDto);
toSendCompletePoliceSituationMatch(alertCalledObjsDto.getAlertCalled().getSequenceNbr());
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalled());
}
@Async
public void toSendCompletePoliceSituationMatch(Long id){
try {
Object result = iAlertCalledService.toCompletePoliceSituationMatch(id);
List<Object> list= (List<Object>) result;
if(list.size()>0) {
emqKeeper.getMqttClient().publish(topicMatch, result.toString().getBytes(), RuleConfig.DEFAULT_QOS, false);
}
} catch (Exception e) {
logger.info(topicMatch+":警情id"+id+"获取匹配的预案失败------------"+e.getMessage());
}
}
/**
* 根据id删除
*
......
......@@ -16,7 +16,6 @@ import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -413,25 +412,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
}
toSendCompletePoliceSituationMatch(alertCalled.getSequenceNbr());
// toSendCompletePoliceSituationMatch(alertCalled.getSequenceNbr());
return alertCalledObjsDto;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
}
//@Async
public void toSendCompletePoliceSituationMatch(Long id){
try {
Object result = toCompletePoliceSituationMatch(id);
List<Object> list= (List<Object>) result;
if(list.size()>0) {
emqKeeper.getMqttClient().publish(topicMatch, result.toString().getBytes(), RuleConfig.DEFAULT_QOS, false);
}
} catch (Exception e) {
logger.info(topicMatch+":警情id"+id+"获取匹配的预案失败------------"+e.getMessage());
}
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
......
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