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