|
|
@@ -1,5 +1,6 @@
|
|
|
package shop.alien.store.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
@@ -15,6 +16,7 @@ import shop.alien.mapper.*;
|
|
|
import shop.alien.store.service.StoreClockInService;
|
|
|
import shop.alien.store.service.StoreCommentService;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -43,6 +45,10 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
|
|
|
|
|
|
private final LifeCollectMapper lifeCollectMapper;
|
|
|
|
|
|
+ private final StoreInfoMapper storeInfoMapper;
|
|
|
+
|
|
|
+ private final StoreImgMapper storeImgMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public StoreClockIn addStoreClockIn(StoreClockIn storeClockIn) {
|
|
|
LifeUser user = lifeUserMapper.selectById(storeClockIn.getUserId());
|
|
|
@@ -198,9 +204,10 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int setImg(int id, String img) {
|
|
|
+ public int setImgAndAiContent(int id, String img,String aiContent) {
|
|
|
LambdaUpdateWrapper<StoreClockIn> wrapper = new LambdaUpdateWrapper<>();
|
|
|
wrapper.set(StoreClockIn::getImgUrl, img);
|
|
|
+ wrapper.set(StoreClockIn::getMaybeAiContent,aiContent);
|
|
|
wrapper.eq(StoreClockIn::getId, id);
|
|
|
return storeClockInMapper.update(null, wrapper);
|
|
|
}
|
|
|
@@ -224,4 +231,47 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
|
|
|
public List<Map<Integer, Integer>> getStoreClockInWithCanLookCount() {
|
|
|
return storeClockInMapper.getStoreClockInWithCanLookCount();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public StoreClockInVo getStoreClockInById(Integer id) {
|
|
|
+ StoreClockIn storeClockIn = storeClockInMapper.selectById(id);
|
|
|
+ StoreClockInVo storeClockInVo = BeanUtil.copyProperties(storeClockIn, StoreClockInVo.class);
|
|
|
+ if (null == storeClockIn) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ StoreInfo storeInfo = storeInfoMapper.selectById(storeClockIn.getStoreId());
|
|
|
+ // 店铺名称
|
|
|
+ storeClockInVo.setStoreName(storeInfo.getStoreName());
|
|
|
+ // 店铺头像
|
|
|
+ LambdaQueryWrapper<StoreImg> eq = new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 10).eq(StoreImg::getStoreId, storeInfo.getId());
|
|
|
+ StoreImg storeImg = storeImgMapper.selectOne(eq);
|
|
|
+ storeClockInVo.setEntranceImage(storeImg != null ? storeImg.getImgUrl() : "");
|
|
|
+ // 店铺评分
|
|
|
+ storeClockInVo.setScore(storeInfo.getScoreAvg());
|
|
|
+ // 设置店铺大类
|
|
|
+ String businessSectionName = storeInfo.getBusinessSectionName();
|
|
|
+ if(Arrays.asList("酒吧", "KTV", "洗浴汗蒸", "按摩足疗").contains(businessSectionName)){
|
|
|
+ storeClockInVo.setStoreTypeNew(1);
|
|
|
+ } else if (Arrays.asList("丽人美发", "运动健身").contains(businessSectionName)){
|
|
|
+ storeClockInVo.setStoreTypeNew(2);
|
|
|
+ } else if (Arrays.asList("特色美食").contains(businessSectionName)){
|
|
|
+ storeClockInVo.setStoreTypeNew(3);
|
|
|
+ }
|
|
|
+ // 最小分类
|
|
|
+ storeClockInVo.setBusinessClassifyName(storeInfo.getBusinessClassifyName());
|
|
|
+ // 地址
|
|
|
+ storeClockInVo.setStoreAddress(storeInfo.getStoreAddress());
|
|
|
+ // 是否收藏
|
|
|
+ // 查询我的收藏
|
|
|
+ LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();
|
|
|
+ collectWrapper.eq(LifeCollect::getUserId, String.valueOf(storeClockInVo.getUserId()));
|
|
|
+ List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(collectWrapper);
|
|
|
+ List<String> collectList = lifeCollectList.stream().map(LifeCollect::getStoreId).collect(Collectors.toList());
|
|
|
+ storeClockInVo.setIsCollect("0");
|
|
|
+ if (collectList.contains(storeClockInVo.getStoreId().toString())){
|
|
|
+ storeClockInVo.setIsCollect("1");
|
|
|
+ }
|
|
|
+ return storeClockInVo;
|
|
|
+ }
|
|
|
}
|