|
|
@@ -1,73 +1,74 @@
|
|
|
-//package com.uas.ps.inquiry;
|
|
|
-//
|
|
|
-//import com.uas.ps.inquiry.model.PurcInquiry;
|
|
|
-//import com.uas.ps.inquiry.model.PurcInquiryItem;
|
|
|
-//import com.uas.ps.inquiry.rabbit.RabbitConstants;
|
|
|
-//import com.uas.ps.inquiry.util.FlexJsonUtils;
|
|
|
-//import com.uas.ps.inquiry.util.HttpUtil;
|
|
|
-//import org.junit.Test;
|
|
|
-//import org.junit.runner.RunWith;
|
|
|
-//import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.boot.test.context.SpringBootTest;
|
|
|
-//import org.springframework.context.annotation.Import;
|
|
|
-//import org.springframework.test.context.junit4.SpringRunner;
|
|
|
-//
|
|
|
-//import java.util.Date;
|
|
|
-//import java.util.HashSet;
|
|
|
-//import java.util.Set;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @author liuam
|
|
|
-// * @since 2018/9/12 0012 上午 11:24
|
|
|
-// */
|
|
|
-//@RunWith(SpringRunner.class)
|
|
|
-//@SpringBootTest(classes = Application.class)
|
|
|
-//@Import(com.uas.ps.inquiry.ApplicationContextRegister.class)
|
|
|
-//public class TestInquiry {
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private RabbitTemplate rabbitTemplate;
|
|
|
-//
|
|
|
-// @Test
|
|
|
-// public void testRabbitReceive() {
|
|
|
-// Object o = rabbitTemplate.receiveAndConvert(RabbitConstants.INQUIRY_MESSAGE);
|
|
|
-// System.out.println(o);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Test
|
|
|
-// public void saveInquiry() throws Exception {
|
|
|
-// PurcInquiry inquiry = new PurcInquiry();
|
|
|
-// inquiry.setEndDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2));
|
|
|
-// inquiry.setRecorderUU(1000002503L);
|
|
|
-// inquiry.setAmount(1);
|
|
|
-// inquiry.setRecorder("董必伟");
|
|
|
-// inquiry.setEnUU(10041559L);
|
|
|
-// inquiry.setSourceapp("MALL");
|
|
|
-// PurcInquiryItem item = new PurcInquiryItem();
|
|
|
-// item.setCmpCode("HCD89045");
|
|
|
-// item.setDate(new Date(System.currentTimeMillis()));
|
|
|
-// item.setUserUU(1000002503L);
|
|
|
-// item.setProdTitle("测试15");
|
|
|
-// item.setEndDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2));
|
|
|
-// item.setSource("MALL");
|
|
|
-// item.setSpec("14211");
|
|
|
-// item.setUserTel("15671616315");
|
|
|
-// item.setUserName("董必伟");
|
|
|
-// item.setInbrand("A123 Systems");
|
|
|
-// Set<PurcInquiryItem> items = new HashSet<>();
|
|
|
-// items.add(item);
|
|
|
-// inquiry.setInquiryItems(items);
|
|
|
-// String res = HttpUtil.doPost("http://10.1.51.82:24002" + "/inquiry/buyer/save",
|
|
|
-// FlexJsonUtils.toJsonDeep(inquiry));
|
|
|
-// System.out.println(res);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Test
|
|
|
-// public void sumPublishWithTime() throws Exception {
|
|
|
-// Date now = new Date();
|
|
|
-// HttpUtil.Response res = HttpUtil.sendGetRequest("http://10.1.51.82:24002" + "/inquiry/api/sum/publish/time?time=" + now, null);
|
|
|
-// System.out.println(res);
|
|
|
-// }
|
|
|
-//
|
|
|
-//}
|
|
|
+package java.com.uas.ps.inquiry;
|
|
|
+
|
|
|
+import com.uas.ps.inquiry.Application;
|
|
|
+import com.uas.ps.inquiry.model.PurcInquiry;
|
|
|
+import com.uas.ps.inquiry.model.PurcInquiryItem;
|
|
|
+import com.uas.ps.inquiry.rabbit.RabbitConstants;
|
|
|
+import com.uas.ps.inquiry.util.FlexJsonUtils;
|
|
|
+import com.uas.ps.inquiry.util.HttpUtil;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.context.annotation.Import;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author liuam
|
|
|
+ * @since 2018/9/12 0012 上午 11:24
|
|
|
+ */
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@SpringBootTest(classes = Application.class)
|
|
|
+@Import(com.uas.ps.inquiry.ApplicationContextRegister.class)
|
|
|
+public class TestInquiry {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RabbitTemplate rabbitTemplate;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRabbitReceive() {
|
|
|
+ Object o = rabbitTemplate.receiveAndConvert(RabbitConstants.INQUIRY_MESSAGE);
|
|
|
+ System.out.println(o);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void saveInquiry() throws Exception {
|
|
|
+ PurcInquiry inquiry = new PurcInquiry();
|
|
|
+ inquiry.setEndDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2));
|
|
|
+ inquiry.setRecorderUU(1000002503L);
|
|
|
+ inquiry.setAmount(1);
|
|
|
+ inquiry.setRecorder("董必伟");
|
|
|
+ inquiry.setEnUU(10041559L);
|
|
|
+ inquiry.setSourceapp("MALL");
|
|
|
+ PurcInquiryItem item = new PurcInquiryItem();
|
|
|
+ item.setCmpCode("HCD89045");
|
|
|
+ item.setDate(new Date(System.currentTimeMillis()));
|
|
|
+ item.setUserUU(1000002503L);
|
|
|
+ item.setProdTitle("测试15");
|
|
|
+ item.setEndDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2));
|
|
|
+ item.setSource("MALL");
|
|
|
+ item.setSpec("14211");
|
|
|
+ item.setUserTel("15671616315");
|
|
|
+ item.setUserName("董必伟");
|
|
|
+ item.setInbrand("A123 Systems");
|
|
|
+ Set<PurcInquiryItem> items = new HashSet<>();
|
|
|
+ items.add(item);
|
|
|
+ inquiry.setInquiryItems(items);
|
|
|
+ String res = HttpUtil.doPost("http://10.1.51.82:24002" + "/inquiry/buyer/save",
|
|
|
+ FlexJsonUtils.toJsonDeep(inquiry));
|
|
|
+ System.out.println(res);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void sumPublishWithTime() throws Exception {
|
|
|
+ Date now = new Date();
|
|
|
+ HttpUtil.Response res = HttpUtil.sendGetRequest("http://10.1.51.82:24002" + "/inquiry/api/sum/publish/time?time=" + now, null);
|
|
|
+ System.out.println(res);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|