Commit 05b337ce by Lee Jaebin

#32825 作業一覧画面改善

parent 1d2780ad
...@@ -73,6 +73,7 @@ import jp.agentec.abook.abv.bl.dto.ContentDto; ...@@ -73,6 +73,7 @@ import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.GroupDto; import jp.agentec.abook.abv.bl.dto.GroupDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto; import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ServiceOptionDto; 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.HttpDownloadState;
import jp.agentec.adf.net.http.HttpFileDownloader; import jp.agentec.adf.net.http.HttpFileDownloader;
import jp.agentec.adf.net.http.HttpMultipart; import jp.agentec.adf.net.http.HttpMultipart;
...@@ -513,21 +514,19 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -513,21 +514,19 @@ public class AcmsClient implements AcmsClientResponseListener {
} }
/** /**
* 作業データ送信 * 作業報告データ送信
* @param sid * @param sid
* @param operationId * @param operationId
* @param taskKey * @param taskReportDto
* @param delFlag
* @param taskReportLevel
* @param taskHotspotInfo
* @param taskReportInfo
* @param formFile * @param formFile
* @param taskReportSendSaveDate
* @param isRoutinTask
* @return * @return
* @throws AcmsException * @throws ABVException
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws IOException * @throws IOException
*/ */
public AcmsMessageJSON sendTaskData(String sid, String operationId, String taskKey, String delFlag, String taskReportLevel, String taskHotspotInfo, String taskReportInfo, File formFile, boolean attachedFileSendFlg, Date taskReportSendSaveDate) throws ABVException, NetworkDisconnectedException, IOException { public AcmsMessageJSON testSendTaskData(String sid, Long operationId, TaskReportDto taskReportDto, File formFile, Date taskReportSendSaveDate, boolean isRoutinTask) throws ABVException, NetworkDisconnectedException, IOException {
if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック if (networkAdapter != null && !networkAdapter.isNetworkConnected()) { // NWのチェック
throw new NetworkDisconnectedException(); throw new NetworkDisconnectedException();
} }
...@@ -535,39 +534,47 @@ public class AcmsClient implements AcmsClientResponseListener { ...@@ -535,39 +534,47 @@ public class AcmsClient implements AcmsClientResponseListener {
String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSendTaskData); String apiUrl = AcmsApis.getApiUrl(env.acmsAddress, urlPath, AcmsApis.ApiSendTaskData);
List<HttpMultipart> HttpMultipartList = new ArrayList<HttpMultipart>(); List<HttpMultipart> HttpMultipartList = new ArrayList<HttpMultipart>();
HttpMultipartList.add(new HttpMultipart(ABookKeys.SID, sid)); HttpMultipartList.add(new HttpMultipart(ABookKeys.SID, sid));
HttpMultipartList.add(new HttpMultipart(ABookKeys.OPERATION_ID, operationId)); HttpMultipartList.add(new HttpMultipart(ABookKeys.OPERATION_ID, StringUtil.toString(operationId)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_KEY, taskKey)); HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_KEY, taskReportDto.taskKey));
HttpMultipartList.add(new HttpMultipart(ABookKeys.DEL_FLAG, delFlag)); HttpMultipartList.add(new HttpMultipart(ABookKeys.DEL_FLAG, taskReportDto.delFlg ? "1" : "0"));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_LEVEL, taskReportLevel)); HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_LEVEL, StringUtil.toString(taskReportDto.taskReportLevel)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_HOT_SPOT_INFO, taskHotspotInfo)); HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_HOT_SPOT_INFO, taskReportDto.taskHotSpotInfo));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_INFO, taskReportInfo)); HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_INFO, taskReportDto.taskReportInfo));
HttpMultipartList.add(new HttpMultipart(ABookKeys.ATTACHED_CHANGE_FLAG, attachedFileSendFlg ? "1" : "0")); HttpMultipartList.add(new HttpMultipart(ABookKeys.ATTACHED_CHANGE_FLAG, taskReportDto.attachedFileSendFlg ? "1" : "0"));
// 定期点検用
if (isRoutinTask) {
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) { if (formFile != null) {
HttpMultipartList.add(new HttpMultipart(ABookKeys.FORM_FILE, formFile)); HttpMultipartList.add(new HttpMultipart(ABookKeys.FORM_FILE, formFile));
} }
if (taskReportSendSaveDate != null) { if (taskReportSendSaveDate != null) {
String sendDate = DateTimeUtil.toStringInTimeZone(taskReportSendSaveDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, "GMT") + ",GMT"; HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_SAVE_DATE, DateTimeUtil.toStringForCmsGMT(taskReportSendSaveDate)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_SAVE_DATE, sendDate));
} }
result = HttpRequestSender.post(apiUrl, HttpMultipartList.toArray(new HttpMultipart[HttpMultipartList.size()])); result = HttpRequestSender.post(apiUrl, HttpMultipartList.toArray(new HttpMultipart[HttpMultipartList.size()]));
Logger.d(TAG, "[sendTaskData]: operationId=%s, taskKey=%s, delFlag=%s, taskReportLevel=%s, taskHopspotInfo=%s, taskReportInfo=%s, attachedFileSendFlg=%s", operationId, taskKey, delFlag, taskReportLevel, taskHotspotInfo, taskReportInfo, attachedFileSendFlg);
AcmsMessageJSON json = new AcmsMessageJSON(result.httpResponseBody); AcmsMessageJSON json = new AcmsMessageJSON(result.httpResponseBody);
Logger.d(TAG, "sendTaskData res: %s", json); Logger.d(TAG, "sendTaskData res: %s", json);
if (json.errorMessage != null) { if (json.errorMessage != null) {
if (json.errorMessage[0].equals("P003")) { if (json.errorMessage[0].equals("P003")) {
throw new ABVException(ABVExceptionCode.P_E_ACMS_P003); throw new ABVException(ABVExceptionCode.P_E_ACMS_P003);
} else if (json.errorMessage[0].equals("P004")) { } else if (json.errorMessage[0].equals("P004")) {
throw new ABVException(ABVExceptionCode.P_E_ACMS_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) { if (json.httpStatus != 200) {
throw new AcmsException(ABVExceptionCode.S_E_ACMS_0001, json); throw new AcmsException(ABVExceptionCode.S_E_ACMS_0001, json);
} }
return json; return json;
} }
......
...@@ -71,12 +71,13 @@ public class OperationDataJSON extends AcmsCommonJSON { ...@@ -71,12 +71,13 @@ public class OperationDataJSON extends AcmsCommonJSON {
TaskReportDto taskReportDto = new TaskReportDto(); TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskReportJson = taskReportList.getJSONObject(j); JSONObject taskReportJson = taskReportList.getJSONObject(j);
taskReportDto.taskKey = dto.taskKey;
taskReportDto.taskReportLevel = taskReportJson.getInt(TaskReportLevel); taskReportDto.taskReportLevel = taskReportJson.getInt(TaskReportLevel);
taskReportDto.enableReport = taskReportJson.getInt(EnableReport); taskReportDto.enableReport = taskReportJson.getInt(EnableReport);
if (taskReportJson.has(TaskReportInfoId)) { if (taskReportJson.has(TaskReportInfoId)) {
// 定期点検の場合 // 定期点検の場合
taskReportDto.taskReportInfoId = taskReportJson.getLong(TaskReportInfoId); taskReportDto.taskReportInfoId = taskReportJson.getInt(TaskReportInfoId);
} }
if (taskReportJson.has(ReportStartDate)) { if (taskReportJson.has(ReportStartDate)) {
taskReportDto.reportStartDate = DateTimeUtil.toDate(taskReportJson.getString(ReportStartDate), DateTimeFormat.yyyyMMddHHmmss_hyphen); taskReportDto.reportStartDate = DateTimeUtil.toDate(taskReportJson.getString(ReportStartDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
......
...@@ -6,12 +6,11 @@ import org.json.adf.JSONObject; ...@@ -6,12 +6,11 @@ import org.json.adf.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.OperationContentDto; import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto; import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto; import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.WorkingGroupDto; import jp.agentec.abook.abv.bl.dto.TaskWorkerGroupDto;
import jp.agentec.adf.util.DateTimeFormat; import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
...@@ -37,6 +36,9 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -37,6 +36,9 @@ public class OperationListJSON extends AcmsCommonJSON {
public static final String EnableReportHistory = "enableReportHistory"; public static final String EnableReportHistory = "enableReportHistory";
// 作業編集可能区分
public static final String EnableReportEdit = "enableReportEdit";
// 作業担当グループリスト // 作業担当グループリスト
public static final String WorkingGroupList = "workingGroupList"; public static final String WorkingGroupList = "workingGroupList";
public static final String ReportLevel = "reportLevel"; // 報告階層 public static final String ReportLevel = "reportLevel"; // 報告階層
...@@ -68,7 +70,7 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -68,7 +70,7 @@ public class OperationListJSON extends AcmsCommonJSON {
JSONObject operationJson = operations.getJSONObject(i); JSONObject operationJson = operations.getJSONObject(i);
OperationDto dto = new OperationDto(); OperationDto dto = new OperationDto();
dto.operationContentDtoList = new ArrayList<OperationContentDto>(); dto.operationContentDtoList = new ArrayList<OperationContentDto>();
dto.workingGroupDtoList = new ArrayList<WorkingGroupDto>(); dto.taskWorkerGroupDtoList = new ArrayList<TaskWorkerGroupDto>();
dto.operationId = operationJson.getLong(OperationId); dto.operationId = operationJson.getLong(OperationId);
dto.operationType = operationJson.getInt(OperationType); dto.operationType = operationJson.getInt(OperationType);
dto.operationName = operationJson.getString(OperationName); dto.operationName = operationJson.getString(OperationName);
...@@ -77,13 +79,13 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -77,13 +79,13 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.operationEndDate = DateTimeUtil.toDate(operationJson.getString(OperationEndDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen); dto.operationEndDate = DateTimeUtil.toDate(operationJson.getString(OperationEndDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
dto.reportType = operationJson.getInt(ReportType); // 作業報告タイプ dto.reportType = operationJson.getInt(ReportType); // 作業報告タイプ
dto.enableReportHistory = operationJson.getInt(EnableReportHistory); // 報告履歴管理 dto.enableReportHistory = operationJson.getInt(EnableReportHistory); // 報告履歴管理
dto.enableReportEdit = operationJson.has(EnableReportEdit) ? operationJson.getInt(EnableReportEdit) : 0; // 作業編集区分
// 作業終了更新日 // 作業終了更新日
if (operationJson.has(OperationLastEditDate)) { if (operationJson.has(OperationLastEditDate)) {
dto.lastEditDate = DateTimeUtil.toDate(operationJson.getString(OperationLastEditDate), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen); dto.lastEditDate = DateTimeUtil.toDate(operationJson.getString(OperationLastEditDate), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
} }
if (operationJson.has(ReportCycle)) { if (operationJson.has(ReportCycle)) {
dto.reportCycle = operationJson.getInt(ReportCycle); dto.reportCycle = operationJson.getInt(ReportCycle);
} }
...@@ -138,14 +140,14 @@ public class OperationListJSON extends AcmsCommonJSON { ...@@ -138,14 +140,14 @@ public class OperationListJSON extends AcmsCommonJSON {
break; break;
} }
// 作業担当グループリストセット // 作業担当グループリストセット
WorkingGroupDto workingGroupDto = new WorkingGroupDto(); TaskWorkerGroupDto taskWorkerGroupDto = new TaskWorkerGroupDto();
workingGroupDto.reportLevel = workingGroupJsonArray.getJSONObject(k).getInt(ReportLevel); taskWorkerGroupDto.taskReportLevel = workingGroupJsonArray.getJSONObject(k).getInt(ReportLevel);
workingGroupDto.groupList = new ArrayList<Integer>(); taskWorkerGroupDto.groupList = new ArrayList<Integer>();
JSONArray workingGroupListArray = workingGroupJsonArray.getJSONObject(k).getJSONArray(GroupList); JSONArray workingGroupListArray = workingGroupJsonArray.getJSONObject(k).getJSONArray(GroupList);
for (int j = 0; j < workingGroupListArray.length(); j++) { for (int j = 0; j < workingGroupListArray.length(); j++) {
workingGroupDto.groupList.add(workingGroupListArray.getJSONObject(j).getInt(GroupId)); taskWorkerGroupDto.groupList.add(workingGroupListArray.getJSONObject(j).getInt(GroupId));
} }
dto.workingGroupDtoList.add(workingGroupDto); dto.taskWorkerGroupDtoList.add(taskWorkerGroupDto);
} }
} }
......
...@@ -150,4 +150,10 @@ public class Constant { ...@@ -150,4 +150,10 @@ public class Constant {
int Invalid = 0; // 無効 int Invalid = 0; // 無効
int Enable = 1; // 有効 int Enable = 1; // 有効
} }
// 作業編集可能区分
public interface EnableReportEdit {
int NO = 0;
int YES = 1;
}
} }
...@@ -12,24 +12,17 @@ public class ABookKeys { ...@@ -12,24 +12,17 @@ public class ABookKeys {
public static final String CONTENT_ID = "contentId"; public static final String CONTENT_ID = "contentId";
public static final String CONTENT_NAME = "contentName"; public static final String CONTENT_NAME = "contentName";
public static final String CONTENT_TYPE = "contentType"; public static final String CONTENT_TYPE = "contentType";
public static final String OPERATION_ID = "projectId"; public static final String OPERATION_ID = "operationId";
public static final String OPERATION_NAME = "projectName"; public static final String OPERATION_NAME = "operationName";
// ABOOKCHECK SCHEME // ABOOKCHECK SCHEME
public static final String ABOOK_CHECK_API = "abookcheck-api"; public static final String ABOOK_CHECK_API = "abookcheck-api";
// #32782 指示者テーブル関連削除 start
// TODO TaskDirections 削除処理が必要
public static final String CMD_INSERT_TASK_DIRECTIONS = "insertTaskReportLevel";
public static final String CMD_UPDATE_TASK_DIRECTIONS = "updateTaskReportLevel";
public static final String CMD_DELETE_TASK_DIRECTIONS = "deleteTaskReport";
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_MOVE_HOT_SPOT = "moveHotspot";
public static final String CMD_SHOW_DIRECTION_OZD = "showDirectionOzd"; public static final String CMD_SHOW_DIRECTION_OZD = "showDirectionOzd";
public static final String CMD_PREVIEW_DIRECTION_OZD = "previewDirectionOzd"; public static final String CMD_PREVIEW_DIRECTION_OZD = "previewDirectionOzd";
public static final String CMD_INSERT_TASK_REPORT = "insertTaskReportReplyLevel"; public static final String CMD_INSERT_TASK_REPORT = "insertTaskReport";
public static final String CMD_UPDATE_TASK_REPORT = "updateTaskReportReplyLevel"; public static final String CMD_UPDATE_TASK_REPORT = "updateTaskReport";
public static final String CMD_DELETE_TASK_REPORT = "deleteTaskReportReply"; public static final String CMD_DELETE_TASK_REPORT = "deleteTaskReport";
public static final String CMD_CANCEL_TASK_REPORT = "cancelTaskReport"; public static final String CMD_CANCEL_TASK_REPORT = "cancelTaskReport";
public static final String CMD_SHOW_REPORT_OZD = "showReportOzd"; public static final String CMD_SHOW_REPORT_OZD = "showReportOzd";
public static final String CMD_PREVIEW_REPORT_OZD = "previewReportOzd"; public static final String CMD_PREVIEW_REPORT_OZD = "previewReportOzd";
......
...@@ -257,6 +257,34 @@ public class AbstractDao { ...@@ -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型リストで返します。 * クエリを実行し、最初の行の最初の列の値をLong型リストで返します。
* *
* @param sql * @param sql
......
...@@ -158,9 +158,10 @@ public class OperationDao extends AbstractDao { ...@@ -158,9 +158,10 @@ public class OperationDao extends AbstractDao {
+ "need_sync_flg, " + "need_sync_flg, "
+ "report_cycle, " + "report_cycle, "
+ "enable_report_update, " + "enable_report_update, "
+ "enable_report_history) " + "enable_report_history, "
+ "enable_report_edit) "
+ "values " + "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", + "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues()); dto.getInsertValues());
} }
...@@ -179,13 +180,15 @@ public class OperationDao extends AbstractDao { ...@@ -179,13 +180,15 @@ public class OperationDao extends AbstractDao {
+ "need_sync_flg=?, " + "need_sync_flg=?, "
+ "report_cycle=?, " + "report_cycle=?, "
+ "enable_report_update=?, " + "enable_report_update=?, "
+ "enable_report_history=? " + "enable_report_history=?, "
+ "enable_report_edit=? "
+ "where operation_id=?", + "where operation_id=?",
dto.getUpdateValues()); dto.getUpdateValues());
return count > 0; return count > 0;
} }
public void delete(OperationDto dto) { public void delete(OperationDto dto) {
delete("r_task_worker_group", "operation_id=?", dto.getKeyValues());
delete("r_operation_content", "operation_id=?", dto.getKeyValues()); delete("r_operation_content", "operation_id=?", dto.getKeyValues());
delete("t_operation", "operation_id=?", dto.getKeyValues()); delete("t_operation", "operation_id=?", dto.getKeyValues());
} }
...@@ -200,6 +203,7 @@ public class OperationDao extends AbstractDao { ...@@ -200,6 +203,7 @@ public class OperationDao extends AbstractDao {
delete("t_task_report_items", null, null); delete("t_task_report_items", null, null);
delete("t_inspect_task_report", null, null); delete("t_inspect_task_report", null, null);
delete("m_worker_group", null, null); delete("m_worker_group", null, null);
delete("r_task_worker_group", null, null);
} }
public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) { public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
......
...@@ -152,74 +152,70 @@ public class RoutineTaskReportDao extends AbstractDao { ...@@ -152,74 +152,70 @@ public class RoutineTaskReportDao extends AbstractDao {
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); 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) { // public List<RoutineTaskReportDto> selectRoutineTaskReportByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_inspect_task_report where task_key=?", new String[]{ taskKey }, RoutineTaskReportDto.class); // return rawQueryGetDtoList("select * from t_inspect_task_report where task_key=?", new String[]{ taskKey }, RoutineTaskReportDto.class);
} // }
//
public List<RoutineTaskReportDto> getRoutineTaskReportByOperationId(Long operationId) { // public List<RoutineTaskReportDto> getRoutineTaskReportByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
sb.append(" select tr.* "); // sb.append(" select tr.* ");
sb.append(" from t_inspect_task_report tr "); // sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join "); // sb.append(" inner join ");
sb.append(" t_task tt "); // sb.append(" t_task tt ");
sb.append(" ON tt.task_key == tr.task_key "); // sb.append(" ON tt.task_key == tr.task_key ");
sb.append(" WHERE tt.del_flg = 0"); // sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.operation_id = ?"); // sb.append(" AND tt.operation_id = ?");
sb.append(" ORDER BY task_report_id ASC, report_start_date ASC"); // sb.append(" ORDER BY task_report_id ASC, report_start_date ASC");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, RoutineTaskReportDto.class); // return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, RoutineTaskReportDto.class);
} // }
//
public List<RoutineTaskReportDto> getSendableRoutineTaskReportData(long operationId) { // public List<RoutineTaskReportDto> getSendableRoutineTaskReportData(long operationId) {
StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
sb.append(" select * "); // sb.append(" select * ");
sb.append(" from t_inspect_task_report tr "); // sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join "); // sb.append(" inner join ");
sb.append(" t_task tt "); // sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key"); // sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tr.data_send_flag = 1"); // sb.append(" WHERE tr.data_send_flag = 1");
sb.append(" AND tt.operation_id = ?"); // sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class); // return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId }, RoutineTaskReportDto.class);
} // }
//
public List<RoutineTaskReportDto> getSendableRoutineTaskReportData(long operationId, String taskKey) { // public List<RoutineTaskReportDto> getSendableRoutineTaskReportData(long operationId, String taskKey) {
StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
sb.append(" select * "); // sb.append(" select * ");
sb.append(" from t_inspect_task_report tr "); // sb.append(" from t_inspect_task_report tr ");
sb.append(" inner join "); // sb.append(" inner join ");
sb.append(" t_task tt "); // sb.append(" t_task tt ");
sb.append(" ON tr.task_key == tt.task_key"); // sb.append(" ON tr.task_key == tt.task_key");
sb.append(" WHERE tr.data_send_flag = 1"); // sb.append(" WHERE tr.data_send_flag = 1");
sb.append(" AND tt.operation_id = ?"); // sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?"); // sb.append(" AND tt.task_key = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId, "" + taskKey }, RoutineTaskReportDto.class); // return rawQueryGetDtoList(sb.toString(), new String[]{ "" + operationId, "" + taskKey }, RoutineTaskReportDto.class);
} // }
public boolean isExistSendRoutineTaskData(Long operationId) { // public boolean existsToDoRoutineTaskReportData(long operationId) {
return getSendableRoutineTaskReportData(operationId).size() > 0; // String currDate = DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen);
} // StringBuilder sb = new StringBuilder();
// sb.append(" select count(*) ");
public boolean existsToDoRoutineTaskReportData(long operationId) { // sb.append(" from t_inspect_task_report tr ");
String currDate = DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMddHHmmss_hyphen); // sb.append(" inner join t_task tt ON tt.task_key == tr.task_key ");
StringBuilder sb = new StringBuilder(); // sb.append(" WHERE tt.del_flg = 0 ");
sb.append(" select count(*) "); // sb.append(" AND tt.operation_id = ? ");
sb.append(" from t_inspect_task_report tr "); // sb.append(" AND datetime(report_end_date) >= datetime(?, 'utc') ");
sb.append(" inner join t_task tt ON tt.task_key == tr.task_key "); // return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, currDate }) > 0;
sb.append(" WHERE tt.del_flg = 0 "); // }
sb.append(" AND tt.operation_id = ? "); //
sb.append(" AND datetime(report_end_date) >= datetime(?, 'utc') "); // public List<RoutineTaskReportDto> geRoutineTaskReportByTaskKey(String taskKey) {
return rawQueryGetInt(sb.toString(), new String[]{ "" + operationId, currDate }) > 0; // StringBuilder sb = new StringBuilder();
} // sb.append(" SELECT * ");
// sb.append(" FROM t_inspect_task_report ");
public List<RoutineTaskReportDto> geRoutineTaskReportByTaskKey(String taskKey) { // sb.append(" WHERE task_key = ? ");
StringBuilder sb = new StringBuilder(); // sb.append(" ORDER BY task_report_id, report_start_date ");
sb.append(" SELECT * "); // return rawQueryGetDtoList(sb.toString(), new String[]{ taskKey }, RoutineTaskReportDto.class);
sb.append(" FROM t_inspect_task_report "); // }
sb.append(" WHERE task_key = ? ");
sb.append(" ORDER BY task_report_id, report_start_date "); // public String getRoutineTaskReportAttachedFileName(String taskKey, int taskReportId, String reportStartDate) {
return rawQueryGetDtoList(sb.toString(), new String[]{ taskKey }, RoutineTaskReportDto.class); // 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 });
} // }
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 });
}
} }
...@@ -5,6 +5,8 @@ import java.util.List; ...@@ -5,6 +5,8 @@ import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor; import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.TaskReportDto; 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. * Created by leej on 2018/09/10.
...@@ -74,7 +76,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -74,7 +76,7 @@ public class TaskReportDao extends AbstractDao {
+ "task_report_info_id, " + "task_report_info_id, "
+ "report_start_date, " + "report_start_date, "
+ "report_end_date, " + "report_end_date, "
+ "reported_flag) " + "reported_flg) "
+ "values " + "values "
+ "(?,?,?,?,?,?,?,?,?,?,?)", + "(?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues()); dto.getInsertValues());
...@@ -92,6 +94,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -92,6 +94,7 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class); return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
} }
/** /**
* 作業キーと作業報告タイプで作業報告データ取得 * 作業キーと作業報告タイプで作業報告データ取得
* @param taskKey * @param taskKey
...@@ -99,7 +102,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -99,7 +102,7 @@ public class TaskReportDao extends AbstractDao {
* @return * @return
*/ */
public TaskReportDto getTaskReport(String taskKey, Integer taskReportLevel) { 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); return rawQueryGetDto("select * from t_task_report where task_key=? AND task_report_level=?", new String[]{ "" + taskKey, "" + taskReportLevel }, TaskReportDto.class);
} }
public boolean update(TaskReportDto dto) { public boolean update(TaskReportDto dto) {
...@@ -114,44 +117,44 @@ public class TaskReportDao extends AbstractDao { ...@@ -114,44 +117,44 @@ public class TaskReportDao extends AbstractDao {
+ "task_report_info_id=?, " + "task_report_info_id=?, "
+ "report_start_date=?, " + "report_start_date=?, "
+ "report_end_date=?, " + "report_end_date=?, "
+ "reported_flag=?, " + "reported_flg=? "
+ "where task_key=?", + "where task_key=?",
dto.getUpdateValues()); dto.getUpdateValues());
return count > 0; return count > 0;
} }
public boolean updateRoutinTask(TaskReportDto dto, boolean reportedFlg) { // public boolean updateRoutinTask(TaskReportDto dto, boolean reportedFlg) {
long count; // long count;
if (reportedFlg) { // if (reportedFlg) {
dto.reportedFlag = true; // dto.reportedFlag = true;
//
count = update("update t_inspect_task_report " // count = update("update t_inspect_task_report "
+ "set " // + "set "
+ "report_end_date=?, " // + "report_end_date=?, "
+ "attached_file_name=?, " // + "attached_file_name=?, "
+ "local_attached_file_name=?, " // + "local_attached_file_name=?, "
+ "json_data=?, " // + "json_data=?, "
+ "data_send_flag=?, " // + "data_send_flag=?, "
+ "attached_file_send_flag=?, " // + "attached_file_send_flag=?, "
+ "reported_flag=? " // + "reported_flag=? "
+ "where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)", // + "where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)",
dto.getUpdateValues()); // dto.getUpdateValues());
} else { // } else {
count = update("update t_inspect_task_report " // count = update("update t_inspect_task_report "
+ "set " // + "set "
+ "report_end_date=?, " // + "report_end_date=?, "
+ "attached_file_name=?, " // + "attached_file_name=?, "
+ "local_attached_file_name=?, " // + "local_attached_file_name=?, "
+ "json_data=?, " // + "json_data=?, "
+ "data_send_flag=?, " // + "data_send_flag=?, "
+ "attached_file_send_flag=? " // + "attached_file_send_flag=? "
+ "where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)", // + "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 }); // new Object[] { dto.reportEndDate, dto.attachedFileName, dto.localAttachedFileName, dto.jsonData, dto.dataSendFlag, dto.attachedFileSendFlag, dto.taskKey, dto.taskReportId, dto.reportStartDate });
} // }
//
return count > 0; // return count > 0;
} // }
} // }
/** /**
* 送信フラグのあるデータが存在するか * 送信フラグのあるデータが存在するか
...@@ -201,20 +204,16 @@ public class TaskReportDao extends AbstractDao { ...@@ -201,20 +204,16 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetString("select local_attached_file_name from t_task_report where task_key=? AND task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel}); return rawQueryGetString("select local_attached_file_name from t_task_report where task_key=? AND task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel});
} }
public List<TaskReportDto> selectByTaskKey(String taskKey) { public List<TaskReportDto> selectByTaskKey(String taskKey, int taskReportLevel) {
return rawQueryGetDtoList("select * from t_task_report where task_key=?", new String[]{ taskKey }, TaskReportDto.class); return rawQueryGetDtoList("select * from t_task_report where task_key=? and task_report_level", new String[]{ "" + taskKey, "" + taskReportLevel }, TaskReportDto.class);
} }
public List<TaskReportDto> selectAll() { public List<TaskReportDto> selectAll() {
return rawQueryGetDtoList("select * from t_task_report", null, TaskReportDto.class); return rawQueryGetDtoList("select * from t_task_report", null, TaskReportDto.class);
} }
public void deleteAll() {
delete("t_task_report", null, null);
}
/** /**
* * データの存在チェック
* @param taskKey * @param taskKey
* @param taskReportLevel * @param taskReportLevel
* @return * @return
...@@ -222,4 +221,146 @@ public class TaskReportDao extends AbstractDao { ...@@ -222,4 +221,146 @@ public class TaskReportDao extends AbstractDao {
public boolean isExistTaskReport(String taskKey, Integer taskReportLevel) { 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; return rawQueryGetInt("select COUNT(*) from t_task_report where task_key=? AND task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel }) > 0;
} }
// 仮定期点検メソッド
public boolean update(TaskReportDto 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.dataSendFlg, dto.attachedFileSendFlg, dto.taskKey, dto.taskReportId, dto.reportStartDate });
}
return count > 0;
}
public void delete(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) });
}
public TaskReportDto 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<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;
}
}
public TaskReportDto 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 }, TaskReportDto.class);
}
public List<TaskReportDto> selectRoutineTaskReportByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_inspect_task_report where task_key=?", new String[]{ taskKey }, TaskReportDto.class);
}
public List<TaskReportDto> 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}, TaskReportDto.class);
}
public List<TaskReportDto> 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 }, TaskReportDto.class);
}
public List<TaskReportDto> 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 }, TaskReportDto.class);
}
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<TaskReportDto> 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 }, TaskReportDto.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 });
}
/**
* 作業キーで作業時間が存在する作業報告データ取得(定期点検)
* @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);
}
} }
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.group_id 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 { ...@@ -59,13 +59,44 @@ public class WorkerGroupDao extends AbstractDao {
return count > 0; 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() { public void deleteAll() {
delete("m_worker_group", null, null); 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
...@@ -20,7 +20,7 @@ public class RTaskWorkerGroup extends SQLiteTableScript { ...@@ -20,7 +20,7 @@ public class RTaskWorkerGroup extends SQLiteTableScript {
List<String> ddl = new ArrayList<String>(); List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_task_worker_group ( "); sql.append(" CREATE TABLE r_task_worker_group ( ");
sql.append(" task_report_level INTEGER default 0 "); sql.append(" task_report_level INTEGER default 0 ");
sql.append(" , operation_id BIGINT NOT NULL "); sql.append(" , operation_id BIGINT NOT NULL ");
sql.append(" , group_id INTEGER NOT NULL "); sql.append(" , group_id INTEGER NOT NULL ");
......
...@@ -33,10 +33,10 @@ public class TOperation extends SQLiteTableScript { ...@@ -33,10 +33,10 @@ public class TOperation extends SQLiteTableScript {
sql.append(" , edit_lock_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , edit_lock_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , need_sync_flg BOOLEAN NOT NULL DEFAULT 0 "); sql.append(" , need_sync_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , 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(" , report_cycle INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report_update 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_history SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , enable_report_edit SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (operation_id) "); sql.append(" , PRIMARY KEY (operation_id) ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -39,6 +39,7 @@ public class TTaskReport extends SQLiteTableScript { ...@@ -39,6 +39,7 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" , task_report_info_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(" , enable_report SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , task_report_level SMALLINT NOT NULL DEFAULT 0 "); sql.append(" , task_report_level SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , reported_flg BOOLEAN DEFAULT 0 ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -28,11 +28,11 @@ public class OperationDto extends AbstractDto { ...@@ -28,11 +28,11 @@ public class OperationDto extends AbstractDto {
public int enableReportUpdate; //0:不可 1:可 public int enableReportUpdate; //0:不可 1:可
public String reportPeriod; //定期点検、2018/12/20 08:10:00 ~ 2018/12/21 18:10:00 public String reportPeriod; //定期点検、2018/12/20 08:10:00 ~ 2018/12/21 18:10:00
public int reportCount; //定期点検、作業数 public int reportCount; //定期点検、作業数
public int enableReportEdit; // 作業編集可能区分
public int enableReportHistory; // 0: 履歴無し, 1: 履歴可 public int enableReportHistory; // 0: 履歴無し, 1: 履歴可
// 作業担当グループリスト // 作業担当グループリスト
public List<WorkingGroupDto> workingGroupDtoList; public List<TaskWorkerGroupDto> taskWorkerGroupDtoList;
public boolean equalsLastEdit(OperationDto dto) { public boolean equalsLastEdit(OperationDto dto) {
if (dto != null) { if (dto != null) {
...@@ -45,12 +45,12 @@ public class OperationDto extends AbstractDto { ...@@ -45,12 +45,12 @@ public class OperationDto extends AbstractDto {
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory }; return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit };
} }
@Override @Override
public Object[] getUpdateValues() { public Object[] getUpdateValues() {
return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, operationId }; return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit, operationId };
} }
@Override @Override
......
...@@ -19,7 +19,7 @@ public class TaskReportDto extends AbstractDto { ...@@ -19,7 +19,7 @@ public class TaskReportDto extends AbstractDto {
//  作業報告詳細リスト //  作業報告詳細リスト
public int taskReportLevel; // 作業報告レベル public int taskReportLevel; // 作業報告レベル
public int taskReportId; // 作業報告ID public int taskReportId; // 作業報告ID
public long taskReportInfoId; // 作業報告情報ID public int taskReportInfoId; // 作業報告情報ID
public Date reportStartDate; // 作業開始日 public Date reportStartDate; // 作業開始日
public Date reportEndDate; // 作業終了日 public Date reportEndDate; // 作業終了日
public int enableReport; // 報告可能区分 public int enableReport; // 報告可能区分
......
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 };
}
}
package jp.agentec.abook.abv.bl.dto;
import java.util.List;
/**
* Created by leej on 2019/03/18.
*/
public class WorkingGroupDto {
public int reportLevel;
public List<Integer> groupList;
}
...@@ -44,6 +44,7 @@ import jp.agentec.abook.abv.bl.data.dao.TaskDao; ...@@ -44,6 +44,7 @@ import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao; import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportItemsDao; import jp.agentec.abook.abv.bl.data.dao.TaskReportItemsDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportSendDao; import jp.agentec.abook.abv.bl.data.dao.TaskReportSendDao;
import jp.agentec.abook.abv.bl.data.dao.TaskWorkerGroupDao;
import jp.agentec.abook.abv.bl.data.dao.WorkerGroupDao; import jp.agentec.abook.abv.bl.data.dao.WorkerGroupDao;
import jp.agentec.abook.abv.bl.dto.CategoryContentDto; import jp.agentec.abook.abv.bl.dto.CategoryContentDto;
import jp.agentec.abook.abv.bl.dto.ContentDto; import jp.agentec.abook.abv.bl.dto.ContentDto;
...@@ -55,6 +56,7 @@ import jp.agentec.abook.abv.bl.dto.TaskDto; ...@@ -55,6 +56,7 @@ import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto; import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.abook.abv.bl.dto.TaskReportItemsDto; import jp.agentec.abook.abv.bl.dto.TaskReportItemsDto;
import jp.agentec.abook.abv.bl.dto.TaskReportSendDto; import jp.agentec.abook.abv.bl.dto.TaskReportSendDto;
import jp.agentec.abook.abv.bl.dto.TaskWorkerGroupDto;
import jp.agentec.abook.abv.bl.dto.WorkerGroupDto; import jp.agentec.abook.abv.bl.dto.WorkerGroupDto;
import jp.agentec.adf.util.DateTimeFormat; import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
...@@ -83,11 +85,13 @@ public class OperationLogic extends AbstractLogic { ...@@ -83,11 +85,13 @@ public class OperationLogic extends AbstractLogic {
private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class); private PushMessageDao mPushMessageDao = AbstractDao.getDao(PushMessageDao.class);
private TaskWorkerGroupDao mTaskWorkerGroupDao = AbstractDao.getDao(TaskWorkerGroupDao.class);
public void initializeOperations() throws AcmsException, NetworkDisconnectedException { public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
// 作業グループリスト取得
setWorkingGroupList();
// プロジェクト一覧取得し、登録・更新・削除する // プロジェクト一覧取得し、登録・更新・削除する
retrieveServerOperation(); retrieveServerOperation();
// 作業者グループリスト取得
setWorkingGroupList();
} }
/** /**
...@@ -112,7 +116,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -112,7 +116,7 @@ public class OperationLogic extends AbstractLogic {
List<Long> localOperationContentIds = mOperationContentDao.getContentIds(serverOperationDto.operationId); List<Long> localOperationContentIds = mOperationContentDao.getContentIds(serverOperationDto.operationId);
boolean operationContentFlg = false; boolean operationContentFlg = false;
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) { for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
if (localOperationContentIds == null) { if (localOperationContentIds == null || localOperationContentIds.size() == 0) {
// insert // insert
mOperationContentDao.insertOperationContent(operationContentDto); mOperationContentDao.insertOperationContent(operationContentDto);
} else { } else {
...@@ -136,6 +140,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -136,6 +140,7 @@ public class OperationLogic extends AbstractLogic {
if (mOperationContentDao.isExistMainOperationContent(serverOperationDto.operationId)) { if (mOperationContentDao.isExistMainOperationContent(serverOperationDto.operationId)) {
serverOperationDto.contentCreatingFlg = false; serverOperationDto.contentCreatingFlg = false;
} }
mOperationDao.update(serverOperationDto); mOperationDao.update(serverOperationDto);
// 更新することで登録フラグをfalseにセット // 更新することで登録フラグをfalseにセット
insertFlg = false; insertFlg = false;
...@@ -163,8 +168,18 @@ public class OperationLogic extends AbstractLogic { ...@@ -163,8 +168,18 @@ public class OperationLogic extends AbstractLogic {
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) { for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
mOperationContentDao.insertOperationContent(operationContentDto); mOperationContentDao.insertOperationContent(operationContentDto);
} }
}
// 作業担当グループ登録
mTaskWorkerGroupDao.deleteByOperationId(serverOperationDto.operationId);
for (TaskWorkerGroupDto taskWorkerGroupDto : serverOperationDto.taskWorkerGroupDtoList) {
taskWorkerGroupDto.operationId = serverOperationDto.operationId;
for (Integer groupId : taskWorkerGroupDto.groupList) {
taskWorkerGroupDto.groupId = groupId;
mTaskWorkerGroupDao.insert(taskWorkerGroupDto);
} }
}
for (PushMessageDto dto : serverOperationDto.pushMessageList) { for (PushMessageDto dto : serverOperationDto.pushMessageList) {
mPushMessageDao.insert(dto); mPushMessageDao.insert(dto);
} }
...@@ -207,12 +222,22 @@ public class OperationLogic extends AbstractLogic { ...@@ -207,12 +222,22 @@ public class OperationLogic extends AbstractLogic {
private void setWorkingGroupList() throws NetworkDisconnectedException, AcmsException { private void setWorkingGroupList() throws NetworkDisconnectedException, AcmsException {
AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid); AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid);
WorkerGroupJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getWorkingGroupList(param); WorkerGroupJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getWorkingGroupList(param);
mWorkerGroupDao.deleteAll(); List<Integer> localWorkerGroupIdList = mWorkerGroupDao.getAllWorkerGroupId();
for (WorkerGroupDto dto : json.workerGroupList) { for (WorkerGroupDto dto : json.workerGroupList) {
if (mWorkerGroupDao.isExist(dto.groupId)) {
localWorkerGroupIdList.remove(dto.groupId);
mWorkerGroupDao.update(dto);
} else {
mWorkerGroupDao.insert(dto); mWorkerGroupDao.insert(dto);
} }
} }
// 削除
for (Integer groupId : localWorkerGroupIdList) {
mWorkerGroupDao.deleteById(groupId);
}
}
/** /**
* 作業指示の登録 * 作業指示の登録
* *
...@@ -225,10 +250,8 @@ public class OperationLogic extends AbstractLogic { ...@@ -225,10 +250,8 @@ public class OperationLogic extends AbstractLogic {
* @param dataSendFlg * @param dataSendFlg
* @throws IOException * @throws IOException
*/ */
public void insertTaskReportLevel(String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
// #32782 指示者テーブル関連削除 start
// TODO Delete
TaskDto taskDto = new TaskDto(); TaskDto taskDto = new TaskDto();
TaskReportDto taskReportDto = new TaskReportDto(); TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskJson = taskDirectionsJson.getJSONObject("task"); JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
...@@ -287,7 +310,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -287,7 +310,6 @@ public class OperationLogic extends AbstractLogic {
if (result) { if (result) {
FileUtil.delete(tempDirPath); FileUtil.delete(tempDirPath);
} }
// #32782 指示者テーブル関連削除 end
} }
/** /**
...@@ -302,7 +324,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -302,7 +324,7 @@ public class OperationLogic extends AbstractLogic {
* @param dataSendFlg * @param dataSendFlg
* @throws IOException * @throws IOException
*/ */
public void updateTaskReportLevel(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void updateTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) { if (taskDto == null) {
// ignore // ignore
...@@ -405,10 +427,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -405,10 +427,9 @@ public class OperationLogic extends AbstractLogic {
* @param localAttachedFileName * @param localAttachedFileName
* @param attachedChangeFlag * @param attachedChangeFlag
* @param dataSendFlg * @param dataSendFlg
* @param taskReportLevel
* @throws IOException * @throws IOException
*/ */
public void insertTaskReportReplyLevel(String taskKey, long operationId, int taskReportLevel, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void insertTaskReportReply(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) { if (taskDto == null) {
//TODO error //TODO error
...@@ -421,7 +442,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -421,7 +442,7 @@ public class OperationLogic extends AbstractLogic {
while (taskKeys.hasNext()) { while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto(); TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next(); String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_2_")) { if (itemKey.startsWith("q_3_")) {
taskDto.taskStatus = taskJson.getInt(itemKey); taskDto.taskStatus = taskJson.getInt(itemKey);
} }
taskReportItemsDto.taskKey = taskKey; taskReportItemsDto.taskKey = taskKey;
...@@ -440,18 +461,19 @@ public class OperationLogic extends AbstractLogic { ...@@ -440,18 +461,19 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.attachedFileSendFlg = attachedChangeFlag; taskReportDto.attachedFileSendFlg = attachedChangeFlag;
// 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする // 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey); List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey, Constant.TaskReportLevel.ReportReplyType);
if (taskReport.size() > 0) { if (taskReport.size() > 0) {
mTaskReportDao.update(taskReportDto); mTaskReportDao.update(taskReportDto);
} else { } else {
mTaskReportDao.insert(taskReportDto); mTaskReportDao.insert(taskReportDto);
} }
mTaskDao.update(taskDto); mTaskDao.update(taskDto);
//添付ファイル変更の場合、以下の処理を行う //添付ファイル変更の場合、以下の処理を行う
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey); String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel); String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType);
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
JSONObject attachedListJson = taskReportJson.getJSONObject("attached"); JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
...@@ -470,24 +492,24 @@ public class OperationLogic extends AbstractLogic { ...@@ -470,24 +492,24 @@ public class OperationLogic extends AbstractLogic {
* 定期点検データ新規 * 定期点検データ新規
* @param operationId * @param operationId
* @param contentId * @param contentId
* @param routineTaskReportDto * @param taskReportDto
* @param attachedChangeFlag * @param attachedChangeFlag
* @param dataSendFlg * @param dataSendFlg
* @throws IOException * @throws IOException
*/ */
public void insertRoutineTaskReport(long operationId, long contentId, RoutineTaskReportDto routineTaskReportDto, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void insertRoutineTaskReport(long operationId, long contentId, TaskReportDto taskReportDto, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
routineTaskReportDto.attachedFileSendFlag = attachedChangeFlag; taskReportDto.attachedFileSendFlg = attachedChangeFlag;
routineTaskReportDto.dataSendFlag = dataSendFlg; taskReportDto.dataSendFlg = dataSendFlg;
mRoutineTaskReportDao.insert(routineTaskReportDto); mTaskReportDao.insert(taskReportDto);
if (!StringUtil.isNullOrEmpty(routineTaskReportDto.jsonData)) { if (!StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
JSONObject taskReportJson = new JSONObject(routineTaskReportDto.jsonData); JSONObject taskReportJson = new JSONObject(taskReportDto.jsonData);
JSONObject taskJson = taskReportJson.getJSONObject("task"); JSONObject taskJson = taskReportJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys(); Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) { while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto(); TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next(); String itemKey = (String) taskKeys.next();
taskReportItemsDto.taskKey = routineTaskReportDto.taskKey; taskReportItemsDto.taskKey = taskReportDto.taskKey;
taskReportItemsDto.itemKey = itemKey; taskReportItemsDto.itemKey = itemKey;
try { try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey); taskReportItemsDto.inputValue = taskJson.getString(itemKey);
...@@ -500,16 +522,12 @@ public class OperationLogic extends AbstractLogic { ...@@ -500,16 +522,12 @@ public class OperationLogic extends AbstractLogic {
} }
//添付ファイル変更の場合、以下の処理を行う //添付ファイル変更の場合、以下の処理を行う
String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(routineTaskReportDto.reportStartDate); String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(taskReportDto.reportStartDate);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, routineTaskReportDto.taskKey); String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskReportDto.taskKey);
// #32926 作業報告画面改善 start String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskReportDto.taskKey, taskReportDto.taskReportId, strReportStartDate, 0);
// TODO routineTaskReportDto -> taskReportDto
// String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, routineTaskReportDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, routineTaskReportDto.taskReportLevel);
String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, routineTaskReportDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, 0);
// #32926 作業報告画面改善 end
if (!StringUtil.isNullOrEmpty(routineTaskReportDto.jsonData)) { if (!StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
JSONObject attachedListJson = (new JSONObject(routineTaskReportDto.jsonData)).getJSONObject("attached"); JSONObject attachedListJson = (new JSONObject(taskReportDto.jsonData)).getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson); List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除 // コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames); deleteDifferentialFile(tempDirPath, attachedFileNames);
...@@ -522,12 +540,12 @@ public class OperationLogic extends AbstractLogic { ...@@ -522,12 +540,12 @@ public class OperationLogic extends AbstractLogic {
} }
} }
public void updateTaskReportReplyLevel(String taskKey, int taskReportLevel, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException { public void updateTaskReportReplyLevel(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel); TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportReplyType);
if (taskReportDto == null) { if (taskReportDto == null) {
Logger.w(TAG, "taskReportDto is null"); Logger.w(TAG, "taskReportDto is null");
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
insertTaskReportReplyLevel(taskKey, operationId, taskReportLevel, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg); insertTaskReportReply(taskKey, operationId, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg);
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
return; return;
} }
...@@ -542,7 +560,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -542,7 +560,7 @@ public class OperationLogic extends AbstractLogic {
taskReportItemsDto.inputValue = newValue; taskReportItemsDto.inputValue = newValue;
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto); mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
} }
if (taskReportItemsDto.itemKey.startsWith("q_2_")) { if (taskReportItemsDto.itemKey.startsWith("q_3_")) {
// 値が異なるため、作業コードの入力値を変更する // 値が異なるため、作業コードの入力値を変更する
taskDto.taskStatus = Integer.parseInt(taskReportItemsDto.inputValue); taskDto.taskStatus = Integer.parseInt(taskReportItemsDto.inputValue);
} }
...@@ -562,7 +580,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -562,7 +580,7 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.update(taskDto); mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey); String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel); String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType);
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
if (taskReportDto.attachedFileSendFlg) { if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う //添付ファイル変更の場合、以下の処理を行う
...@@ -585,20 +603,20 @@ public class OperationLogic extends AbstractLogic { ...@@ -585,20 +603,20 @@ public class OperationLogic extends AbstractLogic {
* 定期点検データ更新 * 定期点検データ更新
* @param operationId * @param operationId
* @param contentId * @param contentId
* @param routineTaskReportDto * @param taskReportDto
* @param attachedChangeFlag * @param attachedChangeFlag
* @param dataSendFlg * @param dataSendFlg
* @param insertFlg * @param insertFlg
* @param reportedFlg * @param reportedFlg
* @throws IOException * @throws IOException
*/ */
public void updateRoutineTaskReport(long operationId, long contentId, RoutineTaskReportDto routineTaskReportDto, boolean attachedChangeFlag, boolean dataSendFlg, boolean insertFlg, boolean reportedFlg) throws IOException { public void updateRoutineTaskReport(long operationId, long contentId, TaskReportDto taskReportDto, boolean attachedChangeFlag, boolean dataSendFlg, boolean insertFlg, boolean reportedFlg) throws IOException {
routineTaskReportDto.attachedFileSendFlag = attachedChangeFlag; taskReportDto.attachedFileSendFlg = attachedChangeFlag;
routineTaskReportDto.dataSendFlag = dataSendFlg; taskReportDto.dataSendFlg = dataSendFlg;
mRoutineTaskReportDao.update(routineTaskReportDto, reportedFlg); mTaskReportDao.update(taskReportDto, reportedFlg);
if (!StringUtil.isNullOrEmpty(routineTaskReportDto.jsonData)) { if (!StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
JSONObject taskReportJson = new JSONObject(routineTaskReportDto.jsonData); JSONObject taskReportJson = new JSONObject(taskReportDto.jsonData);
JSONObject taskJson = taskReportJson.getJSONObject("task"); JSONObject taskJson = taskReportJson.getJSONObject("task");
if (insertFlg) { if (insertFlg) {
...@@ -606,7 +624,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -606,7 +624,7 @@ public class OperationLogic extends AbstractLogic {
while (taskKeys.hasNext()) { while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto(); TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next(); String itemKey = (String) taskKeys.next();
taskReportItemsDto.taskKey = routineTaskReportDto.taskKey; taskReportItemsDto.taskKey = taskReportDto.taskKey;
taskReportItemsDto.itemKey = itemKey; taskReportItemsDto.itemKey = itemKey;
taskReportItemsDto.taskReportLevel = Constant.TaskReportLevel.ReportType; taskReportItemsDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
try { try {
...@@ -618,7 +636,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -618,7 +636,7 @@ public class OperationLogic extends AbstractLogic {
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto); mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
} }
} else { } else {
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(routineTaskReportDto.taskKey, Constant.TaskReportLevel.ReportType); List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskReportDto.taskKey, Constant.TaskReportLevel.ReportType);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) { for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try { try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey); String newValue = taskJson.getString(taskReportItemsDto.itemKey);
...@@ -635,17 +653,15 @@ public class OperationLogic extends AbstractLogic { ...@@ -635,17 +653,15 @@ public class OperationLogic extends AbstractLogic {
} }
} }
String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(routineTaskReportDto.reportStartDate); String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(taskReportDto.reportStartDate);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, routineTaskReportDto.taskKey); String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskReportDto.taskKey);
// #32926 作業報告画面改善 start
// TODO routineTaskReportDto -> taskReportDto String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskReportDto.taskKey, taskReportDto.taskReportId, strReportStartDate, taskReportDto.taskReportLevel);
// String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, routineTaskReportDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, taskReportDto.taskReportLevel);
String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, routineTaskReportDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, 0);
// #32926 作業報告画面改善 end
if (insertFlg) { if (insertFlg) {
if (!StringUtil.isNullOrEmpty(routineTaskReportDto.jsonData)) { if (!StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
JSONObject attachedListJson = (new JSONObject(routineTaskReportDto.jsonData)).getJSONObject("attached"); JSONObject attachedListJson = (new JSONObject(taskReportDto.jsonData)).getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson); List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除 // コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames); deleteDifferentialFile(tempDirPath, attachedFileNames);
...@@ -657,11 +673,11 @@ public class OperationLogic extends AbstractLogic { ...@@ -657,11 +673,11 @@ public class OperationLogic extends AbstractLogic {
FileUtil.delete(tempDirPath); FileUtil.delete(tempDirPath);
} }
} else { } else {
if (routineTaskReportDto.attachedFileSendFlag) { if (taskReportDto.attachedFileSendFlg) {
if (StringUtil.isNullOrEmpty(routineTaskReportDto.jsonData)) { if (StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
//添付ファイル変更の場合、以下の処理を行う //添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = (new JSONObject(routineTaskReportDto.jsonData)).getJSONObject("attached"); JSONObject attachedListJson = (new JSONObject(taskReportDto.jsonData)).getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson); List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除 // コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames); deleteDifferentialFile(tempDirPath, attachedFileNames);
...@@ -753,8 +769,14 @@ public class OperationLogic extends AbstractLogic { ...@@ -753,8 +769,14 @@ public class OperationLogic extends AbstractLogic {
return mTaskReportSendDao.getLastTaskReportSendId(taskKey); return mTaskReportSendDao.getLastTaskReportSendId(taskKey);
} }
public void deleteTaskReportReply(long operationId, long contentId, String taskKey, int taskReportLevel) { /**
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel); * 報告回答を削除
* @param operationId
* @param contentId
* @param taskKey
*/
public void deleteTaskReportReply(long operationId, long contentId, String taskKey) {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportReplyType);
if(taskReportDto != null) { if(taskReportDto != null) {
taskReportDto.dataSendFlg = true; taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false; taskReportDto.attachedFileSendFlg = false;
...@@ -772,7 +794,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -772,7 +794,7 @@ public class OperationLogic extends AbstractLogic {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel)); FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType));
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
} }
...@@ -782,12 +804,8 @@ public class OperationLogic extends AbstractLogic { ...@@ -782,12 +804,8 @@ public class OperationLogic extends AbstractLogic {
* @param contentId * @param contentId
* @param dto * @param dto
*/ */
// #32926 作業報告画面改善 start public void deleteTaskReport(long operationId, long contentId, TaskReportDto dto) {
// TODO RoutineTaskReportDto -> TaskReportDto mTaskReportDao.delete(dto);
// public void deleteRoutineTaskReport(long operationId, long contentId, TaskReportDto dto) {
public void deleteRoutineTaskReport(long operationId, long contentId, RoutineTaskReportDto dto) {
// #32926 作業報告画面改善 end
mRoutineTaskReportDao.delete(dto);
String reportStartDate = DateTimeUtil.toString(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen); String reportStartDate = DateTimeUtil.toString(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
mTaskReportSendDao.deleteByTaskKeyIdDate(dto.taskKey, dto.taskReportId, reportStartDate); mTaskReportSendDao.deleteByTaskKeyIdDate(dto.taskKey, dto.taskReportId, reportStartDate);
...@@ -796,16 +814,10 @@ public class OperationLogic extends AbstractLogic { ...@@ -796,16 +814,10 @@ public class OperationLogic extends AbstractLogic {
// 作業報告のディレクトリ削除 // 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, dto.taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, dto.taskKey));
// #32926 作業報告画面改善 start
// TODO routineTaskReportDto -> taskReportDto
// FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate, dto.taskReportLevel));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate, 0)); FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate, 0));
// 作業報告送信のディレクトリ削除 // 作業報告送信のディレクトリ削除
// TODO routineTaskReportDto -> taskReportDto
// FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate, dto.taskReportLevel));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate, 0)); FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate, 0));
// #32926 作業報告画面改善 end
} }
/** /**
...@@ -840,12 +852,12 @@ public class OperationLogic extends AbstractLogic { ...@@ -840,12 +852,12 @@ public class OperationLogic extends AbstractLogic {
} }
public RoutineTaskReportDto getRoutineTaskReportUtc(String taskKey, int taskReportId, String reportStartDate) { public TaskReportDto getRoutineTaskReportUtc(String taskKey, int taskReportId, String reportStartDate) {
return mRoutineTaskReportDao.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate); return mTaskReportDao.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
} }
public List<RoutineTaskReportDto> getRoutineTaskReportByTaskKey(String taskKey) { public List<TaskReportDto> getRoutineTaskReportByTaskKey(String taskKey) {
return mRoutineTaskReportDao.geRoutineTaskReportByTaskKey(taskKey); return mTaskReportDao.geRoutineTaskReportByTaskKey(taskKey);
} }
/** /**
...@@ -869,11 +881,10 @@ public class OperationLogic extends AbstractLogic { ...@@ -869,11 +881,10 @@ public class OperationLogic extends AbstractLogic {
* ホットスポットの更新 * ホットスポットの更新
* @param taskKey * @param taskKey
* @param param * @param param
* @param taskReportLevel
*/ */
public void updateTaskHotspot(String taskKey, Map<String, String> param, int taskReportLevel) { public void updateTaskHotspot(String taskKey, Map<String, String> param) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel); TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportType);
taskReportDto.dataSendFlg = true; taskReportDto.dataSendFlg = true;
taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT); taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
mTaskReportDao.update(taskReportDto); mTaskReportDao.update(taskReportDto);
...@@ -903,19 +914,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -903,19 +914,6 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.update(taskDto); mTaskDao.update(taskDto);
} }
/**
* 作業指示、作業報告用のjsonファイル
* taskReport.jsonとtaskReportSuggest.jsonとhotspot.jsonを作成
*
* @param operationId
* @param contentPath
* @throws IOException
*/
public void createJsonForOperationContent(Long operationId, String contentPath) throws IOException {
createJsonForOperationContent(operationId, contentPath, false);
}
/** /**
* 作業指示、作業報告用のjsonファイル * 作業指示、作業報告用のjsonファイル
* taskReport.jsonとtaskReportSuggest.jsonとhotspot.jsonを作成 * taskReport.jsonとtaskReportSuggest.jsonとhotspot.jsonを作成
...@@ -1005,8 +1003,8 @@ public class OperationLogic extends AbstractLogic { ...@@ -1005,8 +1003,8 @@ public class OperationLogic extends AbstractLogic {
List<JSONObject> workerGroupJsonList = new ArrayList<JSONObject>(); List<JSONObject> workerGroupJsonList = new ArrayList<JSONObject>();
JSONObject taskGroupJson = new JSONObject(); JSONObject taskGroupJson = new JSONObject();
List<WorkerGroupDto> workerGroupDtoList = mWorkerGroupDao.getAllWorkerGroup(); List<TaskWorkerGroupDto> taskWorkerGroupDtoList = mTaskWorkerGroupDao.getTaskWorkerGroupByOperationId(operationId);
for (WorkerGroupDto dto : workerGroupDtoList) { for (TaskWorkerGroupDto dto : taskWorkerGroupDtoList) {
JSONObject workerGroupJson = new JSONObject(); JSONObject workerGroupJson = new JSONObject();
workerGroupJson.put(ABookKeys.GROUP_ID, dto.groupId); workerGroupJson.put(ABookKeys.GROUP_ID, dto.groupId);
workerGroupJson.put(ABookKeys.GROUP_NAME, dto.groupName); workerGroupJson.put(ABookKeys.GROUP_NAME, dto.groupName);
...@@ -1021,9 +1019,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -1021,9 +1019,9 @@ public class OperationLogic extends AbstractLogic {
} }
taskGroupJson.put("taskGroup", workerGroupJsonList); taskGroupJson.put("taskGroup", workerGroupJsonList);
Logger.d(TAG, "createWorkerGroupJson : " + taskGroupJson.toString()); Logger.d(TAG, "createWorkerGroupJson : " + taskGroupJson.toString());
Logger.d(TAG,contentPath + "/workerGroup.json"); Logger.d(TAG,contentPath + "/workingGroup.json");
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
FileUtil.createFile(contentPath + "/workerGroup.json", taskGroupJson.toString()); FileUtil.createFile(contentPath + "/workingGroup.json", taskGroupJson.toString());
} }
/** /**
...@@ -1061,17 +1059,13 @@ public class OperationLogic extends AbstractLogic { ...@@ -1061,17 +1059,13 @@ public class OperationLogic extends AbstractLogic {
public void createTaskReportJson(Long operationId, String contentPath) throws IOException { public void createTaskReportJson(Long operationId, String contentPath) throws IOException {
List<JSONObject> taskReportJsonList = new ArrayList<JSONObject>(); List<JSONObject> taskReportJsonList = new ArrayList<JSONObject>();
JSONObject taskReportJson = new JSONObject(); JSONObject taskReportJson = new JSONObject();
JSONObject taskReportJsonRow;
List<TaskReportDto> taskReportDtoList = mTaskReportDao.getTaskReportByOperationId(operationId); List<TaskReportDto> taskReportDtoList = mTaskReportDao.getTaskReportByOperationId(operationId);
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
int taskReportLevel = 0; int taskReportLevel = 0;
for (TaskReportDto dto : taskReportDtoList) { for (TaskReportDto dto : taskReportDtoList) {
taskReportJsonRow = new JSONObject();
taskReportLevel = dto.taskReportLevel; taskReportLevel = dto.taskReportLevel;
if(dto.jsonData != null && dto.jsonData.length() > 0) { if(dto.jsonData != null && dto.jsonData.length() > 0) {
taskReportJsonRow.put(ABookKeys.HAS_AUTHORITY, dto.enableReport); taskReportJsonList.add(new JSONObject(dto.jsonData).put(ABookKeys.HAS_AUTHORITY, dto.enableReport));
taskReportJsonList.add(new JSONObject(dto.jsonData));
taskReportJsonList.add(taskReportJsonRow);
} }
} }
taskReportJson.put(String.format("taskReport_%d", taskReportLevel), taskReportJsonList); taskReportJson.put(String.format("taskReport_%d", taskReportLevel), taskReportJsonList);
...@@ -1283,7 +1277,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -1283,7 +1277,7 @@ public class OperationLogic extends AbstractLogic {
* @param taskKey * @param taskKey
* @throws Exception * @throws Exception
*/ */
public void sendTaskReportSendData(long operationId, String taskKey, Callback progressCallback) throws Exception { public boolean sendTaskReportSendData(long operationId, String taskKey, boolean isRoutinTask, Callback progressCallback) throws Exception {
List<TaskReportDto> taskReportDtoList = null; List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0; int maxProgress = 0;
if (taskKey == null) { if (taskKey == null) {
...@@ -1301,8 +1295,17 @@ public class OperationLogic extends AbstractLogic { ...@@ -1301,8 +1295,17 @@ public class OperationLogic extends AbstractLogic {
int progress = maxProgress / allSendCount; int progress = maxProgress / allSendCount;
for (TaskReportDto taskReportDto : taskReportDtoList) { for (TaskReportDto taskReportDto : taskReportDtoList) {
List<TaskReportSendDto> taskReportSendDtoList = mTaskReportSendDao.getSendableTaskReportSendData(taskReportDto.taskKey); List<TaskReportSendDto> taskReportSendDtoList;
int lastTaskReportSendId = mTaskReportSendDao.getLastTaskReportSendId(taskReportDto.taskKey); int lastTaskReportSendId;
if (isRoutinTask) {
// 定期点検
String reportStartDateStr = DateTimeUtil.toString(taskReportDto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
taskReportSendDtoList = mTaskReportSendDao.getSendableTaskReportSendData(taskReportDto.taskKey, taskReportDto.taskReportId, reportStartDateStr);
lastTaskReportSendId = mTaskReportSendDao.getLastTaskReportSendId(taskReportDto.taskKey, taskReportDto.taskReportId, reportStartDateStr);
} else {
taskReportSendDtoList = mTaskReportSendDao.getSendableTaskReportSendData(taskReportDto.taskKey);
lastTaskReportSendId = mTaskReportSendDao.getLastTaskReportSendId(taskReportDto.taskKey);
}
for (TaskReportSendDto taskReportSendDto : taskReportSendDtoList) { for (TaskReportSendDto taskReportSendDto : taskReportSendDtoList) {
// 履歴なし:元のattachedFileSendFlg // 履歴なし:元のattachedFileSendFlg
...@@ -1313,10 +1316,11 @@ public class OperationLogic extends AbstractLogic { ...@@ -1313,10 +1316,11 @@ public class OperationLogic extends AbstractLogic {
} }
File zipFile = null; File zipFile = null;
String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(taskReportDto.reportStartDate);
if (taskReportDto.attachedFileSendFlg) { if (taskReportDto.attachedFileSendFlg) {
String fileName = null; String fileName = null;
zipFile = createAttachedFileForSend(operationId, taskReportDto.taskKey, taskReportSendDto.taskReportSendId, false, 0, "", taskReportDto.taskReportLevel); zipFile = createAttachedFileForSend(operationId, taskReportDto.taskKey, taskReportSendDto.taskReportSendId, isRoutinTask, taskReportDto.taskReportId, strReportStartDate, taskReportDto.taskReportLevel);
if (zipFile != null) { if (zipFile != null) {
fileName = FileUtil.getFilenameWithoutExt(zipFile.getName()); fileName = FileUtil.getFilenameWithoutExt(zipFile.getName());
} }
...@@ -1324,23 +1328,29 @@ public class OperationLogic extends AbstractLogic { ...@@ -1324,23 +1328,29 @@ public class OperationLogic extends AbstractLogic {
} }
try { try {
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendTaskData( AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).testSendTaskData(
cache.getMemberInfo().sid, cache.getMemberInfo().sid,
String.valueOf(operationId), operationId,
taskReportDto.taskKey, taskReportDto,
taskReportDto.delFlg ? "1" : "0",
String.valueOf(taskReportDto.taskReportLevel),
taskReportDto.taskHotSpotInfo,
taskReportSendDto.jsonData,
zipFile, zipFile,
taskReportDto.attachedFileSendFlg, taskReportSendDto.saveDate,
taskReportSendDto.saveDate isRoutinTask
); );
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId); mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
// #32926 作業報告画面改善 start
if (isRoutinTask) {
// 定期点検
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId, taskReportDto.taskReportLevel));
} else {
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId, taskReportDto.taskReportLevel)); FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId, taskReportDto.taskReportLevel));
// #32926 作業報告画面改善 end }
} catch (ABVException ex) {
if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P005) {
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId, taskReportDto.taskReportLevel));
return true;
}
} catch (Exception ex) { } catch (Exception ex) {
throw ex; throw ex;
} finally { } finally {
...@@ -1360,105 +1370,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -1360,105 +1370,7 @@ public class OperationLogic extends AbstractLogic {
} }
} }
} }
} return false;
/**
* 定期点検用、作業報告履歴データ送信
* @param operationId
* @param taskKey
* @throws Exception
*/
public int sendRoutineTaskReportSendData(long operationId, String taskKey, Callback progressCallback) throws Exception {
List<RoutineTaskReportDto> routineTaskReportDtoList = null;
int sendErrorCnt = 0;
int maxProgress = 0;
if (taskKey == null) {
routineTaskReportDtoList = mRoutineTaskReportDao.getSendableRoutineTaskReportData(operationId);
maxProgress = 40;
} else {
routineTaskReportDtoList = mRoutineTaskReportDao.getSendableRoutineTaskReportData(operationId, taskKey);
maxProgress = 100;
}
if (routineTaskReportDtoList != null && routineTaskReportDtoList.size() > 0) {
OperationDto operationDto = mOperationDao.getOperation(operationId);
int allSendCount = mTaskReportSendDao.getSendableTaskReportSendDataCount(operationId, taskKey);
int progress = maxProgress / allSendCount;
for (RoutineTaskReportDto routineTaskReportDto : routineTaskReportDtoList) {
String reportStartDate = DateTimeUtil.toString(routineTaskReportDto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
List<TaskReportSendDto> taskReportSendDtoList = mTaskReportSendDao.getSendableTaskReportSendData(routineTaskReportDto.taskKey, routineTaskReportDto.taskReportId, reportStartDate);
int lastTaskReportSendId = mTaskReportSendDao.getLastTaskReportSendId(routineTaskReportDto.taskKey, routineTaskReportDto.taskReportId, reportStartDate);
for (TaskReportSendDto taskReportSendDto : taskReportSendDtoList) {
// 履歴なし:元のattachedFileSendFlg
// 履歴追加:古い履歴はtrue
// 履歴更新:true、ファイルに変更が無くてもzipファイル作成
if (taskReportSendDto.taskReportSendId < lastTaskReportSendId || operationDto.enableReportHistory == Constant.EnableReportHistory.Enable) {
routineTaskReportDto.attachedFileSendFlag = true;
}
File zipFile = null;
String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(routineTaskReportDto.reportStartDate);
if (routineTaskReportDto.attachedFileSendFlag) {
String fileName = null;
// #32926 作業報告画面改善 start
// TODO routineTaskReportDto -> taskReportDto
// zipFile = createAttachedFileForSend(operationId, routineTaskReportDto.taskKey, taskReportSendDto.taskReportSendId, true, routineTaskReportDto.taskReportId, strReportStartDate, taskReportDto.taskReportLevel);
zipFile = createAttachedFileForSend(operationId, routineTaskReportDto.taskKey, taskReportSendDto.taskReportSendId, true, routineTaskReportDto.taskReportId, strReportStartDate, 0);
// #32926 作業報告画面改善 end
if (zipFile != null) {
fileName = FileUtil.getFilenameWithoutExt(zipFile.getName());
}
routineTaskReportDto.localAttachedFileName = fileName != null ? SecurityUtil.getMd5Hash(fileName) : null;
}
try {
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendRoutineTaskReportData(
cache.getMemberInfo().sid,
operationId,
routineTaskReportDto.taskReportId,
routineTaskReportDto.taskReportInfoId,
routineTaskReportDto.reportStartDate,
taskReportSendDto.jsonData,
zipFile,
routineTaskReportDto.attachedFileSendFlag,
taskReportSendDto.saveDate
);
progressCallback.callback(new Integer(progress));
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
// #32926 作業報告画面改善 start
// TODO routineTaskReportDto -> taskReportDto
// FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId, taskReportDto.taskReportLevel));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId, 0));
// #33926 作業報告画面改善 end
} catch (ABVException ex) {
if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P005) {
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
// #32926 作業報告画面改善 start
// TODO routineTaskReportDto -> taskReportDto
// FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId, taskReportDto.taskReportLevel));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, routineTaskReportDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId, 0));
// #32926 作業報告画面改善 end
sendErrorCnt++;
}
} catch (Exception ex) {
throw ex;
} finally {
if (zipFile != null) {
zipFile.delete();
}
}
}
routineTaskReportDto.dataSendFlag = false;
routineTaskReportDto.attachedFileSendFlag = false;
mRoutineTaskReportDao.update(routineTaskReportDto, false);
}
}
return sendErrorCnt;
} }
/** /**
...@@ -1697,4 +1609,14 @@ public class OperationLogic extends AbstractLogic { ...@@ -1697,4 +1609,14 @@ public class OperationLogic extends AbstractLogic {
} }
return null; return null;
} }
/**
* 作業報告の取得
* @param taskKey
* @param taskReportlevel
* @return
*/
public TaskReportDto getTaskReport(String taskKey, int taskReportlevel) {
return mTaskReportDao.getTaskReport(taskKey, taskReportlevel);
}
} }
...@@ -855,13 +855,10 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -855,13 +855,10 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mCmd = abookCheckParam.get(ABookKeys.CMD); mCmd = abookCheckParam.get(ABookKeys.CMD);
mTaskKey = abookCheckParam.get(ABookKeys.TASK_KEY); mTaskKey = abookCheckParam.get(ABookKeys.TASK_KEY);
// #32926 作業報告画面改善 start
int taskReportLevel = 0; // 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答)) int taskReportLevel = 0; // 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答))
if (abookCheckParam.containsKey(ABookKeys.TASK_REPORT_LEVEL)) { if (abookCheckParam.containsKey(ABookKeys.TASK_REPORT_LEVEL)) {
taskReportLevel = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_LEVEL)); // 作業報告レベル taskReportLevel = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_LEVEL)); // 作業報告レベル
} }
// #32926 作業報告画面改善 end
int taskReportId = 0; int taskReportId = 0;
String reportStartDate = ""; String reportStartDate = "";
...@@ -870,9 +867,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -870,9 +867,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE); 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, if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
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_DELETE_TASK_REPORT, ABookKeys.CMD_CANCEL_TASK_REPORT, ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
boolean isError = false; boolean isError = false;
try { try {
...@@ -881,19 +877,15 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -881,19 +877,15 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
if (isOperationPdf && operationTaskDto != null && StringUtil.equalsAny(mCmd, if (isOperationPdf && operationTaskDto != null && StringUtil.equalsAny(mCmd,
ABookKeys.CMD_INSERT_TASK_DIRECTIONS,
ABookKeys.CMD_UPDATE_TASK_DIRECTIONS,
ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_INSERT_TASK_REPORT,
ABookKeys.CMD_UPDATE_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_MOVE_HOT_SPOT,
ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) { ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
String taskCode = ""; String taskCode = "";
// #32781 start if (abookCheckParam.get(ABookKeys.TASK_REPORT) != null) {
// TODO TASK_DIRECTIONSの削除され、TASK_REPORTに変更する JSONObject tastReportJson = new JSONObject(abookCheckParam.get(ABookKeys.TASK_REPORT));
if (abookCheckParam.get(ABookKeys.TASK_DIRECTIONS) != null) { JSONObject taskJson = tastReportJson.getJSONObject(ABookKeys.TASK);
JSONObject direction = new JSONObject(abookCheckParam.get(ABookKeys.TASK_DIRECTIONS));
JSONObject taskJson = direction.getJSONObject(ABookKeys.TASK);
Iterator taskKeys = taskJson.keys(); Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) { while (taskKeys.hasNext()) {
String itemKey = (String) taskKeys.next(); String itemKey = (String) taskKeys.next();
...@@ -902,7 +894,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -902,7 +894,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
} }
} }
// #32781 end
if (abookCheckParam.get(ABookKeys.HOT_SPOT) != null) { if (abookCheckParam.get(ABookKeys.HOT_SPOT) != null) {
JSONObject hotSpot = new JSONObject(abookCheckParam.get(ABookKeys.HOT_SPOT)); JSONObject hotSpot = new JSONObject(abookCheckParam.get(ABookKeys.HOT_SPOT));
...@@ -930,12 +921,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -930,12 +921,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
return null; return null;
} }
}; };
// #32926 作業報告画面改善 start
ABookCheckWebViewHelper.getInstance().doABookCheckParam(ABVContentViewActivity.this, ABookCheckWebViewHelper.getInstance().doABookCheckParam(ABVContentViewActivity.this,
mCmd, mTaskKey, enableReportHistory, abookCheckParam, mOperationId, mContentPath, getContentId(), mCmd, mTaskKey, enableReportHistory, abookCheckParam, mOperationId, mContentPath, getContentId(),
operationDto.reportType == Constant.ReportType.Routine, finishCallback, operationDto.reportType, finishCallback,
taskReportLevel); taskReportLevel);
// #32926 作業報告画面改善 end
} catch(Exception e) { } catch(Exception e) {
Logger.e(TAG, "doABookCheckParam error", e); Logger.e(TAG, "doABookCheckParam error", e);
} }
......
...@@ -9,7 +9,6 @@ import android.database.Cursor; ...@@ -9,7 +9,6 @@ import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
...@@ -52,11 +51,9 @@ import java.util.Arrays; ...@@ -52,11 +51,9 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; 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.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON; 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.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType; import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel; import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
...@@ -620,7 +617,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -620,7 +617,7 @@ public class OperationListActivity extends ABVUIActivity {
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra(ABookKeys.CONTENT_ID, operationDto.contentId); intent.putExtra(ABookKeys.CONTENT_ID, operationDto.contentId);
intent.putExtra(ABookKeys.OPERATION_ID, operationDto.operationId); 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); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
if(operationDto.operationType == OperationType.PDF) { if(operationDto.operationType == OperationType.PDF) {
...@@ -700,14 +697,10 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -700,14 +697,10 @@ public class OperationListActivity extends ABVUIActivity {
} }
}; };
if (reportType == OperationReportType.ROUTINE_TASK) {
// 定期点検
if (mOperationLogic.sendRoutineTaskReportSendData(operationId, null, progressCallback) > 0) {
handleErrorMessageToast(R.string.P005);
}
} else {
// 報告送信 // 報告送信
mOperationLogic.sendTaskReportSendData(operationId, null, progressCallback); if (mOperationLogic.sendTaskReportSendData(operationId, null, reportType == OperationReportType.ROUTINE_TASK, progressCallback)) {
// 作業報告タイプが定期点検且つ、P005のエラーの場合、以下のエラーをトーストメッセージで表示
handleErrorMessageToast(R.string.P005);
} }
progressDialogHorizontal.setProgress(60); progressDialogHorizontal.setProgress(60);
...@@ -722,7 +715,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -722,7 +715,7 @@ public class OperationListActivity extends ABVUIActivity {
if (!StringUtil.isNullOrEmpty(avilableDateStr)) { if (!StringUtil.isNullOrEmpty(avilableDateStr)) {
// 利用可能メッセージ // 利用可能メッセージ
dialogMsg = String.format(getString(R.string.msg_routineTask_report_available_from), 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); dialogMsg = getString(R.string.msg_no_report_data);
} }
...@@ -837,8 +830,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -837,8 +830,7 @@ public class OperationListActivity extends ABVUIActivity {
List<RoutineTaskReportDto> localRoutineTaskReportList; List<RoutineTaskReportDto> localRoutineTaskReportList;
Date lastEditDate; Date lastEditDate;
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) { OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
RoutineTaskDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getRoutineTaskData(param);
//プログレスを40%進行させるための計算 //プログレスを40%進行させるための計算
int progress = 0; int progress = 0;
...@@ -846,123 +838,108 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -846,123 +838,108 @@ public class OperationListActivity extends ABVUIActivity {
progress = 40 / json.taskDtoList.size(); progress = 40 / json.taskDtoList.size();
} }
JSONObject taskReportJson;
for (TaskDto serverTaskDto : json.taskDtoList) { for (TaskDto serverTaskDto : json.taskDtoList) {
if (operationDto.reportType == Constant.ReportType.Routine) {
if (isExistsTaskInList(localTaskList, serverTaskDto)) { if (isExistsTaskInList(localTaskList, serverTaskDto)) {
mTaskDao.update(serverTaskDto); mTaskDao.update(serverTaskDto);
} else { } else {
mTaskDao.insert(serverTaskDto); mTaskDao.insert(serverTaskDto);
} }
localRoutineTaskReportList = mRoutineTaskReportDao.selectRoutineTaskReportByTaskKey(serverTaskDto.taskKey); List<TaskReportDto> localTaskReportList = mTaskReportDao.getNotNullStartDateTaskReportByTaskKey(serverTaskDto.taskKey);
List<RoutineTaskReportDto> localRemove = new ArrayList(); List<TaskReportDto> localRemove = new ArrayList();
// 先にローカルにしか存在しない事を削除 : DB, files // 先にローカルにしか存在しない事を削除 : DB, files
for (RoutineTaskReportDto routineTaskDto : localRoutineTaskReportList) { for (TaskReportDto localTaskReportDto : localTaskReportList) {
if (!isExistsRoutineTaskReportInList(serverTaskDto.RoutineTaskReportList, routineTaskDto)) { if (!isExistsRoutinTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto)) {
mOperationLogic.deleteRoutineTaskReport(operationDto.operationId, operationContentDto.contentId, routineTaskDto); mOperationLogic.deleteTaskReport(operationId, operationContentDto.contentId, localTaskReportDto);
localRemove.add(routineTaskDto); localRemove.add(localTaskReportDto);
} }
} }
localRoutineTaskReportList.removeAll(localRemove); localTaskReportList.removeAll(localRemove);
// サーバーからの情報で更新 // サーバーからの情報で更新
for (RoutineTaskReportDto routineTaskDto : serverTaskDto.RoutineTaskReportList) { for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String reportAttachedFileName = routineTaskDto.attachedFileName; String reportAttachedFileName = taskReportDto.attachedFileName;
routineTaskDto.taskKey = serverTaskDto.taskKey; 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) { if (isSyncGetTaskFileError) {
return null; return null;
} }
if (isExistsRoutinTaskReportInList(localTaskReportList, taskReportDto)) {
// 報告データが存在すると作業報告を更新する // 報告データが存在すると作業報告を更新する
if (routineTaskDto.jsonData != null) { if (taskReportDto.jsonData != null) {
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, routineTaskDto, false, false, false, false); mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false, false, false);
} }
} else { } else {
// 添付ファイルが存在する場合、取得して解凍する。 if (taskReportDto.jsonData != null) {
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, routineTaskDto.taskReportId, routineTaskDto.taskReportInfoId, routineTaskDto.reportStartDate, reportAttachedFileName); mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false);
if (isSyncGetTaskFileError) {
return null;
}
if (routineTaskDto.jsonData != null) {
mOperationLogic.insertRoutineTaskReport(operationContentDto.operationId, operationContentDto.contentId, routineTaskDto, false, false);
}
}
} }
progressCallback.callback(new Integer(progress));
} }
lastEditDate = json.lastEditDate;
} else {
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();
} }
JSONObject taskReportJson; } else {
for (TaskDto taskDto : json.taskDtoList) { if (isExistsTaskInList(localTaskList, serverTaskDto)) {
if (isExistsTaskInList(localTaskList, taskDto)) {
// 更新 // 更新
for (TaskReportDto taskReportDto : taskDto.taskReportDtoList) { for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName; String attachedFileName = taskReportDto.attachedFileName;
// 添付ファイルが存在する場合、取得して解凍する。 // 添付ファイルが存在する場合、取得して解凍する。
try { try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, taskReportDto.attachedFileName); refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) { if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData); taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus); taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
// 作業報告を更新 // 作業報告を更新
// update // update
mOperationLogic.updateTaskReportLevel(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId, mOperationLogic.updateTaskReport(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId,
taskReportJson, taskDto.taskHotSpotInfo, attachedFileName, false, false); taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
} else { } else {
// 作業報告(回答) // 作業報告(回答)
if (taskReportDto.jsonData != null) { if (taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReportReplyLevel(taskDto.taskKey, taskReportDto.taskReportLevel, taskDto.operationId, operationContentDto.contentId, mOperationLogic.updateTaskReportReplyLevel(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false); new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
} }
} }
// 更新済みの場合、localTaskListから削除 // 更新済みの場合、localTaskListから削除
localTaskList.remove(taskDto); localTaskList.remove(serverTaskDto);
} }
} else { } else {
// 登録 // 登録
for (TaskReportDto taskReportDto : taskDto.taskReportDtoList) { for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName; String attachedFileName = taskReportDto.attachedFileName;
// 添付ファイルが存在する場合、取得して解凍する。 // 添付ファイルが存在する場合、取得して解凍する。
try { try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, taskReportDto.attachedFileName); refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) { if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData); taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus); taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
mOperationLogic.insertTaskReportLevel(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, mOperationLogic.insertTaskReport(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskReportJson, taskDto.taskHotSpotInfo, attachedFileName, false, false); taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
} else { } else {
if (taskReportDto.jsonData != null) { if (taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReportReplyLevel(taskDto.taskKey, operationContentDto.operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false); new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
} }
} }
} }
} }
}
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
} }
// サーバーから取得した作業情報がローカルに存在しないので削除する // サーバーから取得した作業情報がローカルに存在しないので削除する
...@@ -971,7 +948,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -971,7 +948,6 @@ public class OperationListActivity extends ABVUIActivity {
mTaskDao.delete(taskDto); mTaskDao.delete(taskDto);
} }
lastEditDate = json.lastEditDate; lastEditDate = json.lastEditDate;
}
progressCallback.callback(new Integer(40)); progressCallback.callback(new Integer(40));
return lastEditDate; return lastEditDate;
...@@ -1033,20 +1009,10 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1033,20 +1009,10 @@ public class OperationListActivity extends ABVUIActivity {
// 既存の添付ディレクトリ削除 // 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
String reportLocalAttachedFileName = mRoutineTaskReportDao.getRoutineTaskReportAttachedFileName(taskKey, taskReportId, reportStartDateHypn); String reportLocalAttachedFileName = mTaskReportDao.getRoutineTaskReportAttachedFileName(taskKey, taskReportId, reportStartDateHypn);
int count = 0;
boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName); boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName);
if (mOperationAuthLevel == OperationAuthLevel.WORKER && getReportFileFlg) { if (getReportFileFlg) {
count++;
}
// 同期させるタスクの数をコンストラクタで渡す
final CountDownLatch latch = new CountDownLatch(count);
if (mOperationAuthLevel == OperationAuthLevel.WORKER && getReportFileFlg) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try { 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, reportAttachedFileName);
// #32926 start // #32926 start
...@@ -1063,18 +1029,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1063,18 +1029,7 @@ public class OperationListActivity extends ABVUIActivity {
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, Toast.LENGTH_LONG); ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, Toast.LENGTH_LONG);
isSyncGetTaskFileError = true; isSyncGetTaskFileError = true;
} }
return null;
}
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);
latch.countDown();
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
// 上記の非同期の処理が終了するまで、待つ
latch.await();
} }
/** /**
...@@ -1602,8 +1557,8 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1602,8 +1557,8 @@ public class OperationListActivity extends ABVUIActivity {
* @param rDto * @param rDto
* @return * @return
*/ */
private boolean isExistsRoutineTaskReportInList(List<RoutineTaskReportDto> listDto, RoutineTaskReportDto rDto) { private boolean isExistsRoutinTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto) {
for(RoutineTaskReportDto lDto:listDto) { for (TaskReportDto lDto : listDto) {
if (lDto.taskKey.equals(rDto.taskKey) && if (lDto.taskKey.equals(rDto.taskKey) &&
lDto.taskReportId == rDto.taskReportId && lDto.taskReportId == rDto.taskReportId &&
lDto.reportStartDate.equals(rDto.reportStartDate)) { lDto.reportStartDate.equals(rDto.reportStartDate)) {
......
...@@ -143,7 +143,7 @@ public class OperationListAdapter extends AbstractOperationAdapter { ...@@ -143,7 +143,7 @@ public class OperationListAdapter extends AbstractOperationAdapter {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE); holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
} }
if(mOperationAuthLevel == OperationAuthLevel.WORKER) { if(operationDto.enableReportEdit == Constant.EnableReportEdit.NO) {
holder.lyPanoEditLayout.setVisibility(View.GONE); holder.lyPanoEditLayout.setVisibility(View.GONE);
} }
......
...@@ -18,16 +18,12 @@ import java.util.Date; ...@@ -18,16 +18,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; 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.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback; import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor; import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant; import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys; 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.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.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationTaskDto; import jp.agentec.abook.abv.bl.dto.OperationTaskDto;
import jp.agentec.abook.abv.bl.dto.TaskDto; import jp.agentec.abook.abv.bl.dto.TaskDto;
...@@ -69,271 +65,107 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -69,271 +65,107 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param param * @param param
* @param operationId プロジェクトID * @param operationId プロジェクトID
* @param contentPath * @param contentPath
* @param routineTaskReportFlg * @param reportType
* @param finishCallback * @param finishCallback
* @param taskReportLevel * @param taskReportLevel
*/ */
public void doABookCheckParam(ABVContentViewActivity context, String cmd, String taskKey, int enableReportHistory, 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; int taskReportSendId = 0;
mFinishCallback = finishCallback; mFinishCallback = finishCallback;
// #32782 指示者テーブル関連削除 start
// TODO append
// int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
// #32782 指示者テーブル関連削除 end
// #32782 指示者テーブル関連削除 start
// TODO change
/*
switch (cmd) { switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
// #32782 指示者テーブル関連削除 start
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_INSERT_TASK_REPORT: case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, true, routineTaskReportFlg); insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, true, reportType, taskReportLevel);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel)); sendTaskData(context, operationId, taskKey, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, enableReportHistory, false);
}
// #32782 指示者テーブル関連削除 end
break; break;
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
case ABookKeys.CMD_UPDATE_TASK_REPORT: case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, false, routineTaskReportFlg); insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, false, reportType, taskReportLevel);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { sendTaskData(context, operationId, taskKey, taskReportLevel);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, enableReportHistory, false);
}
break; break;
// #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_DELETE_TASK_REPORT: case ABookKeys.CMD_DELETE_TASK_REPORT:
int taskReportId = 0; int taskReportId = 0;
String reportStartDate = ""; String reportStartDate = "";
boolean sendTaskReportDataFlg = false; boolean sendTaskReportDataFlg = false;
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { // TODO検討
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey); // copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false); if (reportType == Constant.ReportType.Routine) {
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID)); taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE); reportStartDate = param.get(ABookKeys.REPORT_START_DATE).replace("T", " ");
reportStartDate = reportStartDate.replace("T", " ");
mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate); mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate); copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if (routineTaskTaskReportDto != null && enableReportHistory != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} else { } else {
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey); mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel)); copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey);
if (taskReportDto != null && enableReportHistory != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} }
if (sendTaskReportDataFlg) { if (enableReportHistory == Constant.EnableReportHistory.Invalid) {
if (enableReportHistory == Constant.OperationUpdateType.HISTORY_NO) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey); taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true); mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId); deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId, taskReportLevel);
} else if (enableReportHistory == Constant.OperationUpdateType.HISTORY_UPDATE) { } else if (enableReportHistory == Constant.EnableReportHistory.Enable) {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true); mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
} }
sendTaskReportData(context, operationId, taskKey, enableReportHistory, false); sendTaskData(context, operationId, taskKey);
} else {
mFinishCallback.callback(false);
}
}
break; break;
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
case ABookKeys.CMD_MOVE_HOT_SPOT: case ABookKeys.CMD_MOVE_HOT_SPOT:
mOperationLogic.updateTaskHotspot(taskKey, param); mOperationLogic.updateTaskHotspot(taskKey, param);
mOperationLogic.createHopSpotJson(operationId, contentPath); mOperationLogic.createHopSpotJson(operationId, contentPath);
break; break;
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS: // case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS:
case ABookKeys.CMD_CANCEL_TASK_REPORT: case ABookKeys.CMD_CANCEL_TASK_REPORT:
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
mFinishCallback.callback(false); mFinishCallback.callback(false);
break; break;
} }
*/
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
// sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
// sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, true);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyTaskAttachedMovie(operationId, contentId, taskKey, 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, enableReportHistory, operationId, contentId, param, contentPath, true, routineTaskReportFlg, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, enableReportHistory);
break;
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, false, routineTaskReportFlg, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, enableReportHistory);
break;
// #32861 作業情報追加 start
// 一時保存処理
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, 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 = "";
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, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate, taskReportLevel);
} else {
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey, taskReportLevel);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
}
if (enableReportHistory == Constant.EnableReportHistory.Invalid) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId, taskReportLevel);
} else if (enableReportHistory == Constant.EnableReportHistory.Enable) {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
}
sendTaskReportData(context, operationId, taskKey, enableReportHistory);
break;
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 context ABVContentViewActivity
* @param operationId プロジェクトID * @param operationId プロジェクトID
* @param taskKey タスクキー * @param taskKey タスクキー
*/ */
private void sendTaskDirectionsData(final ABVContentViewActivity context, final long operationId, final String taskKey) { private void sendTaskData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int taskReportLevel) {
// #32782 指示者テーブル関連削除 start // TODO 以下の処理見直し
// TODO Delete mothod // ネットワーク通信チェック
Logger.d(TAG, "[sendTaskDirectionsData] operationId=%s, taskKey=%s", operationId, taskKey); if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
//作業指示送信時には「enableReportHistory」値が必要ではないので、「-1」に設定 mFinishCallback.callback(false);
sendTaskData(context, operationId, taskKey, -1, true); return;
// #32782 指示者テーブル関連削除 end
} }
/** final Callback progressCallback = new Callback() {
* 作業報告データ送信処理 @Override
* @param context ABVContentViewActivity public Object callback(Object ret) {
* @param operationId プロジェクトID final int progress = (int)ret;
* @param taskKey タスクキー context.runOnUiThread(new Runnable() {
* @param reportUpdateType 作業履歴タイプ @Override
*/ public void run() {
// #32782 指示者テーブル関連削除 start context.progressDialogHorizontal.setProgress(context.progressDialogHorizontal.getProgress() + progress);
// TODO change
/*
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int enableReportHistory, final boolean isDirection) {
Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey);
sendTaskData(context, operationId, taskKey, enableReportHistory, isDirection);
} }
*/ });
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType) { return null;
Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey);
sendTaskData(context, operationId, taskKey, reportUpdateType, false);
} }
// #32782 指示者テーブル関連削除 end };
/** context.showProgressView(context.getString(R.string.synchronizing));
* 作業報告・指示データ送信処理(共通) CommonExecutor.execute(new Runnable() {
* @param context ABVContentViewActivity @Override
* @param operationId プロジェクトID public void run() {
* @param taskKey タスクキー boolean isError = false;
* @param reportUpdateType 作業履歴タイプ
* @param isDirections 作業指示:true, 作業報告:false
*/
private void sendTaskData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirections) {
// TODO 以下の処理見直し
// // ネットワーク通信チェック
// if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
// mFinishCallback.callback(false);
// return;
// }
//
// final Callback progressCallback = new Callback() {
// @Override
// public Object callback(Object ret) {
// final int progress = (int)ret;
// context.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// context.progressDialogHorizontal.setProgress(context.progressDialogHorizontal.getProgress() + progress);
// }
// });
// return null;
// }
// };
//
// context.showProgressView(context.getString(R.string.synchronizing));
// CommonExecutor.execute(new Runnable() {
// @Override
// public void run() {
// boolean isError = false;
// try { // try {
// if (isDirections) { // if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
// // #32782 指示者テーブル関連削除 start // // #32782 指示者テーブル関連削除 start
// // TODO change // // TODO change
//// mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback); // mOperationLogic.sendTaskReportSendData(operationId, taskKey, taskReportLevel, progressCallback);
// mOperationLogic.sendTaskDirectionsData(operationId, taskKey, progressCallback);
// // #32782 指示者テーブル関連削除 end // // #32782 指示者テーブル関連削除 end
// mOperationLogic.updateSyncOperation(operationId, true); // mOperationLogic.updateSyncOperation(operationId, true);
// } else { // } else {
...@@ -368,8 +200,8 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -368,8 +200,8 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// mFinishCallback.callback(isError); // mFinishCallback.callback(isError);
// context.closeProgressPopup(); // context.closeProgressPopup();
// } // }
// } }
// }); });
} }
public void doABookCheckParamPdf(long operationId, OperationTaskDto operationTaskDto, String contentPath) { public void doABookCheckParamPdf(long operationId, OperationTaskDto operationTaskDto, String contentPath) {
...@@ -461,13 +293,11 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -461,13 +293,11 @@ public class ABookCheckWebViewHelper extends ABookHelper {
JSONObject taskDirectionsJson = new JSONObject(taskDirections); JSONObject taskDirectionsJson = new JSONObject(taskDirections);
String taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT); String taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) { if (insertFlg) {
mOperationLogic.insertTaskReportLevel(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true); mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, true); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
} else { } else {
mOperationLogic.updateTaskReportLevel(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true); mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, true); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
} }
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
} }
...@@ -500,7 +330,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -500,7 +330,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// 指示者の場合下記の処理を行わない // 指示者の場合下記の処理を行わない
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) { if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (insertFlg) { if (insertFlg) {
mOperationLogic.insertTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo); mOperationLogic.insertTaskReportReply(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false); mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
} else { } else {
mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo); mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
...@@ -519,7 +349,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -519,7 +349,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mOperationLogic.updateRoutineTaskReport(operationId, contentId, routineTaskTaskReportDto, attachedChangeFlag, true, insertFlg, true); mOperationLogic.updateRoutineTaskReport(operationId, contentId, routineTaskTaskReportDto, attachedChangeFlag, true, insertFlg, true);
} else { } else {
if (insertFlg) { if (insertFlg) {
mOperationLogic.insertTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo); mOperationLogic.insertTaskReportReply(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
} else { } else {
mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo); mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
} }
...@@ -560,7 +390,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -560,7 +390,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
} }
} }
*/ */
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 { private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, int reportType, int taskReportLevel) throws IOException {
int taskReportSendId = 0; int taskReportSendId = 0;
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false; boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskReport = param.get(ABookKeys.TASK_REPORT); String taskReport = param.get(ABookKeys.TASK_REPORT);
...@@ -568,33 +398,39 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -568,33 +398,39 @@ public class ABookCheckWebViewHelper extends ABookHelper {
int taskReportId = 0; int taskReportId = 0;
String reportStartDate = ""; String reportStartDate = "";
if (routineTaskReportFlg) { if (reportType == Constant.ReportType.Routine) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID)); taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE); reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " "); reportStartDate = reportStartDate.replace("T", " ");
//reportStartDate = DateTimeUtil.toString(DateTimeUtil.toDate(reportStartDate, "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmss_hyphen); //reportStartDate = DateTimeUtil.toString(DateTimeUtil.toDate(reportStartDate, "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen), DateTimeFormat.yyyyMMddHHmmss_hyphen);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate); TaskReportDto taskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
routineTaskTaskReportDto.jsonData = taskReport; taskReportDto.jsonData = taskReport;
mOperationLogic.updateRoutineTaskReport(operationId, contentId, routineTaskTaskReportDto, attachedChangeFlag, true, insertFlg, true); mOperationLogic.updateRoutineTaskReport(operationId, contentId, taskReportDto, attachedChangeFlag, true, insertFlg, true);
} else { } else {
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
String hotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) { if (insertFlg) {
// #32926 作業報告画面改善 start mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, hotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.insertTaskReportReplyLevel(taskKey, operationId, taskReportLevel, contentId, taskReportJson, null, attachedChangeFlag, true); } else {
// #32926 作業報告画面改善 end mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, hotSpotInfo, null, attachedChangeFlag, true);
}
} else {
if (insertFlg) {
mOperationLogic.insertTaskReportReply(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
} else { } else {
mOperationLogic.updateTaskReportReplyLevel(taskKey, taskReportLevel, operationId, contentId, taskReportJson, null, attachedChangeFlag, true); mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
} }
} }
if (routineTaskReportFlg) { }
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath); if (reportType == Constant.ReportType.Routine) {
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate, taskReportLevel); mOperationLogic.createJsonForOperationContent(operationId, contentPath, true);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
} else { } else {
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, false); mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel); copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
} }
...@@ -606,7 +442,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -606,7 +442,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
} }
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, routineTaskReportFlg, taskReportId, reportStartDate, taskReportLevel); copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, reportType == Constant.ReportType.Routine, taskReportId, reportStartDate, taskReportLevel);
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
if (reportUpdateType == Constant.EnableReportHistory.Enable) { if (reportUpdateType == Constant.EnableReportHistory.Enable) {
...@@ -625,9 +461,9 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -625,9 +461,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
List<TaskDto> taskDtoList = mOperationLogic.getOperationTask(operationId); List<TaskDto> taskDtoList = mOperationLogic.getOperationTask(operationId);
for (TaskDto taskDto : taskDtoList) { for (TaskDto taskDto : taskDtoList) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) { if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
List<RoutineTaskReportDto> listRoutineTaskReport = mOperationLogic.getRoutineTaskReportByTaskKey(taskDto.taskKey); List<TaskReportDto> listRoutineTaskReport = mOperationLogic.getRoutineTaskReportByTaskKey(taskDto.taskKey);
for (RoutineTaskReportDto routineTaskDto : listRoutineTaskReport) { for (TaskReportDto routineTaskDto : listRoutineTaskReport) {
copyRoutineTaskReportAttachedMovie(operationId, contentId, routineTaskDto.taskKey, routineTaskDto.taskReportId, routineTaskDto.reportStartDate, 0); copyRoutineTaskReportAttachedMovie(operationId, contentId, routineTaskDto.taskKey, routineTaskDto.taskReportId, routineTaskDto.reportStartDate);
} }
} else { } else {
// #32926 作業報告画面改善 start // #32926 作業報告画面改善 start
...@@ -651,7 +487,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -651,7 +487,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param objReportStartDate * @param objReportStartDate
* @throws IOException * @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; String reportStartDate;
if (objReportStartDate instanceof String) { if (objReportStartDate instanceof String) {
reportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(DateTimeUtil.toDate((String)objReportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen)); reportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(DateTimeUtil.toDate((String)objReportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen));
...@@ -661,7 +497,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -661,7 +497,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
return; return;
} }
String taskKeyPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDate, taskReportLevel); String taskKeyPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDate, 0);
File taskKeyFile = new File(taskKeyPath); File taskKeyFile = new File(taskKeyPath);
// 作業報告書の添付ファイル(mp4,mov拡張子のみ)コピー // 作業報告書の添付ファイル(mp4,mov拡張子のみ)コピー
...@@ -702,21 +538,21 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -702,21 +538,21 @@ public class ABookCheckWebViewHelper extends ABookHelper {
} }
} }
} }
// 作業報告書の添付ファイル(mp4,mov拡張子のみ)コピー // // 作業報告書の添付ファイル(mp4,mov拡張子のみ)コピー
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.WORKER) { // if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.WORKER) {
taskKeyPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, taskReportLevel); // taskKeyPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, taskReportLevel);
taskKeyFile = new File(taskKeyPath); // taskKeyFile = new File(taskKeyPath);
if (taskKeyFile.exists()) { // if (taskKeyFile.exists()) {
String attachedMoviesFilePath = ABVEnvironment.getInstance().getAttachedDirectionOrReportDirPath(contentId, taskKey, taskReportLevel); // String attachedMoviesFilePath = ABVEnvironment.getInstance().getAttachedDirectionOrReportDirPath(contentId, taskKey, taskReportLevel);
FileUtil.delete(attachedMoviesFilePath); // FileUtil.delete(attachedMoviesFilePath);
FileUtil.createNewDirectory(attachedMoviesFilePath); // FileUtil.createNewDirectory(attachedMoviesFilePath);
for (String taskAttachedFile : taskKeyFile.list()) { // for (String taskAttachedFile : taskKeyFile.list()) {
if (StringUtil.endsWithAny(taskAttachedFile.toLowerCase(), "mov", "mp4")) { // if (StringUtil.endsWithAny(taskAttachedFile.toLowerCase(), "mov", "mp4")) {
FileUtil.copy(taskKeyPath + "/" + taskAttachedFile, attachedMoviesFilePath + "/" + taskAttachedFile, true); // FileUtil.copy(taskKeyPath + "/" + taskAttachedFile, attachedMoviesFilePath + "/" + taskAttachedFile, true);
} // }
} // }
} // }
} // }
} }
/** /**
......
...@@ -4954,14 +4954,10 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -4954,14 +4954,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
String cmd = checkParam.get(ABookKeys.CMD); String cmd = checkParam.get(ABookKeys.CMD);
switch (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_INSERT_TASK_REPORT: // 作業報告の登録
case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新 case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新
case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除 case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除
getTaskHotspotJSON(); getTaskHotspotJSON();
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS: // 作業指示のキャンセル
case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル
if(operationTaskDto != null) { if(operationTaskDto != null) {
updateOperationTaskPosition(operationTaskDto.pdfX, operationTaskDto.pdfY); updateOperationTaskPosition(operationTaskDto.pdfX, operationTaskDto.pdfY);
...@@ -5183,8 +5179,6 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5183,8 +5179,6 @@ public class ContentViewActivity extends ABVContentViewActivity {
if (operationTaskLayout.currentLayout != null && !StringUtil.isNullOrEmpty(taskKey)) { if (operationTaskLayout.currentLayout != null && !StringUtil.isNullOrEmpty(taskKey)) {
switch(cmd){ switch(cmd){
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_INSERT_TASK_REPORT: case ABookKeys.CMD_INSERT_TASK_REPORT:
case ABookKeys.CMD_UPDATE_TASK_REPORT: case ABookKeys.CMD_UPDATE_TASK_REPORT:
...@@ -5204,10 +5198,10 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5204,10 +5198,10 @@ public class ContentViewActivity extends ABVContentViewActivity {
} }
// #32782 指示者テーブル関連削除 end // #32782 指示者テーブル関連削除 end
break; break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS: // case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
operationTaskLayout.setIconStatus(taskKey, true); // operationTaskLayout.setIconStatus(taskKey, true);
//hideOperationTaskLayout(); // //hideOperationTaskLayout();
break; // break;
default: default:
operationTaskLayout.setIconStatus(taskKey, false); operationTaskLayout.setIconStatus(taskKey, false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment