添加生成的内容历史记录、抽象实现类共用方法
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
package com.gxwebsoft.ai.controller;
|
||||
|
||||
import com.gxwebsoft.ai.entity.AiHistory;
|
||||
import com.gxwebsoft.ai.param.AiHistoryParam;
|
||||
import com.gxwebsoft.ai.service.AiHistoryService;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AI审计历史记录表控制器
|
||||
*
|
||||
* @author yc
|
||||
*/
|
||||
@Tag(name = "AI审计历史记录表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/ai/history")
|
||||
public class AiHistoryController extends BaseController {
|
||||
@Resource
|
||||
private AiHistoryService aiHistoryService;
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:list')")
|
||||
@Operation(summary = "分页查询AI审计历史记录表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<AiHistory>> page(AiHistoryParam param) {
|
||||
// 使用关联查询
|
||||
return success(aiHistoryService.pageRel(param));
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:list')")
|
||||
@Operation(summary = "查询全部AI审计历史记录表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<AiHistory>> list(AiHistoryParam param) {
|
||||
// 使用关联查询
|
||||
return success(aiHistoryService.listRel(param));
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:list')")
|
||||
@Operation(summary = "根据id查询AI审计历史记录表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<AiHistory> get(@PathVariable("id") Long id) {
|
||||
// 使用关联查询
|
||||
return success(aiHistoryService.getByIdRel(id));
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:save')")
|
||||
@Operation(summary = "添加AI审计历史记录表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody AiHistory aiHistory) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
aiHistory.setUserId(loginUser.getUserId());
|
||||
aiHistory.setUsername(loginUser.getUsername());
|
||||
}
|
||||
if (aiHistoryService.save(aiHistory)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:update')")
|
||||
@Operation(summary = "修改AI审计历史记录表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody AiHistory aiHistory) {
|
||||
if (aiHistoryService.updateById(aiHistory)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:remove')")
|
||||
@Operation(summary = "删除AI审计历史记录表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Long id) {
|
||||
if (aiHistoryService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:save')")
|
||||
@Operation(summary = "批量添加AI审计历史记录表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<AiHistory> list) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
for (AiHistory history : list) {
|
||||
history.setUserId(loginUser.getUserId());
|
||||
history.setUsername(loginUser.getUsername());
|
||||
}
|
||||
}
|
||||
if (aiHistoryService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:update')")
|
||||
@Operation(summary = "批量修改AI审计历史记录表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<AiHistory> batchParam) {
|
||||
if (batchParam.update(aiHistoryService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
//@PreAuthorize("hasAuthority('ai:aiHistory:remove')")
|
||||
@Operation(summary = "批量删除AI审计历史记录表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Long> ids) {
|
||||
if (aiHistoryService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.gxwebsoft.ai.dto.export.TripleOneExportEntity;
|
||||
import com.gxwebsoft.ai.dto.export.DecisionTableExportEntity;
|
||||
import com.gxwebsoft.ai.entity.AiCloudDoc;
|
||||
import com.gxwebsoft.ai.entity.AiCloudFile;
|
||||
import com.gxwebsoft.ai.service.AiHistoryService;
|
||||
import com.gxwebsoft.ai.utils.ExcelExportTool;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
@@ -24,9 +25,12 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -56,48 +60,23 @@ public class AuditContent3Controller extends BaseController {
|
||||
@Autowired
|
||||
private PwlProjectLibraryService pwlProjectLibraryService;
|
||||
|
||||
@Autowired
|
||||
private AiHistoryService aiHistoryService;
|
||||
|
||||
// 历史记录有效期(分钟)
|
||||
private static final int HISTORY_EXPIRE_MINUTES = 10;
|
||||
|
||||
/**
|
||||
* 生成三重一大制度对比分析表数据
|
||||
*/
|
||||
@Operation(summary = "生成三重一大制度对比分析表")
|
||||
@PostMapping("/generateTripleOneTable")
|
||||
public ApiResult<?> generateTripleOneTable(@RequestBody AuditContentRequest request) {
|
||||
final User loginUser = getLoginUser();
|
||||
String kbIdTmp = "";
|
||||
String libraryKbIds = "";
|
||||
|
||||
try {
|
||||
// 创建临时知识库(如果需要)
|
||||
if (!request.getDocList().isEmpty() || !request.getFileList().isEmpty()) {
|
||||
kbIdTmp = createTempKnowledgeBase(request);
|
||||
}
|
||||
|
||||
// 提前查询项目库信息
|
||||
if (StrUtil.isNotBlank(request.getLibraryIds())) {
|
||||
List<String> idList = StrUtil.split(request.getLibraryIds(), ',');
|
||||
List<PwlProjectLibrary> ret = pwlProjectLibraryService.list(
|
||||
new LambdaQueryWrapper<PwlProjectLibrary>().in(PwlProjectLibrary::getId, idList));
|
||||
libraryKbIds = ret.stream().map(PwlProjectLibrary::getKbId).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
// 生成三重一大制度对比分析表数据
|
||||
String knowledgeBaseId = StrUtil.isNotBlank(kbIdTmp) ? kbIdTmp : request.getKbIds();
|
||||
JSONObject result = auditContent3TripleService.generateTripleOneTableData(
|
||||
knowledgeBaseId,
|
||||
libraryKbIds,
|
||||
request.getProjectLibrary(),
|
||||
loginUser.getUsername(),
|
||||
request.getHistory(),
|
||||
request.getSuggestion()
|
||||
);
|
||||
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
log.error("生成三重一大制度对比分析表失败", e);
|
||||
return fail("生成三重一大制度对比分析表失败: " + e.getMessage());
|
||||
} finally {
|
||||
cleanupTempKnowledgeBase(kbIdTmp);
|
||||
}
|
||||
public ApiResult<?> generateTripleOneTable(@RequestBody AuditContentRequest request, HttpServletRequest servletRequest) {
|
||||
return generateTableData(request, servletRequest.getRequestURI(),
|
||||
(params) -> auditContent3TripleService.generateTripleOneTableData(
|
||||
params.knowledgeBaseId, params.libraryKbIds, params.projectLibrary,
|
||||
params.username, params.history, params.suggestion
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,69 +84,134 @@ public class AuditContent3Controller extends BaseController {
|
||||
*/
|
||||
@Operation(summary = "生成重大经济决策调查表")
|
||||
@PostMapping("/generateDecisionTable")
|
||||
public ApiResult<?> generateDecisionTable(@RequestBody AuditContentRequest request) {
|
||||
public ApiResult<?> generateDecisionTable(@RequestBody AuditContentRequest request, HttpServletRequest servletRequest) {
|
||||
return generateTableData(request, servletRequest.getRequestURI(),
|
||||
(params) -> auditContent3DecisionService.generateDecisionTableData(
|
||||
params.knowledgeBaseId, params.libraryKbIds, params.projectLibrary,
|
||||
params.username, params.history, params.suggestion, request.getData()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用的表格数据生成方法
|
||||
*/
|
||||
private ApiResult<?> generateTableData(AuditContentRequest request, String interfaceName, Function<GenerateParams, JSONObject> generateFunction) {
|
||||
final User loginUser = getLoginUser();
|
||||
String requestHistory = request.getHistory();
|
||||
request.setHistory("");
|
||||
|
||||
// 检查历史记录
|
||||
String requestHash = generateRequestHash(request, interfaceName);
|
||||
var history = aiHistoryService.getValidHistory(requestHash, interfaceName, HISTORY_EXPIRE_MINUTES);
|
||||
if (history != null) {
|
||||
log.info("返回历史数据,请求哈希: {}", requestHash);
|
||||
return success(JSONObject.parseObject(history.getResponseData()));
|
||||
}
|
||||
request.setHistory(requestHistory);
|
||||
|
||||
String kbIdTmp = "";
|
||||
String libraryKbIds = "";
|
||||
|
||||
try {
|
||||
// 创建临时知识库(如果需要)
|
||||
if (!request.getDocList().isEmpty() || !request.getFileList().isEmpty()) {
|
||||
if (hasUploadedFiles(request)) {
|
||||
kbIdTmp = createTempKnowledgeBase(request);
|
||||
}
|
||||
|
||||
// 生成重大经济决策调查表数据
|
||||
String knowledgeBaseId = StrUtil.isNotBlank(kbIdTmp) ? kbIdTmp : request.getKbIds();
|
||||
JSONObject result = auditContent3DecisionService.generateDecisionTableData(
|
||||
knowledgeBaseId,
|
||||
request.getLibraryIds(),
|
||||
request.getProjectLibrary(),
|
||||
loginUser.getUsername(),
|
||||
request.getHistory(),
|
||||
request.getSuggestion(),
|
||||
request.getData()
|
||||
);
|
||||
// 查询项目库信息
|
||||
libraryKbIds = getLibraryKbIds(request.getLibraryIds());
|
||||
|
||||
// 生成数据
|
||||
String knowledgeBaseId = getKnowledgeBaseId(kbIdTmp, request.getKbIds());
|
||||
GenerateParams params = new GenerateParams(knowledgeBaseId, libraryKbIds, request.getProjectLibrary(), loginUser.getUsername(), request.getHistory(), request.getSuggestion());
|
||||
|
||||
JSONObject result = generateFunction.apply(params);
|
||||
|
||||
// 保存到历史记录
|
||||
saveToHistory(request, interfaceName, requestHash, result, loginUser);
|
||||
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
log.error("生成重大经济决策调查表失败", e);
|
||||
return fail("生成重大经济决策调查表失败: " + e.getMessage());
|
||||
log.error("生成表格数据失败,接口: {}", interfaceName, e);
|
||||
return fail("生成表格数据失败: " + e.getMessage());
|
||||
} finally {
|
||||
cleanupTempKnowledgeBase(kbIdTmp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成请求哈希
|
||||
*/
|
||||
private String generateRequestHash(AuditContentRequest request, String interfaceName) {
|
||||
String requestJson = JSONObject.toJSONString(request);
|
||||
return DigestUtil.md5Hex(interfaceName + ":" + requestJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存到历史记录
|
||||
*/
|
||||
private void saveToHistory(AuditContentRequest request, String interfaceName, String requestHash, JSONObject result, User loginUser) {
|
||||
try {
|
||||
aiHistoryService.saveHistory(requestHash, interfaceName, JSONObject.toJSONString(request), result.toJSONString(), loginUser.getUserId(), loginUser.getUsername(), loginUser.getTenantId());
|
||||
} catch (Exception e) {
|
||||
log.warn("保存历史记录失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否有上传的文件
|
||||
*/
|
||||
private boolean hasUploadedFiles(AuditContentRequest request) {
|
||||
return !request.getDocList().isEmpty() || !request.getFileList().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取知识库ID
|
||||
*/
|
||||
private String getKnowledgeBaseId(String tempKbId, String requestKbIds) {
|
||||
return StrUtil.isNotBlank(tempKbId) ? tempKbId : requestKbIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目库KB IDs
|
||||
*/
|
||||
private String getLibraryKbIds(String libraryIds) {
|
||||
if (StrUtil.isBlank(libraryIds)) {
|
||||
return "";
|
||||
}
|
||||
List<String> idList = StrUtil.split(libraryIds, ',');
|
||||
List<PwlProjectLibrary> ret = pwlProjectLibraryService.list(new LambdaQueryWrapper<PwlProjectLibrary>().in(PwlProjectLibrary::getId, idList));
|
||||
return ret.stream().map(PwlProjectLibrary::getKbId).filter(StrUtil::isNotBlank).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建临时知识库并提交文档
|
||||
*/
|
||||
private String createTempKnowledgeBase(AuditContentRequest request) {
|
||||
String kbIdTmp = knowledgeBaseService.createKnowledgeBaseTemp();
|
||||
|
||||
// 收集文档ID
|
||||
Set<Integer> docIds = request.getDocList().stream()
|
||||
.flatMap(docId -> aiCloudDocService.getSelfAndChildren(docId).stream())
|
||||
.map(AiCloudDoc::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<Integer> docIds = request.getDocList().stream().flatMap(docId -> aiCloudDocService.getSelfAndChildren(docId).stream()).map(AiCloudDoc::getId).collect(Collectors.toSet());
|
||||
// 查询相关文件
|
||||
LambdaQueryWrapper<AiCloudFile> queryWrapper = new LambdaQueryWrapper<AiCloudFile>()
|
||||
.in(!docIds.isEmpty(), AiCloudFile::getDocId, docIds)
|
||||
.or(!request.getFileList().isEmpty())
|
||||
.in(!request.getFileList().isEmpty(), AiCloudFile::getId, request.getFileList());
|
||||
|
||||
List<AiCloudFile> fileList = aiCloudFileService.list(queryWrapper);
|
||||
|
||||
List<AiCloudFile> fileList = getRelatedFiles(docIds, request.getFileList());
|
||||
// 提取文件ID并提交到知识库
|
||||
Set<String> kbFileIds = fileList.stream()
|
||||
.map(AiCloudFile::getFileId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<String> kbFileIds = fileList.stream().map(AiCloudFile::getFileId).collect(Collectors.toSet());
|
||||
if (!kbFileIds.isEmpty()) {
|
||||
knowledgeBaseService.submitDocuments(kbIdTmp, new ArrayList<>(kbFileIds));
|
||||
}
|
||||
|
||||
return kbIdTmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取相关文件列表
|
||||
*/
|
||||
private List<AiCloudFile> getRelatedFiles(Set<Integer> docIds, List<Integer> fileList) {
|
||||
LambdaQueryWrapper<AiCloudFile> queryWrapper = new LambdaQueryWrapper<AiCloudFile>()
|
||||
.in(!docIds.isEmpty(), AiCloudFile::getDocId, docIds)
|
||||
.or(!fileList.isEmpty())
|
||||
.in(!fileList.isEmpty(), AiCloudFile::getId, fileList);
|
||||
return aiCloudFileService.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理临时知识库
|
||||
*/
|
||||
@@ -187,17 +231,8 @@ public class AuditContent3Controller extends BaseController {
|
||||
@Operation(summary = "导出三重一大制度对比分析表到Excel")
|
||||
@PostMapping("/exportTripleOneTable")
|
||||
public void exportTripleOneTable(@RequestBody Map<String, Object> request, HttpServletResponse response) {
|
||||
List<Map<String, Object>> dataList = (List<Map<String, Object>>) request.get("data");
|
||||
String companyName = (String) request.get("companyName");
|
||||
|
||||
// 转换为实体列表
|
||||
List<TripleOneExportEntity> exportData = convertToTripleOneEntityList(dataList);
|
||||
|
||||
// 使用工具类导出
|
||||
String fileName = "三重一大制度对比分析表_" + (companyName != null ? companyName : "未知公司");
|
||||
String title = companyName != null ? companyName + " - 三重一大制度对比分析表" : "三重一大制度对比分析表";
|
||||
|
||||
ExcelExportTool.exportExcel(exportData, TripleOneExportEntity.class, fileName, "三重一大制度对比分析表", title, response);
|
||||
exportToExcel(request, response, "三重一大制度对比分析表",
|
||||
this::convertToTripleOneEntityList, TripleOneExportEntity.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,36 +241,58 @@ public class AuditContent3Controller extends BaseController {
|
||||
@Operation(summary = "导出重大经济决策调查表到Excel")
|
||||
@PostMapping("/exportDecisionTable")
|
||||
public void exportDecisionTable(@RequestBody Map<String, Object> request, HttpServletResponse response) {
|
||||
exportToExcel(request, response, "重大经济决策调查表",
|
||||
this::convertToDecisionTableEntityList, DecisionTableExportEntity.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用的Excel导出方法
|
||||
*/
|
||||
private <T> void exportToExcel(Map<String, Object> request, HttpServletResponse response,
|
||||
String sheetName, Function<List<Map<String, Object>>, List<T>> converter,
|
||||
Class<T> entityClass) {
|
||||
List<Map<String, Object>> dataList = (List<Map<String, Object>>) request.get("data");
|
||||
String companyName = (String) request.get("companyName");
|
||||
|
||||
// 转换为实体列表
|
||||
List<DecisionTableExportEntity> exportData = convertToDecisionTableEntityList(dataList);
|
||||
List<T> exportData = converter.apply(dataList);
|
||||
|
||||
// 使用工具类导出
|
||||
String fileName = "重大经济决策调查表_" + (companyName != null ? companyName : "未知公司");
|
||||
String title = companyName != null ? companyName + " - 重大经济决策调查表" : "重大经济决策调查表";
|
||||
String fileName = sheetName + "_" + (companyName != null ? companyName : "未知公司");
|
||||
String title = companyName != null ? companyName + " - " + sheetName : sheetName;
|
||||
|
||||
ExcelExportTool.exportExcel(exportData, DecisionTableExportEntity.class, fileName, "重大经济决策调查表", title, response);
|
||||
ExcelExportTool.exportExcel(exportData, entityClass, fileName, sheetName, title, response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 转换为三重一大实体列表
|
||||
* 参数包装类
|
||||
*/
|
||||
private static class GenerateParams {
|
||||
final String knowledgeBaseId;
|
||||
final String libraryKbIds;
|
||||
final String projectLibrary;
|
||||
final String username;
|
||||
final String history;
|
||||
final String suggestion;
|
||||
|
||||
GenerateParams(String knowledgeBaseId, String libraryKbIds, String projectLibrary, String username, String history, String suggestion) {
|
||||
this.knowledgeBaseId = knowledgeBaseId;
|
||||
this.libraryKbIds = libraryKbIds;
|
||||
this.projectLibrary = projectLibrary;
|
||||
this.username = username;
|
||||
this.history = history;
|
||||
this.suggestion = suggestion;
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 数据转换方法 ==========
|
||||
|
||||
private List<TripleOneExportEntity> convertToTripleOneEntityList(List<Map<String, Object>> originalData) {
|
||||
return originalData.stream().map(this::convertToTripleOneEntity).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为重大经济决策调查表实体列表
|
||||
*/
|
||||
|
||||
private List<DecisionTableExportEntity> convertToDecisionTableEntityList(List<Map<String, Object>> originalData) {
|
||||
return originalData.stream().map(this::convertToDecisionTableEntity).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个Map转换为三重一大实体
|
||||
*/
|
||||
|
||||
private TripleOneExportEntity convertToTripleOneEntity(Map<String, Object> item) {
|
||||
TripleOneExportEntity entity = new TripleOneExportEntity();
|
||||
entity.setCategory(getStringValue(item, "category"));
|
||||
@@ -247,10 +304,7 @@ public class AuditContent3Controller extends BaseController {
|
||||
entity.setWorkPaperIndex(formatWorkPaperIndex(item.get("workPaperIndex")));
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个Map转换为重大经济决策调查表实体
|
||||
*/
|
||||
|
||||
private DecisionTableExportEntity convertToDecisionTableEntity(Map<String, Object> item) {
|
||||
DecisionTableExportEntity entity = new DecisionTableExportEntity();
|
||||
entity.setIndex(getStringValue(item, "index"));
|
||||
@@ -264,18 +318,12 @@ public class AuditContent3Controller extends BaseController {
|
||||
entity.setBad(getStringValue(item, "bad"));
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全获取字符串值
|
||||
*/
|
||||
|
||||
private String getStringValue(Map<String, Object> map, String key) {
|
||||
Object value = map.get(key);
|
||||
return value != null ? value.toString() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化工作底稿索引(如果是数组则转换为字符串)
|
||||
*/
|
||||
|
||||
private String formatWorkPaperIndex(Object workPaperIndex) {
|
||||
if (workPaperIndex == null) {
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user