|
@@ -191,7 +191,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
if (StringUtil.isBlank(phoneId)) {
|
|
if (StringUtil.isBlank(phoneId)) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, "user_" + phoneId, position);
|
|
|
|
|
|
|
+ String collectUserId = toLifeCollectUserId(phoneId);
|
|
|
|
|
+ SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, collectUserId, position);
|
|
|
applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
|
|
applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
|
|
|
return item;
|
|
return item;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -206,7 +207,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
if (StringUtil.isBlank(phoneId)) {
|
|
if (StringUtil.isBlank(phoneId)) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, "user_" + phoneId, position);
|
|
|
|
|
|
|
+ String collectUserId = toLifeCollectUserId(phoneId);
|
|
|
|
|
+ SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, collectUserId, position);
|
|
|
applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
|
|
applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
|
|
|
return item;
|
|
return item;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -216,7 +218,20 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 二手商品详情公共填充:图片列表(含视频排序)、关注状态、距离文案、价格展示
|
|
|
|
|
|
|
+ * 与 {@code alienStore/collect/addCollect}、表 {@code life_collect.user_id} 一致:普通用户收藏键为 {@code user_手机号}。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param phoneOrUserId 裸手机号或已带 {@code user_} 的前端入参
|
|
|
|
|
+ */
|
|
|
|
|
+ static String toLifeCollectUserId(String phoneOrUserId) {
|
|
|
|
|
+ if (StringUtil.isBlank(phoneOrUserId)) {
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ String t = phoneOrUserId.trim();
|
|
|
|
|
+ return t.startsWith("user_") ? t : "user_" + t;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 二手商品详情公共填充:图片列表(含视频排序)、关注状态、距离文案、价格展示;收藏状态由 SQL 已带出,此处补默认「未收藏」。
|
|
|
*/
|
|
*/
|
|
|
private void applySecondGoodsDetailEnrichment(SecondGoodsRecommendVo item, String phoneId, Integer goodsId) {
|
|
private void applySecondGoodsDetailEnrichment(SecondGoodsRecommendVo item, String phoneId, Integer goodsId) {
|
|
|
if (item == null) {
|
|
if (item == null) {
|
|
@@ -246,7 +261,7 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
query1.lambda()
|
|
query1.lambda()
|
|
|
.eq(LifeFans::getFollowedId, item.getUserPhone())
|
|
.eq(LifeFans::getFollowedId, item.getUserPhone())
|
|
|
.eq(LifeFans::getDeleteFlag, 0)
|
|
.eq(LifeFans::getDeleteFlag, 0)
|
|
|
- .eq(LifeFans::getFansId, "user_" + phoneId);
|
|
|
|
|
|
|
+ .eq(LifeFans::getFansId, toLifeCollectUserId(phoneId));
|
|
|
List<LifeFans> lifeFans = lifeFansMapper.selectList(query1);
|
|
List<LifeFans> lifeFans = lifeFansMapper.selectList(query1);
|
|
|
if (lifeFans.size() > 0) {
|
|
if (lifeFans.size() > 0) {
|
|
|
item.setFansStatus(1);
|
|
item.setFansStatus(1);
|
|
@@ -256,6 +271,9 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
item.setPosition("距离" + item.getDist() + "km");
|
|
item.setPosition("距离" + item.getDist() + "km");
|
|
|
}
|
|
}
|
|
|
item.setPrice(item.getAmount() != null ? item.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null);
|
|
item.setPrice(item.getAmount() != null ? item.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null);
|
|
|
|
|
+ if (StringUtil.isBlank(item.getCollectStatus())) {
|
|
|
|
|
+ item.setCollectStatus("0");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|