feat(service): 添加按热卷号查询计划详情功能
- 在 SqlServerApiBusinessService 中实现按热卷号查询计划详情方法 - 新增调用查询扩展卷数据接口并整合到返回结果中 - 修改 PlanDetailView 构造函数以支持扩展卷数据列表 - 添加 excoilRows 属性和相应的 getter 方法 - 提供新的 fromExecuteSqlResponse 静态工厂方法处理双响应对象 - 在 SqlServerApiClient 中新增 queryExcoilByHotCoilId 查询接口
This commit is contained in:
@@ -361,6 +361,15 @@ public class SqlServerApiClient {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public ExecuteSqlResponse queryExcoilByHotCoilId(String hotCoilId) {
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"select * from JXPLTCM.PLTCM_PDO_EXCOIL where HOT_COILID = :hotCoilId",
|
||||
singletonParam("hotCoilId", hotCoilId)
|
||||
);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryPlanListByHotCoilIdLike(String hotCoilId, int page, int pageSize) {
|
||||
int endRow = page * pageSize;
|
||||
int startRow = endRow - pageSize;
|
||||
|
||||
@@ -122,7 +122,10 @@ public class SqlServerApiBusinessService {
|
||||
* 计划详情:按热卷号查询。
|
||||
*/
|
||||
public PlanDetailView getPlanByHotCoilId(String hotCoilId) {
|
||||
return PlanDetailView.fromExecuteSqlResponse(hotCoilId, client.queryPlanByHotCoilId(hotCoilId));
|
||||
SqlServerApiClient.ExecuteSqlResponse planResponse = client.queryPlanByHotCoilId(hotCoilId);
|
||||
SqlServerApiClient.ExecuteSqlResponse excoilResponse = null;
|
||||
excoilResponse = client.queryExcoilByHotCoilId(hotCoilId);
|
||||
return PlanDetailView.fromExecuteSqlResponse(hotCoilId, planResponse, excoilResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,11 +424,13 @@ public class SqlServerApiBusinessService {
|
||||
private final String coilId;
|
||||
private final List<Map<String, Object>> rows;
|
||||
private final Map<String, Object> firstRow;
|
||||
private final List<Map<String, Object>> excoilRows;
|
||||
|
||||
public PlanDetailView(String coilId, List<Map<String, Object>> rows, Map<String, Object> firstRow) {
|
||||
public PlanDetailView(String coilId, List<Map<String, Object>> rows, Map<String, Object> firstRow, List<Map<String, Object>> excoilRows) {
|
||||
this.coilId = coilId;
|
||||
this.rows = rows;
|
||||
this.firstRow = firstRow;
|
||||
this.excoilRows = excoilRows;
|
||||
}
|
||||
|
||||
public String getCoilId() {
|
||||
@@ -440,10 +445,21 @@ public class SqlServerApiBusinessService {
|
||||
return firstRow;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getExcoilRows() {
|
||||
return excoilRows;
|
||||
}
|
||||
|
||||
public static PlanDetailView fromExecuteSqlResponse(String coilId, SqlServerApiClient.ExecuteSqlResponse response) {
|
||||
List<Map<String, Object>> rows = asRowList(response);
|
||||
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
|
||||
return new PlanDetailView(coilId, rows, firstRow);
|
||||
return new PlanDetailView(coilId, rows, firstRow, Collections.<Map<String, Object>>emptyList());
|
||||
}
|
||||
|
||||
public static PlanDetailView fromExecuteSqlResponse(String coilId, SqlServerApiClient.ExecuteSqlResponse response, SqlServerApiClient.ExecuteSqlResponse excoilResponse) {
|
||||
List<Map<String, Object>> rows = asRowList(response);
|
||||
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
|
||||
List<Map<String, Object>> excoilRows = asRowList(excoilResponse);
|
||||
return new PlanDetailView(coilId, rows, firstRow, excoilRows);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user