Commit b6731bf7 by Lee Jaebin

#34190 作業種別毎に作業を絞り込み機能追加

parent fd257eb8
......@@ -62,6 +62,8 @@ public class ABVEnvironment {
// Serverから取得したcontentVersion時のリソースパターンを一時的に保存するための変数
public int resourcePatternType;
public boolean operationGroupMasterClearFlg;
////////////////////////////// 定数 //////////////////////////////////
private static final String ServerTimeKey = "ABook";
......@@ -227,6 +229,22 @@ public class ABVEnvironment {
return logLevel;
}
/**
* 作業種別のクリア判定フラグをセット
* @param clearFlg
*/
public void setOperationGroupMasterClearFlg(boolean clearFlg) {
this.operationGroupMasterClearFlg = clearFlg;
}
/**
* 作業種別のクリア判定フラグ取得
* @return
*/
public boolean getOperationGroupMasterClearFlg() {
return operationGroupMasterClearFlg;
}
///////////////////////////////////////     以下ファイルパス関係     ///////////////////////////////////////
......
......@@ -243,11 +243,10 @@ public class OperationDao extends AbstractDao {
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr, Integer operationGroupMasterId) {
String sql = generateGetOperationQuery(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr, operationGroupMasterId);
public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
String sql = generateGetOperationQuery(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr);
return rawQueryGetDtoList(sql, null, OperationDto.class);
}
......@@ -258,10 +257,9 @@ public class OperationDao extends AbstractDao {
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @param operationGroupMasterId
* @return
*/
private String generateGetOperationQuery(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr, Integer operationGroupMasterId) {
private String generateGetOperationQuery(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
String curDate = DateTimeUtil.toStringInTimeZone(new Date(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC");
StringBuffer sql = new StringBuffer();
......@@ -306,12 +304,6 @@ public class OperationDao extends AbstractDao {
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON top.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 ");
// 作業種別IDに紐づく作業のみ検索するため、INNER JOINする
if (operationGroupMasterId != null) {
sql.append(" INNER JOIN r_operation_group_master_relation AS rogmo ");
sql.append(" ON rogmo.operation_id = top.operation_id ");
sql.append(" AND rogmo.operation_group_master_id =" + operationGroupMasterId);
}
sql.append(" WHERE top.operation_id IS NOT NULL ");
if (!StringUtil.isNullOrEmpty(searchOperationName)) {
sql.append(" AND top.operation_name GLOB " + "'*" + searchOperationName + "*'");
......@@ -370,4 +362,19 @@ public class OperationDao extends AbstractDao {
updateNeedSyncFlg(operationDto.operationId, true);
}
}
/**
* 作業種別IDで関連する作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getOperationByOperationGroupMasterId(Integer operationGroupMasterId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM t_operation AS top");
sql.append(" INNER JOIN r_operation_group_master_relation AS rog");
sql.append(" ON rog.operation_id = top.operation_id");
sql.append(" WHERE rog.operation_group_master_id = ?");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + operationGroupMasterId }, OperationDto.class);
}
}
\ No newline at end of file
......@@ -8,11 +8,15 @@ import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.OperationGroupMasterJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.NetworkDisconnectedException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.OperationGroupMasterDao;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
import jp.agentec.abook.abv.bl.dto.comparator.OperationGroupMasterLevelComparator;
......@@ -25,30 +29,33 @@ public class OperationGroupMasterLogic extends AbstractLogic {
private static final String TAG = "OperationGroupMasterLogic";
private OperationGroupMasterDao mOperationGroupMasterDao = AbstractDao.getDao(OperationGroupMasterDao.class);
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
/**
* 作業種別・作業種別に紐づいた作業IDを取得して
* DBに登録する
*/
public void setOperationGroupMaster() throws NetworkDisconnectedException, AcmsException {
try {
// サーバー通信で、作業種別情報を取得する
List<OperationGroupMasterDto> serverOperationGroupMasterDtos = getOperationGroupMasterServerData();
// ローカルDBに存在する作業種別情報をDto配列でセット
List<OperationGroupMasterDto> localOperationGroupMasterDtos = mOperationGroupMasterDao.getAllOperationGroupMaster();
List<Integer> localOperationGroupMasterIds = new ArrayList<Integer>();
boolean updateFlg = false;
for (OperationGroupMasterDto serverOperationGroupMasterDto : serverOperationGroupMasterDtos) {
// DB登録フラグ
boolean insertFlg = true;
for (OperationGroupMasterDto localOperationGroupMasterDto : localOperationGroupMasterDtos) {
// サーバーで取得したIDでローカルに存在するか比較して、更新・登録を判定
if (serverOperationGroupMasterDto.operationGroupMasterId == localOperationGroupMasterDto.operationGroupMasterId) {
// DB更新処理
// DB更新処理(作業種別の親階層が変更されたか、作業種別名が変更されたときのみ)
if (serverOperationGroupMasterDto.parentOperationGroupMasterId != localOperationGroupMasterDto.parentOperationGroupMasterId || !serverOperationGroupMasterDto.operationGroupMasterName.equals(localOperationGroupMasterDto.operationGroupMasterName)) {
Logger.d(TAG, "[UPDATE] OperationGroupMaster operationGroupMasterId=" + serverOperationGroupMasterDto.operationGroupMasterId + " operationGroupMasterName=" + serverOperationGroupMasterDto.operationGroupMasterName);
mOperationGroupMasterDao.updateOperationGroupMaster(serverOperationGroupMasterDto);
updateFlg = true;
}
// 更新処理が終わったら登録フラグをfalseにしてlocalOperationGroupMasterDtosから除外する
insertFlg = false;
localOperationGroupMasterDtos.remove(localOperationGroupMasterDto);
......@@ -66,8 +73,15 @@ public class OperationGroupMasterLogic extends AbstractLogic {
// 作業種別関連テーブルの削除処理
for (OperationGroupMasterDto deleteOperationGroupMasterDto : localOperationGroupMasterDtos) {
updateFlg = true;
mOperationGroupMasterDao.delete(deleteOperationGroupMasterDto);
}
// 作業種別のクリアフラグをセット
ABVEnvironment.getInstance().setOperationGroupMasterClearFlg(updateFlg);
} catch (Exception e) {
Logger.e(e.getMessage());
}
}
/**
......@@ -129,7 +143,12 @@ public class OperationGroupMasterLogic extends AbstractLogic {
return mOperationGroupMasterDao.getLastGroupLevel();
}
public List<OperationGroupMasterDto> test (Integer operationGroupMasterId) {
/**
* 親の階層パスをリストでセット
* @param operationGroupMasterId
* @return
*/
public List<OperationGroupMasterDto> getParentOperationGroupMasterForPath (Integer operationGroupMasterId) {
List<OperationGroupMasterDto> operationGroupMasterDtoList = new ArrayList<OperationGroupMasterDto>();
// 作業種別DTO取得
OperationGroupMasterDto dto = mOperationGroupMasterDao.getOperationGroupMaster(operationGroupMasterId);
......@@ -144,4 +163,13 @@ public class OperationGroupMasterLogic extends AbstractLogic {
Collections.sort(operationGroupMasterDtoList, new OperationGroupMasterLevelComparator());
return operationGroupMasterDtoList;
}
/**
* 作業種別IDで関連する作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getOperationByOperationGroupMasterId(Integer operationGroupMasterId) {
return mOperationDao.getOperationByOperationGroupMasterId(operationGroupMasterId);
}
}
......@@ -1074,9 +1074,9 @@ public class OperationLogic extends AbstractLogic {
* @param searchEndDateStr
* @return
*/
public List<OperationDto> getRefreshOperation(String searchWord, String searchStartDateStr, String searchEndDateStr, String reportTypeStr, Integer operationGroupMasterId) {
public List<OperationDto> getRefreshOperation(String searchWord, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
List<OperationDto> operationDtoList;
operationDtoList = mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, reportTypeStr, operationGroupMasterId);
operationDtoList = mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, reportTypeStr);
for (OperationDto operationDto : operationDtoList) {
// 作業送信フラグが存在する場合またはホットスポット更新フラグが存在する場合、needSyncFlgをtrueにセット
if (mTaskReportDao.isExistSendTaskData(operationDto.operationId) || mTaskReportDao.isExistUpdateTargetHotSpotTaskData(operationDto.operationId)) {
......
......@@ -24,21 +24,61 @@
<ImageButton
android:id="@+id/icon_filter"
style="@style/ToolBarIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/btn_view_mode"
android:onClick="onClickOperationFilterList"
android:src="@drawable/ic_filter" />
android:background="@drawable/ic_filter" />
<ImageButton
android:id="@+id/icon_operation_group_master"
style="@style/ToolBarIcon"
android:id="@+id/btn_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/icon_filter"
android:src="@drawable/ic_filter"
android:visibility="gone"/>
android:background="@drawable/ic_operation_search" />
<RadioGroup
android:id="@+id/segment_group"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/btn_search"
android:orientation="horizontal"
android:visibility="visible">
<RadioButton
android:id="@+id/operation_location_type_all"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/radio_left"
android:button="@null"
android:checked="true"
android:gravity="center"
android:onClick="onClickOperationLocationType"
android:text="全て"
android:textColor="@color/operation_default_text_color"
android:textStyle="bold" />
<RadioButton
android:id="@+id/operation_location_type_group"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/radio_right"
android:button="@null"
android:gravity="center"
android:onClick="onClickOperationLocationType"
android:text="カテゴリ"
android:textColor="@color/operation_default_text_color"
android:textStyle="bold" />
</RadioGroup>
<TextView
android:id="@+id/title"
......@@ -84,18 +124,8 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@+id/btn_search"
android:background="@drawable/ic_communication_menu" />
<ImageButton
android:id="@+id/btn_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@+id/btn_sub_menu"
android:background="@drawable/ic_operation_search"
android:contentDescription="@string/list" />
android:background="@drawable/ic_communication_menu" />
<ImageButton
android:id="@+id/btn_sub_menu"
......@@ -131,6 +161,9 @@
android:id="@+id/operation_list_layout"
style="@style/operation_list_bg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</LinearLayout>
\ No newline at end of file
......@@ -9,6 +9,7 @@ import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.DefPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.UserPrefKey;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType.OperationLocationType;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -132,7 +133,7 @@ public class ABVUIDataCache {
* 保持していた作業種別のデータをクリアする
*/
public void clearOperationGroupMaster() {
setOperationGroupMasterMode(AppDefType.OperationGroupMasterMode.NO);
setOperationGroupMasterMode(OperationLocationType.ALL);
setOperationGroupMasterId(0);
operationGroupMasterStack.clear();
}
......
......@@ -13,9 +13,9 @@ public interface AppDefType {
}
// 作業種別モードフラグ
interface OperationGroupMasterMode {
int NO = 0;
int YES = 1;
interface OperationLocationType {
int ALL = 0;
int GROUP = 1;
}
interface DefPrefKey {
......
......@@ -125,7 +125,7 @@ public abstract class HierarchyOperationListHelper<StackObject> extends Operatio
int popCount = mBreadCrumbsLayout.getChildCount() - button.level;
if (popCount > 0) {
popList(popCount);
popList(popCount, true);
}
}
......@@ -143,7 +143,7 @@ public abstract class HierarchyOperationListHelper<StackObject> extends Operatio
*
* @param popCount いくつ上の階層を表示するか指定します。
*/
abstract public void popList(int popCount);
abstract public void popList(int popCount, boolean isReload);
/**
* 一つ下の階層のリストへ移動する
......
......@@ -27,6 +27,6 @@ public class HomeOperationListHelper extends OperationListHelper {
@Override
protected List<OperationDto> findOperationList() throws Exception {
String reportTypeStr = getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
return operationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr, null);
return operationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr);
}
}
......@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.ui.home.helper;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.OperationGroupMasterDao;
......@@ -31,7 +32,8 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
if (stack.size() == 0) {
// スタックが空の場合、全体を入れる
OperationGroupMasterDto operationGroupMasterDto;
if (mAppActivity.getOperationGroupMasterId() == 0) {
// 保存されたoperationGroupmasterIdが0または、存在しない場合
if (mAppActivity.getOperationGroupMasterId() == 0 || !mOperationGroupMasterDao.isExistOperationGroupMaster(mAppActivity.getOperationGroupMasterId())) {
// 最上位階層をセット
operationGroupMasterDto = mOperationGroupMasterDao.getTopOperationGroupMaster();
if (operationGroupMasterDto != null) {
......@@ -39,7 +41,7 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
}
} else {
// 前回開いた際のIDでセット
List<OperationGroupMasterDto> operationGroupMasterDtoList = mOperationGroupMasterLogic.test(mAppActivity.getOperationGroupMasterId());
List<OperationGroupMasterDto> operationGroupMasterDtoList = mOperationGroupMasterLogic.getParentOperationGroupMasterForPath(mAppActivity.getOperationGroupMasterId());
if (CollectionUtil.isNotEmpty(operationGroupMasterDtoList)) {
for (OperationGroupMasterDto dto : operationGroupMasterDtoList) {
pushList(dto);
......@@ -55,35 +57,49 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
}
}
/**
* データの取得処理(新着更新処理完了後行われる)
* @return
* @throws Exception
*/
@Override
protected List<OperationDto> findOperationList() throws Exception {
OperationGroupMasterDto peekOperationGroupMasterDto = stack.peek();
String reportTypeStr = getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
Integer operationGroupMasterId;
// operationGroupMasterIdのデータが存在しないと
if (mOperationGroupMasterDao.isExistOperationGroupMaster(peekOperationGroupMasterDto.operationGroupMasterId)) {
Integer operationGroupMasterId = null;
// operationGroupMasterIdのデータが存在、且つクリアフラグがfalseの場合
if (mOperationGroupMasterDao.isExistOperationGroupMaster(peekOperationGroupMasterDto.operationGroupMasterId) && !ABVEnvironment.getInstance().getOperationGroupMasterClearFlg()) {
operationGroupMasterId = peekOperationGroupMasterDto.operationGroupMasterId;
} else {
// 表示する作業種別が既に削除された場合、最上位階層に戻る(リセット)
popList(breadCrumbList.size() - 1);
// 保存されたoperationGroupMasterIDを0にセット
mAppActivity.setOperationGroupMasterId(0);
//TODO 最上位階層のID取得
operationGroupMasterId = 0;
popList(breadCrumbList.size() - 1, false);
// 最上位階層のデータ取得(全体)
OperationGroupMasterDto topLevelOperationGroupMasterDto = mOperationGroupMasterDao.getTopOperationGroupMaster();
if (topLevelOperationGroupMasterDto != null) {
operationGroupMasterId = topLevelOperationGroupMasterDto.operationGroupMasterId;
// 最上位階層のoperationGroupMasterIdをセット
mAppActivity.setOperationGroupMasterId(operationGroupMasterId);
}
ABVEnvironment.getInstance().setOperationGroupMasterClearFlg(false);
// 作業種別の選択画面を閉じる
mAppActivity.closeOperationGroupMasterDialog();
}
return operationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr, operationGroupMasterId);
return mOperationGroupMasterLogic.getOperationByOperationGroupMasterId(operationGroupMasterId);
}
@Override
public void popList(int popCount) {
public void popList(int popCount, boolean isReload) {
for (int i = 0; i < popCount; i++) {
stack.pop();
// パンくずリスト削除
removeBreadCrumbs(breadCrumbList.get(breadCrumbList.size() - 1));
}
if (isReload) {
// 作業一覧画面を更新する
refreshList();
}
}
@Override
public void pushList(OperationGroupMasterDto operationGroupMasterDto) {
......@@ -121,12 +137,21 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
return groupName;
}
/**
* 親階層の情報で下の階層をリストで取得
* @return List<OperationGroupMasterDto>
*/
@Override
public List<OperationGroupMasterDto> getChildList() {
OperationGroupMasterDto peekOperationGroupMasterDto = stack.peek();
return getChildList(peekOperationGroupMasterDto.operationGroupMasterId);
}
/**
* 親階層のIDで下の階層をリストで取得
* @param operationGroupMasterId
* @return List<OperationGroupMasterDto>
*/
public List<OperationGroupMasterDto> getChildList(Integer operationGroupMasterId) {
return mOperationGroupMasterDao.getOperationGroupMasterChildList(operationGroupMasterId);
}
......
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