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

作战指挥处置记录预览

parent e033264c
package com.yeejoin.amos.boot.module.jcs.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author litw
* @date 2021-11-26.
*/
@Data
public class AlertCallCommandDto {
@ApiModelProperty(value = "名称")
String name;
@ApiModelProperty(value = "职务")
String duty;
}
...@@ -113,4 +113,7 @@ public class AlertCalledDto extends BaseDto{ ...@@ -113,4 +113,7 @@ public class AlertCalledDto extends BaseDto{
private String systemSource; private String systemSource;
@ApiModelProperty(value = "系统来源code") @ApiModelProperty(value = "系统来源code")
private String systemSourceCode; private String systemSourceCode;
@ApiModelProperty(value = "处置记录url")
private String recordUrl;
} }
package com.yeejoin.amos.boot.module.jcs.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ltw
* @date 2021-11-25.
*/
@Data
public class AlertCalledMobDto {
@ApiModelProperty(value = "力量调派")
List<AlertCalledPowerInfoDto> alertCalledPowerInfoDtoList;
@ApiModelProperty(value = "指挥力量")
List<AlertCallCommandDto> alertCallCommandDtoList;
@ApiModelProperty(value = "年度")
String year;
@ApiModelProperty(value = "灾害单位")
String unit;
@ApiModelProperty(value = "详细地址")
String address;
@ApiModelProperty(value = "警情类型")
String alertType;
@ApiModelProperty(value = "来源类型")
String sourceType;
@ApiModelProperty(value = "报警人姓名")
String reportName;
@ApiModelProperty(value = "联系电话")
String conectPhone;
@ApiModelProperty(value = "接警时间")
String callTime;
@ApiModelProperty(value = "出动时间")
String toTime;
@ApiModelProperty(value = "到场时间")
String arriveTime;
@ApiModelProperty(value = "控制时间")
String controlTime;
@ApiModelProperty(value = "结束时间")
String endTime;
}
package com.yeejoin.amos.boot.module.jcs.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author litw
* @date 2021-11-25.
*/
@Data
public class AlertCalledPowerInfoDto {
@ApiModelProperty(value = "队站")
String station;
@ApiModelProperty(value = "到场时间")
String arriveTime;
@ApiModelProperty(value = "车辆名称")
String carName;
@ApiModelProperty(value = "参战人数")
String personNum;
@ApiModelProperty(value = "水")
String water;
@ApiModelProperty(value = "泡沫")
String foam;
@ApiModelProperty(value = "干粉")
String dryPowder;
@ApiModelProperty(value = "其他")
String other;
@ApiModelProperty(value = "第一次出动调派车辆数量")
String disatchNum;
}
...@@ -104,7 +104,8 @@ public class AlertCalled extends BaseEntity { ...@@ -104,7 +104,8 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "备注信息") @ApiModelProperty(value = "备注信息")
private String remark; private String remark;
@ApiModelProperty(value = "处置记录url")
private String recordUrl;
......
...@@ -2,10 +2,10 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper; ...@@ -2,10 +2,10 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedExtDto; 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.AlertSubmittedSMSDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -57,4 +57,9 @@ public interface AlertSubmittedMapper extends BaseMapper<AlertSubmitted> { ...@@ -57,4 +57,9 @@ public interface AlertSubmittedMapper extends BaseMapper<AlertSubmitted> {
Map<String, Integer> getUseNum(@Param("id") Long id); Map<String, Integer> getUseNum(@Param("id") Long id);
List<Map<String, Object>> getFirst(@Param("alertId") Long alertId);
List<Map<String, Object>> getOther(@Param("alertId") Long alertId);
} }
...@@ -131,6 +131,40 @@ ...@@ -131,6 +131,40 @@
a.alert_called_id = ${id} a.alert_called_id = ${id}
</select> </select>
<select id="getFirst" resultType="Map">
SELECT distinct
a.rec_date recDate ,
b.company_name companyName,
c.resources_name carName,
c.resources_num carNum,
c.resources_id id
FROM
jc_power_transfer a
LEFT JOIN jc_power_transfer_company b ON a.sequence_nbr = b.power_transfer_id
LEFT JOIN jc_power_transfer_company_resources c ON c.power_transfer_company_id = b.sequence_nbr
where a.sequence_nbr = (select sequence_nbr from jc_power_transfer where alert_called_id
= #{alertId}
order by rec_date asc limit 1)
</select>
<select id="getOther" resultType="Map">
SELECT distinct
a.rec_date recDate ,
b.company_name companyName,
c.resources_name carName,
c.resources_num carNum,
c.resources_id id
FROM
jc_power_transfer a
LEFT JOIN jc_power_transfer_company b ON a.sequence_nbr = b.power_transfer_id
LEFT JOIN jc_power_transfer_company_resources c ON c.power_transfer_company_id = b.sequence_nbr
where a.sequence_nbr = (select sequence_nbr from jc_power_transfer where alert_called_id
= #{alertId}
order by rec_date asc limit 1,100)
</select>
......
...@@ -49,6 +49,7 @@ import com.yeejoin.amos.boot.module.jcs.api.service.*; ...@@ -49,6 +49,7 @@ import com.yeejoin.amos.boot.module.jcs.api.service.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -689,6 +690,17 @@ public class CommandController extends BaseController { ...@@ -689,6 +690,17 @@ public class CommandController extends BaseController {
return ResponseHelper.buildResponse(iAlertCalledService.selectAlertCalledcount(id)); return ResponseHelper.buildResponse(iAlertCalledService.selectAlertCalledcount(id));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "下载附件", notes = "下载附件")
@PostMapping(value = "/downLoad")
public void downLoad(@RequestBody List<String> path, HttpServletResponse response){
try {
IOUtils.copy(new FileInputStream(readUrl + path.get(0)), response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
/** /**
* * @param null * * @param null
* *
......
...@@ -20,6 +20,31 @@ ...@@ -20,6 +20,31 @@
<artifactId>amos-boot-module-common-biz</artifactId> <artifactId>amos-boot-module-common-biz</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.deepoove</groupId>
<artifactId>poi-tl</artifactId>
<version>1.6.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>poi-ooxml</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.spire</groupId>-->
<!-- <artifactId>Spire.Doc</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
</dependencies> </dependencies>
</project> </project>
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
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.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
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;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
...@@ -39,6 +40,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -39,6 +40,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -258,6 +262,29 @@ public class AlertSubmittedController extends BaseController { ...@@ -258,6 +262,29 @@ public class AlertSubmittedController extends BaseController {
return ResponseHelper.buildResponse(schedulingContent); return ResponseHelper.buildResponse(schedulingContent);
} }
/**
* 获取警情续报内容
*
* @return 返回结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/alert_submitted/ddd", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取警情续报内容和模板", notes = "获取警情续报内容和模板")
public ResponseModel<Object> getAlertSubmittedContentDD() {
try {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledByIdNoRedis(1455815417061728258L);
alertSubmittedService.generateMob(alertCalledFormDto.getAlertCalled());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return ResponseHelper.buildResponse(null);
}
private String getTaskInformation(String content, Map<String, String> definitions) { private String getTaskInformation(String content, Map<String, String> definitions) {
int size = definitions.size(); int size = definitions.size();
String[] keys = definitions.keySet().toArray(new String[size]); String[] keys = definitions.keySet().toArray(new String[size]);
......
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.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto;
import org.apache.commons.lang3.ObjectUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
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 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;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ELMode;
import com.deepoove.poi.data.RowRenderData;
import com.deepoove.poi.data.style.Style;
import com.deepoove.poi.data.style.TableStyle;
import com.deepoove.poi.policy.DynamicTableRenderPolicy;
import com.deepoove.poi.policy.MiniTableRenderPolicy;
import com.deepoove.poi.util.TableTools;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant; import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
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.biz.common.utils.WordConverterUtils;
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.entity.OrgUsr;
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.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.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.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.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto; 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.AlertSubmittedExtDto;
...@@ -62,7 +48,9 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto; ...@@ -62,7 +48,9 @@ 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.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.PowerData;
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.PushMessageWebAndAppRo; 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.SchedulingReportingDto;
...@@ -80,18 +68,58 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum; ...@@ -80,18 +68,58 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum; import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper; 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.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.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.feign.model.FeignClientResult;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.component.rule.config.RuleConfig; import com.yeejoin.amos.component.rule.config.RuleConfig;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.joda.time.DateTime;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum;
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.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays; 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.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/** /**
...@@ -130,6 +158,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -130,6 +158,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired @Autowired
IDutyPersonService iDutyPersonService; IDutyPersonService iDutyPersonService;
@Autowired
PowerTransferMapper powerTransferMapper;
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
...@@ -159,11 +189,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -159,11 +189,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired @Autowired
DynamicFormInstanceMapper dynamicFormInstanceMapper; DynamicFormInstanceMapper dynamicFormInstanceMapper;
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
private final String msgType = "jcs119"; private final String msgType = "jcs119";
@Override @Override
...@@ -213,7 +243,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -213,7 +243,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> definitions = new HashMap<>(); Map<String, String> definitions = new HashMap<>();
definitions.put("$type",alertCalled.getAlertType()); definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime",DateUtils.dateTimeToDateString(alertCalled.getCallTime())); definitions.put("$callTime", DateUtils.dateTimeToDateString(alertCalled.getCallTime()));
definitions.put("$replaceContent",replaceContent); definitions.put("$replaceContent",replaceContent);
definitions.put("$address",alertCalled.getAddress()); definitions.put("$address",alertCalled.getAddress());
String content = getTaskInformation( template.getRichContent(),definitions); String content = getTaskInformation( template.getRichContent(),definitions);
...@@ -284,119 +314,119 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -284,119 +314,119 @@ 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()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
if(e.containsKey("onDuty")) { if(e.containsKey("onDuty")) {
// 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。 // 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。
String [] arr = e.get("onDuty").toString().split(","); String [] arr = e.get("onDuty").toString().split(",");
List<String> list = Arrays.asList(arr); 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());
orgUsers.add(map);
});
} 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());
orgUsers.add(map);
});
if(e.containsKey("name")) { }
// 消防救援保障部
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
orgUsers.addAll(mapList);
}
// 安运部 if(e.containsKey("name")) {
if(e.get("type").toString().equals("AY")) { // 消防救援保障部
if(e.containsKey("name")) { List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
String [] arr = e.get("airportPost").toString().split(","); orgUsers.addAll(mapList);
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("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);
if(e.get("type").toString().equals("SF")) { orgUsers.addAll(mapList);
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);
}
} }
} }
// 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他 // 事发单位
if(alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode()) if(e.get("type").toString().equals("SF")) {
|| alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) { if(e.containsKey("airportPost")) {
if(e.containsKey("onDuty")) { String [] arr = e.get("airportPost").toString().split(",");
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString()); List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved,list);
orgUsers.addAll(mapList); orgUsers.addAll(mapList);
} }
} }
}
// 120急救 // 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他
if(alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) { if(alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
if (e.containsKey("name")) { || alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString()); if(e.containsKey("onDuty")) {
orgUsers.addAll(mapList); 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()); // 120急救
orgUsers.addAll(mapList1); 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);
} }
}
}); });
// 警情初报 续报 结案 // 警情初报 续报 结案
// 1.保存警情记录主表 // 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted(); AlertSubmitted alertSubmitted = new AlertSubmitted();
alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr())); alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr()));
// 保存初报细分类型(一般火灾、航空器救援等) // 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode()); alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 警情初报 --- 续报 结案 // 警情初报 --- 续报 结案
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) { if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName()); alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS); Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode()); alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode());
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName()); alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = Optional.of(AlertSchedulingTypeEnum.融合调度); Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = Optional.of(AlertSchedulingTypeEnum.融合调度);
alertSubmitted.setSchedulingTypeCode(alertSchedulingTypeEnum.get().getCode()); alertSubmitted.setSchedulingTypeCode(alertSchedulingTypeEnum.get().getCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName()); alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo))); alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo)));
alertSubmitted.setUpdateTime(new Date()); alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date()); alertSubmitted.setSubmissionTime(new Date());
this.baseMapper.insert(alertSubmitted); this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr().toString(); alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
} 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 {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.非警情确认.getName()); alertSubmitted.setBusinessType(AlertBusinessTypeEnum.非警情确认.getName());
sCode = "SMS_JCS_QR"; sCode = "SMS_JCS_QR";
} }
AlertSubmitted alertSubmittedNew = null; AlertSubmitted alertSubmittedNew = null;
Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum = Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum =
...@@ -426,7 +456,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -426,7 +456,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId)); alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
} }
usIds.add(orgUser.get("amosUserId").toString()); if (!ValidationUtil.isEmpty(orgUser.get("amosUserId"))) {
usIds.add(orgUser.get("amosUserId").toString());
}
alertSubmittedObject.setType(false); alertSubmittedObject.setType(false);
...@@ -462,22 +494,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -462,22 +494,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 组织短信内容 // 组织短信内容
// 调用短信发送接口 // 调用短信发送接口
Map<String,String> besidesMap = new HashMap<>(); Map<String,String> besidesMap = new HashMap<>();
besidesMap.put("alterId",String.valueOf(alertCalled.getSequenceNbr())); besidesMap.put("alterId",String.valueOf(alertCalled.getSequenceNbr()));
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) { if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
besidesMap.put("sendTime",DateUtils.dateFormat(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN)); besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds); pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds);
} else { } else {
if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) { if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
besidesMap.put("sendTime",DateUtils.dateFormat(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN)); besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds); pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds);
} }
if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) { if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
besidesMap.put("startTime",DateUtils.dateFormat(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN)); besidesMap.put("startTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
besidesMap.put("endTime",DateUtils.dateFormat(alertCalled.getRecDate(),DateUtils.DATE_TIME_PATTERN)); besidesMap.put("endTime", DateUtils.dateFormat(alertCalled.getRecDate(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情结案.getCode(),besidesMap,smsParams,usIds); pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情结案.getCode(),besidesMap,smsParams,usIds);
} }
...@@ -606,7 +638,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -606,7 +638,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
} }
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) { if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay =AlertBusinessTypeEnum.警情结案.getCode(); alertWay = AlertBusinessTypeEnum.警情结案.getCode();
// 警情结案生成模板
try {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
generateMob(alertCalled);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
} }
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) { if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
...@@ -655,6 +700,293 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -655,6 +700,293 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
return map; return map;
} }
public void generateMob(AlertCalled alertCalled) throws UnsupportedEncodingException, FileNotFoundException, ParseException {
AlertCalledMobDto report = new AlertCalledMobDto();
report.setYear(String.valueOf(DateUtils.getYear(new Date())));
report.setUnit(ValidationUtil.isEmpty(alertCalled.getUnitInvolved()) ? "" : alertCalled.getUnitInvolved());
report.setAddress(ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
report.setAlertType(ValidationUtil.isEmpty(alertCalled.getAlertType()) ? "" : alertCalled.getAlertType());
report.setSourceType(ValidationUtil.isEmpty(alertCalled.getAlertSource()) ? "" : alertCalled.getAlertSource());
report.setReportName(ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
report.setConectPhone(ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
report.setCallTime(ValidationUtil.isEmpty(alertCalled.getCallTime()) ? "" : DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
String urlString="";
report.setEndTime(DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
// 查询第一次调派
List<Map<String, Object>> first = alertSubmittedMapper.getFirst(alertCalled.getSequenceNbr());
// 查询后续调派
List<Map<String, Object>> other = alertSubmittedMapper.getFirst(alertCalled.getSequenceNbr());
LinkedList<AlertCalledPowerInfoDto> list = new LinkedList<>();
for(int i = 0; i <first.size(); i++) {
AlertCalledPowerInfoDto dto = new AlertCalledPowerInfoDto();
if(i == 0) {
dto.setDisatchNum(String.valueOf(first.size()));
}
dto.setCarName(first.get(i).get("carName").toString());
dto.setStation(first.get(i).get("companyName").toString());
// 随车人员
List<PowerData> powerDataOne = powerTransferMapper.getPowerDataOne(Long.valueOf(first.get(i).get("id").toString()));
if(!ValidationUtil.isEmpty(powerDataOne)) {
dto.setPersonNum(String.valueOf(powerDataOne.size()));
} else {
dto.setPersonNum("0");
}
LocalDateTime dateTime = (LocalDateTime)first.get(i).get("recDate");
Date date = Date.from(dateTime.toInstant(ZoneOffset.of("+8")));
report.setToTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
report.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
dto.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
list.add(dto);
}
for(int i = 0; i <other.size(); i++) {
AlertCalledPowerInfoDto dto = new AlertCalledPowerInfoDto();
dto.setCarName(other.get(i).get("carName").toString());
dto.setStation(other.get(i).get("companyName").toString());
// 随车人员
List<PowerData> powerDataOne = powerTransferMapper.getPowerDataOne(Long.valueOf(first.get(i).get("id").toString()));
if(!ValidationUtil.isEmpty(powerDataOne)) {
dto.setPersonNum(String.valueOf(powerDataOne.size()));
} else {
dto.setPersonNum("0");
}
LocalDateTime dateTime = (LocalDateTime)first.get(i).get("recDate");
Date date = Date.from(dateTime.toInstant(ZoneOffset.of("+8")));
dto.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
list.add(dto);
}
// 查询应急指挥辅屏值班人员
List<Map<String, Object>> mapList = iDutyPersonService.listOnDutyPerson();
List<AlertCallCommandDto> list1 = new ArrayList<>();
mapList.forEach(e->{
AlertCallCommandDto dto = new AlertCallCommandDto();
dto.setName(e.get("userName").toString());
dto.setDuty(e.get("postTypeName").toString());
list1.add(dto);
});
if (mapList.size() == 0) {
AlertCallCommandDto commandDto = new AlertCallCommandDto();
commandDto.setName("");
commandDto.setDuty("");
list1.add(commandDto);
}
report.setAlertCallCommandDtoList(list1);
report.setAlertCalledPowerInfoDtoList(list);
if (!ValidationUtil.isEmpty(report)) {
String checkReportTemplatePath = this.getClass().getClassLoader().getResource("templates/check-report-template" +
".docx").getFile();
String filePath = this.getClass().getClassLoader().getResource("templates").getPath();
String fileName = filePath + "/" + System.currentTimeMillis() + ".docx";
AlertCalledPowerInfoTablePolicy calledPowerInfoTablePolicy = new AlertCalledPowerInfoTablePolicy();
AlertCallCommandTablePolicy alertCallCommandTablePolicy = new AlertCallCommandTablePolicy();
Configure.ConfigureBuilder configureBuilder = Configure.newBuilder();
configureBuilder.setElMode(ELMode.SPEL_MODE).bind("alertCalledPowerInfoDtoList", calledPowerInfoTablePolicy)
.bind("alertCallCommandDtoList", alertCallCommandTablePolicy).build();
XWPFTemplate template = XWPFTemplate.compile(checkReportTemplatePath, configureBuilder.build()).render(report);
FileOutputStream out = new FileOutputStream(fileName);
BufferedOutputStream bos = null;
try {
bos = new BufferedOutputStream(out);
template.write(bos);
bos.flush();
out.flush();
// docx 转 doc
Document document = new Document();
document.loadFromFile(fileName);
String newFileName = System.currentTimeMillis()+".doc";
//保存结果文件
document.saveToFile(newFileName, FileFormat.Doc);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(WordConverterUtils.fileToMultipartFile(new File(newFileName)));
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString=it.next();
}
}
System.out.println(urlString);
// 更新警情信息
alertCalled.setRecordUrl(urlString);
alertCalledService.updateById(alertCalled);
} catch (IOException e) {
log.error("生成文档失败---------->");
e.printStackTrace();
} finally {
try {
bos.close();
out.close();
template.close();
// File file = new File(fileName);
// if(file.exists()) {
// String htmlPath = System.getProperty("user.dir") + File.separator + "lookHtml" + File.separator + "file" + File.separator;
// String name = urlString.substring(urlString.lastIndexOf('/') + 1);
// new File(fileName).renameTo(new File(htmlPath+name.substring(0, name.indexOf(".")) + ".html"));
// }
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
static int dangerListDataStartRow = 2; // 表头占两行
static int dangerListDataStartRowNew = 1; // 表头占一行
public static <T> Consumer<T> foreachWithIndex(BiConsumer<T, Integer> consumer) {
class Obj {
int i;
}
Obj obj = new Obj();
return t -> {
int index = obj.i++;
consumer.accept(t, index);
};
}
public static class AlertCalledPowerInfoTablePolicy extends DynamicTableRenderPolicy {
@Override
public void render(XWPFTable table, Object o) {
if (ValidationUtil.isEmpty(o)) {
table.removeRow(dangerListDataStartRow);
return;
}
List<AlertCalledPowerInfoDto> reportDto = (List<AlertCalledPowerInfoDto>) o;
List<RowRenderData> checkDangerList = Lists.newArrayList();
reportDto.forEach(foreachWithIndex((report, index) -> {
RowRenderData rowRenderData = RowRenderData.build(String.valueOf(reportDto.size() - index),
report.getStation(), report.getArriveTime(), report.getCarName(),report.getPersonNum(),report.getDisatchNum(),report.getDryPowder(),report.getFoam(),report.getOther());
checkDangerList.add(rowRenderData);
}));
generateTableData(table, checkDangerList);
}
}
public static class AlertCallCommandTablePolicy extends DynamicTableRenderPolicy {
@Override
public void render(XWPFTable table, Object o) {
if (ValidationUtil.isEmpty(o)) {
table.removeRow(dangerListDataStartRow);
return;
}
List<AlertCallCommandDto> reportDto = (List<AlertCallCommandDto>) o;
List<RowRenderData> checkDangerList = Lists.newArrayList();
reportDto.forEach(foreachWithIndex((report, index) -> {
RowRenderData rowRenderData = RowRenderData.build(String.valueOf(reportDto.size() - index),
report.getName(), report.getDuty());
checkDangerList.add(rowRenderData);
}));
generateTableDataNew(table, checkDangerList);
}
private void generateTableDataNew(XWPFTable table, List<RowRenderData> dangerList) {
if (!ValidationUtil.isEmpty(dangerList)) {
// 表格渲染和列表数据下标相反,需要翻转一下列表
List<RowRenderData> reverseList = Lists.reverse(dangerList);
table.removeRow(dangerListDataStartRowNew);
// 循环插入行
int listLength = dangerList.size();
for (int i = 0; i < listLength; i++) {
reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
Style style = new Style();
style.setFontFamily("仿宋");
style.setFontSize(12);
cellRenderData.getRenderData().setStyle(style);
});
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRowNew);
IntStream.range(2,6).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRowNew, reverseList.get(i));
}
TableTools.mergeCellsVertically(table, 0, 0, listLength);
}
}
}
public static void generateTableData(XWPFTable table, List<RowRenderData> dangerList) {
String firstSize ="";
if (!ValidationUtil.isEmpty(dangerList)) {
firstSize = dangerList.get(0).getCellDatas().get(5).getRenderData().getText();
int fSizs = Integer.parseInt(firstSize);
// 表格渲染和列表数据下标相反,需要翻转一下列表
List<RowRenderData> reverseList = Lists.reverse(dangerList);
table.removeRow(dangerListDataStartRow);
// 循环插入行
int listLength = dangerList.size();
for (int i = 0; i < fSizs; i++) {
if(i == 0) {
TableStyle tableStyle = new TableStyle();
tableStyle.setAlign(Enum.forInt(2));
reverseList.get(i).getCellDatas().get(0).setCellStyle(tableStyle);
reverseList.get(i).getCellDatas().get(0).getRenderData().setText("增\n援\n力\n量");
Style style = new Style();
style.setFontFamily("宋体");
style.setFontSize(12);
style.setBold(true);
reverseList.get(i).getCellDatas().get(0).getRenderData().setStyle(style);
} else {
reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
Style style = new Style();
style.setFontFamily("仿宋");
style.setFontSize(12);
cellRenderData.getRenderData().setStyle(style);
});
}
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRow);
IntStream.range(5,14).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRow, reverseList.get(i));
}
for (int i = fSizs; i < listLength ; i++) {
reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
Style style = new Style();
style.setFontFamily("仿宋");
style.setFontSize(12);
cellRenderData.getRenderData().setStyle(style);
});
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRow);
IntStream.range(5,14).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRow, reverseList.get(i));
}
TableTools.mergeCellsVertically(table, 0, 0, fSizs + 1);
if(listLength - fSizs > 1 ) {
TableTools.mergeCellsVertically(table, 0, fSizs + 2 , listLength + 1);
}
}
}
/** /**
* 短信报送对象 * 短信报送对象
* *
...@@ -698,10 +1030,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -698,10 +1030,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
dataDictionary.getCode()).eq("format", true)); dataDictionary.getCode()).eq("format", true));
Map<String, String> definitions = new HashMap<>(); Map<String, String> definitions = new HashMap<>();
definitions.put("$type",alertCalled.getAlertType()); definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime",DateUtils.dateTimeToDateString(alertCalled.getCallTime())); definitions.put("$callTime", DateUtils.dateTimeToDateString(alertCalled.getCallTime()));
definitions.put("$replaceContent",replaceContent); definitions.put("$replaceContent",replaceContent);
definitions.put("$address",alertCalled.getAddress()); definitions.put("$address",alertCalled.getAddress());
definitions.put("$recDate",DateUtils.convertDateToString(alertCalled.getRecDate(),DateUtils.DATE_TIME_PATTERN)); definitions.put("$recDate", DateUtils.convertDateToString(alertCalled.getRecDate(), DateUtils.DATE_TIME_PATTERN));
String content = getTaskInformation( template.getContent(),definitions); String content = getTaskInformation( template.getContent(),definitions);
template.setContent(content); template.setContent(content);
TemplateDto templateDto = new TemplateDto(); TemplateDto templateDto = new TemplateDto();
...@@ -870,11 +1202,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -870,11 +1202,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object; AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId(); String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr(); alertCalledId = calledRo.getSequenceNbr();
AlertCalled alertCalled = alertCalledService.getAlertCalledById(Long.parseLong(alertSubmittedId)); AlertCalled alertCalled = alertCalledService.getAlertCalledById(Long.parseLong(alertSubmittedId));
//响应级别 //响应级别
String responseLevelString =""; String responseLevelString ="";
if(alertCalled!=null && alertCalled.getResponseLevel()!=null) { if(alertCalled!=null && alertCalled.getResponseLevel()!=null) {
responseLevelString = alertCalled.getResponseLevel(); responseLevelString = alertCalled.getResponseLevel();
} }
//先获取消救部领导、消救部值班人员信息 //先获取消救部领导、消救部值班人员信息
sendIds.stream().forEach(e -> { sendIds.stream().forEach(e -> {
...@@ -896,7 +1228,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -896,7 +1228,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}); });
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class); List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
for (Object powerTransferCompanyDto : companyDetail) { for (Object powerTransferCompanyDto : companyDetail) {
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class); PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId(); Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName(); String companyName = powerDto.getCompanyName();
StringBuffer resourcesNum = new StringBuffer(); StringBuffer resourcesNum = new StringBuffer();
...@@ -1001,7 +1333,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1001,7 +1333,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}; };
userList=new ArrayList<String>(); userList=new ArrayList<String>();
if(!ValidationUtil.isEmpty(map.get("amosId"))) { if(!ValidationUtil.isEmpty(map.get("amosId"))) {
userList.add(map.get("amosId").toString()); userList.add(map.get("amosId").toString());
} }
alertSubmittedObjectSub.setUserPhone(map.get("mobilePhone").toString()); alertSubmittedObjectSub.setUserPhone(map.get("mobilePhone").toString());
} }
...@@ -1028,7 +1360,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1028,7 +1360,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
mobiles.add(i.get("mobilePhone").toString()); mobiles.add(i.get("mobilePhone").toString());
} }
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) { if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString()); userList.add(i.get("amosId").toString());
} }
}); });
smsParams.put("resourcesNum", resourcesNumStr.substring(resourcesNumStr.length() - 2)); smsParams.put("resourcesNum", resourcesNumStr.substring(resourcesNumStr.length() - 2));
...@@ -1045,7 +1377,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1045,7 +1377,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
besidesMap.put("responseLevelString", responseLevelString);//响应级别 besidesMap.put("responseLevelString", responseLevelString);//响应级别
besidesMap.put("alterId", alertCalledId); besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) { if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList); pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
} }
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false); emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
} }
...@@ -1084,7 +1416,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1084,7 +1416,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
} }
for (Object powerTransferCompanyDto : companyDetail) { for (Object powerTransferCompanyDto : companyDetail) {
Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>(); Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>();
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class); PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId(); Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName(); String companyName = powerDto.getCompanyName();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId); FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
...@@ -1140,7 +1472,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1140,7 +1472,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
mobiles.add(i.get("mobilePhone").toString()); mobiles.add(i.get("mobilePhone").toString());
} }
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) { if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString()); userList.add(i.get("amosId").toString());
} }
}); });
smsParams.put("resourcesNum", companyName); smsParams.put("resourcesNum", companyName);
...@@ -1157,7 +1489,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1157,7 +1489,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>(); Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId); besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) { if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList); pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
} }
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false); emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
} }
...@@ -1204,7 +1536,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1204,7 +1536,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//获取对应急救站的当日值班员信息 //获取对应急救站的当日值班员信息
for (Object powerTransferCompanyDto : companyDetail) { for (Object powerTransferCompanyDto : companyDetail) {
Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>(); Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>();
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class); PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId(); Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName(); String companyName = powerDto.getCompanyName();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);//这个公司ID实际上是120急救站的id值 FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);//这个公司ID实际上是120急救站的id值
...@@ -1259,7 +1591,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1259,7 +1591,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
mobiles.add(i.get("mobilePhone").toString()); mobiles.add(i.get("mobilePhone").toString());
} }
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) { if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString()); userList.add(i.get("amosId").toString());
} }
}); });
smsParams.put("resourcesNum", companyName); smsParams.put("resourcesNum", companyName);
...@@ -1276,14 +1608,14 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1276,14 +1608,14 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>(); Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId); besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) { if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList); pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
} }
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false); emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
} }
} }
} }
/** /**
* app消息web 消息推送 * app消息web 消息推送
* @param * @param
...@@ -1291,72 +1623,72 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1291,72 +1623,72 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
* @throws MqttException * @throws MqttException
*/ */
public void pushPowerTransferToAppAndWeb(String type,Map<String, String> besidesMap, HashMap<String, String> smsParams, List<String> userList){ public void pushPowerTransferToAppAndWeb(String type,Map<String, String> besidesMap, HashMap<String, String> smsParams, List<String> userList){
PushMessageWebAndAppRo pushMessageWebAndAppRo = new PushMessageWebAndAppRo(); PushMessageWebAndAppRo pushMessageWebAndAppRo = new PushMessageWebAndAppRo();
pushMessageWebAndAppRo.setRelationId(besidesMap.get("alterId")); pushMessageWebAndAppRo.setRelationId(besidesMap.get("alterId"));
pushMessageWebAndAppRo.setRecivers(userList); pushMessageWebAndAppRo.setRecivers(userList);
pushMessageWebAndAppRo.setCategory(RuleConstant.NOTIFY); pushMessageWebAndAppRo.setCategory(RuleConstant.NOTIFY);
pushMessageWebAndAppRo.setIsSendApp(true); pushMessageWebAndAppRo.setIsSendApp(true);
pushMessageWebAndAppRo.setIsSendWeb(true); pushMessageWebAndAppRo.setIsSendWeb(true);
pushMessageWebAndAppRo.setRuleType(type); pushMessageWebAndAppRo.setRuleType(type);
pushMessageWebAndAppRo.setMsgType(this.msgType); pushMessageWebAndAppRo.setMsgType(this.msgType);
pushMessageWebAndAppRo.setTerminal(RuleConstant.APP_WEB); pushMessageWebAndAppRo.setTerminal(RuleConstant.APP_WEB);
Map<String,String> map= new HashMap<String,String>(); Map<String,String> map= new HashMap<String,String>();
map.put("url", "disasterPage"); map.put("url", "disasterPage");
map.put("sequenceNbr", besidesMap.get("alterId")); map.put("sequenceNbr", besidesMap.get("alterId"));
if(AlertBusinessTypeEnum.警情结案.getCode().equals(type)) { if(AlertBusinessTypeEnum.警情结案.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息"); pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setStartTime(besidesMap.get("startTime")); pushMessageWebAndAppRo.setStartTime(besidesMap.get("startTime"));
pushMessageWebAndAppRo.setEndTime(besidesMap.get("endTime")); pushMessageWebAndAppRo.setEndTime(besidesMap.get("endTime"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address")); pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("endAlert"); pushMessageWebAndAppRo.setRuleType("endAlert");
} }
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(type)) { if(AlertBusinessTypeEnum.非警情确认.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息"); pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr")); pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address")); pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("notAlert"); pushMessageWebAndAppRo.setRuleType("notAlert");
} }
if(AlertBusinessTypeEnum.警情续报.getCode().equals(type)) { if(AlertBusinessTypeEnum.警情续报.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息"); pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setCompanyName(smsParams.get("alertType")); pushMessageWebAndAppRo.setCompanyName(smsParams.get("alertType"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address")); pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime")); pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime"));
pushMessageWebAndAppRo.setTransferLocation(smsParams.get("replaceContent")); pushMessageWebAndAppRo.setTransferLocation(smsParams.get("replaceContent"));
pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数 pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数 pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
pushMessageWebAndAppRo.setRuleType("followReportAlert"); pushMessageWebAndAppRo.setRuleType("followReportAlert");
} }
if(AlertBusinessTypeEnum.力量调派.getCode().equals(type)) { if(AlertBusinessTypeEnum.力量调派.getCode().equals(type)) {
map.put("url", "powerInformationPage"); map.put("url", "powerInformationPage");
pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.力量调派.getName()); pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.力量调派.getName());
pushMessageWebAndAppRo.setCompanyName(smsParams.get("resourcesNum")); pushMessageWebAndAppRo.setCompanyName(smsParams.get("resourcesNum"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address")); pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr")); pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr"));
if(StringUtils.isNotBlank(besidesMap.get("transferLocation"))) { if(StringUtils.isNotBlank(besidesMap.get("transferLocation"))) {
pushMessageWebAndAppRo.setTransferLocation(besidesMap.get("responseLevelString"));//响应级别 pushMessageWebAndAppRo.setTransferLocation(besidesMap.get("responseLevelString"));//响应级别
pushMessageWebAndAppRo.setRuleType("fullTime"); pushMessageWebAndAppRo.setRuleType("fullTime");
}else { }else {
pushMessageWebAndAppRo.setRuleType("monitor"); pushMessageWebAndAppRo.setRuleType("monitor");
} }
} }
if(AlertBusinessTypeEnum.警情初报.getCode().equals(type)) { if(AlertBusinessTypeEnum.警情初报.getCode().equals(type)) {
pushMessageWebAndAppRo.setRuleType("reportAlert"); pushMessageWebAndAppRo.setRuleType("reportAlert");
pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.警情初报.getName()); pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.警情初报.getName());
pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime")); pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime"));
pushMessageWebAndAppRo.setCompanyName(smsParams.get("companyName"));//发送单位 pushMessageWebAndAppRo.setCompanyName(smsParams.get("companyName"));//发送单位
pushMessageWebAndAppRo.setAddress(smsParams.get("address")); pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setFireSituation(smsParams.get("fireSituation"));//火势情况 pushMessageWebAndAppRo.setFireSituation(smsParams.get("fireSituation"));//火势情况
pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数 pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数 pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
} }
pushMessageWebAndAppRo.setExtras(map);; pushMessageWebAndAppRo.setExtras(map);;
try { try {
ruleTrigger.publish(pushMessageWebAndAppRo, "消息/addAlterMessageCheck", new String[0]); ruleTrigger.publish(pushMessageWebAndAppRo, "消息/addAlterMessageCheck", new String[0]);
} catch (Exception e) { } catch (Exception e) {
} }
} }
} }
...@@ -57,7 +57,7 @@ public class ESAlertCalledService { ...@@ -57,7 +57,7 @@ public class ESAlertCalledService {
public void init() throws Exception public void init() throws Exception
{ {
//初始化ES,重建索引 //初始化ES,重建索引
initEs(); //initEs();
} }
/** /**
......
...@@ -2298,5 +2298,17 @@ ...@@ -2298,5 +2298,17 @@
</sql> </sql>
</changeSet> --> </changeSet> -->
<changeSet author="litw" id="2021-11-29-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="jc_alert_called" columnName="record_url"/>
</not>
</preConditions>
<comment>update data jc_alert_called</comment>
<sql>
ALTER TABLE jc_alert_called ADD record_url varchar(200) null COMMENT '处置记录URL';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
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