刘光辉
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package jnpf.dmsController;
 
import cn.dev33.satoken.annotation.SaCheckLogin;
import jakarta.validation.Valid;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.dmsEntity.storage.form.DmsDisableFlowEventForm;
import jnpf.dmsPermission.DmsCurrentIdentity;
import jnpf.dmsService.DmsApprovedDisableFlowService;
import jnpf.dmsService.DmsDisableOccupancyService;
import jnpf.dmsEntity.storage.form.DmsDisableSubmitValidationForm;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
 
@RestController
@SaCheckLogin
@RequiredArgsConstructor
@RequestMapping("/biz/wenjian/disable")
public class DmsApprovedDisableController {
    private final DmsCurrentIdentity identity;
    private final DmsApprovedDisableFlowService service;
    private final DmsDisableOccupancyService occupancy;
    @PostMapping("/chexiao/validate-submit")
    public ActionResult<String> validateRevoke(@RequestBody @Valid DmsDisableSubmitValidationForm form) { return validate(form,"yichexiao"); }
    @PostMapping("/shixiao/validate-submit")
    public ActionResult<String> validateInvalidate(@RequestBody @Valid DmsDisableSubmitValidationForm form) { return validate(form,"yishixiao"); }
    private ActionResult<String> validate(DmsDisableSubmitValidationForm form, String operation) {
        UserInfo user = identity.requireUser();
        occupancy.validateSubmission(identity.tenantId(user), user.getUserId(), operation, form);
        return ActionResult.success("文件占用校验通过");
    }
    @PostMapping("/chexiao/flow-event")
    public ActionResult<String> revoke(@RequestBody @Valid DmsDisableFlowEventForm form) {return sync(form,"yichexiao");}
    @PostMapping("/shixiao/flow-event")
    public ActionResult<String> invalidate(@RequestBody @Valid DmsDisableFlowEventForm form) {return sync(form,"yishixiao");}
    private ActionResult<String> sync(DmsDisableFlowEventForm form,String operation) {
        UserInfo user=identity.requireUser();String tenant=identity.tenantId(user);
        service.onEvent(tenant,form.getFlowId().trim(),form.getTaskId().trim(),operation,form.getEventType());
        return ActionResult.success("已处理文件撤销或失效流程事件");
    }
    @ExceptionHandler(org.springframework.web.client.HttpServerErrorException.class)
    public org.springframework.http.ResponseEntity<ActionResult<String>> fileUnavailable(
            org.springframework.web.client.HttpServerErrorException failure) {
        ActionResult<String> result = new ActionResult<>();
        result.setCode(failure.getStatusCode().value());
        result.setMsg(failure.getStatusText());
        return org.springframework.http.ResponseEntity.status(failure.getStatusCode()).body(result);
    }
}