囤油余额

This commit is contained in:
齐天大圣 2024-01-15 14:02:48 +08:00
parent 70e988e9a8
commit 078a770a83
4 changed files with 32 additions and 13 deletions

View File

@ -62,11 +62,12 @@
card_favorables.id,
card_favorables.couponAmount,
card_favorables.couponContent,
card_favorables.cardRecordId
card_favorables.cardRecordId,
card_favorables.endTime
from
(SELECT
'优惠券' AS couponType,
cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.satisfied_amount couponContent,cfr.id cardRecordId
cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.satisfied_amount couponContent,cfr.id cardRecordId, cfr.end_time endTime
FROM
card_favorable cf
LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id
@ -76,7 +77,7 @@
and cfr.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT
'兑换券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime
FROM
card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
@ -87,7 +88,7 @@
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT
'洗车券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime
FROM
card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
@ -98,7 +99,7 @@
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT
'洗车卡' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime
FROM
card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id

View File

@ -12,6 +12,7 @@ import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRe
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
@ -40,6 +41,8 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
private LJUserService userService;
@Resource
private CardFavorableService cardFavorableService;
@Resource
private OilNameService oilNameService;
/**
* 分页查询所有数据
* @param page
@ -80,7 +83,18 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
@Override
public IPage<CardFavorableRecordVO> getCardFavorableList(Page page, CardFavorableRecord cardFavorableRecord) {
return cardFavorableRecordMapper.getCardFavorableList(page,cardFavorableRecord);
IPage<CardFavorableRecordVO> cardFavorableList = cardFavorableRecordMapper.getCardFavorableList(page, cardFavorableRecord);
List<CardFavorableRecordVO> records = cardFavorableList.getRecords();
for (CardFavorableRecordVO record : records) {
String oilName = "";
String[] split = record.getOilType().split(",");
for (String s : split) {
oilName += oilNameService.selectOilNameById(Integer.parseInt(s)).getOilName();
}
record.setOilName(oilName);
}
cardFavorableList.setRecords(records);
return cardFavorableList;
}
/**

View File

@ -1,8 +1,10 @@
package com.fuint.business.marketingActivity.cardFavorable.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class CouponVO implements Serializable {
@ -23,7 +25,9 @@ public class CouponVO implements Serializable {
//券有效期
private String couponTime;
//券开始时间
private String startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
//券结束时间
private String endTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
}

View File

@ -577,10 +577,10 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
if (oilTypeList.contains(cardFuleOrders.getOilType())) {
for (JSONObject jsonObject : jsonObjectList) {
if (cardFuleOrders.getOilType().equals(jsonObject.getString("oilType"))) {
double incomeLitres = jsonObject.getDouble("incomeLitres");
double incomeLitres = jsonObject.getDouble("refuelMoney");
BigDecimal add = BigDecimal.valueOf(cardFuleOrders.getIncomeLitres()).add(BigDecimal.valueOf(incomeLitres));
incomeLitres = add.doubleValue();
jsonObject.put("incomeLitres", incomeLitres);
jsonObject.put("refuelMoney", incomeLitres);
String userBnlancce = jsonObjectList.toString();
userBalance.setRefuelMoney(userBnlancce);
break;
@ -590,7 +590,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("type", cardFuleOrders.getType());
jsonObject1.put("oilType", cardFuleOrders.getOilType());
jsonObject1.put("incomeLitres", cardFuleOrders.getIncomeLitres());
jsonObject1.put("refuelMoney", cardFuleOrders.getIncomeLitres());
jsonObject1.put("oilName", cardFuleOrders.getOilName());
jsonObjectList.add(jsonObject1);
String userBnlancce = jsonObjectList.toString();
@ -601,7 +601,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
JSONObject jsonObject = new JSONObject();
jsonObject.put("type", cardFuleOrders.getType());
jsonObject.put("oilType", cardFuleOrders.getOilType());
jsonObject.put("incomeLitres", cardFuleOrders.getIncomeLitres());
jsonObject.put("refuelMoney", cardFuleOrders.getIncomeLitres());
jsonObject.put("oilName", cardFuleOrders.getOilName());
jsonObjects.add(jsonObject);
userBalance.setRefuelMoney(jsonObjects.toString());
@ -613,7 +613,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
JSONObject jsonObject = new JSONObject();
jsonObject.put("type",cardFuleOrders.getType());
jsonObject.put("oilType",cardFuleOrders.getOilType());
jsonObject.put("incomeLitres",cardFuleOrders.getIncomeLitres());
jsonObject.put("refuelMoney",cardFuleOrders.getIncomeLitres());
jsonObject.put("oilName",cardFuleOrders.getOilName());
jsonObjects.add(jsonObject);
userBalance1.setRefuelMoney(jsonObjects.toString());