作者 shenhailong

添加 列表查询 主单号—— 工具类 +不+ - 问题

@@ -31,6 +31,12 @@ @@ -31,6 +31,12 @@
31 <scope>test</scope> 31 <scope>test</scope>
32 </dependency> 32 </dependency>
33 <dependency> 33 <dependency>
  34 + <groupId>org.freemarker</groupId>
  35 + <artifactId>freemarker</artifactId>
  36 + <version>RELEASE</version>
  37 + </dependency>
  38 +
  39 + <dependency>
34 <groupId>org.jetbrains</groupId> 40 <groupId>org.jetbrains</groupId>
35 <artifactId>annotations</artifactId> 41 <artifactId>annotations</artifactId>
36 <version>RELEASE</version> 42 <version>RELEASE</version>
@@ -49,6 +49,17 @@ public final class DateUtil { @@ -49,6 +49,17 @@ public final class DateUtil {
49 return sdf_yyyyMMdd.format(new Date()); 49 return sdf_yyyyMMdd.format(new Date());
50 } 50 }
51 51
  52 +
  53 + public static String get_yyyyMMdd(String date) throws ParseException {
  54 +
  55 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
  56 +
  57 + Date parse = simpleDateFormat.parse(date);
  58 +
  59 +
  60 + return sdf_yyyyMMdd.format(parse);
  61 + }
  62 +
52 public static Date formatByyyyyMMdd(String dateStr){ 63 public static Date formatByyyyyMMdd(String dateStr){
53 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); 64 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
54 LocalDate beginDateTime = LocalDate.parse(dateStr, formatter); 65 LocalDate beginDateTime = LocalDate.parse(dateStr, formatter);
@@ -81,7 +92,7 @@ public final class DateUtil { @@ -81,7 +92,7 @@ public final class DateUtil {
81 * @return 20190916071330431 92 * @return 20190916071330431
82 */ 93 */
83 public static String getCurrentTime17(){ 94 public static String getCurrentTime17(){
84 - return timesdfsss.format(currentDate); 95 + return timesdfsss.format(new Date());
85 } 96 }
86 97
87 /** 98 /**
@@ -484,4 +495,32 @@ public final class DateUtil { @@ -484,4 +495,32 @@ public final class DateUtil {
484 } 495 }
485 return age; 496 return age;
486 } 497 }
  498 +
  499 +
  500 + /**
  501 + * 给时间加上几个小时
  502 + * @param day 当前时间 格式:yyyy-MM-dd HH:mm:ss
  503 + * @param hour 需要加的时间
  504 + * @return
  505 + */
  506 + public static String addDateMinut(Date day, int hour){
  507 + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
  508 + Date date = null;
  509 + try {
  510 + date = day;
  511 + } catch (Exception ex) {
  512 + ex.printStackTrace();
  513 + }
  514 + if (date == null)
  515 + return "";
  516 +// System.out.println("front:" + format.format(date)); //显示输入的日期
  517 + Calendar cal = Calendar.getInstance();
  518 + cal.setTime(date);
  519 + cal.add(Calendar.HOUR, hour);// 24小时制
  520 + date = cal.getTime();
  521 +// System.out.println("after:" + format.format(date)); //显示更新后的日期
  522 + cal = null;
  523 + return format.format(date);
  524 +
  525 + }
487 } 526 }
  1 +package com.tianbo.util.nmms;
  2 +
  3 +public class AwbaUtils {
  4 +
  5 + public static String awba(String awba){
  6 + if (awba.contains("-")){
  7 + return awba;
  8 + }else {
  9 + StringBuffer stringBuffer = new StringBuffer(awba);
  10 + String s = stringBuffer.insert(3, "-").toString();
  11 + return s;
  12 + }
  13 + }
  14 +}