Commit ec42bc8b by Jeong Gilmo

Merge branch 'feature/1.0.1' into feature/1.0.1_33006

# Conflicts:
#	ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
parents 2666dd82 fa601572
......@@ -24,7 +24,6 @@ import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoutineTaskDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServiceOptionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
......@@ -56,6 +55,7 @@ import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.acms.type.LoginStatus;
import jp.agentec.abook.abv.bl.acms.type.RequirePasswordChangeCode;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.ExceptionDetailMessage;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
......@@ -73,13 +73,13 @@ import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ServiceOptionDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.adf.net.http.HttpDownloadState;
import jp.agentec.adf.net.http.HttpFileDownloader;
import jp.agentec.adf.net.http.HttpMultipart;
import jp.agentec.adf.net.http.HttpParameterObject;
import jp.agentec.adf.net.http.HttpRequestSender;
import jp.agentec.adf.net.http.HttpResponse;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -505,29 +505,27 @@ public class AcmsClient implements AcmsClientResponseListener {
}
//作業者グループ取得
public WorkerGroupJSON getWorkerGroupList(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiWorkerGroupList, param);
public WorkerGroupJSON getWorkingGroupList(AcmsParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiWorkingGroupList, param);
WorkerGroupJSON json = new WorkerGroupJSON(response.httpResponseBody);
return json;
}
/**
* 作業データ送信
* 作業報告データ送信
* @param sid
* @param operationId
* @param taskKey
* @param delFlag
* @param taskType
* @param taskHotspotInfo
* @param taskReportInfo
* @param taskReportDto
* @param formFile
* @param taskReportSendSaveDate
* @param reportType
* @return
* @throws AcmsException
* @throws ABVException
* @throws NetworkDisconnectedException
* @throws IOException
*/
public AcmsMessageJSON sendTaskData(String sid, String operationId, String taskKey, String delFlag, String taskType, String taskHotspotInfo, String taskReportInfo, File formFile, boolean attachedFileSendFlg, Date taskReportSendSaveDate) throws ABVException, NetworkDisconnectedException, IOException {
public AcmsMessageJSON sendTaskData(String sid, Long operationId, TaskReportDto taskReportDto, File formFile, Date taskReportSendSaveDate, int reportType) throws ABVException, NetworkDisconnectedException, IOException {
if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック
throw new NetworkDisconnectedException();
}
......@@ -535,39 +533,48 @@ public class AcmsClient implements AcmsClientResponseListener {
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSendTaskData);
List<HttpMultipart> HttpMultipartList = new ArrayList<HttpMultipart>();
HttpMultipartList.add(new HttpMultipart(ABookKeys.SID, sid));
HttpMultipartList.add(new HttpMultipart(ABookKeys.OPERATION_ID, operationId));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_KEY, taskKey));
HttpMultipartList.add(new HttpMultipart(ABookKeys.DEL_FLAG, delFlag));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_TYPE, taskType));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_HOT_SPOT_INFO, taskHotspotInfo));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_INFO, taskReportInfo));
HttpMultipartList.add(new HttpMultipart(ABookKeys.ATTACHED_CHANGE_FLAG, attachedFileSendFlg ? "1" : "0"));
HttpMultipartList.add(new HttpMultipart(ABookKeys.OPERATION_ID, StringUtil.toString(operationId)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_KEY, taskReportDto.taskKey));
HttpMultipartList.add(new HttpMultipart(ABookKeys.DEL_FLAG, taskReportDto.delFlg ? "1" : "0"));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_LEVEL, StringUtil.toString(taskReportDto.taskReportLevel)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_HOT_SPOT_INFO, taskReportDto.taskHotSpotInfo));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_INFO, taskReportDto.jsonData));
HttpMultipartList.add(new HttpMultipart(ABookKeys.ATTACHED_CHANGE_FLAG, taskReportDto.attachedFileSendFlg ? "1" : "0"));
HttpMultipartList.add(new HttpMultipart(ABookKeys.ROUTINE_TASK_FLAG, reportType == Constant.ReportType.Routine ? "1" : "0"));
// 定期点検用
if (reportType == Constant.ReportType.Routine) {
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_ID, StringUtil.toString(taskReportDto.taskReportId)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_INFO_ID, StringUtil.toString(taskReportDto.taskReportInfoId)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.REPORT_START_DATE, DateTimeUtil.toStringForCmsGMT(taskReportDto.reportStartDate)));
}
if (formFile != null) {
HttpMultipartList.add(new HttpMultipart(ABookKeys.FORM_FILE, formFile));
}
if (taskReportSendSaveDate != null) {
String sendDate = DateTimeUtil.toStringInTimeZone(taskReportSendSaveDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT") + ",GMT";
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_SAVE_DATE, sendDate));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_SAVE_DATE, DateTimeUtil.toStringForCmsGMT(taskReportSendSaveDate)));
}
result = HttpRequestSender.post(apiUrl, HttpMultipartList.toArray(new HttpMultipart[HttpMultipartList.size()]));
Logger.d(TAG, "[sendTaskData]: operationId=%s, taskKey=%s, delFlag=%s, task_type=%s, taskHopspotInfo=%s, taskReportInfo=%s, attachedFileSendFlg=%s", operationId, taskKey, delFlag, taskType, taskHotspotInfo, taskReportInfo, attachedFileSendFlg);
AcmsMessageJSON json = new AcmsMessageJSON(result.httpResponseBody);
Logger.d(TAG, "sendTaskData res: %s", json);
if (json.errorMessage != null) {
if (json.errorMessage[0].equals("P003")) {
throw new ABVException(ABVExceptionCode.P_E_ACMS_P003);
} else if (json.errorMessage[0].equals("P004")) {
throw new ABVException(ABVExceptionCode.P_E_ACMS_P004);
} else if (json.errorMessage[0].equals("P005")) {
throw new ABVException(ABVExceptionCode.P_E_ACMS_P005);
}
}
if (json.httpStatus != 200) {
throw new AcmsException(ABVExceptionCode.S_E_ACMS_0001, json);
}
return json;
}
......@@ -646,19 +653,6 @@ public class AcmsClient implements AcmsClientResponseListener {
}
/**
* プロジェクトの定期点検データ取得
* @param param
* @return
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public RoutineTaskDataJSON getRoutineTaskData(GetOperationDataParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiGetRoutineTaskData, param);
RoutineTaskDataJSON json = new RoutineTaskDataJSON(response.httpResponseBody);
return json;
}
/**
* 作業データファイルの取得
* @param param
* @param operationId
......@@ -836,7 +830,7 @@ public class AcmsClient implements AcmsClientResponseListener {
HttpTaskWorker<HttpParameterObject> httpTaskThread = new HttpTaskWorker<HttpParameterObject>(methodName, apiUrl, param);
try{
try {
httpTaskThread.start();
httpTaskThread.join(HttpRequestSender.DefaultConnectionTimeout);
} catch (Exception e) {
......
......@@ -7,9 +7,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.adf.util.DateTimeFormat;
......@@ -20,35 +18,30 @@ import jp.agentec.adf.util.DateTimeUtil;
*/
public class OperationDataJSON extends AcmsCommonJSON {
public static final String OperationLastEditDate = "projectLastEditDate";
public static final String OperationLastEditDate = "operationLastEditDate";
public static final String TaskList = "taskList";
public static final String OperationId = "projectId";
public static final String OperationId = "operationId";
public static final String TaskId = "taskId";
public static final String TaskKey = "taskKey";
public static final String TaskCode = "taskCode";
public static final String TaskStatus = "taskStatus";
public static final String TaskHotspotInfo = "taskHotspotInfo";
// #32782 指示者テーブル関連削除 start
// TODO change&delete TaskDirections
// public static final String TaskDirectionsInfo = "taskReportInfo";
public static final String TaskDirectionsInfo = "taskDirectionsInfo";
// #32782 指示者テーブル関連削除 end
public static final String TaskReportInfo = "taskReportInfo";
// #32782 指示者テーブル関連削除 start
// TODO change&Delete TaskDirections
// public static final String TaskDirectionsKey = "taskReportKey";
public static final String TaskDirectionsKey = "taskDirectionsKey";
// #32782 指示者テーブル関連削除 end
public static final String TaskReportKey = "taskReportKey";
public static final String Task = "task";
// 1.0.1で追加
public static final String TaskReportId = "taskReportId"; // 作業報告書ID ※定期点検のみ
public static final String TaskReportList = "taskReportList"; // 作業報告詳細リスト
public static final String TaskReportLevel = "taskReportLevel"; // 作業報告階層
public static final String EnableReport = "enableReport"; // 報告可能区分
public static final String TaskReportInfoId = "taskReportInfoId"; // 作業報告書情報ID ※定期点検のみ
public static final String ReportStartDate = "reportStartDate"; // 点検開始日時   ※定期点検のみ
public static final String ReportEndDate = "reportEndDate"; // 点検終了日時   ※定期点検のみ
public static final String TaskReportKey = "taskReportKey"; // 作業報告キー
public static final String TaskReportInfo = "taskReportInfo"; // 作業報告データ
public List<TaskDto> taskDtoList;
public Date lastEditDate;
// #32926 作業報告画面改善 start
public static final String TaskReportLevel = "taskReportLevel";
// #32926 作業報告画面改善 end
public OperationDataJSON(String jsonString) throws AcmsException {
super(jsonString);
}
......@@ -62,12 +55,6 @@ public class OperationDataJSON extends AcmsCommonJSON {
for (int i = 0; i < taskList.length(); i++) {
JSONObject taskJson = taskList.getJSONObject(i);
TaskDto dto = new TaskDto();
// #32782 指示者テーブル関連削除 start
// TODO change
// dto.taskDirectionsDto = new TaskReportDto();
dto.taskDirectionsDto = new TaskDirectionsDto();
// #32782 指示者テーブル関連削除 end
dto.taskReportDto = new TaskReportDto();
dto.operationId = taskJson.getLong(OperationId);
dto.taskId = taskJson.getLong(TaskId);
......@@ -76,25 +63,43 @@ public class OperationDataJSON extends AcmsCommonJSON {
dto.taskStatus = taskJson.getInt(TaskStatus);
dto.taskHotSpotInfo = taskJson.getJSONObject(TaskHotspotInfo).toString();
if(taskJson.has(TaskDirectionsInfo)) {
dto.taskDirectionsDto.jsonData = taskJson.getJSONObject(TaskDirectionsInfo).toString();
// 作業報告詳細リスト
JSONArray taskReportList = taskJson.getJSONArray(TaskReportList);
dto.taskReportDtoList = new ArrayList<TaskReportDto>();
for (int j = 0; j < taskReportList.length(); j++) {
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskReportJson = taskReportList.getJSONObject(j);
taskReportDto.taskKey = dto.taskKey;
taskReportDto.taskReportLevel = taskReportJson.getInt(TaskReportLevel);
taskReportDto.enableReport = taskReportJson.getInt(EnableReport);
if (taskReportJson.has(TaskReportInfoId)) {
// 定期点検の場合
taskReportDto.taskReportInfoId = taskReportJson.getInt(TaskReportInfoId);
}
if(taskJson.has(TaskDirectionsKey)) {
dto.taskDirectionsDto.attachedFileName = taskJson.getString(TaskDirectionsKey);
if (taskReportJson.has(ReportStartDate)) {
taskReportDto.reportStartDate = DateTimeUtil.toDate(taskReportJson.getString(ReportStartDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
if (taskReportJson.has(ReportEndDate)) {
taskReportDto.reportEndDate = DateTimeUtil.toDate(taskReportJson.getString(ReportEndDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
if (taskReportJson.has(TaskReportKey)) {
taskReportDto.attachedFileName = taskReportJson.getString(TaskReportKey);
}
if (taskJson.has(TaskReportInfo)) {
Object object = taskJson.get(TaskReportInfo);
if (taskReportJson.has(TaskReportInfo)) {
Object object = taskReportJson.get(TaskReportInfo);
if (object instanceof String) {
dto.taskReportDto.jsonData = null;
taskReportDto.jsonData = null;
} else {
dto.taskReportDto.jsonData = taskJson.getJSONObject(TaskReportInfo).toString();
taskReportDto.jsonData = taskReportJson.getJSONObject(TaskReportInfo).toString();
}
}
if (taskJson.has(TaskReportKey)) {
dto.taskReportDto.attachedFileName = taskJson.getString(TaskReportKey);
dto.taskReportDtoList.add(taskReportDto);
}
taskDtoList.add(dto);
}
}
......
......@@ -6,11 +6,11 @@ import org.json.adf.JSONObject;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON;
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.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.TaskWorkerGroupDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -20,33 +20,39 @@ import jp.agentec.adf.util.DateTimeUtil;
public class OperationListJSON extends AcmsCommonJSON {
// TODO
// サーバ作業後、対応必要「project」→「operation」
public static final String OperationList = "projectList";
public static final String OperationId = "projectId";
public static final String OperationName = "projectName";
public static final String OperationDescriptions = "projectDescriptions";
public static final String OperationStartDate = "projectStartDate";
public static final String OperationEndDate = "projectEndDate";
public static final String OperationType = "projectType";
public static final String ReportUpdateType = "reportUpdateType";
public static final String OperationLastEditDate = "projectLastEditDate";
public static final String OperationStatus = "projectStatus";
public static final String DecisionStatus = "decisionStatus";
public static final String DecisionType = "decisionType";
public static final String OperationList = "operationList";
public static final String OperationId = "operationId";
public static final String OperationType = "operationType";
public static final String ReportType = "reportType";
public static final String OperationName = "operationName";
public static final String OperationDescriptions = "operationDescriptions";
public static final String OperationStartDate = "operationStartDate";
public static final String OperationEndDate = "operationEndDate";
public static final String OperationLastEditDate = "operationLastEditDate";
public static final String ContentId = "contentId";
//定期点検用
public static final String ReportCycle = "reportCycle";
public static final String EnableReportUpdate = "enableReportUpdate";
public static final String EnableReportHistory = "enableReportHistory";
// 作業編集可能区分
public static final String EnableReportEdit = "enableReportEdit";
// 作業担当グループリスト
public static final String WorkingGroupList = "workingGroupList";
public static final String ReportLevel = "reportLevel"; // 報告階層
public static final String GroupId = "groupId"; // グループID
public static final String GroupList = "groupList"; // グループリスト
public static final String RelatedContentList = "relatedContentList";
public static final String PushMessageList = "pushMessageList";
public static final String PushMessageId = "pushMessageId";
public static final String PushSendLoginId = "pushSendLoginId";
public static final String PushSendDate = "pushSendDate";
public static final String PushMessage = "pushMessage";
//定期点検用
public static final String OperationReportType = "projectReportType";
public static final String ReportCycle = "reportCycle";
public static final String EnableReportUpdate = "enableReportUpdate";
public static final String PushMessage = "pushMessage";
public List<OperationDto> operationList;
......@@ -64,21 +70,22 @@ public class OperationListJSON extends AcmsCommonJSON {
JSONObject operationJson = operations.getJSONObject(i);
OperationDto dto = new OperationDto();
dto.operationContentDtoList = new ArrayList<OperationContentDto>();
dto.taskWorkerGroupDtoList = new ArrayList<TaskWorkerGroupDto>();
dto.operationId = operationJson.getLong(OperationId);
dto.operationType = operationJson.getInt(OperationType);
dto.operationName = operationJson.getString(OperationName);
dto.operationDescriptions = operationJson.getString(OperationDescriptions);
dto.operationStartDate = DateTimeUtil.toDate(operationJson.getString(OperationStartDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
dto.operationEndDate = DateTimeUtil.toDate(operationJson.getString(OperationEndDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
dto.operationType = operationJson.getInt(OperationType);
dto.reportUpdateType = operationJson.has(ReportUpdateType) ? operationJson.getInt(ReportUpdateType) : 0;
dto.reportType = operationJson.getInt(ReportType); // 作業報告タイプ
dto.enableReportHistory = operationJson.getInt(EnableReportHistory); // 報告履歴管理
dto.enableReportEdit = operationJson.has(EnableReportEdit) ? operationJson.getInt(EnableReportEdit) : 0; // 作業編集区分
// 作業終了更新日
if (operationJson.has(OperationLastEditDate)) {
dto.lastEditDate = DateTimeUtil.toDate(operationJson.getString(OperationLastEditDate), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
if (operationJson.has(OperationReportType)) {
dto.operationReportType = operationJson.getInt(OperationReportType);
}
if (operationJson.has(ReportCycle)) {
dto.reportCycle = operationJson.getInt(ReportCycle);
}
......@@ -124,6 +131,26 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.pushMessageList.add(pushMessageDto);
}
}
if (operationJson.has(WorkingGroupList)) {
JSONArray workingGroupJsonArray = operationJson.getJSONArray(WorkingGroupList);
for (int k = 0; k < workingGroupJsonArray.length(); k++) {
if (workingGroupJsonArray.getJSONObject(k).length() == 0) {
// リストの情報が空の場合、以下の処理を行わないようにする
break;
}
// 作業担当グループリストセット
TaskWorkerGroupDto taskWorkerGroupDto = new TaskWorkerGroupDto();
taskWorkerGroupDto.taskReportLevel = workingGroupJsonArray.getJSONObject(k).getInt(ReportLevel);
taskWorkerGroupDto.groupList = new ArrayList<Integer>();
JSONArray workingGroupListArray = workingGroupJsonArray.getJSONObject(k).getJSONArray(GroupList);
for (int j = 0; j < workingGroupListArray.length(); j++) {
taskWorkerGroupDto.groupList.add(workingGroupListArray.getJSONObject(j).getInt(GroupId));
}
dto.taskWorkerGroupDtoList.add(taskWorkerGroupDto);
}
}
operationList.add(dto);
}
}
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.RoutineTaskReportDto;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* Created by seo-y on 2018/12/19.
*/
public class RoutineTaskDataJSON extends OperationDataJSON {
public static final String TaskReportId = "taskReportId";
public static final String TaskReportInfoId = "taskReportInfoId";
public static final String ReportStartDate = "reportStartDate";
public static final String ReportEndDate = "reportEndDate";
public static final String TaskReportInfo = "taskReportInfo";
public static final String TaskReportKey = "taskReportKey";
public static final String ReportList = "reportList";
public List<RoutineTaskReportDto> reportDtoList;
public RoutineTaskDataJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) {
lastEditDate = DateTimeUtil.toDate(json.getString(OperationLastEditDate), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
taskDtoList = new ArrayList<TaskDto>();
if (json.has(TaskList)) {
JSONArray taskList = json.getJSONArray(TaskList);
for (int i = 0; i < taskList.length(); i++) {
JSONObject taskJson = taskList.getJSONObject(i);
TaskDto dto = new TaskDto();
// #32782 指示者テーブル関連削除 start
// TODO change
// dto.taskDirectionsDto = new TaskReportDto();
dto.taskDirectionsDto = new TaskDirectionsDto();
// #32782 指示者テーブル関連削除 end
dto.taskReportDto = new TaskReportDto();
dto.operationId = taskJson.getLong(OperationId);
dto.taskId = taskJson.getLong(TaskId);
dto.taskKey = taskJson.getString(TaskKey);
dto.taskReportId = taskJson.getInt(TaskReportId);
if (taskJson.has(TaskHotspotInfo)) {
dto.taskHotSpotInfo = taskJson.getJSONObject(TaskHotspotInfo).toString();
} else {
dto.taskHotSpotInfo = "";
}
reportDtoList = new ArrayList<RoutineTaskReportDto>();
if (taskJson.has(ReportList)) {
JSONArray reportList = taskJson.getJSONArray(ReportList);
String taskReportInfoId;
for (int j = 0; j < reportList.length(); j++) {
JSONObject reportJson = reportList.getJSONObject(j);
RoutineTaskReportDto reportDto = new RoutineTaskReportDto();
reportDto.taskKey = dto.taskKey;
reportDto.taskReportId = dto.taskReportId;
reportDto.taskReportInfoId = reportJson.getInt(TaskReportInfoId);
reportDto.reportStartDate = DateTimeUtil.toDate(reportJson.getString(ReportStartDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
reportDto.reportEndDate = DateTimeUtil.toDate(reportJson.getString(ReportEndDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
if (reportJson.has(TaskReportInfo)) {
Object obj = reportJson.get(TaskReportInfo);
if (obj instanceof String) {
reportDto.jsonData = (String)obj;
} else if (obj instanceof JSONObject) {
reportDto.jsonData = ((JSONObject)obj).toString();
} else {
reportDto.jsonData = "";
}
} else {
reportDto.jsonData = "";
}
if (reportJson.has(TaskReportKey)) {
reportDto.attachedFileName = reportJson.getString(TaskReportKey);
}
reportDtoList.add(reportDto);
}
}
dto.RoutineTaskReportList = reportDtoList;
taskDtoList.add(dto);
}
}
}
}
......@@ -13,9 +13,7 @@ public class GetOperationDataParameters extends AcmsParameters {
this.operationId = operationId;
}
// TODO
// サーバ作業後、対応必要「project」→「operation」
public long getProjectId() {
public long getOperationId() {
return operationId;
}
......
......@@ -133,13 +133,13 @@ public class AcmsApis {
// デバイストークン更新
public static final String ApiUrlUpdateDeviceToken = "updateDeviceToken";
// プロジェクト一覧取得
public static final String ApiOperationList = "projectList";
public static final String ApiOperationList = "operationList";
// 作業者グループ取得
public static final String ApiWorkerGroupList = "workerGroupList";
public static final String ApiWorkingGroupList = "workingGroupList";
// 作業データ送信
public static final String ApiSendTaskData = "taskData";
// 作業データ取得
public static final String ApiGetOperationData = "getProjectData";
public static final String ApiGetOperationData = "getOperationData";
// 定期点検データ取得
public static final String ApiGetRoutineTaskData = "getProjectInspectData";
// 作業ファイル取得
......@@ -196,7 +196,7 @@ public class AcmsApis {
if (methodName.equals(ApiUrlNewAppStoreLogin) || methodName.equals(ApiUrlAppStoreNewLogin) || methodName.equals(ApiUrlServerTime) || methodName.equals(ApiUrlServerTimeZone)) {
apiValue = Constant.ApiValue.nuapi;
} else if (methodName.equals(ApiOperationList) || methodName.equals(ApiWorkerGroupList) || methodName.equals(ApiSendTaskData) || methodName.equals(ApiGetOperationData) ||
} else if (methodName.equals(ApiOperationList) || methodName.equals(ApiWorkingGroupList) || methodName.equals(ApiSendTaskData) || methodName.equals(ApiGetOperationData) ||
methodName.equals(ApiGetTaskFile) || methodName.equals(ApiSceneEntry) || methodName.equals(ApiTaskContentEntry) ||
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiGetRoutineTaskData) || methodName.equals(ApiSendRoutineTaskData)) {
apiValue = Constant.ApiValue.checkapi;
......
......@@ -140,9 +140,9 @@ public class ABVEnvironment {
public static final String SavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%s";
public static final String RoutineTaskSavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%d/%s/%s";
public static final String OperationTaskKeyReportSendDirFormat = OperationTaskKeyDirFormat + TaskReportLevelDir + "/reportSend/%d";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormat = OperationTaskKeyDirFormat + TaskReportLevelDir + "/reportSend/%d/%s/%d";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormatForDelete = OperationTaskKeyDirFormat + TaskReportLevelDir + "/reportSend/%d/%s";
public static final String OperationTaskKeyRoutineTaskReportDirFormat = OperationTaskKeyDirFormat + TaskReportLevelDir + "/report/%d/%s";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormat = OperationTaskKeyDirFormat + "/reportSend/%d/%s/%d";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormatForDelete = OperationTaskKeyDirFormat + "/reportSend/%d/%s";
public static final String OperationTaskKeyRoutineTaskReportDirFormat = OperationTaskKeyDirFormat + "/report/%d/%s";
// #32926 作業報告画面改善 end
/**
......@@ -678,32 +678,43 @@ public class ABVEnvironment {
return String.format(OperationTaskKeyDirFormat, rootDirectory, operationId, taskKey);
}
// #32926 作業報告画面改善 start
// taskReportLevelの値によってディレクトリを構成
public String getOperationTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportSendId, int taskReportLevel) {
return String.format(OperationTaskKeyReportSendDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel), taskReportSendId);
public String getOperationTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportLevel, int taskReportSendId) {
return String.format(OperationTaskKeyReportSendDirFormat, rootDirectory, operationId, taskKey, taskReportLevel, taskReportSendId);
}
public String getRoutineTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate, int taskReportLevel) {
return String.format(OperationTaskKeyRoutineTaskReportSendDirFormatForDelete, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel), taskReportId, getReportDate(reportStartDate));
public String getRoutineTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate) {
return String.format(OperationTaskKeyRoutineTaskReportSendDirFormatForDelete, rootDirectory, operationId, taskKey, taskReportId, getReportDate(reportStartDate));
}
public String getRoutineTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate, int taskReportSendId, int taskReportLevel) {
return String.format(OperationTaskKeyRoutineTaskReportSendDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel), taskReportId, getReportDate(reportStartDate), taskReportSendId);
public String getRoutineTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate, int taskReportSendId) {
return String.format(OperationTaskKeyRoutineTaskReportSendDirFormat, rootDirectory, operationId, taskKey, taskReportId, getReportDate(reportStartDate), taskReportSendId);
}
public String getRoutineTaskReportDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate, int taskReportLevel) {
return String.format(OperationTaskKeyRoutineTaskReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel), taskReportId, getReportDate(reportStartDate));
public String getRoutineTaskReportDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate) {
return String.format(OperationTaskKeyRoutineTaskReportDirFormat, rootDirectory, operationId, taskKey, taskReportId, getReportDate(reportStartDate));
}
public String getOperationDirectionOrReportDirPath(long operationId, String taskKey, String taskReportLevel) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, taskReportLevel);
public String getOperationDirectionOrReportDirPath(long operationId, String taskKey, int taskReportLevel) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel));
}
public String getOperationTaskReportLevelDirPath(long operationId, String taskKey, String taskReportLevel) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, taskReportLevel);
/**
* 作業報告レベルのディレクトリパス
* 例)root/files/ABook/projects/[project_id]/[task_key]/[taskReportLevel]
* @param operationId
* @param taskKey
* @param taskReportLevel
* @return
*/
public String getOperationTaskReportLevelDirPath(long operationId, String taskKey, int taskReportLevel) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel));
}
public String getOperationTaskReportDirPath(long operationId, String taskKey) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey);
}
// #32926 作業報告画面改善 end
public String getOperationReportSendDirPath(long operationId, String taskKey) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, REPORT_SEND);
......@@ -716,8 +727,8 @@ public class ABVEnvironment {
// #32926 作業報告画面改善 start
// taskReportLevelの値によってディレクトリを構成
public String getAttachedDirectionOrReportDirPath(long contentId, String taskKey, String taskReportLevel) {
return String.format(AttachedMoviesTaskTypeDir, cacheDirectory, contentId, taskKey, taskReportLevel);
public String getAttachedDirectionOrReportDirPath(long contentId, String taskKey, int taskReportLevel) {
return String.format(AttachedMoviesTaskTypeDir, cacheDirectory, contentId, taskKey, String.valueOf(taskReportLevel));
}
// #32926 作業報告画面改善 end
......
......@@ -88,17 +88,10 @@ public class Constant {
String REPORT_GPS = "reportGps";
}
public interface OperationUpdateType {
int HISTORY_NO = 0;
int HISTORY_ADD = 1;
int HISTORY_UPDATE = 2;
}
public interface OperationReportType {
// TODO 変数名は仮実装、変更必要
int DEFAULT = 0;
int REPORT_TYPE = 0;
int ROUTINE_TASK = 1;
int REPORT_TYPE = 2;
int REPORT_RESPONSE_TYPE = 2;
}
public interface PushMessageSendType {
......@@ -141,11 +134,26 @@ public class Constant {
int Audio =3;
}
// #32926 作業報告画面改善 start
public interface TaskReportLevel {
int ReportType = 0; // 報告タイプ
int ReportReplyType = 1; // 報告(回答)タイプ
}
public interface ReportType {
int Report = 0; // 報告
int Routine = 1; // 定期点検
int Report_Answer = 2; // 報告(回答)
int ReportReply = 2; // 報告(回答)
}
// 報告履歴管理
public interface EnableReportHistory {
int Invalid = 0; // 無効
int Enable = 1; // 有効
}
// 作業編集可能区分
public interface EnableReportEdit {
int NO = 0;
int YES = 1;
}
// #32926 作業報告画面改善 end
}
......@@ -12,18 +12,11 @@ public class ABookKeys {
public static final String CONTENT_ID = "contentId";
public static final String CONTENT_NAME = "contentName";
public static final String CONTENT_TYPE = "contentType";
public static final String OPERATION_ID = "projectId";
public static final String OPERATION_NAME = "projectName";
public static final String OPERATION_ID = "operationId";
public static final String OPERATION_NAME = "operationName";
// ABOOKCHECK SCHEME
public static final String ABOOK_CHECK_API = "abookcheck-api";
// #32782 指示者テーブル関連削除 start
// TODO TaskDirections 削除処理が必要
public static final String CMD_INSERT_TASK_DIRECTIONS = "insertTaskDirections";
public static final String CMD_UPDATE_TASK_DIRECTIONS = "updateTaskDirections";
public static final String CMD_DELETE_TASK_DIRECTIONS = "deleteTaskDirections";
public static final String CMD_CANCEL_TASK_DIRECTIONS = "cancelTaskDirections";
// #32782 指示者テーブル関連削除 end
public static final String CMD_MOVE_HOT_SPOT = "moveHotspot";
public static final String CMD_SHOW_DIRECTION_OZD = "showDirectionOzd";
public static final String CMD_PREVIEW_DIRECTION_OZD = "previewDirectionOzd";
......@@ -50,6 +43,7 @@ public class ABookKeys {
public static final String READ_ONLY_FLG = "readOnlyFlg";
public static final String DIRECTION_FLG = "directionFlg";
public static final String ATTACHED_CHANGE_FLAG = "attachedChangeFlag";
public static final String ROUTINE_TASK_FLAG = "routineTaskFlag";
// #32782 指示者テーブル関連削除 start
// TODO change TASK_DIRECTIONS 削除が必要
// public static final String TASK_DIRECTIONS = "taskReport";
......@@ -77,7 +71,7 @@ public class ABookKeys {
public static final String SID = "sid";
public static final String FORM_FILE = "formFile";
public static final String DEL_FLAG = "delFlag";
public static final String TASK_TYPE = "taskType";
public static final String TASK_REPORT_LEVEL = "taskReportLevel";
public static final String TASK_HOT_SPOT_INFO = "taskHotspotInfo";
public static final String TASK_REPORT_INFO = "taskReportInfo";
public static final String TASK_REPORT_SAVE_DATE = "saveDate";
......@@ -123,7 +117,6 @@ public class ABookKeys {
public static final String CMD_LOCAL_SAVE_TASK_REPORT = "localSaveTaskReport"; // 一時保存
// #32861 作業情報追加 end
// #32926 作業報告画面改善 start
public static final String TASK_REPORT_LEVEL = "taskReportLevel"; // 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答))
public static final String TASK_HAS_AUTHORITY = "taskHasAuthority";
public static final String HAS_AUTHORITY = "hasAuthority";
// #32926 作業報告画面改善 end
}
......@@ -19,6 +19,7 @@ import jp.agentec.abook.abv.bl.data.tables.MWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.ROperationContent;
import jp.agentec.abook.abv.bl.data.tables.RContentCategory;
import jp.agentec.abook.abv.bl.data.tables.RContentGroup;
import jp.agentec.abook.abv.bl.data.tables.RTaskWorkerGroup;
import jp.agentec.abook.abv.bl.data.tables.SQLiteTableScript;
import jp.agentec.abook.abv.bl.data.tables.TContent;
import jp.agentec.abook.abv.bl.data.tables.TContentBookmark;
......@@ -31,13 +32,10 @@ import jp.agentec.abook.abv.bl.data.tables.TContentResource;
import jp.agentec.abook.abv.bl.data.tables.TContentServerSearched;
import jp.agentec.abook.abv.bl.data.tables.TContentTag;
import jp.agentec.abook.abv.bl.data.tables.TEnquete;
import jp.agentec.abook.abv.bl.data.tables.TRoutineTaskReport;
import jp.agentec.abook.abv.bl.data.tables.TMarkingSetting;
import jp.agentec.abook.abv.bl.data.tables.TOperation;
import jp.agentec.abook.abv.bl.data.tables.TPushMessage;
import jp.agentec.abook.abv.bl.data.tables.TTask;
import jp.agentec.abook.abv.bl.data.tables.TTaskDirections;
import jp.agentec.abook.abv.bl.data.tables.TTaskDirectionsItems;
import jp.agentec.abook.abv.bl.data.tables.TTaskReport;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportItems;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportSend;
......@@ -89,18 +87,13 @@ public class ABVDataOpenHelper {
iTableScripts.add(new MWorkerGroup());
iTableScripts.add(new TOperation());
iTableScripts.add(new RTaskWorkerGroup());
iTableScripts.add(new ROperationContent());
iTableScripts.add(new TTask());
// #32782 指示者テーブル関連削除 start
// TODO delete
iTableScripts.add(new TTaskDirections());
iTableScripts.add(new TTaskDirectionsItems());
// #32782 指示者テーブル関連削除 end
iTableScripts.add(new TTaskReport());
iTableScripts.add(new TTaskReportSend());
iTableScripts.add(new TTaskReportItems());
iTableScripts.add(new TPushMessage());
iTableScripts.add(new TRoutineTaskReport());
return iTableScripts;
}
......
......@@ -257,6 +257,34 @@ public class AbstractDao {
}
/**
* クエリを実行し、最初の行の最初の列の値をInteger型リストで返します。
*
* @param sql
* @param bindArgs
* @return
*/
public List<Integer> rawQueryGetIntegerList(String sql, String[] bindArgs) {
SQLiteDatabase db = dbConn.getDatabase();
Cursor cursor = null;
try {
List<Integer> list = new ArrayList<Integer>();
if (Logger.isVerboseEnabled()) {
Logger.v(TAG, "%s [%s]", sql, join(bindArgs));
}
cursor = db.rawQuery(sql, bindArgs);
while (cursor.moveToNext()) {
list.add(cursor.getInt(0));
}
return list;
}
finally {
if (cursor != null) {
cursor.close();
}
}
}
/**
* クエリを実行し、最初の行の最初の列の値をLong型リストで返します。
*
* @param sql
......
......@@ -70,16 +70,6 @@ public class OperationDao extends AbstractDao {
dto.contentCreatingFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("report_update_type");
if (column != -1) {
dto.reportUpdateType = cursor.getInt(column);
}
column = cursor.getColumnIndex("operation_report_type");
if (column != -1) {
dto.operationReportType = cursor.getInt(column);
}
column = cursor.getColumnIndex("report_cycle");
if (column != -1) {
dto.reportCycle = cursor.getInt(column);
......@@ -100,22 +90,32 @@ public class OperationDao extends AbstractDao {
dto.reportCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("enable_report_history");
if (column != -1) {
dto.enableReportHistory = cursor.getInt(column);
}
column = cursor.getColumnIndex("enable_report_edit");
if (column != -1) {
dto.enableReportEdit = cursor.getInt(column);
}
return dto;
}
public List<OperationDto> getAllOperation() {
return rawQueryGetDtoList("select tp.*, rpc.content_id from t_project AS tp left outer join r_operation_content AS rpc on tp.operation_id = rpc.operation_id", null, OperationDto.class);
return rawQueryGetDtoList("select tp.*, rpc.content_id from t_operation AS tp left outer join r_operation_content AS rpc on tp.operation_id = rpc.operation_id", null, OperationDto.class);
}
public List<OperationDto> getLatestOperations() {
return rawQueryGetDtoList("select * from t_project where operation_start_date <= ? order by operation_start_date DESC " , new String[]{DateTimeUtil.toStringInTimeZone(DateTimeUtil.getCurrentDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT")}, OperationDto.class);
return rawQueryGetDtoList("select * from t_operation where operation_start_date <= ? order by operation_start_date DESC " , new String[]{DateTimeUtil.toStringInTimeZone(DateTimeUtil.getCurrentDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT")}, OperationDto.class);
}
public OperationDto getOperation(long operationId) {
StringBuffer sql = new StringBuffer();
String[] args = new String[] { "" + operationId };
sql.append(" SELECT * ");
sql.append(" FROM t_project ");
sql.append(" FROM t_operation ");
sql.append(" WHERE operation_id = ?");
return rawQueryGetDto(sql.toString(), args, OperationDto.class);
}
......@@ -124,7 +124,7 @@ public class OperationDao extends AbstractDao {
StringBuffer sql = new StringBuffer();
String[] args = new String[] { "" + operationId };
sql.append(" SELECT * ");
sql.append(" FROM t_project AS tp ");
sql.append(" FROM t_operation AS tp ");
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 ");
......@@ -136,7 +136,7 @@ public class OperationDao extends AbstractDao {
StringBuffer sql = new StringBuffer();
String[] args = new String[] { "" + contentId };
sql.append(" SELECT * ");
sql.append(" FROM t_project AS tp ");
sql.append(" FROM t_operation AS tp ");
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 ");
......@@ -154,95 +154,93 @@ public class OperationDao extends AbstractDao {
}
public void insert(OperationDto dto) {
insert("insert into t_project "
insert("insert into t_operation "
+ "(operation_id, "
+ "operation_name, "
+ "operation_descriptions, "
+ "operation_start_date, "
+ "operation_end_date, "
+ "operation_type, "
+ "report_type, "
+ "last_edit_date, "
+ "content_creating_flg, "
+ "edit_lock_flg, "
+ "need_sync_flg, "
+ "report_update_type, "
+ "operation_report_type, "
+ "report_cycle, "
+ "enable_report_update) "
+ "enable_report_update, "
+ "enable_report_history, "
+ "enable_report_edit) "
+ "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
}
public boolean update(OperationDto dto) {
long count = update("update t_project "
long count = update("update t_operation "
+ "set "
+ "operation_name=?, "
+ "operation_descriptions=?, "
+ "operation_start_date=?, "
+ "operation_end_date=?, "
+ "operation_type=?, "
+ "report_type=?, "
+ "last_edit_date=?, "
+ "content_creating_flg=?, "
+ "edit_lock_flg=?, "
+ "need_sync_flg=?, "
+ "report_update_type=?, "
+ "operation_report_type=?, "
+ "report_cycle=?, "
+ "enable_report_update=? "
+ "enable_report_update=?, "
+ "enable_report_history=?, "
+ "enable_report_edit=? "
+ "where operation_id=?",
dto.getUpdateValues());
return count > 0;
}
public void delete(OperationDto dto) {
delete("r_task_worker_group", "operation_id=?", dto.getKeyValues());
delete("r_operation_content", "operation_id=?", dto.getKeyValues());
delete("t_project", "operation_id=?", dto.getKeyValues());
delete("t_operation", "operation_id=?", dto.getKeyValues());
}
public void deleteAll() {
delete("t_push_message", null, null);
delete("r_operation_content", null, null);
delete("t_project", null, null);
delete("t_operation", null, null);
delete("t_task", null, null);
// #32782 指示者テーブル関連削除 start
// TODO delete
delete("t_task_directions", null, null);
delete("t_task_directions_items", null, null);
// #32782 指示者テーブル関連削除 end
delete("t_task_report", null, null);
delete("t_task_report_send", null, null);
delete("t_task_report_items", null, null);
delete("t_inspect_task_report", 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 operationReportTypeStr) {
String sql = generateGetOperationQuery(searchOperationName, searchStartDateStr, searchEndDateStr, operationReportTypeStr);
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);
}
private String generateGetOperationQuery(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String operationReportTypeStr) {
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();
sql.append(" SELECT tp.operation_id, ");
sql.append(" tp.operation_name, ");
sql.append(" tp.operation_type, ");
sql.append(" tp.operation_descriptions, ");
sql.append(" tp.operation_start_date, ");
sql.append(" tp.operation_end_date, ");
sql.append(" tp.last_edit_date, ");
sql.append(" tp.edit_lock_flg, ");
sql.append(" tp.need_sync_flg, ");
sql.append(" tp.content_creating_flg, ");
sql.append(" tp.report_update_type, ");
sql.append(" tp.operation_report_type, ");
sql.append(" tp.report_cycle, ");
sql.append(" tp.enable_report_update, ");
sql.append(" SELECT top.operation_id, ");
sql.append(" top.operation_name, ");
sql.append(" top.operation_type, ");
sql.append(" top.operation_descriptions, ");
sql.append(" top.operation_start_date, ");
sql.append(" top.operation_end_date, ");
sql.append(" top.last_edit_date, ");
sql.append(" top.edit_lock_flg, ");
sql.append(" top.need_sync_flg, ");
sql.append(" top.content_creating_flg, ");
sql.append(" top.report_type, ");
sql.append(" top.report_cycle, ");
sql.append(" top.enable_report_update, ");
sql.append(" CASE ");
sql.append(" WHEN operation_report_type = 1 THEN ( ");
sql.append(" WHEN report_type = 1 THEN ( ");
sql.append(" SELECT strftime('%Y/%m/%d %H:%M', datetime(ti.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ti.report_end_date, 'localtime')) ");
sql.append(" FROM t_task tt ");
sql.append(" INNER JOIN t_inspect_task_report ti ");
......@@ -250,52 +248,52 @@ public class OperationDao extends AbstractDao {
sql.append(" AND tt.del_flg = 0 ");
//sql.append(" AND datetime(ti.report_start_date) <= datetime('" + curDate + "') ");
sql.append(" AND datetime(ti.report_end_date) >= datetime('" + curDate + "') ");
sql.append(" WHERE tt.operation_id = tp.operation_id ");
sql.append(" WHERE tt.operation_id = top.operation_id ");
sql.append(" ORDER BY ti.report_start_date ASC LIMIT 1 ) ");
sql.append(" ELSE '' ");
sql.append(" END AS report_period, ");
sql.append(" CASE ");
sql.append(" WHEN operation_report_type = 1 THEN ( ");
sql.append(" WHEN report_type = 1 THEN ( ");
sql.append(" SELECT count(*) ");
sql.append(" FROM t_inspect_task_report ");
sql.append(" WHERE task_key = (SELECT task_key FROM t_task WHERE operation_id = tp.operation_id LIMIT 1) ) ");
sql.append(" WHERE task_key = (SELECT task_key FROM t_task WHERE operation_id = top.operation_id LIMIT 1) ) ");
sql.append(" ELSE 0 ");
sql.append(" END AS report_count, ");
sql.append(" rpc.content_id ");
sql.append(" FROM t_project AS tp ");
sql.append(" FROM t_operation AS top ");
sql.append(" LEFT OUTER JOIN r_operation_content AS rpc ");
sql.append(" ON tp.operation_id = rpc.operation_id ");
sql.append(" ON top.operation_id = rpc.operation_id ");
sql.append(" AND rpc.operation_content_flg = 1 ");
sql.append(" WHERE tp.operation_id IS NOT NULL ");
sql.append(" WHERE top.operation_id IS NOT NULL ");
if (!StringUtil.isNullOrEmpty(searchOperationName)) {
sql.append(" AND tp.operation_name GLOB " + "'*" + 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 tp.operation_end_date >= '" + DateTimeUtil.toString(startDate, 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 tp.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
sql.append(" AND top.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
}
if (operationReportTypeStr != null) {
sql.append(" AND tp.operation_report_type in ("+ operationReportTypeStr +")");
if (reportTypeStr != null) {
sql.append(" AND top.report_type in ("+ reportTypeStr +")");
}
sql.append(" ORDER BY tp.operation_report_type DESC, tp.operation_start_date DESC, tp.operation_id DESC");
sql.append(" ORDER BY top.operation_start_date DESC, top.operation_name ASC");
Logger.v(TAG, "sql=%s", sql);
return sql.toString();
}
public boolean updateContentCreatingFlg(long operationId, boolean content_creating_flg){
public boolean updateContentCreatingFlg(long operationId, boolean contentCreatingFlg) {
OperationDto dto = getOperation(operationId);
if (dto != null) {
dto.contentCreatingFlg = content_creating_flg;
dto.contentCreatingFlg = contentCreatingFlg;
return update(dto);
}
return false;
......
......@@ -94,10 +94,10 @@ public class PushMessageDao extends AbstractDao {
public List<PushMessageDto> selectAll() {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, tp.operation_name ");
sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name ");
sql.append(" FROM t_push_message AS tpm ");
sql.append(" INNER JOIN t_project AS tp ");
sql.append(" ON tpm.operation_id = tp.operation_id ");
sql.append(" INNER JOIN t_operation AS top ");
sql.append(" ON tpm.operation_id = top.operation_id ");
sql.append(" ORDER BY tpm.push_message_id DESC ");
Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDtoList(sql.toString(), null, PushMessageDto.class);
......@@ -106,10 +106,10 @@ public class PushMessageDao extends AbstractDao {
public PushMessageDto select(long pushMessageId) {
String[] args = new String[] { "" + pushMessageId };
StringBuffer sql = new StringBuffer();
sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, tp.operation_name ");
sql.append(" SELECT tpm.push_message_id, tpm.operation_id, tpm.push_send_login_id, tpm.push_send_date, tpm.push_message, tpm.reading_flg, top.operation_name ");
sql.append(" FROM t_push_message AS tpm ");
sql.append(" INNER JOIN t_project AS tp ");
sql.append(" ON tpm.operation_id = tp.operation_id ");
sql.append(" INNER JOIN t_operation AS top ");
sql.append(" ON tpm.operation_id = top.operation_id ");
sql.append(" WHERE tpm.push_message_id = ? ");
Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDto(sql.toString(), args, PushMessageDto.class);
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.RoutineTaskReportDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* Created by seo-y on 2018/12/17.
*/
public class RoutineTaskReportDao extends AbstractDao {
private static final String TAG = "InspectTaskReportDao";
@Override
public RoutineTaskReportDto convert(Cursor cursor) {
RoutineTaskReportDto dto = new RoutineTaskReportDto();
int column = cursor.getColumnIndex("task_key");
if (column != -1) {
dto.taskKey = cursor.getString(column);
}
column = cursor.getColumnIndex("task_report_id");
if (column != -1) {
dto.taskReportId = cursor.getInt(column);
}
column = cursor.getColumnIndex("task_report_info_id");
if (column != -1) {
dto.taskReportInfoId = cursor.getInt(column);
}
column = cursor.getColumnIndex("report_start_date");
if (column != -1) {
dto.reportStartDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
column = cursor.getColumnIndex("report_end_date");
if (column != -1) {
dto.reportEndDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
column = cursor.getColumnIndex("attached_file_name");
if (column != -1) {
dto.attachedFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("local_attached_file_name");
if (column != -1) {
dto.localAttachedFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("json_data");
if (column != -1) {
dto.jsonData = cursor.getString(column);
}
column = cursor.getColumnIndex("data_send_flag");
if (column != -1) {
dto.dataSendFlag = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("attached_file_send_flag");
if (column != -1) {
dto.attachedFileSendFlag = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("reported_flag");
if (column != -1) {
dto.reportedFlag = toBool(cursor.getInt(column));
}
return dto;
}
public void insert(RoutineTaskReportDto dto) {
insert("insert into t_inspect_task_report "
+ "(task_key, "
+ "task_report_id, "
+ "task_report_info_id, "
+ "report_start_date, "
+ "report_end_date, "
+ "attached_file_name, "
+ "local_attached_file_name, "
+ "json_data, "
+ "data_send_flag, "
+ "attached_file_send_flag, "
+ "reported_flag) "
+ "values (?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
}
public boolean update(RoutineTaskReportDto dto, boolean reportedFlg) {
long count;
if (reportedFlg) {
dto.reportedFlag = true;
count = update("update t_inspect_task_report "
+ "set "
+ "report_end_date=?, "
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "json_data=?, "
+ "data_send_flag=?, "
+ "attached_file_send_flag=?, "
+ "reported_flag=? "
+ "where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)",
dto.getUpdateValues());
} else {
count = update("update t_inspect_task_report "
+ "set "
+ "report_end_date=?, "
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "json_data=?, "
+ "data_send_flag=?, "
+ "attached_file_send_flag=? "
+ "where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)",
new Object[] { dto.reportEndDate, dto.attachedFileName, dto.localAttachedFileName, dto.jsonData, dto.dataSendFlag, dto.attachedFileSendFlag, dto.taskKey, dto.taskReportId, dto.reportStartDate });
}
return count > 0;
}
public void delete(RoutineTaskReportDto dto) {
delete("t_inspect_task_report", "task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?, 'utc')", new String[] { dto.taskKey, "" + dto.taskReportId, DateTimeUtil.toString(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen) });
}
public RoutineTaskReportDto getLastRoutineTaskReportData(long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select tr.* ");
sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tt.operation_id = ? ORDER BY tr.report_start_date DESC LIMIT 1");
List<RoutineTaskReportDto> dtoList = rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class);
if (dtoList != null && dtoList.size() > 0) {
return dtoList.get(0);
} else {
RoutineTaskReportDto dto = new RoutineTaskReportDto();
dto.taskReportId = 0;
return dto;
}
}
public RoutineTaskReportDto getRoutineTaskReportUtc(String taskKey, int taskReportId, String reportStartDate){
return rawQueryGetDto("select * from t_inspect_task_report where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?, 'utc')", new String[]{ taskKey, "" + taskReportId, reportStartDate }, RoutineTaskReportDto.class);
}
public List<RoutineTaskReportDto> selectRoutineTaskReportByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_inspect_task_report where task_key=?", new String[]{ taskKey }, RoutineTaskReportDto.class);
}
public List<RoutineTaskReportDto> getRoutineTaskReportByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select tr.* ");
sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == tr.task_key ");
sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.operation_id = ?");
sb.append(" ORDER BY task_report_id ASC, report_start_date ASC");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, RoutineTaskReportDto.class);
}
public List<RoutineTaskReportDto> getSendableRoutineTaskReportData(long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tr.data_send_flag = 1");
sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class);
}
public List<RoutineTaskReportDto> getSendableRoutineTaskReportData(long operationId, String taskKey) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tr.data_send_flag = 1");
sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId, "" + taskKey }, RoutineTaskReportDto.class);
}
public boolean isExistSendRoutineTaskData(Long operationId) {
return getSendableRoutineTaskReportData(operationId).size() > 0;
}
public boolean existsToDoRoutineTaskReportData(long operationId) {
String currDate = DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen);
StringBuilder sb = new StringBuilder();
sb.append(" select count(*) ");
sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join t_task tt ON tt.task_key == tr.task_key ");
sb.append(" WHERE tt.del_flg = 0 ");
sb.append(" AND tt.operation_id = ? ");
sb.append(" AND datetime(report_end_date) >= datetime(?, 'utc') ");
return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, currDate }) > 0;
}
public List<RoutineTaskReportDto> geRoutineTaskReportByTaskKey(String taskKey) {
StringBuilder sb = new StringBuilder();
sb.append(" SELECT * ");
sb.append(" FROM t_inspect_task_report ");
sb.append(" WHERE task_key = ? ");
sb.append(" ORDER BY task_report_id, report_start_date ");
return rawQueryGetDtoList(sb.toString(), new String[]{ taskKey }, RoutineTaskReportDto.class);
}
public String getRoutineTaskReportAttachedFileName(String taskKey, int taskReportId, String reportStartDate) {
return rawQueryGetString("select local_attached_file_name from t_inspect_task_report where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)", new String[]{ taskKey, "" + taskReportId, reportStartDate });
}
}
......@@ -99,25 +99,13 @@ public class TaskDao extends AbstractDao {
/**
* 作業削除
* @param taskKey
* @param directionFlg
*/
public void deleteTaskData(String taskKey, boolean directionFlg) {
public void deleteTaskData(String taskKey) {
String[] keyValues = new String[]{""+ taskKey};
if (directionFlg) {
delete("t_task", "task_key=?", keyValues);
// #32782 指示者テーブル関連削除 start
// TODO delete
delete("t_task_directions", "task_key=?", keyValues);
delete("t_task_directions_items", "task_key=?", keyValues);
// #32782 指示者テーブル関連削除 end
delete("t_task_report", "task_key=?", keyValues);
delete("t_task_report_items", "task_key=?", keyValues);
} else {
delete("t_task_report", "task_key=?", keyValues);
delete("t_task_report_items", "task_key=?", keyValues);
}
}
/**
* 作業削除
......@@ -125,11 +113,6 @@ public class TaskDao extends AbstractDao {
*/
public void delete(TaskDto dto) {
delete("t_task", "task_key=?", dto.getKeyValues());
// #32782 指示者テーブル関連削除 start
// TODO delete
delete("t_task_directions", "task_key=?", dto.getKeyValues());
delete("t_task_directions_items", "task_key=?", dto.getKeyValues());
// #32782 指示者テーブル関連削除 end
delete("t_task_report", "task_key=?", dto.getKeyValues());
delete("t_task_report_items", "task_key=?", dto.getKeyValues());
delete("t_inspect_task_report", "task_key=?", new String[] { dto.taskKey });
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
/**
* Created by leej on 2018/08/31.
*/
public class TaskDirectionsDao extends AbstractDao {
private static final String TAG = "TaskDirectionsDao";
/*package*/ TaskDirectionsDao() {
}
@Override
protected TaskDirectionsDto convert(Cursor cursor) {
TaskDirectionsDto dto = new TaskDirectionsDto();
int column = cursor.getColumnIndex("task_key");
if (column != -1) {
dto.taskKey = cursor.getString(column);
}
column = cursor.getColumnIndex("json_data");
if (column != -1) {
dto.jsonData = cursor.getString(column);
}
column = cursor.getColumnIndex("attached_file_name");
if (column != -1) {
dto.attachedFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("local_attached_file_name");
if (column != -1) {
dto.localAttachedFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("attached_file_send_flg");
if (column != -1) {
dto.attachedFileSendFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("data_send_flg");
if (column != -1) {
dto.dataSendFlg = toBool(cursor.getInt(column));
}
// t_taskテーブルへINNER JOINで取得したカラム取得
column = cursor.getColumnIndex("task_hotspot_info");
if (column != -1) {
dto.taskHotSpotInfo = cursor.getString(column);
}
column = cursor.getColumnIndex("del_flg");
if (column != -1) {
dto.delFlg = toBool(cursor.getInt(column));
}
return dto;
}
public void insert(TaskDirectionsDto dto) {
insert("insert into t_task_directions "
+ "(task_key, "
+ "json_data, "
+ "attached_file_name, "
+ "local_attached_file_name, "
+ "attached_file_send_flg, "
+ "data_send_flg) "
+ "values "
+ "(?,?,?,?,?,?)",
dto.getInsertValues());
}
public List<TaskDirectionsDto> getTaskDirectionsByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select ttd.* ");
sb.append(" from t_task_directions ttd ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class);
}
public TaskDirectionsDto getTaskDirections(String taskKey) {
return rawQueryGetDto("select * from t_task_directions where task_key=?", new String[]{"" + taskKey}, TaskDirectionsDto.class);
}
public String getTaskDirectionsAttachedFileName(String taskKey) {
return rawQueryGetString("select local_attached_file_name from t_task_directions where task_key=?", new String[]{"" + taskKey});
}
public boolean update(TaskDirectionsDto dto) {
long count = update("update t_task_directions "
+ "set "
+ "json_data=?, "
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "attached_file_send_flg=?, "
+ "data_send_flg=? "
+ "where task_key=?",
dto.getUpdateValues());
return count > 0;
}
public boolean isExistSendTaskData(Long operationId) {
return getSendableTaskData(operationId).size() > 0;
}
public List<TaskDirectionsDto> getSendableTaskData(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_task_directions ttd ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE ttd.data_send_flg = 1");
sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class);
}
public List<TaskDirectionsDto> getSendableTaskData(Long operationId, String taskKey) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_task_directions ttd ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE ttd.data_send_flg = 1");
sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey}, TaskDirectionsDto.class);
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsItemsDto;
/**
* Created by leej on 2018/08/31.
*/
public class TaskDirectionsItemsDao extends AbstractDao {
/*package*/ TaskDirectionsItemsDao() {
}
@Override
protected TaskDirectionsItemsDto convert(Cursor cursor) {
TaskDirectionsItemsDto dto = new TaskDirectionsItemsDto();
int column = cursor.getColumnIndex("task_key");
if (column != -1) {
dto.taskKey = cursor.getString(column);
}
column = cursor.getColumnIndex("item_key");
if (column != -1) {
dto.itemKey = cursor.getString(column);
}
column = cursor.getColumnIndex("input_value");
if (column != -1) {
dto.inputValue = cursor.getString(column);
}
return dto;
}
public void insertTaskDirectionsItems(TaskDirectionsItemsDto dto) {
insert("insert into t_task_directions_items (task_key, item_key, input_value) values (?,?,?)", dto.getInsertValues());
}
public List<TaskDirectionsItemsDto> getTaskDirectionsItemByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_directions_items where task_key=?", new String[]{"" + taskKey}, TaskDirectionsItemsDto.class);
}
public List<TaskDirectionsItemsDto> getTaskDirectionsItemByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select distinct ttdi.* ");
sb.append(" from t_task_directions_items ttdi ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttdi.task_key ");
sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsItemsDto.class);
}
public boolean updateTaskDirectionsItems(TaskDirectionsItemsDto dto) {
long count = update("update t_task_directions_items set input_value=? where item_key=? and task_key=? ", dto.getUpdateValues());
return (count > 0);
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.data.dao;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* Created by leej on 2018/09/10.
......@@ -53,13 +56,10 @@ public class TaskReportDao extends AbstractDao {
if (column != -1) {
dto.delFlg = toBool(cursor.getInt(column));
}
// #32782 指示者テーブル関連削除 start
// TODO append
// column = cursor.getColumnIndex("reportor_flag");
// if (column != -1) {
// dto.reporterFlag = toBool(cursor.getInt(column));
// }
// #32782 指示者テーブル関連削除 end
column = cursor.getColumnIndex("reported_flag");
if (column != -1) {
dto.reportedFlag = toBool(cursor.getInt(column));
}
return dto;
}
......@@ -71,14 +71,14 @@ public class TaskReportDao extends AbstractDao {
+ "attached_file_name, "
+ "local_attached_file_name, "
+ "attached_file_send_flg, "
+ "data_send_flg) "
// #32782 指示者テーブル関連削除 start
// TODO append
// + "reporter_flag) "
+ "data_send_flg, "
+ "task_report_id, "
+ "task_report_info_id, "
+ "report_start_date, "
+ "report_end_date, "
+ "reported_flg) "
+ "values "
// + "(?,?,?,?,?,?,?)",
+ "(?,?,?,?,?,?)",
// #32782 指示者テーブル関連削除 end
+ "(?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
}
......@@ -91,11 +91,28 @@ public class TaskReportDao extends AbstractDao {
sb.append(" ON tt.task_key == ttr.task_key ");
sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.operation_id = ?");
sb.append(" ORDER BY task_report_id ASC, report_start_date ASC");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
}
public TaskReportDto getTaskReport(String taskKey) {
return rawQueryGetDto("select * from t_task_report where task_key=?", new String[]{"" + taskKey}, TaskReportDto.class);
/**
* 作業キーと作業報告タイプで作業報告データ取得
* @param taskKey
* @param taskReportLevel
* @return
*/
public TaskReportDto getTaskReport(String taskKey, Integer taskReportLevel) {
return rawQueryGetDto("select * from t_task_report where task_key=? AND task_report_level=?", new String[]{ "" + taskKey, "" + taskReportLevel }, TaskReportDto.class);
}
/**
* 作業キーで報告リストを取得
* @param taskKey
* @return
*/
public List<TaskReportDto> getTaskReportListByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_report where task_key=? ORDER BY task_report_id, report_start_date", new String[]{ "" + taskKey }, TaskReportDto.class);
}
public boolean update(TaskReportDto dto) {
......@@ -105,11 +122,12 @@ public class TaskReportDao extends AbstractDao {
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "attached_file_send_flg=?, "
+ "data_send_flg=? "
// #32782 指示者テーブル関連削除 start
// TODO append
// + "reporter_flag=? "
// #32782 指示者テーブル関連削除 end
+ "data_send_flg=?, "
+ "task_report_id=?, "
+ "task_report_info_id=?, "
+ "report_start_date=?, "
+ "report_end_date=?, "
+ "reported_flg=? "
+ "where task_key=?",
dto.getUpdateValues());
return count > 0;
......@@ -137,11 +155,15 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
}
// #32782 指示者テーブル関連削除 start
// TODO append
// public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey, boolean reporterFlag) {
public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey) {
// #32782 指示者テーブル関連削除 end
/**
* 送信フラグがtrueのデータを取得
* @param operationId
* @param taskKey
* @param taskReportLevel
* @return
*/
public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey, int taskReportLevel) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_task_report ttr ");
......@@ -151,30 +173,139 @@ public class TaskReportDao extends AbstractDao {
sb.append(" WHERE ttr.data_send_flg = 1");
sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?");
// #32782 指示者テーブル関連削除 start
// TODO append
// sb.append(" AND ttr.repertor_flag = ?");
// return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey, "" + reporterFlag}, TaskReportDto.class);
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey}, TaskReportDto.class);
// #32782 指示者テーブル関連削除 end
sb.append(" AND ttr.task_report_level = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey, "" + taskReportLevel}, TaskReportDto.class);
}
// #32926 作業報告画面改善 start
// taskReportLevel によって添付ファイルを取得する
public String getTaskReportAttachedFileName(String taskKey, String taskReportLevel) {
return rawQueryGetString("select local_attached_file_name from t_task_report where task_key=?", new String[]{"" + taskKey, "" + taskReportLevel});
/**
*
* taskReportLevel によって添付ファイル名を取得する
* @param taskKey
* @param taskReportLevel
* @return
*/
public String getTaskReportAttachedFileName(String taskKey, int taskReportLevel) {
return rawQueryGetString("select local_attached_file_name from t_task_report where task_key=? AND task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel});
}
// #32926 作業報告画面改善 end
public List<TaskReportDto> selectByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_report where task_key=?", new String[]{ taskKey }, TaskReportDto.class);
public List<TaskReportDto> selectByTaskKey(String taskKey, int taskReportLevel) {
return rawQueryGetDtoList("select * from t_task_report where task_key=? and task_report_level", new String[]{ "" + taskKey, "" + taskReportLevel }, TaskReportDto.class);
}
public List<TaskReportDto> selectAll() {
return rawQueryGetDtoList("select * from t_task_report", null, TaskReportDto.class);
}
public void deleteAll() {
delete("t_task_report", null, null);
/**
* データの存在チェック
* @param taskKey
* @param taskReportLevel
* @return
*/
public boolean isExistTaskReport(String taskKey, Integer taskReportLevel) {
return rawQueryGetInt("select COUNT(*) from t_task_report where task_key=? AND task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel }) > 0;
}
/**
* 定期点検用の報告更新
* @param dto
* @return
*/
public boolean updateRoutineTask(TaskReportDto dto) {
long count = update("update t_task_report "
+ "set "
+ "report_end_date=?, "
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "json_data=?, "
+ "data_send_flag=?, "
+ "attached_file_send_flag=? "
+ "reported_flag=? "
+ "where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)",
new Object[]{dto.reportEndDate, dto.attachedFileName, dto.localAttachedFileName, dto.jsonData, dto.dataSendFlg, dto.attachedFileSendFlg, dto.reportedFlag, dto.taskKey, dto.taskReportId, dto.reportStartDate});
return count > 0;
}
/**
* テーブル物理削除(定期点検専用)
* @param dto
*/
public void deleteRoutineTaskReport(TaskReportDto dto) {
delete("t_task_report", "task_key=? and task_report_level=? task_report_id=? and datetime(report_start_date)=datetime(?, 'utc')", new String[] { dto.taskKey, "" + dto.taskReportLevel, "" + dto.taskReportId, DateTimeUtil.toString(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen) });
}
/**
* 定期点検報告データで最後の時間データ取得
* @param operationId
* @return
*/
public TaskReportDto getLastRoutineTaskReportData(long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select tr.* ");
sb.append(" from t_task_report tr ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tt.operation_id = ? ORDER BY tr.report_start_date DESC LIMIT 1");
List<TaskReportDto> dtoList = rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, TaskReportDto.class);
if (dtoList != null && dtoList.size() > 0) {
return dtoList.get(0);
} else {
TaskReportDto dto = new TaskReportDto();
dto.taskReportId = 0;
return dto;
}
}
/**
* 定期点検の報告データ取得
* @param taskKey
* @param taskReportId
* @param reportStartDate
* @return
*/
public TaskReportDto getRoutineTaskReportUtc(String taskKey, int taskReportId, String reportStartDate){
return rawQueryGetDto("select * from t_task_report where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?, 'utc')", new String[]{ taskKey, "" + taskReportId, reportStartDate }, TaskReportDto.class);
}
/**
* 定期点検のSQL専用のため、taskReportId, report_start_dateが存在するデータの条件追加
* @param operationId
* @return
*/
public boolean existsToDoRoutineTaskReportData(long operationId) {
String currDate = DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen);
StringBuilder sb = new StringBuilder();
sb.append(" select count(*) ");
sb.append(" from t_task_report tr ");
sb.append(" inner join t_task tt ON tt.task_key == tr.task_key ");
sb.append(" WHERE tt.del_flg = 0 ");
sb.append(" AND tt.operation_id = ? ");
// 定期点検のみ
sb.append(" AND tr.task_report_id != 0");
sb.append(" AND tr.report_start_date IS NOT NULL");
sb.append(" AND datetime(report_end_date) >= datetime(?, 'utc') ");
return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, currDate }) > 0;
}
/**
* 定期点検報告の添付zipファイル名を取得
* @param taskKey
* @param taskReportId
* @param reportStartDate
* @return
*/
public String getRoutineTaskReportAttachedFileName(String taskKey, int taskReportId, String reportStartDate) {
return rawQueryGetString("select local_attached_file_name from t_inspect_task_report where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)", new String[]{ taskKey, "" + taskReportId, reportStartDate });
}
/**
* 作業キーで作業時間が存在する作業報告データ取得(定期点検)
* @param taskKey
* @return
*/
public List<TaskReportDto> getNotNullStartDateTaskReportByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_report where task_key=? AND report_start_date IS NOT NULL", new String[]{ taskKey }, TaskReportDto.class);
}
}
......@@ -22,6 +22,12 @@ public class TaskReportItemsDao extends AbstractDao {
if (column != -1) {
dto.taskKey = cursor.getString(column);
}
column = cursor.getColumnIndex("task_report_level");
if (column != -1) {
dto.taskReportLevel = cursor.getInt(column);
}
column = cursor.getColumnIndex("item_key");
if (column != -1) {
dto.itemKey = cursor.getString(column);
......@@ -35,11 +41,11 @@ public class TaskReportItemsDao extends AbstractDao {
}
public void insertTaskReportItems(TaskReportItemsDto dto) {
insert("insert into t_task_report_items (task_key, item_key, input_value) values (?,?,?)", dto.getInsertValues());
insert("insert into t_task_report_items (task_key, task_report_level, item_key, input_value) values (?,?,?,?)", dto.getInsertValues());
}
public List<TaskReportItemsDto> getTaskReportItemByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_report_items where task_key=?", new String[]{"" + taskKey}, TaskReportItemsDto.class);
public List<TaskReportItemsDto> getTaskReportItemByTaskKey(String taskKey, int taskReportLevel) {
return rawQueryGetDtoList("select * from t_task_report_items where task_key=? and task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel}, TaskReportItemsDto.class);
}
public List<TaskReportItemsDto> getTaskReportItemByOperationId(Long operationId) {
......@@ -55,7 +61,7 @@ public class TaskReportItemsDao extends AbstractDao {
}
public boolean updateTaskReportItems(TaskReportItemsDto dto) {
long count = update("update t_task_report_items set input_value=? where item_key=? and task_key=? ", dto.getUpdateValues());
long count = update("update t_task_report_items set input_value=? where task_report_level=? and item_key=? and task_key=? ", dto.getUpdateValues());
return (count > 0);
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.TaskWorkerGroupDto;
import jp.agentec.abook.abv.bl.dto.WorkerGroupDto;
/**
* Created by leej on 2019/03/19.
*/
public class TaskWorkerGroupDao extends AbstractDao {
private static final String TAG = "TaskReportDao";
/*package*/ TaskWorkerGroupDao() {
}
@Override
protected TaskWorkerGroupDto convert(Cursor cursor) {
TaskWorkerGroupDto dto = new TaskWorkerGroupDto();
int column = cursor.getColumnIndex("task_report_level");
if (column != -1) {
dto.taskReportLevel = cursor.getInt(column);
}
column = cursor.getColumnIndex("operation_id");
if (column != -1) {
dto.operationId = cursor.getLong(column);
}
column = cursor.getColumnIndex("group_id");
if (column != -1) {
dto.groupId = cursor.getInt(column);
}
column = cursor.getColumnIndex("group_name");
if (column != -1) {
dto.groupName = cursor.getString(column);
}
return dto;
}
public void insert(TaskWorkerGroupDto dto) {
insert("insert into r_task_worker_group "
+ "(task_report_level, "
+ "operation_id, "
+ "group_id ) "
+ "values "
+ "(?,?,?)",
dto.getInsertValues());
}
/**
* 作業に紐づいた作業担当グループを削除
* @param operationId
*/
public void deleteByOperationId(Long operationId) {
delete("r_task_worker_group", "operation_id=?", new String[]{""+ operationId});
}
/**
* 作業IDに紐づいた作業担当グループを取得
* inner joing m_worker_group(作業名取得)
* @param operationId
* @return
*/
public List<TaskWorkerGroupDto> getTaskWorkerGroupByOperationId(Long operationId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT rtwg.task_report_level, rtwg.operation_id, rtwg.group_id, mwg.group_name ");
sql.append(" FROM r_task_worker_group AS rtwg ");
sql.append(" INNER JOIN m_worker_group AS mwg ");
sql.append(" ON rtwg.group_id = mwg.group_id ");
sql.append(" WHERE rtwg.operation_id = ? ");
sql.append(" ORDER BY rtwg.task_report_level DESC ");
Logger.v(TAG, "sql=%s", sql);
return rawQueryGetDtoList(sql.toString(), new String[]{""+ operationId}, TaskWorkerGroupDto.class);
}
}
......@@ -59,13 +59,44 @@ public class WorkerGroupDao extends AbstractDao {
return count > 0;
}
public boolean delete(WorkerGroupDto dto) {
long ret = delete("m_worker_group", "group_id=?", dto.getKeyValues());
return ret > 0;
/**
* 作業グループ削除
* @param dto
*/
public void delete(WorkerGroupDto dto) {
delete("r_task_worker_group", "group_id=?", dto.getKeyValues());
delete("m_worker_group", "group_id=?", dto.getKeyValues());
}
/**
* グループIDで削除
* @param groupId
* @return
*/
public void deleteById(Integer groupId) {
String[] keyValue = new String[]{""+ groupId};
delete("r_task_worker_group", "group_id=?", keyValue);
delete("m_worker_group", "group_id=?", keyValue);
}
public void deleteAll() {
delete("m_worker_group", null, null);
}
/**
* グループIDで存在チェック
* @param groupId
* @return
*/
public boolean isExist(Integer groupId) {
return rawQueryGetInt("select COUNT(*) from m_worker_group where group_id=?", new String[]{"" + groupId }) > 0;
}
/**
* 全てのグループID取得
* @return
*/
public List<Integer> getAllWorkerGroupId() {
return rawQueryGetIntegerList("select group_id from m_worker_group order by group_id", null);
}
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ public class ROperationContent extends SQLiteTableScript {
sql.append(" , content_id BIGINT NOT NULL ");
sql.append(" , operation_content_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (operation_id, content_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_project (operation_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id) ");
sql.append(" , FOREIGN KEY (content_id) REFERENCES t_content (content_id)");
sql.append(" ) ");
......
......@@ -4,15 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
/**
* Created by leej on 2018/08/31.
* Created by leej on 2019/03/18.
*/
public class TTaskDirectionsItems extends SQLiteTableScript {
public class RTaskWorkerGroup extends SQLiteTableScript {
public TTaskDirectionsItems() {
public RTaskWorkerGroup() {
super();
}
......@@ -21,10 +20,13 @@ public class TTaskDirectionsItems extends SQLiteTableScript {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_task_directions_items ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , item_key VARCHAR(64) ");
sql.append(" , input_value VARCHAR(64) ");
sql.append(" CREATE TABLE r_task_worker_group ( ");
sql.append(" task_report_level INTEGER default 0 ");
sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , group_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (task_report_level, operation_id, group_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id) ");
sql.append(" , FOREIGN KEY (group_id) REFERENCES m_worker_group (group_id)");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -21,7 +21,7 @@ public class TOperation extends SQLiteTableScript {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_project ( ");
sql.append(" CREATE TABLE t_operation ( ");
sql.append(" operation_id BIGINT NOT NULL ");
sql.append(" , operation_name VARCHAR(128) ");
sql.append(" , operation_type INTEGER NOT NULL ");
......@@ -32,10 +32,11 @@ public class TOperation extends SQLiteTableScript {
sql.append(" , content_creating_flg INTEGER NOT NULL ");
sql.append(" , edit_lock_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , need_sync_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , report_update_type INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , operation_report_type INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , report_type INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , report_cycle INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report_update INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report_history SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , enable_report_edit SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (operation_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......@@ -52,13 +53,13 @@ public class TOperation extends SQLiteTableScript {
// }
//
// if (oldVersion < DatabaseVersions.Plus_1_9_3_5) { // カラムの追加
// ddl.add(" ALTER TABLE t_project ADD COLUMN report_update_type INTEGER NOT NULL DEFAULT 0 ");
// ddl.add(" ALTER TABLE t_operation ADD COLUMN report_update_type INTEGER NOT NULL DEFAULT 0 ");
// }
//
// if (oldVersion < DatabaseVersions.Plus_1_9_4) { // カラムの追加
// ddl.add(" ALTER TABLE t_project ADD COLUMN project_report_type INTEGER NOT NULL DEFAULT 0 ");
// ddl.add(" ALTER TABLE t_project ADD COLUMN report_cycle INTEGER NOT NULL DEFAULT 0 ");
// ddl.add(" ALTER TABLE t_project ADD COLUMN enable_report_update INTEGER NOT NULL DEFAULT 0 ");
// ddl.add(" ALTER TABLE t_operation ADD COLUMN project_report_type INTEGER NOT NULL DEFAULT 0 ");
// ddl.add(" ALTER TABLE t_operation ADD COLUMN report_cycle INTEGER NOT NULL DEFAULT 0 ");
// ddl.add(" ALTER TABLE t_operation ADD COLUMN enable_report_update INTEGER NOT NULL DEFAULT 0 ");
// }
// return ddl;
return null;
......
......@@ -27,7 +27,7 @@ public class TPushMessage extends SQLiteTableScript {
sql.append(" , push_message TEXT ");
sql.append(" , reading_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (push_message_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_project (operation_id) ");
sql.append(" , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
/**
* Created by seo-y on 2018/12/17.
*/
public class TRoutineTaskReport extends SQLiteTableScript {
public TRoutineTaskReport() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE IF NOT EXISTS t_inspect_task_report ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , task_report_id INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , task_report_info_id INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , report_start_date DATETIME NOT NULL ");
sql.append(" , report_end_date DATETIME ");
sql.append(" , attached_file_name TEXT ");
sql.append(" , local_attached_file_name TEXT ");
sql.append(" , json_data TEXT ");
sql.append(" , data_send_flag BOOLEAN DEFAULT 0 ");
sql.append(" , attached_file_send_flag BOOLEAN DEFAULT 0 ");
sql.append(" , reported_flag BOOLEAN DEFAULT 0 ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object[] params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
/**
* Created by leej on 2018/08/31.
*/
public class TTaskDirections extends SQLiteTableScript {
public TTaskDirections() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_task_directions ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , json_data TEXT NOT NULL ");
sql.append(" , attached_file_name TEXT ");
sql.append(" , local_attached_file_name TEXT ");
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 ");
sql.append(" , data_send_flg BOOLEAN DEFAULT 0 ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object[] params) {
return null;
}
}
......@@ -28,10 +28,13 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" , local_attached_file_name TEXT ");
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 ");
sql.append(" , data_send_flg BOOLEAN DEFAULT 0 ");
// #32782 指示者テーブル関連削除 start
// TODO append
// sql.append(" , reporter_flag BOOLEAN DEFAULT 0 ");
// #32782 指示者テーブル関連削除 end
sql.append(" , report_start_date DATETIME ");
sql.append(" , report_end_date DATETIME ");
sql.append(" , task_report_id INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , task_report_info_id INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , task_report_level SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , reported_flg BOOLEAN DEFAULT 0 ");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -23,6 +23,7 @@ public class TTaskReportItems extends SQLiteTableScript {
sql.append(" CREATE TABLE t_task_report_items ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , task_report_level INTEGER default 0 ");
sql.append(" , item_key VARCHAR(64) ");
sql.append(" , input_value VARCHAR(64) ");
sql.append(" ) ");
......
......@@ -23,16 +23,16 @@ public class OperationDto extends AbstractDto {
public List<OperationContentDto> operationContentDtoList;
public List<TaskDto> taskDtoList;
public List<PushMessageDto> pushMessageList;
public int reportUpdateType; //0:履歴無し 1:新規追加 2:更新
public int operationReportType; //0:通常 1:定期点検
public int reportType; //0:通常 1:定期点検
public int reportCycle; //0:日次 1:月次 2:年次
public int enableReportUpdate; //0:不可 1:可
public String reportPeriod; //定期点検、2018/12/20 08:10:00 ~ 2018/12/21 18:10:00
public int reportCount; //定期点検、作業数
public int enableReportHistory; // 0: 履歴無し, 1: 履歴可
public int enableReportEdit; // 作業編集可能区分
// #32926 作業報告画面改善 start
public int reportType; // 作業報告タイプ 0:報告 1:定期点検 2:報告(回答)
// #32926 作業報告画面改善 end
// 作業担当グループリスト
public List<TaskWorkerGroupDto> taskWorkerGroupDtoList;
public boolean equalsLastEdit(OperationDto dto) {
if (dto != null) {
......@@ -45,12 +45,12 @@ public class OperationDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportUpdateType, operationReportType, reportCycle, enableReportUpdate };
return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportUpdateType, operationReportType, reportCycle, enableReportUpdate, operationId };
return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit, operationId };
}
@Override
......
package jp.agentec.abook.abv.bl.dto;
/**
* Created by leej on 2018/08/31.
*/
public class TaskDirectionsDto extends AbstractDto {
public String taskKey;
public String jsonData;
public String attachedFileName;
public String localAttachedFileName;
public boolean attachedFileSendFlg;
public boolean dataSendFlg;
public String taskHotSpotInfo;
public boolean delFlg;
@Override
public Object[] getInsertValues() {
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskKey };
}
@Override
public String[] getKeyValues() {
return new String[] { "" + taskKey };
}
}
package jp.agentec.abook.abv.bl.dto;
/**
* Created by leej on 2018/09/03.
*/
public class TaskDirectionsItemsDto extends AbstractDto {
public String taskKey;
public String itemKey;
public String inputValue;
@Override
public String[] getKeyValues() {
return new String[] {""+taskKey};
}
@Override
public Object[] getInsertValues() {
return new Object[] {taskKey, itemKey, inputValue};
}
@Override
public Object[] getUpdateValues() {
return new Object[] { inputValue, itemKey, taskKey };
}
}
\ No newline at end of file
......@@ -14,22 +14,12 @@ public class TaskDto extends AbstractDto {
public String taskCode;
public Integer taskStatus;
public String taskHotSpotInfo;
public List<TaskReportDto> taskReportDtoList;
public boolean delFlg;
// #32782 指示者テーブル関連削除 start
// TODO TaskDirectionDto から TaskReportDto に変更、taskDirectionsDto 名を変更必要
// public TaskReportDto taskDirectionsDto;
public TaskDirectionsDto taskDirectionsDto;
// #32782 指示者テーブル関連削除 end
public TaskReportDto taskReportDto;
public int taskReportId;
public List<RoutineTaskReportDto> RoutineTaskReportList;
// #32926 作業報告画面改善 start
public boolean taskHasAuthority; // タスク別の権限
public int taskReportLevel; // 作業報告階層
// #32926 作業報告画面改善 end
@Override
public Object[] getInsertValues() {
......
......@@ -10,41 +10,31 @@ public class TaskReportDto extends AbstractDto {
public String taskKey;
public String jsonData;
public String attachedFileName;
public String localAttachedFileName;
public boolean attachedFileSendFlg;
public boolean dataSendFlg;
public String taskHotSpotInfo;
public boolean delFlg;
// #32782 指示者テーブル関連削除 start
public boolean reporterFlag;
//  作業報告詳細リスト
public int taskReportLevel; // 作業報告レベル
public int taskHasAuthority; // 権限
public int taskReportId; // 作業報告ID
public int taskReportInfoId; // 作業報告情報ID
public Date reportStartDate; // 作業開始日
public Date reportEndDate; // 作業終了日
public int enableReport; // 報告可能区分
public boolean reportedFlag; //
// #32782 指示者テーブル関連削除 end
public String attachedFileName;
public String taskReportInfo;
public boolean reportedFlag; // 定期点検用
@Override
public Object[] getInsertValues() {
// #32782 指示者テーブル関連削除 start
// TODO change
// return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag };
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg};
// #32782 指示者テーブル関連削除 end
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, reportedFlag};
}
@Override
public Object[] getUpdateValues() {
// #32782 指示者テーブル関連削除 start
// TODO change
// return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag, taskKey };
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskKey };
// #32782 指示者テーブル関連削除 end
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, reportedFlag, taskKey };
}
@Override
......
......@@ -7,6 +7,7 @@ package jp.agentec.abook.abv.bl.dto;
public class TaskReportItemsDto extends AbstractDto {
public String taskKey;
public int taskReportLevel;
public String itemKey;
public String inputValue;
......@@ -17,11 +18,11 @@ public class TaskReportItemsDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[] {taskKey, itemKey, inputValue};
return new Object[] {taskKey, taskReportLevel, itemKey, inputValue};
}
@Override
public Object[] getUpdateValues() {
return new Object[] { inputValue, itemKey, taskKey };
return new Object[] { inputValue, taskReportLevel, itemKey, taskKey };
}
}
\ No newline at end of file
package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/**
* Created by leej on 2019/03/19.
*/
public class TaskWorkerGroupDto extends AbstractDto {
public int taskReportLevel;
public long operationId;
public int groupId;
// inner join 用
public String groupName;
// OperationListJSONで取得用
public List<Integer> groupList;
@Override
public Object[] getInsertValues() {
return new Object[] { taskReportLevel, operationId, groupId};
}
@Override
public String[] getKeyValues() {
return new String[] { "" + operationId };
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/ic_filter_on"/>
<item
android:drawable="@drawable/ic_filter_off"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/ic_sort_on"/>
<item
android:drawable="@drawable/ic_sort_off"/>
</selector>
\ No newline at end of file
......@@ -15,4 +15,6 @@
<dimen name="text_size_large">22sp</dimen>
<dimen name="operation_scale_zoom_margin_dp">25dp</dimen>
<dimen name="operation_pin_icon_width">35dp</dimen>
<dimen name="operation_pin_icon_height">60dp</dimen>
</resources>
......@@ -15,4 +15,6 @@
<dimen name="weather_text_large_size">13sp</dimen>
<dimen name="operation_scale_zoom_margin_dp">10dp</dimen>
<dimen name="operation_pin_icon_width">18dp</dimen>
<dimen name="operation_pin_icon_height">23dp</dimen>
</resources>
......@@ -20,7 +20,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:background="@drawable/icon_sort" />
android:background="@drawable/ic_display_list" />
<ImageButton
android:id="@+id/icon_filter"
......
......@@ -20,7 +20,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:background="@drawable/icon_sort" />
android:background="@drawable/ic_display_list" />
<ImageButton
android:id="@+id/icon_filter"
......
package jp.agentec.abook.abv.launcher.android;
import java.util.ArrayList;
import java.util.Stack;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.OperationReportType;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
......@@ -77,7 +75,8 @@ public class ABVUIDataCache {
}
public int getViewMode() {
return viewMode;
return PreferenceUtil.getUserPref(context, UserPrefKey.VIEW_MODE, 0);
// return viewMode;
}
public void setViewMode(int viewMode) {
......@@ -141,9 +140,9 @@ public class ABVUIDataCache {
mOperationReportTypes = operationReportTypes;
} else {
mOperationReportTypes = new ArrayList<Integer>();
mOperationReportTypes.add(OperationReportType.DEFAULT);
mOperationReportTypes.add(OperationReportType.ROUTINE_TASK);
mOperationReportTypes.add(OperationReportType.REPORT_TYPE);
mOperationReportTypes.add(OperationReportType.ROUTINE_TASK);
mOperationReportTypes.add(OperationReportType.REPORT_RESPONSE_TYPE);
}
return mOperationReportTypes;
......
......@@ -107,7 +107,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public Long mOperationId;
protected int mXWalkOpenType = -1;
protected int mOperationType;
protected int reportUpdateType; //0:履歴無し 1:新規追加 2:更新
protected int enableReportHistory; //0:履歴無し 1:履歴可
protected String mContentPath;
protected int mStatusCode;
protected boolean isOperationPdf = false;
......@@ -172,7 +172,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mStatusCode = 0;
}
reportUpdateType = operationDto.reportUpdateType;
enableReportHistory = operationDto.enableReportHistory;
linkUrl = intent.getStringExtra("LINKURL"); // LinkURL
......@@ -787,7 +787,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
helpViewType = Constant.HelpViewType.ListOperationDirector;
break;
case Constant.XWalkOpenType.TASK_REPORT:
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
helpViewType = Constant.HelpViewType.RoutineTaskOperation;
} else {
helpViewType = Constant.HelpViewType.ListOperationReporter;
......@@ -824,7 +824,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) {
helpViewType = Constant.HelpViewType.DirectorTask;
} else if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
helpViewType = Constant.HelpViewType.RoutineTaskOperationReport;
} else {
helpViewType = Constant.HelpViewType.ReportTask;
......@@ -855,24 +855,20 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mCmd = abookCheckParam.get(ABookKeys.CMD);
mTaskKey = abookCheckParam.get(ABookKeys.TASK_KEY);
// #32926 作業報告画面改善 start
int taskReportLevel = 0; // 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答))
if (abookCheckParam.containsKey(ABookKeys.TASK_REPORT_LEVEL)) {
taskReportLevel = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_LEVEL)); // 作業報告レベル
}
// #32926 作業報告画面改善 end
int taskReportId = 0;
String reportStartDate = "";
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
taskReportId = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE);
}
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_INSERT_TASK_DIRECTIONS, ABookKeys.CMD_UPDATE_TASK_DIRECTIONS, ABookKeys.CMD_DELETE_TASK_DIRECTIONS, ABookKeys.CMD_CANCEL_TASK_DIRECTIONS,
ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT, ABookKeys.CMD_DELETE_TASK_REPORT, ABookKeys.CMD_CANCEL_TASK_REPORT,
ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
ABookKeys.CMD_DELETE_TASK_REPORT, ABookKeys.CMD_CANCEL_TASK_REPORT, ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
boolean isError = false;
try {
......@@ -881,19 +877,15 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
if (isOperationPdf && operationTaskDto != null && StringUtil.equalsAny(mCmd,
ABookKeys.CMD_INSERT_TASK_DIRECTIONS,
ABookKeys.CMD_UPDATE_TASK_DIRECTIONS,
ABookKeys.CMD_INSERT_TASK_REPORT,
ABookKeys.CMD_UPDATE_TASK_REPORT,
ABookKeys.CMD_MOVE_HOT_SPOT,
ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
String taskCode = "";
// #32781 start
// TODO TASK_DIRECTIONSの削除され、TASK_REPORTに変更する
if (abookCheckParam.get(ABookKeys.TASK_DIRECTIONS) != null) {
JSONObject direction = new JSONObject(abookCheckParam.get(ABookKeys.TASK_DIRECTIONS));
JSONObject taskJson = direction.getJSONObject(ABookKeys.TASK);
if (abookCheckParam.get(ABookKeys.TASK_REPORT) != null) {
JSONObject tastReportJson = new JSONObject(abookCheckParam.get(ABookKeys.TASK_REPORT));
JSONObject taskJson = tastReportJson.getJSONObject(ABookKeys.TASK);
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
String itemKey = (String) taskKeys.next();
......@@ -902,7 +894,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
}
}
// #32781 end
if (abookCheckParam.get(ABookKeys.HOT_SPOT) != null) {
JSONObject hotSpot = new JSONObject(abookCheckParam.get(ABookKeys.HOT_SPOT));
......@@ -930,12 +921,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
return null;
}
};
// #32926 作業報告画面改善 start
ABookCheckWebViewHelper.getInstance().doABookCheckParam(ABVContentViewActivity.this,
mCmd, mTaskKey, reportUpdateType, abookCheckParam, mOperationId, mContentPath, getContentId(),
operationDto.reportType == Constant.ReportType.Routine, finishCallback,
mCmd, mTaskKey, enableReportHistory, abookCheckParam, mOperationId, mContentPath, getContentId(),
operationDto.reportType, finishCallback,
taskReportLevel);
// #32926 作業報告画面改善 end
} catch(Exception e) {
Logger.e(TAG, "doABookCheckParam error", e);
}
......
......@@ -34,9 +34,10 @@ public abstract class ABVLoginActivity extends ABVNoAuthenticatedActivity {
ABVToastUtil.showMakeText(ABVLoginActivity.this, R.string.fcm_not_supported, Toast.LENGTH_SHORT);
}
});
} else {
serverLoginAndCheckChangeUser(fcmToken);
// FCMトークンを取得できない場合、noneIdでセットしてログインする
fcmToken = "noneId";
}
serverLoginAndCheckChangeUser(fcmToken);
} finally {
closeProgressPopup();
}
......
......@@ -108,9 +108,10 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
String fcmToken = FcmManager.getFcmToken(mContext);
if (fcmToken == null) {
ABVToastUtil.showMakeText(mContext, R.string.fcm_not_supported, Toast.LENGTH_SHORT);
} else {
noAuthenticatedShowMain(isGuestLogin, fcmToken, urlPath);
// FCMトークンを取得できない場合、noneIdでセットしてログインする
fcmToken = "noneId";
}
noAuthenticatedShowMain(isGuestLogin, fcmToken, urlPath);
}
});
}
......
......@@ -9,7 +9,6 @@ import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.SparseBooleanArray;
......@@ -52,11 +51,9 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RoutineTaskDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
......@@ -73,10 +70,8 @@ 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.RoutineTaskReportDao;
import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDirectionsDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
......@@ -152,12 +147,8 @@ public class OperationListActivity extends ABVUIActivity {
private Dialog mPanoEntryDialog;
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
// #32782 指示者テーブル関連削除 start
// TODO delete
private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
// #32782 指示者テーブル関連削除 end
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private RoutineTaskReportDao mRoutineTaskReportDao = AbstractDao.getDao(RoutineTaskReportDao.class);
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
......@@ -204,9 +195,9 @@ public class OperationListActivity extends ABVUIActivity {
vg.addView(child);
// ツールバーのビューモードイメージ変更
if (child instanceof PullToRefreshGridView) {
mViewModeButton.setBackground(getRDrawable(R.drawable.icon_sort));
mViewModeButton.setBackground(getRDrawable(R.drawable.ic_display_list));
} else {
mViewModeButton.setBackground(getRDrawable(R.drawable.btn_view_sub_menu));
mViewModeButton.setBackground(getRDrawable(R.drawable.ic_display_pannel));
}
}
}
......@@ -409,7 +400,7 @@ public class OperationListActivity extends ABVUIActivity {
Logger.d(TAG, "onResume Sync operationId : " + operationId);
if (operationDto != null && operationDto.needSyncFlg) {
// 同期処理後、直列処理で新着更新を行う。
syncOperation(operationId, operationDto.operationReportType);
syncOperation(operationId, operationDto.reportType);
} else {
closeProgressPopup();
}
......@@ -605,31 +596,11 @@ public class OperationListActivity extends ABVUIActivity {
contentPath = ABVEnvironment.getInstance().getPanoImageDirName(ContentFileExtractor.getInstance().getContentCacheDirWithExtract(operationDto.contentId));
}
// 更新タイプが[新規追加]に変わった時の為:残っている作業報告内容削除
if (operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD && mOperationAuthLevel == OperationAuthLevel.WORKER) {
final List<TaskReportDto> listTaskReport = mTaskReportDao.selectAll();
if (listTaskReport != null && listTaskReport.size() > 0) {
long operationId = operationDto.operationId;
for (TaskReportDto taskReportDto : listTaskReport) {
// #32926 作業報告画面改善 start
if (taskReportDto.reporterFlag) {
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskReportDto.taskKey, String.valueOf(taskReportDto.taskReportLevel)));
}
// #32926 作業報告画面改善 end
}
mTaskReportDao.deleteAll();
FileUtil.delete(ABVEnvironment.getInstance().getTempDirPath(operationDto.contentId));
}
}
// プロジェクトの指示/報告表示時、必要なJSONファイル作成
mOperationLogic.createJsonForOpenABookCheckPano(operationDto.operationId, operationDto.contentId, contentPath);
mOperationLogic.createJsonForOperationContent(operationDto.operationId, 0, contentPath, mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR ? true : false, operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK);
mOperationLogic.createJsonForOperationContent(operationDto.operationId, contentPath, operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
mOperationLogic.createJsonForRoutineTaskReport(operationDto.reportCycle, operationDto.enableReportUpdate, mOperationLogic.getLastRoutineTaskReportData(operationDto.operationId).taskReportId, contentPath);
}
......@@ -648,7 +619,7 @@ public class OperationListActivity extends ABVUIActivity {
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, mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR ? Constant.XWalkOpenType.TASK_DERECTION : Constant.XWalkOpenType.TASK_REPORT);
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) {
......@@ -674,7 +645,7 @@ public class OperationListActivity extends ABVUIActivity {
if (operationContentDto != null) {
if (notification.downloadStatus == DownloadStatusType.Succeeded) {
OperationDto operationDto = mOperationLogic.getOperation(operationContentDto.operationId);
syncOperation(operationContentDto.operationId, operationDto.operationReportType, true);
syncOperation(operationContentDto.operationId, operationDto.reportType, true);
} else if (notification.downloadStatus == DownloadStatusType.Failed || notification.downloadStatus == DownloadStatusType.Canceled || notification.downloadStatus == DownloadStatusType.Paused) {
Logger.i(TAG, "syncOperation update is failed downloadStatus : " + notification.downloadStatus);
closeProgressPopup();
......@@ -694,10 +665,10 @@ public class OperationListActivity extends ABVUIActivity {
/**
* プロジェクト同期処理
* @param operationId
* @param operationReportType
* @param reportType
* @param buttonEventFlag
*/
public void syncOperation(final long operationId, int operationReportType, boolean buttonEventFlag) {
public void syncOperation(final long operationId, int reportType, boolean buttonEventFlag) {
Logger.i(TAG, "---sync start");
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
......@@ -727,22 +698,18 @@ public class OperationListActivity extends ABVUIActivity {
return null;
}
};
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
mOperationLogic.sendTaskDirectionsData(operationId, null, progressCallback);
} else {
// 作業報告
if (operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (mOperationLogic.sendRoutineTaskReportSendData(operationId, null, progressCallback) > 0) {
// 報告送信
if (mOperationLogic.sendTaskReportSendData(operationId, progressCallback)) {
// 作業報告タイプが定期点検且つ、P005のエラーの場合、以下のエラーをトーストメッセージで表示
handleErrorMessageToast(R.string.P005);
}
} else {
mOperationLogic.sendTaskReportSendData(operationId, null, progressCallback);
}
}
progressDialogHorizontal.setProgress(60);
// 報告受信
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, buttonEventFlag);
if (operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (buttonEventFlag) {
String dialogMsg = null;
// 定期点検プロジェクトの利用可能日付を取得
......@@ -750,7 +717,7 @@ public class OperationListActivity extends ABVUIActivity {
if (!StringUtil.isNullOrEmpty(avilableDateStr)) {
// 利用可能メッセージ
dialogMsg = String.format(getString(R.string.msg_routineTask_report_available_from), avilableDateStr);
} else if (!mRoutineTaskReportDao.existsToDoRoutineTaskReportData(operationId)) {
} else if (!mTaskReportDao.existsToDoRoutineTaskReportData(operationId)) {
// 作業データが存在しないメッセージ
dialogMsg = getString(R.string.msg_no_report_data);
}
......@@ -862,11 +829,9 @@ public class OperationListActivity extends ABVUIActivity {
OperationDto operationDto = mOperationLogic.getOperation(operationId);
OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId);
List<TaskDto> localTaskList = mTaskDao.selectAllTaskByOperationId(operationId);
List<RoutineTaskReportDto> localRoutineTaskReportList;
Date lastEditDate;
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
RoutineTaskDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getRoutineTaskData(param);
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
//プログレスを40%進行させるための計算
int progress = 0;
......@@ -874,265 +839,154 @@ public class OperationListActivity extends ABVUIActivity {
progress = 40 / json.taskDtoList.size();
}
JSONObject taskReportJson;
for (TaskDto serverTaskDto : json.taskDtoList) {
if (operationDto.reportType == Constant.ReportType.Routine) {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
mTaskDao.update(serverTaskDto);
} else {
mTaskDao.insert(serverTaskDto);
}
localRoutineTaskReportList = mRoutineTaskReportDao.selectRoutineTaskReportByTaskKey(serverTaskDto.taskKey);
List<RoutineTaskReportDto> localRemove = new ArrayList();
List<TaskReportDto> localTaskReportList = mTaskReportDao.getNotNullStartDateTaskReportByTaskKey(serverTaskDto.taskKey);
List<TaskReportDto> localRemove = new ArrayList();
// 先にローカルにしか存在しない事を削除 : DB, files
for (RoutineTaskReportDto routineTaskDto : localRoutineTaskReportList) {
if (!isExistsRoutineTaskReportInList(serverTaskDto.RoutineTaskReportList, routineTaskDto)) {
mOperationLogic.deleteRoutineTaskReport(operationDto.operationId, operationContentDto.contentId, routineTaskDto);
localRemove.add(routineTaskDto);
for (TaskReportDto localTaskReportDto : localTaskReportList) {
if (!isExistsRoutinTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto)) {
mOperationLogic.deleteRoutineTaskReport(operationId, operationContentDto.contentId, localTaskReportDto);
localRemove.add(localTaskReportDto);
}
}
localRoutineTaskReportList.removeAll(localRemove);
localTaskReportList.removeAll(localRemove);
// サーバーからの情報で更新
for (RoutineTaskReportDto routineTaskDto : serverTaskDto.RoutineTaskReportList) {
String reportAttachedFileName = routineTaskDto.attachedFileName;
routineTaskDto.taskKey = serverTaskDto.taskKey;
for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String reportAttachedFileName = taskReportDto.attachedFileName;
taskReportDto.taskKey = serverTaskDto.taskKey;
if (isExistsRoutineTaskReportInList(localRoutineTaskReportList, routineTaskDto)) {
// 添付ファイルが存在する場合、取得して解凍する。
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, routineTaskDto.taskReportId, routineTaskDto.taskReportInfoId, routineTaskDto.reportStartDate, reportAttachedFileName);
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.taskReportId, taskReportDto.taskReportInfoId, taskReportDto.reportStartDate, reportAttachedFileName);
if (isSyncGetTaskFileError) {
return null;
}
if (isExistsRoutinTaskReportInList(localTaskReportList, taskReportDto)) {
// 報告データが存在すると作業報告を更新する
if (routineTaskDto.jsonData != null) {
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, routineTaskDto, false, false, false, false);
if (taskReportDto.jsonData != null) {
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false, false, false);
}
} else {
// 添付ファイルが存在する場合、取得して解凍する。
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, routineTaskDto.taskReportId, routineTaskDto.taskReportInfoId, routineTaskDto.reportStartDate, reportAttachedFileName);
if (isSyncGetTaskFileError) {
return null;
if (taskReportDto.jsonData != null) {
mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false);
}
if (routineTaskDto.jsonData != null) {
mOperationLogic.insertRoutineTaskReport(operationContentDto.operationId, operationContentDto.contentId, routineTaskDto, false, false);
}
}
}
progressCallback.callback(new Integer(progress));
}
lastEditDate = json.lastEditDate;
} else {
// TODO
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
//プログレスを40%進行させるための計算
int progress = 0;
if (json.taskDtoList.size() != 0) {
progress = 40 / json.taskDtoList.size();
}
// #32782 指示者テーブル関連削除 start
// TODO change
/*
// JSONObject taskDirectionJson;
JSONObject taskReportJson;
for (TaskDto taskDto : json.taskDtoList) {
String directionsAttachedFileName = taskDto.taskDirectionsDto.attachedFileName;
String reportAttachedFileName = taskDto.taskReportDto.attachedFileName;
// 0305 start
taskReportJson = new JSONObject(taskDto.taskDirectionsDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus);
// 0305 end
int localTaskIndex = localTaskList.indexOf(taskDto);
if (localTaskIndex >= 0) {
} else {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
// 更新
for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName;
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, directionsAttachedFileName, reportAttachedFileName);
if (isSyncGetTaskFileError) {
try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) {
return null;
}
// #32782 指示者テーブル関連削除 start
// 作業更新
mOperationLogic.updateTaskReport(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
taskReportJson, directionsAttachedFileName, false, false, taskDto.taskHotSpotInfo);
localTaskList.remove(taskDto);
// 報告データが存在すると作業報告を更新する
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReport(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
taskReportJson, reportAttachedFileName, false, false, taskDto.taskHotSpotInfo);
}
// #32782 指示者テーブル関連削除 end
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
// 作業報告を更新
// update
mOperationLogic.updateTaskReport(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId,
taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
} else {
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, directionsAttachedFileName, reportAttachedFileName);
if (isSyncGetTaskFileError) {
return null;
// 作業報告(回答)
if (taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReportReplyLevel(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
}
// #32782 指示者テーブル関連削除 start
// 作業登録
mOperationLogic.insertTaskReport(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskReportJson, directionsAttachedFileName, false, false, taskDto.taskHotSpotInfo);
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReport(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskReportJson, reportAttachedFileName, false, false, taskDto.taskHotSpotInfo);
}
// #32782 指示者テーブル関連削除 end
}
progressCallback.callback(new Integer(progress));
// 更新済みの場合、localTaskListから削除
localTaskList.remove(serverTaskDto);
}
*/
JSONObject taskDirectionJson;
for (TaskDto taskDto : json.taskDtoList) {
String directionsAttachedFileName = taskDto.taskDirectionsDto.attachedFileName;
String reportAttachedFileName = taskDto.taskReportDto.attachedFileName;
taskDirectionJson = new JSONObject(taskDto.taskDirectionsDto.jsonData);
taskDirectionJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus);
// #32926 start
int taskReportLevel = taskDto.taskReportLevel;
// #32926 end
int localTaskIndex = localTaskList.indexOf(taskDto);
if (localTaskIndex >= 0) {
} else {
// 登録
for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName;
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, directionsAttachedFileName, reportAttachedFileName, String.valueOf(taskReportLevel));
if (isSyncGetTaskFileError) {
try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) {
return null;
}
// 作業更新
mOperationLogic.updateTaskDirections(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
taskDirectionJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
localTaskList.remove(taskDto);
// 報告データが存在すると作業報告を更新する
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReport(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false, taskReportLevel);
}
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
mOperationLogic.insertTaskReport(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
} else {
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, directionsAttachedFileName, reportAttachedFileName, String.valueOf(taskReportLevel));
if (isSyncGetTaskFileError) {
return null;
if (taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
}
}
// 作業登録
mOperationLogic.insertTaskDirections(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskDirectionJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReport(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false, taskReportLevel);
}
}
progressCallback.callback(new Integer(progress));
}
// #32782 指示者テーブル関連削除 end
progressCallback.callback(new Integer(progress));
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey);
mTaskDao.delete(taskDto);
}
lastEditDate = json.lastEditDate;
}
progressCallback.callback(new Integer(40));
return lastEditDate;
}
public void refreshTaskFile(final long operationId, final long contentId, final long taskId, final String taskKey, final String directionsAttachedFileName, final String reportAttachedFileName, final String taskReportLevel) throws ABVException, InterruptedException, ZipException, NoSuchAlgorithmException, IOException {
/**
* 添付ファイルが存在する場合、取得して解凍する。
* @param operationId
* @param taskReportLevel
* @param contentId
* @param taskId
* @param taskKey
* @param attachedFileName
* @throws ABVException
* @throws InterruptedException
* @throws ZipException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public void refreshTaskFile(final long operationId, final int taskReportLevel, long contentId, final long taskId, final String taskKey, final String attachedFileName) throws Exception {
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
// #32782 指示者テーブル関連削除 start
String directionsLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey, taskReportLevel);
// #32782 指示者テーブル関連削除 end
// #32926 start
String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey, taskReportLevel);
// #32926 end
int count = 0;
boolean getDirectionsFileFlg = directionsAttachedFileName != null && !directionsAttachedFileName.equals(directionsLocalAttachedFileName);
boolean getReportFileFlg = reportAttachedFileName != null && !reportAttachedFileName.equals(reportLocalAttachedFileName);
if (getDirectionsFileFlg) {
count++;
}
if (mOperationAuthLevel == OperationAuthLevel.WORKER && getReportFileFlg) {
count++;
}
// 同期させるタスクの数をコンストラクタで渡す
final CountDownLatch latch = new CountDownLatch(count);
if (getDirectionsFileFlg) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
if (attachedFileName != null && !attachedFileName.equals(reportLocalAttachedFileName)) {
try {
Logger.i(TAG, "[Get Task Directions Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, directionsAttachedFileName);
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, taskReportLevel));
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, directionsAttachedFileName, 0);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, taskReportLevel), null, true);
} catch (Exception e) {
Logger.e(TAG, e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_error_task_receiving_failed, Toast.LENGTH_LONG);
isSyncGetTaskFileError = true;
}
return null;
}
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);
latch.countDown();
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
if (mOperationAuthLevel == OperationAuthLevel.WORKER && getReportFileFlg) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName);
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, attachedFileName);
// #32926 start
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel));
// #32926 end
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, reportAttachedFileName, 1);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
// #32926 start
ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel),
// #32926 end
null, true);
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, attachedFileName, taskReportLevel);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel),null, true);
} catch (Exception e) {
Logger.e(TAG, e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, Toast.LENGTH_LONG);
isSyncGetTaskFileError = true;
}
return null;
}
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);
latch.countDown();
throw e;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
// 上記の非同期の処理が終了するまで、待つ
latch.await();
}
/**
......@@ -1156,48 +1010,27 @@ public class OperationListActivity extends ABVUIActivity {
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
String reportLocalAttachedFileName = mRoutineTaskReportDao.getRoutineTaskReportAttachedFileName(taskKey, taskReportId, reportStartDateHypn);
int count = 0;
String reportLocalAttachedFileName = mTaskReportDao.getRoutineTaskReportAttachedFileName(taskKey, taskReportId, reportStartDateHypn);
boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName);
if (mOperationAuthLevel == OperationAuthLevel.WORKER && getReportFileFlg) {
count++;
}
// 同期させるタスクの数をコンストラクタで渡す
final CountDownLatch latch = new CountDownLatch(count);
if (mOperationAuthLevel == OperationAuthLevel.WORKER && getReportFileFlg) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
if (getReportFileFlg) {
try {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName);
// #32926 start
int taskReportLevel = 0;
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone, taskReportLevel));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone));
// #32926 end
String outputFilePath = mOperationLogic.getRoutineTaskReportFile(operationId, taskKey, taskId, taskReportId, taskReportInfoId, reportStartDateNone, reportAttachedFileName);
// #32926 start
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone, taskReportLevel), null, true);
ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone), null, true);
// #32926 end
} catch (Exception e) {
Logger.e(TAG, e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, Toast.LENGTH_LONG);
isSyncGetTaskFileError = true;
}
return null;
}
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);
latch.countDown();
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
// 上記の非同期の処理が終了するまで、待つ
latch.await();
}
/**
......@@ -1704,8 +1537,14 @@ public class OperationListActivity extends ABVUIActivity {
}
}
/**
* listDtoの中に第2引数のdtoが存在するかチェックメソッド
* @param listDto リストDto
* @param dto ターゲットDto
* @return
*/
private boolean isExistsTaskInList(List<TaskDto> listDto, TaskDto dto) {
for(TaskDto lDto:listDto) {
for (TaskDto lDto : listDto) {
if (lDto.taskKey.equals(dto.taskKey)) {
return true;
}
......@@ -1713,8 +1552,14 @@ public class OperationListActivity extends ABVUIActivity {
return false;
}
private boolean isExistsRoutineTaskReportInList(List<RoutineTaskReportDto> listDto, RoutineTaskReportDto rDto) {
for(RoutineTaskReportDto lDto:listDto) {
/**
* 定期点検の報告存在チェック
* @param listDto
* @param rDto
* @return
*/
private boolean isExistsRoutinTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto) {
for (TaskReportDto lDto : listDto) {
if (lDto.taskKey.equals(rDto.taskKey) &&
lDto.taskReportId == rDto.taskReportId &&
lDto.reportStartDate.equals(rDto.reportStartDate)) {
......@@ -1758,7 +1603,7 @@ public class OperationListActivity extends ABVUIActivity {
if (contentDto == null || !contentDto.downloadedFlg || contentDto.updatedFlg) {
contentDownload(operationDto.contentId, false);
} else {
syncOperation(operationDto.operationId, operationDto.operationReportType, true);
syncOperation(operationDto.operationId, operationDto.reportType, true);
}
}
});
......@@ -1922,9 +1767,9 @@ public class OperationListActivity extends ABVUIActivity {
private ArrayList<Integer> getOperationReportTypeList(boolean isAll) {
ArrayList<Integer> operationReportTypes = new ArrayList<>();
if (isAll) {
operationReportTypes.add(OperationReportType.DEFAULT);
operationReportTypes.add(OperationReportType.ROUTINE_TASK);
operationReportTypes.add(OperationReportType.REPORT_TYPE);
operationReportTypes.add(OperationReportType.ROUTINE_TASK);
operationReportTypes.add(OperationReportType.REPORT_RESPONSE_TYPE);
} else {
operationReportTypes = getABVUIDataCache().getOperationReportTypes();
}
......
......@@ -191,7 +191,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
public void showOperationRelatedContentList() {
mOperationContentList = mOperationLogic.getOperationRelatedContent(operationId);
mOperationContentList = mOperationLogic.getOperationRelatedContent();
Logger.i(TAG, "count of content=" + mOperationContentList.size());
// Gridビュー
......
......@@ -87,9 +87,9 @@ public class OperationListAdapter extends AbstractOperationAdapter {
final OperationDto operationDto = getItem(position);
if (operationDto != null) {
boolean noRoutineTaskAll = (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
boolean noRoutineTaskAll = (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
holder.tvOperationName.setText(operationDto.operationName);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod)) {
holder.tvDate.setText(mContext.getString(R.string.date_label_routineTask) + " : " + mContext.getString(R.string.msg_no_report_data));
} else {
......@@ -106,7 +106,7 @@ public class OperationListAdapter extends AbstractOperationAdapter {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
} else {
// needSyncFlgがfalseの場合
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
......@@ -143,7 +143,7 @@ public class OperationListAdapter extends AbstractOperationAdapter {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
}
if(mOperationAuthLevel == OperationAuthLevel.WORKER) {
if(operationDto.enableReportEdit == Constant.EnableReportEdit.NO) {
holder.lyPanoEditLayout.setVisibility(View.GONE);
}
......
......@@ -119,9 +119,9 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
final OperationDto operationDto = getItem(position);
if (operationDto != null) {
boolean noRoutineTaskAll = (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
boolean noRoutineTaskAll = (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
holder.tvOperationName.setText(operationDto.operationName);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod)) {
holder.tvDate.setText(mContext.getString(R.string.date_label_routineTask) + " : " + mContext.getString(R.string.msg_no_report_data));
} else {
......@@ -137,7 +137,7 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
} else {
// needSyncFlgがfalseの場合
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
......@@ -174,9 +174,9 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
}
if(mOperationAuthLevel == OperationAuthLevel.WORKER) {
// if(mOperationAuthLevel.equals(OperationAuthLevel.WORKER)) {
holder.lyPanoEditLayout.setVisibility(View.GONE);
}
// }
holder.ivPanoEdit.setOnClickListener(new View.OnClickListener() {
@Override
......
......@@ -18,7 +18,6 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
......@@ -26,8 +25,6 @@ import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.RoutineTaskReportDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationTaskDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
......@@ -65,254 +62,81 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param context ABVContentViewActivity
* @param cmd
* @param taskKey タスクキー
* @param reportUpdateType
* @param enableReportHistory
* @param param
* @param operationId プロジェクトID
* @param contentPath
* @param routineTaskReportFlg
* @param reportType
* @param finishCallback
* @param taskReportLevel
*/
public void doABookCheckParam(ABVContentViewActivity context, String cmd, String taskKey, int reportUpdateType, Map<String, String> param, long operationId, String contentPath, long contentId, boolean routineTaskReportFlg, Callback finishCallback, int taskReportLevel) throws IOException {
public void doABookCheckParam(ABVContentViewActivity context, String cmd, String taskKey, int enableReportHistory, Map<String, String> param, long operationId, String contentPath, long contentId, int reportType, Callback finishCallback, int taskReportLevel) throws IOException {
int taskReportSendId = 0;
mFinishCallback = finishCallback;
// #32782 指示者テーブル関連削除 start
// TODO append
// int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
// #32782 指示者テーブル関連削除 end
// #32782 指示者テーブル関連削除 start
// TODO change
/*
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
// #32782 指示者テーブル関連削除 start
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, true, routineTaskReportFlg);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
}
// #32782 指示者テーブル関連削除 end
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, true, reportType, taskReportLevel);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
sendTaskData(context, operationId, taskKey, taskReportLevel);
break;
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, false, routineTaskReportFlg);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
}
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, false, reportType, taskReportLevel);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
sendTaskData(context, operationId, taskKey, taskReportLevel);
break;
// #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_DELETE_TASK_REPORT:
int taskReportId = 0;
String reportStartDate = "";
boolean sendTaskReportDataFlg = false;
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
if (routineTaskReportFlg) {
// TODO検討
// copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
if (reportType == Constant.ReportType.Routine) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
reportStartDate = param.get(ABookKeys.REPORT_START_DATE).replace("T", " ");
mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if (routineTaskTaskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} else {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey);
if (taskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
}
if (sendTaskReportDataFlg) {
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
if (enableReportHistory == Constant.EnableReportHistory.Invalid) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId);
} else if (reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId, taskReportLevel);
} else if (enableReportHistory == Constant.EnableReportHistory.Enable) {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
}
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
} else {
mFinishCallback.callback(false);
}
}
sendTaskData(context, operationId, taskKey, taskReportLevel);
break;
// #32782 指示者テーブル関連削除 end
case ABookKeys.CMD_MOVE_HOT_SPOT:
mOperationLogic.updateTaskHotspot(taskKey, param);
mOperationLogic.createHopSpotJson(operationId, contentPath);
break;
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS:
case ABookKeys.CMD_CANCEL_TASK_REPORT:
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
mFinishCallback.callback(false);
break;
}
*/
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
mOperationLogic.deleteTaskDirections(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_MOVE_HOT_SPOT:
// #32926 作業報告画面改善 start
mOperationLogic.updateTaskHotspot(taskKey, param, taskReportLevel);
// #32926 作業報告画面改善 end
mOperationLogic.createHopSpotJson(operationId, contentPath);
break;
case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, true, routineTaskReportFlg, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
break;
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, false, routineTaskReportFlg, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
break;
// #32861 作業情報追加 start
// 一時保存処理
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, false, routineTaskReportFlg, taskReportLevel);
context.handleErrorMessageToast(R.string.msg_temp_save_result);
break;
// #32861 作業情報追加 end
case ABookKeys.CMD_DELETE_TASK_REPORT:
int taskReportId = 0;
String reportStartDate = "";
boolean sendTaskReportDataFlg = false;
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate, taskReportLevel);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if (routineTaskTaskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} else {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey, taskReportLevel);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey);
if (taskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
}
if (sendTaskReportDataFlg) {
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId, taskReportLevel);
} else if (reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
}
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
} else {
mFinishCallback.callback(false);
}
break;
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS:
// case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS:
case ABookKeys.CMD_CANCEL_TASK_REPORT:
// #32926 作業報告画面改善 start
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
// #32926 作業報告画面改善 end
mFinishCallback.callback(false);
break;
}
// #32782 指示者テーブル関連削除 end
}
/**
* 作業指示データ送信処理
*
* @param context ABVContentViewActivity
* @param operationId プロジェクトID
* @param taskKey タスクキー
*/
private void sendTaskDirectionsData(final ABVContentViewActivity context, final long operationId, final String taskKey) {
// #32782 指示者テーブル関連削除 start
// TODO Delete mothod
Logger.d(TAG, "[sendTaskDirectionsData] operationId=%s, taskKey=%s", operationId, taskKey);
//作業指示送信時には「reportUpdateType」値が必要ではないので、「-1」に設定
sendTaskData(context, operationId, taskKey, -1, true);
// #32782 指示者テーブル関連削除 end
}
/**
* 作業報告データ送信処理
* @param context ABVContentViewActivity
* @param operationId プロジェクトID
* @param taskKey タスクキー
* @param reportUpdateType 作業履歴タイプ
*/
// #32782 指示者テーブル関連削除 start
// TODO change
/*
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirection) {
Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey);
sendTaskData(context, operationId, taskKey, reportUpdateType, isDirection);
}
*/
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType) {
Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey);
sendTaskData(context, operationId, taskKey, reportUpdateType, false);
}
// #32782 指示者テーブル関連削除 end
/**
* 作業報告・指示データ送信処理(共通)
* @param context ABVContentViewActivity
* @param operationId プロジェクトID
* @param taskKey タスクキー
* @param reportUpdateType 作業履歴タイプ
* @param isDirections 作業指示:true, 作業報告:false
*/
private void sendTaskData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirections) {
private void sendTaskData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int taskReportLevel) {
// TODO 以下の処理見直し
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
mFinishCallback.callback(false);
......@@ -337,42 +161,30 @@ public class ABookCheckWebViewHelper extends ABookHelper {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
OperationDto operationDto = mOperationLogic.getOperation(operationId);
boolean isError = false;
try {
if (isDirections) {
// #32782 指示者テーブル関連削除 start
// TODO change
// mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
mOperationLogic.sendTaskDirectionsData(operationId, taskKey, progressCallback);
// #32782 指示者テーブル関連削除 end
mOperationLogic.updateSyncOperation(operationId, true);
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationId);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (mOperationLogic.sendRoutineTaskReportSendData(operationId, taskKey, progressCallback) > 0){
if (mOperationLogic.sendTaskReportSendData(operationId, taskKey, taskReportLevel, progressCallback)) {
context.handleErrorMessageToast(R.string.P005);
}
} else {
mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
}
if (reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
mOperationLogic.updateSyncOperation(operationId, true);
}
}
} catch (ABVException ex) {
Logger.e(TAG, "sendTaskData", ex);
if (isDirections) {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
} else {
// if (isDirections) {
// context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
// } else {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_report_data);
}
// }
isError = true;
} catch (Exception e) {
Logger.e(TAG, e);
if (isDirections) {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
} else {
// if (isDirections) {
// context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
// } else {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_report_data);
}
// }
isError = true;
} finally {
mFinishCallback.callback(isError);
......@@ -384,7 +196,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
public void doABookCheckParamPdf(long operationId, OperationTaskDto operationTaskDto, String contentPath) {
try {
mOperationLogic.updateTaskHotspot(operationTaskDto.taskKey, operationTaskDto.pdfX, operationTaskDto.pdfY);
mOperationLogic.updateTaskHotspot(operationTaskDto.taskKey, operationTaskDto.pdfX, operationTaskDto.pdfY, Constant.TaskReportLevel.ReportType);
mOperationLogic.createHopSpotJson(operationId, contentPath);
} catch(IOException e){
e.printStackTrace();
......@@ -453,202 +265,80 @@ public class ABookCheckWebViewHelper extends ABookHelper {
}
/**
* 作業指示の登録・更新
*
* @param taskKey
* @param enableReportHistory
* @param operationId
* @param contentId
* @param param
* @param contentPath
* @param insertFlg
* @param reportType
* @param taskReportLevel
* @throws IOException
*/
private void insertOrUpdateTaskDirections(String taskKey, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg) throws IOException {
// #32782 指示者テーブル関連削除 start
// TODO Delete method
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskDirections = param.get(ABookKeys.TASK_DIRECTIONS);
JSONObject taskDirectionsJson = new JSONObject(taskDirections);
String taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) {
mOperationLogic.insertTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
} else {
mOperationLogic.updateTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
}
// #32782 指示者テーブル関連削除 end
}
// #32782 指示者テーブル関連削除 start
// TODO change
/*
private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg) throws IOException {
private void insertOrUpdateTaskReport(String taskKey, int enableReportHistory, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, int reportType, int taskReportLevel) throws IOException {
int taskReportSendId = 0;
// #32782 指示者テーブル関連削除 start
// 指示者か報告者か判断
int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskReport = param.get(ABookKeys.TASK_REPORT);
// TODO この処理後、削除
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
taskReport = param.get(ABookKeys.TASK_DIRECTIONS);
}
JSONObject taskReportJson = new JSONObject(taskReport);
String taskHotSpotInfo = null;
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
}
// #32782 指示者テーブル関連削除 end
int taskReportId = 0;
String reportStartDate = "";
// 指示者の場合下記の処理を行わない
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
}
} else {
if (routineTaskReportFlg) {
if (reportType == Constant.ReportType.Routine) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
//reportStartDate = DateTimeUtil.toString(DateTimeUtil.toDate(reportStartDate, "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmss_hyphen);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
routineTaskTaskReportDto.jsonData = taskReport;
mOperationLogic.updateRoutineTaskReport(operationId, contentId, routineTaskTaskReportDto, attachedChangeFlag, true, insertFlg, true);
} else {
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
}
}
TaskReportDto taskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
taskReportDto.jsonData = taskReport;
if (routineTaskReportFlg) {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.updateRoutineTaskReport(operationId, contentId, taskReportDto, attachedChangeFlag, true, insertFlg, true);
mOperationLogic.createJsonForOperationContent(operationId, contentPath, true);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
} else {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
} else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
if (routineTaskReportFlg) {
mOperationLogic.initialRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createRoutineTaskReportJson(operationId, contentPath);
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
String hotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, hotSpotInfo, null, attachedChangeFlag, true);
} else {
mOperationLogic.initialTaskReport(operationId, contentId, taskKey);
mOperationLogic.createTaskReportJson(operationId, contentPath);
}
}
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, routineTaskReportFlg, taskReportId, reportStartDate);
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false));
}
}
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, hotSpotInfo, null, attachedChangeFlag, true);
}
*/
private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg, int taskReportLevel) throws IOException {
int taskReportSendId = 0;
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskReport = param.get(ABookKeys.TASK_REPORT);
JSONObject taskReportJson = new JSONObject(taskReport);
int taskReportId = 0;
String reportStartDate = "";
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
//reportStartDate = DateTimeUtil.toString(DateTimeUtil.toDate(reportStartDate, "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmss_hyphen);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
routineTaskTaskReportDto.jsonData = taskReport;
mOperationLogic.updateRoutineTaskReport(operationId, contentId, routineTaskTaskReportDto, attachedChangeFlag, true, insertFlg, true);
} else {
if (insertFlg) {
// #32926 作業報告画面改善 start
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskReportLevel);
// #32926 作業報告画面改善 end
mOperationLogic.insertTaskReportReply(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskReportLevel);
mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
}
}
if (routineTaskReportFlg) {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate, taskReportLevel);
} else {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
if (enableReportHistory == Constant.EnableReportHistory.Invalid) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
if (routineTaskReportFlg) {
mOperationLogic.initialRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createRoutineTaskReportJson(operationId, contentPath);
} else {
mOperationLogic.initialTaskReport(operationId, contentId, taskKey);
mOperationLogic.createTaskReportJson(operationId, contentPath);
}
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
// #32926 作業報告画面改善 start
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, routineTaskReportFlg, taskReportId, reportStartDate, taskReportLevel);
// #32926 作業報告画面改善 end
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
// 作業報告のディレクトリ削除
// #32926 作業報告画面改善 start
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, String.valueOf(taskReportLevel)));
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, reportType == Constant.ReportType.Routine, taskReportId, reportStartDate, taskReportLevel);
// #32926 作業報告画面改善 end
}
}
// #32782 指示者テーブル関連削除 end
// xwalkで動画ファイルにアクセスするため、../files/..の以下のパスのディレクトりを../cache/..以下のパスに変更
public void allCopyTaskAttachedMovieFileToCache(long operationId, long contentId, OperationDto operationDto) {
try {
List<TaskDto> taskDtoList = mOperationLogic.getOperationTask(operationId);
for (TaskDto taskDto : taskDtoList) {
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
List<RoutineTaskReportDto> listRoutineTaskReport = mOperationLogic.getRoutineTaskReportByTaskKey(taskDto.taskKey);
for (RoutineTaskReportDto routineTaskDto : listRoutineTaskReport) {
copyRoutineTaskReportAttachedMovie(operationId, contentId, routineTaskDto.taskKey, routineTaskDto.taskReportId, routineTaskDto.reportStartDate, 0);
}
List<TaskReportDto> taskReportDtoList = mOperationLogic.getTaskReportByTaskKey(taskDto.taskKey);
for (TaskReportDto taskReportDto : taskReportDtoList) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskReportDto.taskKey, taskReportDto.taskReportId, taskReportDto.reportStartDate);
} else {
// #32926 作業報告画面改善 start
copyTaskAttachedMovie(operationId, contentId, taskDto.taskKey, String.valueOf(taskDto.taskReportLevel));
// #32926 作業報告画面改善 end
copyTaskAttachedMovie(operationId, contentId, taskDto.taskKey, taskReportDto.taskReportLevel);
}
}
}
} catch (IOException e) {
......@@ -667,7 +357,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param objReportStartDate
* @throws IOException
*/
public void copyRoutineTaskReportAttachedMovie(long operationId, long contentId, String taskKey, int taskReportId, Object objReportStartDate, int taskReportLevel) throws IOException {
public void copyRoutineTaskReportAttachedMovie(long operationId, long contentId, String taskKey, int taskReportId, Object objReportStartDate) throws IOException {
String reportStartDate;
if (objReportStartDate instanceof String) {
reportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(DateTimeUtil.toDate((String)objReportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen));
......@@ -677,7 +367,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
return;
}
String taskKeyPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDate, taskReportLevel);
String taskKeyPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDate);
File taskKeyFile = new File(taskKeyPath);
// 作業報告書の添付ファイル(mp4,mov拡張子のみ)コピー
......@@ -694,17 +384,15 @@ public class ABookCheckWebViewHelper extends ABookHelper {
}
/**
* /.../files/ABook/project/{projectId}/{taskKey}/{taskType}/*.(mov,mp4)を
* /.../cache/{contentId}/attachedMovie/{taskKey}/{taskType}/*.(mov,mp4)にコピー
* /.../files/ABook/project/{projectId}/{taskKey}/{taskType}/{taskReportLevel}/*.(mov,mp4)を
* /.../cache/{contentId}/attachedMovie/{taskKey}/{taskType}/{taskReportLevel}/*.(mov,mp4)にコピー
*
* @param operationId
* @param contentId
*/
// #32926 作業報告画面改善 start
public void copyTaskAttachedMovie(long operationId, long contentId, String taskKey, String taskReportLevel) throws IOException {
public void copyTaskAttachedMovie(long operationId, long contentId, String taskKey, int taskReportLevel) throws IOException {
// 作業指示書の添付ファイル(mp4,mov拡張子のみ)コピー
String taskKeyPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
// #32926 作業報告画面改善 end
File taskKeyFile = new File(taskKeyPath);
if (taskKeyFile.exists()) {
String attachedMoviesFilePath = ABVEnvironment.getInstance().getAttachedDirectionOrReportDirPath(contentId, taskKey, taskReportLevel);
......@@ -718,21 +406,6 @@ public class ABookCheckWebViewHelper extends ABookHelper {
}
}
}
// 作業報告書の添付ファイル(mp4,mov拡張子のみ)コピー
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.WORKER) {
taskKeyPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, taskReportLevel);
taskKeyFile = new File(taskKeyPath);
if (taskKeyFile.exists()) {
String attachedMoviesFilePath = ABVEnvironment.getInstance().getAttachedDirectionOrReportDirPath(contentId, taskKey, taskReportLevel);
FileUtil.delete(attachedMoviesFilePath);
FileUtil.createNewDirectory(attachedMoviesFilePath);
for (String taskAttachedFile : taskKeyFile.list()) {
if (StringUtil.endsWithAny(taskAttachedFile.toLowerCase(), "mov", "mp4")) {
FileUtil.copy(taskKeyPath + "/" + taskAttachedFile, attachedMoviesFilePath + "/" + taskAttachedFile, true);
}
}
}
}
}
/**
......@@ -753,10 +426,10 @@ public class ABookCheckWebViewHelper extends ABookHelper {
if (routineTaskReportFlg) {
dReportStartDate = DateTimeUtil.toDate(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
sReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(dReportStartDate);
taskAttachedPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, sReportStartDate, taskReportLevel);
taskAttachedPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, sReportStartDate);
} else {
// #32926 作業報告画面改善 start
taskAttachedPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, String.valueOf(taskReportLevel));
taskAttachedPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
// #32926 作業報告画面改善 end
}
File taskAttachedFiles = new File(taskAttachedPath);
......@@ -764,18 +437,20 @@ public class ABookCheckWebViewHelper extends ABookHelper {
if (taskAttachedFiles.exists()) {
String taskReportSendPath;
if (routineTaskReportFlg) {
taskReportSendPath = ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskKey, taskReportId, sReportStartDate, taskReportSendId, taskReportLevel);
taskReportSendPath = ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskKey, taskReportId, sReportStartDate, taskReportSendId);
} else {
taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId, taskReportLevel);
taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId);
}
FileUtil.delete(taskReportSendPath);
FileUtil.createNewDirectory(taskReportSendPath);
for (String taskAttachedFile : taskAttachedFiles.list()) {
if (!taskAttachedFile.equals(ABVEnvironment.getInstance().REPORT_SEND)) {
FileUtil.copy(taskAttachedPath + "/" + taskAttachedFile, taskReportSendPath + "/" + taskAttachedFile, true);
}
}
}
}
/**
* 作業報告送信ファイル削除
......@@ -789,7 +464,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
@Override
protected Void doInBackground(Void... params) {
try {
String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId, taskReportLevel);
String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId);
FileUtil.delete(taskReportSendPath);
} catch (Exception ex) {
Logger.e(String.format("%s.deleteReportTaskSendFiles(%d, %s)", TAG, operationId, taskKey), ex);
......
......@@ -63,8 +63,8 @@ public class OperationListHelper {
private List<OperationDto> filterOperationList() {
try {
String operationReportTypeStr = PreferenceUtil.getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
operationDtoList = mOperationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, operationReportTypeStr);
String reportTypeStr = PreferenceUtil.getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
operationDtoList = mOperationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr);
} catch (Exception e) {
Logger.e(TAG, "findOperationList", e);
ErrorMessage.showErrorMessageToast(mAppActivity.getApplicationContext(), ErrorCode.E107);
......
......@@ -4954,14 +4954,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
String cmd = checkParam.get(ABookKeys.CMD);
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS: // 作業指示の登録
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS: // 作業指示の更新
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS: // 作業指示の削除
case ABookKeys.CMD_INSERT_TASK_REPORT: // 作業報告の登録
case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新
case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除
getTaskHotspotJSON();
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS: // 作業指示のキャンセル
case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル
if(operationTaskDto != null) {
updateOperationTaskPosition(operationTaskDto.pdfX, operationTaskDto.pdfY);
......@@ -5165,7 +5161,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
public void showOperationTaskLayout(ZoomRelativeLayout layout, OperationTaskDto operationTaskDto, float clickX) {
//setCurrentOperationTask(layout, currentTaskDto);
operationTaskLayout.showTaskForm(layout, mXWalkOpenType, operationTaskDto, isNormalSize(), clickX);
// 拡大・縮小・切替ボタンの非表示
mScaleZoomLayout.setVisibility(View.INVISIBLE);
......@@ -5176,6 +5171,9 @@ public class ContentViewActivity extends ABVContentViewActivity {
String taskKey = checkParam.get(ABookKeys.TASK_KEY);
String taskCode = "";
// 作業報告レベル
int taskReportLevel = Integer.parseInt(checkParam.get(ABookKeys.TASK_REPORT_LEVEL));
// フォームが閉じられたと見做すので、以下の処理を行う
isOpenedOperationTask = false;
// 拡大・縮小・切替ボタンの表示
......@@ -5183,13 +5181,11 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (operationTaskLayout.currentLayout != null && !StringUtil.isNullOrEmpty(taskKey)) {
switch(cmd){
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
// #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_INSERT_TASK_REPORT:
case ABookKeys.CMD_UPDATE_TASK_REPORT:
case ABookKeys.CMD_DELETE_TASK_REPORT:
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
JSONObject hotspot = new JSONObject(checkParam.get(ABookKeys.HOT_SPOT));
taskCode = hotspot.getString(ABookKeys.TASK_CODE);
......@@ -5202,13 +5198,15 @@ public class ContentViewActivity extends ABVContentViewActivity {
} else {
operationTaskLayout.setIconStatus(taskKey, false);
}
// #32782 指示者テーブル関連削除 end
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
case ABookKeys.CMD_DELETE_TASK_REPORT:
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
operationTaskLayout.setIconStatus(taskKey, true);
//hideOperationTaskLayout();
} else {
operationTaskLayout.setIconStatus(taskKey, false);
}
break;
default:
operationTaskLayout.setIconStatus(taskKey, false);
break;
......@@ -5245,7 +5243,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
public int getOperationReportUpdateType() {
return reportUpdateType;
return enableReportHistory;
}
/**
......
......@@ -50,13 +50,6 @@ public class OperationTaskLayout extends RelativeLayout {
private static final int ICON_WIDTH = 32;
private static final int ICON_HEIGHT = 32;
// 仮)ピンのイメージアイコンのサイズ
private static final int PIN_ICON_WIDTH = 20;
private static final int PIN_ICON_HEIGHT = 40;
// 仮)終了のピンのイメージアイコンのサイズ
private static final int PIN_FINISHED_ICON_WIDTH = 20;
private static final int PIN_FINISHED_ICON_HEIGHT = 40;
private static final int CODE_WIDTH = 46;
private static final int CODE_HEIGHT = 26;
......@@ -194,13 +187,10 @@ public class OperationTaskLayout extends RelativeLayout {
// ピンで表示
final ActionOperationTaskPin taskPin = new ActionOperationTaskPin(mContext, dto);
taskPin.taskKey = dto.taskKey;
if (dto.isFinished) {
width = (int) (PIN_FINISHED_ICON_WIDTH * density);
height = (int) (PIN_FINISHED_ICON_HEIGHT * density);
} else {
width = (int) (PIN_ICON_WIDTH * density);
height = (int) (PIN_ICON_HEIGHT * density);
}
// ピンのイメージアイコンのサイズセット
width = (int) mContext.getResources().getDimensionPixelSize(R.dimen.operation_pin_icon_width);
height = (int) mContext.getResources().getDimensionPixelSize(R.dimen.operation_pin_icon_height);
params = new RelativeLayout.LayoutParams(width, height);
taskPin.setVisibility(View.INVISIBLE);
......@@ -282,12 +272,8 @@ public class OperationTaskLayout extends RelativeLayout {
}
private boolean isTaskFinished(String taskKey) {
if(mContext.getOperationReportUpdateType() == Constant.OperationUpdateType.HISTORY_ADD) {
return false;
} else {
return mTaskDao.getTaskByTaskKey(taskKey).taskStatus == FINISHED_STATUS;
}
}
public void showTaskList(int pageNum, boolean isNormalSize) {
final String script = String.format(SCRIPT_SHOW_TASK_LIST, pageNum + 1);
......
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