Commit 0f341cc9 authored by chenhao's avatar chenhao

提交代码

parent ca6b565f
package com.yeejoin.amos.boot.module.common.api.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.common.api.dto.PerfQuotaIotDTO;
import com.yeejoin.amos.boot.module.common.api.dto.VideoDto;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -14,9 +12,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.common.api.dto.PerfQuotaIotDTO;
import com.yeejoin.amos.boot.module.common.api.dto.VideoDto;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
/**
* 装备服务feign
......@@ -315,4 +315,9 @@ public interface EquipFeignClient {
*/
@RequestMapping(value = "/perf-quota/listAll", method = RequestMethod.POST)
ResponseModel<List<EquipmentIndexDto>> getEquipmentIndexDto(@RequestBody PerfQuotaIotDTO perfQuotaIotDTO);
@RequestMapping(value = "/car/{id}", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> selectOneById( @PathVariable Long id);
}
......@@ -105,4 +105,14 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
@Param("stratTime") String stratTime,
@Param("endTime") String endTime
);
List<Map<String, Object>> getDutyPersonByTeamIdAndCarId(
String carIdName,
String teamIdName,
String userIdName,
String dutyDate,
String groupCode,
String carId,
String teamId);
}
......@@ -259,5 +259,43 @@
</if>
order by instanceId desc
</select>
<select id="getDutyPersonByTeamIdAndCarId" resultType="java.util.Map">
SELECT
userId
FROM
(
SELECT
MAX(
CASE
WHEN cbd.field_code = #{carIdName} THEN
cbd.field_value
END
) AS #{carIdName},
MAX(
CASE
WHEN cbd.field_code = #{teamIdName} THEN
cbd.field_value
END
) AS #{teamIdName},
MAX(
CASE
WHEN cbd.field_code = #{userIdName} THEN
cbd.field_value
END
) AS #{userIdName},
cbd.instance_id
FROM
cb_dynamic_form_instance cbd
LEFT JOIN cb_duty_person_shift cps ON cbd.instance_id = cps.instance_id
WHERE
cps.duty_date = #{dutyDate}
AND cps.is_delete = FALSE
AND cbd.group_code = #{groupCode}
GROUP BY
cbd.instance_id
) ss
WHERE
ss.carId = #{carId}
AND ss.teamId = #{teamId}
</select>
</mapper>
package com.yeejoin.amos.boot.module.jcs.api.dto;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -15,4 +17,7 @@ public class CompanyDto {
@ApiModelProperty(value = "调派单位名称")
private String powerCompanyName;
@ApiModelProperty(value = "调派单位资源列表")
private List<PowerTransferCompanyResourcesDto> powerTransferCompanyResourcesDtoList;
}
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferSimpleDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Arrays;
import java.util.List;
/**
* 力量调派
......@@ -202,6 +201,5 @@ public class PowerTransferController extends BaseController {
return ResponseHelper.buildResponse(powerTransferService.getPowerTransferList(beginDate, endDate));
}
}
package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.HashMap;
import java.util.Set;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
/**
* <pre>
......@@ -44,9 +41,10 @@ public class PowerTransferAction {
* @throws Exception 异常
*/
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsCode, String sendType, String sendIds, Object object) throws Exception {
public void sendcmd(String smsCode, String sendType, List<String> sendIds, Object object) throws Exception {
alertSubmittedService.ruleCallbackAction(smsCode, sendIds, object);
// alertSubmittedService.ruleCallbackAction(smsCode, sendIds, object);
System.out.println("8796w39879873298798");
}
......
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -67,8 +66,6 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.TemplateMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import ch.qos.logback.core.joran.conditional.IfAction;
/**
* 警情接警记录 服务实现类
*
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
......@@ -45,33 +68,6 @@ import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedObjectService
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService;
import com.yeejoin.amos.boot.module.jcs.biz.rule.action.AlertCalledAction;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.ObjectUtils;
import org.checkerframework.checker.units.qual.A;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 警情报送记录 服务实现类
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -17,13 +41,16 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.PowerCarCountDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerCompanyCountDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDetailParamDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferParamDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferResourceDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferSimpleDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ResourceStatisticsDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertFeedbackStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
......@@ -31,24 +58,6 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.stream.Collectors;
/**
* 力量调派 服务实现类
......@@ -95,6 +104,15 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired
private DutyCarServiceImpl dutyCarService;
@Autowired
FireTeamServiceImpl iFireTeamService;
@Autowired
DynamicFormInstanceMapper dynamicFormInstanceMapper;
@Autowired
RuleAlertCalledService ruleAlertCalledService;
@Override
public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) {
List<PowerTransferCompanyResourcesDto> powerTransferList =
......@@ -129,14 +147,22 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
Long powerTransferSequenceNbr = powerTransfer.getSequenceNbr();
// 获取任务派发模板
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type",
alertCalled.getAlertType()).eq("format", false));
String content = template.getContent();
Map<String, String> definitions = new HashMap<>();
initDefinitions(definitions, alertCalled, powerTransferDto);
// Template template = templateService.getOne(new QueryWrapper<Template>().eq("type",
// alertCalled.getAlertType()).eq("format", false));
// String content = template.getContent();
// Map<String, String> definitions = new HashMap<>();
// initDefinitions(definitions, alertCalled, powerTransferDto);
// 创建力量调派单位
createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content);
// createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content);
//封装调派任务的集合,以便于实现任务规则校验
try {
packagePowerTransferDetail(powerTransferDto);
} catch (Exception e) {
log.error("调用规则失败:PowerTransferServiceImpl。createPowerTransfer()");
}
//发送调派通知
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
......@@ -148,6 +174,27 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
return true;
}
private void packagePowerTransferDetail(PowerTransferDto powerTransferDto) throws Exception {
List<PowerTransferCompanyDto> powerTransferCompanyDtoList = powerTransferDto.getPowerTransferCompanyDotList();
Set<PowerTransferCompanyDto> fullTimeList = new HashSet<PowerTransferCompanyDto>();
Set<PowerTransferCompanyDto> medicalTeamList = new HashSet<PowerTransferCompanyDto>();
Set<PowerTransferCompanyDto> monitorTeamList = new HashSet<PowerTransferCompanyDto>();
for (PowerTransferCompanyDto powerTransferCompanyDto : powerTransferCompanyDtoList) {
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(powerTransferCompanyDto.getPowerTransType())) {
fullTimeList.add(powerTransferCompanyDto);
} else if (FireBrigadeTypeEnum.医疗救援队.getKey().equals(powerTransferCompanyDto.getPowerTransType())) {
medicalTeamList.add(powerTransferCompanyDto);
} else if (FireBrigadeTypeEnum.监控大队.getKey().equals(powerTransferCompanyDto.getPowerTransType())) {
monitorTeamList.add(powerTransferCompanyDto);
}
}
ruleAlertCalledService.powerTransferCalledRule(fullTimeList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.专职消防队.getKey());
ruleAlertCalledService.powerTransferCalledRule(medicalTeamList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.医疗救援队.getKey());
ruleAlertCalledService.powerTransferCalledRule(monitorTeamList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.监控大队.getKey());
}
@Override
public List<FireBrigadeResourceDto> getPowerTree(String type) {
List<FireBrigadeResourceDto> fireBrigadeResourceList = Lists.newArrayList();
......@@ -656,93 +703,4 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
return AlertFeedbackStatusEnum.toList();
}
public Object forceDispatchTaskDispatch(){
// for (PowerTransferParamDto powerTransferParamDto : params) {
// if("car".equals(powerTransferParamDto.getType())) {
// forceDispatchTaskDispatchOnCar(powerTransferParamDto);
// }else if("monitor".equals(powerTransferParamDto.getType())) {
// forceDispatchTaskDispatchOnMonitor(powerTransferParamDto);
// }else if("fristAid".equals(powerTransferParamDto.getType())) {
// forceDispatchTaskDispatchOnFristAid(powerTransferParamDto);
// }
// }
return null;
}
public Object forceDispatchTaskDispatchOnMonitor(PowerTransferParamDto params) {
return params;
}
public Object forceDispatchTaskDispatchOnFristAid(PowerTransferParamDto params) {
return params;
}
public Object forceDispatchTaskDispatchOnCar(PowerTransferParamDto params) {
//获取车辆的id
String[] isdStrings = params.getIdValue().split(",");
List<Long> idsList = new ArrayList<Long>();
for (String carId : isdStrings) {
ResponseModel<Map<String, Object>> carResponseModel = equipFeignClient.selectOneById(Long.parseLong(carId));
Map<String, Object> carResultMap = carResponseModel.getResult();
if (carResultMap == null || carResultMap.isEmpty() || !carResultMap.containsKey("teamId")) {
continue;
}
String teamId = carResultMap.get("teamId").toString();
List<PowerTransferDetailParamDto> detailParamDtos=params.getDetail();
for (PowerTransferDetailParamDto dto : detailParamDtos) {
if("DD".equals(dto.getType())) {
}
}
// // 首先判斷当前的队伍是支队还是大队
// FireTeam fireTeam = iFireTeamService.getById(Long.parseLong(teamId));
// Long parentTeamId = fireTeam.getParent();
// if (parentTeamId !=null) {//父级节点的team存在,说明当前team是大队,不是支队
// //大队岗位
//
// //获取总队的人员信息
// String parentTeamIdString = Long.toString(parentTeamId);
// List<Map<String, Object>> parentUserIdsList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId("carId",
// "teamId", "userId", DateUtils.getDateNowShortStr(), "dutyCar", carId, parentTeamIdString);
// parentUserIdsList.stream().forEach(i->{
// String userId = i.get("userId").toString();
// idsList.add(Long.parseLong(userId));
// });
// //获取支队的人员信息
// List<Map<String, Object>> userIdsList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId("carId",
// "teamId", "userId", DateUtils.getDateNowShortStr(), "dutyCar", carId, teamId);
//
// userIdsList.stream().forEach(i->{
// String userId = i.get("userId").toString();
// idsList.add(Long.parseLong(userId));
// });
//
//
// }else {
// //支队岗位
//
// }
//
}
return params;
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
import com.yeejoin.amos.component.rule.RuleTrigger;
/**
......@@ -20,7 +28,8 @@ import com.yeejoin.amos.component.rule.RuleTrigger;
* </pre>
*
* @author gwb
* @version $Id: RuleAlertCalledService.java, v 0.1 2021年6月24日 下午6:30:44 gwb Exp $
* @version $Id: RuleAlertCalledService.java, v 0.1 2021年6月24日 下午6:30:44 gwb Exp
* $
*/
@Service
public class RuleAlertCalledService {
......@@ -28,6 +37,9 @@ public class RuleAlertCalledService {
@Autowired
private RuleTrigger ruleTrigger;
@Autowired
AlertCalledServiceImpl alertCalledServiceImpl;
/**
*
* <pre>
......@@ -38,71 +50,161 @@ public class RuleAlertCalledService {
* @return
* @throws Exception
*/
public Boolean fireAlertCalledRule(AlertCalledObjsDto alertCalledVo) throws Exception
{
public Boolean fireAlertCalledRule(AlertCalledObjsDto alertCalledVo) throws Exception {
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled))
{
if (ValidationUtil.isEmpty(alertCalled)) {
throw new BadRequest("参数校验失败.");
}
/**
* 构建警情报送规则对象
*/
AlertCalledRo alertCalledRo = new AlertCalledRo();
//通用属性
// 通用属性
alertCalledRo.setSequenceNbr(String.valueOf(alertCalled.getSequenceNbr()));
alertCalledRo.setAddress(alertCalled.getAddress());
alertCalledRo.setAlertType(alertCalled.getAlertType());
alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCalledRo.setCasualtiesNum(alertCalled.getCasualtiesNum() != null ? String.valueOf(alertCalled.getCasualtiesNum()) : "无");
alertCalledRo.setTrappedNum(alertCalled.getTrappedNum() != null ? String.valueOf(alertCalled.getTrappedNum()) : "无");
alertCalledRo.setCasualtiesNum(
alertCalled.getCasualtiesNum() != null ? String.valueOf(alertCalled.getCasualtiesNum()) : "无");
alertCalledRo
.setTrappedNum(alertCalled.getTrappedNum() != null ? String.valueOf(alertCalled.getTrappedNum()) : "无");
alertCalledRo.setCompanyName(alertCalled.getCompanyName());
List<AlertFormValue> alertFormValues = alertCalledVo.getAlertFormValue();
if (!ValidationUtil.isEmpty(alertFormValues))
{
for (AlertFormValue alertFormValue : alertFormValues)
{
if (alertFormValue.getFieldCode().equals("alertSubmittedId"))
{
if (!ValidationUtil.isEmpty(alertFormValues)) {
for (AlertFormValue alertFormValue : alertFormValues) {
if (alertFormValue.getFieldCode().equals("alertSubmittedId")) {
alertCalledRo.setAlertSubmittedId(alertFormValue.getFieldValue());
}
//一般火灾
if (alertFormValue.getFieldCode().equals("fireLocation"))
{
// 一般火灾
if (alertFormValue.getFieldCode().equals("fireLocation")) {
alertCalledRo.setFireLocation(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("burningMaterial"))
{
if (alertFormValue.getFieldCode().equals("burningMaterial")) {
alertCalledRo.setBurningMaterial(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("fireSituation"))
{
if (alertFormValue.getFieldCode().equals("fireSituation")) {
alertCalledRo.setFireSituation(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("dangerousExplosives"))
{
if (alertFormValue.getFieldCode().equals("dangerousExplosives")) {
alertCalledRo.setDangerousExplosives(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("fireTime"))
{
if (alertFormValue.getFieldCode().equals("fireTime")) {
alertCalledRo.setCallTimeStr(alertFormValue.getFieldValue());
}
//航空器救援
// 航空器救援
//突发事件救援
// 突发事件救援
//漏油现场安全保障
// 漏油现场安全保障
//专机保障
// 专机保障
}
}
//触发规则
// 触发规则
ruleTrigger.publish(alertCalledRo, "西咸机场119接处警规则/alertCalledRule", new String[0]);
return true;
}
public boolean powerTransferCalledRule(Set<PowerTransferCompanyDto> i, Long alertCalledId,String type) throws Exception {
if (ValidationUtil.isEmpty(alertCalledId)) {
throw new BadRequest("参数校验失败.");
}
AlertCallePowerTransferRo alertCallePowerTransferRo = new AlertCallePowerTransferRo();
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledServiceImpl
.selectAlertCalledByIdNoRedis(alertCalledId);
if (alertCalledFormDto == null) {
return false;
}
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
alertCallePowerTransferRo
.setCallTimeStr(DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
alertCallePowerTransferRo.setAddress(alertCalled.getAddress());
alertCallePowerTransferRo.setAlertType(alertCalled.getAlertType());
alertCallePowerTransferRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCallePowerTransferRo.setCompanyName(alertCalled.getCompanyName());
alertCallePowerTransferRo.setTrappedNum(Integer.toString(alertCalled.getTrappedNum()));
alertCallePowerTransferRo.setCasualtiesNum(Integer.toString(alertCalled.getCasualtiesNum()));
alertCallePowerTransferRo.setContactPhone(alertCalled.getContactPhone());
alertCallePowerTransferRo.setContactUser(alertCalled.getContactUser());
String presentSituation =null;//性别
String gender =null;//年龄段(岁)
String ageGroup =null;//患者现状说明
String dangerousExplosives=null;//危险爆炸品
List<FormValue> alertFormValues = alertCalledFormDto.getDynamicFormAlert();
if (!ValidationUtil.isEmpty(alertFormValues)) {
for (FormValue alertFormValue : alertFormValues) {
if (alertFormValue.getKey().equals("alertSubmittedId")) {
alertCallePowerTransferRo.setAlertSubmittedId(alertFormValue.getValue());
}
// 一般火灾
if (alertFormValue.getKey().equals("fireLocation")) {
alertCallePowerTransferRo.setFireLocation(alertFormValue.getValue());
}
if (alertFormValue.getKey().equals("burningSubstancesDescription")) {
alertCallePowerTransferRo.setBurningMaterial(alertFormValue.getValue());
}
if (alertFormValue.getKey().equals("fireSituation")) {
alertCallePowerTransferRo.setFireSituation(alertFormValue.getValue());
}
if (alertFormValue.getKey().equals("dangerousExplosives")) {
alertCallePowerTransferRo.setDangerousExplosives(alertFormValue.getValue());
}
if (alertFormValue.getKey().equals("fireTime")) {
alertCallePowerTransferRo.setCallTimeStr(alertFormValue.getValue());
}
if (alertFormValue.getKey().equals("presentSituation")) {
presentSituation = alertFormValue.getValue();
}
if (alertFormValue.getKey().equals("gender")) {
gender = alertFormValue.getValue();
}
if (alertFormValue.getKey().equals("ageGroup")) {
ageGroup = alertFormValue.getValue();
}
if (alertFormValue.getKey().equals("dangerousExplosives")) {
dangerousExplosives = alertFormValue.getValue();
}
}
}
if (FireBrigadeTypeEnum.专职消防队.equals(type)) {
alertCallePowerTransferRo.setCompany(new ArrayList<>(i));
alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation());
stringBuffer.append(" 燃烧物质:"+alertCallePowerTransferRo.getBurningMaterial());
stringBuffer.append(" 火势情况:"+alertCallePowerTransferRo.getFireSituation());
stringBuffer.append(" 有无危险爆炸品:"+dangerousExplosives);
alertCallePowerTransferRo.setContent(stringBuffer.toString());
} else if (FireBrigadeTypeEnum.监控大队.equals(type)) {
alertCallePowerTransferRo.setCompany(new ArrayList<>(i));
alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation());
stringBuffer.append(" 燃烧物质:"+alertCallePowerTransferRo.getBurningMaterial());
stringBuffer.append(" 火势情况:"+alertCallePowerTransferRo.getFireSituation());
stringBuffer.append(" 有无危险爆炸品:"+dangerousExplosives);
alertCallePowerTransferRo.setContent(stringBuffer.toString());
} else if (FireBrigadeTypeEnum.医疗救援队.equals(type)) {
alertCallePowerTransferRo.setCompany(new ArrayList<>(i));
alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" 患者现状:"+ageGroup);
stringBuffer.append(" 性别:"+presentSituation);
stringBuffer.append(" 年龄段:"+gender);
alertCallePowerTransferRo.setContent(stringBuffer.toString());
}
// 触发规则
ruleTrigger.publish(alertCallePowerTransferRo, "西咸机场119接处警规则/powerTransferCalledRule", new String[0]);
return true;
}
}
package com.yeejoin.amos.maintenance.business.feign;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* @author DELL
*/ //装备
......@@ -53,5 +59,6 @@ public interface EquipFeignClient {
*/
@GetMapping(value = PREFIX+"/maintenanceResourceData/getFireFacilityList")
ResponseModel<List<Map<String, Object>>> overTimeMaintenanceFacility(@RequestParam String type, @RequestParam String id);
}
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