|
|
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.api.b2c_erp.baisc.service.ComponentService;
|
|
|
import com.uas.api.b2c_erp.seller.model.Prod;
|
|
|
import com.uas.api.b2c_erp.seller.service.ProdService;
|
|
|
-import com.uas.erp.schedular.b2b.domain.Customer;
|
|
|
import com.uas.erp.schedular.diymall.domain.OrdersInfo;
|
|
|
import com.uas.erp.schedular.diymall.domain.LoggingOrder;
|
|
|
import com.uas.erp.schedular.diymall.domain.Order;
|
|
|
@@ -298,7 +297,6 @@ public class ProductTask extends AbstractTask {
|
|
|
//查询中间表 库存取整
|
|
|
List<Stock> stock = jdbcTemplate.queryForBeanList("select TSS_PRODCODE,round(tss_amount,0) tss_amount, TSS_DATE ,pr_zxdhl moq,pr_zxbzs mpq,getsaleprice_hkd(pr_code) price,pr_remark_sale invoiceModel,pr_remark_purchase invoiceName" +
|
|
|
" FROM TT_SHOP_STOCK LEFT JOIN PRODUCT ON TSS_PRODCODE=pr_code",Stock.class);
|
|
|
- String jsons = JSON.toJSONString(stock);
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(stock)) {
|
|
|
// 拿到商城物料总条数
|
|
|
@@ -331,30 +329,27 @@ public class ProductTask extends AbstractTask {
|
|
|
}
|
|
|
|
|
|
productUpdate1.retainAll(productUpdate2);
|
|
|
- //System.out.println(JSON.toJSONString(productUpdate1));
|
|
|
-
|
|
|
- JSONObject json = new JSONObject();
|
|
|
- json.put("secretId",SECRETUU);
|
|
|
- json.put("signature", "");
|
|
|
- json.put("productUpdate", productUpdate1);
|
|
|
- String signatureValues = OpenApiSignUtil.sign(JSON.toJSONString(json), SECRETKEY);
|
|
|
- json.put("signature",signatureValues);
|
|
|
-
|
|
|
- RestTemplate restTemp = new RestTemplate(new HttpsClientRequestFactory());
|
|
|
-// DefaultUriTemplateHandler uriTemplateHandler = new DefaultUriTemplateHandler();
|
|
|
-// uriTemplateHandler.setStrictEncoding(true);
|
|
|
-// restTemp.setUriTemplateHandler(uriTemplateHandler);
|
|
|
-
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
|
- headers.setContentType(type);
|
|
|
- HttpEntity<String> requestEntity = new HttpEntity<String>(json.toJSONString(), headers);
|
|
|
-
|
|
|
-
|
|
|
- System.out.println(json.toString());
|
|
|
- String result = restTemp.postForObject(BASEPATH_PRODUCT + "/openapi/product/batch/update", requestEntity, String.class);
|
|
|
- JSONObject response = (JSONObject) JSONObject.parse(result);
|
|
|
- System.out.println(response);
|
|
|
+ Integer count = Double.valueOf(Math.ceil(productUpdate1.size()/200.0)).intValue();
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
+ List<ProductUpdate> data = null;
|
|
|
+ if (i == (count - 1)) {
|
|
|
+ data = new ArrayList<>(productUpdate1.subList(i * 200, productUpdate1.size()));
|
|
|
+ }else {
|
|
|
+ data = new ArrayList<>(productUpdate1.subList(i * 200, (i + 1) * 200));
|
|
|
+ }
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("secretId",SECRETUU);
|
|
|
+ json.put("signature", "");
|
|
|
+ json.put("productUpdate", data);
|
|
|
+ String signatureValues = OpenApiSignUtil.sign(JSON.toJSONString(json), SECRETKEY);
|
|
|
+ json.put("signature",signatureValues);
|
|
|
+ RestTemplate restTemp = new RestTemplate(new HttpsClientRequestFactory());
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
|
+ headers.setContentType(type);
|
|
|
+ HttpEntity<String> requestEntity = new HttpEntity<String>(json.toJSONString(), headers);
|
|
|
+ restTemp.postForObject(BASEPATH_PRODUCT + "/openapi/product/batch/update", requestEntity, String.class);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|