Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
wangming
/
kzy-wx
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 65647a75
authored
Mar 14, 2020
by
魏文甫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
1 parent
0437f8ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
10 deletions
src/main/java/com/server/utils/DateUtils.java
src/main/java/com/server/web/common/service/Impl/UserServiceImpl.java
src/main/resources/mybatis/mapping/IntegralMapper.xml
src/main/java/com/server/utils/DateUtils.java
View file @
65647a7
...
@@ -2,9 +2,7 @@ package com.server.utils;
...
@@ -2,9 +2,7 @@ package com.server.utils;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.TimeZone
;
/**
/**
* @author ZMS
* @author ZMS
...
@@ -196,9 +194,28 @@ public class DateUtils {
...
@@ -196,9 +194,28 @@ public class DateUtils {
return
myCal
.
compareTo
(
compareCal
);
return
myCal
.
compareTo
(
compareCal
);
}
}
/**
* 获取当月所有天
*
* @return
*/
public
static
List
<
String
>
getDayListOfMonth
()
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
Calendar
aCalendar
=
Calendar
.
getInstance
(
Locale
.
CHINA
);
int
year
=
aCalendar
.
get
(
Calendar
.
YEAR
);
//年份
int
month
=
aCalendar
.
get
(
Calendar
.
MONTH
)
+
1
;
//月份
int
day
=
aCalendar
.
getActualMaximum
(
Calendar
.
DATE
);
for
(
int
i
=
1
;
i
<=
day
;
i
++)
{
String
aDate
=
(
month
<
10
?
((
"0"
)
+
month
)
:
month
)
+
"/"
+
(
i
<
10
?
(
"0"
+
i
)
:
i
);
list
.
add
(
aDate
);
}
return
list
;
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
List
<
String
>
list
=
getDayListOfMonth
();
System
.
out
.
println
(
list
);
}
}
...
...
src/main/java/com/server/web/common/service/Impl/UserServiceImpl.java
View file @
65647a7
...
@@ -12,10 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -12,10 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* Created by 豆腐干Sama on 2018/12/6.
* Created by 豆腐干Sama on 2018/12/6.
...
@@ -95,12 +92,34 @@ public class UserServiceImpl implements UserService {
...
@@ -95,12 +92,34 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
Map
<
String
,
Object
>
signInList
(
TKzyUser
loginUser
)
{
public
Map
<
String
,
Object
>
signInList
(
TKzyUser
loginUser
)
{
//List<String> dayList = getDayListOfMonth();
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM"
);
SimpleDateFormat
simpleDateFormat2
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
simpleDateFormat2
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Map
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"userId"
,
loginUser
.
getId
());
param
.
put
(
"userId"
,
loginUser
.
getId
());
param
.
put
(
"month"
,
simpleDateFormat
.
format
(
new
Date
()));
param
.
put
(
"month"
,
simpleDateFormat
.
format
(
new
Date
()));
List
<
Map
<
String
,
Object
>>
list
=
integralMapper
.
signInList
(
param
);
List
<
Map
<
String
,
Object
>>
list
=
integralMapper
.
signInList
(
param
);
List
<
String
>
hasSignDay
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
map
:
list
)
{
String
dd
=
(
String
)
map
.
get
(
"days"
);
String
[]
_D
=
dd
.
split
(
"/"
);
String
ymd
=
_D
[
0
]
+
"/"
+
(
_D
[
1
].
startsWith
(
"0"
)
?
(
_D
[
1
].
substring
(
1
,
_D
[
1
].
length
()))
:
_D
[
1
])
+
"/"
+
(
_D
[
2
].
startsWith
(
"0"
)
?
(
_D
[
2
].
substring
(
0
,
_D
[
2
].
length
()))
:
_D
[
2
]);
hasSignDay
.
add
(
ymd
);
}
/*List<Map<String, Object>> daysList = new ArrayList<>();
Map<String, Object> flag = null;
for (String everyDay : dayList) {
flag = new HashMap<>();
flag.put("day", everyDay);
if (hasSignDay.contains(everyDay)) {
flag.put("signFlag", 1);
} else {
flag.put("signFlag", 0);
}
daysList.add(flag);
}*/
Map
<
String
,
Object
>
param2
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
param2
=
new
HashMap
<
String
,
Object
>();
...
@@ -111,7 +130,8 @@ public class UserServiceImpl implements UserService {
...
@@ -111,7 +130,8 @@ public class UserServiceImpl implements UserService {
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
dataMap
.
put
(
"list"
,
list
);
dataMap
.
put
(
"list"
,
list
);
dataMap
.
put
(
"todaySign"
,
todaySign
);
dataMap
.
put
(
"todaySign"
,
todaySign
);
return
ResultMapUtil
.
returnMap
(
"1"
,
""
,
list
);
dataMap
.
put
(
"daysList"
,
hasSignDay
);
return
ResultMapUtil
.
returnMap
(
"1"
,
""
,
dataMap
);
}
}
...
...
src/main/resources/mybatis/mapping/IntegralMapper.xml
View file @
65647a7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
SELECT
SELECT
t.id,
t.id,
t.create_dt AS createDt,
t.create_dt AS createDt,
date_format(t.create_dt,'%Y/%m/%d') AS days,
t.integral
t.integral
FROM
FROM
t_kzy_user_integral_flowing t
t_kzy_user_integral_flowing t
...
@@ -24,7 +25,7 @@
...
@@ -24,7 +25,7 @@
WHERE
WHERE
t.source_type = 1
t.source_type = 1
AND t.user_id = #{userId,jdbcType=BIGINT}
AND t.user_id = #{userId,jdbcType=BIGINT}
AND DATE_FORMAT(t.create_dt, '%Y-%m-%') = #{today,jdbcType=VARCHAR}
AND DATE_FORMAT(t.create_dt, '%Y-%m-%
d
') = #{today,jdbcType=VARCHAR}
ORDER BY t.id DESC limit 0,1
ORDER BY t.id DESC limit 0,1
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment