jiangqs
2023-07-07 5627daeb1ac1a29947e902f9a7efb6730ed98611
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -277,71 +277,85 @@
            }
        }
        if(newShop){
            //商户账户信息初始化
            ShopAccount shopAccount = new ShopAccount();
            shopAccount.setShopId(shop.getShopId());
            shopAccount.setDelFlag(0);
            shopAccount.setTotalIncome(new BigDecimal("0"));
            shopAccount.setTotalDisburse(new BigDecimal("0"));
            shopAccount.setTotalRefund(new BigDecimal("0"));
            shopAccount.setTotalProfitsharing(new BigDecimal("0"));
            shopAccount.setTotalMoney(new BigDecimal("0"));
            shopAccountService.save(shopAccount);
            //商户认证信息初始化
            String authId = IdUtils.simpleUUID();
            ShopAuthentication shopAuthentication = new ShopAuthentication();
            shopAuthentication.setAuthId(authId);
            shopAuthentication.setDelFlag(0);
            shopAuthentication.setShopId(shop.getShopId());
            shopAuthenticationService.save(shopAuthentication);
            //商户分成信息初始化
            ShopProportion shopProportion = new ShopProportion();
            shopProportion.setDelFlag(0);
            shopProportion.setShopId(shop.getShopId());
            shopProportion.setShopType(shop.getShopType());
            shopProportion.setProportionPercent(new BigDecimal("100.00"));
            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.setTotalExperienceOrder(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);
            //生成商户关联记录
            initNewShop(shop,mgtEditShopDto.getUserId());
        }
    }
    /**
     * @description  商户关联类初始化
     * @author  jqs
     * @date    2023/7/7 11:25
     * @param shop
     * @param userId
     * @return  void
     */
    private void initNewShop(Shop shop,Long userId){
        BigDecimal zeroBig = new BigDecimal("0.00");
        //商户账户信息初始化
        ShopAccount shopAccount = new ShopAccount();
        shopAccount.setShopId(shop.getShopId());
        shopAccount.setDelFlag(0);
        shopAccount.setTotalIncome(new BigDecimal("0"));
        shopAccount.setTotalDisburse(new BigDecimal("0"));
        shopAccount.setTotalRefund(new BigDecimal("0"));
        shopAccount.setTotalProfitsharing(new BigDecimal("0"));
        shopAccount.setTotalMoney(new BigDecimal("0"));
        shopAccountService.save(shopAccount);
        //商户认证信息初始化
        String authId = IdUtils.simpleUUID();
        ShopAuthentication shopAuthentication = new ShopAuthentication();
        shopAuthentication.setAuthId(authId);
        shopAuthentication.setDelFlag(0);
        shopAuthentication.setShopId(shop.getShopId());
        shopAuthenticationService.save(shopAuthentication);
        //商户分成信息初始化
        ShopProportion shopProportion = new ShopProportion();
        shopProportion.setDelFlag(0);
        shopProportion.setShopId(shop.getShopId());
        shopProportion.setShopType(shop.getShopType());
        shopProportion.setProportionPercent(new BigDecimal("100.00"));
        shopProportion.setUpdateTime(new Date());
        shopProportion.setUpdateUserId(userId);
        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.setTotalExperienceOrder(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);
    }
    /**
     * @description  终止合作
     * @author  jqs
     * @date    2023/6/20 12:01