更新10.10
This commit is contained in:
parent
ed1a41de21
commit
960db8c98a
@ -1,5 +1,7 @@
|
||||
package com.fuint.business.marketingActivity.activeApplet.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -26,6 +28,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -208,11 +211,33 @@ public class ActiveAppletServiceImpl extends ServiceImpl<ActiveAppletMapper, Act
|
||||
*/
|
||||
@Override
|
||||
public ActiveApplet selectByStoreId(Integer storeId) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<ActiveApplet>()
|
||||
ActiveApplet activeApplet = baseMapper.selectOne(new LambdaQueryWrapper<ActiveApplet>()
|
||||
.eq(ActiveApplet::getStoreId, storeId)
|
||||
.eq(ActiveApplet::getType, "7")
|
||||
.eq(ActiveApplet::getIsonline, "0")
|
||||
.eq(ActiveApplet::getActiveStatus, "1"));
|
||||
if (activeApplet != null) {
|
||||
if (!"1".equals(activeApplet.getTime())) {
|
||||
return activeApplet;
|
||||
}else {
|
||||
DateTime now = DateUtil.date();
|
||||
Date activeStartTime = activeApplet.getActiveStartTime();
|
||||
Date activeEndTime = activeApplet.getActiveEndTime();
|
||||
//判断当前时间是否在活动时间范围内
|
||||
boolean timeBetween = isTimeBetween(activeStartTime, activeEndTime, now);
|
||||
if (timeBetween) {
|
||||
return activeApplet;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isTimeBetween(Date activeStartTime, Date activeEndTime, DateTime now) {
|
||||
if (now.isAfterOrEquals(activeStartTime) && now.isBeforeOrEquals(activeEndTime)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user