Commit f654fc22 authored by lisong's avatar lisong

修改bug

parent ca6e61c2
......@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.command.biz.service.impl.FrontlineLiaisonSer
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.JcSituationDetailMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
......@@ -216,6 +217,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired
JcSituationDetailMapper jcSituationDetailMapper;
@Autowired
UserCarMapper userCarMapper;
@Value("${mqtt.topic.command.alert.noticeJa}")
private String topicJa;
......@@ -577,21 +581,21 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds, null);
} else {
if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds, null);
}
if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
besidesMap.put("startTime", DateUtils.dateFormat(alertCalled.getCallTime(), 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, null);
}
if(alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(),besidesMap,smsParams,usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(),besidesMap,smsParams,usIds, null);
}
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
......@@ -1623,6 +1627,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("alertType", calledRo.getAlertType());
List<PowerTransferCompanyResourcesDto> list = powerDto
.getPowerTransferCompanyResourcesDtoList();
// 查询已绑定车辆人员id
List<UserCar> userCars = userCarMapper.selectList(new QueryWrapper<UserCar>().lambda().eq(UserCar::getIsDelete, false));
List<Long> userIds = userCars.stream().map(UserCar::getAmosUserId).collect(Collectors.toList());
if (list != null && list.size() > 0) {
for (PowerTransferCompanyResourcesDto i : list) {
String carName = i.getResourcesName();
......@@ -1660,9 +1667,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
};
userList=new ArrayList<String>();
// 车辆绑定人发送的是待办任务
if(!ValidationUtil.isEmpty(map.get("amosId"))) {
if (!CollectionUtils.isEmpty(userIds)){
if (userIds.contains(Long.valueOf(map.get("amosId").toString()))){
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);
besidesMap.put("alterId", alertCalledId);
ArrayList<String> strings = new ArrayList<>();
strings.add(map.get("amosId").toString());
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,strings, RuleConstant.TASK);
}else {
userList.add(map.get("amosId").toString());
}
}else {
userList.add(map.get("amosId").toString());
}
}
alertSubmittedObjectSub.setUserPhone(map.get("mobilePhone").toString());
}
alertSubmittedObjectListSub.add(alertSubmittedObjectSub);
......@@ -1673,7 +1694,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
besidesMap.put("responseLevelString", responseLevelString);
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList, null);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS,
......@@ -1683,14 +1704,31 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
String resourcesNumStr = resourcesNum.toString();
List<String> userList= new ArrayList<String>();
ArrayList<String> taskUserIds = new ArrayList<>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
if (!CollectionUtils.isEmpty(userIds)){
if (userIds.contains(Long.valueOf(i.get("amosId").toString()))){
taskUserIds.add(i.get("amosId").toString());
}else {
userList.add(i.get("amosId").toString());
}
}else {
userList.add(i.get("amosId").toString());
}
}
});
// 车辆绑定人发送的是待办任务
if (!CollectionUtils.isEmpty(taskUserIds)){
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);//响应级别
besidesMap.put("alterId", alertCalledId);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,taskUserIds, RuleConstant.TASK);
}
smsParams.put("resourcesNum", resourcesNumStr);
// 短信报送对象
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
......@@ -1705,7 +1743,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
besidesMap.put("responseLevelString", responseLevelString);//响应级别
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList, null);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -1717,7 +1755,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
public void ruleCallbackActionForPowerTransferForSurvBrigade(String smsCode, List sendIds, Object object, List<String> pList) throws MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
// 查询已绑定车辆人员id
List<UserCar> userCars = userCarMapper.selectList(new QueryWrapper<UserCar>().lambda().eq(UserCar::getIsDelete, false));
List<Long> userCarIds = userCars.stream().map(UserCar::getAmosUserId).collect(Collectors.toList());
Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>();
String alertCalledId = null;
......@@ -1796,14 +1836,30 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("alertType", calledRo.getAlertType());
List<String> userList= new ArrayList<String>();
ArrayList<String> taskUserIds = new ArrayList<>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
if (!CollectionUtils.isEmpty(userCarIds)){
if (userCarIds.contains(Long.valueOf(i.get("amosId").toString()))){
taskUserIds.add(i.get("amosId").toString());
}else {
userList.add(i.get("amosId").toString());
}
}else {
userList.add(i.get("amosId").toString());
}
}
});
// 绑定车辆人员发送的是待办消息
if (!CollectionUtils.isEmpty(taskUserIds)){
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,taskUserIds,RuleConstant.TASK);
}
smsParams.put("resourcesNum", companyName);
// 短信报送对象
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
......@@ -1818,7 +1874,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList,null);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -1830,7 +1886,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
public void ruleCallbackActionForPowerTransferForAid(String smsCode, List sendIds, Object object, List<String> pList) throws MqttPersistenceException, MqttException {
// 查询已绑定车辆人员id
List<UserCar> userCars = userCarMapper.selectList(new QueryWrapper<UserCar>().lambda().eq(UserCar::getIsDelete, false));
List<Long> userCarIds = userCars.stream().map(UserCar::getAmosUserId).collect(Collectors.toList());
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
Set<String> mobiles = new HashSet<>();
......@@ -1916,14 +1974,30 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
List<String> userList= new ArrayList<String>();
List<String> taskUserIds= new ArrayList<String>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
if (!CollectionUtils.isEmpty(userCarIds)){
if (userCarIds.contains(Long.valueOf(i.get("amosId").toString()))){
taskUserIds.add(i.get("amosId").toString());
}else {
userList.add(i.get("amosId").toString());
}
}else {
userList.add(i.get("amosId").toString());
}
}
});
// 绑定车辆人员发送的是待办消息
if (CollectionUtils.isEmpty(taskUserIds)){
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,taskUserIds, RuleConstant.TASK);
}
smsParams.put("resourcesNum", companyName);
// 短信报送对象
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
......@@ -1938,7 +2012,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList, null);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
......@@ -1952,13 +2026,17 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
* @throws MqttPersistenceException
* @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, Integer messageType){
PushMessageWebAndAppRo pushMessageWebAndAppRo = new PushMessageWebAndAppRo();
pushMessageWebAndAppRo.setRelationId(besidesMap.get("alterId"));
pushMessageWebAndAppRo.setRecivers(userList);
// pushMessageWebAndAppRo.setCategory(RuleConstant.NOTIFY);
// 默认发送消息通知,力量调派车辆绑定人发送待办任务。
if (null != messageType){
pushMessageWebAndAppRo.setCategory(RuleConstant.TASK);
}else {
pushMessageWebAndAppRo.setCategory(RuleConstant.NOTIFY);
}
pushMessageWebAndAppRo.setIsSendApp(true);
pushMessageWebAndAppRo.setIsSendWeb(true);
pushMessageWebAndAppRo.setRuleType(type);
......
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