Pre Merge pull request !379 from mnisummer/master
This commit is contained in:
commit
0c29e0f3aa
|
|
@ -17,61 +17,40 @@
|
||||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
//合并行 & 合并列
|
||||||
|
let columns = [
|
||||||
|
[
|
||||||
|
{ checkbox : true, rowspan : 2 },
|
||||||
|
{ title : '基本信息', align : 'center', colspan : 5 },
|
||||||
|
{ title : '其他信息', align : 'center', colspan : 3 }
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{ field : 'userId', title : '用户ID' },
|
||||||
|
{ field : 'userCode', title : '用户编号' },
|
||||||
|
{ field : 'userName', title : '用户姓名' },
|
||||||
|
{ field : 'userPhone', title : '用户手机' },
|
||||||
|
{ field : 'userEmail', title : '用户邮箱' },
|
||||||
|
{ field : 'userBalance', title : '用户余额' },
|
||||||
|
{ field : 'status', title : '用户状态', formatter : function (value, row, index) {
|
||||||
|
return $.table.selectDictLabel(datas, value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ title : '操作', align : 'center', formatter : function (value, row, index) {
|
||||||
|
var actions = [];
|
||||||
|
actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
|
||||||
|
actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
|
||||||
|
return actions.join('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
];
|
||||||
var options = {
|
var options = {
|
||||||
url: prefix + "/list",
|
url: prefix + "/list",
|
||||||
showSearch: false,
|
showSearch: false,
|
||||||
showRefresh: false,
|
showRefresh: false,
|
||||||
showToggle: false,
|
showToggle: false,
|
||||||
showColumns: false,
|
showColumns: false,
|
||||||
columns : [
|
columns : columns
|
||||||
[{
|
|
||||||
title : '基本信息',
|
|
||||||
align : 'center',
|
|
||||||
colspan : 6
|
|
||||||
}, {
|
|
||||||
title : '其他信息',
|
|
||||||
align : 'center',
|
|
||||||
colspan : 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[{
|
|
||||||
checkbox : true
|
|
||||||
}, {
|
|
||||||
field : 'userId',
|
|
||||||
title : '用户ID'
|
|
||||||
}, {
|
|
||||||
field : 'userCode',
|
|
||||||
title : '用户编号'
|
|
||||||
}, {
|
|
||||||
field : 'userName',
|
|
||||||
title : '用户姓名'
|
|
||||||
}, {
|
|
||||||
field : 'userPhone',
|
|
||||||
title : '用户手机'
|
|
||||||
}, {
|
|
||||||
field : 'userEmail',
|
|
||||||
title : '用户邮箱'
|
|
||||||
}, {
|
|
||||||
field : 'userBalance',
|
|
||||||
title : '用户余额'
|
|
||||||
}, {
|
|
||||||
field : 'status',
|
|
||||||
title : '用户状态',
|
|
||||||
formatter : function (value, row, index) {
|
|
||||||
return $.table.selectDictLabel(datas, value);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
title : '操作',
|
|
||||||
align : 'center',
|
|
||||||
formatter : function (value, row, index) {
|
|
||||||
var actions = [];
|
|
||||||
actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
|
|
||||||
actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
|
|
||||||
return actions.join('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
$.table.init(options);
|
$.table.init(options);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
|
|
@ -23,6 +24,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
public static String YYYY_MM = "yyyy-MM";
|
public static String YYYY_MM = "yyyy-MM";
|
||||||
|
|
||||||
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||||
|
public static String YYYY_MM_DD_PATH = "yyyy/MM/dd";
|
||||||
|
|
||||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||||
|
|
||||||
|
|
@ -34,7 +36,43 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前Date型日期
|
* 获取年(4位数字)
|
||||||
|
* @param date
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getYear(Date date)
|
||||||
|
{
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(date);
|
||||||
|
return calendar.get(Calendar.YEAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取月份(1 - 12)
|
||||||
|
* @param date
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getMonth(Date date)
|
||||||
|
{
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(date);
|
||||||
|
return calendar.get(Calendar.MONTH) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取天数(一个月内)
|
||||||
|
* @param date
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getDayOfMonth(Date date)
|
||||||
|
{
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(date);
|
||||||
|
return calendar.get(Calendar.DAY_OF_MONTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前 Date型日期
|
||||||
*
|
*
|
||||||
* @return Date() 当前日期
|
* @return Date() 当前日期
|
||||||
*/
|
*/
|
||||||
|
|
@ -44,45 +82,46 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前日期, 默认格式为yyyy-MM-dd
|
* 获取当前日期, 默认格式为 yyyy-MM-dd
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String getDate()
|
public static String getDateNow()
|
||||||
{
|
{
|
||||||
return dateTimeNow(YYYY_MM_DD);
|
return parseDateToStr(YYYY_MM_DD, new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String getTime()
|
/**
|
||||||
|
* 获取当前日期时间, 默认格式为 yyyy-MM-dd HH:mm:ss
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static final String getDateTimeNow()
|
||||||
{
|
{
|
||||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
return parseDateToStr(YYYY_MM_DD_HH_MM_SS, new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTimeNow()
|
/**
|
||||||
{
|
* 获取当前日期时间, 按照指定格式
|
||||||
return dateTimeNow(YYYYMMDDHHMMSS);
|
*
|
||||||
}
|
* @param format 格式
|
||||||
|
* @return String
|
||||||
public static final String dateTimeNow(final String format)
|
*/
|
||||||
|
public static final String getDateTimeNow(final String format)
|
||||||
{
|
{
|
||||||
return parseDateToStr(format, new Date());
|
return parseDateToStr(format, new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String dateTime(final Date date)
|
|
||||||
{
|
|
||||||
return parseDateToStr(YYYY_MM_DD, date);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String parseDateToStr(final String format, final Date date)
|
public static final String parseDateToStr(final String format, final Date date)
|
||||||
{
|
{
|
||||||
return new SimpleDateFormat(format).format(date);
|
return new SimpleDateFormat(format).format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Date dateTime(final String format, final String ts)
|
public static final Date parseStrToDate(final String format, final String str)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new SimpleDateFormat(format).parse(ts);
|
return new SimpleDateFormat(format).parse(str);
|
||||||
}
|
}
|
||||||
catch (ParseException e)
|
catch (ParseException e)
|
||||||
{
|
{
|
||||||
|
|
@ -90,24 +129,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期路径 即年/月/日 如2018/08/08
|
|
||||||
*/
|
|
||||||
public static final String datePath()
|
|
||||||
{
|
|
||||||
Date now = new Date();
|
|
||||||
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期路径 即年/月/日 如20180808
|
|
||||||
*/
|
|
||||||
public static final String dateTime()
|
|
||||||
{
|
|
||||||
Date now = new Date();
|
|
||||||
return DateFormatUtils.format(now, "yyyyMMdd");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期型字符串转化为日期 格式
|
* 日期型字符串转化为日期 格式
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ public class FileUploadUtils
|
||||||
*/
|
*/
|
||||||
public static final String extractFilename(MultipartFile file)
|
public static final String extractFilename(MultipartFile file)
|
||||||
{
|
{
|
||||||
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
|
return StringUtils.format("{}/{}_{}.{}", DateUtils.getDateTimeNow(DateUtils.YYYY_MM_DD_PATH),
|
||||||
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public class FileUtils
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String extension = getFileExtendName(data);
|
String extension = getFileExtendName(data);
|
||||||
pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
|
pathName = DateUtils.getDateTimeNow(DateUtils.YYYY_MM_DD_PATH) + "/" + IdUtils.fastUUID() + "." + extension;
|
||||||
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
|
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
|
||||||
fos = new FileOutputStream(file);
|
fos = new FileOutputStream(file);
|
||||||
fos.write(data);
|
fos.write(data);
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class Seq
|
||||||
*/
|
*/
|
||||||
public static String getId(AtomicInteger atomicInt, int length)
|
public static String getId(AtomicInteger atomicInt, int length)
|
||||||
{
|
{
|
||||||
String result = DateUtils.dateTimeNow();
|
String result = DateUtils.getDateTimeNow(DateUtils.YYYYMMDDHHMMSS);
|
||||||
result += machineCode;
|
result += machineCode;
|
||||||
result += getSeq(atomicInt, length);
|
result += getSeq(atomicInt, length);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class VelocityUtils
|
||||||
velocityContext.put("basePackage", getPackagePrefix(packageName));
|
velocityContext.put("basePackage", getPackagePrefix(packageName));
|
||||||
velocityContext.put("packageName", packageName);
|
velocityContext.put("packageName", packageName);
|
||||||
velocityContext.put("author", genTable.getFunctionAuthor());
|
velocityContext.put("author", genTable.getFunctionAuthor());
|
||||||
velocityContext.put("datetime", DateUtils.getDate());
|
velocityContext.put("datetime", DateUtils.getDateNow());
|
||||||
velocityContext.put("pkColumn", genTable.getPkColumn());
|
velocityContext.put("pkColumn", genTable.getPkColumn());
|
||||||
velocityContext.put("importList", getImportList(genTable));
|
velocityContext.put("importList", getImportList(genTable));
|
||||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue