夜得朦胧 hace 1 año
padre
commit
a56847350d

+ 1 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/MultiSimulationProjectServiceImpl.java

@@ -364,6 +364,7 @@ public class MultiSimulationProjectServiceImpl implements MultiSimulationProject
         param.setPathStartPoint(StringUtils.isBlank(param.getPathStartPoint()) ? "" : param.getPathStartPoint());
         param.setPathEndPoint(StringUtils.isBlank(param.getPathEndPoint()) ? "" : param.getPathEndPoint());
         param.setCarSort(Objects.isNull(param.getCarSort()) ? 0 : param.getCarSort());
+        param.setAlgorithmType(param.getAlgorithmType() == null ? 0 : param.getAlgorithmType());
 
         if (StringUtils.isBlank(param.getSceneCarId())) {
             param.setSceneCarId(StringUtil.getRandomUUID());

+ 13 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationMapServiceImpl.java

@@ -30,6 +30,7 @@ import com.css.simulation.resource.server.app.service.job_manage.MultiSimulation
 import com.css.simulation.resource.server.app.service.job_manage.SimulationMapService;
 import com.css.simulation.resource.server.infra.db.mysql.mapper.*;
 import com.css.simulation.resource.server.infra.feign.service.FileDownService;
+import com.css.simulation.resource.server.infra.util.AuthUtil;
 import com.css.simulation.resource.server.infra.util.PageUtil;
 import com.github.pagehelper.PageInfo;
 import lombok.SneakyThrows;
@@ -125,6 +126,10 @@ public class SimulationMapServiceImpl implements SimulationMapService {
 
 
     public ResponseBodyVO updateSimulationMap(SimulationMapParam param){
+        String currentUserRoleCode = AuthUtil.getCurrentUserRoleCode();
+        if (!StringUtils.equals(DictConstants.ROLE_CODE_ADMIN, currentUserRoleCode) && !StringUtils.equals(DictConstants.ROLE_CODE_SYSADMIN, currentUserRoleCode)){
+            return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "当前用户无该权限");
+        }
         if (StringUtils.isBlank(param.getMapId())){
             return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "地图id为空");
         }
@@ -142,6 +147,10 @@ public class SimulationMapServiceImpl implements SimulationMapService {
 
     }
     public ResponseBodyVO deleteSimulationMap(SimulationMapParam param){
+        String currentUserRoleCode = AuthUtil.getCurrentUserRoleCode();
+        if (!StringUtils.equals(DictConstants.ROLE_CODE_ADMIN, currentUserRoleCode) && !StringUtils.equals(DictConstants.ROLE_CODE_SYSADMIN, currentUserRoleCode)){
+            return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "当前用户无该权限");
+        }
         if (StringUtils.isBlank(param.getMapId())){
             return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "地图id为空");
         }
@@ -155,6 +164,10 @@ public class SimulationMapServiceImpl implements SimulationMapService {
     @SneakyThrows
     @Transactional
     public ResponseBodyVO uploadSimulationMap(MultipartFile fileJson, MultipartFile fileDriver, SimulationMapParam param){
+        String currentUserRoleCode = AuthUtil.getCurrentUserRoleCode();
+        if (!StringUtils.equals(DictConstants.ROLE_CODE_ADMIN, currentUserRoleCode) && !StringUtils.equals(DictConstants.ROLE_CODE_SYSADMIN, currentUserRoleCode)){
+            return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "当前用户无该权限");
+        }
         String mapName = param.getMapName();
         String mapJson = new String(fileJson.getBytes(), StandardCharsets.UTF_8);
         if (StringUtils.isBlank(mapJson) || param.getPathNum() == null || StringUtils.isBlank(mapName)){

+ 5 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/server/infra/db/mysql/mapper/MultiSimulationSceneCarMapper.java

@@ -11,8 +11,8 @@ import java.util.List;
 
 @Mapper
 public interface MultiSimulationSceneCarMapper {
-    @Insert("insert into multi_simulation_scene_car (id,scene_id,car_id,algorithm_id,path_id,path_start,path_end,path_start_point,path_end_point,car_sort,is_simulation_car) values" +
-        "(#{sceneCarId},#{sceneId},#{carId},#{algorithmId},#{pathId},#{pathStart},#{pathEnd},#{pathStartPoint},#{pathEndPoint},#{carSort},#{isSimulationCar})")
+    @Insert("insert into multi_simulation_scene_car (id,scene_id,car_id,algorithm_id,algorithm_type,path_id,path_start,path_end,path_start_point,path_end_point,car_sort,is_simulation_car) values" +
+        "(#{sceneCarId},#{sceneId},#{carId},#{algorithmId},#{algorithmType},#{pathId},#{pathStart},#{pathEnd},#{pathStartPoint},#{pathEndPoint},#{carSort},#{isSimulationCar})")
     int addMultiSimulationSceneCar(MultiSimulationSceneCarParam param);
 
     @Select("select count(*) from multi_simulation_scene_car where scene_id = #{sceneId} and deleted = 0")
@@ -20,7 +20,7 @@ public interface MultiSimulationSceneCarMapper {
 
 
     @Update("<script>" +
-        "update multi_simulation_scene_car set car_id = #{carId},algorithm_id = #{algorithmId}, path_id = #{pathId}," +
+        "update multi_simulation_scene_car set car_id = #{carId},algorithm_id = #{algorithmId}, algorithm_type = #{algorithmType}, path_id = #{pathId}," +
         "path_start = #{pathStart},path_end = #{pathEnd},path_start_point = #{pathStartPoint},path_end_point = #{pathEndPoint},car_sort = #{carSort} " +
         "where id = #{sceneCarId}" +
         "</script>")
@@ -36,14 +36,14 @@ public interface MultiSimulationSceneCarMapper {
     int deleteMultiSimulationSceneCar(MultiSimulationSceneCarParam param);
 //
     @Select("<script>" +
-        "select id,sceneId,carId,algorithmId,pathId,pathStart,pathEnd,pathStartPoint,pathEndPoint,carSort,createTime from multi_simulation_scene_car where deleted = 0 " +
+        "select id,scene_id,car_id,algorithm_id,algorithm_type,path_id,path_start,path_end,path_start_point,path_end_point,car_sort,create_time from multi_simulation_scene_car where deleted = 0 " +
         "and scene_id = #{sceneId}" +
         "order by carSort, create_time desc" +
         "</script>")
     List<MultiSimulationSceneCarVO> selectSceneCarList(MultiSimulationSceneCarParam param);
 
     @Select("<script>" +
-        "select id,sceneId,carId,algorithmId,pathId,pathStart,pathEnd,pathStartPoint,pathEndPoint,carSort,createTime from multi_simulation_scene_car where deleted = 0 " +
+        "select id,scene_id,car_id,algorithm_id,algorithm_type,path_id,path_start,path_end,path_start_point,path_end_point,car_sort,create_time from multi_simulation_scene_car where deleted = 0 " +
         "and id = #{sceneCarId}" +
         "</script>")
     MultiSimulationSceneCarVO selectSceneCarById(MultiSimulationSceneCarParam param);