刘光辉
4 小时以前 06f314545ac3514d7ce28939920866ae8188d31c
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
package jnpf.controller;
 
import cn.dev33.satoken.same.SaSameUtil;
import jakarta.validation.Valid;
import jnpf.base.ActionResult;
import jnpf.dmsEntity.storage.form.DmsPersistentPdfGenerateForm;
import jnpf.dmsEntity.storage.vo.DmsPersistentPdfGenerateVO;
import jnpf.exception.DataException;
import jnpf.fileStorage.dms.DmsPersistentPdfStorageService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("/Internal/file/dms")
@RequiredArgsConstructor
public class DmsPersistentPdfController {
    private final DmsPersistentPdfStorageService service;
 
    @PostMapping("/persistent-pdf")
    public ActionResult<DmsPersistentPdfGenerateVO> generate(
            @RequestHeader(value = "X-DMS-Service-Id", required = false) String serviceId,
            @RequestBody @Valid DmsPersistentPdfGenerateForm form) {
        SaSameUtil.checkCurrentRequestToken();
        if (!"jnpf-dms".equals(serviceId)) {
            throw new DataException("仅允许 DMS 生成持久化 PDF");
        }
        return ActionResult.success(service.generate(form));
    }
}