From c18ec3846c8483975de2224c1ecac9470e9b2804 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 16 八月 2023 19:21:36 +0800
Subject: [PATCH] 同步代码

---
 management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java
index 61bea73..6c2735a 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java
@@ -185,12 +185,14 @@
             // 已发放优惠券
             tBranchOfficeResp.setTotalCount(totalCount);
 
-            BigDecimal orderPriceCount = new BigDecimal("0");
+            BigDecimal orderPriceCount = BigDecimal.ZERO;
             // 累计优惠券金额
             for (TUserToCoupon tUserToCoupon : tUserToCoupons) {
                 TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId());
-                BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal()));
-                orderPriceCount = orderPriceCount.add(price);
+                if(Objects.nonNull(tCoupon)){
+                    BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal()));
+                    orderPriceCount = orderPriceCount.add(price);
+                }
             }
             tBranchOfficeResp.setOrderPriceCount(orderPriceCount);
 
@@ -226,10 +228,11 @@
             }
             tBranchOffice.setDistrictName(area.getName());
             tBranchOffice.setDistrictCode(area.getCode());
-        }else {
+        }
+        /*else {
             tBranchOffice.setDistrictName(city.getName());
             tBranchOffice.setDistrictCode(city.getCode());
-        }
+        }*/
 
         // 通过省市查询代理商
         List<TAgent> tAgent = tAgentMapper.selectList(new EntityWrapper<TAgent>().eq("provinceCode", province.getCode())

--
Gitblit v1.7.1