Commit c976e02c by onuma

カテゴリ選択機能(スマホ)まで実装

parent 1349ecdb
......@@ -9,6 +9,7 @@ import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.TaskWorkerGroupDto;
import jp.agentec.adf.util.DateTimeFormat;
......@@ -56,6 +57,13 @@ public class OperationListJSON extends AcmsCommonJSON {
public static final String EnableAddReport = "enableAddReport";
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
public static final String OperationGroupMasterIdList = "operationGroupMasterIdList";
public static final String QuickReport = "quickReport";
public List<OperationDto> operationList;
public OperationListJSON(String jsonString) throws AcmsException {
......@@ -73,6 +81,8 @@ public class OperationListJSON extends AcmsCommonJSON {
OperationDto dto = new OperationDto();
dto.operationContentDtoList = new ArrayList<OperationContentDto>();
dto.taskWorkerGroupDtoList = new ArrayList<TaskWorkerGroupDto>();
dto.operationGroupMasterRelationDtoList = new ArrayList<OperationGroupMasterRelationDto>();
dto.operationId = operationJson.getLong(OperationId);
dto.operationType = operationJson.getInt(OperationType);
dto.operationName = operationJson.getString(OperationName);
......@@ -83,6 +93,7 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.enableReportHistory = operationJson.getInt(EnableReportHistory); // 報告履歴管理
dto.enableReportEdit = operationJson.has(EnableReportEdit) ? operationJson.getInt(EnableReportEdit) : 0; // 作業編集区分
dto.enableAddReport = operationJson.has(EnableAddReport) ? operationJson.getInt(EnableAddReport) : 0; // 作業追加区分
dto.quickReport = operationJson.has(QuickReport) ? operationJson.getInt(QuickReport) : 0;
// 作業終了更新日
if (operationJson.has(OperationLastEditDate)) {
......@@ -100,7 +111,7 @@ public class OperationListJSON extends AcmsCommonJSON {
if (operationJson.has(ContentId)) {
// プロジェクト用資料の登録
OperationContentDto operationContentDto = new OperationContentDto();
operationContentDto.operationId = operationJson.getLong(OperationId);
operationContentDto.operationId = dto.operationId;
operationContentDto.contentId = operationJson.getLong(ContentId);
operationContentDto.operationContentFlg = true;
dto.operationContentDtoList.add(operationContentDto);
......@@ -111,7 +122,7 @@ public class OperationListJSON extends AcmsCommonJSON {
for (int k = 0; k < relatedContentJsonArray.length(); k++) {
// 関連資料の登録
OperationContentDto operationContentDto = new OperationContentDto();
operationContentDto.operationId = operationJson.getLong(OperationId);
operationContentDto.operationId = dto.operationId;
operationContentDto.contentId = relatedContentJsonArray.getJSONObject(k).getInt(ContentId);
operationContentDto.operationContentFlg = false;
dto.operationContentDtoList.add(operationContentDto);
......@@ -154,6 +165,17 @@ public class OperationListJSON extends AcmsCommonJSON {
}
}
// 作業種別IDリストをセット
if (operationJson.has(OperationGroupMasterIdList)) {
// 作業種別に紐づく作業種別ID、作業IDセット
JSONArray operationGroupMasterIdJsonArray = operationJson.getJSONArray(OperationGroupMasterIdList);
for (int j = 0; j < operationGroupMasterIdJsonArray.length(); j++) {
OperationGroupMasterRelationDto operationGroupMasterRelationDto = new OperationGroupMasterRelationDto();
operationGroupMasterRelationDto.operationId = dto.operationId;
operationGroupMasterRelationDto.operationGroupMasterId = operationGroupMasterIdJsonArray.getInt(j);
dto.operationGroupMasterRelationDtoList.add(operationGroupMasterRelationDto);
}
}
operationList.add(dto);
}
}
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.db.SQLiteStatement;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
/**
* Created by leej on 2019/06/26.
*/
public class OperationGroupMasterOperationDao extends AbstractDao {
private static final String TAG = "OperationGroupMasterDao";
private enum QueryType {GetAllGroups, GetRootGroups, GetGroups}
/*package*/ OperationGroupMasterOperationDao() {
}
@Override
protected OperationGroupMasterRelationDto convert(Cursor cursor) {
OperationGroupMasterRelationDto dto = new OperationGroupMasterRelationDto();
int column = cursor.getColumnIndex("operation_group_master_id");
if (column != -1) {
dto.operationGroupMasterId = cursor.getInt(column);
}
column = cursor.getColumnIndex("operation_id");
if (column != -1) {
dto.operationId = cursor.getLong(column);
}
return dto;
}
/**
* 作業種別と作業のリレーションテーブル削除
* @param operationGroupMasterId
*/
public void deleteOperationGroupMasterOperation(Integer operationGroupMasterId, Long operationId) {
delete("r_operation_group_master_relation", "operation_group_master_id=? AND operation_id=?", new String[]{""+ operationGroupMasterId, ""+ operationId});
}
/**
* 作業種別と作業のリレーションテーブルのDB登録処理
* @param dto
*/
public boolean insertOperationGroupMasterOperation(OperationGroupMasterRelationDto dto) {
StringBuffer sql = new StringBuffer();
sql.append(" INSERT OR IGNORE INTO r_operation_group_master_relation ");
sql.append(" SELECT " + dto.operationGroupMasterId);
sql.append(" , " + dto.operationId);
sql.append(" FROM t_operation AS top ");
sql.append(" LEFT OUTER JOIN r_operation_group_master_relation AS rmogm ");
sql.append(" ON rmogm.operation_group_master_id = ? ");
sql.append(" AND top.operation_id <> rmogm.operation_id ");
sql.append(" WHERE top.operation_id = ? ");
sql.append(" GROUP BY rmogm.operation_group_master_id ");
SQLiteStatement stmt = null;
Logger.v(TAG, "sql=%s", sql);
try {
SQLiteDatabase db = getDatabase();
stmt = db.compileStatement(sql.toString());
stmt.bindLong(1, dto.operationGroupMasterId);
stmt.bindLong(2, dto.operationId);
return (stmt.executeInsert() > 0);
} finally {
if (stmt != null) {
stmt.close();
}
}
}
/**
* 作業種別IDで関連する作業のIDを取得
* @param operationId
* @return
*/
public List<Integer> getOperationGroupMasterIds(Long operationId) {
return rawQueryGetIntegerList("select operation_group_master_id from r_operation_group_master_relation where operation_id=?", new String[]{""+ operationId});
}
}
\ No newline at end of file
......@@ -41,6 +41,7 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.OperationGroupMasterOperationDao;
import jp.agentec.abook.abv.bl.data.dao.PushMessageDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
......@@ -52,6 +53,7 @@ import jp.agentec.abook.abv.bl.dto.CategoryContentDto;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
......@@ -79,6 +81,10 @@ public class OperationLogic extends AbstractLogic {
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class);
private TaskReportItemsDao mTaskReportItemsDao = AbstractDao.getDao(TaskReportItemsDao.class);
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能 追加
///////////////////////////////////////////////////////////////////////////////////////////////////////
private OperationGroupMasterOperationDao mOperationGroupMasterOperationDao = AbstractDao.getDao(OperationGroupMasterOperationDao.class);
private ContentLogic mContentLogic = AbstractLogic.getLogic(ContentLogic.class);
......@@ -139,7 +145,36 @@ public class OperationLogic extends AbstractLogic {
if (mOperationContentDao.isExistMainOperationContent(serverOperationDto.operationId)) {
serverOperationDto.contentCreatingFlg = false;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能 追加
///////////////////////////////////////////////////////////////////////////////////////////////////////
// ローカルにある作業情報に紐づく全作業IDを取得
List<Integer> localOperationGroupMasterIds = mOperationGroupMasterOperationDao.getOperationGroupMasterIds(serverOperationDto.operationId);
for (OperationGroupMasterRelationDto operationGroupMasterRelationDto : serverOperationDto.operationGroupMasterRelationDtoList) {
if (localOperationGroupMasterIds == null || localOperationGroupMasterIds.size() == 0) {
// 作業IDが存在しなければ、登録する
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterRelationDto);
} else {
// ローカル(DB)に作業IDが存在するかチェックして更新・登録を判定
int localOperationContentIndex = localOperationGroupMasterIds.indexOf(operationGroupMasterRelationDto.operationGroupMasterId);
if (localOperationContentIndex >= 0) {
// 作業IDが存在するので更新
localOperationGroupMasterIds.remove(localOperationContentIndex);
} else {
// 作業IDが存在しないので登録
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterRelationDto);
}
}
}
if (localOperationGroupMasterIds != null) {
// ローカルとサーバーの差分は削除と見做し、削除処理を行う。
for (Integer deleteOperationGroupMasterId : localOperationGroupMasterIds) {
mOperationGroupMasterOperationDao.deleteOperationGroupMasterOperation(deleteOperationGroupMasterId, serverOperationDto.operationId);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能 追加ここまで
///////////////////////////////////////////////////////////////////////////////////////////////////////
mOperationDao.update(serverOperationDto);
// 更新することで登録フラグをfalseにセット
insertFlg = false;
......@@ -167,6 +202,16 @@ public class OperationLogic extends AbstractLogic {
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
mOperationContentDao.insertOperationContent(operationContentDto);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能
///////////////////////////////////////////////////////////////////////////////////////////////////////
// 作業種別・作業のリレーションテーブルにデータ登録
for (OperationGroupMasterRelationDto operationGroupMasterRelationDto : serverOperationDto.operationGroupMasterRelationDtoList) {
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterRelationDto);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
// カテゴリ選択機能 追加ここまで
///////////////////////////////////////////////////////////////////////////////////////////////////////
}
// 作業担当グループ登録
......@@ -1135,9 +1180,9 @@ public class OperationLogic extends AbstractLogic {
* @param searchEndDateStr 終了期間
* @return 作業情報配列
*/
public List<OperationDto> getRefreshOperation(String searchWord, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
return mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, reportTypeStr);
}
//public List<OperationDto> getRefreshOperation(String searchWord, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
// return mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, reportTypeStr);
//}
/**
* 作業毎に情報更新ボタンを表示するため、NeedSyncFlgをセットする。
......
......@@ -1435,7 +1435,8 @@
<!-- カテゴリ選択機能 -->
<string name="no_child">これより下はありません。</string>
<string name="category_list">カテゴリ一覧</string>
<string name="title_category">カテゴリ</string>
<string name="title_all_operation">全作業</string>
<string name="category_list">カテゴリ一覧</string>
</resources>
......@@ -1443,7 +1443,8 @@
<!-- カテゴリ選択機能 -->
<string name="no_child">이 아래로는 데이터가 없습니다.</string>
<string name="category_list">분류 목록</string>
<string name="title_category">분류</string>
<string name="title_all_operation">전체 작업</string>
<string name="category_list">분류 목록</string>
</resources>
\ No newline at end of file
......@@ -1441,7 +1441,8 @@
<!-- カテゴリ選択機能 -->
<string name="no_child">No more data below.</string>
<string name="category_list">aaa</string>
<string name="title_category">bbbb</string>
<string name="title_all_operation">Absdafasll</string>
<string name="title_category">Category</string>
<string name="title_all_operation">All</string>
<string name="category_list">Select Category</string>
</resources>
\ No newline at end of file
......@@ -72,4 +72,10 @@
<item></item>
<item>縦(反転)</item>
</string-array>
<string-array name="category_types">
<item>全て</item>
<item>カテゴリ</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -74,4 +74,10 @@
<item>세로</item>
<item>세로(역방향)</item>
</string-array>
<string-array name="category_types">
<item>전체</item>
<item>분류</item>
</string-array>
</resources>
......@@ -117,4 +117,5 @@
<item>All</item>
<item>Category</item>
</string-array>
</resources>
\ No newline at end of file
......@@ -232,7 +232,7 @@ public class OperationListActivity extends ABVUIActivity {
// ツールバーのタイトル表示
//mOperationTitle = (TextView) findViewById(R.id.operation_title);
mOperationBatchSyncButton = (ImageButton) findViewById(R.id.btn_batch_sync);
//mOperationBatchSyncButton = (ImageButton) findViewById(R.id.btn_batch_sync);
mCategoryLocationButton = (ImageButton) findViewById(R.id.btn_category_location);
......@@ -402,14 +402,14 @@ public class OperationListActivity extends ABVUIActivity {
// 検索ボタンを無効にする
mSearchButton.setEnabled(false);
// 一括同期ボタン表示
mOperationBatchSyncButton.setVisibility(View.VISIBLE);
//mOperationBatchSyncButton.setVisibility(View.VISIBLE);
} else {
// 全て
// 検索ボタンを活性化
mSearchButton.setEnabled(true);
setCategoryImage(false);
// 一括同期ボタン非表示
mOperationBatchSyncButton.setVisibility(View.GONE);
//mOperationBatchSyncButton.setVisibility(View.GONE);
//mOperationTitle.setText(R.string.title_all_operation);
mTitleView.setText(R.string.title_all_operation);
}
......@@ -420,7 +420,7 @@ public class OperationListActivity extends ABVUIActivity {
setCategoryImage(false);
mCategoryLocationButton.setVisibility(View.GONE);
// 一括同期ボタンを非表示
mOperationBatchSyncButton.setVisibility(View.GONE);
//mOperationBatchSyncButton.setVisibility(View.GONE);
// 検索ボタンを活性化
mSearchButton.setEnabled(true);
}
......@@ -2040,7 +2040,7 @@ public class OperationListActivity extends ABVUIActivity {
private OperationGroupMasterLogic mOperationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
private ABVListDialog mShowDialog;
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
private ImageButton mOperationBatchSyncButton; // カテゴリの一括同期ボタン
//private ImageButton mOperationBatchSyncButton; // カテゴリの一括同期ボタン
// 作業種別のサービスオプション値を保持用フラグ
private boolean mOperationGroupMasterServiceOperationFlg;
......@@ -2218,10 +2218,10 @@ public class OperationListActivity extends ABVUIActivity {
public void checkBatchNeedSyncButton(Integer operationGroupMasterId) {
if (mOperationDao.hasNeedSyncOperationByGroupMasterId(operationGroupMasterId)) {
// 選択したカテゴリ一覧でneedSyncFlgがtrueの作業が存在すれば、活性化する
mOperationBatchSyncButton.setEnabled(true);
//mOperationBatchSyncButton.setEnabled(true);
} else {
// 一括同期ボタンを非活性化する
mOperationBatchSyncButton.setEnabled(false);
//mOperationBatchSyncButton.setEnabled(false);
}
}
......
......@@ -65,7 +65,9 @@ public abstract class OperationListHelper {
private List<OperationDto> filterOperationList() {
try {
String reportTypeStr = getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
operationDtoList = operationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr);
// OperationGroupMasterListHelper か HomeOperationListHelper かどちらかのを実行
operationDtoList = findOperationList();
//operationDtoList = operationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr);
for (OperationDto operationDto : operationDtoList) {
// 該当する作業の最後に同期した日付を取得
......
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