From 20efa3330a60bc3d83630c8ff1f182baa5c38303 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Wed, 4 Sep 2024 11:48:22 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E6=8A=98=E6=89=A3=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/luoo/user/service/StoreService.java | 14 ++++++++++++-- .../java/com/luoo/user/vo/store/StoreAppVO.java | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/service/StoreService.java b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java index dd0d697..cf5f9dd 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/StoreService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java @@ -1,6 +1,7 @@ package com.luoo.user.service; import api.PageResult; +import com.luoo.user.config.EnvConfig; import com.luoo.user.dao.StoreDao; import com.luoo.user.dto.store.StoreSearchDto; import com.luoo.user.dto.store.StoreUpdateDto; @@ -57,7 +58,9 @@ public class StoreService { private final StoreMapper storeMapper; - public StoreService(StoreDao storeDao, JPAQueryFactory jpaQueryFactory, RegionService regionService, RedisTemplate redisTemplate, UserInfoService userInfoService, RabbitTemplate rabbitTemplate, StoreMapper storeMapper) { + private final EnvConfig envConfig; + + public StoreService(StoreDao storeDao, JPAQueryFactory jpaQueryFactory, RegionService regionService, RedisTemplate redisTemplate, UserInfoService userInfoService, RabbitTemplate rabbitTemplate, StoreMapper storeMapper, EnvConfig envConfig) { this.storeDao = storeDao; this.jpaQueryFactory = jpaQueryFactory; this.regionService = regionService; @@ -65,6 +68,7 @@ public class StoreService { this.userInfoService = userInfoService; this.rabbitTemplate = rabbitTemplate; this.storeMapper = storeMapper; + this.envConfig = envConfig; } @Transactional(rollbackFor = Exception.class) @@ -109,7 +113,7 @@ public class StoreService { rabbitTemplate.convertAndSend("store_visit", id); // 只显示合作中的门店 - return jpaQueryFactory.select(Projections.constructor(StoreAppVO.class, + StoreAppVO storeAppVO = jpaQueryFactory.select(Projections.constructor(StoreAppVO.class, qStore.id, qStore.name, qStore.regionId, @@ -130,6 +134,9 @@ public class StoreService { (qStore.id.eq(id)) .and(qStore.status.eq(StoreEnums.STORE_STATUS_COOPERATION.getCode()))) .fetchOne(); + assert storeAppVO != null; + storeAppVO.setDiscount(100 * envConfig.getPermanentMemberDiscount()); + return storeAppVO; } @Transactional(rollbackFor = Exception.class) @@ -260,6 +267,9 @@ public class StoreService { // redisTemplate.delete(String.valueOf(uuid)); + for (StoreAppVO storeAppVO : storeList) { + storeAppVO.setDiscount(100 * envConfig.getPermanentMemberDiscount()); + } return storeList; } diff --git a/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java b/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java index 171975d..3dc6141 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java @@ -78,6 +78,9 @@ public class StoreAppVO implements Serializable { @ApiModelProperty(value = "编码") private String code; + @ApiModelProperty(value = "折扣") + private Float discount; + public StoreAppVO() { }