Compare commits
10 Commits
49485a7ac1
...
77df1b4d3b
| Author | SHA1 | Date | |
|---|---|---|---|
| 77df1b4d3b | |||
| 256ec6da69 | |||
| e755e9d98e | |||
| 984c1c5ef3 | |||
| 1ba1152339 | |||
| ca7492c312 | |||
| 2b7aaef3c9 | |||
| ede6b613d7 | |||
| ffcadd7818 | |||
|
|
264236c74a |
@@ -1,51 +1,462 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Controller;
|
||||
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictStatsDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Service.StatisticsService;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.*;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Service.StatisticService;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Service.AttrService;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Service.DateService;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Service.CountService;
|
||||
import com.whu.edu.LyStatistic.Util.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/stats")
|
||||
public class StatisticsController {
|
||||
|
||||
@Autowired
|
||||
private StatisticsService statisticsService;
|
||||
private StatisticService statisticService;
|
||||
@Autowired
|
||||
private AttrService attrService;
|
||||
@Autowired
|
||||
private DateService dateService;
|
||||
@Autowired
|
||||
private CountService countService;
|
||||
/**
|
||||
* 小班属性
|
||||
* 入参:内业小班号NYXBH+乡XIANG
|
||||
* 出参:小班的所有属性+媒体数据
|
||||
*/
|
||||
@GetMapping("/plot/attr")
|
||||
public ApiResponse<PlotAttrDTO> getPlotAttr(@RequestParam String nyxbh, @RequestParam String xiang) {
|
||||
try {
|
||||
PlotAttrDTO data = attrService.getPlotAttributes(nyxbh, xiang);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询小班属性失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub1样地属性
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub1内所有值、t1sub1_media中的媒体数据
|
||||
*/
|
||||
@GetMapping("/t1sub1")
|
||||
public ApiResponse<List<T1sub1DTO>> getT1sub1(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub1DTO> data = attrService.getT1sub1(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询样地属性失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub2样木属性
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub2内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub2")
|
||||
public ApiResponse<List<T1sub2DTO>> getT1sub2(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub2DTO> data = attrService.getT1sub2(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询样木属性失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub4 幼树样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub4内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub4")
|
||||
public ApiResponse<List<T1sub4DTO>> getT1sub4(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub4DTO> data = attrService.getT1sub4(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询幼树样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub6 下木样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub6内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub6")
|
||||
public ApiResponse<List<T1sub6DTO>> getT1sub6(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub6DTO> data = attrService.getT1sub6(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询下木样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub8 未成林样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub8内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub8")
|
||||
public ApiResponse<List<T1sub8DTO>> getT1sub8(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub8DTO> data = attrService.getT1sub8(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询未成林样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub12 经济林样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub12内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub12")
|
||||
public ApiResponse<List<T1sub12DTO>> getT1sub12(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub12DTO> data = attrService.getT1sub12(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询经济林样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub201 灌木样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub201内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub201")
|
||||
public ApiResponse<List<T1sub201DTO>> getT1sub201(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub201DTO> data = attrService.getT1sub201(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询灌木样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub202 藤本样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub202内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub202")
|
||||
public ApiResponse<List<T1sub202DTO>> getT1sub202(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub202DTO> data = attrService.getT1sub202(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询藤本样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub203 草本样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub203内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub203")
|
||||
public ApiResponse<List<T1sub203DTO>> getT1sub203(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub203DTO> data = attrService.getT1sub203(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询草本样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub204 地被样方
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub204内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub204")
|
||||
public ApiResponse<List<T1sub204DTO>> getT1sub204(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub204DTO> data = attrService.getT1sub204(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询地被样方失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub25 目测项目表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub25内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub25")
|
||||
public ApiResponse<List<T1sub25DTO>> getT1sub25(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub25DTO> data = attrService.getT1sub25(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询目测项目表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t3sub 散生单木表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t3sub内所有值
|
||||
*/
|
||||
@GetMapping("/t3sub")
|
||||
public ApiResponse<List<T3subDTO>> getT3sub(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T3subDTO> data = attrService.getT3sub(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询散生单木表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t4sub 四旁树单木表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t4sub内所有值
|
||||
*/
|
||||
@GetMapping("/t4sub")
|
||||
public ApiResponse<List<T4subDTO>> getT4sub(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T4subDTO> data = attrService.getT4sub(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询四旁树单木表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub5 幼树表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub5内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub5")
|
||||
public ApiResponse<List<T1sub5DTO>> getT1sub5(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub5DTO> data = attrService.getT1sub5(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询幼树表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub7 下木表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub7内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub7")
|
||||
public ApiResponse<List<T1sub7DTO>> getT1sub7(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub7DTO> data = attrService.getT1sub7(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询下木表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub9 未成林表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub9内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub9")
|
||||
public ApiResponse<List<T1sub9DTO>> getT1sub9(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub9DTO> data = attrService.getT1sub9(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询未成林表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub13 经济树种表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub13内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub13")
|
||||
public ApiResponse<List<T1sub13DTO>> getT1sub13(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub13DTO> data = attrService.getT1sub13(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询经济树种表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub21 灌木调查表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub21内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub21")
|
||||
public ApiResponse<List<T1sub21DTO>> getT1sub21(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub21DTO> data = attrService.getT1sub21(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询灌木调查表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub22 藤本调查表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub22内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub22")
|
||||
public ApiResponse<List<T1sub22DTO>> getT1sub22(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub22DTO> data = attrService.getT1sub22(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询藤本调查表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub23 草本调查表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub23内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub23")
|
||||
public ApiResponse<List<T1sub23DTO>> getT1sub23(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub23DTO> data = attrService.getT1sub23(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询草本调查表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub24 地被调查表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub24内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub24")
|
||||
public ApiResponse<List<T1sub24DTO>> getT1sub24(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub24DTO> data = attrService.getT1sub24(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询地被调查表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* t1sub251 目测单项表
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub251内所有值
|
||||
*/
|
||||
@GetMapping("/t1sub251")
|
||||
public ApiResponse<List<T1sub251DTO>> getT1sub251(@RequestParam String database, @RequestParam String id) {
|
||||
try {
|
||||
List<T1sub251DTO> data = attrService.getT1sub251(database, id);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询目测单项表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按日期返回已完成的小班数和样地数
|
||||
* 入参:date yyyy-MM-dd
|
||||
* 出参:"district": "区名",
|
||||
* "plotcount": 小班数,
|
||||
* "sampleplotcount": 样地数
|
||||
*/
|
||||
@GetMapping("/date")
|
||||
public ApiResponse<List<DatePlotDTO>> getPlotAttr(
|
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
|
||||
try {
|
||||
List<DatePlotDTO> data = dateService.getPlotAttributes(date);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询该日期已完成小班失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 区级计数
|
||||
* 入参:区名称
|
||||
* 出参:内业数量
|
||||
* 外业完成
|
||||
* 样地数量
|
||||
*/
|
||||
@GetMapping("/district/count")
|
||||
public ApiResponse<DistrictCountDTO> getDistrictCount(@RequestParam String district) {
|
||||
try {
|
||||
DistrictCountDTO data = countService.getDistrictCount(district);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询区计数失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 小班计数
|
||||
* 入参:rootid,databasename
|
||||
* 出参:样木数等
|
||||
*/
|
||||
@GetMapping("/plot/count")
|
||||
public ApiResponse<PlotCountDTO> getPlotCount(@RequestParam String rootId, @RequestParam String databaseName) {
|
||||
try {
|
||||
PlotCountDTO data = countService.getPlotCount(rootId,databaseName);
|
||||
return ApiResponse.success(data);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询小班计数失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 区级统计
|
||||
* 出参:"completionStatus": 完成状态
|
||||
* "plotArea"小班面积
|
||||
* "plotCount"小班数量
|
||||
*/
|
||||
@GetMapping("/district")
|
||||
public ApiResponse<DistrictStatsDTO> getDistrictStats() {
|
||||
try {
|
||||
// 1️⃣ 获取 Map<区名, PlotStatsDTO>
|
||||
Map<String, PlotStatsDTO> statsMap = statisticsService.getAllDistrictStats();
|
||||
// 1️⃣ 获取各区统计 List
|
||||
List<PlotStatsDTO> statsList = statisticService.getAllDistrictStats();
|
||||
|
||||
// 2️⃣ 构建 DistrictStatsDTO
|
||||
// 2️⃣ 构建 DTO 需要的 Map
|
||||
Map<String, String> completionStatus = new LinkedHashMap<>();
|
||||
Map<String, Double> plotArea = new LinkedHashMap<>();
|
||||
Map<String, Integer> plotCount = new LinkedHashMap<>();
|
||||
|
||||
for (Map.Entry<String, PlotStatsDTO> entry : statsMap.entrySet()) {
|
||||
String district = entry.getKey();
|
||||
PlotStatsDTO stats = entry.getValue();
|
||||
for (PlotStatsDTO stats : statsList) {
|
||||
|
||||
// 计算完成状态(示例逻辑,可根据需求调整)
|
||||
// stats.getDistrict() 需要在 DTO 里有 district 字段
|
||||
String district = stats.getDistrict();
|
||||
|
||||
// 计算完成状态
|
||||
String status;
|
||||
if (safeInt(stats.getApprovedCount()) > 0) {
|
||||
status = "已完成";
|
||||
} else if (safeInt(stats.getCollectedCount()) > 0) {
|
||||
status = "未完成";
|
||||
if (safeInt(stats.getCollectedCount()) > 0) {
|
||||
status = "已采集";
|
||||
} else if (safeInt(stats.getCollectedCount()) == 0 && safeInt(stats.getPublishedUncollectedCount()) > 0) {
|
||||
status = "已发布未开始";
|
||||
} else {
|
||||
status = "未开始";
|
||||
status = "未发布";
|
||||
}
|
||||
|
||||
completionStatus.put(district, status);
|
||||
@@ -56,11 +467,76 @@ public class StatisticsController {
|
||||
DistrictStatsDTO dto = new DistrictStatsDTO(completionStatus, plotArea, plotCount);
|
||||
|
||||
return ApiResponse.success(dto);
|
||||
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("区级统计查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @GetMapping("/street")
|
||||
// public ApiResponse<StreetStatsDTO> getStreetStats(@RequestParam String district) {
|
||||
// try {
|
||||
// // 1️⃣ 获取 Map<街道名, PlotStatsDTO>
|
||||
// Map<String, PlotStatsDTO> statsMap = statisticsService.getStreetStatsByDistrict(district);
|
||||
//
|
||||
// // 2️⃣ 构建统计 DTO
|
||||
// Map<String, String> completionStatus = new LinkedHashMap<>();
|
||||
// Map<String, Double> plotArea = new LinkedHashMap<>();
|
||||
// Map<String, Integer> plotCount = new LinkedHashMap<>();
|
||||
//
|
||||
// for (Map.Entry<String, PlotStatsDTO> entry : statsMap.entrySet()) {
|
||||
// String street = entry.getKey();
|
||||
// PlotStatsDTO stats = entry.getValue();
|
||||
//
|
||||
// // 判断状态(逻辑与区级相同)
|
||||
// String status;
|
||||
// if (safeInt(stats.getApprovedCount()) > 0) {
|
||||
// status = "已完成";
|
||||
// } else if (safeInt(stats.getCollectedCount()) > 0) {
|
||||
// status = "未完成";
|
||||
// } else {
|
||||
// status = "未开始";
|
||||
// }
|
||||
//
|
||||
// completionStatus.put(street, status);
|
||||
// plotArea.put(street, safeDouble(stats.getTotalArea()));
|
||||
// plotCount.put(street, safeInt(stats.getPlotCount()));
|
||||
// }
|
||||
//
|
||||
// StreetStatsDTO dto = new StreetStatsDTO(completionStatus, plotArea, plotCount);
|
||||
//
|
||||
// return ApiResponse.success(dto);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// return ApiResponse.error("街道统计查询失败:" + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * ✅ 新增接口:一次性获取所有小班边界(无参)
|
||||
// * URL: GET /api/stats/boundaries/all
|
||||
// */
|
||||
// @GetMapping("/boundaries/all")
|
||||
// public ApiResponse<List<PlotBoundaryDTO>> getAllBoundaries() {
|
||||
// try {
|
||||
// long startTime = System.currentTimeMillis();
|
||||
//
|
||||
// // 调用 Service 获取全量数据
|
||||
// List<PlotBoundaryDTO> list = statisticsService.getAllBoundaries();
|
||||
//
|
||||
// long duration = System.currentTimeMillis() - startTime;
|
||||
// System.out.println("全量加载小班边界耗时: " + duration + "ms, 总数量: " + list.size());
|
||||
//
|
||||
// return ApiResponse.success(list);
|
||||
// } catch (Exception e) {
|
||||
// return ApiResponse.error("获取所有图斑边界失败:" + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
// 防止 null
|
||||
private int safeInt(Integer value) {
|
||||
return (value != null) ? value : 0;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DatePlotDTO {
|
||||
private String district;
|
||||
private int plotcount;
|
||||
private int sampleplotcount;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DistrictCountDTO {
|
||||
private String ny;
|
||||
private String wy;
|
||||
private String yd;
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlotAttrDTO {
|
||||
private String id;
|
||||
private String databaseName;
|
||||
private String taskName;
|
||||
private String tableName;
|
||||
private String collectorName;
|
||||
private String bc0;
|
||||
private String bc1;
|
||||
private String bc2;
|
||||
private String bc3;
|
||||
private String bc4;
|
||||
private String bcl;
|
||||
private String bgDlbm;
|
||||
private String bhdj;
|
||||
private String bhlydj;
|
||||
private String bz;
|
||||
private String cbgd;
|
||||
private String cun;
|
||||
private String diLei;
|
||||
private String diMao;
|
||||
private String djmxjbdj;
|
||||
private String dwhj;
|
||||
private String dwzl;
|
||||
private String fzzhd;
|
||||
private String fzzhddm;
|
||||
private String gcfq;
|
||||
private String gclx;
|
||||
private String gmgd;
|
||||
private String gmgddj;
|
||||
private String gmlgd;
|
||||
private String grlx;
|
||||
private String grqd;
|
||||
private String haiBa;
|
||||
private String hj;
|
||||
private String hqjycslx;
|
||||
private String huoLmXj;
|
||||
private String jjlcq;
|
||||
private String jjz;
|
||||
private String jtqw;
|
||||
private String jycslx;
|
||||
private String kdmFblx;
|
||||
private String kdmSl;
|
||||
private String kjd;
|
||||
private String kyqk;
|
||||
private String kzlyhd;
|
||||
private String kzlyhddm;
|
||||
private String lcjg;
|
||||
private String ldaiHj;
|
||||
private String ldaiHs;
|
||||
private String ldaiZj;
|
||||
private String ldbhdj;
|
||||
private String ldfljd;
|
||||
private String ldlx;
|
||||
private String ldshdj;
|
||||
private String ldsyqsO;
|
||||
private String ldsyqsU;
|
||||
private String ldwsdj;
|
||||
private String ldzldj;
|
||||
private String lfccl;
|
||||
private String lfccldj;
|
||||
private String lfcclDj;
|
||||
private String linChang;
|
||||
private String linZhong;
|
||||
private String lj;
|
||||
private String ljz;
|
||||
private String lmqs;
|
||||
private String lmsyqs;
|
||||
private String lmzl;
|
||||
private String lmzldj;
|
||||
private String lxjjzl;
|
||||
private String lyzylb;
|
||||
private String meiGqXj;
|
||||
private String nyxbh;
|
||||
private String pjmsg;
|
||||
private String pjmxj;
|
||||
private String pjnl;
|
||||
private String pjSg;
|
||||
private String pjXj;
|
||||
private String poDu;
|
||||
private String poDuDm;
|
||||
private String poWei;
|
||||
private String poXiang;
|
||||
private String qiYuan;
|
||||
private String qmlxj;
|
||||
private String qqjycslx;
|
||||
private String qqjycx;
|
||||
private String qyxbh;
|
||||
private String sheng;
|
||||
private String shi;
|
||||
private String sj;
|
||||
private String slhldj;
|
||||
private String sljkdj;
|
||||
private String sllb;
|
||||
private String sllyzy;
|
||||
private String slqlgc;
|
||||
private String slqljg;
|
||||
private String slzhdj;
|
||||
private String slzhlx;
|
||||
private String spljydj;
|
||||
private String spycsbl;
|
||||
private String sqdj;
|
||||
private String stqw;
|
||||
private String szjg;
|
||||
private String szzc;
|
||||
private String tchd;
|
||||
private String tchddm;
|
||||
private String tdgllx;
|
||||
private String trgxdj;
|
||||
private String trlx;
|
||||
private String trmc;
|
||||
private String trzd;
|
||||
private String wclZdfs;
|
||||
private String wclZdgg;
|
||||
private String xbh;
|
||||
private String xbmj;
|
||||
private String xbmjGq;
|
||||
private String xbz;
|
||||
private String xbzs;
|
||||
private String xian;
|
||||
private String xiang;
|
||||
private String xiBh;
|
||||
private String ybddj;
|
||||
private String yds;
|
||||
private String yssz;
|
||||
private String yuBiDu;
|
||||
private String zbfglx;
|
||||
private String zbgd;
|
||||
private String zbzgd;
|
||||
private String zdkjlx;
|
||||
private String zfsblx;
|
||||
private String zhj;
|
||||
private String zj;
|
||||
private String zlnd;
|
||||
private String zlwz;
|
||||
private String zrd;
|
||||
private String zynt;
|
||||
private String collector;
|
||||
private String collector0;
|
||||
private String createTime;
|
||||
private String reason;
|
||||
private String reviewer;
|
||||
private String reviewer0;
|
||||
private String shape;
|
||||
private String status;
|
||||
private String updateTime;
|
||||
private String updateTime0;
|
||||
private String version;
|
||||
private List<String> mediaPathList;
|
||||
// 这里需要生成getter和setter方法
|
||||
// 可以使用IDE自动生成或Lombok注解
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlotBoundaryDTO {
|
||||
/**
|
||||
* 小班唯一标识 (对应 SQL 中的 "ID")
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 小班边界 GeoJSON (对应 SQL 中的 "shape")
|
||||
* 存储内容示例: {"type":"MultiPolygon","coordinates":...}
|
||||
*/
|
||||
private String shape;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlotCountDTO {
|
||||
private Integer yds;
|
||||
private Integer ysyfs;
|
||||
private Integer xmyfs;
|
||||
private Integer wclyfs;
|
||||
private Integer jjlyfs;
|
||||
private Integer gmyfs;
|
||||
private Integer tbyfs;
|
||||
private Integer cbyfs;
|
||||
private Integer dbyfs;
|
||||
private Integer mcxms;
|
||||
private Integer ssms;
|
||||
private Integer spss;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlotImageDTO {
|
||||
private String id;
|
||||
private String databaseName;
|
||||
|
||||
}
|
||||
@@ -8,13 +8,16 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlotStatsDTO {
|
||||
private String district;
|
||||
|
||||
private Integer plotCount; // 图斑总数量
|
||||
private Double totalArea; // 图斑总面积(sum XBMJ)
|
||||
|
||||
private Integer unPassedCount; // -1 审核未通过
|
||||
private Integer assignedCount; // 0 已分配,未审核
|
||||
private Integer collectedCount; // 1 已采集,未审核
|
||||
private Integer approvedCount; // 2 已审核
|
||||
// private Integer unPassedCount; // -1 审核未通过
|
||||
// private Integer assignedCount; // 0 已分配,未审核
|
||||
// private Integer collectedCount; // 1 已采集,未审核
|
||||
// private Integer approvedCount; // 2 已审核
|
||||
private Integer collectedCount; // collector/reviewer有一个不是-1:已采集
|
||||
private Integer publishedUncollectedCount; // collector/reviewer均为-1:已发布未采集
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StreetStatsDTO {
|
||||
private Map<String, String> completionStatus; // 区 -> 完成状态
|
||||
private Map<String, Double> plotArea; // 区 -> 图斑面积
|
||||
private Map<String, Integer> plotCount; // 区 -> 图斑数量
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class T1sub1DTO {
|
||||
private String databaseName;
|
||||
private String id;
|
||||
private String bz;
|
||||
private String mgqxj;
|
||||
|
||||
// 对应 MGQZS
|
||||
private String mgqzs;
|
||||
|
||||
// 对应 PJ_XJ
|
||||
private String pjXj;
|
||||
|
||||
// 对应 TYPE
|
||||
private String type;
|
||||
|
||||
// 对应 YDZXJ
|
||||
private String ydzxj;
|
||||
|
||||
// 对应 ZS
|
||||
private String zs;
|
||||
|
||||
// 对应 angle
|
||||
private String angle;
|
||||
|
||||
// 对应 area
|
||||
private String area;
|
||||
|
||||
// 对应 length
|
||||
private String length;
|
||||
|
||||
// 对应 parentID (建议转为 parentId)
|
||||
private String parentId;
|
||||
|
||||
// 对应 shape
|
||||
private String shape;
|
||||
|
||||
// 对应 version
|
||||
private String version;
|
||||
|
||||
// 对应 width
|
||||
private String width;
|
||||
private List<String> mediaPathList;
|
||||
// 这里需要生成getter和setter方法
|
||||
// 可以使用IDE自动生成或Lombok注解
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class T1sub2DTO {
|
||||
private String databaseName;
|
||||
private String grandparentid;
|
||||
private String cjl;
|
||||
private String id;
|
||||
private String sz;
|
||||
private String type;
|
||||
private String type2;
|
||||
private String xj;
|
||||
private String ymh;
|
||||
private String parentId;
|
||||
private String photo;
|
||||
private String version;
|
||||
}
|
||||
@@ -4,9 +4,8 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UnitInfo {
|
||||
private String taskName;
|
||||
private String schemaCode;
|
||||
private String unitName;
|
||||
// private String taskName;
|
||||
// private String unitName;
|
||||
private String district;
|
||||
private String village;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Mapper;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AttrMapper {
|
||||
|
||||
PlotAttrDTO findPlotAttributes(@Param("nyxbh") String nyxbh,@Param("xiang") String xiang);
|
||||
List<T1sub1DTO> findT1sub1(@Param("database") String database, @Param("id") String id);
|
||||
List<T1sub2DTO> findT1sub2(@Param("database") String database, @Param("id") String id);
|
||||
List<String> findMediaPaths(@Param("id") String id,
|
||||
@Param("databaseName") String databaseName,
|
||||
@Param("table") String table);
|
||||
List<T1sub4DTO> findT1sub4(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub6DTO> findT1sub6(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub8DTO> findT1sub8(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub12DTO> findT1sub12(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub201DTO> findT1sub201(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub202DTO> findT1sub202(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub203DTO> findT1sub203(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub204DTO> findT1sub204(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub25DTO> findT1sub25(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T3subDTO> findT3sub(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T4subDTO> findT4sub(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub5DTO> findT1sub5(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub7DTO> findT1sub7(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub9DTO> findT1sub9(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub13DTO> findT1sub13(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub21DTO> findT1sub21(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub22DTO> findT1sub22(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub23DTO> findT1sub23(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub24DTO> findT1sub24(@Param("database") String database, @Param("id") String id);
|
||||
|
||||
List<T1sub251DTO> findT1sub251(@Param("database") String database, @Param("id") String id);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Mapper;
|
||||
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotCountDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* TaskCommonMapper.xml
|
||||
* 区、小班的计数
|
||||
*/
|
||||
@Mapper
|
||||
public interface CountMapper {
|
||||
|
||||
/**
|
||||
* 按照区统计数量(内业外业样地数量)
|
||||
* @return 统计结果 DTO
|
||||
*/
|
||||
DistrictCountDTO loadDistrictCount(String district);
|
||||
|
||||
/**
|
||||
* 按照小班统计数量(样地数量)
|
||||
* @return 统计结果 DTO
|
||||
*/
|
||||
PlotCountDTO loadPlotCount(String rootId, String databaseName);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Mapper;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DatePlotDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DateMapper {
|
||||
|
||||
List<DatePlotDTO> finishedPlot(@Param("date") Date date);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Mapper;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TaskCommonMapper.xml
|
||||
* 通用 Mapper,用于不同 schema 下的 roottable1 表
|
||||
*/
|
||||
@Mapper
|
||||
public interface StatisticMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 按照区统计图斑信息(数量、面积、各状态)
|
||||
* @return 统计结果 DTO
|
||||
*/
|
||||
List<PlotStatsDTO> selectPlotStatsByDistrict();
|
||||
|
||||
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Mapper;
|
||||
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
|
||||
//import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotDetailDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TaskCommonMapper.xml
|
||||
@@ -21,6 +18,12 @@ public interface TaskCommonMapper {
|
||||
*/
|
||||
PlotStatsDTO selectPlotStats(@Param("schema") String schema);
|
||||
|
||||
/**
|
||||
* 获取所有小班的ID和边界信息
|
||||
* * @param schema 动态传入的数据库模式名
|
||||
* @return 包含ID和GeoJSON的列表
|
||||
*/
|
||||
// List<PlotBoundaryDTO> selectAllPlotBoundaries(@Param("schema") String schema);
|
||||
// /**
|
||||
// * 查询单个图斑详情
|
||||
// * @param schema schema 名
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Service;
|
||||
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.AttrMapper;
|
||||
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class AttrService {
|
||||
@Autowired
|
||||
private AttrMapper attrMapper; // 查询 unit_info 表
|
||||
/**
|
||||
* 查询小班属性
|
||||
* 条件:NYXBH + XIANG
|
||||
*/
|
||||
public PlotAttrDTO getPlotAttributes(String nyxbh, String xiang){
|
||||
// ① 通过 NYXBH + XIANG
|
||||
PlotAttrDTO schema = attrMapper.findPlotAttributes(nyxbh, xiang);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的小班所在任务 schema");
|
||||
}
|
||||
|
||||
// 第二次查 media_path 列表
|
||||
List<String> mediaPaths = attrMapper.findMediaPaths(schema.getId(), schema.getDatabaseName(),"merged.roottable1_media_merged");
|
||||
|
||||
// 设置到 DTO 中
|
||||
schema.setMediaPathList(mediaPaths);
|
||||
|
||||
return schema;
|
||||
}
|
||||
/**
|
||||
* t1sub1样地属性
|
||||
* 入参:database_name+ID
|
||||
* 出参:t1sub1内所有值、t1sub1_media中的媒体数据
|
||||
*/
|
||||
public List<T1sub1DTO> getT1sub1(String database, String id){
|
||||
|
||||
// 查询得到 List<T1sub1DTO>
|
||||
List<T1sub1DTO> schema = attrMapper.findT1sub1(database, id);
|
||||
if (schema == null || schema.isEmpty()) {
|
||||
throw new RuntimeException("未找到对应的样地所在任务 schema");
|
||||
}
|
||||
|
||||
// 为每条 DTO 设置 mediaPathList
|
||||
for (T1sub1DTO dto : schema) {
|
||||
List<String> mediaPaths = attrMapper.findMediaPaths(
|
||||
dto.getId(),
|
||||
dto.getDatabaseName(),
|
||||
"merged.t1sub1_media_merged"
|
||||
);
|
||||
dto.setMediaPathList(mediaPaths);
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
|
||||
public List<T1sub2DTO> getT1sub2(String database, String id){
|
||||
List<T1sub2DTO> schema = attrMapper.findT1sub2(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的样木所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub4DTO> getT1sub4(String database, String id){
|
||||
List<T1sub4DTO> schema = attrMapper.findT1sub4(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的幼树样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub6DTO> getT1sub6(String database, String id){
|
||||
List<T1sub6DTO> schema = attrMapper.findT1sub6(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的下木样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub8DTO> getT1sub8(String database, String id){
|
||||
List<T1sub8DTO> schema = attrMapper.findT1sub8(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的未成林样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub12DTO> getT1sub12(String database, String id){
|
||||
List<T1sub12DTO> schema = attrMapper.findT1sub12(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的经济林样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub201DTO> getT1sub201(String database, String id){
|
||||
List<T1sub201DTO> schema = attrMapper.findT1sub201(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的灌木样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub202DTO> getT1sub202(String database, String id){
|
||||
List<T1sub202DTO> schema = attrMapper.findT1sub202(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的藤本样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub203DTO> getT1sub203(String database, String id){
|
||||
List<T1sub203DTO> schema = attrMapper.findT1sub203(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的草本样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub204DTO> getT1sub204(String database, String id){
|
||||
List<T1sub204DTO> schema = attrMapper.findT1sub204(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的地被样方所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub25DTO> getT1sub25(String database, String id){
|
||||
List<T1sub25DTO> schema = attrMapper.findT1sub25(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的目测项目表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T3subDTO> getT3sub(String database, String id){
|
||||
List<T3subDTO> schema = attrMapper.findT3sub(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的散生单木表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T4subDTO> getT4sub(String database, String id){
|
||||
List<T4subDTO> schema = attrMapper.findT4sub(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的四旁树单木表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub5DTO> getT1sub5(String database, String id){
|
||||
List<T1sub5DTO> schema = attrMapper.findT1sub5(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的幼树表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub7DTO> getT1sub7(String database, String id){
|
||||
List<T1sub7DTO> schema = attrMapper.findT1sub7(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的下木表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub9DTO> getT1sub9(String database, String id){
|
||||
List<T1sub9DTO> schema = attrMapper.findT1sub9(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的未成林表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub13DTO> getT1sub13(String database, String id){
|
||||
List<T1sub13DTO> schema = attrMapper.findT1sub13(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的经济树种表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub21DTO> getT1sub21(String database, String id){
|
||||
List<T1sub21DTO> schema = attrMapper.findT1sub21(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的灌木调查表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub22DTO> getT1sub22(String database, String id){
|
||||
List<T1sub22DTO> schema = attrMapper.findT1sub22(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的藤本调查表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub23DTO> getT1sub23(String database, String id){
|
||||
List<T1sub23DTO> schema = attrMapper.findT1sub23(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的草本调查表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub24DTO> getT1sub24(String database, String id){
|
||||
List<T1sub24DTO> schema = attrMapper.findT1sub24(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的地被调查表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
public List<T1sub251DTO> getT1sub251(String database, String id){
|
||||
List<T1sub251DTO> schema = attrMapper.findT1sub251(database, id);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应的目测单项表所在任务 schema");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
}
|
||||
@@ -21,13 +21,13 @@ public class BaseTaskQueryService {
|
||||
PlotStatsDTO stats = taskCommonMapper.selectPlotStats(schema);
|
||||
if (stats == null) {
|
||||
// 防止 mapper 返回 null
|
||||
return new PlotStatsDTO(0, 0.0, 0, 0, 0, 0);
|
||||
return new PlotStatsDTO( "0", 0, 0.0, 0, 0);
|
||||
}
|
||||
return stats;
|
||||
} catch (Exception e) {
|
||||
// 表不存在或 schema 不存在,直接跳过
|
||||
// 不管是什么异常,都返回默认统计,保证批量统计不被中断
|
||||
return new PlotStatsDTO(0, 0.0, 0, 0, 0, 0);
|
||||
return new PlotStatsDTO( "0", 00, 0.0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Service;
|
||||
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotCountDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.CountMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CountService {
|
||||
|
||||
@Autowired
|
||||
private CountMapper countMapper;
|
||||
|
||||
/**
|
||||
* 查询区的计数信息
|
||||
*/
|
||||
public DistrictCountDTO getDistrictCount(String district) {
|
||||
DistrictCountDTO data = countMapper.loadDistrictCount(district);
|
||||
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* 查询小班的计数信息
|
||||
*/
|
||||
public PlotCountDTO getPlotCount(String rootId, String databaseName) {
|
||||
PlotCountDTO data = countMapper.loadPlotCount(rootId,databaseName);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Service;
|
||||
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.DatePlotDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.DateMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DateService {
|
||||
@Autowired
|
||||
private DateMapper dateMapper; // 查询 unit_info 表
|
||||
/**
|
||||
* 查询小班属性
|
||||
* 条件:NYXBH + XIANG
|
||||
*/
|
||||
public List<DatePlotDTO> getPlotAttributes(Date date){
|
||||
List<DatePlotDTO> schema = dateMapper.finishedPlot(date);
|
||||
if (schema == null) {
|
||||
throw new RuntimeException("未找到对应时间的小班任务");
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Service;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.StatisticMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class StatisticService {
|
||||
// @Autowired
|
||||
// private InfoMapper unitInfoMapper; // 查询 unit_info 表
|
||||
//
|
||||
// @Autowired
|
||||
// private BaseTaskQueryService baseQueryService; // 通用任务查询 Service
|
||||
@Autowired
|
||||
private StatisticMapper statisticMapper;
|
||||
/**
|
||||
* 查询所有区的统计信息
|
||||
* 返回 Map<区名, PlotStatsDTO>
|
||||
*/
|
||||
public List<PlotStatsDTO> getAllDistrictStats() {
|
||||
// 直接从数据库一次性查出“按区聚合后的统计数据”
|
||||
List<PlotStatsDTO> list = statisticMapper.selectPlotStatsByDistrict();
|
||||
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 查询单个区的统计信息
|
||||
*/
|
||||
// public PlotStatsDTO getDistrictStats(String district) {
|
||||
//
|
||||
// // 1. 获取该区所有任务(schema)
|
||||
// List<UnitInfo> tasks = unitInfoMapper.findByDistrict(district);
|
||||
//
|
||||
// // 2. 初始化统计对象
|
||||
// PlotStatsDTO total = new PlotStatsDTO(0, 0.0, 0, 0, 0, 0);
|
||||
//
|
||||
// // 3. 遍历每个任务 schema,累加统计
|
||||
// for (UnitInfo task : tasks) {
|
||||
// String schema = task.getSchemaCode();
|
||||
// PlotStatsDTO stats = baseQueryService.queryPlotStats(schema);
|
||||
// merge(total, stats);
|
||||
// }
|
||||
//
|
||||
// return total;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 按街道统计(传入区名称)
|
||||
* 返回 Map<街道名, PlotStatsDTO>
|
||||
*/
|
||||
// public Map<String, PlotStatsDTO> getStreetStatsByDistrict(String district) {
|
||||
//
|
||||
// // 1️⃣ 获取该区所有任务
|
||||
// List<UnitInfo> tasksInDistrict = unitInfoMapper.findByDistrict(district);
|
||||
//
|
||||
// // 防止该区没有数据
|
||||
// if (tasksInDistrict == null || tasksInDistrict.isEmpty()) {
|
||||
// return new LinkedHashMap<>();
|
||||
// }
|
||||
//
|
||||
// // 2️⃣ 按街道分组
|
||||
// Map<String, List<UnitInfo>> groupedByStreet =
|
||||
// tasksInDistrict.stream().collect(Collectors.groupingBy(UnitInfo::getVillage));
|
||||
//
|
||||
// Map<String, PlotStatsDTO> result = new LinkedHashMap<>();
|
||||
//
|
||||
// // 3️⃣ 遍历每个街道,累加统计
|
||||
// for (Map.Entry<String, List<UnitInfo>> entry : groupedByStreet.entrySet()) {
|
||||
//
|
||||
// String street = entry.getKey();
|
||||
// List<UnitInfo> streetTasks = entry.getValue();
|
||||
//
|
||||
// // 初始化统计对象
|
||||
// PlotStatsDTO total = new PlotStatsDTO(0, 0.0, 0, 0, 0, 0);
|
||||
//
|
||||
// // 遍历该街道的所有 schema
|
||||
// for (UnitInfo task : streetTasks) {
|
||||
// String schema = task.getSchemaCode();
|
||||
// PlotStatsDTO stats = baseQueryService.queryPlotStats(schema);
|
||||
//
|
||||
// if (stats != null) {
|
||||
// total.setPlotCount(total.getPlotCount() + safeInt(stats.getPlotCount()));
|
||||
// total.setTotalArea(total.getTotalArea() + safeDouble(stats.getTotalArea()));
|
||||
// total.setUnPassedCount(total.getUnPassedCount() + safeInt(stats.getUnPassedCount()));
|
||||
// total.setAssignedCount(total.getAssignedCount() + safeInt(stats.getAssignedCount()));
|
||||
// total.setCollectedCount(total.getCollectedCount() + safeInt(stats.getCollectedCount()));
|
||||
// total.setApprovedCount(total.getApprovedCount() + safeInt(stats.getApprovedCount()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 添加到结果 Map
|
||||
// result.put(street, total);
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// public List<PlotBoundaryDTO> getAllBoundaries() {
|
||||
// List<PlotBoundaryDTO> totalBoundaries = new ArrayList<>();
|
||||
//
|
||||
// // 1. 查询所有任务信息 (UnitInfo)
|
||||
// List<UnitInfo> allTasks = unitInfoMapper.findAll();
|
||||
//
|
||||
// // 2. 遍历每个任务,查询对应的表
|
||||
// for (UnitInfo task : allTasks) {
|
||||
// String schema = task.getSchemaCode();
|
||||
// try {
|
||||
// // 调用 Mapper 查询该 schema 下的小班
|
||||
// List<PlotBoundaryDTO> boundaries = taskCommonMapper.selectAllPlotBoundaries(schema);
|
||||
//
|
||||
// if (boundaries != null && !boundaries.isEmpty()) {
|
||||
// totalBoundaries.addAll(boundaries);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// // 捕获异常(例如某个表不存在),打印日志但不中断整个流程
|
||||
// System.err.println("查询 schema 失败: " + schema + ", 错误: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return totalBoundaries;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // ✅ 防止 null 值累加
|
||||
// private int safeInt(Integer value) {
|
||||
// return (value != null) ? value : 0;
|
||||
// }
|
||||
//
|
||||
// private double safeDouble(Double value) {
|
||||
// return (value != null) ? value : 0.0;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 合并两个 PlotStatsDTO
|
||||
// */
|
||||
// private void merge(PlotStatsDTO total, PlotStatsDTO add) {
|
||||
// if (add == null) return;
|
||||
//
|
||||
// total.setPlotCount(total.getPlotCount() + add.getPlotCount());
|
||||
// total.setTotalArea(total.getTotalArea() + add.getTotalArea());
|
||||
//
|
||||
//// total.setUnPassedCount(total.getUnPassedCount() + add.getUnPassedCount());
|
||||
//// total.setAssignedCount(total.getAssignedCount() + add.getAssignedCount());
|
||||
// total.setCollectedCount(total.getCollectedCount() + add.getCollectedCount());
|
||||
// total.setPublishedUncollectedCount(total.getPublishedUncollectedCount() + add.getPublishedUncollectedCount());
|
||||
// }
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package com.whu.edu.LyStatistic.MapLyStatistic.Service;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Dto.UnitInfo;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Mapper.InfoMapper;
|
||||
import com.whu.edu.LyStatistic.MapLyStatistic.Service.BaseService.BaseTaskQueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class StatisticsService {
|
||||
@Autowired
|
||||
private InfoMapper unitInfoMapper; // 查询 unit_info 表
|
||||
|
||||
@Autowired
|
||||
private BaseTaskQueryService baseQueryService; // 通用任务查询 Service
|
||||
/**
|
||||
* 查询单个区的统计信息
|
||||
*/
|
||||
public PlotStatsDTO getDistrictStats(String district) {
|
||||
|
||||
// 1. 获取该区所有任务(schema)
|
||||
List<UnitInfo> tasks = unitInfoMapper.findByDistrict(district);
|
||||
|
||||
// 2. 初始化统计对象
|
||||
PlotStatsDTO total = new PlotStatsDTO(0, 0.0, 0, 0, 0, 0);
|
||||
|
||||
// 3. 遍历每个任务 schema,累加统计
|
||||
for (UnitInfo task : tasks) {
|
||||
String schema = task.getSchemaCode();
|
||||
PlotStatsDTO stats = baseQueryService.queryPlotStats(schema);
|
||||
merge(total, stats);
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有区的统计信息
|
||||
* 返回 Map<区名, PlotStatsDTO>
|
||||
*/
|
||||
public Map<String, PlotStatsDTO> getAllDistrictStats() {
|
||||
|
||||
// 1️⃣ 查询 unit_info 全部数据
|
||||
List<UnitInfo> allTasks = unitInfoMapper.findAll();
|
||||
|
||||
// 2️⃣ 按 district 分组
|
||||
Map<String, List<UnitInfo>> grouped =
|
||||
allTasks.stream().collect(Collectors.groupingBy(UnitInfo::getDistrict));
|
||||
|
||||
Map<String, PlotStatsDTO> result = new LinkedHashMap<>();
|
||||
|
||||
// 3️⃣ 遍历每个区,累加统计
|
||||
for (Map.Entry<String, List<UnitInfo>> entry : grouped.entrySet()) {
|
||||
|
||||
String district = entry.getKey();
|
||||
List<UnitInfo> tasks = entry.getValue();
|
||||
|
||||
// 初始化累加对象
|
||||
PlotStatsDTO total = new PlotStatsDTO(0, 0.0, 0, 0, 0, 0);
|
||||
|
||||
for (UnitInfo task : tasks) {
|
||||
String schema = task.getSchemaCode();
|
||||
PlotStatsDTO stats = baseQueryService.queryPlotStats(schema); // ✅ 使用安全方法
|
||||
|
||||
if (stats != null) {
|
||||
// 累加
|
||||
total.setPlotCount(total.getPlotCount() + safeInt(stats.getPlotCount()));
|
||||
total.setTotalArea(total.getTotalArea() + safeDouble(stats.getTotalArea()));
|
||||
total.setUnPassedCount(total.getUnPassedCount() + safeInt(stats.getUnPassedCount()));
|
||||
total.setAssignedCount(total.getAssignedCount() + safeInt(stats.getAssignedCount()));
|
||||
total.setCollectedCount(total.getCollectedCount() + safeInt(stats.getCollectedCount()));
|
||||
total.setApprovedCount(total.getApprovedCount() + safeInt(stats.getApprovedCount()));
|
||||
}
|
||||
}
|
||||
|
||||
result.put(district, total);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// ✅ 防止 null 值累加
|
||||
private int safeInt(Integer value) {
|
||||
return (value != null) ? value : 0;
|
||||
}
|
||||
|
||||
private double safeDouble(Double value) {
|
||||
return (value != null) ? value : 0.0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 合并两个 PlotStatsDTO
|
||||
*/
|
||||
private void merge(PlotStatsDTO total, PlotStatsDTO add) {
|
||||
if (add == null) return;
|
||||
|
||||
total.setPlotCount(total.getPlotCount() + add.getPlotCount());
|
||||
total.setTotalArea(total.getTotalArea() + add.getTotalArea());
|
||||
|
||||
total.setUnPassedCount(total.getUnPassedCount() + add.getUnPassedCount());
|
||||
total.setAssignedCount(total.getAssignedCount() + add.getAssignedCount());
|
||||
total.setCollectedCount(total.getCollectedCount() + add.getCollectedCount());
|
||||
total.setApprovedCount(total.getApprovedCount() + add.getApprovedCount());
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface TaskStatisticMapper {
|
||||
public interface StatisticDataMapper {
|
||||
|
||||
/**
|
||||
* 查询根表任务(支持时间范围 + 人员过滤)
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.whu.edu.LyStatistic.statistic.service;
|
||||
|
||||
import com.whu.edu.LyStatistic.statistic.dto.*;
|
||||
import com.whu.edu.LyStatistic.statistic.mapper.TaskStatisticMapper;
|
||||
import com.whu.edu.LyStatistic.statistic.mapper.StatisticDataMapper;
|
||||
import com.whu.edu.LyStatistic.statistic.mapper.UserStaffMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -18,7 +18,7 @@ public class TaskStatisticService {
|
||||
private UserStaffMapper userStaffMapper;
|
||||
|
||||
@Autowired
|
||||
private TaskStatisticMapper taskStatisticMapper;
|
||||
private StatisticDataMapper statisticDataMapper;
|
||||
|
||||
/**
|
||||
* 按 schema 和时间区间统计任务数据
|
||||
@@ -42,11 +42,11 @@ public class TaskStatisticService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
String districtName = taskStatisticMapper.getDistrictNameBySchema(schema);
|
||||
String villageName = taskStatisticMapper.getVillageNameBySchema(schema);
|
||||
String districtName = statisticDataMapper.getDistrictNameBySchema(schema);
|
||||
String villageName = statisticDataMapper.getVillageNameBySchema(schema);
|
||||
|
||||
// 2️⃣ 查询根表记录(支持时间区间)
|
||||
List<RootTask> rootTasks = taskStatisticMapper.findRootTasksByTimeRange(schema, startTime, endTime, userIds);
|
||||
List<RootTask> rootTasks = statisticDataMapper.findRootTasksByTimeRange(schema, startTime, endTime, userIds);
|
||||
if (rootTasks.isEmpty()) {
|
||||
return new TaskStatisticResult(schema, districtName, villageName, Collections.emptyList(), 0, 0, 0, 0);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class TaskStatisticService {
|
||||
// 🧩 安全封装:防止 schema 无表时报错
|
||||
private Map<Long, Integer> safeCountByParent(String schema, String table, List<Long> rootIds) {
|
||||
try {
|
||||
return taskStatisticMapper.countGroupByParent(schema, table, "parentID", rootIds)
|
||||
return statisticDataMapper.countGroupByParent(schema, table, "parentID", rootIds)
|
||||
.stream()
|
||||
.filter(m -> m.get("parentid") != null)
|
||||
.collect(Collectors.toMap(
|
||||
@@ -153,7 +153,7 @@ public class TaskStatisticService {
|
||||
|
||||
private List<Map<String, Object>> safeFindSubIds(String schema, String table, List<Long> rootIds) {
|
||||
try {
|
||||
return taskStatisticMapper.findSubIdsGroupByParent(schema, table, "parentID", rootIds);
|
||||
return statisticDataMapper.findSubIdsGroupByParent(schema, table, "parentID", rootIds);
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class TaskStatisticService {
|
||||
|
||||
private Integer safeCountByParentId(String schema, String table, Long parentId) {
|
||||
try {
|
||||
return taskStatisticMapper.countByParentId(schema, table, "parentID", parentId);
|
||||
return statisticDataMapper.countByParentId(schema, table, "parentID", parentId);
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ spring.application.name=LydcStatistic
|
||||
spring.profiles.active=dev
|
||||
server.port=9001
|
||||
server.address=0.0.0.0
|
||||
spring.datasource.host=127.0.0.1
|
||||
spring.datasource.host=120.48.89.193
|
||||
spring.datasource.port=5432
|
||||
spring.datasource.database=tj_project
|
||||
spring.datasource.database=linye_statistic
|
||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
spring.datasource.url=jdbc:postgresql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.database}?useSSL=true&allowMultiQueries=true
|
||||
spring.datasource.username=postgres
|
||||
|
||||
154
src/main/resources/mapper/MapLyStatistic/Attr.xml
Normal file
154
src/main/resources/mapper/MapLyStatistic/Attr.xml
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.whu.edu.LyStatistic.MapLyStatistic.Mapper.AttrMapper">
|
||||
<select id="findPlotAttributes" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotAttrDTO">
|
||||
SELECT *
|
||||
FROM merged.roottable1_merged
|
||||
WHERE "NYXBH" = #{nyxbh} AND "XIANG" = #{xiang}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="findT1sub1" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub1DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub1_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findMediaPaths" resultType="string">
|
||||
SELECT media_path
|
||||
FROM ${table}
|
||||
WHERE "id" = #{id}
|
||||
AND "database_name" = #{databaseName}
|
||||
ORDER BY media_path
|
||||
</select>
|
||||
|
||||
<select id="findT1sub2" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub2DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub2_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub4" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub4DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub4_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub6" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub6DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub6_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub8" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub8DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub8_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub12" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub12DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub12_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub201" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub201DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub201_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub202" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub202DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub202_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub203" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub203DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub203_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub204" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub204DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub204_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub25" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub25DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub25_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT3sub" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T3subDTO">
|
||||
SELECT *
|
||||
FROM merged.t3sub_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT4sub" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T4subDTO">
|
||||
SELECT *
|
||||
FROM merged.t4sub_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub5" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub5DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub5_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub7" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub7DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub7_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub9" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub9DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub9_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub13" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub13DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub13_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub21" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub21DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub21_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub22" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub22DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub22_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub23" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub23DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub23_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub24" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub24DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub24_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findT1sub251" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.T1sub251DTO">
|
||||
SELECT *
|
||||
FROM merged.t1sub251_merged
|
||||
WHERE database_name = #{database} AND "parentID" = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
23
src/main/resources/mapper/MapLyStatistic/Count.xml
Normal file
23
src/main/resources/mapper/MapLyStatistic/Count.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.whu.edu.LyStatistic.MapLyStatistic.Mapper.CountMapper">
|
||||
<!-- 按区返回计数 -->
|
||||
<select id="loadDistrictCount" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.DistrictCountDTO">
|
||||
SELECT
|
||||
"NY",
|
||||
"WY",
|
||||
"YD"
|
||||
FROM xian_stats
|
||||
WHERE "NAME" = #{district}
|
||||
</select>
|
||||
|
||||
<!-- 按小班返回计数 -->
|
||||
<select id="loadPlotCount" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotCountDTO">
|
||||
SELECT *
|
||||
FROM root_summary
|
||||
WHERE root_id = #{rootId} AND database_name = #{databaseName}
|
||||
</select>
|
||||
</mapper>
|
||||
34
src/main/resources/mapper/MapLyStatistic/Date.xml
Normal file
34
src/main/resources/mapper/MapLyStatistic/Date.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.whu.edu.LyStatistic.MapLyStatistic.Mapper.DateMapper">
|
||||
<select id="finishedPlot" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.DatePlotDTO">
|
||||
SELECT
|
||||
r.region AS district,
|
||||
COUNT(m."ID") AS plotcount, -- 小班数量
|
||||
COUNT(ts."ID") AS sampleplotcount -- 样地数量
|
||||
FROM merged.roottable1_merged m
|
||||
JOIN region r
|
||||
ON substring(m."CUN", 1, 6) = r.regionid::text
|
||||
LEFT JOIN merged.t1sub1_merged ts
|
||||
ON ts."parentID" = m."ID"
|
||||
AND ts."database_name" = m."database_name"
|
||||
WHERE (m.reviewer != '-1' OR m.collector != '-1')
|
||||
AND Date(m.update_time) = #{date}
|
||||
GROUP BY r.region
|
||||
ORDER BY r.region;
|
||||
</select>
|
||||
|
||||
<select id="finishedSamplePlot" resultType="string">
|
||||
SELECT media_path
|
||||
FROM merged.roottable1_media_merged
|
||||
WHERE "id" = #{id}
|
||||
AND "database_name" = #{databaseName}
|
||||
ORDER BY media_path
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -6,20 +6,26 @@
|
||||
<mapper namespace="com.whu.edu.LyStatistic.MapLyStatistic.Mapper.InfoMapper">
|
||||
|
||||
<select id="findByDistrict" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.UnitInfo">
|
||||
SELECT task_name, schema_code, unit_name, district, village
|
||||
FROM public.unit_info
|
||||
SELECT task_name, unit_name, district, village
|
||||
FROM merged.roottable1_merged
|
||||
WHERE district = #{district}
|
||||
</select>
|
||||
|
||||
<select id="findByVillage" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.UnitInfo">
|
||||
SELECT task_name, schema_code, unit_name, district, village
|
||||
FROM public.unit_info
|
||||
SELECT task_name,unit_name, district, village
|
||||
FROM merged.roottable1_merged
|
||||
WHERE village = #{village}
|
||||
</select>
|
||||
|
||||
<select id="findAll" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.UnitInfo">
|
||||
SELECT task_name, schema_code, unit_name, district, village
|
||||
FROM public.unit_info
|
||||
SELECT district, village
|
||||
FROM merged.roottable1_merged
|
||||
</select>
|
||||
|
||||
<select id="findAllRegion" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.UnitInfo">
|
||||
SELECT region, regionid
|
||||
FROM region
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
66
src/main/resources/mapper/MapLyStatistic/Statistic.xml
Normal file
66
src/main/resources/mapper/MapLyStatistic/Statistic.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.whu.edu.LyStatistic.MapLyStatistic.Mapper.StatisticMapper">
|
||||
|
||||
<select id="selectPlotStatsByDistrict"
|
||||
resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO">
|
||||
|
||||
SELECT
|
||||
r.region AS district,
|
||||
|
||||
-- 统计总行数(plotCount)
|
||||
COUNT(*) AS plotCount,
|
||||
|
||||
-- 面积求和,XBMJ 是 text,需要转 numeric
|
||||
COALESCE(SUM(NULLIF(m."XBMJ", '')::numeric), 0) AS totalArea,
|
||||
|
||||
-- status 也是 text,因此必须先转 integer
|
||||
COALESCE(SUM(CASE WHEN m."status"::int = -1 THEN 1 ELSE 0 END), 0) AS unPassedCount,
|
||||
COALESCE(SUM(CASE WHEN m."status"::int = 0 THEN 1 ELSE 0 END), 0) AS assignedCount,
|
||||
|
||||
-- 新的状态统计逻辑
|
||||
-- collector/reviewer有一个不是-1:已采集
|
||||
COALESCE(SUM(CASE
|
||||
WHEN (m."collector" != '-1' OR m."reviewer" != '-1')
|
||||
THEN 1 ELSE 0
|
||||
END), 0) AS collectedCount,
|
||||
|
||||
-- collector/reviewer均为-1:已发布未采集
|
||||
COALESCE(SUM(CASE
|
||||
WHEN m."collector" = '-1' AND m."reviewer" = '-1'
|
||||
THEN 1 ELSE 0
|
||||
END), 0) AS publishedUncollectedCount,
|
||||
|
||||
COALESCE(SUM(CASE WHEN m."status"::int = 2 THEN 1 ELSE 0 END), 0) AS approvedCount
|
||||
|
||||
FROM merged.roottable1_merged m
|
||||
JOIN region r
|
||||
ON substring(m."CUN", 1, 6) = r.regionid::text
|
||||
|
||||
GROUP BY r.region
|
||||
ORDER BY r.region
|
||||
</select>
|
||||
|
||||
<!--按街道
|
||||
统计图斑信息:
|
||||
- plotCount: 图斑数量
|
||||
- totalArea: 图斑面积汇总 (XBMJ)
|
||||
- 各状态数量 (-1,0,1,2)
|
||||
-->
|
||||
<select id="selectPlotStatsByStreet" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO">
|
||||
SELECT
|
||||
COUNT(*) AS plotCount,
|
||||
COALESCE(SUM("XBMJ"), 0) AS totalArea,
|
||||
COALESCE(SUM(CASE WHEN "status" = -1 THEN 1 ELSE 0 END), 0) AS unPassedCount,
|
||||
COALESCE(SUM(CASE WHEN "status" = 0 THEN 1 ELSE 0 END), 0) AS assignedCount,
|
||||
COALESCE(SUM(CASE WHEN "status" = 1 THEN 1 ELSE 0 END), 0) AS collectedCount,
|
||||
COALESCE(SUM(CASE WHEN "status" = 2 THEN 1 ELSE 0 END), 0) AS approvedCount
|
||||
FROM merged.roottable1_merged
|
||||
WHERE village = #{village}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -5,13 +5,69 @@
|
||||
|
||||
<mapper namespace="com.whu.edu.LyStatistic.MapLyStatistic.Mapper.TaskCommonMapper">
|
||||
|
||||
<!--
|
||||
<!--按区
|
||||
统计图斑信息:
|
||||
- plotCount: 图斑数量
|
||||
- totalArea: 图斑面积汇总 (XBMJ)
|
||||
- 各状态数量 (-1,0,1,2)
|
||||
-->
|
||||
<select id="selectPlotStats" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO">
|
||||
<!-- <select id="selectPlotStatsByDistrict" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- COUNT(*) AS plotCount,-->
|
||||
<!-- COALESCE(SUM("XBMJ"), 0) AS totalArea,-->
|
||||
<!-- COALESCE(SUM(CASE WHEN "status" = -1 THEN 1 ELSE 0 END), 0) AS unPassedCount,-->
|
||||
<!-- COALESCE(SUM(CASE WHEN "status" = 0 THEN 1 ELSE 0 END), 0) AS assignedCount,-->
|
||||
<!-- COALESCE(SUM(CASE WHEN "status" = 1 THEN 1 ELSE 0 END), 0) AS collectedCount,-->
|
||||
<!-- COALESCE(SUM(CASE WHEN "status" = 2 THEN 1 ELSE 0 END), 0) AS approvedCount-->
|
||||
<!-- FROM merged.roottable1_merged-->
|
||||
<!-- WHERE district = #{district}-->
|
||||
<!-- </select>-->
|
||||
<select id="selectPlotStatsByDistrict"
|
||||
resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO">
|
||||
|
||||
SELECT
|
||||
r.region AS district,
|
||||
|
||||
-- 统计总行数(plotCount)
|
||||
COUNT(*) AS plotCount,
|
||||
|
||||
-- 面积求和,XBMJ 是 text,需要转 numeric
|
||||
COALESCE(SUM(NULLIF(m."XBMJ", '')::numeric), 0) AS totalArea,
|
||||
|
||||
-- status 也是 text,因此必须先转 integer
|
||||
COALESCE(SUM(CASE WHEN m."status"::int = -1 THEN 1 ELSE 0 END), 0) AS unPassedCount,
|
||||
COALESCE(SUM(CASE WHEN m."status"::int = 0 THEN 1 ELSE 0 END), 0) AS assignedCount,
|
||||
|
||||
-- 新的状态统计逻辑
|
||||
-- collector/reviewer有一个不是-1:已采集
|
||||
COALESCE(SUM(CASE
|
||||
WHEN (m."collector" != '-1' OR m."reviewer" != '-1')
|
||||
THEN 1 ELSE 0
|
||||
END), 0) AS collectedCount,
|
||||
|
||||
-- collector/reviewer均为-1:已发布未采集
|
||||
COALESCE(SUM(CASE
|
||||
WHEN m."collector" = '-1' AND m."reviewer" = '-1'
|
||||
THEN 1 ELSE 0
|
||||
END), 0) AS publishedUncollectedCount,
|
||||
|
||||
COALESCE(SUM(CASE WHEN m."status"::int = 2 THEN 1 ELSE 0 END), 0) AS approvedCount
|
||||
|
||||
FROM merged.roottable1_merged m
|
||||
JOIN region r
|
||||
ON substring(m."CUN", 1, 6) = r.regionid::text
|
||||
|
||||
GROUP BY r.region
|
||||
ORDER BY r.region
|
||||
</select>
|
||||
|
||||
<!--按街道
|
||||
统计图斑信息:
|
||||
- plotCount: 图斑数量
|
||||
- totalArea: 图斑面积汇总 (XBMJ)
|
||||
- 各状态数量 (-1,0,1,2)
|
||||
-->
|
||||
<select id="selectPlotStatsByStreet" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotStatsDTO">
|
||||
SELECT
|
||||
COUNT(*) AS plotCount,
|
||||
COALESCE(SUM("XBMJ"), 0) AS totalArea,
|
||||
@@ -19,7 +75,8 @@
|
||||
COALESCE(SUM(CASE WHEN "status" = 0 THEN 1 ELSE 0 END), 0) AS assignedCount,
|
||||
COALESCE(SUM(CASE WHEN "status" = 1 THEN 1 ELSE 0 END), 0) AS collectedCount,
|
||||
COALESCE(SUM(CASE WHEN "status" = 2 THEN 1 ELSE 0 END), 0) AS approvedCount
|
||||
FROM "${schema}".roottable1
|
||||
FROM merged.roottable1_merged
|
||||
WHERE village = #{village}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -40,4 +97,13 @@
|
||||
WHERE plot_id = #{plotId}
|
||||
</select>
|
||||
|
||||
<!-- 所有图斑id和shape -->
|
||||
<select id="selectAllPlotBoundaries" resultType="com.whu.edu.LyStatistic.MapLyStatistic.Dto.PlotBoundaryDTO">
|
||||
SELECT
|
||||
"ID" AS id,
|
||||
"shape" AS shapeGeoJson
|
||||
FROM "${schema}".roottable1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.whu.edu.LyStatistic.statistic.mapper.TaskStatisticMapper">
|
||||
<mapper namespace="com.whu.edu.LyStatistic.statistic.mapper.StatisticDataMapper">
|
||||
|
||||
<!-- 根表记录 -->
|
||||
<select id="findRootTasks" resultType="com.whu.edu.LyStatistic.statistic.dto.RootTask">
|
||||
|
||||
Reference in New Issue
Block a user