| | |
| | | import com.ruoyi.system.api.domain.dto.MgtAfterSaleSettingDTO; |
| | | import com.ruoyi.system.domain.dto.PointsConfigDTO; |
| | | import com.ruoyi.system.domain.vo.CustomConfigVO; |
| | | import com.ruoyi.system.domain.vo.WishSettingVO; |
| | | import com.ruoyi.system.mapper.CustomConfigMapper; |
| | | import com.ruoyi.system.service.ICustomConfigService; |
| | | import java.math.BigDecimal; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取心愿求购设置 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public WishSettingVO getWishSetting() { |
| | | WishSettingVO vo = new WishSettingVO(); |
| | | CustomConfig customConfig = getCustomConfigByKey( |
| | | ConfigEnum.WISH_DESCRIPTION.getKey()).orElse(new CustomConfig()); |
| | | List<CustomConfig> list = this.lambdaQuery() |
| | | .in(CustomConfig::getConfigKey, ConfigEnum.WISH_DESCRIPTION.getKey(), |
| | | ConfigEnum.WISH_SHARE_TITLE.getKey(), |
| | | ConfigEnum.WISH_SHARE_IMG_URL.getKey()) |
| | | .eq(CustomConfig::getDelFlag, 0).list(); |
| | | for (CustomConfig config : list) { |
| | | if (ConfigEnum.WISH_DESCRIPTION.getKey().equals(config.getConfigKey())) { |
| | | vo.setDescription(customConfig.getConfigValue()); |
| | | } else if (ConfigEnum.WISH_SHARE_TITLE.getKey().equals(config.getConfigKey())) { |
| | | vo.setShareTitle(config.getConfigValue()); |
| | | } else if (ConfigEnum.WISH_SHARE_IMG_URL.getKey().equals(config.getConfigKey())) { |
| | | vo.setShareImgUrl(config.getConfigValue()); |
| | | } |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * 保存心愿求购说明 |
| | | * |
| | | * @param vo 保存心愿求购说明 |
| | | */ |
| | | @Override |
| | | public void saveWishDescription(WishSettingVO vo) { |
| | | String description = vo.getDescription(); |
| | | String shareTitle = vo.getShareTitle(); |
| | | String shareImgUrl = vo.getShareImgUrl(); |
| | | CustomConfig wishDescription = getCustomConfigByKey( |
| | | ConfigEnum.WISH_DESCRIPTION.getKey()).orElseGet(() -> { |
| | | CustomConfig customConfig = new CustomConfig(); |
| | | customConfig.setConfigKey(ConfigEnum.WISH_DESCRIPTION.getKey()); |
| | | customConfig.setConfigName(ConfigEnum.WISH_DESCRIPTION.getKeyName()); |
| | | customConfig.setConfigType(ConfigEnum.WISH_DESCRIPTION.getKeyType()); |
| | | return customConfig; |
| | | }); |
| | | wishDescription.setConfigValue(description); |
| | | CustomConfig wishShareTitle = getCustomConfigByKey( |
| | | ConfigEnum.WISH_SHARE_TITLE.getKey()).orElseGet(() -> { |
| | | CustomConfig customConfig = new CustomConfig(); |
| | | customConfig.setConfigKey(ConfigEnum.WISH_SHARE_TITLE.getKey()); |
| | | customConfig.setConfigName(ConfigEnum.WISH_SHARE_TITLE.getKeyName()); |
| | | customConfig.setConfigType(ConfigEnum.WISH_SHARE_TITLE.getKeyType()); |
| | | return customConfig; |
| | | }); |
| | | wishShareTitle.setConfigValue(shareTitle); |
| | | CustomConfig wishShareImgUrl = getCustomConfigByKey( |
| | | ConfigEnum.WISH_SHARE_IMG_URL.getKey()).orElseGet(() -> { |
| | | CustomConfig customConfig = new CustomConfig(); |
| | | customConfig.setConfigKey(ConfigEnum.WISH_SHARE_IMG_URL.getKey()); |
| | | customConfig.setConfigName(ConfigEnum.WISH_SHARE_IMG_URL.getKeyName()); |
| | | customConfig.setConfigType(ConfigEnum.WISH_SHARE_IMG_URL.getKeyType()); |
| | | return customConfig; |
| | | }); |
| | | wishShareImgUrl.setConfigValue(shareImgUrl); |
| | | saveOrUpdateBatch( |
| | | Lists.newArrayList(wishDescription, wishShareTitle, wishShareImgUrl)); |
| | | } |
| | | } |