From fdfd89903aa2b94263b7b36044c017b6aabfe95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Wed, 18 Sep 2024 16:53:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B09.18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integral/entity/IntegralDetail.java | 3 + .../mapper/xml/IntegralDetailMapper.xml | 3 + .../impl/IntegralDetailServiceImpl.java | 8 ++ .../impl/CardFavorableServiceImpl.java | 9 ++ .../mapper/xml/CardValueOrdersMapper.xml | 4 +- .../controller/CardValueRuleController.java | 12 ++ .../cardValueRule/dto/CardValueOrdersDTO.java | 14 +++ .../cardValueRule/vo/CardValueOrdersVo.java | 12 ++ .../order/dto/CardBalanceChangeDto.java | 9 ++ .../order/mapper/AllOrderInfoMapper.java | 4 + .../service/impl/UserBalanceServiceImpl.java | 13 +- .../controller/ClientBalanceController.java | 117 ++++++++++++++++++ 12 files changed, 204 insertions(+), 4 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dto/CardValueOrdersDTO.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/vo/CardValueOrdersVo.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/CardBalanceChangeDto.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java index 2488e4ae9..df1ee4bcc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java @@ -51,6 +51,9 @@ public class IntegralDetail extends BaseEntity implements Serializable { */ private Integer chainStoreId; + private String startTime; + private String endTime; + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml index a1dde2895..140981a58 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml @@ -42,6 +42,9 @@ and id.user_id = #{integralDetail.userId} + + and id.create_time between #{integralDetail.startTime} and #{integralDetail.endTime} + order by create_time desc diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java index 4b88daa49..b5ba22898 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java @@ -1,5 +1,8 @@ package com.fuint.business.integral.service.impl; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.integral.entity.IntegralDetail; @@ -56,6 +59,11 @@ public class IntegralDetailServiceImpl implements IntegralDetailService { public IPage queryByPageUni(@Param("page") Page page, IntegralDetail integralDetail) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); integralDetail.setUserId(nowAccountInfo.getId()); + if (ObjectUtil.isNotEmpty(integralDetail.getStartTime())) { + DateTime parse = DateUtil.parse(integralDetail.getStartTime(), "yyyy-MM"); + integralDetail.setStartTime(DateUtil.beginOfMonth(parse).toString()); + integralDetail.setEndTime(DateUtil.endOfMonth(parse).toString()); + } return this.integralDetailMapper.queryAllByLimit(page, integralDetail); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java index 381e34ecf..601a28491 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableServiceImpl.java @@ -21,6 +21,8 @@ import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -42,6 +44,9 @@ import java.util.stream.Collectors; @Service("cardFavorableService") public class CardFavorableServiceImpl extends ServiceImpl implements CardFavorableService { + private static final Logger log = LoggerFactory.getLogger(CardFavorableServiceImpl.class); + + @Resource private StoreService storeService; @Resource @@ -151,8 +156,10 @@ public class CardFavorableServiceImpl extends ServiceImpl - - and user_id = #{order.userId} + + and mt_user_id = #{order.mtUserId} and status = #{order.status} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java index f9aac5764..8adba5374 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java @@ -106,5 +106,17 @@ public class CardValueRuleController extends BaseController { public ResponseObject delete(@RequestParam("idList") List idList) { return getSuccessResult(this.cardValueRuleService.removeByIds(idList)); } + + /** + * 获取储值卡权益说明与规则说明(小程序端) + * @return + */ + @GetMapping("/getQyAndGz") + public ResponseObject getQyDetails(Integer storeId){ + LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper(); + queryWrapper.eq(CardValueRule::getStoreId, storeId); + queryWrapper.eq(CardValueRule::getType,"0"); + return getSuccessResult(this.cardValueRuleService.getOne(queryWrapper)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dto/CardValueOrdersDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dto/CardValueOrdersDTO.java new file mode 100644 index 000000000..cd0436ebc --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dto/CardValueOrdersDTO.java @@ -0,0 +1,14 @@ +package com.fuint.business.marketingActivity.cardValueRule.dto; + +import cn.hutool.core.date.DateTime; +import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; +import lombok.Data; + +import java.util.Date; + +@Data +public class CardValueOrdersDTO extends CardValueOrders { + private String startTime; + private int page; + private int pageSize; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/vo/CardValueOrdersVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/vo/CardValueOrdersVo.java new file mode 100644 index 000000000..8bbd210d6 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/vo/CardValueOrdersVo.java @@ -0,0 +1,12 @@ +package com.fuint.business.marketingActivity.cardValueRule.vo; + +import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; +import lombok.Data; + +@Data +public class CardValueOrdersVo { + private String orderNo; + private Integer userId; + private String afterBalance; + private String storeName; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/CardBalanceChangeDto.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/CardBalanceChangeDto.java new file mode 100644 index 000000000..75c6c8884 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/dto/CardBalanceChangeDto.java @@ -0,0 +1,9 @@ +package com.fuint.business.order.dto; + +import com.fuint.business.order.entity.CardBalanceChange; +import lombok.Data; + +@Data +public class CardBalanceChangeDto extends CardBalanceChange { + private String startTime; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java index 236a1a392..aed3a7749 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; +import com.fuint.business.marketingActivity.cardValueRule.dto.CardValueOrdersDTO; +import com.fuint.business.marketingActivity.cardValueRule.vo.CardValueOrdersVo; import com.fuint.business.order.dto.AllOrderInfoDto; import com.fuint.business.order.entity.AllOrderInfo; import com.fuint.business.order.entity.CardBalanceChange; @@ -89,4 +91,6 @@ public interface AllOrderInfoMapper extends BaseMapper { IPage runningWaterByInstituion2(Page page,@Param("order") AllOrderInfoDto allOrderInfo); + IPage getBlanceANdOrder(Page page, @Param("order") CardValueOrdersDTO allOrderInfo); + } \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java index e77b6aebf..ba72d817c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java @@ -336,12 +336,21 @@ public class UserBalanceServiceImpl extends ServiceImpl(); queryWrapper.eq("mt_user_id",nowAccountInfo.getId()); queryWrapper.eq("chain_store_id",userBalance.getChainStoreId()); UserBalance balance = baseMapper.selectOne(queryWrapper); - UserBlanceUniVo userBlanceUniVo = BeanUtil.copyProperties(balance, UserBlanceUniVo.class); - userBlanceUniVo.setAllBalance(balance.getCardBalance()+balance.getGiveAmount()); + log.info("查询会员储值卡余额:"+balance); + UserBlanceUniVo userBlanceUniVo = new UserBlanceUniVo(); + if (ObjectUtil.isNotEmpty(balance)) { + userBlanceUniVo = BeanUtil.copyProperties(balance,UserBlanceUniVo.class); + userBlanceUniVo.setAllBalance(balance.getCardBalance()+balance.getGiveAmount()); + }else { + userBlanceUniVo.setAllBalance(0.0); + userBlanceUniVo.setCardBalance(0.0); + userBlanceUniVo.setGiveAmount(0.0); + } return userBlanceUniVo; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientBalanceController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientBalanceController.java index a83c1658e..adf4af491 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientBalanceController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientBalanceController.java @@ -1,5 +1,23 @@ package com.fuint.module.clientApi.controller; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; +import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper; +import com.fuint.business.marketingActivity.cardValueRule.dto.CardValueOrdersDTO; +import com.fuint.business.order.dto.CardBalanceChangeDto; +import com.fuint.business.order.entity.CardBalanceChange; +import com.fuint.business.order.mapper.AllOrderInfoMapper; +import com.fuint.business.order.mapper.CardBalanceChangeMapper; +import com.fuint.business.order.vo.CardBalanceChangeVo; +import com.fuint.business.store.entity.MtStore; +import com.fuint.business.store.mapper.MtStoreMapper; import com.fuint.common.util.Constants; import com.fuint.common.dto.*; import com.fuint.common.enums.*; @@ -17,8 +35,15 @@ import com.fuint.repository.model.MtOrder; import com.fuint.repository.model.MtSetting; import com.fuint.repository.model.MtUser; import com.fuint.utils.StringUtil; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; @@ -26,6 +51,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 余额接口controller @@ -38,6 +64,9 @@ import java.util.Map; @RequestMapping(value = "/clientApi/balance") public class ClientBalanceController extends BaseController { + private static final Logger log = LoggerFactory.getLogger(ClientBalanceController.class); + + /** * 配置服务接口 * */ @@ -74,6 +103,15 @@ public class ClientBalanceController extends BaseController { @Autowired private MerchantService merchantService; + @Autowired + private CardValueOrdersMapper cardValueOrdersMapper; + + @Autowired + private MtStoreMapper mtStoreMapper; + + @Autowired + private CardBalanceChangeMapper cardBalanceChangeMapper; + /** * 充值配置 * @@ -261,4 +299,83 @@ public class ClientBalanceController extends BaseController { return getSuccessResult(result); } + + + /** + * 余额明细(小程序) + * @param + * @param + * @return + */ +// @RequestMapping(value = "/detail", method = RequestMethod.GET) +// public ResponseObject getBalanceDetail(CardValueOrdersDTO order) { +// Page page = PageHelper.startPage(order.getPage(), order.getPageSize()); +// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); +// log.info("nowAccountInfo:{}", nowAccountInfo); +// order.setMtUserId(nowAccountInfo.getId()); +// order.setStatus("paid"); +// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); +// if (ObjectUtil.isNotEmpty(order.getRechargeType())) { +// lambdaQueryWrapper.eq(CardValueOrders::getRechargeType, order.getRechargeType()); +// } +// if (ObjectUtil.isNotEmpty(order.getStartTime()) ) { +// DateTime parse = DateUtil.parse(order.getStartTime(), DatePattern.NORM_MONTH_FORMATTER); +// DateTime start = DateUtil.beginOfMonth(parse); +// DateTime end = DateUtil.endOfMonth(parse); +// lambdaQueryWrapper.between(CardValueOrders::getPayTime, start, end); +// } +// lambdaQueryWrapper.eq(CardValueOrders::getMtUserId,nowAccountInfo.getId()); +//// lambdaQueryWrapper.eq(CardValueOrders::getStatus, "paid"); +// List cardValueOrders = cardValueOrdersMapper.selectList(lambdaQueryWrapper); +// PageRequest pageRequest = PageRequest.of(order.getPage(), order.getPageSize()); +// +// //查询商户名称 +// MtStore mtStore = mtStoreMapper.selectOne(new LambdaQueryWrapper() +// .eq(MtStore::getId, order.getStoreId())); +// +// if (CollUtil.isNotEmpty(cardValueOrders) && ObjectUtil.isNotEmpty(mtStore)) { +// cardValueOrders.stream().forEach(item -> item.setStoreName(mtStore.getName())); +// } +// PageImpl pageImpl = new PageImpl(cardValueOrders, pageRequest, page.getTotal()); +// PaginationResponse paginationResponse = new PaginationResponse(pageImpl, CardValueOrders.class); +// paginationResponse.setTotalPages(page.getPages()); +// paginationResponse.setTotalElements(page.getTotal()); +// paginationResponse.setContent(cardValueOrders); +// +// return getSuccessResult(paginationResponse); +// } + @RequestMapping(value = "/detail", method = RequestMethod.GET) + public ResponseObject getBalanceDetail(Integer page, Integer pageSize, CardBalanceChangeDto order) { + Page pageHelper = PageHelper.startPage(page, pageSize); + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(CardBalanceChange::getUserId, nowAccountInfo.getId()); + if (ObjectUtil.isNotEmpty(order.getChangeType())) { + lambdaQueryWrapper.eq(CardBalanceChange::getChangeType, order.getChangeType()); + } + if (ObjectUtil.isNotEmpty(order.getStartTime())) { + DateTime parse = DateUtil.parse(order.getStartTime(), DatePattern.NORM_MONTH_FORMATTER); + DateTime dateTime = DateUtil.beginOfMonth(parse); + DateTime end = DateUtil.endOfMonth(parse); + lambdaQueryWrapper.between(CardBalanceChange::getCreateTime, dateTime, end); + } + lambdaQueryWrapper.eq(CardBalanceChange::getStoreId, order.getStoreId()); + + PageRequest pageRequest = PageRequest.of(page, pageSize); + + List cardBalanceChanges = cardBalanceChangeMapper.selectList(lambdaQueryWrapper); + //查询商户名称 + MtStore mtStore = mtStoreMapper.selectOne(new LambdaQueryWrapper() + .eq(MtStore::getId, order.getStoreId())); + List cardBalanceChangeVos = BeanUtil.copyToList(cardBalanceChanges, CardBalanceChangeVo.class); + if (ObjectUtil.isNotEmpty(mtStore)) { + cardBalanceChangeVos.stream().forEach(item -> item.setStoreName(mtStore.getName())); + } + PageImpl pageImpl = new PageImpl(cardBalanceChanges, pageRequest, pageHelper.getTotal()); + PaginationResponse paginationResponse = new PaginationResponse(pageImpl, CardBalanceChangeVo.class); + paginationResponse.setTotalPages(pageHelper.getPages()); + paginationResponse.setTotalElements(pageHelper.getTotal()); + paginationResponse.setContent(cardBalanceChangeVos); + return getSuccessResult(paginationResponse); + } }