|
|
@@ -12,19 +12,16 @@ import com.usoftchina.saas.purchase.dto.PurchaseDetailDTO;
|
|
|
import com.usoftchina.saas.purchase.dto.PurchaseFormDTO;
|
|
|
import com.usoftchina.saas.transfers.config.B2BConfig;
|
|
|
import com.usoftchina.saas.transfers.dto.MessageInfo;
|
|
|
+import com.usoftchina.saas.transfers.utils.SendUtil;
|
|
|
import com.usoftchina.saas.utils.BeanMapper;
|
|
|
import com.usoftchina.saas.utils.JsonUtils;
|
|
|
import com.usoftchina.saas.utils.ObjectUtils;
|
|
|
-import com.usoftchina.saas.utils.http.HttpUtil;
|
|
|
-import com.usoftchina.saas.utils.http.HttpUtil.Response;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author: guq
|
|
|
@@ -62,8 +59,10 @@ public class SendPurchaseTask extends Executable {
|
|
|
|
|
|
b2bPurchase.setPurchaseDetails(b2bPurchaseDetailList);
|
|
|
|
|
|
- sendPurchaseToB2B(b2bConfig.getCommon() + purchaseUrl, Long.parseLong(messageInfo.getBizId()), JsonUtils.toJsonString(b2bPurchase), companyDTO.getAccessKey());
|
|
|
- purchaseApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
|
|
|
+ boolean success = SendUtil.sendToB2B(b2bConfig.getCommon() + purchaseUrl, JsonUtils.toJsonString(b2bPurchase), companyDTO.getAccessKey());
|
|
|
+ if (success) {
|
|
|
+ purchaseApi.updateB2BStatus(Long.parseLong(messageInfo.getBizId()), "已上传");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -92,19 +91,4 @@ public class SendPurchaseTask extends Executable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 发送http请求
|
|
|
- * @param bizId
|
|
|
- * @param data
|
|
|
- * @param accessSecretKey
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- private void sendPurchaseToB2B(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){
|
|
|
- purchaseApi.updateB2BStatus(bizId, "已上传");
|
|
|
- }
|
|
|
- }
|
|
|
}
|