| | |
| | | return Result.ok(result); |
| | | } |
| | | |
| | | /** |
| | | * 清空指定报表期已导入数据与审核结果(数据导入页"清空数据"入口调用),便于整月重新导入。 |
| | | * types 为空表示清空该报表期全部类型;否则只清空指定数据类型(逗号分隔,如 h2032,cityBus)。 |
| | | */ |
| | | @PostMapping("/clear") |
| | | public Result<Map<String, Object>> clearData(@RequestParam("period") String period, |
| | | @RequestParam(value = "types", required = false) String types) { |
| | | try { |
| | | List<String> typeList = new java.util.ArrayList<>(); |
| | | if (types != null) { |
| | | for (String t : types.split(",")) { |
| | | String s = t.trim(); |
| | | if (!s.isEmpty()) typeList.add(s); |
| | | } |
| | | } |
| | | Map<String, Object> stats = importService.clearPeriod(period, typeList); |
| | | return Result.ok(stats); |
| | | } catch (Exception e) { |
| | | log.error("clear period {} types {} error", period, types, e); |
| | | return Result.error("清空失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |