From efe79e640c4598f52c2d1032fcead000edf8049e Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期三, 28 六月 2023 10:29:53 +0800 Subject: [PATCH] 统计bug和验证优化 --- ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java | 195 +++++++++++++++++++++++++++++++----------------- 1 files changed, 126 insertions(+), 69 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java index 48209b2..0ea858e 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java @@ -5,6 +5,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.api.constant.ConfigEnum; import com.ruoyi.system.api.domain.poji.config.Activeness; +import com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo; +import com.ruoyi.system.api.service.RemoteActivityService; +import com.ruoyi.system.api.service.RemoteMemberService; +import com.ruoyi.system.api.service.RemoteOrderService; +import com.ruoyi.system.api.service.RemoteShopService; import com.ruoyi.system.domain.dto.*; import com.ruoyi.system.domain.pojo.config.Advert; import com.ruoyi.system.domain.pojo.config.CustomConfig; @@ -16,6 +21,7 @@ import com.ruoyi.system.service.config.ActivenessService; import com.ruoyi.system.service.config.AdvertService; import com.ruoyi.system.service.config.CustomConfigService; +import com.ruoyi.system.service.config.RecommendCooperationService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -43,6 +49,20 @@ @Resource private ActivenessService activenessService; + @Resource + private RemoteMemberService remoteMemberService; + + @Resource + private RecommendCooperationService recommendCooperationService; + + @Resource + private RemoteShopService remoteShopService; + + @Resource + private RemoteOrderService remoteOrderService; + + @Resource + private RemoteActivityService remoteActivityService; /** * @param key @@ -71,12 +91,13 @@ if (customConfig == null) { customConfig = new CustomConfig(); customConfig.setCreateTime(new Date()); + customConfig.setDelFlag(0); } // 设置配置的类型、键、名称、值和更新时间 - customConfig.setType(ConfigEnum.PLATFORM_SERVICE_PHONE.getKeyType()); - customConfig.setKey(ConfigEnum.PLATFORM_SERVICE_PHONE.getKey()); - customConfig.setName(ConfigEnum.PLATFORM_SERVICE_PHONE.getKeyName()); - customConfig.setValue(mgtServiceMobileEditDto.getServiceMobile()); + customConfig.setConfigType(ConfigEnum.PLATFORM_SERVICE_PHONE.getKeyType()); + customConfig.setConfigKey(ConfigEnum.PLATFORM_SERVICE_PHONE.getKey()); + customConfig.setConfigName(ConfigEnum.PLATFORM_SERVICE_PHONE.getKeyName()); + customConfig.setConfigValue(mgtServiceMobileEditDto.getServiceMobile()); customConfig.setUpdateTime(new Date()); // 保存或更新配置 this.saveOrUpdate(customConfig); @@ -95,57 +116,57 @@ //获取自定义配置 List<CustomConfig> customConfigList = customConfigMapper.selectList(new LambdaQueryWrapper<CustomConfig>().eq(CustomConfig::getDelFlag, 0)); Optional.ofNullable(customConfigList).ifPresent(list -> { - Map<String, CustomConfig> configMap = list.stream().collect(Collectors.toMap(CustomConfig::getKey, Function.identity())); + Map<String, CustomConfig> configMap = list.stream().collect(Collectors.toMap(CustomConfig::getConfigKey, Function.identity())); // 遍历配置映射,设置相应的属性值 configMap.forEach((key, value) -> { switch (key) { case "SHARE_INTEGRAL": - mgtAllCustomConfigVo.setShareIntegral(Integer.valueOf(value.getValue())); + mgtAllCustomConfigVo.setShareIntegral(Integer.valueOf(value.getConfigValue())); break; case "SUGGEST_PLATFORM_INTEGRAL": - mgtAllCustomConfigVo.setSuggestPlatformIntegral(Integer.valueOf(value.getValue())); + mgtAllCustomConfigVo.setSuggestPlatformIntegral(Integer.valueOf(value.getConfigValue())); break; case "SIGN_IN_INTEGRAL": - mgtAllCustomConfigVo.setSignInIntegral(Integer.valueOf(value.getValue())); + mgtAllCustomConfigVo.setSignInIntegral(Integer.valueOf(value.getConfigValue())); break; case "SUGGEST_SHOP_INTEGRAL": - mgtAllCustomConfigVo.setSuggestShopIntegral(Integer.valueOf(value.getValue())); + mgtAllCustomConfigVo.setSuggestShopIntegral(Integer.valueOf(value.getConfigValue())); break; case "PAY_MONEY_INTEGRAL": - mgtAllCustomConfigVo.setPayMoneyIntegral(Integer.valueOf(value.getValue())); + mgtAllCustomConfigVo.setPayMoneyIntegral(Integer.valueOf(value.getConfigValue())); break; case "ORDER_AUTO_CANCEL_TIME": - mgtAllCustomConfigVo.setOrderAutoCancelTime(Integer.valueOf(value.getValue())); + mgtAllCustomConfigVo.setOrderAutoCancelTime(Integer.valueOf(value.getConfigValue())); break; case "HOME_STYLE": - mgtAllCustomConfigVo.setHomeStyle(Integer.valueOf(value.getValue())); + mgtAllCustomConfigVo.setHomeStyle(Integer.valueOf(value.getConfigValue())); break; case "SHOP_EMERGENCY_DEGREE": - mgtAllCustomConfigVo.setShopEmergencyDegree(value.getValue()); + mgtAllCustomConfigVo.setShopEmergencyDegree(value.getConfigValue()); break; case "SHOP_FOLLOW_TYPE": - mgtAllCustomConfigVo.setShopFollowType(value.getValue()); + mgtAllCustomConfigVo.setShopFollowType(value.getConfigValue()); break; case "SHOP_CUSTOM_STATUS": - mgtAllCustomConfigVo.setShopCustomStatus(value.getValue()); + mgtAllCustomConfigVo.setShopCustomStatus(value.getConfigValue()); break; case "SHOP_SOURCE_CHANNEL": - mgtAllCustomConfigVo.setShopSourceChannel(value.getValue()); + mgtAllCustomConfigVo.setShopSourceChannel(value.getConfigValue()); break; case "MEMBER_SOURCE_CHANNEL": - mgtAllCustomConfigVo.setMemberSourceChannel(value.getValue()); + mgtAllCustomConfigVo.setMemberSourceChannel(value.getConfigValue()); break; case "MEMBER_CHARACTER": - mgtAllCustomConfigVo.setMemberCharacter(value.getValue()); + mgtAllCustomConfigVo.setMemberCharacter(value.getConfigValue()); break; case "MEMBER_LEVEL": - mgtAllCustomConfigVo.setMemberLevel(value.getValue()); + mgtAllCustomConfigVo.setMemberLevel(value.getConfigValue()); break; case "MEMBER_TYPE": - mgtAllCustomConfigVo.setMemberType(value.getValue()); + mgtAllCustomConfigVo.setMemberType(value.getConfigValue()); break; case "NURSE_PROBLEM": - mgtAllCustomConfigVo.setNurseProblem(value.getValue()); + mgtAllCustomConfigVo.setNurseProblem(value.getConfigValue()); break; default: break; @@ -209,7 +230,7 @@ private void deletePastConfig(Date updateTime) { List<CustomConfig> customConfigList = customConfigMapper.selectList(new LambdaQueryWrapper<CustomConfig>() .eq(CustomConfig::getDelFlag, 0) - .eq(CustomConfig::getType, 2)); + .eq(CustomConfig::getConfigType, 2)); for (CustomConfig customConfig : customConfigList) { customConfig.setDelFlag(1); customConfig.setUpdateTime(updateTime); @@ -229,44 +250,39 @@ for (ConfigEnum configEnum : ConfigEnum.values()) { CustomConfig customConfig = new CustomConfig(); customConfig.setDelFlag(0); - customConfig.setType(configEnum.getKeyType()); - customConfig.setKey(configEnum.getKey()); - customConfig.setName(configEnum.getKeyName()); - customConfig.setValue(getConfigValue(configEnum, mgtOtherConfigEditDto)); + customConfig.setConfigType(configEnum.getKeyType()); + customConfig.setConfigKey(configEnum.getKey()); + customConfig.setConfigName(configEnum.getKeyName()); 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 @@ -283,7 +299,7 @@ List<CustomConfig> customConfigList = customConfigMapper.selectList( new LambdaQueryWrapper<CustomConfig>() .eq(CustomConfig::getDelFlag, 0) - .eq(CustomConfig::getType, 3) + .eq(CustomConfig::getConfigType, 3) ); if (customConfigList != null && !customConfigList.isEmpty()) { String key; @@ -292,8 +308,8 @@ List<CustomConfig> updatedCustomConfigs = new ArrayList<>(); // 遍历配置列表,根据 key 更新配置值 for (CustomConfig customConfig : customConfigList) { - key = customConfig.getKey(); - oldValue = customConfig.getValue(); + key = customConfig.getConfigKey(); + oldValue = customConfig.getConfigValue(); switch (key) { case "SHOP_EMERGENCY_DEGREE": newValue = mgtShopConfigEditDto.getShopEmergencyDegree(); @@ -310,7 +326,7 @@ default: break; } - customConfig.setValue(newValue); + customConfig.setConfigValue(newValue); customConfig.setUpdateTime(updateTime); handleChangeConfig(oldValue, newValue, key); updatedCustomConfigs.add(customConfig); @@ -340,7 +356,7 @@ List<CustomConfig> customConfigList = customConfigMapper.selectList( new LambdaQueryWrapper<CustomConfig>() .eq(CustomConfig::getDelFlag, 0) - .eq(CustomConfig::getType, 4) + .eq(CustomConfig::getConfigType, 4) ); if (customConfigList != null && !customConfigList.isEmpty()) { String key; @@ -349,8 +365,8 @@ List<CustomConfig> updatedCustomConfigs = new ArrayList<>(); // 遍历配置列表,根据 key 更新配置值 for (CustomConfig customConfig : customConfigList) { - key = customConfig.getKey(); - oldValue = customConfig.getValue(); + key = customConfig.getConfigKey(); + oldValue = customConfig.getConfigValue(); switch (key) { case "MEMBER_SOURCE_CHANNEL": newValue = mgtMemberConfigEditDto.getMemberSourceChannel(); @@ -370,7 +386,7 @@ default: break; } - customConfig.setValue(newValue); + customConfig.setConfigValue(newValue); customConfig.setUpdateTime(updateTime); handleChangeConfig(oldValue, newValue, key); updatedCustomConfigs.add(customConfig); @@ -398,10 +414,10 @@ private void createNewConfig(ConfigEnum configEnum, String value, Date updateTime) { CustomConfig customConfig = new CustomConfig(); customConfig.setDelFlag(0); - customConfig.setType(configEnum.getKeyType()); - customConfig.setKey(configEnum.getKey()); - customConfig.setName(configEnum.getKeyName()); - customConfig.setValue(value); + customConfig.setConfigType(configEnum.getKeyType()); + customConfig.setConfigKey(configEnum.getKey()); + customConfig.setConfigName(configEnum.getKeyName()); + customConfig.setConfigValue(value); customConfig.setCreateTime(updateTime); customConfig.setUpdateTime(updateTime); this.saveOrUpdate(customConfig); @@ -472,8 +488,49 @@ public MgtCustomConfigVo getCustomConfig(MgtCustomConfigDto mgtCustomConfigDto){ CustomConfig customConfig = this.getByKey(mgtCustomConfigDto.getConfigType()); MgtCustomConfigVo mgtCustomConfigVo = new MgtCustomConfigVo(); - mgtCustomConfigVo.setCustomConfig(customConfig.getValue()); - mgtCustomConfigVo.setConfigType(mgtCustomConfigDto.getConfigType()); + if(customConfig!=null){ + mgtCustomConfigVo.setCustomConfig(customConfig.getConfigValue()); + mgtCustomConfigVo.setConfigType(mgtCustomConfigDto.getConfigType()); + } return mgtCustomConfigVo; } + + /** + * @description getBulletinBoard + * @param + * @return MgtBulletinBoardVo + * @author jqs34 + * @date 2023/6/18 16:41 + */ + @Override + public MgtBulletinBoardVo getBulletinBoard(){ + // 创建 MgtBulletinBoardVo 对象 + MgtBulletinBoardVo mgtBulletinBoardVo = new MgtBulletinBoardVo(); + // 获取会员信息 + MgtBulletinBoardVo mgtBulletinBoardVoMember = remoteMemberService.boardMemberTotal().getData(); + mgtBulletinBoardVo.setMemberTotal(mgtBulletinBoardVoMember.getMemberTotal()); + mgtBulletinBoardVo.setMemberToday(mgtBulletinBoardVoMember.getMemberToday()); + // 获取推荐合作信息 + MgtBulletinBoardVo mgtBulletinBoardVoCustom = recommendCooperationService.boardMemberTotal(); + mgtBulletinBoardVo.setCustomTotal(mgtBulletinBoardVoCustom.getCustomTotal()); + mgtBulletinBoardVo.setCustomToday(mgtBulletinBoardVoCustom.getCustomToday()); + // 获取店铺信息 + MgtBulletinBoardVo mgtBulletinBoardVoShop = remoteShopService.boardShopTotal().getData(); + mgtBulletinBoardVo.setShopTotal(mgtBulletinBoardVoShop.getShopTotal()); + mgtBulletinBoardVo.setAgencyTotal(mgtBulletinBoardVoShop.getAgencyTotal()); + mgtBulletinBoardVo.setDealerTotal(mgtBulletinBoardVoShop.getDealerTotal()); + mgtBulletinBoardVo.setFollowShopToday(mgtBulletinBoardVoShop.getFollowShopToday()); + mgtBulletinBoardVo.setFollowUserToday(0); + // 获取订单信息 + MgtBulletinBoardVo mgtBulletinBoardVoOrder = remoteOrderService.boardOrderTotal().getData(); + mgtBulletinBoardVo.setSalesTotal(mgtBulletinBoardVoOrder.getSalesTotal()); + mgtBulletinBoardVo.setUnUseOrderTotal(mgtBulletinBoardVoOrder.getUnUseOrderTotal()); + mgtBulletinBoardVo.setActivityOrderTotal(mgtBulletinBoardVoOrder.getActivityOrderTotal()); + // 获取活动信息 + MgtBulletinBoardVo mgtBulletinBoardVoActivity = remoteActivityService.boardActivityTotal().getData(); + mgtBulletinBoardVo.setActivityUserTotal(mgtBulletinBoardVoActivity.getActivityUserTotal()); + // 返回 MgtBulletinBoardVo 对象 + return mgtBulletinBoardVo; + } + } -- Gitblit v1.7.1