jiangqs
2023-06-15 a262dee3a122f081a2d31d86b851ce3df0680d1a
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java
@@ -71,6 +71,7 @@
        if (customConfig == null) {
            customConfig = new CustomConfig();
            customConfig.setCreateTime(new Date());
            customConfig.setDelFlag(0);
        }
        // 设置配置的类型、键、名称、值和更新时间
        customConfig.setConfigType(ConfigEnum.PLATFORM_SERVICE_PHONE.getKeyType());
@@ -232,41 +233,36 @@
            customConfig.setConfigType(configEnum.getKeyType());
            customConfig.setConfigKey(configEnum.getKey());
            customConfig.setConfigName(configEnum.getKeyName());
            customConfig.setConfigValue(getConfigValue(configEnum, mgtOtherConfigEditDto));
            customConfig.setCreateTime(updateTime);
            customConfig.setUpdateTime(updateTime);
            this.saveOrUpdate(customConfig);
            switch (configEnum) {
                case SHARE_INTEGRAL:
                    customConfig.setConfigValue(mgtOtherConfigEditDto.getShareIntegral().toString());
                    this.saveOrUpdate(customConfig);
                case SUGGEST_PLATFORM_INTEGRAL:
                    customConfig.setConfigValue(mgtOtherConfigEditDto.getSuggestPlatformIntegral().toString());
                    this.saveOrUpdate(customConfig);
                case SIGN_IN_INTEGRAL:
                    customConfig.setConfigValue(mgtOtherConfigEditDto.getSignInIntegral().toString());
                    this.saveOrUpdate(customConfig);
                case SUGGEST_SHOP_INTEGRAL:
                    customConfig.setConfigValue(mgtOtherConfigEditDto.getSuggestShopIntegral().toString());
                    this.saveOrUpdate(customConfig);
                case ORDER_AUTO_CANCEL_TIME:
                    customConfig.setConfigValue(mgtOtherConfigEditDto.getOrderAutoCancelTime().toString());
                    this.saveOrUpdate(customConfig);
                case PAY_MONEY_INTEGRAL:
                    customConfig.setConfigValue(mgtOtherConfigEditDto.getPayMoneyIntegral().toString());
                    this.saveOrUpdate(customConfig);
                case HOME_STYLE:
                    customConfig.setConfigValue(mgtOtherConfigEditDto.getHomeStyle().toString());
                    this.saveOrUpdate(customConfig);
                default:
                    break;
            }
        }
    }
    /**
     * @param configEnum
     * @param mgtOtherConfigEditDto
     * @return String
     * @description 获取配置参数
     * @author jqs
     * @date 2023/6/7 16:37
     */
    private String getConfigValue(ConfigEnum configEnum, MgtOtherConfigEditDto mgtOtherConfigEditDto) {
        switch (configEnum) {
            case SHARE_INTEGRAL:
                return mgtOtherConfigEditDto.getShareIntegral().toString();
            case SUGGEST_PLATFORM_INTEGRAL:
                return mgtOtherConfigEditDto.getSuggestPlatformIntegral().toString();
            case SIGN_IN_INTEGRAL:
                return mgtOtherConfigEditDto.getSignInIntegral().toString();
            case SUGGEST_SHOP_INTEGRAL:
                return mgtOtherConfigEditDto.getSuggestShopIntegral().toString();
            case ORDER_AUTO_CANCEL_TIME:
                return mgtOtherConfigEditDto.getOrderAutoCancelTime().toString();
            case PAY_MONEY_INTEGRAL:
                return mgtOtherConfigEditDto.getPayMoneyIntegral().toString();
            case HOME_STYLE:
                return mgtOtherConfigEditDto.getHomeStyle().toString();
            default:
                throw new IllegalArgumentException("Invalid ConfigEnum");
        }
    }
    /**
     * @param mgtShopConfigEditDto