Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
300f3d9e
Commit
300f3d9e
authored
May 06, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消除成功接收处理
parent
d353d6f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
DateHelper.java
...src/main/java/com/yanzuoguang/util/helper/DateHelper.java
+16
-2
BaseDaoImpl.java
...b/src/main/java/com/yanzuoguang/dao/Impl/BaseDaoImpl.java
+14
-1
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/DateHelper.java
View file @
300f3d9e
...
...
@@ -447,7 +447,7 @@ public class DateHelper {
/**
* 增加月份处理
*
* @param date 当前日期
* @param date
当前日期
* @param month 需要增加的月份
* @return 增加之后的值
*/
...
...
@@ -462,7 +462,7 @@ public class DateHelper {
* 增加日期处理
*
* @param date 当前日期
* @param day 需要增加的日期
* @param day
需要增加的日期
* @return 增加之后的值
*/
public
static
Date
addDay
(
Date
date
,
int
day
)
{
...
...
@@ -619,4 +619,18 @@ public class DateHelper {
public
static
String
toYear
(
Date
time
)
{
return
getDateTimeString
(
"yyyy-01-01"
,
time
);
}
/**
* 判断是否时时间格式字符串
*
* @param from 来源字符串
* @return 是否时时间字符串
*/
public
static
boolean
isDateFormat
(
String
from
)
{
try
{
return
DateAutoHelper
.
getAutoDate
(
from
)
!=
null
;
}
catch
(
Exception
ex
)
{
return
false
;
}
}
}
yzg-util-db/src/main/java/com/yanzuoguang/dao/Impl/BaseDaoImpl.java
View file @
300f3d9e
...
...
@@ -5,10 +5,12 @@ import com.yanzuoguang.dao.DaoConst;
import
com.yanzuoguang.db.Impl.AllBeanRowMapper
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.InitDao
;
import
com.yanzuoguang.util.vo.MapRow
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -309,14 +311,25 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
protected
<
T
extends
Object
>
String
getMd5
(
String
sqlName
,
T
model
)
{
SqlData
sql
=
this
.
getSql
(
sqlName
);
StringBuilder
sb
=
new
StringBuilder
();
String
date
=
StringHelper
.
EMPTY
;
for
(
SqlDataField
field
:
sql
.
sqlDataFields
)
{
if
(
sb
.
length
()
>
0
)
{
sb
.
append
(
":"
);
}
Object
item
=
ObjectHelper
.
get
(
model
,
field
.
paraName
);
String
itemString
=
String
.
valueOf
(
item
);
if
(
item
instanceof
Date
)
{
date
=
DateHelper
.
getDateTimeString
((
Date
)
item
);
}
else
if
(
DateHelper
.
isDateFormat
(
itemString
))
{
date
=
itemString
;
}
sb
.
append
(
item
);
}
return
StringHelper
.
md5
(
sb
.
toString
());
if
(
StringHelper
.
isEmpty
(
date
))
{
return
StringHelper
.
getNewMD5Id
(
DateHelper
.
getDateTime
(
date
),
sb
.
toString
());
}
else
{
return
StringHelper
.
md5
(
sb
.
toString
());
}
}
/**
...
...
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