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 eea280d..ebaa594 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 @@ -12,14 +12,12 @@ import com.luoo.user.vo.store.StorePCVO; import com.querydsl.core.BooleanBuilder; import com.querydsl.core.types.Projections; import com.querydsl.jpa.impl.JPAQueryFactory; +import constants.Constants; import enums.StoreEnums; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.geo.Distance; -import org.springframework.data.geo.Point; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.redis.connection.RedisGeoCommands; @@ -102,7 +100,7 @@ public class StoreService { public StorePCVO getOne(String id) { QStore qStore = QStore.store; QUserInfo qUserInfo = QUserInfo.userInfo; - return jpaQueryFactory.select(Projections.constructor(StorePCVO.class, + StorePCVO storePCVO = jpaQueryFactory.select(Projections.constructor(StorePCVO.class, qStore.id, qStore.name, qStore.regionId, @@ -129,6 +127,9 @@ public class StoreService { .on(qStore.contact.eq(qUserInfo.id)) .where((qStore.id.eq(id))) .fetchOne(); + assert storePCVO != null; + storePCVO.setContactAvatar(Constants.RESOURCE_PREFIX + storePCVO.getContactAvatar()); + return storePCVO; } public StoreAppVO getStoreForApp(String id) { @@ -167,6 +168,8 @@ public class StoreService { (qStore.id.eq(id)) .and(qStore.status.eq(StoreEnums.STORE_STATUS_COOPERATION.getCode()))) .fetchOne(); + assert storeAppVO != null; + storeAppVO.setContactAvatar(Constants.RESOURCE_PREFIX + storeAppVO.getContactAvatar()); return storeAppVO; } @@ -224,6 +227,8 @@ public class StoreService { Region regionById = regionService.getRegionById(store.getRegionId()); store.setRegion(regionById); } + + store.setContactAvatar(Constants.RESOURCE_PREFIX + store.getContactAvatar()); }); return new PageResult<>(total, storeList); } @@ -232,7 +237,9 @@ public class StoreService { storeSearchDto.setStatus(StoreEnums.STORE_STATUS_COOPERATION.getCode()); List storeList = storeMapper.getListForApp(storeSearchDto); - + storeList.forEach(store -> { + store.setContactAvatar(Constants.RESOURCE_PREFIX + store.getContactAvatar()); + }); // BooleanBuilder booleanBuilder = new BooleanBuilder(); // QStore qStore = QStore.store;