|
|
@@ -1,6 +1,8 @@
|
|
|
package com.uas.platform.b2b.purc;
|
|
|
|
|
|
import com.uas.platform.b2b.BaseJunitTest;
|
|
|
+import com.uas.platform.b2b.core.util.DateFormatUtils;
|
|
|
+import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.dao.PurchaseNoticeDao;
|
|
|
import com.uas.platform.b2b.dao.PurchaseOrderItemDao;
|
|
|
import com.uas.platform.b2b.model.PurchaseNotice;
|
|
|
@@ -29,6 +31,9 @@ public class PurchaseNotify extends BaseJunitTest {
|
|
|
@Autowired
|
|
|
private EntityManagerFactory entityManagerFactory;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonDao commonDao;
|
|
|
+
|
|
|
@PersistenceContext
|
|
|
protected EntityManager em;
|
|
|
|
|
|
@@ -126,4 +131,32 @@ public class PurchaseNotify extends BaseJunitTest {
|
|
|
return notice;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * // 测试用例
|
|
|
+ // -1, 不跨年,25日前
|
|
|
+ sendDate(-1, '2018-12-23') 期望结果: '2018-11-26'
|
|
|
+ // -1,不跨年,26日后
|
|
|
+ sendDate(-1, '2018-12-28') 期望结果: '2018-11-26'
|
|
|
+ // -1, 跨年,25日前
|
|
|
+ sendDate(-1, '2019-01-23') 期望结果: '2018-12-26'
|
|
|
+ // -1,跨年,26日后
|
|
|
+ sendDate(-1, '2019-01-28') 期望结果: '2018-12-26'
|
|
|
+ // >=0, 不跨年,不跨月
|
|
|
+ sendDate(5, '2018-12-23') 期望结果: '2018-12-17'
|
|
|
+ // >=0,不跨年,跨月,有31号
|
|
|
+ sendDate(5, '2018-12-02') 期望结果: '2018-11-26'
|
|
|
+ // >=0,不跨年,跨月,无31号
|
|
|
+ sendDate(5, '2018-11-02') 期望结果: '2018-10-27'
|
|
|
+ // >=0, 跨年,不跨月
|
|
|
+ sendDate(5, '2019-01-23') 期望结果: '2019-01-17'
|
|
|
+ // >=0,跨年,跨月
|
|
|
+ sendDate(5, '2019-01-02') 期望结果: '2018-12-27'
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void getSendDelivery() {
|
|
|
+ StringBuffer sql = new StringBuffer("select purc_notice_delivery('").append("2018-12-23").append("', ").append("-1").append(")");
|
|
|
+ Date delivery = commonDao.queryForObject(sql.toString(), Date.class);
|
|
|
+ System.out.println(delivery);
|
|
|
+ }
|
|
|
}
|