diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java index ed958f89e..5c22c694a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelDieselController.java @@ -13,8 +13,6 @@ import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.commons.lang3.ObjectUtils; import org.apache.ibatis.annotations.Param; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -68,15 +66,20 @@ public class CardFuelDieselController extends BaseController { //返回囤油卡状态 for (CardFuelDiesel record : records) { record.setStatus(record.getStatus().equals("1") ? "true" : "false"); - if("1".equals(record.getActiveTime())){ - record.setActiveStatus(record.getActiveTime().equals("1") ? "1" : "0"); + if(ObjectUtils.isNotEmpty(record.getActiveTime()) && "1".equals(record.getActiveTime())){ + record.setActivityProgress("1"); } - if (ObjectUtils.isNotEmpty(record.getStartTime()) && ObjectUtils.isNotEmpty(record.getEndTime())){ - record.setActiveStatus(record.getStartTime().getTime() > new Date().getTime() ? "0" : "1"); - record.setActiveStatus(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2"); + //活动进度状态 + if (ObjectUtils.isNotEmpty(record.getStartTime()) && + ObjectUtils.isNotEmpty(record.getEndTime()) && + record.getActiveTime().equals("2")){ + record.setActivityProgress(record.getStartTime().getTime() > new Date().getTime() ? "0" : ""); + if(ObjectUtils.isEmpty(record.getActivityProgress())){ + record.setActivityProgress(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2"); + } } } - return getSuccessResult(this.cardFuelDieselService.page(page, queryWrapper)); + return getSuccessResult(page1); } /** @@ -103,6 +106,9 @@ public class CardFuelDieselController extends BaseController { cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId()); } + //活动时间 + cardFuelDiesel.setStartTime(new Date()); + cardFuelDiesel.setEndTime(new Date()); cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2"); return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelDiesel.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelDiesel.java index dadf00bf0..7703360e7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelDiesel.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelDiesel.java @@ -41,10 +41,10 @@ public class CardFuelDiesel extends Model { //活动时间 1:不限时间 2:自定义时间 private String activeTime; //活动开始时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; //活动结束时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; //活动进度 private String activityProgress; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java index 4160cc184..2d67eeb26 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java @@ -74,6 +74,9 @@ public class CardGiftServiceImpl extends ServiceImpl i */ @Override public Map selectStatistics(Integer storeId) { + if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { + storeId = TokenUtil.getNowAccountInfo().getStoreId(); + } HashMap map = new HashMap<>(); if (ObjectUtils.isNotEmpty(storeId)) { //获取礼品卡数量 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java index 12bea8ff4..5082a4ba6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueController.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardValue.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.marketingActivity.cardValue.entity.CardValue; import com.fuint.business.marketingActivity.cardValue.service.CardValueService; @@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; +import java.util.Date; import java.util.List; /** @@ -54,7 +56,23 @@ public class CardValueController extends BaseController { queryWrapper.eq(CardValue::getIsonline,cardValue.getIsonline()); } queryWrapper.orderByDesc(CardValue::getCreateTime); - return getSuccessResult(this.cardValueService.page(page, queryWrapper)); + IPage page1 = this.cardValueService.page(page, queryWrapper); + List records = page1.getRecords(); + //返回储值卡活动进度状态 + for (CardValue record : records) { + if(ObjectUtils.isNotEmpty(record.getActiveTime()) && record.getActiveTime().equals("1")){ + record.setActivityProgress("1"); + } + if (ObjectUtils.isNotEmpty(record.getStartTime()) && + ObjectUtils.isNotEmpty(record.getEndTime()) && + record.getActiveTime().equals("2")){ + record.setActivityProgress(record.getStartTime().getTime() > new Date().getTime() ? "0" : ""); + if(ObjectUtils.isEmpty(record.getActivityProgress())){ + record.setActivityProgress(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2"); + } + } + } + return getSuccessResult(page1); } /** @@ -89,6 +107,8 @@ public class CardValueController extends BaseController { public ResponseObject insert(@RequestBody CardValue cardValue) { //获取当前店铺的id和连锁店id if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) { + cardValue.setStartTime(new Date()); + cardValue.setEndTime(new Date()); cardValue.setStoreId(TokenUtil.getNowAccountInfo().getStoreId()); cardValue.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId()); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java index d533406e6..a9e665bbb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/entity/CardValue.java @@ -56,11 +56,13 @@ public class CardValue extends Model { private Double percentageCommissions; //活动时间 1:不限时间 2:自定义时间 private String activeTime; + //活动进度 + private String activityProgress; //活动开始时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; //活动结束时间 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; //活动状态 1:启用 2:禁用 private String activeStatus; @@ -236,6 +238,14 @@ public class CardValue extends Model { this.activeTime = activeTime; } + public String getActivityProgress() { + return activityProgress; + } + + public void setActivityProgress(String activityProgress) { + this.activityProgress = activityProgress; + } + public Date getStartTime() { return startTime; }