diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java index 47e8f0e..8e8b8e4 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java @@ -195,5 +195,21 @@ public class UdiwmsPostDirectController { return baseResponse; } + /** + * UDI管理系统发送下载请求到自助平台 + * + * @param postDownloadInfo + * @param bindingResult + * @return + */ + @PostMapping("/udisp/sync/downloadNow") + public BaseResponse postDownloadInfo(@RequestBody PostDownloadInfo postDownloadInfo, BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + BaseResponse response = postSmpHttp.postDownloadInfo(postDownloadInfo); + return response; + } + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java b/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java index ac6e8b1..87b84c2 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java @@ -10,6 +10,7 @@ import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; import com.glxp.sale.admin.service.param.SystemParamConfigService; import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; @@ -18,6 +19,7 @@ import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; +@Slf4j @Service public class PostSmpHttp { @@ -92,7 +94,7 @@ public class PostSmpHttp { return udiDlDeviceResponse; } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); return ResultVOUtils.error(500, "下载失败!"); } } @@ -108,12 +110,31 @@ public class PostSmpHttp { paramMap.put("orderId", postThirdSysUploadInfo.getOrderId()); paramMap.put("wzUploadStatus", postThirdSysUploadInfo.getWzUploadStatus()); paramMap.put("wzUploadResult", postThirdSysUploadInfo.getWzUploadResult()); - String response = UHttpClient.postJson(getSpmsUrl() + "/udiwms/", paramMap, getHeaders()); + String response = UHttpClient.postJson(getSpmsUrl() + "/sps/sync/order/syncOrderUploadInfo", paramMap, getHeaders()); try { BaseResponse baseResponse = JSONUtil.toBean(response, BaseResponse.class); return baseResponse; } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); + return ResultVOUtils.error(500, "同步失败!"); + } + } + + /** + * UDI管理系统发送下载请求到自助平台 + * + * @param postDownloadInfo + * @return + */ + public BaseResponse postDownloadInfo(PostDownloadInfo postDownloadInfo) { + Map paramMap = new HashMap<>(1); + paramMap.put("type", postDownloadInfo.getType()); + String response = UHttpClient.postJson(getSpmsUrl() + "/sps/sync/data/downloadNow", paramMap, getHeaders()); + try { + BaseResponse baseResponse = JSONUtil.toBean(response, BaseResponse.class); + return baseResponse; + } catch (Exception e) { + log.error(e.getMessage(), e); return ResultVOUtils.error(500, "同步失败!"); } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/req/sync/PostDownloadInfo.java b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/PostDownloadInfo.java new file mode 100644 index 0000000..5066840 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/PostDownloadInfo.java @@ -0,0 +1,16 @@ +package com.glxp.sale.admin.req.sync; + +import lombok.Data; + +/** + * 下载任务信息 + */ +@Data +public class PostDownloadInfo { + + /** + * 下载类型 + */ + private Integer type; + +}