|
|
|
@ -44,8 +44,9 @@ public class EnforcementRegistrationReportImpl implements IEnforcementRegistrati |
|
|
|
public RegistrationStatisticsVo statistics(EnforcementRegistrationBo bo) { |
|
|
|
String checkCategoryCode = StringUtils.isNotBlank(bo.getCheckCategory()) ? bo.getCheckCategory() : "01"; |
|
|
|
|
|
|
|
// 单条SQL聚合查询,数据权限由 @EfcodeDataFilter 拦截器自动处理
|
|
|
|
RegistrationStatisticsVo vo = registrationMapper.selectReportStatistics(bo, null, checkCategoryCode); |
|
|
|
// 单条SQL聚合查询,手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id)
|
|
|
|
String dataFilter = buildDualColumnFilter(""); |
|
|
|
RegistrationStatisticsVo vo = registrationMapper.selectReportStatistics(bo, dataFilter, checkCategoryCode); |
|
|
|
if (vo == null) { |
|
|
|
vo = new RegistrationStatisticsVo(); |
|
|
|
} |
|
|
|
@ -84,8 +85,10 @@ public class EnforcementRegistrationReportImpl implements IEnforcementRegistrati |
|
|
|
@Override |
|
|
|
public TableDataInfo<EnforcementRegistrationVo> listForV2(EnforcementRegistrationBo bo, PageQuery pageQuery) { |
|
|
|
// V2:SQL层JOIN字典表排序 + 服务端分页(依赖district/street已回填)
|
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id),表别名 er
|
|
|
|
Page<EnforcementRegistrationVo> page = pageQuery.build(); |
|
|
|
IPage<EnforcementRegistrationVo> result = registrationMapper.selectReportPageV2(page, bo, null); |
|
|
|
String dataFilter = buildDualColumnFilter("er"); |
|
|
|
IPage<EnforcementRegistrationVo> result = registrationMapper.selectReportPageV2(page, bo, dataFilter); |
|
|
|
return TableDataInfo.build(result); |
|
|
|
} |
|
|
|
|
|
|
|
@ -100,7 +103,9 @@ public class EnforcementRegistrationReportImpl implements IEnforcementRegistrati |
|
|
|
*/ |
|
|
|
private List<EnforcementRegistrationVo> loadAndSortAll(EnforcementRegistrationBo bo) { |
|
|
|
Page<EnforcementRegistrationVo> page = new Page<>(1, Integer.MAX_VALUE, false); |
|
|
|
IPage<EnforcementRegistrationVo> result = registrationMapper.selectReportPage(page, bo, null); |
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id),无表别名
|
|
|
|
String dataFilter = buildDualColumnFilter(""); |
|
|
|
IPage<EnforcementRegistrationVo> result = registrationMapper.selectReportPage(page, bo, dataFilter); |
|
|
|
List<EnforcementRegistrationVo> records = result.getRecords(); |
|
|
|
// 从企业地址中解析区域/街道并按字典顺序排序
|
|
|
|
return enrichAndSortByDictOrder(records); |
|
|
|
@ -238,8 +243,10 @@ public class EnforcementRegistrationReportImpl implements IEnforcementRegistrati |
|
|
|
@Override |
|
|
|
public List<RegistrationExportV2Vo> exportListV2(EnforcementRegistrationBo bo) { |
|
|
|
// 使用V2排序:Sql JOIN字典表排序,全量加载
|
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id),表别名 er
|
|
|
|
Page<EnforcementRegistrationVo> page = new Page<>(1, Integer.MAX_VALUE, false); |
|
|
|
IPage<EnforcementRegistrationVo> result = registrationMapper.selectReportPageV2(page, bo, null); |
|
|
|
String dataFilter = buildDualColumnFilter("er"); |
|
|
|
IPage<EnforcementRegistrationVo> result = registrationMapper.selectReportPageV2(page, bo, dataFilter); |
|
|
|
List<EnforcementRegistrationVo> dataList = result.getRecords(); |
|
|
|
|
|
|
|
// 字典翻译
|
|
|
|
@ -291,8 +298,9 @@ public class EnforcementRegistrationReportImpl implements IEnforcementRegistrati |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ChartDataVo> categoryChart(EnforcementRegistrationBo bo) { |
|
|
|
// 数据权限由 @EfcodeDataFilter 拦截器自动处理
|
|
|
|
List<ChartDataVo> list = registrationMapper.selectReportCategoryChart(bo, null); |
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id)
|
|
|
|
String dataFilter = buildDualColumnFilter(""); |
|
|
|
List<ChartDataVo> list = registrationMapper.selectReportCategoryChart(bo, dataFilter); |
|
|
|
|
|
|
|
// 字典翻译
|
|
|
|
Map<String, String> dictMap = dictTypeService.selectDictDataByType("law_enforce_category").stream() |
|
|
|
@ -310,19 +318,22 @@ public class EnforcementRegistrationReportImpl implements IEnforcementRegistrati |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ChartDataVo> deptRankChart(EnforcementRegistrationBo bo) { |
|
|
|
// 数据权限由 @EfcodeDataFilter 拦截器自动处理
|
|
|
|
return registrationMapper.selectReportDeptRankChart(bo, null); |
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id)
|
|
|
|
String dataFilter = buildDualColumnFilter(""); |
|
|
|
return registrationMapper.selectReportDeptRankChart(bo, dataFilter); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ChartDataVo> enterpriseRankChart(EnforcementRegistrationBo bo) { |
|
|
|
// 数据权限由 @EfcodeDataFilter 拦截器自动处理
|
|
|
|
return registrationMapper.selectReportEnterpriseRankChart(bo, null); |
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id)
|
|
|
|
String dataFilter = buildDualColumnFilter(""); |
|
|
|
return registrationMapper.selectReportEnterpriseRankChart(bo, dataFilter); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public TableDataInfo<RegistrationAnalysisVo> analysisRank(EnforcementRegistrationBo bo, PageQuery pageQuery) { |
|
|
|
String dataFilter = DataFilterUtil.buildFilterSql(true, true); |
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id)
|
|
|
|
String dataFilter = buildDualColumnFilter(""); |
|
|
|
List<RegistrationAnalysisVo> analysisList = registrationMapper.selectReportAnalysisList(bo, dataFilter); |
|
|
|
|
|
|
|
// 手动分页
|
|
|
|
@ -338,7 +349,26 @@ public class EnforcementRegistrationReportImpl implements IEnforcementRegistrati |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<RegistrationAnalysisVo> analysisAll(EnforcementRegistrationBo bo) { |
|
|
|
String dataFilter = DataFilterUtil.buildFilterSql(true, true); |
|
|
|
// 手动构建双列权限过滤(bureau_dept_id OR entrust_dept_id)
|
|
|
|
String dataFilter = buildDualColumnFilter(""); |
|
|
|
return registrationMapper.selectReportAnalysisList(bo, dataFilter); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 构建双列数据权限过滤条件:bureau_dept_id(执法单位)或 entrust_dept_id(委托执法部门)。 |
|
|
|
* <p>任一列在权限范围内即可保留记录。带 "AND " 前缀,可直接拼在现有 WHERE 条件后。 |
|
|
|
* <p>超管或 ViewAllDataRole 返回 null(不过滤)。 |
|
|
|
* |
|
|
|
* @param tableAlias 表别名(不带点),无别名传 "" |
|
|
|
* @return 拼接后的 "AND (...)" SQL片段;超管/全数据角色返回 null |
|
|
|
*/ |
|
|
|
private String buildDualColumnFilter(String tableAlias) { |
|
|
|
String bureauFilter = DataFilterUtil.buildFilterSql(tableAlias, "bureau_dept_id", true, true); |
|
|
|
if (bureauFilter == null) { |
|
|
|
// 超管或 ViewAllDataRole,全部放行
|
|
|
|
return null; |
|
|
|
} |
|
|
|
String entrustFilter = DataFilterUtil.buildFilterSql(tableAlias, "entrust_dept_id", true, true); |
|
|
|
return "AND (" + bureauFilter + " OR " + entrustFilter + ")"; |
|
|
|
} |
|
|
|
} |
|
|
|
|