From b051f008e007a335948cd8f3b78c1f7629a4d6ac Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期一, 31 八月 2026 13:00:05 +0800
Subject: [PATCH] fix: 菜单高亮间歇性失效根因(el-menu 同路由导航回滚 activeIndex)——default-active 绑定路由+select 后宏任务纠正;feat: 修改密码(用户自改)+ admin 重置他人密码为 123456
---
traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/ExplainController.java | 192 ++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 162 insertions(+), 30 deletions(-)
diff --git a/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/ExplainController.java b/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/ExplainController.java
index 586dc65..01bb9cc 100644
--- a/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/ExplainController.java
+++ b/traffic-audit-server/src/main/java/com/trafficaudit/dataimport/controller/ExplainController.java
@@ -3,10 +3,17 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.trafficaudit.common.Result;
+import com.trafficaudit.dataimport.entity.CityBusMonthly;
+import com.trafficaudit.dataimport.entity.CityTaxiMonthly;
import com.trafficaudit.dataimport.entity.H2032EnterpriseMonthly;
+import com.trafficaudit.dataimport.entity.PassengerEnterpriseMonthly;
+import com.trafficaudit.dataimport.mapper.CityBusMonthlyMapper;
+import com.trafficaudit.dataimport.mapper.CityTaxiMonthlyMapper;
import com.trafficaudit.dataimport.mapper.H2032EnterpriseMonthlyMapper;
+import com.trafficaudit.dataimport.mapper.PassengerEnterpriseMonthlyMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -18,7 +25,8 @@
import java.util.Map;
/**
- * 浼佷笟瑙i噴锛氱嫭绔嬩簬瀹℃牳缁撴灉鐨勮В閲婂垪琛ㄤ笌 AI 鍒嗘瀽鍏ュ彛
+ * 浼佷笟瑙i噴锛氱嫭绔嬩簬瀹℃牳缁撴灉鐨勮В閲婂垪琛ㄤ笌 AI 鍒嗘瀽鍏ュ彛銆�
+ * 鏀寔澶氭姤琛ㄧ被鍨嬶細H2032 璐ц繍銆丠2031 鍏矾鏃呭銆丆ITY_BUS 鍩庡競鍏氦銆丆ITY_TAXI 宸℃父鍑虹銆�
*/
@Slf4j
@RestController
@@ -27,47 +35,171 @@
@Resource
private H2032EnterpriseMonthlyMapper h2032Mapper;
+ @Resource
+ private PassengerEnterpriseMonthlyMapper passengerMapper;
+ @Resource
+ private CityBusMonthlyMapper cityBusMapper;
+ @Resource
+ private CityTaxiMonthlyMapper cityTaxiMapper;
@GetMapping("/list")
- public Result<Map<String, Object>> list(@RequestParam(value = "period", required = false) String period,
+ public Result<Map<String, Object>> list(@RequestParam(value = "reportType", defaultValue = "H2032") String reportType,
+ @RequestParam(value = "period", required = false) String period,
@RequestParam(value = "keyword", required = false) String keyword,
+ @RequestParam(value = "hasExplanation", defaultValue = "false") boolean hasExplanation,
@RequestParam(value = "page", defaultValue = "1") long page,
@RequestParam(value = "size", defaultValue = "20") long size) {
String kw = keyword == null ? "" : keyword.trim();
boolean hasPeriod = period != null && !period.trim().isEmpty();
-
- LambdaQueryWrapper<H2032EnterpriseMonthly> w = new LambdaQueryWrapper<H2032EnterpriseMonthly>()
- .eq(hasPeriod, H2032EnterpriseMonthly::getReportPeriod, period)
- .isNotNull(H2032EnterpriseMonthly::getVerifyExplanation)
- .ne(H2032EnterpriseMonthly::getVerifyExplanation, "")
- .like(!kw.isEmpty(), H2032EnterpriseMonthly::getEnterpriseName, kw)
- .orderByDesc(H2032EnterpriseMonthly::getId);
-
- Page<H2032EnterpriseMonthly> p = new Page<>(Math.max(page, 1), Math.min(Math.max(size, 1), 200));
- Page<H2032EnterpriseMonthly> r = h2032Mapper.selectPage(p, w);
+ long p = Math.max(page, 1);
+ long s = Math.min(Math.max(size, 1), 200);
List<Map<String, Object>> records = new ArrayList<>();
- for (H2032EnterpriseMonthly e : r.getRecords()) {
- Map<String, Object> row = new LinkedHashMap<>();
- row.put("id", e.getId());
- row.put("reportPeriod", e.getReportPeriod());
- row.put("regionCode", e.getRegionCode());
- row.put("enterpriseCode", e.getEnterpriseCode());
- row.put("enterpriseName", e.getEnterpriseName());
- row.put("vehicleTotal", e.getVehicleTotal());
- row.put("tonsTotal", e.getTonsTotal());
- row.put("freightTotal", e.getFreightTotal());
- row.put("turnoverTotal", e.getTurnoverTotal());
- row.put("avgDistance", e.getAvgDistance());
- row.put("verifyExplanation", e.getVerifyExplanation());
- records.add(row);
+ long total = 0;
+
+ if ("H2031".equals(reportType)) {
+ LambdaQueryWrapper<PassengerEnterpriseMonthly> w = new LambdaQueryWrapper<PassengerEnterpriseMonthly>()
+ .eq(hasPeriod, PassengerEnterpriseMonthly::getReportPeriod, period)
+ .isNotNull(hasExplanation, PassengerEnterpriseMonthly::getVerifyExplanation)
+ .ne(hasExplanation, PassengerEnterpriseMonthly::getVerifyExplanation, "")
+ .like(!kw.isEmpty(), PassengerEnterpriseMonthly::getEnterpriseName, kw)
+ .orderByDesc(PassengerEnterpriseMonthly::getId);
+ Page<PassengerEnterpriseMonthly> r = passengerMapper.selectPage(new Page<>(p, s), w);
+ for (PassengerEnterpriseMonthly e : r.getRecords()) {
+ Map<String, Object> row = baseRow(e.getId(), e.getReportPeriod(), e.getRegionCode(),
+ e.getEnterpriseCode(), e.getEnterpriseName(), e.getVerifyExplanation());
+ row.put("vehicleTotal", e.getVehicleTotal());
+ row.put("seatTotal", e.getSeatTotal());
+ row.put("passengerTotal", e.getPassengerTotal());
+ row.put("turnoverTotal", e.getTurnoverTotal());
+ row.put("avgDistance", e.getAvgDistanceTotal());
+ records.add(row);
+ }
+ total = r.getTotal();
+ } else if ("CITY_BUS".equals(reportType)) {
+ LambdaQueryWrapper<CityBusMonthly> w = new LambdaQueryWrapper<CityBusMonthly>()
+ .eq(hasPeriod, CityBusMonthly::getReportPeriod, period)
+ .isNotNull(hasExplanation, CityBusMonthly::getVerifyExplanation)
+ .ne(hasExplanation, CityBusMonthly::getVerifyExplanation, "")
+ .like(!kw.isEmpty(), CityBusMonthly::getEnterpriseName, kw)
+ .orderByDesc(CityBusMonthly::getId);
+ Page<CityBusMonthly> r = cityBusMapper.selectPage(new Page<>(p, s), w);
+ for (CityBusMonthly e : r.getRecords()) {
+ Map<String, Object> row = baseRow(e.getId(), e.getReportPeriod(), e.getRegionCode(),
+ e.getEnterpriseCode(), e.getEnterpriseName(), e.getVerifyExplanation());
+ row.put("city", e.getCity());
+ row.put("opVehicles", e.getOpVehicles());
+ row.put("passengerVolume", e.getPassengerVolume());
+ row.put("turnover", e.getTurnover());
+ row.put("avgDistance", e.getAvgDistance());
+ records.add(row);
+ }
+ total = r.getTotal();
+ } else if ("CITY_TAXI".equals(reportType)) {
+ LambdaQueryWrapper<CityTaxiMonthly> w = new LambdaQueryWrapper<CityTaxiMonthly>()
+ .eq(hasPeriod, CityTaxiMonthly::getReportPeriod, period)
+ .isNotNull(hasExplanation, CityTaxiMonthly::getVerifyExplanation)
+ .ne(hasExplanation, CityTaxiMonthly::getVerifyExplanation, "")
+ .like(!kw.isEmpty(), CityTaxiMonthly::getCity, kw)
+ .orderByDesc(CityTaxiMonthly::getId);
+ Page<CityTaxiMonthly> r = cityTaxiMapper.selectPage(new Page<>(p, s), w);
+ for (CityTaxiMonthly e : r.getRecords()) {
+ Map<String, Object> row = baseRow(e.getId(), e.getReportPeriod(), e.getRegionCode(),
+ null, e.getCity(), e.getVerifyExplanation());
+ row.put("city", e.getCity());
+ row.put("opVehicles", e.getOpVehicles());
+ row.put("tripTotal", e.getTripTotal());
+ row.put("passengerVolume", e.getPassengerVolume());
+ row.put("turnover", e.getTurnover());
+ row.put("avgDistance", e.getAvgDistance());
+ records.add(row);
+ }
+ total = r.getTotal();
+ } else {
+ LambdaQueryWrapper<H2032EnterpriseMonthly> w = new LambdaQueryWrapper<H2032EnterpriseMonthly>()
+ .eq(hasPeriod, H2032EnterpriseMonthly::getReportPeriod, period)
+ .isNotNull(hasExplanation, H2032EnterpriseMonthly::getVerifyExplanation)
+ .ne(hasExplanation, H2032EnterpriseMonthly::getVerifyExplanation, "")
+ .like(!kw.isEmpty(), H2032EnterpriseMonthly::getEnterpriseName, kw)
+ .orderByDesc(H2032EnterpriseMonthly::getId);
+ Page<H2032EnterpriseMonthly> r = h2032Mapper.selectPage(new Page<>(p, s), w);
+ for (H2032EnterpriseMonthly e : r.getRecords()) {
+ Map<String, Object> row = baseRow(e.getId(), e.getReportPeriod(), e.getRegionCode(),
+ e.getEnterpriseCode(), e.getEnterpriseName(), e.getVerifyExplanation());
+ row.put("vehicleTotal", e.getVehicleTotal());
+ row.put("tonsTotal", e.getTonsTotal());
+ row.put("freightTotal", e.getFreightTotal());
+ row.put("turnoverTotal", e.getTurnoverTotal());
+ row.put("avgDistance", e.getAvgDistance());
+ records.add(row);
+ }
+ total = r.getTotal();
}
Map<String, Object> result = new LinkedHashMap<>();
+ result.put("reportType", reportType);
result.put("records", records);
- result.put("total", r.getTotal());
- result.put("current", r.getCurrent());
- result.put("size", r.getSize());
+ result.put("total", total);
+ result.put("current", p);
+ result.put("size", s);
return Result.ok(result);
}
-}
\ No newline at end of file
+
+ /**
+ * 淇濆瓨浼佷笟瑙i噴锛氭洿鏂板搴旀潵婧愯〃锛圚2032/H2031/CITY_BUS/CITY_TAXI锛夎鐨� verifyExplanation銆�
+ * 瀹℃牳缁撴灉椤靛唴宓岃В閲婃ā鍧椾笌銆屼紒涓氳В閲娿�嶉〉鍏辩敤姝ゆ帴鍙c��
+ */
+ @PostMapping("/save")
+ public Result<String> save(@RequestParam("reportType") String reportType,
+ @RequestParam("reportId") Long reportId,
+ @RequestParam(value = "explanation", required = false) String explanation) {
+ String exp = explanation == null ? "" : explanation.trim();
+ boolean ok = false;
+ String t = reportType == null ? "" : reportType;
+ try {
+ switch (t) {
+ case "H2032": {
+ H2032EnterpriseMonthly e = h2032Mapper.selectById(reportId);
+ if (e != null) { e.setVerifyExplanation(exp); h2032Mapper.updateById(e); ok = true; }
+ break;
+ }
+ case "H2031": {
+ PassengerEnterpriseMonthly e = passengerMapper.selectById(reportId);
+ if (e != null) { e.setVerifyExplanation(exp); passengerMapper.updateById(e); ok = true; }
+ break;
+ }
+ case "CITY_BUS": {
+ CityBusMonthly e = cityBusMapper.selectById(reportId);
+ if (e != null) { e.setVerifyExplanation(exp); cityBusMapper.updateById(e); ok = true; }
+ break;
+ }
+ case "CITY_TAXI": {
+ CityTaxiMonthly e = cityTaxiMapper.selectById(reportId);
+ if (e != null) { e.setVerifyExplanation(exp); cityTaxiMapper.updateById(e); ok = true; }
+ break;
+ }
+ default:
+ throw new RuntimeException("涓嶆敮鎸佺殑鎶ヨ〃绫诲瀷锛�" + reportType);
+ }
+ } catch (Exception e) {
+ log.error("explain save error", e);
+ return Result.error("淇濆瓨澶辫触: " + e.getMessage());
+ }
+ if (!ok) {
+ return Result.error("鏈壘鍒板搴旂殑鏁版嵁琛岋紙reportId=" + reportId + "锛�");
+ }
+ return Result.ok(exp);
+ }
+
+ private Map<String, Object> baseRow(Long id, String reportPeriod, String regionCode,
+ String enterpriseCode, String enterpriseName, String verifyExplanation) {
+ Map<String, Object> row = new LinkedHashMap<>();
+ row.put("id", id);
+ row.put("reportPeriod", reportPeriod);
+ row.put("regionCode", regionCode);
+ row.put("enterpriseCode", enterpriseCode);
+ row.put("enterpriseName", enterpriseName);
+ row.put("verifyExplanation", verifyExplanation);
+ return row;
+ }
+}
--
Gitblit v1.9.1