Commit f64380e8 authored by 李腾威's avatar 李腾威

融合调度规则 任务 4318 4326 4327

parent ca609bb3
...@@ -134,5 +134,7 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> { ...@@ -134,5 +134,7 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
List<Map<String, Object>> getFirstAidForTypeCodeAndCompanyId(long company); List<Map<String, Object>> getFirstAidForTypeCodeAndCompanyId(long company);
List<Map<String, Object>> queryByCompanyId(Long companyId); List<Map<String, Object>> queryByCompanyId();
List<Map<String, Object>> queryByCompanyNew(String bizOrgName);
} }
...@@ -37,5 +37,5 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> { ...@@ -37,5 +37,5 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<FirefightersExcelDto> exportToExcel(Boolean isDelete, String name, String postQualification, String fireTeamId, List<FirefightersExcelDto> exportToExcel(Boolean isDelete, String name, String postQualification, String fireTeamId,
String state, String areasExpertise, String jobTitle); String state, String areasExpertise, String jobTitle);
List<FirefightersDto> queryById(Long teamId,String[] gw); List<FirefightersDto> queryById(@Param("gw")String[] gw);
} }
...@@ -92,5 +92,5 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -92,5 +92,5 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<Map<String, Long>> countDeptByCompanyId(@Param("companyIdList") List<String> companyIdList); List<Map<String, Long>> countDeptByCompanyId(@Param("companyIdList") List<String> companyIdList);
List<Map<String,Object>> queryCompanyId(Long id); List<Map<String,Object>> queryCompanyId(String bizOrgName);
} }
...@@ -34,5 +34,7 @@ public interface IDutyPersonService extends IDutyCommonService { ...@@ -34,5 +34,7 @@ public interface IDutyPersonService extends IDutyCommonService {
*/ */
List<DutyPersonDto> findByDutyAreaId(Long dutyAreaId); List<DutyPersonDto> findByDutyAreaId(Long dutyAreaId);
List<Map<String, Object>> queryByCompanyId(Long companyId); List<Map<String, Object>> queryByCompanyId();
List<Map<String, Object>> queryByCompanyNew(String bizOrgName);
} }
...@@ -342,25 +342,44 @@ AND cft.type_code = ( ...@@ -342,25 +342,44 @@ AND cft.type_code = (
</select> </select>
<select id='queryByCompanyId' resultType="map"> <select id='queryByCompanyId' resultType="map">
SELECT select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone from (
e.field_code, select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr
e.field_name, from cb_org_usr orgUsr left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
e.field_value i.instance_id where i.field_code = 'telephone') as d
FROM where d.sequence_nbr in (
cb_dynamic_form_instance e, select userId from (
(SELECT select cb.duty_date,a.deptId,c.userId from cb_duty_person_shift cb
i.* left join (select i.instance_id id1 ,if(i.field_code = 'deptId',
FROM i.field_value, null) as 'deptId' from cb_dynamic_form_instance i
cb_dynamic_form_instance i where i.field_code = 'deptId' and i.field_value is not null) a
, on cb.instance_id = a.id1
(SELECT * FROM `cb_duty_person_shift` where to_days(duty_date) = to_days(now())) b left join (select i.instance_id id3 ,if(i.field_code = 'userId',
WHERE i.field_value, null) as 'userId' from cb_dynamic_form_instance i
i.instance_id = b.instance_id where i.field_code = 'userId' and i.field_value is not null) c
AND on cb.instance_id = c.id3
i.field_code = 'deptId' where to_days(cb.duty_date) = to_days(now()) and
AND a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name = '消防救援保障部' or
i.field_value = #{companyId}) c biz_org_name = '综合办公室' or biz_org_name = '消防支队' or biz_org_name = '应急指挥科' )) r )
WHERE </select>
e. instance_id = c.instance_id
<select id='queryByCompanyNew' resultType="map">
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr
from cb_org_usr orgUsr left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
i.instance_id where i.field_code = 'telephone') as d
where d.sequence_nbr in (
select userId from (
select cb.duty_date,a.deptId,c.userId from cb_duty_person_shift cb
left join (select i.instance_id id1 ,if(i.field_code = 'deptId',
i.field_value, null) as 'deptId' from cb_dynamic_form_instance i
where i.field_code = 'deptId' and i.field_value is not null) a
on cb.instance_id = a.id1
left join (select i.instance_id id3 ,if(i.field_code = 'userId',
i.field_value, null) as 'userId' from cb_dynamic_form_instance i
where i.field_code = 'userId' and i.field_value is not null) c
on cb.instance_id = c.id3
where to_days(cb.duty_date) = to_days(now()) and
a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})) r )
</select> </select>
</mapper> </mapper>
...@@ -174,11 +174,14 @@ ...@@ -174,11 +174,14 @@
<select id="queryById" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto"> <select id="queryById" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto">
SELECT SELECT
* firefighters.sequence_nbr sequenceNbr ,
firefighters.name,
mobile_phone as mobilePhone
FROM FROM
cb_firefighters cb_firefighters firefighters
WHERE WHERE
fire_team_id = #{teamId} fire_team_id in ( select sequence_nbr from cb_fire_team cft where company in (
select sequence_nbr from cb_org_usr cou where biz_org_name = '消防救援部') )
<if test="gw != null"> <if test="gw != null">
And job_title_code In And job_title_code In
<foreach item="item" collection="gw" index="index" open="(" separator="," close=")"> <foreach item="item" collection="gw" index="index" open="(" separator="," close=")">
......
...@@ -687,35 +687,16 @@ LEFT JOIN ( ...@@ -687,35 +687,16 @@ LEFT JOIN (
</select> </select>
<select id="queryCompanyId" resultType="map"> <select id="queryCompanyId" resultType="map">
SELECT select * from (
d.field_code , select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
d.field_name , a.fireManagementPostCode, b.telephone from cb_org_usr cou
d.field_value , left join (select i.instance_id id1 ,if(i.field_code = 'fireManagementPostCode',
s.sequence_nbr, i.field_value_label, null) as 'fireManagementPostCode' from cb_dynamic_form_instance i where i.field_code = 'fireManagementPostCode'
s.biz_org_name, and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
s.parent_id left join (select i.instance_id id2,if(i.field_code = 'telephone',
FROM i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone'
cb_dynamic_form_instance d , and i.field_value is not null) b on cou .sequence_nbr = b.id2
( SELECT ) d where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
u.* and (d.fireManagementPostCode = '消防安全管理人' or d.fireManagementPostCode = '消防安全责任人')
FROM
cb_org_usr u,
cb_dynamic_form_instance i
where
u.parent_id = #{id}
AND
u.is_delete = 0
AND
u.biz_org_type = 'PERSON'
AND
i.instance_id = u.sequence_nbr
AND
i.field_code = 'administrativePositionCode'
AND
i.field_value is not NULL ) s
WHERE
d.instance_id = s.sequence_nbr
AND
d.field_code = 'telephone'
</select> </select>
</mapper> </mapper>
...@@ -26,7 +26,7 @@ public class AlertCalledRo implements Serializable{ ...@@ -26,7 +26,7 @@ public class AlertCalledRo implements Serializable{
* *
* </pre> * </pre>
*/ */
private static final long serialVersionUID = 7091835997817930383L; private static final long serialVersionUID = 529623529216238088L;
/** /**
* 通用属性 * 通用属性
...@@ -46,6 +46,12 @@ public class AlertCalledRo implements Serializable{ ...@@ -46,6 +46,12 @@ public class AlertCalledRo implements Serializable{
@Label(value = "发送单位") @Label(value = "发送单位")
private String companyName; private String companyName;
@Label(value = "联系人")
private String contactUser;
@Label(value = "联系电话")
private String contactPhone;
@Label(value = "被困人数") @Label(value = "被困人数")
private String trappedNum; private String trappedNum;
...@@ -57,6 +63,24 @@ public class AlertCalledRo implements Serializable{ ...@@ -57,6 +63,24 @@ public class AlertCalledRo implements Serializable{
@Label(value = "警情报送id") @Label(value = "警情报送id")
private String alertSubmittedId; private String alertSubmittedId;
@Label(value = "事发单位")
private String unitInvolved;
@Label(value = "模板替换内容")
private String replaceContent;
@Label(value = "警情报送类型(0,警情报送,1,警情续报,2,非警情确认,3,警情结案)")
private String alertWay;
@Label(value = "警情续报,非警情确认,警情结案,选择人员ids")
private String ids;
@Label(value = "警情续报自定义内容")
private String feedback;
/** /**
* 一般火灾 * 一般火灾
*/ */
...@@ -74,5 +98,77 @@ public class AlertCalledRo implements Serializable{ ...@@ -74,5 +98,77 @@ public class AlertCalledRo implements Serializable{
/** /**
* 航空器救援 * 航空器救援
*/ */
@Label(value = "航班号")
private String flightNumber;
@Label(value = "飞机型号")
private String aircraftModel;
@Label(value = "落地时间")
private String landingTime;
@Label(value = "灾害事故情况")
private String accidentSituationHkq;
@Label(value = "燃油量")
private String fuelQuantity;
@Label(value = "发展态势")
private String developmentTrend;
@Label(value = "载客量")
private String passengerCapacity;
@Label(value = "航空器故障部位")
private String damageLocation;
@Label(value = "迫降跑道")
private String forcedLandingTrack;
/**
* 突发事件救援
*/
@Label(value = "灾害事故情况")
private String accidentSituation;
/**
* 漏油现场安全保障
*/
@Label(value = "航班号")
private String flightNumberLy;
@Label(value = "机位")
private String seat;
@Label(value = "漏油面积")
private String oilLeakageArea;
/**
* 专机保障
*/
@Label(value = "保障等级")
private String securityLevel;
@Label(value = "机位")
private String seatBz;
/**
* 120急救
*/
@Label(value = "患者现状")
private String patientStatus;
@Label(value = "性别")
private String gender;
@Label(value = "年龄段")
private String ageGroup;
//
// /**
// * 其他
// */
// @Label(value = "灾害事故情况")
// private String accidentSituation;
} }
...@@ -24,6 +24,7 @@ public enum AlertStageEnums { ...@@ -24,6 +24,7 @@ public enum AlertStageEnums {
LYXC("237", "漏油现场安全保障"), LYXC("237", "漏油现场安全保障"),
ZJBZ("238", "转机保障"), ZJBZ("238", "转机保障"),
QTJQ("242", "其他"), QTJQ("242", "其他"),
JJJQ("1214", "120急救"),
RG("226", "人工上报"), RG("226", "人工上报"),
DJ("228", "对讲呼入"), DJ("228", "对讲呼入"),
......
...@@ -43,6 +43,9 @@ public interface IAlertCalledService { ...@@ -43,6 +43,9 @@ public interface IAlertCalledService {
Object selectAlertCalledByIdNoRedis(Long id); Object selectAlertCalledByIdNoRedis(Long id);
Object selectAlertCalledByIdNoRedisNew(Long id);
Map<String,Object> selectAlertCalledKeyValueLabelById( Long id); Map<String,Object> selectAlertCalledKeyValueLabelById( Long id);
......
...@@ -191,18 +191,18 @@ public class DutyPersonController extends BaseController { ...@@ -191,18 +191,18 @@ public class DutyPersonController extends BaseController {
return ResponseHelper.buildResponse(iDutyPersonService.findByDutyAreaId(dutyAreaId)); return ResponseHelper.buildResponse(iDutyPersonService.findByDutyAreaId(dutyAreaId));
} }
/** // /**
* // *
* // *
* @return ResponseModel // * @return ResponseModel
*/ // */
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) // @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/companyId/{companyId}") // @GetMapping(value = "/companyId/{companyId}")
@ApiOperation(httpMethod = "GET", value = "查询当日值班人员", notes = "查询当日值班人员") // @ApiOperation(httpMethod = "GET", value = "查询当日值班人员", notes = "查询当日值班人员")
public ResponseModel<List<Map<String, Object>>> queryByCompanyId( // public ResponseModel<List<Map<String, Object>>> queryByCompanyId(
@PathVariable Long companyId) throws Exception { // @PathVariable Long companyId) throws Exception {
return ResponseHelper.buildResponse(iDutyPersonService.queryByCompanyId(companyId)); // return ResponseHelper.buildResponse(iDutyPersonService.queryByCompanyId(companyId));
} // }
} }
...@@ -268,17 +268,17 @@ public class OrgPersonController { ...@@ -268,17 +268,17 @@ public class OrgPersonController {
} }
} }
/** // /**
* 机场单位下 各单位下人员岗位不为空的人员 // * 机场单位下 各单位下人员岗位不为空的人员
* // *
* @param id // * @param id
* @return // * @return
*/ // */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyId/{id}", method = RequestMethod.GET) // @RequestMapping(value = "/companyId/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取人员岗位不为空的人员详情", notes = "获取人员岗位不为空的人员详情") // @ApiOperation(httpMethod = "GET", value = "获取人员岗位不为空的人员详情", notes = "获取人员岗位不为空的人员详情")
public ResponseModel<Object> queryCompanyId(HttpServletRequest request, // public ResponseModel<Object> queryCompanyId(HttpServletRequest request,
@PathVariable Long id) throws Exception { // @PathVariable Long id) throws Exception {
return ResponseHelper.buildResponse(iOrgUsrService.queryCompanyId(id)); // return ResponseHelper.buildResponse(iOrgUsrService.queryCompanyId(id));
} // }
} }
...@@ -303,17 +303,14 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType ...@@ -303,17 +303,14 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
} }
@Override
public List<Map<String, Object>> queryByCompanyId(){
return dutyPersonShiftMapper.queryByCompanyId();
}
@Override
public List<Map<String, Object>> queryByCompanyNew(String bizOrgName){
return dutyPersonShiftMapper.queryByCompanyNew(bizOrgName);
public List<Map<String, Object>> queryByCompanyId(Long companyId){
return dutyPersonShiftMapper.queryByCompanyId(companyId);
} }
......
...@@ -133,9 +133,10 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi ...@@ -133,9 +133,10 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
return firefightersMapper.getFirefightersName(); return firefightersMapper.getFirefightersName();
} }
public List<FirefightersDto> queryById(Long teamId,String[] gw){ public List<FirefightersDto> queryById(String[] gw){
return firefightersMapper.queryById(teamId,gw);
return firefightersMapper.queryById(gw);
} }
/** /**
* 获取指定岗位名称下的队伍人员电话号码信息 * 获取指定岗位名称下的队伍人员电话号码信息
......
...@@ -1860,9 +1860,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1860,9 +1860,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return resultMap; return resultMap;
} }
public List<Map<String,Object>> queryCompanyId(Long id) { public List<Map<String,Object>> queryCompanyId(String bizOrgName) {
return orgUsrMapper.queryCompanyId(id); return orgUsrMapper.queryCompanyId(bizOrgName);
} }
} }
...@@ -333,21 +333,7 @@ public class FirefightersController extends BaseController { ...@@ -333,21 +333,7 @@ public class FirefightersController extends BaseController {
return ResponseHelper.buildResponse(menus); return ResponseHelper.buildResponse(menus);
} }
/**
*查询
*
* @param
* @return
* @throws Exception
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/gw/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<Object> queryById( @PathVariable Long teamId) throws Exception {
//规则提供岗位名称
String[] gw =new String[]{"1202","1203","1204","1205","1206","1207","1209","1208","1210","1211"};
return ResponseHelper.buildResponse(iFirefightersService.queryById(teamId,gw));
}
......
...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jcs.biz.rule.action; ...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -64,14 +66,13 @@ public class AlertCalledAction { ...@@ -64,14 +66,13 @@ public class AlertCalledAction {
* *
* @param smsCode 短信模板code * @param smsCode 短信模板code
* @param sendType 发送类型 * @param sendType 发送类型
* @param sendIds 人员id
* @param object 模板内容对象 * @param object 模板内容对象
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则") @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<Map<String,Object>> submittedList, Object object) throws Exception {
alertSubmittedService.ruleCallbackAction(smsCode, sendIds, object); alertSubmittedService.ruleCallbackAction(smsCode, submittedList, object);
} }
......
...@@ -9,6 +9,7 @@ import java.util.Set; ...@@ -9,6 +9,7 @@ import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -269,6 +270,25 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -269,6 +270,25 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
} }
/** /**
* 根据灾情id 查询灾情详情
**/
@Override
public Object selectAlertCalledByIdNoRedisNew(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
//
AlertCalledObjsDto alertCalledFormVo = new AlertCalledObjsDto();
alertCalledFormVo.setAlertCalled(alertCalled);
alertCalledFormVo.setAlertFormValue(list);
return alertCalledFormVo;
}
/**
* <pre> * <pre>
* 保存警情信息 * 保存警情信息
* </pre> * </pre>
...@@ -348,8 +368,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -348,8 +368,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
alertCalledObjsDto.setAlertCalled(alertCalled); alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto.setAlertFormValue(alertFormValuelist); alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
// 警情报送 // 警情报送
// 调用规则 // 调用规则 警情初报
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto); ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(), null);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 // 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
/** /**
......
...@@ -35,8 +35,11 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; ...@@ -35,8 +35,11 @@ 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.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto; 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.AlertCalledObjsDto;
...@@ -59,6 +62,7 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject; ...@@ -59,6 +62,7 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template; import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
...@@ -68,6 +72,32 @@ import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedObjectService ...@@ -68,6 +72,32 @@ 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.api.service.IAlertSubmittedService;
import com.yeejoin.amos.boot.module.jcs.biz.rule.action.AlertCalledAction; import com.yeejoin.amos.boot.module.jcs.biz.rule.action.AlertCalledAction;
import com.yeejoin.amos.component.rule.config.RuleConfig; 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.typroject.tyboot.component.emq.EmqKeeper;
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.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* 警情报送记录 服务实现类 * 警情报送记录 服务实现类
...@@ -98,6 +128,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -98,6 +128,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
OrgUsrServiceImpl orgUsrService; OrgUsrServiceImpl orgUsrService;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired
private FirefightersServiceImpl firefightersService;
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
IDutyPersonService iDutyPersonService;
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
...@@ -167,20 +204,14 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -167,20 +204,14 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Override @Override
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception { public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
try { try {
Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName); Map<String,String> map = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参 // 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId()); AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
AlertCalledObjsDto alertCalledVo = new AlertCalledObjsDto(); AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(alertCalled.getSequenceNbr());
alertCalledVo.setAlertCalled(alertCalled); alertCalledVo.setAlertCalled(alertCalled);
List<AlertFormValue> alertFormValue = new ArrayList<>();
AlertFormValue formValue = new AlertFormValue();
formValue.setFieldCode("alertSubmittedId");
formValue.setFieldValue(alertSubmittedId.toString());
alertFormValue.add(formValue);
alertCalledVo.setAlertFormValue(alertFormValue);
// 调用规则 // 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo); ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"),map.get("mobiles"));
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 //通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
} catch (MqttException e) { } catch (MqttException e) {
...@@ -192,29 +223,119 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -192,29 +223,119 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
/** /**
* 规则回调 * 规则回调
*/ */
public void ruleCallbackAction(String smsCode, String sendIds, Object object) throws Exception { public void ruleCallbackAction(String smsCode, List<Map<String,Object>> sendIds, Object object) throws Exception {
// 获取报送对象列表 // 获取报送对象列表
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList(); List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Set<String> mobiles = new HashSet<>(); Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>(); HashMap<String, String> smsParams = new HashMap<>();
String alertCalledId = null; String alertCalledId = null;
// 根据id列表查询所有人员信息
List<Long> ids = StringUtil.String2LongList(sendIds); List<Map<String, Object>> orgUsers = new LinkedList<>();
String sCode = "";
String alertWay = "";
if (object instanceof AlertCalledRo) { if (object instanceof AlertCalledRo) {
AlertCalledRo calledRo = (AlertCalledRo) object; AlertCalledRo calledRo = (AlertCalledRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId(); String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr(); alertCalledId = calledRo.getSequenceNbr();
// 警情初报 String alertTypeCode = calledRo.getAlertTypeCode();
if (alertSubmittedId == null) { alertWay = calledRo.getAlertWay();
String unitInvolved = calledRo.getUnitInvolved();
// 警情续报 警情结案,非警情确认选择人员电话号码
String ids = calledRo.getIds();
if(!ValidationUtil.isEmpty(ids)) {
List<String> ls = Arrays.asList(ids.split(","));
ls.stream().forEach(e->mobiles.add(e));
}
// 获取报送规则
sendIds.stream().forEach(e->{
// 一般火灾 // 航空器救援
if(alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
if(e.containsKey("onDuty")) {
// 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyId();
orgUsers.addAll(mapList);
}
if(e.containsKey("fireBrigade")) {
// 根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
List<FirefightersDto> fireBrigade = firefightersService.queryById(e.get("fireBrigade").toString().split(","));
fireBrigade.stream().forEach(f->{
HashMap<String,Object> map = new HashMap<>();
map.put("telephone",f.getMobilePhone());
map.put("sequenceNbr",f.getSequenceNbr());
map.put("bizOrgName",f.getName());
orgUsers.add(map);
});
}
if(e.containsKey("airportUnit")) {
// 根据人员职务:干部&领导 机场单位 模块 消防急救保障部中,“人员职务”不为空的人员
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId("消防救援部");
orgUsers.addAll(mapList);
}
// 安运部
if(e.get("type").toString().equals("AY")) {
if(e.containsKey("airportPost")) {
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId("安运部");
orgUsers.addAll(mapList);
}
}
// 事发单位
if(e.get("type").toString().equals("SF")) {
if(e.containsKey("airportPost")) {
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved);
orgUsers.addAll(mapList);
}
}
}
// 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他
if(alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
|| alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) {
if(e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew("消防支队");
orgUsers.addAll(mapList);
}
}
// 120急救
if(alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if (e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew("急救科");
orgUsers.addAll(mapList);
}
if (e.containsKey("airportUnit")) {
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId("急救科");
orgUsers.addAll(mapList);
}
}
});
// 警情初报 续报 结案
// 1.保存警情记录主表 // 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted(); AlertSubmitted alertSubmitted = new AlertSubmitted();
alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr())); alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr()));
// 保存初报细分类型(一般火灾、航空器救援等) // 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode()); alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 名称统一为警情初报 // 警情初报 --- 续报 结案
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName()); alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
} else if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情续报.getName());
sCode = "SMS_JCS_XB";
} else if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情结案.getName());
sCode = "SMS_JCS_JA";
} else {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.非警情确认.getName());
sCode = "SMS_JCS_QR";
}
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS); Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode()); alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode());
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName()); alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
...@@ -236,22 +357,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -236,22 +357,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class, EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(calledRo.getAlertTypeCode())); e -> e.getCode().equals(calledRo.getAlertTypeCode()));
smsCode = alertBusinessTypeEnum.get().getSms_code(); smsCode = alertBusinessTypeEnum.get().getSms_code();
}
// 组装人员信息 // 组装人员信息
List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListIdUser(ids);
for (Map<String, Object> orgUser : orgUsers) { for (Map<String, Object> orgUser : orgUsers) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject(); AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId)); alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
alertSubmittedObject.setType(false); alertSubmittedObject.setType(false);
alertSubmittedObject.setCompanyId(Long.valueOf((String) orgUser.get("parentId"))); // alertSubmittedObject.setCompanyId(Long.valueOf((String) orgUser.get("parentId")));
alertSubmittedObject.setCompanyName((String) orgUser.get("parenName")); // alertSubmittedObject.setCompanyName((String) orgUser.get("parenName"));
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr")))); alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName")); alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) { if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone")); mobiles.add((String) orgUser.get("telephone"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
} }
alertSubmittedObjectList.add(alertSubmittedObject); alertSubmittedObjectList.add(alertSubmittedObject);
} }
...@@ -265,14 +384,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -265,14 +384,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum()); smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives()); smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives());
smsParams.put("companyName", calledRo.getCompanyName()); smsParams.put("companyName", calledRo.getCompanyName());
smsParams.put("contactUser", calledRo.getContactUser());
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("replaceContent", calledRo.getReplaceContent());
smsParams.put("alertType", calledRo.getAlertType());
smsParams.put("feedback", calledRo.getFeedback());
} }
// 短信报送对象 // 短信报送对象
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList); alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息 // 发送任务消息
// 组织短信内容 // 组织短信内容
// 调用短信发送接口 // 调用短信发送接口
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
} else {
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false); emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
} }
...@@ -283,9 +411,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -283,9 +411,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
* @param userName 用户名 * @param userName 用户名
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) { public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
Long alertSubmittedId = alertSubmittedDto.getSequenceNbr(); Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String smsCode = ""; String alertWay = "";
Map<String,String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>(); Set<String> mobiles = new HashSet<>();
if (alertSubmittedId == null) { if (alertSubmittedId == null) {
...@@ -333,7 +462,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -333,7 +462,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
this.baseMapper.insert(alertSubmitted); this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr(); alertSubmittedId = alertSubmitted.getSequenceNbr();
smsCode = businessTypeEnum.get().getSms_code();
} }
// 2.保存任务表 // 2.保存任务表
...@@ -377,6 +505,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -377,6 +505,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledService.updateAlertCalled(alertSubmittedDto.getAlertCalledId(), alertCalledService.updateAlertCalled(alertSubmittedDto.getAlertCalledId(),
alertSubmittedDto.getBusinessTypeCode()); alertSubmittedDto.getBusinessTypeCode());
// 警情续报
if(AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情续报.getCode();
}
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay =AlertBusinessTypeEnum.警情结案.getCode();
}
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.非警情确认.getCode();
}
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode()) if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())
|| AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) { || AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
// 查询本次警情调派的车辆 // 查询本次警情调派的车辆
...@@ -392,7 +534,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -392,7 +534,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}); });
} }
//修改调派车辆任务 //修改调派车辆任务
powerTransferCompanyResourcesService.updateByAlertCalledId(alertSubmittedDto.getAlertCalledId()); powerTransferCompanyResourcesService.updateByAlertCalledId(alertSubmittedDto.getAlertCalledId());
...@@ -404,17 +545,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -404,17 +545,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 4.发送任务消息 // 4.发送任务消息
// 4.1组织短信内容 // 4.1组织短信内容
HashMap<String, String> smsParams = new HashMap<>(); // HashMap<String, String> smsParams = new HashMap<>();
JSONObject submitContent = alertSubmittedDto.getSubmitContent(); // JSONObject submitContent = alertSubmittedDto.getSubmitContent();
if(!"316".equals(alertSubmittedDto.getBusinessTypeCode())) { // if(!"316".equals(alertSubmittedDto.getBusinessTypeCode())) {
smsParams.put("alertType", submitContent.get("alertType").toString()); // smsParams.put("alertType", submitContent.get("alertType").toString());
smsParams.put("trappedNum", submitContent.get("trappedNum").toString()); // smsParams.put("trappedNum", submitContent.get("trappedNum").toString());
smsParams.put("companyName", submitContent.get("companyName").toString()); // smsParams.put("companyName", submitContent.get("companyName").toString());
} // }
// 4.2调用短信发送接口 // 4.2调用短信发送接口
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); // alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
return finalAlertSubmittedId;
map.put("alertWay",alertWay);
map.put("mobiles", StringUtils.join(mobiles,","));
return map;
} }
/** /**
......
...@@ -4,6 +4,8 @@ import java.util.ArrayList; ...@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -46,11 +48,10 @@ public class RuleAlertCalledService { ...@@ -46,11 +48,10 @@ public class RuleAlertCalledService {
* 触发警情报送规则 * 触发警情报送规则
* </pre> * </pre>
* *
* @param alertCalled
* @return * @return
* @throws Exception * @throws Exception
*/ */
public Boolean fireAlertCalledRule(AlertCalledObjsDto alertCalledVo) throws Exception { public Boolean fireAlertCalledRule(AlertCalledObjsDto alertCalledVo,String alertWay, String mobiles) throws Exception {
AlertCalled alertCalled = alertCalledVo.getAlertCalled(); AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled)) { if (ValidationUtil.isEmpty(alertCalled)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
...@@ -59,57 +60,175 @@ public class RuleAlertCalledService { ...@@ -59,57 +60,175 @@ public class RuleAlertCalledService {
* 构建警情报送规则对象 * 构建警情报送规则对象
*/ */
AlertCalledRo alertCalledRo = new AlertCalledRo(); AlertCalledRo alertCalledRo = new AlertCalledRo();
// 通用属性
//通用属性
alertCalledRo.setSequenceNbr(String.valueOf(alertCalled.getSequenceNbr())); alertCalledRo.setSequenceNbr(String.valueOf(alertCalled.getSequenceNbr()));
alertCalledRo.setAddress(alertCalled.getAddress()); alertCalledRo.setAddress(alertCalled.getAddress());
alertCalledRo.setUnitInvolved(alertCalled.getUnitInvolved());
alertCalledRo.setContactUser(alertCalled.getContactUser());
alertCalledRo.setContactPhone(alertCalled.getContactPhone());
alertCalledRo.setAlertType(alertCalled.getAlertType()); alertCalledRo.setAlertType(alertCalled.getAlertType());
alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode()); alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCalledRo.setCasualtiesNum( alertCalledRo.setCasualtiesNum(alertCalled.getCasualtiesNum() != null ? String.valueOf(alertCalled.getCasualtiesNum()) : "无");
alertCalled.getCasualtiesNum() != null ? String.valueOf(alertCalled.getCasualtiesNum()) : "无"); alertCalledRo.setTrappedNum(alertCalled.getTrappedNum() != null ? String.valueOf(alertCalled.getTrappedNum()) : "无");
alertCalledRo
.setTrappedNum(alertCalled.getTrappedNum() != null ? String.valueOf(alertCalled.getTrappedNum()) : "无");
alertCalledRo.setCompanyName(alertCalled.getCompanyName()); alertCalledRo.setCompanyName(alertCalled.getCompanyName());
List<AlertFormValue> alertFormValues = alertCalledVo.getAlertFormValue(); List<AlertFormValue> alertFormValues = alertCalledVo.getAlertFormValue();
if (!ValidationUtil.isEmpty(alertFormValues)) {
for (AlertFormValue alertFormValue : alertFormValues) { if (!ValidationUtil.isEmpty(alertFormValues))
if (alertFormValue.getFieldCode().equals("alertSubmittedId")) { {
for (AlertFormValue alertFormValue : alertFormValues)
{
if (alertFormValue.getFieldCode().equals("alertSubmittedId"))
{
alertCalledRo.setAlertSubmittedId(alertFormValue.getFieldValue()); alertCalledRo.setAlertSubmittedId(alertFormValue.getFieldValue());
} }
// 一般火灾 //一般火灾
if (alertFormValue.getFieldCode().equals("fireLocation")) { if (alertFormValue.getFieldCode().equals("fireLocation"))
{
alertCalledRo.setFireLocation(alertFormValue.getFieldValue()); alertCalledRo.setFireLocation(alertFormValue.getFieldValue());
} }
if (alertFormValue.getFieldCode().equals("burningMaterial")) { if (alertFormValue.getFieldCode().equals("burningMaterial"))
{
alertCalledRo.setBurningMaterial(alertFormValue.getFieldValue()); alertCalledRo.setBurningMaterial(alertFormValue.getFieldValue());
} }
if (alertFormValue.getFieldCode().equals("fireSituation")) { if (alertFormValue.getFieldCode().equals("fireSituation"))
{
alertCalledRo.setFireSituation(alertFormValue.getFieldValue()); alertCalledRo.setFireSituation(alertFormValue.getFieldValue());
} }
if (alertFormValue.getFieldCode().equals("dangerousExplosives")) { if (alertFormValue.getFieldCode().equals("dangerousExplosives"))
{
alertCalledRo.setDangerousExplosives(alertFormValue.getFieldValue()); alertCalledRo.setDangerousExplosives(alertFormValue.getFieldValue());
} }
if (alertFormValue.getFieldCode().equals("fireTime")) { if (alertFormValue.getFieldCode().equals("fireTime"))
{
alertCalledRo.setCallTimeStr(alertFormValue.getFieldValue()); alertCalledRo.setCallTimeStr(alertFormValue.getFieldValue());
} }
// 航空器救援 //航空器救援
if (alertFormValue.getFieldCode().equals("flightNumber")) {
alertCalledRo.setFlightNumber(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("aircraftModel")) {
alertCalledRo.setAircraftModel(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("landingTime")) {
alertCalledRo.setLandingTime(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("developmentTrend")) {
alertCalledRo.setDevelopmentTrend(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("fuelQuantity")) {
alertCalledRo.setFuelQuantity(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("passengerCapacity")) {
alertCalledRo.setPassengerCapacity(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("damageLocation")) {
alertCalledRo.setDamageLocation(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("forcedLandingTrack")) {
alertCalledRo.setForcedLandingTrack(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("accidentSituation")) {
alertCalledRo.setAccidentSituationHkq(alertFormValue.getFieldValue());
}
//突发事件救援
if (alertFormValue.getFieldCode().equals("accidentSituation")) {
alertCalledRo.setAccidentSituation(alertFormValue.getFieldValue());
}
//漏油现场安全保障
if (alertFormValue.getFieldCode().equals("flightNumber")) {
alertCalledRo.setFlightNumberLy(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("seat")) {
alertCalledRo.setSeat(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("oilLeakageArea")) {
alertCalledRo.setOilLeakageArea(alertFormValue.getFieldValue());
}
// 突发事件救援 //专机保障
if (alertFormValue.getFieldCode().equals("securityLevel")) {
alertCalledRo.setSecurityLevel(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("seat")) {
alertCalledRo.setSeatBz(alertFormValue.getFieldValue());
}
// 漏油现场安全保障 //120 急救
if (alertFormValue.getFieldCode().equals("patientStatus")) {
alertCalledRo.setPatientStatus(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("gender")) {
alertCalledRo.setGender(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("ageGroup")) {
alertCalledRo.setAgeGroup(alertFormValue.getFieldValue());
}
// 专机保障 }
}
// 警情初报模板替换规则
String replaceContent = "";
if(alertCalled.getAlertTypeCode().equals(AlertStageEnums.YBHZ.getCode())) {
replaceContent = "失火位置:".concat(ValidationUtil.isEmpty(alertCalled.getAddress()) ? "无": alertCalled.getAddress()).concat(
";燃烧物质:").concat(ValidationUtil.isEmpty(alertCalledRo.getFireLocation() )? "无": alertCalledRo.getFireLocation()).concat(
";火势情况:").concat(ValidationUtil.isEmpty(alertCalledRo.getFireLocation() ) ? "无" : alertCalledRo.getFireSituation());
} }
if(alertCalled.getAlertTypeCode().equals(AlertStageEnums.HKJY.getCode())) {
replaceContent = "航班号:".concat(ValidationUtil.isEmpty(alertCalledRo.getFlightNumber()) ? "无": alertCalledRo.getFlightNumber()).concat(
";飞机型号:").concat(ValidationUtil.isEmpty(alertCalledRo.getAircraftModel() )? "无": alertCalledRo.getAircraftModel()).concat(
";落地时间:").concat(ValidationUtil.isEmpty(alertCalledRo.getLandingTime() ) ? "无" : alertCalledRo.getLandingTime()).concat(
"发生".concat(ValidationUtil.isEmpty(alertCalledRo.getAccidentSituationHkq()) ? "无": alertCalledRo.getAccidentSituationHkq()).concat(
";飞机受损位置:").concat(ValidationUtil.isEmpty(alertCalledRo.getDamageLocation() )? "无": alertCalledRo.getDamageLocation()).concat(
";燃油量:").concat(ValidationUtil.isEmpty(alertCalledRo.getFuelQuantity() ) ? "无" : alertCalledRo.getFuelQuantity()).concat(
"载客量:".concat(ValidationUtil.isEmpty(alertCalledRo.getPassengerCapacity()) ? "无": alertCalledRo.getPassengerCapacity()).concat(
";迫降跑道:").concat(ValidationUtil.isEmpty(alertCalledRo.getForcedLandingTrack() )? "无": alertCalledRo.getForcedLandingTrack()).concat(
";发展态势:").concat(ValidationUtil.isEmpty(alertCalledRo.getDevelopmentTrend() ) ? "无" : alertCalledRo.getDevelopmentTrend())
));
} }
// 触发规则 if(alertCalled.getAlertTypeCode().equals(AlertStageEnums.TFSJ.getCode())) {
replaceContent = "发生:".concat(ValidationUtil.isEmpty(alertCalledRo.getAccidentSituation()) ? "无": alertCalledRo.getAccidentSituation().concat("事件"));
}
if(alertCalled.getAlertTypeCode().equals(AlertStageEnums.LYXC.getCode())) {
replaceContent = "航班号:".concat(ValidationUtil.isEmpty(alertCalledRo.getFlightNumberLy()) ? "无": alertCalledRo.getFlightNumberLy()).concat(
";机位:").concat(ValidationUtil.isEmpty(alertCalledRo.getSeat() )? "无": alertCalledRo.getSeat()).concat(
";漏油面积:").concat(ValidationUtil.isEmpty(alertCalledRo.getOilLeakageArea() ) ? "无" : alertCalledRo.getOilLeakageArea());
}
if(alertCalled.getAlertTypeCode().equals(AlertStageEnums.ZJBZ.getCode())) {
replaceContent = "保障等级:".concat(ValidationUtil.isEmpty(alertCalledRo.getSecurityLevel()) ? "无": alertCalledRo.getSecurityLevel()).concat(
";机位:").concat(ValidationUtil.isEmpty(alertCalledRo.getSeatBz() )? "无": alertCalledRo.getSeatBz());
}
if(alertCalled.getAlertTypeCode().equals(AlertStageEnums.JJJQ.getCode())) {
replaceContent = "患者现状:".concat(ValidationUtil.isEmpty(alertCalledRo.getPatientStatus()) ? "无": alertCalledRo.getPatientStatus()).concat(
";性别:").concat(ValidationUtil.isEmpty(alertCalledRo.getGender() )? "无": alertCalledRo.getGender()).concat(
";年龄段:").concat(ValidationUtil.isEmpty(alertCalledRo.getAgeGroup() ) ? "无" : alertCalledRo.getAgeGroup());
}
// 警情 报送类型
alertCalledRo.setAlertWay(alertWay);
alertCalledRo.setReplaceContent(replaceContent);
if(!ValidationUtil.isEmpty(mobiles)) {
alertCalledRo.setIds(mobiles);
}
//触发规则
ruleTrigger.publish(alertCalledRo, "西咸机场119接处警规则/alertCalledRule", new String[0]); ruleTrigger.publish(alertCalledRo, "西咸机场119接处警规则/alertCalledRule", new String[0]);
return true; return true;
} }
public boolean powerTransferCalledRule(Set<PowerTransferCompanyDto> i, Long alertCalledId,String type) throws Exception { public boolean powerTransferCalledRule(Set<PowerTransferCompanyDto> i, Long alertCalledId, String type) throws Exception {
if (ValidationUtil.isEmpty(alertCalledId)) { if (ValidationUtil.isEmpty(alertCalledId)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
......
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