【群组消息大小写问题,人员进组时名字获取】

This commit is contained in:
weizhihong 2023-04-21 10:41:00 +08:00
parent e16437b347
commit a26d883e99
3 changed files with 49 additions and 28 deletions

View File

@ -18,6 +18,7 @@ import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO; import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO;
import club.joylink.rtss.websocket.StompMessageService; import club.joylink.rtss.websocket.StompMessageService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
@ -315,8 +316,9 @@ public class ConversationGroupHandlerService {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "非本组成员"); throw new SimulationException(SimulationExceptionType.Illegal_Argument, "非本组成员");
} }
VoiceRecognitionResult recognitionResult = handleSupplier.get(); VoiceRecognitionResult recognitionResult = handleSupplier.get();
String upperCaseResult = recognitionResult.getResult().toUpperCase(); // 对语音信息进行消息文字处理
String handledContent = simulationVoiceHandler.handle(upperCaseResult); String handledContent = StringUtils.isNotEmpty(recognitionResult.getFilePath()) ?
simulationVoiceHandler.handle(recognitionResult.getResult().toUpperCase()) : recognitionResult.getResult();
// 创建消息信息 // 创建消息信息
String messageId = conversationGroup.generateMessageId(); String messageId = conversationGroup.generateMessageId();
ConversationGroupMessage message = new ConversationGroupMessage(messageId, member, ConversationGroupMessage message = new ConversationGroupMessage(messageId, member,

View File

@ -81,7 +81,7 @@ public class ConversationGroupListener {
if (!m.isRobot()) { if (!m.isRobot()) {
newUserIdSet.add(m.getUserId()); newUserIdSet.add(m.getUserId());
} }
stringBuilder.append(m.getName()).append(""); stringBuilder.append(m.getMemberName()).append("");
}); });
// 通知新成员 // 通知新成员
if (!CollectionUtils.isEmpty(newUserIdSet)) { if (!CollectionUtils.isEmpty(newUserIdSet)) {

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.MapNamedElement;
import club.joylink.rtss.simulation.vo.SimulationMemberVO; import club.joylink.rtss.simulation.vo.SimulationMemberVO;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Objects; import java.util.Objects;
@ -120,6 +121,20 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
return String.format("仿真成员[%s][%s][%s]", getId(), getType(), getName()); return String.format("仿真成员[%s][%s][%s]", getId(), getType(), getName());
} }
public String getMemberName() {
if (StringUtils.isNotEmpty(this.name)) {
return this.name;
}
StringBuilder memberName = new StringBuilder();
if (device instanceof MapNamedElement) {
memberName.append(((MapNamedElement) device).getName());
}
if (this.type != null) {
memberName.append(this.type.getDescription());
}
return memberName.toString();
}
@Override @Override
public String toString() { public String toString() {
String deviceInfo = null; String deviceInfo = null;
@ -160,90 +175,94 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
/** /**
* 仿真成员岗位 * 仿真成员岗位
*/ */
@Getter
public enum Type { public enum Type {
/** /**
* 值班主任 * 值班主任
*/ */
SHIFT_MANAGER(Area.OCC), SHIFT_MANAGER(Area.OCC, "值班主任"),
/** /**
* 中心调度员 * 中心调度员
*/ */
DISPATCHER(Area.OCC), DISPATCHER(Area.OCC, "值班主任"),
/** /**
* 电力调度 * 电力调度
*/ */
ELECTRIC_DISPATCHER(Area.OCC), ELECTRIC_DISPATCHER(Area.OCC, "电力调度"),
/** /**
* 环控调度 * 环控调度
*/ */
ENVIRONMENT_DISPATCHER(Area.OCC), ENVIRONMENT_DISPATCHER(Area.OCC, "环控调度"),
/** /**
* 车辆段调度 * 车辆段调度
*/ */
DEPOT_DISPATCHER(Area.VEHICLE_DEPOT), DEPOT_DISPATCHER(Area.VEHICLE_DEPOT, "车辆段调度"),
/** /**
* 车站值班员 * 车站值班员
*/ */
STATION_SUPERVISOR(Area.STATION), STATION_SUPERVISOR(Area.STATION, "车站值班员"),
/** /**
* 司机 * 司机
*/ */
DRIVER(Area.TRAIN), DRIVER(Area.TRAIN, "司机"),
/** /**
* 通号 * 通号
*/ */
MAINTAINER(Area.STATION), MAINTAINER(Area.STATION, "通号"),
/** /**
* 车辆段/停车场信号楼 * 车辆段/停车场信号楼
*/ */
SIGNAL_BUILDING(Area.VEHICLE_DEPOT), SIGNAL_BUILDING(Area.VEHICLE_DEPOT, "车辆段/停车场信号楼"),
/** /**
* 上级部门 * 上级部门
*/ */
@Deprecated(since = "2022-10-17", forRemoval = true) @Deprecated(since = "2022-10-17", forRemoval = true)
PARENT_DEPARTMENT(Area.OCC), PARENT_DEPARTMENT(Area.OCC, "上级部门"),
/** /**
* 派班员 * 派班员
*/ */
@Deprecated(since = "2022-10-17", forRemoval = true) @Deprecated(since = "2022-10-17", forRemoval = true)
SCHEDULING(Area.OCC), SCHEDULING(Area.OCC, "派班员"),
/** /**
* 车务段段长 * 车务段段长
*/ */
TRAIN_MASTER(Area.TRAIN_DEPOT), TRAIN_MASTER(Area.TRAIN_DEPOT, "车务段段长"),
/** /**
* 车站助理 * 车站助理
*/ */
STATION_ASSISTANT(Area.STATION), STATION_ASSISTANT(Area.STATION, "车站助理"),
/*** 车站站长 */ /**
STATION_MASTER(Area.STATION), * 车站站长
* */
STATION_MASTER(Area.STATION, "车站站长"),
/** /**
* 车站信号员 * 车站信号员
*/ */
STATION_SIGNALER(Area.STATION), STATION_SIGNALER(Area.STATION, "车站信号员"),
/** /**
* 车站客运员 * 车站客运员
*/ */
STATION_PASSENGER(Area.STATION), STATION_PASSENGER(Area.STATION, "车站客运员"),
/** 车站扳道员 */ /** 车站扳道员 */
STATION_SWITCH_MAN(Area.STATION), STATION_SWITCH_MAN(Area.STATION, "车站扳道员"),
/** 车站引导员 */ /** 车站引导员 */
STATION_FACILITATOR(Area.STATION), STATION_FACILITATOR(Area.STATION, "车站引导员"),
/** 车站工务工*/ /** 车站工务工*/
STATION_WORKER(Area.STATION), STATION_WORKER(Area.STATION, "车站工务工"),
/** 设备管理员 */ /** 设备管理员 */
DEVICE_MANAGER(Area.STATION), DEVICE_MANAGER(Area.STATION, "设备管理员"),
/** /**
* 电力工务 * 电力工务
*/ */
STATION_ELECTRIC_WORKER(Area.STATION); STATION_ELECTRIC_WORKER(Area.STATION, "电力工务");
private final int area; private final int area;
Type(int area) { private final String description;
Type(int area, String description) {
this.area = area; this.area = area;
this.description = description;
} }
} }