Browse Source

新增发货提醒上传状态检测

hejq 8 years ago
parent
commit
5b9ac857f8

+ 20 - 0
src/main/java/com/uas/platform/b2b/erp/controller/CheckTransController.java

@@ -2,7 +2,9 @@ package com.uas.platform.b2b.erp.controller;
 
 import com.uas.platform.b2b.erp.model.Inquiry;
 import com.uas.platform.b2b.erp.model.Purchase;
+import com.uas.platform.b2b.erp.model.PurchaseNotify;
 import com.uas.platform.b2b.erp.service.InquiryService;
+import com.uas.platform.b2b.erp.service.PurchaseNotifyService;
 import com.uas.platform.b2b.erp.service.PurchaseService;
 import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
 import com.uas.platform.core.logging.BufferedLoggerManager;
@@ -32,6 +34,9 @@ public class CheckTransController {
     @Autowired
     private PurchaseService purchaseService;
 
+    @Autowired
+    private PurchaseNotifyService purchaseNotifyService;
+
     private final static ErpBufferedLogger logger = BufferedLoggerManager.getLogger(ErpBufferedLogger.class);
 
     /**
@@ -63,4 +68,19 @@ public class CheckTransController {
         logger.log("单据传输检测", "采购订单", purchaseList.size());
         return purchaseService.getB2bId(purchaseList);
     }
+
+    /**
+     * 通过上传id查询平台送货提醒对应的id
+     *
+     * @param data 封装的id信息
+     * @return
+     * @throws UnsupportedEncodingException
+     */
+    @RequestMapping(value = "/notify", method = RequestMethod.POST)
+    public List<PurchaseNotify> getPurchaseNotifyB2bId(@RequestParam("data") String data) throws UnsupportedEncodingException {
+        String jsonStr = URLDecoder.decode(data, "UTF-8");
+        List<PurchaseNotify> notifyList = FlexJsonUtils.fromJsonArray(jsonStr, PurchaseNotify.class);
+        logger.log("单据传输检测", "送货提醒", notifyList.size());
+        return purchaseNotifyService.getB2bId(notifyList);
+    }
 }

+ 9 - 0
src/main/java/com/uas/platform/b2b/erp/model/PurchaseNotify.java

@@ -26,6 +26,7 @@ public class PurchaseNotify {
 	private String pn_remark;
 	private Double pn_endqty;
 	private Double pr_zxbzs;// 物料最小包装数
+	private Long pn_b2bid; //b2bid
 
 	public long getPn_id() {
 		return pn_id;
@@ -107,6 +108,14 @@ public class PurchaseNotify {
 		this.pr_zxbzs = pr_zxbzs;
 	}
 
+	public Long getPn_b2bid() {
+		return pn_b2bid;
+	}
+
+	public void setPn_b2bid(Long pn_b2bid) {
+		this.pn_b2bid = pn_b2bid;
+	}
+
 	/**
 	 * 转为平台的客户送货提醒
 	 * 

+ 9 - 4
src/main/java/com/uas/platform/b2b/erp/service/PurchaseNotifyService.java

@@ -2,10 +2,7 @@ package com.uas.platform.b2b.erp.service;
 
 import java.util.List;
 
-import com.uas.platform.b2b.erp.model.AcceptNotify;
-import com.uas.platform.b2b.erp.model.AcceptNotifyConfirm;
-import com.uas.platform.b2b.erp.model.AcceptNotifyVerify;
-import com.uas.platform.b2b.erp.model.PurchaseNotify;
+import com.uas.platform.b2b.erp.model.*;
 import com.uas.platform.b2b.model.PurchaseNotice;
 import com.uas.platform.b2b.model.SaleSend;
 import com.uas.platform.b2b.model.SaleSendItem;
@@ -62,4 +59,12 @@ public interface PurchaseNotifyService {
 	List<SaleSendItemVerify> convertAcceptUnauditVerify(List<AcceptNotifyVerify> verifies);
 
     List<List<PurchaseNotice>> convertEDIPurchaseNotify(List<PurchaseNotify> notifies, Long enUU);
+
+	/**
+	 * 通过上传的送货提醒id查询平台对应的id
+	 *
+	 * @param notifyList 送货提醒
+	 * @return
+	 */
+	List<PurchaseNotify> getB2bId(List<PurchaseNotify> notifyList);
 }

+ 17 - 4
src/main/java/com/uas/platform/b2b/erp/service/impl/PurchaseNotifyServiceImpl.java

@@ -4,10 +4,7 @@ import com.uas.platform.b2b.dao.PurchaseNoticeDao;
 import com.uas.platform.b2b.dao.PurchaseOrderItemDao;
 import com.uas.platform.b2b.dao.SaleSendItemDao;
 import com.uas.platform.b2b.dao.SaleSendItemVerifyDao;
-import com.uas.platform.b2b.erp.model.AcceptNotify;
-import com.uas.platform.b2b.erp.model.AcceptNotifyConfirm;
-import com.uas.platform.b2b.erp.model.AcceptNotifyVerify;
-import com.uas.platform.b2b.erp.model.PurchaseNotify;
+import com.uas.platform.b2b.erp.model.*;
 import com.uas.platform.b2b.erp.service.PurchaseNotifyService;
 import com.uas.platform.b2b.model.*;
 import com.uas.platform.b2b.support.SystemSession;
@@ -256,4 +253,20 @@ public class PurchaseNotifyServiceImpl implements PurchaseNotifyService {
 		return sendItemVerifies;
 	}
 
+	/**
+	 * 通过上传的送货提醒id查询平台对应的id
+	 *
+	 * @param notifyList 送货提醒
+	 * @return
+	 */
+	@Override
+	public List<PurchaseNotify> getB2bId(List<PurchaseNotify> notifyList) {
+	    for (PurchaseNotify notify : notifyList) {
+            List<PurchaseNotice> noticeList = purchaseNoticeDao.findByEnUUAndSourceId(SystemSession.getUser().getEnterprise().getUu(), notify.getPn_id());
+            if (!CollectionUtils.isEmpty(noticeList)) {
+                notify.setPn_b2bid(noticeList.get(0).getId());
+            }
+        }
+		return notifyList;
+	}
 }