From 7e5de439d51ac44a72807a82ea0caa26e7440d99 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 13 八月 2024 11:14:00 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java | 54 ++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 38 insertions(+), 16 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java index 6bc6d16..a821517 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppCouponServiceImpl.java @@ -1,14 +1,21 @@ package com.ruoyi.account.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.account.api.dto.CouponListDto; import com.ruoyi.account.api.model.TAppCoupon; import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; +import com.ruoyi.account.api.vo.CouponListVOVO; import com.ruoyi.account.api.vo.ExchangeRecordVO; import com.ruoyi.account.mapper.TAppCouponMapper; import com.ruoyi.account.service.TAppCouponService; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.web.page.BasePage; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.order.api.feignClient.OrderClient; import com.ruoyi.other.api.domain.TCoupon; +import com.ruoyi.other.api.feignClient.OtherClient; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -27,36 +34,38 @@ @Service public class TAppCouponServiceImpl extends ServiceImpl<TAppCouponMapper, TAppCoupon> implements TAppCouponService { + @Autowired + private OrderClient orderClient; + @Autowired + private OtherClient otherClient; @Override public PageInfo<ExchangeRecordVO> pagelist(ExchangeRecordGoodsQuery dto) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); PageInfo<ExchangeRecordVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); List<ExchangeRecordVO> list = this.baseMapper.pageList(pageInfo,dto); - // 现金优惠券 + // 订单ids StringBuilder stringBuilder = new StringBuilder(); - // 积分优惠券 - StringBuilder stringBuilder1 = new StringBuilder(); - for (ExchangeRecordVO exchangeRecordVO : list) { switch (exchangeRecordVO.getWaysToObtain()){ case 1: - if (exchangeRecordVO.getSerialNumber()!=null){ - stringBuilder.append(exchangeRecordVO.getSerialNumber()).append(","); + if (exchangeRecordVO.getOrderId()!=null){ + stringBuilder.append(exchangeRecordVO.getOrderId()).append(","); }else{ stringBuilder.append("0").append(","); } break; case 2: - if (exchangeRecordVO.getSerialNumber()!=null){ - stringBuilder1.append(exchangeRecordVO.getSerialNumber()).append(","); + if (exchangeRecordVO.getOrderId()!=null){ + stringBuilder.append("-").append(exchangeRecordVO.getOrderId()).append(","); }else{ - stringBuilder1.append("0").append(","); + stringBuilder.append("-").append("0").append(","); } break; } - Date date = DateUtils.toDate(exchangeRecordVO.getEndTime()); + Date date1 = DateUtils.toDate(exchangeRecordVO.getCreateTime()); exchangeRecordVO.setEndTime1(format.format(date)); + exchangeRecordVO.setCreateTime1(format.format(date1)); if (exchangeRecordVO.getStatus()==1){ if (exchangeRecordVO.getDelFlag() == 1){ // 删除了 就是已取消状态 @@ -80,19 +89,32 @@ exchangeRecordVO.setStatus(2); } } - // 根据购买方式 查询对应订单号 } // 去除最后一个字符 if (StringUtils.hasText(stringBuilder.toString())){ String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); - // 远程调用 查询关联的现金优惠券订单编号 + // 远程调用 查询关联的订单编号 + List<String> data = orderClient.getCodeByOrderId(string).getData(); + for (int i = 0; i < list.size(); i++) { + list.get(i).setOrderId(data.get(i)); + } } - if (StringUtils.hasText(stringBuilder.toString())){ - String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); - // 远程调用 查询关联的积分兑换优惠券订单编号 - } + pageInfo.setRecords(list); return pageInfo; } + + @Override + public PageInfo<CouponListVOVO> couponList(CouponListDto dto) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + PageInfo<CouponListVOVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); + List<CouponListVOVO> list = this.baseMapper.couponList(pageInfo,dto.getUserId()); + for (CouponListVOVO couponListVOVO : list) { + couponListVOVO.setValidityTime("有效期:"+format.format(couponListVOVO.getCreateTime())+" - "+format.format(couponListVOVO.getEndTime())); + } + List<CouponListVOVO> data = otherClient.getCouponInfoByCouponIds(list).getData(); + pageInfo.setRecords(data); + return pageInfo; + } } -- Gitblit v1.7.1