package jnpf.elnController;
|
|
import cn.dev33.satoken.same.SaSameUtil;
|
import jnpf.base.ActionResult;
|
import jnpf.eln.RecordFillApi;
|
import jnpf.eln.RecordFillSaveCommand;
|
import jnpf.eln.RecordFillSaveOperation;
|
import jnpf.elnService.ElnRecordFillAccessService;
|
import jnpf.util.NoDataSourceBind;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@RestController
|
@RequestMapping("/Internal/eln/recordFill")
|
public class ElnRecordFillInternalController implements RecordFillApi {
|
private final ElnRecordFillAccessService accessService;
|
|
public ElnRecordFillInternalController(ElnRecordFillAccessService accessService) {
|
this.accessService = accessService;
|
}
|
|
@Override
|
@PostMapping("/access")
|
@NoDataSourceBind
|
public ActionResult<Boolean> canFill(@RequestParam("tenantId") String tenantId,
|
@RequestParam("userId") String userId,
|
@RequestParam("recordId") String recordId,
|
@RequestParam("fileId") String fileId) {
|
SaSameUtil.checkCurrentRequestToken();
|
return ActionResult.success(accessService.canFill(tenantId, userId, recordId, fileId));
|
}
|
|
@Override
|
@PostMapping("/preflight")
|
@NoDataSourceBind
|
public ActionResult<RecordFillSaveOperation> preflight(@RequestBody RecordFillSaveCommand command) {
|
SaSameUtil.checkCurrentRequestToken();
|
return ActionResult.success(accessService.preflight(command));
|
}
|
|
@Override
|
@PostMapping("/commit")
|
@NoDataSourceBind
|
public ActionResult<RecordFillSaveOperation> commit(@RequestBody RecordFillSaveCommand command) {
|
SaSameUtil.checkCurrentRequestToken();
|
return ActionResult.success(accessService.commit(command));
|
}
|
|
@Override
|
@PostMapping("/abort")
|
@NoDataSourceBind
|
public ActionResult<RecordFillSaveOperation> abort(@RequestBody RecordFillSaveCommand command) {
|
SaSameUtil.checkCurrentRequestToken();
|
return ActionResult.success(accessService.abort(command));
|
}
|
|
@Override
|
@PostMapping("/saveStatus")
|
@NoDataSourceBind
|
public ActionResult<RecordFillSaveOperation> saveStatus(@RequestParam("tenantId") String tenantId,
|
@RequestParam("operationCode") String operationCode) {
|
SaSameUtil.checkCurrentRequestToken();
|
return ActionResult.success(accessService.saveStatus(tenantId, operationCode));
|
}
|
}
|