提交业务系统更新
This commit is contained in:
parent
17c177a341
commit
74a43d99a6
1
.vercel/project.json
Normal file
1
.vercel/project.json
Normal file
@ -0,0 +1 @@
|
||||
{"neverMindDeployCard":true}
|
||||
137
business-css/api-test.http
Normal file
137
business-css/api-test.http
Normal file
@ -0,0 +1,137 @@
|
||||
### Algorithms
|
||||
GET http://localhost:8090/api/algorithms
|
||||
|
||||
### Algorithms page
|
||||
GET http://localhost:8090/api/algorithms/page?current=1&size=10
|
||||
|
||||
### Create algorithm
|
||||
POST http://localhost:8090/api/algorithms
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Sample Algorithm",
|
||||
"description": "Test description",
|
||||
"version": "v1.0",
|
||||
"principle": "Simple principle",
|
||||
"inputParams": "{}",
|
||||
"outputParams": "{}"
|
||||
}
|
||||
|
||||
### Update algorithm
|
||||
PUT http://localhost:8090/api/algorithms/{{algorithmId}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Updated Name"
|
||||
}
|
||||
|
||||
### Delete algorithm
|
||||
DELETE http://localhost:8090/api/algorithms/{{algorithmId}}
|
||||
|
||||
### Search algorithm
|
||||
GET http://localhost:8090/api/algorithms/search?keyword=test
|
||||
|
||||
### Devices
|
||||
POST http://localhost:8090/devices
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"projectId": "{{projectId}}",
|
||||
"code": "D-001",
|
||||
"type": "pump",
|
||||
"name": "Main Pump"
|
||||
}
|
||||
|
||||
GET http://localhost:8090/devices/types
|
||||
|
||||
GET http://localhost:8090/devices/search?type=pump&name=Pump
|
||||
|
||||
### Materials
|
||||
POST http://localhost:8090/materials
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"projectId": "{{projectId}}",
|
||||
"name": "UO2",
|
||||
"uConcentration": 1.2,
|
||||
"uo2Density": 10.5
|
||||
}
|
||||
|
||||
GET http://localhost:8090/materials/search?name=UO2
|
||||
|
||||
### Critical Data
|
||||
POST http://localhost:8090/critical-data
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"deviceType": "pump",
|
||||
"attrState": "{}",
|
||||
"keffValue": 0.98
|
||||
}
|
||||
|
||||
GET http://localhost:8090/critical-data/device-types
|
||||
|
||||
GET http://localhost:8090/critical-data/by-device-type?deviceType=pump
|
||||
|
||||
### Critical Data import (adjust file path)
|
||||
POST http://localhost:8090/critical-data/import
|
||||
Content-Type: multipart/form-data
|
||||
|
||||
file=@E:/path/to/critical-data.xlsx
|
||||
|
||||
### Scenarios
|
||||
POST http://localhost:8090/scenarios
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"projectId": "{{projectId}}",
|
||||
"name": "Scenario A",
|
||||
"description": "Test scenario"
|
||||
}
|
||||
|
||||
GET http://localhost:8090/scenarios/search?name=Scenario
|
||||
|
||||
### Events
|
||||
POST http://localhost:8090/events
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"scenarioId": "{{scenarioId}}",
|
||||
"deviceId": "{{deviceId}}",
|
||||
"materialId": "{{materialId}}",
|
||||
"attrChanges": "{\"flow_rate\": 12.3}",
|
||||
"triggerTime": 1.5
|
||||
}
|
||||
|
||||
PUT http://localhost:8090/events/{{eventId}}/attr-changes
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"attr_changes": {"flow_rate": 20.0}
|
||||
}
|
||||
|
||||
### Scenario Results
|
||||
POST http://localhost:8090/scenario-results
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"scenarioId": "{{scenarioId}}",
|
||||
"deviceId": "{{deviceId}}",
|
||||
"step": 1,
|
||||
"attrState": "{}",
|
||||
"keffValue": 0.97
|
||||
}
|
||||
|
||||
### Projects
|
||||
POST http://localhost:8090/projects
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"code": "P-001",
|
||||
"name": "Demo Project",
|
||||
"description": "Test",
|
||||
"topology": "{}"
|
||||
}
|
||||
|
||||
GET http://localhost:8090/projects/search?name=Demo
|
||||
|
||||
114
business-css/docs/table.txt
Normal file
114
business-css/docs/table.txt
Normal file
@ -0,0 +1,114 @@
|
||||
-- ==========================================
|
||||
-- 1. project 表
|
||||
-- ==========================================
|
||||
CREATE TABLE project (
|
||||
project_id CHAR(36) PRIMARY KEY,
|
||||
code VARCHAR(20) NOT NULL UNIQUE,
|
||||
name VARCHAR(200) NOT NULL,
|
||||
description TEXT,
|
||||
topology LONGTEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ==========================================
|
||||
-- 2. device 表
|
||||
-- ==========================================
|
||||
CREATE TABLE device (
|
||||
device_id CHAR(36) PRIMARY KEY,
|
||||
project_id CHAR(36) NOT NULL,
|
||||
code VARCHAR(50) NOT NULL,
|
||||
type VARCHAR(50) NOT NULL,
|
||||
name VARCHAR(100),
|
||||
size JSON NOT NULL,
|
||||
volume DOUBLE,
|
||||
flow_rate DOUBLE,
|
||||
pulse_velocity DOUBLE,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ==========================================
|
||||
-- 3. material 表
|
||||
-- ==========================================
|
||||
CREATE TABLE material (
|
||||
material_id CHAR(36) PRIMARY KEY,
|
||||
project_id CHAR(36) NOT NULL,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
u_concentration DOUBLE,
|
||||
uo2_density DOUBLE,
|
||||
u_enrichment DOUBLE,
|
||||
pu_concentration DOUBLE,
|
||||
puo2_density DOUBLE,
|
||||
pu_isotope DOUBLE,
|
||||
hno3_acidity DOUBLE,
|
||||
h2c2o4_concentration DOUBLE,
|
||||
organic_ratio DOUBLE,
|
||||
moisture_content DOUBLE,
|
||||
custom_attrs JSON,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ==========================================
|
||||
-- 4. critical_data 表
|
||||
-- ==========================================
|
||||
CREATE TABLE critical_data (
|
||||
critical_id CHAR(36) PRIMARY KEY,
|
||||
device_type VARCHAR(50) NOT NULL,
|
||||
attr_state JSON NOT NULL,
|
||||
keff_value DOUBLE,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ==========================================
|
||||
-- 5. scenario 表
|
||||
-- ==========================================
|
||||
CREATE TABLE scenario (
|
||||
scenario_id CHAR(36) PRIMARY KEY,
|
||||
project_id CHAR(36) NOT NULL,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
description TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ==========================================
|
||||
-- 6. event 表
|
||||
-- ==========================================
|
||||
CREATE TABLE event (
|
||||
event_id CHAR(36) PRIMARY KEY,
|
||||
scenario_id CHAR(36) NOT NULL,
|
||||
device_id CHAR(36),
|
||||
material_id CHAR(36),
|
||||
attr_changes JSON NOT NULL,
|
||||
trigger_time DOUBLE NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ==========================================
|
||||
-- 7. scenario_result 表
|
||||
-- ==========================================
|
||||
CREATE TABLE scenario_result (
|
||||
scenario_id CHAR(36) NOT NULL,
|
||||
device_id CHAR(36) NOT NULL,
|
||||
step INT NOT NULL,
|
||||
attr_state JSON NOT NULL,
|
||||
keff_value DOUBLE,
|
||||
PRIMARY KEY(scenario_id, device_id, step)
|
||||
);
|
||||
|
||||
-- ==========================================
|
||||
-- 8.algorithm 表
|
||||
-- ==========================================
|
||||
CREATE TABLE algorithm (
|
||||
algorithm_id CHAR(36) PRIMARY KEY COMMENT '算法唯一ID',
|
||||
name VARCHAR(100) NOT NULL COMMENT '算法名称',
|
||||
description TEXT COMMENT '算法描述',
|
||||
version VARCHAR(20) COMMENT '版本号,例如v1.0',
|
||||
principle TEXT COMMENT '算法原理说明',
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
input_params JSON COMMENT '调用参数,以JSON存储参数名称、类型、默认值等',
|
||||
output_params JSON COMMENT '输出参数,以JSON存储参数名称、类型、说明等'
|
||||
);
|
||||
@ -66,6 +66,15 @@
|
||||
<classifier>plain</classifier>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.32</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -80,6 +89,20 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.32</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.business.css.domain.Algorithm;
|
||||
import com.yfd.business.css.service.AlgorithmService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/algorithms")
|
||||
public class AlgorithmController {
|
||||
|
||||
@Autowired
|
||||
private AlgorithmService algorithmService;
|
||||
|
||||
@GetMapping
|
||||
public List<Algorithm> getAllAlgorithms() {
|
||||
return algorithmService.list();
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
public Page<Algorithm> getAlgorithmsPage(@RequestParam(defaultValue = "1") int current,
|
||||
@RequestParam(defaultValue = "10") int size) {
|
||||
return algorithmService.page(new Page<>(current, size));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public Algorithm getAlgorithmById(@PathVariable String id) {
|
||||
return algorithmService.getById(id);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public boolean createAlgorithm(@RequestBody Algorithm algorithm) {
|
||||
return algorithmService.save(algorithm);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public boolean updateAlgorithm(@PathVariable String id, @RequestBody Algorithm algorithm) {
|
||||
algorithm.setAlgorithmId(id);
|
||||
return algorithmService.updateById(algorithm);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public boolean deleteAlgorithm(@PathVariable String id) {
|
||||
return algorithmService.removeById(id);
|
||||
}
|
||||
|
||||
@GetMapping("/search")
|
||||
public List<Algorithm> searchAlgorithms(@RequestParam String keyword) {
|
||||
QueryWrapper<Algorithm> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like("name", keyword)
|
||||
.or()
|
||||
.like("description", keyword);
|
||||
return algorithmService.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yfd.business.css.domain.CriticalData;
|
||||
import com.yfd.business.css.service.CriticalDataService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/critical-data")
|
||||
public class CriticalDataController {
|
||||
|
||||
@Resource
|
||||
private CriticalDataService criticalDataService;
|
||||
|
||||
/**
|
||||
* 1. 新增临界数据
|
||||
*/
|
||||
@PostMapping
|
||||
public boolean create(@RequestBody CriticalData data) {
|
||||
return criticalDataService.save(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 修改临界数据
|
||||
*/
|
||||
@PutMapping
|
||||
public boolean update(@RequestBody CriticalData data) {
|
||||
return criticalDataService.updateById(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1 删除临界数据(单条)
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public boolean delete(@PathVariable String id) {
|
||||
return criticalDataService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.2 删除临界数据(多条)
|
||||
*/
|
||||
@DeleteMapping
|
||||
public boolean deleteBatch(@RequestBody List<String> ids) {
|
||||
return criticalDataService.removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 导入临界数据
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public boolean importCriticalData(@RequestParam("file") MultipartFile file) {
|
||||
return criticalDataService.importCriticalData(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 获取设备类型列表(去重)
|
||||
*/
|
||||
@GetMapping("/device-types")
|
||||
public List<String> listDeviceTypes() {
|
||||
return criticalDataService.listDeviceTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 根据设备类型获取临界数据列表
|
||||
*/
|
||||
@GetMapping("/by-device-type")
|
||||
public List<CriticalData> listByDeviceType(@RequestParam String deviceType) {
|
||||
return criticalDataService.list(
|
||||
new QueryWrapper<CriticalData>()
|
||||
.eq("device_type", deviceType)
|
||||
.orderByDesc("created_at")
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yfd.business.css.domain.Device;
|
||||
import com.yfd.business.css.service.DeviceService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/devices")
|
||||
public class DeviceController {
|
||||
|
||||
@Resource
|
||||
private DeviceService deviceService;
|
||||
|
||||
/**
|
||||
* 1. 新增设备
|
||||
*/
|
||||
@PostMapping
|
||||
public boolean create(@RequestBody Device device) {
|
||||
return deviceService.save(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 编辑设备
|
||||
*/
|
||||
@PutMapping
|
||||
public boolean update(@RequestBody Device device) {
|
||||
return deviceService.updateById(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1 删除设备(单条)
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public boolean delete(@PathVariable String id) {
|
||||
return deviceService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.2 删除设备(多条)
|
||||
*/
|
||||
@DeleteMapping
|
||||
public boolean deleteBatch(@RequestBody List<String> ids) {
|
||||
return deviceService.removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 导入设备
|
||||
* (Excel / CSV,具体解析逻辑在 Service)
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public boolean importDevices(@RequestParam("file") MultipartFile file) {
|
||||
return deviceService.importDevices(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 获取设备类型列表(去重)
|
||||
*/
|
||||
@GetMapping("/types")
|
||||
public List<String> listDeviceTypes() {
|
||||
return deviceService.listDeviceTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 根据设备类型获取设备列表
|
||||
*/
|
||||
@GetMapping("/by-type")
|
||||
public List<Device> listByType(@RequestParam String type) {
|
||||
return deviceService.list(
|
||||
new QueryWrapper<Device>()
|
||||
.eq("type", type)
|
||||
.orderByDesc("created_at")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. 设备查询(类型 + 名称)
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public List<Device> search(@RequestParam(required = false) String type,
|
||||
@RequestParam(required = false) String name) {
|
||||
|
||||
QueryWrapper<Device> wrapper = new QueryWrapper<>();
|
||||
|
||||
if (type != null && !type.isEmpty()) {
|
||||
wrapper.eq("type", type);
|
||||
}
|
||||
if (name != null && !name.isEmpty()) {
|
||||
wrapper.like("name", name);
|
||||
}
|
||||
|
||||
return deviceService.list(wrapper.orderByDesc("created_at"));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.yfd.business.css.domain.Event;
|
||||
import com.yfd.business.css.service.EventService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/events")
|
||||
public class EventController {
|
||||
|
||||
private final EventService eventService;
|
||||
|
||||
public EventController(EventService eventService) {
|
||||
this.eventService = eventService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增始发事件
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<Map<String, Object>> addEvent(@RequestBody Event event) {
|
||||
eventService.save(event);
|
||||
Event savedEvent = event;
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"code", 0,
|
||||
"msg", "新增成功",
|
||||
"data", savedEvent
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改 Event 的 attr_changes
|
||||
*/
|
||||
@PutMapping("/{eventId}/attr-changes")
|
||||
public ResponseEntity<Map<String, Object>> updateAttrChanges(
|
||||
@PathVariable String eventId,
|
||||
@RequestBody Map<String, Object> requestBody
|
||||
) {
|
||||
Object attrChanges = requestBody.get("attr_changes");
|
||||
if (attrChanges == null) {
|
||||
return ResponseEntity.badRequest().body(Map.of(
|
||||
"code", 1,
|
||||
"msg", "attr_changes不能为空"
|
||||
));
|
||||
}
|
||||
|
||||
Event updatedEvent = new Event();
|
||||
updatedEvent.setEventId(eventId);
|
||||
updatedEvent.setAttrChanges(String.valueOf(attrChanges));
|
||||
eventService.updateById(updatedEvent);
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"code", 0,
|
||||
"msg", "修改成功",
|
||||
"data", updatedEvent
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yfd.business.css.domain.Material;
|
||||
import com.yfd.business.css.service.MaterialService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/materials")
|
||||
public class MaterialController {
|
||||
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
|
||||
/**
|
||||
* 1. 新增物料
|
||||
*/
|
||||
@PostMapping
|
||||
public boolean create(@RequestBody Material material) {
|
||||
return materialService.save(material);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 编辑物料
|
||||
*/
|
||||
@PutMapping
|
||||
public boolean update(@RequestBody Material material) {
|
||||
return materialService.updateById(material);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1 删除物料(单条)
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public boolean delete(@PathVariable String id) {
|
||||
return materialService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.2 删除物料(多条)
|
||||
*/
|
||||
@DeleteMapping
|
||||
public boolean deleteBatch(@RequestBody List<String> ids) {
|
||||
return materialService.removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 导入物料
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public boolean importMaterials(@RequestParam("file") MultipartFile file) {
|
||||
return materialService.importMaterials(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 根据物料名称搜索
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public List<Material> search(@RequestParam String name) {
|
||||
return materialService.list(
|
||||
new QueryWrapper<Material>()
|
||||
.like("name", name)
|
||||
.orderByDesc("created_at")
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yfd.business.css.domain.Project;
|
||||
import com.yfd.business.css.service.ProjectService;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/projects")
|
||||
public class ProjectController {
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
/**
|
||||
* 1. 新增项目
|
||||
*/
|
||||
@PostMapping
|
||||
public boolean create(@RequestBody Project project) {
|
||||
return projectService.save(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 修改项目
|
||||
*/
|
||||
@PutMapping
|
||||
public boolean update(@RequestBody Project project) {
|
||||
return projectService.updateById(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1 删除项目(单条)
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public boolean delete(@PathVariable String id) {
|
||||
return projectService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.2 删除项目(多条)
|
||||
*/
|
||||
@DeleteMapping
|
||||
public boolean deleteBatch(@RequestBody List<String> ids) {
|
||||
return projectService.removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 导出所有项目
|
||||
*/
|
||||
@GetMapping("/export/all")
|
||||
public ResponseEntity<byte[]> exportAll() {
|
||||
byte[] data = projectService.exportAllProjects();
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION,
|
||||
"attachment; filename=projects.json")
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.body(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 导出项目工程
|
||||
*/
|
||||
@GetMapping("/{id}/export")
|
||||
public ResponseEntity<byte[]> exportProject(@PathVariable String id) {
|
||||
byte[] data = projectService.exportProjectEngineering(id);
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION,
|
||||
"attachment; filename=project_" + id + ".zip")
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.body(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 根据项目名称搜索
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public List<Project> searchByName(@RequestParam String name) {
|
||||
return projectService.list(
|
||||
new QueryWrapper<Project>()
|
||||
.like("name", name)
|
||||
.orderByDesc("created_at")
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yfd.business.css.domain.Scenario;
|
||||
import com.yfd.business.css.service.ScenarioService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/scenarios")
|
||||
public class ScenarioController {
|
||||
|
||||
@Resource
|
||||
private ScenarioService scenarioService;
|
||||
|
||||
/**
|
||||
* 1. 新增情景
|
||||
*/
|
||||
@PostMapping
|
||||
public boolean create(@RequestBody Scenario scenario) {
|
||||
return scenarioService.save(scenario);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 修改情景
|
||||
*/
|
||||
@PutMapping
|
||||
public boolean update(@RequestBody Scenario scenario) {
|
||||
return scenarioService.updateById(scenario);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 删除情景
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public boolean delete(@PathVariable String id) {
|
||||
return scenarioService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.2 删除情景(多条)
|
||||
*/
|
||||
@DeleteMapping
|
||||
public boolean deleteBatch(@RequestBody List<String> ids) {
|
||||
return scenarioService.removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 根据情景名称搜索
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public List<Scenario> searchByName(@RequestParam String name) {
|
||||
return scenarioService.list(
|
||||
new QueryWrapper<Scenario>()
|
||||
.like("name", name)
|
||||
.orderByDesc("created_at")
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.yfd.business.css.controller;
|
||||
|
||||
import com.yfd.business.css.domain.ScenarioResult;
|
||||
import com.yfd.business.css.service.ScenarioResultService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/scenario-results")
|
||||
public class ScenarioResultController {
|
||||
|
||||
private final ScenarioResultService scenarioResultService;
|
||||
|
||||
public ScenarioResultController(ScenarioResultService scenarioResultService) {
|
||||
this.scenarioResultService = scenarioResultService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增情景结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<Map<String, Object>> addScenarioResult(@RequestBody ScenarioResult result) {
|
||||
scenarioResultService.save(result);
|
||||
ScenarioResult savedResult = result;
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"code", 0,
|
||||
"msg", "新增成功",
|
||||
"data", savedResult
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.yfd.business.css.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("algorithm")
|
||||
public class Algorithm implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "algorithm_id", type = IdType.ASSIGN_UUID)
|
||||
private String algorithmId;
|
||||
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@TableField("description")
|
||||
private String description;
|
||||
|
||||
@TableField("version")
|
||||
private String version;
|
||||
|
||||
@TableField("principle")
|
||||
private String principle;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@TableField("input_params")
|
||||
private String inputParams;
|
||||
|
||||
@TableField("output_params")
|
||||
private String outputParams;
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.yfd.business.css.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("critical_data")
|
||||
public class CriticalData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "critical_id", type = IdType.ASSIGN_UUID)
|
||||
private String criticalId;
|
||||
|
||||
@TableField("device_type")
|
||||
private String deviceType;
|
||||
|
||||
@TableField("attr_state")
|
||||
private String attrState; // JSON
|
||||
|
||||
@TableField("keff_value")
|
||||
private Double keffValue;
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.yfd.business.css.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("device")
|
||||
public class Device implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "device_id", type = IdType.ASSIGN_UUID)
|
||||
private String deviceId;
|
||||
|
||||
@TableField("project_id")
|
||||
private String projectId;
|
||||
|
||||
@TableField("code")
|
||||
private String code;
|
||||
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@TableField("size")
|
||||
private String size; // JSON
|
||||
|
||||
@TableField("volume")
|
||||
private Double volume;
|
||||
|
||||
@TableField("flow_rate")
|
||||
private Double flowRate;
|
||||
|
||||
@TableField("pulse_velocity")
|
||||
private Double pulseVelocity;
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.yfd.business.css.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("event")
|
||||
public class Event implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "event_id", type = IdType.ASSIGN_UUID)
|
||||
private String eventId;
|
||||
|
||||
@TableField("scenario_id")
|
||||
private String scenarioId;
|
||||
|
||||
@TableField("device_id")
|
||||
private String deviceId;
|
||||
|
||||
@TableField("material_id")
|
||||
private String materialId;
|
||||
|
||||
@TableField("attr_changes")
|
||||
private String attrChanges; // JSON
|
||||
|
||||
@TableField("trigger_time")
|
||||
private Double triggerTime;
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.yfd.business.css.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("material")
|
||||
public class Material implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "material_id", type = IdType.ASSIGN_UUID)
|
||||
private String materialId;
|
||||
|
||||
@TableField("project_id")
|
||||
private String projectId;
|
||||
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@TableField("u_concentration")
|
||||
private Double uConcentration;
|
||||
|
||||
@TableField("uo2_density")
|
||||
private Double uo2Density;
|
||||
|
||||
@TableField("u_enrichment")
|
||||
private Double uEnrichment;
|
||||
|
||||
@TableField("pu_concentration")
|
||||
private Double puConcentration;
|
||||
|
||||
@TableField("puo2_density")
|
||||
private Double puo2Density;
|
||||
|
||||
@TableField("pu_isotope")
|
||||
private Double puIsotope;
|
||||
|
||||
@TableField("hno3_acidity")
|
||||
private Double hno3Acidity;
|
||||
|
||||
@TableField("h2c2o4_concentration")
|
||||
private Double h2c2o4Concentration;
|
||||
|
||||
@TableField("organic_ratio")
|
||||
private Double organicRatio;
|
||||
|
||||
@TableField("moisture_content")
|
||||
private Double moistureContent;
|
||||
|
||||
@TableField("custom_attrs")
|
||||
private String customAttrs; // JSON
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.yfd.business.css.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("scenario")
|
||||
public class Scenario implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "scenario_id", type = IdType.ASSIGN_UUID)
|
||||
private String scenarioId;
|
||||
|
||||
@TableField("project_id")
|
||||
private String projectId;
|
||||
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@TableField("description")
|
||||
private String description;
|
||||
|
||||
@TableField("created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@TableField("updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yfd.business.css.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("scenario_result")
|
||||
public class ScenarioResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableField("scenario_id")
|
||||
private String scenarioId;
|
||||
|
||||
@TableField("device_id")
|
||||
private String deviceId;
|
||||
|
||||
@TableField("step")
|
||||
private Integer step;
|
||||
|
||||
@TableField("attr_state")
|
||||
private String attrState; // JSON
|
||||
|
||||
@TableField("keff_value")
|
||||
private Double keffValue;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.Algorithm;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AlgorithmMapper extends BaseMapper<Algorithm> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.CriticalData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CriticalDataMapper extends BaseMapper<CriticalData> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.Device;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DeviceMapper extends BaseMapper<Device> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.Event;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface EventMapper extends BaseMapper<Event> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.Material;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MaterialMapper extends BaseMapper<Material> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.Project;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ProjectMapper extends BaseMapper<Project> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.Scenario;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ScenarioMapper extends BaseMapper<Scenario> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.yfd.business.css.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.business.css.domain.ScenarioResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ScenarioResultMapper extends BaseMapper<ScenarioResult> {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.Algorithm;
|
||||
|
||||
public interface AlgorithmService extends IService<Algorithm> {
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.CriticalData;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
public interface CriticalDataService extends IService<CriticalData> {
|
||||
/**
|
||||
* 导入临界数据
|
||||
*/
|
||||
boolean importCriticalData(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 获取设备类型列表(去重)
|
||||
*/
|
||||
List<String> listDeviceTypes();
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.Device;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
public interface DeviceService extends IService<Device> {
|
||||
/**
|
||||
* 导入设备
|
||||
*/
|
||||
boolean importDevices(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 获取设备类型列表(去重)
|
||||
*/
|
||||
List<String> listDeviceTypes();
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.Event;
|
||||
|
||||
public interface EventService extends IService<Event> {
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.Material;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface MaterialService extends IService<Material> {
|
||||
/**
|
||||
* 导入物料
|
||||
*/
|
||||
boolean importMaterials(MultipartFile file);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.Project;
|
||||
|
||||
public interface ProjectService extends IService<Project> {
|
||||
/**
|
||||
* 导出所有项目
|
||||
*/
|
||||
byte[] exportAllProjects();
|
||||
|
||||
/**
|
||||
* 导出项目工程(设备 + 物料 + 场景 + 事件 + 结果)
|
||||
*/
|
||||
byte[] exportProjectEngineering(String projectId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.ScenarioResult;
|
||||
|
||||
public interface ScenarioResultService extends IService<ScenarioResult> {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.yfd.business.css.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.business.css.domain.Scenario;
|
||||
|
||||
public interface ScenarioService extends IService<Scenario> {
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.Algorithm;
|
||||
import com.yfd.business.css.mapper.AlgorithmMapper;
|
||||
import com.yfd.business.css.service.AlgorithmService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AlgorithmServiceImpl extends ServiceImpl<AlgorithmMapper, Algorithm> implements AlgorithmService {
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.CriticalData;
|
||||
import com.yfd.business.css.mapper.CriticalDataMapper;
|
||||
import com.yfd.business.css.service.CriticalDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CriticalDataServiceImpl
|
||||
extends ServiceImpl<CriticalDataMapper, CriticalData>
|
||||
implements CriticalDataService {
|
||||
@Override
|
||||
public boolean importCriticalData(MultipartFile file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listDeviceTypes() {
|
||||
return this.list()
|
||||
.stream()
|
||||
.map(CriticalData::getDeviceType)
|
||||
.filter(s -> s != null && !s.isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.Device;
|
||||
import com.yfd.business.css.mapper.DeviceMapper;
|
||||
import com.yfd.business.css.service.DeviceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class DeviceServiceImpl
|
||||
extends ServiceImpl<DeviceMapper, Device>
|
||||
implements DeviceService {
|
||||
@Override
|
||||
public boolean importDevices(MultipartFile file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listDeviceTypes() {
|
||||
return this.list()
|
||||
.stream()
|
||||
.map(Device::getType)
|
||||
.filter(s -> s != null && !s.isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.Event;
|
||||
import com.yfd.business.css.mapper.EventMapper;
|
||||
import com.yfd.business.css.service.EventService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class EventServiceImpl
|
||||
extends ServiceImpl<EventMapper, Event>
|
||||
implements EventService {
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.Material;
|
||||
import com.yfd.business.css.mapper.MaterialMapper;
|
||||
import com.yfd.business.css.service.MaterialService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Service
|
||||
public class MaterialServiceImpl
|
||||
extends ServiceImpl<MaterialMapper, Material>
|
||||
implements MaterialService {
|
||||
@Override
|
||||
public boolean importMaterials(MultipartFile file) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.Project;
|
||||
import com.yfd.business.css.mapper.ProjectMapper;
|
||||
import com.yfd.business.css.service.ProjectService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ProjectServiceImpl
|
||||
extends ServiceImpl<ProjectMapper, Project>
|
||||
implements ProjectService {
|
||||
@Override
|
||||
public byte[] exportAllProjects() {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] exportProjectEngineering(String projectId) {
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.ScenarioResult;
|
||||
import com.yfd.business.css.mapper.ScenarioResultMapper;
|
||||
import com.yfd.business.css.service.ScenarioResultService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ScenarioResultServiceImpl
|
||||
extends ServiceImpl<ScenarioResultMapper, ScenarioResult>
|
||||
implements ScenarioResultService {
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.business.css.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.business.css.domain.Scenario;
|
||||
import com.yfd.business.css.mapper.ScenarioMapper;
|
||||
import com.yfd.business.css.service.ScenarioService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ScenarioServiceImpl
|
||||
extends ServiceImpl<ScenarioMapper, Scenario>
|
||||
implements ScenarioService {
|
||||
}
|
||||
6
framework/package-lock.json
generated
Normal file
6
framework/package-lock.json
generated
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "framework",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
@ -19,8 +19,17 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@EnableTransactionManagement
|
||||
@ServletComponentScan("com.yfd.platform.config")
|
||||
@MapperScan(basePackages = "com.yfd.platform.*.mapper")
|
||||
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class, RedisAutoConfiguration.class})
|
||||
@MapperScan(basePackages = {
|
||||
"com.yfd.platform.**.mapper",
|
||||
"com.yfd.business.css.**.mapper"
|
||||
})
|
||||
@SpringBootApplication(
|
||||
scanBasePackages = {
|
||||
"com.yfd.platform",
|
||||
"com.yfd.business.css"
|
||||
},
|
||||
exclude= {DataSourceAutoConfiguration.class, RedisAutoConfiguration.class}
|
||||
)
|
||||
@Import({DynamicDataSourceConfig.class})
|
||||
@EnableCaching
|
||||
public class PlatformApplication {
|
||||
|
||||
@ -27,24 +27,36 @@ public class SwaggerConfig {
|
||||
@Bean
|
||||
public GroupedOpenApi groupWebsiteApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("1. 深北莫网站")
|
||||
.packagesToScan("com.yfd.platform.modules.sbmwebsitedb.controller")
|
||||
.group("1. CSS管理")
|
||||
.packagesToScan("com.yfd.business.css.controller")
|
||||
.pathsToMatch(
|
||||
"/api/**",
|
||||
"/devices/**",
|
||||
"/materials/**",
|
||||
"/critical-data/**",
|
||||
"/scenarios/**",
|
||||
"/events/**",
|
||||
"/scenario-results/**",
|
||||
"/projects/**"
|
||||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi groupQuartzApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("2. 定时任务")
|
||||
.packagesToScan("com.yfd.platform.modules.quartz.controller")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi groupSystemApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("3. 系统管理")
|
||||
.group("2. 系统管理")
|
||||
.packagesToScan("com.yfd.platform.system.controller")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi groupQuartzApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("3. 定时任务")
|
||||
.packagesToScan("com.yfd.platform.modules.quartz.controller")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,4 +31,3 @@ springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
path: /swagger-ui.html
|
||||
packages-to-scan: com.yfd.platform
|
||||
|
||||
Loading…
Reference in New Issue
Block a user