报错消除(未完)

This commit is contained in:
joylink_zhangsai 2020-11-19 15:59:53 +08:00
parent 4598550fb3
commit d761ef143b
72 changed files with 227 additions and 2974 deletions

View File

@ -1,41 +0,0 @@
package club.joylink.rtss.controller;
import club.joylink.rtss.services.IScriptService;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
@Api(tags = { "仿真剧本接口" })
@RestController
@RequestMapping(path = "/api/script")
public class ScriptController {
@Autowired
private IScriptService iScriptService;
@ApiOperation(value = "分页查询上线的剧本")
@GetMapping(path = "/paging/online")
public PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO scriptQueryVO) {
return iScriptService.pagingQueryOnlineScript(scriptQueryVO);
}
@ApiOperation(value = "通过id查询剧本详细信息")
@GetMapping(path = "/{id}/detail")
public ScriptVO getDetailInfoById(@PathVariable @NotNull Long id) {
return iScriptService.getDetailForClientById(id);
}
// @ApiOperation(value = "分页查询已经发布的剧本")
// @GetMapping(path = "/paging/published")
// public PageVO<ScriptVO> queryPublishedScript(ScriptQueryVO queryVO){
// return iScriptService.queryPublishedScript(queryVO);
// }
}

View File

@ -25,47 +25,6 @@ public class RaceTheoryController {
@Autowired @Autowired
private IRaceTheoryService iRaceTheoryService; private IRaceTheoryService iRaceTheoryService;
// /**查询竞赛理论题
// * @return*/
// @ApiOperation(value = "查询本竞赛用的理论")
// @GetMapping(path = "/competition/{competitionId}")
// public TheoryQuestionVO getCompetitionTheory(@ApiIgnore @RequestAttribute UserVO user, @PathVariable Long competitionId) {
//
// return iRaceTheoryService.getCompetitionTheory(user.getId(), competitionId);
// }
//
// /**提交理论成绩*/
// @ApiOperation(value = "提交理论")
// @PostMapping(path = "/submit")
// public void submitTheoryQuestion(@ApiIgnore @RequestAttribute UserVO user, @Validated @RequestBody CompetitionTheoryAnswerVO answerVO) {
// iRaceTheoryService.submitTheoryQuestion(user, answerVO);
//
// }
//
// /**参赛者查询理论题作答结果
// * @return*/
// @ApiOperation(value = "查询理论题作答结果")
// @GetMapping(path = "/result/competition/{competitionId}")
// public List<RaceResultVO> getTheoryAnswerResult(@PathVariable Long competitionId, @ApiIgnore @RequestAttribute UserVO user) {
// return iRaceTheoryService.getTheoryAnswerResult(competitionId, user);
// }
//
// /**参赛者查询理论题作答详情
// * @return*/
// @ApiOperation(value = "查询当前人员理论题作答详情")
// @GetMapping(path = "/detail/competition/{competitionId}")
// public List<RaceResultDetailVO> getTheoryAnswerDetails(@PathVariable Long competitionId, @ApiIgnore @RequestAttribute UserVO user) {
// return iRaceTheoryService.getTheoryAnswerDetails(competitionId, user);
// }
//
// /**裁判查询理论题作答详情
// * @return*/
// @ApiOperation(value = "裁判查询参赛者理论题作答详情")
// @GetMapping(path = "/detail/competition/{competitionId}/raceUser/{raceUserId}")
// public List<RaceResultDetailVO> getContestantTheoryAnswerDetails(@PathVariable Long competitionId,@PathVariable Long raceUserId, @ApiIgnore @RequestAttribute UserVO user) {
// return iRaceTheoryService.getContestantTheoryAnswerDetails(competitionId, raceUserId);
// }
//------------------------------------ 项目理论题部分---------------------------------------- //------------------------------------ 项目理论题部分----------------------------------------
/**获取项目理论题*/ /**获取项目理论题*/
@ApiOperation(value = "获取项目理论题") @ApiOperation(value = "获取项目理论题")

View File

@ -121,119 +121,4 @@ public class PermissionDistributeController {
this.permissionDistributeService.handleOldDataColumnPackage(); this.permissionDistributeService.handleOldDataColumnPackage();
} }
/*
@ApiOperation(value = "处理旧数据是否包")
@PutMapping(path = "/package")
public void handleOldDataColumnPackage() {
this.permissionDistributeService.handleOldDataColumnPackage();
}
@ApiOperation(value = "从订单分发权限,获取二维码")
@PostMapping(path = "/{orderCode}/distribute")
public String givePermission(@PathVariable String orderCode, @RequestBody PermissionTransVO transVO,
@RequestAttribute @ApiIgnore UserVO user) {
return permissionDistributeService.getDistributeQrCodeFromOrder(orderCode, transVO.getDistribute(), user);
}
@ApiOperation(value = "用户权限转增分发打包生成权限")
@PostMapping(path = "/packageUserPermission")
public String packageUserPermission(@RequestBody @Validated UserPermissionDistributeVO userPermissionAndAmountVO, @RequestAttribute @ApiIgnore UserVO user) {
return permissionDistributeService.packageUserPermission(userPermissionAndAmountVO, user);
}
@ApiOperation(value = "权限分发")
@PostMapping(path="/distribute")
public String distributePermission(@RequestBody @Validated DistributeParamVO distributeParamVO,
@RequestAttribute @ApiIgnore UserVO user) {
return permissionDistributeService.distributePermission(distributeParamVO, user);
}
@ApiOperation(value = "权限转赠")
@PostMapping(path="/transfer")
public String transferPermission(@RequestBody @Validated DistributeParamVO distributeParamVO,
@RequestAttribute @ApiIgnore UserVO user) {
return permissionDistributeService.transferPermission(distributeParamVO, user);
}
*/
/**
* 从权限分发主键获取权限
* @param state
* @param user
* @return
*//*
@ApiOperation(value = "权限获取")
@GetMapping(path = "/getPermission")
public List<UserPermissionVO> getPermission(Long state, @RequestAttribute @ApiIgnore UserVO user) {
return this.permissionDistributeService.getUserPermission(state, user);
}
@ApiOperation(value = "微信小程序扫码获取权限")
@GetMapping(path = "/permission")
public List<UserPermissionVO> wmGetPermission(String wmCode, Long id) {
return this.permissionDistributeService.wmGetPermission(wmCode, id);
}
@ApiOperation(value = "分页查询权限分发数据")
@GetMapping(path = "")
public PageVO<PermissionDistributeListVO> queryPagedDistribute(PermissionDistributeQueryVO queryVO) {
return this.permissionDistributeService.queryPagedDistribute(queryVO);
}
@ApiOperation(value = "权限回收")
@PutMapping(path = "/{id}/restore")
public void restore(@PathVariable Long id) {
this.permissionDistributeService.restoreDistributeToUserPermission(id);
}
@ApiOperation(value = "权限分发打包详情")
@GetMapping(path = "/package/{id}/detail")
public PageVO<PermissionDistributeListVO> getPackageDetail(@PathVariable Long id, PermissionDistributeQueryVO queryVO) {
return this.permissionDistributeService.getPackageDetail(id, queryVO);
}
@ApiOperation(value = "生成打包分发二维码")
@GetMapping(path = "/package/qrCode")
public String generateQrCode(Long id) {
return this.permissionDistributeService.generateQrCode(id);
}
@ApiOperation(value = "获取权限分发详情")
@GetMapping(path = "/{id}")
public Object getDetail(@PathVariable Long id) {
return this.permissionDistributeService.getDetail(id);
}
@ApiOperation(value = "查询个人权限分发列表")
@GetMapping(path = "/personal")
public List<PermissionDistributeListVO> queryPersonalDistributeList(@RequestAttribute @ApiIgnore UserVO user) {
return permissionDistributeService.queryPersonalDistributeList(user);
}
@ApiOperation(value = "查询权限分发领取用户列表")
@GetMapping(path = "/{id}/users")
public List<UserPermissionVO> queryDistributeGetUsers(@PathVariable Long id, @RequestAttribute @ApiIgnore UserVO user) {
return permissionDistributeService.queryDistributeGetUsers(id, user);
}
@ApiOperation(value = "回收用户权限到权限分发中")
@PutMapping(path = "/{id}/back")
public void restorePermissionToDistribute(@PathVariable Long id,
@RequestBody @Validated UserPermissionVO userPermissionVO,
@RequestAttribute @ApiIgnore UserVO user) {
permissionDistributeService.restorePermissionToDistribute(id, userPermissionVO, user);
}
@ApiOperation(value = "权限分发立即失效")
@GetMapping(path = "/{id}/invalid")
public void immediateInvalid(@PathVariable String id) {
permissionDistributeService.immediateInvalid(id);
}
*/
} }

View File

@ -159,6 +159,7 @@ public class MapController {
@ApiOperation(value = "发布地图上线") @ApiOperation(value = "发布地图上线")
@PutMapping(value = "/{id}/onLine") @PutMapping(value = "/{id}/onLine")
@Role({RoleEnum.SuperAdmin,RoleEnum.Admin})
public void onLine(@PathVariable Long id, @RequestAttribute UserVO user) { public void onLine(@PathVariable Long id, @RequestAttribute UserVO user) {
this.iMapService.onLine(id, user); this.iMapService.onLine(id, user);
} }

View File

@ -1,80 +0,0 @@
package club.joylink.rtss.controller.race;//package club.joylink.rtss.controller.race;
//
//import club.joylink.rtss.services.race.IRaceService;
//import club.joylink.rtss.vo.UserVO;
//import club.joylink.rtss.vo.client.PageVO;
//import club.joylink.rtss.vo.client.race.*;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//import springfox.documentation.annotations.ApiIgnore;
//
//import java.util.List;
//
//@Api(tags = "竞赛信息相关接口")
//@RestController
//@RequestMapping("/api/race")
//public class RaceController {
// @Autowired
// private IRaceService iRaceService;
//
// @ApiOperation("创建竞赛")
// @PostMapping("")
// public void create(@RequestBody @Validated RaceCreateVO createVO, @RequestAttribute @ApiIgnore UserVO user) {
// iRaceService.create(createVO, user);
// }
//
// @ApiOperation("分页查询竞赛")
// @GetMapping("")
// public PageVO<RaceVO> query(RaceQueryVO queryVO) {
// return iRaceService.query(queryVO);
// }
//
// @ApiOperation("根据id查询竞赛信息")
// @GetMapping("/{id}")
// public RaceVO getById(@PathVariable Long id) {
// return iRaceService.getById(id);
// }
//
// @ApiOperation("修改竞赛信息")
// @PutMapping("/{id}")
// public void update(@PathVariable Long id, @RequestBody RaceUpdateVO updateVO) {
// iRaceService.update(id, updateVO);
// }
//
// @ApiOperation("报名")
// @PostMapping("/{id}/signUp")
// public void signUp(@PathVariable Long id, @RequestBody @Validated RaceSignUpInfoVO signUpInfo, @RequestAttribute @ApiIgnore UserVO user) {
// iRaceService.signUp(id, signUpInfo, user);
// }
//
// @ApiOperation("查询竞赛报名人员列表")
// @GetMapping("/{raceId}/raceUser/list")
// public List<RaceUserVO> queryRaceUser(@PathVariable Long raceId) {
// return iRaceService.getRaceContestant(raceId);
// }
//
// @ApiOperation("查询竞赛报名人员详情")
// @GetMapping("/{raceId}/raceUser")
// public RaceUserVO getRaceUser(@PathVariable Long raceId, @RequestAttribute @ApiIgnore UserVO user) {
// return iRaceService.getRaceUser(raceId, user);
// }
//
// @ApiOperation("分页查询竞赛报名人员")
// @GetMapping("/{raceId}/raceUser/page")
// public PageVO<RaceUserVO> pagingQueryRaceUser(@PathVariable Long raceId, RaceUserQueryVO queryVO) {
// return iRaceService.pagingQueryRaceUser(raceId, queryVO);
// }
//
// @ApiOperation("查询用户是否已经报名该竞赛")
// @GetMapping("/{raceId}/isSignUp")
// public boolean isSignUp(@PathVariable Long raceId, @RequestAttribute @ApiIgnore UserVO user, boolean isLogin) {
// if (isLogin) {
// return iRaceService.isSignUpForLogin(raceId, user);
// }
// return iRaceService.isSignUp(raceId, user);
// }
//
//}

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.controller.script; package club.joylink.rtss.controller.script;
import club.joylink.rtss.services.script.IScriptService2; import club.joylink.rtss.services.script.IScriptService;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.script.ScriptVO; import club.joylink.rtss.vo.client.script.ScriptVO;
import club.joylink.rtss.vo.client.script.ScriptQueryVO; import club.joylink.rtss.vo.client.script.ScriptQueryVO;
@ -17,19 +17,19 @@ import javax.validation.constraints.NotNull;
@Api(tags = "新版剧本接口") @Api(tags = "新版剧本接口")
@RestController @RestController
@RequestMapping("/api/script/v1") @RequestMapping("/api/script/v1")
public class ScriptController2 { public class ScriptController {
@Autowired @Autowired
private IScriptService2 iScriptService2; private IScriptService iScriptService;
@ApiOperation(value = "分页查询上线的剧本") @ApiOperation(value = "分页查询上线的剧本")
@GetMapping(path = "/paging/online") @GetMapping(path = "/paging/online")
public PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO scriptQueryVO) { public PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO scriptQueryVO) {
return iScriptService2.pagingQueryOnlineScript(scriptQueryVO); return iScriptService.pagingQueryOnlineScript(scriptQueryVO);
} }
@ApiOperation(value = "通过id查询剧本详细信息") @ApiOperation(value = "通过id查询剧本详细信息")
@GetMapping(path = "/{id}/detail") @GetMapping(path = "/{id}/detail")
public ScriptVO getDetailInfoById(@PathVariable @NotNull Long id) { public ScriptVO getDetailInfoById(@PathVariable @NotNull Long id) {
return iScriptService2.getDetailForClientById(id); return iScriptService.getDetailForClientById(id);
} }
} }

View File

@ -1,4 +1,4 @@
package club.joylink.rtss.controller; package club.joylink.rtss.controller.script;
import club.joylink.rtss.simulation.cbtc.script.ScriptUpdateVO; import club.joylink.rtss.simulation.cbtc.script.ScriptUpdateVO;
import club.joylink.rtss.entity.ScriptDraftWithBLOBs; import club.joylink.rtss.entity.ScriptDraftWithBLOBs;

View File

@ -7,8 +7,8 @@ import club.joylink.rtss.services.simulation.IScriptSimulationService;
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.script.MapLocationVO; import club.joylink.rtss.vo.client.script.MapLocationVO;
import club.joylink.rtss.vo.client.script.ScriptActionNewUpdateVO; import club.joylink.rtss.vo.client.script.ScriptActionUpdateVO;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; 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.simulationv1.SimulationMemberVO; import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -52,13 +52,13 @@ public class ScriptSimulationController {
@ApiOperation(value = "获取剧本所有动作") @ApiOperation(value = "获取剧本所有动作")
@GetMapping("/{group}/allAction") @GetMapping("/{group}/allAction")
public List<ScriptActionNewVO> getAllAction(@PathVariable @NotBlank String group) { public List<ScriptActionVO> getAllAction(@PathVariable @NotBlank String group) {
return iScriptSimulationService.getAllAction(group); return iScriptSimulationService.getAllAction(group);
} }
@ApiOperation("修改剧本会话动作") @ApiOperation("修改剧本会话动作")
@PutMapping("/{group}/action/update") @PutMapping("/{group}/action/update")
public void updateAction(@PathVariable @NotBlank String group, @RequestBody @NotNull @Validated ScriptActionNewUpdateVO updateVO) { public void updateAction(@PathVariable @NotBlank String group, @RequestBody @NotNull @Validated ScriptActionUpdateVO updateVO) {
iScriptSimulationService.updateAction(group, updateVO); iScriptSimulationService.updateAction(group, updateVO);
} }

View File

@ -1,8 +1,5 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import club.joylink.rtss.dao.CommandDefinitionDAO; import club.joylink.rtss.dao.CommandDefinitionDAO;
import club.joylink.rtss.entity.CommandDefinition; import club.joylink.rtss.entity.CommandDefinition;
import club.joylink.rtss.entity.CommandDefinitionExample; import club.joylink.rtss.entity.CommandDefinitionExample;
@ -11,12 +8,14 @@ import club.joylink.rtss.vo.client.CommandCopyVO;
import club.joylink.rtss.vo.client.CommandDefinitionQueryVO; import club.joylink.rtss.vo.client.CommandDefinitionQueryVO;
import club.joylink.rtss.vo.client.CommandDefinitionVO; import club.joylink.rtss.vo.client.CommandDefinitionVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import org.springframework.util.StringUtils; 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.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -53,11 +52,11 @@ public class CommandService implements ICommandService {
CommandDefinitionExample commandDefinitionExample = new CommandDefinitionExample(); CommandDefinitionExample commandDefinitionExample = new CommandDefinitionExample();
CommandDefinitionExample.Criteria criteria = commandDefinitionExample.createCriteria(); CommandDefinitionExample.Criteria criteria = commandDefinitionExample.createCriteria();
//条件线路 //条件线路
if (StringUtils.isNotEmpty(lineCode)) { if (!lineCode.isEmpty()) {
criteria.andLineCodeEqualTo(lineCode); criteria.andLineCodeEqualTo(lineCode);
} }
//条件操作对象 //条件操作对象
if (StringUtils.isNotEmpty(queryVO.getOperateObject())) { if (!queryVO.getOperateObject().isEmpty()) {
criteria.andOperateObjectEqualTo(queryVO.getOperateObject()); criteria.andOperateObjectEqualTo(queryVO.getOperateObject());
} }
@ -65,7 +64,7 @@ public class CommandService implements ICommandService {
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();
if (CollectionUtils.isEmpty(commandDefinitions)) { if (CollectionUtils.isEmpty(commandDefinitions)) {
return PageVO.convert(page, Lists.newArrayList()); return PageVO.convert(page, new ArrayList<>());
} }
return PageVO.convert(page, CommandDefinitionVO.convert2VOList(commandDefinitions)); return PageVO.convert(page, CommandDefinitionVO.convert2VOList(commandDefinitions));
} }
@ -87,14 +86,14 @@ public class CommandService implements ICommandService {
//条件线路 //条件线路
CommandDefinitionExample commandDefinitionExample = new CommandDefinitionExample(); CommandDefinitionExample commandDefinitionExample = new CommandDefinitionExample();
if (StringUtils.isNotEmpty(lineCode)) { if (!lineCode.isEmpty()) {
CommandDefinitionExample.Criteria criteria = commandDefinitionExample.createCriteria(); CommandDefinitionExample.Criteria criteria = commandDefinitionExample.createCriteria();
criteria.andLineCodeEqualTo(lineCode); criteria.andLineCodeEqualTo(lineCode);
if (StringUtils.isNotEmpty(simulationRole)) { if (!simulationRole.isEmpty()) {
//+操作对象过滤 //+操作对象过滤
criteria.andSimulationRoleEqualTo(simulationRole); criteria.andSimulationRoleEqualTo(simulationRole);
} }
if (StringUtils.isNotEmpty(prdType)) { if (!prdType.isEmpty()) {
criteria.andPrdTypeEqualTo(prdType); criteria.andPrdTypeEqualTo(prdType);
} }

View File

@ -1,44 +0,0 @@
package club.joylink.rtss.services;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
public interface IScriptService {
/**
* 根据id获取剧本详细数据
* @param id
* @return
*/
ScriptVO getScriptDetailById(Long id);
/**
* 分页查询上线的剧本
* @param scriptQueryVO
* @return
*/
PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO scriptQueryVO);
/**
* 获取客户端需要的剧本详细数据
* @param id
* @return
*/
ScriptVO getDetailForClientById(Long id);
/**
* 发布
*/
void publish(ScriptDraftWithBLOBs script, UserVO user);
void copy(Long sourceMapId, Long targetMapId, UserVO user);
/**
* 获取剧本操作对象
*/
ScriptBO getScriptBOById(Long scriptId, Simulation simulation);
}

View File

@ -86,6 +86,11 @@ public interface ISysUserService {
*/ */
boolean isAdmin(UserVO userVO); boolean isAdmin(UserVO userVO);
/**
* 确认用户是管理员否则报错
*/
void confirmAdmin(UserVO user);
/** /**
* 根据地图id查询订阅人员 * 根据地图id查询订阅人员
* @param mapId * @param mapId

View File

@ -1,10 +1,9 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.exception.BusinessException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.DBException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.configuration.configProp.WeChatConfig; import club.joylink.rtss.configuration.configProp.WeChatConfig;
@ -13,7 +12,6 @@ import club.joylink.rtss.dao.LearnCommentDAO;
import club.joylink.rtss.dao.LearnMessageDAO; import club.joylink.rtss.dao.LearnMessageDAO;
import club.joylink.rtss.dao.LearnPostDAO; import club.joylink.rtss.dao.LearnPostDAO;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.util.ConvertUtil;
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;
@ -26,11 +24,9 @@ import club.joylink.rtss.vo.client.post.LearnMessageVO;
import club.joylink.rtss.wechat.MiniProgramService; import club.joylink.rtss.wechat.MiniProgramService;
import club.joylink.rtss.wechat.vo.WxError; import club.joylink.rtss.wechat.vo.WxError;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
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.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -87,16 +83,13 @@ public class LearnService implements ILearnService {
// comment.setCreatorId(userVO.getIdLong()); // comment.setCreatorId(userVO.getIdLong());
// comment.setCreateTime(LocalDateTime.now()); // comment.setCreateTime(LocalDateTime.now());
// learnCommentDAO.insertSelective(comment); // learnCommentDAO.insertSelective(comment);
return ConvertUtil.long2Str(post.getId()); return post.getId().toString();
} }
@Override @Override
@Transactional @Transactional
public void likePost(Long postId, UserVO userVO) { public void likePost(Long postId, UserVO userVO) {
LearnPost post = learnPostDAO.selectByPrimaryKey(postId); LearnPost post = getPostEntity(postId);
if (Objects.isNull(post)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
post.setLike(post.getLike() + 1); post.setLike(post.getLike() + 1);
learnPostDAO.updateByPrimaryKey(post); learnPostDAO.updateByPrimaryKey(post);
} }
@ -104,20 +97,14 @@ public class LearnService implements ILearnService {
@Override @Override
@Transactional @Transactional
public void unlikePost(Long postId, UserVO userVO) { public void unlikePost(Long postId, UserVO userVO) {
LearnPost post = learnPostDAO.selectByPrimaryKey(postId); LearnPost post = getPostEntity(postId);
if (Objects.isNull(post)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
post.setUnlike(post.getUnlike() + 1); post.setUnlike(post.getUnlike() + 1);
learnPostDAO.updateByPrimaryKey(post); learnPostDAO.updateByPrimaryKey(post);
} }
@Override @Override
public LearnPostVO getPostInfo(Long postId) { public LearnPostVO getPostInfo(Long postId) {
LearnPost post = learnPostDAO.selectByPrimaryKey(postId); LearnPost post = getPostEntity(postId);
if (Objects.isNull(post)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
LearnPostVO postVO = new LearnPostVO(post); LearnPostVO postVO = new LearnPostVO(post);
// 用户昵称 // 用户昵称
UserVO user = iSysUserService.findUserById(post.getCreatorId()); UserVO user = iSysUserService.findUserById(post.getCreatorId());
@ -128,7 +115,7 @@ public class LearnService implements ILearnService {
@Override @Override
public PageVO<LearnCommentVO> pagedQueryComment(Long messageId, PageQueryVO queryVO) { public PageVO<LearnCommentVO> pagedQueryComment(Long messageId, PageQueryVO queryVO) {
checkMessage(messageId); checkMessageExist(messageId);
List<LearnCommentVO> commentVOList = new ArrayList<>(); List<LearnCommentVO> commentVOList = new ArrayList<>();
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
LearnCommentExample commentExample = new LearnCommentExample(); LearnCommentExample commentExample = new LearnCommentExample();
@ -173,7 +160,7 @@ public class LearnService implements ILearnService {
@Override @Override
public void addComment(Long messageId, LearnCreateVO postCreateVO, UserVO userVO) { public void addComment(Long messageId, LearnCreateVO postCreateVO, UserVO userVO) {
checkMessage(messageId); checkMessageExist(messageId);
checkContent(postCreateVO.getContent()); checkContent(postCreateVO.getContent());
LearnComment comment = new LearnComment(); LearnComment comment = new LearnComment();
comment.setContent(postCreateVO.getContent()); comment.setContent(postCreateVO.getContent());
@ -186,7 +173,7 @@ public class LearnService implements ILearnService {
@Override @Override
public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO, UserVO userVO) { public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO, UserVO userVO) {
checkMessage(messageId); checkMessageExist(messageId);
checkContent(postCreateVO.getContent()); checkContent(postCreateVO.getContent());
LearnComment comment = new LearnComment(); LearnComment comment = new LearnComment();
comment.setContent(postCreateVO.getContent()); comment.setContent(postCreateVO.getContent());
@ -206,10 +193,7 @@ public class LearnService implements ILearnService {
@Override @Override
@Transactional @Transactional
public void likeComment(Long commentId, UserVO userVO) { public void likeComment(Long commentId, UserVO userVO) {
LearnComment comment = learnCommentDAO.selectByPrimaryKey(commentId); LearnComment comment = getCommentEntity(commentId);
if (Objects.isNull(comment)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
comment.setLike(comment.getLike() + 1); comment.setLike(comment.getLike() + 1);
learnCommentDAO.updateByPrimaryKey(comment); learnCommentDAO.updateByPrimaryKey(comment);
} }
@ -217,10 +201,7 @@ public class LearnService implements ILearnService {
@Override @Override
@Transactional @Transactional
public void unlikeComment(Long commentId, UserVO userVO) { public void unlikeComment(Long commentId, UserVO userVO) {
LearnComment comment = learnCommentDAO.selectByPrimaryKey(commentId); LearnComment comment = getCommentEntity(commentId);
if (Objects.isNull(comment)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
comment.setUnlike(comment.getUnlike() + 1); comment.setUnlike(comment.getUnlike() + 1);
learnCommentDAO.updateByPrimaryKey(comment); learnCommentDAO.updateByPrimaryKey(comment);
} }
@ -256,26 +237,24 @@ public class LearnService implements ILearnService {
@Override @Override
public void adminDeleteComment(Long commentId, UserVO user) { public void adminDeleteComment(Long commentId, UserVO user) {
adminCheck(user); iSysUserService.confirmAdmin(user);
learnCommentDAO.deleteByPrimaryKey(commentId); learnCommentDAO.deleteByPrimaryKey(commentId);
} }
@Override @Override
public void userDeleteComment(Long commentId, UserVO user) { public void userDeleteComment(Long commentId, UserVO user) {
LearnComment comment = getComment(commentId); LearnComment comment = getCommentEntity(commentId);
if (!comment.getCreatorId().equals(user.getId())) { if (!comment.getCreatorId().equals(user.getId())) {
log.error(String.format("用户[%s]意外尝试删除别人的评论[%s]", user.getId(), commentId)); log.error(String.format("用户[%s]意外尝试删除别人的评论[%s]", user.getId(), commentId));
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "无法删除非本人的评论"); throw BusinessExceptionAssertEnum.INVALID_OPERATION.exception("无法删除非本人的评论");
} }
learnCommentDAO.deleteByPrimaryKey(commentId); learnCommentDAO.deleteByPrimaryKey(commentId);
} }
@Override @Override
public long createMessage(LearnMessageCreateVO messageCreateVO, UserVO user) { public long createMessage(LearnMessageCreateVO messageCreateVO, UserVO user) {
if (StringUtils.isBlank(messageCreateVO.getContent()) BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!messageCreateVO.getContent().isBlank(),
&& CollectionUtils.isEmpty(messageCreateVO.getPictureUrls())) { "内容不能空白");
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "文字和图片不能都为空");
}
checkContent(messageCreateVO.getContent()); checkContent(messageCreateVO.getContent());
LearnMessageWithBLOBs message = messageCreateVO.convert2DB(user.getId()); LearnMessageWithBLOBs message = messageCreateVO.convert2DB(user.getId());
learnMessageDAO.insert(message); learnMessageDAO.insert(message);
@ -289,23 +268,23 @@ public class LearnService implements ILearnService {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<LearnMessageVO> page = (Page<LearnMessageVO>) learnMessageDAO.select(postId, queryVO); Page<LearnMessageVO> page = (Page<LearnMessageVO>) learnMessageDAO.select(postId, queryVO);
for (LearnMessageVO vo : page.getResult()) { for (LearnMessageVO vo : page.getResult()) {
vo.setComments(pagedQueryComment(vo.getId(), new PageQueryVO(1,3))); vo.setComments(pagedQueryComment(vo.getId(), new PageQueryVO(1, 3)));
} }
return PageVO.convert(page); return PageVO.convert(page);
} }
@Override @Override
public void adminDeleteMessage(Long messageId, UserVO user) { public void adminDeleteMessage(Long messageId, UserVO user) {
adminCheck(user); iSysUserService.confirmAdmin(user);
deleteMessage(messageId); deleteMessage(messageId);
} }
@Override @Override
public void userDeleteMessage(Long messageId, UserVO user) { public void userDeleteMessage(Long messageId, UserVO user) {
LearnMessage message = getMessage(messageId); LearnMessage message = getMessageEntity(messageId);
if (!message.getCreatorId().equals(user.getId())) { if (!message.getCreatorId().equals(user.getId())) {
log.error(String.format("用户[%s]意外尝试删除别人的留言[%s]", user.getId(), messageId)); log.error(String.format("用户[%s]意外尝试删除别人的留言[%s]", user.getId(), messageId));
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "无法删除非本人的留言"); throw BusinessExceptionAssertEnum.INVALID_OPERATION.exception("无法删除非本人的留言");
} }
deleteMessage(messageId); deleteMessage(messageId);
} }
@ -322,7 +301,7 @@ public class LearnService implements ILearnService {
public PageVO<LearnMessageVO> pagedQueryMessageByProject(Project project, LearnMessagePagedQueryVO queryVO) { public PageVO<LearnMessageVO> pagedQueryMessageByProject(Project project, LearnMessagePagedQueryVO queryVO) {
LearnPostVO post = queryPost(project); LearnPostVO post = queryPost(project);
if (post == null) { if (post == null) {
log.error(String.format("项目[%s]的留言板不存在",project)); log.error(String.format("项目[%s]的留言板不存在", project));
throw new SimulationException(SimulationExceptionType.System_Fault, "该项目的留言板不存在"); throw new SimulationException(SimulationExceptionType.System_Fault, "该项目的留言板不存在");
} }
return pagedQueryMessageByPostId(post.getId(), queryVO); return pagedQueryMessageByPostId(post.getId(), queryVO);
@ -344,15 +323,14 @@ public class LearnService implements ILearnService {
// return message.getUnlike(); // return message.getUnlike();
// } // }
private LearnComment findComment(Long commentId) { private LearnComment findCommentEntity(Long commentId) {
return learnCommentDAO.selectByPrimaryKey(commentId); return learnCommentDAO.selectByPrimaryKey(commentId);
} }
private LearnComment getComment(Long commentId) { private LearnComment getCommentEntity(Long commentId) {
LearnComment comment = findComment(commentId); LearnComment comment = findCommentEntity(commentId);
if (comment == null) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(comment,
throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST, "该评论不存在或已被删除"); "该评论不存在或已被删除");
}
return comment; return comment;
} }
@ -368,22 +346,15 @@ public class LearnService implements ILearnService {
} }
private LearnPost topCheck(Long postId, UserVO userVO) { private LearnPost topCheck(Long postId, UserVO userVO) {
if (!iSysUserService.isAdmin(userVO)) { iSysUserService.confirmAdmin(userVO);
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION); LearnPost post = getPostEntity(postId);
}
LearnPost post = learnPostDAO.selectByPrimaryKey(postId);
if (Objects.isNull(post)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
return post; return post;
} }
private void checkContent(String content) { private void checkContent(String content) {
WxError wxError = this.miniProgramService.msgSecCheck(content); WxError wxError = this.miniProgramService.msgSecCheck(content);
if (wxError.isError()) { BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(wxError.isError(),
log.error(String.format("内容校验不通过: [%s]", wxError.toString())); String.format("内容校验不通过: [%s]", wxError.toString()));
throw new BusinessException(ExceptionMapping.CONTENT_SECURITY_CHECK);
}
// Map<String, String> param = new HashMap<>(); // Map<String, String> param = new HashMap<>();
// param.put("content", content); // param.put("content", content);
// WxBaseResp resp = restTemplate.postForObject(weChatConfig.getMsgSecCheckUrl(), param, WxBaseResp.class); // WxBaseResp resp = restTemplate.postForObject(weChatConfig.getMsgSecCheckUrl(), param, WxBaseResp.class);
@ -401,34 +372,28 @@ public class LearnService implements ILearnService {
/** /**
* 留言检查 * 留言检查
*/ */
private void checkMessage(Long messageId) { private void checkMessageExist(Long messageId) {
if (findMessage(messageId) == null) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(findMessageEntity(messageId),
throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的留言不存在", messageId)); String.format("id为[%s]的留言不存在", messageId));
}
} }
private LearnMessageWithBLOBs findMessage(Long messageId) { private LearnMessageWithBLOBs findMessageEntity(Long messageId) {
return learnMessageDAO.selectByPrimaryKey(messageId); return learnMessageDAO.selectByPrimaryKey(messageId);
} }
private LearnMessageWithBLOBs getMessage(Long messageId) { private LearnMessageWithBLOBs getMessageEntity(Long messageId) {
LearnMessageWithBLOBs message = findMessage(messageId); LearnMessageWithBLOBs message = findMessageEntity(messageId);
if (message == null) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message, String.format("id为[%s]的留言不存在", messageId));
throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的留言不存在", messageId));
}
return message; return message;
} }
/** private LearnPost findPostEntity(Long postId) {
* 确认用户是管理员 return learnPostDAO.selectByPrimaryKey(postId);
*/
private void adminCheck(UserVO user) {
if (!iSysUserService.isAdmin(user)) {
log.error(String.format("用户[%s]意外使用管理员的功能", user.getId()));
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "非管理员无法使用此功能");
}
} }
private void test(LearnMessagePagedQueryVO queryVO) { private LearnPost getPostEntity(Long postId) {
LearnPost post = findPostEntity(postId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(post);
return post;
} }
} }

View File

@ -1,11 +1,10 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.exception.BaseException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training.ITrainingV1Service; import club.joylink.rtss.services.training.ITrainingV1Service;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.DBException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.services.cache.ICacheService; import club.joylink.rtss.services.cache.ICacheService;
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;
@ -15,12 +14,6 @@ import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.*; import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.services.simulation.SchedulingService; import club.joylink.rtss.services.simulation.SchedulingService;
import club.joylink.rtss.simulation.Simulation;
import club.joylink.rtss.simulation.SimulationAdapter;
import club.joylink.rtss.simulation.SimulationConstructData;
import club.joylink.rtss.simulation.data.DataService;
import club.joylink.rtss.simulation.data.device.RouteUnit;
import club.joylink.rtss.util.ConvertUtil;
import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.util.VersionUtil; import club.joylink.rtss.util.VersionUtil;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
@ -79,15 +72,6 @@ public class MapService implements IMapService {
@Autowired @Autowired
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired
private SimulationAdapter simulationAdapter;
@Autowired
private IRunPlanDraftService iRunPlanDraftService;
@Autowired
private MpStationRunningDAO stationRunningDAO;
@Autowired @Autowired
private ISysDictionaryService iSysDictionaryService; private ISysDictionaryService iSysDictionaryService;
@ -109,9 +93,6 @@ public class MapService implements IMapService {
@Autowired @Autowired
private IExamService iExamService; private IExamService iExamService;
@Autowired
private IScriptService iScriptService;
@Autowired @Autowired
private IMapSystemService iMapSystemService; private IMapSystemService iMapSystemService;
@ -161,10 +142,10 @@ public class MapService implements IMapService {
example.setOrderByClause("order_number"); example.setOrderByClause("order_number");
MapInfoExample.Criteria criteria = example.createCriteria(); MapInfoExample.Criteria criteria = example.createCriteria();
criteria.andStatusEqualTo(MapStatus.Online.getCode()); criteria.andStatusEqualTo(MapStatus.Online.getCode());
if (!StringUtils.isBlank(mapVO.getName())) { if (!mapVO.getName().isBlank()) {
criteria.andNameLike(String.format("%%%s%%", mapVO.getName())); criteria.andNameLike(String.format("%%%s%%", mapVO.getName()));
} }
if (!StringUtils.isBlank(mapVO.getCityCode())) { if (!mapVO.getCityCode().isBlank()) {
criteria.andCityCodeEqualTo(mapVO.getCityCode()); criteria.andCityCodeEqualTo(mapVO.getCityCode());
} }
// criteria.andDrawWayEqualTo(mapVO.isDrawWay()); // criteria.andDrawWayEqualTo(mapVO.isDrawWay());
@ -229,9 +210,8 @@ public class MapService implements IMapService {
public MapVO getMapInfoById(Long id) { public MapVO getMapInfoById(Long id) {
Objects.requireNonNull(id, "id 不能为null"); Objects.requireNonNull(id, "id 不能为null");
MapVO mapVO = this.findMapBaseInfoById(id); MapVO mapVO = this.findMapBaseInfoById(id);
if (Objects.isNull(mapVO)) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mapVO,
throw new DBException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为%s的地图数据不存在", id)); String.format("id为[%s]的地图数据不存在", id));
}
String version = this.findMapVersion(id); String version = this.findMapVersion(id);
mapVO.setVersion(version); mapVO.setVersion(version);
return mapVO; return mapVO;
@ -277,10 +257,8 @@ public class MapService implements IMapService {
MapDataExample example = new MapDataExample(); MapDataExample example = new MapDataExample();
example.createCriteria().andMapIdEqualTo(mapId); example.createCriteria().andMapIdEqualTo(mapId);
List<MapDataWithBLOBs> mapDataList = this.mapDataDAO.selectByExampleWithBLOBs(example); List<MapDataWithBLOBs> mapDataList = this.mapDataDAO.selectByExampleWithBLOBs(example);
if (CollectionUtils.isEmpty(mapDataList)) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(!CollectionUtils.isEmpty(mapDataList),
throw new DBException(ExceptionMapping.DATA_NOT_EXIST,
String.format("地图id[%s]的地图数据不存在", mapId)); String.format("地图id[%s]的地图数据不存在", mapId));
}
return new MapDataVO(mapDataList.get(0), drayWay); return new MapDataVO(mapDataList.get(0), drayWay);
} }
@ -321,7 +299,7 @@ public class MapService implements IMapService {
@Transactional @Transactional
public void deleteMap(Long id, UserVO userVO) { public void deleteMap(Long id, UserVO userVO) {
// 判断地图数据是否存在 // 判断地图数据是否存在
MapInfo map = mapInfoDAO.selectByPrimaryKey(id); MapInfo map = findMapInfoEntity(id);
if (Objects.isNull(map)) { if (Objects.isNull(map)) {
return; return;
} }
@ -333,27 +311,28 @@ public class MapService implements IMapService {
@Override @Override
public void onLine(Long id, UserVO userVO) { public void onLine(Long id, UserVO userVO) {
// 判断地图数据是否存在 // 判断地图数据是否存在
MapInfo map = mapInfoDAO.selectByPrimaryKey(id); MapInfo map = getMapInfoEntity(id);
if (map == null) { iSysUserService.confirmAdmin(userVO);
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
if (!iSysUserService.isAdmin(userVO)) {
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION);
}
map.setStatus(MapStatus.Online.getCode()); map.setStatus(MapStatus.Online.getCode());
mapInfoDAO.updateByPrimaryKey(map); mapInfoDAO.updateByPrimaryKey(map);
} }
private MapInfo findMapInfoEntity(Long id) {
return mapInfoDAO.selectByPrimaryKey(id);
}
private MapInfo getMapInfoEntity(Long id) {
MapInfo map = findMapInfoEntity(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(map,
String.format("id为[%s]的MapInfo不存在", id));
return map;
}
@Override @Override
public void offLine(Long id, UserVO userVO) { public void offLine(Long id, UserVO userVO) {
// 判断地图数据是否存在 // 判断地图数据是否存在
MapInfo map = mapInfoDAO.selectByPrimaryKey(id); MapInfo map = getMapInfoEntity(id);
if (map == null) { iSysUserService.confirmAdmin(userVO);
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
if (!iSysUserService.isAdmin(userVO)) {
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION);
}
map.setStatus(MapStatus.Offline.getCode()); map.setStatus(MapStatus.Offline.getCode());
mapInfoDAO.updateByPrimaryKey(map); mapInfoDAO.updateByPrimaryKey(map);
} }
@ -381,16 +360,12 @@ public class MapService implements IMapService {
} else { } else {
map = mapInfoList.get(0); map = mapInfoList.get(0);
if (!MapStatus.Delete.getCode().equals(map.getStatus())) { if (!MapStatus.Delete.getCode().equals(map.getStatus())) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getLineCode(), mapVO.getLineCode(),
if (!Objects.equals(map.getLineCode(), mapVO.getLineCode())) { "存在名称相同但基于不同真实线路的地图");
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "存在名称相同但基于不同真实线路的地图"); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getDrawWay(), mapVO.isDrawWay(),
} "存在名称相同但基于不同绘制方式的地图");
if (!Objects.equals(map.getDrawWay(), mapVO.isDrawWay())) { BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getCityCode(), mapVO.getCityCode(),
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "存在名称相同但基于不同绘制方式的地图"); "存在名称相同但基于不同关联城市的地图");
}
if (!Objects.equals(map.getCityCode(), mapVO.getCityCode())) {
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "存在名称相同但基于不同关联城市的地图");
}
} }
} }
// 地图数据 // 地图数据
@ -426,10 +401,8 @@ public class MapService implements IMapService {
// 地图版本 // 地图版本
MapVersion newMapVersion = buildAndInsertMapVersion(map, userVO); MapVersion newMapVersion = buildAndInsertMapVersion(map, userVO);
// 保存站间运行数据 // 保存站间运行数据
if (!map.getDrawWay()) { BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(map.getDrawWay());
this.constructAndSaveStationRunning(map.getId(), mapDataVO); iCacheService.remove(BusinessConsts.CachePrefix.Map + map.getId());
}
ICacheService.remove(BusinessConsts.CachePrefix.Map + map.getId());
MapVO newMapVO = new MapVO(map); MapVO newMapVO = new MapVO(map);
newMapVO.setVersion(newMapVersion.getVersion()); newMapVO.setVersion(newMapVersion.getVersion());
MapDataVO dataVO = new MapDataVO(mapData, map.getDrawWay()); MapDataVO dataVO = new MapDataVO(mapData, map.getDrawWay());
@ -446,21 +419,15 @@ public class MapService implements IMapService {
.andStatusNotEqualTo(MapStatus.Delete.getCode()); .andStatusNotEqualTo(MapStatus.Delete.getCode());
List<MapInfo> mapInfoList = mapInfoDAO.selectByExample(infoExample); List<MapInfo> mapInfoList = mapInfoDAO.selectByExample(infoExample);
MapInfo map; MapInfo map;
if (ObjectUtils.isEmpty(mapInfoList)) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(!ObjectUtils.isEmpty(mapInfoList),
throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST,
String.format("地图名称为[%s]的发布地图数据不存在", mapVO.getName())); String.format("地图名称为[%s]的发布地图数据不存在", mapVO.getName()));
} else {
map = mapInfoList.get(0); map = mapInfoList.get(0);
if (!Objects.equals(map.getLineCode(), mapVO.getLineCode())) { BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getLineCode(), mapVO.getLineCode(),
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "存在名称相同但基于不同真实线路的地图"); "存在名称相同但基于不同真实线路的地图");
} BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getDrawWay(), mapVO.isDrawWay(),
if (!Objects.equals(map.getDrawWay(), mapVO.isDrawWay())) { "存在名称相同但基于不同绘制方式的地图");
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "存在名称相同但基于不同绘制方式的地图"); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getCityCode(), mapVO.getCityCode(),
} "存在名称相同但基于不同关联城市的地图");
if (!Objects.equals(map.getCityCode(), mapVO.getCityCode())) {
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "存在名称相同但基于不同关联城市的地图");
}
}
if (Objects.nonNull(map3dDataVO)) { if (Objects.nonNull(map3dDataVO)) {
Map3dDataExample map3dDataExample = new Map3dDataExample(); Map3dDataExample map3dDataExample = new Map3dDataExample();
map3dDataExample.createCriteria().andMapIdEqualTo(map.getId()); map3dDataExample.createCriteria().andMapIdEqualTo(map.getId());
@ -478,7 +445,7 @@ public class MapService implements IMapService {
map3dData.setUpdateTime(LocalDateTime.now()); map3dData.setUpdateTime(LocalDateTime.now());
map3dDataDAO.updateByPrimaryKeySelective(map3dData); map3dDataDAO.updateByPrimaryKeySelective(map3dData);
} }
ICacheService.remove(BusinessConsts.CachePrefix.Map_3d + map.getId()); iCacheService.remove(BusinessConsts.CachePrefix.Map_3d + map.getId());
} }
} }
@ -515,28 +482,17 @@ public class MapService implements IMapService {
@Override @Override
public void updateName(Long id, String name, UserVO userVO) { public void updateName(Long id, String name, UserVO userVO) {
if (!this.iSysUserService.isAdmin(userVO)) { iSysUserService.confirmAdmin(userVO);
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(isNameExistExcept(name, id));
} MapInfo map = getMapInfoEntity(id);
if (this.isNameExistExcept(name, id)) {
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "名称已存在");
}
MapInfo map = mapInfoDAO.selectByPrimaryKey(id);
if (Objects.isNull(map)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
map.setName(name); map.setName(name);
mapInfoDAO.updateByPrimaryKey(map); mapInfoDAO.updateByPrimaryKey(map);
// // 自动更新商品名称
// iGoodsService.autoUpdateSimulateGoods(new MapVO(map));
} }
@Override @Override
public void updateBelongCity(Long id, String cityCode, UserVO user) { public void updateBelongCity(Long id, String cityCode, UserVO user) {
if (!this.iSysUserService.isAdmin(user)) { iSysUserService.confirmAdmin(user);
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION); MapInfo mapInfo = findMapInfoEntity(id);
}
MapInfo mapInfo = this.mapInfoDAO.selectByPrimaryKey(id);
if (Objects.nonNull(mapInfo)) { if (Objects.nonNull(mapInfo)) {
mapInfo.setCityCode(cityCode); mapInfo.setCityCode(cityCode);
mapInfoDAO.updateByPrimaryKey(mapInfo); mapInfoDAO.updateByPrimaryKey(mapInfo);
@ -546,11 +502,10 @@ public class MapService implements IMapService {
@Override @Override
public void updateBelongProject(Long id, boolean project, String projectCode, UserVO user) { public void updateBelongProject(Long id, boolean project, String projectCode, UserVO user) {
Objects.requireNonNull(id, "地图id不能为空"); Objects.requireNonNull(id, "地图id不能为空");
MapInfo mapInfo = this.mapInfoDAO.selectByPrimaryKey(id); MapInfo mapInfo = findMapInfoEntity(id);
if (project) { if (project) {
if (StringUtils.isBlank(projectCode)) { BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(projectCode.isBlank(),
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "定制项目不能为空"); "定制项目不能为空");
}
} }
mapInfo.setProject(project); mapInfo.setProject(project);
mapInfo.setProjectCode(projectCode); mapInfo.setProjectCode(projectCode);
@ -582,87 +537,6 @@ public class MapService implements IMapService {
return MapVO.convert2VOList(mapInfoList); return MapVO.convert2VOList(mapInfoList);
} }
/**
* 构造并保存站间运行数据
*
* @param mapId
* @param mapDataVO
*/
private void constructAndSaveStationRunning(Long mapId, MapDataVO mapDataVO) {
Objects.requireNonNull(mapId);
List<MapRouteUnitVO> routeUnitList = null;
List<MapRoutingVO> routingList = null;
if (!mapDataVO.isDrawWay()) {
// if (CollectionUtils.isEmpty(mapDataVO.getLogicDataNew().getRoutingList())) {
// return;
// }
// MapLogicDataNewVO logicData = mapDataVO.getLogicDataNew();
// routingList = logicData.getRoutingList();
// routeUnitList = logicData.getRouteUnitList();
// } else {
if (CollectionUtils.isEmpty(mapDataVO.getLogicData().getRoutingList())) {
return;
}
MapLogicDataVO logicData = mapDataVO.getLogicData();
routingList = logicData.getRoutingList();
routeUnitList = logicData.getRouteUnitList();
}
SimulationConstructData constructData = SimulationConstructData.buildFunctionalConstructData(mapDataVO, null);
Simulation simulation = simulationAdapter.constructSimulation(constructData);
Map<String, MpStationRunning> stationRunningMap = new HashMap<>();
// 路径单元
Map<String, MapRouteUnitVO> routeUnitVOMap = routeUnitList.stream()
.collect(Collectors.toMap(routeUnit ->
String.format("%s-%s", routeUnit.getStartSectionCode(), routeUnit.getEndSectionCode()), Function.identity()));
// 交路区段
List<MapRoutingSectionVO> routingSectionVOList = new ArrayList<>();
routingList.forEach(routingVO -> routingSectionVOList.addAll(routingVO.getRoutingSectionList()));
Map<String, List<MapRoutingSectionVO>> routingSectionMap = routingSectionVOList.stream()
.collect(Collectors.groupingBy(MapRoutingSectionVO::getRoutingCode));
// 交路
routingList.forEach(routingVO -> {
List<MapRoutingSectionVO> routingSectionList = routingSectionMap.get(routingVO.getCode());
for (int i = 0; i < routingSectionList.size() - 1; i++) {
MapRoutingSectionVO startSection = routingSectionList.get(i);
MapRoutingSectionVO endSection = routingSectionList.get(i + 1);
String key = String.format("%s-%s", startSection.getSectionCode(), endSection.getSectionCode());
if (Objects.isNull(stationRunningMap.get(key))) {
MpStationRunning stationRunning = new MpStationRunning();
stationRunning.setMapId(mapId);
stationRunning.setStartStationCode(startSection.getStationCode());
stationRunning.setStartSectionCode(startSection.getSectionCode());
stationRunning.setEndStationCode(endSection.getStationCode());
stationRunning.setEndSectionCode(endSection.getSectionCode());
stationRunning.setDirectionCode(routingVO.getDirectionCode());
// 计算距离
MapRouteUnitVO mapRouteUnitVO = routeUnitVOMap.get(key);
if (Objects.isNull(mapRouteUnitVO)) {
log.error(String.format("%s路径单元不存在", key));
stationRunning.setDistance(100000);
} else {
RouteUnit routeUnit = simulation.getDeviceRepository().getDeviceByCode(mapRouteUnitVO.getCode(), RouteUnit.class);
float distance = DataService.CalculateService.calculateDistance(simulation, routeUnit);
stationRunning.setDistance(ConvertUtil.float2IntegerByWeight(distance, 100));
}
stationRunningMap.put(key, stationRunning);
}
}
});
// 删除旧数据插入新数据 后续处理比较
MpStationRunningExample stationRunningExample = new MpStationRunningExample();
stationRunningExample.createCriteria().andMapIdEqualTo(mapId);
List<MpStationRunning> stationRunningList = this.stationRunningDAO.selectByExample(stationRunningExample);
List<Long> stationRunningIdList = stationRunningList.stream().map(MpStationRunning::getId).collect(Collectors.toList());
iRunPlanDraftService.deleteRunPlanLevelByStationRunningId(stationRunningIdList);
this.stationRunningDAO.deleteByExample(stationRunningExample);
stationRunningMap.values().forEach(stationRunning -> {
stationRunning.setMapId(mapId);
this.stationRunningDAO.insert(stationRunning);
});
}
@Override @Override
public List<MapVO> queryOnlineMapInfos() { public List<MapVO> queryOnlineMapInfos() {
MapInfoExample example = new MapInfoExample(); MapInfoExample example = new MapInfoExample();
@ -704,7 +578,7 @@ public class MapService implements IMapService {
@Override @Override
public MapVO findMapBaseInfoById(Long id) { public MapVO findMapBaseInfoById(Long id) {
MapInfo mapInfo = this.mapInfoDAO.selectByPrimaryKey(id); MapInfo mapInfo = findMapInfoEntity(id);
if (Objects.nonNull(mapInfo)) { if (Objects.nonNull(mapInfo)) {
return new MapVO(mapInfo); return new MapVO(mapInfo);
} }
@ -717,9 +591,8 @@ public class MapService implements IMapService {
// 获取源地图数据 // 获取源地图数据
MapVO mapVO = this.getMapDetail(id); MapVO mapVO = this.getMapDetail(id);
// 检查名称 // 检查名称
if (this.isMapNameExist(copyOption.getName())) { BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(isMapNameExist(copyOption.getName()),
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, String.format("地图名称为[%s]的地图已经存在", copyOption.getName())); String.format("地图名称为[%s]的地图已经存在", copyOption.getName()));
}
// 拷贝地图数据 // 拷贝地图数据
mapVO.setName(copyOption.getName()); mapVO.setName(copyOption.getName());
MapDataVO mapDataVO = new MapDataVO(mapVO); MapDataVO mapDataVO = new MapDataVO(mapVO);
@ -744,8 +617,8 @@ public class MapService implements IMapService {
} }
//拷贝system //拷贝system
this.iMapSystemService.copyOfMap(id, mapNewVO.getId()); this.iMapSystemService.copyOfMap(id, mapNewVO.getId());
//拷贝剧本 // //拷贝剧本
this.iScriptService.copy(id, mapNewVO.getId(), user); // this.iScriptService.copy(id, mapNewVO.getId(), user);
} }
} }
@ -769,7 +642,7 @@ public class MapService implements IMapService {
@Override @Override
public boolean isExist(Long id) { public boolean isExist(Long id) {
MapInfo mapInfo = mapInfoDAO.selectByPrimaryKey(id); MapInfo mapInfo = findMapInfoEntity(id);
if (mapInfo == null) { if (mapInfo == null) {
return false; return false;
} }
@ -829,12 +702,11 @@ public class MapService implements IMapService {
@Override @Override
public void updateBasicInfo(Long id, MapInfoUpdateVO updateVO, UserVO user) { public void updateBasicInfo(Long id, MapInfoUpdateVO updateVO, UserVO user) {
MapInfo mapInfo = this.mapInfoDAO.selectByPrimaryKey(id); MapInfo mapInfo = findMapInfoEntity(id);
boolean update = false; boolean update = false;
if (StringUtils.hasText(updateVO.getName())) { if (StringUtils.hasText(updateVO.getName())) {
if (this.isNameExistExcept(updateVO.getName(), id)) { BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertNotTrue(isNameExistExcept(updateVO.getName(), id),
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "名称已存在"); "名称已存在");
}
mapInfo.setName(updateVO.getName()); mapInfo.setName(updateVO.getName());
update = true; update = true;
} }
@ -917,14 +789,14 @@ public class MapService implements IMapService {
try { try {
//子系统 //子系统
iMapSystemService.generateSystem(mapId); iMapSystemService.generateSystem(mapId);
} catch (DBException e) { } catch (BaseException e) {
log.warn("生成地图[{}]子系统{}",mapId,e.getMessage()); log.warn("生成地图[{}]子系统{}", mapId, e.getMessage());
} }
try { try {
//权限 //权限
iPermissionService.generatePermission(mapId, createUser); iPermissionService.generatePermission(mapId, createUser);
} catch (BusinessException | DBException e) { } catch (BaseException e) {
log.warn("生成地图[{}]权限:{}",mapId,e.getMessage()); log.warn("生成地图[{}]权限:{}", mapId, e.getMessage());
} }
} }

View File

@ -1,10 +1,8 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.DBException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.constants.MapPrdTypeEnum; import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.constants.MapSystemType; import club.joylink.rtss.constants.MapSystemType;
import club.joylink.rtss.constants.Project; import club.joylink.rtss.constants.Project;
@ -61,9 +59,8 @@ public class MapSystemService implements IMapSystemService {
@Override @Override
@Transactional @Transactional
public void generateSystem(Long mapId) { public void generateSystem(Long mapId) {
if (!iMapService.isExist(mapId)) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(iMapService.isExist(mapId),
throw new DBException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的地图不存在", mapId)); String.format("id为[%s]的地图不存在", mapId));
}
for (MapPrdTypeEnum value : MapPrdTypeEnum.values()) { for (MapPrdTypeEnum value : MapPrdTypeEnum.values()) {
MapSystem system = new MapSystem(); MapSystem system = new MapSystem();
system.setName(value.getMsg()); system.setName(value.getMsg());
@ -135,9 +132,8 @@ public class MapSystemService implements IMapSystemService {
.andMapIdEqualTo(mapSystemVO.getMapId()) .andMapIdEqualTo(mapSystemVO.getMapId())
.andPrdTypeEqualTo(mapSystemVO.getPrdType()) .andPrdTypeEqualTo(mapSystemVO.getPrdType())
.andTypeEqualTo(mapSystemVO.getType()); .andTypeEqualTo(mapSystemVO.getType());
if (mapSystemDAO.countByExample(mapSystemExample) > 0) { BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(mapSystemDAO.countByExample(mapSystemExample) == 0,
throw new DBException(ExceptionMapping.DATA_EXISTS); "子系统已经存在");
}
MapSystem mapSystem = new MapSystem(); MapSystem mapSystem = new MapSystem();
mapSystem.setName(mapSystemVO.getName()); mapSystem.setName(mapSystemVO.getName());
mapSystem.setType(mapSystemVO.getType()); mapSystem.setType(mapSystemVO.getType());
@ -150,10 +146,7 @@ public class MapSystemService implements IMapSystemService {
@Override @Override
public void updateMapSystem(Long id, MapSystemVO mapSystemVO) { public void updateMapSystem(Long id, MapSystemVO mapSystemVO) {
MapSystem mapSystem = mapSystemDAO.selectByPrimaryKey(id); MapSystem mapSystem = getEntity(id);
if (Objects.isNull(mapSystem)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
if (StringUtils.hasText(mapSystemVO.getName()) && !Objects.equals(mapSystem.getName(), mapSystemVO.getName())) { if (StringUtils.hasText(mapSystemVO.getName()) && !Objects.equals(mapSystem.getName(), mapSystemVO.getName())) {
mapSystem.setName(mapSystemVO.getName()); mapSystem.setName(mapSystemVO.getName());
mapSystemDAO.updateByPrimaryKey(mapSystem); mapSystemDAO.updateByPrimaryKey(mapSystem);
@ -162,10 +155,7 @@ public class MapSystemService implements IMapSystemService {
@Override @Override
public MapSystemVO getMapSystem(Long id) { public MapSystemVO getMapSystem(Long id) {
MapSystem mapSystem = mapSystemDAO.selectByPrimaryKey(id); MapSystem mapSystem = getEntity(id);
if (Objects.isNull(mapSystem)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
return new MapSystemVO(mapSystem); return new MapSystemVO(mapSystem);
} }
@ -216,10 +206,7 @@ public class MapSystemService implements IMapSystemService {
*/ */
@Override @Override
public MapSystemDetailVO getMapSystemDetail(Long id, UserVO userVO) { public MapSystemDetailVO getMapSystemDetail(Long id, UserVO userVO) {
MapSystem mapSystem = mapSystemDAO.selectByPrimaryKey(id); MapSystem mapSystem = getEntity(id);
if (Objects.isNull(mapSystem)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
}
MapSystemDetailVO mapSystemDetailVO = new MapSystemDetailVO(mapSystem); MapSystemDetailVO mapSystemDetailVO = new MapSystemDetailVO(mapSystem);
if (MapSystemType.Simulation.name().equals(mapSystem.getType())) { if (MapSystemType.Simulation.name().equals(mapSystem.getType())) {
@ -264,9 +251,7 @@ public class MapSystemService implements IMapSystemService {
@Override @Override
public void delete(Long id, UserVO userVO) { public void delete(Long id, UserVO userVO) {
if (!iSysUserService.isAdmin(userVO)) { iSysUserService.confirmAdmin(userVO);
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION);
}
mapSystemDAO.deleteByPrimaryKey(id); mapSystemDAO.deleteByPrimaryKey(id);
} }
@ -293,4 +278,15 @@ public class MapSystemService implements IMapSystemService {
List<MapSystem> mapSystemList = mapSystemDAO.selectByExample(example); List<MapSystem> mapSystemList = mapSystemDAO.selectByExample(example);
return mapSystemList.stream().map(MapSystemVO::new).collect(Collectors.toList()); return mapSystemList.stream().map(MapSystemVO::new).collect(Collectors.toList());
} }
private MapSystem findEntity(Long id) {
return mapSystemDAO.selectByPrimaryKey(id);
}
private MapSystem getEntity(Long id) {
MapSystem entity = findEntity(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(entity);
return entity;
}
} }

View File

@ -1,125 +0,0 @@
package club.joylink.rtss.services;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.StatusEnum;
import club.joylink.rtss.dao.ScriptDAO;
import club.joylink.rtss.entity.Script;
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
import club.joylink.rtss.entity.ScriptExample;
import club.joylink.rtss.entity.ScriptWithBLOBs;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
@Service
public class ScriptService implements IScriptService {
@Autowired
private ScriptDAO scriptDAO;
@Override
public PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
ScriptExample example = new ScriptExample();
ScriptExample.Criteria criteria = example.createCriteria();
criteria.andStatusEqualTo(BusinessConsts.STATUS_USE);
if (Objects.nonNull(queryVO.getMapId())) {
criteria.andMapIdEqualTo(queryVO.getMapId());
}
Page<Script> dbList = (Page<Script>) scriptDAO.selectByExample(example);
List<ScriptVO> scriptVOList = ScriptVO.convert2VOList(dbList.getResult());
return PageVO.convert(dbList, scriptVOList);
}
@Override
public ScriptVO getScriptDetailById(Long id) {
Objects.requireNonNull(id, "剧本id不能为空");
ScriptWithBLOBs scriptWithBLOBs = scriptDAO.selectByPrimaryKey(id);
if(Objects.isNull(scriptWithBLOBs)) {
throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST);
}
return new ScriptVO(scriptWithBLOBs);
}
@Override
public ScriptVO getDetailForClientById(Long id) {
ScriptVO scriptVO = getScriptDetailById(id);
scriptVO.filterDetailForClient();
return scriptVO;
}
@Override
public void publish(ScriptDraftWithBLOBs script, UserVO user) {
ScriptWithBLOBs scriptWithBLOBs = this.convertScriptDraft2Script(script);
ScriptExample example = new ScriptExample();
example.createCriteria().andMapIdEqualTo(script.getMapId()).andNameEqualTo(script.getName());
List<Script> scriptList = scriptDAO.selectByExample(example);
if (CollectionUtils.isEmpty(scriptList)){
scriptWithBLOBs.setCreatorId(user.getId());
scriptDAO.insert(scriptWithBLOBs);
} else {
scriptWithBLOBs.setId(scriptList.get(0).getId());
scriptDAO.updateByPrimaryKeySelective(scriptWithBLOBs);
}
}
private ScriptWithBLOBs convertScriptDraft2Script(ScriptDraftWithBLOBs scriptDraft) {
ScriptWithBLOBs script = new ScriptWithBLOBs();
script.setMapId(scriptDraft.getMapId());
script.setName(scriptDraft.getName());
script.setLang(scriptDraft.getLang());
script.setDescription(scriptDraft.getDescription());
script.setMapLocationJson(scriptDraft.getMapLocationJson());
script.setBgScenesJson(scriptDraft.getBgScenesJson());
script.setFinalScenesJson(scriptDraft.getFinalScenesJson());
script.setMembersJson(scriptDraft.getMembersJson());
script.setPlayersJson(scriptDraft.getPlayersJson());
script.setActionsJson(scriptDraft.getActionsJson());
script.setFullMarksDuration(scriptDraft.getFullMarksDuration());
script.setPassingGradeDuration(scriptDraft.getPassingGradeDuration());
script.setZeroDuration(scriptDraft.getZeroDuration());
script.setStatus(BusinessConsts.STATUS_USE);
script.setCreatorId(scriptDraft.getCreatorId());
script.setCreateTime(scriptDraft.getCreateTime());
return script;
}
@Override
@Transactional
public void copy(Long sourceMapId, Long targetMapId, UserVO user) {
ScriptExample example = new ScriptExample();
example.createCriteria()
.andMapIdEqualTo(sourceMapId)
.andStatusEqualTo(StatusEnum.Valid.getCode());
List<ScriptWithBLOBs> scriptList = this.scriptDAO.selectByExampleWithBLOBs(example);
if(!CollectionUtils.isEmpty(scriptList)) {
scriptList.forEach(script -> {
script.setId(null);
script.setMapId(targetMapId);
script.setCreatorId(user.getId());
script.setCreateTime(LocalDateTime.now());
this.scriptDAO.insert(script);
});
}
}
@Override
public ScriptBO getScriptBOById(Long scriptId, Simulation simulation) {
ScriptWithBLOBs scriptWithBLOBs = scriptDAO.selectByPrimaryKey(scriptId);
return new ScriptBO(scriptWithBLOBs, simulation);
}
}

View File

@ -270,6 +270,11 @@ public class SysUserService implements ISysUserService {
return roles.contains(BusinessConsts.ROLE_04) || roles.contains(BusinessConsts.ROLE_05); return roles.contains(BusinessConsts.ROLE_04) || roles.contains(BusinessConsts.ROLE_05);
} }
@Override
public void confirmAdmin(UserVO user) {
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertTrue(isAdmin(user));
}
@Override @Override
public boolean isExist(Long id) { public boolean isExist(Long id) {
SysUser user = sysUserDAO.selectByPrimaryKey(id); SysUser user = sysUserDAO.selectByPrimaryKey(id);

View File

@ -8,7 +8,7 @@ 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.script.IScriptService2; import club.joylink.rtss.services.script.IScriptService;
import club.joylink.rtss.services.simulation.IScriptSimulationService; import club.joylink.rtss.services.simulation.IScriptSimulationService;
import club.joylink.rtss.services.simulation.ProjectSimulationService; import club.joylink.rtss.services.simulation.ProjectSimulationService;
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher; import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
@ -26,7 +26,7 @@ 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;
import club.joylink.rtss.vo.client.competition.*; import club.joylink.rtss.vo.client.competition.*;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; 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 com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -65,7 +65,7 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
private CompetitionRecordDAO competitionRecordDAO; private CompetitionRecordDAO competitionRecordDAO;
@Autowired @Autowired
private IScriptService2 iScriptService2; private IScriptService iScriptService;
@Autowired @Autowired
private CompetitionAndScriptManager competitionAndScriptManager; private CompetitionAndScriptManager competitionAndScriptManager;
@ -128,11 +128,11 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
* 检查数据是否正确 * 检查数据是否正确
*/ */
private void checkData(CompetitionVO competitionVO) { private void checkData(CompetitionVO competitionVO) {
ScriptVO scriptDetail = iScriptService2.getDetailById(competitionVO.getScriptId()); ScriptVO scriptDetail = iScriptService.getDetailById(competitionVO.getScriptId());
Map<String, ScriptActionNewVO> actionMap = scriptDetail.getActionList() Map<String, ScriptActionVO> actionMap = scriptDetail.getActionList()
.stream().collect(Collectors.toMap(ScriptActionNewVO::getId, Function.identity())); .stream().collect(Collectors.toMap(ScriptActionVO::getId, Function.identity()));
for (CommandPublishStatisticVO rule : competitionVO.getCommandEvaluationRuleVOs()) { for (CommandPublishStatisticVO rule : competitionVO.getCommandEvaluationRuleVOs()) {
ScriptActionNewVO action = actionMap.get(rule.getActionId()); ScriptActionVO action = actionMap.get(rule.getActionId());
Float score = rule.getScore(); Float score = rule.getScore();
Integer timeOut = rule.getTimeOut(); Integer timeOut = rule.getTimeOut();
Float deductScore = rule.getDeductScore(); Float deductScore = rule.getDeductScore();

View File

@ -1,135 +0,0 @@
package club.joylink.rtss.services.completition;//package club.joylink.rtss.services.completition;
//
//import com.joylink.base.exception.BusinessException;
//import com.joylink.base.exception.constant.ExceptionMapping;
//import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
//import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
//import club.joylink.rtss.simulation.cbtc.Simulation;
//import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
//import club.joylink.rtss.constants.RaceUserStatusEnum;
//import club.joylink.rtss.manager.CompetitionManager;
//import club.joylink.rtss.services.race.IRaceService;
//import club.joylink.rtss.services.record.ISimulationProcessRecordService;
//import club.joylink.rtss.vo.LoginUserInfoVO;
//import club.joylink.rtss.vo.UserVO;
//import club.joylink.rtss.vo.client.JointTrainingRoomRequestVO;
//import club.joylink.rtss.vo.client.competition.CompetitionPaper;
//import club.joylink.rtss.vo.client.competition.PracticalQuestionVO;
//import club.joylink.rtss.vo.client.race.RaceUserVO;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.CollectionUtils;
//
//import java.util.List;
//import java.util.Objects;
//
//@Service
//public class CompetitionServiceImpl implements ICompetitionService {
//
//
// @Autowired
// private GroupSimulationService groupSimulationService;
//
// @Autowired
// private IRaceService raceService;
//
// @Autowired
// private CompetitionManager competitionManager;
//
// @Autowired
// private ISimulationProcessRecordService recordService;
//
// @Autowired
// private GroupSimulationCache groupSimulationCache;
//
// @Autowired
// private ICompetitionPracticalService iCompetitionPracticalService;
//
//
// /**参赛者创建竞赛演练房间*/
// @Override
// public String createCompetitionRoom(LoginUserInfoVO loginUserInfoVO, Long competitionId, JointTrainingRoomRequestVO requestVO) {
// //根据竞赛查找用户
// RaceUserVO raceUser = raceService.getRaceUser(competitionId, loginUserInfoVO.getUserVO());
// if (Objects.isNull(raceUser)) {
// throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST, "不是参赛成员!");
// }
// String group = groupSimulationService.simulation(requestVO.getMapId(), requestVO.getPrdType(), loginUserInfoVO);
// recordService.startRecordSimulation(loginUserInfoVO.getUserVO(), group);
// Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
// List<PracticalQuestionVO> practicals = competitionManager.getCompetitionPractical(competitionId);
// if (!CollectionUtils.isEmpty(practicals)) {
// //加载剧本到仿真中并给参赛者扮演成员
// iCompetitionPracticalService.loadPractical(simulation, practicals.get(0), raceUser);
// }
// competitionManager.updateSimulationStatus(competitionId, loginUserInfoVO.getUserVO().getId(), RaceUserStatusEnum.Practical_The_Arena, group);
// return group;
// }
//
// /**结束实操竞赛*/
// @Override
// public int finishPracticalCompetition(Long competitionId, String group, int score, UserVO user) {
// //TODO 计算实操总分并返回
//
// competitionManager.updatePracticeScore(competitionId, user.getId(), (float) score);
// //销毁竞赛仿真
// groupSimulationService.clearSimulation(group, user);
// //保存分数
// return score;
// }
//
// @Override
// public void exitCompetitionArena(Long competitionId, String group, UserVO user) {
// if (Objects.nonNull(group)) {
// //销毁竞赛仿真
// groupSimulationService.clearSimulation(group, user);
// }
// competitionManager.updateStatus(competitionId, user.getId(), RaceUserStatusEnum.Enter_The_Arena);
// }
//
// @Override
// public void loadCompetitionPaper(Long competitionId, CompetitionPaper competitionPaper) {
// if (!competitionId.equals(competitionPaper.getCompetitionId())) {
// throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "加载竞赛与试题不匹配,请选择本竞赛使用的试卷.");
// }
// competitionManager.saveCompetitionPaper(competitionId, competitionPaper);
// iCompetitionPracticalService.loadPractical(competitionId, competitionPaper);
// }
//
// @Override
// public CompetitionPaper getCompetitionPaper(Long competitionId) {
// return competitionManager.getCompetitionPaper(competitionId);
// }
//
// /**裁判进入仿真*/
// @Override
// public void refereeEntranceSimulation(String group, LoginUserInfoVO loginUserInfoVO) {
// Simulation simulation = groupSimulationService.getSimulationByGroup(group);
// SimulationUser simulationUser = new SimulationUser(simulation, loginUserInfoVO);
// simulation.addSimulationUser(simulationUser);
//// memberManager.addAndPlayTheRoleMember(, SimulationMember.Role.REFEREE, referee);
//
// }
//
// /**裁判退出仿真*/
// @Override
// public void refereeExitSimulation(String group, UserVO refree) {
// Simulation simulation = groupSimulationService.getSimulationByGroup(group);
// simulation.removeSimulationUser(refree.getId());
//// memberManager.remove(groupSimulationService.getSimulationByGroup(group), refree.getId());
//
// }
//
// /**裁判打分*/
// @Override
// public void refereeScoring(RaceUserVO userScore) {
//
// if (Objects.nonNull(userScore.getArtificialTheoryScore())) {
// competitionManager.artificialTheoryScore(userScore.getRaceId(), userScore.getUserId(), userScore.getArtificialTheoryScore());
// }
// if (Objects.nonNull(userScore.getArtificialPracticeScore())) {
// competitionManager.artificialPracticeScore(userScore.getRaceId(), userScore.getUserId(), userScore.getArtificialPracticeScore());
// }
// }
//
//}

View File

@ -1,27 +0,0 @@
package club.joylink.rtss.services.completition;//package club.joylink.rtss.services.completition;
//
//import club.joylink.rtss.vo.LoginUserInfoVO;
//import club.joylink.rtss.vo.UserVO;
//import club.joylink.rtss.vo.client.JointTrainingRoomRequestVO;
//import club.joylink.rtss.vo.client.competition.CompetitionPaper;
//import club.joylink.rtss.vo.client.race.RaceUserVO;
//
//public interface ICompetitionService {
//
//
// String createCompetitionRoom(LoginUserInfoVO loginUserInfoVO, Long id, JointTrainingRoomRequestVO requestVO);
//
// int finishPracticalCompetition(Long competitionId, String group,int score, UserVO user);
//
// void exitCompetitionArena(Long competitionId, String group, UserVO user);
//
// void loadCompetitionPaper(Long competition, CompetitionPaper competitionPaper);
//
// void refereeEntranceSimulation(String group, LoginUserInfoVO userLoginInfo);
//
// void refereeExitSimulation(String group, UserVO refree);
//
// void refereeScoring(RaceUserVO scores);
//
// CompetitionPaper getCompetitionPaper(Long competitionId);
//}

View File

@ -9,24 +9,6 @@ import java.util.List;
public interface IRaceTheoryService { public interface IRaceTheoryService {
// TheoryQuestionVO getCompetitionTheory(Long userId, Long competitionId);
//
// /**
// * 提交理论试题
// * @param user
// */
// void submitTheoryQuestion(UserVO user, CompetitionTheoryAnswerVO answer);
//
// /**获取理论题作答结果*/
// List<RaceResultVO> getTheoryAnswerResult(Long competitionId, UserVO userVO);
//
// List<RaceResultDetailVO> getTheoryAnswerDetails(Long competitionId, UserVO userVO);
//
// List<RaceResultDetailVO> getContestantTheoryAnswerDetails(Long competitionId, Long raceUserId);
// void deleteTheoryAnswerDetails(Long competitionId, UserVO userVO);
List<QuestionVO> getProjectTheory(String mode, String projectCode, Integer companyId, UserVO user); List<QuestionVO> getProjectTheory(String mode, String projectCode, Integer companyId, UserVO user);
List<RaceResultDetailVO> submitProjectTheory(UserVO user, String projectCode, Integer companyId, ProjectTheoryAnswerVO theoryAnswers); List<RaceResultDetailVO> submitProjectTheory(UserVO user, String projectCode, Integer companyId, ProjectTheoryAnswerVO theoryAnswers);

View File

@ -56,143 +56,6 @@ public class RaceTheoryService implements IRaceTheoryService {
@Autowired @Autowired
private IRaceQuestionsRuleService iRaceQuestionsRuleService; private IRaceQuestionsRuleService iRaceQuestionsRuleService;
// @Override
// public TheoryQuestionVO getCompetitionTheory(Long userId, Long competitionId) {
// List<QuestionVO> theoryQuestions = competitionManager.getCompetitionTheory(competitionId);
// if (!CollectionUtils.isEmpty((theoryQuestions))) {
// competitionManager.updateStatus(competitionId, userId, RaceUserStatusEnum.Theory_The_Arena);
// }
// List<QuestionVO> collect = theoryQuestions.stream().map(questionVO -> {
// try {
// QuestionVO clone = questionVO.clone();
// clone.getOptionList().forEach(questionOptionVO -> questionOptionVO.setCorrect(null));
// return clone;
// } catch (CloneNotSupportedException e) {
// e.printStackTrace();
// }
// return null;
// }).collect(Collectors.toList());
// if (collect.contains(null)) {
// return null;
// }
// Integer theoryDuration = competitionManager.getCompetitionTheoryDuration(competitionId);
// return new TheoryQuestionVO(theoryDuration,collect);
// }
//
// @Override
// public void submitTheoryQuestion(UserVO user, CompetitionTheoryAnswerVO answer) {
// //验证每道题答案
// List<Float> scores = new ArrayList<Float>() {{
// add(0f);
// }};
// RaceUserVO raceUser = raceService.getRaceUser(answer.getCompetitionId(), user);
// List<RaceResult> raceResults = new ArrayList<>();
// //*******************
// if (CollectionUtils.isEmpty(answer.getTheoryAnswers())) {
// competitionManager.getCompetitionTheory(answer.getCompetitionId()).forEach(question -> {
// RaceResult raceResult = new RaceResult();
// raceResult.setUserRaceId(raceUser.getId());
// raceResult.setQuestionTopic(question.getTopic());
// raceResult.setQuestionId(question.getId());
// raceResult.setQuestionOptionId(null);
// raceResult.setTotalScore(question.getScore());
// raceResult.setAnswerContent("");
// raceResult.setCorrect(false);
// raceResult.setScore(0f);
// raceResult.setRemarks("未作答");
// raceResults.add(raceResult);
// });
// } else {
// Map<Long, List<Long>> questionAnswerMap = answer.getTheoryAnswers().stream().collect(Collectors.toMap(o-> o.getQuestionId(),o-> TheoryAnswerVO.getOptionIds(o.getAnswerContents()) ,(oldVal,newVal)->newVal));
// competitionManager.getCompetitionTheory(answer.getCompetitionId()).forEach(question -> {
// question.getOptionList().stream().filter(QuestionOptionVO::getCorrect).forEach(questionOption -> {
// RaceResult raceResult = new RaceResult();
// raceResult.setUserRaceId(raceUser.getId());
// raceResult.setQuestionTopic(question.getTopic());
// raceResult.setQuestionId(question.getId());
// raceResult.setTotalScore(question.getScore());
// if (Objects.equals(questionOption.getId(), questionAnswerMap.get(question.getId()).get(0))) {
// raceResult.setQuestionOptionId(JsonUtils.writeValueAsString(Arrays.asList(questionOption.getId())));
// raceResult.setAnswerContent(questionOption.getContent());
// raceResult.setCorrect(true);
// raceResult.setScore(question.getScore());
// scores.add(question.getScore());
// } else {
// raceResult.setCorrect(false);
// raceResult.setScore(0f);
// if (Objects.isNull(questionAnswerMap.get(question.getId()))) {
// raceResult.setQuestionOptionId(null);
// raceResult.setAnswerContent("");
// raceResult.setRemarks("未作答");
// } else {
// raceResult.setQuestionOptionId(JsonUtils.writeValueAsString(Arrays.asList(questionAnswerMap.get(question.getId()).get(0))));
// raceResult.setAnswerContent(question.getOptionList().stream().filter(questionOptionVO -> Objects.equals(questionOptionVO.getId(), questionAnswerMap.get(question.getId()))).findFirst().get().getContent());
// raceResult.setRemarks(String.format("作答内容错误:[%s];正确答案为:[%s]", raceResult.getAnswerContent(), questionOption.getContent()));
// }
// }
// raceResults.add(raceResult);
// });
// });
// }
//
// //*******************
//
// deleteTheoryAnswerDetails(answer.getCompetitionId(), user);
// raceResultDAO.batchInsert(raceResults);
// competitionManager.updateTheoryScore(answer.getCompetitionId(), user.getId(), scores.stream().reduce(Float::sum).get());
//
// }
//
// @Override
// public List<RaceResultVO> getTheoryAnswerResult(Long competitionId, UserVO userVO) {
// //根据竞赛id和用户查找参赛id
// RaceUserVO raceUser = raceService.getRaceUser(competitionId, userVO);
// //根据参赛id获取参赛成绩信息
// RaceResultExample example = new RaceResultExample();
// example.createCriteria().andUserRaceIdEqualTo(raceUser.getId());
// List<RaceResult> raceResults = raceResultDAO.selectByExample(example);
// return raceResults.stream().map(RaceResultVO::new).collect(Collectors.toList());
// }
//
// @Override
// public List<RaceResultDetailVO> getTheoryAnswerDetails(Long competitionId, UserVO userVO) {
// //根据竞赛id和用户查找参赛id
// RaceUserVO raceUser = raceService.getRaceUser(competitionId, userVO);
// //根据参赛id获取参赛成绩信息
// RaceResultExample example = new RaceResultExample();
// example.createCriteria().andUserRaceIdEqualTo(raceUser.getId());
// List<RaceResult> raceResults = raceResultDAO.selectByExample(example);
// return raceResults.stream().map(RaceResultDetailVO::new).map(resultDetailVO -> {
// QuestionVO question = questionBankService.getQuestion(resultDetailVO.getQuestionId());
// resultDetailVO.setQuestion(question);
// return resultDetailVO;
// }).collect(Collectors.toList());
// }
//
// @Override
// public List<RaceResultDetailVO> getContestantTheoryAnswerDetails(Long competitionId, Long raceUserId) {
// //根据参赛id获取参赛成绩信息
// RaceResultExample example = new RaceResultExample();
// example.createCriteria().andUserRaceIdEqualTo(raceUserId);
// List<RaceResult> raceResults = raceResultDAO.selectByExample(example);
// return raceResults.stream().map(RaceResultDetailVO::new).map(resultDetailVO -> {
// QuestionVO question = questionBankService.getQuestion(resultDetailVO.getQuestionId());
// resultDetailVO.setQuestion(question);
// return resultDetailVO;
// }).collect(Collectors.toList());
// }
//
// @Override
// public void deleteTheoryAnswerDetails(Long competitionId, UserVO userVO) {
// //根据竞赛id和用户查找参赛id
// RaceUserVO raceUser = raceService.getRaceUser(competitionId, userVO);
// //根据参赛id获取参赛成绩信息
// RaceResultExample example = new RaceResultExample();
// example.createCriteria().andUserRaceIdEqualTo(raceUser.getId());
// raceResultDAO.deleteByExample(example);
// }
/** /**
* 获取项目题目或者根据模式生成试卷 * 获取项目题目或者根据模式生成试卷
* *

View File

@ -1,32 +0,0 @@
package club.joylink.rtss.services.fault;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.fault.FaultRuleQueryVO;
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
public interface IFaultRuleService {
/**
* 添加故障规则
*/
void addFaultRule(FaultRuleVO faultRuleVO);
/**
* 更新故障规则
*/
void updateFaultRule(FaultRuleVO faultRuleVO);
/**
* 删除故障规则
*/
void deleteFaultRule(Long id);
/**
* 分页查找故障规则列表
*/
PageVO<FaultRuleVO> getByPage(FaultRuleQueryVO queryVO);
/**
* 根据故障id查找故障规则
*/
FaultRuleVO getBy(Long id);
}

View File

@ -1,60 +0,0 @@
package club.joylink.rtss.services.race;//package club.joylink.rtss.services.race;
//
//import club.joylink.rtss.vo.UserVO;
//import club.joylink.rtss.vo.client.PageVO;
//import club.joylink.rtss.vo.client.race.*;
//
//import java.util.List;
//
//public interface IRaceService {
// /**
// * 创建赛事
// */
// void create(RaceCreateVO createVO, UserVO user);
//
// /**
// * 查询赛事
// */
// PageVO<RaceVO> query(RaceQueryVO queryVO);
//
// List<RaceVO> queryRaceList();
//
// /**
// * 更新竞赛信息
// */
// void update(Long id, RaceUpdateVO updateVO);
//
// /**
// * 用户报名
// */
// void signUp(Long id, RaceSignUpInfoVO signUpInfo, UserVO user);
//
// /**
// * 分页查询竞赛的参赛者
// */
// PageVO<RaceUserVO> pagingQueryRaceUser(Long raceId, RaceUserQueryVO queryVO);
//
// /**
// * 该用户是否已经报名竞赛
// */
// boolean isSignUp(Long raceId, UserVO user);
//
// boolean isSignUpForLogin(Long raceId, UserVO user);
//
// /**
// * 根据id获取竞赛信息
// */
// RaceVO getById(Long id);
//
// RaceUserVO getRaceUser(Long raceId, UserVO user);
//
// /**
// * 获取竞赛参赛者列表
// */
// List<RaceUserVO> getRaceContestant(Long raceId);
//
// /**
// * 更新参赛者信息
// */
// void updateRaceUser(RaceUserVO raceUserVO);
//}

View File

@ -1,302 +0,0 @@
package club.joylink.rtss.services.race;//package club.joylink.rtss.services.race;
//
//import com.github.pagehelper.Page;
//import com.github.pagehelper.PageHelper;
//import com.joylink.base.exception.BusinessException;
//import com.joylink.base.exception.DBException;
//import com.joylink.base.exception.SysBizException;
//import com.joylink.base.exception.constant.ExceptionMapping;
//import club.joylink.rtss.services.cache.ICacheService;
//import club.joylink.rtss.constants.BusinessConsts;
//import club.joylink.rtss.constants.RaceStatusEnum;
//import club.joylink.rtss.constants.RaceUserStatusEnum;
//import club.joylink.rtss.dao.RaceDAO;
//import club.joylink.rtss.dao.RaceUserDAO;
//import club.joylink.rtss.entity.Race;
//import club.joylink.rtss.entity.RaceExample;
//import club.joylink.rtss.entity.RaceUser;
//import club.joylink.rtss.entity.RaceUserExample;
//import club.joylink.rtss.services.IMapService;
//import club.joylink.rtss.services.ISysUserService;
//import club.joylink.rtss.manager.CompetitionManager;
//import club.joylink.rtss.vo.UserVO;
//import club.joylink.rtss.vo.VdCode;
//import club.joylink.rtss.vo.client.PageVO;
//import club.joylink.rtss.vo.client.race.*;
//import org.springframework.util.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.CollectionUtils;
//
//import java.time.LocalDateTime;
//import java.util.Comparator;
//import java.util.List;
//import java.util.concurrent.ConcurrentHashMap;
//import java.util.stream.Collectors;
//
//@Service
//public class RaceService implements IRaceService {
// @Autowired
// private RaceDAO raceDAO;
//
// @Autowired
// private RaceUserDAO raceUserDAO;
//
// @Autowired
// private ICacheService iCacheService;
//
// @Autowired
// private IMapService iMapService;
//
// @Autowired
// private ISysUserService iSysUserService;
//
// @Autowired
// private CompetitionManager competitionManager;
//
// @Override
// public void create(RaceCreateVO createVO, UserVO user) {
// createRaceCheck(createVO);
// Race race = createVO.convert2DB();
// race.setCreatorId(user.getId());
// race.setCreateTime(LocalDateTime.now());
// race.setStatus(RaceStatusEnum.Not_Started.getCode());
// raceDAO.insert(race);
// }
//
// /**
// * 创建竞赛条件检查
// */
// private void createRaceCheck(RaceCreateVO createVO) {
// RaceExample example = new RaceExample();
// example.createCriteria().andNameEqualTo(createVO.getName());
// if (raceDAO.countByExample(example)>0) {
// throw new BusinessException(ExceptionMapping.NAME_REPEAT);
// }
// if (!iMapService.isExist(createVO.getMapId())) {
// throw new DBException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的地图不存在",createVO.getMapId()));
// }
// }
//
// @Override
// public PageVO<RaceVO> query(RaceQueryVO queryVO) {
// RaceExample example = new RaceExample();
// example.setOrderByClause("id desc");
// RaceExample.Criteria criteria = example.createCriteria();
// if (StringUtils.hasText(queryVO.getRaceName())) {
// criteria.andNameLike(String.format("%%%s%%", queryVO.getRaceName()));
// }
// criteria.andStatusEqualTo(RaceStatusEnum.Not_Started.getCode());
// PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
// Page<Race> page = (Page<Race>) raceDAO.selectByExample(example);
// List<RaceVO> vos = page.getResult().stream().map(RaceVO::new).collect(Collectors.toList());
// vos.forEach(vo->{
// UserVO user = iSysUserService.getUserById(vo.getCreatorId());
// vo.setCreatorName(user.getNickname());
// });
// return PageVO.convert(page, vos);
// }
//
// @Override
// public List<RaceVO> queryRaceList() {
// RaceExample example = new RaceExample();
//
// List<Race> races = raceDAO.selectByExample(example);
// List<RaceVO> vos = races.stream().map(RaceVO::new).collect(Collectors.toList());
// return vos;
// }
//
// @Override
// public void update(Long id, RaceUpdateVO updateVO) {
// Race entity = findRaceById(id);
// if (entity == null) {
// return;
// }
// updateVO.overWrite(entity);
// raceDAO.updateByPrimaryKey(entity);
// }
//
// @Override
// public void signUp(Long id, RaceSignUpInfoVO signUpInfo, UserVO user) {
// signUpCheck(id, signUpInfo, user);
// //验证码检验
// VdCode object = (VdCode) iCacheService.get(user.getNationcode() + signUpInfo.getMobile());
// if (null == object || object.isTimeout(BusinessConsts.VDCODE_TIMEOUT)) {
// throw new SysBizException(ExceptionMapping.VDCODE_EXPIRE);
// } else if (!object.getVdcode().equals(signUpInfo.getVdCode())) {
// throw new SysBizException(ExceptionMapping.VDCODE_INCORRECT);
// }
// RaceUser raceUser = signUpInfo.buildDB();
// raceUser.setRaceId(id);
// raceUser.setUserId(user.getId());
// raceUser.setTime(LocalDateTime.now());
// raceUser.setStatus(RaceUserStatusEnum.Not_Yet_Entered.getCode());
// raceUserDAO.insert(raceUser);
// competitionManager.addContestant(id, new RaceUserVO(raceUser));
// }
//
// private void signUpCheck(Long id, RaceSignUpInfoVO signUpInfo, UserVO user) {
// RaceVO race = getById(id);
// if (RaceStatusEnum.Not_Started.getCode() != race.getStatus()) {
// throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "只有尚未开始的竞赛才可报名");
// }
// if (isSignUp(id, user)) {
// throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION, "已经报过名了,无需重复报名");
// }
// if (!race.getOptionTypes().contains(signUpInfo.getType())) {
// throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "所选角色不在竞赛可选范围内");
// }
// if (isMobileExist(id, signUpInfo.getMobile())) {
// throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "该手机号已被使用");
// }
// if (isIdNumberExist(id, signUpInfo.getIdNumber())) {
// throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "该身份证已被使用");
// }
// }
//
// /**
// * 该手机号是否已经报名过
// */
// private boolean isMobileExist(Long raceId, String mobile) {
// RaceUserExample example = new RaceUserExample();
// example.createCriteria().andRaceIdEqualTo(raceId).andMobileEqualTo(mobile);
// long count = raceUserDAO.countByExample(example);
// return count > 0;
// }
//
// /**
// * 该身份证是否已经报名过
// */
// private boolean isIdNumberExist(Long raceId, String idNumber) {
// RaceUserExample example = new RaceUserExample();
// example.createCriteria().andRaceIdEqualTo(raceId).andIdNumberEqualTo(idNumber);
// long count = raceUserDAO.countByExample(example);
// return count > 0;
// }
//
// @Override
// public PageVO<RaceUserVO> pagingQueryRaceUser(Long raceId, RaceUserQueryVO queryVO) {
// ConcurrentHashMap<Long, RaceUserVO> contestantMap = competitionManager.getCompetitionContestantMap().get(raceId);
// List<RaceUserVO> list = contestantMap.values().stream().sorted(Comparator.comparing(RaceUserVO::getId)).collect(Collectors.toList());
// if (StringUtils.hasText(queryVO.getName())) {
// list = list.stream().filter(vo -> vo.getName().contains(queryVO.getName())).collect(Collectors.toList());
// }
// if (StringUtils.hasText(queryVO.getOrganization())) {
// list = list.stream().filter(vo -> vo.getOrganization().contains(queryVO.getOrganization())).collect(Collectors.toList());
// }
//// RaceUserExample example = new RaceUserExample();
//// example.setOrderByClause("id desc");
//// RaceUserExample.Criteria criteria = example.createCriteria().andRaceIdEqualTo(raceId);
//// PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
//// Page<RaceUser> page = (Page<RaceUser>) raceUserDAO.selectByExample(example);
//// List<RaceUserVO> vos = page.getResult().stream().map(RaceUserVO::new).collect(Collectors.toList());
//// Page<RaceUser> page = (Page<RaceUser>) list;
// int toIndex = queryVO.getPageSize() * queryVO.getPageNum();
// List<RaceUserVO> pageList = list.subList(queryVO.getOffset(), list.size()>toIndex?toIndex:list.size());
// return new PageVO(queryVO.getPageNum(),queryVO.getPageSize(),list.size(), pageList);
// }
//
// @Override
// public boolean isSignUp(Long raceId, UserVO user) {
// RaceUserExample example = new RaceUserExample();
// example.createCriteria()
// .andRaceIdEqualTo(raceId)
// .andUserIdEqualTo(user.getId());
// long num = raceUserDAO.countByExample(example);
// return num>0;
// }
//
// @Override
// public boolean isSignUpForLogin(Long raceId, UserVO user) {
// RaceUserExample example = new RaceUserExample();
// example.createCriteria()
// .andRaceIdEqualTo(raceId)
// .andUserIdEqualTo(user.getId());
// long num = raceUserDAO.countByExample(example);
// if(num>0){
// competitionManager.updateStatus(raceId,user.getId(), RaceUserStatusEnum.Enter_The_Arena);
// return true;
// }
// return false;
// }
//
// @Override
// public RaceVO getById(Long id) {
// Race race = getRaceById(id);
// RaceVO vo = new RaceVO(race);
// vo.setCreatorName(iSysUserService.getUserById(race.getCreatorId()).getNickname());
// return vo;
// }
//
// private Race getRaceByName(String raceName) {
// RaceExample example = new RaceExample();
// example.createCriteria().andNameEqualTo(raceName);
// List<Race> races = raceDAO.selectByExample(example);
// if (CollectionUtils.isEmpty(races)) {
// throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
// }
// return races.get(0);
// }
//
// private Race findRaceById(Long id) {
// return raceDAO.selectByPrimaryKey(id);
// }
//
// private Race getRaceById(Long id) {
// Race race = this.findRaceById(id);
// if (race == null) {
// throw new DBException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的竞赛不存在", id));
// }
// return race;
// }
//
// /**查询竞赛的参赛者*/
// @Override
// public List<RaceUserVO> getRaceContestant(Long raceId){
// RaceUserExample example = new RaceUserExample();
// example.setOrderByClause("id");
// example.createCriteria().andRaceIdEqualTo(raceId);
// List<RaceUser> raceUsers = raceUserDAO.selectByExample(example);
// return raceUsers.stream().map(RaceUserVO::new).collect(Collectors.toList());
// }
//
// @Override
// public void updateRaceUser(RaceUserVO raceUserVO) {
// if (raceUserVO.getId() == null) {
// throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "id不能为空");
// }
// RaceUser raceUser = raceUserVO.buildDB();
// raceUserDAO.updateByPrimaryKey(raceUser);
// }
//
// /**查询竞赛参赛者信息*/
// @Override
// public RaceUserVO getRaceUser(Long raceId, UserVO user){
// if (CollectionUtils.isEmpty(competitionManager.getCompetitionContestantMap())) {
// return null;
// }
// ConcurrentHashMap<Long, RaceUserVO> contestantMap = competitionManager.getCompetitionContestantMap().get(raceId);
// if (CollectionUtils.isEmpty(contestantMap)) {
// return null;
// }
// List<RaceUserVO> collect = contestantMap.values()
// .stream()
// .filter(vo -> vo.getUserId().equals(user.getId()))
// .limit(1)
// .collect(Collectors.toList());
// if (CollectionUtils.isEmpty(collect)) {
// return null;
// }
// return collect.get(0);
//
//// RaceUserExample example = new RaceUserExample();
//// example.createCriteria()
//// .andRaceIdEqualTo(raceId)
//// .andUserIdEqualTo(user);
//// List<RaceUser> raceUsers = raceUserDAO.selectByExample(example);
//// if(CollectionUtils.isEmpty(raceUsers)){
//// return null;
//// }
//// return new RaceUserVO(raceUsers.get(0));
// }
//}

View File

@ -4,7 +4,7 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.script.ScriptVO; import club.joylink.rtss.vo.client.script.ScriptVO;
import club.joylink.rtss.vo.client.script.ScriptQueryVO; import club.joylink.rtss.vo.client.script.ScriptQueryVO;
public interface IScriptService2 { public interface IScriptService {
/** /**
* 分页查询上线的剧本 * 分页查询上线的剧本

View File

@ -1,9 +1,8 @@
package club.joylink.rtss.services.script; package club.joylink.rtss.services.script;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.joylink.base.exception.DBException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.ScriptDAO; import club.joylink.rtss.dao.ScriptDAO;
import club.joylink.rtss.entity.Script; import club.joylink.rtss.entity.Script;
@ -19,7 +18,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
@Service @Service
public class ScriptService2 implements IScriptService2 { public class ScriptService implements IScriptService {
@Autowired @Autowired
private ScriptDAO scriptDAO; private ScriptDAO scriptDAO;
@ -52,10 +51,17 @@ public class ScriptService2 implements IScriptService2 {
*/ */
@Override @Override
public ScriptVO getDetailById(Long id) { public ScriptVO getDetailById(Long id) {
ScriptWithBLOBs script = scriptDAO.selectByPrimaryKey(id); return new ScriptVO(getEntity(id));
if (Objects.isNull(script)) {
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
} }
return new ScriptVO(script);
private ScriptWithBLOBs findEntity(Long id) {
return scriptDAO.selectByPrimaryKey(id);
}
private ScriptWithBLOBs getEntity(Long id) {
ScriptWithBLOBs entity = findEntity(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(entity,
String.format("id为[%s]的剧本不存在", id));
return entity;
} }
} }

View File

@ -6,8 +6,8 @@ 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.script.MapLocationVO; import club.joylink.rtss.vo.client.script.MapLocationVO;
import club.joylink.rtss.vo.client.script.ScriptActionNewUpdateVO; import club.joylink.rtss.vo.client.script.ScriptActionUpdateVO;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; 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.simulationv1.SimulationMemberVO; import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
@ -33,7 +33,7 @@ public interface IScriptSimulationService {
/** /**
* 获取剧本的所有动作 * 获取剧本的所有动作
*/ */
List<ScriptActionNewVO> getAllAction(String group); List<ScriptActionVO> getAllAction(String group);
/** /**
* 重置剧本 * 重置剧本
@ -73,7 +73,7 @@ public interface IScriptSimulationService {
/** /**
* 修改剧本动作 * 修改剧本动作
*/ */
void updateAction(String group, ScriptActionNewUpdateVO updateVO); void updateAction(String group, ScriptActionUpdateVO updateVO);
/** /**
* 添加动作 * 添加动作

View File

@ -19,16 +19,15 @@ import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.entity.ScriptDraftWithBLOBs; import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
import club.joylink.rtss.listener.simulation.script.ScriptWritingListener; import club.joylink.rtss.listener.simulation.script.ScriptWritingListener;
import club.joylink.rtss.services.IScriptDraftService; import club.joylink.rtss.services.IScriptDraftService;
import club.joylink.rtss.services.IScriptService; import club.joylink.rtss.services.script.IScriptService;
import club.joylink.rtss.services.script.IScriptService2;
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.SocketMessageVO; import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.script.MapLocationVO; import club.joylink.rtss.vo.client.script.MapLocationVO;
import club.joylink.rtss.vo.client.script.ScriptActionNewUpdateVO; import club.joylink.rtss.vo.client.script.ScriptActionUpdateVO;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; 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.simulationv1.SimulationMemberVO; import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
import club.joylink.rtss.websocket.StompMessageService; import club.joylink.rtss.websocket.StompMessageService;
@ -74,10 +73,10 @@ public class ScriptSimulationService implements IScriptSimulationService {
private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher; private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher;
@Autowired @Autowired
private IScriptService2 iScriptService2; private IScriptService iScriptService;
@Autowired @Autowired
private IScriptService iScriptService; private club.joylink.rtss.services.IScriptService iScriptService;
@Autowired @Autowired
private ScriptWritingListener scriptWritingListener; private ScriptWritingListener scriptWritingListener;
@ -123,9 +122,9 @@ public class ScriptSimulationService implements IScriptSimulationService {
} }
@Override @Override
public List<ScriptActionNewVO> getAllAction(String group) { public List<ScriptActionVO> getAllAction(String group) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
return ScriptActionNewVO.convertFromBOList(simulation.getScript().getActionList()); return ScriptActionVO.convertFromBOList(simulation.getScript().getActionList());
} }
@Override @Override
@ -221,7 +220,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
} }
@Override @Override
public void updateAction(String group, ScriptActionNewUpdateVO updateVO) { public void updateAction(String group, ScriptActionUpdateVO updateVO) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
ScriptBO script = simulation.getScript(); ScriptBO script = simulation.getScript();
ScriptActionBO action = script.getActionById(updateVO.getId()); ScriptActionBO action = script.getActionById(updateVO.getId());
@ -240,7 +239,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
throw new SimulationException(SimulationExceptionType.System_Fault, "仿真中没有剧本"); throw new SimulationException(SimulationExceptionType.System_Fault, "仿真中没有剧本");
} }
script.addAction(action); script.addAction(action);
SocketMessageVO<ScriptActionNewVO> message = SocketMessageFactory.buildScriptActionMessage(simulation.getGroup(), new ScriptActionNewVO(action)); SocketMessageVO<ScriptActionVO> message = SocketMessageFactory.buildScriptActionMessage(simulation.getGroup(), new ScriptActionVO(action));
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message); stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
} }
@ -374,7 +373,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
@Override @Override
public void loadScript(String group, Long scriptId) { public void loadScript(String group, Long scriptId) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
ScriptVO detailById = iScriptService2.getDetailById(scriptId); ScriptVO detailById = iScriptService.getDetailById(scriptId);
groupSimulationService.loadScenes(simulation.getGroup(), detailById.getBgScenesJson()); groupSimulationService.loadScenes(simulation.getGroup(), detailById.getBgScenesJson());
ScriptBO scriptBO = iScriptService.getScriptBOById(scriptId, simulation); ScriptBO scriptBO = iScriptService.getScriptBOById(scriptId, simulation);
this.scriptCoverSimulation(simulation, scriptBO); this.scriptCoverSimulation(simulation, scriptBO);

View File

@ -6,7 +6,7 @@ import club.joylink.rtss.constants.MapPrdTypeEnum;
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.*;
import club.joylink.rtss.services.script.IScriptService2; import club.joylink.rtss.services.script.IScriptService;
import club.joylink.rtss.services.simulation.IScriptSimulationService; import club.joylink.rtss.services.simulation.IScriptSimulationService;
import club.joylink.rtss.services.simulation.SchedulingService; import club.joylink.rtss.services.simulation.SchedulingService;
import club.joylink.rtss.services.training.ITrainingV1Service; import club.joylink.rtss.services.training.ITrainingV1Service;
@ -118,10 +118,10 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
private StompMessageService stompMessageService; private StompMessageService stompMessageService;
@Autowired @Autowired
private IScriptService scriptService; private club.joylink.rtss.services.IScriptService scriptService;
@Autowired @Autowired
private IScriptService2 iScriptService2; private IScriptService iScriptService;
@Autowired @Autowired
private OtherConfig otherConfig; private OtherConfig otherConfig;
@ -602,7 +602,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
@Override @Override
public void loadScript(Simulation simulation, Long scriptId) { public void loadScript(Simulation simulation, Long scriptId) {
ScriptVO detailById = iScriptService2.getDetailById(scriptId); ScriptVO detailById = iScriptService.getDetailById(scriptId);
this.loadScenes(simulation.getGroup(), detailById.getBgScenesJson()); this.loadScenes(simulation.getGroup(), detailById.getBgScenesJson());
ScriptBO scriptBO = scriptService.getScriptBOById(scriptId, simulation); ScriptBO scriptBO = scriptService.getScriptBOById(scriptId, simulation);
iScriptSimulationService.scriptCoverSimulation(simulation, scriptBO); iScriptSimulationService.scriptCoverSimulation(simulation, scriptBO);

View File

@ -38,7 +38,7 @@ import club.joylink.rtss.services.simulation.ScriptExecuteService;
import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; import club.joylink.rtss.vo.client.script.ScriptActionVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO; import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO; import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO;
import club.joylink.rtss.websocket.StompMessageService; import club.joylink.rtss.websocket.StompMessageService;
@ -734,13 +734,13 @@ public class SimulationMainThread {
public void simulationScriptTip(SimulationScriptTipEvent event) { public void simulationScriptTip(SimulationScriptTipEvent event) {
Simulation simulation = event.getSimulation(); Simulation simulation = event.getSimulation();
ScriptActionBO action = event.getAction(); ScriptActionBO action = event.getAction();
ScriptActionNewVO actionVO = ScriptActionNewVO.buildScriptTipVO(action); ScriptActionVO actionVO = ScriptActionVO.buildScriptTipVO(action);
if (actionVO.getType().equals(ScriptActionBO.ActionType.Conversation)) { if (actionVO.getType().equals(ScriptActionBO.ActionType.Conversation)) {
LocalDateTime correctSystemTime = simulation.getCorrectSystemTime(); LocalDateTime correctSystemTime = simulation.getCorrectSystemTime();
String currentTime = correctSystemTime.getHour() + "" + correctSystemTime.getMinute() + ""; String currentTime = correctSystemTime.getHour() + "" + correctSystemTime.getMinute() + "";
actionVO.setContent(String.format(actionVO.getContent(), currentTime)); actionVO.setContent(String.format(actionVO.getContent(), currentTime));
} }
SocketMessageVO<ScriptActionNewVO> message = SocketMessageVO<ScriptActionVO> message =
SocketMessageFactory.buildScriptTipMessage(simulation.getGroup(), actionVO); SocketMessageFactory.buildScriptTipMessage(simulation.getGroup(), actionVO);
stompMessageService.sendToUser(action.getMember().getUserIdStr(), message); stompMessageService.sendToUser(action.getMember().getUserIdStr(), message);
log.info(String.format("仿真[%s]剧本提示成员[%s]执行动作[%s]", simulation.getGroup(), action.getMember().getId(), action.getId())); log.info(String.format("仿真[%s]剧本提示成员[%s]执行动作[%s]", simulation.getGroup(), action.getMember().getId(), action.getId()));
@ -758,8 +758,8 @@ public class SimulationMainThread {
public void simulationScriptActionFinish(SimulationScriptActionFinishEvent event) { public void simulationScriptActionFinish(SimulationScriptActionFinishEvent event) {
Simulation simulation = event.getSimulation(); Simulation simulation = event.getSimulation();
ScriptActionBO action = event.getScriptActionBO(); ScriptActionBO action = event.getScriptActionBO();
ScriptActionNewVO vo = ScriptActionNewVO.buildFinishTipVO(action); ScriptActionVO vo = ScriptActionVO.buildFinishTipVO(action);
SocketMessageVO<ScriptActionNewVO> message = SocketMessageVO<ScriptActionVO> message =
SocketMessageFactory.buildSimulationScriptActionFinishMessage(simulation.getGroup(), vo); SocketMessageFactory.buildSimulationScriptActionFinishMessage(simulation.getGroup(), vo);
stompMessageService.sendToUser(action.getMember().getUserIdStr(), message); stompMessageService.sendToUser(action.getMember().getUserIdStr(), message);
log.info(String.format("用户[%s]完成仿真[%s]id为[%s]的剧本动作", simulation.getGroup(), action.getMember().getUserId(), action.getId())); log.info(String.format("用户[%s]完成仿真[%s]id为[%s]的剧本动作", simulation.getGroup(), action.getMember().getUserId(), action.getId()));

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.simulation.cbtc.event;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.script.ScriptActionBO; import club.joylink.rtss.simulation.cbtc.script.ScriptActionBO;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO;
import lombok.Getter; import lombok.Getter;
/** /**

View File

@ -12,7 +12,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.SwitchStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.TrainStatusVO;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; import club.joylink.rtss.vo.client.script.ScriptActionVO;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -118,7 +118,7 @@ public class ScriptActionBO {
*/ */
private String conversationMessageId; private String conversationMessageId;
public ScriptActionBO(Simulation simulation, ScriptActionNewVO actionVO) { public ScriptActionBO(Simulation simulation, ScriptActionVO actionVO) {
SimulationMember member = simulation.findMemberById(actionVO.getMemberId()); SimulationMember member = simulation.findMemberById(actionVO.getMemberId());
this.id = simulation.getIdGenerator().nextActionId(); this.id = simulation.getIdGenerator().nextActionId();
this.type = actionVO.getType(); this.type = actionVO.getType();

View File

@ -1,25 +0,0 @@
package club.joylink.rtss.vo.client;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class ExamLessonVO {
/**
* 课程ID
*/
private String lessonId;
/**
* 课程名称
*/
private String lessonName;
/**
* 试题信息
*/
private List<ExamDefinitionVO> examDefinitionVOList;
}

View File

@ -1,21 +0,0 @@
package club.joylink.rtss.vo.client;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@ApiModel(value = "故障模式设置")
public class FailureModeSettingVO {
@ApiModelProperty(value = "自动/人工")
private boolean auto;
@ApiModelProperty(value = "自动时选择的规则id")
private String ruleId;
}

View File

@ -1,19 +0,0 @@
package club.joylink.rtss.vo.client;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@ApiModel(value = "地图产品查询对象")
@Getter
@Setter
public class MapPrdQueryVO extends PageQueryVO {
@ApiModelProperty(value = "产品名称")
private String name;
@ApiModelProperty(value = "产品编号")
private String code;
}

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.vo.client.competition; package club.joylink.rtss.vo.client.competition;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; import club.joylink.rtss.vo.client.script.ScriptActionVO;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -22,7 +22,7 @@ public class CommandPublishStatisticVO {
@NotNull @NotNull
private String actionId; private String actionId;
private ScriptActionNewVO actionVO; private ScriptActionVO actionVO;
/** /**
* 语音识别关键词列表 * 语音识别关键词列表
@ -68,7 +68,7 @@ public class CommandPublishStatisticVO {
public CommandPublishStatisticVO(CommandPublishStatisticBO bo) { public CommandPublishStatisticVO(CommandPublishStatisticBO bo) {
this.id = bo.getId(); this.id = bo.getId();
this.actionId = bo.getAction().getId(); this.actionId = bo.getAction().getId();
this.actionVO = new ScriptActionNewVO(bo.getAction()); this.actionVO = new ScriptActionVO(bo.getAction());
this.keyWords = bo.getKeyWords(); this.keyWords = bo.getKeyWords();
this.timeOut = bo.getTimeOut(); this.timeOut = bo.getTimeOut();
this.score = bo.getScore(); this.score = bo.getScore();

View File

@ -1,48 +0,0 @@
package club.joylink.rtss.vo.client.competition;
import club.joylink.rtss.vo.client.question.QuestionVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.util.ArrayList;
import java.util.List;
@ApiModel(value = "竞赛试卷")
@Getter
@Setter
public class CompetitionPaper {
@ApiModelProperty(value="竞赛id")
@NotNull(message = "竞赛id不能为空")
private Long competitionId;
@ApiModelProperty(value="理论题")
@NotNull(message = "竞赛理论题不能为空")
@Valid
private List<QuestionVO> theoryQuestions;
@ApiModelProperty(value="实操题")
@NotNull(message = "竞赛实操题不能为空")
private List<PracticalQuestionVO> practicalQuestions= new ArrayList<>();
@ApiModelProperty(value="竞赛理论作答时间/min")
@NotNull(message = "理论答题时长需要设置")
@Positive(message = "理论答题时长需要设置为正数")
private Integer theoryExamTime;
@ApiModelProperty(value="竞赛实操作答时间/min")
@NotNull(message = "实操答题时长需要设置")
@Positive(message = "实操答题时长需要设置为正数")
private Integer practicalExamTime;
@ApiModelProperty(value="竞赛理论总分值")
private Float theoryScore;
@ApiModelProperty(value="竞赛实操总分值")
private Float practicalScore;
}

View File

@ -1,17 +0,0 @@
package club.joylink.rtss.vo.client.competition;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.Setter;
@ApiModel(value = "竞赛实操题查询对象")
@Getter
@Setter
public class CompetitionPracticalQueryVO extends PageQueryVO {
private Long mapId;
private String name;
}

View File

@ -1,18 +0,0 @@
package club.joylink.rtss.vo.client.competition;
import java.time.LocalDate;
/**
* 竞赛记录
*/
public class CompetitionRecordVO {
private Long id;
private Long userId;
private Long competitionId;
private Float score;
private LocalDate date;
}

View File

@ -1,27 +0,0 @@
package club.joylink.rtss.vo.client.competition;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel(value = "竞赛理论题答题VO")
@Getter
@Setter
public class CompetitionTheoryAnswerVO {
@ApiModelProperty(value = "竞赛id")
@NotNull(message = "竞赛id不能为空")
private Long competitionId;
@ApiModelProperty(value = "理论题作答模式")
private String mode;
@ApiModelProperty(value = "理论答题")
@Valid
private List<TheoryAnswerVO> theoryAnswers;
}

View File

@ -1,20 +0,0 @@
package club.joylink.rtss.vo.client.competition;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.Setter;
@ApiModel(value = "竞赛理论题查询对象")
@Getter
@Setter
public class CompetitionTheoryQueryVO extends PageQueryVO {
private Long mapId;
private Long competitionId;
private String name;
}

View File

@ -1,46 +0,0 @@
package club.joylink.rtss.vo.client.competition;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotNull;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class PracticalQuestionVO {
/**
* 题号
*/
@ApiModelProperty("题号")
@NotNull(message = "题号不能为空")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 题目
*/
@ApiModelProperty("题目")
@NotNull(message = "题目不能为空")
private ScriptDraftWithBLOBs question;
/**
* 分值
*/
@ApiModelProperty("分值")
@NotNull(message = "分值不能为空")
private Float score;
private Long creatorId;
private Long creatorName;
}

View File

@ -1,22 +0,0 @@
package club.joylink.rtss.vo.client.competition;
import club.joylink.rtss.vo.client.question.QuestionVO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class TheoryQuestionVO {
/**理论试题作答时长*/
private Integer theoryExamTime;
/**理论题目*/
private List<QuestionVO> questions;
}

View File

@ -16,7 +16,7 @@ import club.joylink.rtss.record.SimulationRecordEvent;
import club.joylink.rtss.record.SocketMessagePO; import club.joylink.rtss.record.SocketMessagePO;
import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.script.ScriptActionNewVO; import club.joylink.rtss.vo.client.script.ScriptActionVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO; import club.joylink.rtss.vo.client.simulationv1.SimulationMemberMessageVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO; import club.joylink.rtss.vo.client.simulationv1.SimulationUserMessageVO;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
@ -283,7 +283,7 @@ public class SocketMessageFactory {
/** /**
* 构建剧本动作消息 * 构建剧本动作消息
*/ */
public static SocketMessageVO<ScriptActionNewVO> buildScriptActionMessage(String group, ScriptActionNewVO actionNewVO) { public static SocketMessageVO<ScriptActionVO> buildScriptActionMessage(String group, ScriptActionVO actionNewVO) {
return build(WebSocketMessageType.Simulation_Script_Action, group, actionNewVO); return build(WebSocketMessageType.Simulation_Script_Action, group, actionNewVO);
} }
@ -299,14 +299,14 @@ public class SocketMessageFactory {
/** /**
* 构建仿真剧本提示消息 * 构建仿真剧本提示消息
*/ */
public static SocketMessageVO<ScriptActionNewVO> buildScriptTipMessage(String group, ScriptActionNewVO action) { public static SocketMessageVO<ScriptActionVO> buildScriptTipMessage(String group, ScriptActionVO action) {
return build(WebSocketMessageType.Simulation_Script_Action_Tip, group, action); return build(WebSocketMessageType.Simulation_Script_Action_Tip, group, action);
} }
/** /**
* 构建仿真剧本动作完成消息 * 构建仿真剧本动作完成消息
*/ */
public static SocketMessageVO<ScriptActionNewVO> buildSimulationScriptActionFinishMessage(String group, ScriptActionNewVO action) { public static SocketMessageVO<ScriptActionVO> buildSimulationScriptActionFinishMessage(String group, ScriptActionVO action) {
return build(WebSocketMessageType.Simulation_Script_Action_Finish, group, action); return build(WebSocketMessageType.Simulation_Script_Action_Finish, group, action);
} }

View File

@ -1,21 +0,0 @@
package club.joylink.rtss.vo.client.fault;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@ApiModel(value = "故障模式设置")
public class FaultModeSettingVO {
@ApiModelProperty(value = "自动/人工")
private boolean auto;
@ApiModelProperty(value = "自动时选择的规则id")
private Long ruleId;
}

View File

@ -1,32 +0,0 @@
package club.joylink.rtss.vo.client.fault;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
@ApiModel(value = "故障规则查询对象")
@Getter
@Setter
public class FaultRuleQueryVO extends PageQueryVO {
@ApiModelProperty(value = "线路编号")
@NotBlank(message = "线路code不能为空")
private String lineCode;
@ApiModelProperty(value = "设备类型")
private String deviceType;
@ApiModelProperty(value = "设备编码")
private String deviceCode;
@ApiModelProperty(value = "故障类型")
private String faultType;
@ApiModelProperty(value = "触发条件")
private String triggerCondition;
}

View File

@ -1,47 +0,0 @@
package club.joylink.rtss.vo.client.order;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.entity.SaleGoods;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Getter
@Setter
@NoArgsConstructor
@ApiModel(value = "goodItem")
public class GoodItem implements Serializable {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 名称
*/
@NotBlank(message = "商品名称不能为空")
@ApiModelProperty(value = "商品名称",required = true)
private String name;
@NotNull(message = "权限主键")
@ApiModelProperty(value = "权限主键",required = true,example = "92")
private Long permissionId;
@ApiModelProperty(value = "权限名称",required = true,example = "成都仿真权限打包")
private String permissionName;
/**
* 描述
*/
@ApiModelProperty(value = "商品描述",required = false,example = "成都三号线打包万能权限")
private String remarks;
public GoodItem(SaleGoods saleGoods){
this.id=saleGoods.getId();
this.name=saleGoods.getName();
this.permissionId=saleGoods.getPermissionId();
this.remarks=saleGoods.getRemarks();
}
}

View File

@ -1,38 +0,0 @@
package club.joylink.rtss.vo.client.order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ApiModel(value = "orderItemDetailVO")
@NoArgsConstructor
@Getter
@Setter
/***
* 订单的条目
* 每一条数据对象
* **/
public class OrderItemDetailVO {
/**
* 订单每一个商品项目
*里面有权限id基础权限
* 如果是包权限万能权限包权限id需要额外创建
* **/
@ApiModelProperty(value = "商品",required = true)
private GoodItem goodItem;
private Integer itemNumber;
/**
* 权限类型
* 课程权限仿真权限仿真权限大屏权限
* **/
@ApiModelProperty(value = "权限类型",required = true,example = "2")
private Integer permissionType;
}

View File

@ -1,145 +0,0 @@
package club.joylink.rtss.vo.client.order;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value = "订单对象")
@NoArgsConstructor
@Getter
@Setter
/**
* 订单创建对象
* 从订单创建分发
* 从分发
* */
public class OrderJsonVO {
private Long id;
/**
* 编号
*/
private String code;
/**
* 组织/企业id
*/
@ApiModelProperty(value="企业组织id",example = "124",required=true)
private Long organizationId;
/**
* 订单类型个人/企业合同/合约赠送/内部分配等
*/
@ApiModelProperty(value = "订单类型(个人/企业合同/合约赠送/内部分配等)",example = "1",required = true)
private String orderType;
@ApiModelProperty(value = "购买权限数量",example = "5",required = true)
private Integer packageNum;
@ApiModelProperty(value = "能否分发")
private Boolean canDistribute;
/**
* 业务类型续费延时/增加权限等
*/
@ApiModelProperty(value = "业务类型",example = "1",required = true)
private String bizType;
@ApiModelProperty(value = "选择的基础权限主键列表",example = "[1,2,3]",required = true)
private List<Long> relPermissions;
/**
* 订单里多个项目详情
*基础权限包
* **/
@ApiModelProperty(value="订单条目列表")
private List<OrderItemDetailVO> orderDetailList;
@ApiModelProperty(value = "订单总价格;单位(分)",example = "20")
private Long totalPrice;
@ApiModelProperty(value = "打包商品价格",example = "20")
private Long price;
/**
* 支付方式:
*/
@ApiModelProperty(value="支付方式:线下/微信/支付宝",example = "weixin",required = true)
private String payWays;
/**
* 支付状态
*/
@ApiModelProperty(value = "支付状态",required = true)
private String payStatus;
/**
* 订单状态
*/
private String status;
@ApiModelProperty(value = "销售人员",example = "12345")
private Long sellerId;
/**
* 合同编号
*/
@ApiModelProperty(value = "合同编号",example = "12345")
private String contractNo;
/**
* 是否永久
* **/
@ApiModelProperty(value = "是否永久",example = "0",required = true)
private Boolean forever;
@ApiModelProperty(value = "万能权限1/基础权限0",required = true)
private Boolean isPackage;
@ApiModelProperty(value = "权限转增类型;公用1/专用权限0",example = "0",required = true)
private Boolean distributeType;
/**
* 权限包名称
* 当权限类型为万能权限时必填参数
*/
@ApiModelProperty(value = "权限包名称,当权限类型为万能权限时必填参数",example = "权限包")
private String packageName;
/**
* 权限包名称描述
* 万能权限必填参数
* **/
@ApiModelProperty(value = "权限包描述",example = "打包多个权限为万能权限")
private String remarks;
@ApiModelProperty(value = "是否可以试用",required = true)
private Boolean tryUse;
@ApiModelProperty(value = "试用时间",example = "10",required = true)
private Integer tryUseTime;
@ApiModelProperty(value = "试用时间单位:年/月/日/时/分/秒",example = "5",required = true)
private String tryUseTimeUnit;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate startTime;
@ApiModelProperty(value = "购买月数",example = "5",required = true)
private Integer monthAmount;
}

View File

@ -1,113 +0,0 @@
package club.joylink.rtss.vo.client.permission;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.Date;
@ApiModel(value = "订单列表对象")
@NoArgsConstructor
@Getter
@Setter
public class OrderListVO {
private String id;
/**
* 编号
*/
private String code;
/**
* 组织/企业id
*/
private String organizationId;
/**
* 组织/企业id
*/
private String organizationName;
/**
* 用户id
*/
private String userName;
private String userMobile;
/**
* 商品id
*/
private String goodsName;
/**
* 购买数量
*/
private Integer amount;
/**
* 购买月数
*/
private Integer monthAmount;
/**
* 总价单位分
*/
private Float totalPrice;
/**
* 是否永久:true/false
*/
private Boolean forever;
/**
* 开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/**
* 支付方式:线下/微信/支付宝
*/
private String payWays;
/**
* 支付状态
*/
private String payStatus;
/**
* 订单状态
*/
private String status;
/**
* 合同编号
*/
private String contractNo;
/**
* 订单类型个人/企业合同/合约赠送/内部分配等
*/
private String orderType;
/**
* 业务类型续费延时/增加权限等
*/
private String bizType;
private Date createTime;
/**
* 二维码是否已经生成过
*/
private Boolean qrCodeGenerated;
/**
* 销售员id
*/
private String sellerName;
}

View File

@ -1,33 +0,0 @@
package club.joylink.rtss.vo.client.permission;
import club.joylink.rtss.vo.client.goods.GoodsVO;
import club.joylink.rtss.vo.client.order.OrderCreateVO;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
/**
* 一键生成订单的实体类
*/
@Getter
@Setter
public class PermissionGoodsOrderVo implements Serializable {
/**
* 创建权限的参数
*/
private PermissionCreateVO createVO;
/**
* 创建商品的参数
*/
private GoodsVO goodsVO;
/**
* 创建订单生成的参数
*/
private List<OrderCreateVO> orderList;
/**
* 公用或者私用
*/
private boolean canDistribute;
}

View File

@ -1,69 +0,0 @@
package club.joylink.rtss.vo.client.permission;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
@ApiModel(value="权限分发对象")
@NoArgsConstructor
@Getter
@Setter
public class PermissionTransVO {
/**
* 权限类型
*/
@ApiModelProperty(value="权限类型")
@NotBlank(message="权限类型不能为空")
private String permissionType;
/**
* 地图id
*/
@ApiModelProperty(value="地图id")
private Long mapId;
/**
* 地图产品编码
*/
@ApiModelProperty(value="地图产品编码")
private String mapProductCode;
/**
* 课程id
*/
@ApiModelProperty(value="课程id")
private Long lessonId;
/**
* 权限分发总数
*/
@ApiModelProperty(value="权限分发总数")
@NotNull(message="数量不能为空")
private Integer amount;
/**
* 开始时间
*/
@ApiModelProperty(value="开始时间")
@NotNull(message="开始时间不能为空")
private Date startTime;
/**
* 结束时间
*/
@ApiModelProperty(value="结束时间")
private Date endTime;
/**
* 权限是否可以转赠
*/
@ApiModelProperty(value="权限是否可以转赠")
private Boolean canDistribute;
}

View File

@ -1,24 +0,0 @@
package club.joylink.rtss.vo.client.permissionDistribute;
import club.joylink.rtss.vo.client.order.OrderCreateVO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@Getter
@Setter
@NoArgsConstructor
@ApiModel(value = "权限分发快速创建")
public class DistributeCreateQuicklyVO {
@Valid
private OrderCreateVO orderCreateVO;
@NotNull(message = "是否可以分发不能为空")
private Boolean canDistribute;
}

View File

@ -1,4 +0,0 @@
package club.joylink.rtss.vo.client.permissionDistribute;
public class DistributeCreateVO {
}

View File

@ -1,27 +0,0 @@
package club.joylink.rtss.vo.client.plan;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingDataVO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
@ApiModel(value = "用户交路数据对象")
@Getter
@Setter
@NoArgsConstructor
public class UserRoutingVO extends MapRoutingDataVO {
private Long id;
private Long mapId;
private Long userId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@ -1,30 +0,0 @@
package club.joylink.rtss.vo.client.plan;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value = "用户车站区段停站时间数据对象")
@Getter
@Setter
@NoArgsConstructor
public class UserStationParkingTimeVO {
private Long id;
private Long mapId;
private List<MapStationParkingTimeVO> stationParkingTimeVOList;
private Long userId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@ -1,30 +0,0 @@
package club.joylink.rtss.vo.client.plan;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value = "用户站间距离和运行等级(站间运行时间)对象")
@Getter
@Setter
@NoArgsConstructor
public class UserStationRunLevelVO {
private Long id;
private Long mapId;
private List<MapStationRunLevelVO> stationRunLevelVOList;
private Long userId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}

View File

@ -1,9 +1,6 @@
package club.joylink.rtss.vo.client.plc; package club.joylink.rtss.vo.client.plc;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.simulation.data.virtual.VirtualScreenDoor;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;

View File

@ -1,19 +0,0 @@
package club.joylink.rtss.vo.client.plc;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@ApiModel(value = "plc网关配置查询对象")
public class PLCGatewayConfigQueryVO extends PageQueryVO {
@ApiModelProperty(value = "网关名称")
private String gatewayName;
}

View File

@ -1,39 +0,0 @@
package club.joylink.rtss.vo.client.race;
import club.joylink.rtss.vo.client.competition.PracticalQuestionVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 竞赛实操题结果
*/
@ApiModel("竞赛实操题结果")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class RacePracticalResultVO {
@ApiModelProperty("试题名称")
private String name;
@ApiModelProperty("试题描述")
private String description;
@ApiModelProperty("总分")
private Float totalScore;
@ApiModelProperty("得分")
private Float score;
public RacePracticalResultVO(PracticalQuestionVO queryVO, RaceUserVO raceUserVO) {
this.name = queryVO.getQuestion().getName();
this.description = queryVO.getQuestion().getDescription();
this.totalScore = queryVO.getScore();
this.score = raceUserVO.getPracticeScore();
}
}

View File

@ -1,20 +0,0 @@
package club.joylink.rtss.vo.client.race;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ApiModel("竞赛查询")
@Getter
@Setter
@NoArgsConstructor
public class RaceQueryVO extends PageQueryVO {
@ApiModelProperty("竞赛名称")
private String raceName;
// @ApiModelProperty("是否仅查询未开始的竞赛")
// private Boolean notStarted;
}

View File

@ -65,7 +65,7 @@ public class RaceResultDetailVO {
public RaceResultDetailVO(RaceResult raceResult) { public RaceResultDetailVO(RaceResult raceResult) {
this.userRaceId = raceResult.getUserRaceId(); this.userRaceId = raceResult.getUserRaceId();
this.questionId = raceResult.getQuestionId(); this.questionId = raceResult.getQuestionId();
if(StringUtils.isBlank(raceResult.getQuestionOptionId())){ if(raceResult.getQuestionOptionId().isBlank()){
this.answerOptionId = null; this.answerOptionId = null;
}else{ }else{
this.answerOptionId = JsonUtils.read(raceResult.getQuestionOptionId(),JsonUtils.getCollectionType(List.class, Long.class)); this.answerOptionId = JsonUtils.read(raceResult.getQuestionOptionId(),JsonUtils.getCollectionType(List.class, Long.class));

View File

@ -1,80 +0,0 @@
package club.joylink.rtss.vo.client.race;
import club.joylink.rtss.entity.RaceResult;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class RaceResultVO {
/**
* 用户竞赛id
*/
private Long userRaceId;
/**
* 竞赛题目
*/
private String topic;
/**
* 作答内容
*/
private String answerContent;
/**
* 是否正确
*/
private Boolean correct;
/**
* 得分
*/
private Float score;
/**
* 题目分值
*/
private Float totalScore;
/**
* 备注信息
*/
private String remarks;
private Long userId;
private String projectCode;
private Integer companyId;
public RaceResultVO(RaceResult raceResult) {
this.topic = raceResult.getQuestionTopic();
this.userRaceId = raceResult.getUserRaceId();
this.answerContent = raceResult.getAnswerContent();
this.correct = raceResult.getCorrect();
this.score = raceResult.getScore();
this.totalScore = raceResult.getTotalScore();
this.remarks = raceResult.getRemarks();
this.userId = raceResult.getUserId();
this.projectCode = raceResult.getProjectCode();
this.companyId = raceResult.getCompanyId();
}
public RaceResult convert2DB() {
RaceResult raceResult = new RaceResult();
raceResult.setUserRaceId(userRaceId);
raceResult.setQuestionTopic(topic);
raceResult.setAnswerContent(answerContent);
raceResult.setScore(score);
raceResult.setTotalScore(totalScore);
raceResult.setCorrect(correct);
raceResult.setRemarks(remarks);
raceResult.setUserId(userId);
raceResult.setProjectCode(projectCode);
raceResult.setCompanyId(companyId);
return raceResult;
}
}

View File

@ -1,90 +0,0 @@
package club.joylink.rtss.vo.client.race;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.entity.RaceUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ApiModel("竞赛报名信息")
@Getter
@Setter
@NoArgsConstructor
public class RaceSignUpInfoVO {
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空")
@Pattern(regexp = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",
message = "身份证号格式不正确")
@ApiModelProperty("身份证号")
private String idNumber;
/**
* 姓名
*/
@Length(max = 10, message = "姓名长度不能超过10个字符")
@NotBlank(message = "姓名不能为空")
@ApiModelProperty("姓名")
private String name;
@NotBlank(message = "手机号不能为空")
@Length(max = 11, message = "手机号长度不能超过11位")
@ApiModelProperty("手机号")
private String mobile;
@NotBlank(message = "验证码不能为空")
@ApiModelProperty("验证码")
private String vdCode;
/**
* 所属组织/企业/学校
*/
@NotBlank(message = "所属组织/企业/学校不能为空")
@Length(max = 30, message = "所属组织/企业/学校名称长度不能超过30个字符")
@ApiModelProperty("所属组织/企业/学校")
private String organization;
/**
* 所属部门
*/
@NotBlank(message = "所属部门不能为空")
@Length(max = 20, message = "所属部门名称长度不能超过20个字符")
@ApiModelProperty("所属部门/专业")
private String department;
/**
* 职位
*/
@NotBlank(message = "职位不能为空")
@Length(max = 20, message = "职位名称长度不能超过20个字符")
@ApiModelProperty("职位")
private String position;
/**
* 所选角色
*/
@NotNull(message = "角色不能为空")
@ApiModelProperty("所选角色")
private SimulationMember.Type type;
public RaceUser buildDB() {
RaceUser user = new RaceUser();
user.setIdNumber(this.idNumber);
user.setName(this.name);
user.setMobile(this.mobile);
user.setOrganization(this.organization);
user.setDepartment(this.department);
user.setPosition(this.position);
user.setRole(type.name());
return user;
}
}

View File

@ -1,40 +0,0 @@
package club.joylink.rtss.vo.client.race;
import club.joylink.rtss.entity.Race;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDate;
@ApiModel("竞赛信息更新")
@Getter
@Setter
@NoArgsConstructor
public class RaceUpdateVO {
private Long id;
@ApiModelProperty("竞赛名称")
private String name;
@ApiModelProperty("开始日期")
private LocalDate startDate;
@ApiModelProperty("结束日期")
private LocalDate endDate;
@ApiModelProperty("关联的地图id")
private Long mapId;
/**
* 以当前对象的属性值覆盖数据库对象的对应属性值
*/
public void overWrite(Race race) {
race.setName(this.name);
race.setStartDate(this.startDate);
race.setEndDate(this.endDate);
race.setMapId(this.mapId);
}
}

View File

@ -1,26 +0,0 @@
package club.joylink.rtss.vo.client.race;
import club.joylink.rtss.vo.client.PageQueryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ApiModel("参赛者分页查询接口")
@Getter
@Setter
@NoArgsConstructor
public class RaceUserQueryVO extends PageQueryVO {
/**
* 参赛者名称
*/
@ApiModelProperty("参赛者名称")
private String name;
/**
* 参赛者所属组织/企业/学校
*/
@ApiModelProperty("参赛者所属组织/企业/学校")
private String organization;
}

View File

@ -1,141 +0,0 @@
package club.joylink.rtss.vo.client.race;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.entity.RaceUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
@ApiModel("竞赛参赛者")
@Getter
@Setter
@NoArgsConstructor
public class RaceUserVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 赛事id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long raceId;
/**
* 用户id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long userId;
/**
* 身份证
*/
private String idNumber;
/**
* 报名时填写的名称
*/
private String name;
/**
* 报名时填写的手机号
*/
private String mobile;
private String organization;
/**
* 所属部门
*/
private String department;
/**
* 职位
*/
private String position;
/**
* 岗位
*/
@ApiModelProperty("在竞赛中扮演的成员的岗位")
private SimulationMember.Type type;
/**
* 报名时间
*/
@ApiModelProperty("报名时间")
private LocalDateTime time;
private Integer status;
/**
* 理论考试分数
*/
private Float theoryScore;
/**
* 理论人工打分
*/
private Float artificialTheoryScore;
/**
* 实操考试分数
*/
private Float practiceScore;
/**
* 实操人工打分
*/
private Float artificialPracticeScore;
/**
* 总分
*/
private Float totalScore;
/**
* 所在仿真组
*/
private String group;
public RaceUserVO(RaceUser raceUser) {
this.id = raceUser.getId();
this.raceId = raceUser.getRaceId();
this.userId = raceUser.getUserId();
this.idNumber = raceUser.getIdNumber();
this.name = raceUser.getName();
this.mobile = raceUser.getMobile();
this.organization = raceUser.getOrganization();
this.department = raceUser.getDepartment();
this.position = raceUser.getPosition();
this.type = SimulationMember.Type.valueOf(raceUser.getRole());
this.time = raceUser.getTime();
this.status = raceUser.getStatus();
this.theoryScore = raceUser.getTheoryScore();
this.practiceScore = raceUser.getPracticeScore();
}
public RaceUser buildDB() {
RaceUser raceUser = new RaceUser();
raceUser.setId(this.id);
raceUser.setRaceId(this.raceId);
raceUser.setUserId(this.userId);
raceUser.setIdNumber(this.idNumber);
raceUser.setName(this.name);
raceUser.setMobile(this.mobile);
raceUser.setOrganization(this.organization);
raceUser.setDepartment(this.department);
raceUser.setPosition(this.position);
raceUser.setRole(this.type.name());
raceUser.setTime(this.time);
raceUser.setStatus(this.status);
raceUser.setTheoryScore(this.theoryScore);
raceUser.setPracticeScore(this.practiceScore);
return raceUser;
}
}

View File

@ -1,79 +0,0 @@
package club.joylink.rtss.vo.client.race;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.entity.Race;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Getter
@Setter
public class RaceVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 竞赛名称
*/
private String name;
private Long mapId;
/**
* 开始日期
*/
private LocalDate startDate;
/**
* 结束日期
*/
private LocalDate endDate;
/**
* 可选角色
*/
@ApiModelProperty("可选角色")
private List<SimulationMember.Type> optionTypes;
/**
* 创建者的id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long creatorId;
/**
* 创建者姓名
*/
private String creatorName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 赛事状态
*/
private int status;
public RaceVO(Race race) {
this.id = race.getId();
this.name = race.getName();
this.mapId = race.getMapId();
this.startDate = race.getStartDate();
this.endDate = race.getEndDate();
this.optionTypes = Arrays.stream(race.getOptionalRoles().split(","))
.map(SimulationMember.Type::valueOf).collect(Collectors.toList());
this.creatorId = race.getCreatorId();
this.createTime = race.getCreateTime();
this.status = race.getStatus();
}
}

View File

@ -12,7 +12,7 @@ import javax.validation.constraints.NotNull;
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
public class ScriptActionNewUpdateVO { public class ScriptActionUpdateVO {
@NotNull(message = "动作id不能为空") @NotNull(message = "动作id不能为空")
private String id; private String id;

View File

@ -24,7 +24,7 @@ import java.util.stream.Collectors;
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "剧本动作") @ApiModel(value = "剧本动作")
public class ScriptActionNewVO { public class ScriptActionVO {
private String id; private String id;
@ -101,7 +101,7 @@ public class ScriptActionNewVO {
@ApiModelProperty(value = "动作触发条件") @ApiModelProperty(value = "动作触发条件")
private ScriptActionBO.Condition condition; private ScriptActionBO.Condition condition;
public ScriptActionNewVO(ScriptActionBO action) { public ScriptActionVO(ScriptActionBO action) {
this.id = action.getId(); this.id = action.getId();
this.type = action.getType(); this.type = action.getType();
this.memberId = action.getMember().getId(); this.memberId = action.getMember().getId();
@ -119,7 +119,7 @@ public class ScriptActionNewVO {
this.condition = action.getCondition(); this.condition = action.getCondition();
} }
public ScriptActionNewVO(ScriptActionPO action) { public ScriptActionVO(ScriptActionPO action) {
this.id = action.getId(); this.id = action.getId();
this.type = action.getType(); this.type = action.getType();
this.memberId = action.getMemberId(); this.memberId = action.getMemberId();
@ -139,8 +139,8 @@ public class ScriptActionNewVO {
/** /**
* 构建剧本提示VO * 构建剧本提示VO
*/ */
public static ScriptActionNewVO buildScriptTipVO(ScriptActionBO action) { public static ScriptActionVO buildScriptTipVO(ScriptActionBO action) {
ScriptActionNewVO vo = new ScriptActionNewVO(action); ScriptActionVO vo = new ScriptActionVO(action);
vo.setCondition(null); vo.setCondition(null);
return vo; return vo;
} }
@ -148,21 +148,21 @@ public class ScriptActionNewVO {
/** /**
* 构建剧本动作完成提示VO * 构建剧本动作完成提示VO
*/ */
public static ScriptActionNewVO buildFinishTipVO(ScriptActionBO action) { public static ScriptActionVO buildFinishTipVO(ScriptActionBO action) {
ScriptActionNewVO vo = new ScriptActionNewVO(); ScriptActionVO vo = new ScriptActionVO();
vo.setId(action.getId()); vo.setId(action.getId());
return vo; return vo;
} }
public static List<ScriptActionNewVO> convertFromBOList(List<ScriptActionBO> list) { public static List<ScriptActionVO> convertFromBOList(List<ScriptActionBO> list) {
List<ScriptActionNewVO> voList = new ArrayList<>(); List<ScriptActionVO> voList = new ArrayList<>();
if(!CollectionUtils.isEmpty(list)) { if(!CollectionUtils.isEmpty(list)) {
list.forEach(scriptAction -> voList.add(new ScriptActionNewVO(scriptAction))); list.forEach(scriptAction -> voList.add(new ScriptActionVO(scriptAction)));
} }
return voList; return voList;
} }
public static List<ScriptActionNewVO> convertFromPOList(List<ScriptActionPO> actionPOList) { public static List<ScriptActionVO> convertFromPOList(List<ScriptActionPO> actionPOList) {
return actionPOList.stream().map(ScriptActionNewVO::new).collect(Collectors.toList()); return actionPOList.stream().map(ScriptActionVO::new).collect(Collectors.toList());
} }
} }

View File

@ -1,24 +0,0 @@
package club.joylink.rtss.vo.client.script;
import club.joylink.rtss.vo.UserVO;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
@ApiModel(value = "剧本用户选择扮演的角色")
public class ScriptUserPlayRole {
private UserVO userVO;
private String memberId;
public ScriptUserPlayRole(UserVO userVO, String memberId) {
this.userVO = userVO;
this.memberId = memberId;
}
}

View File

@ -86,7 +86,7 @@ public class ScriptVO {
/** /**
* 剧本动作 * 剧本动作
*/ */
private List<ScriptActionNewVO> actionList = new ArrayList<>(); private List<ScriptActionVO> actionList = new ArrayList<>();
private Integer fullMarksDuration; private Integer fullMarksDuration;
@ -129,7 +129,7 @@ public class ScriptVO {
this.mapLocation = script.getMapLocation(); this.mapLocation = script.getMapLocation();
this.bgSet = Objects.nonNull(script.getBgScenesJson()); this.bgSet = Objects.nonNull(script.getBgScenesJson());
this.memberList = SimulationMemberVO.convert2VOList(script.getMemberList()); this.memberList = SimulationMemberVO.convert2VOList(script.getMemberList());
this.actionList = ScriptActionNewVO.convertFromBOList(script.getActionList()); this.actionList = ScriptActionVO.convertFromBOList(script.getActionList());
this.fullMarksDuration = script.getFullMarksDuration(); this.fullMarksDuration = script.getFullMarksDuration();
this.passingGradeDuration = script.getPassingGradeDuration(); this.passingGradeDuration = script.getPassingGradeDuration();
this.zeroDuration = script.getZeroDuration(); this.zeroDuration = script.getZeroDuration();
@ -191,7 +191,7 @@ public class ScriptVO {
} }
if (Objects.nonNull(script.getActionsJson())) { if (Objects.nonNull(script.getActionsJson())) {
List<ScriptActionPO> actionPOList = JsonUtils.read(script.getActionsJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptActionPO.class)); List<ScriptActionPO> actionPOList = JsonUtils.read(script.getActionsJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptActionPO.class));
this.actionList = ScriptActionNewVO.convertFromPOList(actionPOList); this.actionList = ScriptActionVO.convertFromPOList(actionPOList);
} }
this.bgScenesJson = script.getBgScenesJson(); this.bgScenesJson = script.getBgScenesJson();
this.finalScenesJson = script.getFinalScenesJson(); this.finalScenesJson = script.getFinalScenesJson();