Commit 5b2ea6f4 by Kim Jinsung

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

parent bae657e9
...@@ -12,6 +12,7 @@ import java.security.NoSuchAlgorithmException; ...@@ -12,6 +12,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -1957,4 +1958,20 @@ public class OperationLogic extends AbstractLogic { ...@@ -1957,4 +1958,20 @@ public class OperationLogic extends AbstractLogic {
} }
return needSyncCheckArray; 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 { ...@@ -211,6 +211,8 @@ public class OperationListActivity extends OperationActivity {
public Long mQrCodeOperationId = null; public Long mQrCodeOperationId = null;
private ListView mOperationPushMessageListView; private ListView mOperationPushMessageListView;
private Long mSyncTargetOperationId = null;
// ビューの作成 // ビューの作成
private class ReloadHandler implements Runnable { private class ReloadHandler implements Runnable {
@Override @Override
...@@ -506,6 +508,20 @@ public class OperationListActivity extends OperationActivity { ...@@ -506,6 +508,20 @@ public class OperationListActivity extends OperationActivity {
needSyncOperationList.addAll(mOperationDao.getNeedSyncAllOperation()); needSyncOperationList.addAll(mOperationDao.getNeedSyncAllOperation());
} }
List<OperationDto> needSyncCheckArray = mOperationLogic.needSyncCheckArray(needSyncOperationList); 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) { if (needSyncCheckArray.size() > 0) {
categoryBatchSync(needSyncCheckArray); categoryBatchSync(needSyncCheckArray);
} else { } else {
...@@ -548,9 +564,12 @@ public class OperationListActivity extends OperationActivity { ...@@ -548,9 +564,12 @@ public class OperationListActivity extends OperationActivity {
Logger.i(TAG, "onResume:start"); Logger.i(TAG, "onResume:start");
super.onResume(); super.onResume();
refreshOperationList(); refreshOperationList();
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
// 作業指示・報告からプロジェクト一覧へ戻った時の同期処理 // 作業指示・報告からプロジェクト一覧へ戻った時の同期処理
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) { if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
if (isAutoSync()) { if (isAutoSync()) {
mSyncTargetOperationId = operationId;
// delay for showProgressView // delay for showProgressView
handler.postDelayed(new Runnable() { handler.postDelayed(new Runnable() {
@Override @Override
...@@ -560,7 +579,7 @@ public class OperationListActivity extends OperationActivity { ...@@ -560,7 +579,7 @@ public class OperationListActivity extends OperationActivity {
}, 100); }, 100);
} else { } else {
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
if (operationId != -1) { if (operationId != -1) {
final OperationDto operationDto = mOperationLogic.getOperation(operationId); final OperationDto operationDto = mOperationLogic.getOperation(operationId);
// リソースパターンの適用 // リソースパターンの適用
...@@ -2431,6 +2450,7 @@ public class OperationListActivity extends OperationActivity { ...@@ -2431,6 +2450,7 @@ public class OperationListActivity extends OperationActivity {
} }
} }
mAutoSyncOpenOperationId = null; 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