Commit 4eb068c6 by Kim Jinsung

Question #46359 eXFrame 同期エラー

同期・送信処理のパフォーマンス改善
parent 4e8470d2
......@@ -19,6 +19,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
......@@ -102,8 +103,10 @@ public class OperationLogic extends AbstractLogic {
private TaskWorkerGroupDao mTaskWorkerGroupDao = AbstractDao.getDao(TaskWorkerGroupDao.class);
private TaskReportApprovalDao mTaskReportApprovalDao = AbstractDao.getDao(TaskReportApprovalDao.class);
/**
* 作業に関連する情報取得(API通信で取得して、DB保存処理)
*
* @throws AcmsException
* @throws NetworkDisconnectedException
*/
......@@ -216,13 +219,15 @@ public class OperationLogic extends AbstractLogic {
boolean isNotExistContent = false;
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
if (operationContentDto.operationContentFlg) {
if(mContentDao.getContent(operationContentDto.contentId) == null) {
if (mContentDao.getContent(operationContentDto.contentId) == null) {
isNotExistContent = true;
}
}
}
// コンテンツテーブルに存在しない場合、プロジェクトを登録しない
if (isNotExistContent) { continue; }
if (isNotExistContent) {
continue;
}
serverOperationDto.needSyncFlg = true;
serverOperationDto.contentCreatingFlg = false;
......@@ -271,7 +276,7 @@ public class OperationLogic extends AbstractLogic {
for (OperationDto deleteOperationDto : deleteListDtoArray) {
List<TaskDto> taskDtoList = mTaskDao.selectAllTaskByOperationId(deleteOperationDto.operationId);
List<Long> contentIds = mOperationContentDao.getContentIds(deleteOperationDto.operationId);
for(TaskDto taskDto : taskDtoList) {
for (TaskDto taskDto : taskDtoList) {
mTaskDao.delete(taskDto);
}
mPushMessageDao.delete(deleteOperationDto.operationId);
......@@ -377,13 +382,15 @@ public class OperationLogic extends AbstractLogic {
boolean isNotExistContent = false;
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
if (operationContentDto.operationContentFlg) {
if(mContentDao.getContent(operationContentDto.contentId) == null) {
if (mContentDao.getContent(operationContentDto.contentId) == null) {
isNotExistContent = true;
}
}
}
// コンテンツテーブルに存在しない場合、プロジェクトを登録しない
if (isNotExistContent) { continue; }
if (isNotExistContent) {
continue;
}
serverOperationDto.needSyncFlg = true;
serverOperationDto.contentCreatingFlg = false;
......@@ -432,7 +439,7 @@ public class OperationLogic extends AbstractLogic {
for (OperationDto deleteOperationDto : deleteListDtoArray) {
List<TaskDto> taskDtoList = mTaskDao.selectAllTaskByOperationId(deleteOperationDto.operationId);
List<Long> contentIds = mOperationContentDao.getContentIds(deleteOperationDto.operationId);
for(TaskDto taskDto : taskDtoList) {
for (TaskDto taskDto : taskDtoList) {
mTaskDao.delete(taskDto);
}
mPushMessageDao.delete(deleteOperationDto.operationId);
......@@ -478,6 +485,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 報告データ登録
*
* @param taskKey
* @param operationId
* @param contentId
......@@ -551,6 +559,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告を更新
*
* @param taskKey タスクキー
* @param operationId 作業ID
* @param contentId コンテンツID
......@@ -620,7 +629,7 @@ public class OperationLogic extends AbstractLogic {
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if(result) {
if (result) {
FileUtil.delete(tempDirPath);
}
}
......@@ -659,6 +668,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 「全削除」ボタンで、すべての工程情報を削除する。
*
* @param operationId 作業ID
* @param contentId コンテンツID
* @param contentPath コンテンツファイルパス
......@@ -695,6 +705,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 定期点検データ新規
*
* @param operationId
* @param taskReportDto
* @param attachedChangeFlag
......@@ -740,13 +751,14 @@ public class OperationLogic extends AbstractLogic {
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, routineTaskReportDirPath, true);
if(result) {
if (result) {
FileUtil.delete(tempDirPath);
}
}
/**
* 定期点検データ更新
*
* @param operationId
* @param contentId
* @param taskReportDto
......@@ -826,6 +838,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告送信データ、新規
*
* @param taskKey
* @param taskReportJson
* @param deleteFlg
......@@ -859,6 +872,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告送信データ、更新
*
* @param taskKey
* @param taskReportId
* @param reportStartDate
......@@ -905,6 +919,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告送信データID取得
*
* @param taskKey
* @return
*/
......@@ -914,6 +929,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 定期点検用、作業削除
*
* @param operationId
* @param contentId
* @param dto
......@@ -933,6 +949,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 定期点検用、作業内容削除
*
* @param operationId
* @param contentId
* @param taskKey
......@@ -941,7 +958,7 @@ public class OperationLogic extends AbstractLogic {
*/
public void deleteRoutineTaskReport(long operationId, long contentId, String taskKey, int taskReportId, String reportStartDate) {
TaskReportDto taskReportDto = mTaskReportDao.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if(taskReportDto != null) {
if (taskReportDto != null) {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskReportDto.jsonData = "";
......@@ -969,6 +986,7 @@ public class OperationLogic extends AbstractLogic {
/**
* ホットスポットの更新
*
* @param taskKey
* @param param
*/
......@@ -1024,8 +1042,8 @@ public class OperationLogic extends AbstractLogic {
try {
OperationDto operationDto = mOperationDao.getOperation(operationId);
if (operationDto.reportType == Constant.ReportType.ReportContinuous) {
contentPath = contentPath.replaceAll("panoImage","processList");
contentPath = contentPath.replaceAll("taskPdf","processList");
contentPath = contentPath.replaceAll("panoImage", "processList");
contentPath = contentPath.replaceAll("taskPdf", "processList");
createContinuousTaskReportJson(operationId);
createContinuousTaskReportSuggestJson(operationId);
createProcessInfoJson(operationId, contentPath);
......@@ -1042,7 +1060,6 @@ public class OperationLogic extends AbstractLogic {
createHopSpotJson(operationId, contentPath);
} catch (IOException e) {
Logger.e(TAG, "createJsonForOperationContent error : ", e);
throw e;
......@@ -1103,7 +1120,7 @@ public class OperationLogic extends AbstractLogic {
jsonObject.put("attachedMoviePath", ABVEnvironment.getInstance().getAttachedMoviesFilePath(contentId));
// 絞り検索マスタデータのパス
jsonObject.put("masterPath",ABVEnvironment.getInstance().getMasterFilePath() + File.separator + ABVEnvironment.getInstance().ApertureMasterDataFileName);
jsonObject.put("masterPath", ABVEnvironment.getInstance().getMasterFilePath() + File.separator + ABVEnvironment.getInstance().ApertureMasterDataFileName);
FileUtil.createFile(contentPath + "/content.json", jsonObject.toString());
}
......@@ -1160,8 +1177,8 @@ public class OperationLogic extends AbstractLogic {
List<TaskDto> taskDtoList = mTaskDao.selectTaskByOperationId(operationId);
OperationDto operation = mOperationDao.getOperation(operationId);
if (operation.reportType == Constant.ReportType.ReportContinuous) {
contentPath = contentPath.replaceAll("panoImage","processList");
contentPath = contentPath.replaceAll("taskPdf","processList");
contentPath = contentPath.replaceAll("panoImage", "processList");
contentPath = contentPath.replaceAll("taskPdf", "processList");
}
for (TaskDto dto : taskDtoList) {
if (!StringUtil.isNullOrEmpty(dto.taskHotSpotInfo)) {
......@@ -1177,6 +1194,7 @@ public class OperationLogic extends AbstractLogic {
/**
* phaseStatus.jsonファイル作成(工程承認情報表示用)
*
* @param operationId 作業ID
* @param contentPath 保存パス
* @throws IOException
......@@ -1222,11 +1240,12 @@ public class OperationLogic extends AbstractLogic {
phaseStatusJson.put(ABookKeys.PROCESS_LIST, processInfoList);
OperationDto operation = mOperationDao.getOperation(operationId);
if (operation.operationType == PANO || operation.operationType == DRAWING || operation.operationType == PDF) {
contentPath = contentPath.replaceAll("panoImage","processList");
contentPath = contentPath.replaceAll("taskPdf","processList");
contentPath = contentPath.replaceAll("panoImage", "processList");
contentPath = contentPath.replaceAll("taskPdf", "processList");
}
FileUtil.createFile(contentPath + "/phaseStatus.json", phaseStatusJson.toString());
}
/**
* processInfo.jsonファイル作成(報告一覧表示用)
*
......@@ -1249,8 +1268,8 @@ public class OperationLogic extends AbstractLogic {
processInfoJson.put("processList", taskJsonList);
OperationDto operation = mOperationDao.getOperation(operationId);
if (operation.operationType == PANO || operation.operationType == DRAWING || operation.operationType == PDF) {
contentPath = contentPath.replaceAll("panoImage","processList");
contentPath = contentPath.replaceAll("taskPdf","processList");
contentPath = contentPath.replaceAll("panoImage", "processList");
contentPath = contentPath.replaceAll("taskPdf", "processList");
}
Logger.d(TAG, "createProcessInfoJson : " + processInfoJson.toString());
FileUtil.createFile(contentPath + "/processInfo.json", processInfoJson.toString());
......@@ -1271,8 +1290,8 @@ public class OperationLogic extends AbstractLogic {
processInfoJson.put("processList", taskJsonList);
OperationDto operation = mOperationDao.getOperation(operationId);
if (operation.operationType == PANO || operation.operationType == DRAWING || operation.operationType == PDF) {
contentPath = contentPath.replaceAll("panoImage","processList");
contentPath = contentPath.replaceAll("taskPdf","processList");
contentPath = contentPath.replaceAll("panoImage", "processList");
contentPath = contentPath.replaceAll("taskPdf", "processList");
}
Logger.d(TAG, "createProcessInfoJson : " + processInfoJson.toString());
FileUtil.createFile(contentPath + "/processInfo.json", processInfoJson.toString());
......@@ -1304,7 +1323,7 @@ public class OperationLogic extends AbstractLogic {
level++;
}
if(dto.jsonData != null && dto.jsonData.length() > 0) {
if (dto.jsonData != null && dto.jsonData.length() > 0) {
if (operationDto.reportType == Constant.ReportType.ReportReply) {
JSONObject editJson = new JSONObject(dto.jsonData);
editJson.put(ABookKeys.HAS_AUTHORITY, dto.enableReport);
......@@ -1335,13 +1354,14 @@ public class OperationLogic extends AbstractLogic {
}
Logger.d(TAG, "createTaskReportJson : " + taskReportJson.toString());
Logger.d(TAG,contentPath + "/" + ABookKeys.TASK_REPORT + ".json");
Logger.d(TAG, contentPath + "/" + ABookKeys.TASK_REPORT + ".json");
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_REPORT + ".json", taskReportJson.toString());
}
/**
* 定期点検用のJSON作成
*
* @param operationId
* @param contentPath
* @throws IOException
......@@ -1372,12 +1392,13 @@ public class OperationLogic extends AbstractLogic {
taskReportJsonRoot.put(ABookKeys.TASK_REPORT_ID, lastRoutineTaskReportDto.taskReportId);
taskReportJsonRoot.put("taskReport_0", taskReportJsonList);
Logger.d(TAG, "createRoutineTaskReportJson : " + taskReportJsonRoot.toString());
Logger.d(TAG,contentPath + "/" + ABookKeys.TASK_REPORT + ".json");
Logger.d(TAG, contentPath + "/" + ABookKeys.TASK_REPORT + ".json");
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_REPORT + ".json", taskReportJsonRoot.toString());
}
/**
* 連続作業用の報告Suggestデータ作成(taskReportSuggest.json)
*  連続作業用の報告Suggestデータ作成(taskReportSuggest.json)
*
* @param operationId 作業ID
* @throws IOException I/O例外
*/
......@@ -1423,6 +1444,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 連続作業用の報告用データ作成(TaskReport.json作成)
*
* @param operationId 作業ID
* @throws IOException I/O例外
*/
......@@ -1441,7 +1463,7 @@ public class OperationLogic extends AbstractLogic {
Integer phaseNo = taskDto.phaseNo;
for (TaskReportDto taskReportDto : taskReportDtoList) {
JSONObject taskReportJson = new JSONObject();
if(taskReportDto.jsonData != null && taskReportDto.jsonData.length() > 0) {
if (taskReportDto.jsonData != null && taskReportDto.jsonData.length() > 0) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
}
taskReportJson.put(ABookKeys.PROCESS_KEY, taskDto.processKey);
......@@ -1495,7 +1517,7 @@ public class OperationLogic extends AbstractLogic {
taskReportSuggestJson.put(String.format("%s_%s", ABookKeys.TASK_REPORT_SUGGEST, String.valueOf(dto.taskReportLevel)), itemJson);
}
Logger.d(TAG, "createTaskReportSuggestJson : " + taskReportSuggestJson.toString());
Logger.d(TAG,contentPath + "/" + ABookKeys.TASK_REPORT_SUGGEST + ".json");
Logger.d(TAG, contentPath + "/" + ABookKeys.TASK_REPORT_SUGGEST + ".json");
// #32926 作業報告画面改善 end
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_REPORT_SUGGEST + ".json", taskReportSuggestJson.toString());
}
......@@ -1534,9 +1556,9 @@ public class OperationLogic extends AbstractLogic {
* 作業一覧取得
*
* @param searchWord 検索条件:作業名
* @param searchStartDateStr 検索条件:作業日範囲(開始)
* @param searchEndDateStr  検索条件:作業日範囲(終了)
* @param operationSortingType ソート順
* @param searchStartDateStr  検索条件:作業日範囲(開始)
* @param searchEndDateStr   検索条件:作業日範囲(終了)
* @param operationSortingType  ソート順
* @return 作業リスト
*/
public List<OperationDto> getRefreshOperation(String searchWord, String searchStartDateStr, String searchEndDateStr, OperationSortingType operationSortingType, int operationGroupMasterId) {
......@@ -1638,6 +1660,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告履歴データ送信(全体)
*
* @param operationId 作業ID
* @param progressCallback コールバック用
* @return
......@@ -1649,6 +1672,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告履歴データ送信
*
* @param operationId 作業ID
* @param taskKey 報告・回答のキー
* @param progressCallback コールバック用
......@@ -1815,6 +1839,7 @@ public class OperationLogic extends AbstractLogic {
/**
* タスク関連zipファイル取得
*
* @param operationId
* @param taskKey
* @param taskId
......@@ -1833,6 +1858,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 定期点検関連zipファイル取得
*
* @param operationId
* @param taskKey
* @param taskId
......@@ -1852,6 +1878,7 @@ public class OperationLogic extends AbstractLogic {
/**
* シーンの登録
*
* @param file
* @param contentId
* @throws IOException
......@@ -1864,6 +1891,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 360コンテンツの登録
*
* @param operationId
* @param contentName
* @param file
......@@ -1876,7 +1904,7 @@ public class OperationLogic extends AbstractLogic {
public void deleteAllOperation() {
List<OperationDto> operationDtoList = mOperationDao.getAllOperation();
for(OperationDto operationDto : operationDtoList) {
for (OperationDto operationDto : operationDtoList) {
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirFile(operationDto.operationId));
}
mOperationDao.deleteAll();
......@@ -1934,6 +1962,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告送信の添付ファイルのzip生成
*
* @param operationId
* @param taskKey
* @param taskReportSendId
......@@ -1986,10 +2015,11 @@ public class OperationLogic extends AbstractLogic {
/**
* ディレクトリのファイルがattachedFileNamesに含まれないファイル削除
*
* @param dirPath
* @param attachedFileNames
*/
private void deleteDifferentialFile (String dirPath, List<String> attachedFileNames) {
private void deleteDifferentialFile(String dirPath, List<String> attachedFileNames) {
File file = new File(dirPath);
if (file.exists()) {
String[] fileList = file.list();
......@@ -2005,6 +2035,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業の開始日のチェック
*
* @param operationId
* @return
*/
......@@ -2019,6 +2050,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業報告の取得
*
* @param taskKey 報告・回答キー
* @param taskReportlevel 作業レベル
* @return TaskReportDto 作業報告
......@@ -2029,6 +2061,7 @@ public class OperationLogic extends AbstractLogic {
/**
* suggestJsonデータをtaskReportItemテーブルに登録
*
* @param taskKey
* @param reportLevel
* @param suggestJson
......@@ -2070,6 +2103,7 @@ public class OperationLogic extends AbstractLogic {
/**
* t_taskテーブルに登録(報告データ)
* データが存在しないと登録する
*
* @param taskKey
* @param operationId
* @param hotSpotInfo
......@@ -2142,6 +2176,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 連続作業の承認情報を取得
*
* @param operationId 作業ID
* @throws NetworkDisconnectedException
* @throws ABVException
......@@ -2194,6 +2229,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 工程情報を全部削除する。(全削除ボタンタップ時)
*
* @param operationId 作業ID
* @param processKey 工程キー
* @throws Exception 例外
......@@ -2206,6 +2242,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 同期処理で、削除された工程情報を
*
* @param operationId
* @throws Exception
* @throws AcmsException
......@@ -2268,5 +2305,124 @@ public class OperationLogic extends AbstractLogic {
}
return operationListJsonObject.toString();
}
/**
* サーバから取得したタスクデータとローカルDBのタスクデータを比較
* @param localTaskDto ローカルDBのタスクデータ
* @param serverTaskDto サーバ側から取得したタスクデータ
* @return true:変更なし、false:変更あり
*/
public boolean taskDataSameCheck(TaskDto localTaskDto, TaskDto serverTaskDto) {
if (!Objects.equals(localTaskDto.taskId, serverTaskDto.taskId)) {
return false;
}
if (!Objects.equals(localTaskDto.taskCode, serverTaskDto.taskCode)) {
return false;
}
if (!Objects.equals(localTaskDto.taskStatus, serverTaskDto.taskStatus)) {
return false;
}
if (!Objects.equals(localTaskDto.taskHotSpotInfo, serverTaskDto.taskHotSpotInfo)) {
return false;
}
if (!Objects.equals(localTaskDto.delFlg, serverTaskDto.delFlg)) {
return false;
}
if (!Objects.equals(localTaskDto.taskName, serverTaskDto.taskName)) {
return false;
}
if (!Objects.equals(localTaskDto.phaseNo, serverTaskDto.phaseNo)) {
return false;
}
if (!Objects.equals(localTaskDto.phaseStatus, serverTaskDto.phaseStatus)) {
return false;
}
if (!Objects.equals(localTaskDto.processStatus, serverTaskDto.processStatus)) {
return false;
}
if (!Objects.equals(localTaskDto.processKey, serverTaskDto.processKey)) {
return false;
}
return true;
}
/**
* サーバから取得したタスク報告データとローカルDBのタスク報告データを比較
* @param localTaskReportDto ローカルDBの報告データ
* @param serverTaskReportDto サーバ側から取得した報告データ
* @return true:変更なし、false:変更あり
*/
public boolean taskReportDataSameCheck(TaskReportDto localTaskReportDto, TaskReportDto serverTaskReportDto) {
if (!Objects.equals(localTaskReportDto.attachedFileName, serverTaskReportDto.attachedFileName)) {
return false;
}
if (!Objects.equals(localTaskReportDto.attachedFileSendFlg, serverTaskReportDto.attachedFileSendFlg)) {
return false;
}
if (!Objects.equals(localTaskReportDto.dataSendFlg, serverTaskReportDto.dataSendFlg)) {
return false;
}
if (!Objects.equals(localTaskReportDto.delFlg, serverTaskReportDto.delFlg)) {
return false;
}
if (!Objects.equals(localTaskReportDto.enableReport, serverTaskReportDto.enableReport)) {
return false;
}
if (!Objects.equals(localTaskReportDto.jsonData, serverTaskReportDto.jsonData)) {
return false;
}
if (!Objects.equals(localTaskReportDto.localAttachedFileName, serverTaskReportDto.localAttachedFileName)) {
return false;
}
if (!Objects.equals(localTaskReportDto.localSavedFlg, serverTaskReportDto.localSavedFlg)) {
return false;
}
if (!Objects.equals(localTaskReportDto.reportStartDate, serverTaskReportDto.reportStartDate)) {
return false;
}
if (!Objects.equals(localTaskReportDto.reportEndDate, serverTaskReportDto.reportEndDate)) {
return false;
}
if (!Objects.equals(localTaskReportDto.taskReportInfoId, serverTaskReportDto.taskReportInfoId)) {
return false;
}
if (!Objects.equals(localTaskReportDto.taskReportLevel, serverTaskReportDto.taskReportLevel)) {
return false;
}
return true;
}
/**
* DBから取得した定期点検タスク報告配列から該当するタスク報告を取得する
*
* @param localTaskReportDtoList DBから取得したタスク報告配列
* @param taskKey タスクキー
* @param taskReportId タスク報告ID
* @param reportStartDate 定期点検開始日
* @return TaskReportDto タスク報告
*/
public TaskReportDto getLocalRoutineTaskReportDtoInList(List<TaskReportDto> localTaskReportDtoList, String taskKey, int taskReportId, Date reportStartDate) {
TaskReportDto taskReportDto = null;
for (TaskReportDto localTaskReportDto : localTaskReportDtoList) {
if (localTaskReportDto.taskKey.equals(taskKey) && localTaskReportDto.taskReportId == taskReportId && localTaskReportDto.reportStartDate.equals(reportStartDate)) {
taskReportDto = localTaskReportDto;
continue;
}
}
return taskReportDto;
}
/**
* ローカルDBから取得したタスク配列の中に該当するタスクDTO取得
* @param listDto リストDto
* @param taskKey タスクキー
* @return
*/
public TaskDto getLocalTaskInList(List<TaskDto> listDto, String taskKey) {
for (TaskDto lDto : listDto) {
if (lDto.taskKey.equals(taskKey)) {
return lDto;
}
}
return null;
}
}
\ No newline at end of file
......@@ -1416,13 +1416,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
return errorMsg.length() > 0 ? errorMsg.toString() : null;
}
/**
* 作業データ受信
* @param operationId
* @param progressCallback
* @return
* @param operationId 作業ID
* @param progressCallback プログレスバー表示用コールバック
* @return 作業更新日
* @throws NetworkDisconnectedException
* @throws ABVException
* @throws IOException
......@@ -1431,6 +1429,22 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
* @throws ZipException
*/
public Date receptionTaskData(long operationId, Callback progressCallback, StringBuilder errorMsg) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
return receptionTaskData(operationId, progressCallback, errorMsg, null);
}
/**
* 作業データ受信
* @param operationId 作業ID
* @param progressCallback プログレスバー表示用コールバック
* @param taskKey タスクキー
* @return 作業更新日
* @throws NetworkDisconnectedException
* @throws ABVException
* @throws IOException
* @throws InterruptedException
* @throws NoSuchAlgorithmException
* @throws ZipException
*/
public Date receptionTaskData(long operationId, Callback progressCallback, StringBuilder errorMsg, String taskKey) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
GetOperationDataParameters param = new GetOperationDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId);
OperationDto operationDto = mOperationLogic.getOperation(operationId);
OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId);
......@@ -1441,17 +1455,24 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
//プログレスを40%進行させるための計算
int progress = 0;
float progress = 0;
if (json.taskDtoList.size() != 0) {
progress = 40 / json.taskDtoList.size();
progress = 40f / json.taskDtoList.size();
}
boolean isRoutineTask = operationDto.reportType == Constant.ReportType.RoutineTask;
List<TaskReportDto> localTaskReportDtoList = null;
if (isRoutineTask) {
localTaskReportDtoList = mTaskReportDao.getTaskReportByOperationId(operationId);
}
float saveProgress = 0;
for (TaskDto serverTaskDto : json.taskDtoList) {
//報告送信後、そのタスクのみ同期する
if (taskKey != null && !serverTaskDto.taskKey.equals(taskKey)) {
continue;
}
List<TaskReportDto> localTaskReportList = mTaskReportDao.getTaskReportListByTaskKey(serverTaskDto.taskKey);
//報告削除
for (TaskReportDto localTaskReportDto : localTaskReportList) {
if (!isExistsTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto, isRoutineTask)) {
if (isRoutineTask) {
......@@ -1467,21 +1488,34 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
}
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
// 作業の報告更新
mTaskDao.update(serverTaskDto);
localTaskList.remove(serverTaskDto);
} else {
//タスク更新・追加
TaskDto localTaskDto = mOperationLogic.getLocalTaskInList(localTaskList, serverTaskDto.taskKey);
if (localTaskDto == null) {
// 作業の報告登録
mTaskDao.insert(serverTaskDto);
} else {
// 作業の報告更新
if (mOperationLogic.taskDataSameCheck(localTaskDto, serverTaskDto)) {
mTaskDao.update(serverTaskDto);
}
localTaskList.remove(localTaskDto);
}
// サーバーからの情報で更新
//報告更新・追加
for (TaskReportDto serverTaskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = serverTaskReportDto.attachedFileName;
TaskReportDto localTaskReportDto;
TaskReportDto localTaskReportDto = null;
if (operationDto.reportType == Constant.ReportType.RoutineTask) {
localTaskReportDto = mTaskReportDao.getRoutineTaskReportUtc(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportId, DateTimeUtil.toString(serverTaskReportDto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen));
if (localTaskReportDtoList != null) {
localTaskReportDto = mOperationLogic.getLocalRoutineTaskReportDtoInList(localTaskReportDtoList, serverTaskReportDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.reportStartDate);
if (localTaskReportDto != null) {
//サーバ側からのデータが変更されているか確認
if (mOperationLogic.taskReportDataSameCheck(localTaskReportDto, serverTaskReportDto)) {
continue;
}
}
}
} else {
localTaskReportDto = mTaskReportDao.selectByTaskKey(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportLevel);
}
......@@ -1513,6 +1547,9 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
if (localTaskReportDto != null) {
// 報告データが存在すると作業報告を更新する
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false, localTaskReportDto.localSavedFlg);
if (localTaskReportDtoList != null) {
localTaskReportDtoList.remove(localTaskReportDto);
}
} else {
mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false);
}
......@@ -1548,19 +1585,28 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
}
if (progressCallback != null) {
progressCallback.callback(new Integer(progress));
if (progress >= 1) {
progressCallback.callback(new Integer((int)progress));
} else {
saveProgress += progress;
if (saveProgress > 1) {
progressCallback.callback(new Integer((int)saveProgress));
saveProgress = 0f;
}
}
}
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
if (taskKey == null) {
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey, Constant.TaskReportLevel.ReportType);
mTaskDao.delete(taskDto);
}
}
lastEditDate = json.lastEditDate;
if (progressCallback != null) {
progressCallback.callback(new Integer(40));
}
return lastEditDate;
}
......
......@@ -85,6 +85,8 @@ import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil;
import static jp.agentec.abook.abv.bl.common.Constant.ReportType.RoutineTask;
public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
protected static GroupLogic groupLogic = AbstractLogic.getLogic(GroupLogic.class);
......@@ -941,7 +943,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
int taskReportId = 0;
String reportStartDate = "";
if (operationDto.reportType == Constant.ReportType.RoutineTask && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
if (operationDto.reportType == RoutineTask && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
taskReportId = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE);
}
......@@ -963,10 +965,15 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
try {
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT)) {
// リソースパターンの適用
runOnUiThread(new Runnable() {
@Override
public void run() {
showProgressPopup(PatternStringUtil.patternToString(getApplicationContext(),
R.string.file_initialization,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
}
});
}
//連続作業の全削除ボタンタップ時のインジケーター表示
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_DELETE_PROCESS)) {
showProgressPopup(PatternStringUtil.patternToString(getApplicationContext(),
......@@ -1013,12 +1020,20 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public Object callback(Object ret) {
final boolean isError = (boolean)ret;
closeProgressPopup();
syncOperation(mOperationId, mReportType, false);
//キー項目あり設定時、送信後、同期処理
if (mOperationType == OperationType.LIST) { //リスト作業のみ実行
if (mReportType != RoutineTask) { //定期点検以外
if (mCmd.equals(ABookKeys.CMD_INSERT_TASK_REPORT) || mCmd.equals(ABookKeys.CMD_UPDATE_TASK_REPORT)) {
try {
receptionTaskData(mOperationId, null, null, mTaskKey);
mOperationLogic.createJsonForOperationContent(mOperationId, mContentPath, false);
} catch (IOException e) {
} catch (Exception e) {
Logger.e(TAG, "createJsonForOperationContent error. " + e);
}
}
}
}
// 報告・報告(回答)の切り替えボタンタップ、連続作業の全削除ボタンタップ
if (mCmd.equals(ABookKeys.CMD_CHANGE_TASK_REPORT) || mCmd.equals(ABookKeys.CMD_DELETE_PROCESS)) {
afterABookCheckApi(mCmd, mTaskKey, 0, "", null, isOperationPdf());
......
......@@ -7,6 +7,8 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
......@@ -320,8 +322,14 @@ public class OperationListActivity extends ABVUIActivity {
mCallBack = new Runnable() {
@Override
public void run() {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
openReportView(tempOperationDto);
}
});
}
};
runOnUiThread(new Runnable() {
@Override
......@@ -598,6 +606,30 @@ public class OperationListActivity extends ABVUIActivity {
}
}
});
} else {
//作業報告した後、戻った時に自動同期を開始
final OperationDto operationDto = mOperationLogic.getOperation(operationId);
if (operationDto != null && operationDto.needSyncFlg) {
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
mCallBack = new Runnable() {
@Override
public void run() {
//同期終了後、新着更新
if (!contentRefresher.isRefreshing()) {
dateUpdate();
}
}
};
//すぐ同期処理を開始すると、プログレスバー表示されないため、0.5秒後に実行
handler.postDelayed(new Runnable() {
@Override
public void run() {
startSyncOperationStart(operationDto, false);
}
}, 500);
}
}
}
if (!activityResultFlg && operationId == -1) {
......@@ -770,7 +802,13 @@ public class OperationListActivity extends ABVUIActivity {
return result;
}
public void startTaskDirectionOrReportView(OperationDto operationDto) {
public void startTaskDirectionOrReportView(final OperationDto operationDto) {
runOnUiThread(new Runnable() {
@Override
public void run() {
showProgressPopup();
}
});
try {
ContentDto contentDto = contentDao.getContent(operationDto.contentId);
if (contentDto != null && contentDto.downloadedFlg) {
......@@ -798,10 +836,15 @@ public class OperationListActivity extends ABVUIActivity {
// 作業閲覧日付の更新
mOperationDao.updateReadingDate(operationDto.operationId);
final String _contentPath = contentPath;
runOnUiThread(new Runnable() {
@Override
public void run() {
// サーバ作業後、対応必要
StringBuffer path = new StringBuffer();
path.append(contentPath);
path.append(_contentPath);
// #32926 作業報告画面改善 start
path.append("/index.html?app=android");
path.append("&report_type=" + operationDto.reportType); // 作業報告タイプ : 0:報告 1:定期点検 2:報告(回答)
......@@ -830,19 +873,23 @@ public class OperationListActivity extends ABVUIActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(AppDefType.ChatPushMessageKey.baseActivityName, OperationListActivity.class.getName());
if(operationDto.operationType == OperationType.PDF) {
if (operationDto.operationType == OperationType.PDF) {
intent.putExtra("LINKURL", "file://" + path);
ActivityHandlingHelper.getInstance().checkContentActivity(operationDto.contentId, 0, intent);
} else {
intent.setClass(this, HTMLXWalkWebViewActivity.class);
ActivityHandlingHelper.getInstance().startHTMLXWalkWebActivity(this, intent, "file://" + path, operationDto.contentId, -1, -1, -1, -1, -1);
intent.setClass(OperationListActivity.this, HTMLXWalkWebViewActivity.class);
ActivityHandlingHelper.getInstance().startHTMLXWalkWebActivity(OperationListActivity.this, intent, "file://" + path, operationDto.contentId, -1, -1, -1, -1, -1);
}
}
});
} else {
Logger.w(TAG, "content is not download");
}
} catch (Exception e) {
Logger.e(TAG, e);
handleErrorMessageToast(ErrorCode.E107);
} finally {
closeProgressPopup();
}
}
......@@ -899,125 +946,11 @@ public class OperationListActivity extends ABVUIActivity {
String errorMessage = syncOperation(operationId, operationReportType, buttonEventFlg);
if (errorMessage != null) {
closeProgressPopup();
if (buttonEventFlg) {
// エラーメッセージ表示
showSimpleAlertDialog(getString(R.string.app_name), errorMessage);
}
}
/**
* 作業同期処理
* @param operationId
* @param reportType
* @param buttonEventFlag
* @return result errorMessage
*/
@Override
public String syncOperation(final long operationId, int reportType, boolean buttonEventFlag) {
final StringBuilder errorMsg = new StringBuilder();
try {
//コンテンツダウンロード関連プログレスバー値設定
progressDialogHorizontal.setProgress(20);
final Callback progressCallback = new Callback() {
@Override
public Object callback(Object ret) {
final int progress = (int)ret;
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialogHorizontal.setProgress(progressDialogHorizontal.getProgress() + progress);
}
});
return null;
}
};
// 報告送信
mOperationLogic.sendTaskReportSendData(operationId, progressCallback);
//工程全削除の送信(連続作業)
if (reportType == ReportType.ReportContinuous) {
if (!mOperationLogic.deleteProcess(operationId)) { //工程全削除送信失敗時
return PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_error_all_process_delete,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
}
progressDialogHorizontal.setProgress(60);
// 報告受信
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, errorMsg);
//連続作業のみ承認データ取得
if (reportType == ReportType.ReportContinuous) {
mOperationLogic.getProcessData(operationId);
}
// mOperationLastEditDateがnullの場合、エラーと見做す
if (mOperationLastEditDate != null && reportType == ReportType.RoutineTask) {
if (buttonEventFlag) {
String dialogMsg = null;
// 定期点検の利用可能日付を取得
String avilableDateStr = mOperationLogic.getRoutineTaskOperationAvailableDateStr(operationId);
if (!StringUtil.isNullOrEmpty(avilableDateStr)) {
// 利用可能メッセージ
// リソースパターンの適用
dialogMsg = String.format(PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_routineTask_report_available_from,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), avilableDateStr);
} else if (!mTaskReportDao.existsToDoRoutineTaskReportData(operationId)) {
// 作業データが存在しないメッセージ
dialogMsg = PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_no_report_data,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
if (!StringUtil.isNullOrEmpty(dialogMsg)) {
errorMsg.append(dialogMsg);
}
}
putUserPref(String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationId), DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none));
}
} catch (AcmsException e) {
//noinspection EnumSwitchStatementWhichMissesCases
switch (e.getCode()) {
case P_E_ACMS_P003:
// リソースパターンを適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P003, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
case P_E_ACMS_P004:
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P004, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
case P_E_ACMS_P005:
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P005, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
case P_E_ACMS_P006:
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P006, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
default:
Logger.e(TAG, "syncOperation", e);
errorMsg.append(ErrorMessage.getErrorMessage(this, ErrorMessage.getErrorCode(e)));
break;
}
mOperationLastEditDate = null;
} catch (Exception e) {
Logger.e(TAG, e);
errorMsg.append(ErrorMessage.getErrorMessage(this, ABVExceptionCode.C_E_SYSTEM_0001));
mOperationLastEditDate = null;
} finally {
handler.post(new Runnable() {
@Override
public void run() {
if (mOperationLastEditDate != null) {
mOperationLogic.finishedSyncOperation(operationId, mOperationLastEditDate);
progressDialogHorizontal.setProgress(100);
}
mOperationLastEditDate = null;
//screenRefresh();
closeProgressPopup();
}
});
Logger.i(TAG, "---sync end");
}
return errorMsg.length() > 0 ? errorMsg.toString() : null;
}
// 設定画面へ遷移
......@@ -1059,161 +992,9 @@ public class OperationListActivity extends ABVUIActivity {
}
/**
* 作業データ受信
* @param operationId
* @param progressCallback
* @return
* @throws NetworkDisconnectedException
* @throws ABVException
* @throws IOException
* @throws InterruptedException
* @throws NoSuchAlgorithmException
* @throws ZipException
*/
@Override
public Date receptionTaskData(long operationId, Callback progressCallback, StringBuilder errorMsg) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
GetOperationDataParameters param = new GetOperationDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId);
OperationDto operationDto = mOperationLogic.getOperation(operationId);
OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId);
List<TaskDto> localTaskList = mTaskDao.selectAllTaskByOperationId(operationId);
Date lastEditDate;
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
//プログレスを40%進行させるための計算
int progress = 0;
if (json.taskDtoList.size() != 0) {
progress = 40 / json.taskDtoList.size();
}
boolean isRoutineTask = operationDto.reportType == ReportType.RoutineTask;
for (TaskDto serverTaskDto : json.taskDtoList) {
List<TaskReportDto> localTaskReportList = mTaskReportDao.getTaskReportListByTaskKey(serverTaskDto.taskKey);
for (TaskReportDto localTaskReportDto : localTaskReportList) {
if (!isExistsTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto, isRoutineTask)) {
if (isRoutineTask) {
mOperationLogic.deleteRoutineTaskReport(operationId, operationContentDto.contentId, localTaskReportDto);
} else {
// taskDtoが存在するとtaskReportLevel 0 (作業報告)が存在しないことはないので、報告(回答)のみチェックして削除
if (localTaskReportDto.taskReportLevel != TaskReportLevel.ReportType) {
// 作業報告のディレクトリ削除
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, serverTaskDto.taskKey, localTaskReportDto.taskReportLevel);
mTaskReportDao.delete(localTaskReportDto);
}
}
}
}
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
// 作業の報告更新
mTaskDao.update(serverTaskDto);
localTaskList.remove(serverTaskDto);
} else {
// 作業の報告登録
mTaskDao.insert(serverTaskDto);
}
// サーバーからの情報で更新
for (TaskReportDto serverTaskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = serverTaskReportDto.attachedFileName;
TaskReportDto localTaskReportDto;
if (operationDto.reportType == ReportType.RoutineTask) {
localTaskReportDto = mTaskReportDao.getRoutineTaskReportUtc(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportId, DateTimeUtil.toString(serverTaskReportDto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen));
} else {
localTaskReportDto = mTaskReportDao.selectByTaskKey(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportLevel);
}
if (localTaskReportDto != null && localTaskReportDto.localSavedFlg) {
// 一時保存フラグがtrueで定期点検且つ点検後修正不可の場合、添付ファイル(作業報告のディレクトリ)を削除して、localSavedFlgをfalseに変更
if (operationDto.reportType == ReportType.RoutineTask && operationDto.enableReportUpdate == Constant.EnableReportUpdate.NO) {
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(operationContentDto.contentId, localTaskReportDto.taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, localTaskReportDto.taskKey, localTaskReportDto.taskReportId, DateTimeUtil.toString_yyyyMMddHHmmss_none(localTaskReportDto.reportStartDate)));
localTaskReportDto.localSavedFlg = false;
} else {
// 一時保存フラグがtureだと何もしない
continue;
}
}
if (operationDto.reportType == ReportType.RoutineTask) {
serverTaskReportDto.taskKey = serverTaskDto.taskKey;
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.taskReportInfoId, serverTaskReportDto.reportStartDate, attachedFileName);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
return null;
}
if (localTaskReportDto != null) {
// 報告データが存在すると作業報告を更新する
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false, localTaskReportDto.localSavedFlg);
} else {
mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false);
}
} else {
JSONObject taskReportJson = null;
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshTaskFile(operationId, serverTaskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.attachedFileName, serverTaskDto.processKey, serverTaskDto.phaseNo);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
return null;
}
if (!serverTaskReportDto.jsonData.isEmpty()) {
taskReportJson = new JSONObject(serverTaskReportDto.jsonData);
if (serverTaskReportDto.taskReportLevel == TaskReportLevel.ReportType) {
taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
}
}
if (localTaskReportDto == null) {
// 登録
mOperationLogic.insertTaskReport(serverTaskDto.taskKey, operationId, operationContentDto.contentId,
serverTaskReportDto.taskReportLevel, serverTaskReportDto.enableReport,
taskReportJson, attachedFileName, false, false, false, serverTaskDto.processKey, serverTaskDto.phaseNo);
} else {
// 更新
// jsonDataが空で入る場合、taskReportJsonをnullで登録
mOperationLogic.updateTaskReport(serverTaskDto.taskKey, operationId, operationContentDto.contentId,
serverTaskReportDto.taskReportLevel, serverTaskReportDto.enableReport,
taskReportJson, attachedFileName, false, false, localTaskReportDto.localSavedFlg, serverTaskDto.processKey, serverTaskDto.phaseNo);
}
}
}
if (progressCallback != null) {
progressCallback.callback(new Integer(progress));
}
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey, TaskReportLevel.ReportType);
mTaskDao.delete(taskDto);
}
lastEditDate = json.lastEditDate;
if (progressCallback != null) {
progressCallback.callback(new Integer(40));
}
return lastEditDate;
}
/**
* 360コンテンツ登録ダイアログ
*/
public void showPanoEntryDialog(final OperationDto operationDto) {
Logger.d(TAG, "*****************showPanoEntryDialog");
if (contentRefresher != null && contentRefresher.isRefreshing()) {
// 新着更新処理が行っていれば、止める
contentRefresher.stopRefresh();
......@@ -1324,7 +1105,10 @@ public class OperationListActivity extends ABVUIActivity {
ABVToastUtil.showMakeText(this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
startSyncOperationStart(operationDto, true);
}
public void startSyncOperationStart(final OperationDto operationDto, final boolean buttonEventFlg) {
// リソースパターンの適用
showProgressView(PatternStringUtil.patternToString(getApplicationContext(),
R.string.synchronizing,
......@@ -1353,7 +1137,7 @@ public class OperationListActivity extends ABVUIActivity {
closeProgressPopup();
}
} else {
singleSyncOperation(operationDto.operationId, operationDto.reportType, true);
singleSyncOperation(operationDto.operationId, operationDto.reportType, buttonEventFlg);
}
}
});
......
......@@ -80,7 +80,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param finishCallback
* @param taskReportLevel
*/
public void doABookCheckParam(ABVContentViewActivity context, String cmd, String taskKey, int enableReportHistory, Map<String, String> param, long operationId, String contentPath, long contentId, int reportType, Callback finishCallback, int taskReportLevel) throws IOException {
public void doABookCheckParam(ABVContentViewActivity context, final String cmd, final String taskKey, final int enableReportHistory, final Map<String, String> param, final long operationId, final String contentPath, final long contentId, final int reportType, Callback finishCallback,final int taskReportLevel) throws IOException {
int taskReportSendId = 0;
mFinishCallback = finishCallback;
......@@ -106,17 +106,25 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// その時に呼び出し元で表示したダイアログが閉じずに、操作不能となったので、
// mFinishCallBackに、エラーを通知しダイアログを閉じる処理を追加した。
// TODO: 失敗するのであれば、データが壊れているわけなので、壊れたデータを削除する必要があるのでは?
final ABVContentViewActivity final_context = context;
final String final_processKey = processKey;
final Integer final_phaseNo = phaseNo;
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
try {
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel, final_processKey, final_phaseNo);
sendTaskData(final_context, operationId, taskKey, taskReportLevel, reportType, contentPath);
} catch (Exception e) {
context.showSimpleAlertDialog(R.string.error, R.string.ERROR);
Logger.e(TAG,e);
final_context.showSimpleAlertDialog(R.string.error, R.string.ERROR);
Logger.e(TAG, e);
mFinishCallback.callback(true);
context.closeProgressPopup();
throw e;
final_context.closeProgressPopup();
Logger.e(TAG, "doABookCheckParam error", e);
}
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel, processKey, phaseNo);
sendTaskData(context, operationId, taskKey, taskReportLevel, reportType, contentPath);
}
});
break;
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, true);
......@@ -236,9 +244,14 @@ public class ABookCheckWebViewHelper extends ABookHelper {
};
// リソースパターンの適用
context.runOnUiThread(new Runnable() {
@Override
public void run() {
context.showProgressView(PatternStringUtil.patternToString(context,
R.string.synchronizing,
getUserPref(context, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
}
});
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
......
......@@ -162,8 +162,6 @@ public class OzdFileHelper {
public static final boolean moveTempOzdFileToOzdFile(long contentId, String taskKey, String tempOzFileName, String ozFileName) {
String tempOzdFilePath = ABVEnvironment.getInstance().getTempFilePath(contentId, taskKey, tempOzFileName);
String ozdFilePath = ABVEnvironment.getInstance().getTempFilePath(contentId, taskKey, ozFileName);
Logger.i("******** tempOzdFilePath = " + tempOzdFilePath);
Logger.i("******** ozdFilePath = " + ozdFilePath);
if (FileUtil.exists(ozdFilePath)) {
FileUtil.delete(ozdFilePath);
}
......
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