|
@@ -30,6 +30,7 @@ import shop.alien.store.config.BaseRedisService;
|
|
|
import shop.alien.store.config.WebSocketProcess;
|
|
import shop.alien.store.config.WebSocketProcess;
|
|
|
import shop.alien.store.dto.StoreOperationalActivitySignupDto;
|
|
import shop.alien.store.dto.StoreOperationalActivitySignupDto;
|
|
|
import shop.alien.store.service.StoreOperationalActivityService;
|
|
import shop.alien.store.service.StoreOperationalActivityService;
|
|
|
|
|
+import shop.alien.util.common.DateUtils;
|
|
|
import shop.alien.util.common.Constants;
|
|
import shop.alien.util.common.Constants;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
|
|
@@ -258,7 +259,7 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
Integer approvedCount = signupMapper.countSignupByActivityId(dto.getActivityId());
|
|
Integer approvedCount = signupMapper.countSignupByActivityId(dto.getActivityId());
|
|
|
Integer limitPeople = activity.getActivityLimitPeople();
|
|
Integer limitPeople = activity.getActivityLimitPeople();
|
|
|
if (limitPeople != null && limitPeople > 0 && approvedCount != null && approvedCount >= limitPeople) {
|
|
if (limitPeople != null && limitPeople > 0 && approvedCount != null && approvedCount >= limitPeople) {
|
|
|
- throw new IllegalArgumentException("报名人数已满");
|
|
|
|
|
|
|
+ throw new IllegalArgumentException("当前报名人数已满");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
StoreOperationalActivitySignup signup = new StoreOperationalActivitySignup();
|
|
StoreOperationalActivitySignup signup = new StoreOperationalActivitySignup();
|
|
@@ -272,7 +273,7 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
signup.setDeleteFlag(0);
|
|
signup.setDeleteFlag(0);
|
|
|
signup.setCreatedUserId(dto.getUserId());
|
|
signup.setCreatedUserId(dto.getUserId());
|
|
|
boolean result = signupMapper.insert(signup) > 0;
|
|
boolean result = signupMapper.insert(signup) > 0;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 报名成功后给商家发送通知
|
|
// 报名成功后给商家发送通知
|
|
|
if (result) {
|
|
if (result) {
|
|
|
try {
|
|
try {
|
|
@@ -281,7 +282,7 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
log.error("发送活动报名通知失败,signupId={}, error={}", signup.getId(), e.getMessage(), e);
|
|
log.error("发送活动报名通知失败,signupId={}, error={}", signup.getId(), e.getMessage(), e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return result;
|
|
return result;
|
|
|
} finally {
|
|
} finally {
|
|
|
baseRedisService.unlock(lockKey, lockVal);
|
|
baseRedisService.unlock(lockKey, lockVal);
|
|
@@ -293,11 +294,11 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
if (status == null || (status != 2 && status != 5)) {
|
|
if (status == null || (status != 2 && status != 5)) {
|
|
|
throw new IllegalArgumentException("活动状态不允许报名");
|
|
throw new IllegalArgumentException("活动状态不允许报名");
|
|
|
}
|
|
}
|
|
|
- Date now = new Date();
|
|
|
|
|
- if (activity.getSignupStartTime() != null && now.before(activity.getSignupStartTime())) {
|
|
|
|
|
|
|
+ Date nowDay = DateUtils.toDateOnly(new Date());
|
|
|
|
|
+ if (activity.getSignupStartTime() != null && nowDay.before(DateUtils.toDateOnly(activity.getSignupStartTime()))) {
|
|
|
throw new IllegalArgumentException("未到报名时间");
|
|
throw new IllegalArgumentException("未到报名时间");
|
|
|
}
|
|
}
|
|
|
- if (activity.getSignupEndTime() != null && now.after(activity.getSignupEndTime())) {
|
|
|
|
|
|
|
+ if (activity.getSignupEndTime() != null && nowDay.after(DateUtils.toDateOnly(activity.getSignupEndTime()))) {
|
|
|
throw new IllegalArgumentException("报名已结束");
|
|
throw new IllegalArgumentException("报名已结束");
|
|
|
}
|
|
}
|
|
|
// if (activity.getStartTime() != null && status == 5 && now.before(activity.getStartTime())) {
|
|
// if (activity.getStartTime() != null && status == 5 && now.before(activity.getStartTime())) {
|
|
@@ -398,13 +399,13 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
if (activity == null) {
|
|
if (activity == null) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- Date now = new Date();
|
|
|
|
|
- Date start = activity.getSignupStartTime();
|
|
|
|
|
- Date end = activity.getSignupEndTime();
|
|
|
|
|
- if (start != null && now.before(start)) {
|
|
|
|
|
|
|
+ Date nowDay = DateUtils.toDateOnly(new Date());
|
|
|
|
|
+ Date start = DateUtils.toDateOnly(activity.getSignupStartTime());
|
|
|
|
|
+ Date end = DateUtils.toDateOnly(activity.getSignupEndTime());
|
|
|
|
|
+ if (start != null && nowDay.before(start)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- if (end != null && now.after(end)) {
|
|
|
|
|
|
|
+ if (end != null && nowDay.after(end)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
@@ -414,11 +415,11 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
if (activity == null) {
|
|
if (activity == null) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- Date now = new Date();
|
|
|
|
|
|
|
+ Date nowDay = DateUtils.toDateOnly(new Date());
|
|
|
if (activity.getStatus() != null && activity.getStatus() == 7) {
|
|
if (activity.getStatus() != null && activity.getStatus() == 7) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- if (activity.getEndTime() != null && now.after(activity.getEndTime())) {
|
|
|
|
|
|
|
+ if (activity.getEndTime() != null && nowDay.after(DateUtils.toDateOnly(activity.getEndTime()))) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
Integer status = activity.getStatus();
|
|
Integer status = activity.getStatus();
|
|
@@ -426,10 +427,10 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
if (signupStatus != null && signupStatus == 2
|
|
if (signupStatus != null && signupStatus == 2
|
|
|
- && activity.getStartTime() != null && now.before(activity.getStartTime())) {
|
|
|
|
|
|
|
+ && activity.getStartTime() != null && nowDay.before(DateUtils.toDateOnly(activity.getStartTime()))) {
|
|
|
return 2;
|
|
return 2;
|
|
|
}
|
|
}
|
|
|
- if (activity.getSignupEndTime() != null && now.after(activity.getSignupEndTime())) {
|
|
|
|
|
|
|
+ if (activity.getSignupEndTime() != null && nowDay.after(DateUtils.toDateOnly(activity.getSignupEndTime()))) {
|
|
|
if (status != null && status == 5 && signupStatus != null && signupStatus == 2) {
|
|
if (status != null && status == 5 && signupStatus != null && signupStatus == 2) {
|
|
|
return 3;
|
|
return 3;
|
|
|
}
|
|
}
|
|
@@ -443,7 +444,7 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
return 4;
|
|
return 4;
|
|
|
}
|
|
}
|
|
|
if (signupStatus == 1) {
|
|
if (signupStatus == 1) {
|
|
|
- if (activity.getSignupEndTime() != null && now.before(activity.getSignupEndTime())) {
|
|
|
|
|
|
|
+ if (activity.getSignupEndTime() != null && nowDay.before(DateUtils.toDateOnly(activity.getSignupEndTime()))) {
|
|
|
return 5;
|
|
return 5;
|
|
|
}
|
|
}
|
|
|
return 1;
|
|
return 1;
|
|
@@ -489,14 +490,14 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
if (item == null) {
|
|
if (item == null) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- Date now = new Date();
|
|
|
|
|
|
|
+ Date nowDay = DateUtils.toDateOnly(new Date());
|
|
|
Integer activityStatus = item.getActivityStatus();
|
|
Integer activityStatus = item.getActivityStatus();
|
|
|
boolean hasAchievement = item.getHasAchievement() != null && item.getHasAchievement() == 1;
|
|
boolean hasAchievement = item.getHasAchievement() != null && item.getHasAchievement() == 1;
|
|
|
Integer auditStatus = item.getSignupAuditStatus();
|
|
Integer auditStatus = item.getSignupAuditStatus();
|
|
|
Date startTime = item.getStartTime();
|
|
Date startTime = item.getStartTime();
|
|
|
Date endTime = item.getEndTime();
|
|
Date endTime = item.getEndTime();
|
|
|
boolean ended = (activityStatus != null && (activityStatus == 7 || activityStatus == 6))
|
|
boolean ended = (activityStatus != null && (activityStatus == 7 || activityStatus == 6))
|
|
|
- || (endTime != null && now.after(endTime));
|
|
|
|
|
|
|
+ || (endTime != null && nowDay.after(DateUtils.toDateOnly(endTime)));
|
|
|
if (ended) {
|
|
if (ended) {
|
|
|
return hasAchievement ? 2 : 1;
|
|
return hasAchievement ? 2 : 1;
|
|
|
}
|
|
}
|
|
@@ -512,7 +513,7 @@ public class StoreOperationalActivityServiceImpl implements StoreOperationalActi
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (auditStatus != null && auditStatus == 0
|
|
if (auditStatus != null && auditStatus == 0
|
|
|
- && startTime != null && now.before(startTime)) {
|
|
|
|
|
|
|
+ && startTime != null && nowDay.before(DateUtils.toDateOnly(startTime))) {
|
|
|
return 7;
|
|
return 7;
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|