大赛管理功能
This commit is contained in:
parent
f95ed6a898
commit
a5b71e159a
|
@ -1 +1 @@
|
|||
Subproject commit 2aedc24640de82379bc4ebb48e428fd57cfc5e77
|
||||
Subproject commit 5b52c99de80f30e0552b282f9b8f2c578bea56f4
|
|
@ -6,6 +6,7 @@ import club.joylink.rtss.vo.client.PageVO;
|
|||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneListVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScenePublishVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.SceneCustomCreateVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneQueryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
|
@ -27,6 +28,16 @@ public class RaceSceneController {
|
|||
@Autowired
|
||||
private RaceSceneService sceneService;
|
||||
|
||||
@PostMapping("/custom/edit")
|
||||
public void customSave(@RequestBody SceneCustomCreateVO vo, @RequestAttribute AccountVO user) {
|
||||
this.sceneService.customSave(vo, user);
|
||||
}
|
||||
|
||||
@PostMapping("/custom/{id}/edit")
|
||||
public void customUpdate(@PathVariable("id") Long id, @RequestBody SceneCustomCreateVO vo, @RequestAttribute AccountVO user) {
|
||||
this.sceneService.customUpdate(id, vo, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 草稿实训发布到场景
|
||||
*
|
||||
|
|
|
@ -10,22 +10,26 @@ import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
|
|||
import club.joylink.rtss.exception.BusinessExceptionAssert;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.exception.RacetrExceptionAssert;
|
||||
import club.joylink.rtss.services.MinioService;
|
||||
import club.joylink.rtss.simulation.cbtc.training2.Training2;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneListVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScenePublishVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.Scene;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.SceneCustomCreateVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneOuterClass.StorageSimulation;
|
||||
import club.joylink.rtss.vo.race.RaceScenePageVO;
|
||||
import club.joylink.rtss.vo.race.RaceSceneQueryVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -33,10 +37,12 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
@ -48,7 +54,8 @@ public class RaceSceneService {
|
|||
private RacetrTaskDAO taskDAO;
|
||||
@Autowired
|
||||
private DraftTraining2DAO trainingDao;
|
||||
|
||||
@Autowired
|
||||
private MinioService minioService;
|
||||
|
||||
public RacetrScene findById(Long id) {
|
||||
RacetrScene rs = this.sceneDAO.selectByPrimaryKey(id);
|
||||
|
@ -56,6 +63,48 @@ public class RaceSceneService {
|
|||
return rs;
|
||||
}
|
||||
|
||||
public void customSave(SceneCustomCreateVO vo, AccountVO user) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
RacetrScene rs = new RacetrScene();
|
||||
rs.setName(vo.getName());
|
||||
rs.setType(vo.getType().name());
|
||||
rs.setProto(vo.getScene().toByteArray());
|
||||
rs.setCreatorId(user.getId());
|
||||
rs.setUpdaterId(user.getId());
|
||||
rs.setCreateTime(now);
|
||||
rs.setUpdateTime(now);
|
||||
this.sceneDAO.insert(rs);
|
||||
}
|
||||
|
||||
public void customUpdate(Long id, SceneCustomCreateVO vo, AccountVO user) {
|
||||
RacetrScene rs = this.findById(id);
|
||||
this.removeObj(rs);
|
||||
rs.setName(vo.getName());
|
||||
rs.setType(vo.getType().name());
|
||||
rs.setProto(vo.getScene().toByteArray());
|
||||
rs.setUpdaterId(user.getId());
|
||||
rs.setUpdateTime(LocalDateTime.now());
|
||||
this.sceneDAO.updateByPrimaryKeySelective(rs);
|
||||
}
|
||||
|
||||
private void removeObj(RacetrScene rs) {
|
||||
byte[] protoData = rs.getProto();
|
||||
|
||||
if (ArrayUtils.isEmpty(protoData)) {
|
||||
log.error("自定义删除场景附件proto数据不能为空 id:[{}]", rs.getId());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!Objects.equals(rs.getType(), Type.Video.name())) {
|
||||
return;
|
||||
}
|
||||
Scene sceneProto = Scene.parseFrom(protoData);
|
||||
this.minioService.removeMinioObject(rs.getType(), sceneProto.getFileName());
|
||||
} catch (Exception e) {
|
||||
log.error("场景附件处理失败 id:[{}] msg:[{}]", rs.getId(), e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public PageVO<RaceSceneListVO> page(RaceSceneQueryVO query) {
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize());
|
||||
Page<RaceScenePageVO> page = (Page<RaceScenePageVO>) this.sceneDAO.pages(query);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -106,7 +106,7 @@ logging:
|
|||
club.joylink.rtss: DEBUG
|
||||
|
||||
minio:
|
||||
endpoint: http://192.168.3.233
|
||||
endpoint: http://192.168.33.233
|
||||
accessKey: jladmin
|
||||
secretKey: Joylink@0503
|
||||
bucket: oss-rtss
|
||||
|
@ -167,7 +167,7 @@ logging:
|
|||
club.joylink.rtss: INFO
|
||||
|
||||
minio:
|
||||
endpoint: http://192.168.3.233
|
||||
endpoint: http://192.168.33.233
|
||||
accessKey: jladmin
|
||||
secretKey: Joylink@0503
|
||||
bucket: oss-rtss
|
||||
|
|
Loading…
Reference in New Issue