From 724e7026b9dca44f7083b751fb3dbba7d9ff8770 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 26 二月 2026 17:07:22 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi
---
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpUserFeedbackServiceImpl.java | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpUserFeedbackServiceImpl.java b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpUserFeedbackServiceImpl.java
index 2249edd..e2edcf4 100644
--- a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpUserFeedbackServiceImpl.java
+++ b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpUserFeedbackServiceImpl.java
@@ -1,10 +1,32 @@
package com.xiaopeng.operation.service.impl;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xiaopeng.api.dto.account.UserResourcesDto;
+import com.xiaopeng.api.feignClient.account.UserResourcesClient;
+import com.xiaopeng.api.model.operation.XpFeedbackType;
import com.xiaopeng.api.model.operation.XpUserFeedback;
+import com.xiaopeng.api.vo.account.GetUserListByUidsVo;
+import com.xiaopeng.common.core.web.page.PageInfo;
import com.xiaopeng.operation.mapper.XpUserFeedbackMapper;
+import com.xiaopeng.operation.query.UserFeedBackQuery;
+import com.xiaopeng.operation.service.IXpFeedbackTypeService;
import com.xiaopeng.operation.service.IXpUserFeedbackService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xiaopeng.operation.vo.XpUserFeedbackVO;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
/**
* <p>
@@ -15,6 +37,51 @@
* @since 2026-02-03
*/
@Service
+@RequiredArgsConstructor(onConstructor_ = @Lazy)
public class XpUserFeedbackServiceImpl extends ServiceImpl<XpUserFeedbackMapper, XpUserFeedback> implements IXpUserFeedbackService {
+ private final UserResourcesClient userResourcesClient;
+ private final IXpFeedbackTypeService xpFeedbackTypeService;
+ @Override
+ public PageInfo<XpUserFeedbackVO> getPageList(UserFeedBackQuery query) {
+ Page<XpUserFeedback> page = lambdaQuery()
+ .like(StringUtils.isNotBlank(query.getFeedbackContent()), XpUserFeedback::getFeedbackContent, query.getFeedbackContent())
+ .page(new Page<>(query.getPageNum(), query.getPageSize()));
+ //转换为VO
+ List<XpUserFeedbackVO> xpUserFeedbackVOS = BeanUtil.copyToList(page.getRecords(), XpUserFeedbackVO.class);
+ //获取小鹏用户信息
+ List<Long> xpUid = xpUserFeedbackVOS.stream().map(XpUserFeedback::getFeedbackUserId).distinct().collect(Collectors.toList());
+ if (CollUtil.isNotEmpty(xpUid)) {
+ GetUserListByUidsVo getUserListByUidsVo = new GetUserListByUidsVo();
+ getUserListByUidsVo.setUids(xpUid);
+ getUserListByUidsVo.setGetPreCarOwner(Boolean.TRUE);
+ UserResourcesDto resultData = userResourcesClient.getUserListByUids(getUserListByUidsVo);
+ if (resultData.getCode().equals(HttpStatus.OK.value())) {
+ JSONObject jsonObject = JSONObject.parseObject(resultData.getData().toString());
+ for (XpUserFeedbackVO xpUserFeedbackVO : xpUserFeedbackVOS) {
+ JSONObject userInfo = jsonObject.getJSONObject(xpUserFeedbackVO.getFeedbackUserId().toString());
+ if (Objects.nonNull(userInfo)) {
+ xpUserFeedbackVO.setNickname(userInfo.getString("nickName"));
+ xpUserFeedbackVO.setAvatar(userInfo.getString("headImg"));
+ xpUserFeedbackVO.setPhone(userInfo.getString("mobile"));
+ }
+ }
+ }
+ }
+ //收集意见反馈类型ID
+ List<Long> feedbackTypeIds = xpUserFeedbackVOS.stream().map(XpUserFeedback::getFeedbackTypeId).distinct().collect(Collectors.toList());
+ Map<Long, String> feedbackTypeMap = CollUtil.isNotEmpty(feedbackTypeIds) ?
+ xpFeedbackTypeService.listByIds(feedbackTypeIds).stream()
+ .collect(Collectors.toMap(XpFeedbackType::getId, XpFeedbackType::getFeedbackType))
+ : Collections.emptyMap();
+ xpUserFeedbackVOS.forEach(item-> item.setFeedbackTypeName(feedbackTypeMap.get(item.getFeedbackTypeId())));
+
+ //封装分页信息
+ PageInfo<XpUserFeedbackVO> pageInfo = new PageInfo<>();
+ pageInfo.setTotal(page.getTotal());
+ pageInfo.setSize(page.getSize());
+ pageInfo.setPages(page.getPages());
+ pageInfo.setRecords(xpUserFeedbackVOS);
+ return pageInfo;
+ }
}
--
Gitblit v1.7.1