用户签到为空时 无法签到问题

This commit is contained in:
17600048398
2023-04-18 10:57:41 +08:00
parent 05c3c8a80c
commit 1f21d80dc0
3 changed files with 48 additions and 36 deletions

View File

@@ -189,10 +189,12 @@ public class ClerkServiceImpl extends ServiceImpl<ClerkMapper, Clerk> implements
clerk.setIsSuper(clerkAddDTO.getIsSuper());
//校验此会员是否已经是店员
Clerk temp = this.getClerkByMemberId(clerkAddDTO.getMemberId());
if (temp != null && !temp.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
//店员信息不为空
if (temp != null && !temp.getStoreId().equals(clerkAddDTO.getStoreId())) {
throw new ServiceException(ResultCode.CLERK_USER_ERROR);
}
if (temp != null && temp.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
if (temp != null && temp.getStoreId().equals(clerkAddDTO.getStoreId())) {
throw new ServiceException(ResultCode.CLERK_ALREADY_EXIT_ERROR);
}
//部门校验

View File

@@ -1,5 +1,6 @@
package cn.lili.modules.member.serviceimpl;
import cn.hutool.core.util.ObjectUtil;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.properties.RocketmqCustomProperties;
@@ -19,6 +20,7 @@ import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService;
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.rocketmq.tags.MemberTagsEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
@@ -62,8 +64,16 @@ public class MemberSignServiceImpl extends ServiceImpl<MemberSignMapper, MemberS
public Boolean memberSign() {
//获取当前会员信息
AuthUser authUser = UserContext.getCurrentUser();
if (authUser != null) {
if (ObjectUtil.isNotNull(authUser)) {
//获取当前用户当日签到日信息
LambdaQueryWrapper<MemberSign> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MemberSign::getMemberId, authUser.getId());
queryWrapper.eq(MemberSign::getDay,DateUtil.getDayOfStart().intValue());
List<MemberSign> signSize = this.baseMapper.getTodayMemberSign(queryWrapper);
//当日签到信息不为空
if (!signSize.isEmpty()) {
throw new ServiceException(ResultCode.MEMBER_SIGN_REPEAT);
}
//当前签到天数的前一天日期
List<MemberSign> signs = this.baseMapper.getBeforeMemberSign(authUser.getId());
//构建参数