酸扎停机集成
This commit is contained in:
@@ -445,6 +445,56 @@ public class SqlServerApiClient {
|
||||
);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryStoppageList(int page, int pageSize, String area, String stopType, String startDate, String endDate) {
|
||||
java.util.HashMap<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder inner = new StringBuilder("SELECT * FROM JXPLTCM.PRO_STOPPAGE WHERE 1=1");
|
||||
if (area != null && !area.trim().isEmpty()) {
|
||||
inner.append(" AND AREA = :area");
|
||||
params.put("area", area.trim());
|
||||
}
|
||||
if (stopType != null && !stopType.trim().isEmpty()) {
|
||||
inner.append(" AND STOP_TYPE = :stopType");
|
||||
params.put("stopType", stopType.trim());
|
||||
}
|
||||
if (startDate != null && !startDate.trim().isEmpty()) {
|
||||
inner.append(" AND START_DATE >= TO_DATE(:startDate, 'YYYY-MM-DD')");
|
||||
params.put("startDate", startDate.trim());
|
||||
}
|
||||
if (endDate != null && !endDate.trim().isEmpty()) {
|
||||
inner.append(" AND START_DATE < TO_DATE(:endDate, 'YYYY-MM-DD') + 1");
|
||||
params.put("endDate", endDate.trim());
|
||||
}
|
||||
inner.append(" ORDER BY START_DATE DESC");
|
||||
int endRow = page * pageSize;
|
||||
int startRow = endRow - pageSize;
|
||||
params.put("endRow", endRow);
|
||||
params.put("startRow", startRow);
|
||||
String sql = "SELECT * FROM (SELECT t.*, ROWNUM rn FROM (" + inner + ") t WHERE ROWNUM <= :endRow) WHERE rn > :startRow";
|
||||
return executeSql("oracle", sql, params);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryStoppageCount(String area, String stopType, String startDate, String endDate) {
|
||||
java.util.HashMap<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder sql = new StringBuilder("SELECT COUNT(*) as total FROM JXPLTCM.PRO_STOPPAGE WHERE 1=1");
|
||||
if (area != null && !area.trim().isEmpty()) {
|
||||
sql.append(" AND AREA = :area");
|
||||
params.put("area", area.trim());
|
||||
}
|
||||
if (stopType != null && !stopType.trim().isEmpty()) {
|
||||
sql.append(" AND STOP_TYPE = :stopType");
|
||||
params.put("stopType", stopType.trim());
|
||||
}
|
||||
if (startDate != null && !startDate.trim().isEmpty()) {
|
||||
sql.append(" AND START_DATE >= TO_DATE(:startDate, 'YYYY-MM-DD')");
|
||||
params.put("startDate", startDate.trim());
|
||||
}
|
||||
if (endDate != null && !endDate.trim().isEmpty()) {
|
||||
sql.append(" AND START_DATE < TO_DATE(:endDate, 'YYYY-MM-DD') + 1");
|
||||
params.put("endDate", endDate.trim());
|
||||
}
|
||||
return executeSql("oracle", sql.toString(), params);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryRollHistoryList(int page, int pageSize, String rollId, Integer standId) {
|
||||
java.util.HashMap<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder inner = new StringBuilder("SELECT * FROM JXPLTCM.ROLL_HISTORY WHERE 1=1");
|
||||
|
||||
@@ -150,6 +150,23 @@ public class SqlServerApiBusinessService {
|
||||
return asRowList(client.queryRollHistoryByRollId(rollId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停机记录列表(分页 + 可选过滤)。
|
||||
*/
|
||||
public StoppagePageView getStoppageList(int page, int pageSize, String area, String stopType, String startDate, String endDate) {
|
||||
return new StoppagePageView(asRowList(client.queryStoppageList(page, pageSize, area, stopType, startDate, endDate)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停机记录总条数。
|
||||
*/
|
||||
public long getStoppageCount(String area, String stopType, String startDate, String endDate) {
|
||||
List<Map<String, Object>> rows = asRowList(client.queryStoppageCount(area, stopType, startDate, endDate));
|
||||
if (rows.isEmpty()) return 0L;
|
||||
Number n = asNumber(rows.get(0).get("total"));
|
||||
return n == null ? 0L : n.longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史列表(分页 + 可选过滤)。
|
||||
*/
|
||||
@@ -353,6 +370,18 @@ public class SqlServerApiBusinessService {
|
||||
}
|
||||
}
|
||||
|
||||
public static class StoppagePageView {
|
||||
private final List<Map<String, Object>> rows;
|
||||
|
||||
public StoppagePageView(List<Map<String, Object>> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getRows() {
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RollHistoryPageView {
|
||||
private final List<Map<String, Object>> rows;
|
||||
|
||||
|
||||
@@ -99,6 +99,34 @@ public class SqlServerApiController {
|
||||
return R.ok(businessService.getRollHistory(rollId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停机记录列表(分页)。area / stopType / startDate / endDate 均可选。
|
||||
*/
|
||||
@GetMapping("/stoppages")
|
||||
public R<SqlServerApiBusinessService.StoppagePageView> stoppageList(
|
||||
@RequestParam(defaultValue = "1") int page,
|
||||
@RequestParam(defaultValue = "50") int pageSize,
|
||||
@RequestParam(required = false) String area,
|
||||
@RequestParam(required = false) String stopType,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate) {
|
||||
return R.ok(businessService.getStoppageList(page, pageSize, area, stopType, startDate, endDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 停机记录总条数。
|
||||
*/
|
||||
@GetMapping("/stoppages/count")
|
||||
public R<Map<String, Long>> stoppageCount(
|
||||
@RequestParam(required = false) String area,
|
||||
@RequestParam(required = false) String stopType,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate) {
|
||||
Map<String, Long> result = new HashMap<>();
|
||||
result.put("total", businessService.getStoppageCount(area, stopType, startDate, endDate));
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史列表(分页)。rollId / standId 均可选。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user