From 1ffb6c7910cfb4d55b4c169142b67ea872fcf614 Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期二, 27 六月 2023 19:55:50 +0800
Subject: [PATCH] BUG联调

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java |  135 +++++++++++++++++++++++++++++++-------------
 1 files changed, 94 insertions(+), 41 deletions(-)

diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
index 99fc8de..6a6339d 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -10,11 +10,13 @@
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.CodeFactoryUtil;
 import com.ruoyi.shop.domain.dto.*;
+import com.ruoyi.shop.domain.pojo.ShopTotal;
 import com.ruoyi.shop.domain.pojo.shop.*;
 import com.ruoyi.shop.domain.pojo.task.ShopFile;
 import com.ruoyi.shop.domain.vo.*;
 import com.ruoyi.shop.mapper.shop.ShopMapper;
 import com.ruoyi.shop.service.shop.*;
+import com.ruoyi.shop.service.task.MemberTaskService;
 import com.ruoyi.shop.service.task.ShopFileService;
 import com.ruoyi.system.api.constant.AppErrorConstant;
 import com.ruoyi.system.api.domain.dto.*;
@@ -90,6 +92,12 @@
     @Resource
     private RemoteConfigService remoteConfigService;
 
+    @Resource
+    private ShopTotalService shopTotalService;
+
+    @Resource
+    private MemberTaskService memberTaskService;
+
     /**
      * 获取商户详情
      * @param shopId
@@ -133,6 +141,7 @@
     public void createShop(MgtEditShopDto mgtEditShopDto){
         Shop shop = new Shop();
         Boolean newShop = false;
+        BigDecimal zeroBig = BigDecimal.ZERO;
         Shop shopSame = this.getOne(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag,0).eq(Shop::getShopName,mgtEditShopDto.getShopName()));
         if(mgtEditShopDto.getShopId()!=null){
             if(shopSame!=null&&!Objects.equals(shopSame.getShopId(),mgtEditShopDto.getShopId())){
@@ -262,6 +271,41 @@
             shopProportion.setUpdateTime(new Date());
             shopProportion.setUpdateUserId(mgtEditShopDto.getUserId());
             shopProportionService.save(shopProportion);
+            //商户统计
+            ShopTotal shopTotal = new ShopTotal();
+            shopTotal.setShopId(shop.getShopId());
+            shopTotal.setDelFlag(0);
+            shopTotal.setLastPayMoney(zeroBig);
+            shopTotal.setTotalActivityCount(0);
+            shopTotal.setTotalOrder(0);
+            shopTotal.setTotalCycleOrder(0);
+            shopTotal.setToltaExperienceOrder(0);
+            shopTotal.setTotalServiceOrder(0);
+            shopTotal.setTotalGoodsOrder(0);
+            shopTotal.setTotalServiceCount(0);
+            shopTotal.setUsedServiceCount(0);
+            shopTotal.setUseableServiceCount(0);
+            shopTotal.setTotalCycleService(0);
+            shopTotal.setUsedCycleService(0);
+            shopTotal.setUseableCycleService(0);
+            shopTotal.setTotalCyclePerson(0);
+            shopTotal.setUseableCyclePerson(0);
+            shopTotal.setTotalServiceService(0);
+            shopTotal.setUsedServiceService(0);
+            shopTotal.setUseableServiceService(0);
+            shopTotal.setTotalServicePerson(0);
+            shopTotal.setUseableServicePerson(0);
+            shopTotal.setTotalExperienceService(0);
+            shopTotal.setUsedExperienceService(0);
+            shopTotal.setUseableExperienceService(0);
+            shopTotal.setTotalExperiencePerson(0);
+            shopTotal.setUseableExperiencePerson(0);
+            shopTotal.setTotalOrderMoney(zeroBig);
+            shopTotal.setTotalCycleMoney(zeroBig);
+            shopTotal.setTotalExperienceMoney(zeroBig);
+            shopTotal.setTotalServiceMoney(zeroBig);
+            shopTotal.setTotalGoodsMoney(zeroBig);
+            shopTotalService.save(shopTotal);
         }
     }
 
@@ -542,7 +586,16 @@
         Shop shop = this.getById(shopId);
         merHomeShopTotalVo.setShopType(shop.getShopType());
         MerHomeShopTotalVo orderVo = remoteOrderService.getMerHomeTotal(merHomeShopTotalVo).getData();
-
+        ShopTotal shopTotal = shopTotalService.getById(shopId);
+        merHomeShopTotalVo.setShopId(shopId);
+        merHomeShopTotalVo.setShopType(shop.getShopType());
+        merHomeShopTotalVo.setTodayShop(orderVo.getTodayShop());
+        merHomeShopTotalVo.setUnHandleOrder(orderVo.getUnHandleOrder());
+        Integer taskCount = memberTaskService.getMemberIngTotal(shopId);
+        merHomeShopTotalVo.setTask(taskCount);
+        merHomeShopTotalVo.setShopTurnover(orderVo.getShopTurnover());
+        merHomeShopTotalVo.setCycleSurp(shopTotal.getUseableCyclePerson());
+        merHomeShopTotalVo.setExplorationSurp(shopTotal.getUseableExperiencePerson());
         return merHomeShopTotalVo;
     }
 
@@ -743,45 +796,20 @@
         //获取商户类型
         List<MgtMapTotalVo> shopTypeTotal = shopMapper.listShopTypeTotal(mgtBasePlatformDto);
         if (shopTypeTotal != null && shopTypeTotal.size() > 0) {
-            String[] shopTypeKey = new String[shopTypeTotal.size()];
-            Integer[] shopTypeValue = new Integer[shopTypeTotal.size()];
-            // 遍历不同商品类型的会员数列表,设置商品类型数组和对应的会员数数组
-            for (int i = 0; i < shopTypeTotal.size(); i++) {
-                if (shopTypeTotal.get(i).getMapKey().equals("1")) {
-                    shopTypeKey[i] = "经销商";
-                } else if (shopTypeTotal.get(i).getMapKey().equals("2")) {
-                    shopTypeKey[i] = "代理商";
-                }
-                shopTypeValue[i] = shopTypeTotal.get(i).getMapValue();
-            }
-            plTotalShopTotalVo.setShopTypeKey(shopTypeKey);
-            plTotalShopTotalVo.setShopTypeValue(shopTypeValue);
+            shopTypeTotal = listRemoveNull(shopTypeTotal);
+            plTotalShopTotalVo.setShopTypeVos(shopTypeTotal);
         }
         //获取商户状态
         List<MgtMapTotalVo> shopStatusTotal = shopMapper.listShopStatusTotal(mgtBasePlatformDto);
         if (shopStatusTotal != null && shopStatusTotal.size() > 0) {
-            String[] shopStatusKey = new String[shopStatusTotal.size()];
-            Integer[] shopStatusValue = new Integer[shopStatusTotal.size()];
-            // 遍历不同商品类型的会员数列表,设置商品类型数组和对应的会员数数组
-            for (int i = 0; i < shopStatusTotal.size(); i++) {
-                shopStatusKey[i] = shopStatusTotal.get(i).getMapKey();
-                shopStatusValue[i] = shopStatusTotal.get(i).getMapValue();
-            }
-            plTotalShopTotalVo.setShopStatusKey(shopStatusKey);
-            plTotalShopTotalVo.setShopStatusValue(shopStatusValue);
+            shopStatusTotal = listRemoveNull(shopStatusTotal);
+            plTotalShopTotalVo.setShopStatusVos(shopStatusTotal);
         }
         //获取区域排名
         List<MgtMapTotalVo> shopAreaRank = shopMapper.listShopAreaRank(mgtBasePlatformDto);
         if (shopAreaRank != null && shopAreaRank.size() > 0) {
-            String[] shopRankKey = new String[shopAreaRank.size()];
-            Integer[] shopRankValue = new Integer[shopAreaRank.size()];
-            // 遍历不同商品类型的会员数列表,设置商品类型数组和对应的会员数数组
-            for (int i = 0; i < shopAreaRank.size(); i++) {
-                shopRankKey[i] = shopAreaRank.get(i).getMapKey();
-                shopRankValue[i] = shopAreaRank.get(i).getMapValue();
-            }
-            plTotalShopTotalVo.setAreaRankKey(shopRankKey);
-            plTotalShopTotalVo.setAreaRankValue(shopRankValue);
+            shopAreaRank = listRemoveNull(shopAreaRank);
+            plTotalShopTotalVo.setAreaRankVos(shopAreaRank);
         }
         //获取销售排名
         List<MgtMapTotalVo> shopSalesRank = shopMapper.listShopSalesRank(mgtBasePlatformDto);
@@ -799,17 +827,26 @@
         //获取推荐
         List<MgtMapTotalVo> shopRecommendRank = shopMapper.listShopRecommendRank(mgtBasePlatformDto);
         if (shopRecommendRank != null && shopRecommendRank.size() > 0) {
-            String[] shopRecommendKey = new String[shopRecommendRank.size()];
-            Integer[] shopRecommendValue = new Integer[shopRecommendRank.size()];
-            // 遍历不同商品类型的会员数列表,设置商品类型数组和对应的会员数数组
-            for (int i = 0; i < shopRecommendRank.size(); i++) {
-                shopRecommendKey[i] = shopRecommendRank.get(i).getMapKey();
-                shopRecommendValue[i] = shopRecommendRank.get(i).getMapValue();
-            }
-            plTotalShopTotalVo.setShopRecommendKey(shopRecommendKey);
-            plTotalShopTotalVo.setShopRecommendValue(shopRecommendValue);
+            shopRecommendRank = listRemoveNull(shopRecommendRank);
+            plTotalShopTotalVo.setShopRecommendVos(shopRecommendRank);
         }
         return plTotalShopTotalVo;
+    }
+
+    /**
+     * @description  去除空字符串
+     * @author  jqs
+     * @date    2023/6/27 17:35
+     * @param mgtMapTotalVos
+     * @return  List<MgtMapTotalVo>
+     */
+    private List<MgtMapTotalVo> listRemoveNull(List<MgtMapTotalVo> mgtMapTotalVos){
+        for (int i = 0; i < mgtMapTotalVos.size(); i++) {
+            if(StringUtils.isBlank(mgtMapTotalVos.get(i).getMapKey())){
+                mgtMapTotalVos.remove(i);
+            }
+        }
+        return mgtMapTotalVos;
     }
 
     /**
@@ -840,4 +877,20 @@
         BeanUtils.copyProperties(shopAuthentication, shopAuthGetVo);
         return shopAuthGetVo;
     }
+
+    /**
+     * @description  获取商户验证信息
+     * @author  jqs
+     * @date    2023/6/26 10:38
+     * @param authId
+     * @return  MgtShopAuthCodeVo
+     */
+    @Override
+    public MgtShopAuthCodeVo getMgtShopAuthCode(String authId){
+        MgtShopAuthCodeVo mgtShopAuthCodeVo = new MgtShopAuthCodeVo();
+        ShopAuthentication shopAuthentication = shopAuthenticationService.getById(authId);
+        mgtShopAuthCodeVo.setSignUrl(shopAuthentication.getSignUrl());
+        mgtShopAuthCodeVo.setLegalValidationUrl(shopAuthentication.getLegalValidationUrl());
+        return mgtShopAuthCodeVo;
+    }
 }

--
Gitblit v1.7.1