Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
f77404029b
@ -31,7 +31,7 @@ public class PaperCompositionController {
|
||||
* @return
|
||||
*/
|
||||
@Role(value = RoleEnum.SuperAdmin)
|
||||
@GetMapping(path = "/manage/paging")
|
||||
@PostMapping(path = "/manage/paging")
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionForPage(@RequestBody FindPaperCompositionPageReqVo req) {
|
||||
return this.compositionService.findPaperCompositionByPage(req);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.controller.training2;
|
||||
|
||||
import club.joylink.rtss.services.training2.Training2PublishService;
|
||||
import club.joylink.rtss.services.training2.Training2TypeEnum;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.training2.publish.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -47,20 +48,31 @@ public class TrainingV2PublishController {
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(@RequestBody DeletePublishedTraining2ReqVo req){
|
||||
return this.publishService.deletePublishedTrainings(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mapId查所有的已发布单操实训的基础信息
|
||||
*/
|
||||
@GetMapping("/{mapId}/singles")
|
||||
public List<PublishedTraining2InfoRspVo> findAllSingleTrainingBasicInfo(@PathVariable("mapId") Long mapId){
|
||||
public List<PublishedTraining2InfoRspVo> findSingleTrainingBasicInfo(@PathVariable("mapId") Long mapId){
|
||||
return this.publishService.findAllSingleTrainingBasicInfoByMapId(mapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mapId查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@GetMapping("/{mapId}/scenes")
|
||||
public List<PublishedTraining2InfoRspVo> findAllSceneTrainingBasicInfo(@PathVariable("mapId") Long mapId){
|
||||
public List<PublishedTraining2InfoRspVo> findSceneTrainingBasicInfo(@PathVariable("mapId") Long mapId){
|
||||
return this.publishService.findAllSceneTrainingBasicInfoByMapId(mapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingList(Long mapId,Training2TypeEnum type){
|
||||
return this.publishService.findTrainingInfo(mapId, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据实训id查该已发布实训的所有信息
|
||||
*/
|
||||
|
@ -394,76 +394,6 @@ public class ProjectExample {
|
||||
addCriterion("`status` not between", value1, value2, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowIsNull() {
|
||||
addCriterion("`view_show` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowIsNotNull() {
|
||||
addCriterion("`view_show` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowEqualTo(Integer value) {
|
||||
addCriterion("`view_show` =", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowNotEqualTo(Integer value) {
|
||||
addCriterion("`view_show` <>", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowGreaterThan(Integer value) {
|
||||
addCriterion("`view_show` >", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("`view_show` >=", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowLessThan(Integer value) {
|
||||
addCriterion("`view_show` <", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("`view_show` <=", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowLike(Integer value) {
|
||||
addCriterion("`view_show` like", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowNotLike(Integer value) {
|
||||
addCriterion("`view_show` not like", value, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowIn(List<Integer> values) {
|
||||
addCriterion("`view_show` in", values, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowNotIn(List<Integer> values) {
|
||||
addCriterion("`view_show` not in", values, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`view_show` between", value1, value2, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewShowNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`view_show` not between", value1, value2, "viewShow");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,6 @@ public class OrgUserManageService {
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
example.setLimit(10);
|
||||
List<SysAccount> sysAccounts = sysAccountDAO.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(sysAccounts)) {
|
||||
return new ArrayList<>();
|
||||
|
@ -19,6 +19,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 已发布实训管理业务实现
|
||||
@ -202,18 +203,7 @@ public class Training2PublishService {
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PublishedTraining2InfoRspVo> findAllSingleTrainingBasicInfoByMapId(Long mapId) {
|
||||
List<PublishedTraining2InfoRspVo> rsp = new ArrayList<>();
|
||||
//
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andTypeEqualTo(Training2TypeEnum.single.value());
|
||||
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(p -> {
|
||||
rsp.add(Training2Convertor.convertFrom(p));
|
||||
});
|
||||
}
|
||||
//
|
||||
return rsp;
|
||||
return findTrainingInfo(mapId, Training2TypeEnum.single);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,18 +211,28 @@ public class Training2PublishService {
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PublishedTraining2InfoRspVo> findAllSceneTrainingBasicInfoByMapId(Long mapId) {
|
||||
List<PublishedTraining2InfoRspVo> rsp = new ArrayList<>();
|
||||
//
|
||||
return findTrainingInfo(mapId, Training2TypeEnum.scene);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据地图ID和类型查询实训列表
|
||||
*/
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingInfo(Long mapId, Training2TypeEnum type) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andTypeEqualTo(Training2TypeEnum.scene.value());
|
||||
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(p -> {
|
||||
rsp.add(Training2Convertor.convertFrom(p));
|
||||
});
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
if (mapId != null) {
|
||||
criteria.andMapIdEqualTo(mapId);
|
||||
}
|
||||
if (type != null) {
|
||||
criteria.andTypeEqualTo(type.value());
|
||||
}
|
||||
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return List.of();
|
||||
} else {
|
||||
return list.stream().map(Training2Convertor::convertFrom).collect(Collectors.toList());
|
||||
}
|
||||
//
|
||||
return rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,59 +0,0 @@
|
||||
package club.joylink.rtss.websocket.client;
|
||||
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.util.test.LogTest;
|
||||
import club.joylink.rtss.vo.ws.TrainPosition;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.messaging.simp.stomp.StompFrameHandler;
|
||||
import org.springframework.messaging.simp.stomp.StompHeaders;
|
||||
import org.springframework.messaging.simp.stomp.StompSession;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
|
||||
import org.springframework.web.socket.messaging.WebSocketStompClient;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
public class StompClientManager2 {
|
||||
|
||||
public static void main(String[] args) throws ExecutionException, InterruptedException {
|
||||
StandardWebSocketClient socketClient = new StandardWebSocketClient();
|
||||
WebSocketStompClient stompClient = new WebSocketStompClient(socketClient);
|
||||
SimulationSessionHandler handler = new SimulationSessionHandler();
|
||||
ListenableFuture<StompSession> future = stompClient
|
||||
.connect("ws://127.0.0.1:9000/joylink-websocket?token=6a8dbf62d3683844a6aa722b73b989f1",handler, "null");
|
||||
StompSession stompSession = future.get();
|
||||
stompSession.subscribe("/topic/yjddzh/trainPosition", new StompFrameHandler() {
|
||||
@Override
|
||||
public Type getPayloadType(StompHeaders stompHeaders) {
|
||||
return byte[].class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFrame(StompHeaders stompHeaders, Object o) {
|
||||
String recv=null;
|
||||
try {
|
||||
recv = new String((byte[]) o,"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(recv);
|
||||
}
|
||||
});
|
||||
stompSession.setAutoReceipt(true);
|
||||
TimeUnit.SECONDS.sleep(100);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -275,7 +275,7 @@
|
||||
FROM org_user os
|
||||
LEFT JOIN org o ON o.id = os.org_id
|
||||
LEFT JOIN org ro ON o.root_id = ro.id
|
||||
WHERE os.user_id = #{userId}
|
||||
WHERE os.user_id = #{userId} and o.status = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package club.joylink.rtss.util.test;
|
||||
package club.joylink.rtss.services.ws;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
@ -16,14 +16,12 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LogTest {
|
||||
|
||||
|
||||
public class EnvLoggerFileTest {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
LogTest lt = new LogTest();
|
||||
EnvLoggerFileTest lt = new EnvLoggerFileTest();
|
||||
List<TrainPosition> list = lt.readFile("d:\\spring.log2");
|
||||
// lt.query(list,"024");
|
||||
list = lt.query(list,"015",Section.SectionRoadType.RIGHT);
|
||||
list = lt.query(list,"015", Section.SectionRoadType.RIGHT);
|
||||
for (TrainPosition tp : list) {
|
||||
System.out.println(tp.dateFormat() + " --->" + tp.toString());
|
||||
}
|
||||
@ -52,7 +50,7 @@ public class LogTest {
|
||||
return newList;
|
||||
}
|
||||
public List<TrainPosition> query(List<TrainPosition> list, String groupNum, Section.SectionRoadType roadType){
|
||||
List<TrainPosition> newList = list.stream().filter(d->Objects.equals(d.getGroupNum(),groupNum) && d.getRoadType() == roadType ).sorted(Comparator.comparing(TrainPosition::getReceiveTime)).collect(Collectors.toList());
|
||||
List<TrainPosition> newList = list.stream().filter(d-> Objects.equals(d.getGroupNum(),groupNum) && d.getRoadType() == roadType ).sorted(Comparator.comparing(TrainPosition::getReceiveTime)).collect(Collectors.toList());
|
||||
return newList;
|
||||
}
|
||||
public List<TrainPosition> query(List<TrainPosition> list,String groupNum){
|
@ -1,18 +1,19 @@
|
||||
package club.joylink.rtss.websocket.client;
|
||||
package club.joylink.rtss.services.ws;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
|
||||
import club.joylink.rtss.util.test.LogTest;
|
||||
import club.joylink.rtss.vo.ws.TrainPosition;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import club.joylink.rtss.websocket.client.SimulationSessionHandler;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.messaging.simp.stomp.StompFrameHandler;
|
||||
import org.springframework.messaging.simp.stomp.StompHeaders;
|
||||
import org.springframework.messaging.simp.stomp.StompSession;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
|
||||
import org.springframework.web.socket.messaging.WebSocketStompClient;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
@ -24,28 +25,66 @@ import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
public class StompClientManager {
|
||||
|
||||
// private static final Map<String, StompClientSupport> stompClientMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static void main(String[] args) throws ExecutionException, InterruptedException {
|
||||
public class StompTest {
|
||||
@Test
|
||||
public void sendMsg(){
|
||||
StandardWebSocketClient socketClient = new StandardWebSocketClient();
|
||||
WebSocketStompClient stompClient = new WebSocketStompClient(socketClient);
|
||||
SimulationSessionHandler handler = new SimulationSessionHandler();
|
||||
ListenableFuture<StompSession> future = stompClient
|
||||
.connect("ws://127.0.0.1:9000/joylink-tbi-websocket?user_account=train_place&account_pwd=train_place",handler, "null");
|
||||
StompSession stompSession = future.get();
|
||||
LogTest lt = new LogTest();
|
||||
StompSession stompSession = null;
|
||||
try {
|
||||
stompSession = future.get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
EnvLoggerFileTest lt = new EnvLoggerFileTest();
|
||||
List<TrainPosition> list = lt.readFile("d:\\spring.log2");
|
||||
// List<TrainPosition> list = lt.readSource("d:\\t.txt");
|
||||
// runToLeft(stompSession,"001");
|
||||
// runToRight(stompSession,"002");
|
||||
list = lt.query(list,"004",Section.SectionRoadType.LEFT);
|
||||
list = lt.query(list,"004", Section.SectionRoadType.LEFT);
|
||||
// list = lt.query(list, Lists.newArrayList("015","037"), Section.SectionRoadType.RIGHT);
|
||||
send(stompSession,list);
|
||||
}
|
||||
@Test
|
||||
public void subscribe(){
|
||||
StandardWebSocketClient socketClient = new StandardWebSocketClient();
|
||||
WebSocketStompClient stompClient = new WebSocketStompClient(socketClient);
|
||||
SimulationSessionHandler handler = new SimulationSessionHandler();
|
||||
ListenableFuture<StompSession> future = stompClient
|
||||
.connect("ws://127.0.0.1:9000/joylink-websocket?token=6a8dbf62d3683844a6aa722b73b989f1",handler, "null");
|
||||
StompSession stompSession = null;
|
||||
try {
|
||||
stompSession = future.get();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
stompSession.subscribe("/topic/yjddzh/trainPosition", new StompFrameHandler() {
|
||||
@Override
|
||||
public Type getPayloadType(StompHeaders stompHeaders) {
|
||||
return byte[].class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFrame(StompHeaders stompHeaders, Object o) {
|
||||
String recv=null;
|
||||
try {
|
||||
recv = new String((byte[]) o,"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(recv);
|
||||
}
|
||||
});
|
||||
stompSession.setAutoReceipt(true);
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void send(StompSession stompSession,List<TrainPosition> list){
|
||||
|
||||
for (int i = 25; i < list.size(); i++) {
|
||||
@ -118,5 +157,4 @@ public class StompClientManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user