From 16a7534c8ac7de9c8a0deb9101654c6066009247 Mon Sep 17 00:00:00 2001 From: xyiege Date: Wed, 30 Nov 2022 15:23:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=8E=B7=E5=8F=96=E5=90=88?= =?UTF-8?q?=E7=BA=A6=E5=9C=B0=E5=9D=80=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/szwh.properties | 7 +++++-- .../szwh/service/impl/OrderTaskServiceImpl.java | 8 ++++++-- src/main/java/cn/chjyj/szwh/utils/DateUtils.java | 16 ++++++++++++++++ src/test/java/cn/chjyj/szwh/NewTest.java | 8 ++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/conf/szwh.properties b/conf/szwh.properties index a3c48b1..3430dae 100644 --- a/conf/szwh.properties +++ b/conf/szwh.properties @@ -19,7 +19,9 @@ distribute.pem.token=4b4858543056374e564c4f4650533942 # ENTRUST_URL = http://10.24.4.14:51317 ENTRUST_URL = http://10.14.1.173:9528 # 交易系统地址 -TIANLANG_ENTRUST_URL =http://10.24.4.90:11030 +#TIANLANG_ENTRUST_URL =http://10.24.4.90:11030 +// 测试环境下的交易系统地址 +TIANLANG_ENTRUST_URL = http://10.14.1.248:11030 # 用户地址 #REAL_URL =http://10.24.4.14:51317 REAL_URL = http://10.14.1.190:51317 @@ -29,4 +31,5 @@ HOST =http://10.24.4.156 # 中间件 MIDDLEWARE_HOST =http://116.77.235.153:8989 # 渠道用户 -CHANNEL_ISLI =999998-000000001920-2 \ No newline at end of file +#CHANNEL_ISLI =999998-000000001920-2 +CHANNEL_ISLI = 999998-000000000126-6 \ No newline at end of file diff --git a/src/main/java/cn/chjyj/szwh/service/impl/OrderTaskServiceImpl.java b/src/main/java/cn/chjyj/szwh/service/impl/OrderTaskServiceImpl.java index 02be341..3801a4c 100644 --- a/src/main/java/cn/chjyj/szwh/service/impl/OrderTaskServiceImpl.java +++ b/src/main/java/cn/chjyj/szwh/service/impl/OrderTaskServiceImpl.java @@ -3,6 +3,7 @@ package cn.chjyj.szwh.service.impl; import cn.chjyj.szwh.bean.*; import cn.chjyj.szwh.mapper.*; import cn.chjyj.szwh.service.OrderTaskService; +import cn.chjyj.szwh.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -43,8 +44,11 @@ public class OrderTaskServiceImpl implements OrderTaskService { String now=sdf.format(bdate); //组装查询条件 Map qmap =new HashMap<>(); - qmap.put("staus",3); - qmap.put("createtime",now); + //1 未支付 + qmap.put("staus",1); + // 超过30分钟的订单 + String bthmin = DateUtils.overNow("min",-30).toString(); + qmap.put("createtime",bthmin); List orderList= orderMapper.getOrderListUnderDate(now,"1"); // 判断非空 if(orderList!=null){ diff --git a/src/main/java/cn/chjyj/szwh/utils/DateUtils.java b/src/main/java/cn/chjyj/szwh/utils/DateUtils.java index 3f79654..e053069 100644 --- a/src/main/java/cn/chjyj/szwh/utils/DateUtils.java +++ b/src/main/java/cn/chjyj/szwh/utils/DateUtils.java @@ -60,6 +60,22 @@ public class DateUtils { return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); } + /** + * 获取当前时间往前往后的时候 + * @param field 字段 ,如小时,分钟 + * @param oversize 正数标识往后,负数表示往前 + * @return + */ + public static Date overNow(String field,int oversize){ + Calendar cal = Calendar.getInstance(); + int calField = Calendar.HOUR; + if("min".equals(field)){ //分钟 + calField = Calendar.MINUTE; + } + cal.set(calField,oversize); + return cal.getTime(); + } + /** * 指定日期的前后几天 工作日 * diff --git a/src/test/java/cn/chjyj/szwh/NewTest.java b/src/test/java/cn/chjyj/szwh/NewTest.java index b17432c..0fd61b9 100644 --- a/src/test/java/cn/chjyj/szwh/NewTest.java +++ b/src/test/java/cn/chjyj/szwh/NewTest.java @@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import javax.xml.crypto.Data; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.Calendar; @@ -152,4 +153,11 @@ public class NewTest { String nowstr =sdf.format(vstime); System.out.println(nowstr); } + + @Test + public void mkdd(){ + // 超过30分钟的订单 + String bthmin = DateUtils.overNow("min",-30).toString(); + System.out.println(bthmin); + } }