release: 折扣返回

release-2024-04-25
huangyw 3 months ago
parent f369e648e3
commit 20efa3330a

@ -1,6 +1,7 @@
package com.luoo.user.service; package com.luoo.user.service;
import api.PageResult; import api.PageResult;
import com.luoo.user.config.EnvConfig;
import com.luoo.user.dao.StoreDao; import com.luoo.user.dao.StoreDao;
import com.luoo.user.dto.store.StoreSearchDto; import com.luoo.user.dto.store.StoreSearchDto;
import com.luoo.user.dto.store.StoreUpdateDto; import com.luoo.user.dto.store.StoreUpdateDto;
@ -57,7 +58,9 @@ public class StoreService {
private final StoreMapper storeMapper; 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.storeDao = storeDao;
this.jpaQueryFactory = jpaQueryFactory; this.jpaQueryFactory = jpaQueryFactory;
this.regionService = regionService; this.regionService = regionService;
@ -65,6 +68,7 @@ public class StoreService {
this.userInfoService = userInfoService; this.userInfoService = userInfoService;
this.rabbitTemplate = rabbitTemplate; this.rabbitTemplate = rabbitTemplate;
this.storeMapper = storeMapper; this.storeMapper = storeMapper;
this.envConfig = envConfig;
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -109,7 +113,7 @@ public class StoreService {
rabbitTemplate.convertAndSend("store_visit", id); rabbitTemplate.convertAndSend("store_visit", id);
// 只显示合作中的门店 // 只显示合作中的门店
return jpaQueryFactory.select(Projections.constructor(StoreAppVO.class, StoreAppVO storeAppVO = jpaQueryFactory.select(Projections.constructor(StoreAppVO.class,
qStore.id, qStore.id,
qStore.name, qStore.name,
qStore.regionId, qStore.regionId,
@ -130,6 +134,9 @@ public class StoreService {
(qStore.id.eq(id)) (qStore.id.eq(id))
.and(qStore.status.eq(StoreEnums.STORE_STATUS_COOPERATION.getCode()))) .and(qStore.status.eq(StoreEnums.STORE_STATUS_COOPERATION.getCode())))
.fetchOne(); .fetchOne();
assert storeAppVO != null;
storeAppVO.setDiscount(100 * envConfig.getPermanentMemberDiscount());
return storeAppVO;
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -260,6 +267,9 @@ public class StoreService {
// redisTemplate.delete(String.valueOf(uuid)); // redisTemplate.delete(String.valueOf(uuid));
for (StoreAppVO storeAppVO : storeList) {
storeAppVO.setDiscount(100 * envConfig.getPermanentMemberDiscount());
}
return storeList; return storeList;
} }

@ -78,6 +78,9 @@ public class StoreAppVO implements Serializable {
@ApiModelProperty(value = "编码") @ApiModelProperty(value = "编码")
private String code; private String code;
@ApiModelProperty(value = "折扣")
private Float discount;
public StoreAppVO() { public StoreAppVO() {
} }

Loading…
Cancel
Save