Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
fdd51383f4
9
sql/20201229-zhangsai.sql
Normal file
9
sql/20201229-zhangsai.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
alter table iscs drop key line_code_station_code_total_system_system_interface;
|
||||||
|
|
||||||
|
alter table iscs drop column line_code;
|
||||||
|
|
||||||
|
alter table iscs drop column station_code;
|
||||||
|
|
||||||
|
alter table iscs
|
||||||
|
add map_id bigint not null after id;
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
package club.joylink.rtss.configuration.configProp;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix="spring.mail")
|
||||||
|
public class MailConfig {
|
||||||
|
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,10 +5,7 @@ import club.joylink.rtss.services.ILearnService;
|
|||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
|
import club.joylink.rtss.vo.client.learn.*;
|
||||||
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
|
|
||||||
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
|
|
||||||
import club.joylink.rtss.vo.client.learn.LearnPostVO;
|
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
||||||
@ -49,6 +46,13 @@ public class LearnController {
|
|||||||
return iLearnService.createPost(createVO, user);
|
return iLearnService.createPost(createVO, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("编辑留言板基础信息")
|
||||||
|
@PutMapping("/{postId}")
|
||||||
|
public void updatePost(@PathVariable Long postId, @RequestBody @Validated LearnPostUpdateVO updateVO,
|
||||||
|
@RequestAttribute UserVO user) {
|
||||||
|
iLearnService.updatePost(postId, updateVO, user);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取帖子信息")
|
@ApiOperation(value = "获取帖子信息")
|
||||||
@GetMapping(path = "/{postId}")
|
@GetMapping(path = "/{postId}")
|
||||||
public LearnPostVO getPostInfo(@PathVariable Long postId) {
|
public LearnPostVO getPostInfo(@PathVariable Long postId) {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package club.joylink.rtss.controller.competition;
|
package club.joylink.rtss.controller.competition;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonView;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
|
||||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||||
import club.joylink.rtss.services.completition.ICompetitionPracticalService;
|
import club.joylink.rtss.services.completition.ICompetitionPracticalService;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
@ -12,8 +11,10 @@ import club.joylink.rtss.vo.client.competition.CompetitionPagedQueryVO;
|
|||||||
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
||||||
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
||||||
|
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||||
import club.joylink.rtss.vo.client.validGroup.competition.CompetitionUpdateCheck;
|
import club.joylink.rtss.vo.client.validGroup.competition.CompetitionUpdateCheck;
|
||||||
import club.joylink.rtss.vo.view.OperationStatisticAnswerView;
|
import club.joylink.rtss.vo.view.OperationStatisticAnswerView;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonView;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -88,6 +89,18 @@ public class CompetitionPracticalController {
|
|||||||
iCompetitionPracticalService.importFromJson(scriptId, name, competition);
|
iCompetitionPracticalService.importFromJson(scriptId, name, competition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询权限")
|
||||||
|
@GetMapping("/query/permissions")
|
||||||
|
public UserPermissionVO queryPermissions(Long mapId, @RequestAttribute UserVO user) {
|
||||||
|
return iCompetitionPracticalService.queryPermissions(mapId, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("购买权限")
|
||||||
|
@PostMapping("/purchasePermission")
|
||||||
|
public String purchasePermission(Long mapId, Long amount, @RequestAttribute UserVO user) {
|
||||||
|
return iCompetitionPracticalService.purchasePermission(mapId, amount, user);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------- 竞赛运行相关 ------------------------- */
|
/* ------------------------- 竞赛运行相关 ------------------------- */
|
||||||
@ApiOperation("加载竞赛场景")
|
@ApiOperation("加载竞赛场景")
|
||||||
@PutMapping("/load/{group}/{id}")
|
@PutMapping("/load/{group}/{id}")
|
||||||
|
@ -2,11 +2,15 @@ package club.joylink.rtss.controller.iscs;
|
|||||||
|
|
||||||
import club.joylink.rtss.services.IIscsService;
|
import club.joylink.rtss.services.IIscsService;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.client.iscs.IscsCopyVO;
|
||||||
|
import club.joylink.rtss.vo.client.iscs.IscsQueryVO;
|
||||||
import club.joylink.rtss.vo.client.iscs.IscsVO;
|
import club.joylink.rtss.vo.client.iscs.IscsVO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
@ -19,6 +23,12 @@ public class IscsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IIscsService iscsService;
|
private IIscsService iscsService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询iscs数据")
|
||||||
|
@GetMapping("/pagedQuery")
|
||||||
|
public PageVO<IscsVO> pagedQuery(IscsQueryVO queryVO) {
|
||||||
|
return iscsService.pagedQuery(queryVO);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存地图元素信息
|
* 保存地图元素信息
|
||||||
*/
|
*/
|
||||||
@ -34,4 +44,22 @@ public class IscsController {
|
|||||||
return this.iscsService.getIscsDataBy(iscsVO);
|
return this.iscsService.getIscsDataBy(iscsVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除iscs数据")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public void delete(@PathVariable Integer id) {
|
||||||
|
iscsService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("地图是否有iscs数据")
|
||||||
|
@GetMapping("hasData")
|
||||||
|
public boolean isExisted(Long mapId) {
|
||||||
|
return iscsService.isExistedWithMapId(mapId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("复制iscs数据")
|
||||||
|
@PostMapping("/copy")
|
||||||
|
public void copy(@RequestBody @Validated IscsCopyVO copyVO) {
|
||||||
|
iscsService.copy(copyVO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class GoodsController {
|
|||||||
@ApiOperation(value = "查询商品详情")
|
@ApiOperation(value = "查询商品详情")
|
||||||
@GetMapping(path = "/{id}")
|
@GetMapping(path = "/{id}")
|
||||||
public GoodsVO selectById(@PathVariable long id) {
|
public GoodsVO selectById(@PathVariable long id) {
|
||||||
return iGoodsService.selectById(id);
|
return iGoodsService.queryById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取有效商品列表")
|
@ApiOperation(value = "获取有效商品列表")
|
||||||
@ -100,7 +100,7 @@ public class GoodsController {
|
|||||||
@ApiOperation(value = "根据权限id查询商品")
|
@ApiOperation(value = "根据权限id查询商品")
|
||||||
@GetMapping(path = "/permissionId")
|
@GetMapping(path = "/permissionId")
|
||||||
public GoodsVO selectGoodsByPermissionId(Long permissionId) {
|
public GoodsVO selectGoodsByPermissionId(Long permissionId) {
|
||||||
return iGoodsService.selectGoodsByPermissionId(permissionId);
|
return iGoodsService.queryGoodsByPermissionId(permissionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "根据权限ids查询权限包商品")
|
@ApiOperation(value = "根据权限ids查询权限包商品")
|
||||||
|
@ -181,4 +181,10 @@ public class DeviceController {
|
|||||||
UserVO userVO) {
|
UserVO userVO) {
|
||||||
this.deviceService.addOrUpdateGzbDeviceConfig(userVO);
|
this.deviceService.addOrUpdateGzbDeviceConfig(userVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/sdy/addOrUpdate")
|
||||||
|
public void addOrUpdateSdyDeviceConfig(@ApiIgnore @RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||||
|
UserVO userVO) {
|
||||||
|
this.deviceService.addOrUpdateSdyDeviceConfig(userVO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,7 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Api(value="发布IBP盘数据接口")
|
@Api(value="发布IBP盘数据接口")
|
||||||
@RestController
|
@RestController
|
||||||
@ -22,7 +19,7 @@ public class IbpController {
|
|||||||
private IbpService ibpService;
|
private IbpService ibpService;
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询发布的IBP数据基本信息")
|
@ApiOperation(value = "分页查询发布的IBP数据基本信息")
|
||||||
@GetMapping("/list")
|
@GetMapping("")
|
||||||
public PageVO<IbpVO> pagingQueryIbpList(IbpQueryVO queryVO) {
|
public PageVO<IbpVO> pagingQueryIbpList(IbpQueryVO queryVO) {
|
||||||
return this.ibpService.pagingQueryIbpList(queryVO);
|
return this.ibpService.pagingQueryIbpList(queryVO);
|
||||||
}
|
}
|
||||||
@ -39,4 +36,10 @@ public class IbpController {
|
|||||||
return this.ibpService.getBy(queryVO);
|
return this.ibpService.getBy(queryVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除已发布的ibp数据")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public void delete(@PathVariable Long id) {
|
||||||
|
ibpService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class LessonController {
|
|||||||
@ApiOperation(value = "根据条件获取课程列表")
|
@ApiOperation(value = "根据条件获取课程列表")
|
||||||
@GetMapping(path = "")
|
@GetMapping(path = "")
|
||||||
public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO) {
|
public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO) {
|
||||||
return this.iLessonService.queryLessons(lessonQueryVO);
|
return this.iLessonService.queryValidLessons(lessonQueryVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "根据班级获取关联课程列表")
|
@ApiOperation(value = "根据班级获取关联课程列表")
|
||||||
@ -68,7 +68,7 @@ public class LessonController {
|
|||||||
@ApiOperation(value = "获取课程列表")
|
@ApiOperation(value = "获取课程列表")
|
||||||
@GetMapping(path = "/listOfMap")
|
@GetMapping(path = "/listOfMap")
|
||||||
public List<LessonVO> queryLessonsOfMap(Long mapId) {
|
public List<LessonVO> queryLessonsOfMap(Long mapId) {
|
||||||
return this.iLessonService.queryLessonsOfMap(mapId);
|
return this.iLessonService.queryValidLessonsOfMap(mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "分页获取已发布的课程")
|
@ApiOperation(value = "分页获取已发布的课程")
|
||||||
|
@ -291,4 +291,10 @@ public class MapController {
|
|||||||
public List<String> getMapDataVersion(@PathVariable Long id) {
|
public List<String> getMapDataVersion(@PathVariable Long id) {
|
||||||
return iMapService.getMapDataVersion(id);
|
return iMapService.getMapDataVersion(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询所有地图下的所有车站")
|
||||||
|
@GetMapping("/allStations")
|
||||||
|
public List<MapStationNewVO> getAllStations() {
|
||||||
|
return iMapService.getAllStations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
|
|||||||
import club.joylink.rtss.vo.client.validGroup.RunPlanCreateCheck;
|
import club.joylink.rtss.vo.client.validGroup.RunPlanCreateCheck;
|
||||||
import club.joylink.rtss.vo.client.validGroup.RunPlanNameCheck;
|
import club.joylink.rtss.vo.client.validGroup.RunPlanNameCheck;
|
||||||
import club.joylink.rtss.vo.client.validGroup.ValidList;
|
import club.joylink.rtss.vo.client.validGroup.ValidList;
|
||||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInput;
|
import club.joylink.rtss.vo.runplan.RunPlanInput;
|
||||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInputData;
|
import club.joylink.rtss.vo.runplan.RunPlanInputData;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -84,6 +84,12 @@ public class RunPlanDraftController {
|
|||||||
iRunPlanDraftService.deleteDiagramDraftData(planId, user);
|
iRunPlanDraftService.deleteDiagramDraftData(planId, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除运行图数据")
|
||||||
|
@DeleteMapping(path = "/{planId}/data")
|
||||||
|
public void deleteDraftData(@PathVariable Long planId, @RequestAttribute UserVO user) {
|
||||||
|
iRunPlanDraftService.deleteDraftData(planId, user);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "运行图草稿发布")
|
@ApiOperation(value = "运行图草稿发布")
|
||||||
@PostMapping(path = "/{planId}/publish")
|
@PostMapping(path = "/{planId}/publish")
|
||||||
public List<String> publish(@PathVariable Long planId, @RequestAttribute UserVO user) {
|
public List<String> publish(@PathVariable Long planId, @RequestAttribute UserVO user) {
|
||||||
@ -210,6 +216,15 @@ public class RunPlanDraftController {
|
|||||||
this.iRunPlanDraftService.copyRunPlanService(planId, serviceNumber, serviceConfig, user);
|
this.iRunPlanDraftService.copyRunPlanService(planId, serviceNumber, serviceConfig, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "平移计划")
|
||||||
|
@PutMapping(path = "/{planId}/service/{serviceNumber}/move")
|
||||||
|
public void moveRunPlanService(@PathVariable Long planId,
|
||||||
|
@PathVariable String serviceNumber,
|
||||||
|
@RequestBody RunPlanServiceConfigVO serviceConfig,
|
||||||
|
@ApiIgnore @RequestAttribute UserVO user) {
|
||||||
|
this.iRunPlanDraftService.moveRunPlanService(planId, serviceNumber, serviceConfig, user);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "修改计划号")
|
@ApiOperation(value = "修改计划号")
|
||||||
@PutMapping(path = "/{planId}/service/{serviceNumber}/serviceNumber")
|
@PutMapping(path = "/{planId}/service/{serviceNumber}/serviceNumber")
|
||||||
public void updateRunPlanService(@PathVariable Long planId, @PathVariable String serviceNumber, String newServiceNumber) {
|
public void updateRunPlanService(@PathVariable Long planId, @PathVariable String serviceNumber, String newServiceNumber) {
|
||||||
|
@ -39,6 +39,12 @@ public class RunPlanUserDataController {
|
|||||||
iRunPlanRoutingService.createUserRouting(routingVO);
|
iRunPlanRoutingService.createUserRouting(routingVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "生成通用交路区段数据")
|
||||||
|
@PostMapping(path = "/routing/path/generate")
|
||||||
|
public RunPlanRoutingVO generateUserRoutingPath(@RequestBody @Validated RunPlanRoutingVO routingVO) {
|
||||||
|
return iRunPlanRoutingService.generateUserRouting(routingVO);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "分页获取用户交路")
|
@ApiOperation(value = "分页获取用户交路")
|
||||||
@GetMapping(path = "/{mapId}/routing/page")
|
@GetMapping(path = "/{mapId}/routing/page")
|
||||||
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(@PathVariable Long mapId, RunPlanRoutingQueryVO queryVO, @RequestAttribute UserVO user) {
|
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(@PathVariable Long mapId, RunPlanRoutingQueryVO queryVO, @RequestAttribute UserVO user) {
|
||||||
|
@ -39,13 +39,24 @@ public interface IscsDAO {
|
|||||||
int updateByPrimaryKey(Iscs record);
|
int updateByPrimaryKey(Iscs record);
|
||||||
|
|
||||||
@Insert(value = "<script>" +
|
@Insert(value = "<script>" +
|
||||||
"insert into iscs (id, line_code, station_code, total_system, `system`, user_interface, graph_data) " +
|
"insert into iscs (id, map_id, total_system, `system`, user_interface, graph_data) " +
|
||||||
" values " +
|
" values " +
|
||||||
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
|
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
|
||||||
" (#{entity.id,jdbcType=INTEGER}, #{entity.lineCode,jdbcType=VARCHAR}, #{entity.stationCode,jdbcType=VARCHAR}," +
|
" (#{entity.id,jdbcType=INTEGER}, #{entity.mapId,jdbcType=BIGINT}," +
|
||||||
" #{entity.totalSystem,jdbcType=VARCHAR}, " +
|
" #{entity.totalSystem,jdbcType=VARCHAR}, " +
|
||||||
" #{entity.system,jdbcType=VARCHAR}, #{entity.userInterface,jdbcType=VARCHAR}, #{entity.graphData,jdbcType=LONGVARCHAR})"+
|
" #{entity.system,jdbcType=VARCHAR}, #{entity.userInterface,jdbcType=VARCHAR}, #{entity.graphData,jdbcType=LONGVARCHAR})"+
|
||||||
" </foreach>" +
|
" </foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void batchInsertWithId(@Param("list") List<Iscs> iscsList);
|
void batchInsertWithId(@Param("list") List<Iscs> iscsList);
|
||||||
|
|
||||||
|
@Insert(value = "<script>" +
|
||||||
|
"insert into iscs (map_id, total_system, `system`, user_interface, graph_data) " +
|
||||||
|
" values " +
|
||||||
|
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
|
||||||
|
" (#{entity.mapId,jdbcType=BIGINT}," +
|
||||||
|
" #{entity.totalSystem,jdbcType=VARCHAR}, " +
|
||||||
|
" #{entity.system,jdbcType=VARCHAR}, #{entity.userInterface,jdbcType=VARCHAR}, #{entity.graphData,jdbcType=LONGVARCHAR})"+
|
||||||
|
" </foreach>" +
|
||||||
|
"</script>")
|
||||||
|
void batchInsert(@Param("list") List<Iscs> iscsList);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.dao;
|
|||||||
|
|
||||||
import club.joylink.rtss.entity.LsRelChapterTraining;
|
import club.joylink.rtss.entity.LsRelChapterTraining;
|
||||||
import club.joylink.rtss.entity.LsRelChapterTrainingExample;
|
import club.joylink.rtss.entity.LsRelChapterTrainingExample;
|
||||||
|
import club.joylink.rtss.vo.client.LessonChapterTrainingRelVO;
|
||||||
import org.apache.ibatis.annotations.Insert;
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -24,4 +25,15 @@ public interface LsRelChapterTrainingDAO extends MyBatisBaseDao<LsRelChapterTrai
|
|||||||
" </foreach>" +
|
" </foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int batchInsertWithId(@Param("list") List<LsRelChapterTraining> relChapterTrainingList);
|
int batchInsertWithId(@Param("list") List<LsRelChapterTraining> relChapterTrainingList);
|
||||||
|
|
||||||
|
@Insert(value = "<script>" +
|
||||||
|
"insert into ls_rel_chapter_training (lesson_id, chapter_id, training_id, " +
|
||||||
|
" order_num, trial) " +
|
||||||
|
" values " +
|
||||||
|
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
|
||||||
|
" (#{entity.lessonId,jdbcType=BIGINT}, #{entity.chapterId,jdbcType=BIGINT}," +
|
||||||
|
" #{entity.trainingId,jdbcType=BIGINT}, #{entity.orderNum,jdbcType=INTEGER}, #{entity.trial,jdbcType=BIT})"+
|
||||||
|
" </foreach>" +
|
||||||
|
"</script>")
|
||||||
|
int batchInsert(@Param("list") List<LessonChapterTrainingRelVO> relChapterTrainingList);
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,7 @@ import java.io.Serializable;
|
|||||||
public class Iscs implements Serializable {
|
public class Iscs implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
/**
|
private Long mapId;
|
||||||
* 线路code
|
|
||||||
*/
|
|
||||||
private String lineCode;
|
|
||||||
|
|
||||||
private String stationCode;
|
|
||||||
|
|
||||||
private String totalSystem;
|
private String totalSystem;
|
||||||
|
|
||||||
@ -34,20 +29,12 @@ public class Iscs implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLineCode() {
|
public Long getMapId() {
|
||||||
return lineCode;
|
return mapId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLineCode(String lineCode) {
|
public void setMapId(Long mapId) {
|
||||||
this.lineCode = lineCode;
|
this.mapId = mapId;
|
||||||
}
|
|
||||||
|
|
||||||
public String getStationCode() {
|
|
||||||
return stationCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStationCode(String stationCode) {
|
|
||||||
this.stationCode = stationCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTotalSystem() {
|
public String getTotalSystem() {
|
||||||
@ -95,8 +82,7 @@ public class Iscs implements Serializable {
|
|||||||
}
|
}
|
||||||
Iscs other = (Iscs) that;
|
Iscs other = (Iscs) that;
|
||||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||||
&& (this.getLineCode() == null ? other.getLineCode() == null : this.getLineCode().equals(other.getLineCode()))
|
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
|
||||||
&& (this.getStationCode() == null ? other.getStationCode() == null : this.getStationCode().equals(other.getStationCode()))
|
|
||||||
&& (this.getTotalSystem() == null ? other.getTotalSystem() == null : this.getTotalSystem().equals(other.getTotalSystem()))
|
&& (this.getTotalSystem() == null ? other.getTotalSystem() == null : this.getTotalSystem().equals(other.getTotalSystem()))
|
||||||
&& (this.getSystem() == null ? other.getSystem() == null : this.getSystem().equals(other.getSystem()))
|
&& (this.getSystem() == null ? other.getSystem() == null : this.getSystem().equals(other.getSystem()))
|
||||||
&& (this.getUserInterface() == null ? other.getUserInterface() == null : this.getUserInterface().equals(other.getUserInterface()))
|
&& (this.getUserInterface() == null ? other.getUserInterface() == null : this.getUserInterface().equals(other.getUserInterface()))
|
||||||
@ -108,8 +94,7 @@ public class Iscs implements Serializable {
|
|||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||||
result = prime * result + ((getLineCode() == null) ? 0 : getLineCode().hashCode());
|
result = prime * result + ((getMapId() == null) ? 0 : getMapId().hashCode());
|
||||||
result = prime * result + ((getStationCode() == null) ? 0 : getStationCode().hashCode());
|
|
||||||
result = prime * result + ((getTotalSystem() == null) ? 0 : getTotalSystem().hashCode());
|
result = prime * result + ((getTotalSystem() == null) ? 0 : getTotalSystem().hashCode());
|
||||||
result = prime * result + ((getSystem() == null) ? 0 : getSystem().hashCode());
|
result = prime * result + ((getSystem() == null) ? 0 : getSystem().hashCode());
|
||||||
result = prime * result + ((getUserInterface() == null) ? 0 : getUserInterface().hashCode());
|
result = prime * result + ((getUserInterface() == null) ? 0 : getUserInterface().hashCode());
|
||||||
@ -124,8 +109,7 @@ public class Iscs implements Serializable {
|
|||||||
sb.append(" [");
|
sb.append(" [");
|
||||||
sb.append("Hash = ").append(hashCode());
|
sb.append("Hash = ").append(hashCode());
|
||||||
sb.append(", id=").append(id);
|
sb.append(", id=").append(id);
|
||||||
sb.append(", lineCode=").append(lineCode);
|
sb.append(", mapId=").append(mapId);
|
||||||
sb.append(", stationCode=").append(stationCode);
|
|
||||||
sb.append(", totalSystem=").append(totalSystem);
|
sb.append(", totalSystem=").append(totalSystem);
|
||||||
sb.append(", system=").append(system);
|
sb.append(", system=").append(system);
|
||||||
sb.append(", userInterface=").append(userInterface);
|
sb.append(", userInterface=").append(userInterface);
|
||||||
|
@ -184,143 +184,63 @@ public class IscsExample {
|
|||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeIsNull() {
|
public Criteria andMapIdIsNull() {
|
||||||
addCriterion("line_code is null");
|
addCriterion("map_id is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeIsNotNull() {
|
public Criteria andMapIdIsNotNull() {
|
||||||
addCriterion("line_code is not null");
|
addCriterion("map_id is not null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeEqualTo(String value) {
|
public Criteria andMapIdEqualTo(Long value) {
|
||||||
addCriterion("line_code =", value, "lineCode");
|
addCriterion("map_id =", value, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeNotEqualTo(String value) {
|
public Criteria andMapIdNotEqualTo(Long value) {
|
||||||
addCriterion("line_code <>", value, "lineCode");
|
addCriterion("map_id <>", value, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeGreaterThan(String value) {
|
public Criteria andMapIdGreaterThan(Long value) {
|
||||||
addCriterion("line_code >", value, "lineCode");
|
addCriterion("map_id >", value, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeGreaterThanOrEqualTo(String value) {
|
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
|
||||||
addCriterion("line_code >=", value, "lineCode");
|
addCriterion("map_id >=", value, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeLessThan(String value) {
|
public Criteria andMapIdLessThan(Long value) {
|
||||||
addCriterion("line_code <", value, "lineCode");
|
addCriterion("map_id <", value, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeLessThanOrEqualTo(String value) {
|
public Criteria andMapIdLessThanOrEqualTo(Long value) {
|
||||||
addCriterion("line_code <=", value, "lineCode");
|
addCriterion("map_id <=", value, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeLike(String value) {
|
public Criteria andMapIdIn(List<Long> values) {
|
||||||
addCriterion("line_code like", value, "lineCode");
|
addCriterion("map_id in", values, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeNotLike(String value) {
|
public Criteria andMapIdNotIn(List<Long> values) {
|
||||||
addCriterion("line_code not like", value, "lineCode");
|
addCriterion("map_id not in", values, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeIn(List<String> values) {
|
public Criteria andMapIdBetween(Long value1, Long value2) {
|
||||||
addCriterion("line_code in", values, "lineCode");
|
addCriterion("map_id between", value1, value2, "mapId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andLineCodeNotIn(List<String> values) {
|
public Criteria andMapIdNotBetween(Long value1, Long value2) {
|
||||||
addCriterion("line_code not in", values, "lineCode");
|
addCriterion("map_id not between", value1, value2, "mapId");
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andLineCodeBetween(String value1, String value2) {
|
|
||||||
addCriterion("line_code between", value1, value2, "lineCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andLineCodeNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("line_code not between", value1, value2, "lineCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeIsNull() {
|
|
||||||
addCriterion("station_code is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeIsNotNull() {
|
|
||||||
addCriterion("station_code is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeEqualTo(String value) {
|
|
||||||
addCriterion("station_code =", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeNotEqualTo(String value) {
|
|
||||||
addCriterion("station_code <>", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeGreaterThan(String value) {
|
|
||||||
addCriterion("station_code >", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("station_code >=", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeLessThan(String value) {
|
|
||||||
addCriterion("station_code <", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("station_code <=", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeLike(String value) {
|
|
||||||
addCriterion("station_code like", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeNotLike(String value) {
|
|
||||||
addCriterion("station_code not like", value, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeIn(List<String> values) {
|
|
||||||
addCriterion("station_code in", values, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeNotIn(List<String> values) {
|
|
||||||
addCriterion("station_code not in", values, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeBetween(String value1, String value2) {
|
|
||||||
addCriterion("station_code between", value1, value2, "stationCode");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStationCodeNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("station_code not between", value1, value2, "stationCode");
|
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,11 @@ public class CommandService implements ICommandService {
|
|||||||
criteria.andOperateObjectEqualTo(queryVO.getOperateObject());
|
criteria.andOperateObjectEqualTo(queryVO.getOperateObject());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//条件:仿真角色
|
||||||
|
if (!StringUtils.isEmpty(queryVO.getSimulationRole())) {
|
||||||
|
criteria.andSimulationRoleEqualTo(queryVO.getSimulationRole());
|
||||||
|
}
|
||||||
//查指令
|
//查指令
|
||||||
Page<CommandDefinition> page = (Page<CommandDefinition>) commandDefinitionDAO.selectByExample(commandDefinitionExample);
|
Page<CommandDefinition> page = (Page<CommandDefinition>) commandDefinitionDAO.selectByExample(commandDefinitionExample);
|
||||||
List<CommandDefinition> commandDefinitions = page.getResult();
|
List<CommandDefinition> commandDefinitions = page.getResult();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.rtss.services;
|
package club.joylink.rtss.services;
|
||||||
|
|
||||||
|
import club.joylink.rtss.configuration.configProp.MailConfig;
|
||||||
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.constants.EmailSubject;
|
import club.joylink.rtss.constants.EmailSubject;
|
||||||
@ -29,8 +30,8 @@ public class EmailService implements IEmailService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private JavaMailSender mailSender; //自动注入的Bean
|
private JavaMailSender mailSender; //自动注入的Bean
|
||||||
|
|
||||||
// @Autowired
|
@Autowired
|
||||||
// private MailConfig mailConfig;
|
private MailConfig mailConfig;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
@ -41,7 +42,7 @@ public class EmailService implements IEmailService {
|
|||||||
@Override
|
@Override
|
||||||
public void sendToOne(String toUser, String subject, String content) {
|
public void sendToOne(String toUser, String subject, String content) {
|
||||||
SimpleMailMessage smm = new SimpleMailMessage();
|
SimpleMailMessage smm = new SimpleMailMessage();
|
||||||
// smm.setFrom(this.mailConfig.getUsername());
|
smm.setFrom(this.mailConfig.getUsername());
|
||||||
smm.setTo(toUser);
|
smm.setTo(toUser);
|
||||||
smm.setSubject(subject);
|
smm.setSubject(subject);
|
||||||
smm.setText(content);
|
smm.setText(content);
|
||||||
|
@ -297,7 +297,7 @@ public class ExamService implements IExamService{
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ExamDefinition exam = iterator.next();
|
ExamDefinition exam = iterator.next();
|
||||||
if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) {
|
if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) {
|
||||||
this.offLine(exam.getId(), null);
|
this.offLine(exam.getId(), userVO);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
} else if (Objects.nonNull(examIds) && !examIds.contains(exam.getId())) {
|
} else if (Objects.nonNull(examIds) && !examIds.contains(exam.getId())) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
@ -338,7 +338,7 @@ public class ExamService implements IExamService{
|
|||||||
criteria.andLessonIdEqualTo(queryVO.getLessonId());
|
criteria.andLessonIdEqualTo(queryVO.getLessonId());
|
||||||
} else if (Objects.nonNull(queryVO.getMapId())) {
|
} else if (Objects.nonNull(queryVO.getMapId())) {
|
||||||
// 地图id查询
|
// 地图id查询
|
||||||
List<LessonVO> lessonList = this.iLessonService.queryLessonsOfMap(queryVO.getMapId());
|
List<LessonVO> lessonList = this.iLessonService.queryValidLessonsOfMap(queryVO.getMapId());
|
||||||
if (!CollectionUtils.isEmpty(lessonList)) {
|
if (!CollectionUtils.isEmpty(lessonList)) {
|
||||||
List<Long> lessonIdList = lessonList.stream()
|
List<Long> lessonIdList = lessonList.stream()
|
||||||
.map(LessonVO::getId)
|
.map(LessonVO::getId)
|
||||||
@ -360,6 +360,7 @@ public class ExamService implements IExamService{
|
|||||||
if (StringUtils.hasText(queryVO.getCreatorName())) {
|
if (StringUtils.hasText(queryVO.getCreatorName())) {
|
||||||
SysUserExample sysUserExample = new SysUserExample();
|
SysUserExample sysUserExample = new SysUserExample();
|
||||||
sysUserExample.createCriteria().andNameLike(String.format("%%%s%%", queryVO.getCreatorName()));
|
sysUserExample.createCriteria().andNameLike(String.format("%%%s%%", queryVO.getCreatorName()));
|
||||||
|
sysUserExample.or().andNicknameLike(String.format("%%%s%%", queryVO.getCreatorName()));
|
||||||
List<Long> createrIdList = sysUserMapper.selectByExample(sysUserExample).stream()
|
List<Long> createrIdList = sysUserMapper.selectByExample(sysUserExample).stream()
|
||||||
.map(SysUser::getId).collect(Collectors.toList());
|
.map(SysUser::getId).collect(Collectors.toList());
|
||||||
if (createrIdList.size() == 0) {
|
if (createrIdList.size() == 0) {
|
||||||
|
@ -93,7 +93,7 @@ public class GoodsService implements IGoodsService {
|
|||||||
* 根据id查询商品。
|
* 根据id查询商品。
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GoodsVO selectById(long id) {
|
public GoodsVO queryById(long id) {
|
||||||
SaleGoods goods = findEntity(id);
|
SaleGoods goods = findEntity(id);
|
||||||
if (goods == null) {
|
if (goods == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -131,7 +131,7 @@ public class GoodsService implements IGoodsService {
|
|||||||
* 如果不存在,return一个只有permissionName和permissionType的GoodsVO
|
* 如果不存在,return一个只有permissionName和permissionType的GoodsVO
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GoodsVO selectGoodsByPermissionId(Long permissionId) {
|
public GoodsVO queryGoodsByPermissionId(Long permissionId) {
|
||||||
SaleGoodsExample example = new SaleGoodsExample();
|
SaleGoodsExample example = new SaleGoodsExample();
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
.andPermissionIdEqualTo(permissionId);
|
.andPermissionIdEqualTo(permissionId);
|
||||||
@ -160,7 +160,7 @@ public class GoodsService implements IGoodsService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PermissionVO perVO = voList.get(0);
|
PermissionVO perVO = voList.get(0);
|
||||||
GoodsVO goodsVO = selectGoodsByPermissionId(voList.get(0).getId());
|
GoodsVO goodsVO = queryGoodsByPermissionId(voList.get(0).getId());
|
||||||
if (goodsVO == null) {
|
if (goodsVO == null) {
|
||||||
goodsVO = new GoodsVO();
|
goodsVO = new GoodsVO();
|
||||||
goodsVO.setPermissionId(perVO.getId());
|
goodsVO.setPermissionId(perVO.getId());
|
||||||
@ -221,18 +221,13 @@ public class GoodsService implements IGoodsService {
|
|||||||
* 如果要更新的商品不存在,报DBException(数据不存在)
|
* 如果要更新的商品不存在,报DBException(数据不存在)
|
||||||
*/
|
*/
|
||||||
public void updateGoods(Long id, GoodsUpdateVO updateVO, UserVO user) {
|
public void updateGoods(Long id, GoodsUpdateVO updateVO, UserVO user) {
|
||||||
confirmExist(id);
|
SaleGoods entity = getEntityById(id);
|
||||||
SaleGoods goods = updateVO.convert2DB();
|
entity.setName(updateVO.getName());
|
||||||
goods.setId(id);
|
entity.setPrice((long) (updateVO.getPrice() * 100));
|
||||||
goods.setUpdateUserId(user.getId());
|
entity.setRemarks(updateVO.getRemarks());
|
||||||
goods.setUpdateTime(LocalDateTime.now());
|
entity.setUpdateUserId(user.getId());
|
||||||
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
saleGoodsDAO.updateByPrimaryKeySelective(goods);
|
saleGoodsDAO.updateByPrimaryKeySelective(entity);
|
||||||
}
|
|
||||||
|
|
||||||
private void confirmExist(Long id) {
|
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(isExist(id),
|
|
||||||
String.format("id为[%s]的商品不存在", id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,7 +23,7 @@ public interface IGoodsService {
|
|||||||
/**
|
/**
|
||||||
* 查询商品详情
|
* 查询商品详情
|
||||||
*/
|
*/
|
||||||
GoodsVO selectById(long id);
|
GoodsVO queryById(long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新商品
|
* 更新商品
|
||||||
@ -43,7 +43,7 @@ public interface IGoodsService {
|
|||||||
/**
|
/**
|
||||||
* 根据权限id查询商品
|
* 根据权限id查询商品
|
||||||
*/
|
*/
|
||||||
GoodsVO selectGoodsByPermissionId(Long permissionId);
|
GoodsVO queryGoodsByPermissionId(Long permissionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过关联权限ids查询权限包商品
|
* 通过关联权限ids查询权限包商品
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
package club.joylink.rtss.services;
|
package club.joylink.rtss.services;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.client.iscs.IscsCopyVO;
|
||||||
|
import club.joylink.rtss.vo.client.iscs.IscsQueryVO;
|
||||||
import club.joylink.rtss.vo.client.iscs.IscsVO;
|
import club.joylink.rtss.vo.client.iscs.IscsVO;
|
||||||
|
|
||||||
public interface IIscsService {
|
public interface IIscsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
PageVO<IscsVO> pagedQuery(IscsQueryVO queryVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存Iscs数据
|
* 保存Iscs数据
|
||||||
@ -15,4 +22,15 @@ public interface IIscsService {
|
|||||||
*/
|
*/
|
||||||
IscsVO getIscsDataBy(IscsVO iscsVO);
|
IscsVO getIscsDataBy(IscsVO iscsVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据
|
||||||
|
*/
|
||||||
|
void delete(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制Iscs数据
|
||||||
|
*/
|
||||||
|
void copy(IscsCopyVO copyVO);
|
||||||
|
|
||||||
|
boolean isExistedWithMapId(Long mapId);
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,7 @@ import club.joylink.rtss.constants.Project;
|
|||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
|
import club.joylink.rtss.vo.client.learn.*;
|
||||||
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
|
|
||||||
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
|
|
||||||
import club.joylink.rtss.vo.client.learn.LearnPostVO;
|
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
||||||
@ -124,6 +121,11 @@ public interface ILearnService {
|
|||||||
*/
|
*/
|
||||||
PageVO<LearnMessageVO> pagedQueryMessageByProject(Project project, LearnMessagePagedQueryVO queryVO);
|
PageVO<LearnMessageVO> pagedQueryMessageByProject(Project project, LearnMessagePagedQueryVO queryVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新留言板
|
||||||
|
*/
|
||||||
|
void updatePost(Long postId, LearnPostUpdateVO updateVO, UserVO user);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 点赞留言
|
// * 点赞留言
|
||||||
// */
|
// */
|
||||||
|
@ -27,8 +27,9 @@ public interface ILessonDraftService {
|
|||||||
/**
|
/**
|
||||||
* 创建课程
|
* 创建课程
|
||||||
* @param lessonVo
|
* @param lessonVo
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
void createLesson(LessonVO lessonVo, UserVO userVO);
|
Long createLesson(LessonVO lessonVo, UserVO userVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从发布课程创建
|
* 从发布课程创建
|
||||||
|
@ -17,10 +17,6 @@ public interface ILessonService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取课程树
|
* 获取课程树
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param userVO
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
LessonTreeVO getLessonTree(Long id, UserVO userVO);
|
LessonTreeVO getLessonTree(Long id, UserVO userVO);
|
||||||
|
|
||||||
@ -32,6 +28,11 @@ public interface ILessonService {
|
|||||||
*/
|
*/
|
||||||
LessonVO getLessonDetail(Long id, UserVO userVO);
|
LessonVO getLessonDetail(Long id, UserVO userVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询地图下的课程、章节、章节和实训的关联关系
|
||||||
|
*/
|
||||||
|
List<LessonVO> queryLessonDetail(Long mapId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取课程详细信息
|
* 获取课程详细信息
|
||||||
* @param id
|
* @param id
|
||||||
@ -42,11 +43,15 @@ public interface ILessonService {
|
|||||||
LessonVO findByMapAndNameAndPrdType(Long mapId, String name, String prdType);
|
LessonVO findByMapAndNameAndPrdType(Long mapId, String name, String prdType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询课程列表
|
* 查询有效的课程列表
|
||||||
* @param lessonQueryVO
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO);
|
List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程列表(无视状态)
|
||||||
|
* @param mapId
|
||||||
|
*/
|
||||||
|
List<LessonVO> queryLessons(Long mapId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新所属城市
|
* 更新所属城市
|
||||||
@ -121,7 +126,10 @@ public interface ILessonService {
|
|||||||
|
|
||||||
Map<Long, Long> copy(Long sourceMapId, Long targetMapId, Map<Long, Long> trainingRelMap, UserVO user);
|
Map<Long, Long> copy(Long sourceMapId, Long targetMapId, Map<Long, Long> trainingRelMap, UserVO user);
|
||||||
|
|
||||||
List<LessonVO> queryLessonsOfMap(Long mapId);
|
/**
|
||||||
|
* 查询地图下有效的课程
|
||||||
|
*/
|
||||||
|
List<LessonVO> queryValidLessonsOfMap(Long mapId);
|
||||||
|
|
||||||
List<LessonVO> findByMapIdAndPrdType(Long mapId, String prdType);
|
List<LessonVO> findByMapIdAndPrdType(Long mapId, String prdType);
|
||||||
|
|
||||||
@ -142,4 +150,10 @@ public interface ILessonService {
|
|||||||
* 获取有效的课程
|
* 获取有效的课程
|
||||||
*/
|
*/
|
||||||
List<LessonVO> getValidLesson(List<Long> ids, String prdType);
|
List<LessonVO> getValidLesson(List<Long> ids, String prdType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除并添加章节-实训关联关系
|
||||||
|
* @param relVOS
|
||||||
|
*/
|
||||||
|
void addChapterTrainingRelAfterDelete(List<LessonChapterTrainingRelVO> relVOS);
|
||||||
}
|
}
|
||||||
|
@ -278,4 +278,9 @@ public interface IMapService {
|
|||||||
* 获取地图已有的数据版本
|
* 获取地图已有的数据版本
|
||||||
*/
|
*/
|
||||||
List<String> getMapDataVersion(Long id);
|
List<String> getMapDataVersion(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有车站
|
||||||
|
*/
|
||||||
|
List<MapStationNewVO> getAllStations();
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,6 @@ public interface IPermissionService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Permission> getJointAndTeachEntities(List<Long> mapIds);
|
List<Permission> getJointAndTeachEntities(List<Long> mapIds);
|
||||||
|
|
||||||
|
Permission findJointSimulationEntity(Long mapId);
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import club.joylink.rtss.vo.client.map.MapRoutingSectionVO;
|
|||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.*;
|
import club.joylink.rtss.vo.client.runplan.*;
|
||||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInput;
|
import club.joylink.rtss.vo.runplan.RunPlanInput;
|
||||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInputData;
|
import club.joylink.rtss.vo.runplan.RunPlanInputData;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -59,6 +59,8 @@ public interface IRunPlanDraftService {
|
|||||||
*/
|
*/
|
||||||
void deleteDiagramDraftData(Long planId, UserVO user);
|
void deleteDiagramDraftData(Long planId, UserVO user);
|
||||||
|
|
||||||
|
void deleteDraftData(Long planId, UserVO userVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运行图草稿发布
|
* 运行图草稿发布
|
||||||
*/
|
*/
|
||||||
@ -178,6 +180,9 @@ public interface IRunPlanDraftService {
|
|||||||
*/
|
*/
|
||||||
void copyRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO);
|
void copyRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
void moveRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO);
|
||||||
|
|
||||||
void updateRunPlanServiceNumber(Long planId, String oldServiceNumber, String serviceNumber);
|
void updateRunPlanServiceNumber(Long planId, String oldServiceNumber, String serviceNumber);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +58,7 @@ public interface IVoiceService {
|
|||||||
}
|
}
|
||||||
saveFile = new File(localFilePath);
|
saveFile = new File(localFilePath);
|
||||||
//上传文件
|
//上传文件
|
||||||
String url = "https://joylink.club/jlfile/api/upload/AUDIO?appId=00001&appSecret=joylink00001";
|
String url = "https://upload.joylink.club/api/upload/AUDIO?appId=00001&appSecret=joylink00001";
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
||||||
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
|
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
|
||||||
@ -85,33 +85,6 @@ public interface IVoiceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VoiceFile saveFile(MultipartFile multipartFile) {
|
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
|
||||||
String url = "https://joylink.club/jlfile/api/upload/AUDIO?appId=00001&appSecret=joylink00001";
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
|
||||||
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
|
||||||
File tempFile = null;
|
|
||||||
try {
|
|
||||||
tempFile = File.createTempFile("fileName", ".wav");
|
|
||||||
multipartFile.transferTo(tempFile);
|
|
||||||
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
|
|
||||||
map.add("file", new FileSystemResource(tempFile));
|
|
||||||
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, map, String.class);
|
|
||||||
String body = responseEntity.getBody();
|
|
||||||
// body = body.replaceAll("\\\\", "/");
|
|
||||||
CommonJsonResponse response = JsonUtils.read(body, CommonJsonResponse.class);
|
|
||||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertEquals(200, response.getCode());
|
|
||||||
String path = (String) response.getData();
|
|
||||||
return new VoiceFile(path, null);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(e);
|
|
||||||
} finally {
|
|
||||||
if (tempFile != null)
|
|
||||||
tempFile.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static String handleAndSaveFile(MultipartFile file) throws IOException {
|
static String handleAndSaveFile(MultipartFile file) throws IOException {
|
||||||
String contentType = file.getContentType();
|
String contentType = file.getContentType();
|
||||||
BusinessExceptionAssertEnum.UNSUPPORTED_FILE_FORMAT.assertTrue(
|
BusinessExceptionAssertEnum.UNSUPPORTED_FILE_FORMAT.assertTrue(
|
||||||
|
@ -3,14 +3,20 @@ package club.joylink.rtss.services;
|
|||||||
import club.joylink.rtss.dao.IscsDAO;
|
import club.joylink.rtss.dao.IscsDAO;
|
||||||
import club.joylink.rtss.entity.Iscs;
|
import club.joylink.rtss.entity.Iscs;
|
||||||
import club.joylink.rtss.entity.IscsExample;
|
import club.joylink.rtss.entity.IscsExample;
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.client.iscs.IscsCopyVO;
|
||||||
|
import club.joylink.rtss.vo.client.iscs.IscsQueryVO;
|
||||||
import club.joylink.rtss.vo.client.iscs.IscsVO;
|
import club.joylink.rtss.vo.client.iscs.IscsVO;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@ -20,34 +26,100 @@ public class IscsService implements IIscsService {
|
|||||||
private IscsDAO iscsDAO;
|
private IscsDAO iscsDAO;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveIscsData(IscsVO iscsVO) {
|
public PageVO<IscsVO> pagedQuery(IscsQueryVO queryVO) {
|
||||||
|
|
||||||
//查询是否存在,存在更新,不存在插入
|
|
||||||
IscsExample example = new IscsExample();
|
IscsExample example = new IscsExample();
|
||||||
example.createCriteria().andLineCodeEqualTo(iscsVO.getLineCode())
|
IscsExample.Criteria criteria = example.createCriteria();
|
||||||
// .andStationCodeEqualTo(iscsVO.getStationCode())
|
if (queryVO.getMapId() != null)
|
||||||
.andTotalSystemEqualTo(iscsVO.getTotalSystem())
|
criteria.andMapIdEqualTo(queryVO.getMapId());
|
||||||
.andSystemEqualTo(iscsVO.getSystem())
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
.andUserInterfaceEqualTo(iscsVO.getUserInterface());
|
Page<Iscs> page = (Page<Iscs>) iscsDAO.selectByExample(example);
|
||||||
|
List<IscsVO> vos = page.getResult().stream().map(IscsVO::new).collect(Collectors.toList());
|
||||||
|
return PageVO.convert(page, vos);
|
||||||
|
}
|
||||||
|
|
||||||
IscsVO iscsData = getIscsDataBy(iscsVO);
|
@Override
|
||||||
if(Objects.isNull(iscsData)){
|
public void saveIscsData(IscsVO iscsVO) {
|
||||||
iscsDAO.insert(iscsVO.converttoDB());
|
Iscs iscs = iscsVO.converttoDB();
|
||||||
return;
|
createOrUpdate(iscs);
|
||||||
}
|
|
||||||
iscsDAO.updateByExampleSelective(iscsVO.converttoDB(),example);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IscsVO getIscsDataBy(IscsVO iscsVO) {
|
public IscsVO getIscsDataBy(IscsVO iscsVO) {
|
||||||
IscsExample example = new IscsExample();
|
IscsExample example = new IscsExample();
|
||||||
example.createCriteria().andLineCodeEqualTo(iscsVO.getLineCode())
|
example.createCriteria()
|
||||||
// .andStationCodeEqualTo(iscsVO.getStationCode())
|
.andMapIdEqualTo(iscsVO.getMapId())
|
||||||
.andTotalSystemEqualTo(iscsVO.getTotalSystem())
|
.andTotalSystemEqualTo(iscsVO.getTotalSystem())
|
||||||
.andSystemEqualTo(iscsVO.getSystem())
|
.andSystemEqualTo(iscsVO.getSystem())
|
||||||
.andUserInterfaceEqualTo(iscsVO.getUserInterface());
|
.andUserInterfaceEqualTo(iscsVO.getUserInterface());
|
||||||
List<Iscs> list = iscsDAO.selectByExampleWithBLOBs(example);
|
List<Iscs> list = iscsDAO.selectByExampleWithBLOBs(example);
|
||||||
if(CollectionUtils.isEmpty(list))return null;
|
if (CollectionUtils.isEmpty(list)) return null;
|
||||||
return new IscsVO(list.get(0));
|
return new IscsVO(list.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Integer id) {
|
||||||
|
iscsDAO.deleteByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void copy(IscsCopyVO copyVO) {
|
||||||
|
Long fromMapId = copyVO.getFromMapId();
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(fromMapId,
|
||||||
|
"复制操作的数据来源不能为空");
|
||||||
|
Long toMapId = copyVO.getToMapId();
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(toMapId,
|
||||||
|
"复制到的地图不能为空");
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotEquals(fromMapId, toMapId, "不能从自己复制到自己");
|
||||||
|
List<Iscs> entities = getEntityWithBLOBsByMapId(fromMapId);
|
||||||
|
deleteByMapId(toMapId);
|
||||||
|
entities.forEach(iscs -> iscs.setMapId(toMapId));
|
||||||
|
iscsDAO.batchInsert(entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createOrUpdate(Iscs iscs) {
|
||||||
|
Iscs entity = findEntity(iscs.getMapId(), iscs.getTotalSystem(), iscs.getSystem(), iscs.getUserInterface());
|
||||||
|
if (entity == null) {
|
||||||
|
iscsDAO.insert(iscs);
|
||||||
|
} else {
|
||||||
|
iscs.setId(entity.getId());
|
||||||
|
iscsDAO.updateByPrimaryKeyWithBLOBs(iscs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Iscs findEntity(Long mapId, String totalSystem, String system, String userInterface) {
|
||||||
|
IscsExample example = new IscsExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andMapIdEqualTo(mapId)
|
||||||
|
.andTotalSystemEqualTo(totalSystem)
|
||||||
|
.andSystemEqualTo(system)
|
||||||
|
.andUserInterfaceEqualTo(userInterface);
|
||||||
|
List<Iscs> iscsList = iscsDAO.selectByExampleWithBLOBs(example);
|
||||||
|
if (!CollectionUtils.isEmpty(iscsList)) {
|
||||||
|
return iscsList.get(0);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Iscs> getEntityWithBLOBsByMapId(Long mapId) {
|
||||||
|
IscsExample example = new IscsExample();
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
List<Iscs> list = iscsDAO.selectByExampleWithBLOBs(example);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(list, String.format("地图[%s]下无iscs数据", mapId));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void deleteByMapId(Long mapId) {
|
||||||
|
IscsExample example = new IscsExample();
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
iscsDAO.deleteByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isExistedWithMapId(Long mapId) {
|
||||||
|
IscsExample example = new IscsExample();
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
return iscsDAO.countByExample(example) > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
|||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
|
import club.joylink.rtss.vo.client.learn.*;
|
||||||
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
|
|
||||||
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
|
|
||||||
import club.joylink.rtss.vo.client.learn.LearnPostVO;
|
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
||||||
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
||||||
@ -331,6 +328,16 @@ public class LearnService implements ILearnService {
|
|||||||
return pagedQueryMessageByPostId(post.getId(), queryVO);
|
return pagedQueryMessageByPostId(post.getId(), queryVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updatePost(Long postId, LearnPostUpdateVO updateVO, UserVO user) {
|
||||||
|
iSysUserService.confirmAdmin(user);
|
||||||
|
LearnPost entity = getPostEntity(postId);
|
||||||
|
if (Objects.equals(updateVO.getTitle(), entity.getTitle()))
|
||||||
|
return;
|
||||||
|
entity.setTitle(updateVO.getTitle());
|
||||||
|
learnPostDAO.updateByPrimaryKey(entity);
|
||||||
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public Integer likeMessage(Long messageId) {
|
// public Integer likeMessage(Long messageId) {
|
||||||
// LearnMessageWithBLOBs message = getMessage(messageId);
|
// LearnMessageWithBLOBs message = getMessage(messageId);
|
||||||
|
@ -8,7 +8,6 @@ import club.joylink.rtss.entity.LsDraftLessonChapterExample.Criteria;
|
|||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.*;
|
import club.joylink.rtss.vo.client.*;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -87,12 +86,13 @@ public class LessonDraftService implements ILessonDraftService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void createLesson(LessonVO lessonVo, UserVO userVO) {
|
public Long createLesson(LessonVO lessonVo, UserVO userVO) {
|
||||||
LsDraftLesson lesson = lessonVo.convert2Draft();
|
LsDraftLesson lesson = lessonVo.convert2Draft();
|
||||||
lesson.setUpdateTime(LocalDateTime.now());
|
lesson.setUpdateTime(LocalDateTime.now());
|
||||||
lesson.setCreatorId(userVO.getId());
|
lesson.setCreatorId(userVO.getId());
|
||||||
lesson.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
lesson.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||||
this.lsDraftLessonDAO.insert(lesson);
|
this.lsDraftLessonDAO.insert(lesson);
|
||||||
|
return lesson.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -532,4 +532,5 @@ public class LessonDraftService implements ILessonDraftService {
|
|||||||
example.createCriteria().andTrainingIdIn(trainingIdList);
|
example.createCriteria().andTrainingIdIn(trainingIdList);
|
||||||
this.draftRelChapterTrainingDAO.deleteByExample(example);
|
this.draftRelChapterTrainingDAO.deleteByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,6 +147,39 @@ public class LessonService implements ILessonService {
|
|||||||
return lessonVo;
|
return lessonVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LessonVO> queryLessonDetail(Long mapId) {
|
||||||
|
//查询课程
|
||||||
|
List<LsLesson> lessons = findLessonEntities(mapId);
|
||||||
|
List<LessonVO> lessonVOS = LessonVO.convert2PublishVO(lessons);
|
||||||
|
if (!CollectionUtils.isEmpty(lessons)) {
|
||||||
|
Map<Long, LessonVO> lessonVOMap = lessonVOS.stream().collect(Collectors.toMap(LessonVO::getId, Function.identity()));
|
||||||
|
//查询章节
|
||||||
|
List<Long> lessonIds = lessons.stream().map(LsLesson::getId).collect(Collectors.toList());
|
||||||
|
List<LsLessonChapter> chapters = findChapterEntities(lessonIds);
|
||||||
|
if (!CollectionUtils.isEmpty(chapters)) {
|
||||||
|
List<LessonChapterVO> chapterVOS = LessonChapterVO.convert2PublishVO(chapters);
|
||||||
|
Map<Long, List<LessonChapterVO>> groupByLessonIdChapterMap = chapterVOS.stream().collect(Collectors.groupingBy(LessonChapterVO::getLessonId));
|
||||||
|
groupByLessonIdChapterMap.forEach((lessonId, chapterList) -> {
|
||||||
|
LessonVO lessonVO = lessonVOMap.get(lessonId);
|
||||||
|
if (lessonVO != null)
|
||||||
|
lessonVO.setChapters(chapterList);
|
||||||
|
});
|
||||||
|
//查询章节和实训的关联关系
|
||||||
|
List<Long> chapterIds = chapters.stream().map(LsLessonChapter::getId).collect(Collectors.toList());
|
||||||
|
List<LsRelChapterTraining> rels = findChapterTrainingRelEntities(chapterIds);
|
||||||
|
List<LessonChapterTrainingRelVO> relVOS = LessonChapterTrainingRelVO.convert2VOList(rels);
|
||||||
|
Map<Long, List<LessonChapterTrainingRelVO>> groupByLessonIdRelVOMap = relVOS.stream().collect(Collectors.groupingBy(LessonChapterTrainingRelVO::getLessonId));
|
||||||
|
groupByLessonIdRelVOMap.forEach((lessonId, relList) -> {
|
||||||
|
LessonVO lessonVO = lessonVOMap.get(lessonId);
|
||||||
|
if (lessonVO != null)
|
||||||
|
lessonVO.setRel(relList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lessonVOS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LessonVO getLessonInfo(Long id) {
|
public LessonVO getLessonInfo(Long id) {
|
||||||
LsLesson lesson = this.lessonDAO.selectByPrimaryKey(id);
|
LsLesson lesson = this.lessonDAO.selectByPrimaryKey(id);
|
||||||
@ -194,7 +228,7 @@ public class LessonService implements ILessonService {
|
|||||||
} else {
|
} else {
|
||||||
addRelLessonClass(publishVO, publishedLesson.getId());
|
addRelLessonClass(publishVO, publishedLesson.getId());
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if (!CollectionUtils.isEmpty(studentRelLessonClasses)) {
|
if (!CollectionUtils.isEmpty(studentRelLessonClasses)) {
|
||||||
this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample);
|
this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample);
|
||||||
}
|
}
|
||||||
@ -208,28 +242,6 @@ public class LessonService implements ILessonService {
|
|||||||
this.saveChapterDetail(newLesson, lessonVo);
|
this.saveChapterDetail(newLesson, lessonVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 增加课程班级关系
|
|
||||||
*/
|
|
||||||
private void addRelLessonClass(LessonPublishVO publishVO, Long id) {
|
|
||||||
publishVO.getClassIdList().forEach(classId -> {
|
|
||||||
StudentRelLessonClass relLessonClass = new StudentRelLessonClass();
|
|
||||||
relLessonClass.setClassId(classId);
|
|
||||||
relLessonClass.setLessonId(id);
|
|
||||||
this.studentRelLessonClassDAO.insert(relLessonClass);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private LessonVO findByMapAndName(Long mapId, String name) {
|
|
||||||
LsLessonExample lessonExample = new LsLessonExample();
|
|
||||||
lessonExample.createCriteria().andMapIdEqualTo(mapId).andNameEqualTo(name);
|
|
||||||
List<LsLesson> lessonList = this.lessonDAO.selectByExample(lessonExample);
|
|
||||||
if (CollectionUtils.isEmpty(lessonList)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new LessonVO(lessonList.get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LessonVO findByMapAndNameAndPrdType(Long mapId, String name, String prdType) {
|
public LessonVO findByMapAndNameAndPrdType(Long mapId, String name, String prdType) {
|
||||||
LsLessonExample lessonExample = new LsLessonExample();
|
LsLessonExample lessonExample = new LsLessonExample();
|
||||||
@ -241,97 +253,8 @@ public class LessonService implements ILessonService {
|
|||||||
return new LessonVO(lessonList.get(0));
|
return new LessonVO(lessonList.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存课程章节及章节关联的实训信息
|
|
||||||
*/
|
|
||||||
private void saveChapterDetail(LsLesson newLesson, LessonVO lessonVo) {
|
|
||||||
// 清除关系表
|
|
||||||
LsRelChapterTrainingExample relExample = new LsRelChapterTrainingExample();
|
|
||||||
relExample.createCriteria().andLessonIdEqualTo(newLesson.getId());
|
|
||||||
this.relChapterTrainingDAO.deleteByExample(relExample);
|
|
||||||
// 清空章节信息
|
|
||||||
LsLessonChapterExample example = new LsLessonChapterExample();
|
|
||||||
example.createCriteria().andLessonIdEqualTo(newLesson.getId());
|
|
||||||
this.lessonChapterDAO.deleteByExample(example);
|
|
||||||
// 保存
|
|
||||||
Map<Long, Long> idChangedMap = new HashMap<>();
|
|
||||||
this.saveChaptersInfo(newLesson, lessonVo.getChapters(), idChangedMap);
|
|
||||||
this.saveRelChapterTraining(newLesson, lessonVo.getRel(), idChangedMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存课程章节信息
|
|
||||||
*/
|
|
||||||
private void saveChaptersInfo(LsLesson newLesson, List<LessonChapterVO> chapterVos, Map<Long, Long> idChangedMap) {
|
|
||||||
List<LsLessonChapter> chapters = LessonChapterVO.convert2PublishDB(chapterVos).stream()
|
|
||||||
.sorted(Comparator.comparing(LsLessonChapter::getParentId)).collect(Collectors.toList());
|
|
||||||
if (!CollectionUtils.isEmpty(chapters)) {
|
|
||||||
chapters.forEach(chapter -> {
|
|
||||||
Long oldId = chapter.getId();
|
|
||||||
chapter.setLessonId(newLesson.getId());
|
|
||||||
if (chapter.getParentId() != 0) {
|
|
||||||
chapter.setParentId(idChangedMap.get(chapter.getParentId()));
|
|
||||||
}
|
|
||||||
this.lessonChapterDAO.insert(chapter);
|
|
||||||
idChangedMap.put(oldId, chapter.getId());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存章节-实训 关联数据
|
|
||||||
*/
|
|
||||||
private void saveRelChapterTraining(LsLesson newLesson, List<LessonChapterTrainingRelVO> relVos, Map<Long, Long> idChangedMap) {
|
|
||||||
List<LsRelChapterTraining> relList = LessonChapterTrainingRelVO.convert2PublishDB(relVos);
|
|
||||||
if (!CollectionUtils.isEmpty(relList)) {
|
|
||||||
relList.forEach(rel -> {
|
|
||||||
rel.setLessonId(newLesson.getId());
|
|
||||||
rel.setChapterId(idChangedMap.get(rel.getChapterId()));
|
|
||||||
this.relChapterTrainingDAO.insert(rel);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建并插入课程版本信息
|
|
||||||
*/
|
|
||||||
private void buildAndInsertLessonVersion(LsLesson lesson) {
|
|
||||||
LsLessonVersion latest = this.getLatestLessonVersion(lesson.getId());
|
|
||||||
String version = null == latest ? null : latest.getVersion();
|
|
||||||
LsLessonVersion newVersion = buildVersion(lesson, version);
|
|
||||||
this.lessonVersionDAO.insert(newVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建新的版本信息
|
|
||||||
*/
|
|
||||||
private LsLessonVersion buildVersion(LsLesson lesson, String old) {
|
|
||||||
String version = VersionUtil.generateNext(old);
|
|
||||||
LsLessonVersion lessonVersion = new LsLessonVersion();
|
|
||||||
lessonVersion.setLessonId(lesson.getId());
|
|
||||||
lessonVersion.setCreatorId(lesson.getCreatorId());
|
|
||||||
lessonVersion.setUpdateTime(lesson.getUpdateTime());
|
|
||||||
lessonVersion.setVersion(version);
|
|
||||||
return lessonVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取最新的课程版本信息
|
|
||||||
*/
|
|
||||||
private LsLessonVersion getLatestLessonVersion(Long lessonId) {
|
|
||||||
LsLessonVersionExample example = new LsLessonVersionExample();
|
|
||||||
example.createCriteria().andLessonIdEqualTo(lessonId);
|
|
||||||
example.setOrderByClause("update_time desc");
|
|
||||||
List<LsLessonVersion> list = this.lessonVersionDAO.selectByExample(example);
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LessonVO> queryLessons(LessonQueryVO lessonQueryVO) {
|
public List<LessonVO> queryValidLessons(LessonQueryVO lessonQueryVO) {
|
||||||
LsLessonExample example = new LsLessonExample();
|
LsLessonExample example = new LsLessonExample();
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
Criteria criteria = example.createCriteria()
|
Criteria criteria = example.createCriteria()
|
||||||
@ -343,6 +266,15 @@ public class LessonService implements ILessonService {
|
|||||||
return LessonVO.convert2PublishVO(list);
|
return LessonVO.convert2PublishVO(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LessonVO> queryLessons(@NonNull Long mapId) {
|
||||||
|
LsLessonExample example = new LsLessonExample();
|
||||||
|
example.setOrderByClause("id desc");
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
List<LsLesson> list = this.lessonDAO.selectByExample(example);
|
||||||
|
return LessonVO.convert2PublishVO(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCity(Long mapId) {
|
public void updateCity(Long mapId) {
|
||||||
MapVO mapVO = this.iMapService.getMapInfoById(mapId);
|
MapVO mapVO = this.iMapService.getMapInfoById(mapId);
|
||||||
@ -502,7 +434,7 @@ public class LessonService implements ILessonService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public Map<Long, Long> copy(Long sourceMapId, Long targetMapId, Map<Long, Long> trainingRelMap, UserVO user) {
|
public Map<Long, Long> copy(Long sourceMapId, Long targetMapId, Map<Long, Long> trainingRelMap, UserVO user) {
|
||||||
|
|
||||||
List<LsLesson> lessonList = findEntityByMapId(sourceMapId);
|
List<LsLesson> lessonList = findLessonEntities(sourceMapId);
|
||||||
Map<Long, Long> relationMap = new HashMap<>();
|
Map<Long, Long> relationMap = new HashMap<>();
|
||||||
if (CollectionUtils.isEmpty(lessonList)) {
|
if (CollectionUtils.isEmpty(lessonList)) {
|
||||||
return relationMap;
|
return relationMap;
|
||||||
@ -546,14 +478,8 @@ public class LessonService implements ILessonService {
|
|||||||
return relationMap;
|
return relationMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LsLesson> findEntityByMapId(Long mapId) {
|
|
||||||
LsLessonExample example = new LsLessonExample();
|
|
||||||
example.createCriteria().andMapIdEqualTo(mapId);
|
|
||||||
return lessonDAO.selectByExample(example);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LessonVO> queryLessonsOfMap(Long mapId) {
|
public List<LessonVO> queryValidLessonsOfMap(Long mapId) {
|
||||||
LsLessonExample example = new LsLessonExample();
|
LsLessonExample example = new LsLessonExample();
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
.andMapIdEqualTo(mapId)
|
.andMapIdEqualTo(mapId)
|
||||||
@ -611,6 +537,21 @@ public class LessonService implements ILessonService {
|
|||||||
return lessonDAO.getValidLesson(ids, prdType);
|
return lessonDAO.getValidLesson(ids, prdType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChapterTrainingRelAfterDelete(List<LessonChapterTrainingRelVO> relVOS) {
|
||||||
|
//删除旧数据
|
||||||
|
List<Long> ids = relVOS.stream().map(LessonChapterTrainingRelVO::getTrainingId).collect(Collectors.toList());
|
||||||
|
if (!CollectionUtils.isEmpty(ids)) {
|
||||||
|
LsRelChapterTrainingExample example = new LsRelChapterTrainingExample();
|
||||||
|
example.createCriteria().andIdIn(ids);
|
||||||
|
relChapterTrainingDAO.deleteByExample(example);
|
||||||
|
}
|
||||||
|
//添加新数据
|
||||||
|
if (!CollectionUtils.isEmpty(relVOS)) {
|
||||||
|
relChapterTrainingDAO.batchInsert(relVOS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void generateLessonBy(UserVO userVO, MapVO mapVO, BusinessConsts.Lesson.PrdInfo prdLessonInfo, String prdType) {
|
private void generateLessonBy(UserVO userVO, MapVO mapVO, BusinessConsts.Lesson.PrdInfo prdLessonInfo, String prdType) {
|
||||||
//课程
|
//课程
|
||||||
LsLesson lesson = new LsLesson();
|
LsLesson lesson = new LsLesson();
|
||||||
@ -742,4 +683,138 @@ public class LessonService implements ILessonService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存课程章节及章节关联的实训信息
|
||||||
|
*/
|
||||||
|
private void saveChapterDetail(LsLesson newLesson, LessonVO lessonVo) {
|
||||||
|
// 清除关系表
|
||||||
|
LsRelChapterTrainingExample relExample = new LsRelChapterTrainingExample();
|
||||||
|
relExample.createCriteria().andLessonIdEqualTo(newLesson.getId());
|
||||||
|
this.relChapterTrainingDAO.deleteByExample(relExample);
|
||||||
|
// 清空章节信息
|
||||||
|
LsLessonChapterExample example = new LsLessonChapterExample();
|
||||||
|
example.createCriteria().andLessonIdEqualTo(newLesson.getId());
|
||||||
|
this.lessonChapterDAO.deleteByExample(example);
|
||||||
|
// 保存
|
||||||
|
Map<Long, Long> idChangedMap = new HashMap<>();
|
||||||
|
this.saveChaptersInfo(newLesson, lessonVo.getChapters(), idChangedMap);
|
||||||
|
this.saveRelChapterTraining(newLesson, lessonVo.getRel(), idChangedMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存课程章节信息
|
||||||
|
*/
|
||||||
|
private void saveChaptersInfo(LsLesson newLesson, List<LessonChapterVO> chapterVos, Map<Long, Long> idChangedMap) {
|
||||||
|
List<LsLessonChapter> chapters = LessonChapterVO.convert2PublishDB(chapterVos).stream()
|
||||||
|
.sorted(Comparator.comparing(LsLessonChapter::getParentId)).collect(Collectors.toList());
|
||||||
|
if (!CollectionUtils.isEmpty(chapters)) {
|
||||||
|
chapters.forEach(chapter -> {
|
||||||
|
Long oldId = chapter.getId();
|
||||||
|
chapter.setLessonId(newLesson.getId());
|
||||||
|
if (chapter.getParentId() != 0) {
|
||||||
|
chapter.setParentId(idChangedMap.get(chapter.getParentId()));
|
||||||
|
}
|
||||||
|
this.lessonChapterDAO.insert(chapter);
|
||||||
|
idChangedMap.put(oldId, chapter.getId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存章节-实训 关联数据
|
||||||
|
*/
|
||||||
|
private void saveRelChapterTraining(LsLesson newLesson, List<LessonChapterTrainingRelVO> relVos, Map<Long, Long> idChangedMap) {
|
||||||
|
List<LsRelChapterTraining> relList = LessonChapterTrainingRelVO.convert2PublishDB(relVos);
|
||||||
|
if (!CollectionUtils.isEmpty(relList)) {
|
||||||
|
relList.forEach(rel -> {
|
||||||
|
rel.setLessonId(newLesson.getId());
|
||||||
|
rel.setChapterId(idChangedMap.get(rel.getChapterId()));
|
||||||
|
this.relChapterTrainingDAO.insert(rel);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建并插入课程版本信息
|
||||||
|
*/
|
||||||
|
private void buildAndInsertLessonVersion(LsLesson lesson) {
|
||||||
|
LsLessonVersion latest = this.getLatestLessonVersion(lesson.getId());
|
||||||
|
String version = null == latest ? null : latest.getVersion();
|
||||||
|
LsLessonVersion newVersion = buildVersion(lesson, version);
|
||||||
|
this.lessonVersionDAO.insert(newVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新的版本信息
|
||||||
|
*/
|
||||||
|
private LsLessonVersion buildVersion(LsLesson lesson, String old) {
|
||||||
|
String version = VersionUtil.generateNext(old);
|
||||||
|
LsLessonVersion lessonVersion = new LsLessonVersion();
|
||||||
|
lessonVersion.setLessonId(lesson.getId());
|
||||||
|
lessonVersion.setCreatorId(lesson.getCreatorId());
|
||||||
|
lessonVersion.setUpdateTime(lesson.getUpdateTime());
|
||||||
|
lessonVersion.setVersion(version);
|
||||||
|
return lessonVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最新的课程版本信息
|
||||||
|
*/
|
||||||
|
private LsLessonVersion getLatestLessonVersion(Long lessonId) {
|
||||||
|
LsLessonVersionExample example = new LsLessonVersionExample();
|
||||||
|
example.createCriteria().andLessonIdEqualTo(lessonId);
|
||||||
|
example.setOrderByClause("update_time desc");
|
||||||
|
List<LsLessonVersion> list = this.lessonVersionDAO.selectByExample(example);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加课程班级关系
|
||||||
|
*/
|
||||||
|
private void addRelLessonClass(LessonPublishVO publishVO, Long id) {
|
||||||
|
publishVO.getClassIdList().forEach(classId -> {
|
||||||
|
StudentRelLessonClass relLessonClass = new StudentRelLessonClass();
|
||||||
|
relLessonClass.setClassId(classId);
|
||||||
|
relLessonClass.setLessonId(id);
|
||||||
|
this.studentRelLessonClassDAO.insert(relLessonClass);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private LessonVO findByMapAndName(Long mapId, String name) {
|
||||||
|
LsLessonExample lessonExample = new LsLessonExample();
|
||||||
|
lessonExample.createCriteria().andMapIdEqualTo(mapId).andNameEqualTo(name);
|
||||||
|
List<LsLesson> lessonList = this.lessonDAO.selectByExample(lessonExample);
|
||||||
|
if (CollectionUtils.isEmpty(lessonList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new LessonVO(lessonList.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<LsLesson> findLessonEntities(@NonNull Long mapId) {
|
||||||
|
LsLessonExample example = new LsLessonExample();
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
return lessonDAO.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<LsLessonChapter> findChapterEntities(@NonNull List<Long> lessonIds) {
|
||||||
|
if (CollectionUtils.isEmpty(lessonIds))
|
||||||
|
return new ArrayList<>();
|
||||||
|
LsLessonChapterExample example = new LsLessonChapterExample();
|
||||||
|
example.createCriteria().andLessonIdIn(lessonIds);
|
||||||
|
return lessonChapterDAO.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<LsRelChapterTraining> findChapterTrainingRelEntities(@NonNull List<Long> chapterIds) {
|
||||||
|
if (CollectionUtils.isEmpty(chapterIds))
|
||||||
|
return new ArrayList<>();
|
||||||
|
LsRelChapterTrainingExample example = new LsRelChapterTrainingExample();
|
||||||
|
example.createCriteria().andChapterIdIn(chapterIds);
|
||||||
|
return relChapterTrainingDAO.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -849,6 +849,12 @@ public class MapService implements IMapService {
|
|||||||
return mapDataDAO.selectByExample(example).stream().map(MapData::getVersion).collect(Collectors.toList());
|
return mapDataDAO.selectByExample(example).stream().map(MapData::getVersion).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MapStationNewVO> getAllStations() {
|
||||||
|
return listOnline().stream().map(MapVO::getId).map(this::getMapDetail)
|
||||||
|
.map(MapVO::findSortedAllStationListNew).flatMap(Collection::stream).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 该版本的地图数据是否存在
|
* 该版本的地图数据是否存在
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,6 @@ import org.springframework.util.StringUtils;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -110,13 +109,11 @@ public class OrderService implements IOrderService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public String createOrder(OrderCreateVO createVO, UserVO user) {
|
public String createOrder(OrderCreateVO createVO, UserVO user) {
|
||||||
if (valid(createVO)) {
|
return create(createVO, user);
|
||||||
return create(createVO, user);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String create(OrderCreateVO createVO, UserVO user) {
|
private String create(OrderCreateVO createVO, UserVO user) {
|
||||||
|
confirmCorrect(createVO);
|
||||||
//新增订单
|
//新增订单
|
||||||
SaleOrder saleOrder = createVO.convert2DB();
|
SaleOrder saleOrder = createVO.convert2DB();
|
||||||
saleOrder.setCode(iOrderNoGenerator.next());
|
saleOrder.setCode(iOrderNoGenerator.next());
|
||||||
@ -144,20 +141,35 @@ public class OrderService implements IOrderService {
|
|||||||
return saleOrder.getCode();
|
return saleOrder.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean valid(OrderCreateVO createVO) {
|
/**
|
||||||
|
* 确认订单参数正确
|
||||||
|
*/
|
||||||
|
private void confirmCorrect(OrderCreateVO createVO) {
|
||||||
SaleOrderTypeEnum type = SaleOrderTypeEnum.getSaleOrderTypeByCode(createVO.getOrderType());
|
SaleOrderTypeEnum type = SaleOrderTypeEnum.getSaleOrderTypeByCode(createVO.getOrderType());
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Business_Contract:
|
case Business_Contract:
|
||||||
Objects.requireNonNull(createVO.getOrganizationId());
|
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getOrganizationId(), "订单组织/单位不能为空");
|
||||||
Objects.requireNonNull(createVO.getContractNo());
|
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getContractNo(), "订单合同号不能为空");
|
||||||
Objects.requireNonNull(createVO.getSellerId());
|
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getSellerId(), "订单销售人员不能为空");
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(iOrganizationService.isExist(createVO.getOrganizationId()),
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getForever(), "订单是否永久不能不填");
|
||||||
"没有该组织机构/企业");
|
if (createVO.getOrganizationId() != null) {
|
||||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotNull(isContractNoExist(createVO.getContractNo()),
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(iOrganizationService.isExist(createVO.getOrganizationId()),
|
||||||
String.format("合同编号为[%s]的订单已存在", createVO.getContractNo()));
|
"没有该组织机构/企业");
|
||||||
|
}
|
||||||
|
if (createVO.getContractNo() != null) {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(isContractNoExist(createVO.getContractNo()),
|
||||||
|
String.format("合同编号为[%s]的订单已存在", createVO.getContractNo()));
|
||||||
|
}
|
||||||
|
if (!createVO.getForever()) {
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getStartTime(), "非永久订单开始时间不能为空");
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getMonthAmount(), "非永久订单购买时长不能为空");
|
||||||
|
}
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPrice(), "订单总价不能为空");
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayWays(), "订单支付方式不能为空");
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayStatus(), "订单支付状态不能为空");
|
||||||
break;
|
break;
|
||||||
case Contract_Gift:
|
case Contract_Gift:
|
||||||
Objects.requireNonNull(createVO.getOrganizationId());
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getOrganizationId(), "订单组织/单位不能为空");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//公共校验
|
//公共校验
|
||||||
@ -179,7 +191,6 @@ public class OrderService implements IOrderService {
|
|||||||
detailVO.getGoodsAmount() != null && detailVO.getGoodsAmount() > 0,
|
detailVO.getGoodsAmount() != null && detailVO.getGoodsAmount() > 0,
|
||||||
"商品数量至少为1");
|
"商品数量至少为1");
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -244,10 +255,7 @@ public class OrderService implements IOrderService {
|
|||||||
public boolean isContractNoExist(String contractNo) {
|
public boolean isContractNoExist(String contractNo) {
|
||||||
SaleOrderExample example = new SaleOrderExample();
|
SaleOrderExample example = new SaleOrderExample();
|
||||||
example.createCriteria().andContractNoEqualTo(contractNo);
|
example.createCriteria().andContractNoEqualTo(contractNo);
|
||||||
if (saleOrderDAO.countByExample(example) == 0) {
|
return saleOrderDAO.countByExample(example) == 0;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SaleOrder findById(Long id) {
|
public SaleOrder findById(Long id) {
|
||||||
|
@ -47,6 +47,8 @@ public class OrganizationService implements IOrganizationService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExist(Long id) {
|
public boolean isExist(Long id) {
|
||||||
|
if (id == null)
|
||||||
|
return false;
|
||||||
if (organizationDAO.selectByPrimaryKey(id) == null) {
|
if (organizationDAO.selectByPrimaryKey(id) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -560,6 +560,7 @@ public class PermissionService implements IPermissionService {
|
|||||||
/**
|
/**
|
||||||
* 根据mapId获取该地图下的综合演练权限
|
* 根据mapId获取该地图下的综合演练权限
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public PermissionVO getJointSimulationPermissionByMapId(Long mapId) {
|
public PermissionVO getJointSimulationPermissionByMapId(Long mapId) {
|
||||||
PermissionExample example = new PermissionExample();
|
PermissionExample example = new PermissionExample();
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
@ -574,4 +575,19 @@ public class PermissionService implements IPermissionService {
|
|||||||
return new PermissionVO(permissions.get(0));
|
return new PermissionVO(permissions.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Permission findJointSimulationEntity(Long mapId) {
|
||||||
|
PermissionExample example = new PermissionExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andMapIdEqualTo(mapId)
|
||||||
|
.andNameLike(String.format("%%%s%%", "综合演练"));
|
||||||
|
example.or()
|
||||||
|
.andMapIdEqualTo(mapId)
|
||||||
|
.andNameLike(String.format("%%%s%%", "Comprehensive exercise cloud platform"));
|
||||||
|
List<Permission> permissions = permissionDAO.selectByExample(example);
|
||||||
|
if (!CollectionUtils.isEmpty(permissions))
|
||||||
|
return permissions.get(0);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,9 @@ public class ReleaseService implements IReleaseService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompetitionDAO competitionDAO;
|
private CompetitionDAO competitionDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IscsDAO iscsDAO;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReleaseVO exportAsJson(Long mapId, ReleaseConfigVO config) {
|
public ReleaseVO exportAsJson(Long mapId, ReleaseConfigVO config) {
|
||||||
ReleaseVO releaseVO = new ReleaseVO();
|
ReleaseVO releaseVO = new ReleaseVO();
|
||||||
@ -78,7 +81,7 @@ public class ReleaseService implements IReleaseService {
|
|||||||
RealLine realLine = realLines.get(0);
|
RealLine realLine = realLines.get(0);
|
||||||
releaseVO.setRealLineConfig(realLine);
|
releaseVO.setRealLineConfig(realLine);
|
||||||
|
|
||||||
if (config.getRunPlan()) {
|
if (config.isRunPlan()) {
|
||||||
this.confirmRunPlanExist(mapId);
|
this.confirmRunPlanExist(mapId);
|
||||||
RunPlanTemplateExample runPlanTemplateExample = new RunPlanTemplateExample();
|
RunPlanTemplateExample runPlanTemplateExample = new RunPlanTemplateExample();
|
||||||
runPlanTemplateExample.createCriteria().andMapIdEqualTo(mapId);
|
runPlanTemplateExample.createCriteria().andMapIdEqualTo(mapId);
|
||||||
@ -107,7 +110,7 @@ public class ReleaseService implements IReleaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.getMap3dData()) {
|
if (config.isMap3dData()) {
|
||||||
Map3dDataExample map3dDataExample = new Map3dDataExample();
|
Map3dDataExample map3dDataExample = new Map3dDataExample();
|
||||||
map3dDataExample.createCriteria().andMapIdEqualTo(mapId);
|
map3dDataExample.createCriteria().andMapIdEqualTo(mapId);
|
||||||
List<Map3dDataWithBLOBs> map3dDataWithBLOBs = map3dDataDAO.selectByExampleWithBLOBs(map3dDataExample);
|
List<Map3dDataWithBLOBs> map3dDataWithBLOBs = map3dDataDAO.selectByExampleWithBLOBs(map3dDataExample);
|
||||||
@ -115,7 +118,7 @@ public class ReleaseService implements IReleaseService {
|
|||||||
releaseVO.setMap3dData(map3dDataWithBLOBs.get(0));
|
releaseVO.setMap3dData(map3dDataWithBLOBs.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.getCommandDefinition()) {
|
if (config.isCommandDefinition()) {
|
||||||
MapVO mapInfo2 = iMapService.getMapInfoById(mapId);
|
MapVO mapInfo2 = iMapService.getMapInfoById(mapId);
|
||||||
CommandDefinitionExample commandDefinitionExample = new CommandDefinitionExample();
|
CommandDefinitionExample commandDefinitionExample = new CommandDefinitionExample();
|
||||||
commandDefinitionExample.createCriteria().andLineCodeEqualTo(mapInfo2.getLineCode());
|
commandDefinitionExample.createCriteria().andLineCodeEqualTo(mapInfo2.getLineCode());
|
||||||
@ -124,7 +127,7 @@ public class ReleaseService implements IReleaseService {
|
|||||||
releaseVO.setCommandDefinitionList(commandDefinitions);
|
releaseVO.setCommandDefinitionList(commandDefinitions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.getIbp()) {
|
if (config.isIbp()) {
|
||||||
IbpExample example = new IbpExample();
|
IbpExample example = new IbpExample();
|
||||||
example.createCriteria().andMapIdEqualTo(mapId);
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
List<Ibp> ibps = ibpDAO.selectByExampleWithBLOBs(example);
|
List<Ibp> ibps = ibpDAO.selectByExampleWithBLOBs(example);
|
||||||
@ -132,7 +135,15 @@ public class ReleaseService implements IReleaseService {
|
|||||||
releaseVO.setIbpList(ibps);
|
releaseVO.setIbpList(ibps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.getScript()) {
|
if (config.isIscs()) {
|
||||||
|
IscsExample example = new IscsExample();
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
List<Iscs> iscsList = iscsDAO.selectByExampleWithBLOBs(example);
|
||||||
|
if (!CollectionUtils.isEmpty(iscsList)) {
|
||||||
|
releaseVO.setIscsList(iscsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.isScript()) {
|
||||||
//草稿地图
|
//草稿地图
|
||||||
ScriptDraftExample example = new ScriptDraftExample();
|
ScriptDraftExample example = new ScriptDraftExample();
|
||||||
example.createCriteria().andMapIdEqualTo(mapId);
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
@ -283,6 +294,16 @@ public class ReleaseService implements IReleaseService {
|
|||||||
}
|
}
|
||||||
ibpDAO.batchInsertWithId(ibpList);
|
ibpDAO.batchInsertWithId(ibpList);
|
||||||
}
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(releaseVO.getIscsList())) {
|
||||||
|
List<Iscs> iscsList = releaseVO.getIscsList();
|
||||||
|
//删除旧数据
|
||||||
|
IscsExample example = new IscsExample();
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
iscsDAO.deleteByExample(example);
|
||||||
|
//插入新数据
|
||||||
|
iscsList.forEach(iscs->iscs.setMapId(mapId));
|
||||||
|
iscsDAO.batchInsert(iscsList);
|
||||||
|
}
|
||||||
if (!CollectionUtils.isEmpty(releaseVO.getScriptDrafts())) {
|
if (!CollectionUtils.isEmpty(releaseVO.getScriptDrafts())) {
|
||||||
//删除旧草稿
|
//删除旧草稿
|
||||||
ScriptDraftExample example = new ScriptDraftExample();
|
ScriptDraftExample example = new ScriptDraftExample();
|
||||||
|
@ -6,13 +6,13 @@ import club.joylink.rtss.dao.RealLineDAO;
|
|||||||
import club.joylink.rtss.dao.RunPlanDraftDAO;
|
import club.joylink.rtss.dao.RunPlanDraftDAO;
|
||||||
import club.joylink.rtss.dao.RunPlanLevelDAO;
|
import club.joylink.rtss.dao.RunPlanLevelDAO;
|
||||||
import club.joylink.rtss.entity.*;
|
import club.joylink.rtss.entity.*;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssert;
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
||||||
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
|
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
|
||||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
||||||
import club.joylink.rtss.simulation.cbtc.build.RunPlanBuilder;
|
import club.joylink.rtss.simulation.cbtc.build.RunPlanBuilder;
|
||||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
@ -25,10 +25,10 @@ import club.joylink.rtss.vo.client.map.newmap.*;
|
|||||||
import club.joylink.rtss.vo.client.runplan.*;
|
import club.joylink.rtss.vo.client.runplan.*;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
|
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanUserConfigVO;
|
import club.joylink.rtss.vo.client.runplan.user.RunPlanUserConfigVO;
|
||||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanGenerator;
|
import club.joylink.rtss.services.runplan.RunPlanGenerator;
|
||||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInput;
|
import club.joylink.rtss.vo.runplan.RunPlanInput;
|
||||||
import club.joylink.rtss.vo.runplan.newdraw.RunPlanInputData;
|
import club.joylink.rtss.vo.runplan.RunPlanInputData;
|
||||||
import club.joylink.rtss.vo.runplan.newrunplan.*;
|
import club.joylink.rtss.services.runplan.importReal.*;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -95,10 +95,10 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public RunPlanEChartsDataVO createCommon(Long id, RunPlanInput runPlanInput,UserVO userVO) {
|
public RunPlanEChartsDataVO createCommon(Long id, RunPlanInput runPlanInput, UserVO userVO) {
|
||||||
RunPlanDraft draftPlan = runPlanDraftDAO.selectByPrimaryKey(id);
|
RunPlanDraft draftPlan = runPlanDraftDAO.selectByPrimaryKey(id);
|
||||||
MapVO mapVO = this.iMapService.getMapDetail(draftPlan.getMapId());
|
MapVO mapVO = this.iMapService.getMapDetail(draftPlan.getMapId());
|
||||||
List<RunPlanTripVO> runPlanTrips = runPlanGenerator.generatorTrips(userVO.getId(),runPlanInput, mapVO);
|
List<RunPlanTripVO> runPlanTrips = runPlanGenerator.generatorTrips(userVO.getId(), runPlanInput, mapVO);
|
||||||
draftPlan.setTrips(JsonUtils.writeValueAsString(runPlanTrips));
|
draftPlan.setTrips(JsonUtils.writeValueAsString(runPlanTrips));
|
||||||
draftPlan.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
draftPlan.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||||
runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(draftPlan);
|
runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(draftPlan);
|
||||||
@ -152,6 +152,15 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
runPlanDraftDAO.deleteByPrimaryKey(planId);
|
runPlanDraftDAO.deleteByPrimaryKey(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDraftData(Long planId, UserVO userVO) {
|
||||||
|
RunPlanDraft planDraft = runPlanDraftDAO.selectByPrimaryKey(planId);
|
||||||
|
BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(Objects.equals(planDraft.getCreatorId(), userVO.getId()));
|
||||||
|
planDraft.setTrips(null);
|
||||||
|
planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||||
|
runPlanDraftDAO.updateByPrimaryKeyWithBLOBs(planDraft);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void publish(Long planId, UserVO userVO) {
|
public void publish(Long planId, UserVO userVO) {
|
||||||
@ -178,7 +187,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertHasText(runPlanDraft.getTrips(),
|
BusinessExceptionAssertEnum.DATA_ERROR.assertHasText(runPlanDraft.getTrips(),
|
||||||
"运行图车次数据为空,请检查!");
|
"运行图车次数据为空,请检查!");
|
||||||
RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft);
|
RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft);
|
||||||
if(StringUtils.hasText(runPlanName)) runPlanVO.setName(runPlanName);
|
if (StringUtils.hasText(runPlanName)) runPlanVO.setName(runPlanName);
|
||||||
runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(), JsonUtils.getCollectionType(List.class, RunPlanTripVO.class)));
|
runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(), JsonUtils.getCollectionType(List.class, RunPlanTripVO.class)));
|
||||||
iRunPlanTemplateService.draftPublish(runPlanVO, userVO);
|
iRunPlanTemplateService.draftPublish(runPlanVO, userVO);
|
||||||
runPlanDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_03);
|
runPlanDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_03);
|
||||||
@ -201,7 +210,6 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
.filter(mapSectionVO -> StringUtils.hasText(mapSectionVO.getDestinationCode()))
|
.filter(mapSectionVO -> StringUtils.hasText(mapSectionVO.getDestinationCode()))
|
||||||
.collect(Collectors.toMap(MapSectionNewVO::getDestinationCode, Function.identity()));
|
.collect(Collectors.toMap(MapSectionNewVO::getDestinationCode, Function.identity()));
|
||||||
// 导入数据校验并预处理
|
// 导入数据校验并预处理
|
||||||
IRunPlanStrategyNew runPlanStrategy;
|
|
||||||
//获取线路上行对应方向
|
//获取线路上行对应方向
|
||||||
String upDirection = null;
|
String upDirection = null;
|
||||||
RealLineExample example = new RealLineExample();
|
RealLineExample example = new RealLineExample();
|
||||||
@ -217,42 +225,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
upDirection = BusinessConsts.RealLine.Direction.LEFT;
|
upDirection = BusinessConsts.RealLine.Direction.LEFT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (mapVO.getLineCode()) {
|
IRunPlanStrategyNew runPlanStrategy =RunPlanImportStrategyEnum.matchImportStrategy(mapVO.getLineCode());
|
||||||
case "01":
|
|
||||||
runPlanStrategy = new ChengDuLine1RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "02":
|
|
||||||
runPlanStrategy = new FuZhouLine1RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "03":
|
|
||||||
runPlanStrategy = new BeiJingLine1RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "04":
|
|
||||||
runPlanStrategy = new ChengDuLine3RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "06":
|
|
||||||
runPlanStrategy = new NingBoLine1RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "07":
|
|
||||||
runPlanStrategy = new HarBinLine1RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "08":
|
|
||||||
runPlanStrategy = new FoshanTramRunPlanNew();
|
|
||||||
break;
|
|
||||||
case "09":
|
|
||||||
runPlanStrategy = new XianLine2RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "10":
|
|
||||||
runPlanStrategy = new XianLine1RunPlanNew();
|
|
||||||
break;
|
|
||||||
case "11":
|
|
||||||
case "12": //宁波三测试图
|
|
||||||
runPlanStrategy = new XianLine3RunPlanNew();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
runPlanStrategy = new DefaultRunPlanNew();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
runPlanStrategy.importDataCheckAndPreHandle(runPlanImportList, stationList, upDirection);
|
runPlanStrategy.importDataCheckAndPreHandle(runPlanImportList, stationList, upDirection);
|
||||||
// 生成到站计划数据
|
// 生成到站计划数据
|
||||||
tripVOList = runPlanStrategy.parseRunPlanImport(runPlanImportList, sectionMap, upDirection);
|
tripVOList = runPlanStrategy.parseRunPlanImport(runPlanImportList, sectionMap, upDirection);
|
||||||
@ -408,14 +381,14 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
public List getRoutingSectionList(Long planId, String routingCode) {
|
public List getRoutingSectionList(Long planId, String routingCode) {
|
||||||
RunPlanDraft runPlanDraft = runPlanDraftDAO.selectByPrimaryKey(planId);
|
RunPlanDraft runPlanDraft = runPlanDraftDAO.selectByPrimaryKey(planId);
|
||||||
MapVO mapVO = this.iMapService.getMapDetail(runPlanDraft.getMapId());
|
MapVO mapVO = this.iMapService.getMapDetail(runPlanDraft.getMapId());
|
||||||
if(mapVO.isDrawWay()){
|
if (mapVO.isDrawWay()) {
|
||||||
|
|
||||||
MapRoutingDataVO routingVO = mapVO.findRoutingDataByCode(routingCode);
|
MapRoutingDataVO routingVO = mapVO.findRoutingDataByCode(routingCode);
|
||||||
if (Objects.nonNull(routingVO)) {
|
if (Objects.nonNull(routingVO)) {
|
||||||
return routingVO.getParkSectionCodeList();
|
return routingVO.getParkSectionCodeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
MapRoutingVO routingVO = mapVO.findRoutingByCode(routingCode);
|
MapRoutingVO routingVO = mapVO.findRoutingByCode(routingCode);
|
||||||
if (Objects.nonNull(routingVO)) {
|
if (Objects.nonNull(routingVO)) {
|
||||||
return routingVO.getRoutingSectionList();
|
return routingVO.getRoutingSectionList();
|
||||||
@ -446,17 +419,17 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
String startSectionCode = routingData.getStartSectionCode();
|
String startSectionCode = routingData.getStartSectionCode();
|
||||||
MapSectionNewVO endSection = mapVO.findSectionNew(endSectionCode);
|
MapSectionNewVO endSection = mapVO.findSectionNew(endSectionCode);
|
||||||
MapSectionNewVO endReentrySection = null;
|
MapSectionNewVO endReentrySection = null;
|
||||||
if(endSection.isStandTrack()) {
|
if (endSection.isStandTrack()) {
|
||||||
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
|
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode,"车站" + routingData.getEndStationCode() + "折返轨未设置");
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode, "车站" + routingData.getEndStationCode() + "折返轨未设置");
|
||||||
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
||||||
}
|
}
|
||||||
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
||||||
MapSectionNewVO startReentrySection = null;
|
MapSectionNewVO startReentrySection = null;
|
||||||
if(startSection.isStandTrack()) {
|
if (startSection.isStandTrack()) {
|
||||||
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
|
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode,"车站" + routingData.getStartStationCode() + "折返轨未设置");
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode, "车站" + routingData.getStartStationCode() + "折返轨未设置");
|
||||||
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routingData, startReentrySection, endReentrySection);
|
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routingData, startReentrySection, endReentrySection);
|
||||||
@ -509,15 +482,15 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
RunPlanVO planVO = getRunPlanById(planId);
|
RunPlanVO planVO = getRunPlanById(planId);
|
||||||
MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
|
MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
|
||||||
if (Objects.nonNull(inputData.getDepartureInterval())) {
|
if (Objects.nonNull(inputData.getDepartureInterval())) {
|
||||||
String max = planVO.getTripList().stream().map(RunPlanTripVO::getServiceNumber).max(Comparator.naturalOrder()).orElse("0");
|
String max = planVO.getTripList().stream().map(RunPlanTripVO::getServiceNumber).max(Comparator.comparingInt(Integer::parseInt)).orElse("0");
|
||||||
// 当前已有最大服务号
|
// 当前已有最大服务号
|
||||||
int maxServiceNumber = Integer.parseInt(max);
|
int maxServiceNumber = Integer.parseInt(max);
|
||||||
inputData.setServiceNumber(String.format("%03d", ++maxServiceNumber));
|
inputData.setServiceNumber(String.format("%03d", ++maxServiceNumber));
|
||||||
Integer departureInterval = inputData.getDepartureInterval() < 60 ? 180 : inputData.getDepartureInterval();
|
Integer departureInterval = inputData.getDepartureInterval() < 60 ? 180 : inputData.getDepartureInterval();
|
||||||
inputData.setDepartureInterval(departureInterval);
|
inputData.setDepartureInterval(departureInterval);
|
||||||
}
|
}
|
||||||
List<RunPlanTripVO> newTripList = runPlanGenerator.generatorTrips(userId,inputData,mapVO);
|
List<RunPlanTripVO> newTripList = runPlanGenerator.generatorTrips(userId, inputData, mapVO);
|
||||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(CollectionUtils.isEmpty(newTripList),String.format("生成服务号%s运行图数据失败",inputData.getServiceNumber()));
|
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(CollectionUtils.isEmpty(newTripList), String.format("生成服务号%s运行图数据失败", inputData.getServiceNumber()));
|
||||||
planVO.getTripList().addAll(newTripList);
|
planVO.getTripList().addAll(newTripList);
|
||||||
RunPlanDraft planDraft = planVO.convert2Draft();
|
RunPlanDraft planDraft = planVO.convert2Draft();
|
||||||
planDraft.setTrips(JsonUtils.writeValueAsString(planVO.getTripList()));
|
planDraft.setTrips(JsonUtils.writeValueAsString(planVO.getTripList()));
|
||||||
@ -565,7 +538,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
// 数据校验
|
// 数据校验
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(serviceConfig.getTimes() > 0 && serviceConfig.getIntervals() >= 30);
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(serviceConfig.getTimes() > 0 && serviceConfig.getIntervals() >= 30);
|
||||||
RunPlanVO planVO = getRunPlanById(planId);
|
RunPlanVO planVO = getRunPlanById(planId);
|
||||||
String max = planVO.getTripList().stream().map(RunPlanTripVO::getServiceNumber).max(Comparator.naturalOrder()).orElse("");
|
String max = planVO.getTripList().stream().map(RunPlanTripVO::getServiceNumber).max(Comparator.comparingInt(Integer::parseInt)).orElse("");
|
||||||
// 查询最大服务号
|
// 查询最大服务号
|
||||||
int maxServiceNumber = Integer.parseInt(max);
|
int maxServiceNumber = Integer.parseInt(max);
|
||||||
List<RunPlanTripVO> tripVOList = planVO.getTripList().stream()
|
List<RunPlanTripVO> tripVOList = planVO.getTripList().stream()
|
||||||
@ -587,9 +560,14 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
planTripVO.setRight(tripVO.getRight());
|
planTripVO.setRight(tripVO.getRight());
|
||||||
planTripVO.setDestinationCode(tripVO.getDestinationCode());
|
planTripVO.setDestinationCode(tripVO.getDestinationCode());
|
||||||
planTripVO.setStartSectionCode(tripVO.getStartSectionCode());
|
planTripVO.setStartSectionCode(tripVO.getStartSectionCode());
|
||||||
planTripVO.setStartTime(tripVO.getStartTime().plusSeconds(seconds));
|
|
||||||
planTripVO.setEndSectionCode(tripVO.getEndSectionCode());
|
planTripVO.setEndSectionCode(tripVO.getEndSectionCode());
|
||||||
planTripVO.setEndTime(tripVO.getEndTime().plusSeconds(seconds));
|
if (serviceConfig.isForward()) {
|
||||||
|
planTripVO.setStartTime(tripVO.getStartTime().minusSeconds(seconds));
|
||||||
|
planTripVO.setEndTime(tripVO.getEndTime().minusSeconds(seconds));
|
||||||
|
} else {
|
||||||
|
planTripVO.setStartTime(tripVO.getStartTime().plusSeconds(seconds));
|
||||||
|
planTripVO.setEndTime(tripVO.getEndTime().plusSeconds(seconds));
|
||||||
|
}
|
||||||
planTripVO.setIsReentry(tripVO.getIsReentry());
|
planTripVO.setIsReentry(tripVO.getIsReentry());
|
||||||
planTripVO.setIsOutbound(tripVO.getIsOutbound());
|
planTripVO.setIsOutbound(tripVO.getIsOutbound());
|
||||||
planTripVO.setIsInbound(tripVO.getIsInbound());
|
planTripVO.setIsInbound(tripVO.getIsInbound());
|
||||||
@ -620,7 +598,49 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**修改服务号号*/
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void moveRunPlanService(Long planId, String serviceNumber, RunPlanServiceConfigVO serviceConfig, UserVO userVO) {
|
||||||
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(serviceConfig.getIntervals() > 0, "服务计划平移时间需大于0s");
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(this.ifServerExists(planId, serviceNumber));
|
||||||
|
RunPlanVO planVO = getRunPlanById(planId);
|
||||||
|
int intervals = serviceConfig.getIntervals();
|
||||||
|
boolean forward = serviceConfig.isForward();
|
||||||
|
if (forward) {
|
||||||
|
planVO.getTripList().stream()
|
||||||
|
.filter(tripVO -> tripVO.getServiceNumber().equals(serviceNumber))
|
||||||
|
.forEach(tr -> {
|
||||||
|
tr.setStartTime(tr.getStartTime().minusSeconds(intervals));
|
||||||
|
tr.setEndTime(tr.getEndTime().minusSeconds(intervals));
|
||||||
|
for (RunPlanTripTimeVO timeVO : tr.getTimeList()) {
|
||||||
|
timeVO.setArrivalTime(timeVO.getArrivalTime().minusSeconds(intervals));
|
||||||
|
timeVO.setDepartureTime(timeVO.getDepartureTime().minusSeconds(intervals));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
planVO.getTripList().stream()
|
||||||
|
.filter(tripVO -> tripVO.getServiceNumber().equals(serviceNumber))
|
||||||
|
.forEach(tr -> {
|
||||||
|
tr.setStartTime(tr.getStartTime().plusSeconds(intervals));
|
||||||
|
tr.setEndTime(tr.getEndTime().plusSeconds(intervals));
|
||||||
|
for (RunPlanTripTimeVO timeVO : tr.getTimeList()) {
|
||||||
|
timeVO.setArrivalTime(timeVO.getArrivalTime().plusSeconds(intervals));
|
||||||
|
timeVO.setDepartureTime(timeVO.getDepartureTime().plusSeconds(intervals));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
RunPlanDraft planDraft = planVO.convert2Draft();
|
||||||
|
planDraft.setTrips(JsonUtils.writeValueAsString(planVO.getTripList()));
|
||||||
|
planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||||
|
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改服务号号
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateRunPlanServiceNumber(Long planId, String oldServiceNumber, String serviceNumber) {
|
public void updateRunPlanServiceNumber(Long planId, String oldServiceNumber, String serviceNumber) {
|
||||||
RunPlanVO runPlanVO = getRunPlanById(planId);
|
RunPlanVO runPlanVO = getRunPlanById(planId);
|
||||||
@ -662,10 +682,12 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
// planDraft.setTrips(JsonUtils.writeValueAsString(runPlanVO.getTripList()));
|
// planDraft.setTrips(JsonUtils.writeValueAsString(runPlanVO.getTripList()));
|
||||||
// planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
// planDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||||
// runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
// runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||||
this.addTrip(runPlanVO, del.getServiceNumber(), tripConfig,userVO);
|
this.addTrip(runPlanVO, del.getServiceNumber(), tripConfig, userVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**修改车次号*/
|
/**
|
||||||
|
* 修改车次号
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateRunPlanTripNumber(Long planId, String SDTNumber, String tripNumber) {
|
public void updateRunPlanTripNumber(Long planId, String SDTNumber, String tripNumber) {
|
||||||
RunPlanVO runPlanVO = getRunPlanById(planId);
|
RunPlanVO runPlanVO = getRunPlanById(planId);
|
||||||
@ -681,8 +703,10 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
runPlanDraftDAO.updateByPrimaryKeySelective(planDraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加车次号(不校验服务号)*/
|
/**
|
||||||
private void addTrip(RunPlanVO runPlanVO, String serviceNumber, RunPlanTripConfigVO tripConfig,UserVO userVO) {
|
* 添加车次号(不校验服务号)
|
||||||
|
*/
|
||||||
|
private void addTrip(RunPlanVO runPlanVO, String serviceNumber, RunPlanTripConfigVO tripConfig, UserVO userVO) {
|
||||||
MapVO mapVO = this.iMapService.getMapDetail(runPlanVO.getMapId());
|
MapVO mapVO = this.iMapService.getMapDetail(runPlanVO.getMapId());
|
||||||
RunPlanUserConfigVO config = runPlanUserConfigService.getConfig(userVO.getId(), mapVO.getId());
|
RunPlanUserConfigVO config = runPlanUserConfigService.getConfig(userVO.getId(), mapVO.getId());
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(config) && config.hasReentryData(), "运行图-用户缺少配置或没有配置车站折返数据");
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(config) && config.hasReentryData(), "运行图-用户缺少配置或没有配置车站折返数据");
|
||||||
@ -699,19 +723,19 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
String startSectionCode = routingData.getStartSectionCode();
|
String startSectionCode = routingData.getStartSectionCode();
|
||||||
MapSectionNewVO endSection = mapVO.findSectionNew(endSectionCode);
|
MapSectionNewVO endSection = mapVO.findSectionNew(endSectionCode);
|
||||||
MapSectionNewVO endReentrySection = null;
|
MapSectionNewVO endReentrySection = null;
|
||||||
if(endSection.isStandTrack()) {
|
if (endSection.isStandTrack()) {
|
||||||
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
|
String endReentrySectionCode = userReentryData.get(routingData.getEndStationCode());
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode,"车站" + routingData.getEndStationCode() + "折返轨未设置");
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(endReentrySectionCode, "车站" + routingData.getEndStationCode() + "折返轨未设置");
|
||||||
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
|
||||||
}
|
}
|
||||||
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
MapSectionNewVO startSection = mapVO.findSectionNew(startSectionCode);
|
||||||
MapSectionNewVO startReentrySection = null;
|
MapSectionNewVO startReentrySection = null;
|
||||||
if(startSection.isStandTrack()) {
|
if (startSection.isStandTrack()) {
|
||||||
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
|
String startReentrySectionCode = userReentryData.get(routingData.getStartStationCode());
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode,"车站" + routingData.getStartStationCode() + "折返轨未设置");
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(startReentrySectionCode, "车站" + routingData.getStartStationCode() + "折返轨未设置");
|
||||||
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
|
||||||
}
|
}
|
||||||
tripVO = new RunPlanTripVO(tripConfig, routingData, startReentrySection, endReentrySection);
|
tripVO = new RunPlanTripVO(tripConfig, routingData, startReentrySection, endReentrySection);
|
||||||
// 构建类车到站数据
|
// 构建类车到站数据
|
||||||
// tripVO = new RunPlanTripVO(tripConfig, routing);
|
// tripVO = new RunPlanTripVO(tripConfig, routing);
|
||||||
setDirectionCode(mapVO.getConfigVO().getUpRight(), tripVO);
|
setDirectionCode(mapVO.getConfigVO().getUpRight(), tripVO);
|
||||||
@ -723,7 +747,12 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
}
|
}
|
||||||
tripVO.setServiceNumber(serviceNumber);
|
tripVO.setServiceNumber(serviceNumber);
|
||||||
tripVO.setTripNumber(tripVO.getDirectionCode() + tripNumber);
|
tripVO.setTripNumber(tripVO.getDirectionCode() + tripNumber);
|
||||||
tripConfig.getArriveConfigList().stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
|
tripConfig.getArriveConfigList().stream().map(RunPlanTripTimeVO::new).sorted(Comparator.comparing(RunPlanTripTimeVO::getArrivalTime)).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
|
||||||
|
|
||||||
|
if (Objects.equals(tripVO.getEndSectionCode(), (new LinkedList<> (tripVO.getTimeList())).getLast().getSectionCode())) {
|
||||||
|
tripVO.setEndTime(tripConfig.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME));
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(runPlanVO.getTripList())) {
|
if (CollectionUtils.isEmpty(runPlanVO.getTripList())) {
|
||||||
runPlanVO.setTripList(new ArrayList<>());
|
runPlanVO.setTripList(new ArrayList<>());
|
||||||
}
|
}
|
||||||
@ -757,6 +786,7 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteRunPlanTrip(Long planId, String SDTNumber, boolean deleteBefore, UserVO userVO) {
|
public void deleteRunPlanTrip(Long planId, String SDTNumber, boolean deleteBefore, UserVO userVO) {
|
||||||
@ -844,9 +874,9 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
for (int i = 0; i < tripList.size(); i++) {
|
for (int i = 0; i < tripList.size(); i++) {
|
||||||
RunPlanTripVO tripVO = tripList.get(i);
|
RunPlanTripVO tripVO = tripList.get(i);
|
||||||
if (DirectionType.Type02.equals(tripVO.getDirectionCode())) {
|
if (DirectionType.Type02.equals(tripVO.getDirectionCode())) {
|
||||||
tripVO.setTripNumber(tripVO.getDirectionCode()+ String.format("%03d", ++upTripNumber));
|
tripVO.setTripNumber(tripVO.getDirectionCode() + String.format("%03d", ++upTripNumber));
|
||||||
} else if (DirectionType.Type01.equals(tripVO.getDirectionCode())) {
|
} else if (DirectionType.Type01.equals(tripVO.getDirectionCode())) {
|
||||||
tripVO.setTripNumber(tripVO.getDirectionCode()+ String.format("%03d", ++downTripNumber));
|
tripVO.setTripNumber(tripVO.getDirectionCode() + String.format("%03d", ++downTripNumber));
|
||||||
}
|
}
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
tripVO.setIsOutbound(true);
|
tripVO.setIsOutbound(true);
|
||||||
@ -888,15 +918,20 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
RunPlanVO planVO = getRunPlanById(planId);
|
RunPlanVO planVO = getRunPlanById(planId);
|
||||||
if (CollectionUtils.isEmpty(planVO.getTripList())) {
|
if (CollectionUtils.isEmpty(planVO.getTripList())) {
|
||||||
errorList.add("运行图数据为空!");
|
errorList.add("运行图数据为空!");
|
||||||
|
return errorList;
|
||||||
}
|
}
|
||||||
MapVO map = this.iMapService.getMapDetail(planVO.getMapId());
|
MapVO map = this.iMapService.getMapDetail(planVO.getMapId());
|
||||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapData(map);
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||||
"地图基础数据校验不通过");
|
"地图基础数据校验不通过");
|
||||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||||
RunPlanBuilder.RunPlanBuildResult runPlanBuildResult =
|
RunPlanBuilder.RunPlanBuildResult runPlanBuildResult =
|
||||||
RunPlanBuilder.buildRunDiagram(deviceMap, planVO);
|
RunPlanBuilder.buildRunDiagram(deviceMap, planVO);
|
||||||
//先屏蔽掉数据检查
|
if(runPlanBuildResult.getErrMsgList().isEmpty()){
|
||||||
|
List<String> errMsgList = SimulationBuilder.checkRunPlanAndBuildLostRoutePaths(runPlanBuildResult.getServerTripMap(),
|
||||||
|
buildResult.getRoutePathMap());
|
||||||
|
return errMsgList;
|
||||||
|
}
|
||||||
return runPlanBuildResult.getErrMsgList();
|
return runPlanBuildResult.getErrMsgList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,17 +941,17 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
RunPlanVO planVO = getRunPlanById(planId);
|
RunPlanVO planVO = getRunPlanById(planId);
|
||||||
planVO.getTripList().forEach(tripVO -> {
|
planVO.getTripList().forEach(tripVO -> {
|
||||||
List<RunPlanTripTimeVO> timeList = tripVO.getTimeList();
|
List<RunPlanTripTimeVO> timeList = tripVO.getTimeList();
|
||||||
if(CollectionUtils.isEmpty(timeList) || timeList.size()<2){
|
if (CollectionUtils.isEmpty(timeList) || timeList.size() < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RunPlanTripTimeVO first = timeList.get(0);
|
RunPlanTripTimeVO first = timeList.get(0);
|
||||||
RunPlanTripTimeVO second = timeList.get(1);
|
RunPlanTripTimeVO second = timeList.get(1);
|
||||||
RunPlanTripTimeVO second2Last = timeList.get(timeList.size()-2);
|
RunPlanTripTimeVO second2Last = timeList.get(timeList.size() - 2);
|
||||||
RunPlanTripTimeVO last = timeList.get(timeList.size()-1);
|
RunPlanTripTimeVO last = timeList.get(timeList.size() - 1);
|
||||||
if(Objects.equals(first.getStationCode(),second.getStationCode())){
|
if (Objects.equals(first.getStationCode(), second.getStationCode())) {
|
||||||
timeList.remove(first);
|
timeList.remove(first);
|
||||||
}
|
}
|
||||||
if(timeList.size()>2 && Objects.equals(second2Last.getStationCode(),last.getStationCode())){
|
if (timeList.size() > 2 && Objects.equals(second2Last.getStationCode(), last.getStationCode())) {
|
||||||
timeList.remove(last);
|
timeList.remove(last);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -92,13 +92,11 @@ public class RunPlanTemplateService implements IRunPlanTemplateService {
|
|||||||
templatePlan.setId(oldPlan.getId());
|
templatePlan.setId(oldPlan.getId());
|
||||||
runPlanTemplateDAO.updateByPrimaryKeyWithBLOBs(templatePlan);
|
runPlanTemplateDAO.updateByPrimaryKeyWithBLOBs(templatePlan);
|
||||||
// 更新版本
|
// 更新版本
|
||||||
RunPlanTemplateVersionExample versionExample = new RunPlanTemplateVersionExample();
|
RunPlanTemplateVersion version = new RunPlanTemplateVersion();
|
||||||
versionExample.createCriteria().andPlanIdEqualTo(oldPlan.getId());
|
version.setPlanId(oldPlan.getId());
|
||||||
RunPlanTemplateVersion version = runPlanTemplateVersionDAO.selectByExample(versionExample).get(0);
|
|
||||||
version.setId(null);
|
|
||||||
version.setVersion(VersionUtil.generateNext(version.getVersion()));
|
|
||||||
version.setUpdateTime(LocalDateTime.now());
|
version.setUpdateTime(LocalDateTime.now());
|
||||||
version.setCreatorId(userVO.getId());
|
version.setCreatorId(userVO.getId());
|
||||||
|
version.setVersion(VersionUtil.generateNext(findVersion(oldPlan.getId())));
|
||||||
runPlanTemplateVersionDAO.insert(version);
|
runPlanTemplateVersionDAO.insert(version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,22 +244,15 @@ public class UserPermissionService implements IUserPermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定类型的用户权限
|
* 获取指定类型的用户权限
|
||||||
*
|
|
||||||
* @param userVO
|
|
||||||
* @param mapId
|
|
||||||
* @param prdType
|
|
||||||
* @param lessonId
|
|
||||||
* @param type
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<UserPermissionVO> getGivenTypeUserPermissionVOList(UserVO userVO, Long mapId, String prdType, Long lessonId, String type) {
|
private List<UserPermissionVO> getGivenTypeUserPermissionVOList(UserVO userVO, Long mapId, String prdType, Long lessonId, String type) {
|
||||||
PermissionVO permission;
|
PermissionVO permission;
|
||||||
if (MapPrdTypeEnum.JOINT.getCode().equals(prdType)) {
|
if (MapPrdTypeEnum.JOINT.getCode().equals(prdType)) {
|
||||||
permission = iPermissionService.getJointSimulationPermissionByMapId(mapId);
|
permission = iPermissionService.getJointSimulationPermissionByMapId(mapId);
|
||||||
} else {
|
} else {
|
||||||
permission = iPermissionService.getTeachPermissionByMapId(mapId);
|
permission = iPermissionService.getTeachPermissionByMapId(mapId);
|
||||||
}
|
}
|
||||||
return this.getByUserIdAndPermissionId(userVO.getId(), permission.getId());
|
return this.getValidByUserIdAndPermissionId(userVO.getId(), permission.getId());
|
||||||
|
|
||||||
|
|
||||||
// PermissionExample permissionExample = new PermissionExample();
|
// PermissionExample permissionExample = new PermissionExample();
|
||||||
@ -290,9 +283,9 @@ public class UserPermissionService implements IUserPermissionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户id和权限id获取用户权限
|
* 根据用户id和权限id获取有效的用户权限
|
||||||
*/
|
*/
|
||||||
private List<UserPermissionVO> getByUserIdAndPermissionId(Long userId, Long permissionId) {
|
private List<UserPermissionVO> getValidByUserIdAndPermissionId(Long userId, Long permissionId) {
|
||||||
UserPermissionExample example = new UserPermissionExample();
|
UserPermissionExample example = new UserPermissionExample();
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
.andUserIdEqualTo(userId)
|
.andUserIdEqualTo(userId)
|
||||||
|
@ -119,7 +119,7 @@ public class UserUsageStatsService implements IUserUsageStatsService {
|
|||||||
}
|
}
|
||||||
usageTotalStatsVO.setTrainingUserCount(0L);
|
usageTotalStatsVO.setTrainingUserCount(0L);
|
||||||
usageTotalStatsVO.setTrainingTime(0L);
|
usageTotalStatsVO.setTrainingTime(0L);
|
||||||
List<LessonVO> lessonVOList = iLessonService.queryLessonsOfMap(mapVO.getId());
|
List<LessonVO> lessonVOList = iLessonService.queryValidLessonsOfMap(mapVO.getId());
|
||||||
List<Long> lessonIds = lessonVOList.stream().map(LessonVO::getId).collect(Collectors.toList());
|
List<Long> lessonIds = lessonVOList.stream().map(LessonVO::getId).collect(Collectors.toList());
|
||||||
if (!CollectionUtils.isEmpty(lessonIds)) {
|
if (!CollectionUtils.isEmpty(lessonIds)) {
|
||||||
UserTrainingStatsExample userTrainingStatsExample = new UserTrainingStatsExample();
|
UserTrainingStatsExample userTrainingStatsExample = new UserTrainingStatsExample();
|
||||||
|
@ -82,11 +82,13 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
|||||||
upStands.forEach(stand -> ciApiService.standHoldTrainCancel(simulation, stand.getCode(), false));
|
upStands.forEach(stand -> ciApiService.standHoldTrainCancel(simulation, stand.getCode(), false));
|
||||||
break;
|
break;
|
||||||
case JJTC:
|
case JJTC:
|
||||||
ibp.setJjtcLight(true);
|
upStands.forEach(stand -> ciApiService.standEB(simulation, stand));
|
||||||
|
downStands.forEach(stand -> ciApiService.standEB(simulation, stand));
|
||||||
ibp.setJjtcBuzzer(true);
|
ibp.setJjtcBuzzer(true);
|
||||||
break;
|
break;
|
||||||
case QXJJTC:
|
case QXJJTC:
|
||||||
ibp.setJjtcLight(false);
|
upStands.forEach(stand -> ciApiService.cancelStandEB(simulation, stand));
|
||||||
|
downStands.forEach(stand -> ciApiService.cancelStandEB(simulation, stand));
|
||||||
break;
|
break;
|
||||||
case BJQC:
|
case BJQC:
|
||||||
ibp.setJjtcBuzzer(false);
|
ibp.setJjtcBuzzer(false);
|
||||||
@ -166,6 +168,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
|||||||
//上行扣车
|
//上行扣车
|
||||||
vrIbp.setSxkcLight(upStands.stream().anyMatch(Stand::isStationHoldTrain));
|
vrIbp.setSxkcLight(upStands.stream().anyMatch(Stand::isStationHoldTrain));
|
||||||
//紧急停车灯
|
//紧急停车灯
|
||||||
|
vrIbp.setJjtcLight(downStands.stream().allMatch(Stand::isEmergencyClosed) && upStands.stream().allMatch(Stand::isEmergencyClosed));
|
||||||
//下行关门
|
//下行关门
|
||||||
vrIbp.setXxgmLight(downStands.stream().allMatch(stand -> stand.getPsd().isCloseAndLock()));
|
vrIbp.setXxgmLight(downStands.stream().allMatch(stand -> stand.getPsd().isCloseAndLock()));
|
||||||
//下行开门
|
//下行开门
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.rtss.services.completition;
|
package club.joylink.rtss.services.completition;
|
||||||
|
|
||||||
|
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||||
import club.joylink.rtss.constants.Project;
|
import club.joylink.rtss.constants.Project;
|
||||||
import club.joylink.rtss.dao.CompetitionDAO;
|
import club.joylink.rtss.dao.CompetitionDAO;
|
||||||
import club.joylink.rtss.dao.CompetitionRecordDAO;
|
import club.joylink.rtss.dao.CompetitionRecordDAO;
|
||||||
@ -8,6 +9,10 @@ import club.joylink.rtss.entity.CompetitionExample;
|
|||||||
import club.joylink.rtss.entity.CompetitionRecord;
|
import club.joylink.rtss.entity.CompetitionRecord;
|
||||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
|
import club.joylink.rtss.services.IGoodsService;
|
||||||
|
import club.joylink.rtss.services.IOrderService;
|
||||||
|
import club.joylink.rtss.services.IPermissionService;
|
||||||
|
import club.joylink.rtss.services.IUserPermissionService;
|
||||||
import club.joylink.rtss.services.script.IScriptService;
|
import club.joylink.rtss.services.script.IScriptService;
|
||||||
import club.joylink.rtss.services.script.IScriptSimulationService;
|
import club.joylink.rtss.services.script.IScriptSimulationService;
|
||||||
import club.joylink.rtss.services.simulation.ProjectSimulationService;
|
import club.joylink.rtss.services.simulation.ProjectSimulationService;
|
||||||
@ -29,6 +34,7 @@ import club.joylink.rtss.vo.client.PageVO;
|
|||||||
import club.joylink.rtss.vo.client.competition.*;
|
import club.joylink.rtss.vo.client.competition.*;
|
||||||
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
||||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||||
|
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -40,6 +46,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -74,6 +81,18 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher;
|
private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUserPermissionService iUserPermissionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPermissionService iPermissionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGoodsService iGoodsService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IOrderService iOrderService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageVO<CompetitionVO> pagedQueryCompetition(CompetitionPagedQueryVO queryVO) {
|
public PageVO<CompetitionVO> pagedQueryCompetition(CompetitionPagedQueryVO queryVO) {
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
@ -166,11 +185,19 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
|||||||
@Override
|
@Override
|
||||||
public void loadCompetition(String group, Long id, LoginUserInfoVO userInfo) {
|
public void loadCompetition(String group, Long id, LoginUserInfoVO userInfo) {
|
||||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||||
Long scriptId = getEntity(id).getScriptId();
|
CompetitionWithBLOBs competitionEntity = getEntity(id);
|
||||||
|
if (!competitionEntity.getName().startsWith("场景1")) {
|
||||||
|
Long mapId = simulation.getBuildParams().getMap().getId();
|
||||||
|
List<UserPermissionVO> ups = iUserPermissionService.getSimulationUserPermission(userInfo.getUserVO(),
|
||||||
|
mapId, MapPrdTypeEnum.JOINT.getCode());
|
||||||
|
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertCollectionNotEmpty(ups,
|
||||||
|
"权限不足,无法使用场景");
|
||||||
|
}
|
||||||
|
Long scriptId = competitionEntity.getScriptId();
|
||||||
iScriptSimulationService.loadScript(group, scriptId);
|
iScriptSimulationService.loadScript(group, scriptId);
|
||||||
ScriptBO script = simulation.getScript();
|
ScriptBO script = simulation.getScript();
|
||||||
CompetitionBO competition = this.getCompetitionBO(id, script);
|
CompetitionBO competitionBO = this.getCompetitionBO(id, script);
|
||||||
simulation.setCompetition(competition);
|
simulation.setCompetition(competitionBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -365,6 +392,34 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
|||||||
competitionDAO.insert(competition);
|
competitionDAO.insert(competition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserPermissionVO queryPermissions(Long mapId, UserVO user) {
|
||||||
|
List<UserPermissionVO> permissions = iUserPermissionService.getSimulationUserPermission(user, mapId, MapPrdTypeEnum.JOINT.getCode());
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
Optional<UserPermissionVO> optional = permissions.stream()
|
||||||
|
.filter(up -> up.getRemains() > 0 && !up.getStartTime().isAfter(now) && (up.getEndTime() == null || !up.getEndTime().isBefore(now)))
|
||||||
|
.max((o1, o2) -> {
|
||||||
|
if (o1.getEndTime().isAfter(o2.getEndTime())) {
|
||||||
|
return 1;
|
||||||
|
} else if (o2.getEndTime().isAfter(o1.getEndTime())) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return optional.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String purchasePermission(Long mapId, Long amount, UserVO user) {
|
||||||
|
// PermissionVO jointPermission = iPermissionService.getJointSimulationPermissionByMapId(mapId);
|
||||||
|
// GoodsVO goods = iGoodsService.queryGoodsByPermissionId(jointPermission.getId());
|
||||||
|
// OrderCreateVO orderCreateVO = new OrderCreateVO();
|
||||||
|
// orderCreateVO.setOrganizationId();
|
||||||
|
// iOrderService.createOrder()
|
||||||
|
return "待实现";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存结果
|
* 保存结果
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package club.joylink.rtss.services.completition;
|
package club.joylink.rtss.services.completition;
|
||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
|
||||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
@ -9,6 +9,7 @@ import club.joylink.rtss.vo.client.competition.CompetitionPagedQueryVO;
|
|||||||
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
||||||
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
||||||
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
||||||
|
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -107,4 +108,16 @@ public interface ICompetitionPracticalService {
|
|||||||
* @param competition
|
* @param competition
|
||||||
*/
|
*/
|
||||||
void importFromJson(Long scriptId, String name, CompetitionWithBLOBs competition);
|
void importFromJson(Long scriptId, String name, CompetitionWithBLOBs competition);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该地图下的综合演练权限
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
UserPermissionVO queryPermissions(Long mapId, UserVO user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买权限
|
||||||
|
* @param amount 购买数量,单位为月
|
||||||
|
*/
|
||||||
|
String purchasePermission(Long mapId, Long amount, UserVO user);
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ public class LocalDataServiceImpl implements LocalDataService {
|
|||||||
localDataVO.setDicDetailList(dicDetailList);
|
localDataVO.setDicDetailList(dicDetailList);
|
||||||
// iscs
|
// iscs
|
||||||
IscsExample iscsExample = new IscsExample();
|
IscsExample iscsExample = new IscsExample();
|
||||||
iscsExample.createCriteria().andLineCodeIn(lineCodeList);
|
iscsExample.createCriteria().andMapIdIn(mapIdList);
|
||||||
localDataVO.setIscsList(iscsDAO.selectByExampleWithBLOBs(iscsExample));
|
localDataVO.setIscsList(iscsDAO.selectByExampleWithBLOBs(iscsExample));
|
||||||
// operate_placeholder
|
// operate_placeholder
|
||||||
OperatePlaceholderExample operatePlaceholderExample = new OperatePlaceholderExample();
|
OperatePlaceholderExample operatePlaceholderExample = new OperatePlaceholderExample();
|
||||||
|
@ -177,4 +177,6 @@ public interface DeviceService {
|
|||||||
void addOrUpdateXtyDeviceConfig(UserVO userVO);
|
void addOrUpdateXtyDeviceConfig(UserVO userVO);
|
||||||
|
|
||||||
void addOrUpdateGzbDeviceConfig(UserVO userVO);
|
void addOrUpdateGzbDeviceConfig(UserVO userVO);
|
||||||
|
|
||||||
|
void addOrUpdateSdyDeviceConfig(UserVO userVO);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ import club.joylink.rtss.vo.client.PageVO;
|
|||||||
import club.joylink.rtss.vo.client.project.*;
|
import club.joylink.rtss.vo.client.project.*;
|
||||||
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
||||||
import club.joylink.rtss.vo.client.project.gzb.GzbSwitchConfigVO;
|
import club.joylink.rtss.vo.client.project.gzb.GzbSwitchConfigVO;
|
||||||
|
import club.joylink.rtss.vo.client.project.sdy.SdyPsdConfigVO;
|
||||||
|
import club.joylink.rtss.vo.client.project.sdy.SdyPslConfigVO;
|
||||||
import club.joylink.rtss.vo.client.project.xty.XtyPsdConfigVO;
|
import club.joylink.rtss.vo.client.project.xty.XtyPsdConfigVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
@ -360,6 +362,70 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addOrUpdateSdyDeviceConfig(UserVO userVO) {
|
||||||
|
// 删除旧配置
|
||||||
|
ProjectDeviceExample example = new ProjectDeviceExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andProjectCodeEqualTo(Project.SDY.name())
|
||||||
|
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream()
|
||||||
|
.map(Enum::name).collect(Collectors.toList()));
|
||||||
|
this.projectDeviceDAO.deleteByExample(example);
|
||||||
|
// 保存新配置
|
||||||
|
List<ProjectDevice> list = this.buildSdyProjectDevices(userVO);
|
||||||
|
for (ProjectDevice projectDevice : list) {
|
||||||
|
this.projectDeviceDAO.insert(projectDevice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ProjectDevice> buildSdyProjectDevices(UserVO userVO) {
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
List<ProjectDevice> list = new ArrayList<>();
|
||||||
|
// // 教员机
|
||||||
|
// list.add(buildIm(Project.SDY, userVO.getId()));
|
||||||
|
// PLC网关
|
||||||
|
ProjectDevice plcGateway = new ProjectDevice();
|
||||||
|
plcGateway.setProjectCode(Project.SDY.name());
|
||||||
|
plcGateway.setCode("sdy-gateway");
|
||||||
|
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
|
||||||
|
plcGateway.setCreator(userVO.getId());
|
||||||
|
plcGateway.setCreateTime(now);
|
||||||
|
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 16);
|
||||||
|
plcGateway.setConfig(plcGatewayConfigVO.toJson());
|
||||||
|
list.add(plcGateway);
|
||||||
|
// 屏蔽门
|
||||||
|
ProjectDevice psd = new ProjectDevice();
|
||||||
|
psd.setProjectCode(Project.SDY.name());
|
||||||
|
psd.setCode("sdy-psd");
|
||||||
|
psd.setType(ProjectDeviceType.PSD.name());
|
||||||
|
psd.setCreator(userVO.getId());
|
||||||
|
psd.setCreateTime(now);
|
||||||
|
SdyPsdConfigVO psdConfigVO = new SdyPsdConfigVO();
|
||||||
|
psd.setConfig(psdConfigVO.toJson());
|
||||||
|
list.add(psd);
|
||||||
|
// PSL盘
|
||||||
|
ProjectDevice psl = new ProjectDevice();
|
||||||
|
psl.setProjectCode(Project.SDY.name());
|
||||||
|
psl.setCode("sdy-psl");
|
||||||
|
psl.setType(ProjectDeviceType.PSL.name());
|
||||||
|
psl.setCreator(userVO.getId());
|
||||||
|
psl.setCreateTime(now);
|
||||||
|
SdyPslConfigVO pslConfigVO = new SdyPslConfigVO();
|
||||||
|
psl.setConfig(pslConfigVO.toJson());
|
||||||
|
list.add(psl);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ProjectDevice buildIm(Project project, Long creatorId) {
|
||||||
|
ProjectDevice im = new ProjectDevice();
|
||||||
|
im.setProjectCode(project.name());
|
||||||
|
im.setCode(project.name().toLowerCase() + "-" +"im");
|
||||||
|
im.setType(ProjectDeviceType.IM.name());
|
||||||
|
im.setCreator(creatorId);
|
||||||
|
im.setCreateTime(LocalDateTime.now());
|
||||||
|
return im;
|
||||||
|
}
|
||||||
|
|
||||||
private List<ProjectDevice> buildGzbProjectDevices(UserVO userVO) {
|
private List<ProjectDevice> buildGzbProjectDevices(UserVO userVO) {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
List<ProjectDevice> list = new ArrayList<>();
|
List<ProjectDevice> list = new ArrayList<>();
|
||||||
|
@ -38,4 +38,9 @@ public interface IbpService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IbpVO getBy(IbpQueryVO queryVO);
|
IbpVO getBy(IbpQueryVO queryVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除ibp数据
|
||||||
|
*/
|
||||||
|
void delete(Long id);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package club.joylink.rtss.services.publishData;
|
package club.joylink.rtss.services.publishData;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
|
||||||
import com.github.pagehelper.Page;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import club.joylink.rtss.dao.IbpDAO;
|
import club.joylink.rtss.dao.IbpDAO;
|
||||||
import club.joylink.rtss.entity.Ibp;
|
import club.joylink.rtss.entity.Ibp;
|
||||||
import club.joylink.rtss.entity.IbpExample;
|
import club.joylink.rtss.entity.IbpExample;
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.ibp.IbpQueryVO;
|
import club.joylink.rtss.vo.client.ibp.IbpQueryVO;
|
||||||
import club.joylink.rtss.vo.client.ibp.IbpVO;
|
import club.joylink.rtss.vo.client.ibp.IbpVO;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -83,6 +83,11 @@ public class IbpServiceImpl implements IbpService {
|
|||||||
return new IbpVO(ibp);
|
return new IbpVO(ibp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Long id) {
|
||||||
|
ibpDAO.deleteByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
private Ibp queryEntityBy(Long mapId, String stationCode) {
|
private Ibp queryEntityBy(Long mapId, String stationCode) {
|
||||||
Objects.requireNonNull(mapId, "线路编码不能为空");
|
Objects.requireNonNull(mapId, "线路编码不能为空");
|
||||||
// Objects.requireNonNull(stationCode, "车站编码不能为空");
|
// Objects.requireNonNull(stationCode, "车站编码不能为空");
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.rtss.services.runplan;
|
package club.joylink.rtss.services.runplan;
|
||||||
|
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.client.map.newmap.MapRoutingDataVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingQueryVO;
|
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingQueryVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
|
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
|
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
|
||||||
@ -29,4 +30,5 @@ public interface IRunPlanRoutingService {
|
|||||||
|
|
||||||
List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long planId, String routingCode);
|
List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long planId, String routingCode);
|
||||||
|
|
||||||
|
RunPlanRoutingVO generateUserRouting(RunPlanRoutingVO routingVO);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newdraw;
|
package club.joylink.rtss.services.runplan;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.runplan.IRunPlanParktimeService;
|
|
||||||
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
|
||||||
import club.joylink.rtss.services.runplan.IRunPlanRunlevelService;
|
|
||||||
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
|
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapSectionNewVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
|
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.*;
|
import club.joylink.rtss.vo.client.runplan.user.*;
|
||||||
|
import club.joylink.rtss.vo.runplan.RunPlanInput;
|
||||||
|
import club.joylink.rtss.vo.runplan.RunPlanInputData;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@ -209,7 +207,7 @@ public class RunPlanGenerator {
|
|||||||
|
|
||||||
public List<RunPlanTripVO> generatorTrips(Long userId, RunPlanInputData inputData, MapVO mapVO) {
|
public List<RunPlanTripVO> generatorTrips(Long userId, RunPlanInputData inputData, MapVO mapVO) {
|
||||||
//校验时间
|
//校验时间
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getOverTime().isAfter(inputData.getBeginTime()));
|
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getOverTime().isAfter(inputData.getBeginTime()),"输入参数错误:发车时间应早于结束时间");
|
||||||
LocalTime beginTimeOffset = inputData.getBeginTime().minusHours(OFFSET_TIME_HOURS);
|
LocalTime beginTimeOffset = inputData.getBeginTime().minusHours(OFFSET_TIME_HOURS);
|
||||||
//向前推两小时,如果到前一天,则时间不合理
|
//向前推两小时,如果到前一天,则时间不合理
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getBeginTime().isAfter(beginTimeOffset), "发车时间过早,建议晚于上午两点");
|
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(inputData.getBeginTime().isAfter(beginTimeOffset), "发车时间过早,建议晚于上午两点");
|
||||||
@ -304,29 +302,60 @@ public class RunPlanGenerator {
|
|||||||
|
|
||||||
//计算出库车次运行所需时间
|
//计算出库车次运行所需时间
|
||||||
int size = inboundRouting.getParkSectionCodeList().size();
|
int size = inboundRouting.getParkSectionCodeList().size();
|
||||||
int inboundTripRunTime = inputData.getReentryTime() / 2;
|
int inboundTripRunTime = inputData.getReentryTime()/2;
|
||||||
for (int i = 0; i < size - 1; i++) {
|
for (int i = 0; i < size - 1; i++) {
|
||||||
RunPlanRoutingSection routingSection = inboundRouting.getParkSectionCodeList().get(i);
|
RunPlanRoutingSection routingSection = inboundRouting.getParkSectionCodeList().get(i);
|
||||||
RunPlanRoutingSection nextRoutingSection = inboundRouting.getParkSectionCodeList().get(i + 1);
|
RunPlanRoutingSection nextRoutingSection = inboundRouting.getParkSectionCodeList().get(i + 1);
|
||||||
Integer parkTime = parkTimeMap.getOrDefault(routingSection, 0);
|
Integer parkTime = parkTimeMap.get(routingSection.getSectionCode() );
|
||||||
Integer runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
Integer runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||||
inboundTripRunTime = inboundTripRunTime + parkTime + runTime;
|
inboundTripRunTime = inboundTripRunTime + parkTime + runTime;
|
||||||
}
|
}
|
||||||
//构建环路车次
|
|
||||||
boolean loop = false;
|
//计算出库对接环路运行所需时间
|
||||||
while (temp.getLastStationDepartTime().plusSeconds(inputData.getReentryTime() + inboundTripRunTime).isBefore(inputData.getOverTime())) {
|
int oSize = outRef.getParkSectionCodeList().size();
|
||||||
if (same) {
|
int outRefTripRunTime = inputData.getReentryTime()+parkTimeMap.get(outRef.getParkSectionCodeList().get(oSize - 1).getSectionCode());
|
||||||
if (!loop) {
|
for (int i = 0; i < oSize - 1; i++) {
|
||||||
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
RunPlanRoutingSection routingSection = outRef.getParkSectionCodeList().get(i);
|
||||||
loop = true;
|
RunPlanRoutingSection nextRoutingSection = outRef.getParkSectionCodeList().get(i + 1);
|
||||||
|
Integer parkTime = parkTimeMap.get(routingSection.getSectionCode());
|
||||||
|
Integer runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||||
|
outRefTripRunTime = outRefTripRunTime + parkTime + runTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算另一环路运行所需时间
|
||||||
|
int iSize = other.getParkSectionCodeList().size();
|
||||||
|
int otherTripRunTime = inputData.getReentryTime()+parkTimeMap.get(other.getParkSectionCodeList().get(iSize - 1).getSectionCode());
|
||||||
|
for (int i = 0; i < iSize - 1; i++) {
|
||||||
|
RunPlanRoutingSection routingSection = other.getParkSectionCodeList().get(i);
|
||||||
|
RunPlanRoutingSection nextRoutingSection = other.getParkSectionCodeList().get(i + 1);
|
||||||
|
Integer parkTime = parkTimeMap.get(routingSection.getSectionCode());
|
||||||
|
Integer runTime = runLevelMap.get(routingSection.getSectionCode() + "-" + nextRoutingSection.getSectionCode());
|
||||||
|
otherTripRunTime = otherTripRunTime + parkTime + runTime;
|
||||||
|
}
|
||||||
|
if (same ? true :
|
||||||
|
(temp.getLastStationDepartTime().plusSeconds(inputData.getReentryTime()/2 + inboundTripRunTime).isBefore(inputData.getOverTime()) &&
|
||||||
|
(temp.getLastStationDepartTime().plusSeconds(inputData.getReentryTime()/2).getHour()<3
|
||||||
|
|| temp.getLastStationDepartTime().plusSeconds(inputData.getReentryTime()/2 + outRefTripRunTime + otherTripRunTime + inboundTripRunTime).getHour()>3))
|
||||||
|
) {
|
||||||
|
//构建环路车次
|
||||||
|
boolean loop = false;
|
||||||
|
do {
|
||||||
|
if (same) {
|
||||||
|
if (!loop) {
|
||||||
|
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||||
|
loop = true;
|
||||||
|
} else {
|
||||||
|
buildServiceTrips(inputData, mapVO, other, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||||
|
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buildServiceTrips(inputData, mapVO, other, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
|
||||||
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||||
|
buildServiceTrips(inputData, mapVO, other, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
buildServiceTrips(inputData, mapVO, outRef, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
|
||||||
buildServiceTrips(inputData, mapVO, other, null, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
|
||||||
}
|
}
|
||||||
|
while (temp.getLastStationDepartTime().plusSeconds(inputData.getReentryTime()/2 + inboundTripRunTime).isBefore(inputData.getOverTime())
|
||||||
|
&&
|
||||||
|
(temp.getLastStationDepartTime().plusSeconds(inputData.getReentryTime()/2).getHour()<3||temp.getLastStationDepartTime().plusSeconds(inputData.getReentryTime()/2 + outRefTripRunTime + otherTripRunTime + inboundTripRunTime).getHour()>3));
|
||||||
}
|
}
|
||||||
//构建回库计划
|
//构建回库计划
|
||||||
buildServiceTrips(inputData, mapVO, inboundRouting, false, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
buildServiceTrips(inputData, mapVO, inboundRouting, false, runLevelMap, parkTimeMap, userReentryData, serviceTripList, temp);
|
@ -27,9 +27,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collector;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -76,6 +74,26 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
generateUserParktimes(routingVO, deviceMap);
|
generateUserParktimes(routingVO, deviceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RunPlanRoutingVO generateUserRouting(RunPlanRoutingVO routingVO) {
|
||||||
|
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||||
|
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||||
|
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||||
|
"地图基础数据校验不通过");
|
||||||
|
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||||
|
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
|
||||||
|
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
|
||||||
|
//中间经停所有站台轨
|
||||||
|
List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection, endSection, routingVO.getRight());
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack,
|
||||||
|
"没有找到对应方向的中间经停区段,是否需要更换方向/手动添加/直接保存交路");
|
||||||
|
LinkedList<RunPlanRoutingSection> parkSectionCodeList = passingStandTrack.stream().map(section -> new RunPlanRoutingSection(section.getStation().getCode(), section.getCode())).collect(Collectors.toCollection(LinkedList::new));
|
||||||
|
parkSectionCodeList.addFirst(new RunPlanRoutingSection(routingVO.getStartStationCode(), routingVO.getStartSectionCode()));
|
||||||
|
parkSectionCodeList.addLast(new RunPlanRoutingSection(routingVO.getEndStationCode(), routingVO.getEndSectionCode()));
|
||||||
|
routingVO.setParkSectionCodeList(parkSectionCodeList);
|
||||||
|
return routingVO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RunPlanRoutingVO getUserRouting(Long routingId) {
|
public RunPlanRoutingVO getUserRouting(Long routingId) {
|
||||||
RunPlanRouting routing = getRunPlanRoutingData(routingId);
|
RunPlanRouting routing = getRunPlanRoutingData(routingId);
|
||||||
@ -208,6 +226,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0)).getParkSectionCodeList();
|
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0)).getParkSectionCodeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean ifRoutingDataExist(RunPlanRoutingVO routingVO) {
|
private boolean ifRoutingDataExist(RunPlanRoutingVO routingVO) {
|
||||||
return runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(), JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0;
|
return runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(), JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanImport;
|
import club.joylink.rtss.vo.client.runplan.RunPlanImport;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
@ -206,7 +206,7 @@ public interface IRunPlanStrategyNew {
|
|||||||
runPlanArrivalTime.setDepartureTime(runPlanArrivalTime.getArriveTime());
|
runPlanArrivalTime.setDepartureTime(runPlanArrivalTime.getArriveTime());
|
||||||
}
|
}
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(runPlanArrivalTime.getDepartureTime().isBefore(runPlanArrivalTime.getArriveTime()),
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(runPlanArrivalTime.getDepartureTime().isBefore(runPlanArrivalTime.getArriveTime()),
|
||||||
String.format("数据异常:‘%s’到发时间异常", stationName));
|
String.format("数据异常:‘%s’到发时间异常,到达时间%s-发车时间%s", stationName,runPlanArrivalTime.getArriveTime(),runPlanArrivalTime.getDepartureTime()));
|
||||||
});
|
});
|
||||||
// 按到达时间增序排序
|
// 按到达时间增序排序
|
||||||
arrivalList.sort(Comparator.comparing(RunPlanArrivalTime::getArriveTime));
|
arrivalList.sort(Comparator.comparing(RunPlanArrivalTime::getArriveTime));
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
@ -0,0 +1,236 @@
|
|||||||
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
||||||
|
import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
|
||||||
|
import club.joylink.rtss.vo.client.runplan.RunPlanImport;
|
||||||
|
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
|
||||||
|
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class NingBoLine3RunPlanNew implements IRunPlanStrategyNew {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入数据检查和预处理
|
||||||
|
*
|
||||||
|
* @param runPlanImportList
|
||||||
|
* @param stationList
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void importDataCheckAndPreHandle(List<RunPlanImport> runPlanImportList, List<MapStationNewVO> stationList, String upDirection) {
|
||||||
|
Map<String, MapStationNewVO> stationMap = stationList.stream().collect(
|
||||||
|
Collectors.toMap(MapStationNewVO::getRunPlanName, Function.identity()));
|
||||||
|
runPlanImportList.forEach(runPlanImport -> {
|
||||||
|
this.analyzeAndConvertCode(runPlanImport, upDirection);
|
||||||
|
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
|
||||||
|
handleStationAndTime(stationMap, arrivalList);
|
||||||
|
if(Arrays.asList("36102", "36203","36301").contains(runPlanImport.getCode())){
|
||||||
|
runPlanImport.setBackup(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理转换车次信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
|
||||||
|
String code = runPlanImport.getCode();
|
||||||
|
if (StringUtils.hasText(code) && (code.length() == 5)) {
|
||||||
|
runPlanImport.setServiceNumber(code.substring(0, 3));
|
||||||
|
runPlanImport.setTripNumber(code.substring(3, 5));
|
||||||
|
runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01);
|
||||||
|
setRunPlanDirec(runPlanImport, upDirection);
|
||||||
|
} else {
|
||||||
|
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleTrip(RunPlanImport runPlanImport, RunPlanTripVO tripVO, String startStationName, String endStationName, boolean isFirst, boolean isLast, String firstStationName , String finalStationName) {
|
||||||
|
|
||||||
|
// Y315工作日
|
||||||
|
switch (endStationName) {
|
||||||
|
case "奉化停车场":
|
||||||
|
if(runPlanImport.isBackup()){
|
||||||
|
tripVO.setEndSectionCode("T60"); //T2101
|
||||||
|
}else if(Arrays.asList("32403","32503","32603","31215","30119","30819","31119").contains(runPlanImport.getCode())){
|
||||||
|
tripVO.setEndSectionCode("T62"); //T2102
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "金海路":
|
||||||
|
if (runPlanImport.isBackup()) {
|
||||||
|
tripVO.setEndSectionCode("T4");//T2107
|
||||||
|
} else {
|
||||||
|
tripVO.setEndSectionCode("T9");//T2108
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "首南车辆段":
|
||||||
|
if(Arrays.asList("30518","30618","30918","31718","31818","31918","32018").contains(runPlanImport.getCode())){
|
||||||
|
tripVO.setEndSectionCode("T238"); //T3002
|
||||||
|
}else{
|
||||||
|
tripVO.setEndSectionCode("T237");//T3001
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "南部商务区":
|
||||||
|
tripVO.setEndSectionCode("T313");//T3307
|
||||||
|
break;
|
||||||
|
case "大通桥":
|
||||||
|
tripVO.setEndSectionCode("T545");//T4407
|
||||||
|
break;
|
||||||
|
case "体育馆":
|
||||||
|
tripVO.setEndSectionCode("T442");//T4107
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (startStationName) {
|
||||||
|
case "奉化停车场":
|
||||||
|
tripVO.setStartSectionCode("T62"); //T2102
|
||||||
|
break;
|
||||||
|
case "金海路":
|
||||||
|
if (runPlanImport.isBackup()) {
|
||||||
|
tripVO.setStartSectionCode("T4");//T2107
|
||||||
|
} else {
|
||||||
|
tripVO.setStartSectionCode("T9");//T2108
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "首南车辆段":
|
||||||
|
if(Arrays.asList("30102","30202","30402","32402","32502","32602","30702","31002","31302","30602","30902","31202").contains(runPlanImport.getCode())){
|
||||||
|
tripVO.setStartSectionCode("T238");//T3002
|
||||||
|
}else{
|
||||||
|
tripVO.setStartSectionCode("T237"); //T3001
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "南部商务区":
|
||||||
|
tripVO.setStartSectionCode("T313");//T3307
|
||||||
|
break;
|
||||||
|
case "大通桥":
|
||||||
|
tripVO.setStartSectionCode("T545");//T4407
|
||||||
|
break;
|
||||||
|
case "体育馆":
|
||||||
|
tripVO.setStartSectionCode("T442");//T4107
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Y316双休日
|
||||||
|
// switch (endStationName) {
|
||||||
|
// case "奉化停车场":
|
||||||
|
// if(runPlanImport.isBackup()){
|
||||||
|
// tripVO.setEndSectionCode("T60"); //T2101
|
||||||
|
// }else if(Arrays.asList("30915","31115","30117","30219","31417","30419").contains(runPlanImport.getCode())){
|
||||||
|
// tripVO.setEndSectionCode("T62"); //T2102
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case "金海路":
|
||||||
|
// if (runPlanImport.isBackup()) {
|
||||||
|
// tripVO.setEndSectionCode("T4");//T2107
|
||||||
|
// } else {
|
||||||
|
// tripVO.setEndSectionCode("T9");//T2108
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case "首南车辆段":
|
||||||
|
// if(Arrays.asList("31616","31716","31018","31816","31218","31916","30820").contains(runPlanImport.getCode())){
|
||||||
|
// tripVO.setEndSectionCode("T238"); //T3002
|
||||||
|
// }else{
|
||||||
|
// tripVO.setEndSectionCode("T237");//T3001
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case "南部商务区":
|
||||||
|
// tripVO.setEndSectionCode("T313");//T3307
|
||||||
|
// break;
|
||||||
|
// case "大通桥":
|
||||||
|
// tripVO.setEndSectionCode("T545");//T4407
|
||||||
|
// break;
|
||||||
|
// case "体育馆":
|
||||||
|
// tripVO.setEndSectionCode("T442");//T4107
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// switch (startStationName) {
|
||||||
|
// case "奉化停车场":
|
||||||
|
// tripVO.setStartSectionCode("T62"); //T2102
|
||||||
|
// break;
|
||||||
|
// case "金海路":
|
||||||
|
// if (runPlanImport.isBackup()) {
|
||||||
|
// tripVO.setStartSectionCode("T4");//T2107
|
||||||
|
// } else {
|
||||||
|
// tripVO.setStartSectionCode("T9");//T2108
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case "首南车辆段":
|
||||||
|
// if(Arrays.asList("30102","30202","30402","31302","31502","30502","30702","30902").contains(runPlanImport.getCode())){
|
||||||
|
// tripVO.setStartSectionCode("T238");//T3002
|
||||||
|
// }else{
|
||||||
|
// tripVO.setStartSectionCode("T237"); //T3001
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// case "南部商务区":
|
||||||
|
// tripVO.setStartSectionCode("T313");//T3307
|
||||||
|
// break;
|
||||||
|
// case "大通桥":
|
||||||
|
// tripVO.setStartSectionCode("T545");//T4407
|
||||||
|
// break;
|
||||||
|
// case "体育馆":
|
||||||
|
// tripVO.setStartSectionCode("T442");//T4107
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleTripTime(RunPlanTripTimeVO timeVO, RunPlanImport runPlanImport, MapStationNewVO stationVO, String startStationName, String endStationName) {
|
||||||
|
|
||||||
|
// Y315工作日
|
||||||
|
if("高塘桥".equals(stationVO.getRunPlanName())){
|
||||||
|
if(Arrays.asList("36203","30803","31103").contains(runPlanImport.getCode())){
|
||||||
|
timeVO.setSectionCode("T273");//T3015
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if("首南车辆段".equals(stationVO.getRunPlanName())){
|
||||||
|
if(Arrays.asList("30518","30618","30918","31718","31818","31918","32018","30102","30202","30402","32402","32502","32602","30702","31002","31302","30602","30902","31202").contains(runPlanImport.getCode())){
|
||||||
|
timeVO.setSectionCode("T238");//T3002
|
||||||
|
}else{
|
||||||
|
timeVO.setSectionCode("T237"); //T3001
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//通用
|
||||||
|
if("奉化停车场".equals(stationVO.getRunPlanName())){
|
||||||
|
if(runPlanImport.isBackup() && runPlanImport.getCode().equals("36203")){
|
||||||
|
timeVO.setSectionCode("T60"); //T2101
|
||||||
|
}else{
|
||||||
|
timeVO.setSectionCode("T62"); //T2102
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Y316工作日
|
||||||
|
// if("高塘桥".equals(stationVO.getRunPlanName())){
|
||||||
|
// if(Arrays.asList("36203","30603","30803").contains(runPlanImport.getCode())){
|
||||||
|
// timeVO.setSectionCode("T273");//T3015
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if("首南车辆段".equals(stationVO.getRunPlanName())){
|
||||||
|
// if(Arrays.asList("31616","31716","31018","31816","31218","31916","30820","30102","30202","30402","31302","31502","30502","30702","30902").contains(runPlanImport.getCode())){
|
||||||
|
// timeVO.setSectionCode("T238");//T3002
|
||||||
|
// }else{
|
||||||
|
// timeVO.setSectionCode("T237"); //T3001
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public enum RunPlanImportStrategyEnum {
|
||||||
|
|
||||||
|
ChengDuLine1("01", new ChengDuLine1RunPlanNew()),
|
||||||
|
FuZhouLine1("02", new FuZhouLine1RunPlanNew()),
|
||||||
|
BeiJingLine1("03", new BeiJingLine1RunPlanNew()),
|
||||||
|
ChengDuLine3("04", new ChengDuLine3RunPlanNew()),
|
||||||
|
NingBoLine1("06", new NingBoLine1RunPlanNew()),
|
||||||
|
HarBinLine1("07", new HarBinLine1RunPlanNew()),
|
||||||
|
FoshanTram("08", new FoshanTramRunPlanNew()),
|
||||||
|
XianLine2("09", new XianLine2RunPlanNew()),
|
||||||
|
XianLine1("10", new XianLine1RunPlanNew()),
|
||||||
|
XianLine3("11", new XianLine3RunPlanNew()),
|
||||||
|
NingBoLine3("12", new NingBoLine3RunPlanNew());
|
||||||
|
|
||||||
|
private String lineCode;
|
||||||
|
private IRunPlanStrategyNew runPlanImportStrategy;
|
||||||
|
|
||||||
|
RunPlanImportStrategyEnum(String lineCode, IRunPlanStrategyNew runPlanImportStrategy) {
|
||||||
|
this.lineCode = lineCode;
|
||||||
|
this.runPlanImportStrategy = runPlanImportStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IRunPlanStrategyNew matchImportStrategy(String lineCode) {
|
||||||
|
for (RunPlanImportStrategyEnum strategyEnum : RunPlanImportStrategyEnum.values()) {
|
||||||
|
if (Objects.equals(strategyEnum.lineCode, lineCode)) {
|
||||||
|
return strategyEnum.runPlanImportStrategy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new DefaultRunPlanNew();
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.BusinessConsts;
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.vo.runplan.newrunplan;
|
package club.joylink.rtss.services.runplan.importReal;
|
||||||
|
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
@ -160,7 +160,7 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
|
|||||||
Permission permission = iPermissionService.findTeachPermissionEntity(gzbMapId);
|
Permission permission = iPermissionService.findTeachPermissionEntity(gzbMapId);
|
||||||
log.warn(String.format("项目[%s]没有有效的教学权限", projectCode));
|
log.warn(String.format("项目[%s]没有有效的教学权限", projectCode));
|
||||||
if (permission == null) return;
|
if (permission == null) return;
|
||||||
GoodsVO good = iGoodsService.selectGoodsByPermissionId(permission.getId());
|
GoodsVO good = iGoodsService.queryGoodsByPermissionId(permission.getId());
|
||||||
List<Long> userIds = oldSysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
|
List<Long> userIds = oldSysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||||
List<UserPermission> userPermissions = iUserPermissionService.findEntity(userIds, true);
|
List<UserPermission> userPermissions = iUserPermissionService.findEntity(userIds, true);
|
||||||
List<Long> usersWithPermissions = userPermissions.stream()
|
List<Long> usersWithPermissions = userPermissions.stream()
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package club.joylink.rtss.services.training;
|
package club.joylink.rtss.services.training;
|
||||||
|
|
||||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||||
import club.joylink.rtss.services.ICommandService;
|
import club.joylink.rtss.entity.Training;
|
||||||
import club.joylink.rtss.services.IMapService;
|
import club.joylink.rtss.services.*;
|
||||||
import club.joylink.rtss.services.IOperateService;
|
|
||||||
import club.joylink.rtss.services.IRunPlanTemplateService;
|
|
||||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||||
import club.joylink.rtss.services.training.generatornew.GeneratorFactoryNew;
|
import club.joylink.rtss.services.training.generatornew.GeneratorFactoryNew;
|
||||||
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||||
@ -12,6 +10,8 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
|
|||||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||||
import club.joylink.rtss.vo.client.CommandDefinitionVO;
|
import club.joylink.rtss.vo.client.CommandDefinitionVO;
|
||||||
|
import club.joylink.rtss.vo.client.LessonChapterTrainingRelVO;
|
||||||
|
import club.joylink.rtss.vo.client.LessonVO;
|
||||||
import club.joylink.rtss.vo.client.OperateDefinitionVO;
|
import club.joylink.rtss.vo.client.OperateDefinitionVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
||||||
@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -52,11 +53,17 @@ public class GenerateTask {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ICommandService iCommandService;
|
private ICommandService iCommandService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ILessonService iLessonService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ILessonDraftService iLessonDraftService;
|
||||||
|
|
||||||
private List<String> generateNew(GenerateConfig config, MapVO mapVO, Simulation simulation) {
|
private List<String> generateNew(GenerateConfig config, MapVO mapVO, Simulation simulation) {
|
||||||
// 查询生成规则
|
// 查询生成规则
|
||||||
GeneratorNew generator = this.generatorFactoryNew.getGenerator(config.getTrainingType());
|
GeneratorNew generator = this.generatorFactoryNew.getGenerator(config.getTrainingType());
|
||||||
if (Objects.isNull(generator)) {
|
if (Objects.isNull(generator)) {
|
||||||
log.warn("无对应实训类型[{}]的规则生成器",config.getTrainingType());
|
log.warn("无对应实训类型[{}]的规则生成器", config.getTrainingType());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<String> results = new ArrayList<>();
|
List<String> results = new ArrayList<>();
|
||||||
@ -79,7 +86,7 @@ public class GenerateTask {
|
|||||||
this.iTrainingV1Service.batchSaveAutoGenerateTrainings(trainingVOList);
|
this.iTrainingV1Service.batchSaveAutoGenerateTrainings(trainingVOList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()) + ":" + operateType + " 生成失败", e);
|
log.error(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()) + ":" + operateType + " 生成失败", e);
|
||||||
results.add(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()) + ":" +operateType + " 生成失败");
|
results.add(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()) + ":" + operateType + " 生成失败");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -106,63 +113,124 @@ public class GenerateTask {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量更新自动生成实训的用时/说明
|
* 批量更新自动生成实训的用时/说明
|
||||||
*
|
|
||||||
* @param config
|
|
||||||
*/
|
*/
|
||||||
public void batchUpdateGenerateTraining(GenerateConfig config) {
|
public void batchUpdateGenerateTraining(GenerateConfig config) {
|
||||||
this.iTrainingV1Service.batchUpdateGenerateTraining(config);
|
this.iTrainingV1Service.batchUpdateGenerateTraining(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**生成新地图实训,只能在一键生成接口调用*/
|
/**
|
||||||
|
* 生成新地图实训,只能在一键生成接口调用
|
||||||
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public String generateNewTrainings(Long mapId, MapVO mapVO) {
|
public String generateNewTrainings(Long mapId, MapVO mapVO) {
|
||||||
log.warn("generate training start...[{}]", LocalTime.now());
|
log.warn("generate training start...[{}]", LocalTime.now());
|
||||||
try{
|
// 查询通用运行图
|
||||||
// 查询通用运行图
|
RunPlanVO planVO = this.iRunPlanTemplateService.getFirstRunPlanByMapId(mapVO.getId());
|
||||||
RunPlanVO planVO = this.iRunPlanTemplateService.getFirstRunPlanByMapId(mapVO.getId());
|
this.delete(mapId);
|
||||||
this.delete(mapId);
|
GenerateConfig config = new GenerateConfig();
|
||||||
GenerateConfig config = new GenerateConfig();
|
config.setMapId(mapId);
|
||||||
config.setMapId(mapId);
|
List<String> results = new ArrayList<>();
|
||||||
List<String> results = new ArrayList<>();
|
List<CommandDefinitionVO> commandDefinitions = iCommandService.queryDefinitionsByLineCode(mapVO.getLineCode());
|
||||||
List<CommandDefinitionVO> commandDefinitions = iCommandService.queryDefinitionsByLineCode(mapVO.getLineCode());
|
Map<String, List<CommandDefinitionVO>> groupByPrdType = commandDefinitions.stream()
|
||||||
Map<String, List<CommandDefinitionVO>> groupByPrdType = commandDefinitions.stream()
|
.collect(Collectors.groupingBy(CommandDefinitionVO::getPrdType));
|
||||||
.collect(Collectors.groupingBy(CommandDefinitionVO::getPrdType));
|
groupByPrdType.forEach((r, cdr) -> {
|
||||||
groupByPrdType.forEach((r, cdr) -> {
|
config.setPrdType(r);
|
||||||
config.setPrdType(r);
|
SimulationBuildParams params = SimulationBuildParams.builder()
|
||||||
SimulationBuildParams params = SimulationBuildParams.builder()
|
.createTime(LocalDateTime.now())
|
||||||
.createTime(LocalDateTime.now())
|
.map(mapVO)
|
||||||
.map(mapVO)
|
.prodType(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))
|
||||||
.prodType(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))
|
.runPlan(planVO)
|
||||||
.runPlan(planVO)
|
.build();
|
||||||
.build();
|
Simulation simulation = SimulationBuilder.build(params);
|
||||||
Simulation simulation = SimulationBuilder.build(params);
|
Map<String, List<CommandDefinitionVO>> groupByOperationObject = cdr.stream()
|
||||||
Map<String, List<CommandDefinitionVO>> groupByOperationObject = cdr.stream()
|
.collect(Collectors.groupingBy(CommandDefinitionVO::getOperateObject));
|
||||||
.collect(Collectors.groupingBy(CommandDefinitionVO::getOperateObject));
|
groupByOperationObject.forEach((o, cdo) -> {
|
||||||
groupByOperationObject.forEach((o, cdo) -> {
|
config.setTrainingType(o);
|
||||||
config.setTrainingType(o);
|
config.setOperateType(cdo.stream().map(cd -> cd.getOperate()).collect(Collectors.toList()));
|
||||||
config.setOperateType(cdo.stream().map(cd -> cd.getOperate()).collect(Collectors.toList()));
|
List<String> list = this.generateNew(config, mapVO, simulation);
|
||||||
List<String> list =this.generateNew(config, mapVO,simulation);
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
results.addAll(list);
|
||||||
results.addAll(list);
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
log.warn("generate training end...[{}]", LocalTime.now());
|
||||||
|
return CollectionUtils.isEmpty(results) ? "成功" : String.join(",", results);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
@Transactional
|
||||||
|
public String generateTrainings(Long mapId) {
|
||||||
|
try {
|
||||||
|
Objects.requireNonNull(mapId, "地图id不能为空");
|
||||||
|
//获取地图下章节和实训的关联关系,记录章节下关联的实训的类型和数量
|
||||||
|
List<LessonVO> lessonVOS = iLessonService.queryLessonDetail(mapId);
|
||||||
|
List<LessonChapterTrainingRelVO> rels = lessonVOS.stream().flatMap(lessonVO -> {
|
||||||
|
List<LessonChapterTrainingRelVO> rel = lessonVO.getRel();
|
||||||
|
if (rel == null)
|
||||||
|
return null;
|
||||||
|
// rel = new ArrayList<>();
|
||||||
|
return rel.stream();
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
lessonVOS = null;
|
||||||
|
Map<Long, Training> trainingMap = iTrainingV1Service.findEntities(mapId)
|
||||||
|
.stream().collect(Collectors.toMap(Training::getId, Function.identity()));
|
||||||
|
Map<LessonChapterTrainingRelVO, Training> chapterTrainingRelMap = new HashMap<>();
|
||||||
|
for (LessonChapterTrainingRelVO rel : rels) {
|
||||||
|
Training training = trainingMap.get(rel.getTrainingId());
|
||||||
|
chapterTrainingRelMap.put(rel, training);
|
||||||
|
}
|
||||||
|
trainingMap = null;
|
||||||
|
rels = null;
|
||||||
|
Map<Long, Map<String, Map<String, Map<String, List<Map.Entry<LessonChapterTrainingRelVO, Training>>>>>> oldRelMap
|
||||||
|
= chapterTrainingRelMap.entrySet().stream().collect(
|
||||||
|
Collectors.groupingBy(entry -> entry.getKey().getChapterId(),
|
||||||
|
Collectors.groupingBy(entry -> entry.getValue().getPrdType(),
|
||||||
|
Collectors.groupingBy(entry -> entry.getValue().getType(),
|
||||||
|
Collectors.groupingBy(entry -> entry.getValue().getOperateType())))));
|
||||||
|
chapterTrainingRelMap = null;
|
||||||
|
//生成实训
|
||||||
|
MapVO mapVO = iMapService.getMapDetail(mapId);
|
||||||
|
String result = generateNewTrainings(mapId, mapVO);
|
||||||
|
//根据上面的记录结果重建章节-实训关联关系
|
||||||
|
Map<String, Map<String, Map<String, List<Training>>>> newTrainingMap = iTrainingV1Service.findEntities(mapId)
|
||||||
|
.stream().collect(Collectors.groupingBy(Training::getPrdType, Collectors.groupingBy(Training::getType, Collectors.groupingBy(Training::getOperateType))));
|
||||||
|
List<LessonChapterTrainingRelVO> newRelList = new ArrayList<>();
|
||||||
|
oldRelMap.forEach((chapterId, oldTrainingInfo) -> {
|
||||||
|
oldTrainingInfo.forEach((prdType, typeAndOperateType) -> {
|
||||||
|
Map<String, Map<String, List<Training>>> groupByTypeTrainingMap = newTrainingMap.get(prdType);
|
||||||
|
if (CollectionUtils.isEmpty(groupByTypeTrainingMap)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
typeAndOperateType.forEach((type, operateTypeAndRelEntries) -> {
|
||||||
|
Map<String, List<Training>> groupByOperateTypeTrainingMap = groupByTypeTrainingMap.get(type);
|
||||||
|
if (CollectionUtils.isEmpty(groupByOperateTypeTrainingMap)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
operateTypeAndRelEntries.forEach((operateType, relEntries) -> {
|
||||||
|
List<Training> trainings = groupByOperateTypeTrainingMap.get(operateType);
|
||||||
|
if (CollectionUtils.isEmpty(trainings))
|
||||||
|
return;
|
||||||
|
int trainingIndex = 0;
|
||||||
|
for (Map.Entry<LessonChapterTrainingRelVO, Training> entry : relEntries) {
|
||||||
|
LessonChapterTrainingRelVO oldRel = entry.getKey();
|
||||||
|
oldRel.setTrainingId(trainings.get(trainingIndex).getId());
|
||||||
|
newRelList.add(oldRel);
|
||||||
|
trainingIndex++;
|
||||||
|
if (trainingIndex >= trainings.size())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
log.warn("generate training end...[{}]", LocalTime.now());
|
iLessonService.addChapterTrainingRelAfterDelete(newRelList);
|
||||||
return CollectionUtils.isEmpty(results) ? "成功" : String.join(",", results);
|
return result;
|
||||||
}finally {
|
} finally {
|
||||||
runningmapIds.remove(mapId);
|
runningmapIds.remove(mapId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
public Set<Long> getRunningmapIds() {
|
||||||
public String generateTrainings(Long mapId){
|
|
||||||
|
|
||||||
Objects.requireNonNull(mapId, "地图id不能为空");
|
|
||||||
MapVO mapVO = iMapService.getMapDetail(mapId);
|
|
||||||
return generateNewTrainings(mapId, mapVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Long> getRunningmapIds(){
|
|
||||||
return this.runningmapIds;
|
return this.runningmapIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
|||||||
import club.joylink.rtss.vo.client.training.TrainingQueryVO;
|
import club.joylink.rtss.vo.client.training.TrainingQueryVO;
|
||||||
import club.joylink.rtss.vo.client.training.TrainingResultVO;
|
import club.joylink.rtss.vo.client.training.TrainingResultVO;
|
||||||
import club.joylink.rtss.vo.client.training.TrainingStepVO;
|
import club.joylink.rtss.vo.client.training.TrainingStepVO;
|
||||||
|
import lombok.NonNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -187,4 +188,6 @@ public interface ITrainingV1Service {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Training> findEntities(Long mapId, String prdType);
|
List<Training> findEntities(Long mapId, String prdType);
|
||||||
|
|
||||||
|
List<Training> findEntities(@NonNull Long mapId);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import club.joylink.rtss.vo.client.training.TrainingResultVO;
|
|||||||
import club.joylink.rtss.vo.client.training.TrainingStepVO;
|
import club.joylink.rtss.vo.client.training.TrainingStepVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -689,9 +690,16 @@ public class TrainingV1Service implements ITrainingV1Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Training> findEntities(Long mapId, String prdType) {
|
public List<Training> findEntities(@NonNull Long mapId, @NonNull String prdType) {
|
||||||
TrainingExample example = new TrainingExample();
|
TrainingExample example = new TrainingExample();
|
||||||
example.createCriteria().andMapIdEqualTo(mapId).andPrdTypeEqualTo(prdType);
|
example.createCriteria().andMapIdEqualTo(mapId).andPrdTypeEqualTo(prdType);
|
||||||
return trainingDAO.selectByExample(example);
|
return trainingDAO.selectByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Training> findEntities(@NonNull Long mapId) {
|
||||||
|
TrainingExample example = new TrainingExample();
|
||||||
|
example.createCriteria().andMapIdEqualTo(mapId);
|
||||||
|
return trainingDAO.selectByExample(example);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,9 @@ public interface TrainingConsts {
|
|||||||
/** 始端信号机 */
|
/** 始端信号机 */
|
||||||
START_SIGNAL,
|
START_SIGNAL,
|
||||||
/** 终端信号机 */
|
/** 终端信号机 */
|
||||||
END_SIGNAL
|
END_SIGNAL,
|
||||||
|
/** 终端按钮信号机 */
|
||||||
|
END_BUTTON_SIGNAL
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,9 @@ public interface GeneratorNew {
|
|||||||
case END_SIGNAL:
|
case END_SIGNAL:
|
||||||
s.setDeviceCode(((Route) mapDevice).getDestination().getCode());
|
s.setDeviceCode(((Route) mapDevice).getDestination().getCode());
|
||||||
break;
|
break;
|
||||||
|
case END_BUTTON_SIGNAL:
|
||||||
|
s.setDeviceCode(((Route) mapDevice).getDestinationButtonSignal().getCode());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
s.setDeviceCode(mapDevice.getCode());
|
s.setDeviceCode(mapDevice.getCode());
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class StationGeneratorNew implements GeneratorNew {
|
|||||||
switch (Operation.Type.valueOf (operateDefinitionVO.getOperateType())) {
|
switch (Operation.Type.valueOf (operateDefinitionVO.getOperateType())) {
|
||||||
case Station_Set_CI_Auto_Trigger:
|
case Station_Set_CI_Auto_Trigger:
|
||||||
if(!station.isInterlock())continue;
|
if(!station.isInterlock())continue;
|
||||||
station.setControlMode(Station.ControlMode.Center);
|
station.setControlMode(Station.ControlMode.Local);
|
||||||
// List<Route> routeList1 = simulation.getRepository().getRouteList();
|
// List<Route> routeList1 = simulation.getRepository().getRouteList();
|
||||||
// for (Route route : routeList1) {
|
// for (Route route : routeList1) {
|
||||||
// if (Objects.equals(route.getInterlockStation(), station)) {
|
// if (Objects.equals(route.getInterlockStation(), station)) {
|
||||||
@ -41,7 +41,7 @@ public class StationGeneratorNew implements GeneratorNew {
|
|||||||
break;
|
break;
|
||||||
case Station_Cancel_CI_Auto_Trigger:
|
case Station_Cancel_CI_Auto_Trigger:
|
||||||
if(!station.isInterlock())continue;
|
if(!station.isInterlock())continue;
|
||||||
station.setControlMode(Station.ControlMode.Center);
|
station.setControlMode(Station.ControlMode.Local);
|
||||||
List<Route> routeList2 = simulation.getRepository().getRouteList();
|
List<Route> routeList2 = simulation.getRepository().getRouteList();
|
||||||
for (Route route : routeList2) {
|
for (Route route : routeList2) {
|
||||||
if (Objects.equals(route.getInterlockStation(), station)) {
|
if (Objects.equals(route.getInterlockStation(), station)) {
|
||||||
@ -52,14 +52,14 @@ public class StationGeneratorNew implements GeneratorNew {
|
|||||||
break;
|
break;
|
||||||
case Station_Open_Auto_Setting:
|
case Station_Open_Auto_Setting:
|
||||||
station.setControlMode(Station.ControlMode.Center);
|
station.setControlMode(Station.ControlMode.Center);
|
||||||
// List<Route> routeList3 = simulation.getRepository().getRouteList();
|
List<Route> routeList3 = simulation.getRepository().getRouteList();
|
||||||
// for (Route route : routeList3) {
|
for (Route route : routeList3) {
|
||||||
// if (Objects.equals(route.getInterlockStation(), station)) {
|
if (Objects.equals(route.getInterlockStation(), station)) {
|
||||||
// if (route.isAtsControl()) {
|
if (route.isAtsControl()) {
|
||||||
// route.setAtsControl(false);
|
route.setAtsControl(false);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
break;
|
break;
|
||||||
case Station_Close_Auto_Setting:
|
case Station_Close_Auto_Setting:
|
||||||
List<Route> routeList4 = simulation.getRepository().getRouteList();
|
List<Route> routeList4 = simulation.getRepository().getRouteList();
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package club.joylink.rtss.simulation;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的仿真消息发布器,基于webSocket STOMP协议
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class DefaultMessagePublisher implements SimulationPublisher {
|
||||||
|
@Autowired
|
||||||
|
private SimpMessagingTemplate smt;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void publishToUser(String user, String destination, Object message) {
|
||||||
|
smt.convertAndSendToUser(user, destination, message);
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class Simulation<U extends SimulationUser> {
|
public abstract class Simulation<U extends SimulationUser> {
|
||||||
@ -27,7 +28,10 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
/**
|
/**
|
||||||
* 仿真状态
|
* 仿真状态
|
||||||
*/
|
*/
|
||||||
private volatile State state;
|
private final AtomicInteger state = new AtomicInteger(RUNNING);
|
||||||
|
private static final int RUNNING = 1;
|
||||||
|
private static final int PAUSE = 0;
|
||||||
|
private static final int ERROR = -1;
|
||||||
/**
|
/**
|
||||||
* 仿真运行发生异常时,保存的异常信息
|
* 仿真运行发生异常时,保存的异常信息
|
||||||
*/
|
*/
|
||||||
@ -39,7 +43,7 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
/**
|
/**
|
||||||
* 执行线程池,核心线程数量默认4,所有仿真共享
|
* 执行线程池,核心线程数量默认4,所有仿真共享
|
||||||
*/
|
*/
|
||||||
private static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);
|
public static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(4);
|
||||||
|
|
||||||
private SimulationPublisher publisher;
|
private SimulationPublisher publisher;
|
||||||
|
|
||||||
@ -50,10 +54,13 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Simulation(String id, int speed) {
|
public Simulation(String id, int speed) {
|
||||||
|
if (id == null) {
|
||||||
|
throw new IllegalArgumentException("仿真id不能为空");
|
||||||
|
}
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
this.systemTime = LocalDateTime.now();
|
this.systemTime = LocalDateTime.now();
|
||||||
this.state = State.PAUSE;
|
this.state.set(PAUSE);
|
||||||
this.addJob("systemTime", () ->
|
this.addJob("systemTime", () ->
|
||||||
this.systemTime = this.systemTime.plusNanos(TimeUnit.MILLISECONDS.toNanos(1)), 10);
|
this.systemTime = this.systemTime.plusNanos(TimeUnit.MILLISECONDS.toNanos(1)), 10);
|
||||||
}
|
}
|
||||||
@ -69,9 +76,9 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
return this.systemTime;
|
return this.systemTime;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 仿真数据初始化,由具体仿真实现
|
* 仿真数据状态初始化,由具体仿真实现
|
||||||
*/
|
*/
|
||||||
protected abstract void initData();
|
protected abstract void initState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仿真初始化
|
* 仿真初始化
|
||||||
@ -80,7 +87,7 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
this.pause(); // 先暂停
|
this.pause(); // 先暂停
|
||||||
this.reset();
|
this.reset();
|
||||||
// 通知实现初始化数据
|
// 通知实现初始化数据
|
||||||
this.initData();
|
this.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reset() {
|
private void reset() {
|
||||||
@ -106,6 +113,16 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
scheduledJob.runAsSpeed(EXECUTOR, this.speed);
|
scheduledJob.runAsSpeed(EXECUTOR, this.speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 延时执行逻辑,只执行一次
|
||||||
|
* PS:暂时不处理速度变化对延迟执行的逻辑产生影响
|
||||||
|
* @param logic
|
||||||
|
* @param delay
|
||||||
|
*/
|
||||||
|
public void delayExecute(Runnable logic, long delay) {
|
||||||
|
EXECUTOR.schedule(logic, delay, TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除指定仿真任务逻辑循环
|
* 移除指定仿真任务逻辑循环
|
||||||
* @param name
|
* @param name
|
||||||
@ -125,14 +142,14 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
* 控制-开始
|
* 控制-开始
|
||||||
*/
|
*/
|
||||||
public void start() {
|
public void start() {
|
||||||
this.state = State.RUNNING;
|
this.state.set(RUNNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制-暂停
|
* 控制-暂停
|
||||||
*/
|
*/
|
||||||
public void pause() {
|
public void pause() {
|
||||||
this.state = State.PAUSE;
|
this.state.set(PAUSE);
|
||||||
while (true) {
|
while (true) {
|
||||||
if (this.getAllRunningJobAmount() == this.getAllFinishedJobAmount()) {
|
if (this.getAllRunningJobAmount() == this.getAllFinishedJobAmount()) {
|
||||||
break;
|
break;
|
||||||
@ -161,24 +178,24 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getState() {
|
public int getState() {
|
||||||
return this.state;
|
return this.state.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
return State.RUNNING.equals(this.state);
|
return this.state.get() == RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新仿真速度
|
* 更新仿真速度
|
||||||
* @param speed [1,10] 1<=speed<=10
|
* @param speed [1,8] 1<=speed<=8
|
||||||
*/
|
*/
|
||||||
public void updateSpeed(int speed) {
|
public void updateSpeed(int speed) {
|
||||||
if (speed < 1) {
|
if (speed < 1) {
|
||||||
throw new IllegalArgumentException("speed must big or equal than 1");
|
throw new IllegalArgumentException("speed must big or equal than 1");
|
||||||
}
|
}
|
||||||
if (speed > 10) {
|
if (speed > 8) {
|
||||||
throw new IllegalArgumentException("speed must small or equal than 10");
|
throw new IllegalArgumentException("speed must small or equal than 8");
|
||||||
}
|
}
|
||||||
if (this.speed == speed) { // 速度与当前相同,返回
|
if (this.speed == speed) { // 速度与当前相同,返回
|
||||||
return;
|
return;
|
||||||
@ -191,7 +208,7 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void runError(Throwable throwable) {
|
public void runError(Throwable throwable) {
|
||||||
this.state = State.ERROR;
|
this.state.set(ERROR);
|
||||||
this.throwable = throwable;
|
this.throwable = throwable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +256,7 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
|
|
||||||
public void publishMessage(String destination, Object message) {
|
public void publishMessage(String destination, Object message) {
|
||||||
if (this.publisher == null) {
|
if (this.publisher == null) {
|
||||||
throw new UnsupportedOperationException(String.format("仿真[%s]没有消息发布者对象", this.id));
|
throw new UnsupportedOperationException(String.format("仿真[%s]没有消息发布对象:publisher = null", this.id));
|
||||||
}
|
}
|
||||||
for (U simulationUser : this.simulationUserMap.values()) {
|
for (U simulationUser : this.simulationUserMap.values()) {
|
||||||
if (simulationUser.isSubscribe(destination)) {
|
if (simulationUser.isSubscribe(destination)) {
|
||||||
@ -248,9 +265,5 @@ public abstract class Simulation<U extends SimulationUser> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum State {
|
public abstract String debugStr();
|
||||||
RUNNING,
|
|
||||||
PAUSE,
|
|
||||||
ERROR,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package club.joylink.rtss.simulation;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class SimulationIdGenerator {
|
||||||
|
public static final AtomicInteger sn = new AtomicInteger(0);
|
||||||
|
|
||||||
|
public static String buildId() {
|
||||||
|
return String.valueOf(sn.incrementAndGet());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package club.joylink.rtss.simulation;
|
||||||
|
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SimulationManager {
|
||||||
|
|
||||||
|
public static final Map<String, Simulation> simulationCache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DefaultMessagePublisher defaultMessagePublisher;
|
||||||
|
|
||||||
|
public Simulation save(Simulation simulation) {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(simulationCache.containsKey(simulation.getId()),
|
||||||
|
String.format("已经存在id为[%s]的仿真[%s]", simulation.getId(), simulation.debugStr()));
|
||||||
|
simulationCache.put(simulation.getId(), simulation);
|
||||||
|
simulation.setPublisher(this.defaultMessagePublisher); // 设置默认的消息发布器
|
||||||
|
return simulation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Simulation queryById(String id) {
|
||||||
|
return simulationCache.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Simulation getById(String id) {
|
||||||
|
Simulation simulation = simulationCache.get(id);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST
|
||||||
|
.assertNotNull(simulation, String.format("id为[%s]的仿真不存在", id));
|
||||||
|
return simulation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Simulation> T queryById(String id, T t) {
|
||||||
|
return (T) simulationCache.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Simulation> T getById(String id, T t) {
|
||||||
|
Simulation simulation = simulationCache.get(id);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST
|
||||||
|
.assertNotNull(simulation, String.format("id为[%s]的仿真不存在", id));
|
||||||
|
return (T) simulation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(String id) {
|
||||||
|
this.getById(id).init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start(String id) {
|
||||||
|
this.getById(id).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pause(String id) {
|
||||||
|
this.getById(id).pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateSpeed(String id, int speed) {
|
||||||
|
this.getById(id).updateSpeed(speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Simulation destroy(String id) {
|
||||||
|
Simulation simulation = simulationCache.remove(id);
|
||||||
|
if (simulation != null) {
|
||||||
|
simulation.destroy();
|
||||||
|
}
|
||||||
|
return simulation;
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ package club.joylink.rtss.simulation;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class SimulationUser {
|
public abstract class SimulationUser {
|
||||||
/**
|
/**
|
||||||
* 仿真用户唯一标识,并且是发布订阅消息时的用户唯一标识
|
* 仿真用户唯一标识,并且是发布订阅消息时的用户唯一标识
|
||||||
*/
|
*/
|
||||||
|
@ -21,7 +21,6 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ public class ZCLogicLoop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//更新CBTC ma
|
//更新CBTC ma
|
||||||
if (!deviceStation.isFault()) { //如果列车头所在区段所属设备集中站zc未故障
|
if (!deviceStation.getZc().isFault()) { //如果列车头所在区段所属设备集中站zc未故障
|
||||||
this.calculateMAOfCBTC(simulation, train, trainList);
|
this.calculateMAOfCBTC(simulation, train, trainList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,9 +144,11 @@ public class ZCLogicLoop {
|
|||||||
SectionPosition tailPosition = train.calculateTailPosition();
|
SectionPosition tailPosition = train.calculateTailPosition();
|
||||||
Section tailSection = tailPosition.getSection();
|
Section tailSection = tailPosition.getSection();
|
||||||
MovementAuthority.End end = checkPsdOpen(tailSection);
|
MovementAuthority.End end = checkPsdOpen(tailSection);
|
||||||
if (Objects.nonNull(end)) {
|
if (end != null)
|
||||||
return Arrays.asList(end);
|
return List.of(end);
|
||||||
}
|
MovementAuthority.End ecStandEnd = checkEC(tailSection);
|
||||||
|
if (ecStandEnd != null)
|
||||||
|
return List.of(ecStandEnd);
|
||||||
// 如果车尾正常,从车头开始往前查找
|
// 如果车尾正常,从车头开始往前查找
|
||||||
Section section = headPosition.getSection();
|
Section section = headPosition.getSection();
|
||||||
List<MovementAuthority.End> endList = new ArrayList<>();
|
List<MovementAuthority.End> endList = new ArrayList<>();
|
||||||
@ -223,6 +224,18 @@ public class ZCLogicLoop {
|
|||||||
return endList;
|
return endList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MovementAuthority.End checkEC(Section tailSection) {
|
||||||
|
if (tailSection.isNormalStandTrack()) {
|
||||||
|
List<Stand> standList = tailSection.getStandList();
|
||||||
|
for (Stand stand : standList) {
|
||||||
|
if (stand.isEmergencyClosed()) {
|
||||||
|
new MovementAuthority.End(stand, MovementAuthority.EndType.EC_STAND, tailSection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private MovementAuthority.End checkUnlockedOverlap(Simulation simulation, Section section, boolean right) {
|
private MovementAuthority.End checkUnlockedOverlap(Simulation simulation, Section section, boolean right) {
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
// 判断是否已经办理进路的区段
|
// 判断是否已经办理进路的区段
|
||||||
|
@ -40,6 +40,8 @@ public class DriverOperateHandler {
|
|||||||
public void changeTrainForce(Simulation simulation, String groupNumber, Float percent) {
|
public void changeTrainForce(Simulation simulation, String groupNumber, Float percent) {
|
||||||
Objects.requireNonNull(percent);
|
Objects.requireNonNull(percent);
|
||||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||||
|
if (train.isSignalEB() && percent == -2)
|
||||||
|
ATPService.cancelSignalEB(train);
|
||||||
if (train.isEB()) {
|
if (train.isEB()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -169,9 +171,10 @@ public class DriverOperateHandler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 开/关门
|
* 开/关门
|
||||||
|
*
|
||||||
* @param groupNumber 要开/关门的列车的车组号
|
* @param groupNumber 要开/关门的列车的车组号
|
||||||
* @param right 要开/关右边的门吗
|
* @param right 要开/关右边的门吗
|
||||||
* @param open 要开门吗
|
* @param open 要开门吗
|
||||||
*/
|
*/
|
||||||
@OperateHandlerMapping(type = Operation.Type.Driver_Door_On_Off)
|
@OperateHandlerMapping(type = Operation.Type.Driver_Door_On_Off)
|
||||||
public void onOrOffDoor(Simulation simulation, String groupNumber, Boolean right, Boolean open) {
|
public void onOrOffDoor(Simulation simulation, String groupNumber, Boolean right, Boolean open) {
|
||||||
|
@ -500,7 +500,7 @@ public class AtsPlanService {
|
|||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
List<TripPlan> tripPlanList = repository.getOutboundTripPlan();
|
List<TripPlan> tripPlanList = repository.getOutboundTripPlan();
|
||||||
for (TripPlan tripPlan : tripPlanList) {
|
for (TripPlan tripPlan : tripPlanList) {
|
||||||
if (tripPlan.isTimeToRun(simulation.getSystemTime().toLocalTime())) {
|
if (tripPlan.isTimeToOutBound(simulation.getSystemTime().toLocalTime())) {
|
||||||
if (!tripPlan.isDeparture()) { // 计划未发车
|
if (!tripPlan.isDeparture()) { // 计划未发车
|
||||||
this.tryInitOutboundTrain(simulation, tripPlan);
|
this.tryInitOutboundTrain(simulation, tripPlan);
|
||||||
} else { // 计划车次已发车,查询对应的列车是否上线运行,若未上线且按计划未回库,且没有列车跑此服务的记录,将列车以人工车方式加载到转换轨
|
} else { // 计划车次已发车,查询对应的列车是否上线运行,若未上线且按计划未回库,且没有列车跑此服务的记录,将列车以人工车方式加载到转换轨
|
||||||
|
@ -118,7 +118,7 @@ public class AtsRouteService {
|
|||||||
String.format("进路[%s(%s)]自动通过已开启,不能设置自动追踪", route.getName(), route.getCode()));
|
String.format("进路[%s(%s)]自动通过已开启,不能设置自动追踪", route.getName(), route.getCode()));
|
||||||
}
|
}
|
||||||
if (route.isCiControl()) {
|
if (route.isCiControl()) {
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Repetition);
|
throw new SimulationException(SimulationExceptionType.Operation_Repetition,String.format("进路[%s(%s)]自动追踪/连锁自动触发已开启,无需重复设置", route.getName(), route.getCode()));
|
||||||
}
|
}
|
||||||
route.setAtsControl(false);
|
route.setAtsControl(false);
|
||||||
route.setCiControl(true);
|
route.setCiControl(true);
|
||||||
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -217,6 +218,10 @@ public class AtsRouteSettingService {
|
|||||||
// 列车到达终点站台准备折返
|
// 列车到达终点站台准备折返
|
||||||
if (signal.getSection().isNormalStandTrack() &&
|
if (signal.getSection().isNormalStandTrack() &&
|
||||||
train.isParkingStand(signal.getSection().getStandList().get(0))) {
|
train.isParkingStand(signal.getSection().getStandList().get(0))) {
|
||||||
|
// 判断从当前时间到折返后下一计划到站时间中是否存在出库的冲突计划
|
||||||
|
if (this.containsConflictOutBoundPlan(simulation, tripPlan)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// 折返计划的正常站后折返起始信号机,根据折返策略查询进路
|
// 折返计划的正常站后折返起始信号机,根据折返策略查询进路
|
||||||
Station station = signal.getSection().getStation();
|
Station station = signal.getSection().getStation();
|
||||||
StationTurnBackStrategyOption strategy = null;
|
StationTurnBackStrategyOption strategy = null;
|
||||||
@ -277,6 +282,31 @@ public class AtsRouteSettingService {
|
|||||||
return route;
|
return route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前时间到折返计划的下一计划第一站到站时间之间是否存在冲突的出库计划
|
||||||
|
* @param simulation
|
||||||
|
* @param tripPlan
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean containsConflictOutBoundPlan(Simulation simulation, TripPlan tripPlan) {
|
||||||
|
LocalTime current = simulation.getSystemTime().toLocalTime();
|
||||||
|
if (tripPlan.isTurnBack()) {
|
||||||
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
TripPlan nextTripPlan = repository.queryServiceNextTripPlan(tripPlan.getServiceNumber(), tripPlan.getTripNumber());
|
||||||
|
if(nextTripPlan == null) return false;
|
||||||
|
LocalTime arriveTime = nextTripPlan.getFirstStationPlan().getArriveTime();
|
||||||
|
List<TripPlan> planList = repository.queryOutBoundTripPlanBetween(current, arriveTime);
|
||||||
|
if (!planList.isEmpty()) {
|
||||||
|
for (TripPlan plan : planList) {
|
||||||
|
if (Objects.equals(plan.getSecondStationPlan().getStation(), nextTripPlan.getFirstStationPlan().getStation())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private Route selectRouteOfPaths(Simulation simulation, TrainInfo train,
|
private Route selectRouteOfPaths(Simulation simulation, TrainInfo train,
|
||||||
Signal signal, List<RoutePath> routePaths, List<TrainInfo> trainList) {
|
Signal signal, List<RoutePath> routePaths, List<TrainInfo> trainList) {
|
||||||
if (CollectionUtils.isEmpty(routePaths)) {
|
if (CollectionUtils.isEmpty(routePaths)) {
|
||||||
|
@ -650,11 +650,7 @@ public class AtsTrainLoadService {
|
|||||||
List<TripPlan> allTripPlanList = repository.getAllTripPlanList();
|
List<TripPlan> allTripPlanList = repository.getAllTripPlanList();
|
||||||
allTripPlanList.forEach(tripPlan -> {
|
allTripPlanList.forEach(tripPlan -> {
|
||||||
if (!systemTime.isBefore(tripPlan.getStartTime())) {
|
if (!systemTime.isBefore(tripPlan.getStartTime())) {
|
||||||
if (tripPlan.isOutbound()) {
|
tripPlan.dispatch();
|
||||||
tripPlan.dispatch();
|
|
||||||
} else {
|
|
||||||
tripPlan.use();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.CI;
|
|||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.ESP;
|
import club.joylink.rtss.simulation.cbtc.data.map.ESP;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
|
import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
|
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
|
||||||
@ -303,4 +304,14 @@ public interface CiApiService {
|
|||||||
* 重启令解
|
* 重启令解
|
||||||
*/
|
*/
|
||||||
void restart(Simulation simulation, Station station);
|
void restart(Simulation simulation, Station station);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站台紧急停车
|
||||||
|
*/
|
||||||
|
void standEB(Simulation simulation, Stand stand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消站台紧急停车
|
||||||
|
*/
|
||||||
|
void cancelStandEB(Simulation simulation, Stand stand);
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
}
|
}
|
||||||
Optional<Route> routeOptional = simulation.getRepository().getSettingRoutes().stream()
|
Optional<Route> routeOptional = simulation.getRepository().getSettingRoutes().stream()
|
||||||
.filter(route -> route.getStart().equals(signal)).limit(1).findAny();
|
.filter(route -> route.getStart().equals(signal)).limit(1).findAny();
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(routeOptional.isPresent());
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(routeOptional.isPresent(),"信号机不是已排进路的始端信号机");
|
||||||
settingRoute(simulation, routeOptional.get().getCode());
|
settingRoute(simulation, routeOptional.get().getCode());
|
||||||
// Route lockedRoute = signal.getLockedRoute();
|
// Route lockedRoute = signal.getLockedRoute();
|
||||||
// if (Objects.isNull(lockedRoute)) {
|
// if (Objects.isNull(lockedRoute)) {
|
||||||
@ -103,12 +103,12 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
if (aSwitch.isReversePosition()) {
|
if (aSwitch.isReversePosition()) {
|
||||||
if (!this.switchService.turn2NormalPosition(simulation, aSwitch)) {
|
if (!this.switchService.turn2NormalPosition(simulation, aSwitch)) {
|
||||||
log.info(String.format("道岔[%s(%s)]锁闭,不能进行定操", aSwitch.getName(), aSwitch.getCode()));
|
log.info(String.format("道岔[%s(%s)]锁闭,不能进行定操", aSwitch.getName(), aSwitch.getCode()));
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL);
|
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,"道岔锁闭,不能进行定操");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!this.switchService.turn2ReversePosition(simulation, aSwitch)) {
|
if (!this.switchService.turn2ReversePosition(simulation, aSwitch)) {
|
||||||
log.info(String.format("道岔[%s(%s)]锁闭,不能进行反操", aSwitch.getName(), aSwitch.getCode()));
|
log.info(String.format("道岔[%s(%s)]锁闭,不能进行反操", aSwitch.getName(), aSwitch.getCode()));
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL);
|
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,"道岔锁闭,不能进行反操");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
||||||
if (!this.switchService.turn2NormalPosition(simulation, aSwitch)) {
|
if (!this.switchService.turn2NormalPosition(simulation, aSwitch)) {
|
||||||
log.info(String.format("道岔[%s(%s)]锁闭,不能进行定操", aSwitch.getName(), aSwitch.getCode()));
|
log.info(String.format("道岔[%s(%s)]锁闭,不能进行定操", aSwitch.getName(), aSwitch.getCode()));
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL);
|
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,"道岔锁闭,不能进行定操");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
||||||
if (!this.switchService.turn2ReversePosition(simulation, aSwitch)) {
|
if (!this.switchService.turn2ReversePosition(simulation, aSwitch)) {
|
||||||
log.info(String.format("道岔[%s(%s)]锁闭,不能进行反操", aSwitch.getName(), aSwitch.getCode()));
|
log.info(String.format("道岔[%s(%s)]锁闭,不能进行反操", aSwitch.getName(), aSwitch.getCode()));
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL);
|
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,"道岔锁闭,不能进行反操");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,13 +359,13 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
if (config.isGuideNeedRouteSettingFirst()) {
|
if (config.isGuideNeedRouteSettingFirst()) {
|
||||||
// 需要先办理进路
|
// 需要先办理进路
|
||||||
if (Objects.isNull(signalCode)) {
|
if (Objects.isNull(signalCode)) {
|
||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument,"操作参数缺少信号机");
|
||||||
} else {
|
} else {
|
||||||
Signal signal = repository.getByCode(signalCode, Signal.class);
|
Signal signal = repository.getByCode(signalCode, Signal.class);
|
||||||
if (!CollectionUtils.isEmpty(signal.getRouteList())) { // 是进路始端
|
if (!CollectionUtils.isEmpty(signal.getRouteList())) { // 是进路始端
|
||||||
Route lockedRoute = signal.getLockedRoute();
|
Route lockedRoute = signal.getLockedRoute();
|
||||||
if (Objects.isNull(lockedRoute)) { // 没有已办理进路,异常
|
if (Objects.isNull(lockedRoute)) { // 没有已办理进路,异常
|
||||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL);
|
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,"操作信号机没有已办理的进路");
|
||||||
} else { // 有,开引导信号
|
} else { // 有,开引导信号
|
||||||
this.signalService.openGuideSignal(simulation, signal);
|
this.signalService.openGuideSignal(simulation, signal);
|
||||||
}
|
}
|
||||||
@ -400,7 +400,7 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
signalService.openGuideSignal(simulation, signal);
|
signalService.openGuideSignal(simulation, signal);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument,"操作参数缺少信号机或进路");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,4 +441,18 @@ public class CiApiServiceImpl implements CiApiService {
|
|||||||
signals.forEach(Signal::reset);
|
signals.forEach(Signal::reset);
|
||||||
deviceStation.setInterlockMachineStarting(false);
|
deviceStation.setInterlockMachineStarting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void standEB(Simulation simulation, Stand stand) {
|
||||||
|
if (stand.getEsp() == null)
|
||||||
|
return;
|
||||||
|
stand.getEsp().update(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelStandEB(Simulation simulation, Stand stand) {
|
||||||
|
if (stand.getEsp() == null)
|
||||||
|
return;
|
||||||
|
stand.getEsp().update(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,6 +729,14 @@ public class RouteService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 站台紧急停车
|
||||||
|
if (!CollectionUtils.isEmpty(route.getEspList())) {
|
||||||
|
for (ESP esp : route.getEspList()) {
|
||||||
|
if (esp.isEffective()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 道岔位置一致检查
|
// 道岔位置一致检查
|
||||||
Set<Switch> sectionRelSwitches = sectionList.stream().map(Section::getRelSwitch).collect(Collectors.toSet());
|
Set<Switch> sectionRelSwitches = sectionList.stream().map(Section::getRelSwitch).collect(Collectors.toSet());
|
||||||
for (SwitchElement element : route.getSwitchList()) {
|
for (SwitchElement element : route.getSwitchList()) {
|
||||||
@ -804,14 +812,6 @@ public class RouteService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 站台紧急停车
|
|
||||||
if (!CollectionUtils.isEmpty(route.getEspList())) {
|
|
||||||
for (ESP esp : route.getEspList()) {
|
|
||||||
if (esp.isEffective()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc;
|
|||||||
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
||||||
import club.joylink.rtss.configuration.configProp.WeChatConfig;
|
import club.joylink.rtss.configuration.configProp.WeChatConfig;
|
||||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||||
|
import club.joylink.rtss.constants.ProjectDeviceType;
|
||||||
import club.joylink.rtss.constants.SystemEnv;
|
import club.joylink.rtss.constants.SystemEnv;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.*;
|
import club.joylink.rtss.services.*;
|
||||||
@ -782,7 +783,10 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
@Override
|
@Override
|
||||||
public List<RealDeviceVO> getRealDeviceList(String group) {
|
public List<RealDeviceVO> getRealDeviceList(String group) {
|
||||||
Simulation simulation = this.getSimulationByGroup(group);
|
Simulation simulation = this.getSimulationByGroup(group);
|
||||||
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList();
|
Set<ProjectDeviceType> displayDeviceTypes =
|
||||||
|
new HashSet<>(List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL, ProjectDeviceType.PLC_GATEWAY));
|
||||||
|
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList()
|
||||||
|
.stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType())).collect(Collectors.toList());
|
||||||
// List<RealDevice> showList = null;
|
// List<RealDevice> showList = null;
|
||||||
// if (!CollectionUtils.isEmpty(realDeviceList)) {
|
// if (!CollectionUtils.isEmpty(realDeviceList)) {
|
||||||
// showList = realDeviceList.stream()
|
// showList = realDeviceList.stream()
|
||||||
@ -880,9 +884,9 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changePassengerFlow(String group, Long passengerFlowId) {
|
public void changePassengerFlow(String group, Long passengerFlowId) {
|
||||||
if(passengerFlowSimulateService.changePassengerFlow(group,passengerFlowId)){
|
if (passengerFlowSimulateService.changePassengerFlow(group, passengerFlowId)) {
|
||||||
Simulation simulation = findSimulationByGroup(group);
|
Simulation simulation = findSimulationByGroup(group);
|
||||||
RunAsPlanParam param =new RunAsPlanParam(simulation.getCorrectSystemTime().toLocalTime(),null);
|
RunAsPlanParam param = new RunAsPlanParam(simulation.getCorrectSystemTime().toLocalTime(), null);
|
||||||
runAsPlan(group, param);
|
runAsPlan(group, param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -893,7 +897,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
//根据时间筛选
|
//根据时间筛选
|
||||||
if (!CollectionUtils.isEmpty(logs)) {
|
if (!CollectionUtils.isEmpty(logs)) {
|
||||||
if (queryVO.getStartTime() != null || queryVO.getEndTime() != null) {
|
if (queryVO.getStartTime() != null || queryVO.getEndTime() != null) {
|
||||||
logs = logs.stream().filter(log->{
|
logs = logs.stream().filter(log -> {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
if (queryVO.getStartTime() != null) {
|
if (queryVO.getStartTime() != null) {
|
||||||
flag = flag && !log.getTime().isBefore(queryVO.getStartTime());
|
flag = flag && !log.getTime().isBefore(queryVO.getStartTime());
|
||||||
|
@ -461,6 +461,19 @@ public class Simulation {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void exitValidConversationOnExitingSimulation(SimulationMember member) {
|
||||||
|
for (Conversation conversation : simulationConversationMap.values()) {
|
||||||
|
if (!conversation.isOver()) {
|
||||||
|
for (ConversationMember conversationMember : conversation.getMemberList()) {
|
||||||
|
if (conversationMember.getMember().equals(member)) {
|
||||||
|
conversation.exit(member);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 该成员是否在有效的会话中
|
* 该成员是否在有效的会话中
|
||||||
*/
|
*/
|
||||||
|
@ -609,8 +609,12 @@ public class SimulationMainThread {
|
|||||||
simulation.getGroup(), conversation.getId()));
|
simulation.getGroup(), conversation.getId()));
|
||||||
SocketMessageVO<ConversationSocketMessageVO> message = SocketMessageFactory
|
SocketMessageVO<ConversationSocketMessageVO> message = SocketMessageFactory
|
||||||
.buildSimulationConversationChatMessage(simulation, conversation, conversationMessage);
|
.buildSimulationConversationChatMessage(simulation, conversation, conversationMessage);
|
||||||
Set<String> userIds = simulation.getSimulationUserIds();
|
if(conversation.hasOtherMemberConnect()){
|
||||||
this.stompMessageService.sendToUser(userIds, message);
|
Set<String> userIds = simulation.getSimulationUserIds();
|
||||||
|
this.stompMessageService.sendToUser(userIds, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.stompMessageService.sendToUser(String.valueOf(conversationMessage.getMember().getUserId()), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener
|
@EventListener
|
||||||
|
@ -295,7 +295,7 @@ public class RunPlanBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
errMsgList.add(String.format("运行计划[%s(%s)]没有车次计划", runPlan.getName(), runPlan.getId()));
|
errMsgList.add(String.format("运行图[%s]计划车次数据为空", runPlan.getName()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public class SimulationBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> checkRunPlanAndBuildLostRoutePaths(Map<String, List<TripPlan>> serverTripMap,
|
public static List<String> checkRunPlanAndBuildLostRoutePaths(Map<String, List<TripPlan>> serverTripMap,
|
||||||
Map<String, List<RoutePath>> routePathMap) {
|
Map<String, List<RoutePath>> routePathMap) {
|
||||||
Map<String, String> errMsgMap = new HashMap<>();
|
Map<String, String> errMsgMap = new HashMap<>();
|
||||||
for (List<TripPlan> tripPlanList : serverTripMap.values()) {
|
for (List<TripPlan> tripPlanList : serverTripMap.values()) {
|
||||||
|
@ -6,7 +6,10 @@ import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
|
|||||||
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||||
@ -176,18 +179,18 @@ public class CommandBO {
|
|||||||
@Override
|
@Override
|
||||||
public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
|
public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
|
||||||
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
||||||
Step step = getStepOfRm2BmAndOpenAto(command);
|
//如果列车没停到目标位置,先想办法开过去---
|
||||||
if (step != null) {
|
|
||||||
return step;
|
|
||||||
}
|
|
||||||
if (!DriveMode.RM.equals(train.getDriveMode())) {
|
|
||||||
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM);
|
|
||||||
}
|
|
||||||
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
|
||||||
Step driveStep = steps.get(0);
|
Step driveStep = steps.get(0);
|
||||||
if (!train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车没停到目标位置
|
if (!train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车没停到目标位置
|
||||||
|
if (!train.isStop())
|
||||||
|
return buildDriverForceChangeOperationStep(train.getGroupNumber(), -1);
|
||||||
|
if (!DriveMode.RM.equals(train.getDriveMode()))
|
||||||
|
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM);
|
||||||
return driveStep;
|
return driveStep;
|
||||||
} else { //如果列车已经停到目标位置
|
} else { //如果列车已经停到目标位置
|
||||||
|
if (!DriveMode.AM.equals(train.getDriveMode()))
|
||||||
|
return getStepOfRm2BmAndOpenAto(command);
|
||||||
command.getTargetMember().setCommand(null);
|
command.getTargetMember().setCommand(null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -517,7 +520,6 @@ public class CommandBO {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public enum ParamName {
|
public enum ParamName {
|
||||||
stationCode,
|
stationCode,
|
||||||
switchCode,
|
switchCode,
|
||||||
@ -538,6 +540,7 @@ public class CommandBO {
|
|||||||
*/
|
*/
|
||||||
speedLimit;
|
speedLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<ParamName> paramNames;
|
private final List<ParamName> paramNames;
|
||||||
|
|
||||||
CommandType(List<ParamName> paramNames) {
|
CommandType(List<ParamName> paramNames) {
|
||||||
|
@ -71,6 +71,24 @@ public class Conversation {
|
|||||||
conversationMember.connect();
|
conversationMember.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasMemberConnect() {
|
||||||
|
for (ConversationMember conversationMember : this.memberList) {
|
||||||
|
if (conversationMember.isConnect()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOtherMemberConnect() {
|
||||||
|
for (ConversationMember conversationMember : this.memberList) {
|
||||||
|
if (!Objects.equals(conversationMember.getMember(),creator) && conversationMember.isConnect()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private ConversationMember getConversationMember(SimulationMember member) {
|
private ConversationMember getConversationMember(SimulationMember member) {
|
||||||
for (ConversationMember conversationMember : this.memberList) {
|
for (ConversationMember conversationMember : this.memberList) {
|
||||||
if (Objects.equals(conversationMember.getMember(), member)) {
|
if (Objects.equals(conversationMember.getMember(), member)) {
|
||||||
|
@ -122,10 +122,15 @@ public class ConversationManagerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ConversationVO createConversation(Simulation simulation, SimulationMember creator, CommunicationObject object, List<String> memberIds) {
|
public ConversationVO createConversation(Simulation simulation, SimulationMember creator, CommunicationObject object, List<String> memberIds) {
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
|
||||||
Set<SimulationMember> members = new LinkedHashSet<>();
|
Set<SimulationMember> members = new LinkedHashSet<>();
|
||||||
if (!CollectionUtils.isEmpty(memberIds)) {
|
if (!CollectionUtils.isEmpty(memberIds)) {
|
||||||
members.addAll(memberIds.stream().map(simulation::getSimulationMemberById).collect(Collectors.toList()));
|
members.addAll(memberIds.stream().map(simulation::getSimulationMemberById).filter(simulationMember -> {
|
||||||
|
if(Objects.nonNull(simulationMember.getUserId())){
|
||||||
|
SimulationUser simulationUser = simulation.querySimulationUserByUserId(simulationMember.getUserId());
|
||||||
|
return simulationUser.isOnline();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
if (object != null){
|
if (object != null){
|
||||||
switch (object) {
|
switch (object) {
|
||||||
@ -162,7 +167,7 @@ public class ConversationManagerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(members)) {
|
if (CollectionUtils.isEmpty(members)) {
|
||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "会话成员列表为空");
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "会话成员列表为空/成员都不在线");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (members.stream().anyMatch(simulation::isInValidConversation)) {
|
if (members.stream().anyMatch(simulation::isInValidConversation)) {
|
||||||
|
@ -21,6 +21,7 @@ import lombok.Setter;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@ -1016,4 +1017,21 @@ public class SimulationDataRepository {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指定时间范围内的出库计划
|
||||||
|
* @param start
|
||||||
|
* @param end
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<TripPlan> queryOutBoundTripPlanBetween(LocalTime start, LocalTime end) {
|
||||||
|
List<TripPlan> list = new ArrayList<>();
|
||||||
|
List<TripPlan> allTripPlanList = this.getAllTripPlanList();
|
||||||
|
for (TripPlan tripPlan : allTripPlanList) {
|
||||||
|
if (tripPlan.isOutbound() && start.isBefore(tripPlan.getStartTime()) && end.isAfter(tripPlan.getStartTime())) {
|
||||||
|
list.add(tripPlan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,11 +66,6 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
*/
|
*/
|
||||||
private boolean trainParking;
|
private boolean trainParking;
|
||||||
|
|
||||||
/**
|
|
||||||
* 站台紧急关闭
|
|
||||||
*/
|
|
||||||
private boolean emergencyClosed;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列车停站倒计时,单位ms
|
* 列车停站倒计时,单位ms
|
||||||
*/
|
*/
|
||||||
@ -146,8 +141,10 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
|
if (this.esp != null) {
|
||||||
|
this.esp.reset();
|
||||||
|
}
|
||||||
this.trainParking = false;
|
this.trainParking = false;
|
||||||
this.emergencyClosed = false;
|
|
||||||
this.remainTime = 0;
|
this.remainTime = 0;
|
||||||
this.stationHoldTrain = false;
|
this.stationHoldTrain = false;
|
||||||
this.centerHoldTrain = false;
|
this.centerHoldTrain = false;
|
||||||
@ -161,6 +158,12 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
this.noStatus = false;
|
this.noStatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmergencyClosed() {
|
||||||
|
if (esp == null)
|
||||||
|
return false;
|
||||||
|
return esp.isEffective();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否扣车状态
|
* 是否扣车状态
|
||||||
*/
|
*/
|
||||||
|
@ -398,6 +398,9 @@ public class Station extends MayOutOfOrderDevice {
|
|||||||
* 是否处于中控下
|
* 是否处于中控下
|
||||||
*/
|
*/
|
||||||
public boolean underCenterControl() {
|
public boolean underCenterControl() {
|
||||||
|
if (isCentralized()) {
|
||||||
|
return isCenterControl();
|
||||||
|
}
|
||||||
if (hasControlMode) {
|
if (hasControlMode) {
|
||||||
return isCenterControl();
|
return isCenterControl();
|
||||||
} else {
|
} else {
|
||||||
@ -409,6 +412,8 @@ public class Station extends MayOutOfOrderDevice {
|
|||||||
* 是否处于站控下
|
* 是否处于站控下
|
||||||
*/
|
*/
|
||||||
public boolean underStandControl() {
|
public boolean underStandControl() {
|
||||||
|
if (isCentralized())
|
||||||
|
return isStandControl();
|
||||||
if (hasControlMode) {
|
if (hasControlMode) {
|
||||||
return isStandControl();
|
return isStandControl();
|
||||||
} else {
|
} else {
|
||||||
|
@ -192,22 +192,20 @@ public class TripPlan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置已发车
|
* 按计划派发
|
||||||
*/
|
*/
|
||||||
public void use() {
|
|
||||||
this.departure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispatch() {
|
public void dispatch() {
|
||||||
this.departure = true;
|
this.departure = true;
|
||||||
this.dispatched = true;
|
if (this.isOutbound()) {
|
||||||
|
this.dispatched = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否到了发车时间
|
* 是否到了发车时间
|
||||||
*/
|
*/
|
||||||
public boolean isTimeToRun(LocalTime time) {
|
public boolean isTimeToOutBound(LocalTime time) {
|
||||||
return time.isAfter(this.getStartTime());
|
return time.isAfter(this.getStartTime().minusMinutes(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public StationPlan queryStationPlanByStation(Station station) {
|
public StationPlan queryStationPlanByStation(Station station) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user