更新9.18

This commit is contained in:
许允枞 2024-09-18 16:53:51 +08:00
parent 7ea6567863
commit fdfd89903a
12 changed files with 204 additions and 4 deletions

View File

@ -51,6 +51,9 @@ public class IntegralDetail extends BaseEntity implements Serializable {
*/ */
private Integer chainStoreId; private Integer chainStoreId;
private String startTime;
private String endTime;
} }

View File

@ -42,6 +42,9 @@
<if test="integralDetail.userId != null"> <if test="integralDetail.userId != null">
and id.user_id = #{integralDetail.userId} and id.user_id = #{integralDetail.userId}
</if> </if>
<if test="integralDetail.startTime != null and integralDetail.startTime != '' and integralDetail.endTime != null and integralDetail.endTime != ''">
and id.create_time between #{integralDetail.startTime} and #{integralDetail.endTime}
</if>
</where> </where>
order by create_time desc order by create_time desc

View File

@ -1,5 +1,8 @@
package com.fuint.business.integral.service.impl; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.integral.entity.IntegralDetail; import com.fuint.business.integral.entity.IntegralDetail;
@ -56,6 +59,11 @@ public class IntegralDetailServiceImpl implements IntegralDetailService {
public IPage<IntegralDetail> queryByPageUni(@Param("page") Page page, IntegralDetail integralDetail) { public IPage<IntegralDetail> queryByPageUni(@Param("page") Page page, IntegralDetail integralDetail) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
integralDetail.setUserId(nowAccountInfo.getId()); 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); return this.integralDetailMapper.queryAllByLimit(page, integralDetail);
} }

View File

@ -21,6 +21,8 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -42,6 +44,9 @@ import java.util.stream.Collectors;
@Service("cardFavorableService") @Service("cardFavorableService")
public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, CardFavorable> implements CardFavorableService { public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, CardFavorable> implements CardFavorableService {
private static final Logger log = LoggerFactory.getLogger(CardFavorableServiceImpl.class);
@Resource @Resource
private StoreService storeService; private StoreService storeService;
@Resource @Resource
@ -151,8 +156,10 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
carFavorbleIds.add(id); carFavorbleIds.add(id);
} }
} }
log.info("删除前的carFavorbleIds{}",carFavorbleIds);
//领取列表的券ids 减去 限领一张的 //领取列表的券ids 减去 限领一张的
carFavorbleIds.removeAll(carFavorbleRecordIds); carFavorbleIds.removeAll(carFavorbleRecordIds);
log.info("删除后的carFavorbleIds{}",carFavorbleIds);
for (Integer carFavorbleId : carFavorbleIds) { for (Integer carFavorbleId : carFavorbleIds) {
CardFavorable one = getById(carFavorbleId); CardFavorable one = getById(carFavorbleId);
cardFavorableArrayList.add(one); cardFavorableArrayList.add(one);
@ -164,8 +171,10 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
carFavorbleIds2.add(id); carFavorbleIds2.add(id);
} }
} }
log.info("删除前的carFavorbleIds2{}",carFavorbleIds2);
//领取列表的券ids 减去 当前查询的券ids //领取列表的券ids 减去 当前查询的券ids
carFavorbleIds2.removeAll(carFavorbleIds1); carFavorbleIds2.removeAll(carFavorbleIds1);
log.info("删除后的carFavorbleIds2{}",carFavorbleIds2);
for (Integer carFavorbleId : carFavorbleIds) { for (Integer carFavorbleId : carFavorbleIds) {
CardFavorable one = getById(carFavorbleId); CardFavorable one = getById(carFavorbleId);
cardFavorableArrayList.add(one); cardFavorableArrayList.add(one);

View File

@ -11,8 +11,8 @@
resultType="com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders"> resultType="com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders">
<include refid="selectOrders"></include> <include refid="selectOrders"></include>
<where> <where>
<if test="order.userId != null and order.userId != ''"> <if test="order.mtUserId != null and order.mtUserId != ''">
and user_id = #{order.userId} and mt_user_id = #{order.mtUserId}
</if> </if>
<if test="order.status != null and order.status != ''"> <if test="order.status != null and order.status != ''">
and status = #{order.status} and status = #{order.status}

View File

@ -106,5 +106,17 @@ public class CardValueRuleController extends BaseController {
public ResponseObject delete(@RequestParam("idList") List<Long> idList) { public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
return getSuccessResult(this.cardValueRuleService.removeByIds(idList)); return getSuccessResult(this.cardValueRuleService.removeByIds(idList));
} }
/**
* 获取储值卡权益说明与规则说明(小程序端)
* @return
*/
@GetMapping("/getQyAndGz")
public ResponseObject getQyDetails(Integer storeId){
LambdaQueryWrapper<CardValueRule> queryWrapper =new LambdaQueryWrapper<CardValueRule>();
queryWrapper.eq(CardValueRule::getStoreId, storeId);
queryWrapper.eq(CardValueRule::getType,"0");
return getSuccessResult(this.cardValueRuleService.getOne(queryWrapper));
}
} }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; 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.dto.AllOrderInfoDto;
import com.fuint.business.order.entity.AllOrderInfo; import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.CardBalanceChange; import com.fuint.business.order.entity.CardBalanceChange;
@ -89,4 +91,6 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
IPage<AllOrderInfoVo> runningWaterByInstituion2(Page page,@Param("order") AllOrderInfoDto allOrderInfo); IPage<AllOrderInfoVo> runningWaterByInstituion2(Page page,@Param("order") AllOrderInfoDto allOrderInfo);
IPage<CardValueOrdersVo> getBlanceANdOrder(Page page, @Param("order") CardValueOrdersDTO allOrderInfo);
} }

View File

@ -336,12 +336,21 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
@Override @Override
public UserBlanceUniVo getUserBalanceApplet(UserBalance userBalance) { public UserBlanceUniVo getUserBalanceApplet(UserBalance userBalance) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
log.info("查询会员信息:"+nowAccountInfo);
QueryWrapper queryWrapper = new QueryWrapper<>(); QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",nowAccountInfo.getId()); queryWrapper.eq("mt_user_id",nowAccountInfo.getId());
queryWrapper.eq("chain_store_id",userBalance.getChainStoreId()); queryWrapper.eq("chain_store_id",userBalance.getChainStoreId());
UserBalance balance = baseMapper.selectOne(queryWrapper); UserBalance balance = baseMapper.selectOne(queryWrapper);
UserBlanceUniVo userBlanceUniVo = BeanUtil.copyProperties(balance, UserBlanceUniVo.class); log.info("查询会员储值卡余额:"+balance);
UserBlanceUniVo userBlanceUniVo = new UserBlanceUniVo();
if (ObjectUtil.isNotEmpty(balance)) {
userBlanceUniVo = BeanUtil.copyProperties(balance,UserBlanceUniVo.class);
userBlanceUniVo.setAllBalance(balance.getCardBalance()+balance.getGiveAmount()); userBlanceUniVo.setAllBalance(balance.getCardBalance()+balance.getGiveAmount());
}else {
userBlanceUniVo.setAllBalance(0.0);
userBlanceUniVo.setCardBalance(0.0);
userBlanceUniVo.setGiveAmount(0.0);
}
return userBlanceUniVo; return userBlanceUniVo;
} }
/** /**

View File

@ -1,5 +1,23 @@
package com.fuint.module.clientApi.controller; 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.util.Constants;
import com.fuint.common.dto.*; import com.fuint.common.dto.*;
import com.fuint.common.enums.*; 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.MtSetting;
import com.fuint.repository.model.MtUser; import com.fuint.repository.model.MtUser;
import com.fuint.utils.StringUtil; 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 io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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 org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -26,6 +51,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 余额接口controller * 余额接口controller
@ -38,6 +64,9 @@ import java.util.Map;
@RequestMapping(value = "/clientApi/balance") @RequestMapping(value = "/clientApi/balance")
public class ClientBalanceController extends BaseController { public class ClientBalanceController extends BaseController {
private static final Logger log = LoggerFactory.getLogger(ClientBalanceController.class);
/** /**
* 配置服务接口 * 配置服务接口
* */ * */
@ -74,6 +103,15 @@ public class ClientBalanceController extends BaseController {
@Autowired @Autowired
private MerchantService merchantService; 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); return getSuccessResult(result);
} }
/**
* 余额明细(小程序)
* @param
* @param
* @return
*/
// @RequestMapping(value = "/detail", method = RequestMethod.GET)
// public ResponseObject getBalanceDetail(CardValueOrdersDTO order) {
// Page<Object> page = PageHelper.startPage(order.getPage(), order.getPageSize());
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// log.info("nowAccountInfo:{}", nowAccountInfo);
// order.setMtUserId(nowAccountInfo.getId());
// order.setStatus("paid");
// LambdaQueryWrapper<CardValueOrders> 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> cardValueOrders = cardValueOrdersMapper.selectList(lambdaQueryWrapper);
// PageRequest pageRequest = PageRequest.of(order.getPage(), order.getPageSize());
//
// //查询商户名称
// MtStore mtStore = mtStoreMapper.selectOne(new LambdaQueryWrapper<MtStore>()
// .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<Object> pageHelper = PageHelper.startPage(page, pageSize);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LambdaQueryWrapper<CardBalanceChange> 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<CardBalanceChange> cardBalanceChanges = cardBalanceChangeMapper.selectList(lambdaQueryWrapper);
//查询商户名称
MtStore mtStore = mtStoreMapper.selectOne(new LambdaQueryWrapper<MtStore>()
.eq(MtStore::getId, order.getStoreId()));
List<CardBalanceChangeVo> 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);
}
} }