提交
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package com.mosty.yjzl.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwSaveDTO;
|
||||
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwUpdateDTO;
|
||||
import com.mosty.base.model.query.yjzl.TbZdxlFgdwQuery;
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
|
||||
@ -20,7 +21,9 @@ import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhangzhao
|
||||
@ -91,6 +94,36 @@ public class TbZdxlFgdwController {
|
||||
return ResponseResult.success(tbZdxlFgdwService.selectList(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增单条
|
||||
* @param dto 保存DTO对象
|
||||
* @param bindResult 校验对象
|
||||
* @return ResponseResult 实体主键ID
|
||||
*/
|
||||
@ApiOperation(value = "新增单条")
|
||||
@PostMapping("/save")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位接口-新增单条", businessType = BusinessType.INSERT)
|
||||
public ResponseResult<Long> save(@RequestBody @Valid TbZdxlFgdwSaveDTO dto, BindingResult bindResult){
|
||||
try {
|
||||
//基础信息校验
|
||||
String message = SpringValidUtils.getErrorsMsg(bindResult);
|
||||
if (StringUtils.isNotBlank(message)) {
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg() + message);
|
||||
}
|
||||
|
||||
//新增
|
||||
Long resultId = tbZdxlFgdwService.saveEntity(dto);
|
||||
if(ObjectUtils.isNotEmpty(resultId)){
|
||||
return ResponseResult.success(resultId);
|
||||
}
|
||||
return ResponseResult.fail(MessageUtils.getSaveFailMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResponseResult.fail(MessageUtils.getSaveServerErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改单条
|
||||
* @param dto 修改DTO对象
|
||||
@ -121,4 +154,22 @@ public class TbZdxlFgdwController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取正方形四个点位
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @param distance 范围(米),半径
|
||||
* @return ResponseResult 正方形四个角点坐标
|
||||
*/
|
||||
@ApiOperation(value = "根据经纬度获取正方形四个点位")
|
||||
@GetMapping("/getSquarePoints")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位接口-获取正方形点位", businessType = BusinessType.OTHER)
|
||||
public ResponseResult<Map<String, BigDecimal>> getSquarePoints(
|
||||
@RequestParam("longitude") Double longitude,
|
||||
@RequestParam("latitude") Double latitude,
|
||||
@RequestParam(value = "distance", defaultValue = "500") Double distance) {
|
||||
return ResponseResult.success(tbZdxlFgdwService.getSquarePoints(longitude, latitude, distance));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user