Commit 6b2584cf authored by 李腾威's avatar 李腾威

融合调度规则 任务 4318 4326 4327

parent 675a52c3
...@@ -134,7 +134,7 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> { ...@@ -134,7 +134,7 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
List<Map<String, Object>> getFirstAidForTypeCodeAndCompanyId(long company); List<Map<String, Object>> getFirstAidForTypeCodeAndCompanyId(long company);
List<Map<String, Object>> queryByCompanyId(); List<Map<String, Object>> queryByCompanyId(@Param(value="bizNames") List<String> bizNames);
List<Map<String, Object>> queryByCompanyNew(String bizOrgName); List<Map<String, Object>> queryByCompanyNew(String bizOrgName);
} }
...@@ -92,7 +92,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -92,7 +92,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<Map<String, Long>> countDeptByCompanyId(@Param("companyIdList") List<String> companyIdList); List<Map<String, Long>> countDeptByCompanyId(@Param("companyIdList") List<String> companyIdList);
List<Map<String,Object>> queryCompanyId(String bizOrgName); List<Map<String,Object>> queryCompanyId(String bizOrgName,@Param("codes")List<String> codes);
List<Map<String,Object>> queryCompanyIdNew(String bizOrgName); List<Map<String,Object>> queryCompanyIdNew(String bizOrgName);
......
...@@ -34,7 +34,7 @@ public interface IDutyPersonService extends IDutyCommonService { ...@@ -34,7 +34,7 @@ public interface IDutyPersonService extends IDutyCommonService {
*/ */
List<DutyPersonDto> findByDutyAreaId(Long dutyAreaId); List<DutyPersonDto> findByDutyAreaId(Long dutyAreaId);
List<Map<String, Object>> queryByCompanyId(); List<Map<String, Object>> queryByCompanyId(List<String> bizNames);
List<Map<String, Object>> queryByCompanyNew(String bizOrgName); List<Map<String, Object>> queryByCompanyNew(String bizOrgName);
} }
...@@ -358,8 +358,11 @@ AND cft.type_code = ( ...@@ -358,8 +358,11 @@ AND cft.type_code = (
where i.field_code = 'userId' and i.field_value is not null) c where i.field_code = 'userId' and i.field_value is not null) c
on cb.instance_id = c.id3 on cb.instance_id = c.id3
where to_days(cb.duty_date) = to_days(now()) and where to_days(cb.duty_date) = to_days(now()) and
a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name = '消防救援保障部' or a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name in
biz_org_name = '综合办公室' or biz_org_name = '消防支队' or biz_org_name = '应急指挥科' )) r ) <foreach item="item" index="index" collection="bizNames" open="(" separator="," close=")">
#{item}
</foreach>
)) r )
</select> </select>
......
...@@ -691,13 +691,17 @@ LEFT JOIN ( ...@@ -691,13 +691,17 @@ LEFT JOIN (
select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId, select cou.biz_org_name bizOrgName,cou.sequence_nbr sequenceNbr ,cou .parent_id parentId,
a.fireManagementPostCode, b.telephone from cb_org_usr cou a.fireManagementPostCode, b.telephone from cb_org_usr cou
left join (select i.instance_id id1 ,if(i.field_code = 'fireManagementPostCode', left join (select i.instance_id id1 ,if(i.field_code = 'fireManagementPostCode',
i.field_value_label, null) as 'fireManagementPostCode' from cb_dynamic_form_instance i where i.field_code = 'fireManagementPostCode' i.field_value, null) as 'fireManagementPostCode' from cb_dynamic_form_instance i where i.field_code = 'fireManagementPostCode'
and i.field_value_label is not null) a on cou .sequence_nbr = a.id1 and i.field_value_label is not null) a on cou .sequence_nbr = a.id1
left join (select i.instance_id id2,if(i.field_code = 'telephone', left join (select i.instance_id id2,if(i.field_code = 'telephone',
i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone' i.field_value, null) as 'telephone' from cb_dynamic_form_instance i where i.field_code = 'telephone'
and i.field_value is not null) b on cou .sequence_nbr = b.id2 and i.field_value is not null) b on cou .sequence_nbr = b.id2
) d where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName}) ) d where d.parentId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})
and (d.fireManagementPostCode = '消防安全管理人' or d.fireManagementPostCode = '消防安全责任人') and (d.fireManagementPostCode in
<foreach item="item" index="index" collection="codes" open="(" separator="," close=")">
#{item}
</foreach>
)
</select> </select>
<select id="queryCompanyIdNew" resultType="map"> <select id="queryCompanyIdNew" resultType="map">
......
...@@ -26,7 +26,7 @@ public class AlertCalledRo implements Serializable{ ...@@ -26,7 +26,7 @@ public class AlertCalledRo implements Serializable{
* *
* </pre> * </pre>
*/ */
private static final long serialVersionUID = 529623529216238088L; private static final long serialVersionUID = -8755622977733065123L;
/** /**
* 通用属性 * 通用属性
...@@ -73,9 +73,12 @@ public class AlertCalledRo implements Serializable{ ...@@ -73,9 +73,12 @@ public class AlertCalledRo implements Serializable{
@Label(value = "警情报送类型(0,警情报送,1,警情续报,2,非警情确认,3,警情结案)") @Label(value = "警情报送类型(0,警情报送,1,警情续报,2,非警情确认,3,警情结案)")
private String alertWay; private String alertWay;
@Label(value = "警情续报,非警情确认,警情结案,选择人员ids") @Label(value = "警情续报,非警情确认,警情结案,选择人员电话号码")
private String ids; private String ids;
@Label(value = "警情续报,非警情确认,警情结案,选择人员AmousIds")
private String usIds;
@Label(value = "警情续报自定义内容") @Label(value = "警情续报自定义内容")
private String feedback; private String feedback;
......
...@@ -30,6 +30,9 @@ public class AlertSubmittedSMSDto { ...@@ -30,6 +30,9 @@ public class AlertSubmittedSMSDto {
@ApiModelProperty(value = "联系电话") @ApiModelProperty(value = "联系电话")
private String userPhone; private String userPhone;
@ApiModelProperty(value = "警情Id")
private String alertCallId;
@ApiModelProperty(value = "协调单位") @ApiModelProperty(value = "协调单位")
private String companyName; private String companyName;
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
jas.submission_method, jas.submission_method,
jas.submission_method_code, jas.submission_method_code,
jas.update_time, jas.update_time,
jaso.sequence_nbr, jaso.sequence_nbr sequenceNbr,
jaso.company_name, jaso.company_name,
jaso.user_name, jaso.user_name,
jaso.user_phone jaso.user_phone
from jc_alert_submitted jas from jc_alert_submitted jas
left join jc_alert_submitted_object jaso on jas.sequence_nbr = jaso.alert_submitted_id right join jc_alert_submitted_object jaso on jas.sequence_nbr = jaso.alert_submitted_id
where 1=1 where 1=1
<if test="alertSubmittedDto.alertCalledId != null and alertSubmittedDto.alertCalledId != ''"> <if test="alertSubmittedDto.alertCalledId != null and alertSubmittedDto.alertCalledId != ''">
and jas.alert_called_id = #{alertSubmittedDto.alertCalledId} and jas.alert_called_id = #{alertSubmittedDto.alertCalledId}
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
<select id="getSchedulingContent" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto"> <select id="getSchedulingContent" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto">
SELECT SELECT
s.sequence_nbr, s.sequence_nbr,
s.alert_called_id alertCallId,
s.submission_time, s.submission_time,
o.user_phone, o.user_phone,
o.company_name, o.company_name,
......
...@@ -286,26 +286,16 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType ...@@ -286,26 +286,16 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
if(!map20.containsKey(i.get("shiftName").toString())) { if(!map20.containsKey(i.get("shiftName").toString())) {
map20.put(ssString, ssString); map20.put(ssString, ssString);
} }
System.out.println("ssssssssss"); System.out.println("ssssssssss");
}); });
} }
@Override @Override
public List<Map<String, Object>> queryByCompanyId(){ public List<Map<String, Object>> queryByCompanyId(List<String> bizNames){
return dutyPersonShiftMapper.queryByCompanyId(); return dutyPersonShiftMapper.queryByCompanyId(bizNames);
} }
@Override @Override
......
...@@ -1861,9 +1861,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1861,9 +1861,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return resultMap; return resultMap;
} }
public List<Map<String,Object>> queryCompanyId(String bizOrgName) { public List<Map<String,Object>> queryCompanyId(String bizOrgName,List<String> codes) {
return orgUsrMapper.queryCompanyId(bizOrgName); return orgUsrMapper.queryCompanyId(bizOrgName,codes);
} }
public List<Map<String,Object>> queryCompanyIdNew(String bizOrgName) { public List<Map<String,Object>> queryCompanyIdNew(String bizOrgName) {
......
...@@ -7,17 +7,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -7,17 +7,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; 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.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
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.AlertSubmittedDto; 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.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.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;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.RuleAlertCalledService;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.TemplateServiceImpl; 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;
...@@ -34,8 +39,11 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -34,8 +39,11 @@ 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.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** /**
...@@ -203,6 +211,8 @@ public class AlertSubmittedController extends BaseController { ...@@ -203,6 +211,8 @@ public class AlertSubmittedController extends BaseController {
alertSubmittedService.getAlertSubmittedContent(alertCalledId, templateVos, companyName); alertSubmittedService.getAlertSubmittedContent(alertCalledId, templateVos, companyName);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new RuntimeException("系统异常"); throw new RuntimeException("系统异常");
} catch (ParseException e) {
e.printStackTrace();
} }
return ResponseHelper.buildResponse(templateVos); return ResponseHelper.buildResponse(templateVos);
} }
...@@ -216,10 +226,26 @@ public class AlertSubmittedController extends BaseController { ...@@ -216,10 +226,26 @@ public class AlertSubmittedController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}/scheduling_content", method = RequestMethod.GET) @RequestMapping(value = "/{id}/scheduling_content", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取融合调度短信内容", notes = "获取融合调度短信内容") @ApiOperation(httpMethod = "GET", value = "获取融合调度短信内容", notes = "获取融合调度短信内容")
public ResponseModel<AlertSubmittedSMSDto> getSchedulingContent(@PathVariable Long id) { public ResponseModel<AlertSubmittedSMSDto> getSchedulingContent(@PathVariable Long id) throws ParseException {
// 获取报送内容 // 获取报送内容
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日 // 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
AlertSubmittedSMSDto schedulingContent = alertSubmittedService.getSchedulingContent(id); AlertSubmittedSMSDto schedulingContent = alertSubmittedService.getSchedulingContent(id);
AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(schedulingContent.getAlertCallId()));
/**
* 构建警情报送规则对象
*/
AlertCalledRo alertCalledRo = new AlertCalledRo();
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
String replaceContent = RuleAlertCalledService.init(alertCalledRo,alertCalledVo);
Map<String, String> definitions = new HashMap<>();
definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.dateTimeToDateString(alertCalled.getCallTime()));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",alertCalled.getAddress());
String content = getTaskInformation( schedulingContent.getSubmissionTemplate(),definitions);
schedulingContent.setSubmissionTemplate(content);
if(!ValidationUtil.isEmpty(schedulingContent.getSubmissionContent())) { if(!ValidationUtil.isEmpty(schedulingContent.getSubmissionContent())) {
try { try {
JSON.parseObject(schedulingContent.getSubmissionContent()); JSON.parseObject(schedulingContent.getSubmissionContent());
...@@ -230,5 +256,12 @@ public class AlertSubmittedController extends BaseController { ...@@ -230,5 +256,12 @@ public class AlertSubmittedController extends BaseController {
} }
return ResponseHelper.buildResponse(schedulingContent); return ResponseHelper.buildResponse(schedulingContent);
} }
private String getTaskInformation(String content, Map<String, String> definitions) {
int size = definitions.size();
String[] keys = definitions.keySet().toArray(new String[size]);
String[] values = definitions.values().toArray(new String[size]);
return StringUtils.replaceEach(content, keys, values);
}
} }
...@@ -369,7 +369,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -369,7 +369,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
alertCalledObjsDto.setAlertFormValue(alertFormValuelist); alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
// 警情报送 // 警情报送
// 调用规则 警情初报 // 调用规则 警情初报
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(), null); ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(), null,null,null);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 // 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
/** /**
...@@ -377,9 +377,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -377,9 +377,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
*/ */
eSAlertCalledService.saveAlertCalledToES(alertCalled); eSAlertCalledService.saveAlertCalledToES(alertCalled);
} }
return alertCalledObjsDto; return alertCalledObjsDto;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -2163,8 +2163,60 @@ ...@@ -2163,8 +2163,60 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litw" id="2021-11-15-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template"/>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="jc_template"/>
</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(26, 'LLDP', '力量调派统一模板', '【力量调派】调派departmentName content 赶往rescueGrid 位置。responseLevel 联系人: contactUser 联系电话: contactPhone 相关警情:【type】时间:callTime replaceContent', 0, NULL, NULL, NULL, 0);
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-17-litengwei-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
`jc_template` jc
set
content = '<![CDATA[<p>【警情续报】<span contenteditable="true" data-name="editContent" data-type="input"></span><p>相关警情:时间:$callTime 地点: $address 发生$type 警情 $replaceContent 被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>;<p>发送单位:<span contentEditable data-name="companyName" data-type="input"></span></p> ]]>'
where jc.type_code = '313'
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-17-litengwei-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
jc_template jc
set
content = '<![CDATA[<p>【非警情确认】根据现场反馈信息、视频监控信息和消防物联监控信息,判断 【时间:$callTime 地点: $address 发生$type 警情 $replaceContent ;被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>; 】 为非警情,请个单位、部门尽快 进行恢复到日常执勤状态。</p><p>发送单位:<span contenteditable="true" data-name="companyName" data-type="input"></span></p>]]>'
where
jc.type_code = '314'
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-17-litengwei-3">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
jc_template jc
set
content = '<![CDATA[<p>【警情结案】当前警情已于<span contenteditable="true" data-name="recDate" data-type="input"></span> 当前警情已经结案。</p>相关警情:时间:$callTime 地点: $address 发生$type 警情 $replaceContent;被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>;<p>发送单位:<span contentEditable data-name="companyName" data-type="input"></span></p>]]>'
where
jc.type_code = '315'
</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