Commit fd257eb8 by Lee Jaebin

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

parent 815b1a49
......@@ -8,19 +8,18 @@ import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterOperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
/**
* Created by leej on 2019/06/24.
*/
public class OperationGroupMasterJSON extends AcmsCommonJSON {
public static final String OperationGroupMasterList = "operatioinGroupMasterList";
public static final String OperationGroupMasterList = "operationGroupMasterList";
public static final String OperationGroupMasterId = "operationGroupMasterId";
public static final String OperationGroupMasterName = "operationGroupMasterName";
public static final String OperationGroupMasterLevel = "operationGroupMasterLevel";
public static final String ParentOperationGroupMasterId = "parentOperationGroupMasterId";
public static final String OperationIdList = "operationIdList";
public Integer[] userGroupIds;
public ArrayList<OperationGroupMasterDto> operationGroupMasterList;
......@@ -37,23 +36,12 @@ public class OperationGroupMasterJSON extends AcmsCommonJSON {
for (int i = 0; i < operationGroupMasterJsonList.length(); i++) {
OperationGroupMasterDto dto = new OperationGroupMasterDto();
dto.operationGroupMasterOperationDtoList = new ArrayList<OperationGroupMasterOperationDto>();
JSONObject operationGroupMasterJson = operationGroupMasterJsonList.getJSONObject(i);
dto.operationGroupMasterId = getInt(operationGroupMasterJson, OperationGroupMasterId);
dto.operationGroupMasterName = getString(operationGroupMasterJson, OperationGroupMasterName);
dto.operationGroupMasterLevel = getInt(operationGroupMasterJson, OperationGroupMasterLevel);
dto.parentOperationGroupMasterId = getInt(operationGroupMasterJson, ParentOperationGroupMasterId);
if (operationGroupMasterJson.has(OperationIdList)) {
// 作業種別に紐づく作業種別ID、作業IDセット
JSONArray operationIdJsonArray = operationGroupMasterJson.getJSONArray(OperationIdList);
for (int k = 0; k < operationIdJsonArray.length(); k++) {
OperationGroupMasterOperationDto operationGroupMasterOperationDto = new OperationGroupMasterOperationDto();
operationGroupMasterOperationDto.operationGroupMasterId = dto.operationGroupMasterId;
operationGroupMasterOperationDto.operationId = operationIdJsonArray.getLong(k);
dto.operationGroupMasterOperationDtoList.add(operationGroupMasterOperationDto);
}
}
operationGroupMasterList.add(dto);
}
}
......
......@@ -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,9 @@ public class OperationListJSON extends AcmsCommonJSON {
public static final String EnableAddReport = "enableAddReport";
public static final String OperationGroupMasterIdList = "operationGroupMasterIdList";
public List<OperationDto> operationList;
public OperationListJSON(String jsonString) throws AcmsException {
......@@ -73,6 +77,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);
......@@ -100,7 +106,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 +117,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 +160,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);
}
}
......
......@@ -6,8 +6,7 @@ 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.OperationGroupMasterDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterOperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
/**
* Created by leej on 2019/06/26.
......@@ -22,8 +21,8 @@ public class OperationGroupMasterOperationDao extends AbstractDao {
}
@Override
protected OperationGroupMasterOperationDto convert(Cursor cursor) {
OperationGroupMasterOperationDto dto = new OperationGroupMasterOperationDto();
protected OperationGroupMasterRelationDto convert(Cursor cursor) {
OperationGroupMasterRelationDto dto = new OperationGroupMasterRelationDto();
int column = cursor.getColumnIndex("operation_group_master_id");
if (column != -1) {
......@@ -48,7 +47,7 @@ public class OperationGroupMasterOperationDao extends AbstractDao {
* 作業種別と作業のリレーションテーブルのDB登録処理
* @param dto
*/
public boolean insertOperationGroupMasterOperation(OperationGroupMasterOperationDto dto) {
public boolean insertOperationGroupMasterOperation(OperationGroupMasterRelationDto dto) {
StringBuffer sql = new StringBuffer();
......@@ -81,10 +80,10 @@ public class OperationGroupMasterOperationDao extends AbstractDao {
/**
* 作業種別IDで関連する作業のIDを取得
* @param operationGroupMasterId
* @param operationId
* @return
*/
public List<Long> getOperationIds(Integer operationGroupMasterId) {
return rawQueryGetLongList("select operation_id from r_operation_group_master_relation where operation_group_master_id=?", new String[]{""+ operationGroupMasterId});
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
......@@ -32,6 +32,8 @@ public class OperationDto extends AbstractDto {
public int enableReportEdit; // 作業編集可能区分
public int enableAddReport; // 作業追加区分
public List<OperationGroupMasterRelationDto> operationGroupMasterRelationDtoList; // 作業種別に紐づく作業Dto
// 作業担当グループリスト
public List<TaskWorkerGroupDto> taskWorkerGroupDtoList;
......
......@@ -12,7 +12,6 @@ public class OperationGroupMasterDto extends AbstractDto {
public int parentOperationGroupMasterId; // 作業種別の親階層ID
public int operationGroupMasterLevel; // 作業種別の階層レベル
public int operationCount = 0; // 作業種別に紐づく作業数
public List<OperationGroupMasterOperationDto> operationGroupMasterOperationDtoList; // 作業種別に紐づく作業Dto
public OperationGroupMasterDto() {
}
......
......@@ -4,7 +4,7 @@ package jp.agentec.abook.abv.bl.dto;
* Created by leej on 2019/06/25.
*/
public class OperationGroupMasterOperationDto extends AbstractDto {
public class OperationGroupMasterRelationDto extends AbstractDto {
// 作業種別ID
public Integer operationGroupMasterId;
// 作業ID
......
......@@ -2,8 +2,6 @@ package jp.agentec.abook.abv.bl.logic;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -14,11 +12,9 @@ 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;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterOperationDto;
import jp.agentec.abook.abv.bl.dto.OperationGroupMasterRelationDto;
import jp.agentec.abook.abv.bl.dto.comparator.OperationGroupMasterLevelComparator;
/**
......@@ -30,8 +26,6 @@ public class OperationGroupMasterLogic extends AbstractLogic {
private OperationGroupMasterDao mOperationGroupMasterDao = AbstractDao.getDao(OperationGroupMasterDao.class);
private OperationGroupMasterOperationDao mOperationGroupMasterOperationDao = AbstractDao.getDao(OperationGroupMasterOperationDao.class);
/**
* 作業種別・作業種別に紐づいた作業IDを取得して
* DBに登録する
......@@ -52,30 +46,7 @@ public class OperationGroupMasterLogic extends AbstractLogic {
if (serverOperationGroupMasterDto.operationGroupMasterId == localOperationGroupMasterDto.operationGroupMasterId) {
// DB更新処理
// ローカルにある作業情報に紐づく全作業IDを取得
List<Long> localOperationGroupMasterOperationIds = mOperationGroupMasterOperationDao.getOperationIds(serverOperationGroupMasterDto.operationGroupMasterId);
for (OperationGroupMasterOperationDto operationGroupMasterOperationDto : serverOperationGroupMasterDto.operationGroupMasterOperationDtoList) {
if (localOperationGroupMasterOperationIds == null || localOperationGroupMasterOperationIds.size() == 0) {
// 作業IDが存在しなければ、登録する
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterOperationDto);
} else {
// ローカル(DB)に作業IDが存在するかチェックして更新・登録を判定
int localOperationContentIndex = localOperationGroupMasterOperationIds.indexOf(operationGroupMasterOperationDto.operationId);
if (localOperationContentIndex >= 0) {
// 作業IDが存在するので更新
localOperationGroupMasterOperationIds.remove(localOperationContentIndex);
} else {
// 作業IDが存在しないので登録
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterOperationDto);
}
}
}
if (localOperationGroupMasterOperationIds != null) {
// ローカルとサーバーの差分は削除と見做し、削除処理を行う。
for (Long deleteOperationId : localOperationGroupMasterOperationIds) {
mOperationGroupMasterOperationDao.deleteOperationGroupMasterOperation(localOperationGroupMasterDto.operationGroupMasterId, deleteOperationId);
}
}
Logger.d(TAG, "[UPDATE] OperationGroupMaster operationGroupMasterId=" + serverOperationGroupMasterDto.operationGroupMasterId + " operationGroupMasterName=" + serverOperationGroupMasterDto.operationGroupMasterName);
mOperationGroupMasterDao.updateOperationGroupMaster(serverOperationGroupMasterDto);
// 更新処理が終わったら登録フラグをfalseにしてlocalOperationGroupMasterDtosから除外する
......@@ -90,9 +61,6 @@ public class OperationGroupMasterLogic extends AbstractLogic {
Logger.d(TAG, "[INSERT] OperationGroupMaster operationGroupMasterId=" + serverOperationGroupMasterDto.operationGroupMasterId + " operationGroupMasterName=" + serverOperationGroupMasterDto.operationGroupMasterName);
// DB登録処理
mOperationGroupMasterDao.insertOperationGroupMaster(serverOperationGroupMasterDto);
for (OperationGroupMasterOperationDto operationGroupMasterOperationDto : serverOperationGroupMasterDto.operationGroupMasterOperationDtoList) {
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterOperationDto);
}
}
}
......
......@@ -38,6 +38,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;
......@@ -49,6 +50,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;
......@@ -76,6 +78,7 @@ 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);
......@@ -93,10 +96,10 @@ public class OperationLogic extends AbstractLogic {
public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
// 作業グループリスト取得
setWorkingGroupList();
// 作業一覧取得し、登録・更新・削除する
retrieveServerOperation();
// 作業種別・作業種別に紐づいた作業IDを取得
mOperationGroupMasterLogic.setOperationGroupMaster();
// 作業一覧取得し、登録・更新・削除する
retrieveServerOperation();
}
/**
......@@ -145,6 +148,31 @@ public class OperationLogic extends AbstractLogic {
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;
......@@ -172,6 +200,11 @@ public class OperationLogic extends AbstractLogic {
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
mOperationContentDao.insertOperationContent(operationContentDto);
}
// 作業種別・作業のリレーションテーブルにデータ登録
for (OperationGroupMasterRelationDto operationGroupMasterRelationDto : serverOperationDto.operationGroupMasterRelationDtoList) {
mOperationGroupMasterOperationDao.insertOperationGroupMasterOperation(operationGroupMasterRelationDto);
}
}
// 作業担当グループ登録
......
......@@ -401,9 +401,9 @@ public class OperationListActivity extends ABVUIActivity {
// アイコンの変更
//TODO アイコンを変更(仮アイコン)
if (getABVUIDataCache().getOperationGroupMasterMode() == AppDefType.OperationGroupMasterMode.YES) {
mOperationGroupMasterButton.setImageDrawable(getRDrawable(R.drawable.ic_filter_selected));
mOperationGroupMasterButton.setImageDrawable(getRDrawable(R.drawable.ic_group_operation));
} else {
mOperationGroupMasterButton.setImageDrawable(getRDrawable(R.drawable.ic_filter));
mOperationGroupMasterButton.setImageDrawable(getRDrawable(R.drawable.ic_normal_operation));
}
} else {
// アイコン非表示
......@@ -1995,8 +1995,9 @@ public class OperationListActivity extends ABVUIActivity {
// 直下の作業種別リスト情報を取得
final List<OperationGroupMasterDto> operationGroupMasterDtoList = helper.getChildList();
dialog.setTitle(helper.getPeekName(), R.drawable.ic_title_group);
dialog.setTitle(helper.getPeekName(), R.drawable.ic_title_group_operation);
//TODO 多言語化
dialog.setLeftItemOnClickListener("解除", new View.OnClickListener() {
@Override
public void onClick(View v) {
......
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