From 7ce82b491f9cd097fe70aae37d1ad3dff3779e72 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 21 二月 2023 14:24:43 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/controller/all/CrdsController.java | 97 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 85 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/lf/server/controller/all/CrdsController.java b/src/main/java/com/lf/server/controller/all/CrdsController.java index d64ffac..704fde6 100644 --- a/src/main/java/com/lf/server/controller/all/CrdsController.java +++ b/src/main/java/com/lf/server/controller/all/CrdsController.java @@ -2,18 +2,23 @@ import com.lf.server.annotation.SysLog; import com.lf.server.entity.all.ResponseMsg; +import com.lf.server.entity.all.StaticData; import com.lf.server.entity.data.DirEntity; +import com.lf.server.helper.HttpHelper; +import com.lf.server.helper.StringHelper; import com.lf.server.service.data.DirService; -import com.lf.server.service.sys.RoleService; -import com.lf.server.service.sys.TokenService; -import com.lf.server.service.sys.UserService; +import com.lf.server.service.data.FmeService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; 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.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -25,16 +30,10 @@ @RequestMapping("/crds") public class CrdsController extends BaseController { @Autowired - UserService userService; - - @Autowired - RoleService roleService; - - @Autowired - TokenService tokenService; - - @Autowired DirService dirService; + + @Autowired + FmeService fmeService; @SysLog() @ApiOperation(value = "鏌ヨ椤圭洰") @@ -61,4 +60,78 @@ return fail(ex.getMessage(), null); } } + + @SysLog() + @ApiOperation(value = "鏌ヨ浠诲姟鐘舵��") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") + }) + @GetMapping(value = "/selectTaskStatus") + public Object selectTaskStatus(String id, HttpServletRequest req) { + try { + if (StringHelper.isEmpty(id)) { + return fail("id涓嶈兘涓虹┖"); + } + + return fmeService.getTaskStatus(id, req); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "璇锋眰鎵撳寘") + @ApiImplicitParams({ + @ApiImplicitParam(name = "dirId", value = "鐩綍ID", dataType = "Integer", paramType = "57"), + @ApiImplicitParam(name = "major", value = "涓撲笟", dataType = "String", paramType = "绌胯法瓒�"), + @ApiImplicitParam(name = "isCut", value = "鏄惁瑁佸壀", dataType = "String", paramType = "NO") + }) + @GetMapping(value = "/uploadReqPackaging") + public ResponseMsg<Object> uploadReqPackaging(Integer dirId, String major, String isCut, HttpServletRequest req) { + try { + if (null == dirId || dirId < StaticData.TWO) { + return fail("鐩綍ID涓嶈兘涓虹┖涓斿ぇ浜�1"); + } + + boolean isMajor = StaticData.CROSSING.equals(major) || StaticData.ROUTE.equals(major); + if (!isMajor) { + return fail("涓撲笟鍙兘鏄�滅┛璺ㄨ秺鈥濇垨鈥滅嚎璺��"); + } + + boolean bCut = StaticData.YES.equals(isCut) || StaticData.NO.equals(isCut); + if (!bCut) { + return fail("鏄惁瑁佸壀鍙兘鏄�淵ES鈥濇垨鈥淣O鈥�"); + } + + DirEntity dir = dirService.selectDir(dirId); + if (null == dir) { + return fail("鐩綍(id = " + dirId + ")涓嶅瓨鍦�"); + } + + String id = fmeService.crdsPackaging(dir.getFullName(), major, isCut, req); + + return success(id); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "浠诲姟ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4") + }) + @GetMapping(value = "/downloadFile") + public void downloadResult(String id, HttpServletRequest req, HttpServletResponse res) { + try { + if (!StringHelper.isEmpty(id)) { + String url = fmeService.getDownloadUrl(id, req); + + HttpHelper httpHelper = new HttpHelper(); + httpHelper.service(req, res, url, null); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } } -- Gitblit v1.9.3