|
|
@@ -5636,20 +5636,18 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
Integer totalCount = 0;
|
|
|
double storeScore;
|
|
|
Object ratingObj = commonRatingService.getRatingCount(storeInfo.getId(), 1);
|
|
|
- if (ratingObj != null && ratingObj instanceof Map) {
|
|
|
+ if (ratingObj != null) {
|
|
|
Map<String, Object> ratingMap = (Map<String, Object>) ratingObj;
|
|
|
-
|
|
|
- // 校验外层状态(success、code)
|
|
|
- Boolean isSuccess = (Boolean) ratingMap.get("success");
|
|
|
- Integer code = (Integer) ratingMap.get("code");
|
|
|
- if (isSuccess != null && isSuccess && code != null && code == 200) {
|
|
|
- // 提取核心数据层data
|
|
|
- Map<String, Object> dataMap = (Map<String, Object>) ratingMap.get("data");
|
|
|
- if (dataMap != null) {
|
|
|
- // 解析各字段(非空校验+类型转换)
|
|
|
- storeScore = dataMap.get("storeScore") != null ? Double.parseDouble(dataMap.get("storeScore").toString()) : 0.0;
|
|
|
- totalCount = dataMap.get("totalCount") != null ? Integer.parseInt(dataMap.get("totalCount").toString()) : 0;
|
|
|
+ Object totalCountObj = ratingMap.get("totalCount");
|
|
|
+ if (totalCountObj != null) {
|
|
|
+ // 安全转换为整数
|
|
|
+ try {
|
|
|
+ totalCount = Integer.parseInt(totalCountObj.toString().trim());
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ totalCount = 0; // 转换失败时默认值
|
|
|
}
|
|
|
+ } else {
|
|
|
+ totalCount = 0;
|
|
|
}
|
|
|
}
|
|
|
|