Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -3,6 +3,8 @@ package com.sqx.modules.app.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.sqx.modules.app.entity.UserInfo;
|
import com.sqx.modules.app.entity.UserInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @description 针对表【user_info】的数据库操作Service
|
* @description 针对表【user_info】的数据库操作Service
|
||||||
@@ -12,6 +14,16 @@ public interface UserInfoService extends IService<UserInfo> {
|
|||||||
|
|
||||||
UserInfo getByUserId(long userId);
|
UserInfo getByUserId(long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户是否实名
|
||||||
|
*/
|
||||||
|
boolean isAuth(long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过查询用户实名信息 绑定的用户ID列表
|
||||||
|
*/
|
||||||
|
List<UserInfo> getUsersByNameAndCertNo(String certName,String certNo);
|
||||||
|
|
||||||
Integer countCertCount(String name, String idNum);
|
Integer countCertCount(String name, String idNum);
|
||||||
|
|
||||||
Integer countCertCount(String name, String idNum, String accountNo, String mobile);
|
Integer countCertCount(String name, String idNum, String accountNo, String mobile);
|
||||||
|
|||||||
@@ -7,14 +7,16 @@ import com.sqx.modules.app.mapper.UserInfoMapper;
|
|||||||
import com.sqx.modules.app.service.UserInfoService;
|
import com.sqx.modules.app.service.UserInfoService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @description 针对表【user_info】的数据库操作Service实现
|
* @description 针对表【user_info】的数据库操作Service实现
|
||||||
* @createDate 2025-01-02 14:15:08
|
* @createDate 2025-01-02 14:15:08
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||||
implements UserInfoService{
|
implements UserInfoService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserInfo getByUserId(long userId) {
|
public UserInfo getByUserId(long userId) {
|
||||||
@@ -28,6 +30,29 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAuth(long userId) {
|
||||||
|
UserInfo userInfo = getOne(new LambdaQueryWrapper<UserInfo>()
|
||||||
|
.eq(UserInfo::getUserId, userId)
|
||||||
|
.isNotNull(UserInfo::getCertName)
|
||||||
|
.isNotNull(UserInfo::getCertNo)
|
||||||
|
);
|
||||||
|
if (userInfo != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserInfo> getUsersByNameAndCertNo(String certName, String certNo) {
|
||||||
|
List<UserInfo> userIds = baseMapper.selectList(new LambdaQueryWrapper<UserInfo>()
|
||||||
|
.eq(UserInfo::getCertName,certName)
|
||||||
|
.eq(UserInfo::getCertNo,certNo)
|
||||||
|
.select(UserInfo::getUserId)
|
||||||
|
);
|
||||||
|
return userIds;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer countCertCount(String name, String idNum) {
|
public Integer countCertCount(String name, String idNum) {
|
||||||
return count(new LambdaQueryWrapper<UserInfo>()
|
return count(new LambdaQueryWrapper<UserInfo>()
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.sqx.common.annotation.Debounce;
|
|||||||
import com.sqx.common.exception.CzgException;
|
import com.sqx.common.exception.CzgException;
|
||||||
import com.sqx.common.utils.*;
|
import com.sqx.common.utils.*;
|
||||||
import com.sqx.modules.app.annotation.Login;
|
import com.sqx.modules.app.annotation.Login;
|
||||||
|
import com.sqx.modules.app.service.UserInfoService;
|
||||||
import com.sqx.modules.app.service.UserService;
|
import com.sqx.modules.app.service.UserService;
|
||||||
import com.sqx.modules.common.service.CommonInfoService;
|
import com.sqx.modules.common.service.CommonInfoService;
|
||||||
import com.sqx.modules.discSpinning.entity.DiscSpinning;
|
import com.sqx.modules.discSpinning.entity.DiscSpinning;
|
||||||
@@ -45,6 +46,7 @@ public class DiscSpinningController {
|
|||||||
private final TaskCenterService taskCenterService;
|
private final TaskCenterService taskCenterService;
|
||||||
private final TaskCenterRecordService taskRecordService;
|
private final TaskCenterRecordService taskRecordService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
private final UserInfoService userInfoService;
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
ScheduledExecutorService executor = Executors.newScheduledThreadPool(10);
|
ScheduledExecutorService executor = Executors.newScheduledThreadPool(10);
|
||||||
|
|
||||||
@@ -52,7 +54,7 @@ public class DiscSpinningController {
|
|||||||
public DiscSpinningController(CommonInfoService commonRepository, DiscSpinningService discSpinningService,
|
public DiscSpinningController(CommonInfoService commonRepository, DiscSpinningService discSpinningService,
|
||||||
OrdersService ordersService, DiscSpinningRecordService recordService,
|
OrdersService ordersService, DiscSpinningRecordService recordService,
|
||||||
TaskCenterService taskCenterService, UserService userService, RedisUtils redisUtils,
|
TaskCenterService taskCenterService, UserService userService, RedisUtils redisUtils,
|
||||||
TaskCenterRecordService taskRecordService) {
|
TaskCenterRecordService taskRecordService,UserInfoService userInfoService) {
|
||||||
this.commonRepository = commonRepository;
|
this.commonRepository = commonRepository;
|
||||||
this.discSpinningService = discSpinningService;
|
this.discSpinningService = discSpinningService;
|
||||||
this.ordersService = ordersService;
|
this.ordersService = ordersService;
|
||||||
@@ -61,6 +63,7 @@ public class DiscSpinningController {
|
|||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
this.redisUtils = redisUtils;
|
this.redisUtils = redisUtils;
|
||||||
this.taskRecordService = taskRecordService;
|
this.taskRecordService = taskRecordService;
|
||||||
|
this.userInfoService = userInfoService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/discSpinning/insertDiscSpinning")
|
@PostMapping("/discSpinning/insertDiscSpinning")
|
||||||
@@ -129,9 +132,9 @@ public class DiscSpinningController {
|
|||||||
})
|
})
|
||||||
@ApiOperation("查询大转盘")
|
@ApiOperation("查询大转盘")
|
||||||
public Result selectDiscSpinning(@RequestParam(required = false, defaultValue = "1") Integer source) {
|
public Result selectDiscSpinning(@RequestParam(required = false, defaultValue = "1") Integer source) {
|
||||||
PageHelper.startPage(1,20);
|
PageHelper.startPage(1, 20);
|
||||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(discSpinningService.list(
|
return Result.success().put("data", PageUtils.page(new PageInfo<>(discSpinningService.list(
|
||||||
new QueryWrapper<DiscSpinning>().eq("disc_type", source).orderByAsc("disc_type", "odds"))),true)
|
new QueryWrapper<DiscSpinning>().eq("disc_type", source).orderByAsc("disc_type", "odds"))), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,6 +178,10 @@ public class DiscSpinningController {
|
|||||||
double amount = 0;
|
double amount = 0;
|
||||||
Long sourceId = null;
|
Long sourceId = null;
|
||||||
Integer i = recordService.countDraw(userId);
|
Integer i = recordService.countDraw(userId);
|
||||||
|
if ((i != null && i.equals(2)) || !source.equals(1)) {
|
||||||
|
boolean auth = userInfoService.isAuth(userId);
|
||||||
|
if(!auth) return Result.error("剩余抽奖活动需要实名认证后进行");
|
||||||
|
}
|
||||||
if (source == null || source.equals(1)) {
|
if (source == null || source.equals(1)) {
|
||||||
source = 1;
|
source = 1;
|
||||||
//订单抽奖
|
//订单抽奖
|
||||||
@@ -239,7 +246,7 @@ public class DiscSpinningController {
|
|||||||
@RequestMapping("/app/discSpinning/receive")
|
@RequestMapping("/app/discSpinning/receive")
|
||||||
@Login
|
@Login
|
||||||
public Result receive(@RequestAttribute("userId") Long userId) {
|
public Result receive(@RequestAttribute("userId") Long userId) {
|
||||||
userService.addBlackUser(userId,"转盘奖项领取");
|
userService.addBlackUser(userId, "转盘奖项领取");
|
||||||
return Result.success().put("data", 1);
|
return Result.success().put("data", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TaskCenterRecordDao extends BaseMapper<TaskCenterRecord> {
|
public interface TaskCenterRecordDao extends BaseMapper<TaskCenterRecord> {
|
||||||
Integer countTaskNum(Long userId, Long taskId, String time);
|
Integer countTaskNum(Long userId, Long taskId, String time);
|
||||||
|
|
||||||
|
TaskCenterRecord countTaskNumByUserIds(Set<Long> userId, Long taskId, String time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.sqx.modules.taskCenter.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface TaskCenterRecordService extends IService<TaskCenterRecord> {
|
public interface TaskCenterRecordService extends IService<TaskCenterRecord> {
|
||||||
|
|
||||||
@@ -15,5 +15,6 @@ public interface TaskCenterRecordService extends IService<TaskCenterRecord> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer countTaskNum(Long userId,Long taskId,String time);
|
Integer countTaskNum(Long userId,Long taskId,String time);
|
||||||
|
Integer countTaskNum(Set<Long> userId, Long taskId, String time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,8 @@ import com.sqx.modules.taskCenter.dao.TaskCenterRecordDao;
|
|||||||
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
||||||
import com.sqx.modules.taskCenter.service.TaskCenterRecordService;
|
import com.sqx.modules.taskCenter.service.TaskCenterRecordService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Set;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TaskCenterRecordServiceImpl extends ServiceImpl<TaskCenterRecordDao, TaskCenterRecord> implements TaskCenterRecordService {
|
public class TaskCenterRecordServiceImpl extends ServiceImpl<TaskCenterRecordDao, TaskCenterRecord> implements TaskCenterRecordService {
|
||||||
@@ -19,5 +16,11 @@ public class TaskCenterRecordServiceImpl extends ServiceImpl<TaskCenterRecordDao
|
|||||||
public Integer countTaskNum(Long userId, Long taskId, String time) {
|
public Integer countTaskNum(Long userId, Long taskId, String time) {
|
||||||
return baseMapper.countTaskNum(userId, taskId, time);
|
return baseMapper.countTaskNum(userId, taskId, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countTaskNum(Set<Long> userId, Long taskId, String time) {
|
||||||
|
TaskCenterRecord record = baseMapper.countTaskNumByUserIds(userId, taskId, time);
|
||||||
|
return record == null ? 0 : 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,9 @@ import com.sqx.common.utils.RedisKeys;
|
|||||||
import com.sqx.common.utils.RedisUtils;
|
import com.sqx.common.utils.RedisUtils;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.entity.InviteAchievement;
|
import com.sqx.modules.app.entity.InviteAchievement;
|
||||||
import com.sqx.modules.app.entity.UserEntity;
|
import com.sqx.modules.app.entity.UserInfo;
|
||||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||||
import com.sqx.modules.app.service.InviteAchievementService;
|
import com.sqx.modules.app.service.*;
|
||||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
|
||||||
import com.sqx.modules.app.service.UserMoneyService;
|
|
||||||
import com.sqx.modules.app.service.UserService;
|
|
||||||
import com.sqx.modules.discSpinning.service.DiscSpinningRecordService;
|
import com.sqx.modules.discSpinning.service.DiscSpinningRecordService;
|
||||||
import com.sqx.modules.orders.service.OrdersService;
|
import com.sqx.modules.orders.service.OrdersService;
|
||||||
import com.sqx.modules.taskCenter.dao.TaskCenterDao;
|
import com.sqx.modules.taskCenter.dao.TaskCenterDao;
|
||||||
@@ -33,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter> implements TaskCenterService {
|
public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter> implements TaskCenterService {
|
||||||
@@ -52,6 +50,8 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DiscSpinningRecordService discSpinningRecordService;
|
private DiscSpinningRecordService discSpinningRecordService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private UserInfoService userInfoService;
|
||||||
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtils redisUtils;
|
private RedisUtils redisUtils;
|
||||||
@@ -167,26 +167,28 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
//一次性任务
|
//一次性任务
|
||||||
case 3:
|
case 3:
|
||||||
if (s.getId().equals(1L)) {
|
if (s.getId().equals(1L)) {
|
||||||
// Integer sumOrderNum = ordersService.countOrderNum(userId, null);
|
|
||||||
InviteAchievement inviteAchievement = inviteAchievementService.getByUserId(userId);
|
InviteAchievement inviteAchievement = inviteAchievementService.getByUserId(userId);
|
||||||
Integer sumOrderNum = 0;
|
Integer sumOrderNum = 0;
|
||||||
if (inviteAchievement != null) {
|
if (inviteAchievement != null) {
|
||||||
sumOrderNum = inviteAchievement.getCount();
|
sumOrderNum = inviteAchievement.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sumOrderNum != null && sumOrderNum < s.getNumber()) {
|
if (sumOrderNum != null && sumOrderNum < s.getNumber()) {
|
||||||
s.setDiscNumber(sumOrderNum);
|
s.setDiscNumber(sumOrderNum);
|
||||||
s.setNumber(s.getNumber());
|
s.setNumber(s.getNumber());
|
||||||
} else if (recordService.countTaskNum(userId, s.getId(), null) > 0) {
|
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
s.setDiscNumber(0);
|
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||||
s.setNumber(null);
|
if (userInfo != null || StringUtils.isNotBlank(userInfo.getCertNo()) || StringUtils.isNotBlank(userInfo.getCertName())) {
|
||||||
s.setJumpType(0);
|
List<UserInfo> users = userInfoService.getUsersByNameAndCertNo(userInfo.getCertName(), userInfo.getCertNo());
|
||||||
}
|
Set<Long> courseIds = users.stream().map(UserInfo::getUserId).collect(Collectors.toSet());
|
||||||
} else if (s.getDetail().contains("绑定支付宝")) {
|
if (recordService.countTaskNum(courseIds, s.getId(), null) > 0){
|
||||||
UserEntity userInfo = userService.queryByUserId(userId);
|
continue;
|
||||||
if (StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
}
|
||||||
continue;
|
}else if (recordService.countTaskNum(userId, s.getId(), null) > 0){
|
||||||
|
s.setDiscNumber(0);
|
||||||
|
s.setNumber(null);
|
||||||
|
s.setJumpType(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -234,8 +236,14 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
// Integer sumOrderNum = ordersService.countOrderNum(userId, null);
|
// Integer sumOrderNum = ordersService.countOrderNum(userId, null);
|
||||||
if (sumOrderNum != null && sumOrderNum < taskCenter.getNumber()) {
|
if (sumOrderNum != null && sumOrderNum < taskCenter.getNumber()) {
|
||||||
return Result.error("领取失败,未达成领取条件");
|
return Result.error("领取失败,未达成领取条件");
|
||||||
} else if (recordService.countTaskNum(userId, taskCenter.getId(), null) > 0) {
|
} else {
|
||||||
return Result.error("不可重复领取");
|
UserInfo userInfo = userInfoService.getByUserId(userId);
|
||||||
|
if (userInfo == null || StringUtils.isBlank(userInfo.getCertNo()) || StringUtils.isBlank(userInfo.getCertName())) {
|
||||||
|
return Result.error("请实名后领取");
|
||||||
|
}
|
||||||
|
List<UserInfo> users = userInfoService.getUsersByNameAndCertNo(userInfo.getCertName(), userInfo.getCertNo());
|
||||||
|
Set<Long> courseIds = users.stream().map(UserInfo::getUserId).collect(Collectors.toSet());
|
||||||
|
if (recordService.countTaskNum(courseIds, taskCenter.getId(), null) > 0) return Result.error("同一实名算一个新用户,不可重复领取");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<TaskCenterRecord> records = new ArrayList<>();
|
List<TaskCenterRecord> records = new ArrayList<>();
|
||||||
@@ -271,7 +279,7 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
record.setTaskId(id);
|
record.setTaskId(id);
|
||||||
record.setType(reward.getType());
|
record.setType(reward.getType());
|
||||||
record.setNumber(reward.getNumber());
|
record.setNumber(reward.getNumber());
|
||||||
record.setName(taskCenter.getTitle() + ":" + record.getName());
|
record.setName(taskCenter.getTitle());
|
||||||
record.setTargetId(targetId);
|
record.setTargetId(targetId);
|
||||||
record.setCreateTime(DateUtil.now());
|
record.setCreateTime(DateUtil.now());
|
||||||
record.setUpdateTime(DateUtil.now());
|
record.setUpdateTime(DateUtil.now());
|
||||||
|
|||||||
@@ -16,4 +16,22 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="countTaskNumByUserIds" resultType="com.sqx.modules.taskCenter.entity.TaskCenterRecord">
|
||||||
|
SELECT
|
||||||
|
record.id
|
||||||
|
FROM
|
||||||
|
task_center_record record
|
||||||
|
WHERE
|
||||||
|
record.user_id in
|
||||||
|
<foreach collection="userId" item="id" open="(" close=")" separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
AND record.task_id = #{taskId}
|
||||||
|
<if test="time !=null and time != ''">
|
||||||
|
and create_time > #{time}
|
||||||
|
</if>
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user