Commit 5e96dcf4 by Kazuyuki Hida

ダッシュボードから報告一覧・定期点検の画面への遷移を実装した。

parent 1fcc3515
package jp.agentec.abook.abv.ui.home.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
......@@ -23,15 +24,29 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
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.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.ReportStatusDao;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
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.ReportStatusDto;
import jp.agentec.abook.abv.bl.dto.comparator.ReportStatusCompalator;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.LockReportLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.UnlockReportLogic;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.constant.ErrorCode;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
import jp.agentec.abook.abv.ui.viewer.view.CheckFormWebview;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -227,39 +242,45 @@ public class DashboardActivity extends OperationActivity {
return false;
}
switch (cmd) {
case CMD_GET_REPORT_STATUS_COUNT: {
return getReportStatusCount();
}
case CMD_GET_REPORT_LIST: {
try {
try {
switch (cmd) {
case CMD_GET_REPORT_STATUS_COUNT: {
return getReportStatusCount();
}
case CMD_GET_REPORT_LIST: {
String reportStatusId = param.get("reportStatusId");
if (reportStatusId != null) {
return getReportList(Integer.parseInt(reportStatusId));
} else {
return false;
}
} catch (Throwable e) {
Logger.e(TAG, e);
return false;
}
case CMD_GO_REPORT_DETAIL: {
Long operationId = longOrNull(param.get("operationId"));
if (operationId == null) {
return true;
} else {
return goReportDetail(operationId);
}
}
case CMD_LOCK_REPORT: {
String taskKey = param.get("taskKey");
Long taskReportId = longOrNull(param.get("taskReportId"));
Date reportStartDate = dateOrNull(param.get("reportStartDate"));
return lockReport(taskKey, taskReportId, reportStartDate);
}
case CMD_UNLOCK_REPORT: {
String taskKey = param.get("taskKey");
Long taskReportId = longOrNull(param.get("taskReportId"));
Date reportStartDate = dateOrNull(param.get("reportStartDate"));
return unlockReport(taskKey, taskReportId, reportStartDate);
}
}
case CMD_GO_REPORT_DETAIL: {
return goReportDetail();
}
case CMD_LOCK_REPORT: {
String taskKey = param.get("taskKey");
Long taskReportId = longOrNull(param.get("taskReportId"));
Date reportStartDate = dateOrNull(param.get("reportStartDate"));
return lockReport(taskKey, taskReportId, reportStartDate);
}
case CMD_UNLOCK_REPORT: {
String taskKey = param.get("taskKey");
Long taskReportId = longOrNull(param.get("taskReportId"));
Date reportStartDate = dateOrNull(param.get("reportStartDate"));
return unlockReport(taskKey, taskReportId, reportStartDate);
}
} catch (Throwable e) {
Logger.e(TAG, e.getLocalizedMessage());
return false;
}
return false;
}
......@@ -350,9 +371,62 @@ public class DashboardActivity extends OperationActivity {
return tree;
}
private boolean goReportDetail(long operationId) {
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
return true;
}
// 新着更新を止める
contentRefresher.stopRefresh();
OperationDao operationDao = AbstractDao.getDao(OperationDao.class);
OperationDto operationDto = operationDao.getOperation(operationId);
// t_operationテーブルにcontent_idは含まれていないので、この時点でoperationDto.contentIdはnull
// なので、contentDtoを取り出す
OperationContentDao operationContentDao = AbstractDao.getDao(OperationContentDao.class);
OperationContentDto operationContentDto = operationContentDao.getOperationMainContent(operationId);
ContentDto contentDto = contentDao.getContent(operationContentDto.contentId);
try {
if (contentDto != null && contentDto.downloadedFlg) {
String contentPath = ABVEnvironment.getInstance().getTaskListDirName(ContentFileExtractor.getInstance().getContentCacheDirWithExtract(contentDto.contentId));
// プロジェクトの指示/報告表示時、必要なJSONファイル作成
OperationLogic operationLogic = AbstractLogic.getLogic(OperationLogic.class);
operationLogic.createJsonForOperationContent(operationDto.operationId, contentPath, operationDto.reportType == Constant.ReportType.RoutineTask);
// サーバ作業後、対応必要
StringBuilder path = new StringBuilder();
path.append(contentPath);
// #32926 作業報告画面改善 start
path.append("/index.html?app=android");
path.append("&report_type=").append(operationDto.reportType); // 作業報告タイプ : 0:報告 1:定期点検 2:報告(回答)
path.append("&mobile_flg=").append(isNormalSize() ? "1" : "0"); // ScreenType
Logger.d(TAG, "path : " + path);
Intent intent = new Intent();
intent.putExtra(ABookKeys.CONTENT_ID, operationDto.contentId);
intent.putExtra(ABookKeys.OPERATION_ID, operationDto.operationId);
intent.putExtra(Constant.ABookCheck.XWALK_OPEN_TYPE, Constant.XWalkOpenType.TASK_REPORT);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
if(operationDto.operationType == OperationType.PDF) {
intent.putExtra("LINKURL", "file://" + path);
ActivityHandlingHelper.getInstance().checkContentActivity(operationDto.contentId, 0, intent);
} else {
intent.setClass(this, HTMLXWalkWebViewActivity.class);
ActivityHandlingHelper.getInstance().startHTMLXWalkWebActivity(this, intent, "file://" + path, contentDto.contentId, -1, -1, -1, -1, -1);
}
return true;
} else {
Logger.w(TAG, "content is not download");
}
} catch (Exception e) {
Logger.e(TAG, e);
handleErrorMessageToast(ErrorCode.E107);
}
private boolean goReportDetail() {
//todo
return 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