Commit 1c44822a authored by 李腾威's avatar 李腾威

迭代6 1090 融合调度消息发送

parent 041f79d2
......@@ -117,4 +117,7 @@ public class FirefightersDto extends BaseDto {
private String areasExpertise;
@ApiModelProperty(value = "消防专家领域字典code")
private String areasExpertiseCode;
@ApiModelProperty(value = "amos账户id")
private String amosUserId;
}
......@@ -37,5 +37,5 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<FirefightersExcelDto> exportToExcel(Boolean isDelete, String name, String postQualification, String fireTeamId,
String state, String areasExpertise, String jobTitle);
List<FirefightersDto> queryById(@Param("gw")String[] gw);
List<FirefightersDto> queryById(@Param("gw")String[] gw, @Param("name")String name);
}
......@@ -342,8 +342,8 @@ AND cft.type_code = (
</select>
<select id='queryByCompanyId' 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
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId
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 (
......@@ -367,8 +367,8 @@ AND cft.type_code = (
<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
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone,amosUserId from (
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId
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 (
......
......@@ -176,12 +176,13 @@
SELECT
firefighters.sequence_nbr sequenceNbr ,
firefighters.name,
mobile_phone as mobilePhone
mobile_phone as mobilePhone,
amos_user_id amosUserId
FROM
cb_firefighters firefighters
WHERE
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 = '消防救援保障部') )
select sequence_nbr from cb_org_usr cou where biz_org_name = #{name}) )
<if test="gw != null">
And job_title_code In
<foreach item="item" collection="gw" index="index" open="(" separator="," close=")">
......
......@@ -689,7 +689,7 @@ LEFT JOIN (
<select id="queryCompanyId" resultType="map">
select * from (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
a.fireManagementPostCode, b.telephone from cb_org_usr cou
a.fireManagementPostCode, b.telephone,cou.amos_org_id amosUserId from cb_org_usr cou
left join (select i.instance_id id1 ,if(i.field_code = 'fireManagementPostCode',
i.field_value, null) as 'fireManagementPostCode' from cb_dynamic_form_instance i where i.field_code = 'fireManagementPostCode'
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
......@@ -707,7 +707,7 @@ LEFT JOIN (
<select id="queryCompanyIdNew" resultType="map">
select * from (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
a.administrativePositionCode, b.telephone from cb_org_usr cou
a.administrativePositionCode, b.telephone, cou.amos_org_id amosUserId from cb_org_usr cou
left join (select i.instance_id id1 ,if(i.field_code = 'administrativePositionCode',
i.field_value_label, null) as 'administrativePositionCode' from cb_dynamic_form_instance i where i.field_code = 'administrativePositionCode'
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
......
......@@ -131,10 +131,10 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
return firefightersMapper.getFirefightersName();
}
public List<FirefightersDto> queryById(String[] gw){
public List<FirefightersDto> queryById(String[] gw,String name){
return firefightersMapper.queryById(gw);
return firefightersMapper.queryById(gw,name);
}
/**
* 获取指定岗位名称下的队伍人员电话号码信息
......
......@@ -84,7 +84,7 @@ public class AlertSubmittedController extends BaseController {
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增警情报送记录", notes = "新增警情报送记录")
public ResponseModel<Object> saveAlertSubmitted(@RequestBody AlertSubmittedDto alertSubmittedDto) throws Exception {
return ResponseHelper.buildResponse(alertSubmittedService.save(alertSubmittedDto, getUserInfo().getUserName()));
return ResponseHelper.buildResponse(alertSubmittedService.save(alertSubmittedDto, getUserInfo().getRealName()));
}
/**
......
......@@ -264,11 +264,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
List<Map<String, Object>> orgUsers = new LinkedList<>();
String sCode = "";
String alertWay = "";
AlertCalled alertCalled = null;
List<String> usIds = new ArrayList<>();
if (object instanceof AlertCalledRo) {
AlertCalledRo calledRo = (AlertCalledRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto)alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
alertCalled = alertCalledObjsDto.getAlertCalled();
String alertTypeCode = calledRo.getAlertTypeCode();
alertWay = calledRo.getAlertWay();
String unitInvolved = calledRo.getUnitInvolved();
......@@ -294,7 +299,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
if(e.containsKey("fireBrigade")) {
// 根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
List<FirefightersDto> fireBrigade = firefightersService.queryById(e.get("fireBrigade").toString().split(","));
List<FirefightersDto> fireBrigade = firefightersService.queryById(e.get("fireBrigade").toString().split(","), e.get("name").toString());
fireBrigade.stream().forEach(f->{
HashMap<String,Object> map = new HashMap<>();
map.put("telephone",f.getMobilePhone());
......@@ -403,6 +408,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
List<AlertSubmitted> alertSubmitteds = alertSubmittedMapper.selectList(queryWrapper);
alertSubmittedNew = alertSubmitteds.get(0);
if(!ValidationUtil.isEmpty(calledRo.getUsIds())) {
usIds.addAll(Arrays.asList(calledRo.getUsIds().split(",")));
}
}
// 组装人员信息
......@@ -414,6 +422,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
}
usIds.add(orgUser.get("amosUserId").toString());
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
......@@ -448,9 +458,29 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 组织短信内容
// 调用短信发送接口
Map<String,String> besidesMap = new HashMap<>();
besidesMap.put("alterId",String.valueOf(alertCalled.getSequenceNbr()));
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
besidesMap.put("sendTime",DateUtils.dateFormat(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds);
} else {
if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
besidesMap.put("sendTime",DateUtils.dateFormat(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds);
}
if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
besidesMap.put("startTime",DateUtils.dateFormat(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN));
besidesMap.put("endTime",DateUtils.dateFormat(alertCalled.getRecDate(),DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情结案.getCode(),besidesMap,smsParams,usIds);
}
if(alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(),besidesMap,smsParams,usIds);
}
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
......@@ -1251,9 +1281,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
/**
* app消息web 消息推送
* @param smsCode
* @param sendIds
* @param object
* @param
* @throws MqttPersistenceException
* @throws MqttException
*/
......@@ -1277,19 +1305,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setStartTime(besidesMap.get("startTime"));
pushMessageWebAndAppRo.setEndTime(besidesMap.get("endTime"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("endAlert");
}
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("notAlert");
}
if(AlertBusinessTypeEnum.警情续报.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setCompanyName(smsParams.get("companyName"));
pushMessageWebAndAppRo.setCompanyName(smsParams.get("alertType"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime"));
pushMessageWebAndAppRo.setTransferLocation(besidesMap.get("transferLocation"));
pushMessageWebAndAppRo.setTransferLocation(smsParams.get("replaceContent"));
pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
pushMessageWebAndAppRo.setRuleType("followReportAlert");
}
if(AlertBusinessTypeEnum.力量调派.getCode().equals(type)) {
map.put("url", "powerInformationPage");
......@@ -1310,7 +1342,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime"));
pushMessageWebAndAppRo.setCompanyName(smsParams.get("companyName"));//发送单位
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setFireSituation(besidesMap.get("fireSituation"));//火势情况
pushMessageWebAndAppRo.setFireSituation(smsParams.get("fireSituation"));//火势情况
pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
}
......
......@@ -192,9 +192,9 @@ public class RuleAlertCalledService {
// 警情初报模板替换规则
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());
replaceContent = "失火位置:".concat(ValidationUtil.isEmpty(alertCalledRo.getFireLocation()) ? "无": alertCalledRo.getFireLocation()).concat(
";燃烧物质:").concat(ValidationUtil.isEmpty(alertCalledRo.getBurningMaterial() )? "无": alertCalledRo.getBurningMaterial()).concat(
";火势情况:").concat(ValidationUtil.isEmpty(alertCalledRo.getFireSituation() ) ? "无" : alertCalledRo.getFireSituation());
}
if(alertCalled.getAlertTypeCode().equals(AlertStageEnums.HKJY.getCode())) {
......
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