Browse Source

更新采购订单上传成功的判断方法

hejq 7 years ago
parent
commit
8c9a927a5d

+ 12 - 12
src/main/java/com/uas/platform/b2b/erp/controller/PurchaseController.java

@@ -1,16 +1,5 @@
 package com.uas.platform.b2b.erp.controller;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
 import com.uas.platform.b2b.erp.model.MessageLog;
 import com.uas.platform.b2b.erp.model.Purchase;
 import com.uas.platform.b2b.erp.model.PurchaseDetailEnd;
@@ -20,6 +9,16 @@ import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
 import com.uas.platform.b2b.service.PurchaseOrderService;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.List;
 
 /**
  * 对买家ERP的数据接口<br>
@@ -49,11 +48,12 @@ public class PurchaseController {
 	 */
 	@RequestMapping(method = RequestMethod.POST)
 	@ResponseBody
-	public void savePurchases(@RequestParam("data") String data) throws UnsupportedEncodingException {
+	public List<Purchase> savePurchases(@RequestParam("data") String data) throws UnsupportedEncodingException {
 		String jsonStr = URLDecoder.decode(data, "UTF-8");
 		List<Purchase> purchases = FlexJsonUtils.fromJsonArray(jsonStr, Purchase.class);
 		purchaseOrderService.save(purchaseService.convertPurchase(purchases));
 		logger.log("采购单", "上传采购单", purchases.size());
+		return purchaseService.getB2bId(purchases);
 	}
 
 	/**

+ 2 - 2
src/main/java/com/uas/platform/b2b/erp/controller/PurchaseNotifyController.java

@@ -58,9 +58,9 @@ public class PurchaseNotifyController {
 		String jsonStr = URLDecoder.decode(data, "UTF-8");
 		List<PurchaseNotify> notifies = FlexJsonUtils.fromJsonArray(jsonStr, PurchaseNotify.class);
 		List<PurchaseNotice> noticeList = purchaseNotifyService.convertPurchaseNotify(notifies);
-		noticeList = purchaseNoticeService.save(noticeList);
+		purchaseNoticeService.save(noticeList);
 		logger.log("送货提醒", "上传送货提醒", notifies.size());
-		return purchaseNotifyService.convertPurchaseNotice(noticeList);
+		return purchaseNotifyService.getB2bId(notifies);
 	}
 
 	/**

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/PurchaseNoticeService.java

@@ -29,7 +29,7 @@ public interface PurchaseNoticeService {
 	 * @param notices
 	 * @return
 	 */
-	public List<PurchaseNotice> save(List<PurchaseNotice> notices);
+	public void save(List<PurchaseNotice> notices);
 
 	/**
 	 * 批量结案客户送货提醒

+ 1 - 2
src/main/java/com/uas/platform/b2b/service/impl/PurchaseNoticeServiceImpl.java

@@ -107,11 +107,10 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
     private PersonalProductService personalProductService;
 
 	@Override
-	public List<PurchaseNotice> save(List<PurchaseNotice> notices) {
+	public void save(List<PurchaseNotice> notices) {
 		notices = purchaseNoticeDao.save(notices);
 		saveUserOrders(notices);
 		ContextUtils.publishEvent(new PurchaseNoticeSaveReleaseEvent(notices));
-		return notices;
 	}
 
 	private void saveUserOrders(final List<PurchaseNotice> notices) {