diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java index 4aba568..9576f46 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/SyncController.java @@ -1,10 +1,12 @@ package com.glxp.sale.admin.controller.sync; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.glxp.sale.admin.constant.BasicProcessStatus; import com.glxp.sale.admin.constant.ConstantStatus; +import com.glxp.sale.admin.entity.param.SystemParamConfigEntity; import com.glxp.sale.admin.entity.sync.BasicExportStatusEntity; import com.glxp.sale.admin.entity.sync.BasicUploadStatusEntity; import com.glxp.sale.admin.idc.utils.UriUtils; @@ -12,9 +14,11 @@ import com.glxp.sale.admin.service.param.SystemParamConfigService; import com.glxp.sale.admin.service.sync.BasicExportService; import com.glxp.sale.admin.service.sync.BasicUploadService; import com.glxp.sale.admin.util.*; +import com.glxp.sale.common.enums.ResultEnum; import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; @@ -61,8 +65,28 @@ public class SyncController { * @return */ @PostMapping("/udispsync/sync/testConnection") - public BaseResponse testConnection() { - return ResultVOUtils.success("连接成功"); + public BaseResponse testConnection(HttpServletRequest request) { + String uri = uriUtils.parseUri(request.getRequestURL().toString()); + String upperServerHost = systemParamConfigService.selectValueByParamKey("upper_server_ip"); + if (StrUtil.isNotEmpty(upperServerHost)) { + uri = upperServerHost + "/" + uri; + } else { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), request.getRemoteHost() + "服务缺少上级服务IP"); + } + uri = changeUri(uri); + JSONObject jsonObject = null; + try { + jsonObject = redirect(request, uri); + } catch (Exception e) { + e.printStackTrace(); + return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), request.getRemoteHost() + "服务访问上级服务" + upperServerHost + "异常"); + } + BaseResponse response = JSONUtil.toBean(jsonObject.toJSONString(), BaseResponse.class); + if ("20000".equals(response.getCode())) { + return ResultVOUtils.success("连接成功"); + } else { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK.getCode(), response.getMessage()); + } } //单据接口直连--扫码单据 diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java index cc3ec68..8b3a4b1 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java @@ -260,6 +260,11 @@ public class DlAllDataService { */ @Transactional(rollbackFor = Exception.class) public void pullData(BasicExportTypeEnum exportType) { + switch (exportType){ + case IO_ORDER: + case COUNTRY_DI_DATA: + return; + } String data = spGetHttp.pullData(exportType); cn.hutool.json.JSONObject obj = JSONUtil.parseObj(data);