Commit 55200f89 by 魏文甫

Merge branch 'wei_master' into '105'

Wei master

See merge request !18
2 parents 45b1d178 0740af45
...@@ -9,5 +9,5 @@ import java.util.Map; ...@@ -9,5 +9,5 @@ import java.util.Map;
public interface IntegralMapper { public interface IntegralMapper {
List<Map<String, Object>> signInList(Map<String, Object> param); List<Map<String, Object>> signInList(Map<String, Object> param);
Map<String, Object> queryTodaySign(Map<String, Object> param2); Map<String, Object> queryDaySign(Map<String, Object> param2);
} }
...@@ -59,12 +59,27 @@ public class UserServiceImpl implements UserService { ...@@ -59,12 +59,27 @@ public class UserServiceImpl implements UserService {
if (loginUser.getSignInCount() == null) { if (loginUser.getSignInCount() == null) {
loginUser.setSignInCount(0); loginUser.setSignInCount(0);
} }
String firstDay = simpleDateFormat.format(DateUtils.firstDayOfMonth()); String firstDay = simpleDateFormat.format(DateUtils.firstDayOfMonth());
Integer integral = 1; Integer integral = 1;
if (firstDay.equals(simpleDateFormat.format(new Date()))) { if (firstDay.equals(simpleDateFormat.format(new Date()))) {
loginUser.setSignInCount(1); loginUser.setSignInCount(1);
tKzyUserIntegralFlowing.setIntegral(1); tKzyUserIntegralFlowing.setIntegral(1);
} else { } else {
//判断昨天是否签到,昨天未签到,签到哦连续天数置0;
Map<String, Object> param2 = new HashMap<String, Object>();
param2.put("userId", loginUser.getId());
param2.put("today", simpleDateFormat.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)));
Map<String, Object> yestoday = integralMapper.queryDaySign(param2);
if (yestoday == null || yestoday.get("id") == null) {
loginUser.setSignInCount(0);
}
if (loginUser.getSignInCount() == 5) {
loginUser.setSignInCount(1);
integral = 1;
} else {
if (loginUser.getSignInCount() < 2) { if (loginUser.getSignInCount() < 2) {
integral = 1; integral = 1;
} else if (loginUser.getSignInCount() == 2) { } else if (loginUser.getSignInCount() == 2) {
...@@ -73,12 +88,12 @@ public class UserServiceImpl implements UserService { ...@@ -73,12 +88,12 @@ public class UserServiceImpl implements UserService {
integral = 1; integral = 1;
} else if (loginUser.getSignInCount() == 4) { } else if (loginUser.getSignInCount() == 4) {
integral = 5; integral = 5;
tKzyUserIntegralFlowing.setIntegral(5);
} else { } else {
integral = 1; integral = 1;
} }
loginUser.setSignInCount(loginUser.getSignInCount() + 1); loginUser.setSignInCount(loginUser.getSignInCount() + 1);
} }
}
loginUser.setIntegral(loginUser.getIntegral() + integral); loginUser.setIntegral(loginUser.getIntegral() + integral);
tKzyUserIntegralFlowing.setIntegral(integral); tKzyUserIntegralFlowing.setIntegral(integral);
loginUser.setLastSignDt(new Date()); loginUser.setLastSignDt(new Date());
...@@ -127,7 +142,7 @@ public class UserServiceImpl implements UserService { ...@@ -127,7 +142,7 @@ public class UserServiceImpl implements UserService {
param2.put("userId", loginUser.getId()); param2.put("userId", loginUser.getId());
param2.put("today", simpleDateFormat2.format(new Date())); param2.put("today", simpleDateFormat2.format(new Date()));
Map<String, Object> todaySign = integralMapper.queryTodaySign(param2); Map<String, Object> todaySign = integralMapper.queryDaySign(param2);
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);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
AND t.user_id = #{userId,jdbcType=BIGINT} AND t.user_id = #{userId,jdbcType=BIGINT}
AND DATE_FORMAT(t.create_dt, '%Y-%m') = #{month,jdbcType=VARCHAR} AND DATE_FORMAT(t.create_dt, '%Y-%m') = #{month,jdbcType=VARCHAR}
</select> </select>
<select id="queryTodaySign" parameterType="java.util.HashMap" resultType="java.util.HashMap"> <select id="queryDaySign" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT SELECT
t.id, t.id,
t.create_dt AS createDt, t.create_dt AS createDt,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!