yeg
2026-09-09 90b6d6768ebeebc44863850289a4696203a0cda9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package com.battery.business.web;
 
import java.util.List;
import com.battery.business.report.FormationReportRepository;
import com.battery.business.report.FormationReportService;
import com.battery.business.report.FormationReportRequest;
import com.battery.business.report.CompareReportEditRequest;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
/** 化成报表按所属动作授权,授权用户可以跨创建人协作。 */
@RestController
@RequestMapping("/system/formation-report")
public class FormationReportController extends BaseController
{
    private final FormationReportService service;
    private final FormationReportRepository reports;
    public FormationReportController(FormationReportService service, FormationReportRepository reports)
    { this.service = service; this.reports = reports; }
 
    /** 查询真实化成来源,不额外要求测试管理权限。 */
    @GetMapping("/sources") @PreAuthorize("@ss.hasPermi('system:formation-report:add')")
    public AjaxResult sources() { return success(service.sources()); }
 
    /** 后端校验归属并读取当前循环及业务字段。 */
    @PostMapping("/preview") @PreAuthorize("@ss.hasPermi('system:formation-report:add')")
    public AjaxResult preview(@RequestBody List<FormationReportRequest.Selection> selections) { return success(service.preview(selections)); }
 
    /** 查询独立报表摘要。 */
    @GetMapping("/list") @PreAuthorize("@ss.hasPermi('system:formation-report:query')")
    public AjaxResult list() { return success().put("rows", service.list()); }
 
    /** 创建身份及首个完整版本。 */
    @PostMapping @PreAuthorize("@ss.hasPermi('system:formation-report:add')")
    public AjaxResult create(@Valid @RequestBody FormationReportRequest request) { return success(service.create(request, getUserId(), getUsername())); }
 
    /** 重开最新保存版本,不读取来源测试。 */
    @GetMapping("/{id}") @PreAuthorize("@ss.hasPermi('system:formation-report:query')")
    public AjaxResult get(@PathVariable long id) { return success(service.get(id, null)); }
 
    /** 编辑权限独立读取最新基准。 */
    @GetMapping("/{id}/editing") @PreAuthorize("@ss.hasPermi('system:formation-report:edit')")
    public AjaxResult editing(@PathVariable long id) { return success(service.get(id, null)); }
 
    /** 查看历史版本的操作人、时间和说明。 */
    @GetMapping("/{id}/versions") @PreAuthorize("@ss.hasPermi('system:formation-report:query')")
    public AjaxResult history(@PathVariable long id) { return success(reports.history(id)); }
 
    /** 指定历史版本只读,不提供回滚。 */
    @GetMapping("/{id}/versions/{versionNo}") @PreAuthorize("@ss.hasPermi('system:formation-report:query')")
    public AjaxResult version(@PathVariable long id, @PathVariable int versionNo) { return success(service.get(id, versionNo)); }
 
    /** 导出权限独立读取指定快照,打开打印不记录下载成功。 */
    @GetMapping("/{id}/versions/{versionNo}/print") @PreAuthorize("@ss.hasPermi('system:formation-report:export')")
    public AjaxResult print(@PathVariable long id, @PathVariable int versionNo) { return success(service.get(id, versionNo)); }
 
    /** 普通编辑不接受来源或测量快照。 */
    @PostMapping("/{id}/versions") @PreAuthorize("@ss.hasPermi('system:formation-report:edit')")
    public AjaxResult edit(@PathVariable long id, @Valid @RequestBody FormationReportRequest.Edit request)
    { return success(service.edit(id, request, getUserId(), getUsername())); }
 
    /** 明确按当前来源生成新版本。 */
    @PostMapping("/{id}/refresh-source") @PreAuthorize("@ss.hasPermi('system:formation-report:edit')")
    public AjaxResult refresh(@PathVariable long id, @Valid @RequestBody CompareReportEditRequest.Refresh request)
    { return success(service.refresh(id, request, getUserId(), getUsername())); }
 
    /** 整体删除及最小日志同成同败。 */
    @DeleteMapping("/{id}") @PreAuthorize("@ss.hasPermi('system:formation-report:remove')")
    public AjaxResult delete(@PathVariable long id) { service.delete(id, getUserId(), getUsername()); return success(); }
}