Commit 4fd148e0 authored by chenzhao's avatar chenzhao

web消息弹窗 航空器发生空白 数据源补充

parent 1bf0c08a
......@@ -58,6 +58,16 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceI
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
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.AlertCalledTodyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ControllerDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ControllerEquipDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
......
......@@ -33,10 +33,10 @@ import java.util.stream.IntStream;
import com.yeejoin.amos.boot.module.command.api.dto.FrontlineLiaisonDto;
import com.yeejoin.amos.boot.module.command.biz.service.impl.FrontlineLiaisonServiceImpl;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.enums.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.JcSituationDetailMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.*;
import com.yeejoin.amos.boot.module.jcs.biz.dao.ESAlertCalledRepository;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import org.apache.commons.lang3.ObjectUtils;
......@@ -99,32 +99,6 @@ import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireTeamServiceImpl;
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.jcs.api.dto.AlertCallCommandDto;
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.AlertCalledMobDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledPowerInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedExtDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
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.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
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.PushMessageWebAndAppRo;
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.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedObjectService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService;
import com.yeejoin.amos.boot.module.jcs.biz.rule.action.AlertCalledAction;
......@@ -175,7 +149,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
OrgUsrServiceImpl iOrgUsrService;
@Autowired
IDutyPersonService iDutyPersonService;
@Autowired
AlertFormValueServiceImpl formValueService;
@Autowired
PowerTransferMapper powerTransferMapper;
......@@ -262,23 +237,25 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedExtDtoList.forEach(alertSubmittedExtDto -> {
try {
alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(),
alertSubmittedExtDto.getUserName()));
if(alertSubmittedExtDto.getUserName()!=null){
alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(),
alertSubmittedExtDto.getUserName()));
}else{
alertSubmittedExtDto.setExtraInfo("未匹配到报送人");
}
if(alertSubmittedExtDto.getUserName()!=null){
alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(),
alertSubmittedExtDto.getUserName()));
}else{
alertSubmittedExtDto.setExtraInfo("未匹配到报送人");
}
TemplateExtendDto template = null;
Template templateN = null;
if(AlertBusinessTypeEnum.警情初报.getName().equals(alertSubmittedExtDto.getBusinessType())) {
// 获取任务派发模板
templateN = templateService
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN,template);
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN,template);
template.setRichContent(template.getContent());
} else {
......@@ -309,7 +286,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("companyName") ;
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("companyName") ;
JSONObject jsonObject = null;
if(!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) {
......@@ -390,7 +367,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
esAlertCalledRepository.deleteById(alertSubmittedDto.getAlertCalledId());
esAlertCalledRepository.save(esAlertCalled);
} catch (MqttException e) {
} catch (MqttException e) {
throw new RuntimeException();
}
return true;
......@@ -408,263 +385,273 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 获取报送对象列表
try { List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>();
String alertCalledId = null;
Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>();
String alertCalledId = null;
List<Map<String, Object>> orgUsers = new LinkedList<>();
List<Map<String, Object>> orgUsersqc = 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();
//航空器类型警情 web端消息弹窗 发生后面没有数据源 和测试沟通补充航空器子类为数据源
if (calledRo.getAlertTypeCode().equals("230")) {
List<AlertFormValueDto> alertFormValueDtos = formValueService.listByCalledId(Long.valueOf(calledRo.getSequenceNbr()));
alertFormValueDtos.forEach(e->{
if (e.getFieldCode().equals("aircraftRescueSub")){
calledRo.setFireSituation(e.getFieldValue());
}
});
}
List<Map<String, Object>> orgUsers = new LinkedList<>();
List<Map<String, Object>> orgUsersqc = 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();
alertCalledId = calledRo.getSequenceNbr();
log.info("calledRo.getSequenceNbr()"+calledRo.getSequenceNbr());
log.info("alertCalledObjsDtoid"+Long.valueOf(calledRo.getSequenceNbr()));
AlertCalledObjsDto alertCalledObjsDto = alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
log.info("alertCalledObjsDto"+alertCalledObjsDto);
alertCalled = alertCalledObjsDto.getAlertCalled();
log.info("calledRo.getSequenceNbr()"+calledRo.getSequenceNbr());
log.info("alertCalledObjsDtoid"+Long.valueOf(calledRo.getSequenceNbr()));
AlertCalledObjsDto alertCalledObjsDto = alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
log.info("alertCalledObjsDto"+alertCalledObjsDto);
alertCalled = alertCalledObjsDto.getAlertCalled();
// AlertCalledRo tempCalledRo = new AlertCalledRo();
// RuleAlertCalledService.init(tempCalledRo,alertCalledObjsDto);
// BeanUtils.copyProperties(tempCalledRo,calledRo,"feedback","usIds","ids","alertWay","replaceContent","unitInvolved","alertSubmittedId");
String alertTypeCode = calledRo.getAlertTypeCode();
alertWay = calledRo.getAlertWay();
String unitInvolved = calledRo.getUnitInvolved();
// 警情续报 警情结案,非警情确认选择人员电话号码
String ids = calledRo.getIds();
if(!ValidationUtil.isEmpty(ids)) {
List<String> ls = Arrays.asList(ids.split(","));
for (String s: ls
) {
mobiles.add(s);
}
}
// 获取报送规则
sendIds.stream().forEach(e->{
// 一般火灾 // 航空器救援
if(alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
// 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。
if(e.containsKey("onDuty")) {
String [] arr = e.get("onDuty").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyId(list);
orgUsers.addAll(mapList);
}
//根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
if(e.containsKey("fireBrigade")) {
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());
map.put("sequenceNbr",f.getSequenceNbr());
map.put("bizOrgName",f.getName());
map.put("amosUserId",f.getAmosUserId());
map.put("companyName", e.get("name").toString());
orgUsers.add(map);
});
}
//// 机场单位 模块 消防急救保障部中,“人员职务”不为空的人员
if(e.containsKey("name")) {
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
orgUsers.addAll(mapList);
String alertTypeCode = calledRo.getAlertTypeCode();
alertWay = calledRo.getAlertWay();
String unitInvolved = calledRo.getUnitInvolved();
// 警情续报 警情结案,非警情确认选择人员电话号码
String ids = calledRo.getIds();
if(!ValidationUtil.isEmpty(ids)) {
List<String> ls = Arrays.asList(ids.split(","));
for (String s: ls
) {
mobiles.add(s);
}
// 安运部
if(e.get("type").toString().equals("AY")) {
if(e.containsKey("name")) {
String [] arr = e.get("airportPost").toString().split(",");
}
// 获取报送规则
sendIds.stream().forEach(e->{
// 一般火灾 // 航空器救援
if(alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
// 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。
if(e.containsKey("onDuty")) {
String [] arr = e.get("onDuty").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(e.get("name").toString(),list);
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyId(list);
orgUsers.addAll(mapList);
}
}
// 事发单位
if(e.get("type").toString().equals("SF")) {
if(e.containsKey("airportPost")) {
String [] arr = e.get("airportPost").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved,list);
//根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
if(e.containsKey("fireBrigade")) {
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());
map.put("sequenceNbr",f.getSequenceNbr());
map.put("bizOrgName",f.getName());
map.put("amosUserId",f.getAmosUserId());
map.put("companyName", e.get("name").toString());
orgUsers.add(map);
});
}
//// 机场单位 模块 消防急救保障部中,“人员职务”不为空的人员
if(e.containsKey("name")) {
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
orgUsers.addAll(mapList);
}
}
}
// 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他
if(alertTypeCode.equals(AlertStageEnums.TFSJ.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
|| alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) {
if(e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString());
orgUsers.addAll(mapList);
// 安运部
if(e.get("type").toString().equals("AY")) {
if(e.containsKey("name")) {
String [] arr = e.get("airportPost").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(e.get("name").toString(),list);
orgUsers.addAll(mapList);
}
}
// 事发单位
if(e.get("type").toString().equals("SF")) {
if(e.containsKey("airportPost")) {
String [] arr = e.get("airportPost").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved,list);
orgUsers.addAll(mapList);
}
}
}
}
// 120急救
if(alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if (e.containsKey("name")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString());
orgUsers.addAll(mapList);
List<Map<String, Object>> mapList1 = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
orgUsers.addAll(mapList1);
// 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他
if(alertTypeCode.equals(AlertStageEnums.TFSJ.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
|| alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) {
if(e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("onDuty").toString());
orgUsers.addAll(mapList);
}
}
}
});
Map<String,Map<String,Object>> mapcq =new HashMap<>();
//对人员去重
if(orgUsers!=null&&orgUsers.size()>0){
orgUsers.forEach(org -> {
if(org.get("amosUserId")!=null){
mapcq.put(org.get("amosUserId").toString(),org);
// 120急救
if(alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if (e.containsKey("name")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString());
orgUsers.addAll(mapList);
List<Map<String, Object>> mapList1 = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
orgUsers.addAll(mapList1);
}
}
});
}
orgUsers.clear();
orgUsers.addAll(mapcq.values());
// 警情初报 续报 结案
// 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted();
alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr()));
// 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 警情初报 --- 续报 结案
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode());
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = Optional.of(AlertSchedulingTypeEnum.融合调度);
alertSubmitted.setSchedulingTypeCode(alertSchedulingTypeEnum.get().getCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo)));
alertSubmitted.setSender(alertCalled.getRecUserName());
alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date());
this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
} else if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情续报.getName());
sCode = "SMS_JCS_XB";
} else if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情结案.getName());
sCode = "SMS_JCS_JA";
} else {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.非警情确认.getName());
sCode = "SMS_JCS_QR";
}
Map<String,Map<String,Object>> mapcq =new HashMap<>();
//对人员去重
if(orgUsers!=null&&orgUsers.size()>0){
orgUsers.forEach(org -> {
if(org.get("amosUserId")!=null){
mapcq.put(org.get("amosUserId").toString(),org);
}
});
}
orgUsers.clear();
orgUsers.addAll(mapcq.values());
// 警情初报 续报 结案
// 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted();
alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr()));
// 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 警情初报 --- 续报 结案
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode());
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = Optional.of(AlertSchedulingTypeEnum.融合调度);
alertSubmitted.setSchedulingTypeCode(alertSchedulingTypeEnum.get().getCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo)));
alertSubmitted.setSender(alertCalled.getRecUserName());
alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date());
this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
} else if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情续报.getName());
sCode = "SMS_JCS_XB";
} else if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情结案.getName());
sCode = "SMS_JCS_JA";
} else {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.非警情确认.getName());
sCode = "SMS_JCS_QR";
}
AlertSubmitted alertSubmittedNew = null;
AlertSubmitted alertSubmittedNew = null;
// Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum =
// EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
// e -> e.getCode().equals(calledRo.getAlertTypeCode()));
// smsCode = alertBusinessTypeEnum.get().getSms_code();
if(!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
LambdaQueryWrapper<AlertSubmitted> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertSubmitted::getAlertCalledId,alertCalledId);
queryWrapper.orderByDesc(AlertSubmitted::getSequenceNbr);
List<AlertSubmitted> alertSubmitteds = alertSubmittedMapper.selectList(queryWrapper);
alertSubmittedNew = alertSubmitteds.get(0);
if(!ValidationUtil.isEmpty(calledRo.getUsIds())) {
usIds.addAll(Arrays.asList(calledRo.getUsIds().split(",")));
}
}
// 组装人员信息
for (Map<String, Object> orgUser : orgUsers) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
if(!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmittedObject.setAlertSubmittedId(alertSubmittedNew.getSequenceNbr());
} else {
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
LambdaQueryWrapper<AlertSubmitted> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertSubmitted::getAlertCalledId,alertCalledId);
queryWrapper.orderByDesc(AlertSubmitted::getSequenceNbr);
List<AlertSubmitted> alertSubmitteds = alertSubmittedMapper.selectList(queryWrapper);
alertSubmittedNew = alertSubmitteds.get(0);
if(!ValidationUtil.isEmpty(calledRo.getUsIds())) {
usIds.addAll(Arrays.asList(calledRo.getUsIds().split(",")));
}
}
if (!ValidationUtil.isEmpty(orgUser.get("amosUserId"))) {
usIds.add(orgUser.get("amosUserId").toString());
}
// 组装人员信息
for (Map<String, Object> orgUser : orgUsers) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
if(!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmittedObject.setAlertSubmittedId(alertSubmittedNew.getSequenceNbr());
} else {
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
}
alertSubmittedObject.setType(false);
if (!ValidationUtil.isEmpty(orgUser.get("amosUserId"))) {
usIds.add(orgUser.get("amosUserId").toString());
}
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
alertSubmittedObject.setTheUser((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setCompanyName((String) orgUser.get("companyName"));
alertSubmittedObject.setType(false);
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add(orgUser.get("telephone").toString());
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
alertSubmittedObject.setTheUser((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setCompanyName((String) orgUser.get("companyName"));
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add(orgUser.get("telephone").toString());
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
}
alertSubmittedObjectList.add(alertSubmittedObject);
}
alertSubmittedObjectList.add(alertSubmittedObject);
}
// 组装报送内容
smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address", calledRo.getAddress());
smsParams.put("fireLocation", calledRo.getFireLocation());
log.info("alertCalled888888"+alertCalled);
smsParams.put("endTimeStr", alertCalled.getUpdateTime()!=null ? DateUtils.convertDateToString(alertCalled.getUpdateTime(),DateUtils.DATE_TIME_PATTERN) : "");
smsParams.put("burningMaterial", calledRo.getBurningMaterial());
smsParams.put("fireSituation", calledRo.getFireSituation());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives());
smsParams.put("companyName", calledRo.getCompanyName());
smsParams.put("contactUser", alertCalled.getContactUser());
smsParams.put("contactPhone", alertCalled.getContactPhone());
smsParams.put("replaceContent", calledRo.getReplaceContent());
smsParams.put("alertType", calledRo.getAlertType());
smsParams.put("feedback", calledRo.getFeedback());
}
// 短信报送对象
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
// 组装报送内容
smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address", calledRo.getAddress());
smsParams.put("fireLocation", calledRo.getFireLocation());
log.info("alertCalled888888"+alertCalled);
smsParams.put("endTimeStr", alertCalled.getUpdateTime()!=null ? DateUtils.convertDateToString(alertCalled.getUpdateTime(),DateUtils.DATE_TIME_PATTERN) : "");
smsParams.put("burningMaterial", calledRo.getBurningMaterial());
smsParams.put("fireSituation", calledRo.getFireSituation());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives());
smsParams.put("companyName", calledRo.getCompanyName());
smsParams.put("contactUser", alertCalled.getContactUser());
smsParams.put("contactPhone", alertCalled.getContactPhone());
smsParams.put("replaceContent", calledRo.getReplaceContent());
smsParams.put("alertType", calledRo.getAlertType());
smsParams.put("feedback", calledRo.getFeedback());
}
// 短信报送对象
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
Map<String,String> besidesMap = new HashMap<>();
besidesMap.put("alterId",String.valueOf(alertCalled.getSequenceNbr()));
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, null);
} else {
if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
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, null);
}
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds, null);
} else {
if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds, null);
}
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, null);
}
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, null);
}
if(alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(),besidesMap,smsParams,usIds, null);
}
if(alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(),besidesMap,smsParams,usIds, null);
}
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException();
......@@ -680,142 +667,142 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Transactional(rollbackFor = Exception.class)
public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
try { Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String alertWay = "";
Date endDate = null;
Map<String,String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>();
List<Long> userIds = new ArrayList<>();
if (alertSubmittedId == null) {
// 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted();
String bussTypeCode;
alertSubmitted.setAlertCalledId(alertSubmittedDto.getAlertCalledId());
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
bussTypeCode = alertSubmittedDto.getBusinessTypeCode();
Optional<AlertBusinessTypeEnum> businessTypeEnum = EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(bussTypeCode));
alertSubmitted.setBusinessType(businessTypeEnum.get().getName());
alertSubmitted.setCallLogId(alertSubmittedDto.getCallLogId());
alertSubmitted.setRecDate(alertSubmittedDto.getRecDate());
alertSubmitted.setSubmissionMethodCode(alertSubmittedDto.getSubmissionMethodCode());
Optional<SubmissionMethodEnum> submissionMethodEnum = EnumsUtils.getEnumObject(SubmissionMethodEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getSubmissionMethodCode()));
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum =
EnumsUtils.getEnumObject(AlertSchedulingTypeEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getSchedulingTypeCode()));
alertSubmitted.setSchedulingTypeCode(alertSubmittedDto.getSchedulingTypeCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
alertSubmittedDto.getSubmitContent().get("recDate").toString();
endDate = DateUtils.dateParse(alertSubmittedDto.getSubmitContent().get("recDate").toString(),DateUtils.HOUR_PATTERN);
alertSubmitted.setSubmissionContent(alertSubmittedDto.getSubmitContent().toJSONString());
alertSubmitted.setSender(userName);
alertSubmitted.setRecUserName(userName);
alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date());
this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr();
}
String alertWay = "";
Date endDate = null;
Map<String,String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>();
List<Long> userIds = new ArrayList<>();
if (alertSubmittedId == null) {
// 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted();
String bussTypeCode;
alertSubmitted.setAlertCalledId(alertSubmittedDto.getAlertCalledId());
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
bussTypeCode = alertSubmittedDto.getBusinessTypeCode();
Optional<AlertBusinessTypeEnum> businessTypeEnum = EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(bussTypeCode));
alertSubmitted.setBusinessType(businessTypeEnum.get().getName());
alertSubmitted.setCallLogId(alertSubmittedDto.getCallLogId());
alertSubmitted.setRecDate(alertSubmittedDto.getRecDate());
alertSubmitted.setSubmissionMethodCode(alertSubmittedDto.getSubmissionMethodCode());
Optional<SubmissionMethodEnum> submissionMethodEnum = EnumsUtils.getEnumObject(SubmissionMethodEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getSubmissionMethodCode()));
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum =
EnumsUtils.getEnumObject(AlertSchedulingTypeEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getSchedulingTypeCode()));
alertSubmitted.setSchedulingTypeCode(alertSubmittedDto.getSchedulingTypeCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
// 2.保存任务表
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Long finalAlertSubmittedId = alertSubmittedId;
// 报送给单位
if (AlertSubmitTypeEnum.Org.getKey().equals(alertSubmittedDto.getType())) {
alertSubmittedDto.getSubmitCompanyList().forEach(company -> {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(finalAlertSubmittedId);
alertSubmittedObject.setType(true);
alertSubmittedObject.setCompanyId(company.getCompanyId());
alertSubmittedObject.setCompanyName(company.getCompanyName());
alertSubmittedObject.setRecUserName(userName);
alertSubmittedObjectList.add(alertSubmittedObject);
});
} else {
// 报送给个人
alertSubmittedDto.getSubmitCompanyList().forEach(company -> {
company.getPersonList().forEach(person -> {
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
alertSubmittedDto.getSubmitContent().get("recDate").toString();
endDate = DateUtils.dateParse(alertSubmittedDto.getSubmitContent().get("recDate").toString(),DateUtils.HOUR_PATTERN);
alertSubmitted.setSubmissionContent(alertSubmittedDto.getSubmitContent().toJSONString());
alertSubmitted.setSender(userName);
alertSubmitted.setRecUserName(userName);
alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date());
this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr();
}
// 2.保存任务表
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Long finalAlertSubmittedId = alertSubmittedId;
// 报送给单位
if (AlertSubmitTypeEnum.Org.getKey().equals(alertSubmittedDto.getType())) {
alertSubmittedDto.getSubmitCompanyList().forEach(company -> {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(finalAlertSubmittedId);
alertSubmittedObject.setType(false);
alertSubmittedObject.setType(true);
alertSubmittedObject.setCompanyId(company.getCompanyId());
alertSubmittedObject.setCompanyName(company.getCompanyName());
alertSubmittedObject.setUserId(person.getPersonId());
userIds.add(person.getPersonId());
alertSubmittedObject.setTheUser(person.getPersonName());
alertSubmittedObject.setUserPhone(person.getPersonPhone());
alertSubmittedObject.setRecUserName(userName);
if (!ValidationUtil.isEmpty(person.getPersonPhone())) {
mobiles.add(person.getPersonPhone());
}
alertSubmittedObjectList.add(alertSubmittedObject);
});
});
}
} else {
// 报送给个人
alertSubmittedDto.getSubmitCompanyList().forEach(company -> {
company.getPersonList().forEach(person -> {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(finalAlertSubmittedId);
alertSubmittedObject.setType(false);
alertSubmittedObject.setCompanyId(company.getCompanyId());
alertSubmittedObject.setCompanyName(company.getCompanyName());
alertSubmittedObject.setUserId(person.getPersonId());
userIds.add(person.getPersonId());
alertSubmittedObject.setTheUser(person.getPersonName());
alertSubmittedObject.setUserPhone(person.getPersonPhone());
alertSubmittedObject.setRecUserName(userName);
if (!ValidationUtil.isEmpty(person.getPersonPhone())) {
mobiles.add(person.getPersonPhone());
}
alertSubmittedObjectList.add(alertSubmittedObject);
});
});
}
// 查询AmousUserId
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(true, OrgUsr::getSequenceNbr, userIds);
List<String> usIds = new ArrayList<>();
List<OrgUsr> list = orgUsrService.getBaseMapper().selectList(queryWrapper);
if(null != list && list.size() > 0) {
list.stream().forEach(e->{
if(!ValidationUtil.isEmpty(e.getAmosOrgId())) {
usIds.add(e.getAmosOrgId());
}
});
// 查询AmousUserId
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(true, OrgUsr::getSequenceNbr, userIds);
List<String> usIds = new ArrayList<>();
List<OrgUsr> list = orgUsrService.getBaseMapper().selectList(queryWrapper);
if(null != list && list.size() > 0) {
list.stream().forEach(e->{
if(!ValidationUtil.isEmpty(e.getAmosOrgId())) {
usIds.add(e.getAmosOrgId());
}
});
map.put("usIds", StringUtils.join(usIds.toArray(new String[userIds.size()]),","));
} else {
map.put("usIds", "");
}
map.put("usIds", StringUtils.join(usIds.toArray(new String[userIds.size()]),","));
} else {
map.put("usIds", "");
}
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
for(AlertSubmittedObject object :alertSubmittedObjectList ) {
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
for(AlertSubmittedObject object :alertSubmittedObjectList ) {
alertSubmittedObjectServiceImpl.save(object);
}
// 3.更新警情状态
alertCalledService.updateAlertCalled(alertSubmittedDto.getAlertCalledId(),
alertSubmittedDto.getBusinessTypeCode(),
alertSubmittedDto.getSubmitContent().get("trappedNum")!=null?alertSubmittedDto.getSubmitContent().get("trappedNum").toString():null,
alertSubmittedDto.getSubmitContent().get("casualtiesNum")!=null?alertSubmittedDto.getSubmitContent().get("casualtiesNum").toString():null,
alertSubmittedDto.getSubmitContent().get("recDate")!=null?alertSubmittedDto.getSubmitContent().get("recDate").toString():null
);
// 警情续报
if(AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情续报.getCode();
}
// 3.更新警情状态
alertCalledService.updateAlertCalled(alertSubmittedDto.getAlertCalledId(),
alertSubmittedDto.getBusinessTypeCode(),
alertSubmittedDto.getSubmitContent().get("trappedNum")!=null?alertSubmittedDto.getSubmitContent().get("trappedNum").toString():null,
alertSubmittedDto.getSubmitContent().get("casualtiesNum")!=null?alertSubmittedDto.getSubmitContent().get("casualtiesNum").toString():null,
alertSubmittedDto.getSubmitContent().get("recDate")!=null?alertSubmittedDto.getSubmitContent().get("recDate").toString():null
);
// 警情续报
if(AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情续报.getCode();
}
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情结案.getCode();
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情结案.getCode();
// 警情结案生成模板
try {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
generateMob(alertCalled);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
// 警情结案生成模板
try {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
generateMob(alertCalled);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}
}
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.非警情确认.getCode();
}
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.非警情确认.getCode();
}
......@@ -824,33 +811,33 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())
|| AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
// 查询本次警情调派的车辆
List<String> transferCarIdList =
powerTransferService.queryTransferCarIdsByAlertCalledId(alertSubmittedDto.getAlertCalledId());
List<Object> carStatusInfoDtoList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(transferCarIdList)) {
transferCarIdList.forEach(carId -> {
CarStatusInfoDto carStatusInfo = new CarStatusInfoDto();
carStatusInfo.setSequenceNbr(carId);
carStatusInfo.setStatus(FireCarStatusEnum.执勤.getCode());
carStatusInfoDtoList.add(carStatusInfo);
});
}
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())
|| AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
// 查询本次警情调派的车辆
List<String> transferCarIdList =
powerTransferService.queryTransferCarIdsByAlertCalledId(alertSubmittedDto.getAlertCalledId());
List<Object> carStatusInfoDtoList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(transferCarIdList)) {
transferCarIdList.forEach(carId -> {
CarStatusInfoDto carStatusInfo = new CarStatusInfoDto();
carStatusInfo.setSequenceNbr(carId);
carStatusInfo.setStatus(FireCarStatusEnum.执勤.getCode());
carStatusInfoDtoList.add(carStatusInfo);
});
}
//修改调派车辆任务
//修改调派车辆任务
powerTransferCompanyResourcesService.updateByAlertCalledId(alertSubmittedDto.getAlertCalledId());
// 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList);
powerTransferCompanyResourcesService.updateByAlertCalledId(alertSubmittedDto.getAlertCalledId());
// 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList);
// //跟车辆状态
// powerTransferCompanyResourcesService.update(new UpdateWrapper<PowerTransferCompanyResources>().eq("resources_id", transferCarIdList).set("status", FireCarStatusEnum.返队.getCode()));
}
}
//警情結案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
//警情結案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
//tuisongxinjingqing
RequestData par=new RequestData();
......@@ -858,41 +845,41 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
List<AlertCalledZhDto> list4 = alertCalledService.alertCalledListByAlertStatus(null, null, par);
String json="";
if(list!=null&&list.size()>0){
AlertCalledZhDto ll=list4.get(0);
Map<String, String> map1 = org.apache.commons.beanutils.BeanUtils.describe((Object)list4.get(0));
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
map1.put("callTime",ll.getCallTime()!=null?sdf.format(ll.getCallTime()):"");
map.put("sequenceNbr",ll.getSequenceNbr()+"");
map1.put("updateTime",ll.getUpdateTime()!=null?sdf.format(ll.getUpdateTime()):"");
json=list!=null&&list.size()>0?JSONObject.toJSONString(map1, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue):"";
}
String json="";
if(list!=null&&list.size()>0){
AlertCalledZhDto ll=list4.get(0);
Map<String, String> map1 = org.apache.commons.beanutils.BeanUtils.describe((Object)list4.get(0));
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
map1.put("callTime",ll.getCallTime()!=null?sdf.format(ll.getCallTime()):"");
map.put("sequenceNbr",ll.getSequenceNbr()+"");
map1.put("updateTime",ll.getUpdateTime()!=null?sdf.format(ll.getUpdateTime()):"");
json=list!=null&&list.size()>0?JSONObject.toJSONString(map1, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue):"";
}
// String json=list4!=null&&list4.size()>0?JSONObject.toJSONString(list4.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
emqKeeper.getMqttClient().publish(topicJa, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
}
// 4.发送任务消息
// 4.1组织短信内容 废弃
// 4.发送任务消息
// 4.1组织短信内容 废弃
JSONObject submitContent = alertSubmittedDto.getSubmitContent();
JSONObject submitContent = alertSubmittedDto.getSubmitContent();
String feedBack = submitContent.get("editContent") != null ? submitContent.get("editContent").toString(): "";
String feedBack = submitContent.get("editContent") != null ? submitContent.get("editContent").toString(): "";
// 4.2调用短信发送接口 废弃
// alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);\
// 4.2调用短信发送接口 废弃
// alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);\
map.put("feedBack",feedBack);
map.put("alertWay",alertWay);
map.put("mobiles", StringUtils.join(mobiles,","));
return map;
map.put("feedBack",feedBack);
map.put("alertWay",alertWay);
map.put("mobiles", StringUtils.join(mobiles,","));
return map;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
......@@ -961,19 +948,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 查询车辆资源
ArrayList<Long> longs = new ArrayList<>();
if (!ObjectUtils.isEmpty(first.get(i).get("id"))){
longs.add(Long.valueOf(first.get(i).get("id").toString()));
ResponseModel<Map<String, Object>> carPropertyByCarIds = equipFeignClient.getCarPropertyByCarIds(longs);
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("waterNum"))){
dto.setWater(String.valueOf(carPropertyByCarIds.getResult().get("waterNum")));
totalWater = totalWater.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("waterNum"))));
}else {
dto.setWater("0");
longs.add(Long.valueOf(first.get(i).get("id").toString()));
ResponseModel<Map<String, Object>> carPropertyByCarIds = equipFeignClient.getCarPropertyByCarIds(longs);
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("waterNum"))){
dto.setWater(String.valueOf(carPropertyByCarIds.getResult().get("waterNum")));
totalWater = totalWater.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("waterNum"))));
}else {
dto.setWater("0");
}
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("foamNum"))){
dto.setFoam(String.valueOf(carPropertyByCarIds.getResult().get("foamNum")));
totalFoam = totalFoam.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("foamNum"))));
}else {
dto.setFoam("0");
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("foamNum"))){
dto.setFoam(String.valueOf(carPropertyByCarIds.getResult().get("foamNum")));
totalFoam = totalFoam.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("foamNum"))));
}else {
dto.setFoam("0");
}
}
list.add(dto);
......@@ -1007,19 +994,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 查询车辆资源
ArrayList<Long> longs = new ArrayList<>();
if (!ObjectUtils.isEmpty(other.get(i).get("id"))){
longs.add(Long.valueOf(other.get(i).get("id").toString()));
ResponseModel<Map<String, Object>> carPropertyByCarIds = equipFeignClient.getCarPropertyByCarIds(longs);
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("waterNum"))){
dto.setWater(String.valueOf(carPropertyByCarIds.getResult().get("waterNum")));
totalWater = totalWater.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("waterNum"))));
}else {
dto.setWater("0");
}
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("foamNum"))){
dto.setFoam(String.valueOf(carPropertyByCarIds.getResult().get("foamNum")));
totalFoam = totalFoam.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("foamNum"))));
}else {
dto.setFoam("0");
longs.add(Long.valueOf(other.get(i).get("id").toString()));
ResponseModel<Map<String, Object>> carPropertyByCarIds = equipFeignClient.getCarPropertyByCarIds(longs);
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("waterNum"))){
dto.setWater(String.valueOf(carPropertyByCarIds.getResult().get("waterNum")));
totalWater = totalWater.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("waterNum"))));
}else {
dto.setWater("0");
}
if (!ObjectUtils.isEmpty(carPropertyByCarIds.getResult().get("foamNum"))){
dto.setFoam(String.valueOf(carPropertyByCarIds.getResult().get("foamNum")));
totalFoam = totalFoam.add(new BigDecimal(String.valueOf(carPropertyByCarIds.getResult().get("foamNum"))));
}else {
dto.setFoam("0");
}
}
list.add(dto);
......@@ -1076,7 +1063,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// String checkReportTemplatePath = this.getClass().getClassLoader().getResource("templates/check-report-template" +
// ".docx").getFile();
// String filePath = this.getClass().getClassLoader().getResource("templates").getPath();
// String filePath = this.getClass().getClassLoader().getResource("templates").getPath();
String filePath = "";
String fileName = "";
if(os.toLowerCase().startsWith("win")) {
......@@ -1286,7 +1273,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 表格渲染和列表数据下标相反,需要翻转一下列表
List<RowRenderData> reverseList = Lists.reverse(dangerList);
table.removeRow(dangerListDataStartRow);
table.removeRow(dangerListDataStartRow);
// 循环插入行
int listLength = dangerList.size();
for (int i = 0; i < fSizs; i++) {
......@@ -1672,13 +1659,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(one.getBizOrgName(),positionType);
List<FirefightersDto> fireBrigade = firefightersService.queryById(groupCode, one.getBizOrgName().toString());
fireBrigade.stream().forEach(f-> {
HashMap<String, Object> map = new HashMap<>();
map.put("mobilePhone", f.getMobilePhone());
map.put("userId", f.getSequenceNbr());
map.put("userName", f.getName());
map.put("amosId", f.getAmosUserId());
sendUserIds.add(map);
});
HashMap<String, Object> map = new HashMap<>();
map.put("mobilePhone", f.getMobilePhone());
map.put("userId", f.getSequenceNbr());
map.put("userName", f.getName());
map.put("amosId", f.getAmosUserId());
sendUserIds.add(map);
});
// sendUserIds.addAll(mapList);
}
//所在大队值班当日值班员;
......@@ -1811,7 +1798,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObjectSub.setUserPhone(map.get("mobilePhone").toString());
}
alertSubmittedObjectListSub.add(alertSubmittedObjectSub);
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectListSub);
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectListSub);
// 调用短信发送接口
alertCalledAction.sendAlertCalleCmd(smsCode, mobile, smsParams);
Map<String, String> besidesMap = new HashMap<String, String>();
......@@ -1877,22 +1864,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
public Set<Map<String, Object>> getwone(Set<Map<String, Object>> sendUserIds){
public Set<Map<String, Object>> getwone(Set<Map<String, Object>> sendUserIds){
Map<String,Map<String, Object>> map =new HashMap<>();
if(sendUserIds!=null&&sendUserIds.size()>0){
for (Map<String, Object> sendUserId : sendUserIds) {
if(sendUserId!=null&&sendUserId.get("amosId")!=null){
map.put(sendUserId.get("amosId").toString(),sendUserId);
}
}
}
Set<Map<String, Object>> set = new HashSet<>(map.values());
return set;
if(sendUserIds!=null&&sendUserIds.size()>0){
for (Map<String, Object> sendUserId : sendUserIds) {
if(sendUserId!=null&&sendUserId.get("amosId")!=null){
map.put(sendUserId.get("amosId").toString(),sendUserId);
}
}
}
Set<Map<String, Object>> set = new HashSet<>(map.values());
return set;
}
}
......@@ -2017,7 +2004,7 @@ public Set<Map<String, Object>> getwone(Set<Map<String, Object>> sendUserIds){
}
smsParams.put("resourcesNum", companyName);
// 短信报送对象
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
......@@ -2159,7 +2146,7 @@ public Set<Map<String, Object>> getwone(Set<Map<String, Object>> sendUserIds){
}
smsParams.put("resourcesNum", companyName);
// 短信报送对象
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
......@@ -2262,5 +2249,4 @@ public Set<Map<String, Object>> getwone(Set<Map<String, Object>> sendUserIds){
e.printStackTrace();
}
}
}
}
\ No newline at end of file
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