From a639f4c71e751a67da5bbd960948b7f8a9055708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Mon, 15 Jan 2024 10:26:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActiveExchangeController.java | 14 +++++ .../service/ActiveExchangeService.java | 1 + .../impl/ActiveExchangeServiceImpl.java | 5 ++ .../CardBalanceChangeController.java | 61 +++++++++++++++++++ .../OilBalanceChangeController.java | 56 ++++++++++++++++- .../service/CardBalanceChangeService.java | 7 +++ .../impl/CardBalanceChangeServiceImpl.java | 19 ++++++ .../order/vo/StroeBalanceCountVO.java | 19 ++++++ .../business/order/vo/StroeOilCountVO.java | 17 ++++++ 9 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeBalanceCountVO.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeOilCountVO.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/controller/ActiveExchangeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/controller/ActiveExchangeController.java index 0457d9d4e..9ad995779 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/controller/ActiveExchangeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/controller/ActiveExchangeController.java @@ -102,4 +102,18 @@ public class ActiveExchangeController extends BaseController { return getSuccessResult(this.activeExchangeService.paymentActive(paymentActiveDTO)); } + + /** + * 查询当前店铺的交易记录 + * @param pageNo + * @param pageSize + * @param cardExchangeRecord + * @return + */ + /* @GetMapping + public ResponseObject selectAllOrders(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, + @Param("cardFuelDiesel") CardExchangeRecord cardExchangeRecord) { + return getSuccessResult(this.activeExchangeService.selectAllOrders(pageNo,pageSize, cardExchangeRecord)); + }*/ } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/ActiveExchangeService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/ActiveExchangeService.java index 0a7dbd129..637853d55 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/ActiveExchangeService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/ActiveExchangeService.java @@ -1,5 +1,6 @@ package com.fuint.business.marketingActivity.activeExchange.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.marketingActivity.activeExchange.dto.ActiveExchangeRecordDTO; import com.fuint.business.marketingActivity.activeExchange.dto.PaymentActiveDTO; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index 0475506d8..c5c1105d7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -1,6 +1,7 @@ package com.fuint.business.marketingActivity.activeExchange.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; @@ -36,6 +37,8 @@ import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableS import com.fuint.business.marketingActivity.cardValue.entity.CardValue; import com.fuint.business.marketingActivity.cardValue.service.CardValueService; import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO; +import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; +import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper; import com.fuint.business.order.mapper.OilOrderMapper; import com.fuint.business.petrolStationManagement.entity.OilName; import com.fuint.business.petrolStationManagement.service.OilNameService; @@ -98,6 +101,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { private ILJStoreService iljStoreService; @Autowired private LJUserService userService; + @Resource + private CardValueOrdersMapper cardValueOrdersMapper; /** * 分页查询所有 * @param diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java index 9fb810e0d..67eee562c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CardBalanceChangeController.java @@ -7,6 +7,7 @@ import com.fuint.business.order.entity.CashierOrder; import com.fuint.business.order.service.CardBalanceChangeService; import com.fuint.business.order.service.CashierOrderService; import com.fuint.business.order.vo.CardBalanceChangeVo; +import com.fuint.business.order.vo.StroeBalanceCountVO; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +16,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.math.BigDecimal; +import java.util.List; +import java.util.stream.Collectors; + @RestController @RequestMapping("/business/CardBalanceChange") public class CardBalanceChangeController extends BaseController { @@ -31,4 +36,60 @@ public class CardBalanceChangeController extends BaseController { IPage list = cardBalanceChangeService.getCardRecordList(page,cardBalanceChange); return getSuccessResult(list); } + + + /** + * 获取店铺余额变化明细 + * @param cardBalanceChange + * @param pageNo + * @param pageSize + * @return + */ + @GetMapping("getStoreOrdersList") + public ResponseObject getStoreOrdersList(CardBalanceChange cardBalanceChange, + @RequestParam(value = "page",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){ + Page page =new Page(pageNo,pageSize); + IPage list = cardBalanceChangeService.getStoreOrdersList(page,cardBalanceChange); + return getSuccessResult(list); + } + + + /** + * 获取店铺余额统计 + * @param cardBalanceChange + * @param pageNo + * @param pageSize + * @return + */ + @GetMapping("getBalanceStoreCount") + public ResponseObject getStoreCount(CardBalanceChange cardBalanceChange, + @RequestParam(value = "page",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){ + Page page =new Page(pageNo,pageSize); + StroeBalanceCountVO stroeBalanceCountVO = new StroeBalanceCountVO(); + IPage list = cardBalanceChangeService.getStoreOrdersList(page,cardBalanceChange); + List records = list.getRecords(); + //消费笔数 + List collectOut = records.stream().filter(s -> s.getChangeType().equals("0")).collect(Collectors.toList()); + stroeBalanceCountVO.setOutCount(collectOut.size()); + //充值笔数 + List collectIn = records.stream().filter(s -> s.getChangeType().equals("1")).collect(Collectors.toList()); + stroeBalanceCountVO.setOutCount(collectIn.size()); + //消费总额 + double totalConsumption = 0.0; + for (CardBalanceChange cardBalanceChange1 : collectOut) { + totalConsumption += cardBalanceChange1.getBalance(); + } + stroeBalanceCountVO.setTotalConsumption(totalConsumption); + //充值总额 + double totalRecharge = 0.0; + for (CardBalanceChange cardBalanceChange1 : collectIn) { + totalRecharge += cardBalanceChange1.getBalance(); + } + stroeBalanceCountVO.setTotalRecharge(totalRecharge); + //余额汇总 + stroeBalanceCountVO.setTotalBalance(totalRecharge -totalConsumption); + return getSuccessResult(stroeBalanceCountVO); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilBalanceChangeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilBalanceChangeController.java index 5c2a0f555..36d781cbb 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilBalanceChangeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/OilBalanceChangeController.java @@ -2,6 +2,7 @@ package com.fuint.business.order.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.api.ApiController; import com.baomidou.mybatisplus.extension.api.R; @@ -9,13 +10,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.order.entity.CardBalanceChange; import com.fuint.business.order.entity.OilBalanceChange; import com.fuint.business.order.service.OilBalanceChangeService; +import com.fuint.business.order.vo.StroeOilCountVO; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; import java.util.List; +import java.util.stream.Collectors; /** * 余油变化表(OilBalanceChange)表控制层 @@ -44,7 +50,14 @@ public class OilBalanceChangeController extends BaseController { @RequestParam(value = "page",defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){ Page page =new Page(pageNo,pageSize); - return getSuccessResult(this.oilBalanceChangeService.page(page, new QueryWrapper<>(oilBalanceChange))); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + queryWrapper.eq(OilBalanceChange::getStoreId,nowAccountInfo.getStoreId()); + if (ObjectUtils.isNotEmpty(oilBalanceChange.getOilType())){ + queryWrapper.eq(OilBalanceChange::getOilType,oilBalanceChange.getOilType()); + } + queryWrapper.orderByDesc(OilBalanceChange::getCreateTime); + return getSuccessResult(this.oilBalanceChangeService.page(page, queryWrapper)); } /** @@ -90,5 +103,46 @@ public class OilBalanceChangeController extends BaseController { public ResponseObject delete(@RequestParam("idList") List idList) { return getSuccessResult(this.oilBalanceChangeService.removeByIds(idList)); } + + /** + * 分页查询所有数据 + * @param oilBalanceChange + * @param pageNo + * @param pageSize + * @return + */ + @GetMapping("getOilStoreCount") + public ResponseObject getOilStoreCount(OilBalanceChange oilBalanceChange, + @RequestParam(value = "page",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){ + Page page =new Page(pageNo,pageSize); + StroeOilCountVO stroeOilCountVO = new StroeOilCountVO(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + queryWrapper.eq(OilBalanceChange::getStoreId,nowAccountInfo.getStoreId()); + if (ObjectUtils.isNotEmpty(oilBalanceChange.getOilType())){ + queryWrapper.eq(OilBalanceChange::getOilType,oilBalanceChange.getOilType()); + } + List list = this.oilBalanceChangeService.list(queryWrapper); + //充值笔数 + List collectIn = list.stream().filter(o -> o.getChangeType().equals("1")).collect(Collectors.toList()); + stroeOilCountVO.setInCount(collectIn.size()); + //消费笔数 + List collectOut = list.stream().filter(o -> o.getChangeType().equals("0")).collect(Collectors.toList()); + stroeOilCountVO.setOutCount(collectOut.size()); + //消费总额 + double totalConsumption = 0.0; + for (OilBalanceChange oilBalanceChange1 : collectOut) { + totalConsumption += oilBalanceChange1.getOilBalance(); + } + stroeOilCountVO.setTotalConsumption(totalConsumption); + //充值总额 + double totalRecharge = 0.0; + for (OilBalanceChange oilBalanceChange1 : collectIn) { + totalRecharge += oilBalanceChange1.getOilBalance(); + } + stroeOilCountVO.setTotalRecharge(totalConsumption); + return getSuccessResult(stroeOilCountVO); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CardBalanceChangeService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CardBalanceChangeService.java index 5e60fb89c..1a5f43b66 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CardBalanceChangeService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CardBalanceChangeService.java @@ -20,4 +20,11 @@ public interface CardBalanceChangeService extends IService { IPage getCardRecordList(Page page, CardBalanceChange cardBalanceChange); + /** + * 获取店铺余额变化明细 + * @param page + * @param cardBalanceChange + * @return + */ + IPage getStoreOrdersList(Page page, CardBalanceChange cardBalanceChange); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java index 593f285a2..37359f057 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CardBalanceChangeServiceImpl.java @@ -1,5 +1,6 @@ package com.fuint.business.order.service.impl; +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.service.impl.ServiceImpl; @@ -12,6 +13,8 @@ import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class CardBalanceChangeServiceImpl extends ServiceImpl implements CardBalanceChangeService { @Override @@ -37,4 +40,20 @@ public class CardBalanceChangeServiceImpl extends ServiceImpl cardBalanceChangeVoIPage = baseMapper.getCardRecordList(page, cardBalanceChange); return cardBalanceChangeVoIPage; } + + /** + * 获取店铺余额变化明细 + * @param page + * @param cardBalanceChange + * @return + */ + @Override + public IPage getStoreOrdersList(Page page, CardBalanceChange cardBalanceChange) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CardBalanceChange::getStoreId,nowAccountInfo.getStoreId()); + queryWrapper.orderByDesc(CardBalanceChange::getCreateTime); + IPage page1 = page(page, queryWrapper); + return page1; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeBalanceCountVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeBalanceCountVO.java new file mode 100644 index 000000000..f93adb18a --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeBalanceCountVO.java @@ -0,0 +1,19 @@ +package com.fuint.business.order.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StroeBalanceCountVO implements Serializable { + //充值笔数 + private Integer inCount; + //消费笔数 + private Integer outCount; + //充值总额 + private double totalRecharge; + //消费总额 + private double totalConsumption; + //余额汇总 + private double totalBalance; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeOilCountVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeOilCountVO.java new file mode 100644 index 000000000..3d5f746b0 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/StroeOilCountVO.java @@ -0,0 +1,17 @@ +package com.fuint.business.order.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StroeOilCountVO implements Serializable { + //充值笔数 + private Integer inCount; + //消费笔数 + private Integer outCount; + //充值总额 + private double totalRecharge; + //消费总额 + private double totalConsumption; +}