砍价新增状态显示,新增状态检测util
This commit is contained in:
@ -114,4 +114,6 @@ public class YxStoreBargainDto implements Serializable {
|
||||
private Timestamp endTimeDate;
|
||||
|
||||
private Timestamp startTimeDate;
|
||||
|
||||
private String statusStr;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
|
||||
*/
|
||||
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.dto.YxStoreBargainDto;
|
||||
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.utils.FileUtil;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -51,7 +52,14 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
getPage(pageable);
|
||||
PageInfo<YxStoreBargain> page = new PageInfo<>(queryAll(criteria));
|
||||
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());
|
||||
return map;
|
||||
}
|
||||
|
@ -52,20 +52,10 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
||||
getPage(pageable);
|
||||
PageInfo<YxStoreSeckill> page = new PageInfo<>(queryAll(criteria));
|
||||
List<YxStoreSeckillDto> storeSeckillDTOS = generator.convert(page.getList(),YxStoreSeckillDto.class);
|
||||
int nowTime = OrderUtil.getSecondTimestampTwo();
|
||||
for (YxStoreSeckillDto storeSeckillDTO : storeSeckillDTOS){
|
||||
if(storeSeckillDTO.getStatus() > 0){
|
||||
if(storeSeckillDTO.getStartTime() > nowTime){
|
||||
storeSeckillDTO.setStatusStr("活动未开始");
|
||||
}else if(storeSeckillDTO.getStopTime() < nowTime){
|
||||
storeSeckillDTO.setStatusStr("活动已结束");
|
||||
}else if(storeSeckillDTO.getStopTime() > nowTime && storeSeckillDTO.getStartTime() < nowTime){
|
||||
storeSeckillDTO.setStatusStr("正在进行中");
|
||||
}
|
||||
}else {
|
||||
storeSeckillDTO.setStatusStr("关闭");
|
||||
}
|
||||
|
||||
String statusStr = OrderUtil.checkActivityStatus(storeSeckillDTO.getStartTime(),
|
||||
storeSeckillDTO.getStopTime(), storeSeckillDTO.getStatus());
|
||||
storeSeckillDTO.setStatusStr(statusStr);
|
||||
}
|
||||
Map<String,Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content",storeSeckillDTOS);
|
||||
|
Reference in New Issue
Block a user