油卡活动进度
This commit is contained in:
parent
4c6c8b57b8
commit
3c0078066e
@ -13,8 +13,6 @@ import com.fuint.framework.web.BaseController;
|
|||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
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 org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -68,15 +66,20 @@ public class CardFuelDieselController extends BaseController {
|
|||||||
//返回囤油卡状态
|
//返回囤油卡状态
|
||||||
for (CardFuelDiesel record : records) {
|
for (CardFuelDiesel record : records) {
|
||||||
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
|
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
|
||||||
if("1".equals(record.getActiveTime())){
|
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && "1".equals(record.getActiveTime())){
|
||||||
record.setActiveStatus(record.getActiveTime().equals("1") ? "1" : "0");
|
record.setActivityProgress("1");
|
||||||
}
|
}
|
||||||
if (ObjectUtils.isNotEmpty(record.getStartTime()) && ObjectUtils.isNotEmpty(record.getEndTime())){
|
//活动进度状态
|
||||||
record.setActiveStatus(record.getStartTime().getTime() > new Date().getTime() ? "0" : "1");
|
if (ObjectUtils.isNotEmpty(record.getStartTime()) &&
|
||||||
record.setActiveStatus(record.getEndTime().getTime() > new Date().getTime() ? "1" : "2");
|
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.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||||
}
|
}
|
||||||
|
//活动时间
|
||||||
|
cardFuelDiesel.setStartTime(new Date());
|
||||||
|
cardFuelDiesel.setEndTime(new Date());
|
||||||
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||||
return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel));
|
return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel));
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,10 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
|
|||||||
//活动时间 1:不限时间 2:自定义时间
|
//活动时间 1:不限时间 2:自定义时间
|
||||||
private String activeTime;
|
private String activeTime;
|
||||||
//活动开始时间
|
//活动开始时间
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date startTime;
|
private Date startTime;
|
||||||
//活动结束时间
|
//活动结束时间
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
//活动进度
|
//活动进度
|
||||||
private String activityProgress;
|
private String activityProgress;
|
||||||
|
@ -74,6 +74,9 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Long> selectStatistics(Integer storeId) {
|
public Map<String, Long> selectStatistics(Integer storeId) {
|
||||||
|
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||||
|
storeId = TokenUtil.getNowAccountInfo().getStoreId();
|
||||||
|
}
|
||||||
HashMap<String, Long> map = new HashMap<>();
|
HashMap<String, Long> map = new HashMap<>();
|
||||||
if (ObjectUtils.isNotEmpty(storeId)) {
|
if (ObjectUtils.isNotEmpty(storeId)) {
|
||||||
//获取礼品卡数量
|
//获取礼品卡数量
|
||||||
|
@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardValue.controller;
|
|||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
|
||||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
|
||||||
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,7 +56,23 @@ public class CardValueController extends BaseController {
|
|||||||
queryWrapper.eq(CardValue::getIsonline,cardValue.getIsonline());
|
queryWrapper.eq(CardValue::getIsonline,cardValue.getIsonline());
|
||||||
}
|
}
|
||||||
queryWrapper.orderByDesc(CardValue::getCreateTime);
|
queryWrapper.orderByDesc(CardValue::getCreateTime);
|
||||||
return getSuccessResult(this.cardValueService.page(page, queryWrapper));
|
IPage page1 = this.cardValueService.page(page, queryWrapper);
|
||||||
|
List<CardValue> 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) {
|
public ResponseObject insert(@RequestBody CardValue cardValue) {
|
||||||
//获取当前店铺的id和连锁店id
|
//获取当前店铺的id和连锁店id
|
||||||
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
|
||||||
|
cardValue.setStartTime(new Date());
|
||||||
|
cardValue.setEndTime(new Date());
|
||||||
cardValue.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
cardValue.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||||
cardValue.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
cardValue.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,13 @@ public class CardValue extends Model<CardValue> {
|
|||||||
private Double percentageCommissions;
|
private Double percentageCommissions;
|
||||||
//活动时间 1:不限时间 2:自定义时间
|
//活动时间 1:不限时间 2:自定义时间
|
||||||
private String activeTime;
|
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;
|
private Date startTime;
|
||||||
//活动结束时间
|
//活动结束时间
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
//活动状态 1:启用 2:禁用
|
//活动状态 1:启用 2:禁用
|
||||||
private String activeStatus;
|
private String activeStatus;
|
||||||
@ -236,6 +238,14 @@ public class CardValue extends Model<CardValue> {
|
|||||||
this.activeTime = activeTime;
|
this.activeTime = activeTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getActivityProgress() {
|
||||||
|
return activityProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityProgress(String activityProgress) {
|
||||||
|
this.activityProgress = activityProgress;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getStartTime() {
|
public Date getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user