|
@@ -20,6 +20,7 @@ import shop.alien.mapper.second.SecondRecommendMapper;
|
|
|
import shop.alien.second.service.SecondRecommendService;
|
|
|
import shop.alien.util.common.JwtUtil;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -61,6 +62,9 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
}
|
|
|
IPage<SecondGoodsRecommendVo> result = mapper.getSecondRecommendByPage(page, userId, longitude + "," + latitude, typeId, "user_" + phoneId);
|
|
|
for (SecondGoodsRecommendVo row : result.getRecords()) {
|
|
|
+ // 价格保留两位小数
|
|
|
+ row.setPrice(row.getPrice() != null ? row.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null);
|
|
|
+ // 距离拼接
|
|
|
if (StringUtil.isNotBlank(row.getDist())) {
|
|
|
row.setPosition("距离" + row.getDist() + "km");
|
|
|
}
|
|
@@ -101,6 +105,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
if (StringUtil.isNotBlank(item.getDist())) {
|
|
|
item.setPosition("距离" + item.getDist() + "km");
|
|
|
}
|
|
|
+ // 价格保留两位小数
|
|
|
+ item.setPrice(item.getPrice() != null ? item.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null);
|
|
|
|
|
|
// 评论列表
|
|
|
List<SecondCommentVo> cList = new ArrayList<>();
|
|
@@ -152,6 +158,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
if (StringUtil.isNotBlank(item.getDist())) {
|
|
|
item.setPosition("距离" + item.getDist() + "km");
|
|
|
}
|
|
|
+ // 价格保留两位小数
|
|
|
+ item.setPrice(item.getPrice() != null ? item.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null);
|
|
|
|
|
|
// 评论列表
|
|
|
List<SecondCommentVo> cList = new ArrayList<>();
|
|
@@ -223,6 +231,7 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
|
|
|
if (StringUtil.isNotBlank(item.getDist())) {
|
|
|
item.setPosition("距离" + item.getDist() + "km");
|
|
|
}
|
|
|
+ item.setPrice(item.getPrice() != null ? item.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null);
|
|
|
return item;
|
|
|
} catch (Exception e) {
|
|
|
log.error("SecondRecommendServiceImpl.querySecondGoodsDetail Error Mgs={}", e.getMessage());
|