|
|
@@ -1,15 +1,17 @@
|
|
|
package com.uas.platform.b2b.erp.controller;
|
|
|
|
|
|
import com.uas.platform.b2b.erp.model.BatchInquiry;
|
|
|
+import com.uas.platform.b2b.erp.model.Inquiry;
|
|
|
+import com.uas.platform.b2b.erp.model.InquiryDecide;
|
|
|
+import com.uas.platform.b2b.erp.model.InquiryDetail;
|
|
|
import com.uas.platform.b2b.erp.service.PublicInquiryService;
|
|
|
import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
|
|
|
+import com.uas.platform.b2b.service.PubInquiryService;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
+import com.uas.platform.core.util.ArrayUtils;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-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.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
@@ -28,6 +30,9 @@ public class PublicInquiryController {
|
|
|
@Autowired
|
|
|
private PublicInquiryService publicInquiryService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PubInquiryService pubInquiryService;
|
|
|
+
|
|
|
private final static ErpBufferedLogger logger = BufferedLoggerManager.getLogger(ErpBufferedLogger.class);
|
|
|
|
|
|
/**
|
|
|
@@ -58,4 +63,73 @@ public class PublicInquiryController {
|
|
|
publicInquiryService.updateStatus(inquiries);
|
|
|
logger.log("erp公共询价单", "erp关闭公共询价单", inquiries.size());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * (针对客户)获取平台供应商的报价信息
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/infos", method = RequestMethod.GET)
|
|
|
+ public List<InquiryDetail> getReply() {
|
|
|
+ List<InquiryDetail> details = publicInquiryService.convertPublicInquiryReply(pubInquiryService.findNotUploadReply());
|
|
|
+ logger.log("公共询价", "下载询价单报价结果", details.size());
|
|
|
+ return details;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 平台的报价信息传到买家ERP之后,修改平台里面的询价单明细的上传状态
|
|
|
+ *
|
|
|
+ * @param data 传回的id串
|
|
|
+ * @return
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/reply/back", method = RequestMethod.POST)
|
|
|
+ public void onReplySuccess(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String[] idArray = URLDecoder.decode(data, "UTF-8").split(",");
|
|
|
+ logger.log("公共询价单", "更新下载状态为已下载", idArray.length);
|
|
|
+ pubInquiryService.onReplyUploadSuccess(idArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 买家在收到报价信息后,点击提交按钮后,状态传至平台,至此平台的供应商不能再对这张询价单进行报价
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/checking", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void checkInquiry(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ List<Inquiry> inquiries = FlexJsonUtils.fromJsonArray(jsonStr, Inquiry.class);
|
|
|
+ publicInquiryService.updateInquiryStatus(inquiries);
|
|
|
+ logger.log("公共询价单", "ERP询价单提交,单据不再进行报价操作", inquiries.size());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 买家ERP(不)采纳了价格之后,修改平台里面的报价信息的状态
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/reply/decide", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void onReplyDecide(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ List<InquiryDecide> decides = FlexJsonUtils.fromJsonArray(jsonStr, InquiryDecide.class);
|
|
|
+ pubInquiryService.onReplyDecide(publicInquiryService.convertInquiryDecide(decides));
|
|
|
+ logger.log("询价单", "修改询价单报价信息状态", decides.size());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 买家ERP作废询价单后,修改平台里面的状态
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/invalid", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void onReplyInvalid(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ List<Inquiry> inquiries = FlexJsonUtils.fromJsonArray(jsonStr, Inquiry.class);
|
|
|
+ pubInquiryService.onReplyInvalid(inquiries);
|
|
|
+ logger.log("询价单", "作废询价单", inquiries.size());
|
|
|
+ }
|
|
|
}
|