refactor: 注释掉出口卷数据同步相关代码并优化钢卷对比默认查询逻辑

本次提交主要变更:
1.  注释掉所有出口卷数据同步的接口、服务实现和相关工具方法
2.  优化钢卷对比页面的默认时间逻辑,移除默认7天前的起始时间,改为默认查询今日全天数据
3.  新增日期格式化工具方法统一处理时间字符串拼接
4.  完善钢卷对比接口的注释和字段映射逻辑
This commit is contained in:
2026-05-22 14:01:16 +08:00
parent 80fbe70ab7
commit c2b7a08414
8 changed files with 332 additions and 266 deletions

View File

@@ -428,20 +428,20 @@ public class SqlServerApiClient {
return executeSql("oracle", sql.toString(), params);
}
public ExecuteSqlResponse queryExcoilByInsdateRange(String startTime, String endTime) {
Map<String, Object> params = new java.util.HashMap<>();
StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1");
if (startTime != null && !startTime.trim().isEmpty()) {
sql.append(" AND INSDATE > TO_DATE(:startTime, 'YYYY-MM-DD HH24:MI:SS')");
params.put("startTime", startTime.trim());
}
if (endTime != null && !endTime.trim().isEmpty()) {
sql.append(" AND INSDATE <= TO_DATE(:endTime, 'YYYY-MM-DD HH24:MI:SS')");
params.put("endTime", endTime.trim());
}
sql.append(" ORDER BY INSDATE ASC");
return executeSql("oracle", sql.toString(), params);
}
// public ExecuteSqlResponse queryExcoilByInsdateRange(String startTime, String endTime) {
// Map<String, Object> params = new java.util.HashMap<>();
// StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1");
// if (startTime != null && !startTime.trim().isEmpty()) {
// sql.append(" AND INSDATE > TO_DATE(:startTime, 'YYYY-MM-DD HH24:MI:SS')");
// params.put("startTime", startTime.trim());
// }
// if (endTime != null && !endTime.trim().isEmpty()) {
// sql.append(" AND INSDATE <= TO_DATE(:endTime, 'YYYY-MM-DD HH24:MI:SS')");
// params.put("endTime", endTime.trim());
// }
// sql.append(" ORDER BY INSDATE ASC");
// return executeSql("oracle", sql.toString(), params);
// }
public ExecuteSqlResponse queryExcoilList(int page, int pageSize) {
int endRow = page * pageSize;

View File

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -25,14 +26,32 @@ public class CoilComparisonController {
private final SqlServerApiBusinessService sqlServerService;
private final IWmsMaterialCoilService wmsMaterialCoilService;
/**
* 获取钢卷状态信息接口
* 根据时间范围、产线类型查询钢卷状态,并关联本地系统中的钢卷信息
*
* @param startTime 开始时间(可选)
* @param endTime 结束时间(可选)
* @param lineType 产线类型(可选)
* @return 返回包含钢卷状态信息的列表,每个钢卷信息包含外系统和本系统的相关数据
*/
@GetMapping("/excoil-status")
public R<List<Map<String, Object>>> getExcoilStatus(
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) String lineType) {
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) String lineType) {
// 默认时间为今天
if (startTime == null || startTime.trim().isEmpty()) {
startTime = LocalDate.now().toString() + " 00:00:00";
}
if (endTime == null || endTime.trim().isEmpty()) {
endTime = LocalDate.now().toString() + " 23:59:59";
}
// 从SQL Server服务获取指定时间范围内的钢卷数据
List<Map<String, Object>> excoilRows = sqlServerService.getExcoilByTimeRange(startTime, endTime);
// 构建查询条件,查询本地系统中的热轧卷板原料信息
WmsMaterialCoilBo bo = new WmsMaterialCoilBo();
bo.setItemType("raw_material");
bo.setMaterialType("原料");
@@ -40,6 +59,7 @@ public class CoilComparisonController {
bo.setSelectType("raw_material");
List<WmsMaterialCoilVo> localCoils = wmsMaterialCoilService.queryList(bo);
// 将本地钢卷数据以钢卷号为key存入Map便于后续查找
Map<String, WmsMaterialCoilVo> localMap = new HashMap<>();
for (WmsMaterialCoilVo coil : localCoils) {
if (coil.getEnterCoilNo() != null) {
@@ -47,23 +67,57 @@ public class CoilComparisonController {
}
}
// 处理结果集,将外系统和本地系统的钢卷信息合并
List<Map<String, Object>> result = new ArrayList<>();
for (Map<String, Object> excoil : excoilRows) {
String hotCoilId = excoil.get("HOT_COILID") != null ? String.valueOf(excoil.get("HOT_COILID")) : null;
// 获取热轧卷ID
String hotCoilId = excoil.get("hot_coilid") != null ? String.valueOf(excoil.get("hot_coilid")) : null;
// 创建结果项
Map<String, Object> item = new LinkedHashMap<>();
item.put("excoilId", excoil.get("EXCOILID"));
item.put("coilId", excoil.get("COILID"));
// 添加外系统基本信息
item.put("excoilId", excoil.get("encoilid"));
item.put("hotCoilId", hotCoilId);
item.put("endDate", excoil.get("END_DATE"));
item.put("startDate", excoil.get("START_DATE"));
item.put("actualThick", excoil.get("ACTUAL_THICK"));
item.put("actualWidth", excoil.get("ACTUAL_WIDTH"));
item.put("actualWeight", excoil.get("ACTUAL_WEIGHT"));
item.put("processCode", excoil.get("PROCESS_CODE"));
item.put("endDate", excoil.get("end_date"));
item.put("startDate", excoil.get("start_date"));
item.put("excoilid", excoil.get("excoilid"));
item.put("grade", excoil.get("grade"));
item.put("status", excoil.get("status"));
item.put("shift", excoil.get("shift"));
item.put("crew", excoil.get("crew"));
item.put("entryThick", excoil.get("entry_thick"));
item.put("entryWeight", excoil.get("entry_weight"));
item.put("entryWidth", excoil.get("entry_width"));
item.put("exitThick", excoil.get("exit_thick"));
item.put("exitWidth", excoil.get("exit_width"));
item.put("exitLength", excoil.get("exit_length"));
item.put("exitNegDev", excoil.get("exit_neg_dev"));
item.put("exitPosDev", excoil.get("exit_pos_dev"));
item.put("calcExitWeight", excoil.get("calc_exit_weight"));
item.put("measExitWeight", excoil.get("meas_exit_weight"));
item.put("quality", excoil.get("quality"));
item.put("shapeQuality", excoil.get("shape_quality"));
item.put("orderQuality", excoil.get("order_quality"));
item.put("productType", excoil.get("product_type"));
item.put("parkType", excoil.get("park_type"));
item.put("sideTrim", excoil.get("side_trim"));
item.put("innerDiameter", excoil.get("inner_diameter"));
item.put("outerDiameter", excoil.get("outer_diameter"));
item.put("headpos", excoil.get("headpos"));
item.put("tailpos", excoil.get("tailpos"));
item.put("subid", excoil.get("subid"));
item.put("rn", excoil.get("rn"));
item.put("comments", excoil.get("comments"));
item.put("reportFlag", excoil.get("report_flag"));
item.put("usedEntryWeight", excoil.get("used_entry_weight"));
item.put("onlineDate", excoil.get("online_date"));
item.put("insdate", excoil.get("insdate"));
item.put("weldedDate", excoil.get("welded_date"));
// 如果存在热轧卷ID则尝试匹配本地系统数据
if (hotCoilId != null) {
WmsMaterialCoilVo matched = localMap.get(hotCoilId);
if (matched != null) {
// 匹配成功,添加本地系统数据
item.put("enterCoilNo", matched.getEnterCoilNo());
item.put("currentCoilNo", matched.getCurrentCoilNo());
item.put("supplierCoilNo", matched.getSupplierCoilNo());
@@ -75,6 +129,7 @@ public class CoilComparisonController {
item.put("manufacturer", matched.getManufacturer());
item.put("coilStatus", matched.getStatus());
item.put("warehouseName", matched.getWarehouseName());
// 根据数据类型设置匹配状态
if (matched.getDataType() != null && matched.getDataType() == 0) {
item.put("matchStatus", 0);
item.put("matchStatusDesc", "已加工");
@@ -83,6 +138,7 @@ public class CoilComparisonController {
item.put("matchStatusDesc", "未加工");
}
} else {
// 未匹配到本地数据,设置为未入库状态
item.put("enterCoilNo", null);
item.put("currentCoilNo", null);
item.put("supplierCoilNo", null);
@@ -98,6 +154,7 @@ public class CoilComparisonController {
item.put("matchStatusDesc", "未入库");
}
} else {
// 热轧卷ID为空设置为未入库状态
item.put("enterCoilNo", null);
item.put("currentCoilNo", null);
item.put("supplierCoilNo", null);

View File

@@ -161,12 +161,12 @@ public class SqlServerApiBusinessService {
return asRowList(client.queryExcoilByTimeRange(startTime, endTime));
}
/**
* 出口卷实绩列表(按数据写入时间),用于增量同步。
*/
public List<Map<String, Object>> getExcoilByInsdateRange(String startTime, String endTime) {
return asRowList(client.queryExcoilByInsdateRange(startTime, endTime));
}
// /**
// * 出口卷实绩列表(按数据写入时间),用于增量同步。
// */
// public List<Map<String, Object>> getExcoilByInsdateRange(String startTime, String endTime) {
// return asRowList(client.queryExcoilByInsdateRange(startTime, endTime));
// }
/**
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。

View File

@@ -166,16 +166,16 @@ public class SqlServerApiController {
return R.ok(businessService.getExcoilByTimeRange(startTime, endTime));
}
/**
* 出口卷实绩列表(按数据写入时间),用于增量同步。
* startTimeexclusive/ endTimeinclusive格式yyyy-MM-dd HH:mm:ss
*/
@GetMapping("/excoil/by-insdate")
public R<List<Map<String, Object>>> excoilByInsdate(
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
return R.ok(businessService.getExcoilByInsdateRange(startTime, endTime));
}
// /**
// * 出口卷实绩列表(按数据写入时间),用于增量同步。
// * startTimeexclusive/ endTimeinclusive格式yyyy-MM-dd HH:mm:ss
// */
// @GetMapping("/excoil/by-insdate")
// public R<List<Map<String, Object>>> excoilByInsdate(
// @RequestParam(required = false) String startTime,
// @RequestParam(required = false) String endTime) {
// return R.ok(businessService.getExcoilByInsdateRange(startTime, endTime));
// }
/**
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。