Commit 815b1a49 by Lee Jaebin

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

parent 1e37ede3
package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.SearchDivisionType;
......@@ -9,6 +10,8 @@ import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.NumericUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -152,17 +155,45 @@ public class OperationGroupMasterDao extends AbstractDao {
}
/**
* 階層の作業種別情報取得
* 階層の作業種別情報取得(検索結果を元にデータ取得)
* @param searchOperationName
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @param level
* @return
*/
public List<OperationGroupMasterDto> getOperationGroupMasterListBylevel(Integer level) {
public List<OperationGroupMasterDto> getOperationGroupMasterListBylevel(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr, Integer level) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT M1.*, count(R1.operation_id) AS operation_count FROM m_operation_group_master AS M1");
sql.append(" LEFT OUTER JOIN r_operation_group_master_relation R1");
sql.append(" ON R1.operation_group_master_id = M1.operation_group_master_id");
sql.append(" AND R1.operation_id IN(");
sql.append(" SELECT operation_id FROM t_operation top");
sql.append(" WHERE top.operation_id IS NOT NULL");
if (!StringUtil.isNullOrEmpty(searchOperationName)) {
sql.append(" AND top.operation_name GLOB " + "'*" + searchOperationName + "*'");
}
if (!StringUtil.isNullOrEmpty(searchStartDateStr)) {
Date startDate = DateTimeUtil.toDate(searchStartDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen);
sql.append(" AND top.operation_end_date >= '" + DateTimeUtil.toString(startDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
}
if (!StringUtil.isNullOrEmpty(searchEndDateStr)) {
Date endDate = DateTimeUtil.toDate(searchEndDateStr, "UTC", DateTimeFormat.yyyyMMdd_hyphen);
sql.append(" AND top.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
}
if (reportTypeStr != null) {
sql.append(" AND top.report_type in ("+ reportTypeStr +")");
}
sql.append(" )");
sql.append(" WHERE M1.operation_group_master_level =? ");
sql.append(" GROUP BY M1.operation_group_master_id");
Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDtoList(sql.toString(), new String[]{""+ level}, OperationGroupMasterDto.class);
}
......
......@@ -14,6 +14,7 @@ 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.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.data.dao.OperationGroupMasterOperationDao;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
......@@ -116,12 +117,16 @@ public class OperationGroupMasterLogic extends AbstractLogic {
/**
* 作業種別毎に作業数(子グループの作業も含む)を
* operationCountMapにセットする
* @param searchOperationName
* @param searchStartDateStr
* @param searchEndDateStr
* @param reportTypeStr
* @param level
* @param operationCountMap
*/
public void getAllOperationCount(int level, Map<Integer, Integer> operationCountMap) {
public void getAllOperationCount(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr, int level, Map<Integer, Integer> operationCountMap) {
List<OperationGroupMasterDto> operationGroupMasterDtoList;
operationGroupMasterDtoList = mOperationGroupMasterDao.getOperationGroupMasterListBylevel(level);
operationGroupMasterDtoList = mOperationGroupMasterDao.getOperationGroupMasterListBylevel(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr, level);
// ルート階層の場合は以下の処理しない
if (level > 0 && operationGroupMasterDtoList != null) {
......@@ -144,7 +149,7 @@ public class OperationGroupMasterLogic extends AbstractLogic {
}
}
level--;
getAllOperationCount(level, operationCountMap); // 再帰呼び出し
getAllOperationCount(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr, level, operationCountMap); // 再帰呼び出し
}
}
......
......@@ -10,6 +10,15 @@
android:id="@+id/toolbar"
style="@style/DialogToolBarHolo">
<Button
android:id="@+id/popup_left_title"
style="@style/ButtonABookLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:visibility="gone" />
<TextView
android:id="@+id/popup_title"
style="@style/DialogToolBarTitle"
......@@ -48,24 +57,24 @@
</LinearLayout>
<LinearLayout
android:id="@+id/left_item"
android:id="@+id/header_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_layout"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingBottom="8dp"
android:visibility="gone" ><!-- ツールバー背景イメージの影の高さがあるため、8dpほどpaddingを入れる -->
android:paddingLeft="10dp"
android:visibility="gone"><!-- ツールバー背景イメージの影の高さがあるため、8dpほどpaddingを入れる -->
<TextView
android:id="@+id/header_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/blue_arrow_up"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/dummy_str"
android:textColor="@color/text_select"
android:textSize="@dimen/app_normal_text_size"
android:maxLines="1" />
android:textSize="@dimen/app_normal_text_size" />
</LinearLayout>
<View
......
......@@ -103,7 +103,7 @@ public class ABVListDialog extends Dialog {
getListView().setOnItemLongClickListener(listener);
}
public void setLeftItemOnClickListener(String itemName, View.OnClickListener l) {
public void setHeaderItemOnClickListener(String itemName, View.OnClickListener l) {
// Button itemButton = (Button) mRoot.findViewById(R.id.popup_title_left);
// if (itemButton != null) {
// itemButton.setVisibility(View.VISIBLE);
......@@ -111,7 +111,7 @@ public class ABVListDialog extends Dialog {
// itemButton.setOnClickListener(l);
// } else {
// 携帯の場合
LinearLayout linearLayout = (LinearLayout) mRoot.findViewById(R.id.left_item);
LinearLayout linearLayout = (LinearLayout) mRoot.findViewById(R.id.header_item);
linearLayout.setOnClickListener(l);
linearLayout.setVisibility(View.VISIBLE);
TextView textView = (TextView) mRoot.findViewById(R.id.header_title);
......@@ -119,6 +119,21 @@ public class ABVListDialog extends Dialog {
textView.setText(String.format(suffixText, itemName));
// }
}
/**
* 左側の要素イベント
* @param itemName
* @param l
*/
public void setLeftItemOnClickListener(String itemName, View.OnClickListener l) {
Button itemButton = (Button) mRoot.findViewById(R.id.popup_left_title);
if (itemButton != null) {
itemButton.setText(itemName);
itemButton.setVisibility(View.VISIBLE);
itemButton.setOnClickListener(l);
}
}
public void setRightItemOnClickListener(int resId, View.OnClickListener l) {
ImageButton itemButton = (ImageButton) mRoot.findViewById(R.id.popup_right_image);
if (itemButton != null) {
......
......@@ -133,8 +133,6 @@ public class OperationListActivity extends ABVUIActivity {
private ImageButton mCommunicationButton;
private ImageButton mCommonContentButton;
private List<OperationDto> mOperationList;
public String mSearchWord;
public String mStartDateStr;
public String mEndDateStr;
......@@ -254,19 +252,13 @@ public class OperationListActivity extends ABVUIActivity {
mOperationGroupMasterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// インジケーター表示
showProgressPopup();
if (getABVUIDataCache().getOperationGroupMasterMode() == AppDefType.OperationGroupMasterMode.NO) {
getABVUIDataCache().setOperationGroupMasterMode(AppDefType.OperationGroupMasterMode.YES);
} else {
getABVUIDataCache().setOperationGroupMasterMode(AppDefType.OperationGroupMasterMode.NO);
}
getABVUIDataCache().setOperationGroupMasterMode(AppDefType.OperationGroupMasterMode.YES);
mListHelper = getListHelper();
setOperationListView();
//作業種別モードの場合は、作業種別選択ダイアログ画面を表示
if (getABVUIDataCache().getOperationGroupMasterMode() == AppDefType.OperationGroupMasterMode.YES) {
showOperationGroupMasterDialog(true, false);
}
showOperationGroupMasterDialog(true, false);
}
});
......@@ -373,6 +365,9 @@ public class OperationListActivity extends ABVUIActivity {
private void configurationToolbarIcon() {
// ツールバーの検索結果レイアウトの表示・非表示
checkShowSearchResult();
List<PushMessageDto> pushMessageDtoList = mPushMessageLogic.getAllPushMessageList();
boolean existUnreadFlg = false;
......@@ -1985,7 +1980,8 @@ public class OperationListActivity extends ABVUIActivity {
Integer lastLevel = mOperationGroupMasterLogic.getLastGroupLevel();
operationCountMap = new HashMap<Integer, Integer>();
// 作業種別毎に作業数をMapにセット
mOperationGroupMasterLogic.getAllOperationCount(lastLevel, operationCountMap);
String reportTypeStr = getUserPref(AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
mOperationGroupMasterLogic.getAllOperationCount(mSearchWord, mStartDateStr, mEndDateStr, reportTypeStr, lastLevel, operationCountMap);
}
// 既にダイアログが存在するか、開いた状態である場合は何もしない
if (mShowDialog != null && mShowDialog.isShowing()) {
......@@ -2001,6 +1997,16 @@ public class OperationListActivity extends ABVUIActivity {
dialog.setTitle(helper.getPeekName(), R.drawable.ic_title_group);
dialog.setLeftItemOnClickListener("解除", new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
getABVUIDataCache().setOperationGroupMasterMode(AppDefType.OperationGroupMasterMode.NO);
setOperationListView();
}
});
// autoCloseがtrueの場合、下位階層が存在しなければreturnで以下の処理は行わない
if (autoClose && operationGroupMasterDtoList.size() < 1) {
return;
......@@ -2025,7 +2031,7 @@ public class OperationListActivity extends ABVUIActivity {
if (helper.getStackSize() > 1) {
dialog.setListViewAdapter(adapter);
String backToName = helper.getPrePeekName();
dialog.setLeftItemOnClickListener(backToName, new View.OnClickListener() {
dialog.setHeaderItemOnClickListener(backToName, new View.OnClickListener() {
@Override
public void onClick(View v) {
OperationGroupMasterListHelper helper = (OperationGroupMasterListHelper) mListHelper;
......
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