|
|
@@ -0,0 +1,78 @@
|
|
|
+package com.uas.platform.b2b.erp.controller;
|
|
|
+
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+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.ProductSample;
|
|
|
+import com.uas.platform.b2b.erp.service.InquiryService;
|
|
|
+import com.uas.platform.b2b.erp.service.PurchaseSampleService;
|
|
|
+import com.uas.platform.b2b.model.Attach;
|
|
|
+import com.uas.platform.b2b.model.FileUpload;
|
|
|
+import com.uas.platform.b2b.service.AttachService;
|
|
|
+import com.uas.platform.b2b.service.PurchaseInquiryService;
|
|
|
+import com.uas.platform.b2b.service.PurchaseProofingService;
|
|
|
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 对买家ERP的数据接口<br>
|
|
|
+ * 打样申请处理
|
|
|
+ *
|
|
|
+ * @author yingp
|
|
|
+ *
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/erp/purchase/sample")
|
|
|
+public class ProductSampleController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InquiryService inquiryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseInquiryService purchaseInquiryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AttachService attachService;
|
|
|
+ @Autowired
|
|
|
+ private PurchaseSampleService purchaseSampleService;
|
|
|
+ @Autowired
|
|
|
+ private PurchaseProofingService purchaseProofingService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将买家ERP的采购询价写到平台
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void saveProductSamples(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ List<ProductSample> productSamples = FlexJsonUtils.fromJsonArray(jsonStr, ProductSample.class);
|
|
|
+ purchaseProofingService.save(purchaseSampleService.convertProofing(productSamples));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 买家ERP的附件
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/attach", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void uploadAttach(String data, FileUpload uploadItem) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ Map<String, Map<String, Object>> fileList = FlexJsonUtils.fromJson(jsonStr);
|
|
|
+ List<Attach> attachs = attachService.uploadZipAndSave(uploadItem, "purchaseProofing", "客户打样申请单附件", fileList);
|
|
|
+ purchaseProofingService.saveAttach(attachs);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|