Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -3,6 +3,7 @@ package com.sqx;
|
|||||||
import com.sqx.modules.pay.wuyou.WuyouPay;
|
import com.sqx.modules.pay.wuyou.WuyouPay;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* @author GYJ
|
* @author GYJ
|
||||||
*/
|
*/
|
||||||
|
@EnableCaching
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SqxApplication {
|
public class SqxApplication {
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
package com.sqx.config;
|
package com.sqx.config;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.CacheManager;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.core.*;
|
import org.springframework.data.redis.core.*;
|
||||||
|
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redis配置
|
* Redis配置
|
||||||
*
|
*
|
||||||
@@ -16,6 +23,18 @@ public class RedisConfig {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedisConnectionFactory factory;
|
private RedisConnectionFactory factory;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) {
|
||||||
|
RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMinutes(30))
|
||||||
|
// 设置缓存过期时间为30分钟
|
||||||
|
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()))
|
||||||
|
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer()))
|
||||||
|
.disableCachingNullValues();
|
||||||
|
|
||||||
|
return RedisCacheManager.builder(redisConnectionFactory)
|
||||||
|
.cacheDefaults(cacheConfiguration)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<String, Object> redisTemplate() {
|
public RedisTemplate<String, Object> redisTemplate() {
|
||||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.sqx.modules.common.entity.CommonInfo;
|
import com.sqx.modules.common.entity.CommonInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -13,10 +15,11 @@ import java.util.List;
|
|||||||
* @date 2020/7/8
|
* @date 2020/7/8
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
|
@CacheConfig(cacheNames = "common")
|
||||||
public interface CommonInfoDao extends BaseMapper<CommonInfo> {
|
public interface CommonInfoDao extends BaseMapper<CommonInfo> {
|
||||||
|
|
||||||
List<CommonInfo> findByCondition(@Param("condition") String condition);
|
List<CommonInfo> findByCondition(@Param("condition") String condition);
|
||||||
|
@Cacheable(key = "#type")
|
||||||
CommonInfo findOne(@Param("type") int type);
|
CommonInfo findOne(@Param("type") int type);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import com.sqx.modules.common.entity.CommonInfo;
|
|||||||
import com.sqx.modules.common.service.CommonInfoService;
|
import com.sqx.modules.common.service.CommonInfoService;
|
||||||
import com.sqx.modules.course.service.CourseService;
|
import com.sqx.modules.course.service.CourseService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.CachePut;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -16,6 +20,7 @@ import java.util.Date;
|
|||||||
* @author fang
|
* @author fang
|
||||||
* @date 2020/7/8
|
* @date 2020/7/8
|
||||||
*/
|
*/
|
||||||
|
@CacheConfig(cacheNames = "common")
|
||||||
@Service
|
@Service
|
||||||
public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo> implements CommonInfoService {
|
public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo> implements CommonInfoService {
|
||||||
|
|
||||||
@@ -25,7 +30,7 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
|||||||
private CourseService courseService;
|
private CourseService courseService;
|
||||||
|
|
||||||
|
|
||||||
|
@CacheEvict(key = "#commonInfo.id")
|
||||||
@Override
|
@Override
|
||||||
public Result update(CommonInfo commonInfo) {
|
public Result update(CommonInfo commonInfo) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@@ -43,19 +48,19 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
|||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonInfo findOne(int type) {
|
public CommonInfo findOne(int type) {
|
||||||
return commonInfoDao.findOne(type);
|
return commonInfoDao.findOne(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#id")
|
||||||
@Override
|
@Override
|
||||||
public Result delete(long id) {
|
public Result delete(long id) {
|
||||||
commonInfoDao.deleteById(id);
|
commonInfoDao.deleteById(id);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#commonInfo.id")
|
||||||
@Override
|
@Override
|
||||||
public Result updateBody(CommonInfo commonInfo) {
|
public Result updateBody(CommonInfo commonInfo) {
|
||||||
commonInfoDao.updateById(commonInfo);
|
commonInfoDao.updateById(commonInfo);
|
||||||
|
|||||||
@@ -194,24 +194,27 @@ public class DiscSpinningController {
|
|||||||
}else if(source.equals(3)){
|
}else if(source.equals(3)){
|
||||||
redisKey = RedisKeys.getDateKey("spinning:amount:taskM") + userId;
|
redisKey = RedisKeys.getDateKey("spinning:amount:taskM") + userId;
|
||||||
}
|
}
|
||||||
Map<Integer, Integer> week = redisUtils.get(redisKey, Map.class);
|
Map<String, Object> week = redisUtils.get(redisKey, Map.class);
|
||||||
for (Map.Entry<Integer, Integer> entry : week.entrySet()) {
|
for (Map.Entry<String, Object> entry : week.entrySet()) {
|
||||||
Integer value = entry.getValue();
|
int value = new BigDecimal(entry.getValue().toString()).intValue();
|
||||||
if (value > 1) {
|
if (value > 1) {
|
||||||
value = value - 1;
|
value = value - 1;
|
||||||
week.put(entry.getKey(), value);
|
week.put(entry.getKey(), value);
|
||||||
|
sourceId = Long.valueOf(entry.getKey());
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
TaskCenterRecord centerRecord = new TaskCenterRecord();
|
TaskCenterRecord centerRecord = new TaskCenterRecord();
|
||||||
centerRecord.setUserId(userId);
|
centerRecord.setUserId(userId);
|
||||||
centerRecord.setTaskId(entry.getKey().longValue());
|
centerRecord.setTaskId(Long.valueOf(entry.getKey()));
|
||||||
if(source.equals(2)){
|
if(source.equals(2)){
|
||||||
centerRecord.setSourceId(entry.getKey().longValue());
|
sourceId = Long.valueOf(entry.getKey());
|
||||||
|
centerRecord.setSourceId(Long.getLong(entry.getKey()));
|
||||||
}
|
}
|
||||||
centerRecord.setName(source.equals(2) ? "周任务奖励" : "月任务奖励");
|
centerRecord.setName(source.equals(2) ? "周任务奖励" : "月任务奖励");
|
||||||
centerRecord.setType(9);
|
centerRecord.setType(9);
|
||||||
centerRecord.setNumber(1);
|
centerRecord.setNumber(1);
|
||||||
centerRecord.setCreateTime(DateUtil.now());
|
centerRecord.setCreateTime(DateUtil.now());
|
||||||
|
centerRecord.setUpdateTime(DateUtil.now());
|
||||||
taskRecordService.save(centerRecord);
|
taskRecordService.save(centerRecord);
|
||||||
week.remove(entry.getKey());
|
week.remove(entry.getKey());
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import com.sqx.modules.taskCenter.entity.TaskCenterReward;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TaskCenterRewardDao extends BaseMapper<TaskCenterReward> {
|
public interface TaskCenterRewardDao extends BaseMapper<TaskCenterReward> {
|
||||||
|
|
||||||
@Select("SELECT type,number FROM `task_center_reward` where task_id = #{taskId}")
|
@Select("SELECT type,number FROM `task_center_reward` where task_id = #{taskId}")
|
||||||
Map<Integer, Integer> getRewardMap(Long taskId);
|
List<TaskCenterReward> getRewardMap(Long taskId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TaskCenterRewardServiceImpl extends ServiceImpl<TaskCenterRewardDao, TaskCenterReward> implements TaskCenterRewardService {
|
public class TaskCenterRewardServiceImpl extends ServiceImpl<TaskCenterRewardDao, TaskCenterReward> implements TaskCenterRewardService {
|
||||||
@@ -17,7 +20,14 @@ public class TaskCenterRewardServiceImpl extends ServiceImpl<TaskCenterRewardDao
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, Integer> getRewardMap(Long taskId) {
|
public Map<Integer, Integer> getRewardMap(Long taskId) {
|
||||||
return baseMapper.getRewardMap(taskId);
|
List<TaskCenterReward> rewards = baseMapper.getRewardMap(taskId);
|
||||||
|
|
||||||
|
Map<Integer, Integer> map = rewards.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
TaskCenterReward::getType,
|
||||||
|
Collectors.summingInt(TaskCenterReward::getNumber)
|
||||||
|
));
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,14 +91,21 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
//周任务
|
//周任务
|
||||||
if (s.getNumber() > 1 && s.getNumber() < 8) {
|
if (s.getNumber() > 1 && s.getNumber() < 8) {
|
||||||
if (rewardMap.containsKey(9)) {
|
if (rewardMap.containsKey(9)) {
|
||||||
|
boolean isBreak = false;
|
||||||
//抽奖次数
|
//抽奖次数
|
||||||
Map<Integer, Integer> taskWCount = signRecordService.getTaskWCount(userId, rewardMap.get(9));
|
Map<Long, Integer> taskWCount = signRecordService.getTaskWCount(userId, rewardMap.get(9));
|
||||||
if (CollectionUtil.isNotEmpty(taskWCount)) {
|
if (CollectionUtil.isNotEmpty(taskWCount)) {
|
||||||
for (Integer value : taskWCount.values()) {
|
for (Integer value : taskWCount.values()) {
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
|
isBreak=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isBreak){
|
||||||
|
s.setDiscNumber(null);
|
||||||
|
s.setNumber(null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Integer wSignCount = signRecordService.getWSignCount(userId);
|
Integer wSignCount = signRecordService.getWSignCount(userId);
|
||||||
@@ -123,6 +130,8 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
if (rewardMap.containsKey(9)) {
|
if (rewardMap.containsKey(9)) {
|
||||||
Integer spinningCount = discSpinningRecordService.countSourceRecord(s.getId());
|
Integer spinningCount = discSpinningRecordService.countSourceRecord(s.getId());
|
||||||
if (spinningCount == null || spinningCount > 0) {
|
if (spinningCount == null || spinningCount > 0) {
|
||||||
|
s.setDiscNumber(null);
|
||||||
|
s.setNumber(null);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
s.setButtonTitle("已领取");
|
s.setButtonTitle("已领取");
|
||||||
@@ -264,14 +273,14 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||||||
Map<Integer, Integer> taskWRedisMap = new HashMap<>();
|
Map<Integer, Integer> taskWRedisMap = new HashMap<>();
|
||||||
if ("2".equals(type)) {
|
if ("2".equals(type)) {
|
||||||
//抽奖次数
|
//抽奖次数
|
||||||
Map<Integer, Integer> taskWCount = signRecordService.getTaskWCount(userId, rewardMap.get(9));
|
Map<Long, Integer> taskWCount = signRecordService.getTaskWCount(userId, rewardMap.get(9));
|
||||||
if (CollectionUtil.isNotEmpty(taskWCount)) {
|
if (CollectionUtil.isNotEmpty(taskWCount)) {
|
||||||
for (Map.Entry<Integer, Integer> entry : taskWCount.entrySet()) {
|
for (Map.Entry<Long, Integer> entry : taskWCount.entrySet()) {
|
||||||
Integer key = entry.getKey();
|
Long key = entry.getKey();
|
||||||
Integer value = entry.getValue();
|
Integer value = entry.getValue();
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
countTaskDisc = countTaskDisc + value;
|
countTaskDisc = countTaskDisc + value;
|
||||||
taskWRedisMap.put(key, value);
|
taskWRedisMap.put(key.intValue(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.sqx.modules.userSign.entity.UserSignRecord;
|
import com.sqx.modules.userSign.entity.UserSignRecord;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface UserSignRecordDao extends BaseMapper<UserSignRecord> {
|
public interface UserSignRecordDao extends BaseMapper<UserSignRecord> {
|
||||||
//周 抽奖次数
|
//周 抽奖次数
|
||||||
Map<Integer,Integer> getTaskWCount(long userId, int wCount,String time);
|
List<UserSignRecord> getTaskWCount(long userId, int wCount,String time,List<Long> ids);
|
||||||
|
|
||||||
|
List<Long> getNoRecordTask(long userId, String time);
|
||||||
//周 签到 次数 连续签到
|
//周 签到 次数 连续签到
|
||||||
Integer getWSignCount(long userId,String time);
|
Integer getWSignCount(long userId,String time);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public interface UserSignRecordService extends IService<UserSignRecord> {
|
|||||||
//获取当月签到次数
|
//获取当月签到次数
|
||||||
int getUserSignCount(long userId);
|
int getUserSignCount(long userId);
|
||||||
//周 剩余抽奖次数
|
//周 剩余抽奖次数
|
||||||
Map<Integer,Integer> getTaskWCount(long userId, int wCount);
|
Map<Long,Integer> getTaskWCount(long userId, int wCount);
|
||||||
//周 签到 次数
|
//周 签到 次数
|
||||||
Integer getWSignCount(long userId);
|
Integer getWSignCount(long userId);
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.sqx.modules.app.dao.UserDao;
|
|||||||
import com.sqx.modules.app.entity.UserEntity;
|
import com.sqx.modules.app.entity.UserEntity;
|
||||||
import com.sqx.modules.common.dao.CommonInfoDao;
|
import com.sqx.modules.common.dao.CommonInfoDao;
|
||||||
import com.sqx.modules.common.entity.CommonInfo;
|
import com.sqx.modules.common.entity.CommonInfo;
|
||||||
|
import com.sqx.modules.taskCenter.entity.TaskCenterReward;
|
||||||
import com.sqx.modules.userSign.dao.UserSignRecordDao;
|
import com.sqx.modules.userSign.dao.UserSignRecordDao;
|
||||||
import com.sqx.modules.userSign.dto.UserSignDTO;
|
import com.sqx.modules.userSign.dto.UserSignDTO;
|
||||||
import com.sqx.modules.userSign.dto.UserSignRecordDTO;
|
import com.sqx.modules.userSign.dto.UserSignRecordDTO;
|
||||||
@@ -132,9 +133,16 @@ public class UserSignRecordServiceImpl extends ServiceImpl<UserSignRecordDao, Us
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer,Integer> getTaskWCount(long userId,int wCount) {
|
public Map<Long,Integer> getTaskWCount(long userId,int wCount) {
|
||||||
Date thirtyDaysAgo = DateUtil.offsetDay(new Date(), -30);
|
Date thirtyDaysAgo = DateUtil.offsetDay(new Date(), -30);
|
||||||
return baseMapper.getTaskWCount(userId,wCount,DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd")+" 00:00:00");
|
List<Long> noRecordTasks = baseMapper.getNoRecordTask(userId, DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd") + " 00:00:00");
|
||||||
|
List<UserSignRecord> taskWCount = baseMapper.getTaskWCount(userId, wCount, DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd") + " 00:00:00", noRecordTasks);
|
||||||
|
Map<Long, Integer> map = taskWCount.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
UserSignRecord::getId,
|
||||||
|
Collectors.summingInt(UserSignRecord::getDay)
|
||||||
|
));
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
c.msg_url as msgUrl,
|
c.msg_url as msgUrl,
|
||||||
c.pay_num as payNum,
|
c.pay_num as payNum,
|
||||||
c.price,
|
c.price,
|
||||||
|
c.wholesale_price as wholesalePrice,
|
||||||
c.is_over as isOver,
|
c.is_over as isOver,
|
||||||
c.title,
|
c.title,
|
||||||
c.is_price as isPrice,
|
c.is_price as isPrice,
|
||||||
@@ -139,6 +140,7 @@
|
|||||||
c.msg_url as msgUrl,
|
c.msg_url as msgUrl,
|
||||||
c.pay_num as payNum,
|
c.pay_num as payNum,
|
||||||
c.price,
|
c.price,
|
||||||
|
c.wholesale_price as wholesalePrice,
|
||||||
c.is_over as isOver,
|
c.is_over as isOver,
|
||||||
c.title,
|
c.title,
|
||||||
c.is_price as isPrice,
|
c.is_price as isPrice,
|
||||||
@@ -264,6 +266,7 @@
|
|||||||
c.msg_url as msgUrl,
|
c.msg_url as msgUrl,
|
||||||
c.pay_num as payNum,
|
c.pay_num as payNum,
|
||||||
c.price,
|
c.price,
|
||||||
|
c.wholesale_price as wholesalePrice,
|
||||||
c.status,
|
c.status,
|
||||||
c.title,
|
c.title,
|
||||||
c.title_img as titleImg,
|
c.title_img as titleImg,
|
||||||
|
|||||||
@@ -281,12 +281,12 @@
|
|||||||
<select id="selectOrdersCountStatisticsByDay" resultType="Integer">
|
<select id="selectOrdersCountStatisticsByDay" resultType="Integer">
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM orders
|
FROM orders
|
||||||
LEFT JOIN disc_spinning_record record ON orders.orders_id = record.source_id
|
LEFT JOIN disc_spinning_record record ON orders.orders_id = record.source_id and record.source = 'order'
|
||||||
WHERE orders.user_id = #{userId}
|
WHERE orders.user_id = #{userId}
|
||||||
AND orders.`status` = 1
|
AND orders.`status` = 1
|
||||||
AND orders.`pay_way` = 9
|
AND orders.`pay_way` = 9
|
||||||
AND orders.create_time > DATE_FORMAT(CURDATE(), '%Y-%m-%d 00:00:00')
|
AND orders.create_time > DATE_FORMAT(CURDATE(), '%Y-%m-%d 00:00:00')
|
||||||
AND record.order_id IS NULL
|
AND record.source_id IS NULL
|
||||||
ORDER BY orders.create_time
|
ORDER BY orders.create_time
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@
|
|||||||
AND orders.`status` = 1
|
AND orders.`status` = 1
|
||||||
AND orders.`pay_way` = 9
|
AND orders.`pay_way` = 9
|
||||||
AND orders.create_time > DATE_FORMAT(CURDATE(), '%Y-%m-%d 00:00:00')
|
AND orders.create_time > DATE_FORMAT(CURDATE(), '%Y-%m-%d 00:00:00')
|
||||||
AND record.order_id IS NULL
|
AND record.source_id IS NULL
|
||||||
ORDER BY orders.create_time LIMIT 1
|
ORDER BY orders.create_time LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,38 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.sqx.modules.userSign.dao.UserSignRecordDao">
|
<mapper namespace="com.sqx.modules.userSign.dao.UserSignRecordDao">
|
||||||
|
|
||||||
<select id="getTaskWCount" resultType="Map">
|
<select id="getNoRecordTask" resultType="Long">
|
||||||
SELECT
|
SELECT
|
||||||
sign.id,
|
sign.id
|
||||||
#{wCount} - COUNT(CASE WHEN cenRecord.id IS NULL and record.source_id IS NOT NULL THEN 1 END) AS record_count
|
FROM
|
||||||
|
user_sign_record sign
|
||||||
|
LEFT JOIN task_center_record cenRecord ON sign.id = cenRecord.source_id
|
||||||
|
WHERE
|
||||||
|
sign.`DAY` = 7
|
||||||
|
AND sign.user_id = #{userId}
|
||||||
|
and sign.create_time > #{time}
|
||||||
|
AND cenRecord.id IS NULL
|
||||||
|
order by sign.create_time asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTaskWCount" resultType="com.sqx.modules.userSign.entity.UserSignRecord">
|
||||||
|
SELECT
|
||||||
|
sign.id as id,
|
||||||
|
#{wCount} - COUNT(CASE WHEN spRecord.source_id IS NOT NULL THEN 1 END) AS `day`
|
||||||
FROM
|
FROM
|
||||||
user_sign_record sign
|
user_sign_record sign
|
||||||
LEFT JOIN task_center_record cenRecord on sign.id = cenRecord.source_id
|
|
||||||
LEFT JOIN disc_spinning_record spRecord ON sign.id = spRecord.source_id
|
LEFT JOIN disc_spinning_record spRecord ON sign.id = spRecord.source_id
|
||||||
WHERE
|
WHERE
|
||||||
sign.`DAY` = 7;
|
sign.`DAY` = 7
|
||||||
AND sign.user_id = #{userId}
|
AND sign.user_id = #{userId}
|
||||||
and sign.create_time > #{time}
|
AND sign.create_time > #{time}
|
||||||
|
<if test="ids!= null and ids.size() > 0">
|
||||||
|
AND sign.id in
|
||||||
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
GROUP BY sign.id
|
||||||
order by sign.create_time asc
|
order by sign.create_time asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user