Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

martin 3 éve
szülő
commit
9e511dc36c
16 módosított fájl, 687 hozzáadás és 21 törlés
  1. 3 0
      api-common/src/main/java/api/common/pojo/param/project/SimulationManualProjectParam.java
  2. 14 0
      api-common/src/main/java/api/common/pojo/param/system/RoleParam.java
  3. 5 2
      api-common/src/main/java/api/common/pojo/po/project/ManualProjectTaskPo.java
  4. 1 1
      api-common/src/main/java/api/common/pojo/po/system/DictPO.java
  5. 22 0
      api-common/src/main/java/api/common/pojo/po/system/RolePO.java
  6. 21 0
      api-common/src/main/java/api/common/pojo/vo/system/RoleVO.java
  7. 21 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java
  8. 353 16
      simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java
  9. 3 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/project/mapper/SimulationProjectTaskMapper.java
  10. 7 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/project/service/SimulationProjectService.java
  11. 65 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/RoleCtrl.java
  12. 1 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/UserCtrl.java
  13. 22 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/mapper/RoleMapper.java
  14. 48 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/RoleService.java
  15. 26 0
      simulation-resource-server/src/main/resources/mapper/project/SimulationProjectTaskMapper.xml
  16. 75 0
      simulation-resource-server/src/main/resources/mapper/system/RoleMapper.xml

+ 3 - 0
api-common/src/main/java/api/common/pojo/param/project/SimulationManualProjectParam.java

@@ -102,5 +102,8 @@ public class SimulationManualProjectParam extends PageVO {
     //算法类型
     private String algorithmType;
 
+    //仿真结果地址
+    private String runResultFilePath;
+
 
 }

+ 14 - 0
api-common/src/main/java/api/common/pojo/param/system/RoleParam.java

@@ -0,0 +1,14 @@
+package api.common.pojo.param.system;
+
+import api.common.pojo.common.PageVO;
+
+public class RoleParam extends PageVO {
+
+    //角色名称
+    private String roleName;
+    //角色编码
+    private String roleCode;
+    //是否启用
+    private String visible;
+
+}

+ 5 - 2
api-common/src/main/java/api/common/pojo/po/project/ManualProjectTaskPo.java

@@ -64,13 +64,13 @@ public class ManualProjectTaskPo extends BasePo {
     private String maximumSwingSpeed;
 
     //自车速度方差
-    private Double speedVariance;
+    private String speedVariance;
 
     //舒适度
     private String speedComfortLevel;
 
     //自车横摆角速度均方根
-    private Double swingSpeedMeanSquareRoot;
+    private String swingSpeedMeanSquareRoot;
 
     //舒适度
     private String swingComfortLevel;
@@ -99,6 +99,9 @@ public class ManualProjectTaskPo extends BasePo {
     //其他
     private String otherCurve;
 
+    //时间轴
+    private String timerShaft;
+
 
 
 

+ 1 - 1
api-common/src/main/java/api/common/pojo/po/system/DictPO.java

@@ -17,6 +17,6 @@ public class DictPO extends CommonPO {
     //编码
     private String dictCode;
     //序号
-    private String dictOrder;
+    private int dictOrder;
 
 }

+ 22 - 0
api-common/src/main/java/api/common/pojo/po/system/RolePO.java

@@ -0,0 +1,22 @@
+package api.common.pojo.po.system;
+
+import api.common.pojo.common.CommonPO;
+import lombok.Data;
+
+@Data
+public class RolePO extends CommonPO {
+
+    //主键
+    private String id;
+    //角色名称
+    private String roleName;
+    //角色编码
+    private String roleCode;
+    //角色描述
+    private String description;
+    //是否启用
+    private String visible;
+    //排序号
+    private int sort;
+
+}

+ 21 - 0
api-common/src/main/java/api/common/pojo/vo/system/RoleVO.java

@@ -0,0 +1,21 @@
+package api.common.pojo.vo.system;
+
+import lombok.Data;
+
+@Data
+public class RoleVO {
+
+    //主键
+    private String id;
+    //角色名称
+    private String roleName;
+    //角色编码
+    private String roleCode;
+    //角色描述
+    private String description;
+    //是否启用
+    private String visible;
+    //排序号
+    private int sort;
+
+}

+ 21 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java

@@ -190,6 +190,27 @@ public class SimulationProjectCtrl {
         return service.saveEvaluationLevel(param);
     }
 
+    /**
+     *保存仿真结果到数据库(任务结果返回时调用)
+     * @param param
+     * @return
+     */
+    @RequestMapping("saveTaskResult")
+    @ResponseBody
+    public ResponseBodyVO saveTaskResult(@RequestBody SimulationManualProjectParam param){
+        return service.saveTaskResult(param);
+    }
+
+    /**
+     * 导出工作任务文件包
+     * @return
+     */
+    @RequestMapping("exportProjectTaskFileById")
+    @ResponseBody
+    public ResponseBodyVO exportProjectTaskFileById(@RequestBody SimulationManualProjectParam param){
+        return service.exportProjectTaskFileById(param);
+    }
+
 
 
 

+ 353 - 16
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -709,7 +709,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         InputStream fileInputStream = null;
         InputStreamReader inputStreamReader = null;
         BufferedReader bufferedReader = null;
-        File file = null;
+//        File file = null;
         try {
             //2.解析仿真文件
             //time
@@ -762,58 +762,100 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                 }
                 String[] split = line.split(",");
 
+                ////添加异常捕获,非正常数据默认为0
                 try {
-                    time_list.add(Double.valueOf(split[1]));
+                    Double aDouble = Double.valueOf(split[1]);
+                    if(aDouble.isNaN()){
+                        time_list.add(0D);
+                    }else{
+                        time_list.add(Double.valueOf(split[1]));
+                    }
                 }catch (NumberFormatException e){
                     time_list.add(0D);
                 }
 
 
                 try {
-                    lateral_velocity_list.add(Double.valueOf(split[6]));
+                    Double aDouble = Double.valueOf(split[6]);
+                    if(aDouble.isNaN()){
+                        lateral_velocity_list.add(0D);
+                    }else{
+                        lateral_velocity_list.add(Double.valueOf(split[6]));
+                    }
+
                 }catch (NumberFormatException e){
                     lateral_velocity_list.add(0D);
                 }
 
                 try {
-                    longitudinal_velocity_list.add(Double.valueOf(split[7]));
+                    Double aDouble = Double.valueOf(split[7]);
+                    if(aDouble.isNaN()){
+                        longitudinal_velocity_list.add(0D);
+                    }else{
+                        longitudinal_velocity_list.add(Double.valueOf(split[7]));
+                    }
                 }catch (NumberFormatException e){
                     longitudinal_velocity_list.add(0D);
                 }
 
 
                 try {
-                    lateral_acceleration.add(Double.valueOf(split[8]));
+                    Double aDouble = Double.valueOf(split[8]);
+                    if(aDouble.isNaN()){
+                        lateral_acceleration.add(0D);
+                    }else{
+                        lateral_acceleration.add(Double.valueOf(split[8]));
+                    }
                 }catch (NumberFormatException e){
                     lateral_acceleration.add(0D);
                 }
 
                 try {
-                    longitudinal_acceleration_list.add(Double.valueOf(split[9]));
+                    Double aDouble = Double.valueOf(split[9]);
+                    if(aDouble.isNaN()){
+                        longitudinal_acceleration_list.add(0D);
+                    }else{
+                        longitudinal_acceleration_list.add(Double.valueOf(split[9]));
+                    }
                 }catch (NumberFormatException e){
                     longitudinal_acceleration_list.add(0D);
                 }
 
                 try {
-                    steeting_wheel_list.add(Double.valueOf(split[12]));//steering_angle
+                    Double aDouble = Double.valueOf(split[12]);
+                    if(aDouble.isNaN()){
+                        steeting_wheel_list.add(0D);
+                    }else{
+                        steeting_wheel_list.add(Double.valueOf(split[12]));//steering_angle
+                    }
                 }catch (NumberFormatException e){
                     steeting_wheel_list.add(0D);
                 }
 
                 try {
-                    yawrate_list.add(Double.valueOf(split[13]));
+                    Double aDouble = Double.valueOf(split[13]);
+                    if(aDouble.isNaN()){
+                        yawrate_list.add(0D);
+                    }else{
+                        yawrate_list.add(Double.valueOf(split[13]));
+                    }
                 }catch (NumberFormatException e){
                     yawrate_list.add(0D);
                 }
 
                 try {
-                    lane_offset_list.add(Double.valueOf(split[27]));//lane_center_offset
+                    Double aDouble = Double.valueOf(split[27]);
+                    if(aDouble.isNaN()){
+                        lane_offset_list.add(0D);
+                    }else{
+                        lane_offset_list.add(Double.valueOf(split[27]));//lane_center_offset
+                    }
                 }catch (NumberFormatException e){
                     lane_offset_list.add(0D);
                 }
 
-//                brake_list.add(Double.valueOf(split[7])); ///TODO 没有
-//                throttle_list.add(Double.valueOf(split[7]));///TODO 没有
+//                brake_list.add(Double.valueOf(split[])); ///TODO 没有
+//                throttle_list.add(Double.valueOf(split[]));///TODO 没有
 
             }
             //里程
@@ -912,9 +954,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                 if(bufferedReader != null){
                     bufferedReader.close();
                 }
-                if(file != null ){
+                /*if(file != null ){
                     file.delete();
-                }
+                }*/
             }catch (IOException e){
                 e.printStackTrace();
 
@@ -2833,12 +2875,12 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
         String id = param.getId();
         if(StringUtil.isEmpty(id)){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"工作名称不能为空");
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"工作id不能为空");
         }
 
         SimulationManualProjectPo po = simulationProjectMapper.selectProjectBaseById(param);
-        if(StringUtil.isEmpty(id)){
-            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"工作名称不能为空");
+        if(po == null){
+            return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"没有查到工作信息");
         }
 
         List<ScenePackageSubListVO> scenePackageSubListVOS = simulationProjectMapper.selectSubSceneByPid(po.getScene());
@@ -2869,6 +2911,301 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
     }
 
+    @Override
+    public ResponseBodyVO saveTaskResult(SimulationManualProjectParam param) {
+
+        String projectId = param.getProjectId();
+        String taskId = param.getTaskId();
+        String runResultFilePath = param.getRunResultFilePath();
+
+        if(StringUtil.isEmpty(projectId)){
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"工作id不能为空");
+        }
+        if(StringUtil.isEmpty(taskId)){
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"任务id不能为空");
+        }
+        if(StringUtil.isEmpty(runResultFilePath)){
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"地址不能为空");
+        }
+
+        InputStream fileInputStream = null;
+        InputStreamReader inputStreamReader = null;
+        BufferedReader bufferedReader = null;
+        File file = null;
+        try {
+            //time
+            List<Double> time_list = new ArrayList<>();
+            //velocity
+            List<String> velocity_list = new ArrayList<>();
+            List<Double> lateral_velocity_list = new ArrayList<>();
+            List<Double> longitudinal_velocity_list = new ArrayList<>();
+            //acceleration
+            List<String> acceleration_list = new ArrayList<>();
+            List<Double> lateral_acceleration = new ArrayList<>();
+            List<Double> longitudinal_acceleration_list = new ArrayList<>();
+            //lane_offset
+            List<String> lane_offset_list = new ArrayList<>();
+            ///TODO brake 暂无
+            List<String> brake_list = new ArrayList<>();
+            //steeting_wheel
+            List<String> steeting_wheel_list = new ArrayList<>();
+            ///TODO throttle 暂无
+            List<String> throttle_list = new ArrayList<>();
+            //摆角速度
+            List<Double> yawrate_list = new ArrayList<>();
+
+            MinioParameter minioParameter = new MinioParameter();
+            minioParameter.setObjectName(runResultFilePath+"/Ego.csv");
+            Response download = fileDownService.download(minioParameter);
+            Response.Body body = download.body();
+            fileInputStream = body.asInputStream();
+
+            /*file = new File("E:\\仿真云平台\\任务详情界面数据\\Ego(1).csv");
+            fileInputStream = new FileInputStream(file);
+            inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");*/
+
+            inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
+            bufferedReader = new BufferedReader(inputStreamReader);
+            String line;
+            int lineIndex = 0;
+
+            while((line = bufferedReader.readLine()) != null){
+                lineIndex++;
+                if(lineIndex == 1){
+                    continue;
+                }
+                String[] split = line.split(",");
+
+                //添加异常捕获,非正常数据默认为0
+                try {
+                    Double aDouble = Double.valueOf(split[1]);
+                    if(aDouble.isNaN()){
+                        time_list.add(0D);
+                    }else{
+                        time_list.add(aDouble);
+                    }
+                }catch (NumberFormatException e){
+                    time_list.add(0D);
+                }
+
+                try {
+                    Double aDouble = Double.valueOf(split[6]);
+                    if(aDouble.isNaN()){
+                        lateral_velocity_list.add(0D);
+                    }else{
+                        lateral_velocity_list.add(aDouble);
+                    }
+
+                }catch (NumberFormatException e){
+                    lateral_velocity_list.add(0D);
+                }
+
+                try {
+                    Double aDouble = Double.valueOf(split[7]);
+                    if(aDouble.isNaN()){
+                        longitudinal_velocity_list.add(0D);
+                    }else{
+                        longitudinal_velocity_list.add(aDouble);
+                    }
+
+                }catch (NumberFormatException e){
+                    longitudinal_velocity_list.add(0D);
+                }
+
+
+                try {
+                    Double aDouble = Double.valueOf(split[8]);
+                    if(aDouble.isNaN()){
+                        lateral_acceleration.add(0D);
+                    }else{
+                        lateral_acceleration.add(aDouble);
+                    }
+
+                }catch (NumberFormatException e){
+                    lateral_acceleration.add(0D);
+                }
+
+                try {
+                    Double aDouble = Double.valueOf(split[9]);
+                    if(aDouble.isNaN()){
+                        longitudinal_acceleration_list.add(0D);
+                    }else{
+                        longitudinal_acceleration_list.add(aDouble);
+                    }
+
+                }catch (NumberFormatException e){
+                    longitudinal_acceleration_list.add(0D);
+                }
+
+                try {
+                    Double aDouble = Double.valueOf(split[12]);
+                    if(aDouble.isNaN()){
+                        steeting_wheel_list.add("0");
+                    }else{
+                        steeting_wheel_list.add(String.valueOf(aDouble));//steering_angle
+                    }
+                }catch (NumberFormatException e){
+                    steeting_wheel_list.add("0");
+                }
+
+                try {
+                    Double aDouble = Double.valueOf(split[13]);
+                    if(aDouble.isNaN()){
+                        yawrate_list.add(0D);
+                    }else{
+                        yawrate_list.add(aDouble);
+                    }
+                }catch (NumberFormatException e){
+                    yawrate_list.add(0D);
+                }
+
+                try {
+                    Double aDouble = Double.valueOf(split[27]);
+                    if(aDouble.isNaN()){
+                        lane_offset_list.add("0");
+                    }else{
+                        lane_offset_list.add(String.valueOf(aDouble));//lane_center_offset
+                    }
+                }catch (NumberFormatException e){
+                    lane_offset_list.add("0");
+                }
+
+            }
+
+            //里程
+            Double lc = 0D;
+            for(int i=0; i<time_list.size(); i++){
+                if(i == 0){
+                    continue;
+                }
+                lc += (time_list.get(i)-time_list.get(i-1))*longitudinal_velocity_list.get(i-1);
+
+            }
+
+            //平均速度
+            Double pjsd = lc/time_list.get(time_list.size()-1);
+
+            //最大速度
+            Double zdsd = Collections.max(longitudinal_velocity_list);
+
+            //最小速度
+            Double zxsd = Collections.min(longitudinal_velocity_list);
+
+            //最大加速度
+            Double zdjiasd = Collections.max(longitudinal_acceleration_list);
+
+            //最大减速度
+            Double zdjiansd = Collections.min(longitudinal_acceleration_list);
+
+            //最大摆角速度
+            Double zdbjsd = Collections.max(yawrate_list);
+
+            //自车速度方差
+            Double zcsdfc = 0D;
+            for(Double d :longitudinal_velocity_list){
+                zcsdfc +=Math.pow(d-pjsd,2);
+            }
+            zcsdfc = zcsdfc/longitudinal_velocity_list.size();
+
+            //自车横摆角速度均方根
+            Double zchbjsdjfg = 0D;
+            for(Double d :yawrate_list){
+                zchbjsdjfg += Math.pow(d-pjsd,2);
+            }
+            zchbjsdjfg = Math.sqrt(zchbjsdjfg/yawrate_list.size());
+
+            for(int i=0; i<lateral_acceleration.size(); i++){
+                Double aDouble = lateral_acceleration.get(i);
+                Double aDouble1 = longitudinal_acceleration_list.get(i);
+                Double d = Math.pow(aDouble,2)+Math.pow(aDouble1,2);
+                acceleration_list.add(String.valueOf(Math.sqrt(d)));
+            }
+
+            for(int i=0; i<lateral_velocity_list.size(); i++){
+                Double aDouble = lateral_velocity_list.get(i);
+                Double aDouble1 = longitudinal_velocity_list.get(i);
+                Double d = Math.pow(aDouble,2)+Math.pow(aDouble1,2);
+                velocity_list.add(String.valueOf(d));
+            }
+
+            //将数据保存到库
+            ManualProjectTaskPo manualProjectTaskPo = new ManualProjectTaskPo();
+            manualProjectTaskPo.setId(taskId);
+            manualProjectTaskPo.setPId(projectId);
+            manualProjectTaskPo.setMileage(lc.toString());
+            manualProjectTaskPo.setAverageVelocity(pjsd.toString());
+            manualProjectTaskPo.setMaximunSpeed(zdsd.toString());
+            manualProjectTaskPo.setMinimunVelocity(zxsd.toString());
+            manualProjectTaskPo.setMaximumAcceleration(zdjiasd.toString());
+            manualProjectTaskPo.setMaximumDeceleration(zdjiansd.toString());
+            manualProjectTaskPo.setMaximumSwingSpeed(zdbjsd.toString());
+            manualProjectTaskPo.setSpeedVariance(String.valueOf(zcsdfc));
+            manualProjectTaskPo.setSwingSpeedMeanSquareRoot(String.valueOf(zchbjsdjfg));
+            manualProjectTaskPo.setAcceleration(String.join(",",acceleration_list));
+            manualProjectTaskPo.setLaneOffset(String.join(",",lane_offset_list));
+            manualProjectTaskPo.setBrake(String.join(",",brake_list));
+            manualProjectTaskPo.setSteetingWheel(String.join(",",steeting_wheel_list));
+            manualProjectTaskPo.setThrottle(String.join(",",throttle_list));
+            if(!isEmpty(yawrate_list)){
+                StringBuffer sb = new StringBuffer();
+                for(Double d : yawrate_list){
+                    sb.append(d+",");
+                }
+                String s = sb.substring(0, sb.lastIndexOf(","));
+                manualProjectTaskPo.setYawRate(s);
+            }
+            manualProjectTaskPo.setVelocity(String.join(",",velocity_list));
+            manualProjectTaskPo.setOtherCurve("");///TODO 其他暂无
+
+            if(!isEmpty(time_list)){
+                StringBuffer sb = new StringBuffer();
+                for(Double d : time_list){
+                    sb.append(d+",");
+                }
+                String s = sb.substring(0, sb.lastIndexOf(","));
+                manualProjectTaskPo.setTimerShaft(s);
+            }
+
+            simulationProjectTaskMapper.updateTaksResult(manualProjectTaskPo);
+
+
+
+        } catch (Exception e){
+            e.printStackTrace();
+        } finally {
+            try {
+                if(fileInputStream != null){
+                    fileInputStream.close();
+                }
+                if(inputStreamReader != null){
+                    inputStreamReader.close();
+                }
+                if(bufferedReader != null){
+                    bufferedReader.close();
+                }
+                /*if(file != null ){
+                    file.delete();
+                }*/
+            }catch (IOException e){
+                e.printStackTrace();
+
+            }
+        }
+
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
+
+    }
+
+    @Override
+    public ResponseBodyVO exportProjectTaskFileById(SimulationManualProjectParam param) {
+        String id = param.getId();
+        if(StringUtil.isEmpty(id)){
+            return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"工作id不能为空");
+        }
+
+        return null;
+    }
+
     /**
      * 换行
      * @param lineNum 换行数量

+ 3 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/mapper/SimulationProjectTaskMapper.java

@@ -34,6 +34,9 @@ public interface SimulationProjectTaskMapper {
 
     List<Map> selectRunTaskByState(Map map);
 
+    //更新仿真结果到数据库
+    int updateTaksResult(ManualProjectTaskPo po);
+
 
 
 

+ 7 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/project/service/SimulationProjectService.java

@@ -3,6 +3,7 @@ package com.css.simulation.resource.project.service;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.project.SimulationManualProjectParam;
 import com.itextpdf.text.DocumentException;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import java.io.IOException;
 import java.util.Map;
@@ -52,5 +53,10 @@ public interface SimulationProjectService {
     String selectProjectReportIdByAlgorithmId(String algorithmId);
 
     //生成保存评价等级
-    public ResponseBodyVO saveEvaluationLevel(SimulationManualProjectParam param);
+    ResponseBodyVO saveEvaluationLevel(SimulationManualProjectParam param);
+
+    //仿真结果保存到数据库
+    ResponseBodyVO saveTaskResult(SimulationManualProjectParam param);
+
+    ResponseBodyVO exportProjectTaskFileById(SimulationManualProjectParam param);
 }

+ 65 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/RoleCtrl.java

@@ -0,0 +1,65 @@
+package com.css.simulation.resource.system.ctrl;
+
+import api.common.pojo.common.ResponseBodyVO;
+import api.common.pojo.param.system.RoleParam;
+import api.common.pojo.po.system.RolePO;
+import api.common.pojo.vo.system.RoleVO;
+import api.common.util.ObjectUtil;
+import com.css.simulation.resource.system.service.RoleService;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+/**
+ * 角色管理
+ */
+@Controller
+@RequestMapping("/role")
+public class RoleCtrl {
+
+    @Autowired
+    RoleService roleService;
+
+    /**
+     * 获取角色列表
+     */
+    @RequestMapping("/getRolePageList")
+    @ResponseBody
+    public ResponseBodyVO<PageInfo<RoleVO>> getRolePageList(@RequestBody RoleParam pageParam){
+        ResponseBodyVO<PageInfo<RoleVO>> response = new ResponseBodyVO<PageInfo<RoleVO>>(ResponseBodyVO.Response.SUCCESS);
+        response.setInfo(roleService.getRolePageList(pageParam));
+        return response;
+    }
+
+    /**
+     * 新增、修改
+     */
+    @RequestMapping("/saveRole")
+    @ResponseBody
+    public ResponseBodyVO<RolePO> saveRole(@RequestBody RoleVO roleVO){
+        if(ObjectUtil.isNull(roleVO)){
+            return new ResponseBodyVO(false, 500, "参数必传!",null);
+        }
+        ResponseBodyVO<RolePO> response = new ResponseBodyVO<RolePO>(ResponseBodyVO.Response.SUCCESS);
+        response.setInfo(roleService.saveRole(roleVO));
+        return response;
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delRoleById")
+    @ResponseBody
+    public ResponseBodyVO delRoleById(@RequestBody RolePO rolePO){
+        int i = roleService.delRoleById(rolePO);
+        if(i>0){
+            return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
+        }else{
+            return new ResponseBodyVO(false, 500, "删除失败!",null);
+        }
+    }
+
+}

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/UserCtrl.java

@@ -17,7 +17,7 @@ public class UserCtrl {
     UserService userService;
 
     /**
-     * 获取当前登录人的菜单列表
+     * 获取当前登录人详情
      */
     @RequestMapping("/getUserInfo")
     @ResponseBody

+ 22 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/mapper/RoleMapper.java

@@ -0,0 +1,22 @@
+package com.css.simulation.resource.system.mapper;
+
+import api.common.pojo.param.system.RoleParam;
+import api.common.pojo.po.system.RolePO;
+import api.common.pojo.vo.system.RoleVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Mapper
+@Repository
+public interface RoleMapper {
+
+    List<RoleVO> getRolePageList(RoleParam pageParam);
+
+    void insert(RolePO po);
+
+    void update(RolePO po);
+
+    int delRoleById(RolePO rolePO);
+}

+ 48 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/system/service/RoleService.java

@@ -0,0 +1,48 @@
+package com.css.simulation.resource.system.service;
+
+import api.common.pojo.param.system.RoleParam;
+import api.common.pojo.po.system.RolePO;
+import api.common.pojo.vo.system.RoleVO;
+import api.common.util.ObjectUtil;
+import api.common.util.StringUtil;
+import com.css.simulation.resource.common.utils.PageUtil;
+import com.css.simulation.resource.common.utils.PoUtil;
+import com.css.simulation.resource.system.mapper.RoleMapper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class RoleService {
+
+    @Autowired
+    RoleMapper roleMapper;
+
+    public PageInfo<RoleVO> getRolePageList(RoleParam pageParam) {
+        PageUtil.setPageInfo(pageParam);
+        List<RoleVO> list = roleMapper.getRolePageList(pageParam);
+        return new PageInfo<>(list);
+    }
+
+    public RolePO saveRole(RoleVO roleVO) {
+        RolePO po = new RolePO();
+        ObjectUtil.voToPo(roleVO,po);
+        //常规字段赋值
+        PoUtil.initAddPo(po);
+        String id = po.getId();
+        if(ObjectUtil.isNull(id)){//新增
+            po.setId(StringUtil.getRandomUUID());
+            roleMapper.insert(po);
+        }else{
+            roleMapper.update(po);
+        }
+        return po;
+    }
+
+    public int delRoleById(RolePO rolePO) {
+        PoUtil.initDelPo(rolePO);
+        return roleMapper.delRoleById(rolePO);
+    }
+}

+ 26 - 0
simulation-resource-server/src/main/resources/mapper/project/SimulationProjectTaskMapper.xml

@@ -97,5 +97,31 @@
         </foreach>
     </select>
 
+    <!--更新仿真结果到数据库-->
+    <update id="updateTaksResult" parameterType="api.common.pojo.po.project.ManualProjectTaskPo">
+        update simulation_manual_project_task
+        set
+        mileage = #{mileage, jdbcType=VARCHAR},
+        average_velocity = #{averageVelocity, jdbcType=VARCHAR},
+        maximun_speed = #{maximunSpeed, jdbcType=VARCHAR},
+        minimun_velocity = #{minimunVelocity, jdbcType=VARCHAR},
+        maximum_acceleration = #{maximumAcceleration, jdbcType=VARCHAR},
+        maximum_deceleration = #{maximumDeceleration, jdbcType=VARCHAR},
+        maximum_swingSpeed = #{maximumSwingSpeed, jdbcType=VARCHAR},
+        speed_variance = #{speedVariance, jdbcType=VARCHAR},
+        swing_speed_mean_square_root = #{swingSpeedMeanSquareRoot, jdbcType=VARCHAR},
+        acceleration = #{acceleration, jdbcType=LONGVARCHAR},
+        lane_offset = #{laneOffset, jdbcType=LONGVARCHAR},
+        brake = #{brake, jdbcType=LONGVARCHAR},
+        steeting_wheel = #{steetingWheel, jdbcType=LONGVARCHAR},
+        throttle =  #{throttle, jdbcType=LONGVARCHAR},
+        yaw_rate = #{yawRate, jdbcType=LONGVARCHAR},
+        velocity = #{velocity, jdbcType=LONGVARCHAR},
+        other_curve = #{otherCurve, jdbcType=LONGVARCHAR},
+        timer_shaft = #{timerShaft, jdbcType=LONGVARCHAR}
+        where id = #{id, jdbcType=VARCHAR} and p_id = #{pId, jdbcType=VARCHAR} and is_deleted = '0'
+
+    </update>
+
 
 </mapper>

+ 75 - 0
simulation-resource-server/src/main/resources/mapper/system/RoleMapper.xml

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.css.simulation.resource.system.mapper.RoleMapper" >
+
+    <select id="getRolePageList" parameterType="api.common.pojo.param.system.RoleParam" resultType="api.common.pojo.vo.system.RoleVO">
+        SELECT
+            id,
+            role_name,
+            role_code,
+            description,
+            visible,
+            sort
+        FROM system_role
+        WHERE is_deleted = '0'
+        <if test="roleName != null and roleName != ''">
+            and c.role_name like CONCAT('%',#{roleName,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="roleCode != null and roleCode != ''">
+            and c.role_code like CONCAT('%',#{roleCode,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="visible != null and visible != ''">
+            and c.visible = #{roleName,jdbcType=VARCHAR}
+        </if>
+        ORDER BY sort
+    </select>
+
+    <insert id="insert" parameterType="api.common.pojo.po.system.RolePO">
+        INSERT INTO system_role(
+            id,
+            role_name,
+            role_code,
+            description,
+            visible,
+            sort,
+            create_time,
+            modify_time,
+            create_user_id,
+            modify_user_id,
+            is_deleted
+        )
+        VALUES(
+            #{id,jdbcType=VARCHAR},
+            #{roleName,jdbcType=VARCHAR},
+            #{roleCode,jdbcType=VARCHAR},
+            #{description,jdbcType=VARCHAR},
+            #{visible,jdbcType=VARCHAR},
+            #{sort,jdbcType=INTEGER},
+            #{createTime,jdbcType=TIMESTAMP},
+            #{modifyTime,jdbcType=TIMESTAMP},
+            #{createUserId,jdbcType=VARCHAR},
+            #{modifyUserId,jdbcType=VARCHAR},
+            #{isDeleted,jdbcType=VARCHAR}
+        )
+    </insert>
+
+    <update id="update" parameterType="api.common.pojo.po.system.RolePO">
+        update system_role set
+            role_name = #{roleName,jdbcType=VARCHAR},
+            role_code = #{roleCode,jdbcType=VARCHAR},
+            description = #{description,jdbcType=VARCHAR},
+            visible = #{visible,jdbcType=VARCHAR},
+            sort = #{sort,jdbcType=INTEGER},
+            modify_time = #{modifyTime,jdbcType=TIMESTAMP},
+            modify_user_id = #{modifyUserId,jdbcType=VARCHAR}
+        where id = #{id,jdbcType=VARCHAR}
+    </update>
+
+    <update id="delRoleById" parameterType="api.common.pojo.po.system.RolePO">
+        update system_role set
+          modify_time = #{modifyTime,jdbcType=TIMESTAMP},
+          modify_user_id = #{modifyUserId,jdbcType=VARCHAR},
+          is_deleted = #{isDeleted,jdbcType=VARCHAR}
+        where id = #{id,jdbcType=VARCHAR}
+    </update>
+</mapper>