食堂流水查询,导出。导入util修改,统一使用String类型
Conflicts:
src/main/java/com/supwisdom/dlpay/framework/util/ImportExcelUtil.java
diff --git a/build.gradle b/build.gradle
index 566e7a0..aa4e9cc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,6 +6,7 @@
id 'org.jetbrains.kotlin.plugin.spring'
}
+
apply plugin: 'io.spring.dependency-management'
group = 'com.supwisdom'
@@ -77,10 +78,10 @@
jvmTarget = jdkVersion
}
}
-
+/*
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = jdkVersion
}
-}
+}*/
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java b/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
index 80097c6..38e3dfe 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/DateUtil.java
@@ -2,7 +2,6 @@
import org.apache.log4j.Logger;
-import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -10,318 +9,332 @@
import java.util.TimeZone;
public class DateUtil {
- private static final Logger logger = Logger.getLogger(DateUtil.class);
- public static final String DATE_FMT = "yyyyMMdd";
- public static final String TIME_FMT = "HHmmss";
- public static final String DATETIME_FMT = "yyyyMMddHHmmss";
+ private static final Logger logger = Logger.getLogger(DateUtil.class);
+ public static final String DATE_FMT = "yyyyMMdd";
+ public static final String TIME_FMT = "HHmmss";
+ public static final String DATETIME_FMT = "yyyyMMddHHmmss";
- /**
- * Description: 返回一个当前时间 @return String 格式:yyyyMMddHHmmss @exception Modify
- * History:
- */
- public static String getNow() {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
- return sdf.format(new Date());
- }
-
-
- /**
- * Description: 根据类型返回一个当前时间 @param partten String @return String 格式:partten
- */
- public static String getNow(String partten) {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(partten);
- return sdf.format(new Date());
- }
-
- /**
- * Description: 得到一个特殊的时间 @param startTime String 格式:yyyyMMddHHmmss @param
- * interval int 秒 @return String 格式:partten @exception Modify History:
- */
- public static String getNewTime(String startTime, int interval) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
- Date d = sdf.parse(startTime);
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(d.getTime());
- calendar.add(Calendar.SECOND, interval);
- return sdf.format(calendar.getTime());
- } catch (ParseException e) {
- return startTime;
+ /**
+ * Description: 返回一个当前时间 @return String 格式:yyyyMMddHHmmss @exception Modify
+ * History:
+ */
+ public static String getNow() {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ return sdf.format(new Date());
}
- }
- /**
- * Description: 得到一个特殊的时间 @param startTime String 格式:partten @param
- * interval int 秒 @return String 格式:partten @exception Modify History:
- */
- public static String getNewTime(String startTime, int interval, String partten) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(partten);
- Date d = sdf.parse(startTime);
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(d.getTime());
- calendar.add(Calendar.SECOND, interval);
- return sdf.format(calendar.getTime());
- } catch (ParseException e) {
- return startTime;
+
+ /**
+ * Description: 根据类型返回一个当前时间 @param partten String @return String 格式:partten
+ */
+ public static String getNow(String partten) {
+ SimpleDateFormat sdf = new SimpleDateFormat(partten);
+ return sdf.format(new Date());
}
- }
- public static String getNewDay(String startDay, int intervalday) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
- Date d = sdf.parse(startDay);
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(d.getTime());
- calendar.add(Calendar.DATE, intervalday);
- return sdf.format(calendar.getTime());
- } catch (ParseException e) {
- return startDay;
- }
- }
-
- /**
- * 得到两个日期相差的天数 格式 yyyyMMdd @return diffdays = secondDay - firstDay
- */
- public static long getIntervalDay(String firstDay, String secondDay) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
- Date f = sdf.parse(firstDay);
- Date s = sdf.parse(secondDay);
- long time = s.getTime() - f.getTime();
- return time / (24 * 60 * 60 * 1000);
- } catch (ParseException e) {
- return 0;
- }
- }
-
- /**
- * Description: 比较两个时间字符串的前后关系 @param firstTime String 格式:yyyyMMddHHmmss
- *
- * @param secondTime String 格式: yyyyMMddHHmmss @return int |
- * firstTime=second int=0 | firstTime>secondTime int>0 |
- * firstTime<secondTime int<0 @exception Modify History:
- */
- public static int compareDatetime(String firstTime, String secondTime) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
- Date f = sdf.parse(firstTime);
- Date s = sdf.parse(secondTime);
- return f.compareTo(s);
- } catch (ParseException e) {
- return 0;
- }
- }
-
- /**
- * Description: 比较两个时间字符串的前后关系 @param firstTime String 格式:pattern
- *
- * @param secondTime String 格式: yyyyMMddHHmmss @return int |
- * firstTime=second int=0 | firstTime>secondTime int>0 |
- * firstTime<secondTime int<0 @exception Modify History:
- */
- public static int compareDatetime(String firstTime, String secondTime, String pattern) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
- Date f = sdf.parse(firstTime);
- Date s = sdf.parse(secondTime);
- return f.compareTo(s);
- } catch (ParseException e) {
- return 0;
- }
- }
-
- /**
- * Description: 比较两个时间字符串的时间差 @param firstTime String 格式:yyyyMMddHHmmss
- *
- * @param secondTime String 格式: yyyyMMddHHmmss @param second int 格式 @return
- * int | firstTime+seconds=secondTime int=0 | firstTime+seconds>secondTime
- * int>0 | firstTime+seconds<secondTime int<0 @exception Modify History:
- */
- public static int compareDatetime(String firstTime, String secondTime, int seconds) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
- Date f = sdf.parse(firstTime);
- Date s = sdf.parse(secondTime);
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(f.getTime());
- calendar.add(Calendar.SECOND, seconds);
- Date temp = calendar.getTime();
- return temp.compareTo(s);
- } catch (Exception e) {
- return 0;
- }
- }
-
- /**
- * Description: 对time重新格式化
- */
- public static String reformatDatetime(String time, String fromPattern, String toPattern) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(fromPattern);
- Date d = sdf.parse(time);
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeInMillis(d.getTime());
- sdf = new SimpleDateFormat(toPattern);
- return sdf.format(calendar.getTime());
- } catch (Exception e) {
- e.printStackTrace();
- return time;
- }
- }
-
- /**
- * 获得两个字符串日期之间的时间差(单位毫秒) 格式 yyyyMMddHHmmss
- */
- public static long getInterval(String startTime, String endTime) {
- long duration = 0;
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
- duration = sdf.parse(endTime).getTime() - sdf.parse(startTime).getTime();
- } catch (ParseException e) {
- logger.error("Hi guys,there is an error when you try to parse the date string");
- }
- return duration;
- }
-
- /**
- * 获得两个字符串日期之间的时间差(单位毫秒)
- */
- public static long getIntervalTime(String startTime, String endTime, String pattern) {
- long duration = 0;
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
- duration = sdf.parse(endTime).getTime() - sdf.parse(startTime).getTime();
- } catch (ParseException e) {
- logger.error("Hi guys,there is an error when you try to parse the date string");
- }
- return duration;
- }
-
- /**
- * 转换成日期格式
- * 短格式:20140401 -> 2014-04-01
- * 中格式:201404011200 -> 2014-04-01 12:00
- * 长格式:20140401123025 -> 2014-04-01 12:30:25
- **/
- public static String parseToDateFormat(String str) {
- switch (str.length()) {
- case 8:
- str = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8);
- break;
- case 12:
- str = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8) + " " + str.substring(8, 10) + ":" + str.substring(10, 12);
- break;
- case 14:
- str = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8) + " " + str.substring(8, 10) + ":" + str.substring(10, 12) + ":" + str.substring(12, 14);
- break;
- default:
- break;
- }
- return str;
- }
-
- /**
- * 解日期格式
- * 短格式:2014-04-01 -> 20140401
- * 中格式:2014-04-01 12:00 -> 201404011200
- * 长格式:2014-04-01 12:30:25 -> 20140401123025
- **/
- public static String unParseToDateFormat(String str) {
- return str.replaceAll("-", "").replaceAll(" ", "").replaceAll(":", "");
- }
-
- /**
- * 检验时间格式
- */
- public static boolean checkDatetimeValid(String datetime, String pattern) {
- if (null == datetime) return false;
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
- Date d = sdf.parse(datetime);
- return datetime.trim().equals(sdf.format(d));
- } catch (Exception e) {
- }
- return false;
- }
-
- /**
- * 获取指定日期是星期几 格式 yyyyMMdd
- * MON|TUE|WED|THU|FRI|SAT|SUN
- * 1 2 3 4 5 6 7
- */
- public static int getWeekday(String datestr) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
- Calendar calendar = Calendar.getInstance();
- boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY); //一周第一天是否为星期天
- Date d = sdf.parse(datestr);
- calendar.setTimeInMillis(d.getTime());
- int weekDay = calendar.get(calendar.DAY_OF_WEEK);
- if (isFirstSunday) {
- weekDay = weekDay - 1;
- if (weekDay == 0) {
- weekDay = 7;
+ /**
+ * Description: 得到一个特殊的时间 @param startTime String 格式:yyyyMMddHHmmss @param
+ * interval int 秒 @return String 格式:partten @exception Modify History:
+ */
+ public static String getNewTime(String startTime, int interval) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ Date d = sdf.parse(startTime);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(d.getTime());
+ calendar.add(Calendar.SECOND, interval);
+ return sdf.format(calendar.getTime());
+ } catch (ParseException e) {
+ return startTime;
}
- }
- return weekDay;
- } catch (Exception e) {
- return -1;
}
- }
- /**
- * 获取指定日期
- */
- public static Date getSpecifyDate(String datestr, String pattern) {
- try {
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
- Date result = sdf.parse(datestr);
- return result;
- } catch (Exception e) {
- return new Date();
+ /**
+ * Description: 得到一个特殊的时间 @param startTime String 格式:partten @param
+ * interval int 秒 @return String 格式:partten @exception Modify History:
+ */
+ public static String getNewTime(String startTime, int interval, String partten) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(partten);
+ Date d = sdf.parse(startTime);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(d.getTime());
+ calendar.add(Calendar.SECOND, interval);
+ return sdf.format(calendar.getTime());
+ } catch (ParseException e) {
+ return startTime;
+ }
}
- }
- public static Integer getLastDayOfMonth(Integer year, Integer month) {
- Calendar cal = Calendar.getInstance();
- cal.set(Calendar.YEAR, year);
- cal.set(Calendar.MONTH, month - 1);
- cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
- String str = new SimpleDateFormat("yyyyMMdd ").format(cal.getTime()).toString();
- Integer result = Integer.parseInt(str.substring(0, 4) + str.substring(4, 6) + str.substring(6, 8));
- return result;
- }
+ public static String getNewDay(String startDay, int intervalday) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
+ Date d = sdf.parse(startDay);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(d.getTime());
+ calendar.add(Calendar.DATE, intervalday);
+ return sdf.format(calendar.getTime());
+ } catch (ParseException e) {
+ return startDay;
+ }
+ }
- private static Date set(Date date, int calendarField, int amount) {
- Calendar c = Calendar.getInstance();
- c.setLenient(false);
- c.setTime(date);
- c.add(calendarField, amount);
- return c.getTime();
- }
+ /**
+ * 获取当天前后的时间
+ * @param intervalday
+ * @param format
+ * @return
+ */
+ public static String getNewDay(int intervalday, String format) {
+ SimpleDateFormat sdf = new SimpleDateFormat(format);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(new Date());
+ calendar.add(Calendar.DATE, intervalday);
+ return sdf.format(calendar.getTime());
+ }
+
+ /**
+ * 得到两个日期相差的天数 格式 yyyyMMdd @return diffdays = secondDay - firstDay
+ */
+ public static long getIntervalDay(String firstDay, String secondDay) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
+ Date f = sdf.parse(firstDay);
+ Date s = sdf.parse(secondDay);
+ long time = s.getTime() - f.getTime();
+ return time / (24 * 60 * 60 * 1000);
+ } catch (ParseException e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Description: 比较两个时间字符串的前后关系 @param firstTime String 格式:yyyyMMddHHmmss
+ *
+ * @param secondTime String 格式: yyyyMMddHHmmss @return int |
+ * firstTime=second int=0 | firstTime>secondTime int>0 |
+ * firstTime<secondTime int<0 @exception Modify History:
+ */
+ public static int compareDatetime(String firstTime, String secondTime) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ Date f = sdf.parse(firstTime);
+ Date s = sdf.parse(secondTime);
+ return f.compareTo(s);
+ } catch (ParseException e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Description: 比较两个时间字符串的前后关系 @param firstTime String 格式:pattern
+ *
+ * @param secondTime String 格式: yyyyMMddHHmmss @return int |
+ * firstTime=second int=0 | firstTime>secondTime int>0 |
+ * firstTime<secondTime int<0 @exception Modify History:
+ */
+ public static int compareDatetime(String firstTime, String secondTime, String pattern) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ Date f = sdf.parse(firstTime);
+ Date s = sdf.parse(secondTime);
+ return f.compareTo(s);
+ } catch (ParseException e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Description: 比较两个时间字符串的时间差 @param firstTime String 格式:yyyyMMddHHmmss
+ *
+ * @param secondTime String 格式: yyyyMMddHHmmss @param second int 格式 @return
+ * int | firstTime+seconds=secondTime int=0 | firstTime+seconds>secondTime
+ * int>0 | firstTime+seconds<secondTime int<0 @exception Modify History:
+ */
+ public static int compareDatetime(String firstTime, String secondTime, int seconds) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ Date f = sdf.parse(firstTime);
+ Date s = sdf.parse(secondTime);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(f.getTime());
+ calendar.add(Calendar.SECOND, seconds);
+ Date temp = calendar.getTime();
+ return temp.compareTo(s);
+ } catch (Exception e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Description: 对time重新格式化
+ */
+ public static String reformatDatetime(String time, String fromPattern, String toPattern) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(fromPattern);
+ Date d = sdf.parse(time);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(d.getTime());
+ sdf = new SimpleDateFormat(toPattern);
+ return sdf.format(calendar.getTime());
+ } catch (Exception e) {
+ e.printStackTrace();
+ return time;
+ }
+ }
+
+ /**
+ * 获得两个字符串日期之间的时间差(单位毫秒) 格式 yyyyMMddHHmmss
+ */
+ public static long getInterval(String startTime, String endTime) {
+ long duration = 0;
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
+ duration = sdf.parse(endTime).getTime() - sdf.parse(startTime).getTime();
+ } catch (ParseException e) {
+ logger.error("Hi guys,there is an error when you try to parse the date string");
+ }
+ return duration;
+ }
+
+ /**
+ * 获得两个字符串日期之间的时间差(单位毫秒)
+ */
+ public static long getIntervalTime(String startTime, String endTime, String pattern) {
+ long duration = 0;
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ duration = sdf.parse(endTime).getTime() - sdf.parse(startTime).getTime();
+ } catch (ParseException e) {
+ logger.error("Hi guys,there is an error when you try to parse the date string");
+ }
+ return duration;
+ }
+
+ /**
+ * 转换成日期格式
+ * 短格式:20140401 -> 2014-04-01
+ * 中格式:201404011200 -> 2014-04-01 12:00
+ * 长格式:20140401123025 -> 2014-04-01 12:30:25
+ **/
+ public static String parseToDateFormat(String str) {
+ switch (str.length()) {
+ case 8:
+ str = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8);
+ break;
+ case 12:
+ str = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8) + " " + str.substring(8, 10) + ":" + str.substring(10, 12);
+ break;
+ case 14:
+ str = str.substring(0, 4) + "-" + str.substring(4, 6) + "-" + str.substring(6, 8) + " " + str.substring(8, 10) + ":" + str.substring(10, 12) + ":" + str.substring(12, 14);
+ break;
+ default:
+ break;
+ }
+ return str;
+ }
+
+ /**
+ * 解日期格式
+ * 短格式:2014-04-01 -> 20140401
+ * 中格式:2014-04-01 12:00 -> 201404011200
+ * 长格式:2014-04-01 12:30:25 -> 20140401123025
+ **/
+ public static String unParseToDateFormat(String str) {
+ return str.replaceAll("-", "").replaceAll(" ", "").replaceAll(":", "");
+ }
+
+ /**
+ * 检验时间格式
+ */
+ public static boolean checkDatetimeValid(String datetime, String pattern) {
+ if (null == datetime) return false;
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ Date d = sdf.parse(datetime);
+ return datetime.trim().equals(sdf.format(d));
+ } catch (Exception e) {
+ }
+ return false;
+ }
+
+ /**
+ * 获取指定日期是星期几 格式 yyyyMMdd
+ * MON|TUE|WED|THU|FRI|SAT|SUN
+ * 1 2 3 4 5 6 7
+ */
+ public static int getWeekday(String datestr) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");
+ Calendar calendar = Calendar.getInstance();
+ boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY); //一周第一天是否为星期天
+ Date d = sdf.parse(datestr);
+ calendar.setTimeInMillis(d.getTime());
+ int weekDay = calendar.get(calendar.DAY_OF_WEEK);
+ if (isFirstSunday) {
+ weekDay = weekDay - 1;
+ if (weekDay == 0) {
+ weekDay = 7;
+ }
+ }
+ return weekDay;
+ } catch (Exception e) {
+ return -1;
+ }
+ }
+
+ /**
+ * 获取指定日期
+ */
+ public static Date getSpecifyDate(String datestr, String pattern) {
+ try {
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern);
+ Date result = sdf.parse(datestr);
+ return result;
+ } catch (Exception e) {
+ return new Date();
+ }
+ }
+
+ public static Integer getLastDayOfMonth(Integer year, Integer month) {
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.MONTH, month - 1);
+ cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
+ String str = new SimpleDateFormat("yyyyMMdd ").format(cal.getTime()).toString();
+ Integer result = Integer.parseInt(str.substring(0, 4) + str.substring(4, 6) + str.substring(6, 8));
+ return result;
+ }
+
+ private static Date set(Date date, int calendarField, int amount) {
+ Calendar c = Calendar.getInstance();
+ c.setLenient(false);
+ c.setTime(date);
+ c.add(calendarField, amount);
+ return c.getTime();
+ }
- public static Date setMinutes(Date date, int amount) {
- return set(date, Calendar.MINUTE, amount);
- }
+ public static Date setMinutes(Date date, int amount) {
+ return set(date, Calendar.MINUTE, amount);
+ }
- public static long getNowSecond() {
- Calendar calendar = Calendar.getInstance();
- return calendar.getTimeInMillis() / 1000;
- }
+ public static long getNowSecond() {
+ Calendar calendar = Calendar.getInstance();
+ return calendar.getTimeInMillis() / 1000;
+ }
- public static String getUTCTime(Long timeInMillisSecond) {
- Calendar time = Calendar.getInstance();
- SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
- fmt.setTimeZone(TimeZone.getTimeZone("UTC"));
- time.setTimeInMillis(timeInMillisSecond);
- return fmt.format(time.getTime());
- }
+ public static String getUTCTime(Long timeInMillisSecond) {
+ Calendar time = Calendar.getInstance();
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
+ fmt.setTimeZone(TimeZone.getTimeZone("UTC"));
+ time.setTimeInMillis(timeInMillisSecond);
+ return fmt.format(time.getTime());
+ }
- public static String getUTCTime() {
- return getUTCTime(System.currentTimeMillis());
- }
+ public static String getUTCTime() {
+ return getUTCTime(System.currentTimeMillis());
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java b/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
index 7ea105c..f00bbc3 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/HmacUtil.java
@@ -97,7 +97,7 @@
return false;
}
- public static void main(String[] args) {
+ /* public static void main(String[] args) {
String refno = DateUtil.getNow();
Map<String, String> mapValue = new HashMap<String, String>();
mapValue.put("tradeaccount", "10000097");
@@ -112,5 +112,5 @@
System.out.println("{\"tradeaccount\":\"10000097\",\"tradename\":\"在线点餐\",\"tradeamount\":\"1\"," +
"\"paidamount\": \"1\",\"outtradeno\":\"" + refno + "\",\"yktshopid\": \"2\",\"shopid\":\"68512084\",\"sign\": \"" + sign + "\"}");
}
-
+*/
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/ImportExcelUtil.java b/src/main/java/com/supwisdom/dlpay/framework/util/ImportExcelUtil.java
index c14a1a6..a5eb64b 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/ImportExcelUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/ImportExcelUtil.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package com.supwisdom.dlpay.framework.util;
@@ -30,6 +30,7 @@
public class ImportExcelUtil {
static SimpleDateFormat sFormat = new SimpleDateFormat("yyyyMMdd");
+
/**
* @param excelFile
* @return
@@ -43,13 +44,10 @@
}
if (POIFSFileSystem.hasPOIFSHeader(excelFile)) {//2003
return (Workbook) new HSSFWorkbook(excelFile);
- }
- else
- if (POIXMLDocument.hasOOXMLHeader(excelFile)) {//2007
+ } else if (POIXMLDocument.hasOOXMLHeader(excelFile)) {//2007
return new XSSFWorkbook(OPCPackage.open(excelFile));
- }
- else {
- System.out.println("其他版本");
+ } else {
+ System.out.println("其他版本");
return null;
}
@@ -150,25 +148,24 @@
String cellvalue = "";
if (cell != null) {
switch (cell.getCellType()) {
- case Cell.CELL_TYPE_NUMERIC:
- case Cell.CELL_TYPE_FORMULA: {
+ case Cell.CELL_TYPE_NUMERIC:
+ case Cell.CELL_TYPE_FORMULA: {
- if ( cell instanceof Date) {
- // cellvalue = cell.getDateCellValue().toLocaleString();
- Date date = cell.getDateCellValue();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
- cellvalue = sdf.format(date);
+ if (cell instanceof Date) {
+ // cellvalue = cell.getDateCellValue().toLocaleString();
+ Date date = cell.getDateCellValue();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ cellvalue = sdf.format(date);
+ } else {
+ cellvalue = String.valueOf(cell.getNumericCellValue());
+ }
+ break;
}
- else {
- cellvalue = String.valueOf(cell.getNumericCellValue());
- }
- break;
- }
- case Cell.CELL_TYPE_STRING:
- cellvalue = cell.getRichStringCellValue().getString();
- break;
- default:
- cellvalue = " ";
+ case Cell.CELL_TYPE_STRING:
+ cellvalue = cell.getRichStringCellValue().getString();
+ break;
+ default:
+ cellvalue = " ";
}
} else {
cellvalue = "";
@@ -199,26 +196,26 @@
while (cells.hasNext()) {
HSSFCell cell = (HSSFCell) cells.next();
switch (cell.getCellType()) {
- case HSSFCell.CELL_TYPE_NUMERIC:
- DecimalFormat df = new DecimalFormat("0");
- String numberCode = df.format(cell.getNumericCellValue());
- data[row.getRowNum()][cell.getCellNum()] = numberCode;
- break;
- case HSSFCell.CELL_TYPE_STRING:
- data[row.getRowNum()][cell.getCellNum()] = cell
- .getStringCellValue();
- break;
- case HSSFCell.CELL_TYPE_BOOLEAN:
- data[row.getRowNum()][cell.getCellNum()] = cell
- .getBooleanCellValue();
- break;
- case HSSFCell.CELL_TYPE_FORMULA:
- data[row.getRowNum()][cell.getCellNum()] = cell
- .getCellFormula();
- break;
- default:
- data[row.getRowNum()][cell.getCellNum()] = "";
- break;
+ case HSSFCell.CELL_TYPE_NUMERIC:
+ DecimalFormat df = new DecimalFormat("0");
+ String numberCode = df.format(cell.getNumericCellValue());
+ data[row.getRowNum()][cell.getCellNum()] = numberCode;
+ break;
+ case HSSFCell.CELL_TYPE_STRING:
+ data[row.getRowNum()][cell.getCellNum()] = cell
+ .getStringCellValue();
+ break;
+ case HSSFCell.CELL_TYPE_BOOLEAN:
+ data[row.getRowNum()][cell.getCellNum()] = cell
+ .getBooleanCellValue();
+ break;
+ case HSSFCell.CELL_TYPE_FORMULA:
+ data[row.getRowNum()][cell.getCellNum()] = cell
+ .getCellFormula();
+ break;
+ default:
+ data[row.getRowNum()][cell.getCellNum()] = "";
+ break;
}
}
}
@@ -226,66 +223,66 @@
}
/**
- * @return��List<Object[][]> oList
+ * @return��List<Object[][]> oList
* @param��InputStream excelFile
* @Description:check Input Stream
*/
public static List<Object[][]> checkInputStream(InputStream excelFile) {
- try{
- if (!excelFile.markSupported()) {//������Ĵ�
- excelFile = new PushbackInputStream(excelFile, 8);
- }
+ try {
+ if (!excelFile.markSupported()) {//������Ĵ�
+ excelFile = new PushbackInputStream(excelFile, 8);
+ }
// if (POIFSFileSystem.hasPOIFSHeader(excelFile)) {
// List<Object[][]> oList= ImportExcelUtil.getIntegralData(excelFile);
// return oList;
// } else
- if (POIXMLDocument.hasOOXMLHeader(excelFile)) {
- List<Object[][]> oList=ImportExcelUtil.getIntegralData07(excelFile);
- return oList;
- }
- }catch(IOException e){
+ if (POIXMLDocument.hasOOXMLHeader(excelFile)) {
+ List<Object[][]> oList = ImportExcelUtil.getIntegralData07(excelFile);
+ return oList;
+ }
+ } catch (IOException e) {
// System.out.print("999999999 The error is::::");
- e.printStackTrace();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- System.out.print("999999999 The error is::::");
- e.printStackTrace();
- }
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ System.out.print("999999999 The error is::::");
+ e.printStackTrace();
+ }
- return null;
+ return null;
}
/**
- * @return�� List<Object[][]> oList
+ * @return�� List<Object [ ] [ ]> oList
* @param��InputStream excelFile
* @Description:excel03 import
*/
- @SuppressWarnings({ "rawtypes", "deprecation" })
- public static List<Object[][]> getIntegralData(InputStream excelFile)throws Exception {
+ @SuppressWarnings({"rawtypes", "deprecation"})
+ public static List<Object[][]> getIntegralData(InputStream excelFile) throws Exception {
- POIFSFileSystem fs = new POIFSFileSystem(excelFile);
+ POIFSFileSystem fs = new POIFSFileSystem(excelFile);
HSSFWorkbook wb = new HSSFWorkbook(fs);
List<Object[][]> oList = new ArrayList<Object[][]>();
HSSFSheet sheet = wb.getSheetAt(0);
- Iterator rows = sheet.rowIterator();
- int coloumNum = sheet.getRow(0).getPhysicalNumberOfCells();
+ Iterator rows = sheet.rowIterator();
+ int coloumNum = sheet.getRow(0).getPhysicalNumberOfCells();
// System.out.println("66666 coloumNum:::"+coloumNum);
- Object data[][] = new Object[sheet.getLastRowNum() + 1][coloumNum];
- while (rows.hasNext()) {
- HSSFRow row = (HSSFRow) rows.next();
- Iterator cells = row.cellIterator();
+ Object data[][] = new Object[sheet.getLastRowNum() + 1][coloumNum];
+ while (rows.hasNext()) {
+ HSSFRow row = (HSSFRow) rows.next();
+ Iterator cells = row.cellIterator();
- while (cells.hasNext()) {
- HSSFCell cell = (HSSFCell) cells.next();
-
- //默认设置前三个字段为string类型
-// for(int i=0;i<=2;i++){
-// HSSFCell cell1 = row.getCell(i);
-// cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
-// }
-
+ while (cells.hasNext()) {
+ HSSFCell cell = (HSSFCell) cells.next();
+ cell.setCellType(HSSFCell.CELL_TYPE_STRING);
+ //默认设置前三个字段为string类型
+ /* for(int i=0;i<=2;i++){
+ HSSFCell cell1 = row.getCell(i);
+ cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
+ }*/
+/*
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC:
data[row.getRowNum()][cell.getCellNum()] = (long)cell.
@@ -303,11 +300,13 @@
data[row.getRowNum()][cell.getCellNum()] = cell
.getCellFormula();
break;
- }
- }
- }
+ }*/
+ data[row.getRowNum()][cell.getCellNum()] = cell
+ .getStringCellValue();
+ }
+ }
- oList.add(data);
+ oList.add(data);
return oList;
}
@@ -315,62 +314,62 @@
/**
* 2007-xlsx格式
- * @return�� List<Object[][]> oList
+ * @return�� List<Object [ ] [ ]> oList
* @param��InputStream excelFile
* @Description:excel07 import
*/
- public static List<Object[][]> getIntegralData07(InputStream excelFile)throws Exception, IOException {
- OPCPackage op=OPCPackage.open(excelFile);
+ public static List<Object[][]> getIntegralData07(InputStream excelFile) throws Exception, IOException {
+ OPCPackage op = OPCPackage.open(excelFile);
XSSFWorkbook xwb = new XSSFWorkbook(op);
List<Object[][]> oList = new ArrayList<Object[][]>();
- for (int k = 0; k < xwb.getNumberOfSheets(); k++){
- XSSFSheet sheet = xwb.getSheetAt(k);
- Iterator<Row> rows = sheet.rowIterator();
- int coloumNum = sheet.getRow(0).getPhysicalNumberOfCells();// get number of columns
- Object data[][] = new Object[sheet.getLastRowNum() + 1][coloumNum];
- while (rows.hasNext()) {
- XSSFRow row = (XSSFRow) rows.next();
- Iterator<Cell> cells = row.cellIterator();
- while (cells.hasNext()) {
- XSSFCell cell = (XSSFCell) cells.next();
-// for (int i=0;i<3;i++){
-// cell.setCellType(XSSFCell.CELL_TYPE_STRING);
-// }
- switch (cell.getCellType()) {
- case XSSFCell.CELL_TYPE_NUMERIC:
- if (100000000 < cell.getNumericCellValue()) {
- double d = cell.getNumericCellValue();
- Date date = HSSFDateUtil.getJavaDate(d);
- data[row.getRowNum()][cell.getColumnIndex()] = sFormat
- .format(date);
- } else {
- DecimalFormat df = new DecimalFormat("0");
- String numberCode = df.format(cell
- .getNumericCellValue());
- data[row.getRowNum()][cell.getColumnIndex()] = numberCode;
- }
- break;
- case XSSFCell.CELL_TYPE_STRING:
- data[row.getRowNum()][cell.getColumnIndex()] = cell
- .getStringCellValue();
- break;
- case XSSFCell.CELL_TYPE_BOOLEAN:
- data[row.getRowNum()][cell.getColumnIndex()] = cell
- .getBooleanCellValue();
- break;
- case XSSFCell.CELL_TYPE_FORMULA:
- data[row.getRowNum()][cell.getColumnIndex()] = cell
- .getCellFormula();
- break;
- default:
- data[row.getRowNum()][cell.getColumnIndex()] = "";
- break;
- }
- }
- }
- oList.add(data);
+ for (int k = 0; k < xwb.getNumberOfSheets(); k++) {
+ XSSFSheet sheet = xwb.getSheetAt(k);
+ Iterator<Row> rows = sheet.rowIterator();
+ int coloumNum = sheet.getRow(0).getPhysicalNumberOfCells();// get number of columns
+ Object data[][] = new Object[sheet.getLastRowNum() + 1][coloumNum];
+ while (rows.hasNext()) {
+ XSSFRow row = (XSSFRow) rows.next();
+ Iterator<Cell> cells = row.cellIterator();
+ while (cells.hasNext()) {
+ XSSFCell cell = (XSSFCell) cells.next();
+ for (int i = 0; i < 3; i++) {
+ cell.setCellType(XSSFCell.CELL_TYPE_STRING);
+ }
+ switch (cell.getCellType()) {
+ case XSSFCell.CELL_TYPE_NUMERIC:
+ if (100000000 < cell.getNumericCellValue()) {
+ double d = cell.getNumericCellValue();
+ Date date = HSSFDateUtil.getJavaDate(d);
+ data[row.getRowNum()][cell.getColumnIndex()] = sFormat
+ .format(date);
+ } else {
+ DecimalFormat df = new DecimalFormat("0");
+ String numberCode = df.format(cell
+ .getNumericCellValue());
+ data[row.getRowNum()][cell.getColumnIndex()] = numberCode;
+ }
+ break;
+ case XSSFCell.CELL_TYPE_STRING:
+ data[row.getRowNum()][cell.getColumnIndex()] = cell
+ .getStringCellValue();
+ break;
+ case XSSFCell.CELL_TYPE_BOOLEAN:
+ data[row.getRowNum()][cell.getColumnIndex()] = cell
+ .getBooleanCellValue();
+ break;
+ case XSSFCell.CELL_TYPE_FORMULA:
+ data[row.getRowNum()][cell.getColumnIndex()] = cell
+ .getCellFormula();
+ break;
+ default:
+ data[row.getRowNum()][cell.getColumnIndex()] = "";
+ break;
+ }
+ }
+ }
+ oList.add(data);
}
return oList;
}
-
+
}
\ No newline at end of file
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/TransDtlSearchBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TransDtlSearchBean.java
new file mode 100644
index 0000000..54ea4c9
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TransDtlSearchBean.java
@@ -0,0 +1,85 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+import com.supwisdom.dlpay.system.bean.PageBean;
+
+public class TransDtlSearchBean extends PageBean {
+
+ private String refno;
+ private String custname;
+ private String startdate;
+ private String enddate;
+ private Integer termid;
+ private Integer status;
+ private Integer shopid;
+
+
+
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ public String getStartdate() {
+ return startdate;
+ }
+
+ public void setStartdate(String startdate) {
+ this.startdate = startdate;
+ }
+
+ public String getEnddate() {
+ return enddate;
+ }
+
+ public void setEnddate(String enddate) {
+ this.enddate = enddate;
+ }
+
+ public Integer getTermid() {
+ return termid;
+ }
+
+ public void setTermid(Integer termid) {
+ this.termid = termid;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ public Integer getShopid() {
+ return shopid;
+ }
+
+ public void setShopid(Integer shopid) {
+ this.shopid = shopid;
+ }
+
+ @Override
+ public String toString() {
+ return "TransDtlSearchBean+++++{" +
+ "refno='" + refno + '\'' +
+ ", custname='" + custname + '\'' +
+ ", startdate='" + startdate + '\'' +
+ ", enddate='" + enddate + '\'' +
+ ", termid=" + termid +
+ ", status=" + status +
+ ", shopid=" + shopid +
+ '}';
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceController.java
index 8ea5883..2d0aad2 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceController.java
@@ -91,11 +91,10 @@
@RequestMapping("/download")
@PreAuthorize("hasPermission('/device/download','')")
@ResponseBody
- public JsonResult downloadfile(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public JsonResult downloadfile(HttpServletRequest request, HttpServletResponse response){
String[] titles0 = {"设备物理ID", "设备厂商", "所属商户ID"
}; //表头
- String[][] info0 = {{"30F32B1C", "XKP", "3000000"
- }}; // 示例内容
+ String[][] info0 = {{"30F32B1C", "XKP", "3000000"},{"30F32B2C", "XKP", "3000001"}}; // 示例内容
String fileName0 = "设备导入模板";// 保存数据
try {
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
new file mode 100644
index 0000000..b62a81d
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
@@ -0,0 +1,116 @@
+package com.supwisdom.dlpay.restaurant.controller;
+
+
+import com.google.gson.Gson;
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.domain.TShopSettlement;
+import com.supwisdom.dlpay.framework.util.*;
+import com.supwisdom.dlpay.restaurant.bean.AreaSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TransDtlSearchBean;
+import com.supwisdom.dlpay.restaurant.domain.TArea;
+import com.supwisdom.dlpay.restaurant.domain.TTransDtl;
+import com.supwisdom.dlpay.restaurant.service.AreaService;
+import com.supwisdom.dlpay.restaurant.service.ShopSettlementService;
+import com.supwisdom.dlpay.restaurant.service.TransDtlService;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/transdtl")
+public class TransDtlController {
+ @Autowired
+ private TransDtlService transDtlService;
+
+ @Autowired
+ private ShopSettlementService shopSettlementService;
+
+ @RequestMapping("/index")
+ public String indexView(ModelMap model) {
+ List<TShopSettlement> lst = shopSettlementService.getAllShopSettlement();
+ Map<Integer, String> map = new HashMap<>();
+ for (TShopSettlement shop : lst) {
+ map.put(shop.getShopid(), shop.getShopname());
+ }
+ String startDate = DateUtil.getNewDay(-7, "yyyy-MM-dd");
+ String endDate = DateUtil.getNow("yyyy-MM-dd");
+
+ Gson gson = new Gson();
+ String gsonString = gson.toJson(map);
+ model.addAttribute("shoplistForSelect", lst);
+ model.addAttribute("shopList", gsonString);
+ model.addAttribute("startDate", startDate);
+ model.addAttribute("endDate", endDate);
+ return "restaurant/transdtl/index";
+ }
+
+ @RequestMapping("/list")
+ @ResponseBody
+ public PageResult<TTransDtl> getDataList(@RequestParam("page") Integer pageNo,
+ @RequestParam("limit") Integer pageSize,
+ @RequestParam(value = "custname", required = false) String custname,
+ @RequestParam(value = "shopid", required = false) Integer shopid,
+ @RequestParam(value = "startdate", required = false) String startdate,
+ @RequestParam(value = "enddate", required = false) String enddate,
+ @RequestParam(value = "refno", required = false) String refno,
+ @RequestParam(value = "status", required = false) Integer status,
+ @RequestParam(value = "termid", required = false) Integer termid) {
+ try {
+ if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+ if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+ TransDtlSearchBean bean = getTransDtlSearchBean(custname, shopid, startdate, enddate, refno, status, termid);
+ bean.setPageNo(pageNo);
+ bean.setPageSize(pageSize);
+
+ return transDtlService.getTransDtlByParam(bean);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
+ }
+ }
+
+ @RequestMapping("/export")
+ @ResponseBody
+ public JsonResult downloadfile(@RequestParam(value = "custname", required = false) String custname,
+ @RequestParam(value = "shopid", required = false) Integer shopid,
+ @RequestParam(value = "startdate", required = false) String startdate,
+ @RequestParam(value = "enddate", required = false) String enddate,
+ @RequestParam(value = "refno", required = false) String refno,
+ @RequestParam(value = "status", required = false) Integer status,
+ @RequestParam(value = "termid", required = false) Integer termid,
+ HttpServletRequest request, HttpServletResponse response) {
+
+ TransDtlSearchBean bean = getTransDtlSearchBean(custname, shopid, startdate, enddate, refno, status, termid);
+ System.out.println(bean.toString());
+ return transDtlService.export(bean, request, response);
+ }
+
+ private TransDtlSearchBean getTransDtlSearchBean( String custname, Integer shopid, String startdate, String enddate, String refno,Integer status, Integer termid) {
+ TransDtlSearchBean bean = new TransDtlSearchBean();
+ bean.setCustname(custname);
+ bean.setEnddate(enddate);
+ bean.setRefno(refno);
+ bean.setStatus(status);
+ bean.setShopid(shopid);
+ if (StringUtil.isEmpty(startdate) || StringUtil.isEmpty(enddate)) {
+ bean.setStartdate(DateUtil.getNewDay(-7, "yyyyMMdd"));
+ bean.setEnddate(DateUtil.getNow("yyyyMMdd"));
+ } else {
+ bean.setStartdate(DateUtil.unParseToDateFormat(startdate));
+ bean.setEnddate(DateUtil.unParseToDateFormat(enddate));
+
+ }
+ bean.setTermid(termid);
+ return bean;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/dao/TransDtlDao.java b/src/main/java/com/supwisdom/dlpay/restaurant/dao/TransDtlDao.java
new file mode 100644
index 0000000..90d5ed6
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/dao/TransDtlDao.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.restaurant.dao;
+
+
+import com.supwisdom.dlpay.restaurant.domain.TTransDtl;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface TransDtlDao extends JpaRepository<TTransDtl, String>, JpaSpecificationExecutor<TTransDtl> {
+
+
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TTransDtl.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TTransDtl.java
new file mode 100644
index 0000000..ae3df29
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TTransDtl.java
@@ -0,0 +1,143 @@
+package com.supwisdom.dlpay.restaurant.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_TRANSDTL")
+public class TTransDtl {
+
+ private String refno;
+ private String custname;
+ private String cardno;
+ private Double amount;
+ private String transdate;
+ private String transtime;
+ private String accdate;
+ private String acctime;
+ private Integer termid;
+ private Integer status;
+ private Integer revflag;
+ private String transtype;
+ private Integer shopid;
+
+
+
+ @Id
+ @Column(name = "refno", unique = true, nullable = false, length = 20)
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ @Column(name = "custname", length = 30)
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ @Column(name = "cardno", length = 30)
+ public String getCardno() {
+ return cardno;
+ }
+
+ public void setCardno(String cardno) {
+ this.cardno = cardno;
+ }
+
+ @Column(name = "amount", precision = 15)
+ public Double getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Double amount) {
+ this.amount = amount;
+ }
+
+ @Column(name = "transdate", length = 8)
+ public String getTransdate() {
+ return transdate;
+ }
+
+ public void setTransdate(String transdate) {
+ this.transdate = transdate;
+ }
+
+ @Column(name = "transtime", length = 6)
+ public String getTranstime() {
+ return transtime;
+ }
+
+ public void setTranstime(String transtime) {
+ this.transtime = transtime;
+ }
+
+ @Column(name = "accdate", length = 8)
+ public String getAccdate() {
+ return accdate;
+ }
+
+ public void setAccdate(String accdate) {
+ this.accdate = accdate;
+ }
+
+ @Column(name = "acctime", length = 6)
+ public String getAcctime() {
+ return acctime;
+ }
+
+ public void setAcctime(String acctime) {
+ this.acctime = acctime;
+ }
+
+ @Column(name = "termid", length = 9)
+ public Integer getTermid() {
+ return termid;
+ }
+
+ public void setTermid(Integer termid) {
+ this.termid = termid;
+ }
+
+ @Column(name = "status", length = 1)
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ @Column(name = "revflag", length = 1)
+ public Integer getRevflag() {
+ return revflag;
+ }
+
+ public void setRevflag(Integer revflag) {
+ this.revflag = revflag;
+ }
+
+ @Column(name = "transtype", length = 5)
+ public String getTranstype() {
+ return transtype;
+ }
+
+ public void setTranstype(String transtype) {
+ this.transtype = transtype;
+ }
+
+
+ @Column(name = "shopid", length = 9)
+ public Integer getShopid() {
+ return shopid;
+ }
+
+ public void setShopid(Integer shopid) {
+ this.shopid = shopid;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/ShopSettlementService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/ShopSettlementService.java
new file mode 100644
index 0000000..cc16a3a
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/ShopSettlementService.java
@@ -0,0 +1,15 @@
+package com.supwisdom.dlpay.restaurant.service;
+
+import com.supwisdom.dlpay.framework.domain.TShopSettlement;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface ShopSettlementService {
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+ List<TShopSettlement> getAllShopSettlement();
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/TransDtlService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/TransDtlService.java
new file mode 100644
index 0000000..0d22d37
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/TransDtlService.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.restaurant.service;
+
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.restaurant.bean.TransDtlSearchBean;
+import com.supwisdom.dlpay.restaurant.domain.TTransDtl;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+public interface TransDtlService {
+
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+ PageResult<TTransDtl> getTransDtlByParam(TransDtlSearchBean param);
+
+ JsonResult export(TransDtlSearchBean bean, HttpServletRequest request, HttpServletResponse response);
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java
index 67b05ad..99a45d5 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java
@@ -81,7 +81,7 @@
if (StringUtil.isEmpty((String) data[i][0]) || StringUtil.isEmpty((String) data[i][1]) || StringUtil.isEmpty((String) data[i][2])) {
msg = msg + "第" + i + "行,关键字段缺失。<br/>";
} else if (customerDao.countByCardno((String) data[i][1]) >0) {
- msg = msg + "第" + i + "行,改市名卡已存在。<br/>";
+ msg = msg + "第" + i + "行,该市名卡已存在。<br/>";
}
else{
TCustomer d=new TCustomer();
@@ -89,8 +89,7 @@
d.setCardno((String) data[i][1]);
d.setBankcardno((String) data[i][2]);
if(null!=data[i][3]){
- Long p=(Long) data[i][3];
- d.setPhone(p.toString());
+ d.setPhone((String) data[i][3]);
}
sList.add(d);
}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/ShopSettlementServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/ShopSettlementServiceImpl.java
new file mode 100644
index 0000000..41f043d
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/ShopSettlementServiceImpl.java
@@ -0,0 +1,30 @@
+package com.supwisdom.dlpay.restaurant.service.impl;
+
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.dao.ShopSettlementDao;
+import com.supwisdom.dlpay.framework.domain.TShopSettlement;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.restaurant.bean.AreaSearchBean;
+import com.supwisdom.dlpay.restaurant.dao.AreaDao;
+import com.supwisdom.dlpay.restaurant.domain.TArea;
+import com.supwisdom.dlpay.restaurant.service.AreaService;
+import com.supwisdom.dlpay.restaurant.service.ShopSettlementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ShopSettlementServiceImpl implements ShopSettlementService {
+ @Autowired
+ private ShopSettlementDao shopSettlementDao;
+
+ @Override
+ public List<TShopSettlement> getAllShopSettlement() {
+ return shopSettlementDao.findAll();
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
new file mode 100644
index 0000000..c9c5ed1
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
@@ -0,0 +1,129 @@
+package com.supwisdom.dlpay.restaurant.service.impl;
+
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.dao.ShopSettlementDao;
+import com.supwisdom.dlpay.framework.domain.TShopSettlement;
+import com.supwisdom.dlpay.framework.util.ExportExcel;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.restaurant.bean.TransDtlSearchBean;
+import com.supwisdom.dlpay.restaurant.dao.TransDtlDao;
+import com.supwisdom.dlpay.restaurant.domain.TTransDtl;
+import com.supwisdom.dlpay.restaurant.service.TransDtlService;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class TransDtlServiceImpl implements TransDtlService {
+ @Autowired
+ private TransDtlDao transDtlDao;
+ @Autowired
+ private ShopSettlementDao shopSettlementDao;
+
+ @Override
+ public PageResult<TTransDtl> getTransDtlByParam(TransDtlSearchBean param) {
+ Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
+ , Sort.by("refno"));
+
+ Specification<TTransDtl> spec = gettTransDtlSpecification(param);
+
+ return new PageResult<>(transDtlDao.findAll(spec, pageable));
+ }
+
+ @NotNull
+ private Specification<TTransDtl> gettTransDtlSpecification(TransDtlSearchBean param) {
+ return new Specification<TTransDtl>() { //查询条件构造
+ @Override
+ public Predicate toPredicate(Root<TTransDtl> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
+ List<Predicate> list = new ArrayList<>();
+
+ if (!StringUtil.isEmpty(param.getRefno())) {
+ list.add(cb.like(root.get("refno").as(String.class), "%" + param.getRefno() + "%"));
+ }
+ if (!StringUtil.isEmpty(param.getCustname())) {
+ list.add(cb.like(root.get("custname").as(String.class), "%" + param.getCustname() + "%"));
+ }
+ if (!StringUtil.isEmpty(param.getStartdate())) {
+ list.add(cb.greaterThanOrEqualTo(root.get("accdate").as(String.class), param.getStartdate()));
+ }
+ if (!StringUtil.isEmpty(param.getEnddate())) {
+ list.add(cb.lessThanOrEqualTo(root.get("accdate").as(String.class), param.getEnddate()));
+ }
+ if (null!=param.getShopid()) {
+ list.add(cb.like(root.get("shopid").as(String.class), param.getShopid().toString()));
+ }
+ if (null!=param.getStatus()) {
+ list.add(cb.like(root.get("status").as(String.class), param.getStatus().toString()));
+ }
+ if (null!=param.getTermid()) {
+ list.add(cb.like(root.get("termid").as(String.class), param.getTermid().toString()));
+ }
+
+ return cb.and(list.toArray(new Predicate[list.size()]));
+ }
+ };
+ }
+
+ @Override
+ public JsonResult export(TransDtlSearchBean bean, HttpServletRequest request, HttpServletResponse response) {
+ String[] titles0 = {"姓名", "交易号", "交易金额","交易时间","记账时间","终端号","商户","流水状态","流水类型"
+ }; //表头
+ String fileName0 = "食堂流水";// 保存数据
+ String[][] info0 = {{}};
+ Specification<TTransDtl> spec = gettTransDtlSpecification(bean);
+ List<TTransDtl> dtl=transDtlDao.findAll(spec);
+ Integer cnt=dtl.size();
+ if(cnt>0 ){
+ System.out.println("---init here---");
+ info0=new String[cnt][titles0.length];
+ List<TShopSettlement> shop=shopSettlementDao.findAll();
+ Map<Integer,String > shopmap=new HashMap<>();
+ for(TShopSettlement s:shop){
+ shopmap.put(s.getShopid(),s.getShopname());
+ }
+ for(int i=0;i<cnt;i++){
+ TTransDtl t=dtl.get(i);
+ info0[i][0]=t.getCustname();
+ info0[i][1]=t.getRefno();
+ info0[i][2]=t.getAmount().toString();
+ info0[i][3]=t.getAccdate();
+ info0[i][4]=t.getTransdate();
+ info0[i][5]=t.getTermid().toString();
+ info0[i][6]=shopmap.get(t.getShopid());
+ String status="";
+ switch (t.getStatus()){
+ case 1:status="未入账"; break;
+ case 0:status="已入账"; break;
+ default:status="未知状态";
+ }
+ info0[i][7]=status;
+ info0[i][8]=t.getTranstype();
+
+ }
+ }
+
+ try {
+ ExportExcel.queryexcel(fileName0, titles0,info0,request, response);
+ return JsonResult.ok("操作成功");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return JsonResult.error("操作失败");
+ }
+}
diff --git a/src/main/resources/static/custom/module/index.js b/src/main/resources/static/custom/module/index.js
index df14f67..d82ed09 100755
--- a/src/main/resources/static/custom/module/index.js
+++ b/src/main/resources/static/custom/module/index.js
@@ -5,7 +5,7 @@
var baseUrl = window.location.pathname;
var index = {
- pageTabs: true, // 是否开启多标签
+ pageTabs: false, // 是否开启多标签
// 路由注册
initRouter: function () {
// 自动扫描side菜单注册
diff --git a/src/main/resources/templates/restaurant/area/index.html b/src/main/resources/templates/restaurant/area/index.html
index 33027c3..e80dca3 100644
--- a/src/main/resources/templates/restaurant/area/index.html
+++ b/src/main/resources/templates/restaurant/area/index.html
@@ -22,9 +22,6 @@
var rawlist=$("#arealist").val();
var arealist=JSON.parse(rawlist);
- $(function () {
- console.log(arealist);
- });
layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
let form = layui.form;
diff --git a/src/main/resources/templates/restaurant/transdtl/index.html b/src/main/resources/templates/restaurant/transdtl/index.html
new file mode 100644
index 0000000..b3ca601
--- /dev/null
+++ b/src/main/resources/templates/restaurant/transdtl/index.html
@@ -0,0 +1,240 @@
+<div class="layui-card">
+ <div class="layui-card-header">
+ <h2 class="header-title">食堂流水表</h2>
+ <span class="layui-breadcrumb pull-right">
+ <a href="#">食堂流水表</a>
+ <a><cite>食堂流水表</cite></a>
+ </span>
+ </div>
+ <div class="layui-card-body">
+ <div class="layui-form toolbar">
+ <form id="form" >
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label">交易日期:</label>
+ <div class="layui-input-inline">
+ <input type="text" name="startdate" class="layui-input" th:value="${startDate}"
+ id="startdate" placeholder="yyyy-MM-dd">
+ </div>
+ <div class="layui-input-inline">
+ <input type="text" name="enddate" class="layui-input" th:value="${endDate}"
+ id="enddate" placeholder="yyyy-MM-dd">
+ </div>
+ </div>
+ </div>
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label"> 姓名:</label>
+ <div class="layui-input-inline">
+ <input id="custname" name="custname" class="layui-input" type="text"/>
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label"> 交易号:</label>
+ <div class="layui-input-inline">
+ <input id="refno" name="refno" class="layui-input " type="text"/>
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label">终端号:</label>
+ <div class="layui-input-inline">
+ <input id="termid" name="termid" class="layui-input " type="text"/>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label"> 商户:</label>
+ <div class="layui-input-inline">
+ <select name="shopid" id="shopid">
+ <option th:each="shop : ${shoplistForSelect}" th:value="${shop.shopid}">[[${shop.shopname}]]</option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label">流水状态:</label>
+ <div class="layui-input-inline">
+ <select name="status" id="status">
+ <option value="" selected>全部</option>
+ <option value="1">已入账</option>
+ <option value="0">未入账</option>
+ </select>
+ </div>
+ </div>
+ <div class="layui-inline" style="margin-left:5%">
+ <button id="btn-search" class="layui-btn icon-btn" data-type="search">
+ <i class="layui-icon"></i>搜索
+ </button>
+ <button id="btn-reset" class="layui-btn layui-btn-primary">重置
+ </button>
+ <!-- <button id="btn-export" lay-filter="form-submit" lay-submit class="layui-btn layui-btn-primary">导出
+ </button>-->
+ <a id="btn-export" href="javascript:void(0);" class="layui-btn layui-btn-primary" >导出</a>
+ </div>
+ </div>
+ </form>
+
+ </div>
+ <table class="layui-table" id="table" lay-filter="table"></table>
+ </div>
+</div>
+<input hidden th:value="${shopList}" id="shoplist">
+<script>
+
+ var rawlist = $("#shoplist").val();
+ var shoplist = JSON.parse(rawlist);
+
+ layui.use(['form', 'table', 'layer', 'admin', 'element', 'laydate'], function () {
+ let form = layui.form;
+ let table = layui.table;
+ let admin = layui.admin;
+
+ var max = $("#enddate").val();
+
+ form.render('select');
+ var laydate = layui.laydate;
+ laydate.render({
+ elem: '#startdate',
+ btns: ['now', 'confirm'],
+ trigger: 'click',
+ max: max
+ });
+ laydate.render({
+ elem: '#enddate',
+ btns: ['now', 'confirm'],
+ trigger: 'click',
+ max: max
+ });
+
+ // 渲染表格
+ table.render({
+ elem: '#table',
+ url: '[[@{/transdtl/list}]]',
+ toolbar: true,
+ minWidth: 80,
+ defaultToolbar: ['filter', 'print'],
+ page: true,
+ cols: [
+ [
+ {field: 'custname', title: '姓名', fixed: 'left'},
+ {field: 'refno', title: '交易号', fixed: 'left', sort: true},
+ {field: 'amount', title: '交易金额', sort: true},
+ {
+ field: 'accdate',
+ title: '交易时间',
+ sort: true,
+ templet: function (item) {
+ var date = item.accdate;
+ if (date != null) {
+ return date.substr(0, 4) + '-' + date.substr(4, 2) + '-' + date.substr(6, 2);
+ }
+ return '';
+ }
+ },
+ {
+ field: 'transdate',
+ title: '记账时间',
+ sort: true,
+ templet: function (item) {
+ var date = item.transdate;
+ if (date != null) {
+ return date.substr(0, 4) + '-' + date.substr(4, 2) + '-' + date.substr(6, 2);
+ }
+ return '';
+ }
+ },
+ {field: 'termid', title: '终端号', sort: true},
+ {
+ field: 'shopid',
+ title: '商户',
+
+ align: 'center',
+ templet: function (item) {
+ return shoplist[item.shopid];
+ }
+ },
+ {
+ field: 'status',
+ title: '流水状态',
+
+ align: 'center',
+ templet: function (item) {
+ if (item.status == 0) {
+ return '未入账';
+ } else if (item.status == 1) {
+ return '已入账';
+ } else {
+ return '未知';
+ }
+ }
+ },
+ {
+ field: 'transtype',
+ title: '流水类型',
+ sort: true,
+
+ align: 'center',
+ templet: function (item) {
+ if (item.transtype == 'lj') {
+ return '联机';
+ } else if (item.transtype == 'tj') {
+ return '脱机';
+ } else {
+ return '未知';
+ }
+ }
+ },
+ ]
+ ]
+ });
+ $('#btn-export').click(function () {
+ var url = '[[@{/transdtl/export}]]';
+ /* $("#form").attr("action",url);
+
+ $("#form").submit();*/
+ var param = $("#form").serialize();
+ console.log(param);
+
+ $("#btn-export").attr("href", url + "?" + param);
+ $("#btn-export")[0].click();
+ });
+ // 搜索按钮点击事件
+ $('#btn-search').click(function () {
+ let custname = $('#custname').val();
+ let shopid = $('#shopid').val();
+ let startdate = $('#startdate').val();
+ let enddate = $('#enddate').val();
+ let refno = $('#refno').val();
+ let status = $('#status').val();
+ let termid = $('#termid').val();
+ table.reload('table', {
+ where: {
+ custname: custname,
+ shopid: shopid,
+ startdate: startdate,
+ enddate: enddate,
+ refno: refno,
+ status: status,
+ termid: termid
+ }, page: {curr: 1}
+ });
+ //页面存在form需要返回false,否则layui自动刷新
+ return false;
+
+
+ });
+
+ $('#btn-reset').click(function () {
+ $(".layui-input").val("");
+ $("select").val("");
+ return false;
+
+ });
+
+ });
+
+
+ // 工具条点击事件
+
+</script>
diff --git a/src/main/resources/templates/system/function/form.html b/src/main/resources/templates/system/function/form.html
index e1468be..834c527 100755
--- a/src/main/resources/templates/system/function/form.html
+++ b/src/main/resources/templates/system/function/form.html
@@ -80,7 +80,6 @@
form.on('submit(form-submit)', function (data) {
layer.load(2);
let token = $("meta[name='_csrf_token']").attr("value");
- debugger
$.ajax({
type : "POST",
dataType : "json",