Commit 13284bdc authored by chenhao's avatar chenhao

提交力量调派任务发送

parent 592489d7
...@@ -106,13 +106,39 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc ...@@ -106,13 +106,39 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
@Param("endTime") String endTime @Param("endTime") String endTime
); );
/**
* 值班表中 【值班排班】中特定部门的特定日期值班员;
* @param dutyDate
* @param departmentName eg:急救科、消救部
* @return
*/
List<Map<String, Object>> getDutyPersonByTeamIdAndCarId( List<Map<String, Object>> getDutyPersonByTeamIdAndCarId(
String carIdName,
String teamIdName,
String userIdName,
String dutyDate, String dutyDate,
String groupCode, String departmentName);
String carId, /**
String teamId); * 值班表中 【120急救排班】该急救站的当日值班员
* @param dutyDate
* @param firstAidId
* @return
*/
List<Map<String, Object>> getDutyPersonByTeamIdAndAirId(
String dutyDate,
String firstAidId);
/**
* 机场单位的人员中,部门 ”人员职务“ 不为空的人员,不包括下级部门的人员
* @param departmentName eg: 急救科、 消救部
* @param PositionType : eg 岗位为:支队长、副支队长、党支部副书记、支队长助理、指挥员、;
* @return
*/
List<Map<String, Object>> getFireRescueDepartmentStaff(String departmentName,List<String> positionType);
List<Map<String, Object>> getDutyFirePerson(String dutyDate,String groupCode);
Map<String, Object> getCurentCarIsUserPhone(long carId);
List<Map<String, Object>> getOrgPersonTelphone(List<Map<String, Object>> companyIds);
} }
...@@ -261,28 +261,206 @@ ...@@ -261,28 +261,206 @@
</select> </select>
<select id="getDutyPersonByTeamIdAndCarId" resultType="java.util.Map"> <select id="getDutyPersonByTeamIdAndCarId" resultType="java.util.Map">
SELECT SELECT
userId cfir.telephone AS mobilePhone,
hh.userId AS userId,
cou.biz_org_name AS userName,
cou.amos_org_id AS amosId
FROM
(
SELECT
userId,
instance_id
FROM
(
SELECT
MAX(
CASE
WHEN cbd.field_code = 'deptName' THEN
cbd.field_value
END
) AS deptName,
MAX(
CASE
WHEN cbd.field_code = 'userId' THEN
cbd.field_value
END
) AS userId,
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 = 'dutyPerson'
GROUP BY
cbd.instance_id
) ss
WHERE
ss.deptName = #{departmentName}
) hh
LEFT JOIN cb_org_usr cou ON hh.userId = cou.sequence_nbr
LEFT JOIN (
SELECT
MAX(
CASE
WHEN cfi.field_code = 'telephone' THEN
cfi.field_value
END
) AS telephone,
cfi.instance_id
FROM
cb_dynamic_form_instance cfi
) cfir ON cfir.instance_id = hh.userId
</select>
<select id="getDutyPersonByTeamIdAndAirId" resultType="java.util.Map">
SELECT
cfir.telephone AS mobilePhone,
hh.userId AS userId,
cou.biz_org_name AS userName,
cou.amos_org_id AS amosId
FROM FROM
( (
SELECT SELECT
userId
FROM
(
SELECT
MAX(
CASE
WHEN cbd.field_code = 'userId' THEN
cbd.field_value
END
) AS userId,
MAX(
CASE
WHEN cbd.field_code = 'firstAidId' THEN
cbd.field_value
END
) AS firstAidId,
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 = 'dutyFirstAid'
GROUP BY
cbd.instance_id
) ss
WHERE
ss.firstAidId = #{firstAidId}
) hh
LEFT JOIN cb_org_usr cou ON hh.userId = cou.sequence_nbr
LEFT JOIN (
SELECT
MAX( MAX(
CASE CASE
WHEN cbd.field_code = #{carIdName} THEN WHEN cfi.field_code = 'telephone' THEN
cfi.field_value
END
) AS telephone,
cfi.instance_id
FROM
cb_dynamic_form_instance cfi
) cfir ON cfir.instance_id = hh.userId
</select>
<select id ="getFireRescueDepartmentStaff" resultType="java.util.Map">
SELECT
dd.telephone AS mobilePhone,
cour.sequence_nbr AS userId,
cour.biz_org_name AS userName,
cour.amos_org_id AS amosId
FROM
(
SELECT
Max(
CASE
WHEN cbd.field_code = 'administrativePositionCode' THEN
cbd.field_value
END
) AS administrativePositionCode,
Max(
CASE
WHEN cbd.field_code = 'telephone' THEN
cbd.field_value
END
) AS telephone,
Max(
CASE
WHEN cbd.field_code = 'stateCode' THEN
cbd.field_value_label
END
) AS stateCode,
cbd.instance_id
FROM
cb_dynamic_form_instance cbd
WHERE
cbd.instance_id IN (
SELECT
cou.sequence_nbr
FROM
cb_org_usr cou
WHERE
cou.parent_id = (
SELECT
sequence_nbr
FROM
cb_org_usr
WHERE
biz_org_name = #{departmentName}
)
AND cou.biz_org_type = 'PERSON'
) group by cbd.instance_id
) dd
LEFT JOIN cb_org_usr cour ON dd.instance_id = cour.sequence_nbr
WHERE
<if test="positionType == null ">
dd.administrativePositionCode IS NOT NULL
</if>
<if test="positionType != null">
dd.administrativePositionCode in
<foreach collection="positionType" item="item" separator="," open="(" close=")" index="">
#{item, jdbcType=NUMERIC}
</foreach>
</if>
</select>
<select id ="getDutyFirePerson" resultType="java.util.Map">
SELECT
dd.telephone AS mobilePhone
FROM
(
SELECT
Max(
CASE
WHEN cbd.field_code = 'telephone' THEN
cbd.field_value cbd.field_value
END END
) AS #{carIdName}, ) AS telephone,
cbd.instance_id
FROM
cb_dynamic_form_instance cbd
WHERE
cbd.instance_id IN (
SELECT
userId
FROM
(
SELECT
MAX( MAX(
CASE CASE
WHEN cbd.field_code = #{teamIdName} THEN WHEN cbd.field_code = 'deptId' THEN
cbd.field_value cbd.field_value
END END
) AS #{teamIdName}, ) AS deptId,
MAX( MAX(
CASE CASE
WHEN cbd.field_code = #{userIdName} THEN WHEN cbd.field_code = 'userId' THEN
cbd.field_value cbd.field_value
END END
) AS #{userIdName}, ) AS userId,
cbd.instance_id cbd.instance_id
FROM FROM
cb_dynamic_form_instance cbd cb_dynamic_form_instance cbd
...@@ -294,8 +472,103 @@ FROM ...@@ -294,8 +472,103 @@ FROM
GROUP BY GROUP BY
cbd.instance_id cbd.instance_id
) ss ) ss
WHERE
ss.deptId IN (
SELECT
sequence_nbr
FROM
cb_org_usr
WHERE
biz_org_name = '消防救援保障部'
AND biz_org_type = 'COMPANY'
)
)
) dd
</select>
<select id='getCurentCarIsUserPhone' resultType="java.util.Map">
SELECT
ss.telephone AS mobilePhone,
cou.sequence_nbr AS userId,
cou.biz_org_name AS userName,
cou.amos_org_id AS amosId
FROM
(
SELECT
field_value as telephone
,instance_id
FROM
cb_dynamic_form_instance
WHERE
group_code = '246'
AND instance_id = (
SELECT
sequence_nbr
FROM
cb_org_usr
WHERE
amos_org_id = (
SELECT
amos_user_id
FROM
jc_user_car
WHERE
car_id = #{carId}
)
) and field_code='telephone'
) ss
LEFT JOIN cb_org_usr cou ON ss.instance_id = cou.sequence_nbr
</select>
<select id='getOrgPersonTelphone' resultType="java.util.Map">
SELECT
dd.telephone AS mobilePhone
FROM
(
SELECT
Max(
CASE
WHEN cbd.field_code = 'administrativePositionCode' THEN
cbd.field_value_label
END
) AS administrativePositionCode,
Max(
CASE
WHEN cbd.field_code = 'telephone' THEN
cbd.field_value
END
) AS telephone,
Max(
CASE
WHEN cbd.field_code = 'stateCode' THEN
cbd.field_value_label
END
) AS stateCode,
cbd.instance_id
FROM
cb_dynamic_form_instance cbd
WHERE
cbd.instance_id IN (
SELECT
cou.sequence_nbr
FROM
cb_org_usr cou
WHERE
cou.parent_id in
<foreach item="item" collection="companyIds" separator="," open="(" close=")" index="">
#{item.departmentId, jdbcType=NUMERIC}
</foreach>
AND cou.biz_org_type = 'PERSON'
)group by cbd.instance_id
) dd
WHERE WHERE
ss.carId = #{carId} dd.administrativePositionCode IS NOT NULL
AND ss.teamId = #{teamId}
</select> </select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.jcs.api.dto; package com.yeejoin.amos.boot.module.jcs.api.dto;
import java.io.Serializable;
import com.yeejoin.amos.component.rule.Label; import com.yeejoin.amos.component.rule.Label;
import com.yeejoin.amos.component.rule.RuleFact; import com.yeejoin.amos.component.rule.RuleFact;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.List;
/** /**
* *
* <pre> * <pre>
...@@ -20,16 +20,12 @@ import java.util.List; ...@@ -20,16 +20,12 @@ import java.util.List;
@Data @Data
@RuleFact(value = "调派信息",project = "西咸机场119调派规则") @RuleFact(value = "调派信息",project = "西咸机场119调派规则")
public class AlertCallePowerTransferRo implements Serializable{ public class AlertCallePowerTransferRo implements Serializable{
/** /**
* <pre> * <pre>
* *
* </pre> * </pre>
*/ */
private static final long serialVersionUID = 4735920511849348360L; private static final long serialVersionUID = 9053208791780047768L;
/** /**
* 通用属性 * 通用属性
...@@ -86,7 +82,7 @@ public class AlertCallePowerTransferRo implements Serializable{ ...@@ -86,7 +82,7 @@ public class AlertCallePowerTransferRo implements Serializable{
private String contactPhone; private String contactPhone;
@ApiModelProperty(value = "调派单位资源列表") @ApiModelProperty(value = "调派单位资源列表")
private List< PowerTransferCompanyDto> company; private String company;
@ApiModelProperty(value = "调派类型队伍") @ApiModelProperty(value = "调派类型队伍")
private String powerTransType; private String powerTransType;
......
...@@ -23,6 +23,7 @@ public enum AlertBusinessTypeEnum { ...@@ -23,6 +23,7 @@ public enum AlertBusinessTypeEnum {
警情初报("reportAlert", "297", "297","", "警情初报"), 警情初报("reportAlert", "297", "297","", "警情初报"),
警情续报("followReportAlert", "313", "313","SMS_JCS_0006", "警情续报"), 警情续报("followReportAlert", "313", "313","SMS_JCS_0006", "警情续报"),
非警情确认("notAlert", "314", "314","SMS_JCS_0008", "非警情确认"), 非警情确认("notAlert", "314", "314","SMS_JCS_0008", "非警情确认"),
力量调派("powerTransfer", "316", "316","SMS_JCS_DP", "力量调派"),
警情结案("endAlert", "315", "315","SMS_JCS_0009", "警情结案"); 警情结案("endAlert", "315", "315","SMS_JCS_0009", "警情结案");
private String key; private String key;
......
...@@ -28,7 +28,7 @@ public enum AlertStageEnums { ...@@ -28,7 +28,7 @@ public enum AlertStageEnums {
RG("226", "人工上报"), RG("226", "人工上报"),
DJ("228", "对讲呼入"), DJ("228", "对讲呼入"),
JK("388", "监控中心报警"), JK("388", "监控中心报警"),//也是监控大队
DH("389", "电话报警"), DH("389", "电话报警"),
...@@ -41,7 +41,18 @@ public enum AlertStageEnums { ...@@ -41,7 +41,18 @@ public enum AlertStageEnums {
ZZZD("116", "企(事)业单位专职消防救援支队"), ZZZD("116", "企(事)业单位专职消防救援支队"),
YWDD("117", "企(事)业单位义务消防救援大队"), YWDD("117", "企(事)业单位义务消防救援大队"),
YLJY("830", "企(事)业单位医疗救援队(站)"), YLJY("830", "企(事)业单位医疗救援队(站)"),
JKDD("118", "企(事)业单位监控大队"); DD("DD", "所属大队"),
JJZ("JJZ", "急救站"),
ZD("ZD", "消防支队"),
XJ("XJ", "消救部"),
ZH("ZH", "应急指挥科"),
BD("BD", "调派车辆指定人"),
监控大队("JK","监控大队"),
onDuty("onDuty", "值班单位"),
fireBrigade("fireBrigade", "岗位名称,规则配置"),
airportUnit("airportUnit", "人员职务规则配置"),
flag("flag", "值班单位"),
JKDD("6", "企(事)业单位监控大队");
......
...@@ -12,7 +12,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -12,7 +12,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; 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.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
...@@ -146,7 +145,9 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi ...@@ -146,7 +145,9 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
*/ */
public List<Map<String, Object>> getDetailByTeamIdAndJobTitle(Long teamId,List<String> jobTitleArray) { public List<Map<String, Object>> getDetailByTeamIdAndJobTitle(Long teamId,List<String> jobTitleArray) {
LambdaQueryWrapper<Firefighters> wrapper = new LambdaQueryWrapper<Firefighters>(); LambdaQueryWrapper<Firefighters> wrapper = new LambdaQueryWrapper<Firefighters>();
wrapper.in(Firefighters::getJobTitle, jobTitleArray); if(jobTitleArray!=null && jobTitleArray.size()>0) {
wrapper.in(Firefighters::getJobTitleCode, jobTitleArray);
}
wrapper.eq(Firefighters::getIsDelete, false); wrapper.eq(Firefighters::getIsDelete, false);
wrapper.eq(Firefighters::getFireTeamId, teamId); wrapper.eq(Firefighters::getFireTeamId, teamId);
wrapper.select(Firefighters::getMobilePhone); wrapper.select(Firefighters::getMobilePhone);
......
...@@ -66,6 +66,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; ...@@ -66,6 +66,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum; import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserRolesEnum; import com.yeejoin.amos.boot.module.common.api.enums.UserRolesEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserUnitTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.UserUnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService; import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService; import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
...@@ -74,6 +75,8 @@ import com.yeejoin.amos.feign.privilege.Privilege; ...@@ -74,6 +75,8 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import ch.qos.logback.core.joran.conditional.IfAction;
/** /**
* 机构/部门/人员表 服务实现类 * 机构/部门/人员表 服务实现类
* *
...@@ -113,6 +116,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -113,6 +116,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Value("${jcs.company.topic.add}") @Value("${jcs.company.topic.add}")
private String airportAddTopic; private String airportAddTopic;
@Autowired
DynamicFormInstanceMapper dynamicFormInstanceMapper;
public static List<OrgMenuDto> buildTreeParallel(List<OrgUsr> list) { public static List<OrgMenuDto> buildTreeParallel(List<OrgUsr> list) {
List<OrgMenuDto> menuList = list.stream().map(o -> { List<OrgMenuDto> menuList = list.stream().map(o -> {
...@@ -1865,4 +1871,17 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1865,4 +1871,17 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return orgUsrMapper.queryCompanyId(bizOrgName); return orgUsrMapper.queryCompanyId(bizOrgName);
} }
public List<Map<String,Object>> getuserDetail(Long departmentId,List<Map<String, Object>> resulLists){
OrgUsr resulList =this.baseMapper.selectById(departmentId);
if(resulList.getParentId()!=null) {
Map<String, Object> resultMap =new HashMap<String, Object>();
resultMap.put("departmentId", resulList.getSequenceNbr());
resulLists.add(resultMap);
return getuserDetail(Long.parseLong(resulList.getParentId()),resulLists);
}else {
return resulLists;
}
}
} }
...@@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory; ...@@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import com.yeejoin.amos.component.rule.RuleActionBean; import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod; import com.yeejoin.amos.component.rule.RuleMethod;
...@@ -44,14 +46,19 @@ public class PowerTransferAction { ...@@ -44,14 +46,19 @@ public class PowerTransferAction {
* @param object 模板内容对象 * @param object 模板内容对象
* @throws Exception 异常 * @throws Exception 异常
*/ */
@SuppressWarnings("rawtypes")
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则") @RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsCode, String sendType, List sendIds, Object object) throws Exception { public void sendcmd(String smsCode, String sendType, List sendIds, Object object) throws Exception {
if (object instanceof AlertCallePowerTransferRo) {
// alertSubmittedService.ruleCallbackAction(smsCode, sendIds, object); AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object;
System.out.println("8796w39879873298798"); calledRo.getPowerTransType();
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForCar(smsCode, sendIds, object);//消防车辆
} else if (FireBrigadeTypeEnum.医疗救援队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForAid(smsCode, sendIds, object);//120急救站
} else if (FireBrigadeTypeEnum.监控大队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForSurvBrigade(smsCode, sendIds, object);//监控大队
}
}
} }
} }
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
...@@ -14,18 +18,20 @@ import java.util.Set; ...@@ -14,18 +18,20 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper; 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.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -33,14 +39,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -33,14 +39,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; 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.DateUtils;
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.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.entity.FireTeam;
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.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService; import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl; 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.AlertCallePowerTransferRo;
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;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
...@@ -51,12 +62,12 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto; ...@@ -51,12 +62,12 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto; import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto; import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto; 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.PowerTransferCompanyZHDto; import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; 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.AlertSubmitted; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject; 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;
...@@ -72,32 +83,6 @@ import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedObjectService ...@@ -72,32 +83,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.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;
/** /**
* 警情报送记录 服务实现类 * 警情报送记录 服务实现类
...@@ -106,7 +91,8 @@ import java.util.stream.Collectors; ...@@ -106,7 +91,8 @@ import java.util.stream.Collectors;
* @date 2021-06-17 * @date 2021-06-17
*/ */
@Service @Service
public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, AlertSubmitted, AlertSubmittedMapper> implements IAlertSubmittedService { public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, AlertSubmitted, AlertSubmittedMapper>
implements IAlertSubmittedService {
@Autowired @Autowired
IAlertSubmittedObjectService iAlertSubmittedObjectService; IAlertSubmittedObjectService iAlertSubmittedObjectService;
...@@ -135,7 +121,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -135,7 +121,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired @Autowired
IDutyPersonService iDutyPersonService; IDutyPersonService iDutyPersonService;
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
@Value("${mqtt.topic.alert.reporting}") @Value("${mqtt.topic.alert.reporting}")
...@@ -154,13 +139,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -154,13 +139,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired @Autowired
PowerTransferCompanyMapper powerTransferCompanyMapper; PowerTransferCompanyMapper powerTransferCompanyMapper;
@Autowired
DynamicFormInstanceMapper dynamicFormInstanceMapper;
@Autowired
FireTeamServiceImpl fireTeamServiceImpl;
@Autowired
IFireTeamService fireTeamService;
@Override @Override
public SchedulingReportingDto listSchedulingByParam(AlertSubmittedDto queryParam) { public SchedulingReportingDto listSchedulingByParam(AlertSubmittedDto queryParam) {
SchedulingReportingDto schedulingReportingDto = new SchedulingReportingDto(); SchedulingReportingDto schedulingReportingDto = new SchedulingReportingDto();
List<AlertSubmittedExtDto> alertSubmittedExtDtoList = this.baseMapper.listSchedulingByParam(queryParam); List<AlertSubmittedExtDto> alertSubmittedExtDtoList = this.baseMapper.listSchedulingByParam(queryParam);
schedulingReportingDto.setSchedulingReportingList(alertSubmittedExtDtoList); schedulingReportingDto.setSchedulingReportingList(alertSubmittedExtDtoList);
Map<String, List<AlertSubmittedExtDto>> groupMap = Map<String, List<AlertSubmittedExtDto>> groupMap = alertSubmittedExtDtoList.stream()
alertSubmittedExtDtoList.stream().collect(Collectors.groupingBy(AlertSubmittedExtDto::getSubmissionMethodCode)); .collect(Collectors.groupingBy(AlertSubmittedExtDto::getSubmissionMethodCode));
int phoneSize = 0; int phoneSize = 0;
int smsSize = 0; int smsSize = 0;
if (ObjectUtils.isNotEmpty(groupMap.get(SubmissionMethodEnum.PHONE.getCode()))) { if (ObjectUtils.isNotEmpty(groupMap.get(SubmissionMethodEnum.PHONE.getCode()))) {
...@@ -187,7 +181,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -187,7 +181,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedExtDto.getUserName())); alertSubmittedExtDto.getUserName()));
TemplateExtendDto template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode()); TemplateExtendDto template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode());
String richContent = template.getRichContent(); String richContent = template.getRichContent();
alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent())); alertSubmittedExtDto.setSubmissionContentValue(
JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()));
alertSubmittedExtDto.setSubmissionContent(richContent); alertSubmittedExtDto.setSubmissionContent(richContent);
} catch (JSONException e) { } catch (JSONException e) {
alertSubmittedExtDto.setSubmissionContentValue(alertSubmittedExtDto.getSubmitContent()); alertSubmittedExtDto.setSubmissionContentValue(alertSubmittedExtDto.getSubmitContent());
...@@ -204,15 +199,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -204,15 +199,16 @@ 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 {
Map<String,String> map = saveAlertSubmitted(alertSubmittedDto, userName); Map<String, String> map = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参 // 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId()); AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(alertCalled.getSequenceNbr()); AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService
.selectAlertCalledByIdNoRedisNew(alertCalled.getSequenceNbr());
alertCalledVo.setAlertCalled(alertCalled); alertCalledVo.setAlertCalled(alertCalled);
// 调用规则 // 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"),map.get("mobiles")); 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) {
throw new RuntimeException(); throw new RuntimeException();
...@@ -223,7 +219,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -223,7 +219,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
/** /**
* 规则回调 * 规则回调
*/ */
public void ruleCallbackAction(String smsCode, List<Map<String,Object>> 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();
...@@ -245,49 +241,51 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -245,49 +241,51 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 警情续报 警情结案,非警情确认选择人员电话号码 // 警情续报 警情结案,非警情确认选择人员电话号码
String ids = calledRo.getIds(); String ids = calledRo.getIds();
if(!ValidationUtil.isEmpty(ids)) { if (!ValidationUtil.isEmpty(ids)) {
List<String> ls = Arrays.asList(ids.split(",")); List<String> ls = Arrays.asList(ids.split(","));
ls.stream().forEach(e->mobiles.add(e)); ls.stream().forEach(e -> mobiles.add(e));
} }
// 获取报送规则 // 获取报送规则
sendIds.stream().forEach(e->{ sendIds.stream().forEach(e -> {
// 一般火灾 // 航空器救援 // 一般火灾 // 航空器救援
if(alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) { if (alertTypeCode.equals(AlertStageEnums.YBHZ.getCode())
if(e.containsKey("onDuty")) { || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
if (e.containsKey("onDuty")) {
// 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。 // 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyId(); List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyId();
orgUsers.addAll(mapList); orgUsers.addAll(mapList);
} }
if(e.containsKey("fireBrigade")) { if (e.containsKey("fireBrigade")) {
// 根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员 // 根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
List<FirefightersDto> fireBrigade = firefightersService.queryById(e.get("fireBrigade").toString().split(",")); List<FirefightersDto> fireBrigade = firefightersService
fireBrigade.stream().forEach(f->{ .queryById(e.get("fireBrigade").toString().split(","));
HashMap<String,Object> map = new HashMap<>(); fireBrigade.stream().forEach(f -> {
map.put("telephone",f.getMobilePhone()); HashMap<String, Object> map = new HashMap<>();
map.put("sequenceNbr",f.getSequenceNbr()); map.put("telephone", f.getMobilePhone());
map.put("bizOrgName",f.getName()); map.put("sequenceNbr", f.getSequenceNbr());
map.put("bizOrgName", f.getName());
orgUsers.add(map); orgUsers.add(map);
}); });
} }
if(e.containsKey("airportUnit")) { if (e.containsKey("airportUnit")) {
// 根据人员职务:干部&领导 机场单位 模块 消防急救保障部中,“人员职务”不为空的人员 // 根据人员职务:干部&领导 机场单位 模块 消防急救保障部中,“人员职务”不为空的人员
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId("消防救援部"); List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId("消防救援部");
orgUsers.addAll(mapList); orgUsers.addAll(mapList);
} }
// 安运部 // 安运部
if(e.get("type").toString().equals("AY")) { if (e.get("type").toString().equals("AY")) {
if(e.containsKey("airportPost")) { if (e.containsKey("airportPost")) {
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId("安运部"); List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId("安运部");
orgUsers.addAll(mapList); orgUsers.addAll(mapList);
} }
} }
// 事发单位 // 事发单位
if(e.get("type").toString().equals("SF")) { if (e.get("type").toString().equals("SF")) {
if(e.containsKey("airportPost")) { if (e.containsKey("airportPost")) {
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved); List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved);
orgUsers.addAll(mapList); orgUsers.addAll(mapList);
} }
...@@ -295,16 +293,18 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -295,16 +293,18 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
} }
// 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他 // 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他
if(alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode()) if (alertTypeCode.equals(AlertStageEnums.HKJY.getCode())
|| alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) { || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
if(e.containsKey("onDuty")) { || alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode())
|| alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) {
if (e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew("消防支队"); List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew("消防支队");
orgUsers.addAll(mapList); orgUsers.addAll(mapList);
} }
} }
// 120急救 // 120急救
if(alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) { if (alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if (e.containsKey("onDuty")) { if (e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew("急救科"); List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew("急救科");
orgUsers.addAll(mapList); orgUsers.addAll(mapList);
...@@ -323,12 +323,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -323,12 +323,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 保存初报细分类型(一般火灾、航空器救援等) // 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode()); alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 警情初报 --- 续报 结案 // 警情初报 --- 续报 结案
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) { if (alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName()); alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
} else if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) { } else if (alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情续报.getName()); alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情续报.getName());
sCode = "SMS_JCS_XB"; sCode = "SMS_JCS_XB";
} else if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) { } else if (alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情结案.getName()); alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情结案.getName());
sCode = "SMS_JCS_JA"; sCode = "SMS_JCS_JA";
} else { } else {
...@@ -353,9 +353,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -353,9 +353,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
this.baseMapper.insert(alertSubmitted); this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr().toString(); alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum = Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum = EnumsUtils
EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class, .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();
// 组装人员信息 // 组装人员信息
...@@ -396,7 +395,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -396,7 +395,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 组织短信内容 // 组织短信内容
// 调用短信发送接口 // 调用短信发送接口
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) { if (alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
} else { } else {
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
...@@ -411,10 +410,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -411,10 +410,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
* @param userName 用户名 * @param userName 用户名
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) { public Map<String, String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
Long alertSubmittedId = alertSubmittedDto.getSequenceNbr(); Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String alertWay = ""; String alertWay = "";
Map<String,String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>(); Set<String> mobiles = new HashSet<>();
if (alertSubmittedId == null) { if (alertSubmittedId == null) {
...@@ -423,7 +422,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -423,7 +422,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String bussTypeCode; String bussTypeCode;
alertSubmitted.setAlertCalledId(alertSubmittedDto.getAlertCalledId()); alertSubmitted.setAlertCalledId(alertSubmittedDto.getAlertCalledId());
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日 // 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
if("316".equals(alertSubmittedDto.getBusinessTypeCode())) { if ("316".equals(alertSubmittedDto.getBusinessTypeCode())) {
alertSubmitted.setBusinessTypeCode(AlertBusinessTypeEnum.警情续报.getCode()); alertSubmitted.setBusinessTypeCode(AlertBusinessTypeEnum.警情续报.getCode());
bussTypeCode = AlertBusinessTypeEnum.警情续报.getCode(); bussTypeCode = AlertBusinessTypeEnum.警情续报.getCode();
} else { } else {
...@@ -439,14 +438,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -439,14 +438,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Optional<SubmissionMethodEnum> submissionMethodEnum = EnumsUtils.getEnumObject(SubmissionMethodEnum.class, Optional<SubmissionMethodEnum> submissionMethodEnum = EnumsUtils.getEnumObject(SubmissionMethodEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getSubmissionMethodCode())); e -> e.getCode().equals(alertSubmittedDto.getSubmissionMethodCode()));
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName()); alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = EnumsUtils.getEnumObject(
EnumsUtils.getEnumObject(AlertSchedulingTypeEnum.class, AlertSchedulingTypeEnum.class, e -> e.getCode().equals(alertSubmittedDto.getSchedulingTypeCode()));
e -> e.getCode().equals(alertSubmittedDto.getSchedulingTypeCode()));
alertSubmitted.setSchedulingTypeCode(alertSubmittedDto.getSchedulingTypeCode()); alertSubmitted.setSchedulingTypeCode(alertSubmittedDto.getSchedulingTypeCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName()); alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日 // 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
if("316".equals(alertSubmittedDto.getBusinessTypeCode())) { if ("316".equals(alertSubmittedDto.getBusinessTypeCode())) {
JSONObject jsonObject = JSON.parseObject(alertSubmittedDto.getSubmitContent().toJSONString()); JSONObject jsonObject = JSON.parseObject(alertSubmittedDto.getSubmitContent().toJSONString());
alertSubmitted.setSubmissionContent(jsonObject.get("custom").toString()); alertSubmitted.setSubmissionContent(jsonObject.get("custom").toString());
} else { } else {
...@@ -506,24 +504,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -506,24 +504,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedDto.getBusinessTypeCode()); alertSubmittedDto.getBusinessTypeCode());
// 警情续报 // 警情续报
if(AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) { if (AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情续报.getCode(); alertWay = AlertBusinessTypeEnum.警情续报.getCode();
} }
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) { if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay =AlertBusinessTypeEnum.警情结案.getCode(); alertWay = AlertBusinessTypeEnum.警情结案.getCode();
} }
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) { if (AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.非警情确认.getCode(); 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())) {
// 查询本次警情调派的车辆 // 查询本次警情调派的车辆
List<String> transferCarIdList = List<String> transferCarIdList = powerTransferService
powerTransferService.queryTransferCarIdsByAlertCalledId(alertSubmittedDto.getAlertCalledId()); .queryTransferCarIdsByAlertCalledId(alertSubmittedDto.getAlertCalledId());
List<Object> carStatusInfoDtoList = Lists.newArrayList(); List<Object> carStatusInfoDtoList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(transferCarIdList)) { if (!ValidationUtil.isEmpty(transferCarIdList)) {
transferCarIdList.forEach(carId -> { transferCarIdList.forEach(carId -> {
...@@ -534,7 +531,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -534,7 +531,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}); });
} }
//修改调派车辆任务 // 修改调派车辆任务
powerTransferCompanyResourcesService.updateByAlertCalledId(alertSubmittedDto.getAlertCalledId()); powerTransferCompanyResourcesService.updateByAlertCalledId(alertSubmittedDto.getAlertCalledId());
// 更新所有车辆状态为执勤 // 更新所有车辆状态为执勤
...@@ -556,8 +553,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -556,8 +553,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 4.2调用短信发送接口 // 4.2调用短信发送接口
// alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); // alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
map.put("alertWay",alertWay); map.put("alertWay", alertWay);
map.put("mobiles", StringUtils.join(mobiles,",")); map.put("mobiles", StringUtils.join(mobiles, ","));
return map; return map;
} }
...@@ -572,7 +569,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -572,7 +569,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
public void saveAlertSubmittedObject(List<AlertSubmittedObject> alertSubmittedObjectList, String smsCode, public void saveAlertSubmittedObject(List<AlertSubmittedObject> alertSubmittedObjectList, String smsCode,
Set<String> mobiles, HashMap<String, String> smsParams) { Set<String> mobiles, HashMap<String, String> smsParams) {
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList); // alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息 // 发送任务消息
// 组织短信内容 // 组织短信内容
...@@ -580,28 +576,30 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -580,28 +576,30 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
} }
public void getAlertSubmittedContent(Long alertCalledId, ArrayList<TemplateDto> templateDtos, String companyName) throws IllegalAccessException { public void getAlertSubmittedContent(Long alertCalledId, ArrayList<TemplateDto> templateDtos, String companyName)
throws IllegalAccessException {
AlertCalled alertCalled = alertCalledService.getById(alertCalledId); AlertCalled alertCalled = alertCalledService.getById(alertCalledId);
Map<String, Object> map = objectToMap(alertCalled); Map<String, Object> map = objectToMap(alertCalled);
map.put("companyName", companyName); map.put("companyName", companyName);
// 获取模板内容 // 获取模板内容
List<DataDictionary> dataDictionaries = List<DataDictionary> dataDictionaries = dataDictionaryService
dataDictionaryService.list(new QueryWrapper<DataDictionary>().eq("type", .list(new QueryWrapper<DataDictionary>().eq("type", "JQBSLX"));
"JQBSLX"));
for (DataDictionary dataDictionary : dataDictionaries) { for (DataDictionary dataDictionary : dataDictionaries) {
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type_code", Template template = templateService
dataDictionary.getCode()).eq("format", true)); .getOne(new QueryWrapper<Template>().eq("type_code", dataDictionary.getCode()).eq("format", true));
List<PowerTransferCompanyDto> lastPowerTransferCompany; List<PowerTransferCompanyDto> lastPowerTransferCompany;
if ("警情续报".equals(template.getType()) && (lastPowerTransferCompany = if ("警情续报".equals(template.getType())
powerTransferService.getLastPowerTransferCompany(alertCalledId)).size() > 0) { && (lastPowerTransferCompany = powerTransferService.getLastPowerTransferCompany(alertCalledId))
.size() > 0) {
map.put("businessType", template.getType()); map.put("businessType", template.getType());
// 获取力量调派内容 // 获取力量调派内容
StringBuilder companyNames = new StringBuilder(); StringBuilder companyNames = new StringBuilder();
StringBuilder resourcesInfo = new StringBuilder(); StringBuilder resourcesInfo = new StringBuilder();
for (PowerTransferCompanyDto powerTransferCompanyDto : lastPowerTransferCompany) { for (PowerTransferCompanyDto powerTransferCompanyDto : lastPowerTransferCompany) {
companyNames.append(powerTransferCompanyDto.getCompanyName()).append("、"); companyNames.append(powerTransferCompanyDto.getCompanyName()).append("、");
resourcesInfo.append(powerTransferCompanyDto.getType()).append(powerTransferCompanyDto.getResourcesCount()).append("辆、"); resourcesInfo.append(powerTransferCompanyDto.getType())
.append(powerTransferCompanyDto.getResourcesCount()).append("辆、");
} }
map.put("companyNames", companyNames.deleteCharAt(companyNames.length() - 1).toString()); map.put("companyNames", companyNames.deleteCharAt(companyNames.length() - 1).toString());
map.put("resourcesInfo", resourcesInfo.deleteCharAt(resourcesInfo.length() - 1).toString()); map.put("resourcesInfo", resourcesInfo.deleteCharAt(resourcesInfo.length() - 1).toString());
...@@ -624,22 +622,26 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -624,22 +622,26 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
List<InstructionsZHDto> listInstructionsZHDto = new ArrayList<>(); List<InstructionsZHDto> listInstructionsZHDto = new ArrayList<>();
//获取调派记录 // 获取调派记录
List<PowerTransferCompanyZHDto> listPowerTransferCompanyZHDto = powerTransferCompanyMapper.listPowerTransferCompanyZHDto(id); List<PowerTransferCompanyZHDto> listPowerTransferCompanyZHDto = powerTransferCompanyMapper
.listPowerTransferCompanyZHDto(id);
listPowerTransferCompanyZHDto.stream().forEach(PowerTransferCompanyZHDto -> { listPowerTransferCompanyZHDto.stream().forEach(PowerTransferCompanyZHDto -> {
String content = ""; String content = "";
if (PowerTransferCompanyZHDto.getIsDistributionAgencies()) { if (PowerTransferCompanyZHDto.getIsDistributionAgencies()) {
content = "调派" + PowerTransferCompanyZHDto.getCompanyName() + "前往" + PowerTransferCompanyZHDto.getAddress(); content = "调派" + PowerTransferCompanyZHDto.getCompanyName() + "前往"
+ PowerTransferCompanyZHDto.getAddress();
} else { } else {
content = "调派" + PowerTransferCompanyZHDto.getCompanyName() + PowerTransferCompanyZHDto.getSubmissionContent() + "前往" + PowerTransferCompanyZHDto.getAddress(); content = "调派" + PowerTransferCompanyZHDto.getCompanyName()
+ PowerTransferCompanyZHDto.getSubmissionContent() + "前往"
+ PowerTransferCompanyZHDto.getAddress();
} }
InstructionsZHDto instruct = new InstructionsZHDto(PowerTransferCompanyZHDto.getSequenceNbr(), PowerTransferCompanyZHDto.getDispatchType(), PowerTransferCompanyZHDto.getRecDate(), content, null); InstructionsZHDto instruct = new InstructionsZHDto(PowerTransferCompanyZHDto.getSequenceNbr(),
PowerTransferCompanyZHDto.getDispatchType(), PowerTransferCompanyZHDto.getRecDate(), content, null);
listInstructionsZHDto.add(instruct); listInstructionsZHDto.add(instruct);
}); });
// 获取融合调度信息
//获取融合调度信息
List<AlertSubmittedZHDto> listAlertSubmittedZHDto = alertSubmittedMapper.listAlertSubmittedZHDto(id); List<AlertSubmittedZHDto> listAlertSubmittedZHDto = alertSubmittedMapper.listAlertSubmittedZHDto(id);
listAlertSubmittedZHDto.stream().forEach(AlertSubmittedZHDto -> { listAlertSubmittedZHDto.stream().forEach(AlertSubmittedZHDto -> {
...@@ -649,52 +651,59 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -649,52 +651,59 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
switch (AlertSubmittedZHDto.getBusinessType()) { switch (AlertSubmittedZHDto.getBusinessType()) {
case "警情初报": case "警情初报":
content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + ","
content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + js.getString("address") + "发生" + js.getString("alertType"); + js.getString("address") + "发生" + js.getString("alertType");
break; break;
case "警情续报": case "警情续报":
content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + "现场被困人数:" + js.getString("trappedNum") + "人伤亡人数:" + js.getString("casualtiesNum") + "人。"; content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + ","
+ "现场被困人数:" + js.getString("trappedNum") + "人伤亡人数:" + js.getString("casualtiesNum") + "人。";
break; break;
case "非警情确认": case "非警情确认":
content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + "此警情现场确认为假警情。"; content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + ","
+ "此警情现场确认为假警情。";
break; break;
case "警情结案": case "警情结案":
content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + "此警情已完场警情处置,警情已结案。"; content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + ","
+ "此警情已完场警情处置,警情已结案。";
break; break;
default: default:
break; break;
} }
InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(), AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content,null); InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(),
AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content, null);
listInstructionsZHDto.add(instruct); listInstructionsZHDto.add(instruct);
}); });
// 获取归并得警情信息 // 获取归并得警情信息
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(AlertCalled::getFatherAlert,id); queryWrapper.eq(AlertCalled::getFatherAlert, id);
List<AlertCalled> alertCalleds = alertCalledService.getBaseMapper().selectList(queryWrapper); List<AlertCalled> alertCalleds = alertCalledService.getBaseMapper().selectList(queryWrapper);
alertCalleds.stream().forEach(e->{ alertCalleds.stream().forEach(e -> {
AlertSubmittedZHDto alertSubmittedZHDto = new AlertSubmittedZHDto(); AlertSubmittedZHDto alertSubmittedZHDto = new AlertSubmittedZHDto();
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledService.selectAlertCalledByIdNoRedis(e.getSequenceNbr()); AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledService
.selectAlertCalledByIdNoRedis(e.getSequenceNbr());
alertSubmittedZHDto.setAlertCalledFormDto(alertCalledFormDto); alertSubmittedZHDto.setAlertCalledFormDto(alertCalledFormDto);
alertSubmittedZHDto.setSequenceNbr(e.getSequenceNbr()); alertSubmittedZHDto.setSequenceNbr(e.getSequenceNbr());
alertSubmittedZHDto.setBusinessType("警情归并"); alertSubmittedZHDto.setBusinessType("警情归并");
alertSubmittedZHDto.setSubmissionTime(alertCalledFormDto.getAlertCalled().getCallTime()); alertSubmittedZHDto.setSubmissionTime(alertCalledFormDto.getAlertCalled().getCallTime());
alertSubmittedZHDto.setCompanyName(alertCalledFormDto.getAlertCalled().getCompanyName()); alertSubmittedZHDto.setCompanyName(alertCalledFormDto.getAlertCalled().getCompanyName());
alertSubmittedZHDto.setUserName(alertCalledFormDto.getAlertCalled().getRecUserName()); alertSubmittedZHDto.setUserName(alertCalledFormDto.getAlertCalled().getRecUserName());
InstructionsZHDto instruct = new InstructionsZHDto(alertSubmittedZHDto.getSequenceNbr(), alertSubmittedZHDto.getBusinessType(), alertSubmittedZHDto.getSubmissionTime(), null, alertSubmittedZHDto.getAlertCalledFormDto()); InstructionsZHDto instruct = new InstructionsZHDto(alertSubmittedZHDto.getSequenceNbr(),
alertSubmittedZHDto.getBusinessType(), alertSubmittedZHDto.getSubmissionTime(), null,
alertSubmittedZHDto.getAlertCalledFormDto());
listInstructionsZHDto.add(instruct); listInstructionsZHDto.add(instruct);
}); });
//排序时间倒序 // 排序时间倒序
/* Bug 2613 修改排序 按照发送时间排序 2021-09-01 陈召 开始*/ /* Bug 2613 修改排序 按照发送时间排序 2021-09-01 陈召 开始 */
Collections.sort(listInstructionsZHDto, new Comparator<InstructionsZHDto>() { Collections.sort(listInstructionsZHDto, new Comparator<InstructionsZHDto>() {
@Override @Override
public int compare(InstructionsZHDto o1, InstructionsZHDto o2) { public int compare(InstructionsZHDto o1, InstructionsZHDto o2) {
...@@ -705,7 +714,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -705,7 +714,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
return (int) i; return (int) i;
} }
}); });
/* Bug 2613 修改排序 按照发送时间排序 2021-09-01 陈召 结束*/ /* Bug 2613 修改排序 按照发送时间排序 2021-09-01 陈召 结束 */
return listInstructionsZHDto; return listInstructionsZHDto;
} }
...@@ -738,4 +747,397 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -738,4 +747,397 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
} }
return map; return map;
} }
@SuppressWarnings("unchecked")
public void ruleCallbackActionForPowerTransferForCar(String smsCode, List sendIds, Object object)
throws IllegalAccessException, MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>();
String alertCalledId = null;
Set<Map<String, Object>> userIdList = new HashSet<Map<String, Object>>();
// 判断当前的规则中是否指定了给当前的车辆驾驶员
boolean designatedDriver = false;
for (Object id : sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(id));
if (jsonObject.containsKey("type") && jsonObject.getString("type").equals(AlertStageEnums.BD.getCode())) {
designatedDriver = true;
}
}
List<Map<String, Object>> orgUsers = new LinkedList<>();
String sCode = "";
if (object instanceof AlertCallePowerTransferRo) {
AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
//先获取消救部领导、消救部值班人员信息
sendIds.stream().forEach(e -> {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
// 消救部
if (jsonObject.containsKey("airportUnit")) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
userIdList.addAll(mapList);
}
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
userIdList.addAll(mapList);
}
}
}
});
List<Object> companyDetail =JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
for (Object powerTransferCompanyDto : companyDetail) {
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName();
StringBuffer resourcesNum = new StringBuffer();
Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>();
//FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
String alertTypeCode = calledRo.getAlertTypeCode();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
sendIds.stream().forEach(e -> {
JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(e));
if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.DD.getCode()))) {
String [] groupCode = jsonObject1.getString("fireBrigade").split(",");
List<String> positionType= Arrays.asList(groupCode);
if (jsonObject1.containsKey("fireBrigade")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(fireTeam.getCompanyName(),positionType);
sendUserIds.addAll(mapList);
}
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),fireTeam.getCompanyName());
sendUserIds.addAll(mapList);
}
}
}else if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.ZD.getCode()))) {
String [] groupCode = jsonObject1.get("fireBrigade").toString().split(",");
List<String> positionType= Arrays.asList(groupCode);
String departmentName= jsonObject1.getString("name");
if (jsonObject1.containsKey("fireBrigade")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,positionType);
sendUserIds.addAll(mapList);
}
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
sendUserIds.addAll(mapList);
}
}
}
});
sendUserIds.addAll(userIdList);
smsCode = AlertBusinessTypeEnum.力量调派.getSms_code();
// 组装人员信息
for (Map<String, Object> orgUser : sendUserIds) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
alertSubmittedObject.setType(false);
alertSubmittedObject.setCompanyId(companyId);
alertSubmittedObject.setCompanyName(companyName);
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
}
alertSubmittedObjectList.add(alertSubmittedObject);
}
smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address", calledRo.getAddress());
smsParams.put("content", calledRo.getContent());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("companyName", calledRo.getCompanyName());
smsParams.put("contactUser", calledRo.getContactUser());
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
List<PowerTransferCompanyResourcesDto> list = powerDto
.getPowerTransferCompanyResourcesDtoList();
if (list != null && list.size() > 0) {
for (PowerTransferCompanyResourcesDto i : list) {
String carName = i.getResourcesName();
String resourceName = i.getResourcesNum();
String type = i.getType();
resourcesNum.append("车辆" + type);
resourcesNum.append("车牌号" + carName + " " + resourceName);
resourcesNum.append("、");
if (designatedDriver) {
// 发送单个车辆的信息数据到客户
smsParams.put("resourcesNum",
resourcesNum.toString().substring(resourcesNum.toString().length() - 2));
List<AlertSubmittedObject> alertSubmittedObjectListSub = Lists.newArrayList();
Map<String, Object> map = dynamicFormInstanceMapper
.getCurentCarIsUserPhone(Long.parseLong(i.getResourcesId()));
AlertSubmittedObject alertSubmittedObjectSub = new AlertSubmittedObject();
alertSubmittedObjectSub.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
alertSubmittedObjectSub.setType(false);
alertSubmittedObjectSub.setCompanyId(companyId);
alertSubmittedObjectSub.setCompanyName(companyName);
alertSubmittedObjectSub.setType(false);
if(map==null || !map.containsKey("userId")) {
continue;
}
alertSubmittedObjectSub.setUserId(Long.parseLong(map.get("userId").toString()));
alertSubmittedObjectSub.setUserName(map.get("userName").toString());
Set<String> mobile =null;
if (!ValidationUtil.isEmpty(map.get("mobilePhone"))) {
mobile = new HashSet<String>() {
{
add(map.get("mobilePhone").toString());
}
};
alertSubmittedObjectSub.setUserPhone(map.get("mobilePhone").toString());
}
alertSubmittedObjectListSub.add(alertSubmittedObjectSub);
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectListSub);
// 调用短信发送接口
alertCalledAction.sendAlertCalleCmd(sCode, mobile, smsParams);
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS,
false);
}
}
}
String resourcesNumStr = resourcesNum.toString();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
});
smsParams.put("resourcesNum", resourcesNumStr.substring(resourcesNumStr.length() - 2));
// 短信报送对象
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
try {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
} catch (Exception e) {
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
}
}
@SuppressWarnings("unchecked")
public void ruleCallbackActionForPowerTransferForSurvBrigade(String smsCode, List sendIds, Object object) throws MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>();
String alertCalledId = null;
if (object instanceof AlertCallePowerTransferRo) {
AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
Set<Map<String, Object>> userIds = new HashSet<Map<String, Object>>();
List<Object> companyDetail =JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
for(Object e:sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
if(jsonObject.containsKey("type") &&( (jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
userIds.addAll(mapList);
}
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
userIds.addAll(mapList);
}
}
}
}
for (Object powerTransferCompanyDto : companyDetail) {
Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>();
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
for(Object sendObject:sendIds) {
JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(sendObject));
if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.监控大队.getCode()))) {
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> dutyList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(
DateUtils.getDateNowShortStr(), fireTeam.getCompanyName());
sendUserIds.addAll(dutyList);
}
if (jsonObject1.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff( fireTeam.getCompanyName(),null);
sendUserIds.addAll(mapList);
}
}
}
}
sendUserIds.addAll(userIds);
smsCode = AlertBusinessTypeEnum.力量调派.getSms_code();
// 组装人员信息
for (Map<String, Object> orgUser : sendUserIds) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
alertSubmittedObject.setType(false);
alertSubmittedObject.setCompanyId(companyId);
alertSubmittedObject.setCompanyName(companyName);
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
}
alertSubmittedObjectList.add(alertSubmittedObject);
}
smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address", calledRo.getAddress());
smsParams.put("content", calledRo.getContent());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("companyName", calledRo.getCompanyName());
smsParams.put("contactUser", calledRo.getContactUser());
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
sendUserIds.stream().forEach(i-> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
});
smsParams.put("resourcesNum", companyName);
// 短信报送对象
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
try {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
}catch(Exception e){
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
}
}
public void ruleCallbackActionForPowerTransferForAid(String smsCode, List sendIds, Object object) throws MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Set<String> mobiles = new HashSet<>();
Set<Map<String, Object>> userIds = new HashSet<Map<String, Object>>();
HashMap<String, String> smsParams = new HashMap<>();
String alertCalledId = null;
if (object instanceof AlertCallePowerTransferRo) {
AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
//List<FireTeam> fireTeamList= new ArrayList<FireTeam>();
List<Object> companyDetail =JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
//获取急救科、消救部人员信息
for(Object e:sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
if(jsonObject.containsKey("type") &&( (jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
userIds.addAll(mapList);
}
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
userIds.addAll(mapList);
}
}
}
}
//获取对应急救站的当日值班员信息
for (Object powerTransferCompanyDto : companyDetail) {
Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>();
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);//这个公司ID实际上是120急救站的id值
//fireTeamList.add(fireTeam);
for(Object e:sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
//获取120急救站的规则
if (jsonObject.containsKey("type") && (jsonObject.getString("type").equals(AlertStageEnums.JJZ.getCode()))) {
if(!jsonObject.containsKey("onDuty")) {
continue;
}
//fireTeamList.stream().forEach(i->{
//获取120急救排版值班的人员信息
List<Map<String, Object>> dutyList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndAirId(
DateUtils.getDateNowShortStr(), fireTeam.getCompanyName());
sendUserIds.addAll(dutyList);
//});
}
}
sendUserIds.addAll(userIds);
smsCode = AlertBusinessTypeEnum.力量调派.getSms_code();
// 组装人员信息
for (Map<String, Object> orgUser : sendUserIds) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
alertSubmittedObject.setCompanyId(companyId);
alertSubmittedObject.setCompanyName(companyName);
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("mobilePhone"))) {
mobiles.add((String) orgUser.get("mobilePhone"));
alertSubmittedObject.setUserPhone(orgUser.get("mobilePhone").toString());
}
alertSubmittedObjectList.add(alertSubmittedObject);
}
smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address", calledRo.getAddress());
smsParams.put("content", calledRo.getContent());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("companyName", calledRo.getCompanyName());
smsParams.put("contactUser", calledRo.getContactUser());
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
});
smsParams.put("resourcesNum", companyName);
// 短信报送对象
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
try {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
}catch (Exception e) {// TODO: handle exception
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
}
}
} }
...@@ -438,4 +438,5 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -438,4 +438,5 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
// queryWrapper.eq(FireTeam::getCompany, companyId); // queryWrapper.eq(FireTeam::getCompany, companyId);
return this.baseMapper.selectList(queryWrapper); return this.baseMapper.selectList(queryWrapper);
} }
} }
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -143,22 +142,22 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -143,22 +142,22 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
powerTransfer.setDispatchNum(dispatch_num); powerTransfer.setDispatchNum(dispatch_num);
powerTransfer.setSequenceNbr(null); powerTransfer.setSequenceNbr(null);
save(powerTransfer); // save(powerTransfer);
Long powerTransferSequenceNbr = powerTransfer.getSequenceNbr(); // Long powerTransferSequenceNbr = powerTransfer.getSequenceNbr();
//
// 获取任务派发模板 // // 获取任务派发模板
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type", // Template template = templateService.getOne(new QueryWrapper<Template>().eq("type",
alertCalled.getAlertType()).eq("format", false)); // alertCalled.getAlertType()).eq("format", false));
String content = template.getContent(); // String content = template.getContent();
Map<String, String> definitions = new HashMap<>(); // Map<String, String> definitions = new HashMap<>();
initDefinitions(definitions, alertCalled, powerTransferDto); // initDefinitions(definitions, alertCalled, powerTransferDto);
// 创建力量调派单位 // 创建力量调派单位
createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content); // createPowerTransferCompany(powerTransferDto, powerTransferSequenceNbr, definitions, content);
//封装调派任务的集合,以便于实现任务规则校验 //封装调派任务的集合,以便于实现任务规则校验
try { try {
//packagePowerTransferDetail(powerTransferDto); packagePowerTransferDetail(powerTransferDto);
} catch (Exception e) { } catch (Exception e) {
log.error("调用规则失败:PowerTransferServiceImpl。createPowerTransfer()"); log.error("调用规则失败:PowerTransferServiceImpl。createPowerTransfer()");
} }
...@@ -191,8 +190,8 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe ...@@ -191,8 +190,8 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
} }
} }
//ruleAlertCalledService.powerTransferCalledRule(fullTimeList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.专职消防队.getKey()); //ruleAlertCalledService.powerTransferCalledRule(fullTimeList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.专职消防队.getKey());
//ruleAlertCalledService.powerTransferCalledRule(medicalTeamList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.医疗救援队.getKey()); ruleAlertCalledService.powerTransferCalledRule(medicalTeamList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.医疗救援队.getKey());
ruleAlertCalledService.powerTransferCalledRule(monitorTeamList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.监控大队.getKey()); //ruleAlertCalledService.powerTransferCalledRule(monitorTeamList,powerTransferDto.getAlertCalledId(),FireBrigadeTypeEnum.监控大队.getKey());
} }
@Override @Override
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
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;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; 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.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo;
...@@ -20,6 +18,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo; ...@@ -20,6 +18,7 @@ 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.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; 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.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
...@@ -236,13 +235,15 @@ public class RuleAlertCalledService { ...@@ -236,13 +235,15 @@ public class RuleAlertCalledService {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledServiceImpl AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledServiceImpl
.selectAlertCalledByIdNoRedis(alertCalledId); .selectAlertCalledByIdNoRedis(alertCalledId);
alertCallePowerTransferRo.setAlertSubmittedId(Long.toString(alertCalledId));
if (alertCalledFormDto == null) { if (alertCalledFormDto == null) {
return false; return false;
} }
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled(); AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
alertCallePowerTransferRo alertCallePowerTransferRo
.setCallTimeStr(DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN)); .setCallTimeStr(DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
alertCallePowerTransferRo.setSequenceNbr(String.valueOf(alertCalled.getSequenceNbr()));
alertCallePowerTransferRo.setAddress(alertCalled.getAddress()); alertCallePowerTransferRo.setAddress(alertCalled.getAddress());
alertCallePowerTransferRo.setAlertType(alertCalled.getAlertType()); alertCallePowerTransferRo.setAlertType(alertCalled.getAlertType());
alertCallePowerTransferRo.setAlertTypeCode(alertCalled.getAlertTypeCode()); alertCallePowerTransferRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
...@@ -258,9 +259,6 @@ public class RuleAlertCalledService { ...@@ -258,9 +259,6 @@ public class RuleAlertCalledService {
List<FormValue> alertFormValues = alertCalledFormDto.getDynamicFormAlert(); List<FormValue> alertFormValues = alertCalledFormDto.getDynamicFormAlert();
if (!ValidationUtil.isEmpty(alertFormValues)) { if (!ValidationUtil.isEmpty(alertFormValues)) {
for (FormValue alertFormValue : alertFormValues) { for (FormValue alertFormValue : alertFormValues) {
if (alertFormValue.getKey().equals("alertSubmittedId")) {
alertCallePowerTransferRo.setAlertSubmittedId(alertFormValue.getValue());
}
// 一般火灾 // 一般火灾
if (alertFormValue.getKey().equals("fireLocation")) { if (alertFormValue.getKey().equals("fireLocation")) {
alertCallePowerTransferRo.setFireLocation(alertFormValue.getValue()); alertCallePowerTransferRo.setFireLocation(alertFormValue.getValue());
...@@ -292,7 +290,7 @@ public class RuleAlertCalledService { ...@@ -292,7 +290,7 @@ public class RuleAlertCalledService {
} }
} }
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(type)) { if (FireBrigadeTypeEnum.专职消防队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(new ArrayList<>(i)); alertCallePowerTransferRo.setCompany(JSONArray.toJSONString(i));
alertCallePowerTransferRo.setPowerTransType(type); alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation()); stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation());
...@@ -302,7 +300,7 @@ public class RuleAlertCalledService { ...@@ -302,7 +300,7 @@ public class RuleAlertCalledService {
alertCallePowerTransferRo.setContent(stringBuffer.toString()); alertCallePowerTransferRo.setContent(stringBuffer.toString());
} else if (FireBrigadeTypeEnum.监控大队.getKey().equals(type)) { } else if (FireBrigadeTypeEnum.监控大队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(new ArrayList<>(i)); alertCallePowerTransferRo.setCompany(JSONArray.toJSONString(i));
alertCallePowerTransferRo.setPowerTransType(type); alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation()); stringBuffer.append(" 失火位置:"+alertCallePowerTransferRo.getFireLocation());
...@@ -312,7 +310,7 @@ public class RuleAlertCalledService { ...@@ -312,7 +310,7 @@ public class RuleAlertCalledService {
alertCallePowerTransferRo.setContent(stringBuffer.toString()); alertCallePowerTransferRo.setContent(stringBuffer.toString());
} else if (FireBrigadeTypeEnum.医疗救援队.getKey().equals(type)) { } else if (FireBrigadeTypeEnum.医疗救援队.getKey().equals(type)) {
alertCallePowerTransferRo.setCompany(new ArrayList<>(i)); alertCallePowerTransferRo.setCompany(JSONArray.toJSONString(i));
alertCallePowerTransferRo.setPowerTransType(type); alertCallePowerTransferRo.setPowerTransType(type);
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(" 患者现状:"+ageGroup==null?"无":ageGroup); stringBuffer.append(" 患者现状:"+ageGroup==null?"无":ageGroup);
......
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