wujianwei
7 天以前 512ca48f967e5a3702a53dc029456ea1a9d452ba
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
74
75
76
77
78
package com.ruoyi.api.third.controller;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.tms.domain.PayableAuditLog;
import com.ruoyi.tms.domain.ReceivableAuditLog;
import com.ruoyi.tms.service.IPayableAuditLogService;
import com.ruoyi.tms.service.IReceivableAuditLogService;
 
import lombok.extern.slf4j.Slf4j;
 
/**
 * 审核日志接收Controller
 * 用于接收其他系统发送的应付账单和应收账单的审核日志
 *
 * @author ruoyi
 * @date 2026-04-07
 */
@RestController
@RequestMapping("/api/third/audit")
@Slf4j
public class AuditLogController {
 
    @Autowired
    private IPayableAuditLogService payableAuditLogService;
 
    @Autowired
    private IReceivableAuditLogService receivableAuditLogService;
 
    /**
     * 接收应付账单审核日志
     *
     * @param auditLog 应付账单审核日志
     * @return 结果
     */
    @PostMapping("/ap-bill")
    public AjaxResult receiveApBillAuditLog(@RequestBody PayableAuditLog auditLog) {
        try {
            log.info("接收到应付账单审核日志: {}", auditLog);
            int result = payableAuditLogService.insertPayableAuditLog(auditLog);
            if (result > 0) {
                return AjaxResult.success("接收成功");
            } else {
                return AjaxResult.error("接收失败");
            }
        } catch (Exception e) {
            log.error("接收应付账单审核日志失败", e);
            return AjaxResult.error("接收失败: " + e.getMessage());
        }
    }
 
    /**
     * 接收应收账单审核日志
     *
     * @param auditLog 应收账单审核日志
     * @return 结果
     */
    @PostMapping("/ar-bill")
    public AjaxResult receiveArBillAuditLog(@RequestBody ReceivableAuditLog auditLog) {
        try {
            log.info("接收到应收账单审核日志: {}", auditLog);
            int result = receivableAuditLogService.insertReceivableAuditLog(auditLog);
            if (result > 0) {
                return AjaxResult.success("接收成功");
            } else {
                return AjaxResult.error("接收失败");
            }
        } catch (Exception e) {
            log.error("接收应收账单审核日志失败", e);
            return AjaxResult.error("接收失败: " + e.getMessage());
        }
    }
}