Commit 321e54a2 authored by zhangyingbin's avatar zhangyingbin

修改地图接口

parent 1b4db922
......@@ -5,12 +5,14 @@ import com.alibaba.fastjson.JSONObject;
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.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 项目信息表
......@@ -130,4 +132,7 @@ public class ProjectDto extends BaseDto {
private String userId;
private String context;
List<Weld> weldList;
List<List<Double>> weldLines;
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.entity.ProjectResource;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
......@@ -237,10 +238,10 @@ public class WeldController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getWeldListByLocation/{northeast}/{southwest}")
@ApiOperation(httpMethod = "GET", value = "", notes = "")
public ResponseModel<List<String>> getWeldListByLocation(@PathVariable( value = "northeast")Object object,@PathVariable( value = "southwest")Object obj){
return ResponseHelper.buildResponse(weldServiceImpl.getWeldListByLocation(object,obj));
@PostMapping(value = "/getWeldListByLocation")
@ApiOperation(httpMethod = "POST", value = "", notes = "")
public ResponseModel<List<ProjectDto>> getWeldListByLocation(@RequestBody Object obj){
return ResponseHelper.buildResponse(weldServiceImpl.getWeldListByLocation(obj));
}
}
......@@ -371,30 +371,37 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
/**
* 根据地图经纬度信息获取项目id
* @param object
* @param obj
* @param obj
* @return
*/
public List<String> getWeldListByLocation(Object object,Object obj){
JSONObject jsonObject = JSON.parseObject(String.valueOf(object));
Double leftLongitude = jsonObject.getDouble("longitude");
Double leftLatitude = jsonObject.getDouble("latitude");
JSONObject json = JSON.parseObject(String.valueOf(obj));
Double rightLongitude = json.getDouble("longitude");
Double rightLatitude = json.getDouble("latitude");
public List<ProjectDto> getWeldListByLocation(Object obj){
JSONObject jsonObject = JSON.parseObject(String.valueOf(obj));
JSONObject left = jsonObject.getJSONObject("northeast");
JSONObject right = jsonObject.getJSONObject("southwest");
Double leftLongitude = left.getDouble("longitude");
Double leftLatitude = left.getDouble("latitude");
Double rightLongitude = right.getDouble("longitude");
Double rightLatitude = right.getDouble("latitude");
List<ProjectDto> projectList = projectService.getProjectLocation();
List<String> projectIds = new ArrayList<>();
List<ProjectDto> projectDtos = new ArrayList<>();
List<Weld> weldList = new ArrayList<>();
for(ProjectDto projectDto:projectList){
if(!ValidationUtil.isEmpty(projectDto.getLatitude()) && !ValidationUtil.isEmpty(projectDto.getLongitude())) {
Double longitude = Double.valueOf(projectDto.getLongitude());
Double latitude = Double.valueOf(projectDto.getLatitude());
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