feat: 엑셀에서 토사시험 > 압밀시험 부정보 업로드 안 되는 버그 수정
parent
06c078fef8
commit
351c5ce4d6
|
|
@ -677,14 +677,69 @@ public class ManageExcelUploadProc03Controller {
|
||||||
sandService.insertTempCbrCompac(map);
|
sandService.insertTempCbrCompac(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listMap = ("".equals(saveMap.get("co5List")))?null:(List<HashMap<String, Object>>) saveMap.get("co5List");
|
|
||||||
|
Object co5Obj = saveMap.get("co5List");
|
||||||
|
listMap = null;
|
||||||
|
|
||||||
|
if (co5Obj != null) {
|
||||||
|
if (co5Obj instanceof List) {
|
||||||
|
// 1. 이미 List 타입인 경우 안전하게 형변환
|
||||||
|
listMap = (List<HashMap<String, Object>>) co5Obj;
|
||||||
|
|
||||||
|
} else if (co5Obj instanceof String) {
|
||||||
|
// 2. String 타입인 경우 양옆 공백 제거
|
||||||
|
String strCo5 = ((String) co5Obj).trim();
|
||||||
|
|
||||||
|
// 3. 에러 원인 원천 차단: 빈 문자열이 아니고, 반드시 '['로 시작할 때만 파싱
|
||||||
|
if (!strCo5.isEmpty() && strCo5.startsWith("[")) {
|
||||||
|
JSONArray jsonArray = JSONArray.fromObject(strCo5);
|
||||||
|
// 필요에 따라 JSONArray를 List<HashMap>으로 변환
|
||||||
|
listMap = (List<HashMap<String, Object>>) JSONArray.toCollection(jsonArray, HashMap.class);
|
||||||
|
} else {
|
||||||
|
// '['로 시작하지 않거나 빈 문자열인 경우의 예외 처리 (로그 출력 등)
|
||||||
|
// listMap은 초기값인 null을 유지합니다.
|
||||||
|
System.out.println("Invalid or empty JSON Array string: " + strCo5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(null != listMap){
|
if(null != listMap){
|
||||||
for(HashMap<String, Object> map : listMap){
|
for(HashMap<String, Object> map : listMap){
|
||||||
logger.debug("=====>co5List:" + map.toString());
|
logger.debug("=====>co5List:" + map.toString());
|
||||||
sandService.insertTempConsolidationUsual(map);
|
sandService.insertTempConsolidationUsual(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listMap = ("".equals(saveMap.get("co5List")))?null:(List<HashMap<String, Object>>) saveMap.get("co5sList");
|
|
||||||
|
// "co5sList"를 기준으로 데이터를 안전하게 가져오고 파싱합니다.
|
||||||
|
Object co5sObj = saveMap.get("co5sList");
|
||||||
|
listMap = null;
|
||||||
|
|
||||||
|
if (co5sObj != null) {
|
||||||
|
if (co5sObj instanceof List) {
|
||||||
|
// 1. 이미 List 형태인 경우 바로 캐스팅
|
||||||
|
listMap = (List<HashMap<String, Object>>) co5sObj;
|
||||||
|
|
||||||
|
} else if (co5sObj instanceof String) {
|
||||||
|
// 2. String 형태인 경우 JSON 배열 형식인지 검사 후 파싱
|
||||||
|
String strCo5s = ((String) co5sObj).trim();
|
||||||
|
|
||||||
|
if (!strCo5s.isEmpty() && strCo5s.startsWith("[")) {
|
||||||
|
JSONArray jsonArray = JSONArray.fromObject(strCo5s);
|
||||||
|
listMap = (List<HashMap<String, Object>>) JSONArray.toCollection(jsonArray, HashMap.class);
|
||||||
|
} else {
|
||||||
|
// 올바른 JSON 배열 형태가 아닐 경우의 예외 처리
|
||||||
|
System.out.println("Invalid or empty JSON Array string for co5sList: " + strCo5s);
|
||||||
|
resultMsg = "토사시험정보 > 압밀시험 부정보가 없습니다.";
|
||||||
|
params.put("resultMsg",resultMsg);
|
||||||
|
resultMsg = URLEncoder.encode(resultMsg, "utf-8");
|
||||||
|
JSONObject jsonData = getJsonFromMap(resultMap);
|
||||||
|
logger.debug("jsonData==>"+ jsonData.toString());
|
||||||
|
JSONObject jsonObj = new JSONObject();
|
||||||
|
jsonObj.put("resultData", jsonData.toString());
|
||||||
|
|
||||||
|
return new ObjectMapper().writeValueAsString(jsonObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(null != listMap){
|
if(null != listMap){
|
||||||
for(HashMap<String, Object> map : listMap){
|
for(HashMap<String, Object> map : listMap){
|
||||||
logger.debug("=====>co5sList:" + map.toString());
|
logger.debug("=====>co5sList:" + map.toString());
|
||||||
|
|
@ -4756,12 +4811,22 @@ public class ManageExcelUploadProc03Controller {
|
||||||
final int sampleInfoCount = _sampleInfoList.size();
|
final int sampleInfoCount = _sampleInfoList.size();
|
||||||
String testNoCheck[] = new String[consolidationTestCount];
|
String testNoCheck[] = new String[consolidationTestCount];
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if( consolidationTestCount != sampleInfoCount){
|
if( consolidationTestCount != sampleInfoCount){
|
||||||
params.put("resultMsg", String.format(fmtMsg, "기본물성시험정보의 시료 갯수"+consolidationTestCount != sampleInfoCount+"개와 같지 않습니다."));
|
params.put("resultMsg", String.format(fmtMsg, "기본물성시험정보의 시료 갯수"+consolidationTestCount != sampleInfoCount+"개와 같지 않습니다."));
|
||||||
return params;
|
return params;
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if( consolidationTestCount == 0 ){
|
||||||
|
params.put("resultMsg", String.format(fmtMsg, "[토사시험정보 - 압밀시험정보] 개수가 0개입니다. 1개 이상 입력하십시오."));
|
||||||
|
return params;
|
||||||
|
};
|
||||||
|
if( sampleInfoCount < consolidationTestCount ){
|
||||||
|
params.put("resultMsg", String.format(fmtMsg, "[토사시험정보 - 압밀시험정보] 개수가 " + consolidationTestCount + "개입니다. 기본물성시험 개수인 " + sampleInfoCount+"개를 초과하여 입력할 수 없습니다."));
|
||||||
|
return params;
|
||||||
|
};
|
||||||
|
|
||||||
int testNo2 =1;
|
int testNo2 =1;
|
||||||
int testNo = 1;
|
int testNo = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue