Commit f5c78aa8 by Lee Jaebin

#34866 一括同期

parent af2b9d92
......@@ -380,4 +380,23 @@ public class OperationDao extends AbstractDao {
updateNeedSyncFlg(operationDto.operationId, true);
}
}
/**
* 作業グループに紐づく同期可能な作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getNeedSyncOperationByGroupMasterId(Integer operationGroupMasterId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM t_operation AS top ");
sql.append(" INNER JOIN r_operation_content AS rop ");
sql.append(" ON top.operation_id = rop.operation_id ");
sql.append(" AND rop.operation_content_flg = 1 ");
sql.append(" INNER JOIN r_operation_group_master_relation AS rogm ");
sql.append(" ON top.operation_id = rogm.operation_id ");
sql.append(" WHERE top.need_sync_flg = 1");
sql.append(" AND rogm.operation_group_master_id = ?");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + operationGroupMasterId }, OperationDto.class);
}
}
\ No newline at end of file
......@@ -121,6 +121,10 @@ public class ContentDownloader {
public void addContentDownloadListener(ContentDownloadListener contentDownloadListener) {
// ダウンロードリスナーが既にセットされてる場合、何もしない
if (contentDownloadListenerSet.contains(contentDownloadListener)) {
return;
}
contentDownloadListenerSet.add(contentDownloadListener);
}
......@@ -834,7 +838,9 @@ public class ContentDownloader {
private void onDownloadingContentZip(HttpDownloadNotification notification, DownloadStatusType downloadStatus) {
ContentZipDownloadNotification dlNotification = new ContentZipDownloadNotification(notification, downloadStatus);
Logger.i(TAG, "--------------- dlNotification");
for (ContentDownloadListener listener : contentDownloadListenerSet) {
Logger.i("---------------" + listener.getClass().toString());
listener.onDownloadingContentZip(dlNotification);
}
}
......
......@@ -30,6 +30,7 @@ import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.EnqueteLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.OperationGroupMasterLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -67,6 +68,7 @@ public class ContentRefresher {
// masterDataを取得するため登録
private ApertureMasterDataLogic apertureMasterDataLogic = AbstractLogic.getLogic(ApertureMasterDataLogic.class);
private OperationGroupMasterLogic operationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
public static ContentRefresher getInstance() {
......@@ -167,6 +169,9 @@ public class ContentRefresher {
// CMSでメンテナンスされる絞り検索マスタデータをアプリから取得できるようにJSONファイルを生成する。
apertureMasterDataLogic.initializeApertureMasterData();
// 作業種別情報を取得
operationGroupMasterLogic.setOperationGroupMaster();
if (interrupt) { // この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別))
Logger.d(TAG, "stop refresh worker before content update.");
setFail();
......
......@@ -96,8 +96,6 @@ public class OperationLogic extends AbstractLogic {
public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
// 作業グループリスト取得
setWorkingGroupList();
// 作業種別・作業種別に紐づいた作業IDを取得
mOperationGroupMasterLogic.setOperationGroupMaster();
// 作業一覧取得し、登録・更新・削除する
retrieveServerOperation();
}
......@@ -1261,7 +1259,9 @@ public class OperationLogic extends AbstractLogic {
operationDto.reportType,
taskReportSendDto.hotspotChangeFlg
);
progressCallback.callback(new Integer(progress));
if (progressCallback != null) {
progressCallback.callback(new Integer(progress));
}
removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId);
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
......@@ -1642,4 +1642,13 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.insert(taskDto);
}
}
/**
* 作業グループに紐づく同期可能な作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getNeedSyncOperationByGroupMasterId(Integer operationGroupMasterId) {
return mOperationDao.getNeedSyncOperationByGroupMasterId(operationGroupMasterId);
}
}
......@@ -523,6 +523,17 @@
<string name="operation_category">カテゴリ</string>
<string name="type_all">全て</string>
<!-- 1.2.0 -->
<string name="msg_operation_enable_meeting_room_connected">会議室入室中の為、このボタンは利用できません。\n共通資料画面から資料を選択してください。</string>
<string name="batch_sync">一括同期</string>
<string name="batch_syncing">一括同期中...</string>
<string name="msg_confirm_batch_sync">表示中の全作業を一括同期しますか?</string>
<string name="msg_batch_sync_disconnect_network">インターネットに接続されていない為、同期処理を中止します。</string>
<string name="msg_batch_sync_content_download_fail">作業ベース資料のダウンロードに失敗しました。</string>
<string name="msg_batch_sync_new_content_updating">新着更新処理中の為、一括同期できません。</string>
<string name="msg_batch_sync_error">「%1$s」の同期に失敗しました。同期処理を中止します。</string>
<string name="msg_batch_sync_move_operation_view">一括同期中には点検作業報告画面へ遷移できません。</string>
<!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0-->
<string name="meetingroom_setting_1">会議室設定(1)</string>
......
......@@ -77,6 +77,15 @@
android:textStyle="bold" />
</RadioGroup>
<ImageButton
android:id="@+id/btc_batch_sync"
style="@style/ToolBarIcon"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/segment_group"
android:src="@drawable/ic_batch_sync"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/search_result"
android:layout_width="wrap_content"
......
......@@ -43,7 +43,7 @@
<RadioButton
android:id="@+id/operation_location_type_all"
android:layout_width="80dp"
android:layout_width="60dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
......@@ -52,15 +52,17 @@
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/type_all"
android:textSize="10sp"
android:textStyle="bold" />
<RadioButton
android:id="@+id/operation_location_type_group"
android:layout_width="80dp"
android:layout_width="60dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
android:gravity="center"
android:textSize="10sp"
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/operation_category"
......@@ -68,6 +70,14 @@
</RadioGroup>
<ImageButton
android:id="@+id/btc_batch_sync"
style="@style/ToolBarIcon"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/segment_group"
android:src="@drawable/ic_batch_sync" />
<ImageButton
android:id="@+id/btn_common_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:textColor="@color/text_select"
android:text="@string/dummy_str"
/>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:padding="6dp"
/>
......@@ -321,8 +321,8 @@ public abstract class ABVActivity extends Activity {
}
}
protected void startActivity(Intent intend, NaviConsts ABVNavi) {
super.startActivity(intend);
protected void startActivity(Intent intent, NaviConsts ABVNavi) {
super.startActivity(intent);
ActivityHandlingHelper.transitionNavi(this, ABVNavi);
}
......
......@@ -207,7 +207,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override
protected void onPause() {
super.onPause();
contentDownloader.removeContentDownloadListener(this);
// contentDownloader.removeContentDownloadListener(this);
}
@Override
......@@ -648,6 +648,26 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
return result;
}
/**
* 作業用コンテンツダウンロード時、ダウンロードかダウンロード再開か判定して行う。
* @param contentDto
* @return
*/
public boolean operationContentDownload(final ContentDto contentDto) {
if (contentDto.isDownloadPaused()) {
// ダウンロード途中で通信が切れた場合、一時停止のステータスに変更になるため、再開させる
try {
contentDownloader.resume(contentDto.contentId);
contentDownloader.addContentDownloadListener(this);
} catch (Exception e) {
Logger.e(TAG, "downloadContent failed. contentId=" + contentDto.contentId, e);
}
} else {
return contentDownload(contentDto.contentId, false);
}
return true;
}
// Wifi非接続時のアラート表示
public void showWifiDisconnectAlert(final int messageId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException {
showWifiDisconnectAlert(messageId, R.string.download, positive, negative);
......
package jp.agentec.abook.abv.ui.common.view;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.PixelFormat;
import java.util.Stack;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
/**
* Created by leej on 2019/08/26.
*/
public class ABVBatchSyncView extends ProgressDialog {
private Context mContext;
private Stack<OperationDto> mBatchSyncOperationStack = new Stack<>();
public ABVBatchSyncView(Context context) {
super(context);
mContext = context;
init();
}
private void init() {
if (getWindow() != null) {
setIndeterminate(false);
setCancelable(false);
setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); //プログレスバー表示
getWindow().setFormat(PixelFormat.TRANSPARENT);
setMessage(getContext().getResources().getString(R.string.batch_syncing));
}
}
public void setStack(Stack<OperationDto> operationDtoStack) {
setMax(operationDtoStack.size());
mBatchSyncOperationStack = operationDtoStack;
}
public OperationDto getOperationDtoByStack() {
return mBatchSyncOperationStack.peek();
}
public boolean checkMaxProgress() {
return getMax() == getProgress() + 1;
}
public void closeProgressDialog() {
setProgress(0);
dismiss();
}
public Stack<OperationDto> getBatchSyncOperationStack() {
return mBatchSyncOperationStack;
}
public boolean empty() {
return mBatchSyncOperationStack.empty();
}
}
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