卡管理

This commit is contained in:
齐天大圣 2024-02-21 15:23:19 +08:00
parent 96eaddcd7c
commit 06d70a77f1
14 changed files with 148 additions and 28 deletions

View File

@ -22,7 +22,7 @@
<el-select v-model="queryParams.type" clearable placeholder="卡券类型">
<el-option label="油品券" value="0"></el-option>
<!-- <el-option label="商品券" value="1"></el-option>-->
<el-option label="通用券" value="2"></el-option>
<!-- <el-option label="通用券" value="2"></el-option>-->
</el-select>
</el-form-item>
<el-form-item>
@ -51,7 +51,7 @@
<template slot-scope="scope">
<el-tag v-if="scope.row.type == 0">油品券</el-tag>
<!-- <el-tag type="success" v-if="scope.row.type == 1">商品券</el-tag>-->
<el-tag type="warning" v-if="scope.row.type == 2">通用券</el-tag>
<!-- <el-tag type="warning" v-if="scope.row.type == 2">通用券</el-tag>-->
</template>
</el-table-column>
<el-table-column label="优惠类型" align="center" prop="discountType" >
@ -153,7 +153,7 @@
<el-radio-group v-model="form.type">
<el-radio label="0">油品券</el-radio>
<!-- <el-radio label="1">商品券</el-radio>-->
<el-radio label="2">通用券</el-radio>
<!-- <el-radio label="2">通用券</el-radio>-->
</el-radio-group>
</el-form-item>
<el-form-item label="优惠类型" prop="discountType">
@ -167,31 +167,61 @@
<el-checkbox v-for="(item,index) in oillist" :label=" item.id " :key="index">{{item.oilType}}{{item.oilName}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<div class="_k">
<el-form-item label="满足金额" prop="satisfiedAmount" v-if="form.discountType == 0">
<el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" >
<template slot="append"></template>
</el-input>
</el-form-item>
</div>
<div class="_k">
<el-form-item label="优惠金额" prop="discountAmount" v-if="form.discountType == 0">
<el-input v-model="form.discountAmount" placeholder="请输入优惠金额" >
<template slot="append"></template>
</el-input>
</el-form-item>
<div style="display: flex;align-items: center;margin-bottom: 25px" v-if="form.discountType == 0">
<div style="color: red">*</div>
<div style="margin: 0px 10px;font-weight: bold"></div>
<div>
<el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" >
<template slot="append"></template>
</el-input>
</div>
<div class="_k">
<el-form-item label="满足金额" prop="satisfiedAmount" v-if="form.discountType == 1">
<div style="margin: 0px 10px;font-weight: bold"></div>
<div>
<el-input v-model="form.discountAmount" placeholder="请输入优惠金额" >
<template slot="append"></template>
</el-input>
</div>
<!-- <div class="_k">-->
<!-- <el-form-item label="满" prop="satisfiedAmount" v-if="form.discountType == 0">-->
<!-- <el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" >-->
<!-- <template slot="append"></template>-->
<!-- </el-input>-->
<!-- </el-form-item>-->
<!-- </div>-->
<!-- <div class="_k" style="margin-left: 15px">-->
<!-- <el-form-item label="减" prop="discountAmount" v-if="form.discountType == 0">-->
<!-- <el-input v-model="form.discountAmount" placeholder="请输入优惠金额" >-->
<!-- <template slot="append"></template>-->
<!-- </el-input>-->
<!-- </el-form-item>-->
<!-- </div>-->
</div>
<div style="display: flex;align-items: center;margin-bottom: 25px" v-if="form.discountType == 1">
<div style="color: red">*</div>
<div style="margin: 0px 10px;font-weight: bold"></div>
<div>
<el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" >
<template slot="append"></template>
</el-input>
</el-form-item>
</div>
<div style="margin: 0px 10px;font-weight: bold"></div>
<div>
<el-input-number v-model="form.specialDiscount" :min="0" :max="9.9" placeholder="1 ~ 9.9"/>
</div>
<div style="margin: 0px 10px;font-weight: bold"></div>
</div>
<el-form-item label="优惠折扣" prop="specialDiscount" v-if="form.discountType == 1">
<el-input-number v-model="form.specialDiscount" :min="0" :max="9.9" placeholder="1 ~ 9.9"/>
</el-form-item>
<!-- <div class="_k">-->
<!-- <el-form-item label="满足金额" prop="satisfiedAmount" v-if="form.discountType == 1">-->
<!-- <el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" >-->
<!-- <template slot="append"></template>-->
<!-- </el-input>-->
<!-- </el-form-item>-->
<!-- </div>-->
<!-- <el-form-item label="优惠折扣" prop="specialDiscount" v-if="form.discountType == 1">-->
<!-- <el-input-number v-model="form.specialDiscount" :min="0" :max="9.9" placeholder="1 ~ 9.9"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="折扣抵消" prop="discountOffset" v-if="form.discountType == 1">
<el-input v-model="form.discountOffset" placeholder="请输入折扣抵消" />
</el-form-item>-->

View File

@ -782,8 +782,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
if (add23.compareTo(add21)>0 && add23.compareTo(add22)>0){
paymentActiveVO.setActiveFavorableAmount(bigDecimal);
}
if (paymentActiveVO.getActiveFavorableAmount().compareTo(add23)>0){
paymentActiveVO.setCardFavorableAmount(bigDecimal);
paymentActiveVO.setMemberFavorableAmount(bigDecimal);

View File

@ -2,10 +2,13 @@ package com.fuint.business.marketingActivity.cardFule.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
@ -84,10 +87,20 @@ public class CardFuelDieselController extends BaseController {
*/
@PostMapping
public ResponseObject insert(@RequestBody CardFuelDiesel cardFuelDiesel) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
//根据油品id和油站id查询
LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardFuelDiesel::getStoreId, nowAccountInfo.getStoreId());
queryWrapper.eq(CardFuelDiesel::getOilType,cardFuelDiesel.getOilType());
List<CardFuelDiesel> list = this.cardFuelDieselService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(list)){
return getFailureResult("该油品活动已存在!");
}
//获取当前店铺的id和连锁店id
if (ObjectUtils.isNotEmpty(TokenUtil.getNowAccountInfo().getStoreId())) {
cardFuelDiesel.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardFuelDiesel.setChainStorId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
if (ObjectUtils.isNotEmpty(nowAccountInfo.getStoreId())) {
cardFuelDiesel.setStoreId(nowAccountInfo.getStoreId());
cardFuelDiesel.setChainStorId(storeService.getById(nowAccountInfo.getStoreId()).getChainStoreId());
}
cardFuelDiesel.setStartTime(new Date());
cardFuelDiesel.setEndTime(new Date());

View File

@ -165,5 +165,14 @@ public class CardFuelRecordController extends BaseController {
return getSuccessResult(iPageList);
}
/**
* 统计接口
*/
@GetMapping("selectFuelRecordCount")
public ResponseObject selectFuelRecordCount(@Param("cardFuelRecord") CardFuelRecord cardFuelRecord) {
return getSuccessResult(this.cardFuelRecordService.selectFuelRecordCount(cardFuelRecord));
}
}

View File

@ -36,6 +36,8 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
private Double lockupPrice;
//充值金额
private Double rechargeBalance;
private Double gbPrice;
private Double oilPrice;
//所得升数
private Double incomeLitres;
//赠送积分
@ -62,5 +64,11 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date updateTime;
//规定开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date stipulateTimeS;
//规定结束时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date stipulateTimeE;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.vo.CardFuelRecordCount;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@ -104,6 +105,7 @@ public interface CardFuelRecordMapper {
*/
IPage<CardFuelRecord> queryByPageApplet(@Param("page") Page page, @Param("cardFuelRecord") CardFuelRecord cardFuelRecord);
List<CardFuelRecordCount> selectFuelRecordCount(CardFuelRecord cardFuelRecord);
}

View File

@ -401,6 +401,12 @@
order by create_time
</select>
<select id="selectFuelRecordCount"
resultType="com.fuint.business.marketingActivity.cardFule.vo.CardFuelRecordCount">
select type oilName,count(id) peoples, SUM(pay_amount) money,SUM(income_litres) litres
from card_fuel_record
where store_id = #{storeId}
GROUP BY oil_type
</select>
</mapper>

View File

@ -6,9 +6,12 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fuint.api.fuyou.entity.ReturnParameter;
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.vo.CardFuelRecordCount;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import io.lettuce.core.dynamic.annotation.Param;
import java.util.List;
/**
* 燃油充值表(CardFuelRecord)表服务接口
@ -100,4 +103,11 @@ public interface CardFuelRecordService {
IPage<CardFuelRecordDTO> test(Page page, String cardFuelRecord) throws JsonProcessingException;
void fuleRechargeFinallDeal(String orderNo) throws JsonProcessingException;
/**
* 统计接口
* @param cardFuelRecord
* @return
*/
List<CardFuelRecordCount> selectFuelRecordCount(CardFuelRecord cardFuelRecord);
}

View File

@ -8,7 +8,9 @@ import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelDieselMapper
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.entity.OilNumber;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.petrolStationManagement.service.OilNumberService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
@ -33,6 +35,8 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
CardFuelDieselMapper cardFuelDieselMapper;
@Autowired
private OilNameService oilNameService;
@Resource
private OilNumberService oilNumberService;
@Override
public List<CardFuelDiesel> countOilType() {
@ -65,6 +69,9 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
List<CardFuelDiesel> records = page1.getRecords();
//返回囤油卡状态
for (CardFuelDiesel record : records) {
OilNumber oilPrice = oilNumberService.getOilPrice(Integer.parseInt(record.getOilType()));
record.setGbPrice(oilPrice.getGbPrice());
record.setOilPrice(oilPrice.getOilPrice());
if (ObjectUtils.isNotEmpty(record.getOilType())){
record.setType(record.getType()+" "+oilNameService.selectOilNameById(Integer.parseInt(record.getOilType())).getOilName());
}

View File

@ -23,6 +23,7 @@ import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelRecordMapper
import com.fuint.business.marketingActivity.cardFule.service.CardFuelChangeService;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.business.marketingActivity.cardFule.vo.CardFuelRecordCount;
import com.fuint.business.marketingActivity.cardFuleOrders.entity.CardFuleOrders;
import com.fuint.business.marketingActivity.cardFuleOrders.service.CardFuleOrdersService;
import com.fuint.business.member.entity.LJStaff;
@ -646,4 +647,17 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
cardFuelRecord.setOilName(cardFuleOrders.getOilName());
cardFuelRecordMapper.insert(cardFuelRecord);
}
/**
* 统计接口
* @param cardFuelRecord
* @return
*/
@Override
public List<CardFuelRecordCount> selectFuelRecordCount(CardFuelRecord cardFuelRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelRecord.setStoreId(nowAccountInfo.getStoreId());
List<CardFuelRecordCount> cardFuelRecordCounts = cardFuelRecordMapper.selectFuelRecordCount(cardFuelRecord);
return cardFuelRecordCounts;
}
}

View File

@ -40,6 +40,9 @@
select card_amount cardAmount,count(id) count,SUM(card_amount) total
from card_gift
where store_id = #{storeId}
<if test="useStatus != null">
and use_status= #{useStatus}
</if>
group by card_amount
</select>
</mapper>

View File

@ -150,6 +150,14 @@ public class OilNumberController extends BaseController {
return getSuccessResult(oilPresetPricesService.selectOilNumberNameByStoreId(null));
}
/**
* 根据油号查询油价
* @return
*/
@GetMapping("/getOilPrice/{oilName}")
public ResponseObject getOilPrice(@PathVariable Integer oilName){
return getSuccessResult(oilPresetPricesService.getOilPrice(oilName));
}
}

View File

@ -71,5 +71,7 @@ public interface OilNumberService extends IService<OilNumber> {
* @return
*/
OilNumber selectOilNumberByOilName(String oilName,Integer storeId);
OilNumber getOilPrice(Integer oilName);
}

View File

@ -148,5 +148,15 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
return oilNumber;
}
@Override
public OilNumber getOilPrice(Integer oilName) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LambdaQueryWrapper<OilNumber> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OilNumber::getStoreId,nowAccountInfo.getStoreId());
queryWrapper.eq(OilNumber::getOilName,oilName);
OilNumber one = getOne(queryWrapper);
return one;
}
}