Selaa lähdekoodia

月度网点采购报表调整

FengChaoYu 2 kuukautta sitten
vanhempi
commit
d3b53c89be

+ 10 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/report/ReportLogic.java

@@ -11,8 +11,10 @@ import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.AdminModule;
 import com.gree.mall.manager.plus.entity.AdminUserModuleRela;
+import com.gree.mall.manager.plus.entity.AdminWebsit;
 import com.gree.mall.manager.plus.service.AdminModuleService;
 import com.gree.mall.manager.plus.service.AdminUserModuleRelaService;
+import com.gree.mall.manager.plus.service.AdminWebsitService;
 import com.gree.mall.manager.utils.DateUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -34,6 +36,7 @@ public class ReportLogic {
     private final MaterialMapper materialMapper;
     private final AdminModuleService adminModuleService;
     private final AdminUserModuleRelaService adminUserModuleRelaService;
+    private final AdminWebsitService adminWebsitService;
 
 
     public List<MaterialSalesSumBean> workerBuySum(String startTime, String endTime, String month, String websitId,
@@ -432,9 +435,15 @@ public class ReportLogic {
         // 网点采购汇总数据注入上个月结存金额
         websiteStockValSumList.forEach(obj -> {
             PurchaseCategoryBean websitePurchaseSum = websitePurchaseSumMap.get(obj.getWebsitId());
-            if (Objects.nonNull(websitePurchaseSum)) {
+            if (Objects.isNull(websitePurchaseSum)) {
+                final AdminWebsit websit = adminWebsitService.getById(obj.getWebsitId());
+                websitePurchaseSum = new PurchaseCategoryBean();
+                websitePurchaseSum.setWebsitId(obj.getWebsitId());
+                websitePurchaseSum.setWebsitName(websit.getName());
                 websitePurchaseSum.setLastMonthVal(obj.getLastMonthVal());
+                websitePurchaseSumMap.put(obj.getWebsitId(), websitePurchaseSum);
             }
+            websitePurchaseSum.setLastMonthVal(obj.getLastMonthVal());
         });
 
         websitePurchaseSumList = new ArrayList<>(websitePurchaseSumMap.values());