礼品卡储值卡排序

This commit is contained in:
齐天大圣 2023-11-01 15:33:00 +08:00
parent cd9f03a59c
commit 7f168fe62d
5 changed files with 61 additions and 4 deletions

View File

@ -2,12 +2,17 @@ package com.fuint.business.marketingActivity.cardFule.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel; import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService; import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController; 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.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -29,6 +34,8 @@ public class CardFuelDieselController extends BaseController {
*/ */
@Resource @Resource
private CardFuelDieselService cardFuelDieselService; private CardFuelDieselService cardFuelDieselService;
@Resource
private StoreService storeService;
/** /**
* 分页查询所有数据 * 分页查询所有数据
@ -42,7 +49,9 @@ public class CardFuelDieselController extends BaseController {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardFuelDiesel cardFuelDiesel) { @Param("cardFuelDiesel") CardFuelDiesel cardFuelDiesel) {
Page page = new Page(pageNo, pageSize); Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFuelDieselService.page(page, new QueryWrapper<>(cardFuelDiesel))); LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(CardFuelDiesel::getCreateTime);
return getSuccessResult(this.cardFuelDieselService.page(page, queryWrapper));
} }
/** /**
@ -64,6 +73,11 @@ public class CardFuelDieselController extends BaseController {
*/ */
@PostMapping @PostMapping
public ResponseObject insert(@RequestBody CardFuelDiesel cardFuelDiesel) { public ResponseObject insert(@RequestBody CardFuelDiesel cardFuelDiesel) {
//获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
}
return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel)); return getSuccessResult(this.cardFuelDieselService.save(cardFuelDiesel));
} }

View File

@ -3,12 +3,17 @@ package com.fuint.business.marketingActivity.cardFule.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelGasoline; import com.fuint.business.marketingActivity.cardFule.entity.CardFuelGasoline;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelGasolineService; import com.fuint.business.marketingActivity.cardFule.service.CardFuelGasolineService;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController; 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.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -30,6 +35,8 @@ public class CardFuelGasolineController extends BaseController {
*/ */
@Resource @Resource
private CardFuelGasolineService cardFuelGasolineService; private CardFuelGasolineService cardFuelGasolineService;
@Resource
private StoreService storeService;
/** /**
* 分页查询所有数据 * 分页查询所有数据
@ -43,7 +50,9 @@ public class CardFuelGasolineController extends BaseController {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelGasoline") CardFuelGasoline cardFuelGasoline) { @Param("cardFuelGasoline") CardFuelGasoline cardFuelGasoline) {
Page page = new Page(pageNo, pageSize); Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFuelGasolineService.page(page, new QueryWrapper<>(cardFuelGasoline))); LambdaQueryWrapper<CardFuelGasoline> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(CardFuelGasoline::getCreateTime);
return getSuccessResult(this.cardFuelGasolineService.page(page, queryWrapper));
} }
/** /**
@ -65,6 +74,11 @@ public class CardFuelGasolineController extends BaseController {
*/ */
@PostMapping @PostMapping
public ResponseObject insert(@RequestBody CardFuelGasoline cardFuelGasoline) { public ResponseObject insert(@RequestBody CardFuelGasoline cardFuelGasoline) {
//获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
cardFuelGasoline.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardFuelGasoline.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
}
return getSuccessResult(this.cardFuelGasolineService.save(cardFuelGasoline)); return getSuccessResult(this.cardFuelGasolineService.save(cardFuelGasoline));
} }

View File

@ -2,10 +2,12 @@ package com.fuint.business.marketingActivity.cardGift.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardGift.entity.CardGift; import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
import com.fuint.business.marketingActivity.cardGift.service.CardGiftService; import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -42,7 +44,9 @@ public class CardGiftController extends BaseController {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardGift") CardGift cardGift) { @Param("cardGift") CardGift cardGift) {
Page page = new Page(pageNo, pageSize); Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardGiftService.page(page, new QueryWrapper<>(cardGift))); LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(CardGift::getCreateTime);
return getSuccessResult(this.cardGiftService.page(page, queryWrapper));
} }
/** /**

View File

@ -7,6 +7,8 @@ import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
import com.fuint.business.marketingActivity.cardGift.service.CardGiftService; import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
import com.fuint.business.oilDepotConfiguration.entity.OilDepotConfig; import com.fuint.business.oilDepotConfiguration.entity.OilDepotConfig;
import com.fuint.business.oilDepotConfiguration.service.OilDepotConfigService; import com.fuint.business.oilDepotConfiguration.service.OilDepotConfigService;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,6 +34,9 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
@Resource @Resource
private OilDepotConfigService oilDepotConfigService; private OilDepotConfigService oilDepotConfigService;
@Resource
private StoreService storeService;
/** /**
* 新增数据 * 新增数据
* *
@ -41,6 +46,11 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
@Override @Override
public boolean insert(CardGift cardGift) { public boolean insert(CardGift cardGift) {
boolean save = false; boolean save = false;
//获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
cardGift.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardGift.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
}
//设置批次号 //设置批次号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
cardGift.setBatchNumber(dateFormat.format(new Date()) + String.format("%05d", new Random().nextInt(100000))); cardGift.setBatchNumber(dateFormat.format(new Date()) + String.format("%05d", new Random().nextInt(100000)));

View File

@ -2,12 +2,17 @@ package com.fuint.business.marketingActivity.cardValue.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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;
import com.fuint.business.store.entity.MtStore;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController; 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.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -30,6 +35,9 @@ public class CardValueController extends BaseController {
@Resource @Resource
private CardValueService cardValueService; private CardValueService cardValueService;
@Resource
private StoreService storeService;
/** /**
* 分页查询所有数据 * 分页查询所有数据
* @param pageNo * @param pageNo
@ -42,7 +50,9 @@ public class CardValueController extends BaseController {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardValue") CardValue cardValue) { @Param("cardValue") CardValue cardValue) {
Page page = new Page(pageNo, pageSize); Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardValueService.page(page, new QueryWrapper<>(cardValue))); LambdaQueryWrapper<CardValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(CardValue::getCreateTime);
return getSuccessResult(this.cardValueService.page(page, queryWrapper));
} }
/** /**
@ -75,6 +85,11 @@ public class CardValueController extends BaseController {
*/ */
@PostMapping @PostMapping
public ResponseObject insert(@RequestBody CardValue cardValue) { public ResponseObject insert(@RequestBody CardValue cardValue) {
//获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
cardValue.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardValue.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
}
return getSuccessResult(this.cardValueService.save(cardValue)); return getSuccessResult(this.cardValueService.save(cardValue));
} }