tony.cheng
2026-02-05 c17c80a5d4b4ceb8f4347e43da14c0c31c0615f7
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
 * 典型案例API Service
 * 处理调解案例和判决文书相关接口
 * 接口前缀: /api/web/dyhCaseInfo/* 和 /api/web/cpwsCaseInfo/*
 */
 
import { request } from './request';
 
class CaseAPIService {
  /**
   * 调解案例分页查询
   * GET /api/web/dyhCaseInfo/page
   * @param {Object} params - 查询参数
   * @param {number} params.page - 当前页码
   * @param {number} params.size - 每页记录数量
   * @param {string} params.keyword - 查询关键词
   * @param {string} params.caseTypeFirst - 纠纷一级类型
   * @param {string} params.occurrenceYears - 发生时间
   * @param {string} params.regionList - 纠纷发生地
   * @returns {Promise} 分页数据
   */
  static getMediationCases(params = {}) {
    return request.get('/api/web/dyhCaseInfo/page', params);
  }
 
  /**
   * 判决文书分页查询
   * GET /api/web/cpwsCaseInfo/page
   * @param {Object} params - 查询参数
   * @param {number} params.page - 当前页码
   * @param {number} params.size - 每页记录数量
   * @param {string} params.keyword - 查询关键词
   * @param {string} params.caseTypeFirst - 纠纷一级类型
   * @param {string} params.occurrenceYears - 发生时间
   * @param {string} params.regionList - 纠纷发生地
   * @returns {Promise} 分页数据
   */
  static getCourtCases(params = {}) {
    return request.get('/api/web/cpwsCaseInfo/page', params);
  }
 
  /**
   * 纠纷发生地筛选统计
   * GET /api/web/cpwsCaseInfo/areaCount
   * @returns {Promise} 地区统计信息
   */
  static getAreaStatistics() {
    return request.get('/api/web/cpwsCaseInfo/areaCount');
  }
 
  /**
   * 年份统计筛选
   * GET /api/web/cpwsCaseInfo/yearCount
   * @returns {Promise} 年份统计信息
   */
  static getYearStatistics() {
    return request.get('/api/web/cpwsCaseInfo/yearCount');
  }
 
  /**
   * 判决文书详情
   * GET /api/web/cpwsCaseInfo/getById
   * @param {string} id - 文书ID
   * @returns {Promise} 文书详情
   */
  static getCourtCaseDetail(id) {
    return request.get(`/api/web/cpwsCaseInfo/getById?id=${id}`);
  }
 
  /**
   * 调解案件详情
   * GET /api/web/dyhCaseInfo/getById
   * @param {string} id - 案件ID
   * @returns {Promise} 案件详情
   */
  static getMediationCaseDetail(id) {
    return request.get(`/api/web/dyhCaseInfo/getById?id=${id}`);
  }
 
  /**
   * 调解案件年份统计
   * GET /api/web/dyhCaseInfo/yearCount
   * @returns {Promise} 调解案件年份统计
   */
  static getMediationYearStatistics() {
    return request.get('/api/web/dyhCaseInfo/yearCount');
  }
 
  /**
   * 统一分页查询方法(兼容调解案例和判决文书)
   * @param {string} type - 案例类型 ('mediation' | 'court')
   * @param {Object} params - 查询参数
   * @returns {Promise} 分页数据
   */
  static getCasesByType(type, params = {}) {
    if (type === 'mediation') {
      return this.getMediationCases(params);
    } else if (type === 'court') {
      return this.getCourtCases(params);
    } else {
      return Promise.reject(new Error('无效的案例类型'));
    }
  }
 
  /**
   * 统一详情查询方法
   * @param {string} type - 案例类型 ('mediation' | 'court')
   * @param {string} id - 案例ID
   * @returns {Promise} 案例详情
   */
  static getCaseDetailByType(type, id) {
    if (type === 'mediation') {
      return this.getMediationCaseDetail(id);
    } else if (type === 'court') {
      return this.getCourtCaseDetail(id);
    } else {
      return Promise.reject(new Error('无效的案例类型'));
    }
  }
}
 
export default CaseAPIService;