管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-23 0c7ba7f5569fb6eb7da463fe3d4a74838ef739a3
src/main/java/com/lf/server/controller/data/upload/CheckController.java
@@ -5,6 +5,7 @@
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.all.StaticData;
import com.lf.server.entity.ctrl.FmeReqEntity;
import com.lf.server.helper.HttpHelper;
import com.lf.server.helper.PathHelper;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.data.FmeService;
@@ -13,6 +14,9 @@
import io.swagger.annotations.ApiOperation;
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.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -46,7 +50,7 @@
            return fmeService.getTaskStatus(id, req);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -60,7 +64,10 @@
        try {
            if (!StringHelper.isEmpty(id)) {
                String url = fmeService.getDownloadUrl(id, req);
                res.sendRedirect(url);
                HttpHelper httpHelper = new HttpHelper();
                // res.sendRedirect(url)
                httpHelper.service(req, res, url, null);
            }
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
@@ -69,8 +76,12 @@
    @SysLog()
    @ApiOperation(value = "提交数据质检")
    @GetMapping(value = "/uploadChecks")
    public ResponseMsg<Object> uploadChecks(FmeReqEntity entity, HttpServletRequest req) {
    @ApiImplicitParams({
            @ApiImplicitParam(name = "entity", value = "FME请求实体类", dataType = "FmeReqEntity", paramType = "body")
    })
    @ResponseBody
    @PostMapping(value = "/uploadChecks")
    public ResponseMsg<Object> uploadChecks(@RequestBody FmeReqEntity entity, HttpServletRequest req) {
        try {
            if (StringHelper.isEmpty(entity.names)) {
                return fail("任务名称不能为空");
@@ -98,14 +109,20 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
    /**
     * 获取文件路径
     */
    private String getFullPath(String filePath) {
        return null == filePath ? null : pathHelper.getConfig().getTempPath() + File.separator + filePath;
    }
    /**
     * 是/否为Zip文件
     */
    private boolean isZipFile(String filePath) {
        if (null == filePath || !filePath.toLowerCase().endsWith(StaticData.ZIP)) {
            return false;
@@ -116,6 +133,9 @@
        return zipFile.exists() && !zipFile.isDirectory();
    }
    /**
     * 是/否为Excel文件
     */
    private boolean isXlsFile(String filePath) {
        if (null == filePath) {
            return false;
@@ -163,7 +183,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -185,7 +205,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -207,7 +227,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -230,7 +250,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -252,7 +272,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -280,7 +300,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -302,7 +322,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -323,7 +343,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -347,7 +367,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -369,7 +389,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -391,7 +411,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -416,7 +436,59 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }*/
    @SysLog()
    @ApiOperation(value = "服务注册")
    @GetMapping(value = "/selectServerRegister")
    public ResponseMsg<Object> selectServerRegister(HttpServletRequest req) {
        try {
            String rs = fmeService.serverRegister("西气东输四线天然气管道工程(吐鲁番-中卫)(00116DT02)", "http://127.0.0.1/LFData/2d/tiles/01/{z}/{x}/{y}.png", "DOM", req);
            if (StringHelper.isEmpty(rs)) {
                return fail("失败");
            }
            return success(rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "服务申请")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "服务ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b"),
            @ApiImplicitParam(name = "pubid", value = "发布ID", dataType = "Integer", paramType = "query", example = "1"),
    })
    @GetMapping(value = "/serverApply")
    public ResponseMsg<Object> serverApply(String id, Integer pubid, HttpServletRequest req) {
        try {
            String rs = fmeService.serverApply(id, pubid, req);
            if (StringHelper.isEmpty(rs)) {
                return fail("失败");
            }
            return success(rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    @SysLog()
    @ApiOperation(value = "删除资源")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "服务ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b")
    })
    @GetMapping(value = "/deleteRes")
    public ResponseMsg<Object> deleteRes(String id, HttpServletRequest req) {
        try {
            fmeService.deleteRes(id, req);
            return success("OK");
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}