| package com.moral.api.controller; | 
|   | 
|   | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiImplicitParam; | 
| import io.swagger.annotations.ApiImplicitParams; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.GetMapping; | 
| import org.springframework.web.bind.annotation.PostMapping; | 
| import org.springframework.web.bind.annotation.RequestBody; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.RestController; | 
|   | 
| import java.util.List; | 
| import java.util.Map; | 
|   | 
| import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | 
| import com.moral.api.entity.ManageCoordinateDetail; | 
| import com.moral.api.service.ManageCoordinateDetailService; | 
| import com.moral.constant.ResponseCodeEnum; | 
| import com.moral.constant.ResultMessage; | 
|   | 
|   | 
| @Slf4j | 
| @RestController | 
| @Api(tags = {"添加经纬度模块"}) | 
| @RequestMapping("coordinateDetail") | 
| public class ManageCoordinateDetailController { | 
|   | 
|   | 
|     @Autowired | 
|     private ManageCoordinateDetailService manageCoordinateDetailService; | 
|   | 
|     /** | 
|      * 新增经纬度点 | 
|      * @param | 
|      * @return | 
|      */ | 
|     @PostMapping("insert") | 
|     public ResultMessage insert(@RequestBody Map<String,Object> params){ | 
|         if (ObjectUtils.isEmpty(params)){ | 
|             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|         } | 
|         Integer integer = manageCoordinateDetailService.insertCoordinate(params); | 
|         if (integer==1){ | 
|             return ResultMessage.ok("经纬度已存在"); | 
|         } | 
|         if (integer==2){ | 
|             return ResultMessage.ok("经纬度不存在"); | 
|         } | 
|         return ResultMessage.ok(); | 
|     } | 
|   | 
|     /** | 
|      * 批量新增 | 
|      * @return | 
|      */ | 
|     @PostMapping("batch") | 
|     @ApiImplicitParams(value = { | 
|             @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), | 
|             @ApiImplicitParam(name = "coordinateId", value = "路段id", required = true, paramType = "query", dataType = "String"), | 
|             @ApiImplicitParam(name = "time1", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String"), | 
|             @ApiImplicitParam(name = "time2", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String") | 
|     }) | 
|     public ResultMessage  getInserts(@RequestBody Map<String,Object> params){ | 
|         if (!params.containsKey("coordinateId")) { | 
|             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|         } | 
|         Integer integer = manageCoordinateDetailService.batchAll(params); | 
|         if (integer!=200){ | 
|             return ResultMessage.ok("操作失败"); | 
|         } | 
|          return ResultMessage.ok(integer); | 
|     } | 
|   | 
|     /** | 
|      * 修改经纬度点 | 
|      * @param manageCoordinateDetail | 
|      * @return | 
|      */ | 
|     @PostMapping("update") | 
|     public ResultMessage update(@RequestBody ManageCoordinateDetail manageCoordinateDetail){ | 
|         return null; | 
|     } | 
|   | 
|   | 
|   | 
|     /** | 
|      * 查询坐标点 | 
|      * @return | 
|      */ | 
|     @PostMapping("select") | 
|     @ApiImplicitParams(value = { | 
|             @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), | 
|             @ApiImplicitParam(name = "coordinateId", value = "路段id", required = true, paramType = "query", dataType = "String"), | 
|             @ApiImplicitParam(name = "time1", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String"), | 
|             @ApiImplicitParam(name = "time2", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String") | 
|     }) | 
|     public ResultMessage selectAll(@RequestBody Map<String,Object> params){ | 
|         if (!params.containsKey("coordinateId") || !params.containsKey("time1")|| !params.containsKey("time2")|| !params.containsKey("mac")) { | 
|             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|         } | 
|         Map<String,Object> rsMap = manageCoordinateDetailService.selectCoordinate(params); | 
|         return ResultMessage.ok(rsMap); | 
|     } | 
|   | 
|     @PostMapping("queryAll") | 
|     @ApiImplicitParams(value = { | 
|             @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), | 
|             @ApiImplicitParam(name = "mac", value = "mac号", required = true, paramType = "query", dataType = "String"), | 
|             @ApiImplicitParam(name = "time1", value = "开始时间,2021-08-18", required = true, paramType = "query", dataType = "String"), | 
|             @ApiImplicitParam(name = "time2", value = "结束时间,2021-08-18", required = true, paramType = "query", dataType = "String") | 
|     }) | 
|     public ResultMessage queryAll(@RequestBody Map<String,Object> params){ | 
|         manageCoordinateDetailService.queryAll(params); | 
|         return ResultMessage.ok(); | 
|     } | 
| } |