Selaa lähdekoodia

上传坐标定位接口

master
鲲鹏 4 vuotta sitten
vanhempi
commit
6f5b4d85b4
4 muutettua tiedostoa jossa 96 lisäystä ja 2 poistoa
  1. +19
    -2
      src/main/java/com/taauav/api/controller/InspectAppPointController.java
  2. +26
    -0
      src/main/java/com/taauav/api/dto/InspectAppPointDto.java
  3. +10
    -0
      src/main/java/com/taauav/api/service/IInspectAppPointService.java
  4. +41
    -0
      src/main/java/com/taauav/api/service/impl/InspectAppPointServiceImpl.java

+ 19
- 2
src/main/java/com/taauav/api/controller/InspectAppPointController.java Näytä tiedosto

@@ -1,9 +1,12 @@
package com.taauav.api.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import com.taauav.api.dto.InspectAppPointDto;
import com.taauav.api.service.IInspectAppPointService;
import com.taauav.common.bean.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.bind.annotation.RestController;
import com.taauav.api.controller.ApiBaseController;

/**
@@ -18,4 +21,18 @@ import com.taauav.api.controller.ApiBaseController;
@RequestMapping("/user/inspectapppoint")
public class InspectAppPointController extends ApiBaseController {

@Autowired
private IInspectAppPointService inspectAppPointService;

/**
* 上传坐标定位
*
* @param inspectAppPointDto 参数
* @return
*/
@PostMapping("/createAppPoint")
public Response createAppPoint(@RequestBody InspectAppPointDto inspectAppPointDto) {
return inspectAppPointService.createAppPoint(inspectAppPointDto);
}

}

+ 26
- 0
src/main/java/com/taauav/api/dto/InspectAppPointDto.java Näytä tiedosto

@@ -0,0 +1,26 @@
package com.taauav.api.dto;

import lombok.Data;

/**
* 巡检坐标定位
*/
@Data
public class InspectAppPointDto {

/**
* 巡检APP任务ID
*/
private Integer inspectAppId;

/**
* 经度
*/
private String x;

/**
* 纬度
*/
private String y;

}

+ 10
- 0
src/main/java/com/taauav/api/service/IInspectAppPointService.java Näytä tiedosto

@@ -2,6 +2,8 @@ package com.taauav.api.service;

import com.taauav.admin.entity.TauvInspectAppPoint;
import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.api.dto.InspectAppPointDto;
import com.taauav.common.bean.Response;

import java.util.List;

@@ -15,6 +17,14 @@ import java.util.List;
*/
public interface IInspectAppPointService extends IService<TauvInspectAppPoint> {

/**
* 创建巡检坐标定位
*
* @param inspectAppPointDto 巡检ID
* @return
*/
Response createAppPoint(InspectAppPointDto inspectAppPointDto);

/**
* 获取巡任务坐标列表
*

+ 41
- 0
src/main/java/com/taauav/api/service/impl/InspectAppPointServiceImpl.java Näytä tiedosto

@@ -2,9 +2,15 @@ package com.taauav.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.taauav.admin.entity.TauvInspectAppPoint;
import com.taauav.api.dto.InspectAppPointDto;
import com.taauav.api.mapper.InspectAppPointMapper;
import com.taauav.api.service.IInspectAppPointService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.common.bean.Response;
import com.taauav.common.util.DateUtil;
import com.taauav.common.util.ShiroUtils;
import com.taauav.common.util.StringUtils;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@@ -23,6 +29,41 @@ public class InspectAppPointServiceImpl extends ServiceImpl<InspectAppPointMappe

@Autowired
private InspectAppPointMapper inspectAppPointMapper;
@Autowired
private Response response;

/**
* 创建巡检坐标定位
*
* @param inspectAppPointDto 参数
* @return
*/
@Override
public Response createAppPoint(InspectAppPointDto inspectAppPointDto) {
// 巡检任务ID
if (inspectAppPointDto.getInspectAppId() == null || inspectAppPointDto.getInspectAppId() <= 0) {
return response.failure("巡检任务ID不能为空");
}
// 经度
if (StringUtils.isEmpty(inspectAppPointDto.getX())) {
return response.failure("经度不能为空");
}
// 纬度
if (StringUtils.isEmpty(inspectAppPointDto.getY())) {
return response.failure("纬度不能为空");
}
TauvInspectAppPoint entity = new TauvInspectAppPoint();
entity.setInspectAppId(inspectAppPointDto.getInspectAppId());
entity.setX(inspectAppPointDto.getX());
entity.setY(inspectAppPointDto.getY());
entity.setCreateUser(ShiroUtils.getAdminId());
entity.setCreateTime(DateUtil.now());
int result = inspectAppPointMapper.insert(entity);
if (result == 0) {
return response.failure("坐标上传失败");
}
return response.success("坐标上传成功");
}

/**
* 获取巡检坐标列表

Loading…
Peruuta
Tallenna