Merge remote-tracking branch 'origin/test' into master-huawei
This commit is contained in:
commit
df1f83c789
@ -1,10 +1,9 @@
|
||||
package club.joylink.rtss.controller.competition;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||
import club.joylink.rtss.services.completition.ICompetitionPracticalService;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -12,8 +11,10 @@ import club.joylink.rtss.vo.client.competition.CompetitionPagedQueryVO;
|
||||
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
||||
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
||||
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||
import club.joylink.rtss.vo.client.validGroup.competition.CompetitionUpdateCheck;
|
||||
import club.joylink.rtss.vo.view.OperationStatisticAnswerView;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -88,6 +89,18 @@ public class CompetitionPracticalController {
|
||||
iCompetitionPracticalService.importFromJson(scriptId, name, competition);
|
||||
}
|
||||
|
||||
@ApiOperation("查询权限")
|
||||
@GetMapping("/query/permissions")
|
||||
public UserPermissionVO queryPermissions(Long mapId, @RequestAttribute UserVO user) {
|
||||
return iCompetitionPracticalService.queryPermissions(mapId, user);
|
||||
}
|
||||
|
||||
@ApiOperation("购买权限")
|
||||
@PostMapping("/purchasePermission")
|
||||
public String purchasePermission(Long mapId, Long amount, @RequestAttribute UserVO user) {
|
||||
return iCompetitionPracticalService.purchasePermission(mapId, amount, user);
|
||||
}
|
||||
|
||||
/* ------------------------- 竞赛运行相关 ------------------------- */
|
||||
@ApiOperation("加载竞赛场景")
|
||||
@PutMapping("/load/{group}/{id}")
|
||||
|
@ -40,7 +40,7 @@ public class GoodsController {
|
||||
@ApiOperation(value = "查询商品详情")
|
||||
@GetMapping(path = "/{id}")
|
||||
public GoodsVO selectById(@PathVariable long id) {
|
||||
return iGoodsService.selectById(id);
|
||||
return iGoodsService.queryById(id);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取有效商品列表")
|
||||
@ -100,7 +100,7 @@ public class GoodsController {
|
||||
@ApiOperation(value = "根据权限id查询商品")
|
||||
@GetMapping(path = "/permissionId")
|
||||
public GoodsVO selectGoodsByPermissionId(Long permissionId) {
|
||||
return iGoodsService.selectGoodsByPermissionId(permissionId);
|
||||
return iGoodsService.queryGoodsByPermissionId(permissionId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据权限ids查询权限包商品")
|
||||
|
@ -297,7 +297,7 @@ public class ExamService implements IExamService{
|
||||
while (iterator.hasNext()) {
|
||||
ExamDefinition exam = iterator.next();
|
||||
if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) {
|
||||
this.offLine(exam.getId(), null);
|
||||
this.offLine(exam.getId(), userVO);
|
||||
iterator.remove();
|
||||
} else if (Objects.nonNull(examIds) && !examIds.contains(exam.getId())) {
|
||||
iterator.remove();
|
||||
|
@ -93,7 +93,7 @@ public class GoodsService implements IGoodsService {
|
||||
* 根据id查询商品。
|
||||
*/
|
||||
@Override
|
||||
public GoodsVO selectById(long id) {
|
||||
public GoodsVO queryById(long id) {
|
||||
SaleGoods goods = findEntity(id);
|
||||
if (goods == null) {
|
||||
return null;
|
||||
@ -131,7 +131,7 @@ public class GoodsService implements IGoodsService {
|
||||
* 如果不存在,return一个只有permissionName和permissionType的GoodsVO
|
||||
*/
|
||||
@Override
|
||||
public GoodsVO selectGoodsByPermissionId(Long permissionId) {
|
||||
public GoodsVO queryGoodsByPermissionId(Long permissionId) {
|
||||
SaleGoodsExample example = new SaleGoodsExample();
|
||||
example.createCriteria()
|
||||
.andPermissionIdEqualTo(permissionId);
|
||||
@ -160,7 +160,7 @@ public class GoodsService implements IGoodsService {
|
||||
return null;
|
||||
}
|
||||
PermissionVO perVO = voList.get(0);
|
||||
GoodsVO goodsVO = selectGoodsByPermissionId(voList.get(0).getId());
|
||||
GoodsVO goodsVO = queryGoodsByPermissionId(voList.get(0).getId());
|
||||
if (goodsVO == null) {
|
||||
goodsVO = new GoodsVO();
|
||||
goodsVO.setPermissionId(perVO.getId());
|
||||
|
@ -23,7 +23,7 @@ public interface IGoodsService {
|
||||
/**
|
||||
* 查询商品详情
|
||||
*/
|
||||
GoodsVO selectById(long id);
|
||||
GoodsVO queryById(long id);
|
||||
|
||||
/**
|
||||
* 更新商品
|
||||
@ -43,7 +43,7 @@ public interface IGoodsService {
|
||||
/**
|
||||
* 根据权限id查询商品
|
||||
*/
|
||||
GoodsVO selectGoodsByPermissionId(Long permissionId);
|
||||
GoodsVO queryGoodsByPermissionId(Long permissionId);
|
||||
|
||||
/**
|
||||
* 通过关联权限ids查询权限包商品
|
||||
|
@ -62,4 +62,6 @@ public interface IPermissionService {
|
||||
* @return
|
||||
*/
|
||||
List<Permission> getJointAndTeachEntities(List<Long> mapIds);
|
||||
|
||||
Permission findJointSimulationEntity(Long mapId);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import org.springframework.util.StringUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@ -110,13 +109,11 @@ public class OrderService implements IOrderService {
|
||||
@Override
|
||||
@Transactional
|
||||
public String createOrder(OrderCreateVO createVO, UserVO user) {
|
||||
if (valid(createVO)) {
|
||||
return create(createVO, user);
|
||||
}
|
||||
return null;
|
||||
return create(createVO, user);
|
||||
}
|
||||
|
||||
private String create(OrderCreateVO createVO, UserVO user) {
|
||||
confirmCorrect(createVO);
|
||||
//新增订单
|
||||
SaleOrder saleOrder = createVO.convert2DB();
|
||||
saleOrder.setCode(iOrderNoGenerator.next());
|
||||
@ -144,20 +141,35 @@ public class OrderService implements IOrderService {
|
||||
return saleOrder.getCode();
|
||||
}
|
||||
|
||||
private boolean valid(OrderCreateVO createVO) {
|
||||
/**
|
||||
* 确认订单参数正确
|
||||
*/
|
||||
private void confirmCorrect(OrderCreateVO createVO) {
|
||||
SaleOrderTypeEnum type = SaleOrderTypeEnum.getSaleOrderTypeByCode(createVO.getOrderType());
|
||||
switch (type) {
|
||||
case Business_Contract:
|
||||
Objects.requireNonNull(createVO.getOrganizationId());
|
||||
Objects.requireNonNull(createVO.getContractNo());
|
||||
Objects.requireNonNull(createVO.getSellerId());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(iOrganizationService.isExist(createVO.getOrganizationId()),
|
||||
"没有该组织机构/企业");
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotNull(isContractNoExist(createVO.getContractNo()),
|
||||
String.format("合同编号为[%s]的订单已存在", createVO.getContractNo()));
|
||||
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getOrganizationId(), "订单组织/单位不能为空");
|
||||
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getContractNo(), "订单合同号不能为空");
|
||||
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getSellerId(), "订单销售人员不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getForever(), "订单是否永久不能不填");
|
||||
if (createVO.getOrganizationId() != null) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(iOrganizationService.isExist(createVO.getOrganizationId()),
|
||||
"没有该组织机构/企业");
|
||||
}
|
||||
if (createVO.getContractNo() != null) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(isContractNoExist(createVO.getContractNo()),
|
||||
String.format("合同编号为[%s]的订单已存在", createVO.getContractNo()));
|
||||
}
|
||||
if (!createVO.getForever()) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getStartTime(), "非永久订单开始时间不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getMonthAmount(), "非永久订单购买时长不能为空");
|
||||
}
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPrice(), "订单总价不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayWays(), "订单支付方式不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getPayStatus(), "订单支付状态不能为空");
|
||||
break;
|
||||
case Contract_Gift:
|
||||
Objects.requireNonNull(createVO.getOrganizationId());
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(createVO.getOrganizationId(), "订单组织/单位不能为空");
|
||||
break;
|
||||
}
|
||||
//公共校验
|
||||
@ -179,7 +191,6 @@ public class OrderService implements IOrderService {
|
||||
detailVO.getGoodsAmount() != null && detailVO.getGoodsAmount() > 0,
|
||||
"商品数量至少为1");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -244,10 +255,7 @@ public class OrderService implements IOrderService {
|
||||
public boolean isContractNoExist(String contractNo) {
|
||||
SaleOrderExample example = new SaleOrderExample();
|
||||
example.createCriteria().andContractNoEqualTo(contractNo);
|
||||
if (saleOrderDAO.countByExample(example) == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return saleOrderDAO.countByExample(example) == 0;
|
||||
}
|
||||
|
||||
public SaleOrder findById(Long id) {
|
||||
|
@ -47,6 +47,8 @@ public class OrganizationService implements IOrganizationService {
|
||||
|
||||
@Override
|
||||
public boolean isExist(Long id) {
|
||||
if (id == null)
|
||||
return false;
|
||||
if (organizationDAO.selectByPrimaryKey(id) == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -560,6 +560,7 @@ public class PermissionService implements IPermissionService {
|
||||
/**
|
||||
* 根据mapId获取该地图下的综合演练权限
|
||||
*/
|
||||
@Override
|
||||
public PermissionVO getJointSimulationPermissionByMapId(Long mapId) {
|
||||
PermissionExample example = new PermissionExample();
|
||||
example.createCriteria()
|
||||
@ -574,4 +575,19 @@ public class PermissionService implements IPermissionService {
|
||||
return new PermissionVO(permissions.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Permission findJointSimulationEntity(Long mapId) {
|
||||
PermissionExample example = new PermissionExample();
|
||||
example.createCriteria()
|
||||
.andMapIdEqualTo(mapId)
|
||||
.andNameLike(String.format("%%%s%%", "综合演练"));
|
||||
example.or()
|
||||
.andMapIdEqualTo(mapId)
|
||||
.andNameLike(String.format("%%%s%%", "Comprehensive exercise cloud platform"));
|
||||
List<Permission> permissions = permissionDAO.selectByExample(example);
|
||||
if (!CollectionUtils.isEmpty(permissions))
|
||||
return permissions.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,6 +64,9 @@ public class ReleaseService implements IReleaseService {
|
||||
@Autowired
|
||||
private CompetitionDAO competitionDAO;
|
||||
|
||||
@Autowired
|
||||
private IscsDAO iscsDAO;
|
||||
|
||||
@Override
|
||||
public ReleaseVO exportAsJson(Long mapId, ReleaseConfigVO config) {
|
||||
ReleaseVO releaseVO = new ReleaseVO();
|
||||
@ -78,7 +81,7 @@ public class ReleaseService implements IReleaseService {
|
||||
RealLine realLine = realLines.get(0);
|
||||
releaseVO.setRealLineConfig(realLine);
|
||||
|
||||
if (config.getRunPlan()) {
|
||||
if (config.isRunPlan()) {
|
||||
this.confirmRunPlanExist(mapId);
|
||||
RunPlanTemplateExample runPlanTemplateExample = new RunPlanTemplateExample();
|
||||
runPlanTemplateExample.createCriteria().andMapIdEqualTo(mapId);
|
||||
@ -107,7 +110,7 @@ public class ReleaseService implements IReleaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.getMap3dData()) {
|
||||
if (config.isMap3dData()) {
|
||||
Map3dDataExample map3dDataExample = new Map3dDataExample();
|
||||
map3dDataExample.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<Map3dDataWithBLOBs> map3dDataWithBLOBs = map3dDataDAO.selectByExampleWithBLOBs(map3dDataExample);
|
||||
@ -115,7 +118,7 @@ public class ReleaseService implements IReleaseService {
|
||||
releaseVO.setMap3dData(map3dDataWithBLOBs.get(0));
|
||||
}
|
||||
}
|
||||
if (config.getCommandDefinition()) {
|
||||
if (config.isCommandDefinition()) {
|
||||
MapVO mapInfo2 = iMapService.getMapInfoById(mapId);
|
||||
CommandDefinitionExample commandDefinitionExample = new CommandDefinitionExample();
|
||||
commandDefinitionExample.createCriteria().andLineCodeEqualTo(mapInfo2.getLineCode());
|
||||
@ -124,7 +127,7 @@ public class ReleaseService implements IReleaseService {
|
||||
releaseVO.setCommandDefinitionList(commandDefinitions);
|
||||
}
|
||||
}
|
||||
if (config.getIbp()) {
|
||||
if (config.isIbp()) {
|
||||
IbpExample example = new IbpExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<Ibp> ibps = ibpDAO.selectByExampleWithBLOBs(example);
|
||||
@ -132,7 +135,15 @@ public class ReleaseService implements IReleaseService {
|
||||
releaseVO.setIbpList(ibps);
|
||||
}
|
||||
}
|
||||
if (config.getScript()) {
|
||||
if (config.isIscs()) {
|
||||
IscsExample example = new IscsExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<Iscs> iscsList = iscsDAO.selectByExampleWithBLOBs(example);
|
||||
if (!CollectionUtils.isEmpty(iscsList)) {
|
||||
releaseVO.setIscsList(iscsList);
|
||||
}
|
||||
}
|
||||
if (config.isScript()) {
|
||||
//草稿地图
|
||||
ScriptDraftExample example = new ScriptDraftExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
@ -283,6 +294,16 @@ public class ReleaseService implements IReleaseService {
|
||||
}
|
||||
ibpDAO.batchInsertWithId(ibpList);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(releaseVO.getIscsList())) {
|
||||
List<Iscs> iscsList = releaseVO.getIscsList();
|
||||
//删除旧数据
|
||||
IscsExample example = new IscsExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
iscsDAO.deleteByExample(example);
|
||||
//插入新数据
|
||||
iscsList.forEach(iscs->iscs.setMapId(mapId));
|
||||
iscsDAO.batchInsert(iscsList);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(releaseVO.getScriptDrafts())) {
|
||||
//删除旧草稿
|
||||
ScriptDraftExample example = new ScriptDraftExample();
|
||||
|
@ -244,22 +244,15 @@ public class UserPermissionService implements IUserPermissionService {
|
||||
|
||||
/**
|
||||
* 获取指定类型的用户权限
|
||||
*
|
||||
* @param userVO
|
||||
* @param mapId
|
||||
* @param prdType
|
||||
* @param lessonId
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public List<UserPermissionVO> getGivenTypeUserPermissionVOList(UserVO userVO, Long mapId, String prdType, Long lessonId, String type) {
|
||||
private List<UserPermissionVO> getGivenTypeUserPermissionVOList(UserVO userVO, Long mapId, String prdType, Long lessonId, String type) {
|
||||
PermissionVO permission;
|
||||
if (MapPrdTypeEnum.JOINT.getCode().equals(prdType)) {
|
||||
permission = iPermissionService.getJointSimulationPermissionByMapId(mapId);
|
||||
} else {
|
||||
permission = iPermissionService.getTeachPermissionByMapId(mapId);
|
||||
}
|
||||
return this.getByUserIdAndPermissionId(userVO.getId(), permission.getId());
|
||||
return this.getValidByUserIdAndPermissionId(userVO.getId(), permission.getId());
|
||||
|
||||
|
||||
// PermissionExample permissionExample = new PermissionExample();
|
||||
@ -290,9 +283,9 @@ public class UserPermissionService implements IUserPermissionService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id和权限id获取用户权限
|
||||
* 根据用户id和权限id获取有效的用户权限
|
||||
*/
|
||||
private List<UserPermissionVO> getByUserIdAndPermissionId(Long userId, Long permissionId) {
|
||||
private List<UserPermissionVO> getValidByUserIdAndPermissionId(Long userId, Long permissionId) {
|
||||
UserPermissionExample example = new UserPermissionExample();
|
||||
example.createCriteria()
|
||||
.andUserIdEqualTo(userId)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.services.completition;
|
||||
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.dao.CompetitionDAO;
|
||||
import club.joylink.rtss.dao.CompetitionRecordDAO;
|
||||
@ -8,6 +9,10 @@ import club.joylink.rtss.entity.CompetitionExample;
|
||||
import club.joylink.rtss.entity.CompetitionRecord;
|
||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IGoodsService;
|
||||
import club.joylink.rtss.services.IOrderService;
|
||||
import club.joylink.rtss.services.IPermissionService;
|
||||
import club.joylink.rtss.services.IUserPermissionService;
|
||||
import club.joylink.rtss.services.script.IScriptService;
|
||||
import club.joylink.rtss.services.script.IScriptSimulationService;
|
||||
import club.joylink.rtss.services.simulation.ProjectSimulationService;
|
||||
@ -29,6 +34,7 @@ import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.*;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -40,6 +46,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -74,6 +81,18 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
||||
@Autowired
|
||||
private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher;
|
||||
|
||||
@Autowired
|
||||
private IUserPermissionService iUserPermissionService;
|
||||
|
||||
@Autowired
|
||||
private IPermissionService iPermissionService;
|
||||
|
||||
@Autowired
|
||||
private IGoodsService iGoodsService;
|
||||
|
||||
@Autowired
|
||||
private IOrderService iOrderService;
|
||||
|
||||
@Override
|
||||
public PageVO<CompetitionVO> pagedQueryCompetition(CompetitionPagedQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
@ -166,11 +185,19 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
||||
@Override
|
||||
public void loadCompetition(String group, Long id, LoginUserInfoVO userInfo) {
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
Long scriptId = getEntity(id).getScriptId();
|
||||
CompetitionWithBLOBs competitionEntity = getEntity(id);
|
||||
if (!competitionEntity.getName().startsWith("场景1")) {
|
||||
Long mapId = simulation.getBuildParams().getMap().getId();
|
||||
List<UserPermissionVO> ups = iUserPermissionService.getSimulationUserPermission(userInfo.getUserVO(),
|
||||
mapId, MapPrdTypeEnum.JOINT.getCode());
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertCollectionNotEmpty(ups,
|
||||
"权限不足,无法使用场景");
|
||||
}
|
||||
Long scriptId = competitionEntity.getScriptId();
|
||||
iScriptSimulationService.loadScript(group, scriptId);
|
||||
ScriptBO script = simulation.getScript();
|
||||
CompetitionBO competition = this.getCompetitionBO(id, script);
|
||||
simulation.setCompetition(competition);
|
||||
CompetitionBO competitionBO = this.getCompetitionBO(id, script);
|
||||
simulation.setCompetition(competitionBO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -365,6 +392,34 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
||||
competitionDAO.insert(competition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPermissionVO queryPermissions(Long mapId, UserVO user) {
|
||||
List<UserPermissionVO> permissions = iUserPermissionService.getSimulationUserPermission(user, mapId, MapPrdTypeEnum.JOINT.getCode());
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Optional<UserPermissionVO> optional = permissions.stream()
|
||||
.filter(up -> up.getRemains() > 0 && !up.getStartTime().isAfter(now) && (up.getEndTime() == null || !up.getEndTime().isBefore(now)))
|
||||
.max((o1, o2) -> {
|
||||
if (o1.getEndTime().isAfter(o2.getEndTime())) {
|
||||
return 1;
|
||||
} else if (o2.getEndTime().isAfter(o1.getEndTime())) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
return optional.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String purchasePermission(Long mapId, Long amount, UserVO user) {
|
||||
// PermissionVO jointPermission = iPermissionService.getJointSimulationPermissionByMapId(mapId);
|
||||
// GoodsVO goods = iGoodsService.queryGoodsByPermissionId(jointPermission.getId());
|
||||
// OrderCreateVO orderCreateVO = new OrderCreateVO();
|
||||
// orderCreateVO.setOrganizationId();
|
||||
// iOrderService.createOrder()
|
||||
return "待实现";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存结果
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
package club.joylink.rtss.services.completition;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.entity.CompetitionWithBLOBs;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -9,6 +9,7 @@ import club.joylink.rtss.vo.client.competition.CompetitionPagedQueryVO;
|
||||
import club.joylink.rtss.vo.client.competition.CompetitionResult;
|
||||
import club.joylink.rtss.vo.client.competition.CompetitionVO;
|
||||
import club.joylink.rtss.vo.client.competition.OperationStatisticVO;
|
||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -107,4 +108,16 @@ public interface ICompetitionPracticalService {
|
||||
* @param competition
|
||||
*/
|
||||
void importFromJson(Long scriptId, String name, CompetitionWithBLOBs competition);
|
||||
|
||||
/**
|
||||
* 查询该地图下的综合演练权限
|
||||
* @return
|
||||
*/
|
||||
UserPermissionVO queryPermissions(Long mapId, UserVO user);
|
||||
|
||||
/**
|
||||
* 购买权限
|
||||
* @param amount 购买数量,单位为月
|
||||
*/
|
||||
String purchasePermission(Long mapId, Long amount, UserVO user);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
|
||||
Permission permission = iPermissionService.findTeachPermissionEntity(gzbMapId);
|
||||
log.warn(String.format("项目[%s]没有有效的教学权限", projectCode));
|
||||
if (permission == null) return;
|
||||
GoodsVO good = iGoodsService.selectGoodsByPermissionId(permission.getId());
|
||||
GoodsVO good = iGoodsService.queryGoodsByPermissionId(permission.getId());
|
||||
List<Long> userIds = oldSysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
List<UserPermission> userPermissions = iUserPermissionService.findEntity(userIds, true);
|
||||
List<Long> usersWithPermissions = userPermissions.stream()
|
||||
|
@ -42,7 +42,9 @@ public interface TrainingConsts {
|
||||
/** 始端信号机 */
|
||||
START_SIGNAL,
|
||||
/** 终端信号机 */
|
||||
END_SIGNAL
|
||||
END_SIGNAL,
|
||||
/** 终端按钮信号机 */
|
||||
END_BUTTON_SIGNAL
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,6 +77,9 @@ public interface GeneratorNew {
|
||||
case END_SIGNAL:
|
||||
s.setDeviceCode(((Route) mapDevice).getDestination().getCode());
|
||||
break;
|
||||
case END_BUTTON_SIGNAL:
|
||||
s.setDeviceCode(((Route) mapDevice).getDestinationButtonSignal().getCode());
|
||||
break;
|
||||
default:
|
||||
s.setDeviceCode(mapDevice.getCode());
|
||||
}
|
||||
|
@ -398,6 +398,9 @@ public class Station extends MayOutOfOrderDevice {
|
||||
* 是否处于中控下
|
||||
*/
|
||||
public boolean underCenterControl() {
|
||||
if (isCentralized()) {
|
||||
return isCenterControl();
|
||||
}
|
||||
if (hasControlMode) {
|
||||
return isCenterControl();
|
||||
} else {
|
||||
@ -409,6 +412,8 @@ public class Station extends MayOutOfOrderDevice {
|
||||
* 是否处于站控下
|
||||
*/
|
||||
public boolean underStandControl() {
|
||||
if (isCentralized())
|
||||
return isStandControl();
|
||||
if (hasControlMode) {
|
||||
return isStandControl();
|
||||
} else {
|
||||
|
@ -12,23 +12,26 @@ import javax.validation.constraints.NotNull;
|
||||
public class ReleaseConfigVO {
|
||||
|
||||
@NotNull
|
||||
private Boolean mapData;
|
||||
private boolean mapData;
|
||||
|
||||
@NotNull
|
||||
private Boolean runPlan;
|
||||
private boolean runPlan;
|
||||
|
||||
@NotNull
|
||||
private Boolean map3dData;
|
||||
private boolean map3dData;
|
||||
|
||||
@NotNull
|
||||
private Boolean commandDefinition;
|
||||
private boolean commandDefinition;
|
||||
|
||||
@NotNull
|
||||
private Boolean realLineConfig;
|
||||
private boolean realLineConfig;
|
||||
|
||||
@NotNull
|
||||
private Boolean ibp;
|
||||
private boolean ibp;
|
||||
|
||||
@NotNull
|
||||
private Boolean script;
|
||||
private boolean iscs;
|
||||
|
||||
@NotNull
|
||||
private boolean script;
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ public class ReleaseVO {
|
||||
*/
|
||||
private List<Ibp> ibpList;
|
||||
|
||||
private List<Iscs> iscsList;
|
||||
|
||||
private List<ScriptDraftWithBLOBs> scriptDrafts;
|
||||
|
||||
private List<ScriptWithBLOBs> scripts;
|
||||
|
Loading…
Reference in New Issue
Block a user