jinpengyong
2024-04-22 4b4a35fc7cc56a8b304ca35f0a9ec0bdd2e0e036
screen-manage/src/main/java/com/moral/api/controller/ManageCoordinateDetailController.java
@@ -2,6 +2,8 @@
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;
@@ -9,6 +11,9 @@
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;
@@ -29,17 +34,20 @@
    /**
     * 新增经纬度点
     * @param manageCoordinateDetail
     * @param
     * @return
     */
    @PostMapping("insert")
    public ResultMessage insert(@RequestBody ManageCoordinateDetail manageCoordinateDetail){
        if (ObjectUtils.isEmpty(manageCoordinateDetail)){
    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(manageCoordinateDetail);
        if (integer==null){
        Integer integer = manageCoordinateDetailService.insertCoordinate(params);
        if (integer==1){
            return ResultMessage.ok("经纬度已存在");
        }
        if (integer==2){
            return ResultMessage.ok("经纬度不存在");
        }
        return ResultMessage.ok();
    }
@@ -49,8 +57,21 @@
     * @return
     */
    @PostMapping("batch")
    public ResultMessage  getInserts(){
        return null;
    @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);
    }
    /**
@@ -64,27 +85,35 @@
    }
    /**
     * 删除经纬度点
     * @param id
     * @return
     */
    @GetMapping("delete")
    public ResultMessage delete(Integer id){
        if (id==null){
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
        manageCoordinateDetailService.deleteCoordinate(id);
        return ResultMessage.ok();
    }
    /**
     * 查询坐标点
     * @return
     */
    @GetMapping("select")
    public ResultMessage selectAll(){
        return null;
    @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();
    }
}