Commit 92ba5522 by NGUYEN HOANG SON

improve save, load processList, warningReportList json

parent 30e88f86
...@@ -893,4 +893,12 @@ public class ABVEnvironment { ...@@ -893,4 +893,12 @@ public class ABVEnvironment {
public String getMasterFilePath() { public String getMasterFilePath() {
return String.format(ApertureMasterDataDirFormat, rootDirectory); return String.format(ApertureMasterDataDirFormat, rootDirectory);
} }
//pickup processList, warningReport
public String getPickupProcessListOperationFilePath(long operationId) {
return getOperationDirFile(operationId) + "/pickupProcessList.json";
}
public String getPickupWarningReportListOperationFilePath(long operationId) {
return getOperationDirFile(operationId) + "/pickupWarningReportList.json";
}
} }
...@@ -258,13 +258,12 @@ public class OperationLogic extends AbstractLogic { ...@@ -258,13 +258,12 @@ public class OperationLogic extends AbstractLogic {
} }
//save processList, warningReport json file //save processList, warningReport json file
String processListJsonPath = ABVEnvironment.getInstance().getOperationDirFile(serverOperationDto.operationId) + "/processList.json"; String processListJsonPath = ABVEnvironment.getInstance().getPickupProcessListOperationFilePath(serverOperationDto.operationId);
FileUtil.delete(processListJsonPath); FileUtil.delete(processListJsonPath);
if (serverOperationDto.processJsonArray != null && serverOperationDto.processJsonArray.length() > 0) { if (serverOperationDto.processJsonArray != null && serverOperationDto.processJsonArray.length() > 0) {
FileUtil.createFile(processListJsonPath, serverOperationDto.processJsonArray.toString()); FileUtil.createFile(processListJsonPath, serverOperationDto.processJsonArray.toString());
} }
String warningReportJsonPath = ABVEnvironment.getInstance().getPickupWarningReportListOperationFilePath(serverOperationDto.operationId);
String warningReportJsonPath = ABVEnvironment.getInstance().getOperationDirFile(serverOperationDto.operationId) + "/warningReportList.json";
FileUtil.delete(warningReportJsonPath); FileUtil.delete(warningReportJsonPath);
if (serverOperationDto.warningReportJsonArray != null && serverOperationDto.warningReportJsonArray.length() > 0) { if (serverOperationDto.warningReportJsonArray != null && serverOperationDto.warningReportJsonArray.length() > 0) {
FileUtil.createFile(warningReportJsonPath, serverOperationDto.warningReportJsonArray.toString()); FileUtil.createFile(warningReportJsonPath, serverOperationDto.warningReportJsonArray.toString());
...@@ -2308,15 +2307,15 @@ public class OperationLogic extends AbstractLogic { ...@@ -2308,15 +2307,15 @@ public class OperationLogic extends AbstractLogic {
operationJson.put(ABookKeys.DISPLAY_PERMISSION_FLG, operationList.get(i).displayPermissionFlg); operationJson.put(ABookKeys.DISPLAY_PERMISSION_FLG, operationList.get(i).displayPermissionFlg);
operationJson.put(ABookKeys.CONTENT_ID, operationList.get(i).contentId); operationJson.put(ABookKeys.CONTENT_ID, operationList.get(i).contentId);
//load processList and warning json file //load processList and warning json file
String processListJsonPath = ABVEnvironment.getInstance().getOperationDirFile(operationList.get(i).operationId) + "/processList.json"; String processListJsonPath = ABVEnvironment.getInstance().getPickupProcessListOperationFilePath(operationList.get(i).operationId);
String processListString = FileUtil.readTextFile(processListJsonPath); String processListString = FileUtil.readTextFile(processListJsonPath);
if (!StringUtil.isNullOrEmpty(processListString)) { if (!StringUtil.isNullOrEmpty(processListString)) {
operationJson.put("processList", new JSONArray(processListString)); operationJson.put(ABookKeys.OPERATION_PROCESS_LIST, new JSONArray(processListString));
} }
String warningReportJsonPath = ABVEnvironment.getInstance().getOperationDirFile(operationList.get(i).operationId) + "/warningReportList.json"; String warningReportJsonPath = ABVEnvironment.getInstance().getPickupWarningReportListOperationFilePath(operationList.get(i).operationId);
String warningReportString = FileUtil.readTextFile(warningReportJsonPath); String warningReportString = FileUtil.readTextFile(warningReportJsonPath);
if (!StringUtil.isNullOrEmpty(warningReportString)) { if (!StringUtil.isNullOrEmpty(warningReportString)) {
operationJson.put("warningReportList", new JSONArray(warningReportString)); operationJson.put(ABookKeys.OPERATION_WARNING_REPORT_LIST, new JSONArray(warningReportString));
} }
operationJsonArray.put(operationJson); operationJsonArray.put(operationJson);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment