| | |
| | | import com.lf.server.entity.ctrl.FmeReqEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.service.data.FmeService; |
| | | 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; |
| | |
| | | protected FmeService fmeService; |
| | | |
| | | @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不能为空"); |
| | | } |
| | | |
| | | Object obj = fmeService.getTaskStatus(id, req); |
| | | |
| | | return obj; |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询OSGB检查") |
| | | @GetMapping(value = "/selectCheckOsgb") |
| | | public ResponseMsg<Object> selectCheckOsgb(HttpServletRequest req) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取错误信息 |
| | | * |
| | | * @param uri Uri地址 |
| | | * @param ex 异常 |
| | | * @return 错误信息 |
| | | */ |
| | | public static String getErrorInfo(String uri, Exception ex) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("result", null); |
| | | map.put("message", ex.getMessage()); |
| | | map.put("code", 400); |
| | | map.put("uri", uri); |
| | | //map.put("tag", StaticData.CACHE_PREFIX) |
| | | |
| | | return map.toString(); |
| | | } |
| | | |
| | | /** |
| | | * GET请求(REST) |
| | | */ |
| | | public static String getForRest(String uri) { |
| | | RestTemplate rest = getRestTemplate(); |
| | | |
| | | return rest.getForObject(uri, String.class); |
| | | } |
| | | |
| | | /** |
| | | * GET请求(REST) |
| | | */ |
| | | public static <T> T getForRest(String uri, Class<T> clazz) { |
| | | RestTemplate rest = getRestTemplate(); |
| | | |
| | | return rest.getForObject(uri, clazz); |
| | | } |
| | | |
| | | /** |
| | |
| | | RestTemplate rest = getRestTemplate(); |
| | | |
| | | return rest.postForObject(uri, list, String.class); |
| | | } |
| | | |
| | | /** |
| | | * 获取错误信息 |
| | | * |
| | | * @param uri Uri地址 |
| | | * @param ex 异常 |
| | | * @return 错误信息 |
| | | */ |
| | | public static String getErrorInfo(String uri, Exception ex) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("result", null); |
| | | map.put("message", ex.getMessage()); |
| | | map.put("code", 400); |
| | | map.put("uri", uri); |
| | | //map.put("tag", StaticData.CACHE_PREFIX) |
| | | |
| | | return map.toString(); |
| | | } |
| | | } |
| | |
| | | import com.lf.server.entity.ctrl.NameValueEntity; |
| | | import com.lf.server.helper.RestHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | |
| | | private String fmeUrl; |
| | | |
| | | /** |
| | | * 获取任务状态 |
| | | */ |
| | | public Object getTaskStatus(String id, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/get", req) + "&id=" + id; |
| | | |
| | | return RestHelper.getForRest(url, Object.class); |
| | | } |
| | | |
| | | /** |
| | | * 1.OSGB检查:.osgb + *倾斜摄影*.xls/.xlsx |
| | | */ |
| | | public String checkOsgb(FmeReqEntity fme, HttpServletRequest req) { |