package com.hx.phip.tool.refund; import com.hx.common.service.CommonService; import com.hx.exception.TipsException; import com.hx.mybatisTool.SqlSentence; import com.hx.phiappt.common.OrderItemConstants; import com.hx.phiappt.common.RefundStatus; import com.hx.phiappt.model.BaseEntity; import com.hx.phiappt.model.cardItem.CardEquity; import com.hx.phiappt.model.cardItem.CardItem; import com.hx.phiappt.model.cardItem.CardItemInfo; import com.hx.phiappt.model.order.OrderItem; import com.hx.phiappt.model.refund.RefundRecordConsumePay; import com.hx.phiappt.model.refund.RefundRecordItem; import com.hx.phiappt.model.refund.RefundRecordItemSource; import com.hx.phiappt.model.user.UserCard; import com.hx.phip.dao.mapper.*; import com.hx.phip.tool.user.UserCardTool; import com.hx.phip.vo.order.payment.PayMethodVo; import com.hx.phip.vo.order.refund.DistributionRedundVo; import com.hx.phip.vo.order.refund.RefundCardVo; import com.hx.phip.vo.user.UserCardItemInfoVo; import com.hx.util.StringUtils; import com.hz.his.vo.order.refund.RefundUserCardItemVo; import com.hz.his.vo.order.refund.RefundUserCardVo; import com.platform.exception.PlatTipsException; import com.platform.resultTool.PlatformCode; import org.springframework.beans.BeanUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.HashMap; import java.util.List; import java.util.Map; public class RefundTool { /**获取已退款方式金额,根据支付方式编号求和返回 * 注意:groupByONumberNo和groupByConsumePayId不能同时使用 * @param itemId 订单子单标识 * @param refundRecordItemId 退款子单标识 * @param groupByONumberNo 根据支付方式编号求和 * @param groupByConsumePayId 根据支付方式记录标识求和 * @param commonService 映射 * @return 返回已退款方式金额集合 */ public static List getRefundRecordConsumePay(String itemId, String refundRecordItemId, boolean groupByONumberNo , boolean groupByConsumePayId, CommonService commonService){ SqlSentence sqlSentence = new SqlSentence(); Map values = new HashMap<>(); StringBuilder sql = new StringBuilder(); sql.append("SELECT"); if(groupByONumberNo){ sql.append(" a.numberNo,"); } if(groupByConsumePayId){ sql.append(" a.consumePayId,"); } sql.append("SUM(a.refundTotal) AS refundTotal FROM refund_record_consume_pay a"); sql.append(" JOIN refund_record rr ON rr.id = a.refundRecordId AND rr.isDel = 0 AND rr.refundStatus = #{m.refundStatus}"); sql.append(" WHERE a.isDel = 0"); if(StringUtils.noNull(itemId)){ sql.append(" AND a.commonId = #{m.commonId}"); } if(StringUtils.noNull(refundRecordItemId)){ sql.append(" AND a.refundRecordItemId = #{m.refundRecordItemId}"); } if(groupByONumberNo){ sql.append(" GROUP BY a.numberNo"); } if(groupByConsumePayId){ sql.append(" GROUP BY a.consumePayId"); } //获取已退款的支付方式 values.put("commonId",itemId); values.put("refundStatus", RefundStatus.STATUS_SUCC_REFUND); sqlSentence.sqlSentence(sql.toString(),values); return commonService.selectList(RefundRecordConsumePayMapper.class,sqlSentence); } /**获取一级退款子单已退金额 * 主要查询,单个数量分配的退款金额,因为目前是按照数量来分配金额退款的 * @param orderItemId 一级退款子单关联标识 * @param goodsType 商品类型 * @param commonService 映射 * @return 已退金额 */ public static RefundRecordItem getOneAlreadyRefundTotal(String orderItemId,String goodsType, CommonService commonService ){ //查找正常退款的 SqlSentence sqlSentence = new SqlSentence(); Map values = new HashMap<>(); StringBuilder sql = new StringBuilder(); //获取已退款的金额,剔除掉用户卡项的部分退 values.put("orderItemId",orderItemId); sql.append("SELECT ROUND(SUM(rri.occupyRefundTotal),2) AS occupyRefundTotal,ROUND(SUM(rri.occupyRefundIntegral),2) AS occupyRefundIntegral"); sql.append(" FROM refund_record_item rri"); sql.append(" JOIN refund_record rr ON rr.id = rri.refundRecordId AND rr.isDel = 0 AND rr.refundStatus IN(0,2)"); sql.append(" WHERE rri.isDel = 0 AND rri.orderItemId = #{m.orderItemId} AND rri.userCardId IS NULL"); sqlSentence.sqlSentence(sql.toString(),values); RefundRecordItem refundRecordItem = commonService.selectOne(RefundRecordItemMapper.class,sqlSentence); if(refundRecordItem == null){ //设置没有找到 refundRecordItem.setIsDel(BaseEntity.YES); refundRecordItem = new RefundRecordItem(); } //用户卡包退款,系统退款总金额,按照退款数量来算的,用户卡包部分退,要特殊查找 if(OrderItemConstants.TYPE_CARD.equals(goodsType)){ //查找有没有这个卡包部分退款的记录 List refundRecordItemList = findRefundUserCard(orderItemId,null,commonService); if(refundRecordItemList.size() > 0){ refundRecordItem.setIsDel(BaseEntity.NO); } for(RefundRecordItem refundRecordItem1:refundRecordItemList){ refundRecordItem.setOccupyRefundTotal(refundRecordItem.getOccupyRefundTotal().add(refundRecordItem1.getOccupyRefundTotal())); refundRecordItem.setOccupyRefundIntegral(refundRecordItem.getOccupyRefundIntegral().add(refundRecordItem1.getOccupyRefundIntegral())); } } return refundRecordItem; } /**获取二级退款子单已退金额 * @param orderItemSonId 二级退款子单关联标识/关联卡项条目的id * @param commonService 映射 * @return 已退金额 */ public static RefundRecordItemSource getTwoAlreadyRefundTotal(String orderItemSonId, CommonService commonService ){ SqlSentence sqlSentence = new SqlSentence(); Map values = new HashMap<>(); StringBuilder sql = new StringBuilder(); values.put("orderItemSonId",orderItemSonId); sql.append("SELECT ROUND(SUM(rris.occupyRefundTotal),2) AS occupyRefundTotal,ROUND(SUM(rris.occupyRefundIntegral),2) AS occupyRefundIntegral"); sql.append(" FROM refund_record_item_source rris"); sql.append(" JOIN refund_record rr ON rr.id = rris.refundRecordId AND rr.isDel = 0 AND rr.refundStatus IN(0,2)"); sql.append(" WHERE rris.isDel = 0 AND rris.orderItemSonId = #{m.orderItemSonId}"); //获取已退款的金额 sqlSentence.sqlSentence(sql.toString(),values); RefundRecordItemSource refundRecordItemSource = commonService.selectOne(RefundRecordItemSourceMapper.class,sqlSentence); if(refundRecordItemSource == null){ //设置是没有找到 refundRecordItemSource.setIsDel(BaseEntity.YES); return new RefundRecordItemSource(); }else{ return refundRecordItemSource; } } /**计算用户卡包条目退款金额*/ public static void userCardRefundCount(UserCard userCard,RefundUserCardVo refundUserCardVo, CommonService commonService, RefundMapper refundMapper){ ////算出金额: //1、算出该卡可退总金额 //2、算出卡项条目总金额,就是占订单支付金额的钱 //3、算出单条目的权益占用金额 //4、获取该条目已退款金额 //5、算出“单次抵扣金额”,再乘以数量得出“抵扣总金额” //6、用“抵扣总金额”算出占用整个卡项总金额的“比例” //7、比较金额,得出可退金额,注意最后一次要全部退掉 //获取卡项 CardItem cardItem = commonService.selectOneByKey(CardItemMapper.class,userCard.getCardItemId()); if(cardItem == null){ throw new TipsException("获取卡项信息失败[210]!"); } //获取子单 OrderItem orderItem = commonService.selectOneByKey(OrderItemMapper.class,userCard.getSourceId()); if(orderItem == null){ throw new TipsException("获取订单子单失败[210]!"); } //公用对象 RefundRecordItemSource itemSource; //用户卡项分配可退总金额 RefundCardVo refundCard = new RefundCardVo(); CardItemInfo cardItemInfo; CardEquity cardEquity; //条目金额计算 BigDecimal sumCardBagMoney; //条目积分计算 BigDecimal sumCardBagIntegral; //获取卡项的权益数量 int cardEquityNum = UserCardTool.getCardEquityCount(userCard.getCardItemId(),commonService); //存储权益分配的退款金额 Map cardEquityMap = new HashMap<>(); //比例 RefundCardVo refundCardEquity; RefundCardVo refundCardInfo; BigDecimal proportion; for(RefundUserCardItemVo refundUserCardItemVo:refundUserCardVo.getRefundUserCardItemVoList()){ if(StringUtils.isEmpty(refundUserCardItemVo.getCardItemInfoId())){ throw new TipsException("卡项条目标识必传[210]!"); } if(refundUserCardItemVo.getRefundQuantity() == null || refundUserCardItemVo.getRefundQuantity() < 1){ throw new TipsException("卡项条目退款次数必填[210]!"); } cardItemInfo = commonService.selectOneByKey(CardItemInfoMapper.class,refundUserCardItemVo.getCardItemInfoId()); if(cardItemInfo == null){ throw new TipsException("获取卡项条目信息失败[210]!"); } cardEquity = commonService.selectOneByKey(CardEquityMapper.class,cardItemInfo.getCardEquityId()); if(cardEquity == null){ throw new TipsException("获取卡项权益信息失败[210]!"); } //-----校验 //获取可用剩余使用次数 UserCardItemInfoVo uerCardItemInfoVo = UserCardTool.getSurplusNumber(userCard,cardItemInfo,cardEquity,commonService); //获取当前需要抵扣的次数 Integer usedNum = UserCardTool.countUsedNumber(refundUserCardItemVo.getRefundQuantity(),cardItemInfo,cardEquity); if(!uerCardItemInfoVo.isNumByNum()){ throw new PlatTipsException(PlatformCode.ERROR_TIPS,"卡项退款提示:不符合N选M规则,请重试"); } if(uerCardItemInfoVo.getSurplusNum() <= 0 ||usedNum > uerCardItemInfoVo.getSurplusNum()){ throw new PlatTipsException(PlatformCode.ERROR_TIPS,"卡项退款提示:卡项的【"+cardItemInfo.getCommonName()+"】次数不够"); } refundCardInfo = new RefundCardVo(); //-----算出权益分配到金额 //查看权益是否已经分配好了的 refundCardEquity = getCardEquityData(orderItem,userCard,cardItem,cardEquity,refundCard,cardEquityNum,cardEquityMap,commonService,refundMapper); //判断是不是最后一个条目 if(CardEquity.EQUITY_TYPE_TIME_CARD.equals(cardEquity.getEquityType())){ //次卡,权益有总次数,所有条目使用的总次数不能大于权益的总次数 //判断数量 if(uerCardItemInfoVo.getSurplusNum() < refundUserCardItemVo.getRefundQuantity()){ //最后的次数 refundCardInfo.setOccupyRefundTotal(refundCardEquity.getSurplusTotal()); refundCardInfo.setOccupyRefundIntegral(refundCardEquity.getSurplusIntegral()); }else{ } refundCardInfo.setSurplusTotal(refundCardEquity.getSurplusTotal()); refundCardInfo.setSurplusIntegral(refundCardEquity.getSurplusIntegral()); }else if(CardEquity.EQUITY_TYPE_N_M.equals(cardEquity.getEquityType())){ //判断条目数量,再判断数量 }else{ //固定或者其他 userCardItemInfoVo.setSurplusNum(cardItemInfo.getMaxNum() - cardItemInfoUseMap.computeIfAbsent(cardItemInfo.getId(),k->0)); } //-----算出单次划扣金额 //获取单次价格金额 sumCardBagMoney = UserCardTool.countOneMoney(cardItemInfo); //计算抵扣总的分摊明细 sumCardBagMoney = sumCardBagMoney.multiply(BigDecimal.valueOf(refundUserCardItemVo.getRefundQuantity()).setScale(2,RoundingMode.DOWN)); //算比例 if(cardItem.getTotal() != null && cardItem.getTotal().compareTo(BigDecimal.ZERO) > 0){ proportion = sumCardBagMoney.divide(cardItem.getTotal(),20,RoundingMode.HALF_UP); }else{ proportion = BigDecimal.ZERO; } //算出占用购买卡项订单时候金额(分摊模式) sumCardBagMoney = occupyRefundTotal.multiply(proportion); sumCardBagIntegral = occupyRefundIntegral.multiply(proportion); //获取卡项条目已退款金额 refundRecordItemSource = getTwoAlreadyRefundTotal(cardItemInfo.getId(),null,null,commonService); // //不能超过卡项条目的分摊总金额 } } /**查找部分退款的用户卡包信息,根据用户卡包标识去重了 * @param orderItemId 子单标识 * @param userCardId 用户卡包标识 * @param commonService 映射 */ public static List findRefundUserCard(String orderItemId,String userCardId,CommonService commonService){ SqlSentence sqlSentence = new SqlSentence(); Map values = new HashMap<>(); StringBuilder sql = new StringBuilder(); //--------获取用户卡包的总金额 //查找有没有这个卡包部分退款的记录 sql.append("SELECT rri.occupyRefundTotal,rri.occupyRefundIntegral,rri.userCardId FROM refund_record_item rri"); sql.append(" JOIN refund_record rr ON rr.id = rri.refundRecordId"); sql.append(" JOIN user_card uc ON uc.id = rri.userCardId"); sql.append(" AND rr.isDel = 0 AND rr.refundStatus IN(0,2)"); sql.append(" WHERE rri.isDel = 0"); if(StringUtils.noNull(orderItemId)){ values.put("orderItemId",orderItemId); sql.append(" AND rri.orderItemId = #{m.orderItemId}"); } if(StringUtils.noNull(userCardId)){ values.put("userCardId",userCardId); sql.append(" AND rri.userCardId = #{m.userCardId}"); }else{ sql.append(" AND rri.userCardId IS NOT NULL"); } sql.append(" GROUP BY rri.userCardId"); sqlSentence.sqlSentence(sql.toString(),values); return commonService.selectList(UserCardMapper.class,sqlSentence); } /**获取卡包已分配的金额(权益分配的金额) * @param userCardId 用户卡项标识,主要获取用户卡项分配的金额 * @param commonService 映射 * @return 已退金额 */ public static RefundRecordItemSource getCardRealRefund(String userCardId, CommonService commonService ){ SqlSentence sqlSentence = new SqlSentence(); Map values = new HashMap<>(); StringBuilder sql = new StringBuilder(); values.put("userCardId",userCardId); sql.append("SELECT rris.occupyEqRefundTotal,rris.occupyEqRefundIntegral"); sql.append(" FROM refund_record_item_source rris"); sql.append(" JOIN refund_record rr ON rr.id = rris.refundRecordId AND rr.isDel = 0 AND rr.refundStatus IN(0,2)"); sql.append(" WHERE rris.isDel = 0 AND rris.userCardId = #{m.userCardId} GROUP BY rris.cardEquityId"); List refundRecordItemSourceList = commonService.selectList(RefundRecordItemSourceMapper.class,sqlSentence); RefundRecordItemSource source = new RefundRecordItemSource(); if(refundRecordItemSourceList.size()==0){ source.setIsDel(BaseEntity.YES); return source; } for(RefundRecordItemSource refundRecordItemSource:refundRecordItemSourceList){ //计算有多少个权益参与了退款 refundRecordItemSource.setRealRefundNum(refundRecordItemSource.getRealRefundNum()+1); source.setOccupyRefundTotal(source.getOccupyRefundTotal().add(refundRecordItemSource.getOccupyEqRefundTotal())); source.setOccupyRefundIntegral(source.getOccupyRefundIntegral().add(refundRecordItemSource.getOccupyEqRefundIntegral())); } return source; } /**获取卡包权益已退款金额(条目分配的金额) * @param cardEquityId 卡项权益标识,主要获取卡项权益分配的金额 * @param commonService 映射 * @return 已退金额 */ public static RefundRecordItemSource getCardEquityRealRefund(String cardEquityId, CommonService commonService ){ SqlSentence sqlSentence = new SqlSentence(); Map values = new HashMap<>(); StringBuilder sql = new StringBuilder(); values.put("cardEquityId",cardEquityId); sql.append("SELECT rris.occupyItemRefundTotal,rris.occupyItemRefundIntegral,rris.occupyEqRefundTotal,rris.occupyEqRefundIntegral"); sql.append(" FROM refund_record_item_source rris"); sql.append(" JOIN refund_record rr ON rr.id = rris.refundRecordId AND rr.isDel = 0 AND rr.refundStatus IN(0,2)"); sql.append(" WHERE rris.isDel = 0 AND rris.cardEquityId = #{m.cardEquityId} GROUP BY orderItemSonId"); List refundRecordItemSourceList = commonService.selectList(RefundRecordItemSourceMapper.class,sqlSentence); RefundRecordItemSource source = new RefundRecordItemSource(); if(refundRecordItemSourceList.size()==0){ source.setIsDel(BaseEntity.YES); return source; } for(RefundRecordItemSource refundRecordItemSource:refundRecordItemSourceList){ //计算有多少个条目参与了退款 source.setRealRefundNum(refundRecordItemSource.getRealRefundNum()+1); source.setRefundMoney(source.getRefundMoney().add(refundRecordItemSource.getOccupyItemRefundTotal())); source.setRefundIntegral(source.getRefundIntegral().add(refundRecordItemSource.getOccupyItemRefundIntegral())); source.setOccupyEqRefundTotal(refundRecordItemSource.getOccupyEqRefundTotal()); source.setOccupyEqRefundIntegral(refundRecordItemSource.getOccupyEqRefundIntegral()); } return source; } /**获取卡包条目已退款金额(条目分配的金额) * @param cardInfoId 卡项条目标识,主要获取卡项条目分配的金额 * @param commonService 映射 * @return 已退金额 */ public static RefundCardVo getCardInfoData(String cardInfoId,CommonService commonService){ SqlSentence sqlSentence = new SqlSentence(); Map values = new HashMap<>(); StringBuilder sql = new StringBuilder(); values.put("orderItemSonId",cardInfoId); sql.append("SELECT SUM(rris.occupyRefundTotal) AS occupyRefundTotal,SUM(rris.occupyRefundIntegral) AS occupyRefundIntegral"); sql.append(",SUM(rris.realRefundNum) AS realRefundNum,rris.occupyItemRefundTotal,rris.occupyItemRefundIntegral"); sql.append(" FROM refund_record_item_source rris"); sql.append(" JOIN refund_record rr ON rr.id = rris.refundRecordId AND rr.isDel = 0 AND rr.refundStatus IN(0,2)"); sql.append(" WHERE rris.isDel = 0 AND rris.orderItemSonId = #{m.orderItemSonId} GROUP BY orderItemSonId"); RefundRecordItemSource itemSource = commonService.selectOne(RefundRecordItemSourceMapper.class,sqlSentence); RefundCardVo refundCardInfo = new RefundCardVo(); if(itemSource != null){ refundCardInfo.setJoinRefund(true); refundCardInfo.setRefundNum(itemSource.getRealRefundNum()); refundCardInfo.setOccupyRefundTotal(itemSource.getOccupyItemRefundTotal()); refundCardInfo.setOccupyRefundIntegral(itemSource.getOccupyItemRefundIntegral()); refundCardInfo.setSurplusTotal(itemSource.getOccupyItemRefundTotal().subtract(itemSource.getOccupyRefundTotal())); refundCardInfo.setSurplusIntegral(itemSource.getOccupyItemRefundIntegral().subtract(itemSource.getOccupyRefundIntegral())); } return refundCardInfo; } /**获取用户卡项的参数,分配金额和剩余可退金额*/ public static RefundCardVo getUserCardData(OrderItem orderItem,UserCard userCard,CommonService commonService,RefundMapper refundMapper){ RefundCardVo refundCard = new RefundCardVo(); //--------获取用户卡包分配的的可退款总金额(包含已经部分退的金额在里面) //查找有没有这个卡包部分退款的记录 List refundRecordItemList = findRefundUserCard(orderItem.getId(),userCard.getId(),commonService); if(refundRecordItemList.size() == 0){ //用户卡包没有分配总金额,那么就按照正常的流程获取可退款金额 DistributionRedundVo distributionRedundVo = UserCardTool.userCardPay(userCard,orderItem,commonService,refundMapper); refundCard.setOccupyRefundTotal(distributionRedundVo.getRefundTotal()); refundCard.setOccupyRefundIntegral(distributionRedundVo.getRefundIntegral()); }else{ refundCard.setJoinRefund(true); RefundRecordItem refundRecordItem = refundRecordItemList.get(0); refundCard.setOccupyRefundTotal(refundRecordItem.getOccupyRefundTotal()); refundCard.setOccupyRefundIntegral(refundRecordItem.getOccupyRefundIntegral()); } //-----计算剩余可分配给权益退款的金额 //查找该卡包已部分退款的金额 RefundRecordItemSource itemSource = getCardRealRefund(userCard.getId(),commonService); //计算该用户卡包剩余可退金额和积分,就是可分配给权益退款的金额 refundCard.setSurplusTotal(refundCard.getOccupyRefundTotal().subtract(itemSource.getOccupyRefundTotal())); refundCard.setSurplusIntegral(refundCard.getOccupyRefundIntegral().subtract(itemSource.getOccupyRefundIntegral())); refundCard.setRefundNum(itemSource.getRealRefundNum()); return refundCard; } /**获取用户卡项权益的参数,分配金额和剩余可退金额*/ public static RefundCardVo getCardEquityData(OrderItem orderItem,UserCard userCard,CardItem cardItem,CardEquity cardEquity,RefundCardVo refundCard,int cardEquityNum ,Map cardEquityMap,CommonService commonService,RefundMapper refundMapper){ //-----算出权益分配到金额 //查看权益是否已经分配好了的 BigDecimal proportion; RefundCardVo refundCardEquity = cardEquityMap.get(cardEquity.getId()); if(refundCardEquity == null){ refundCardEquity = new RefundCardVo(); //获取卡项权益已退款金额和分配的金额 RefundRecordItemSource cardEquityRealRefund = getCardEquityRealRefund(cardEquity.getId(),commonService); if(cardEquityRealRefund.getIsDel().equals(BaseEntity.YES)){ //没有找到已经分配好的,进行新的分配 //获取用户卡包分配金额 if(!refundCard.isJoinRefund()){ BeanUtils.copyProperties(getUserCardData(orderItem,userCard,commonService,refundMapper),refundCard); refundCard.setJoinRefund(true); } if(cardEquityNum>=refundCard.getRefundNum()+1){ //是最后一个 refundCardEquity.setOccupyRefundTotal(refundCard.getSurplusTotal()); refundCardEquity.setOccupyRefundIntegral(refundCard.getSurplusIntegral()); }else{ //不是最后一个,通过比例来算金额 if(cardItem.getTotal().compareTo(BigDecimal.ZERO) > 0){ proportion = cardEquity.getShareMoney().divide(cardItem.getTotal(),20,RoundingMode.HALF_UP); }else{ proportion = BigDecimal.ZERO; } refundCardEquity.setOccupyRefundTotal(refundCard.getOccupyRefundTotal().multiply(proportion).setScale(2,RoundingMode.HALF_UP)); refundCardEquity.setOccupyRefundIntegral(refundCard.getOccupyRefundIntegral().multiply(proportion).setScale(2,RoundingMode.HALF_UP)); //判断不能大于权益设置的金额 if(refundCardEquity.getOccupyRefundTotal().compareTo(cardEquity.getShareMoney()) > 0){ refundCardEquity.setOccupyRefundTotal(cardEquity.getShareMoney()); } //判断不能大于剩下的可退金额 if(refundCardEquity.getOccupyRefundTotal().compareTo(refundCard.getSurplusTotal()) > 0){ refundCardEquity.setOccupyRefundTotal(refundCard.getSurplusTotal()); } //判断不能大于剩下的可退积分 if(refundCardEquity.getOccupyRefundIntegral().compareTo(refundCard.getSurplusIntegral()) > 0){ refundCardEquity.setOccupyRefundIntegral(refundCard.getSurplusIntegral()); } } refundCardEquity.setSurplusTotal(refundCardEquity.getOccupyRefundTotal()); refundCardEquity.setSurplusIntegral(refundCardEquity.getOccupyRefundIntegral()); }else{ refundCardEquity.setJoinRefund(true); refundCardEquity.setRefundNum(cardEquityRealRefund.getRealRefundNum()); refundCardEquity.setOccupyRefundTotal(cardEquityRealRefund.getOccupyEqRefundTotal()); refundCardEquity.setOccupyRefundIntegral(cardEquityRealRefund.getOccupyEqRefundIntegral()); refundCardEquity.setSurplusTotal(cardEquityRealRefund.getOccupyEqRefundTotal().subtract(cardEquityRealRefund.getRefundMoney())); refundCardEquity.setSurplusIntegral(cardEquityRealRefund.getOccupyEqRefundIntegral().subtract(cardEquityRealRefund.getRefundIntegral())); } cardEquityMap.put(cardEquity.getId(),refundCardEquity); } return refundCardEquity; } }