Merge remote-tracking branch 'origin/test'
This commit is contained in:
commit
6b30e5c066
|
@ -4,7 +4,9 @@ import club.joylink.rtss.constants.BusinessConsts;
|
|||
import club.joylink.rtss.constants.RoleEnum;
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.controller.advice.Role;
|
||||
import club.joylink.rtss.entity.training2.ExportTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import club.joylink.rtss.services.training2.Training2PublishService;
|
||||
import club.joylink.rtss.services.training2.Training2TypeEnum;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
|
@ -123,4 +125,23 @@ public class TrainingV2PublishController {
|
|||
public void updateTrainingLabelList(@RequestBody List<PublishedTraining2> publishedTraining2List) {
|
||||
publishService.updateTrainingLabelList(publishedTraining2List);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出所选实训
|
||||
* @param tidList 实训ID列表
|
||||
* @return 实训详情信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public List<ExportTraining2> exportTraining(@RequestBody List<Long> tidList) {
|
||||
return publishService.exportTraining(tidList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训信息
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList, @RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return publishService.importTraining(trainingList, userInfoVO);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package club.joylink.rtss.entity.training2;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导出实训数据格式
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ExportTraining2 {
|
||||
/**
|
||||
* 地图名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 线路编码
|
||||
*/
|
||||
private String lineCode;
|
||||
|
||||
/**
|
||||
* 实训列表
|
||||
*/
|
||||
private List<PublishedTraining2WithBLOBs> list;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.entity.MapInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
|
@ -381,4 +382,19 @@ public interface IMapService {
|
|||
* @return 客户端列表
|
||||
*/
|
||||
Map<Simulation.Type, List<MapClientVO>> queryMapClientMap(long mapId);
|
||||
|
||||
/**
|
||||
* 获取地图基本信息
|
||||
* @param idList 地图ID列表
|
||||
* @return 地图基本信息列表
|
||||
*/
|
||||
List<MapInfo> queryMapInfoList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 根据地图名称、地图线路编号获取基本信息
|
||||
* @param name 地图名称
|
||||
* @param lineCode 线路编号
|
||||
* @return 地图基本信息
|
||||
*/
|
||||
List<MapInfo> queryMapInfo(String name, String lineCode);
|
||||
}
|
||||
|
|
|
@ -958,6 +958,20 @@ public class MapService implements IMapService, ApplicationRunner {
|
|||
return mapDetail.getGraphDataNew().getMapClientVOMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapInfo> queryMapInfoList(List<Long> idList) {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria().andIdIn(idList).andStatusEqualTo("1");
|
||||
return mapInfoDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapInfo> queryMapInfo(String name, String lineCode) {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria().andNameEqualTo(name).andLineCodeEqualTo(lineCode).andStatusEqualTo("1");
|
||||
return mapInfoDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 该版本的地图数据是否存在
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,8 @@ package club.joylink.rtss.services.training2;
|
|||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.PublishedTraining2DAO;
|
||||
import club.joylink.rtss.entity.MapInfo;
|
||||
import club.joylink.rtss.entity.training2.ExportTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
|
@ -37,6 +39,7 @@ public class Training2PublishService {
|
|||
private PublishedTraining2DAO publishedDao;
|
||||
@Autowired
|
||||
private IMapService mapService;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2 findById(Long id) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
|
@ -457,4 +460,56 @@ public class Training2PublishService {
|
|||
blobs.setLabelJson(training2.getLabelJson());
|
||||
publishedDao.updateByPrimaryKeySelective(blobs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出实训信息
|
||||
* @param tidList 实训列表
|
||||
* @return 实训列表
|
||||
*/
|
||||
public List<ExportTraining2> exportTraining(List<Long> tidList) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andIdIn(tidList);
|
||||
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(example);
|
||||
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream().peek(t -> {
|
||||
t.setId(null);
|
||||
t.setUpdateTime(null);
|
||||
t.setCreateTime(null);
|
||||
}).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId));
|
||||
// 地图基本信息列表
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfoList(new ArrayList<>(mapTrainingMap.keySet()));
|
||||
Map<Long, MapInfo> mapInfoMap = mapInfoList.stream().collect(Collectors.toMap(MapInfo::getId, m -> m, (o,n) -> n));
|
||||
List<ExportTraining2> exportTraining2List = new ArrayList<>(mapTrainingMap.size());
|
||||
mapInfoMap.forEach((k, v) -> {
|
||||
ExportTraining2 exportData = new ExportTraining2();
|
||||
exportData.setName(v.getName());
|
||||
exportData.setLineCode(v.getLineCode());
|
||||
exportData.setList(mapTrainingMap.get(k));
|
||||
exportTraining2List.add(exportData);
|
||||
});
|
||||
return exportTraining2List;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训接口
|
||||
* @param trainingList 实训列表
|
||||
*/
|
||||
public List<String> importTraining(List<ExportTraining2> trainingList, LoginUserInfoVO userInfoVO) {
|
||||
List<String> msgList = new ArrayList<>();
|
||||
trainingList.forEach(t -> {
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfo(t.getName(), t.getLineCode());
|
||||
if (mapInfoList.size() == 1) {
|
||||
Long mapId = mapInfoList.get(0).getId();
|
||||
t.getList().forEach(training -> {
|
||||
training.setMapId(mapId);
|
||||
training.setCreatorId(userInfoVO.getAccountVO().getId());
|
||||
training.setCreateTime(LocalDateTime.now());
|
||||
});
|
||||
publishedDao.insertList(t.getList());
|
||||
msgList.add(String.format("地图【%s】实训信息导入成功", t.getName()));
|
||||
} else {
|
||||
msgList.add(String.format("地图【%s】实训信息导入失败", t.getName()));
|
||||
}
|
||||
});
|
||||
return msgList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
|
|||
/**
|
||||
* 电力工务
|
||||
*/
|
||||
STATION_ELECTRIC_WORKER(Area.STATION, "电力工务"),
|
||||
STATION_ELECTRIC_WORKER(Area.STATION, "电务"),
|
||||
|
||||
NCC_DISPATCHER(Area.NCC, "NCC调度员"),
|
||||
|
||||
|
|
Loading…
Reference in New Issue