Commit 56cbed9e authored by 李腾威's avatar 李腾威

3918 3917 3910 bug

parent 77bf68fd
...@@ -50,4 +50,7 @@ public class AlertSubmittedSMSDto { ...@@ -50,4 +50,7 @@ public class AlertSubmittedSMSDto {
@ApiModelProperty(value = "报送模板") @ApiModelProperty(value = "报送模板")
private String submissionTemplate; private String submissionTemplate;
@ApiModelProperty(value = "报送类型")
private String type;
} }
...@@ -75,7 +75,8 @@ ...@@ -75,7 +75,8 @@
o.user_name, o.user_name,
s.sender, s.sender,
s.submission_content, s.submission_content,
t.content submission_template t.content submission_template,
t.type
FROM FROM
jc_alert_submitted_object o jc_alert_submitted_object o
LEFT JOIN jc_alert_submitted s ON o.alert_submitted_id = s.sequence_nbr LEFT JOIN jc_alert_submitted s ON o.alert_submitted_id = s.sequence_nbr
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -16,8 +17,11 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto; ...@@ -16,8 +17,11 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
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.SchedulingReportingDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
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.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedObjectServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedObjectServiceImpl;
...@@ -28,6 +32,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.TemplateServiceImpl; ...@@ -28,6 +32,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.TemplateServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -238,6 +243,23 @@ public class AlertSubmittedController extends BaseController { ...@@ -238,6 +243,23 @@ public class AlertSubmittedController extends BaseController {
/** /**
* 构建警情报送规则对象 * 构建警情报送规则对象
*/ */
boolean flag = false;
TemplateExtendDto template = null;
Template templateN = null;
if(schedulingContent.getType().equals(AlertBusinessTypeEnum.警情结案.getName()) ||
schedulingContent.getType().equals(AlertBusinessTypeEnum.警情续报.getName()) ||
schedulingContent.getType().equals(AlertBusinessTypeEnum.非警情确认.getName())) {
} else {
// 获取模板
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN,template);
template.setRichContent(template.getContent());
flag = true;
}
AlertCalledRo alertCalledRo = new AlertCalledRo(); AlertCalledRo alertCalledRo = new AlertCalledRo();
AlertCalled alertCalled = alertCalledVo.getAlertCalled(); AlertCalled alertCalled = alertCalledVo.getAlertCalled();
...@@ -249,7 +271,24 @@ public class AlertSubmittedController extends BaseController { ...@@ -249,7 +271,24 @@ public class AlertSubmittedController extends BaseController {
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( schedulingContent.getSubmissionTemplate(),definitions);
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "无" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "无" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "无" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "无" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(schedulingContent.getSubmissionContent()).getString("$companyName") ;
definitions.put("$companyName", null == companyName ? "" : companyName);
String content ="";
if(flag) {
content = getTaskInformation( template.getRichContent(),definitions);
} else {
content = getTaskInformation( schedulingContent.getSubmissionTemplate(),definitions);
}
schedulingContent.setSubmissionTemplate(content); schedulingContent.setSubmissionTemplate(content);
if(!ValidationUtil.isEmpty(schedulingContent.getSubmissionContent())) { if(!ValidationUtil.isEmpty(schedulingContent.getSubmissionContent())) {
try { try {
......
...@@ -3,9 +3,12 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl; ...@@ -3,9 +3,12 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.feign.IotFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.IotFeignClient;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
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.KeyValueLabel; import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
...@@ -16,6 +19,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult; ...@@ -16,6 +19,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.FileInfoModel; import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -51,6 +55,10 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc ...@@ -51,6 +55,10 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
@Autowired @Autowired
IotFeignClient iotFeignClient; IotFeignClient iotFeignClient;
@Autowired
AlertCalledServiceImpl iAlertCalledService;
@Autowired @Autowired
private AlertFormValueServiceImpl iAlertFormValueService; private AlertFormValueServiceImpl iAlertFormValueService;
...@@ -108,10 +116,22 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc ...@@ -108,10 +116,22 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
*/ */
@Override @Override
public AircraftDto queryByAircraftSeq(String agencyCode, Long seq) { public AircraftDto queryByAircraftSeq(String agencyCode, Long seq) {
AircraftDto aircraftDto = this.queryBySeq(seq); AlertCalledObjsDto dto = (AlertCalledObjsDto)iAlertCalledService.selectAlertCalledByIdNoRedisNew(seq);
List<AlertFormValue> list = dto.getAlertFormValue();
String aircraft = "";
List<AlertFormValue> list1 = list.stream().filter(formValue -> formValue.getFieldCode().equals("aircraft") || formValue.getFieldCode().equals("aircraftModel")).collect(Collectors.toList());
if(list1.size() > 0) {
aircraft = list1.get(0).getFieldValueCode();
}
LambdaQueryWrapper<Aircraft> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Aircraft::getAircraftModel,aircraft);
AircraftDto aircraftDto = new AircraftDto();
Aircraft one = this.getOne(queryWrapper);
Bean.toPo(one,aircraftDto);
//填充航空器附件信息 //填充航空器附件信息
FeignClientResult<List<FileInfoModel>> fileInfoModelResult = Systemctl.fileInfoClient.queryByEntity( FeignClientResult<List<FileInfoModel>> fileInfoModelResult = Systemctl.fileInfoClient.queryByEntity(
agencyCode, Aircraft.class.getSimpleName(), String.valueOf(seq)); agencyCode, Aircraft.class.getSimpleName(), String.valueOf(one.getSequenceNbr()));
List<FileInfoModel> fileInfoModels = fileInfoModelResult.getResult(); List<FileInfoModel> fileInfoModels = fileInfoModelResult.getResult();
if (!ValidationUtil.isEmpty(fileInfoModels)) { if (!ValidationUtil.isEmpty(fileInfoModels)) {
......
...@@ -259,6 +259,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -259,6 +259,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
List<FormValue> formValue = new ArrayList<FormValue>(); List<FormValue> formValue = new ArrayList<FormValue>();
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) { for (AlertFormValue alertFormValue : list) {
if("flightNumber".equals(alertFormValue.getFieldCode())) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValueCode(), alertFormValue.getBlock());
formValue.add(value);
continue;
}
if("aircraftModel".equals(alertFormValue.getFieldCode())) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValueCode(), alertFormValue.getBlock());
formValue.add(value);
continue;
}
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValue(), alertFormValue.getBlock()); "text", alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
......
...@@ -191,7 +191,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -191,7 +191,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
try { try {
alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(), alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(),
alertSubmittedExtDto.getUserName())); alertSubmittedExtDto.getUserName()));
TemplateExtendDto template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode());
TemplateExtendDto template = null;
Template templateN = null;
if(AlertBusinessTypeEnum.警情初报.getName().equals(alertSubmittedExtDto.getBusinessType())) {
// 获取任务派发模板
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN,template);
template.setRichContent(template.getContent());
} else {
template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode());
}
AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(queryParam.getAlertCalledId()); AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(queryParam.getAlertCalledId());
AlertCalled alertCalled = alertCalledVo.getAlertCalled(); AlertCalled alertCalled = alertCalledVo.getAlertCalled();
...@@ -209,12 +222,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -209,12 +222,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
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",ValidationUtil.isEmpty(alertCalled.getAddress()) ? "无" : alertCalled.getAddress());
definitions.put("$recDate",DateUtils.dateTimeToDateString(alertCalled.getRecDate())); definitions.put("$recDate",DateUtils.dateTimeToDateString(alertCalled.getRecDate()));
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "无" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "无" : String.valueOf(alertCalled.getTrappedNum()));
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") ;
definitions.put("$companyName", null == companyName ? "" : companyName);
String content = getTaskInformation( template.getRichContent(),definitions); String content = getTaskInformation( template.getRichContent(),definitions);
alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent())); alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()));
alertSubmittedExtDto.setSubmissionContent(content); alertSubmittedExtDto.setSubmissionContent(content);
} catch (JSONException e) { } catch (JSONException e) {
alertSubmittedExtDto.setSubmissionContentValue(alertSubmittedExtDto.getSubmitContent()); alertSubmittedExtDto.setSubmissionContentValue(alertSubmittedExtDto.getSubmitContent());
} catch (ParseException e) { } catch (ParseException e) {
...@@ -272,6 +296,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -272,6 +296,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto)alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr())); AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto)alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
alertCalled = alertCalledObjsDto.getAlertCalled(); 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(); String alertTypeCode = calledRo.getAlertTypeCode();
alertWay = calledRo.getAlertWay(); alertWay = calledRo.getAlertWay();
String unitInvolved = calledRo.getUnitInvolved(); String unitInvolved = calledRo.getUnitInvolved();
......
...@@ -126,10 +126,10 @@ public class RuleAlertCalledService { ...@@ -126,10 +126,10 @@ public class RuleAlertCalledService {
} }
//航空器救援 //航空器救援
if (alertFormValue.getFieldCode().equals("flightNumber")) { if (alertFormValue.getFieldCode().equals("flightNumber")) {
alertCalledRo.setFlightNumber(alertFormValue.getFieldValue()); alertCalledRo.setFlightNumber(alertFormValue.getFieldValueCode());
} }
if (alertFormValue.getFieldCode().equals("aircraftModel")) { if (alertFormValue.getFieldCode().equals("aircraftModel")) {
alertCalledRo.setAircraftModel(alertFormValue.getFieldValue()); alertCalledRo.setAircraftModel(alertFormValue.getFieldValueCode());
} }
if (alertFormValue.getFieldCode().equals("landingTime")) { if (alertFormValue.getFieldCode().equals("landingTime")) {
alertCalledRo.setLandingTime(alertFormValue.getFieldValue()); alertCalledRo.setLandingTime(alertFormValue.getFieldValue());
......
...@@ -2367,5 +2367,17 @@ ...@@ -2367,5 +2367,17 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-12-09-1-1">
<preConditions onFail="MARK_RAN">
<not>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="jc_template"/>
</not>
</preConditions>
<comment>insert data jc_template</comment>
<sql>
INSERT INTO `jc_template` (sequence_nbr, type_code, `type`, content, format, rec_user_name, rec_user_id, rec_date, is_delete) VALUES(27, 'JQCB', '警情初报统一模板', '【警情初报】时间:$callTime;地址:$address;发生【$type】警情 $replaceContent 被困人数:$trappedNum 伤亡人数:$casualtiesNum 发送单位:$companyName 联系人: $contactUser 联系电话: $contactPhone ', 0, NULL, NULL, NULL, 0);
</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