录音管理联调添加编辑,门店转换
This commit is contained in:
@@ -2,11 +2,15 @@ package com.rj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rj.common.DataEnrichmentUtil;
|
||||
import com.rj.entity.AudioManagement;
|
||||
import com.rj.entity.CustomerManagement;
|
||||
import com.rj.entity.SalesManagement;
|
||||
import com.rj.service.IAudioManagementService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -28,6 +32,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequestMapping("/api/audioManagement")
|
||||
@Tag(name = "录音管理", description = "录音管理相关接口")
|
||||
@Slf4j
|
||||
public class AudioManagementController {
|
||||
|
||||
@Autowired
|
||||
@@ -115,6 +120,8 @@ public class AudioManagementController {
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
@Autowired
|
||||
private DataEnrichmentUtil dataEnrichmentUtil;
|
||||
|
||||
/**
|
||||
* 分页查询录音列表
|
||||
@@ -154,10 +161,30 @@ public class AudioManagementController {
|
||||
}
|
||||
|
||||
// 按创建时间倒序排列
|
||||
queryWrapper.orderByDesc(AudioManagement::getCreateTime);
|
||||
queryWrapper.orderByDesc(AudioManagement::getUpdateTime);
|
||||
|
||||
Page<AudioManagement> audioPage = audioManagementService.page(page, queryWrapper);
|
||||
|
||||
|
||||
// 使用工具类提取ID列表
|
||||
List<String> dealershipIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getDealershipId);
|
||||
List<String> saleIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getSalesId);
|
||||
List<String> projectIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getProjectId);
|
||||
List<String> customerIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getCustomerId);
|
||||
|
||||
|
||||
// 使用工具类批量获取关联数据
|
||||
Map<String, String> dealershipNameMap = dataEnrichmentUtil.getDealershipIdNameMap(dealershipIds);
|
||||
Map<String, String> saleNameMap = dataEnrichmentUtil.getSalesIdNameMap(saleIds);
|
||||
Map<String, String> projectNameMap = dataEnrichmentUtil.getProjectIdNameMap(projectIds);
|
||||
// Map<String, String> customerNameMap = dataEnrichmentUtil.getCustomerNameMap(customerIds);
|
||||
|
||||
audioPage.getRecords().forEach(audio -> {
|
||||
audio.setDealershipName(dealershipNameMap.getOrDefault(audio.getDealershipId(), ""));
|
||||
audio.setSalesName(saleNameMap.getOrDefault(audio.getSalesId(), ""));
|
||||
audio.setProjectName(projectNameMap.getOrDefault(audio.getProjectId(), ""));
|
||||
// audio.setCustomerName(customerNameMap.getOrDefault(audio.getCustomerId(), ""));
|
||||
});
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", audioPage.getRecords());
|
||||
@@ -168,6 +195,7 @@ public class AudioManagementController {
|
||||
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("查询异常:{}", e.getMessage());
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
|
||||
Reference in New Issue
Block a user