|
@@ -106,18 +106,25 @@ public class SimulationMapServiceImpl implements SimulationMapService {
|
|
|
for (SimulationMapPathVO pathDetail: simulationMapPathPOS) {
|
|
|
String pathStartPoint = pathDetail.getPathStartPoint();
|
|
|
String pathEndPoint = pathDetail.getPathEndPoint();
|
|
|
+ String section = pathDetail.getPathDetail();
|
|
|
List<JSONObject> startArr = new ArrayList<>();
|
|
|
List<JSONObject> endArr = new ArrayList<>();
|
|
|
+ List<JSONObject> pathDetailArr = new ArrayList<>();
|
|
|
JSONArray arrayStart = JSONArray.parseArray(pathStartPoint);
|
|
|
JSONArray arrayEnd = JSONArray.parseArray(pathEndPoint);
|
|
|
+ JSONArray array = JSONArray.parseArray(section);
|
|
|
for (int i = 0; i < arrayStart.size(); i++) {
|
|
|
startArr.add(arrayStart.getJSONObject(i));
|
|
|
}
|
|
|
for (int i = 0; i < arrayEnd.size(); i++) {
|
|
|
endArr.add(arrayEnd.getJSONObject(i));
|
|
|
}
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ pathDetailArr.add(array.getJSONObject(i));
|
|
|
+ }
|
|
|
pathDetail.setStartPoints(startArr);
|
|
|
pathDetail.setEndPoints(endArr);
|
|
|
+ pathDetail.setSections(pathDetailArr);
|
|
|
}
|
|
|
simulationMapVO.setPath(simulationMapPathPOS);
|
|
|
simulationMapVO.setMapJsonPathNum(simulationMapPathPOS.size());
|
|
@@ -163,7 +170,7 @@ public class SimulationMapServiceImpl implements SimulationMapService {
|
|
|
|
|
|
@SneakyThrows
|
|
|
@Transactional
|
|
|
- public ResponseBodyVO uploadSimulationMap(MultipartFile fileJson, MultipartFile fileDriver, SimulationMapParam param){
|
|
|
+ public ResponseBodyVO uploadSimulationMap(MultipartFile fileJson, MultipartFile fileOsgb, 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, "当前用户无该权限");
|
|
@@ -188,10 +195,18 @@ public class SimulationMapServiceImpl implements SimulationMapService {
|
|
|
if (!response.isStatus()){
|
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "上传失败");
|
|
|
}
|
|
|
-
|
|
|
+ String osgbFileName = fileOsgb.getOriginalFilename();
|
|
|
+ if (osgbFileName == null){
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "文件名为空,请检查!");
|
|
|
+ }
|
|
|
+ fileName = "/" + DictConstants.MAP_DRIVER_FILE + "/" + nowTime + "/" + randomCode + "/" + osgbFileName;
|
|
|
+ ResponseBodyVO<String> responseOs = fileDownService.upload(fileDriver, fileName);
|
|
|
+ if (!responseOs.isStatus()){
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "上传失败");
|
|
|
+ }
|
|
|
String previewUrl = response.getInfo();
|
|
|
SimulationMapPO simulationMapPO = new SimulationMapPO();
|
|
|
- simulationMapPO.setMapPath(previewUrl).setMapName(param.getMapName()).setMapDescription(param.getMapDescription())
|
|
|
+ simulationMapPO.setMapPath(previewUrl).setMapOsgbPath(responseOs.getInfo()).setMapName(param.getMapName()).setMapDescription(param.getMapDescription())
|
|
|
.setMapJson(object.toJSONString()).setPathNum(param.getPathNum()).setMapCode("").setId(StringUtil.getRandomUUID());
|
|
|
int i = mapMapper.addSimulationMap(simulationMapPO);
|
|
|
if (i <= 0){
|
|
@@ -205,7 +220,8 @@ public class SimulationMapServiceImpl implements SimulationMapService {
|
|
|
for (int j = 0; j < jsonArray.size(); j++) {
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(j);
|
|
|
SimulationMapPathPO simulationMapPathPO = new SimulationMapPathPO();
|
|
|
- simulationMapPathPO.setId(StringUtil.getRandomUUID()).setMapId(mapPOId).setPathSort(j).setPathDetail(jsonObject.getString("roadIds"))
|
|
|
+ simulationMapPathPO.setId(StringUtil.getRandomUUID()).setMapId(mapPOId)
|
|
|
+ .setPathSort(jsonObject.getInteger("pathId")).setPathDetail(jsonObject.getJSONArray("sections").toJSONString())
|
|
|
.setStartPointNum(jsonObject.getInteger("numOfStartPoints")).setPathStartPoint(jsonObject.getJSONArray("startPoints").toJSONString())
|
|
|
.setEndPointNum(jsonObject.getInteger("numOfEndPoints")).setPathEndPoint(jsonObject.getJSONArray("endPoints").toJSONString());
|
|
|
int i1 = mapPathMapper.addSimulationMap(simulationMapPathPO);
|