| | |
| | | sqlMap.put("effectiveStatus",effectiveStatus); |
| | | sqlSentence.sqlSentence("SELECT * FROM user_card WHERE isDel = 0 AND sourceId = #{m.sourceId} AND status = #{m.status}" + |
| | | " AND effectiveStatus = #{m.effectiveStatus} AND turnAddId IS NULL",sqlMap); |
| | | return commonService.selectList(UserCardMapper.class,sqlSentence); |
| | | List<UserCard> userCardList = commonService.selectList(UserCardMapper.class,sqlSentence); |
| | | if(userCardList.size() == 0){ |
| | | return userCardList; |
| | | } |
| | | //获取已经部分退的用户卡包数量 |
| | | List<RefundRecordItem> refundRecordItemList = RefundTool.findRefundUserCard(sourceId,null,commonService); |
| | | //过滤掉没有使用但有部分退款 |
| | | if(refundRecordItemList.size() == 0){ |
| | | return userCardList; |
| | | } |
| | | |
| | | Map<String,UserCard> userCardMap = new HashMap<>(); |
| | | for(UserCard userCard:userCardList){ |
| | | userCardMap.put(userCard.getId(),userCard); |
| | | } |
| | | //去除掉参与部分退款的用户卡包 |
| | | for(RefundRecordItem refundRecordItem:refundRecordItemList){ |
| | | userCardMap.remove(refundRecordItem.getUserCardId()); |
| | | } |
| | | |
| | | userCardList = new ArrayList<>(); |
| | | for (Map.Entry<String,UserCard> entry : userCardMap.entrySet()) { |
| | | userCardList.add(entry.getValue()); |
| | | } |
| | | |
| | | return userCardList; |
| | | |
| | | } |
| | | |