Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
56c5c6b3d3
@ -87,7 +87,6 @@ public class LoginController {
|
||||
@GetMapping(path = "/getUserInfo")
|
||||
public AccountVO getUserInfo(String token) {
|
||||
LoginUserInfoVO loginUserInfoVO = this.iAuthenticateService.getLoginUserInfoByToken(token);
|
||||
System.out.println(String.format("%s ====%s =========== from getUserInfo",loginUserInfoVO,loginUserInfoVO.getAccountVO().getCompanyId()));
|
||||
return loginUserInfoVO.getAccountVO();
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,14 @@ public class ConversationGroupController {
|
||||
private ConversationGroupServiceImpl conversationGroupService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO) {
|
||||
public List<ConversationGroupVO> queryList(ConversationGroupQueryVO queryVO, @RequestAttribute AccountVO user) {
|
||||
queryVO.setUserId(user.getId());
|
||||
return conversationGroupService.queryList(queryVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page/users")
|
||||
public PageVO<ConversationGroupVO> pagingQuery(ConversationGroupQueryVO queryVO, @RequestAttribute AccountVO user) {
|
||||
queryVO.setUserId(user.getId());
|
||||
return conversationGroupService.pagingQuery(queryVO, user);
|
||||
}
|
||||
|
||||
@ -41,9 +43,9 @@ public class ConversationGroupController {
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/data")
|
||||
public String update(@PathVariable Long id, @RequestBody ConversationGroupVO vo) {
|
||||
public String update(@PathVariable Long id, @RequestBody ConversationGroupVO vo, @RequestAttribute AccountVO user) {
|
||||
vo.setId(id);
|
||||
return conversationGroupService.update(vo);
|
||||
return conversationGroupService.update(vo, user);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ -55,7 +57,7 @@ public class ConversationGroupController {
|
||||
* 检查群组名是否存在
|
||||
*/
|
||||
@GetMapping("/checkName")
|
||||
public boolean checkName(Long id, String name, Long mapId){
|
||||
return conversationGroupService.checkNameNotExist(id, name, mapId);
|
||||
public boolean checkName(Long id, String name, Long mapId, @RequestAttribute AccountVO user){
|
||||
return conversationGroupService.checkNameNotExist(id, name, mapId, user.getId());
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public interface ConversationGroupService {
|
||||
* 更新群组信息
|
||||
* @param vo 群组信息
|
||||
*/
|
||||
String update(ConversationGroupVO vo);
|
||||
String update(ConversationGroupVO vo, AccountVO user);
|
||||
|
||||
/**
|
||||
* 删除群组信息
|
||||
@ -61,19 +61,18 @@ public interface ConversationGroupService {
|
||||
void delete(Long id);
|
||||
|
||||
/**
|
||||
* 通过地图获取会话群组信息
|
||||
*
|
||||
* @param mapId 地图信息
|
||||
* @return 群组列表
|
||||
* 删除群组根据地图信息
|
||||
* @param mapId 地图ID
|
||||
*/
|
||||
List<ConversationGroupVO> getConversationGroupByMapId(Long mapId);
|
||||
void deleteByMapId(Long mapId);
|
||||
|
||||
/**
|
||||
* 检查本地图下群组名是否不存在
|
||||
* @param id 群组ID(编辑时存在)
|
||||
* @param name 群组名称
|
||||
* @param mapId 地图ID
|
||||
* @param userId 用户ID
|
||||
* @return 是否存在
|
||||
*/
|
||||
boolean checkNameNotExist(Long id, String name, Long mapId);
|
||||
boolean checkNameNotExist(Long id, String name, Long mapId, Long userId);
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ public class ConversationGroupServiceImpl implements ConversationGroupService {
|
||||
@Override
|
||||
public String create(ConversationGroupVO vo, AccountVO user) {
|
||||
if (vo.getId() != null) {
|
||||
return update(vo);
|
||||
return update(vo, user);
|
||||
} else {
|
||||
if (checkNameNotExist(null, vo.getName(), vo.getMapId())) {
|
||||
if (checkNameNotExist(null, vo.getName(), vo.getMapId(), user.getId())) {
|
||||
throw new IllegalArgumentException("名称已存在");
|
||||
}
|
||||
RtsConversationGroupInfo rtsConversationGroupInfo = vo.toEntity();
|
||||
@ -75,8 +75,8 @@ public class ConversationGroupServiceImpl implements ConversationGroupService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String update(ConversationGroupVO vo) {
|
||||
if (vo.getId() != null && !checkNameNotExist(vo.getId(), vo.getName(), vo.getMapId())) {
|
||||
public String update(ConversationGroupVO vo, AccountVO user) {
|
||||
if (vo.getId() != null && !checkNameNotExist(vo.getId(), vo.getName(), vo.getMapId(), user.getId())) {
|
||||
RtsConversationGroupInfo rtsConversationGroupInfo = vo.toEntity();
|
||||
rtsConversationGroupInfo.setUpdateTime(LocalDateTime.now());
|
||||
conversationGroupInfoMapper.updateByPrimaryKeySelective(rtsConversationGroupInfo);
|
||||
@ -92,10 +92,10 @@ public class ConversationGroupServiceImpl implements ConversationGroupService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConversationGroupVO> getConversationGroupByMapId(Long mapId) {
|
||||
ConversationGroupQueryVO queryVO = new ConversationGroupQueryVO();
|
||||
queryVO.setMapIds(Arrays.asList(mapId));
|
||||
return queryList(queryVO);
|
||||
public void deleteByMapId(Long mapId) {
|
||||
RtsConversationGroupInfoExample example = new RtsConversationGroupInfoExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
conversationGroupInfoMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ public class ConversationGroupServiceImpl implements ConversationGroupService {
|
||||
* @return 存在结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkNameNotExist(Long id, String name, Long mapId) {
|
||||
public boolean checkNameNotExist(Long id, String name, Long mapId, Long userId) {
|
||||
RtsConversationGroupInfoExample example = new RtsConversationGroupInfoExample();
|
||||
RtsConversationGroupInfoExample.Criteria criteria = example.createCriteria();
|
||||
if (StringUtils.hasText(name)) {
|
||||
@ -118,11 +118,11 @@ public class ConversationGroupServiceImpl implements ConversationGroupService {
|
||||
if (id != null) {
|
||||
criteria.andMapIdNotEqualTo(id);
|
||||
}
|
||||
criteria.andCreatorIdEqualTo(userId);
|
||||
criteria.andStatusEqualTo(VALID);
|
||||
return CollectionUtils.isEmpty(conversationGroupInfoMapper.selectByExampleWithBLOBs(example));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
@ -135,12 +135,13 @@ public class ConversationGroupServiceImpl implements ConversationGroupService {
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(queryVO.getMapIds())) {
|
||||
criteria.andMapIdIn(queryVO.getMapIds());
|
||||
if (queryVO.getMapId() != null) {
|
||||
criteria.andMapIdEqualTo(queryVO.getMapId());
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getProjectCode())) {
|
||||
criteria.andProjectCodeEqualTo(queryVO.getProjectCode());
|
||||
}
|
||||
criteria.andCreatorIdEqualTo(queryVO.getUserId());
|
||||
criteria.andStatusEqualTo(VALID);
|
||||
return example;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.services.voice.discriminate;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroupHandlerService;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
@ -42,6 +43,9 @@ public class VoiceDiscriminateService {
|
||||
@Qualifier(value = "correctSourceServiceImpl")
|
||||
private VoiceTransactionalService correctSourceService;
|
||||
|
||||
@Autowired
|
||||
private ConversationGroupHandlerService conversationGroupManagerService;
|
||||
|
||||
/**
|
||||
* 接受语音文件、资源等必要条件,解析开始
|
||||
*/
|
||||
@ -87,7 +91,9 @@ public class VoiceDiscriminateService {
|
||||
if (CollectionUtils.isEmpty(memberList)) { // 人员全部为真实人员时直接返回
|
||||
return;
|
||||
}
|
||||
// 增加机器人已读操作
|
||||
memberList.forEach(m -> conversationGroupManagerService.readConversationGroup(event.getSimulation(), m, conversationGroup.getId()));
|
||||
// 执行语音识别
|
||||
doAnalysis(event.getSimulation(), event.getContent(), memberList);
|
||||
doAnalysis(event.getSimulation(), event.getMessage().getContent(), memberList);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import club.joylink.rtss.services.conversation.ConversationGroupService;
|
||||
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
|
||||
import club.joylink.rtss.services.permission.PermissionSubjectService;
|
||||
import club.joylink.rtss.simulation.SimulationManager;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
|
||||
import club.joylink.rtss.simulation.cbtc.discriminate.IVoiceDiscriminateRule;
|
||||
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateRule;
|
||||
@ -75,9 +76,6 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
@Autowired
|
||||
private IVoiceDiscriminateRule discriminateRule;
|
||||
|
||||
@Autowired
|
||||
private ConversationGroupService conversationGroupService;
|
||||
|
||||
@Override
|
||||
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType) {
|
||||
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO, createUserType).getId();
|
||||
@ -380,8 +378,9 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
* @param simulation 仿真对象
|
||||
*/
|
||||
private void initConversationGroup(Simulation simulation) {
|
||||
List<ConversationGroupVO> conversationGroupVOList =
|
||||
conversationGroupService.getConversationGroupByMapId(simulation.getBuildParams().getMap().getId());
|
||||
SimulationBuildParams buildParams = simulation.getBuildParams();
|
||||
List<ConversationGroupVO> conversationGroupVOList = buildParams.getMap().getGraphDataNew()
|
||||
.getConversationGroupMap().get(buildParams.getWorkParamVO().getType());
|
||||
if (CollectionUtils.isEmpty(conversationGroupVOList)) {
|
||||
return;
|
||||
}
|
||||
|
@ -273,13 +273,16 @@ public class ConversationGroupHandlerService {
|
||||
if (CollectionUtils.isEmpty(messageList)) {
|
||||
return List.of();
|
||||
}
|
||||
int memberSize = conversationGroup.getMemberList().size();
|
||||
List<String> memberIds = conversationGroup.getSimulationMemberIds();
|
||||
messageList.forEach(message -> {
|
||||
message.read(member);
|
||||
if (message.getReaderSet().size() >= memberSize) { // 全部用户已读
|
||||
if (memberIds.stream()
|
||||
.filter(mid -> !Objects.equals(message.getMember().getId(), mid))
|
||||
.allMatch(mid -> message.getReaderSet().contains(mid))) { // 除发送用户外全部已读
|
||||
message.finishRead();
|
||||
}
|
||||
});
|
||||
applicationEventPublisher.publishEvent(new SimulationConversationGroupMessageStatusEvent(this, simulation, conversationGroup, messageList));
|
||||
return ConversationGroupMessageVO.convert2VO(messageList);
|
||||
}
|
||||
|
||||
@ -406,6 +409,20 @@ public class ConversationGroupHandlerService {
|
||||
doSendMessage(event.getSimulation(), userIdSet, exitMessageVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理消息状态
|
||||
* @param event
|
||||
*/
|
||||
@EventListener
|
||||
public void handleMessageStatus(SimulationConversationGroupMessageStatusEvent event) {
|
||||
ConversationGroup conversationGroup = event.getConversationGroup();
|
||||
event.getMessageList().stream().filter(m -> !m.getMember().isRobot()).forEach(message -> {
|
||||
ConversationGroupSocketMessageVO messageStatusVO
|
||||
= ConversationGroupSocketMessageVO.MessageType.MESSAGE_STATUS.generateMessageVO(conversationGroup, new ConversationGroupMessageVO(message));
|
||||
doSendMessage(event.getSimulation(), Set.of(message.getMember().getUserId()), messageStatusVO);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 对群组操作时基础判断
|
||||
*
|
||||
@ -454,7 +471,7 @@ public class ConversationGroupHandlerService {
|
||||
doSendMessage(simulation, userIdSet, ConversationGroupSocketMessageVO.MessageType.MESSAGE.generateMessageVO(conversationGroup, messageVO));
|
||||
}
|
||||
// 语音识别开始
|
||||
applicationEventPublisher.publishEvent(new SimulationConversationGroupMessageEvent(this, simulation, conversationGroup, member, message.getContent()));
|
||||
applicationEventPublisher.publishEvent(new SimulationConversationGroupMessageEvent(this, simulation, conversationGroup, member, message));
|
||||
return messageVO;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,12 @@ public class ConversationGroupMessageVO extends ConversationMessageVO {
|
||||
this.allRead = message.isAllRead();
|
||||
}
|
||||
|
||||
public ConversationGroupMessageVO(String id, Set<String> readerSet, boolean allRead) {
|
||||
setId(id);
|
||||
this.readerSet = readerSet;
|
||||
this.allRead = allRead;
|
||||
}
|
||||
|
||||
public static List<ConversationGroupMessageVO> convert2VO(List<ConversationGroupMessage> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return List.of();
|
||||
|
@ -110,6 +110,17 @@ public class ConversationGroupSocketMessageVO {
|
||||
return messageVO;
|
||||
}
|
||||
},
|
||||
/** 更新消息状态 */
|
||||
MESSAGE_STATUS {
|
||||
@Override
|
||||
public ConversationGroupSocketMessageVO generateMessageVO(ConversationGroup group, ConversationGroupMessageVO message) {
|
||||
ConversationGroupSocketMessageVO messageVO = new ConversationGroupSocketMessageVO();
|
||||
messageVO.id = group.getId();
|
||||
messageVO.message = new ConversationGroupMessageVO(message.getId(), message.getReaderSet(), message.isAllRead());
|
||||
messageVO.messageType = MessageType.MESSAGE_STATUS;
|
||||
return messageVO;
|
||||
}
|
||||
},
|
||||
/** 会话组解散 */
|
||||
EXIT {
|
||||
@Override
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.data.vo;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMessage;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@ -11,6 +12,7 @@ import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ConversationMessageVO {
|
||||
|
||||
private String id;
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.event.conversation;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroupMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.event.AbstractSimulationEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import lombok.Getter;
|
||||
@ -25,13 +26,13 @@ public class SimulationConversationGroupMessageEvent extends AbstractSimulationE
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private String content;
|
||||
private ConversationGroupMessage message;
|
||||
|
||||
public SimulationConversationGroupMessageEvent(Object source, Simulation simulation, ConversationGroup conversationGroup
|
||||
, SimulationMember member, String content) {
|
||||
, SimulationMember member, ConversationGroupMessage message) {
|
||||
super(source, simulation);
|
||||
this.conversationGroup = conversationGroup;
|
||||
this.member = member;
|
||||
this.content = content;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package club.joylink.rtss.simulation.cbtc.event.conversation;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroupMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationGroupMessageVO;
|
||||
import club.joylink.rtss.simulation.cbtc.event.AbstractSimulationEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 群组消息状态事件
|
||||
*/
|
||||
@Getter
|
||||
public class SimulationConversationGroupMessageStatusEvent extends AbstractSimulationEvent {
|
||||
|
||||
/**
|
||||
* 会话对象
|
||||
*/
|
||||
private ConversationGroup conversationGroup;
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private List<ConversationGroupMessage> messageList;
|
||||
|
||||
public SimulationConversationGroupMessageStatusEvent(Object source, Simulation simulation
|
||||
, ConversationGroup conversationGroup, List<ConversationGroupMessage> messageList) {
|
||||
super(source, simulation);
|
||||
this.conversationGroup = conversationGroup;
|
||||
this.messageList = messageList;
|
||||
}
|
||||
}
|
@ -25,5 +25,10 @@ public class ConversationGroupQueryVO extends PageQueryVO {
|
||||
/**
|
||||
* 地图ID
|
||||
*/
|
||||
private List<Long> mapIds;
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.vo.map;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.conversation.ConversationGroupVO;
|
||||
import club.joylink.rtss.vo.map.display.PictureVO;
|
||||
import club.joylink.rtss.vo.map.graph.*;
|
||||
import lombok.Getter;
|
||||
@ -243,6 +244,11 @@ public class MapGraphDataNewVO {
|
||||
*/
|
||||
private Map<Simulation.Type, List<MapMemberVO>> memberMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 会话群组列表
|
||||
*/
|
||||
private Map<Simulation.Type, List<ConversationGroupVO>> conversationGroupMap = new HashMap<>();
|
||||
|
||||
public MapGraphDataNewVO() {
|
||||
this.bigScreenConfig = new BigScreenConfig();
|
||||
this.generateConfig = new MapCiGenerateConfig();
|
||||
|
Loading…
Reference in New Issue
Block a user