修改--根据AR端传递的坐标返回资源位内容
This commit is contained in:
parent
36be217a43
commit
4b245206bc
@ -1,8 +1,11 @@
|
||||
package com.ruoyi.web.controller.app;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.domain.SysScenic;
|
||||
import com.ruoyi.system.domain.SysSource;
|
||||
import com.ruoyi.system.domain.dto.ARSourceDto;
|
||||
import com.ruoyi.system.domain.dto.Coordinate;
|
||||
import com.ruoyi.system.domain.dto.ShowSysSourceARListDto;
|
||||
import com.ruoyi.system.domain.dto.ShowSysSourceListDto;
|
||||
import com.ruoyi.system.service.ISysSourceService;
|
||||
@ -13,11 +16,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/ar")
|
||||
public class AppARController {
|
||||
public class AppARController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysSourceService sysSourceService;
|
||||
@ -30,19 +34,26 @@ public class AppARController {
|
||||
|
||||
// 发布--获取系统资源位列表, 附带搜索功能
|
||||
@PostMapping("/getAllSource")
|
||||
public AjaxResult getAllSource(@RequestBody SysSource sysSource) {
|
||||
public AjaxResult getAllSource(@RequestBody ARSourceDto sysSource) {
|
||||
|
||||
// SysSource sysSource_1 = new SysSource();
|
||||
|
||||
System.out.println("AR发送数据: "+sysSource.getCity()+sysSource.getScenic());
|
||||
|
||||
List<ShowSysSourceARListDto> showSysSourceList = sysSourceService.getSysSourceARList(sysSource);
|
||||
List<Coordinate> coordinates = sysSource.getCoordinates();
|
||||
|
||||
|
||||
List<ShowSysSourceARListDto> showSysSourceList = sysSourceService.getARSource(sysSource.getCity(), sysSource.getScenic(), coordinates);
|
||||
|
||||
// List<ShowSysSourceARListDto> showSysSourceList = sysSourceService.getSysSourceARList(sysSource);
|
||||
//
|
||||
//
|
||||
AjaxResult ajaxResult = AjaxResult.success();
|
||||
|
||||
ajaxResult.put("sourceList", showSysSourceList);
|
||||
|
||||
return ajaxResult;
|
||||
|
||||
// return success();
|
||||
}
|
||||
@PostMapping("/getPeople")
|
||||
public String getAR(){
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ARSourceDto {
|
||||
private String city;
|
||||
private String scenic;
|
||||
private List<Coordinate> coordinates;
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getScenic() {
|
||||
return scenic;
|
||||
}
|
||||
|
||||
public void setScenic(String scenic) {
|
||||
this.scenic = scenic;
|
||||
}
|
||||
|
||||
public List<Coordinate> getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates(List<Coordinate> coordinates) {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Coordinate {
|
||||
private Integer x;
|
||||
private Integer y;
|
||||
// getters/setters
|
||||
|
||||
// 方法 2:定义接受数组的构造函数
|
||||
@JsonCreator
|
||||
public Coordinate(List<Integer> array) {
|
||||
if (array.size() >= 2) {
|
||||
this.x = array.get(0);
|
||||
this.y = array.get(1);
|
||||
} else {
|
||||
throw new IllegalArgumentException("坐标必须为 [x, y] 格式");
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(Integer x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public Integer getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(Integer y) {
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
@ -94,4 +94,9 @@ public interface ISysSourceService
|
||||
* 查看我的发布资源位详情
|
||||
* */
|
||||
public List<UserPublishWorkSourceListDto> getUserPublishWorkSourceList(Long workId);
|
||||
|
||||
/**
|
||||
* 按xy坐标返回AR资源位图片
|
||||
* */
|
||||
public List<ShowSysSourceARListDto> getARSource(String city, String scenic, List<Coordinate> coordinates);
|
||||
}
|
||||
|
||||
@ -135,4 +135,12 @@ public class SysSourceServiceImpl implements ISysSourceService
|
||||
public List<ShowSysSourceARListDto> getSysSourceARList(SysSource sysSource){
|
||||
return sysSourceMapper.getSysSourceARList(sysSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按xy坐标返回AR资源位图片
|
||||
* */
|
||||
@Override
|
||||
public List<ShowSysSourceARListDto> getARSource(String city, String scenic, List<Coordinate> coordinates){
|
||||
return sysSourceMapper.getARSource(city, scenic, coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,6 +175,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="workId != null "> and s.work_id = #{workId}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getARSource" resultMap="ShowSysSourceARListDtoResult">
|
||||
select s.source_id, s.c_x, s.c_y, s.source_status, s.part, s.work_address, w.work_name, w.detail
|
||||
from sys_source s
|
||||
left join user_work w
|
||||
on s.work_id = w.work_id
|
||||
|
||||
<where>
|
||||
|
||||
<if test="city != null and city != ''"> and s.city = #{city}</if>
|
||||
|
||||
<if test="scenic != null and scenic != ''"> and s.scenic = #{scenic}</if>
|
||||
<if test="coordinates != null and !coordinates.isEmpty()">
|
||||
AND (s.c_x, s.c_y) IN
|
||||
<foreach
|
||||
collection="coordinates"
|
||||
item="point"
|
||||
open="("
|
||||
separator=","
|
||||
close=")"
|
||||
>
|
||||
<!-- 使用 _parameter 直接访问当前项 -->
|
||||
(#{point.x}, #{point.y})
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<!-- <if test="coordinate != null and coordinate != ''"> and coordinate = #{coordinate}</if>-->
|
||||
<!-- <if test="c != null and part != ''"> and s.part = #{part}</if>-->
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<insert id="insertSysSource" parameterType="SysSource" useGeneratedKeys="true" keyProperty="sourceId">
|
||||
insert into sys_source
|
||||
|
||||
Loading…
Reference in New Issue
Block a user