Commit 3882559d authored by 付培阳's avatar 付培阳

规则发短信接口

parent 17e203b7
...@@ -20,6 +20,7 @@ public enum AlertBusinessTypeEnum { ...@@ -20,6 +20,7 @@ public enum AlertBusinessTypeEnum {
突发事件救援警情初报("emergenciesReportAlert", "235", "SMS_JCS_0003", "突发事件救援警情初报"), 突发事件救援警情初报("emergenciesReportAlert", "235", "SMS_JCS_0003", "突发事件救援警情初报"),
漏油现场安全保障警情初报("oilSpillReportAlert", "237", "SMS_JCS_0004", "漏油现场安全保障警情初报"), 漏油现场安全保障警情初报("oilSpillReportAlert", "237", "SMS_JCS_0004", "漏油现场安全保障警情初报"),
专机保障警情初报("specialReportAlert", "238", "SMS_JCS_0005", "专机保障警情初报"), 专机保障警情初报("specialReportAlert", "238", "SMS_JCS_0005", "专机保障警情初报"),
警情初报("reportAlert", "297", "", "警情初报"),
警情续报("followReportAlert", "313", "SMS_JCS_0006", "警情续报"), 警情续报("followReportAlert", "313", "SMS_JCS_0006", "警情续报"),
非警情确认("notAlert", "314", "SMS_JCS_0008", "非警情确认"), 非警情确认("notAlert", "314", "SMS_JCS_0008", "非警情确认"),
警情结案("endAlert", "315", "SMS_JCS_0009", "警情结案"); 警情结案("endAlert", "315", "SMS_JCS_0009", "警情结案");
......
...@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl; ...@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
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.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.TemplateExtendDto; import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
...@@ -29,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -29,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.StringUtil; import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -63,6 +66,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -63,6 +66,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
AlertCalledAction alertCalledAction; AlertCalledAction alertCalledAction;
@Autowired @Autowired
OrgUsrServiceImpl orgUsrService; OrgUsrServiceImpl orgUsrService;
@Autowired
private RedisUtils redisUtils;
@Override @Override
public SchedulingReportingVo listSchedulingByParam(AlertSubmittedDto queryParam) { public SchedulingReportingVo listSchedulingByParam(AlertSubmittedDto queryParam) {
...@@ -144,13 +149,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -144,13 +149,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
AlertCalledRo calledRo = (AlertCalledRo) object; AlertCalledRo calledRo = (AlertCalledRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId(); String alertSubmittedId = calledRo.getAlertSubmittedId();
// 警情初报
if (alertSubmittedId == null) { if (alertSubmittedId == null) {
// 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()); Optional<AlertBusinessTypeEnum> businessTypeEnum = Optional.of(AlertBusinessTypeEnum.警情初报);
Optional<AlertBusinessTypeEnum> businessTypeEnum = EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class, alertSubmitted.setBusinessTypeCode(businessTypeEnum.get().getCode());
e -> e.getCode().equals(calledRo.getAlertTypeCode()));
alertSubmitted.setBusinessType(businessTypeEnum.get().getName()); alertSubmitted.setBusinessType(businessTypeEnum.get().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());
...@@ -159,13 +164,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -159,13 +164,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
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)));
String token = RequestContext.getToken();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get("region_" + token).toString(),
ReginParams.class);
alertSubmitted.setRecUserName(reginParams.getUserModel().getUserName());
alertSubmitted.setSender(reginParams.getUserModel().getUserName());
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();
smsCode = businessTypeEnum.get().getSms_code(); Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum =
EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(calledRo.getAlertTypeCode()));
smsCode = alertBusinessTypeEnum.get().getSms_code();
} }
// 组装人员信息 // 组装人员信息
List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListId(ids); List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListId(ids);
...@@ -179,17 +191,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -179,17 +191,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr")))); alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName")); alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone")); alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
alertSubmittedObject.setRecUserName("ZW");
mobiles.add((String) orgUser.get("telephone")); mobiles.add((String) orgUser.get("telephone"));
alertSubmittedObjectList.add(alertSubmittedObject); alertSubmittedObjectList.add(alertSubmittedObject);
} }
// 组装报送内容 // 组装报送内容
smsParams.put("callTimeStr",calledRo.getCallTimeStr()); smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address",calledRo.getAddress()); smsParams.put("address", calledRo.getAddress());
smsParams.put("fireLocation",calledRo.getFireLocation()); smsParams.put("fireLocation", calledRo.getFireLocation());
smsParams.put("burningMaterial",calledRo.getBurningMaterial()); smsParams.put("burningMaterial", calledRo.getBurningMaterial());
smsParams.put("fireSituation",calledRo.getFireSituation()); smsParams.put("fireSituation", calledRo.getFireSituation());
smsParams.put("trappedNum", calledRo.getTrappedNum()); smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum()); smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives()); smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives());
......
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