Commit 321e54a2 authored by zhangyingbin's avatar zhangyingbin

修改地图接口

parent 1b4db922
...@@ -5,12 +5,14 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,12 +5,14 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company; import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project; import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 项目信息表 * 项目信息表
...@@ -130,4 +132,7 @@ public class ProjectDto extends BaseDto { ...@@ -130,4 +132,7 @@ public class ProjectDto extends BaseDto {
private String userId; private String userId;
private String context; private String context;
List<Weld> weldList;
List<List<Double>> weldLines;
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProjectDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldVerifyDto; import com.yeejoin.amos.boot.module.ugp.api.dto.WeldVerifyDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource; import com.yeejoin.amos.boot.module.ugp.api.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld; import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
...@@ -237,10 +238,10 @@ public class WeldController extends BaseController { ...@@ -237,10 +238,10 @@ public class WeldController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getWeldListByLocation/{northeast}/{southwest}") @PostMapping(value = "/getWeldListByLocation")
@ApiOperation(httpMethod = "GET", value = "", notes = "") @ApiOperation(httpMethod = "POST", value = "", notes = "")
public ResponseModel<List<String>> getWeldListByLocation(@PathVariable( value = "northeast")Object object,@PathVariable( value = "southwest")Object obj){ public ResponseModel<List<ProjectDto>> getWeldListByLocation(@RequestBody Object obj){
return ResponseHelper.buildResponse(weldServiceImpl.getWeldListByLocation(object,obj)); return ResponseHelper.buildResponse(weldServiceImpl.getWeldListByLocation(obj));
} }
} }
...@@ -371,30 +371,37 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements ...@@ -371,30 +371,37 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
/** /**
* 根据地图经纬度信息获取项目id * 根据地图经纬度信息获取项目id
* @param object * @param obj
* @param obj * @param obj
* @return * @return
*/ */
public List<String> getWeldListByLocation(Object object,Object obj){ public List<ProjectDto> getWeldListByLocation(Object obj){
JSONObject jsonObject = JSON.parseObject(String.valueOf(object)); JSONObject jsonObject = JSON.parseObject(String.valueOf(obj));
Double leftLongitude = jsonObject.getDouble("longitude"); JSONObject left = jsonObject.getJSONObject("northeast");
Double leftLatitude = jsonObject.getDouble("latitude"); JSONObject right = jsonObject.getJSONObject("southwest");
JSONObject json = JSON.parseObject(String.valueOf(obj)); Double leftLongitude = left.getDouble("longitude");
Double rightLongitude = json.getDouble("longitude"); Double leftLatitude = left.getDouble("latitude");
Double rightLatitude = json.getDouble("latitude"); Double rightLongitude = right.getDouble("longitude");
Double rightLatitude = right.getDouble("latitude");
List<ProjectDto> projectList = projectService.getProjectLocation(); List<ProjectDto> projectList = projectService.getProjectLocation();
List<String> projectIds = new ArrayList<>(); List<String> projectIds = new ArrayList<>();
List<ProjectDto> projectDtos = new ArrayList<>();
List<Weld> weldList = new ArrayList<>();
for(ProjectDto projectDto:projectList){ for(ProjectDto projectDto:projectList){
if(!ValidationUtil.isEmpty(projectDto.getLatitude()) && !ValidationUtil.isEmpty(projectDto.getLongitude())) { if(!ValidationUtil.isEmpty(projectDto.getLatitude()) && !ValidationUtil.isEmpty(projectDto.getLongitude())) {
Double longitude = Double.valueOf(projectDto.getLongitude()); Double longitude = Double.valueOf(projectDto.getLongitude());
Double latitude = Double.valueOf(projectDto.getLatitude()); Double latitude = Double.valueOf(projectDto.getLatitude());
if (rightLongitude < longitude && longitude < leftLongitude && rightLatitude < latitude && latitude < leftLatitude) { if (rightLongitude < longitude && longitude < leftLongitude && rightLatitude < latitude && latitude < leftLatitude) {
projectIds.add(String.valueOf(projectDto.getSequenceNbr())); projectDtos.add(projectDto);
} }
} }
} }
return projectIds; for(ProjectDto projectDto : projectDtos){
projectDto.setWeldList(this.list(new LambdaQueryWrapper<Weld>().eq(Weld::getProjectId,projectDto.getSequenceNbr())));
projectDto.setWeldLines(getWeldCode(String.valueOf(projectDto.getSequenceNbr())));
}
return projectDtos;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment