砍价新增状态显示,新增状态检测util

This commit is contained in:
hupeng
2020-05-27 19:42:16 +08:00
parent 0f32c1b89b
commit 620abb583b
3 changed files with 22 additions and 22 deletions

View File

@ -114,4 +114,6 @@ public class YxStoreBargainDto implements Serializable {
private Timestamp endTimeDate;
private Timestamp startTimeDate;
private String statusStr;
}

View File

@ -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;
}

View File

@ -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);