package jnpf.controller; import cn.dev33.satoken.same.SaSameUtil; import jakarta.validation.Valid; import jnpf.base.ActionResult; import jnpf.exception.DataException; import jnpf.fileStorage.dms.FileContentImportService; import jnpf.model.filecontent.FileContentImportForm; import jnpf.model.filecontent.FileContentReceipt; 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-content") @RequiredArgsConstructor public class FileContentController { private final FileContentImportService imports; @PostMapping("/same-content") public ActionResult sameContent(@RequestHeader("X-DMS-Service-Id") String serviceId, @RequestBody jnpf.model.filecontent.FileContentComparisonForm form) { SaSameUtil.checkCurrentRequestToken(); if (!"jnpf-dms".equals(serviceId)) throw new DataException("文件内容校验调用来源无效"); return ActionResult.success(imports.sameContent(form)); } @PostMapping("/imports") public ActionResult importContent( @RequestHeader("X-DMS-Service-Id") String serviceId, @RequestBody @Valid FileContentImportForm form) { SaSameUtil.checkCurrentRequestToken(); if (!"jnpf-dms".equals(serviceId)) throw new DataException("物理文件导入调用来源无效"); return ActionResult.success(imports.importContent(form)); } }