release: 折扣返回

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

@ -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;
}

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

Loading…
Cancel
Save