霍林河露天煤矿生产一体化平台
1
13693261870
2023-04-07 c6f05c53f1ccdef583017cce94759e2f0462646c
src/main/java/com/terra/coal/controller/MainController.java
@@ -1,6 +1,8 @@
package com.terra.coal.controller;
import com.terra.coal.entity.CountEntity;
import com.terra.coal.entity.ResponseMsg;
import com.terra.coal.entity.StaticData;
import com.terra.coal.helper.StringHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -11,11 +13,12 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import service.MainService;
import com.terra.coal.service.MainService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
/**
 * CoalController
@@ -45,7 +48,7 @@
        return mv;
    }
    @ApiOperation(value = "加载54数据入库")
    @ApiOperation(value = "加载54数据(入库)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "txtPath", value = "块体数据文件路径", dataType = "String", paramType = "query", example = "D:\\块体数据.txt")
    })
@@ -69,4 +72,30 @@
            return fail(ex.getMessage(), null);
        }
    }
    @ApiOperation(value = "根据范围统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "txtPath", value = "块体数据文件路径", dataType = "String", paramType = "query", example = "D:\\块体数据.txt")
    })
    @GetMapping(value = "/countByRange")
    public ResponseMsg<Object> countByRange(String wkt, double z, double deep) {
        try {
            if (StringHelper.isEmpty(wkt)) {
                return fail("请输入查询范围(WKT字符串)", null);
            }
            if (z < StaticData.MINUS_ONE_THOUSAND || z > StaticData.NINE_THOUSAND) {
                return fail("高度值超出范围(-1000~9000)", null);
            }
            if (deep < 1) {
                return fail("开挖深度过小", null);
            }
            List<CountEntity> rs = mainService.countByRange(wkt, z, deep);
            return success("成功", rs);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            return fail(ex.getMessage(), null);
        }
    }
}