/**
|
* 典型案例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;
|