| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** 网约车总数(月度全省 pin:模板_网约车总数.xlsx) */ |
| | | @PostMapping("/wycTotal") |
| | | public Result<String> importWycTotal(@RequestParam("file") MultipartFile file, |
| | | @RequestParam("period") String period) { |
| | | try { |
| | | int count = importService.importWycTotal(file, period); |
| | | return Result.ok("网约车总数导入成功, 共 " + count + " 期"); |
| | | } catch (Exception e) { |
| | | log.error("wycTotal import error", e); |
| | | return Result.error("导入失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** 网约车订单及全省总量(模板_网约车订单及全省总量.xlsx) */ |
| | | @PostMapping("/wycOrder") |
| | | public Result<String> importWycOrder(@RequestParam("file") MultipartFile file, |
| | | @RequestParam("period") String period) { |
| | | try { |
| | | int count = importService.importWycOrder(file, period); |
| | | return Result.ok("网约车订单及全省总量导入成功, 共 " + count + " 期"); |
| | | } catch (Exception e) { |
| | | log.error("wycOrder import error", e); |
| | | return Result.error("导入失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** 投资月报(全省汇总大表):category=客运站场/物流园区 */ |
| | | @PostMapping("/investment") |
| | | public Result<String> importInvestment(@RequestParam("file") MultipartFile file, |
| | |
| | | } catch (Exception e) { |
| | | log.error("investment import error", e); |
| | | return Result.error("导入失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** 多文件批量导入:前端一次选择多个 Excel 上传(type 为数据类型,投资类型按市州单表解析) */ |
| | | @PostMapping("/batch") |
| | | public Result<Object> importBatch(@RequestParam("type") String type, |
| | | @RequestParam("period") String period, |
| | | @RequestParam("files") List<MultipartFile> files) { |
| | | try { |
| | | Map<String, Object> result = importService.importBatchFiles(type, period, files); |
| | | return Result.ok(result); |
| | | } catch (Exception e) { |
| | | log.error("batch import error", e); |
| | | return Result.error("批量导入失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | } |