Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
5d44f693
Commit
5d44f693
authored
Jun 28, 2018
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改日期为laydate
parent
ff5969b2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
141 additions
and
123 deletions
+141
-123
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
+5
-2
guns-admin/src/main/java/com/stylefeng/guns/modular/system/factory/UserFactory.java
+35
-5
guns-admin/src/main/webapp/WEB-INF/view/system/user/user_add.html
+6
-2
guns-admin/src/main/webapp/WEB-INF/view/system/user/user_edit.html
+7
-3
guns-admin/src/main/webapp/WEB-INF/view/system/user/user_view.html
+7
-3
guns-core/src/main/java/com/stylefeng/guns/core/config/DefaultWebConfig.java
+22
-1
guns-core/src/main/java/com/stylefeng/guns/core/exception/GunsExceptionEnum.java
+50
-45
guns-core/src/main/java/com/stylefeng/guns/core/util/DateUtil.java
+9
-62
No files found.
guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
View file @
5d44f693
...
@@ -210,14 +210,17 @@ public class UserMgrController extends BaseController {
...
@@ -210,14 +210,17 @@ public class UserMgrController extends BaseController {
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
throw
new
GunsException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
GunsException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
User
oldUser
=
userService
.
selectById
(
user
.
getId
());
if
(
ShiroKit
.
hasRole
(
Const
.
ADMIN_NAME
))
{
if
(
ShiroKit
.
hasRole
(
Const
.
ADMIN_NAME
))
{
this
.
userService
.
updateById
(
UserFactory
.
createUser
(
u
ser
));
this
.
userService
.
updateById
(
UserFactory
.
editUser
(
user
,
oldU
ser
));
return
SUCCESS_TIP
;
return
SUCCESS_TIP
;
}
else
{
}
else
{
assertAuth
(
user
.
getId
());
assertAuth
(
user
.
getId
());
ShiroUser
shiroUser
=
ShiroKit
.
getUser
();
ShiroUser
shiroUser
=
ShiroKit
.
getUser
();
if
(
shiroUser
.
getId
().
equals
(
user
.
getId
()))
{
if
(
shiroUser
.
getId
().
equals
(
user
.
getId
()))
{
this
.
userService
.
updateById
(
UserFactory
.
createUser
(
u
ser
));
this
.
userService
.
updateById
(
UserFactory
.
editUser
(
user
,
oldU
ser
));
return
SUCCESS_TIP
;
return
SUCCESS_TIP
;
}
else
{
}
else
{
throw
new
GunsException
(
BizExceptionEnum
.
NO_PERMITION
);
throw
new
GunsException
(
BizExceptionEnum
.
NO_PERMITION
);
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/system/factory/UserFactory.java
View file @
5d44f693
package
com
.
stylefeng
.
guns
.
modular
.
system
.
factory
;
package
com
.
stylefeng
.
guns
.
modular
.
system
.
factory
;
import
com.stylefeng.guns.
modular.system.transfer.UserDto
;
import
com.stylefeng.guns.
core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.modular.system.model.User
;
import
com.stylefeng.guns.modular.system.transfer.UserDto
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
/**
/**
...
@@ -12,13 +13,42 @@ import org.springframework.beans.BeanUtils;
...
@@ -12,13 +13,42 @@ import org.springframework.beans.BeanUtils;
*/
*/
public
class
UserFactory
{
public
class
UserFactory
{
public
static
User
createUser
(
UserDto
userDto
){
public
static
User
createUser
(
UserDto
userDto
)
{
if
(
userDto
==
null
)
{
if
(
userDto
==
null
)
{
return
null
;
return
null
;
}
else
{
}
else
{
User
user
=
new
User
();
User
user
=
new
User
();
BeanUtils
.
copyProperties
(
userDto
,
user
);
BeanUtils
.
copyProperties
(
userDto
,
user
);
return
user
;
return
user
;
}
}
}
}
public
static
User
editUser
(
UserDto
newUser
,
User
oldUser
)
{
if
(
newUser
==
null
||
oldUser
==
null
)
{
return
oldUser
;
}
else
{
if
(
ToolUtil
.
isNotEmpty
(
newUser
.
getAvatar
()))
{
oldUser
.
setAvatar
(
newUser
.
getAvatar
());
}
if
(
ToolUtil
.
isNotEmpty
(
newUser
.
getName
()))
{
oldUser
.
setName
(
newUser
.
getName
());
}
if
(
ToolUtil
.
isNotEmpty
(
newUser
.
getBirthday
()))
{
oldUser
.
setBirthday
(
newUser
.
getBirthday
());
}
if
(
ToolUtil
.
isNotEmpty
(
newUser
.
getDeptid
()))
{
oldUser
.
setDeptid
(
newUser
.
getDeptid
());
}
if
(
ToolUtil
.
isNotEmpty
(
newUser
.
getSex
()))
{
oldUser
.
setSex
(
newUser
.
getSex
());
}
if
(
ToolUtil
.
isNotEmpty
(
newUser
.
getEmail
()))
{
oldUser
.
setEmail
(
newUser
.
getEmail
());
}
if
(
ToolUtil
.
isNotEmpty
(
newUser
.
getPhone
()))
{
oldUser
.
setPhone
(
newUser
.
getPhone
());
}
return
oldUser
;
}
}
}
}
guns-admin/src/main/webapp/WEB-INF/view/system/user/user_add.html
View file @
5d44f693
...
@@ -22,8 +22,7 @@
...
@@ -22,8 +22,7 @@
<div
id=
"driverInfoContent"
>
<div
id=
"driverInfoContent"
>
<
#
input
id=
"name"
name=
"姓名"
underline=
"true"
/>
<
#
input
id=
"name"
name=
"姓名"
underline=
"true"
/>
<
#
input
id=
"birthday"
name=
"出生日期"
underline=
"true"
type=
"date"
<
#
input
id=
"birthday"
name=
"出生日期"
underline=
"true"
type=
"text"
/>
clickFun=
"laydate({istime: false, format: 'YYYY-MM-DD'})"
/>
<
#
input
id=
"rePassword"
name=
"确认密码"
type=
"password"
underline=
"true"
/>
<
#
input
id=
"rePassword"
name=
"确认密码"
type=
"password"
underline=
"true"
/>
...
@@ -53,4 +52,9 @@
...
@@ -53,4 +52,9 @@
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/user/user_info.js"
></script>
<script
src=
"${ctxPath}/static/modular/system/user/user_info.js"
></script>
<script>
laydate
.
render
({
elem
:
'#birthday'
});
</script>
@}
@}
guns-admin/src/main/webapp/WEB-INF/view/system/user/user_edit.html
View file @
5d44f693
...
@@ -19,9 +19,8 @@
...
@@ -19,9 +19,8 @@
<div
id=
"driverInfoContent"
>
<div
id=
"driverInfoContent"
>
<
#
input
id=
"name"
name=
"姓名"
underline=
"true"
value=
"${user.name}"
/>
<
#
input
id=
"name"
name=
"姓名"
underline=
"true"
value=
"${user.name}"
/>
<
#
input
id=
"birthday"
name=
"出生日期"
underline=
"true"
type=
"date"
<
#
input
id=
"birthday"
name=
"出生日期"
underline=
"true"
type=
"text"
value=
"${user.birthday}"
value=
"${user.birthday}"
/>
clickFun=
"laydate({istime: false, format: 'YYYY-MM-DD'})"
/>
<
#
input
id=
"citySel"
name=
"部门"
underline=
"true"
readonly=
"readonly"
hidden=
"deptid"
hiddenValue=
"${user.deptid}"
value=
"${deptName}"
<
#
input
id=
"citySel"
name=
"部门"
underline=
"true"
readonly=
"readonly"
hidden=
"deptid"
hiddenValue=
"${user.deptid}"
value=
"${deptName}"
clickFun=
"UserInfoDlg.showDeptSelectTree(); return false;"
clickFun=
"UserInfoDlg.showDeptSelectTree(); return false;"
...
@@ -49,4 +48,9 @@
...
@@ -49,4 +48,9 @@
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/user/user_info.js"
></script>
<script
src=
"${ctxPath}/static/modular/system/user/user_info.js"
></script>
<script>
laydate
.
render
({
elem
:
'#birthday'
});
</script>
@}
@}
guns-admin/src/main/webapp/WEB-INF/view/system/user/user_view.html
View file @
5d44f693
...
@@ -31,9 +31,8 @@
...
@@ -31,9 +31,8 @@
<div
id=
"driverInfoContent"
>
<div
id=
"driverInfoContent"
>
<
#
input
id=
"name"
name=
"姓名"
underline=
"true"
value=
"${user.name}"
/>
<
#
input
id=
"name"
name=
"姓名"
underline=
"true"
value=
"${user.name}"
/>
<
#
input
id=
"birthday"
name=
"出生日期"
underline=
"true"
<
#
input
id=
"birthday"
name=
"出生日期"
underline=
"true"
type=
"text"
value=
"${user.birthday}"
value=
"${user.birthday}"
/>
clickFun=
"laydate({istime: false, format: 'YYYY-MM-DD'})"
/>
<
#
input
id=
"citySel"
name=
"部门"
underline=
"true"
readonly=
"readonly"
value=
"${deptName}"
<
#
input
id=
"citySel"
name=
"部门"
underline=
"true"
readonly=
"readonly"
value=
"${deptName}"
hidden=
"deptid"
hiddenValue=
"${user.deptid}"
hidden=
"deptid"
hiddenValue=
"${user.deptid}"
...
@@ -65,4 +64,9 @@
...
@@ -65,4 +64,9 @@
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/user/user_info.js"
></script>
<script
src=
"${ctxPath}/static/modular/system/user/user_info.js"
></script>
<script>
laydate
.
render
({
elem
:
'#birthday'
});
</script>
@}
@}
guns-core/src/main/java/com/stylefeng/guns/core/config/DefaultWebConfig.java
View file @
5d44f693
package
com
.
stylefeng
.
guns
.
core
.
config
;
package
com
.
stylefeng
.
guns
.
core
.
config
;
import
com.stylefeng.guns.core.base.controller.GunsErrorView
;
import
com.stylefeng.guns.core.base.controller.GunsErrorView
;
import
com.stylefeng.guns.core.exception.GunsException
;
import
com.stylefeng.guns.core.exception.GunsExceptionEnum
;
import
com.stylefeng.guns.core.util.DateUtil
;
import
com.stylefeng.guns.core.util.DateUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -13,6 +15,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
...
@@ -13,6 +15,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.regex.Pattern
;
@Configuration
@Configuration
public
class
DefaultWebConfig
extends
WebMvcConfigurationSupport
{
public
class
DefaultWebConfig
extends
WebMvcConfigurationSupport
{
...
@@ -36,7 +39,25 @@ public class DefaultWebConfig extends WebMvcConfigurationSupport {
...
@@ -36,7 +39,25 @@ public class DefaultWebConfig extends WebMvcConfigurationSupport {
@Override
@Override
public
Date
convert
(
String
dateString
)
{
public
Date
convert
(
String
dateString
)
{
return
DateUtil
.
parseTime
(
dateString
);
String
patternDate
=
"\\d{4}-\\d{1,2}-\\d{1,2}"
;
String
patternTimeMinutes
=
"\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}"
;
String
patternTimeSeconds
=
"\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}"
;
boolean
dateFlag
=
Pattern
.
matches
(
patternDate
,
dateString
);
boolean
timeMinutesFlag
=
Pattern
.
matches
(
patternTimeMinutes
,
dateString
);
boolean
timeSecondsFlag
=
Pattern
.
matches
(
patternTimeSeconds
,
dateString
);
if
(
dateFlag
)
{
return
DateUtil
.
parseDate
(
dateString
);
}
else
if
(
timeMinutesFlag
)
{
return
DateUtil
.
parseTimeMinutes
(
dateString
);
}
else
if
(
timeSecondsFlag
)
{
return
DateUtil
.
parseTime
(
dateString
);
}
else
{
throw
new
GunsException
(
GunsExceptionEnum
.
INVLIDE_DATE_STRING
);
}
}
}
}
}
}
}
...
...
guns-core/src/main/java/com/stylefeng/guns/core/exception/GunsExceptionEnum.java
View file @
5d44f693
...
@@ -6,49 +6,54 @@ package com.stylefeng.guns.core.exception;
...
@@ -6,49 +6,54 @@ package com.stylefeng.guns.core.exception;
* @author fengshuonan
* @author fengshuonan
* @Date 2017/12/28 下午10:33
* @Date 2017/12/28 下午10:33
*/
*/
public
enum
GunsExceptionEnum
implements
ServiceExceptionEnum
{
public
enum
GunsExceptionEnum
implements
ServiceExceptionEnum
{
/**
/**
* 其他
* 其他
*/
*/
WRITE_ERROR
(
500
,
"渲染界面错误"
),
INVLIDE_DATE_STRING
(
400
,
"输入日期格式不对"
),
/**
/**
* 文件上传
* 其他
*/
*/
FILE_READING_ERROR
(
400
,
"FILE_READING_ERROR!"
),
WRITE_ERROR
(
500
,
"渲染界面错误"
),
FILE_NOT_FOUND
(
400
,
"FILE_NOT_FOUND!"
),
/**
/**
* 文件上传
* 错误的请求
*/
*/
FILE_READING_ERROR
(
400
,
"FILE_READING_ERROR!"
),
REQUEST_NULL
(
400
,
"请求有错误"
),
FILE_NOT_FOUND
(
400
,
"FILE_NOT_FOUND!"
),
SERVER_ERROR
(
500
,
"服务器异常"
);
/**
GunsExceptionEnum
(
int
code
,
String
message
)
{
* 错误的请求
this
.
code
=
code
;
*/
this
.
message
=
message
;
REQUEST_NULL
(
400
,
"请求有错误"
),
}
SERVER_ERROR
(
500
,
"服务器异常"
);
private
Integer
code
;
GunsExceptionEnum
(
int
code
,
String
message
)
{
this
.
code
=
code
;
private
String
message
;
this
.
message
=
message
;
}
@Override
public
Integer
getCode
()
{
private
Integer
code
;
return
code
;
}
private
String
message
;
public
void
setCode
(
Integer
code
)
{
@Override
this
.
code
=
code
;
public
Integer
getCode
()
{
}
return
code
;
}
@Override
public
String
getMessage
()
{
public
void
setCode
(
Integer
code
)
{
return
message
;
this
.
code
=
code
;
}
}
public
void
setMessage
(
String
message
)
{
@Override
this
.
message
=
message
;
public
String
getMessage
()
{
}
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
}
guns-core/src/main/java/com/stylefeng/guns/core/util/DateUtil.java
View file @
5d44f693
...
@@ -28,11 +28,8 @@ import java.util.Date;
...
@@ -28,11 +28,8 @@ import java.util.Date;
public
class
DateUtil
{
public
class
DateUtil
{
/**
/**
* 获取YYYY格式
* 获取YYYY格式
*
* @return
*/
*/
public
static
String
getYear
()
{
public
static
String
getYear
()
{
return
formatDate
(
new
Date
(),
"yyyy"
);
return
formatDate
(
new
Date
(),
"yyyy"
);
...
@@ -40,8 +37,6 @@ public class DateUtil {
...
@@ -40,8 +37,6 @@ public class DateUtil {
/**
/**
* 获取YYYY格式
* 获取YYYY格式
*
* @return
*/
*/
public
static
String
getYear
(
Date
date
)
{
public
static
String
getYear
(
Date
date
)
{
return
formatDate
(
date
,
"yyyy"
);
return
formatDate
(
date
,
"yyyy"
);
...
@@ -49,8 +44,6 @@ public class DateUtil {
...
@@ -49,8 +44,6 @@ public class DateUtil {
/**
/**
* 获取YYYY-MM-DD格式
* 获取YYYY-MM-DD格式
*
* @return
*/
*/
public
static
String
getDay
()
{
public
static
String
getDay
()
{
return
formatDate
(
new
Date
(),
"yyyy-MM-dd"
);
return
formatDate
(
new
Date
(),
"yyyy-MM-dd"
);
...
@@ -58,8 +51,6 @@ public class DateUtil {
...
@@ -58,8 +51,6 @@ public class DateUtil {
/**
/**
* 获取YYYY-MM-DD格式
* 获取YYYY-MM-DD格式
*
* @return
*/
*/
public
static
String
getDay
(
Date
date
)
{
public
static
String
getDay
(
Date
date
)
{
return
formatDate
(
date
,
"yyyy-MM-dd"
);
return
formatDate
(
date
,
"yyyy-MM-dd"
);
...
@@ -67,8 +58,6 @@ public class DateUtil {
...
@@ -67,8 +58,6 @@ public class DateUtil {
/**
/**
* 获取YYYYMMDD格式
* 获取YYYYMMDD格式
*
* @return
*/
*/
public
static
String
getDays
()
{
public
static
String
getDays
()
{
return
formatDate
(
new
Date
(),
"yyyyMMdd"
);
return
formatDate
(
new
Date
(),
"yyyyMMdd"
);
...
@@ -76,8 +65,6 @@ public class DateUtil {
...
@@ -76,8 +65,6 @@ public class DateUtil {
/**
/**
* 获取YYYYMMDD格式
* 获取YYYYMMDD格式
*
* @return
*/
*/
public
static
String
getDays
(
Date
date
)
{
public
static
String
getDays
(
Date
date
)
{
return
formatDate
(
date
,
"yyyyMMdd"
);
return
formatDate
(
date
,
"yyyyMMdd"
);
...
@@ -85,8 +72,6 @@ public class DateUtil {
...
@@ -85,8 +72,6 @@ public class DateUtil {
/**
/**
* 获取YYYY-MM-DD HH:mm:ss格式
* 获取YYYY-MM-DD HH:mm:ss格式
*
* @return
*/
*/
public
static
String
getTime
()
{
public
static
String
getTime
()
{
return
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
return
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
);
...
@@ -94,8 +79,6 @@ public class DateUtil {
...
@@ -94,8 +79,6 @@ public class DateUtil {
/**
/**
* 获取YYYY-MM-DD HH:mm:ss.SSS格式
* 获取YYYY-MM-DD HH:mm:ss.SSS格式
*
* @return
*/
*/
public
static
String
getMsTime
()
{
public
static
String
getMsTime
()
{
return
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss.SSS"
);
return
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss.SSS"
);
...
@@ -103,8 +86,6 @@ public class DateUtil {
...
@@ -103,8 +86,6 @@ public class DateUtil {
/**
/**
* 获取YYYYMMDDHHmmss格式
* 获取YYYYMMDDHHmmss格式
*
* @return
*/
*/
public
static
String
getAllTime
()
{
public
static
String
getAllTime
()
{
return
formatDate
(
new
Date
(),
"yyyyMMddHHmmss"
);
return
formatDate
(
new
Date
(),
"yyyyMMddHHmmss"
);
...
@@ -112,8 +93,6 @@ public class DateUtil {
...
@@ -112,8 +93,6 @@ public class DateUtil {
/**
/**
* 获取YYYY-MM-DD HH:mm:ss格式
* 获取YYYY-MM-DD HH:mm:ss格式
*
* @return
*/
*/
public
static
String
getTime
(
Date
date
)
{
public
static
String
getTime
(
Date
date
)
{
return
formatDate
(
date
,
"yyyy-MM-dd HH:mm:ss"
);
return
formatDate
(
date
,
"yyyy-MM-dd HH:mm:ss"
);
...
@@ -130,12 +109,8 @@ public class DateUtil {
...
@@ -130,12 +109,8 @@ public class DateUtil {
}
}
/**
/**
* @Title: compareDate
* 日期比较,如果s>=e 返回true 否则返回false)
* @Description:(日期比较,如果s>=e 返回true 否则返回false)
*
* @param s
* @param e
* @return boolean
* @throws
* @author luguosui
* @author luguosui
*/
*/
public
static
boolean
compareDate
(
String
s
,
String
e
)
{
public
static
boolean
compareDate
(
String
s
,
String
e
)
{
...
@@ -147,8 +122,6 @@ public class DateUtil {
...
@@ -147,8 +122,6 @@ public class DateUtil {
/**
/**
* 格式化日期
* 格式化日期
*
* @return
*/
*/
public
static
Date
parseDate
(
String
date
)
{
public
static
Date
parseDate
(
String
date
)
{
return
parse
(
date
,
"yyyy-MM-dd"
);
return
parse
(
date
,
"yyyy-MM-dd"
);
...
@@ -156,8 +129,13 @@ public class DateUtil {
...
@@ -156,8 +129,13 @@ public class DateUtil {
/**
/**
* 格式化日期
* 格式化日期
*
*/
* @return
public
static
Date
parseTimeMinutes
(
String
date
)
{
return
parse
(
date
,
"yyyy-MM-dd HH:mm"
);
}
/**
* 格式化日期
*/
*/
public
static
Date
parseTime
(
String
date
)
{
public
static
Date
parseTime
(
String
date
)
{
return
parse
(
date
,
"yyyy-MM-dd HH:mm:ss"
);
return
parse
(
date
,
"yyyy-MM-dd HH:mm:ss"
);
...
@@ -165,8 +143,6 @@ public class DateUtil {
...
@@ -165,8 +143,6 @@ public class DateUtil {
/**
/**
* 格式化日期
* 格式化日期
*
* @return
*/
*/
public
static
Date
parse
(
String
date
,
String
pattern
)
{
public
static
Date
parse
(
String
date
,
String
pattern
)
{
try
{
try
{
...
@@ -177,14 +153,8 @@ public class DateUtil {
...
@@ -177,14 +153,8 @@ public class DateUtil {
}
}
}
}
/**
/**
* 格式化日期
* 格式化日期
*
* @return
*/
*/
public
static
String
format
(
Date
date
,
String
pattern
)
{
public
static
String
format
(
Date
date
,
String
pattern
)
{
return
DateFormatUtils
.
format
(
date
,
pattern
);
return
DateFormatUtils
.
format
(
date
,
pattern
);
...
@@ -192,9 +162,6 @@ public class DateUtil {
...
@@ -192,9 +162,6 @@ public class DateUtil {
/**
/**
* 把日期转换为Timestamp
* 把日期转换为Timestamp
*
* @param date
* @return
*/
*/
public
static
Timestamp
format
(
Date
date
)
{
public
static
Timestamp
format
(
Date
date
)
{
return
new
Timestamp
(
date
.
getTime
());
return
new
Timestamp
(
date
.
getTime
());
...
@@ -202,8 +169,6 @@ public class DateUtil {
...
@@ -202,8 +169,6 @@ public class DateUtil {
/**
/**
* 校验日期是否合法
* 校验日期是否合法
*
* @return
*/
*/
public
static
boolean
isValidDate
(
String
s
)
{
public
static
boolean
isValidDate
(
String
s
)
{
return
parse
(
s
,
"yyyy-MM-dd HH:mm:ss"
)
!=
null
;
return
parse
(
s
,
"yyyy-MM-dd HH:mm:ss"
)
!=
null
;
...
@@ -211,8 +176,6 @@ public class DateUtil {
...
@@ -211,8 +176,6 @@ public class DateUtil {
/**
/**
* 校验日期是否合法
* 校验日期是否合法
*
* @return
*/
*/
public
static
boolean
isValidDate
(
String
s
,
String
pattern
)
{
public
static
boolean
isValidDate
(
String
s
,
String
pattern
)
{
return
parse
(
s
,
pattern
)
!=
null
;
return
parse
(
s
,
pattern
)
!=
null
;
...
@@ -232,11 +195,6 @@ public class DateUtil {
...
@@ -232,11 +195,6 @@ public class DateUtil {
/**
/**
* <li>功能描述:时间相减得到天数
* <li>功能描述:时间相减得到天数
*
* @param beginDateStr
* @param endDateStr
* @return long
* @author Administrator
*/
*/
public
static
long
getDaySub
(
String
beginDateStr
,
String
endDateStr
)
{
public
static
long
getDaySub
(
String
beginDateStr
,
String
endDateStr
)
{
long
day
=
0
;
long
day
=
0
;
...
@@ -259,9 +217,6 @@ public class DateUtil {
...
@@ -259,9 +217,6 @@ public class DateUtil {
/**
/**
* 得到n天之后的日期
* 得到n天之后的日期
*
* @param days
* @return
*/
*/
public
static
String
getAfterDayDate
(
String
days
)
{
public
static
String
getAfterDayDate
(
String
days
)
{
int
daysInt
=
Integer
.
parseInt
(
days
);
int
daysInt
=
Integer
.
parseInt
(
days
);
...
@@ -278,9 +233,6 @@ public class DateUtil {
...
@@ -278,9 +233,6 @@ public class DateUtil {
/**
/**
* 得到n天之后是周几
* 得到n天之后是周几
*
* @param days
* @return
*/
*/
public
static
String
getAfterDayWeek
(
String
days
)
{
public
static
String
getAfterDayWeek
(
String
days
)
{
int
daysInt
=
Integer
.
parseInt
(
days
);
int
daysInt
=
Integer
.
parseInt
(
days
);
...
@@ -295,9 +247,4 @@ public class DateUtil {
...
@@ -295,9 +247,4 @@ public class DateUtil {
return
dateStr
;
return
dateStr
;
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
getTime
(
new
Date
()));
System
.
out
.
println
(
getAfterDayWeek
(
"3"
));
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment