|
|
@@ -2,8 +2,10 @@ package com.uas.platform.b2b.erp.controller;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -14,8 +16,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import com.uas.platform.b2b.erp.model.Prod;
|
|
|
import com.uas.platform.b2b.erp.service.ProdService;
|
|
|
import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
|
|
|
+import com.uas.platform.b2b.model.Product;
|
|
|
import com.uas.platform.b2b.service.ProductService;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
+import com.uas.platform.core.model.Status;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
|
|
|
/**
|
|
|
@@ -68,4 +72,38 @@ public class ProdController {
|
|
|
productService.save(prodService.convertProduct(prods));
|
|
|
logger.log("物料资料", "定时任务更新物料资料", prods.size());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将平台更新的ERP的物料数据回传回ERP
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/backtouas", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public List<Prod> getProds() {
|
|
|
+ List<Prod> prods = new ArrayList<Prod>();
|
|
|
+ List<Product> products = productService.findBySourceAppAndDownloadstatus("ERP", Status.NOT_UPLOAD.value());
|
|
|
+ if (!CollectionUtils.isEmpty(products)) {
|
|
|
+ for (Product product : products) {
|
|
|
+ Prod prod = new Prod();
|
|
|
+ prod.setPr_uuid(product.getCmpUuId());
|
|
|
+ prod.setPr_id(product.getSourceId());
|
|
|
+ prod.setB2b_id(product.getId());
|
|
|
+ prods.add(prod);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return prods;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新下载成功的状态
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/refreshDownloadstatus", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void refreshDownloadstatus(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ productService.onProductDownSuccess(URLDecoder.decode(data, "UTF-8").split(","));
|
|
|
+ }
|
|
|
}
|