CategoryController
这段代码是一个 Spring MVC 的控制器类 `CategoryController`,用于处理与目录相关的请求。让我为你解释一下:
### 类:`CategoryController`
- **包**:`com.cqupt.software_1.controller`
- 该类位于 `com.cqupt.software_1` 包中的 `controller` 子包下。
### 注解:
- **`@RestController`**:
- 说明这是一个 RESTful 风格的控制器,Spring 会自动将返回的对象转换为 JSON 或 XML 格式的响应。
- **`@RequestMapping("/api")`**:
- 设置控制器的基础路由为 `/api`,即所有请求的路径都以 `/api` 开头。
### 自动装配的服务:
- **`CategoryService categoryService`**:
- 类型:`CategoryService`
- 功能:目录服务,用于处理目录相关的业务逻辑。
- **`Category2Service category2Service`**:
- 类型:`Category2Service`
- 功能:另一个目录服务,用于处理另一种目录相关的业务逻辑。
### 请求处理方法:
- **`getCatgory()`**:
- 方法类型:`GET`
- 路径:`/api/category`
- 功能:获取目录列表。
- **`getCatgory2()`**:
- 方法类型:`GET`
- 路径:`/api/category2`
- 功能:获取另一种目录列表。
- **`addDisease(CategoryEntity categoryNode)`**:
- 方法类型:`POST`
- 路径:`/api/addDisease`
- 功能:添加一种新的疾病。
- **`removeCate(CategoryEntity categoryEntity)`**:
- 方法类型:`GET`
- 路径:`/api/category/remove`
- 功能:删除一个目录。
- **`addParentDisease(String diseaseName)`**:
- 方法类型:`GET`
- 路径:`/api/addParentDisease`
- 功能:添加一个父疾病。
- **`getAllDisease()`**:
- 方法类型:`GET`
- 路径:`/api/disease/all`
- 功能:获取所有疾病的列表。
### 辅助方法:
- **`getNotLeafCat(List<CategoryEntity> category)`**:
- 功能:获取非叶子节点的目录列表。
### 目的:
- **功能**:
- 处理与目录相关的请求,包括获取目录、添加疾病、删除目录等。
- 通过各个方法实现对应的业务逻辑,如获取所有疾病列表、添加疾病等。
### 概要:
`CategoryController` 类是一个 Spring MVC 的控制器类,通过不同的请求方法处理与目录相关的请求,包括获取目录、添加疾病、删除目录等操作。同时,通过注解和自动装配,将业务逻辑与请求处理进行了分离和组织。
package com.cqupt.software_1.controller;
import com.alibaba.fastjson.JSON;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.Category2Entity;
import com.cqupt.software_1.entity.CategoryEntity;
import com.cqupt.software_1.service.Category2Service;
import com.cqupt.software_1.service.CategoryService;
import org.hibernate.event.spi.PreCollectionUpdateEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@RestController
@RequestMapping("/api")
public class CategoryController {
@Autowired
CategoryService categoryService;
@Autowired
Category2Service category2Service;
@GetMapping("/category")
public R<List<CategoryEntity>> getCatgory(){
List<CategoryEntity> list = categoryService.getCategory();
System.out.println(JSON.toJSONString(list));
return R.success("200",list);
}
@GetMapping("/category2")
public R <List<Category2Entity>> getCatgory2(){
List<Category2Entity> list = category2Service.getCategory2();
return R.success("200",list);
}
@PostMapping("/addDisease")
public R addDisease(@RequestBody CategoryEntity categoryNode){
categoryService.save(categoryNode);
return R.success(200,"新增目录成功");
}
@GetMapping("/category/remove")
public R removeCate(CategoryEntity categoryEntity){
categoryService.removeNode(categoryEntity.getId());
return R.success(200,"删除成功");
}
@GetMapping("/addParentDisease")
public R addParentDisease(@RequestParam("diseaseName") String diseaseName){
categoryService.addParentDisease(diseaseName);
return R.success("200",null);
}
@GetMapping("/disease/all")
public R getAllDisease(){
List<CategoryEntity> category = categoryService.getCategory();
List<CategoryEntity> notLeafCat = getNotLeafCat(category);
Stream<CategoryEntity> allDiseaseCat = notLeafCat.stream().filter(categoryEntity -> {
return !categoryEntity.getLabel().equals("公共数据集");
});
return R.success("200",allDiseaseCat);
}
private List<CategoryEntity> getNotLeafCat(List<CategoryEntity> category){
List<CategoryEntity> level1 = category.stream().filter(categoryEntity -> {
return categoryEntity.getIsLeafs()!=1;
}).collect(Collectors.toList());
for (CategoryEntity categoryEntity : level1) {
List<CategoryEntity> children = categoryEntity.getChildren();
if(children!=null && children.size()>0){
categoryEntity.setChildren(getNotLeafCat(children));
}
}
return level1;
}
}
DataTableManagerController
这段代码是一个用于处理数据表管理请求的Spring Boot后端控制器。它通过注解引入了需要的服务和映射器,包括 `DataTableManagerService`、`FileService`、`DataTableManagerMapper` 和 `TableManagerService`。接下来,定义了几个接口:
1. `/DataTable/upall`:调用 `upalldata` 方法获取表管理表中的所有信息并返回给前端。
2. `/DataTable/inspection`:根据传入的表名参数检查该表名是否已被使用。如果已被使用,则返回 `false`,表示表名重复,否则返回 `true`,表示表名可用。
3. `/DataTable/upload`:处理文件上传请求,接收上传的文件、新文件名和疾病名,并调用 `fileUpload` 方法进行文件上传处理。最后返回上传结果,包括上传状态码和可能的错误信息。
4. `/DataTable/getTableData`:根据传入的表ID和表名参数获取对应表格的数据,并以JSON格式返回给前端。
接下来是每个函数的详细解释:
1. `upall()` 函数:
- 功能:获取表管理表中的所有信息。
- 返回值:返回一个包含所有表信息的列表。
2. `test_name(String name)` 函数:
- 功能:检查传入的表名是否已被使用。
- 参数:name - 要检查的表名。
- 返回值:如果表名已被使用,则返回 `false`,否则返回 `true`。
3. `uploadFile(MultipartFile file, String newName, String disease)` 函数:
- 功能:处理文件上传请求。
- 参数:
- file - 要上传的文件。
- newName - 新文件名。
- disease - 疾病名。
- 返回值:返回一个包含上传结果的对象,包括上传状态码和可能的错误信息。
4. `getTableData(String tableId, String tableName)` 函数:
- 功能:根据传入的表ID和表名获取对应表格的数据。
- 参数:
- tableId - 表ID。
- tableName - 表名。
- 返回值:返回一个包含表格数据的列表,以JSON格式返回给前端。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.DataTable;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.common.UploadResult;
import com.cqupt.software_1.mapper.DataTableManagerMapper;
import com.cqupt.software_1.service.DataTableManagerService;
import com.cqupt.software_1.service.FileService;
import com.cqupt.software_1.service.TableManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/DataTable")
public class DataTableManagerController {
@Autowired
private DataTableManagerService dataTableManagerService;
@Autowired
private FileService fileService;
@Resource
private DataTableManagerMapper dataTableManagerMapper;
@Autowired
private TableManagerService tableManagerService;
public DataTableManagerController(DataTableManagerService dataTableManagerService, FileService fileService, TableManagerService tableManagerService) {
this.dataTableManagerService = dataTableManagerService;
this.fileService = fileService;
this.tableManagerService = tableManagerService;
}
@GetMapping("/upall")
public List<DataTable> upall() {
return dataTableManagerService.upalldata();
}
@GetMapping("/inspection")
public boolean test_name(String name){
List<String> usedTableNames = dataTableManagerService.upname();
if (usedTableNames.contains(name)) {
return false;
}else{
return true;
}
}
@PostMapping("/upload")
public UploadResult uploadFile(@RequestPart("file") MultipartFile file, @RequestParam("newName") String newName, @RequestParam("disease") String disease) {
try {
return fileService.fileUpload(file, newName,disease);
} catch (Exception e) {
UploadResult res =new UploadResult();
res.setCode(500);
System.out.println("错误信息: " + e);
res.setE(e);
return res;
}
}
@GetMapping("/getTableData")
public R getTableData(@RequestParam("tableId") String tableId, @RequestParam("tableName") String tableName){
System.out.println("tableId=="+tableId+" tableName=="+tableName);
List<Map<String, Object>> tableData = dataTableManagerService.getTableData(tableId, tableName);
return R.success("100",tableData);
}
}
FeatureController
这段代码是一个Spring Boot的REST控制器(RestController),它定义了一些端点(endpoints)来处理关于特征(feature)的请求。让我逐一解释:
1. `getAllFiled/{tableName}`端点:根据表名获取属性列。它从数据库中获取特征列表,并将其按特定条件(这里是数据类型为整数或双精度)放入一个HashMap中,然后返回包含这个HashMap的成功响应对象。
2. `getAllFiled2/{tableName}`端点:根据表名获取属性。它通过调用服务层的方法从数据库中获取表的字段名,然后根据字段名获取每个字段的详细信息,并将结果放入一个HashMap中返回。
3. `getInfoByTableName`端点:根据表名获取前1000行信息。它使用了分页功能(PageHelper)来获取指定表的信息,并返回结果列表以及分页信息。
1. `getInfoBySelectedFiled`:根据选择的字段获取前1000行信息的接口。接收参数包括页码(`page`)、表名(`tableName`)以及字段参数(`params`)。通过调用`pageService`中的方法实现分页查询,并返回结果和分页信息。
2. `getStatisticaldData`:统计每一个字段的缺失率、均值和方差的接口。接收表名(`tableName`)作为路径参数。通过调用`pageService`中的方法查询数据,并对每个字段进行统计计算,最终返回各项指标的统计结果。
3. `runAi`:执行AI算法的接口,使用POST请求方式。接收`RunPyEntity`对象作为请求体,其中包含了算法名称(`aiName`)和运行参数(`runParams`)等信息。将参数转换为JSON格式后发送POST请求到指定的算法服务地址,并返回运行结果。
4. `getstatisticsByFiled`:根据给定的列参数计算各项指标的接口。接收字段数组(`fileds`)和表名(`tableName`)作为参数,调用`statisticaldService`中的方法计算指标,并返回结果。
5. `getBarCoordinates`:获取柱状图坐标数据的接口。接收表名(`tableName`)和字段名(`field`)作为参数,通过调用`tableManagerService`和`dataService`中的方法获取柱状图的坐标数据,并返回结果。
这些接口主要用于数据处理、统计分析以及调用AI算法等功能,是一个后端服务的核心逻辑部分。
package com.cqupt.software_1.controller;
import com.alibaba.fastjson.JSON;
import com.cqupt.software_1.Util.FieldStats;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.common.RunPyEntity;
import com.cqupt.software_1.common.RunPyR;
import com.cqupt.software_1.entity.BarCoordinate;
import com.cqupt.software_1.entity.FieldManagementEntity;
import com.cqupt.software_1.entity.TableManager;
import com.cqupt.software_1.service.*;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.*;
@RestController
@RequestMapping("/feature")
public class FeatureController {
@Autowired
private TableManagerService tableManagerService;
@Autowired
private PageService pageService;
@Autowired
private DataService dataService;
@Autowired
FieldManagementService fieldManagementService;
@Autowired
private StatisticaldService statisticaldService;
@Value("${pyPath}")
private String pyPath;
@GetMapping("/getAllFiled/{tableName}")
public R<Map<String,FieldManagementEntity>> getFiledByTableName(@PathVariable("tableName")String tableName){
HashMap<String, FieldManagementEntity> tableMap = new HashMap<>();
List<FieldManagementEntity> featureList = fieldManagementService.list(null);
for (FieldManagementEntity feature : featureList) {
if("integer".equals(feature.getUnit()) || "double precision".equals(feature.getUnit())) tableMap.put(feature.getFeatureName(),feature);
}
return new R<>(200,"成功",tableMap);
}
@GetMapping("/getAllFiled2/{tableName}")
public R<Map<String, TableManager>> getFiledBYld(@PathVariable("tableName")String tableName) {
List<String> tableNames = tableManagerService.getFiledByTableName(tableName);
System.out.println("属性名字" + tableNames);
List<TableManager> tableManagers = tableManagerService.getAllTableManagersByFiledName(tableNames, tableName);
Map<String, TableManager> tableMap = new HashMap<>();
for (int i = 0 ; i< tableNames.size() ; i++){
String filedName = tableNames.get(i);
TableManager tableManager = tableManagers.get(i);
tableMap.put(filedName, tableManager);
}
return new R<>(200,"成功",tableMap);
}
@GetMapping("/getInfoByTableName")
public R<List<Map<String,Object>>> getInfoByTableName( String tableName, int page ){
PageHelper.startPage(page, 10);
List<Map<String,Object>> res = pageService.getInfoByTableName(tableName);
PageInfo pageInfo = new PageInfo(res);
return new R<>(200,"成功",res,pageInfo.getPages());
}
@GetMapping("/getInfoBySelectedFiled")
public R<List<Map<String,Object>>> getInfoBySelectedFiled(int page, String tableName,@RequestParam("params") String[] params){
PageHelper.startPage(page, 10);
List<Map<String,Object>> res = pageService.getInfoBySelectedFiled(tableName,params);
PageInfo pageInfo = new PageInfo(res);
return new R<>(200,"成功",res,pageInfo.getPages());
}
@GetMapping("/getStatisticaldData/{tableName}")
public R<Map<String, Object>> getStatisticaldData(@PathVariable String tableName){
List<Map<String, Object>> dataList = pageService.getInfoByTableName(tableName);
Map<String, Integer> missingCountMap = new HashMap<>();
Map<String, Double> sumMap = new HashMap<>();
Map<String, Double> squaredSumMap = new HashMap<>();
int totalRecords = dataList.size();
for (Map<String, Object> data : dataList) {
for (String fieldName : data.keySet()) {
Object value = data.get(fieldName);
if (value == null) {
missingCountMap.put(fieldName, missingCountMap.getOrDefault(fieldName, 0) + 1);
} else if (value instanceof Number) {
double fieldValue = ((Number) value).doubleValue();
sumMap.put(fieldName, sumMap.getOrDefault(fieldName, 0.0) + fieldValue);
squaredSumMap.put(fieldName, squaredSumMap.getOrDefault(fieldName, 0.0) + fieldValue * fieldValue);
}
}
}
Map<String, Object> fieldStatsMap = new HashMap<>();
for (String fieldName : dataList.get(0).keySet()) {
int missingCount = missingCountMap.getOrDefault(fieldName, 0);
double missingRate = (double) missingCount / totalRecords * 100;
double mean = sumMap.getOrDefault(fieldName, 0.0) / (totalRecords - missingCount);
double variance = squaredSumMap.getOrDefault(fieldName, 0.0) / (totalRecords - missingCount) - mean * mean;
FieldStats fieldStats = new FieldStats(missingRate, mean, variance);
fieldStatsMap.put(fieldName, fieldStats);
}
return new R<>(200,"成功",fieldStatsMap);
}
@PostMapping("/runAi")
public RunPyR runAi(@RequestBody RunPyEntity runPyEntity) throws URISyntaxException, IOException {
System.out.println("RunPyEntit"+JSON.toJSONString(runPyEntity));
String baseUri = "http://localhost:5000/";
URI uri = new URI(baseUri+runPyEntity.getAiName());
HttpPost httpPost = new HttpPost(uri);
HttpClient httpClient = HttpClients.createDefault();
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(runPyEntity);
httpPost.setEntity(new StringEntity(json, StandardCharsets.UTF_8));
httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8");
HttpResponse response = httpClient.execute(httpPost);
String responseBody = EntityUtils.toString(response.getEntity());
JsonNode jsonNode = objectMapper.readValue(responseBody,JsonNode.class);
return new RunPyR<>(200,"成功",jsonNode);
}
@GetMapping("/getstatisticsByFiled")
public R<List<Map<String,Object>>> getstatisticsByFiled(String[] fileds, String tableName){
List<Map<String ,Object>> res = statisticaldService.getStatisticaldDataByFiled(fileds,tableName);
return new R<>(200,"成功",res);
}
@GetMapping("/getBarCoordinates")
public R getBarCoordinate(String tableName,String field){
System.out.println("表名:"+tableName+"field:"+field);
List<String> tableNames = tableManagerService.getFiledByTableName(tableName);
ArrayList<BarCoordinate> barCoordinates = dataService.getBarCoordinates(tableName,field);
System.out.println("坐标数据为:"+barCoordinates);
return new R<List<BarCoordinate>>(200,"成功",barCoordinates);
}
}
FeatureControllerPublic
这段代码是一个基于Spring框架的Java项目的控制器类。它定义了一个名为`FeatureControllerPublic`的RESTful API控制器,用于管理特征数据。下面是对代码的详细介绍:
1. `FeatureControllerPublic`类是一个REST控制器,通过`@RestController`注解标识。它处理HTTP请求,并返回相应的数据。
2. `@RequestMapping("/api/feature")`注解指定了控制器处理请求的基本URL路径为"/api/feature"。
3. `@Autowired`注解用于自动装配`FeatureManageService`的实例,该服务用于处理特征数据的业务逻辑。
4. `getFeture`方法是一个GET请求处理方法,用于获取特征数据。它接收一个`belongType`参数,表示特征所属的类型,然后根据该类型获取特征列表,并以JSON格式返回。
5. `insertFeature`方法是一个POST请求处理方法,用于上传特征分类结果。它接收一个`FeatureListVo`对象作为请求体,然后将该对象转换为JSON字符串打印输出,并调用`featureManageService.insertFeatures`方法进行特征数据的插入操作。
整体来说,这段代码实现了一个简单的特征管理功能,包括获取特征列表和上传特征分类结果。
package com.cqupt.software_1.controller;
import com.alibaba.fastjson.JSON;
import com.cqupt.software_1.common.FeatureType;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.FeatureEntity;
import com.cqupt.software_1.service.FeatureManageService;
import com.cqupt.software_1.vo.FeatureListVo;
import com.cqupt.software_1.vo.FeatureVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/feature")
public class FeatureControllerPublic {
@Autowired
FeatureManageService featureManageService;
@GetMapping("/getFeatures")
public R<FeatureEntity> getFeture(@RequestParam("index") Integer belongType){
String type = null;
for (FeatureType value : FeatureType.values()) {
if(value.getCode() == belongType){
type = value.getName();
}
}
List<FeatureVo> list = featureManageService.getFeatureList(type);
return R.success("200",list);
}
@PostMapping("/insertFeature")
public R fieldInsert(@RequestBody FeatureListVo featureListVo){
System.out.println("tableHeaders:"+ JSON.toJSONString(featureListVo));
featureManageService.insertFeatures(featureListVo);
return null;
}
}
FieldManagementController
这段代码是一个基于Spring框架的Java项目的控制器类,名为`FieldManagementController`。让我们逐一详细介绍每个函数和接口:
1. `FieldManagementController`类是一个REST控制器,通过`@RestController`注解标识。它处理HTTP请求,并返回相应的数据。
2. `@RequestMapping("/api/filed")`注解指定了控制器处理请求的基本URL路径为"/api/filed"。
3. `@Autowired`注解用于自动装配`FieldManagementService`的实例,该服务处理字段管理相关的业务逻辑。
4. `getAllFiled`方法是一个POST请求处理方法,用于根据疾病名称获取字段信息表。它接收一个`QueryFiledVO`对象作为请求体,打印输出疾病名称并调用`fieldManagementService.getFiledByDiseaseName`方法获取相应的字段信息表,最终以`R.success`形式返回。
5. `updateFiled`方法是一个POST请求处理方法,用于根据动态选择更新字段表。它接收一个`UpdateFiledVO`对象作为请求体,提取疾病名称和字段列表,然后调用`fieldManagementService.updateFieldsByDiseaseName`方法来更新字段表信息,并最终以`R.success`形式返回。
总体来说,这段代码实现了根据疾病名称展示字段信息以及根据动态选择更新字段表的功能。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.FieldManagementEntity;
import com.cqupt.software_1.service.FieldManagementService;
import com.cqupt.software_1.vo.QueryFiledVO;
import com.cqupt.software_1.vo.UpdateFiledVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/filed")
public class FieldManagementController {
@Autowired
FieldManagementService fieldManagementService;
@PostMapping("/getAllFiled")
public R getAllFiled(@RequestBody QueryFiledVO queryFiledVO){
System.out.println(queryFiledVO.getDiseaseName());
List<FieldManagementEntity> res = fieldManagementService.getFiledByDiseaseName(queryFiledVO.getDiseaseName());
return R.success(res);
}
@PostMapping("/updateFiled")
public R updateFiled(@RequestBody UpdateFiledVO updateFiledVO){
String diseaseName = updateFiledVO.getDiseaseName();
List<String> fields = updateFiledVO.getFileds();
fieldManagementService.updateFieldsByDiseaseName(diseaseName, fields);
return R.success(null);
}
}
FileController
这段代码是另一个基于Spring框架的Java项目的控制器类,名为`FileController`。让我们逐一详细介绍每个函数和接口:
1. `FileController`类同样是一个REST控制器,通过`@RestController`注解标识。它处理HTTP请求,并返回相应的数据。
2. `@RequestMapping("/file")`注解指定了控制器处理请求的基本URL路径为"/file"。
3. `@Autowired`注解用于自动装配`FileService`、`ResourceLoader`、`ServletContext`、`TableService`以及`RemoteConfig`的实例,这些服务和配置都在控制器中被使用。
4. `uploadFile`方法是一个POST请求处理方法,用于处理文件上传功能。它接收一个`MultipartFile`类型的文件,并通过JSch库连接到远程服务器,创建SFTP通道,将文件上传到远程服务器指定的路径,然后关闭SFTP通道和会话。接着,将上传的文件导入到MySQL数据库中,并更新相关的表信息,最终以`R`对象形式返回上传结果。
总体来说,这段代码实现了文件上传到远程服务器并导入到MySQL数据库的功能,并在上传完成后更新相关表信息。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.ExecState;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.config.RemoteConfig;
import com.cqupt.software_1.service.FileService;
import com.cqupt.software_1.service.TableService;
import com.jcraft.jsch.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ResourceLoader;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletContext;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@RestController
@RequestMapping("/file")
public class FileController {
@Autowired
private FileService fileService;
@Autowired
private ResourceLoader resourceLoader;
@Autowired
private ServletContext servletContext;
@Autowired
private TableService tableService;
@Autowired
private RemoteConfig remoteConfig;
@PostMapping("/upload")
public R uploadFile(@RequestParam("file") MultipartFile file) throws IOException, JSchException, SftpException {
JSch jsch = new JSch();
Session session = jsch.getSession(remoteConfig.getRemoteUsername(), remoteConfig.getRemoteHost(), remoteConfig.getRemotePort());
session.setConfig("StrictHostKeyChecking", "no");
session.setPassword(remoteConfig.getRemotePassword());
session.connect();
ChannelSftp channel = (ChannelSftp) session.openChannel("sftp");
channel.connect();
String remotePath = remoteConfig.getRemoteFilePath() + file.getOriginalFilename();
channel.put(file.getInputStream(), remotePath);
channel.disconnect();
session.disconnect();
String tableName = file.getOriginalFilename();
tableService.saveCSV2MySQL(remotePath,tableName.substring(0, tableName.indexOf(".")));
System.out.println("上传文件。。。。。。。。。。。。。");
tableService.insertTableInfo(tableName);
return new R<>(200 , "成功" , ExecState.SUCCESS);
}
}
FiledManagerController
这段代码是一个基于Spring框架的Java后端控制器类,用于字段管理工具的实现。让我逐个介绍:
1. `FiledManagerController` 类是一个RESTful风格的控制器,负责处理字段管理相关的HTTP请求。
2. `queryTableManger` 方法使用`@GetMapping`注解来处理GET请求,路径为`/filedManager/queryTableManager`。它用于查询所有字段信息,并支持分页功能。
3. `updateFiled` 方法使用`@PostMapping`注解处理POST请求,路径为`/filedManager/updateFiled`。该方法用于更新字段信息,接收一个TableManager对象作为请求体参数。
4. `delFiled` 方法也是用`@PostMapping`注解处理POST请求,路径为`/filedManager/delFiled`。用于删除字段信息,同样接收一个TableManager对象作为请求体参数。
这些方法中都包含对操作的记录,通过`UserLogService`来保存用户的操作日志,记录用户的操作类型和操作时间。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.FieldManagementEntity;
import com.cqupt.software_1.entity.TableManager;
import com.cqupt.software_1.entity.UserLog;
import com.cqupt.software_1.mapper.DataTableManagerMapper;
import com.cqupt.software_1.service.FieldManagementService;
import com.cqupt.software_1.service.TableManagerService;
import com.cqupt.software_1.service.UserLogService;
import com.cqupt.software_1.vo.QueryFiledVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/filedManager")
public class FiledManagerController {
@Autowired
private TableManagerService tableManagerService;
@Autowired
private UserLogService userLogService;
@Resource
private DataTableManagerMapper dataTableManagerMapper;
@GetMapping("/queryTableManager")
public R<List<TableManager>> queryTableManger(int pageNum,HttpServletRequest request){
PageHelper.startPage(pageNum,15);
Integer userId = (Integer) request.getSession().getAttribute("userId");
List<TableManager> allData = tableManagerService.getAllDataByUserId(userId);
PageInfo pageInfo = new PageInfo<>(allData);
return new R<>(200,"成功",allData,pageInfo.getPages());
}
@PostMapping("/updateFiled")
public R updateFiled(@RequestBody TableManager tableManager,HttpServletRequest request){
tableManagerService.updateById(tableManager);
Integer userId = (Integer) request.getSession().getAttribute("userId");
UserLog userLog = new UserLog();
userLog.setUid(userId);
userLog.setOpTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
userLog.setOpType("更新字段: "+ tableManager.getFieldName());
userLogService.save(userLog);
return new R<>(200,"成功",null);
}
@PostMapping("/delFiled")
public R delFiled(@RequestBody TableManager tableManager, HttpServletRequest request){
Integer userId = (Integer) request.getSession().getAttribute("userId");
UserLog userLog = new UserLog();
userLog.setUid(userId);
userLog.setOpTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
userLog.setOpType("删除字段: "+ tableManager.getFieldName());
userLogService.save(userLog);
boolean b = tableManagerService.removeById(tableManager.getId());
if (b == true){
return new R<>(200,"删除成功",null);
}
return new R<>(500,"删除失败",null);
}
}
IndexController
这段代码是一个基于Spring框架的Java后端控制器(Controller)。它包含了一系列的HTTP请求处理方法,主要用于处理前端页面的请求并返回相应的数据或页面。让我逐个介绍:
1. `getAllData()` 方法:
- 通过GET请求获取所有表的信息。
- 调用 `tableManagerService` 的 `getAllData()` 方法获取所有表的数据。
- 对表数据进行去重操作,确保每个表只出现一次。
- 返回包含表信息的 `R` 对象,其中包含状态码、消息和表信息列表。
2. `getAllData2()` 方法:
- 通过GET请求获取所有表的描述信息。
- 调用 `tableDescribeService` 的 `list()` 方法获取所有表的描述信息。
- 对表描述信息进行去重操作,确保每个表描述只出现一次。
- 返回包含表描述信息的 `R` 对象,其中包含状态码、消息和表描述信息列表。
3. `getStatisticaldData()` 方法:
- 通过GET请求获取数据的统计信息,包括数据总量、指标总量、总体缺失率和总体有效率。
- 调用 `statisticaldService` 的 `getStatisticaldData()` 方法获取统计信息。
- 返回包含统计信息的 `R` 对象,其中包含状态码、消息和统计信息。
4. `showTableTrend()` 方法:
- 通过GET请求获取最近7天内数据表的趋势。
- 计算前7天的日期,并遍历每一天。
- 调用 `statisticaldService` 的 `showTableTrend()` 方法获取每天的数据表总量。
- 返回包含每天数据表数量的 `R` 对象,其中包含状态码、消息和日期-表数量的映射。
5. `getUserInfo()` 方法:
- 通过GET请求获取用户信息。
- 从HTTP请求中获取会话(Session)对象,从中获取用户名。
- 返回包含用户名的 `R` 对象,其中包含状态码、消息和用户名。
这些方法中,大部分都是通过GET请求获取数据,并且返回数据封装在 `R` 对象中,其中包含状态码、消息和相应的数据。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.TableDescribeEntity;
import com.cqupt.software_1.entity.TableManager;
import com.cqupt.software_1.service.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/index")
public class IndexController {
@Autowired
private CardioTrainService cardioTrainService;
@Autowired
private UserService userService;
@Autowired
private TableManagerService tableManagerService;
@Autowired
private StatisticaldService statisticaldService;
@Autowired
private TableDescribeService tableDescribeService;
@GetMapping("/getAllData")
public R<List<TableManager>> getAllData(){
List<TableManager> tableList = tableManagerService.getAllData();
System.err.println("是否是空值:"+tableList);
tableList = tableList.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(
()-> new TreeSet<>(
Comparator.comparing(TableManager::getTableName)
)
), ArrayList::new
));
return new R<>(200,"成功",tableList);
}
@GetMapping("/getAllData2")
public R<List<TableDescribeEntity>> getAllData2(){
List<TableDescribeEntity> tableList = tableDescribeService.list();
System.err.println("是否是空值:"+tableList);
tableList = tableList.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(
()-> new TreeSet<>(
Comparator.comparing(TableDescribeEntity::getTableName)
)
), ArrayList::new
));
return new R<>(200,"成功",tableList);
}
@GetMapping("/getStatisticaldData")
public R<Map<String ,Object>> getStatisticaldData(){
Map<String,Object> res = statisticaldService.getStatisticaldData();
return new R<>(200,"成功",res);
}
@GetMapping("/showTableTrend")
public R<Map<String, Integer>> showTableTrend(){
int previousDays = 7 ;
LocalDate currentDate = LocalDate.now();
Map<String , Integer> res = new HashMap<>();
for (int i = 0; i < previousDays; i++) {
LocalDate minusDays = currentDate.minusDays(i);
int tableNum = statisticaldService.showTableTrend(minusDays);
res.put(minusDays.toString(), tableNum);
}
return new R<>(200, "成功", res);
}
@GetMapping("/getUserInfo")
public R getUserInfo(HttpServletRequest request){
HttpSession session = request.getSession();
String username = (String) session.getAttribute("username");
return new R<>(200,"获取用户信息成功",username);
}
}
IndicatorController
这段代码是一个 Spring Boot 应用中的控制器类。它位于 `com.cqupt.software_1.controller` 包中。该类名为 `IndicatorController`,标注了 `@RestController` 和 `@RequestMapping("/api")` 注解,表明它是一个 RESTful 风格的控制器,并且处理 `/api` 路径下的请求。
- `@Autowired private IndicatorService indicatorService;`:使用 Spring 的依赖注入,将 `IndicatorService` 注入到控制器中,以便在控制器中调用服务层方法。
- `@GetMapping("/indicatorCategory")`:标注了 `@GetMapping` 注解,表示处理 GET 请求,并且处理路径为 `/api/indicatorCategory` 的请求。
- `public R<List<IndicatorCategory>> getIndicatorCategory()`:这是处理 GET 请求的方法,返回类型为 `R<List<IndicatorCategory>>`,其中 `R` 是一个自定义的响应类,用于封装请求的结果。该方法名称为 `getIndicatorCategory`。
- `List<IndicatorCategory> list = indicatorService.getIndicatorCattegory();`:调用 `indicatorService` 的 `getIndicatorCattegory()` 方法,获取指标分类列表。
- `return R.success("200",list);`:将获取到的指标分类列表封装到成功的响应中,状态码为 200。
整体来说,这个控制器类的作用是处理 `/api/indicatorCategory` 的 GET 请求,并调用服务层方法获取指标分类列表,然后将其封装到响应中返回。
package com.cqupt.software_1.controller;
import com.alibaba.fastjson.JSON;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.IndicatorCategory;
import com.cqupt.software_1.service.IndicatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api")
public class IndicatorController {
@Autowired
private IndicatorService indicatorService;
@GetMapping("/indicatorCategory")
public R<List<IndicatorCategory>> getIndicatorCategory(){
List<IndicatorCategory> list = indicatorService.getIndicatorCattegory();
return R.success("200",list);
}
}
IndicatorManagementController
这段代码也是一个 Spring Boot 应用中的控制器类,位于 `com.cqupt.software_1.controller` 包中。该类名为 `IndicatorManagementController`,同样标注了 `@RestController` 和 `@RequestMapping("/api")` 注解,表明它也是一个 RESTful 风格的控制器,并且处理 `/api` 路径下的请求。
- `@Autowired IndicatorManagementService indicatorManagementService;`:使用 Spring 的依赖注入,将 `IndicatorManagementService` 注入到控制器中。
- `@GetMapping("/getIndicators")`:标注了 `@GetMapping` 注解,表示处理 GET 请求,并且处理路径为 `/api/getIndicators` 的请求。该方法名称为 `getIndicators`。
- `private R<List<IndicatorManageEntity>> getIndicators(@RequestParam("types") List<String> types, @RequestParam("tableName") String tableName)`:这是处理 GET 请求的方法,接收两个参数 `types` 和 `tableName`,并返回类型为 `R<List<IndicatorManageEntity>>` 的响应。在方法体内,调用 `indicatorManagementService` 的 `getIndicators` 方法获取指标列表。
- `@PostMapping("/getIndicatorsInfo")`:标注了 `@PostMapping` 注解,表示处理 POST 请求,并且处理路径为 `/api/getIndicatorsInfo` 的请求。该方法名称为 `getIndicatorsInfo`。
- `public R<List<IndicatorsMissDataVo>> getIndicatorsInfo(@RequestBody IndicatorsMissDataVos indicatorsMissDataVos)`:这是处理 POST 请求的方法,接收一个类型为 `IndicatorsMissDataVos` 的请求体,并返回类型为 `R<List<IndicatorsMissDataVo>>` 的响应。在方法体内,调用 `indicatorManagementService` 的 `getIndicatorsInfo` 方法获取指标信息。
- `@PostMapping("/fillData")`:标注了 `@PostMapping` 注解,表示处理 POST 请求,并且处理路径为 `/api/fillData` 的请求。该方法名称为 `fillData`。
- `public R fillData(@RequestBody DataFillMethodVo dataFillMethodVo)`:这是处理 POST 请求的方法,接收一个类型为 `DataFillMethodVo` 的请求体,并返回类型为 `R` 的响应。在方法体内,调用 `indicatorManagementService` 的 `fillData` 方法进行数据补齐操作。
整体来说,这个控制器类的作用是处理 `/api/getIndicators`、`/api/getIndicatorsInfo` 和 `/api/fillData` 的 GET 和 POST 请求,分别调用服务层方法来获取指标列表、指标信息以及进行数据补齐操作。
package com.cqupt.software_1.controller;
import com.alibaba.fastjson.JSON;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.IndicatorManageEntity;
import com.cqupt.software_1.mapper.IndicatorManagementMapper;
import com.cqupt.software_1.service.IndicatorManagementService;
import com.cqupt.software_1.vo.DataFillMethodVo;
import com.cqupt.software_1.vo.IndicatorsMissDataVo;
import com.cqupt.software_1.vo.IndicatorsMissDataVos;
import com.cqupt.software_1.vo.IsFillVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api")
public class IndicatorManagementController {
@Autowired
IndicatorManagementService indicatorManagementService;
@GetMapping("/getIndicators")
private R<List<IndicatorManageEntity>> getIndicators(@RequestParam("types") List<String> types, @RequestParam("tableName") String tableName){
System.out.println("types:"+types);
List<IndicatorManageEntity> list = indicatorManagementService.getIndicators(types,tableName);
System.out.println("feature:"+list);
return R.success("200",list);
}
@PostMapping("/getIndicatorsInfo")
public R<List<IndicatorsMissDataVo>> getIndicatorsInfo(@RequestBody IndicatorsMissDataVos indicatorsMissDataVos){
System.out.println("參數:"+JSON.toJSONString(indicatorsMissDataVos));
List<IndicatorsMissDataVo> list = indicatorManagementService.getIndicatorsInfo(indicatorsMissDataVos.getCheckedFeats(),indicatorsMissDataVos.getTableName());
return R.success("200",list);
}
@PostMapping("/fillData")
public R fillData(@RequestBody DataFillMethodVo dataFillMethodVo) {
List<Map<String, IsFillVo>> list = indicatorManagementService.fillData(dataFillMethodVo);
return R.success("200", list);
}
}
NodesController
这段代码是一个Java Spring Boot应用中的控制器类(NodesController),负责处理关于节点(Nodes)的请求。让我逐步解释:
1. `@RestController` 和 `@RequestMapping("/nodes")` 注解指定了这个类是一个RESTful控制器,处理"/nodes"路径下的请求。
2. `NodesService` 是一个服务类,通过 `@Autowired` 注解实现依赖注入,用于处理节点相关的业务逻辑。
3. `getAllNodes()` 方法处理GET请求,返回所有节点的信息。
4. `addMapping()` 方法用于构建父节点和子节点的映射关系,将子节点添加到对应的父节点列表中。
5. `setChildren()` 方法用递归的方式设置节点的子节点列表,通过遍历构建的映射关系逐层设置子节点。
6. 在 `getAllNodes()` 方法中,首先获取所有节点的信息,并将其转换为Node对象存储在`nodeMap`中。
7. 然后获取节点之间的关系,并构建父子节点的映射关系存储在 `pidCidMap` 中。
8. 接着根据映射关系更新节点的子节点列表。
9. 然后找出所有的根节点,并为每个根节点设置其子节点列表。
10. 最后返回根节点列表。
整体来说,这段代码实现了一个树形结构的节点管理系统,能够返回以树形结构展示的所有节点信息。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.Node;
import com.cqupt.software_1.entity.Nodes;
import com.cqupt.software_1.entity.Relationships;
import com.cqupt.software_1.service.NodesService;
import com.fasterxml.jackson.databind.JsonNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/nodes")
public class NodesController {
@Autowired
private NodesService nodesService;
private static void addMapping(Map<Integer, List<Integer>> pidCidMap, int pid, int cid) {
if (!pidCidMap.containsKey(pid)) {
pidCidMap.put(pid, new ArrayList<>());
}
pidCidMap.get(pid).add(cid);
}
private void setChildren(Node node, Map<Integer, Node> nodeMap, Map<Integer, List<Integer>> pidCidMap) {
Integer nodeId = node.getId();
if (pidCidMap.containsKey(nodeId)) {
List<Node> children = new ArrayList<>();
for (Integer childId : pidCidMap.get(nodeId)) {
Node childNode = nodeMap.get(childId);
if (childNode != null) {
children.add(childNode);
setChildren(childNode, nodeMap, pidCidMap);
}
}
node.setChildren(children);
}
}
@GetMapping("/all")
public R getAllNodes(){
List<Nodes> nodes = nodesService.getAllNodes();
Map<Integer, Node> nodeMap = new HashMap<>();
for (int i = 0; i < nodes.size(); i++) {
JsonNode jsonNode = (nodes.get(i).parseJsonString(nodes.get(i).getData()));
Node node = new Node();
node.setId(jsonNode.get("id").asInt());
node.setPath(jsonNode.get("path").asText());
node.setLabel(jsonNode.get("label").asText());
node.setLeafs(jsonNode.get("isLeafs").asBoolean());
node.setCommon(jsonNode.get("isCommon").asBoolean());
if(node.isLeafs() == false){
node.setChildren(new ArrayList<>());
}
nodeMap.put(node.getId(), node);
}
List<Relationships> relationships = nodesService.getRelationships();
Map<Integer, List<Integer>> pidCidMap = new HashMap<>();
for (Relationships relationship : relationships) {
Integer pid = relationship.getParentId();
Integer cid = relationship.getChildId();
addMapping(pidCidMap, pid, cid);
}
for (Map.Entry<Integer, List<Integer>> entry : pidCidMap.entrySet()) {
Integer parentId = entry.getKey();
List<Integer> childIds = entry.getValue();
Node parentNode = nodeMap.get(parentId);
if (parentNode != null) {
List<Node> children = new ArrayList<>();
for (Integer childId : childIds) {
Node childNode = nodeMap.get(childId);
if (childNode != null) {
children.add(childNode);
}
}
parentNode.setChildren(children);
}
}
List<Node> rootNodes = new ArrayList<>();
for (Node node : nodeMap.values()) {
boolean isRoot = true;
for (Integer parentId : pidCidMap.keySet()) {
if (pidCidMap.get(parentId).contains(node.getId())) {
isRoot = false;
break;
}
}
if (isRoot) {
rootNodes.add(node);
}
}
for (Node rootNode : rootNodes) {
setChildren(rootNode, nodeMap, pidCidMap);
}
return R.success(rootNodes);
}
}
TableController
这段代码是一个Java Spring Boot应用中的控制器类,用于处理关于表格的请求。让我逐一解释:
1. `TableController` 类是一个 `RestController`,它处理所有关于表格的HTTP请求,并映射到 `/table` 路径下。
2. `@Autowired private TableService tableService;` 这行代码注入了一个 `TableService` 对象,以便在控制器中调用表格相关的服务方法。
3. `@PostMapping("/createTable")` 注解表示这是一个处理 POST 请求的方法,并且映射到 `/table/createTable` 路径。
4. `public R<ExecState> createTable(@RequestBody TableCreateDTO tableCreateDTO)` 方法接收一个类型为 `TableCreateDTO` 的请求体,并返回一个包含执行状态的 `R` 对象。`TableCreateDTO` 是一个数据传输对象,用于传递创建表格所需的信息,如表名和字段映射。
5. `tableService.createTable(tableCreateDTO.getTableName(), tableCreateDTO.getFieldMap());` 这行代码调用了 `TableService` 中的 `createTable` 方法,传递了表名和字段映射信息,用于动态创建表格。
6. 最后,方法返回一个 `R` 对象,其中包含了操作结果的状态码、消息和执行状态。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.ExecState;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.dto.TableCreateDTO;
import com.cqupt.software_1.service.TableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/table")
public class TableController {
@Autowired
private TableService tableService;
@PostMapping("/createTable")
public R<ExecState> createTable(@RequestBody TableCreateDTO tableCreateDTO){
tableService.createTable(tableCreateDTO.getTableName(), tableCreateDTO.getFieldMap());
return new R<>(200,"成功",ExecState.SUCCESS);
}
}
TableDataController
这段 Java 代码是一个表格数据管理的控制器类,主要提供了一些接口来操作表格数据。让我们逐个介绍每个函数和接口的作用:
1. `getTableData` 函数是一个 GET 请求,用于获取指定表格的数据。接收 `tableId` 和 `tableName` 作为参数,调用 `tableDataService.getTableData` 方法获取表格数据,并以 JSON 格式返回结果。
2. `uploadFile` 函数是一个 POST 请求,用于上传文件并保存表数据信息。接收 `file`(上传的文件)、`newName`(表格名称)、`disease`(类型)、`user`(用户信息)、`userId`(用户 ID)、`parentId`(父级 ID)和 `parentType`(父级类型)等参数,调用 `tableDataService.uploadFile` 方法上传文件并返回表头信息。
3. `tableInspection` 函数是一个 GET 请求,用于检查上传文件是否存在重复的表格名称。接收 `newname` 参数作为表格名称,在数据库中查找是否有相同名称的表格,返回结果表示是否重复。
4. `createTable` 函数是一个 POST 请求,用于根据筛选条件创建表格并保存数据。接收 `FilterTableDataVo` 对象作为参数,调用 `tableDataService.createTable` 方法创建表格并保存数据。
5. `getFilterTableData` 函数是一个 POST 请求,用于根据条件筛选数据并返回结果。接收 `FilterTableDataVo` 对象作为参数,调用 `tableDataService.getFilterDataByConditions` 方法进行数据筛选,并以 JSON 格式返回结果。
6. `exportFile` 函数是一个 POST 请求,用于导出填充后的数据文件。接收 `ExportFilledDataTableVo` 对象作为参数,调用 `tableDataService.exportFile` 方法导出文件,并将文件数据以字符串形式返回。
7. `getDesTableData` 函数是一个 GET 请求,用于获取列描述性分析的数据。接收 `featureName` 和 `tableName` 参数,调用 `tableDataService.featureDescAnalyze` 方法进行列描述性分析,并返回结果。
8. `getSingleFactorAnalyze` 函数是一个 GET 请求,用于进行单因素分析。接收 `tableName` 和 `colNames` 参数,调用 `tableDataService.singleFactorAnalyze` 方法进行单因素分析,并返回结果。
9. `getConsistencyAnalyze` 函数是一个 GET 请求,用于进行一致性验证。接收 `tableName` 和 `featureName` 参数,调用 `tableDataService.consistencyAnalyze` 方法进行一致性验证,并返回结果。如果数据异常,则返回相应提示信息。
该控制器类提供了丰富的功能接口,用于对表格数据进行管理、分析和操作。
package com.cqupt.software_1.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.CategoryEntity;
import com.cqupt.software_1.service.CategoryService;
import com.cqupt.software_1.service.TableDataService;
import com.cqupt.software_1.service.TableDescribeService;
import com.cqupt.software_1.service.UserService;
import com.cqupt.software_1.vo.*;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@RestController()
@RequestMapping("/api")
public class TableDataController {
@Autowired
TableDataService tableDataService;
@Autowired
UserService userService;
@Autowired
CategoryService categoryService;
@Autowired
TableDescribeService tableDescribeService;
@GetMapping("/getTableData")
public R getTableData(@RequestParam("tableId") String tableId, @RequestParam("tableName") String tableName){
List<LinkedHashMap<String, Object>> tableData = tableDataService.getTableData(tableId, tableName);
return R.success("200",tableData);
}
@PostMapping("/dataTable/upload")
public R uploadFile(@RequestParam("file") MultipartFile file,
@RequestParam("newName") String tableName,
@RequestParam("disease") String type,
@RequestParam("user") String user,
@RequestParam("uid") int userId,
@RequestParam("parentId") String parentId,
@RequestParam("parentType") String parentType){
try {
List<String> featureList = tableDataService.uploadFile(file, tableName, type, user, userId, parentId, parentType);
return R.success("200",featureList);
}catch (Exception e){
e.printStackTrace();
return R.success(500,"文件上传异常");
}
}
@GetMapping("/DataTable/inspection")
public R tableInspection(@RequestParam("newname") String name){
List<CategoryEntity> list = categoryService.list(new QueryWrapper<CategoryEntity>(null));
boolean flag = true;
for (CategoryEntity categoryEntity : list) {
if(categoryEntity.getLabel().equals(name)) {
flag = false;
break;
}
}
return R.success("200",flag);
}
@PostMapping("/createTable")
public R createTable(@RequestBody FilterTableDataVo filterTableDataVo){
tableDataService.createTable(filterTableDataVo.getAddDataForm().getDataName(),filterTableDataVo.getAddDataForm().getCharacterList(),
filterTableDataVo.getAddDataForm().getCreateUser(),filterTableDataVo.getNodeData());
return R.success(200,"SUCCESS");
}
@PostMapping("/filterTableData")
public R <List<Map<String,Object>>> getFilterTableData(@RequestBody FilterTableDataVo filterTableDataVo){
List<LinkedHashMap<String, Object>> filterDataByConditions = tableDataService.getFilterDataByConditions(filterTableDataVo.getAddDataForm().getCharacterList(), filterTableDataVo.getNodeData());
return R.success("200",filterDataByConditions);
}
@PostMapping("/exportFile")
public R exportFile(@RequestBody ExportFilledDataTableVo dataFillMethodVo) throws IOException {
List<String> fileData = tableDataService.exportFile(dataFillMethodVo);
String fileStr = fileData.stream().collect(Collectors.joining("\n"));
return R.success("200",fileStr);
}
@GetMapping("/tableDesAnalyze")
public R getDesTableData(@RequestParam("featureName") String featureName, @RequestParam("tableName") String tableName) throws IOException, URISyntaxException {
FeatureDescAnaVo featureDescAnaVo = tableDataService.featureDescAnalyze(featureName,tableName);
return R.success("200",featureDescAnaVo);
}
@GetMapping("/singleFactorAnalyze")
public R getSingleFactorAnalyze(@RequestParam("tableName") String tableName, @RequestParam("colNames") List<String> colNames) throws IOException, URISyntaxException {
SingleAnalyzeVo singleAnalyzeVo = tableDataService.singleFactorAnalyze(tableName,colNames);
return R.success("200",singleAnalyzeVo);
}
@GetMapping("/consistencyAnalyze")
public R getConsistencyAnalyze(@RequestParam("tableName") String tableName, @RequestParam("featureName") String featureName) throws IOException, URISyntaxException {
ConsistencyAnalyzeVo consistencyAnalyze = tableDataService.consistencyAnalyze(tableName,featureName);
System.out.println(JSON.toJSONString(consistencyAnalyze));
if(consistencyAnalyze!=null){
return R.success("200",consistencyAnalyze);
}else{
return R.fail(500,"数据异常,无法分析");
}
}
}
TableDescribeController
这段代码是一个Spring Boot应用中的控制器类,用于处理关于表描述的请求。让我逐步解释一下:
1. `@RestController`:这是一个注解,表明这个类是一个控制器,并且所有的处理方法都会返回一个对象,而不是视图。
2. `@RequestMapping("/api")`:这是一个注解,指定了处理请求的基本URL路径,即`/api`。
3. `TableDescribeController`类:这是控制器类的名称。
4. `@Autowired`:这是一个注解,用于自动装配`TableDescribeService`服务。
5. `TableDescribeService`:这是一个服务类,处理表描述相关的业务逻辑。
6. `@GetMapping("/tableDescribe")`:这是一个注解,指定了处理GET请求的URL路径,即`/api/tableDescribe`。
7. `public R<TableDescribeEntity> getTableDescribe(@RequestParam("id") String id)`:这是一个GET请求处理方法,用于获取指定表ID的表描述信息。它接受一个名为"id"的参数,通过`@RequestParam`注解指定参数名,参数类型为String。
8. `TableDescribeEntity tableDescribeEntity = tableDescribeService.getOne(new QueryWrapper<TableDescribeEntity>().eq("table_id", id))`:这行代码调用了`tableDescribeService`的`getOne`方法,通过表ID查询对应的表描述信息,并将结果存储在`tableDescribeEntity`变量中。
9. `System.out.println("数据为:"+ JSON.toJSONString(tableDescribeEntity))`:这行代码将表描述信息打印到控制台,以JSON格式显示。
10. `return R.success("200",tableDescribeEntity)`:这行代码返回一个`R`对象,其中包含了请求的处理结果,状态码为"200",并且包含了获取到的表描述信息。
总的来说,这个控制器类负责处理关于表描述的请求,根据表ID查询对应的表描述信息,并以JSON格式返回给客户端。
package com.cqupt.software_1.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.TableDescribeEntity;
import com.cqupt.software_1.service.TableDescribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class TableDescribeController {
@Autowired
TableDescribeService tableDescribeService;
@GetMapping("/tableDescribe")
public R<TableDescribeEntity> getTableDescribe(@RequestParam("id") String id){
TableDescribeEntity tableDescribeEntity = tableDescribeService.getOne(new QueryWrapper<TableDescribeEntity>().eq("table_id", id));
System.out.println("数据为:"+ JSON.toJSONString(tableDescribeEntity));
return R.success("200",tableDescribeEntity);
}
}
TableManagerController
这段代码是另一个Spring Boot应用中的控制器类,主要涉及表管理相关的请求处理。让我来逐步解释:
1. `@RestController`:同样,这个注解表明这个类是一个控制器,所有的处理方法都会返回一个对象,而不是视图。
2. `@RequestMapping("/tTableManager")`:这个注解指定了处理请求的基本URL路径,即`/tTableManager`。
3. `TableManagerController`类:这是控制器类的名称。
4. `@Autowired`:这个注解用于自动装配`DataTableManagerService`和`TableManagerService`服务。
5. `@Resource`:这个注解也是用于自动装配,指定了`DataTableManagerMapper`的资源。
6. `@PostMapping("/insertTableManager")`:这个注解指定了处理POST请求的URL路径,即`/tTableManager/insertTableManager`。
7. `public UploadResult insertTableManager(@RequestBody TableManagerDTO tableManagerDTO)`:这是一个POST请求处理方法,用于上传文件的字段分类。它接受一个`TableManagerDTO`对象作为请求体,该对象包含了表管理相关的信息。
8. `tableManagerService.insertTableManager(tableManagerDTO)`:这行代码调用了`tableManagerService`的`insertTableManager`方法,用于插入表管理相关的信息。
9. `List<DataTable> d=dataTableManagerService.upalldata();`:这行代码调用了`dataTableManagerService`的`upalldata`方法,用于获取所有数据表的信息。
10. `UploadResult res = new UploadResult();`:创建了一个`UploadResult`对象,用于存储上传结果。
11. `res.setRes(d);`:将获取到的数据表信息设置到`UploadResult`对象中。
12. `return res;`:返回包含上传结果的`UploadResult`对象。
13. `@PostMapping("/updateTableManager")`:这个注解指定了处理POST请求的URL路径,即`/tTableManager/updateTableManager`。
14. `public R updateTableManager(@RequestBody TableManager tableManager)`:这是另一个POST请求处理方法,用于编辑字段属性,并将操作写入操作日志。它接受一个`TableManager`对象作为请求体,该对象包含了字段属性的信息。
15. `boolean b = tableManagerService.updateById(tableManager);`:这行代码调用了`tableManagerService`的`updateById`方法,用于更新字段属性,并将操作结果存储在`b`变量中。
16. `if (b == true) { return new R<>(200 , "更新字段成功", null); } else { return new R<>(500,"更新失败",null); }`:根据更新操作的结果,返回不同的响应,如果更新成功,则返回状态码"200"和成功消息,否则返回状态码"500"和失败消息。
总的来说,这个控制器类处理了上传文件字段分类和编辑字段属性的请求,调用相应的服务来完成相关业务逻辑,并返回处理结果给客户端。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.DataTable;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.common.TableManagerDTO;
import com.cqupt.software_1.common.UploadResult;
import com.cqupt.software_1.entity.TableManager;
import com.cqupt.software_1.mapper.DataTableManagerMapper;
import com.cqupt.software_1.service.DataTableManagerService;
import com.cqupt.software_1.service.TableManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/tTableManager")
public class TableManagerController {
@Autowired
private DataTableManagerService dataTableManagerService;
@Resource
private DataTableManagerMapper dataTableManagerMapper;
@Autowired
private TableManagerService tableManagerService;
@PostMapping("/insertTableManager")
public UploadResult insertTableManager(@RequestBody TableManagerDTO tableManagerDTO) {
try {
tableManagerService.insertTableManager(tableManagerDTO);
List<DataTable> d=dataTableManagerService.upalldata();
UploadResult res =new UploadResult();
res.setRes(d);
return res;
} catch (Exception e) {
System.out.println("出错了");
UploadResult res = new UploadResult();
res.setCode(500);
res.setE(e);
dataTableManagerService.deletename(tableManagerDTO.getTableName());
dataTableManagerMapper.deletetablename(tableManagerDTO.getTableName());
return res;
}
}
@PostMapping("/updateTableManager")
public R updateTableManager(@RequestBody TableManager tableManager){
boolean b = tableManagerService.updateById(tableManager);
if (b == true) {
return new R<>(200 , "更新字段成功", null);
}else {
return new R<>(500,"更新失败",null);
}
}
}
TaskController
这是一个基于Spring框架的Java Web应用中的控制器类,用于处理与任务(Task)相关的HTTP请求。让我一一解释每个函数和接口:
1. **getOne(@PathVariable int id)**:
- **功能**:根据任务ID获取单个任务信息。
- **参数**:@PathVariable注解用于从URL路径中获取参数。
- **返回值**:返回包含任务信息的响应对象R。
2. **addTask(@RequestBody Task task)**:
- **功能**:添加新的任务。
- **参数**:@RequestBody注解用于将HTTP请求的JSON数据映射到Task对象。
- **返回值**:返回成功创建任务的响应对象R。
3. **getLeaderList()**:
- **功能**:获取任务负责人列表。
- **返回值**:返回包含任务负责人列表的响应对象R。
4. **getTaskList()**:
- **功能**:获取所有任务列表。
- **返回值**:返回包含所有任务列表的响应对象R。
5. **result(@PathVariable int id)**:
- **功能**:根据任务ID获取任务结果。
- **参数**:@PathVariable注解用于从URL路径中获取参数。
- **返回值**:返回包含任务结果的响应对象R。
6. **deleteById(@PathVariable int id)**:
- **功能**:根据任务ID删除任务。
- **参数**:@PathVariable注解用于从URL路径中获取参数。
- **返回值**:返回删除任务后的任务列表的响应对象R。
这些函数通过Spring的注解来映射HTTP请求,并调用TaskService中的相应方法来处理业务逻辑。
package com.cqupt.software_1.controller;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.common.TaskRequest;
import com.cqupt.software_1.entity.Task;
import com.cqupt.software_1.service.TaskService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.util.StringUtils;
import java.util.List;
@RestController
@RequestMapping("/Task")
public class TaskController {
@Autowired
private TaskService taskService;
@GetMapping("/getOne/{id}")
public R getOne(@PathVariable int id){
Task task = taskService.getById(id);
TaskRequest taskRequest = new TaskRequest();
BeanUtils.copyProperties(task,taskRequest);
if (!StringUtils.isEmpty(task.getParameters())){
taskRequest.setPara(task.getParameters().split(","));
}else {
taskRequest.setPara(new String[]{});
}
return R.success(task);
}
@PostMapping("/addTask")
public R addTask(@RequestBody Task task){
taskService.save(task);
return R.success(200,"创建成功");
}
@GetMapping("/getLeaderList")
public R getLeaderList(){
List<String> leaderList = taskService.getLeaderList();
return R.success(leaderList);
}
@GetMapping("/all")
public R getTaskList() {
return R.success(taskService.getTaskList());
}
@GetMapping("/result/{id}")
public R result(@PathVariable int id) throws JsonProcessingException {
Task task = taskService.getlistbyId(id);
TaskRequest request = new TaskRequest();
System.out.println(task);
ObjectMapper objectMapper = new ObjectMapper();
String res = task.getResult();
String[][] retrievedArray = objectMapper.readValue(res, String[][].class);
String fea1 = task.getFeature();
String[] fea = fea1.split(",");
String tar1 = task.getTargetcolumn();
String[] tar = tar1.split(",");
String para1 = task.getParameters();
String[] para = new String[0];
if (para1 != null)
{
para = para1.split(",");
}
String paraV1 = task.getParametersvalues();
String[] paraV = new String[0];
if (paraV1!=null){
paraV = paraV1.split(",");
}
request.setCi(task.getCi());
request.setRatio(String.valueOf(task.getRatio()));
request.setRes(retrievedArray);
request.setTime(task.getUsetime());
request.setDisease(task.getDisease());
request.setDisease(task.getDisease());
request.setFeature(fea);
request.setLeader(task.getLeader());
request.setModel(task.getModel());
request.setPara(para);
request.setParaValue(paraV);
request.setParticipant(task.getParticipant());
request.setTargetcolumn(tar);
request.setTaskName(task.getTaskname());
request.setDataset(task.getDataset());
request.setUid(task.getUserid());
return R.success(request);
}
@GetMapping("/delete/{id}")
public R deleteById(@PathVariable int id){
taskService.deleteTask(id);
return R.success(taskService.getTaskList());
}
}
UserController
这是一个用户管理模块的控制器代码,用于处理用户注册、登录和退出登录功能。
1. `signUp` 函数用于用户注册,接收一个用户对象作为参数。首先检查用户名是否已存在,如果不存在则对密码进行加密处理,并设置用户的创建时间、角色和唯一标识符,然后保存用户信息到数据库,并记录用户注册操作的日志。
2. `login` 函数用于用户登录,接收一个用户对象和 HTTP 请求和响应对象作为参数。首先根据用户名从数据库中获取用户信息,然后验证密码是否正确。如果密码正确,则记录用户登录操作的日志,设置用户的会话信息,并返回登录成功的响应;否则返回密码错误或用户不存在的响应。
3. `logout` 函数用于用户退出登录,接收一个 HTTP 请求对象作为参数。首先从会话中获取用户ID,然后销毁会话并返回退出成功的响应。
这些函数通过 `@PostMapping` 注解映射到相应的 HTTP POST 请求路径,以实现用户注册、登录和退出登录功能。
package com.cqupt.software_1.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cqupt.software_1.Util.SecurityUtil;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.entity.User;
import com.cqupt.software_1.entity.UserLog;
import com.cqupt.software_1.service.UserLogService;
import com.cqupt.software_1.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private UserLogService userLogService;
@PostMapping("/signUp")
public R signUp(@RequestBody User user) throws ParseException {
user.setUid(0);
User existUser = userService.getUserByName(user.getUsername());
if (existUser != null){
return new R<>(500,"用户已经存在",null);
}
String pwd = user.getPassword();
String password = SecurityUtil.hashDataSHA256(pwd);
user.setPassword(password);
String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
user.setCreateTime(date);
user.setUpdateTime(null);
user.setRole(0);
user.setUid(new Random().nextInt());
userService.saveUser(user);
UserLog userLog = new UserLog();
User one = userService.getUserByName(user.getUsername());
Integer uid = one.getUid();
userLog.setUid(uid);
userLog.setOpTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
userLog.setOpType("用户注册");
userLogService.save(userLog);
return new R<>(200,"成功",null);
}
@PostMapping("/login")
public R login(@RequestBody User user, HttpServletResponse response, HttpServletRequest request){
String userName = user.getUsername();
User getUser = userService.getUserByName(userName);
String password = getUser.getPassword();
if (getUser != null){
String pwd = user.getPassword();
String sha256 = SecurityUtil.hashDataSHA256(pwd);
if (sha256.equals(password)){
UserLog userLog = new UserLog();
userLog.setUid(getUser.getUid());
userLog.setOpTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
userLog.setOpType("登录系统");
userLog.setUsername(userName);
System.out.println("userlog:"+userLog);
userLogService.save(userLog);
HttpSession session = request.getSession();
session.setAttribute("username",user.getUsername());
session.setAttribute("userId",getUser.getUid());
return new R<>(200,"登录成功",null);
}else {
return new R<>(500,"密码错误请重新输入",null);
}
}else {
return new R<>(500,"用户不存在",null);
}
}
@PostMapping("/logout")
public R logout(HttpServletRequest request){
HttpSession session = request.getSession();
Integer userId = (Integer) session.getAttribute("userId");
session.invalidate();
return new R<>(200,"退出成功",null);
}
}
UserLogController
这段代码是一个Spring Boot应用中的一个控制器类,用于处理与用户日志相关的请求。让我来详细介绍一下:
1. `com.cqupt.software_1.controller` 包:包含控制器类的包名。
2. `UserLogController` 类:这是控制器类的定义,使用了 `@RestController` 注解,表明这是一个 RESTful 风格的控制器,处理 HTTP 请求并返回 JSON 数据。
3. `@RequestMapping("/userlog")` 注解:指定了处理请求的基本 URL 路径为 "/userlog",意味着该控制器处理以 "/userlog" 开头的请求。
4. `@Autowired private UserLogService userLogService;`:通过 Spring 的依赖注入,将 `UserLogService` 类的实例注入到控制器中,以便在控制器中调用 `UserLogService` 中的方法。
5. `@GetMapping("/allLog")` 注解:指定了处理 GET 请求的 URL 路径为 "/allLog"。
6. `public R<List<UserLog>> queryAllLog(HttpServletRequest request , HttpServletResponse response)` 方法:处理查询所有用户日志的请求。该方法接受 `HttpServletRequest` 和 `HttpServletResponse` 对象作为参数,用于接收和响应 HTTP 请求。
7. `Integer userId = UserThreadLocal.get().getUid();`:通过 `UserThreadLocal` 类获取当前用户的 ID。
8. `QueryWrapper queryWrapper = new QueryWrapper();`:创建一个查询条件的包装器。
9. `queryWrapper.eq("uid",userId);`:在查询条件中添加一个等于条件,筛选出用户 ID 与当前用户 ID 相等的日志记录。
10. `List list = userLogService.list(queryWrapper);`:调用 `UserLogService` 中的 `list` 方法,根据查询条件获取用户日志列表。
11. `return new R<>(200,"成功",list);`:将查询到的用户日志列表封装成一个自定义的响应对象 `R` 并返回,其中包含状态码 200 和成功消息以及查询结果列表。
package com.cqupt.software_1.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cqupt.software_1.common.R;
import com.cqupt.software_1.common.UserThreadLocal;
import com.cqupt.software_1.entity.UserLog;
import com.cqupt.software_1.service.UserLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@RequestMapping("/userlog")
public class UserLogController {
@Autowired
private UserLogService userLogService;
@GetMapping("/allLog")
public R<List<UserLog>> queryAllLog(HttpServletRequest request , HttpServletResponse response){
Integer userId = UserThreadLocal.get().getUid();
System.out.println(userId);
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("uid",userId);
List list = userLogService.list(queryWrapper);
return new R<>(200,"成功",list);
}
}