Commit 3493050a by Lee Jaebin

#32825 作業一覧画面改善

parent fcc8f297
...@@ -62,6 +62,15 @@ public class OperationContentDao extends AbstractDao { ...@@ -62,6 +62,15 @@ public class OperationContentDao extends AbstractDao {
return rawQueryGetLongList("select content_id from r_operation_content where operation_id=?", new String[]{""+ operationId}); return rawQueryGetLongList("select content_id from r_operation_content where operation_id=?", new String[]{""+ operationId});
} }
/**
* 資料IDに紐づいた作業が存在しないと資料を削除する判定
* @param contentId
* @return
*/
public boolean isDeleteContent (Long contentId) {
return rawQueryGetInt("select COUNT(*) from r_operation_content where content_id=?", new String[]{"" + contentId }) == 0;
}
public boolean insertOperationContent(OperationContentDto dto) { public boolean insertOperationContent(OperationContentDto dto) {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
......
...@@ -211,13 +211,13 @@ public class OperationDao extends AbstractDao { ...@@ -211,13 +211,13 @@ public class OperationDao extends AbstractDao {
public void deleteAll() { public void deleteAll() {
delete("t_push_message", null, null); delete("t_push_message", null, null);
delete("r_operation_content", null, null); delete("r_operation_content", null, null);
delete("r_task_worker_group", null, null);
delete("t_operation", null, null); delete("t_operation", null, null);
delete("t_task", null, null); delete("t_task", null, null);
delete("t_task_report", null, null); delete("t_task_report", null, null);
delete("t_task_report_send", null, null); delete("t_task_report_send", null, null);
delete("t_task_report_items", null, null); delete("t_task_report_items", null, null);
delete("m_worker_group", null, null); delete("m_worker_group", null, null);
delete("r_task_worker_group", null, null);
} }
public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) { public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
......
...@@ -247,6 +247,14 @@ public class TaskReportDao extends AbstractDao { ...@@ -247,6 +247,14 @@ public class TaskReportDao extends AbstractDao {
} }
/** /**
* テーブル物理削除
* @param dto
*/
public void delete(TaskReportDto dto) {
delete("t_task_report", "task_key=? and task_report_level=?", new String[] { dto.taskKey, "" + dto.taskReportLevel });
}
/**
* テーブル物理削除(定期点検専用) * テーブル物理削除(定期点検専用)
* @param dto * @param dto
*/ */
......
...@@ -77,6 +77,8 @@ public class OperationLogic extends AbstractLogic { ...@@ -77,6 +77,8 @@ public class OperationLogic extends AbstractLogic {
private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class); private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class);
private TaskReportItemsDao mTaskReportItemsDao = AbstractDao.getDao(TaskReportItemsDao.class); private TaskReportItemsDao mTaskReportItemsDao = AbstractDao.getDao(TaskReportItemsDao.class);
private ContentLogic mContentLogic = AbstractLogic.getLogic(ContentLogic.class);
private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class); private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class);
private TaskWorkerGroupDao mTaskWorkerGroupDao = AbstractDao.getDao(TaskWorkerGroupDao.class); private TaskWorkerGroupDao mTaskWorkerGroupDao = AbstractDao.getDao(TaskWorkerGroupDao.class);
...@@ -196,12 +198,21 @@ public class OperationLogic extends AbstractLogic { ...@@ -196,12 +198,21 @@ public class OperationLogic extends AbstractLogic {
// サーバーから取得したプロジェクト情報がローカルに存在しないので削除する // サーバーから取得したプロジェクト情報がローカルに存在しないので削除する
for (OperationDto deleteOperationDto : deleteListDtoArray) { for (OperationDto deleteOperationDto : deleteListDtoArray) {
List<TaskDto> taskDtoList = mTaskDao.selectAllTaskByOperationId(deleteOperationDto.operationId); List<TaskDto> taskDtoList = mTaskDao.selectAllTaskByOperationId(deleteOperationDto.operationId);
List<Long> contentIds = mOperationContentDao.getContentIds(deleteOperationDto.operationId);
for(TaskDto taskDto : taskDtoList) { for(TaskDto taskDto : taskDtoList) {
mTaskDao.delete(taskDto); mTaskDao.delete(taskDto);
} }
mPushMessageDao.delete(deleteOperationDto.operationId); mPushMessageDao.delete(deleteOperationDto.operationId);
mOperationDao.delete(deleteOperationDto); mOperationDao.delete(deleteOperationDto);
// 作業削除時、紐づいた資料を削除
for (Long contentId : contentIds) {
if (mOperationContentDao.isDeleteContent(contentId)) {
ContentDto contentDto = mContentDao.getContent(contentId);
mContentLogic.deleteContent(contentDto, true);
}
}
String operationTaskDirPath = ABVEnvironment.getInstance().getOperationDirFile(deleteOperationDto.operationId); String operationTaskDirPath = ABVEnvironment.getInstance().getOperationDirFile(deleteOperationDto.operationId);
FileUtil.delete(operationTaskDirPath); FileUtil.delete(operationTaskDirPath);
} }
...@@ -394,7 +405,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -394,7 +405,7 @@ public class OperationLogic extends AbstractLogic {
} }
/** /**
* 作業指示の削除 * 作業報告の削除
* *
* @param operationId * @param operationId
* @param contentId * @param contentId
...@@ -428,37 +439,43 @@ public class OperationLogic extends AbstractLogic { ...@@ -428,37 +439,43 @@ public class OperationLogic extends AbstractLogic {
* @param dataSendFlg * @param dataSendFlg
* @throws IOException * @throws IOException
*/ */
public void insertTaskReportReply(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void insertTaskReportReply(String taskKey, long operationId, long contentId, int enableReport, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) { if (taskDto == null) {
//TODO error //TODO error
return; return;
} }
TaskReportDto taskReportDto = new TaskReportDto(); TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskJson = taskReportJson.getJSONObject("task"); // taskReportJsonがnullではない場合のみ以下の処理を行う
if (taskReportJson != null) {
JSONObject taskJson = taskReportJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys(); Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) { while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto(); TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next(); String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_3_")) { if (itemKey.startsWith("q_3_")) {
taskDto.taskStatus = taskJson.getInt(itemKey); taskDto.taskStatus = taskJson.getInt(itemKey);
} }
taskReportItemsDto.taskKey = taskKey; taskReportItemsDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey; taskReportItemsDto.itemKey = itemKey;
try { try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey); taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) { } catch (JSONException e) {
// 値がStringではない場合、無視する // 値がStringではない場合、無視する
continue; continue;
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
} }
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto); taskReportDto.jsonData = taskReportJson.toString();
} else {
taskReportDto.jsonData = "";
} }
taskReportDto.taskKey = taskKey; taskReportDto.taskKey = taskKey;
taskReportDto.jsonData = taskReportJson.toString();
taskReportDto.dataSendFlg = dataSendFlg; taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag; taskReportDto.attachedFileSendFlg = attachedChangeFlag;
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportReplyType; taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportReplyType;
taskReportDto.enableReport = enableReport;
// 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする // 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey, Constant.TaskReportLevel.ReportReplyType); List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey, Constant.TaskReportLevel.ReportReplyType);
...@@ -470,21 +487,21 @@ public class OperationLogic extends AbstractLogic { ...@@ -470,21 +487,21 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.update(taskDto); mTaskDao.update(taskDto);
//添付ファイル変更の場合、以下の処理を行う if (taskReportJson != null) {
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey); //添付ファイル変更の場合、以下の処理を行う
// #32926 作業報告画面改善 start String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType); String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType);
// #32926 作業報告画面改善 end
JSONObject attachedListJson = taskReportJson.getJSONObject("attached"); JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson); List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除 // コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames); deleteDifferentialFile(tempDirPath, attachedFileNames);
// 添付ディレクトリの移動 // 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true); boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if(result) { if (result) {
FileUtil.delete(tempDirPath); FileUtil.delete(tempDirPath);
}
} }
} }
...@@ -540,12 +557,12 @@ public class OperationLogic extends AbstractLogic { ...@@ -540,12 +557,12 @@ public class OperationLogic extends AbstractLogic {
} }
} }
public void updateTaskReportReplyLevel(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void updateTaskReportReply(String taskKey, long operationId, long contentId, int enableReport, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportReplyType); TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportReplyType);
if (taskReportDto == null) { if (taskReportDto == null) {
Logger.w(TAG, "taskReportDto is null"); Logger.w(TAG, "taskReportDto is null");
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
insertTaskReportReply(taskKey, operationId, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg); insertTaskReportReply(taskKey, operationId, contentId, enableReport, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg);
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
return; return;
} }
...@@ -576,6 +593,11 @@ public class OperationLogic extends AbstractLogic { ...@@ -576,6 +593,11 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.attachedFileSendFlg = attachedChangeFlag; taskReportDto.attachedFileSendFlg = attachedChangeFlag;
} }
// 作業報告階層
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportReplyType;
// 報告可能区分
taskReportDto.enableReport = enableReport;
mTaskReportDao.update(taskReportDto); mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto); mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey); String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
...@@ -792,11 +814,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -792,11 +814,7 @@ public class OperationLogic extends AbstractLogic {
} }
// 作業報告のディレクトリ削除 // 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey)); deleteTaskReportReplyFileData(operationId, contentId, taskKey);
// #32926 作業報告画面改善 start
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType));
// #32926 作業報告画面改善 end
} }
/** /**
...@@ -973,30 +991,31 @@ public class OperationLogic extends AbstractLogic { ...@@ -973,30 +991,31 @@ public class OperationLogic extends AbstractLogic {
* @param contentPath * @param contentPath
* @throws IOException * @throws IOException
*/ */
// #32926 作業報告画面改善 start
// 現在作業タイプを確認用のparameter追加 // 現在作業タイプを確認用のparameter追加
private void createWorkerGroupJson(Long operationId, String contentPath) throws IOException { private void createWorkerGroupJson(Long operationId, String contentPath) throws IOException {
// #32926 作業報告画面改善 end
int level = 0; int level = 0;
int listCount = 0; int listCount = 0;
List<JSONObject> workerGroupJsonList = new ArrayList<JSONObject>(); List<JSONObject> workerGroupJsonList = new ArrayList<JSONObject>();
JSONObject taskGroupJson = new JSONObject(); JSONObject taskGroupJson = new JSONObject();
List<TaskWorkerGroupDto> taskWorkerGroupDtoList = mTaskWorkerGroupDao.getTaskWorkerGroupByOperationId(operationId); List<TaskWorkerGroupDto> taskWorkerGroupDtoList = mTaskWorkerGroupDao.getTaskWorkerGroupByOperationId(operationId);
// 報告と報告(回答)のデータの区分が必要なので、「taskGroup_0」と「taskGroup_1」で形式で作成 // 報告と報告(回答)のデータの区分が必要なので、「taskGroup_0」と「taskGroup_1」で形式で作成
for (TaskWorkerGroupDto dto : taskWorkerGroupDtoList) { for (TaskWorkerGroupDto dto : taskWorkerGroupDtoList) {
listCount++; listCount++; // 最後のインデックスの判定のため
JSONObject workerGroupJson = new JSONObject(); if (level != dto.taskReportLevel) {
if (level == dto.taskReportLevel) { taskGroupJson.put(String.format("taskReport_%s", String.valueOf(level)), workerGroupJsonList);
workerGroupJson.put(ABookKeys.GROUP_ID, dto.groupId); workerGroupJsonList = new ArrayList<JSONObject>();
workerGroupJson.put(ABookKeys.GROUP_NAME, dto.groupName);
workerGroupJsonList.add(workerGroupJson);
} else {
level++; level++;
} }
if (level != dto.taskReportLevel || taskWorkerGroupDtoList.size() == listCount) { JSONObject workerGroupJson = new JSONObject();
taskGroupJson.put(String.format("taskGroup_%s", String.valueOf(dto.taskReportLevel)), workerGroupJsonList); workerGroupJson.put(ABookKeys.GROUP_ID, dto.groupId);
workerGroupJsonList = new ArrayList<JSONObject>(); workerGroupJson.put(ABookKeys.GROUP_NAME, dto.groupName);
workerGroupJsonList.add(workerGroupJson);
// 最後の時、taskReport_{level}でセット
if (listCount == taskWorkerGroupDtoList.size()) {
taskGroupJson.put(String.format("taskGroup_%s", String.valueOf(level)), workerGroupJsonList);
} }
} }
...@@ -1053,14 +1072,17 @@ public class OperationLogic extends AbstractLogic { ...@@ -1053,14 +1072,17 @@ public class OperationLogic extends AbstractLogic {
if(dto.jsonData != null && dto.jsonData.length() > 0) { if(dto.jsonData != null && dto.jsonData.length() > 0) {
taskReportJsonList.add(new JSONObject(dto.jsonData).put(ABookKeys.HAS_AUTHORITY, dto.enableReport)); taskReportJsonList.add(new JSONObject(dto.jsonData).put(ABookKeys.HAS_AUTHORITY, dto.enableReport));
} else {
JSONObject emptyTaskReportJson = new JSONObject();
emptyTaskReportJson.put(ABookKeys.TASK_KEY, dto.taskKey);
emptyTaskReportJson.put(ABookKeys.HAS_AUTHORITY, dto.enableReport);
taskReportJsonList.add(emptyTaskReportJson);
} }
// 最後の時、taskReport_{level}でセット // 最後の時、taskReport_{level}でセット
if (listCount == taskReportDtoList.size()) { if (listCount == taskReportDtoList.size()) {
taskReportJson.put(String.format("taskReport_%s", String.valueOf(level)), taskReportJsonList); taskReportJson.put(String.format("taskReport_%s", String.valueOf(level)), taskReportJsonList);
} }
level = dto.taskReportLevel;
} }
// データが存在しない場合、 // データが存在しない場合、
...@@ -1397,8 +1419,19 @@ public class OperationLogic extends AbstractLogic { ...@@ -1397,8 +1419,19 @@ public class OperationLogic extends AbstractLogic {
* @param taskKey * @param taskKey
*/ */
public void deleteTaskFileData(long operationId, long contentId, String taskKey) { public void deleteTaskFileData(long operationId, long contentId, String taskKey) {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskDirFilePath(operationId, taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskDirFilePath(operationId, taskKey));
}
/**
* 作業報告(回答)関連ディレクトリ削除
* @param operationId
* @param contentId
* @param taskKey
*/
public void deleteTaskReportReplyFileData(long operationId, long contentId, String taskKey) {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType));
} }
/** /**
......
...@@ -77,7 +77,6 @@ import jp.agentec.abook.abv.bl.download.ContentFileExtractor; ...@@ -77,7 +77,6 @@ import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification; import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContentDto; import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.FixPushMessageDto; import jp.agentec.abook.abv.bl.dto.FixPushMessageDto;
import jp.agentec.abook.abv.bl.dto.RoutineTaskReportDto;
import jp.agentec.abook.abv.bl.dto.OperationContentDto; import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto; import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto; import jp.agentec.abook.abv.bl.dto.PushMessageDto;
...@@ -825,6 +824,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -825,6 +824,7 @@ public class OperationListActivity extends ABVUIActivity {
OperationDto operationDto = mOperationLogic.getOperation(operationId); OperationDto operationDto = mOperationLogic.getOperation(operationId);
OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId); OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId);
List<TaskDto> localTaskList = mTaskDao.selectAllTaskByOperationId(operationId); List<TaskDto> localTaskList = mTaskDao.selectAllTaskByOperationId(operationId);
Date lastEditDate; Date lastEditDate;
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param); OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
...@@ -835,26 +835,35 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -835,26 +835,35 @@ public class OperationListActivity extends ABVUIActivity {
progress = 40 / json.taskDtoList.size(); progress = 40 / json.taskDtoList.size();
} }
boolean isRoutineTask = operationDto.reportType == Constant.ReportType.Routine;
JSONObject taskReportJson; JSONObject taskReportJson;
for (TaskDto serverTaskDto : json.taskDtoList) { for (TaskDto serverTaskDto : json.taskDtoList) {
if (operationDto.reportType == Constant.ReportType.Routine) {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
mTaskDao.update(serverTaskDto);
} else {
mTaskDao.insert(serverTaskDto);
}
List<TaskReportDto> localTaskReportList = mTaskReportDao.getNotNullStartDateTaskReportByTaskKey(serverTaskDto.taskKey);
List<TaskReportDto> localRemove = new ArrayList(); List<TaskReportDto> localRemove = new ArrayList();
// 先にローカルにしか存在しない事を削除 : DB, files List<TaskReportDto> localTaskReportList = mTaskReportDao.getTaskReportListByTaskKey(serverTaskDto.taskKey);
for (TaskReportDto localTaskReportDto : localTaskReportList) { for (TaskReportDto localTaskReportDto : localTaskReportList) {
if (!isExistsRoutinTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto)) { if (!isExistsTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto, isRoutineTask)) {
mOperationLogic.deleteRoutineTaskReport(operationId, operationContentDto.contentId, localTaskReportDto); if (isRoutineTask) {
localRemove.add(localTaskReportDto); mOperationLogic.deleteRoutineTaskReport(operationId, operationContentDto.contentId, localTaskReportDto);
} else {
// taskDtoが存在するとtaskReportLevel 0 (作業報告)が存在しないことはないので、報告(回答)のみチェックして削除
if (localTaskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportReplyType) {
// 作業報告のディレクトリ削除
mOperationLogic.deleteTaskReportReplyFileData(operationId, operationContentDto.contentId, serverTaskDto.taskKey);
mTaskReportDao.delete(localTaskReportDto);
}
}
localTaskReportList.remove(localTaskReportDto);
} }
} }
localTaskReportList.removeAll(localRemove); if (operationDto.reportType == Constant.ReportType.Routine) {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
mTaskDao.update(serverTaskDto);
} else {
mTaskDao.insert(serverTaskDto);
}
// サーバーからの情報で更新 // サーバーからの情報で更新
for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) { for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
...@@ -866,7 +875,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -866,7 +875,7 @@ public class OperationListActivity extends ABVUIActivity {
if (isSyncGetTaskFileError) { if (isSyncGetTaskFileError) {
return null; return null;
} }
if (isExistsRoutinTaskReportInList(localTaskReportList, taskReportDto)) { if (isExistsTaskReportInList(localTaskReportList, taskReportDto, true)) {
// 報告データが存在すると作業報告を更新する // 報告データが存在すると作業報告を更新する
if (taskReportDto.jsonData != null) { if (taskReportDto.jsonData != null) {
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false, false, false); mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false, false, false);
...@@ -900,10 +909,15 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -900,10 +909,15 @@ public class OperationListActivity extends ABVUIActivity {
taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false); taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
} else { } else {
// 作業報告(回答) // 作業報告(回答)
if (taskReportDto.jsonData != null) { if (taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReportReplyLevel(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId, // データの更新
mOperationLogic.updateTaskReportReply(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false); new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
} } else {
// jsonDataがない場合
mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
null, attachedFileName, false, false);
}
} }
// 更新済みの場合、localTaskListから削除 // 更新済みの場合、localTaskListから削除
localTaskList.remove(serverTaskDto); localTaskList.remove(serverTaskDto);
...@@ -928,8 +942,12 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -928,8 +942,12 @@ public class OperationListActivity extends ABVUIActivity {
taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false); taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
} else { } else {
if (taskReportDto.jsonData != null) { if (taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false); new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
} else {
// jsonDataがない場合
mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
null, attachedFileName, false, false);
} }
} }
} }
...@@ -1549,17 +1567,26 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1549,17 +1567,26 @@ public class OperationListActivity extends ABVUIActivity {
} }
/** /**
* 定期点検の報告存在チェック * 報告存在チェック
* @param listDto * @param listDto
* @param rDto * @param rDto
* @return * @return
*/ */
private boolean isExistsRoutinTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto) { private boolean isExistsTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto, boolean isRoutineTask) {
for (TaskReportDto lDto : listDto) { for (TaskReportDto lDto : listDto) {
if (lDto.taskKey.equals(rDto.taskKey) && if (isRoutineTask) {
lDto.taskReportId == rDto.taskReportId && // 定期点検の場合、taskKey,taskReportId,reportStartDateで判定
lDto.reportStartDate.equals(rDto.reportStartDate)) { if (lDto.taskKey.equals(rDto.taskKey) &&
return true; lDto.taskReportId == rDto.taskReportId &&
lDto.reportStartDate.equals(rDto.reportStartDate)) {
return true;
}
} else {
// taskKeyと作業報告階層で判定
if (lDto.taskKey.equals(rDto.taskKey) &&
lDto.taskReportLevel == rDto.taskReportLevel) {
return true;
}
} }
} }
return false; return false;
......
...@@ -97,7 +97,11 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -97,7 +97,11 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate); copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
} else { } else {
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey); if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
} else {
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey);
}
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel); copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
} }
...@@ -301,9 +305,9 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -301,9 +305,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
} }
} else { } else {
if (insertFlg) { if (insertFlg) {
mOperationLogic.insertTaskReportReply(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true); mOperationLogic.insertTaskReportReply(taskKey, operationId, contentId, Constant.EnableReport.YES, taskReportJson, null, attachedChangeFlag, true);
} else { } else {
mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true); mOperationLogic.updateTaskReportReply(taskKey, operationId, contentId, Constant.EnableReport.YES, taskReportJson, null, attachedChangeFlag, true);
} }
} }
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
......
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