diff --git a/src/main/java/com/peanut/modules/common/service/impl/BuyOrderServiceImpl.java b/src/main/java/com/peanut/modules/common/service/impl/BuyOrderServiceImpl.java index 2b1befa..71c12cb 100644 --- a/src/main/java/com/peanut/modules/common/service/impl/BuyOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/common/service/impl/BuyOrderServiceImpl.java @@ -20,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.Instant; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Slf4j @@ -260,7 +257,24 @@ public class BuyOrderServiceImpl extends ServiceImpl impl @Override public List> exportPhysicalBuyOrderInfo(String date,String orderType) { - return this.baseMapper.exportPhysicalBuyOrderInfo(date, orderType); + List> list = this.baseMapper.exportPhysicalBuyOrderInfo(date, orderType); + List> newList = new ArrayList<>(); + for (Map map:list){ + + if(map.get("orderStatus").toString().equals("已退款")){ + Map newMap = new HashMap<>(map); + map.put("orderStatus","已付款"); + newList.add(map); + + newMap.put("orderPrice","-"+map.get("orderPrice").toString()); + newMap.put("price","-"+map.get("price").toString()); + newList.add(newMap); + }else{ + newList.add(map); + } + + } + return newList; } @Override diff --git a/src/main/resources/mapper/book/BuyOrderDao.xml b/src/main/resources/mapper/book/BuyOrderDao.xml index 77284c6..19bca0e 100644 --- a/src/main/resources/mapper/book/BuyOrderDao.xml +++ b/src/main/resources/mapper/book/BuyOrderDao.xml @@ -65,7 +65,8 @@ left join user u on u.id = bo.user_id left join buy_order_product bop on bop.order_id = bo.order_id left join shop_product sp on sp.product_id = bop.product_id - where u.id not in (select id from user where tester_flag = 1) + where + ( u.id not in (select id from user where tester_flag = 1) or (u.id in (select id from user where tester_flag = 1) and (bo.payment_method='1' or bo.payment_method='2') and bo.create_time>='2026-05-06 00:00:00') ) and bo.order_status in (1,2,3,4) and sp.goods_type != '05' and bo.real_money > 0 @@ -99,13 +100,14 @@ from ( select bo.order_id,DATE_FORMAT(bo.create_time,'%Y-%m-%d %H:%i:%s') createTime,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,bo.order_sn orderSn, IF(bo.payment_method=1,'微信',IF(bo.payment_method=2,'支付宝',IF(bo.payment_method=4,'天医币','0'))) payType, - IF(bo.order_status = 4,'已删除',IF(bo.order_status = 3,'已完成',IF(bo.order_status = 2,'已发货','已付款'))) orderStatus,bo.real_money orderPrice,if(bo.remark like '%退%',bo.remark,'') remark + IF(bo.order_status = 4,'已删除',IF(bo.order_status = 3,'已完成',IF(bo.order_status = 2,'已发货',IF(bo.order_status = 6,'已退款','已付款')))) orderStatus,bo.real_money orderPrice,if(bo.remark like '%退%',bo.remark,'') remark from buy_order bo left join user u on u.id = bo.user_id left join buy_order_product bop on bop.order_id = bo.order_id left join shop_product sp on sp.product_id = bop.product_id - where u.id not in (select id from user where tester_flag = 1) - and bo.order_status in (1,2,3,4) and sp.goods_type != '05' and bo.real_money > 0 + where + ( u.id not in (select id from user where tester_flag = 1) or (u.id in (select id from user where tester_flag = 1) and (bo.payment_method='1' or bo.payment_method='2') and bo.create_time>='2026-05-06 00:00:00') ) + and bo.order_status in (1,2,3,4,6) and sp.goods_type != '05' and bo.real_money > 0 and (bo.payment_method = '1' or (bo.payment_method = '2' and bo.order_id >37867))