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() { }