砍价新增状态显示,新增状态检测util
This commit is contained in:
@ -114,4 +114,6 @@ public class YxStoreBargainDto implements Serializable {
|
|||||||
private Timestamp endTimeDate;
|
private Timestamp endTimeDate;
|
||||||
|
|
||||||
private Timestamp startTimeDate;
|
private Timestamp startTimeDate;
|
||||||
|
|
||||||
|
private String statusStr;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2018-2020
|
* Copyright (C) 2018-2020
|
||||||
* All rights reserved, Designed By www.yixiang.co
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package co.yixiang.modules.activity.service.impl;
|
package co.yixiang.modules.activity.service.impl;
|
||||||
|
|
||||||
@ -12,8 +11,10 @@ import co.yixiang.modules.activity.domain.YxStoreBargain;
|
|||||||
import co.yixiang.modules.activity.service.YxStoreBargainService;
|
import co.yixiang.modules.activity.service.YxStoreBargainService;
|
||||||
import co.yixiang.modules.activity.service.dto.YxStoreBargainDto;
|
import co.yixiang.modules.activity.service.dto.YxStoreBargainDto;
|
||||||
import co.yixiang.modules.activity.service.dto.YxStoreBargainQueryCriteria;
|
import co.yixiang.modules.activity.service.dto.YxStoreBargainQueryCriteria;
|
||||||
|
import co.yixiang.modules.activity.service.dto.YxStoreSeckillDto;
|
||||||
import co.yixiang.modules.activity.service.mapper.YxStoreBargainMapper;
|
import co.yixiang.modules.activity.service.mapper.YxStoreBargainMapper;
|
||||||
import co.yixiang.utils.FileUtil;
|
import co.yixiang.utils.FileUtil;
|
||||||
|
import co.yixiang.utils.OrderUtil;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@ -34,9 +35,9 @@ import java.util.Map;
|
|||||||
//import org.springframework.cache.annotation.Cacheable;
|
//import org.springframework.cache.annotation.Cacheable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hupeng
|
* @author hupeng
|
||||||
* @date 2020-05-13
|
* @date 2020-05-13
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
//@CacheConfig(cacheNames = "yxStoreBargain")
|
//@CacheConfig(cacheNames = "yxStoreBargain")
|
||||||
@ -51,7 +52,14 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
getPage(pageable);
|
getPage(pageable);
|
||||||
PageInfo<YxStoreBargain> page = new PageInfo<>(queryAll(criteria));
|
PageInfo<YxStoreBargain> page = new PageInfo<>(queryAll(criteria));
|
||||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||||
map.put("content", generator.convert(page.getList(), YxStoreBargainDto.class));
|
List<YxStoreBargainDto> storeBargainDtoList = generator.convert(page.getList(), YxStoreBargainDto.class);
|
||||||
|
for (YxStoreBargainDto storeBargainDto : storeBargainDtoList) {
|
||||||
|
|
||||||
|
String statusStr = OrderUtil.checkActivityStatus(storeBargainDto.getStartTime(),
|
||||||
|
storeBargainDto.getStopTime(), storeBargainDto.getStatus());
|
||||||
|
storeBargainDto.setStatusStr(statusStr);
|
||||||
|
}
|
||||||
|
map.put("content", storeBargainDtoList);
|
||||||
map.put("totalElements", page.getTotal());
|
map.put("totalElements", page.getTotal());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@ -59,7 +67,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
//@Cacheable
|
//@Cacheable
|
||||||
public List<YxStoreBargain> queryAll(YxStoreBargainQueryCriteria criteria){
|
public List<YxStoreBargain> queryAll(YxStoreBargainQueryCriteria criteria) {
|
||||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreBargain.class, criteria));
|
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreBargain.class, criteria));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +76,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
public void download(List<YxStoreBargainDto> all, HttpServletResponse response) throws IOException {
|
public void download(List<YxStoreBargainDto> all, HttpServletResponse response) throws IOException {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
for (YxStoreBargainDto yxStoreBargain : all) {
|
for (YxStoreBargainDto yxStoreBargain : all) {
|
||||||
Map<String,Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("关联产品ID", yxStoreBargain.getProductId());
|
map.put("关联产品ID", yxStoreBargain.getProductId());
|
||||||
map.put("砍价活动名称", yxStoreBargain.getTitle());
|
map.put("砍价活动名称", yxStoreBargain.getTitle());
|
||||||
map.put("砍价活动图片", yxStoreBargain.getImage());
|
map.put("砍价活动图片", yxStoreBargain.getImage());
|
||||||
@ -99,8 +107,8 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
|||||||
map.put("砍价规则", yxStoreBargain.getRule());
|
map.put("砍价规则", yxStoreBargain.getRule());
|
||||||
map.put("砍价产品浏览量", yxStoreBargain.getLook());
|
map.put("砍价产品浏览量", yxStoreBargain.getLook());
|
||||||
map.put("砍价产品分享量", yxStoreBargain.getShare());
|
map.put("砍价产品分享量", yxStoreBargain.getShare());
|
||||||
map.put(" endTimeDate", yxStoreBargain.getEndTimeDate());
|
map.put(" endTimeDate", yxStoreBargain.getEndTimeDate());
|
||||||
map.put(" startTimeDate", yxStoreBargain.getStartTimeDate());
|
map.put(" startTimeDate", yxStoreBargain.getStartTimeDate());
|
||||||
list.add(map);
|
list.add(map);
|
||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
|
@ -52,20 +52,10 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
|||||||
getPage(pageable);
|
getPage(pageable);
|
||||||
PageInfo<YxStoreSeckill> page = new PageInfo<>(queryAll(criteria));
|
PageInfo<YxStoreSeckill> page = new PageInfo<>(queryAll(criteria));
|
||||||
List<YxStoreSeckillDto> storeSeckillDTOS = generator.convert(page.getList(),YxStoreSeckillDto.class);
|
List<YxStoreSeckillDto> storeSeckillDTOS = generator.convert(page.getList(),YxStoreSeckillDto.class);
|
||||||
int nowTime = OrderUtil.getSecondTimestampTwo();
|
|
||||||
for (YxStoreSeckillDto storeSeckillDTO : storeSeckillDTOS){
|
for (YxStoreSeckillDto storeSeckillDTO : storeSeckillDTOS){
|
||||||
if(storeSeckillDTO.getStatus() > 0){
|
String statusStr = OrderUtil.checkActivityStatus(storeSeckillDTO.getStartTime(),
|
||||||
if(storeSeckillDTO.getStartTime() > nowTime){
|
storeSeckillDTO.getStopTime(), storeSeckillDTO.getStatus());
|
||||||
storeSeckillDTO.setStatusStr("活动未开始");
|
storeSeckillDTO.setStatusStr(statusStr);
|
||||||
}else if(storeSeckillDTO.getStopTime() < nowTime){
|
|
||||||
storeSeckillDTO.setStatusStr("活动已结束");
|
|
||||||
}else if(storeSeckillDTO.getStopTime() > nowTime && storeSeckillDTO.getStartTime() < nowTime){
|
|
||||||
storeSeckillDTO.setStatusStr("正在进行中");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
storeSeckillDTO.setStatusStr("关闭");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Map<String,Object> map = new LinkedHashMap<>(2);
|
Map<String,Object> map = new LinkedHashMap<>(2);
|
||||||
map.put("content",storeSeckillDTOS);
|
map.put("content",storeSeckillDTOS);
|
||||||
|
Reference in New Issue
Block a user