|
|
@@ -48,19 +48,21 @@ public class SendPurchaseInTask extends Executable{
|
|
|
@Override
|
|
|
public void execute(MessageInfo messageInfo) throws Exception {
|
|
|
CompanyDTO companyDTO = companyApi.getCompanyById(messageInfo.getCompanyId()).getData();
|
|
|
- AccountDTO accountDTO = accountApi.getAccountById(messageInfo.getUserId()).getData();
|
|
|
|
|
|
ProdInOutFormDTO prodInOutFormDTO = prodInOutApi.getProdFormData(Long.parseLong(messageInfo.getBizId())).getData();
|
|
|
ProdInOutDTO prodInOutDTO = prodInOutFormDTO.getMain();
|
|
|
PurchaseProdInOut b2bPurchaseProdInOut = BeanMapper.map(prodInOutDTO, PurchaseProdInOut.class);
|
|
|
convertToPronInOut(prodInOutDTO, b2bPurchaseProdInOut);
|
|
|
+ LOGGER.info("ProdInOutDTO={}, PurchaseProdInOut={}", JsonUtils.toJsonString(prodInOutDTO), JsonUtils.toJsonString(b2bPurchaseProdInOut));
|
|
|
|
|
|
List<PurchaseProdInOutDetail> b2bPurchaseProdInOutDetailList = BeanMapper.mapList(prodInOutFormDTO.getItems(), PurchaseProdInOutDetail.class);
|
|
|
convertToPronInOutDetail(prodInOutFormDTO.getItems(), b2bPurchaseProdInOutDetailList);
|
|
|
b2bPurchaseProdInOut.setDetails(b2bPurchaseProdInOutDetailList);
|
|
|
+ LOGGER.info("ProdIODetailDTOList={}, b2bPurchaseProdInOutDetailList={}", JsonUtils.toJsonString(prodInOutFormDTO.getItems()), JsonUtils.toJsonString(b2bPurchaseProdInOutDetailList));
|
|
|
|
|
|
boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + prodInUrl, JsonUtils.toJsonString(b2bPurchaseProdInOut), companyDTO.getAccessKey());
|
|
|
if (success) {
|
|
|
+ LOGGER.info("采购验收单上传成功, id={}", messageInfo.getBizId());
|
|
|
prodInOutApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
|
|
|
}
|
|
|
}
|
|
|
@@ -80,19 +82,4 @@ public class SendPurchaseInTask extends Executable{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 发送http请求
|
|
|
- * @param bizId
|
|
|
- * @param data
|
|
|
- * @param accessSecretKey
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- private void sendProdInToB2B(String url, Long bizId, String data, String accessSecretKey) throws Exception {
|
|
|
- Map<String, String> params = new HashMap<String, String>();
|
|
|
- params.put("data", JsonUtils.toJsonString(data));
|
|
|
- Response response = HttpUtil.sendPostRequest(url, params, true, accessSecretKey);
|
|
|
- if (response.getStatusCode() == 200){
|
|
|
- prodInOutApi.updateB2BStatus(bizId, "已上传");
|
|
|
- }
|
|
|
- }
|
|
|
}
|