diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java index 199a299..c70bee6 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/IdcController.java @@ -1,40 +1,22 @@ package com.glxp.sale.admin.idc.controller; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; -import java.util.Objects; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import cn.hutool.core.io.IoUtil; -import cn.hutool.core.util.StrUtil; -import com.glxp.sale.admin.idc.service.DownloadRestTemplate; -import com.glxp.sale.admin.idc.utils.UriUtils; -import com.glxp.sale.admin.service.param.SystemParamConfigService; -import lombok.extern.slf4j.Slf4j; -import org.apache.tomcat.util.http.fileupload.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.http.*; -import org.springframework.http.client.ClientHttpRequest; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.client.RequestCallback; import org.springframework.web.client.RestTemplate; import org.springframework.web.multipart.MultipartFile; @@ -42,8 +24,13 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.glxp.sale.admin.idc.dao.DbDao; import com.glxp.sale.admin.idc.service.IdcService; +import com.glxp.sale.admin.idc.utils.UriUtils; +import com.glxp.sale.admin.service.param.SystemParamConfigService; import com.glxp.sale.common.res.BaseResponse; +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; + /** * 中继服务接口 @@ -78,6 +65,7 @@ public class IdcController { //@Log("数据同步任务列表拉取") @RequestMapping(value = "/spssync/common/list") + @ResponseBody public BaseResponse list(HttpServletRequest request, @RequestBody(required = false) Map params) { return idcService.taskList(request, params); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java index a0b74e5..c929aef 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java @@ -132,10 +132,10 @@ public class IdcServiceImpl implements IdcService { @Override public void asyncFetchTask() { - Map query = new HashMap(); String host = getNextHost(); + logger.info("fetch from ip:"+host); if(!StringUtils.isEmpty(host)) { - String result = post(host+"/spssync/common/list",query); + String result = post(host+"/spssync/common/list",null); logger.info("fetchTask--->"+result); if(IDCUtils.isJson(result)) { JSONObject json = JSON.parseObject(result); @@ -145,7 +145,7 @@ public class IdcServiceImpl implements IdcService { for(Map map:list) { Map params = new HashMap(); params.put("taskId", map.get("taskId")); - fetchData(host+"/spssync/common/list",params); + fetchData(host+"/spssync/common/download",params); } } } @@ -267,6 +267,7 @@ public class IdcServiceImpl implements IdcService { } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); + logger.error("fetchData-->"+e.getMessage()); } return result; } @@ -275,7 +276,9 @@ public class IdcServiceImpl implements IdcService { OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); - RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(params)); + RequestBody body = RequestBody.create(mediaType, ""); + if(params!=null) + body = RequestBody.create(mediaType,JSON.toJSONString(params)); Request request = new Request.Builder() .url(url) .method("POST", body)