|
|
|
@ -114,10 +114,17 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
|
public AjaxResult syncBuyerMessage(List<MdmGmfxxtbReqBO> mdmGmfxxtbReqBOS, String requestBody) { |
|
|
|
|
// 存表
|
|
|
|
|
List<BuyerEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < mdmGmfxxtbReqBOS.size(); i++) { |
|
|
|
|
MdmGmfxxtbReqBO tempMdmGmfxxtbReqBO = mdmGmfxxtbReqBOS.get(i); |
|
|
|
|
BuyerEntity entity = new BuyerEntity(); |
|
|
|
|
BuyerEntity buyerEntity = buyerMapper.selectBuyerByCodeOrNameAndNsrsbh(tempMdmGmfxxtbReqBO.getCODE(), "", "-1"); |
|
|
|
|
if(buyerEntity == null){ |
|
|
|
|
log.info("MDM编码数据已存在;{}",tempMdmGmfxxtbReqBO.getCODE()); |
|
|
|
|
entity.setSuccess(false); |
|
|
|
|
if(mdmGmfxxtbReqBOS.size() == 1){ |
|
|
|
|
return AjaxResult.success("9999", "MDM数据已存在,请勿重复同步"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
entity.setId(DistributedKeyMaker.generateShotKey()); |
|
|
|
|
entity.setTaxpayerCode(tempMdmGmfxxtbReqBO.getDESC14()); |
|
|
|
|
entity.setPurchaseName(tempMdmGmfxxtbReqBO.getDESC1()); |
|
|
|
@ -182,7 +189,7 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
|
} else { |
|
|
|
|
entity.setSuccess(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
list.add(entity); |
|
|
|
|
} |
|
|
|
|
String respStr = ""; |
|
|
|
@ -429,7 +436,7 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
|
"}"; |
|
|
|
|
|
|
|
|
|
// 发送POST请求
|
|
|
|
|
log.info("[MDM主动同步物料]请求地址:{},请求参数:{}", buyerUrl, requestBody); |
|
|
|
|
log.info("[MDM主动同步物料]请求地址:{},请求参数:{}", groupTaxCodeUrl, requestBody); |
|
|
|
|
HttpResponse response = HttpRequest.post(groupTaxCodeUrl) |
|
|
|
|
.timeout(20000) // 设置请求超时时间
|
|
|
|
|
.header("Content-Type", "application/json") |
|
|
|
@ -439,8 +446,13 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
|
.execute(); |
|
|
|
|
String resp = response.body(); |
|
|
|
|
log.info("[MDM主动同步物料]响应结果:{}", resp); |
|
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(resp)){ |
|
|
|
|
return R.error("未查询到数据!"); |
|
|
|
|
} |
|
|
|
|
SDEnergyMdmBaseBO baseBO = JSONObject.parseObject(resp, SDEnergyMdmBaseBO.class); |
|
|
|
|
if(baseBO == null || baseBO.getESB() == null || "S".equals(baseBO.getESB().getRESULT())){ |
|
|
|
|
return R.error("未查询到数据!"); |
|
|
|
|
} |
|
|
|
|
List<MdmSyncGroupTaxCodeReqBO> mdmGmfxxtbReqBOS = (List<MdmSyncGroupTaxCodeReqBO>) Optional.of(baseBO) |
|
|
|
|
.map(SDEnergyMdmBaseBO::getESB) |
|
|
|
|
.map(ESBBO::getDATA) |
|
|
|
|