| | |
| | | import com.gs.xiaomi.config.DataAcquisitionConfiguration; |
| | | import com.gs.xiaomi.dto.*; |
| | | import com.gs.xiaomi.entity.DeliveryDetail; |
| | | import com.gs.xiaomi.dto.SoapApiResponse; |
| | | import com.gs.xiaomi.entity.DeliveryMain; |
| | | import com.gs.xiaomi.entity.LogisticsPackage; |
| | | import com.gs.xiaomi.entity.PackageDetail; |
| | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @RequiredArgsConstructor |
| | | public class XM104Service { |
| | | public class Xm104Service { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(XM104Service.class); |
| | | private static final Logger log = LoggerFactory.getLogger(Xm104Service.class); |
| | | private final SoapApiService soapApiService; |
| | | |
| | | private final DeliveryMainService deliveryMainService; |
| | |
| | | req.setIvUser(DataAcquisitionConfiguration.IV_USER); |
| | | |
| | | try { |
| | | BizDocumentResult deliveryNo = getDeliveryNo(req); |
| | | SoapApiResponse<BizDocumentResult> response = getDeliveryNo(req); |
| | | |
| | | // 检查响应是否成功 |
| | | if (!response.isSuccess()) { |
| | | log.error("【获取送货单列表失败】EV_CODE: {}, 提示信息: {}", response.getEvCode(), response.getMessage()); |
| | | throw new RuntimeException("获取送货单列表失败: " + response.getMessage()); |
| | | } |
| | | |
| | | BizDocumentResult deliveryNo = response.getData(); |
| | | |
| | | if (CollUtil.isEmpty(deliveryNo.getEtHeaders())) { |
| | | log.info("【BizDocumentResult】返回列表为空,跳过处理"); |
| | |
| | | req.setIvInfo(doc); |
| | | |
| | | try { |
| | | BizDocumentResult result = getDeliveryNo(req); |
| | | SoapApiResponse<BizDocumentResult> detailResponse = getDeliveryNo(req); |
| | | |
| | | // 检查响应是否成功 |
| | | if (!detailResponse.isSuccess()) { |
| | | log.error("【获取送货单详情失败】送货单: {}, EV_CODE: {}, 提示信息: {}", |
| | | etHeader.getZzasn(), detailResponse.getEvCode(), detailResponse.getMessage()); |
| | | throw new RuntimeException("获取送货单详情失败: " + detailResponse.getMessage()); |
| | | } |
| | | |
| | | BizDocumentResult result = detailResponse.getData(); |
| | | |
| | | if (result == null) { |
| | | log.info("【BizDocumentResult】获取送货单详情信息为空,跳过处理"); |
| | |
| | | } |
| | | } |
| | | |
| | | private BizDocumentResult getDeliveryNo(ZfmWsApiRequest request) throws Exception { |
| | | private SoapApiResponse<BizDocumentResult> getDeliveryNo(ZfmWsApiRequest request) throws Exception { |
| | | |
| | | BizDocumentResult bizDocumentResult = soapApiService.callAndParse(DataAcquisitionConfiguration.XM104_URL, request); |
| | | SoapApiResponse<BizDocumentResult> response = soapApiService.callAndParse(DataAcquisitionConfiguration.XM104_URL, request); |
| | | |
| | | return bizDocumentResult; |
| | | return response; |
| | | } |
| | | |
| | | private <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { |
| | |
| | | |
| | | } |
| | | |
| | | //deliveryMainService.callPdaReceiptBtn("送货单签收[BTNOK[PL017[" + etHeader.getZzasn(), ""); |
| | | deliveryMainService.callPdaReceiptBtn("送货单签收[BTNOK[PL017[" + etHeader.getZzasn(), ""); |
| | | }); |
| | | } |
| | | |
| | | public boolean manualSynchronization(NumbericalDto numbericalDto) { |
| | | public String manualSynchronization(NumbericalDto numbericalDto) { |
| | | try { |
| | | String[] asns = numbericalDto.getAsn().split(","); |
| | | for (String asn : asns) { |
| | |
| | | doc.setZzasn(asn); |
| | | getXM104(doc); |
| | | } |
| | | return true; |
| | | return null; // 返回null表示成功 |
| | | } catch (Exception e) { |
| | | log.error("【手动读取ASN异常】 异常: {}", e.getMessage(), e); |
| | | return false; |
| | | // 返回具体的错误信息 |
| | | return e.getMessage() != null ? e.getMessage() : "同步失败: 未知错误"; |
| | | } |
| | | } |
| | | |