Commit 5b2ea6f4 by Kim Jinsung

#62987 アプリ自動同期仕様変更

parent bae657e9
......@@ -12,6 +12,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -1957,4 +1958,20 @@ public class OperationLogic extends AbstractLogic {
}
return needSyncCheckArray;
}
/**
* 重複作業情報を配列から除外
* @param operationDtoList
* @return
*/
public List<OperationDto> deduplicateOperationDto(List<OperationDto> operationDtoList) {
Map<String, OperationDto> map = new HashMap<>();
for (OperationDto operationDto : operationDtoList) {
// IDと名前だけをキーにする
String key = operationDto.operationId +"_" + operationDto.operationName;
// 上記のキーで要素を格納
map.put(key, operationDto);
}
return new ArrayList<>(map.values());
}
}
......@@ -211,6 +211,8 @@ public class OperationListActivity extends OperationActivity {
public Long mQrCodeOperationId = null;
private ListView mOperationPushMessageListView;
private Long mSyncTargetOperationId = null;
// ビューの作成
private class ReloadHandler implements Runnable {
@Override
......@@ -506,6 +508,20 @@ public class OperationListActivity extends OperationActivity {
needSyncOperationList.addAll(mOperationDao.getNeedSyncAllOperation());
}
List<OperationDto> needSyncCheckArray = mOperationLogic.needSyncCheckArray(needSyncOperationList);
if (mSyncTargetOperationId != null && mSyncTargetOperationId != -1) {
if (ABVDataCache.getInstance().serviceOption.isUnableIOReport()) {
List<OperationDto> categorySyncOperationList = mListHelper.getNeedSyncOperationList();
needSyncCheckArray.addAll(categorySyncOperationList);
}
OperationDto operationDto = mOperationLogic.getOperation(mSyncTargetOperationId);
if (operationDto != null && operationDto.needSyncFlg) {
needSyncCheckArray.add(operationDto);
}
mSyncTargetOperationId = null;
needSyncCheckArray = mOperationLogic.deduplicateOperationDto(needSyncCheckArray);
}
Logger.i("needSyncCheckArray.size() = " + needSyncCheckArray.size() + ", mSyncTargetOperationId = " + mSyncTargetOperationId);
if (needSyncCheckArray.size() > 0) {
categoryBatchSync(needSyncCheckArray);
} else {
......@@ -548,9 +564,12 @@ public class OperationListActivity extends OperationActivity {
Logger.i(TAG, "onResume:start");
super.onResume();
refreshOperationList();
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
// 作業指示・報告からプロジェクト一覧へ戻った時の同期処理
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
if (isAutoSync()) {
mSyncTargetOperationId = operationId;
// delay for showProgressView
handler.postDelayed(new Runnable() {
@Override
......@@ -560,7 +579,7 @@ public class OperationListActivity extends OperationActivity {
}, 100);
} else {
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
if (operationId != -1) {
final OperationDto operationDto = mOperationLogic.getOperation(operationId);
// リソースパターンの適用
......@@ -2431,6 +2450,7 @@ public class OperationListActivity extends OperationActivity {
}
}
mAutoSyncOpenOperationId = null;
mSyncTargetOperationId = null;
}
/**
......
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