Commit 17e203b7 authored by tangwei's avatar tangwei

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents bf7bb563 b29d42a0
......@@ -13,7 +13,8 @@ import java.util.List;
public class Menu {
public Long id;
public String name;
public Long parentId;
public Long parentId;
public Boolean isRoot;
public List<Menu> children;
public Menu(Long id, String name, Long parentId2) {
super();
......@@ -30,7 +31,15 @@ public class Menu {
this.children = children;
}
public Long getId() {
public Menu(Long id, String name, Long parentId, Boolean isRoot, List<Menu> children) {
this.id = id;
this.name = name;
this.parentId = parentId;
this.isRoot = isRoot;
this.children = children;
}
public Long getId() {
return id;
}
public void setId(Long id) {
......@@ -56,5 +65,12 @@ public class Menu {
public void setChildren(List<Menu> children) {
this.children = children;
}
public Boolean getRoot() {
return isRoot;
}
public void setRoot(Boolean root) {
isRoot = root;
}
}
\ No newline at end of file
......@@ -10,6 +10,9 @@ import org.apache.ibatis.reflection.MetaObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
......@@ -18,16 +21,16 @@ import java.util.Date;
@Component
public class MetaHandler implements MetaObjectHandler {
@Autowired
protected HttpServletRequest request;
@Autowired
private RedisUtils redisUtils;
protected String getToken() {
String authToken = request.getHeader("token");
if (authToken == null) {
authToken = request.getHeader("X-Access-Token");
}
String authToken = RequestContext.getToken();
// if (authToken == null) {
// authToken = request.getHeader("X-Access-Token");
// }
return authToken;
}
protected String buildKey(String token) {
......
......@@ -191,7 +191,7 @@ public class FireExpertsController extends BaseController {
Collection<DataDictionary> list = dataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent");
Menu menu = new Menu(-1L, "专家领域", -1L, menus);
Menu menu = new Menu(-1L, "专家领域", -1L, true, menus);
List<Menu> menuList = new ArrayList<>();
menuList.add(menu);
// 创建挂在主节点
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
......@@ -28,6 +27,8 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -120,6 +121,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
formValue.setFieldValue(alertSubmittedId.toString());
alertFormValue.add(formValue);
alertCalledVo.setAlertFormValue(alertFormValue);
ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
RequestContextHolder.setRequestAttributes(sra, true);
// TODO 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo);
return true;
......@@ -130,7 +134,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/
public void ruleCallbackAction(String smsCode, String sendIds, Object object) throws Exception {
// 获取报送对象列表
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();;
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>();
// 根据id列表查询所有人员信息
......@@ -138,6 +143,30 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
if (object instanceof AlertCalledRo) {
AlertCalledRo calledRo = (AlertCalledRo) object;
String alertSubmittedId = calledRo.getAlertSubmittedId();
if (alertSubmittedId == null) {
// 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted();
alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr()));
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
Optional<AlertBusinessTypeEnum> businessTypeEnum = EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(calledRo.getAlertTypeCode()));
alertSubmitted.setBusinessType(businessTypeEnum.get().getName());
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode());
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = Optional.of(AlertSchedulingTypeEnum.融合调度);
alertSubmitted.setSchedulingTypeCode(alertSchedulingTypeEnum.get().getCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo)));
alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date());
this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
smsCode = businessTypeEnum.get().getSms_code();
}
// 组装人员信息
List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListId(ids);
......@@ -147,7 +176,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setType(false);
alertSubmittedObject.setCompanyId(Long.valueOf((String) orgUser.get("parentId")));
alertSubmittedObject.setCompanyName((String) orgUser.get("parenName"));
alertSubmittedObject.setUserId(10010L);
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
alertSubmittedObject.setRecUserName("ZW");
......@@ -156,12 +185,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObjectList.add(alertSubmittedObject);
}
// 组装报送内容
smsParams.put("alertType", calledRo.getAlertType());
smsParams.put("callTimeStr",calledRo.getCallTimeStr());
smsParams.put("address",calledRo.getAddress());
smsParams.put("fireLocation",calledRo.getFireLocation());
smsParams.put("burningMaterial",calledRo.getBurningMaterial());
smsParams.put("fireSituation",calledRo.getFireSituation());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives());
smsParams.put("companyName", calledRo.getCompanyName());
}
// 执行短信报送对象
saveAlertSubmittedObject(alertSubmittedObjectList, smsCode, mobiles, smsParams);
// 短信报送对象
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
}
/**
......@@ -266,7 +305,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/
public void saveAlertSubmittedObject(List<AlertSubmittedObject> alertSubmittedObjectList, String smsCode,
Set<String> mobiles, HashMap<String, String> smsParams) {
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
......
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