Commit 1d2780ad by Lee Jaebin

#32825 作業一覧画面改善

parent 04fde09d
......@@ -7,9 +7,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.json.AcmsCommonJSON;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.adf.util.DateTimeFormat;
......@@ -20,24 +18,14 @@ import jp.agentec.adf.util.DateTimeUtil;
*/
public class OperationDataJSON extends AcmsCommonJSON {
public static final String OperationLastEditDate = "projectLastEditDate";
public static final String OperationLastEditDate = "operationLastEditDate";
public static final String TaskList = "taskList";
public static final String OperationId = "projectId";
public static final String OperationId = "operationId";
public static final String TaskId = "taskId";
public static final String TaskKey = "taskKey";
public static final String TaskCode = "taskCode";
public static final String TaskStatus = "taskStatus";
public static final String TaskHotspotInfo = "taskHotspotInfo";
// #32782 指示者テーブル関連削除 start
// TODO change&delete TaskDirections
// public static final String TaskDirectionsInfo = "taskReportInfo";
public static final String TaskDirectionsInfo = "taskDirectionsInfo";
// #32782 指示者テーブル関連削除 end
// #32782 指示者テーブル関連削除 start
// TODO change&Delete TaskDirections
// public static final String TaskDirectionsKey = "taskReportKey";
public static final String TaskDirectionsKey = "taskDirectionsKey";
// #32782 指示者テーブル関連削除 end
public static final String Task = "task";
// 1.0.1で追加
......@@ -54,10 +42,6 @@ public class OperationDataJSON extends AcmsCommonJSON {
public List<TaskDto> taskDtoList;
public Date lastEditDate;
// #32926 作業報告画面改善 start
public static final String TaskReportLevel = "taskReportLevel";
// #32926 作業報告画面改善 end
public OperationDataJSON(String jsonString) throws AcmsException {
super(jsonString);
}
......@@ -82,30 +66,39 @@ public class OperationDataJSON extends AcmsCommonJSON {
// 作業報告詳細リスト
JSONArray taskReportList = taskJson.getJSONArray(TaskReportList);
dto.taskReportDtoList = new ArrayList<TaskReportDto>();
for (int j = 0; j < taskReportList.length(); j++) {
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskReportJson = taskReportList.getJSONObject(j);
taskReportDto.taskReportLevel = taskReportJson.getInt(TaskReportLevel);
taskReportDto.enableReport = taskReportJson.getInt(EnableReport);
taskReportDto.taskReportInfoId = taskReportJson.getLong(TaskReportInfoId);
taskReportDto.reportStartDate = DateTimeUtil.toDate(taskReportJson.getString(ReportStartDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
taskReportDto.reportEndDate = DateTimeUtil.toDate(taskReportJson.getString(ReportEndDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
if (taskReportJson.has(TaskReportInfoId)) {
// 定期点検の場合
taskReportDto.taskReportInfoId = taskReportJson.getLong(TaskReportInfoId);
}
if (taskReportJson.has(ReportStartDate)) {
taskReportDto.reportStartDate = DateTimeUtil.toDate(taskReportJson.getString(ReportStartDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
if (taskReportJson.has(ReportEndDate)) {
taskReportDto.reportEndDate = DateTimeUtil.toDate(taskReportJson.getString(ReportEndDate), DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
if (taskReportJson.has(TaskReportKey)) {
taskReportDto.attachedFileName = taskReportJson.getString(TaskReportKey);
}
if (taskReportJson.has(TaskReportInfo)) {
Object object = taskJson.get(TaskReportInfo);
Object object = taskReportJson.get(TaskReportInfo);
if (object instanceof String) {
taskReportDto.jsonData = null;
} else {
taskReportDto.jsonData = taskJson.getJSONObject(TaskReportInfo).toString();
taskReportDto.jsonData = taskReportJson.getJSONObject(TaskReportInfo).toString();
}
}
dto.taskReportDtoList.add(taskReportDto);
}
taskDtoList.add(dto);
}
}
......
......@@ -29,7 +29,6 @@ public class OperationListJSON extends AcmsCommonJSON {
public static final String OperationDescriptions = "operationDescriptions";
public static final String OperationStartDate = "operationStartDate";
public static final String OperationEndDate = "operationEndDate";
public static final String OperationStatus = "operationStatus";
public static final String OperationLastEditDate = "operationLastEditDate";
public static final String ContentId = "contentId";
//定期点検用
......@@ -76,8 +75,6 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.operationDescriptions = operationJson.getString(OperationDescriptions);
dto.operationStartDate = DateTimeUtil.toDate(operationJson.getString(OperationStartDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
dto.operationEndDate = DateTimeUtil.toDate(operationJson.getString(OperationEndDate), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
// 1.0.1で追加
dto.operationStatus = operationJson.getInt(OperationStatus); // 作業状況
dto.reportType = operationJson.getInt(ReportType); // 作業報告タイプ
dto.enableReportHistory = operationJson.getInt(EnableReportHistory); // 報告履歴管理
......@@ -133,8 +130,8 @@ public class OperationListJSON extends AcmsCommonJSON {
}
}
JSONArray workingGroupJsonArray = operationJson.getJSONArray(WorkingGroupList);
if (operationJson.has(WorkingGroupList)) {
JSONArray workingGroupJsonArray = operationJson.getJSONArray(WorkingGroupList);
for (int k = 0; k < workingGroupJsonArray.length(); k++) {
if (workingGroupJsonArray.getJSONObject(k).length() == 0) {
// リストの情報が空の場合、以下の処理を行わないようにする
......
......@@ -8,9 +8,7 @@ import java.util.List;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.dto.RoutineTaskReportDto;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
......
......@@ -13,9 +13,7 @@ public class GetOperationDataParameters extends AcmsParameters {
this.operationId = operationId;
}
// TODO
// サーバ作業後、対応必要「project」→「operation」
public long getProjectId() {
public long getOperationId() {
return operationId;
}
......
......@@ -139,7 +139,7 @@ public class AcmsApis {
// 作業データ送信
public static final String ApiSendTaskData = "taskData";
// 作業データ取得
public static final String ApiGetOperationData = "getProjectData";
public static final String ApiGetOperationData = "getOperationData";
// 定期点検データ取得
public static final String ApiGetRoutineTaskData = "getProjectInspectData";
// 作業ファイル取得
......
......@@ -711,8 +711,8 @@ public class ABVEnvironment {
// #32926 作業報告画面改善 start
// taskReportLevelの値によってディレクトリを構成
public String getAttachedDirectionOrReportDirPath(long contentId, String taskKey, String taskReportLevel) {
return String.format(AttachedMoviesTaskTypeDir, cacheDirectory, contentId, taskKey, taskReportLevel);
public String getAttachedDirectionOrReportDirPath(long contentId, String taskKey, int taskReportLevel) {
return String.format(AttachedMoviesTaskTypeDir, cacheDirectory, contentId, taskKey, String.valueOf(taskReportLevel));
}
// #32926 作業報告画面改善 end
......
......@@ -88,12 +88,6 @@ public class Constant {
String REPORT_GPS = "reportGps";
}
public interface OperationUpdateType {
int HISTORY_NO = 0;
int HISTORY_ADD = 1;
int HISTORY_UPDATE = 2;
}
public interface OperationReportType {
int REPORT_TYPE = 0;
int ROUTINE_TASK = 1;
......@@ -142,12 +136,18 @@ public class Constant {
public interface TaskReportLevel {
int ReportType = 0; // 報告タイプ
int ReportResponseType = 1; // 報告(回答)タイプ
int ReportReplyType = 1; // 報告(回答)タイプ
}
public interface ReportType {
int Report = 0; // 報告
int Routine = 1; // 定期点検
int ReportAnswer = 2; // 報告(回答)
int ReportReply = 2; // 報告(回答)
}
// 報告履歴管理
public interface EnableReportHistory {
int Invalid = 0; // 無効
int Enable = 1; // 有効
}
}
......@@ -19,17 +19,17 @@ public class ABookKeys {
public static final String ABOOK_CHECK_API = "abookcheck-api";
// #32782 指示者テーブル関連削除 start
// TODO TaskDirections 削除処理が必要
public static final String CMD_INSERT_TASK_DIRECTIONS = "insertTaskDirections";
public static final String CMD_UPDATE_TASK_DIRECTIONS = "updateTaskDirections";
public static final String CMD_DELETE_TASK_DIRECTIONS = "deleteTaskDirections";
public static final String CMD_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_SHOW_DIRECTION_OZD = "showDirectionOzd";
public static final String CMD_PREVIEW_DIRECTION_OZD = "previewDirectionOzd";
public static final String CMD_INSERT_TASK_REPORT = "insertTaskReport";
public static final String CMD_UPDATE_TASK_REPORT = "updateTaskReport";
public static final String CMD_DELETE_TASK_REPORT = "deleteTaskReport";
public static final String CMD_INSERT_TASK_REPORT = "insertTaskReportReplyLevel";
public static final String CMD_UPDATE_TASK_REPORT = "updateTaskReportReplyLevel";
public static final String CMD_DELETE_TASK_REPORT = "deleteTaskReportReply";
public static final String CMD_CANCEL_TASK_REPORT = "cancelTaskReport";
public static final String CMD_SHOW_REPORT_OZD = "showReportOzd";
public static final String CMD_PREVIEW_REPORT_OZD = "previewReportOzd";
......@@ -123,7 +123,6 @@ public class ABookKeys {
public static final String CMD_LOCAL_SAVE_TASK_REPORT = "localSaveTaskReport"; // 一時保存
// #32861 作業情報追加 end
// #32926 作業報告画面改善 start
public static final String TASK_REPORT_LEVEL = "taskReportLevel"; // 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答))
public static final String TASK_HAS_AUTHORITY = "taskHasAuthority";
public static final String HAS_AUTHORITY = "hasAuthority";
// #32926 作業報告画面改善 end
}
......@@ -37,8 +37,6 @@ import jp.agentec.abook.abv.bl.data.tables.TMarkingSetting;
import jp.agentec.abook.abv.bl.data.tables.TOperation;
import jp.agentec.abook.abv.bl.data.tables.TPushMessage;
import jp.agentec.abook.abv.bl.data.tables.TTask;
import jp.agentec.abook.abv.bl.data.tables.TTaskDirections;
import jp.agentec.abook.abv.bl.data.tables.TTaskDirectionsItems;
import jp.agentec.abook.abv.bl.data.tables.TTaskReport;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportItems;
import jp.agentec.abook.abv.bl.data.tables.TTaskReportSend;
......@@ -93,11 +91,6 @@ public class ABVDataOpenHelper {
iTableScripts.add(new RTaskWorkerGroup());
iTableScripts.add(new ROperationContent());
iTableScripts.add(new TTask());
// #32782 指示者テーブル関連削除 start
// TODO delete
iTableScripts.add(new TTaskDirections());
iTableScripts.add(new TTaskDirectionsItems());
// #32782 指示者テーブル関連削除 end
iTableScripts.add(new TTaskReport());
iTableScripts.add(new TTaskReportSend());
iTableScripts.add(new TTaskReportItems());
......
......@@ -70,11 +70,6 @@ public class OperationDao extends AbstractDao {
dto.contentCreatingFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("report_update_type");
if (column != -1) {
dto.reportUpdateType = cursor.getInt(column);
}
column = cursor.getColumnIndex("report_cycle");
if (column != -1) {
dto.reportCycle = cursor.getInt(column);
......@@ -156,13 +151,14 @@ public class OperationDao extends AbstractDao {
+ "operation_start_date, "
+ "operation_end_date, "
+ "operation_type, "
+ "report_type, "
+ "last_edit_date, "
+ "content_creating_flg, "
+ "edit_lock_flg, "
+ "need_sync_flg, "
+ "report_update_type, "
+ "report_cycle, "
+ "enable_report_update) "
+ "enable_report_update, "
+ "enable_report_history) "
+ "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
......@@ -176,13 +172,14 @@ public class OperationDao extends AbstractDao {
+ "operation_start_date=?, "
+ "operation_end_date=?, "
+ "operation_type=?, "
+ "report_type=?, "
+ "last_edit_date=?, "
+ "content_creating_flg=?, "
+ "edit_lock_flg=?, "
+ "need_sync_flg=?, "
+ "report_update_type=?, "
+ "report_cycle=?, "
+ "enable_report_update=? "
+ "enable_report_update=?, "
+ "enable_report_history=? "
+ "where operation_id=?",
dto.getUpdateValues());
return count > 0;
......@@ -198,11 +195,6 @@ public class OperationDao extends AbstractDao {
delete("r_operation_content", null, null);
delete("t_operation", null, null);
delete("t_task", null, null);
// #32782 指示者テーブル関連削除 start
// TODO delete
delete("t_task_directions", null, null);
delete("t_task_directions_items", null, null);
// #32782 指示者テーブル関連削除 end
delete("t_task_report", null, null);
delete("t_task_report_send", null, null);
delete("t_task_report_items", null, null);
......@@ -210,12 +202,12 @@ public class OperationDao extends AbstractDao {
delete("m_worker_group", null, null);
}
public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String operationReportTypeStr) {
String sql = generateGetOperationQuery(searchOperationName, searchStartDateStr, searchEndDateStr, operationReportTypeStr);
public List<OperationDto> getOperations(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
String sql = generateGetOperationQuery(searchOperationName, searchStartDateStr, searchEndDateStr, reportTypeStr);
return rawQueryGetDtoList(sql, null, OperationDto.class);
}
private String generateGetOperationQuery(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String operationReportTypeStr) {
private String generateGetOperationQuery(String searchOperationName, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
String curDate = DateTimeUtil.toStringInTimeZone(new Date(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC");
StringBuffer sql = new StringBuffer();
......@@ -230,7 +222,6 @@ public class OperationDao extends AbstractDao {
sql.append(" top.edit_lock_flg, ");
sql.append(" top.need_sync_flg, ");
sql.append(" top.content_creating_flg, ");
sql.append(" top.report_update_type, ");
sql.append(" top.report_type, ");
sql.append(" top.report_cycle, ");
sql.append(" top.enable_report_update, ");
......@@ -274,20 +265,18 @@ public class OperationDao extends AbstractDao {
sql.append(" AND top.operation_start_date <= '" + DateTimeUtil.toString(endDate, DateTimeFormat.yyyyMMdd_hyphen) + "'");
}
if (operationReportTypeStr != null) {
// sql.append(" AND top.operation_report_type in ("+ operationReportTypeStr +")");
sql.append(" AND top.report_type in ("+ operationReportTypeStr +")");
if (reportTypeStr != null) {
sql.append(" AND top.report_type in ("+ reportTypeStr +")");
}
// sql.append(" ORDER BY top.operation_report_type DESC, top.operation_start_date DESC, top.operation_id DESC");
sql.append(" ORDER BY top.report_type DESC, top.operation_start_date DESC, top.operation_id DESC");
sql.append(" ORDER BY top.operation_start_date DESC, top.operation_name ASC");
Logger.v(TAG, "sql=%s", sql);
return sql.toString();
}
public boolean updateContentCreatingFlg(long operationId, boolean content_creating_flg){
public boolean updateContentCreatingFlg(long operationId, boolean content_creating_flg) {
OperationDto dto = getOperation(operationId);
if (dto != null) {
dto.contentCreatingFlg = content_creating_flg;
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
/**
* Created by leej on 2018/08/31.
*/
public class TaskDirectionsDao extends AbstractDao {
private static final String TAG = "TaskDirectionsDao";
/*package*/ TaskDirectionsDao() {
}
@Override
protected TaskDirectionsDto convert(Cursor cursor) {
TaskDirectionsDto dto = new TaskDirectionsDto();
int column = cursor.getColumnIndex("task_key");
if (column != -1) {
dto.taskKey = cursor.getString(column);
}
column = cursor.getColumnIndex("json_data");
if (column != -1) {
dto.jsonData = cursor.getString(column);
}
column = cursor.getColumnIndex("attached_file_name");
if (column != -1) {
dto.attachedFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("local_attached_file_name");
if (column != -1) {
dto.localAttachedFileName = cursor.getString(column);
}
column = cursor.getColumnIndex("attached_file_send_flg");
if (column != -1) {
dto.attachedFileSendFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("data_send_flg");
if (column != -1) {
dto.dataSendFlg = toBool(cursor.getInt(column));
}
// t_taskテーブルへINNER JOINで取得したカラム取得
column = cursor.getColumnIndex("task_hotspot_info");
if (column != -1) {
dto.taskHotSpotInfo = cursor.getString(column);
}
column = cursor.getColumnIndex("del_flg");
if (column != -1) {
dto.delFlg = toBool(cursor.getInt(column));
}
return dto;
}
public void insert(TaskDirectionsDto dto) {
insert("insert into t_task_directions "
+ "(task_key, "
+ "json_data, "
+ "attached_file_name, "
+ "local_attached_file_name, "
+ "attached_file_send_flg, "
+ "data_send_flg) "
+ "values "
+ "(?,?,?,?,?,?)",
dto.getInsertValues());
}
public List<TaskDirectionsDto> getTaskDirectionsByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select ttd.* ");
sb.append(" from t_task_directions ttd ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class);
}
public TaskDirectionsDto getTaskDirections(String taskKey) {
return rawQueryGetDto("select * from t_task_directions where task_key=?", new String[]{"" + taskKey}, TaskDirectionsDto.class);
}
public String getTaskDirectionsAttachedFileName(String taskKey) {
return rawQueryGetString("select local_attached_file_name from t_task_directions where task_key=?", new String[]{"" + taskKey});
}
public boolean update(TaskDirectionsDto dto) {
long count = update("update t_task_directions "
+ "set "
+ "json_data=?, "
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "attached_file_send_flg=?, "
+ "data_send_flg=? "
+ "where task_key=?",
dto.getUpdateValues());
return count > 0;
}
public boolean isExistSendTaskData(Long operationId) {
return getSendableTaskData(operationId).size() > 0;
}
public List<TaskDirectionsDto> getSendableTaskData(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_task_directions ttd ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE ttd.data_send_flg = 1");
sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsDto.class);
}
public List<TaskDirectionsDto> getSendableTaskData(Long operationId, String taskKey) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_task_directions ttd ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttd.task_key ");
sb.append(" WHERE ttd.data_send_flg = 1");
sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey}, TaskDirectionsDto.class);
}
}
package jp.agentec.abook.abv.bl.data.dao;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsItemsDto;
/**
* Created by leej on 2018/08/31.
*/
public class TaskDirectionsItemsDao extends AbstractDao {
/*package*/ TaskDirectionsItemsDao() {
}
@Override
protected TaskDirectionsItemsDto convert(Cursor cursor) {
TaskDirectionsItemsDto dto = new TaskDirectionsItemsDto();
int column = cursor.getColumnIndex("task_key");
if (column != -1) {
dto.taskKey = cursor.getString(column);
}
column = cursor.getColumnIndex("item_key");
if (column != -1) {
dto.itemKey = cursor.getString(column);
}
column = cursor.getColumnIndex("input_value");
if (column != -1) {
dto.inputValue = cursor.getString(column);
}
return dto;
}
public void insertTaskDirectionsItems(TaskDirectionsItemsDto dto) {
insert("insert into t_task_directions_items (task_key, item_key, input_value) values (?,?,?)", dto.getInsertValues());
}
public List<TaskDirectionsItemsDto> getTaskDirectionsItemByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_directions_items where task_key=?", new String[]{"" + taskKey}, TaskDirectionsItemsDto.class);
}
public List<TaskDirectionsItemsDto> getTaskDirectionsItemByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select distinct ttdi.* ");
sb.append(" from t_task_directions_items ttdi ");
sb.append(" inner join ");
sb.append(" t_task tt ");
sb.append(" ON tt.task_key == ttdi.task_key ");
sb.append(" WHERE tt.del_flg = 0");
sb.append(" AND tt.operation_id = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskDirectionsItemsDto.class);
}
public boolean updateTaskDirectionsItems(TaskDirectionsItemsDto dto) {
long count = update("update t_task_directions_items set input_value=? where item_key=? and task_key=? ", dto.getUpdateValues());
return (count > 0);
}
}
\ No newline at end of file
......@@ -54,13 +54,10 @@ public class TaskReportDao extends AbstractDao {
if (column != -1) {
dto.delFlg = toBool(cursor.getInt(column));
}
// #32782 指示者テーブル関連削除 start
// TODO append
// column = cursor.getColumnIndex("reportor_flag");
// if (column != -1) {
// dto.reporterFlag = toBool(cursor.getInt(column));
// }
// #32782 指示者テーブル関連削除 end
column = cursor.getColumnIndex("reported_flag");
if (column != -1) {
dto.reportedFlag = toBool(cursor.getInt(column));
}
return dto;
}
......@@ -72,14 +69,14 @@ public class TaskReportDao extends AbstractDao {
+ "attached_file_name, "
+ "local_attached_file_name, "
+ "attached_file_send_flg, "
+ "data_send_flg) "
// #32782 指示者テーブル関連削除 start
// TODO append
// + "reporter_flag) "
+ "data_send_flg, "
+ "task_report_id, "
+ "task_report_info_id, "
+ "report_start_date, "
+ "report_end_date, "
+ "reported_flag) "
+ "values "
// + "(?,?,?,?,?,?,?)",
+ "(?,?,?,?,?,?)",
// #32782 指示者テーブル関連削除 end
+ "(?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
}
......@@ -95,8 +92,14 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
}
public TaskReportDto getTaskReport(String taskKey) {
return rawQueryGetDto("select * from t_task_report where task_key=?", new String[]{"" + taskKey}, TaskReportDto.class);
/**
* 作業キーと作業報告タイプで作業報告データ取得
* @param taskKey
* @param taskReportLevel
* @return
*/
public TaskReportDto getTaskReport(String taskKey, Integer taskReportLevel) {
return rawQueryGetDto("select * from t_task_report where task_key=? AND task_report_level", new String[]{ "" + taskKey, "" + taskReportLevel }, TaskReportDto.class);
}
public boolean update(TaskReportDto dto) {
......@@ -106,16 +109,50 @@ public class TaskReportDao extends AbstractDao {
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "attached_file_send_flg=?, "
+ "data_send_flg=? "
// #32782 指示者テーブル関連削除 start
// TODO append
// + "reporter_flag=? "
// #32782 指示者テーブル関連削除 end
+ "data_send_flg=?, "
+ "task_report_id=?, "
+ "task_report_info_id=?, "
+ "report_start_date=?, "
+ "report_end_date=?, "
+ "reported_flag=?, "
+ "where task_key=?",
dto.getUpdateValues());
return count > 0;
}
public boolean updateRoutinTask(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.dataSendFlag, dto.attachedFileSendFlag, dto.taskKey, dto.taskReportId, dto.reportStartDate });
}
return count > 0;
}
}
/**
* 送信フラグのあるデータが存在するか
*
......@@ -138,11 +175,8 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
}
// #32782 指示者テーブル関連削除 start
// TODO append
// public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey, boolean reporterFlag) {
public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey) {
// #32782 指示者テーブル関連削除 end
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_task_report ttr ");
......@@ -152,10 +186,6 @@ public class TaskReportDao extends AbstractDao {
sb.append(" WHERE ttr.data_send_flg = 1");
sb.append(" AND tt.operation_id = ?");
sb.append(" AND tt.task_key = ?");
// #32782 指示者テーブル関連削除 start
// TODO append
// sb.append(" AND ttr.repertor_flag = ?");
// return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey, "" + reporterFlag}, TaskReportDto.class);
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey}, TaskReportDto.class);
// #32782 指示者テーブル関連削除 end
}
......@@ -187,11 +217,9 @@ public class TaskReportDao extends AbstractDao {
*
* @param taskKey
* @param taskReportLevel
* @param taskReportId
* @param reportStartDate
* @return
*/
public boolean isExistTaskReport(String taskKey, Integer taskReportLevel, String taskReportId, String reportStartDate) {
return rawQueryGetInt("select COUNT(*) from t_task_report where task_key=? AND task_report_level=? AND task_report_id=? AND report_start_date=?", new String[]{"" + taskKey, "" + taskReportLevel, "" + taskReportId, "" + reportStartDate }) > 0;
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;
}
}
......@@ -22,6 +22,12 @@ public class TaskReportItemsDao extends AbstractDao {
if (column != -1) {
dto.taskKey = cursor.getString(column);
}
column = cursor.getColumnIndex("task_report_level");
if (column != -1) {
dto.taskReportLevel = cursor.getInt(column);
}
column = cursor.getColumnIndex("item_key");
if (column != -1) {
dto.itemKey = cursor.getString(column);
......@@ -35,11 +41,11 @@ public class TaskReportItemsDao extends AbstractDao {
}
public void insertTaskReportItems(TaskReportItemsDto dto) {
insert("insert into t_task_report_items (task_key, item_key, input_value) values (?,?,?)", dto.getInsertValues());
insert("insert into t_task_report_items (task_key, task_report_level, item_key, input_value) values (?,?,?,?)", dto.getInsertValues());
}
public List<TaskReportItemsDto> getTaskReportItemByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_report_items where task_key=?", new String[]{"" + taskKey}, TaskReportItemsDto.class);
public List<TaskReportItemsDto> getTaskReportItemByTaskKey(String taskKey, int taskReportLevel) {
return rawQueryGetDtoList("select * from t_task_report_items where task_key=? and task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel}, TaskReportItemsDto.class);
}
public List<TaskReportItemsDto> getTaskReportItemByOperationId(Long operationId) {
......@@ -55,7 +61,7 @@ public class TaskReportItemsDao extends AbstractDao {
}
public boolean updateTaskReportItems(TaskReportItemsDto dto) {
long count = update("update t_task_report_items set input_value=? where item_key=? and task_key=? ", dto.getUpdateValues());
long count = update("update t_task_report_items set input_value=? where task_report_level=? and item_key=? and task_key=? ", dto.getUpdateValues());
return (count > 0);
}
}
\ No newline at end of file
......@@ -32,7 +32,6 @@ public class TOperation extends SQLiteTableScript {
sql.append(" , content_creating_flg INTEGER NOT NULL ");
sql.append(" , edit_lock_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , need_sync_flg BOOLEAN NOT NULL DEFAULT 0 ");
sql.append(" , report_update_type INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , report_type INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , report_cycle INTEGER NOT NULL DEFAULT 0 ");
......
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
/**
* Created by leej on 2018/08/31.
*/
public class TTaskDirections extends SQLiteTableScript {
public TTaskDirections() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_task_directions ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , json_data TEXT NOT NULL ");
sql.append(" , attached_file_name TEXT ");
sql.append(" , local_attached_file_name TEXT ");
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 ");
sql.append(" , data_send_flg BOOLEAN DEFAULT 0 ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object[] params) {
return null;
}
}
package jp.agentec.abook.abv.bl.data.tables;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
import jp.agentec.abook.abv.bl.data.DatabaseVersions;
/**
* Created by leej on 2018/08/31.
*/
public class TTaskDirectionsItems extends SQLiteTableScript {
public TTaskDirectionsItems() {
super();
}
@Override
public List<String> getCreateScript(int version) {
List<String> ddl = new ArrayList<String>();
StringBuffer sql = new StringBuffer();
sql.append(" CREATE TABLE t_task_directions_items ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , item_key VARCHAR(64) ");
sql.append(" , input_value VARCHAR(64) ");
sql.append(" ) ");
ddl.add(sql.toString());
return ddl;
}
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
}
@Override
public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object[] params) {
return null;
}
}
......@@ -23,6 +23,7 @@ public class TTaskReportItems extends SQLiteTableScript {
sql.append(" CREATE TABLE t_task_report_items ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , task_report_level INTEGER default 0 ");
sql.append(" , item_key VARCHAR(64) ");
sql.append(" , input_value VARCHAR(64) ");
sql.append(" ) ");
......
......@@ -23,24 +23,17 @@ public class OperationDto extends AbstractDto {
public List<OperationContentDto> operationContentDtoList;
public List<TaskDto> taskDtoList;
public List<PushMessageDto> pushMessageList;
public int reportUpdateType; //0:履歴無し 1:新規追加 2:更新
public int operationReportType; //0:通常 1:定期点検
public int reportType; //0:通常 1:定期点検
public int reportCycle; //0:日次 1:月次 2:年次
public int enableReportUpdate; //0:不可 1:可
public String reportPeriod; //定期点検、2018/12/20 08:10:00 ~ 2018/12/21 18:10:00
public int reportCount; //定期点検、作業数
public int operationStatus; // 作業状況 0: 準備中, 1: 作業中, 2: 完了
public int reportType; // 0:報告 1:定期点検 2:報告(回答)
public int enableReportHistory; // 0: 不可, 1: 可
public int enableReportHistory; // 0: 履歴無し, 1: 履歴可
// 作業担当グループリスト
public List<WorkingGroupDto> workingGroupDtoList;
// #32926 作業報告画面改善 start
public int reportType; // 作業報告タイプ 0:報告 1:定期点検 2:報告(回答)
// #32926 作業報告画面改善 end
public boolean equalsLastEdit(OperationDto dto) {
if (dto != null) {
if (operationId.equals(dto.operationId) && lastEditDate.equals(dto.lastEditDate)) {
......@@ -52,12 +45,12 @@ public class OperationDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportUpdateType, operationReportType, reportCycle, enableReportUpdate };
return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportUpdateType, operationReportType, reportCycle, enableReportUpdate, operationId };
return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, operationId };
}
@Override
......
package jp.agentec.abook.abv.bl.dto;
/**
* Created by leej on 2018/08/31.
*/
public class TaskDirectionsDto extends AbstractDto {
public String taskKey;
public String jsonData;
public String attachedFileName;
public String localAttachedFileName;
public boolean attachedFileSendFlg;
public boolean dataSendFlg;
public String taskHotSpotInfo;
public boolean delFlg;
@Override
public Object[] getInsertValues() {
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskKey };
}
@Override
public String[] getKeyValues() {
return new String[] { "" + taskKey };
}
}
package jp.agentec.abook.abv.bl.dto;
/**
* Created by leej on 2018/09/03.
*/
public class TaskDirectionsItemsDto extends AbstractDto {
public String taskKey;
public String itemKey;
public String inputValue;
@Override
public String[] getKeyValues() {
return new String[] {""+taskKey};
}
@Override
public Object[] getInsertValues() {
return new Object[] {taskKey, itemKey, inputValue};
}
@Override
public Object[] getUpdateValues() {
return new Object[] { inputValue, itemKey, taskKey };
}
}
\ No newline at end of file
......@@ -17,42 +17,24 @@ public class TaskReportDto extends AbstractDto {
public boolean delFlg;
//  作業報告詳細リスト
public int taskReportLevel;
public int enableReport;
public long taskReportInfoId;
public String attachedFileName;
public Date reportStartDate;
public Date reportEndDate;
public String taskReportInfo;
// #32782 指示者テーブル関連削除 start
public boolean reporterFlag;
public int taskReportLevel; // 作業報告レベル
public int taskHasAuthority; // 権限
public int taskReportId; // 作業報告ID
public int taskReportInfoId; // 作業報告情報ID
public long taskReportInfoId; // 作業報告情報ID
public Date reportStartDate; // 作業開始日
public Date reportEndDate; // 作業終了日
public int enableReport; // 報告可能区分
public boolean reportedFlag; //
// #32782 指示者テーブル関連削除 end
public String attachedFileName;
public String taskReportInfo;
public boolean reportedFlag; // 定期点検用
@Override
public Object[] getInsertValues() {
// #32782 指示者テーブル関連削除 start
// TODO change
// return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag };
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg};
// #32782 指示者テーブル関連削除 end
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, reportedFlag};
}
@Override
public Object[] getUpdateValues() {
// #32782 指示者テーブル関連削除 start
// TODO change
// return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag, taskKey };
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskKey };
// #32782 指示者テーブル関連削除 end
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, reportedFlag, taskKey };
}
@Override
......
......@@ -7,6 +7,7 @@ package jp.agentec.abook.abv.bl.dto;
public class TaskReportItemsDto extends AbstractDto {
public String taskKey;
public int taskReportLevel;
public String itemKey;
public String inputValue;
......@@ -17,11 +18,11 @@ public class TaskReportItemsDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[] {taskKey, itemKey, inputValue};
return new Object[] {taskKey, taskReportLevel, itemKey, inputValue};
}
@Override
public Object[] getUpdateValues() {
return new Object[] { inputValue, itemKey, taskKey };
return new Object[] { inputValue, taskReportLevel, itemKey, taskKey };
}
}
\ No newline at end of file
......@@ -41,8 +41,6 @@ import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.PushMessageDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDirectionsDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDirectionsItemsDao;
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.TaskReportSendDao;
......@@ -53,8 +51,6 @@ import jp.agentec.abook.abv.bl.dto.RoutineTaskReportDto;
import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsDto;
import jp.agentec.abook.abv.bl.dto.TaskDirectionsItemsDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.abook.abv.bl.dto.TaskReportItemsDto;
......@@ -77,11 +73,6 @@ public class OperationLogic extends AbstractLogic {
private WorkerGroupDao mWorkerGroupDao = AbstractDao.getDao(WorkerGroupDao.class);
private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
// #32782 指示者テーブル関連削除 start
// TODO delete
private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
private TaskDirectionsItemsDao mTaskDirectionsItemsDao = AbstractDao.getDao(TaskDirectionsItemsDao.class);
// #32782 指示者テーブル関連削除 end
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class);
private TaskReportItemsDao mTaskReportItemsDao = AbstractDao.getDao(TaskReportItemsDao.class);
......@@ -112,6 +103,7 @@ public class OperationLogic extends AbstractLogic {
List<OperationDto> serverOperations = json.operationList;
for (OperationDto serverOperationDto : serverOperations) {
// 登録フラグ
boolean insertFlg = true;
for (OperationDto localProjcetDto : localOperations) {
if (serverOperationDto.operationId.equals(localProjcetDto.operationId)) {
......@@ -145,10 +137,13 @@ public class OperationLogic extends AbstractLogic {
serverOperationDto.contentCreatingFlg = false;
}
mOperationDao.update(serverOperationDto);
// 更新することで登録フラグをfalseにセット
insertFlg = false;
break;
}
}
// 更新されたら以下の処理は行わない
if (insertFlg) {
boolean isNotExistContent = false;
for (OperationContentDto operationContentDto : serverOperationDto.operationContentDtoList) {
......@@ -230,12 +225,12 @@ public class OperationLogic extends AbstractLogic {
* @param dataSendFlg
* @throws IOException
*/
public void insertTaskDirections( String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
public void insertTaskReportLevel(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();
TaskDirectionsDto taskDirectionsDto = new TaskDirectionsDto();
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
taskDto.taskKey = taskKey;
taskDto.operationId = operationId;
......@@ -244,34 +239,37 @@ public class OperationLogic extends AbstractLogic {
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
TaskDirectionsItemsDto taskDirectionsItemsDto = new TaskDirectionsItemsDto();
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_1_")) {
taskDto.taskCode = taskJson.getString(itemKey);
}
taskDirectionsItemsDto.taskKey = taskKey;
taskDirectionsItemsDto.itemKey = itemKey;
taskReportItemsDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey;
taskReportItemsDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
try {
taskDirectionsItemsDto.inputValue = taskJson.getString(itemKey);
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
mTaskDirectionsItemsDao.insertTaskDirectionsItems(taskDirectionsItemsDto);
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
taskDirectionsDto.taskKey = taskKey;
taskDirectionsDto.jsonData = taskDirectionsJson.toString();
taskDirectionsDto.dataSendFlg = dataSendFlg;
taskDirectionsDto.attachedFileSendFlg = attachedChangeFlag;
taskReportDto.taskKey = taskKey;
taskReportDto.jsonData = taskDirectionsJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
// 作業報告
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
if (localAttachedFileName != null) {
taskDirectionsDto.localAttachedFileName = localAttachedFileName;
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
}
mTaskDirectionsDao.insert(taskDirectionsDto);
mTaskReportDao.insert(taskReportDto);
mTaskDao.insert(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
......@@ -282,7 +280,7 @@ public class OperationLogic extends AbstractLogic {
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, "0");
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportType);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
......@@ -293,74 +291,72 @@ public class OperationLogic extends AbstractLogic {
}
/**
* 作業指示の更新
*
* 作業報告を更新
* @param taskKey
* @param operationId
* @param contentId
* @param taskDirectionsJson
* @param taskReportJson
* @param hotSpotInfo
* @param localAttachedFileName
* @param attachedChangeFlag
* @param dataSendFlg
* @return
* @throws IOException
*/
public void updateTaskDirections(String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
// #32782 指示者テーブル関連削除 start
// TODO Delete method
public void updateTaskReportLevel(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
// ignore
Logger.w(TAG, "taskDto is null");
return;
}
TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportType);
taskDto.operationId = operationId;
taskDto.taskHotSpotInfo = hotSpotInfo;
JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
JSONObject taskJson = taskReportJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys();
List<TaskDirectionsItemsDto> taskDirectionsItemsDtoList = mTaskDirectionsItemsDao.getTaskDirectionsItemByTaskKey(taskKey);
for (TaskDirectionsItemsDto taskDirectionsItemsDto : taskDirectionsItemsDtoList) {
List<TaskReportItemsDto> taskReportItemsDtoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey, Constant.TaskReportLevel.ReportType);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDtoList) {
try {
String newValue = taskJson.getString(taskDirectionsItemsDto.itemKey);
if (!newValue.equals(taskDirectionsItemsDto.inputValue)) {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskDirectionsItemsDto.inputValue = newValue;
if (taskDirectionsItemsDto.itemKey.startsWith("q_1_")) {
taskReportItemsDto.inputValue = newValue;
if (taskReportItemsDto.itemKey.startsWith("q_1_")) {
// 値が異なるため、作業コードの入力値を変更する
taskDto.taskCode = taskDirectionsItemsDto.inputValue;
taskDto.taskCode = taskReportItemsDto.inputValue;
}
mTaskDirectionsItemsDao.updateTaskDirectionsItems(taskDirectionsItemsDto);
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
}
taskDirectionsDto.jsonData = taskDirectionsJson.toString();
taskDirectionsDto.dataSendFlg = dataSendFlg;
taskReportDto.jsonData = taskReportJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
// attachedFileSendFlgがtrueの場合は、更新しない
if (!taskDirectionsDto.attachedFileSendFlg) {
taskDirectionsDto.attachedFileSendFlg = attachedChangeFlag;
if (!taskReportDto.attachedFileSendFlg) {
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
}
if (localAttachedFileName != null) {
taskDirectionsDto.localAttachedFileName = localAttachedFileName;
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
if (taskReportJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskReportJson.getInt(ABookKeys.TASK_STATUS);
}
mTaskDirectionsDao.update(taskDirectionsDto);
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, "0");
if (taskDirectionsDto.attachedFileSendFlg) {
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportType);
if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskDirectionsJson.getJSONObject("attached");
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
......@@ -374,11 +370,8 @@ public class OperationLogic extends AbstractLogic {
FileUtil.delete(tempDirPath);
}
}
// #32782 指示者テーブル関連削除 end
}
// TODO
// 削除対象
/**
* 作業指示の削除
*
......@@ -386,30 +379,25 @@ public class OperationLogic extends AbstractLogic {
* @param contentId
* @param taskKey
*/
public void deleteTaskDirections(long operationId, long contentId, String taskKey) {
// #32782 指示者テーブル関連削除 start
// TODO Delete method
public void deleteTaskReport(long operationId, long contentId, String taskKey) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
return;
}
TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
taskDirectionsDto.dataSendFlg = true;
taskDirectionsDto.attachedFileSendFlg = false;
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportType);
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskDto.delFlg = true;
mTaskDirectionsDao.update(taskDirectionsDto);
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
// プロジェクトの作業データディレクトリ削除
deleteTaskFileData(operationId, contentId, taskKey);
// #32782 指示者テーブル関連削除 end
}
/**
* 作業報告の登録
*
* 作業報告(回答)の登録
* @param taskKey
* @param operationId
* @param contentId
......@@ -417,225 +405,10 @@ public class OperationLogic extends AbstractLogic {
* @param localAttachedFileName
* @param attachedChangeFlag
* @param dataSendFlg
* @param hotSpotInfo
* @param taskReportLevel
* @throws IOException
*/
// #32782 指示者テーブル関連削除 start
// TODO change
public void insertTaskReport(String taskKey, int taskReportLevel, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, String hotSpotInfo) throws IOException {
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
TaskDto taskDto = new TaskDto();
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskJson = taskReportJson.getJSONObject("task");
taskDto.taskKey = taskKey;
taskDto.operationId = operationId;
taskDto.taskHotSpotInfo = hotSpotInfo;
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_1_")) {
taskDto.taskCode = taskJson.getString(itemKey);
}
taskReportItemsDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey;
try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
taskReportDto.taskKey = taskKey;
taskReportDto.jsonData = taskReportJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
if (localAttachedFileName != null) {
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskReportJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskReportJson.getInt(ABookKeys.TASK_STATUS);
}
mTaskReportDao.insert(taskReportDto);
mTaskDao.insert(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, true);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
} else {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
//TODO error
return;
}
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskJson = taskReportJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_2_")) {
taskDto.taskStatus = taskJson.getInt(itemKey);
}
taskReportItemsDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey;
try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
taskReportDto.taskKey = taskKey;
taskReportDto.jsonData = taskReportJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
// 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey);
if (taskReport.size() > 0) {
mTaskReportDao.update(taskReportDto);
} else {
mTaskReportDao.insert(taskReportDto);
}
mTaskDao.update(taskDto);
//添付ファイル変更の場合、以下の処理を行う
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false);
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if(result) {
FileUtil.delete(tempDirPath);
}
}
// TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
// if (taskDto == null) {
// taskDto = new TaskDto();
// // 指示者と報告者判断する
// String taskHotSpotInfo = null;
// if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// taskDto.taskKey = taskKey;
// taskDto.operationId = operationId;
// taskDto.taskHotSpotInfo = hotSpotInfo;
// } else {
// //TODO error
// return;
// }
// }
// TaskReportDto taskReportDto = new TaskReportDto();
// JSONObject taskJson = taskReportJson.getJSONObject("task");
//
// Iterator taskKeys = taskJson.keys();
// while (taskKeys.hasNext()) {
// TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
// String itemKey = (String) taskKeys.next();
//
// // 指示者の場合
// if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// if (itemKey.startsWith("q_1_")) {
// taskDto.taskStatus = taskJson.getInt(itemKey);
// }
// } else {
// if (itemKey.startsWith("q_2_")) {
// taskDto.taskStatus = taskJson.getInt(itemKey);
// }
// }
// taskReportItemsDto.taskKey = taskKey;
// taskReportItemsDto.itemKey = itemKey;
// try {
// taskReportItemsDto.inputValue = taskJson.getString(itemKey);
// } catch (JSONException e) {
// // 値がStringではない場合、無視する
// continue;
// }
// mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
// }
// taskReportDto.taskKey = taskKey;
// taskReportDto.jsonData = taskReportJson.toString();
// taskReportDto.dataSendFlg = dataSendFlg;
// taskReportDto.attachedFileSendFlg = attachedChangeFlag;
//
// // #32782 指示者テーブル関連削除 start
// // 報告者の場合
// taskReportDto.reporterFlag = true;
// // #32782 指示者テーブル関連削除 end
//
// if (localAttachedFileName != null) {
// taskReportDto.localAttachedFileName = localAttachedFileName;
// }
//
// if (taskReportJson.has(ABookKeys.TASK_STATUS)) {
// taskDto.taskStatus = taskReportJson.getInt(ABookKeys.TASK_STATUS);
// }
//
//
// // 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
// List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey);
// if (taskReport.size() > 0) {
// mTaskReportDao.update(taskReportDto);
// } else {
// mTaskReportDao.insert(taskReportDto);
// }
//
// if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// mTaskDao.insert(taskDto);
// } else {
// mTaskDao.update(taskDto);
// }
//
// //添付ファイル変更の場合、以下の処理を行う
// String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false);
//
// JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
// List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// // コピー元のファイルで、添付ファイルとして使用しないファイル削除
// deleteDifferentialFile(tempDirPath, attachedFileNames);
//
// // 添付ディレクトリの移動
// boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
// if(result) {
// FileUtil.delete(tempDirPath);
// }
}
<<<<<<< HEAD
public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
=======
*/
// #32926 作業報告画面改善 start
public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, int taskReportLevel) throws IOException {
// #32926 作業報告画面改善 end
>>>>>>> feature/1.0.1
public void insertTaskReportReplyLevel(String taskKey, long operationId, int taskReportLevel, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
//TODO error
......@@ -678,7 +451,7 @@ public class OperationLogic extends AbstractLogic {
//添付ファイル変更の場合、以下の処理を行う
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// #32926 作業報告画面改善 start
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, String.valueOf(taskReportLevel));
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
// #32926 作業報告画面改善 end
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
......@@ -692,7 +465,6 @@ public class OperationLogic extends AbstractLogic {
FileUtil.delete(tempDirPath);
}
}
// #32782 指示者テーブル関連削除 end
/**
* 定期点検データ新規
......@@ -750,123 +522,18 @@ public class OperationLogic extends AbstractLogic {
}
}
/**
* 作業報告の更新
* @param taskKey
* @param operationId
* @param contentId
* @param taskReport
* @param attachedChangeFlag
* @param dataSendFlg
* @param hotSpotInfo
* @throws IOException
*/
// #32782 指示者テーブル関連削除 satrt
// TODO change
/*
public void updateTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, String hotSpotInfo) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
// 指示者か報告者か判断
int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
if (taskReportDto == null) {
Logger.w(TAG, "taskReportDto is null");
// 指示者の場合
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
insertTaskReport(taskKey, operationId, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg, hotSpotInfo);
}
return;
}
JSONObject taskJson = taskReport.getJSONObject("task");
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// 指示者の場合
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
taskDto.operationId = operationId;
taskDto.taskHotSpotInfo = hotSpotInfo;
}
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskReportItemsDto.inputValue = newValue;
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
// 指示者の場合
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (taskReportItemsDto.inputValue.startsWith("q_1_")) {
// 値が異なるため、作業コードの入力値を変更する
taskDto.taskCode = taskReportItemsDto.inputValue;
}
} else {
if (taskReportItemsDto.itemKey.startsWith("q_2_")) {
// 値が異なるため、作業コードの入力値を変更する
taskDto.taskStatus = Integer.parseInt(taskReportItemsDto.inputValue);
}
}
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
}
taskReportDto.jsonData = taskReport.toString();
taskReportDto.dataSendFlg = dataSendFlg;
// attachedFileSendFlgがtrueの場合は、更新しない
if (!taskReportDto.attachedFileSendFlg) {
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
}
// #32782 指示者テーブル関連削除 start
taskReportDto.reporterFlag = true;
// #32782 指示者テーブル関連削除 end
// 指示者の場合
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (localAttachedFileName != null) {
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskReport.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskReport.getInt(ABookKeys.TASK_STATUS);
}
}
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false);
if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskReport.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
// 同じファイル名が存在すれば、コピー先ファイルを削除
deleteDifferentialFile(operationDrectionOrReportDirPath, attachedFileNames);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
}
}
*/
// #32926 作業報告画面改善 start
public void updateTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, int taskReportLevel) throws IOException {
// #32926 作業報告画面改善 end
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
public void updateTaskReportReplyLevel(String taskKey, int taskReportLevel, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel);
if (taskReportDto == null) {
Logger.w(TAG, "taskReportDto is null");
// #32926 作業報告画面改善 start
insertTaskReport(taskKey, operationId, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg, taskReportLevel);
insertTaskReportReplyLevel(taskKey, operationId, taskReportLevel, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg);
// #32926 作業報告画面改善 end
return;
}
JSONObject taskJson = taskReport.getJSONObject("task");
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey);
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey, Constant.TaskReportLevel.ReportReplyType);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
......@@ -895,7 +562,7 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// #32926 作業報告画面改善 start
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, String.valueOf(taskReportLevel));
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
// #32926 作業報告画面改善 end
if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う
......@@ -913,7 +580,6 @@ public class OperationLogic extends AbstractLogic {
}
}
}
// #32782 指示者テーブル関連削除 end
/**
* 定期点検データ更新
......@@ -942,6 +608,7 @@ public class OperationLogic extends AbstractLogic {
String itemKey = (String) taskKeys.next();
taskReportItemsDto.taskKey = routineTaskReportDto.taskKey;
taskReportItemsDto.itemKey = itemKey;
taskReportItemsDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
......@@ -951,7 +618,7 @@ public class OperationLogic extends AbstractLogic {
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
} else {
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(routineTaskReportDto.taskKey);
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(routineTaskReportDto.taskKey, Constant.TaskReportLevel.ReportType);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
......@@ -1086,54 +753,8 @@ public class OperationLogic extends AbstractLogic {
return mTaskReportSendDao.getLastTaskReportSendId(taskKey);
}
/**
* 作業報告の削除
*
* @param operationId
* @param contentId
* @param taskKey
*/
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void deleteTaskReport(long operationId, long contentId, String taskKey) {
// #32782 指示者テーブル関連削除 start
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
return;
} else {
taskDto.taskStatus = 0;
mTaskDao.update(taskDto);
}
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskDto.delFlg = true;
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
// プロジェクトの作業データディレクトリ削除
deleteTaskFileData(operationId, contentId, taskKey);
} else {
if(taskReportDto != null) {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskReportDto.jsonData = "";
mTaskReportDao.update(taskReportDto);
}
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false));
}
// #32782 指示者テーブル関連削除 end
}
*/
public void deleteTaskReport(long operationId, long contentId, String taskKey, int taskReportLevel) {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
public void deleteTaskReportReply(long operationId, long contentId, String taskKey, int taskReportLevel) {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel);
if(taskReportDto != null) {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
......@@ -1151,10 +772,9 @@ public class OperationLogic extends AbstractLogic {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
// #32926 作業報告画面改善 start
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, String.valueOf(taskReportLevel)));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel));
// #32926 作業報告画面改善 end
}
// #32782 指示者テーブル関連削除 end
/**
* 定期点検用、作業削除
......@@ -1219,15 +839,6 @@ public class OperationLogic extends AbstractLogic {
// #32926 作業報告画面改善 end
}
/**
* 作業報告の取得
*
* @param taskKey
*/
public TaskReportDto getTaskReport(String taskKey) {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
return taskReportDto;
}
public RoutineTaskReportDto getRoutineTaskReportUtc(String taskKey, int taskReportId, String reportStartDate) {
return mRoutineTaskReportDao.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
......@@ -1238,21 +849,6 @@ public class OperationLogic extends AbstractLogic {
}
/**
* 作業報告の初期化:更新タイプ:新規追加
*
* @param operationId
* @param contentId
* @param taskKey
*/
public void initialTaskReport(long operationId, long contentId, String taskKey) {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
if(taskReportDto != null) {
taskReportDto.jsonData = "";
mTaskReportDao.update(taskReportDto);
}
}
/**
* 定期点検初期化
* @param operationId
* @param contentId
......@@ -1271,33 +867,18 @@ public class OperationLogic extends AbstractLogic {
/**
* ホットスポットの更新
*
* @param taskKey
* @param param
* @param taskReportLevel
*/
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void updateTaskHotspot(String taskKey, Map<String, String> param, int taskReportLevel) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// #32782 指示者テーブル関連削除 start
TaskReportDto taskReportDao = mTaskReportDao.getTaskReport(taskKey);
taskReportDao.dataSendFlg = true;
taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
mTaskReportDao.update(taskReportDao);
// #32782 指示者テーブル関連削除 end
mTaskDao.update(taskDto);
}
*/
public void updateTaskHotspot(String taskKey, Map<String, String> param, int taskReportLevel) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
taskDirectionsDto.dataSendFlg = true;
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel);
taskReportDto.dataSendFlg = true;
taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
mTaskDirectionsDao.update(taskDirectionsDto);
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
}
// #32782 指示者テーブル関連削除 end
/**
......@@ -1307,13 +888,11 @@ public class OperationLogic extends AbstractLogic {
* @param newX
* @param newY
*/
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void updateTaskHotspot(String taskKey, float newX, float newY) {
public void updateTaskHotspot(String taskKey, float newX, float newY, int taskReportLevel) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// #32782 指示者テーブル関連削除 start
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel);
taskReportDto.dataSendFlg = true;
JSONObject hotSpot = new JSONObject(taskDto.taskHotSpotInfo);
hotSpot.put("x", newX);
......@@ -1323,32 +902,18 @@ public class OperationLogic extends AbstractLogic {
// #32782 指示者テーブル関連削除 end
mTaskDao.update(taskDto);
}
*/
public void updateTaskHotspot(String taskKey, float newX, float newY) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
taskDirectionsDto.dataSendFlg = true;
JSONObject hotSpot = new JSONObject(taskDto.taskHotSpotInfo);
hotSpot.put("x", newX);
hotSpot.put("y", newY);
taskDto.taskHotSpotInfo = hotSpot.toString();
mTaskDirectionsDao.update(taskDirectionsDto);
mTaskDao.update(taskDto);
}
// #32782 指示者テーブル関連削除 end
/**
* 作業指示、作業報告用のjsonファイル
* taskReport.jsonとtaskReportSuggest.jsonとhotspot.jsonを作成
*
* @param operationId
* @param reportUpdateType
* @param contentPath
* @param directionsFlg
* @throws IOException
*/
public void createJsonForOperationContent(Long operationId, int reportUpdateType, String contentPath, boolean directionsFlg) throws IOException {
createJsonForOperationContent(operationId, reportUpdateType, contentPath, directionsFlg, false);
public void createJsonForOperationContent(Long operationId, String contentPath) throws IOException {
createJsonForOperationContent(operationId, contentPath, false);
}
/**
......@@ -1356,52 +921,19 @@ public class OperationLogic extends AbstractLogic {
* taskReport.jsonとtaskReportSuggest.jsonとhotspot.jsonを作成
*
* @param operationId
* @param reportUpdateType
* @param contentPath
* @param directionsFlg
* @param routineTaskReportFlg
* @throws IOException
*/
// #32782 指示者テーブル関連削除 start
// TODO change
/*
public void createJsonForOperationContent(Long operationId, int reportUpdateType, String contentPath, boolean directionsFlg, boolean routineTaskReportFlg) throws IOException {
public void createJsonForOperationContent(Long operationId, String contentPath, boolean routineTaskReportFlg) throws IOException {
try {
// #32782 指示者テーブル関連削除 start
// 作業タイプは
// 0:報告、1: 定期点検、2:報告&報告(回答)
// 報告と報告&報告(回答)、定期点検のjson作成の処理を分ける
if (routineTaskReportFlg) {
createRoutineTaskReportJson(operationId, contentPath);
} else {
createTaskReportJson(operationId, contentPath);
}
createTaskReportJson(operationId, contentPath);
// if (routineTaskReportFlg) {
// createRoutineTaskReportJson(operationId, contentPath);
// } else {
// createTaskReportJson(operationId, contentPath);
// }
createTaskReportSuggestJson(operationId, contentPath);
// #32782 指示者テーブル関連削除 end
createHopSpotJson(operationId, contentPath);
} catch (IOException e) {
Logger.e(TAG, "createJsonForOperationContent error : ", e);
throw e;
}
}
*/
public void createJsonForOperationContent(Long operationId, int reportUpdateType, String contentPath, boolean directionsFlg, boolean routineTaskReportFlg) throws IOException {
try {
createTaskDirectionsJson(operationId, contentPath);
createTaskDirectionsSuggestJson(operationId, contentPath);
if (!directionsFlg) {
//if (reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD ) {
// createTaskReportJson(operationId, contentPath);
//}
if (routineTaskReportFlg) {
createRoutineTaskReportJson(operationId, contentPath);
} else {
createTaskReportJson(operationId, contentPath);
}
createTaskReportSuggestJson(operationId, contentPath);
}
createHopSpotJson(operationId, contentPath);
} catch (IOException e) {
Logger.e(TAG, "createJsonForOperationContent error : ", e);
......@@ -1517,69 +1049,6 @@ public class OperationLogic extends AbstractLogic {
FileUtil.createFile(contentPath + "/taskHotspot.json", hotspotJson.toString());
}
// TODO
// 削除対象
/**
* taskDirections.jsonファイル作成
*
* @param operationId
* @param contentPath
* @throws IOException
*/
private void createTaskDirectionsJson(Long operationId, String contentPath) throws IOException {
// #32782 指示者テーブル関連削除 start
// TODO Delete method
List<JSONObject> taskDirectionsJsonList = new ArrayList<JSONObject>();
JSONObject taskDirectionsJson = new JSONObject();
List<TaskDirectionsDto> taskDirectionsDtoList = mTaskDirectionsDao.getTaskDirectionsByOperationId(operationId);
for (TaskDirectionsDto dto : taskDirectionsDtoList) {
taskDirectionsJsonList.add(new JSONObject(dto.jsonData));
}
taskDirectionsJson.put(ABookKeys.TASK_DIRECTIONS, taskDirectionsJsonList);
Logger.d(TAG, "createTaskDirectionsJson : " + taskDirectionsJson.toString());
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_DIRECTIONS + ".json", taskDirectionsJson.toString());
// #32782 指示者テーブル関連削除 end
}
/**
* taskDirectionsSuggest.jsonファイル作成
*
* @param operationId
* @param contentPath
* @throws IOException
*/
private void createTaskDirectionsSuggestJson(Long operationId, String contentPath) throws IOException {
// #32782 指示者テーブル関連削除 start
// TODO Delete mothod
JSONObject itemJson = new JSONObject();
JSONObject taskDirectionsSuggestJson = new JSONObject();
List<TaskDirectionsItemsDto> taskDirectionsItemsDtoList = mTaskDirectionsItemsDao.getTaskDirectionsItemByOperationId(operationId);
for (TaskDirectionsItemsDto dto : taskDirectionsItemsDtoList) {
JSONArray jsonArray = new JSONArray();
if (itemJson.has(dto.itemKey)) {
boolean result = false;
jsonArray = itemJson.getJSONArray(dto.itemKey);
for (int i = 0; i < jsonArray.length(); i++) {
if (jsonArray.get(i).equals(dto.inputValue)) {
result = true;
break;
}
}
if (!result) {
jsonArray.put(dto.inputValue);
itemJson.put(dto.itemKey, jsonArray);
}
} else {
jsonArray.put(dto.inputValue);
itemJson.put(dto.itemKey, jsonArray);
}
}
taskDirectionsSuggestJson.put(ABookKeys.TASK_DIRECTIONS_SUGGEST, itemJson);
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_DIRECTIONS_SUGGEST + ".json", taskDirectionsSuggestJson.toString());
// #32782 指示者テーブル関連削除 end
}
/**
* 作業指示、作業報告用のjsonファイル
* 報告と報告(回答)のデータの区分が必要なので、「taskReport_0」と「taskReport_1」で形式で作成
......@@ -1600,7 +1069,7 @@ public class OperationLogic extends AbstractLogic {
taskReportJsonRow = new JSONObject();
taskReportLevel = dto.taskReportLevel;
if(dto.jsonData != null && dto.jsonData.length() > 0) {
taskReportJsonRow.put(ABookKeys.TASK_HAS_AUTHORITY, dto.taskHasAuthority);
taskReportJsonRow.put(ABookKeys.HAS_AUTHORITY, dto.enableReport);
taskReportJsonList.add(new JSONObject(dto.jsonData));
taskReportJsonList.add(taskReportJsonRow);
}
......@@ -1711,9 +1180,9 @@ public class OperationLogic extends AbstractLogic {
* @param searchEndDateStr
* @return
*/
public List<OperationDto> getRefreshOperation(String searchWord, String searchStartDateStr, String searchEndDateStr, String operationReportTypeStr) {
public List<OperationDto> getRefreshOperation(String searchWord, String searchStartDateStr, String searchEndDateStr, String reportTypeStr) {
List<OperationDto> operationDtoList;
operationDtoList = mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, operationReportTypeStr);
operationDtoList = mOperationDao.getOperations(searchWord, searchStartDateStr, searchEndDateStr, reportTypeStr);
for (OperationDto operationDto : operationDtoList) {
// 作業送信フラグが存在する場合、needSyncFlgをtrueにセット
if (mTaskReportDao.isExistSendTaskData(operationDto.operationId)) {
......@@ -1809,61 +1278,6 @@ public class OperationLogic extends AbstractLogic {
}
/**
* 作業指示データ送信
*
* @param operationId
* @param taskKey
* @return
* @throws Exception
*/
// TODO sendTaskDirectionsData 名を変更必要
public void sendTaskDirectionsData(long operationId, String taskKey, Callback progressCallback) throws ABVException, NetworkDisconnectedException, IOException, ZipException, NoSuchAlgorithmException {
List<TaskDirectionsDto> taskDirectionsDtoList = null;
int maxProgress = 0;
if (taskKey == null) {
taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId);
maxProgress = 40;
} else {
taskDirectionsDtoList = mTaskDirectionsDao.getSendableTaskData(operationId, taskKey);
maxProgress = 100;
}
if (taskDirectionsDtoList != null && taskDirectionsDtoList.size() > 0) {
//プログレスを40%進行させるための計算
int progress = maxProgress / taskDirectionsDtoList.size();
for (TaskDirectionsDto dto : taskDirectionsDtoList) {
File zipFile = null;
if (dto.attachedFileSendFlg) {
String fileName = null;
zipFile = createAttachedFile(operationId, dto.taskKey, true, "0");
if (zipFile != null) {
fileName = FileUtil.getFilenameWithoutExt(zipFile.getName());
}
dto.localAttachedFileName = fileName != null ? SecurityUtil.getMd5Hash(fileName) : null;
}
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendTaskData
(cache.getMemberInfo().sid, String.valueOf(operationId), dto.taskKey, dto.delFlg ? "1" : "0", String.valueOf(0), dto.taskHotSpotInfo, dto.jsonData, zipFile, dto.attachedFileSendFlg, null);
if (zipFile != null) {
zipFile.delete();
}
if (dto.delFlg) {
// 物理削除
mTaskDao.deleteTaskData(dto.taskKey, true);
} else {
dto.dataSendFlg = false;
dto.attachedFileSendFlg = false;
mTaskDirectionsDao.update(dto);
}
progressCallback.callback(new Integer(progress));
}
}
// #32782 指示者テーブル関連削除 end
}
/**
* 作業報告履歴データ送信
* @param operationId
* @param taskKey
......@@ -1880,44 +1294,6 @@ public class OperationLogic extends AbstractLogic {
maxProgress = 100;
}
// if (taskDirectionsDtoList != null && taskDirectionsDtoList.size() > 0) {
// //プログレスを40%進行させるための計算
// int progress = maxProgress / taskDirectionsDtoList.size();
//
// for (TaskDirectionsDto dto : taskDirectionsDtoList) {
// File zipFile = null;
// if (dto.attachedFileSendFlg) {
// String fileName = null;
// zipFile = createAttachedFile(operationId, dto.taskKey, true);
// if (zipFile != null) {
// fileName = FileUtil.getFilenameWithoutExt(zipFile.getName());
// }
// dto.localAttachedFileName = fileName != null ? SecurityUtil.getMd5Hash(fileName) : null;
// }
//
// AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).sendTaskData
// (cache.getMemberInfo().sid, String.valueOf(operationId), dto.taskKey, dto.delFlg ? "1" : "0", String.valueOf(0), dto.taskHotSpotInfo, dto.jsonData, zipFile, dto.attachedFileSendFlg, null);
//
// if (zipFile != null) {
// zipFile.delete();
// }
// if (dto.delFlg) {
// // 物理削除
// mTaskDao.deleteTaskData(dto.taskKey, true);
// } else {
// dto.dataSendFlg = false;
// dto.attachedFileSendFlg = false;
// mTaskDirectionsDao.update(dto);
// }
// progressCallback.callback(new Integer(progress));
// }
// }
//
//
//
//
//
if (taskReportDtoList != null && taskReportDtoList.size() > 0) {
OperationDto operationDto = mOperationDao.getOperation(operationId);
......@@ -1932,7 +1308,7 @@ public class OperationLogic extends AbstractLogic {
// 履歴なし:元のattachedFileSendFlg
// 履歴追加:古い履歴はtrue
// 履歴更新:true、ファイルに変更が無くてもzipファイル作成
if (taskReportSendDto.taskReportSendId < lastTaskReportSendId || operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
if (taskReportSendDto.taskReportSendId < lastTaskReportSendId || operationDto.enableReportHistory == Constant.EnableReportHistory.Enable) {
taskReportDto.attachedFileSendFlg = true;
}
......@@ -1978,10 +1354,6 @@ public class OperationLogic extends AbstractLogic {
// 物理削除
mTaskDao.deleteTaskData(taskReportDto.taskKey, false);
} else {
if (operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
taskReportDto.jsonData = "";
}
taskReportDto.dataSendFlg = false;
taskReportDto.attachedFileSendFlg = false;
mTaskReportDao.update(taskReportDto);
......@@ -2022,7 +1394,7 @@ public class OperationLogic extends AbstractLogic {
// 履歴なし:元のattachedFileSendFlg
// 履歴追加:古い履歴はtrue
// 履歴更新:true、ファイルに変更が無くてもzipファイル作成
if (taskReportSendDto.taskReportSendId < lastTaskReportSendId || operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
if (taskReportSendDto.taskReportSendId < lastTaskReportSendId || operationDto.enableReportHistory == Constant.EnableReportHistory.Enable) {
routineTaskReportDto.attachedFileSendFlag = true;
}
......@@ -2080,10 +1452,6 @@ public class OperationLogic extends AbstractLogic {
}
}
if (operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
routineTaskReportDto.jsonData = "";
}
routineTaskReportDto.dataSendFlag = false;
routineTaskReportDto.attachedFileSendFlag = false;
mRoutineTaskReportDao.update(routineTaskReportDto, false);
......@@ -2213,7 +1581,7 @@ public class OperationLogic extends AbstractLogic {
* @throws NoSuchAlgorithmException
* @throws IOException
*/
private File createAttachedFile(Long operationId, String taskKey, boolean directionFlg, String taskReportLevel) throws ZipException, NoSuchAlgorithmException, IOException {
private File createAttachedFile(Long operationId, String taskKey, boolean directionFlg, int taskReportLevel) throws ZipException, NoSuchAlgorithmException, IOException {
File zipFile;
// #32926 作業報告画面改善 start
String filePath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
......
......@@ -107,7 +107,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public Long mOperationId;
protected int mXWalkOpenType = -1;
protected int mOperationType;
protected int reportUpdateType; //0:履歴無し 1:新規追加 2:更新
protected int enableReportHistory; //0:履歴無し 1:履歴可
protected String mContentPath;
protected int mStatusCode;
protected boolean isOperationPdf = false;
......@@ -172,7 +172,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mStatusCode = 0;
}
reportUpdateType = operationDto.reportUpdateType;
enableReportHistory = operationDto.enableReportHistory;
linkUrl = intent.getStringExtra("LINKURL"); // LinkURL
......@@ -787,7 +787,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
helpViewType = Constant.HelpViewType.ListOperationDirector;
break;
case Constant.XWalkOpenType.TASK_REPORT:
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
helpViewType = Constant.HelpViewType.RoutineTaskOperation;
} else {
helpViewType = Constant.HelpViewType.ListOperationReporter;
......@@ -824,7 +824,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) {
helpViewType = Constant.HelpViewType.DirectorTask;
} else if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
helpViewType = Constant.HelpViewType.RoutineTaskOperationReport;
} else {
helpViewType = Constant.HelpViewType.ReportTask;
......@@ -865,7 +865,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
int taskReportId = 0;
String reportStartDate = "";
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
taskReportId = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE);
}
......@@ -932,7 +932,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
};
// #32926 作業報告画面改善 start
ABookCheckWebViewHelper.getInstance().doABookCheckParam(ABVContentViewActivity.this,
mCmd, mTaskKey, reportUpdateType, abookCheckParam, mOperationId, mContentPath, getContentId(),
mCmd, mTaskKey, enableReportHistory, abookCheckParam, mOperationId, mContentPath, getContentId(),
operationDto.reportType == Constant.ReportType.Routine, finishCallback,
taskReportLevel);
// #32926 作業報告画面改善 end
......
......@@ -76,7 +76,6 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.RoutineTaskReportDao;
import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDirectionsDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
......@@ -152,10 +151,7 @@ public class OperationListActivity extends ABVUIActivity {
private Dialog mPanoEntryDialog;
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
// #32782 指示者テーブル関連削除 start
// TODO delete
private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
// #32782 指示者テーブル関連削除 end
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private RoutineTaskReportDao mRoutineTaskReportDao = AbstractDao.getDao(RoutineTaskReportDao.class);
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
......@@ -405,7 +401,7 @@ public class OperationListActivity extends ABVUIActivity {
Logger.d(TAG, "onResume Sync operationId : " + operationId);
if (operationDto != null && operationDto.needSyncFlg) {
// 同期処理後、直列処理で新着更新を行う。
syncOperation(operationId, operationDto.operationReportType);
syncOperation(operationId, operationDto.reportType);
} else {
closeProgressPopup();
}
......@@ -601,31 +597,11 @@ public class OperationListActivity extends ABVUIActivity {
contentPath = ABVEnvironment.getInstance().getPanoImageDirName(ContentFileExtractor.getInstance().getContentCacheDirWithExtract(operationDto.contentId));
}
// 更新タイプが[新規追加]に変わった時の為:残っている作業報告内容削除
if (operationDto.reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD && mOperationAuthLevel == OperationAuthLevel.WORKER) {
final List<TaskReportDto> listTaskReport = mTaskReportDao.selectAll();
if (listTaskReport != null && listTaskReport.size() > 0) {
long operationId = operationDto.operationId;
for (TaskReportDto taskReportDto : listTaskReport) {
// #32926 作業報告画面改善 start
if (taskReportDto.reporterFlag) {
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskReportDto.taskKey, String.valueOf(taskReportDto.taskReportLevel));
}
// #32926 作業報告画面改善 end
}
mTaskReportDao.deleteAll();
FileUtil.delete(ABVEnvironment.getInstance().getTempDirPath(operationDto.contentId));
}
}
// プロジェクトの指示/報告表示時、必要なJSONファイル作成
mOperationLogic.createJsonForOpenABookCheckPano(operationDto.operationId, operationDto.contentId, contentPath);
mOperationLogic.createJsonForOperationContent(operationDto.operationId, 0, contentPath, mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR ? true : false, operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK);
mOperationLogic.createJsonForOperationContent(operationDto.operationId, contentPath, operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
mOperationLogic.createJsonForRoutineTaskReport(operationDto.reportCycle, operationDto.enableReportUpdate, mOperationLogic.getLastRoutineTaskReportData(operationDto.operationId).taskReportId, contentPath);
}
......@@ -861,7 +837,7 @@ public class OperationListActivity extends ABVUIActivity {
List<RoutineTaskReportDto> localRoutineTaskReportList;
Date lastEditDate;
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
RoutineTaskDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getRoutineTaskData(param);
//プログレスを40%進行させるための計算
......@@ -932,86 +908,90 @@ public class OperationListActivity extends ABVUIActivity {
JSONObject taskReportJson;
for (TaskDto taskDto : json.taskDtoList) {
for (TaskReportDto taskReportDto : taskDto.taskReportDtoList) {
String reportAttachedFileName = taskReportDto.attachedFileName;
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus);
}
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, taskReportDto.attachedFileName);
if (isSyncGetTaskFileError) {
return null;
}
}
// int localTaskIndex = localTaskList.indexOf(taskDto);
// if (localTaskIndex >= 0) {
//
// // 作業更新
// mOperationLogic.updateTaskDirections(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
// taskDirectionJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
// localTaskList.remove(taskDto);
// // 報告データが存在すると作業報告を更新する
// if (taskDto.taskReportDto.jsonData != null) {
// mOperationLogic.updateTaskReport(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
// new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false, taskReportLevel);
// }
// } else {
//
//
// // 作業登録
// mOperationLogic.insertTaskDirections(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
// taskDirectionJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
// if (taskDto.taskReportDto.jsonData != null) {
// mOperationLogic.insertTaskReport(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
// new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false, taskReportLevel);
// }
// }
progressCallback.callback(new Integer(progress));
}
if (isExistsTaskInList(localTaskList, taskDto)) {
// 更新
for (TaskReportDto taskReportDto : taskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName;
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey);
mTaskDao.delete(taskDto);
}
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) {
return null;
}
lastEditDate = json.lastEditDate;
}
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus);
// 作業報告を更新
// update
mOperationLogic.updateTaskReportLevel(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
taskReportJson, taskDto.taskHotSpotInfo, attachedFileName, false, false);
} else {
// 作業報告(回答)
if (taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReportReplyLevel(taskDto.taskKey, taskReportDto.taskReportLevel, taskDto.operationId, operationContentDto.contentId,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
}
}
// 更新済みの場合、localTaskListから削除
localTaskList.remove(taskDto);
}
} else {
// 登録
for (TaskReportDto taskReportDto : taskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName;
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) {
return null;
}
// プログレスを40%進行させるための計算
int progress = 0;
if (json.taskDtoList.size() != 0) {
progress = 40 / json.taskDtoList.size();
}
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus);
for (TaskDto serverTaskDto : json.taskDtoList) {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
mTaskDao.update(serverTaskDto);
localTaskList.remove(serverTaskDto);
} else {
mTaskDao.insert(serverTaskDto);
mOperationLogic.insertTaskReportLevel(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskReportJson, taskDto.taskHotSpotInfo, attachedFileName, false, false);
} else {
if (taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReportReplyLevel(taskDto.taskKey, operationContentDto.operationId, taskReportDto.taskReportLevel, operationContentDto.contentId,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
}
}
}
}
progressCallback.callback(new Integer(progress));
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey);
mTaskDao.delete(taskDto);
}
// String reportAttachedFileName = serverTaskDto.taskReportDto.attachedFileName;
lastEditDate = json.lastEditDate;
}
progressCallback.callback(new Integer(40));
return lastEditDate;
}
public void refreshTaskFile(final long operationId, final int taskReportLevel, long contentId, final long taskId, final String taskKey, final String attachedFileName) throws ABVException, InterruptedException, ZipException, NoSuchAlgorithmException, IOException {
/**
* 添付ファイルが存在する場合、取得して解凍する。
* @param operationId
* @param taskReportLevel
* @param contentId
* @param taskId
* @param taskKey
* @param attachedFileName
* @throws ABVException
* @throws InterruptedException
* @throws ZipException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public void refreshTaskFile(final long operationId, final int taskReportLevel, long contentId, final long taskId, final String taskKey, final String attachedFileName) throws Exception {
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
......@@ -1027,7 +1007,7 @@ public class OperationListActivity extends ABVUIActivity {
} catch (Exception e) {
Logger.e(TAG, e);
ABVToastUtil.showMakeText(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, Toast.LENGTH_LONG);
isSyncGetTaskFileError = true;
throw e;
}
}
}
......@@ -1601,8 +1581,14 @@ public class OperationListActivity extends ABVUIActivity {
}
}
/**
* listDtoの中に第2引数のdtoが存在するかチェックメソッド
* @param listDto リストDto
* @param dto ターゲットDto
* @return
*/
private boolean isExistsTaskInList(List<TaskDto> listDto, TaskDto dto) {
for(TaskDto lDto:listDto) {
for (TaskDto lDto : listDto) {
if (lDto.taskKey.equals(dto.taskKey)) {
return true;
}
......@@ -1661,7 +1647,7 @@ public class OperationListActivity extends ABVUIActivity {
if (contentDto == null || !contentDto.downloadedFlg || contentDto.updatedFlg) {
contentDownload(operationDto.contentId, false);
} else {
syncOperation(operationDto.operationId, operationDto.operationReportType, true);
syncOperation(operationDto.operationId, operationDto.reportType, true);
}
}
});
......
......@@ -87,9 +87,9 @@ public class OperationListAdapter extends AbstractOperationAdapter {
final OperationDto operationDto = getItem(position);
if (operationDto != null) {
boolean noRoutineTaskAll = (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
boolean noRoutineTaskAll = (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
holder.tvOperationName.setText(operationDto.operationName);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod)) {
holder.tvDate.setText(mContext.getString(R.string.date_label_routineTask) + " : " + mContext.getString(R.string.msg_no_report_data));
} else {
......@@ -106,7 +106,7 @@ public class OperationListAdapter extends AbstractOperationAdapter {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
} else {
// needSyncFlgがfalseの場合
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
......
......@@ -119,9 +119,9 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
final OperationDto operationDto = getItem(position);
if (operationDto != null) {
boolean noRoutineTaskAll = (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
boolean noRoutineTaskAll = (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
holder.tvOperationName.setText(operationDto.operationName);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod)) {
holder.tvDate.setText(mContext.getString(R.string.date_label_routineTask) + " : " + mContext.getString(R.string.msg_no_report_data));
} else {
......@@ -137,7 +137,7 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
} else {
// needSyncFlgがfalseの場合
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
......@@ -174,9 +174,9 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
}
if(mOperationAuthLevel == OperationAuthLevel.WORKER) {
// if(mOperationAuthLevel.equals(OperationAuthLevel.WORKER)) {
holder.lyPanoEditLayout.setVisibility(View.GONE);
}
// }
holder.ivPanoEdit.setOnClickListener(new View.OnClickListener() {
@Override
......
......@@ -65,7 +65,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param context ABVContentViewActivity
* @param cmd
* @param taskKey タスクキー
* @param reportUpdateType
* @param enableReportHistory
* @param param
* @param operationId プロジェクトID
* @param contentPath
......@@ -73,7 +73,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param finishCallback
* @param taskReportLevel
*/
public void doABookCheckParam(ABVContentViewActivity context, String cmd, String taskKey, int reportUpdateType, Map<String, String> param, long operationId, String contentPath, long contentId, boolean routineTaskReportFlg, Callback finishCallback, int taskReportLevel) throws IOException {
public void doABookCheckParam(ABVContentViewActivity context, String cmd, String taskKey, int enableReportHistory, Map<String, String> param, long operationId, String contentPath, long contentId, boolean routineTaskReportFlg, Callback finishCallback, int taskReportLevel) throws IOException {
int taskReportSendId = 0;
mFinishCallback = finishCallback;
......@@ -90,25 +90,25 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// #32782 指示者テーブル関連削除 start
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, true, routineTaskReportFlg);
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, true, routineTaskReportFlg);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
sendTaskReportData(context, operationId, taskKey, enableReportHistory, false);
}
// #32782 指示者テーブル関連削除 end
break;
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, false, routineTaskReportFlg);
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, false, routineTaskReportFlg);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
sendTaskReportData(context, operationId, taskKey, enableReportHistory, false);
}
break;
// #32782 指示者テーブル関連削除 start
......@@ -120,8 +120,8 @@ public class ABookCheckWebViewHelper extends ABookHelper {
boolean sendTaskReportDataFlg = false;
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
......@@ -130,34 +130,34 @@ public class ABookCheckWebViewHelper extends ABookHelper {
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if (routineTaskTaskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
if (routineTaskTaskReportDto != null && enableReportHistory != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} else {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey);
if (taskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
if (taskReportDto != null && enableReportHistory != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
}
if (sendTaskReportDataFlg) {
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
if (enableReportHistory == Constant.OperationUpdateType.HISTORY_NO) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId);
} else if (reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
} else if (enableReportHistory == Constant.OperationUpdateType.HISTORY_UPDATE) {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
}
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
sendTaskReportData(context, operationId, taskKey, enableReportHistory, false);
} else {
mFinishCallback.callback(false);
}
......@@ -178,20 +178,21 @@ public class ABookCheckWebViewHelper extends ABookHelper {
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskDirectionsData(context, operationId, taskKey);
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, String.valueOf(taskReportLevel));
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
sendTaskDirectionsData(context, operationId, taskKey);
// sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
mOperationLogic.deleteTaskDirections(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
sendTaskDirectionsData(context, operationId, taskKey);
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
......@@ -200,61 +201,49 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mOperationLogic.createHopSpotJson(operationId, contentPath);
break;
case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, true, routineTaskReportFlg, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, true, routineTaskReportFlg, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, enableReportHistory);
break;
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, false, routineTaskReportFlg, taskReportLevel);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
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, reportUpdateType, operationId, contentId, param, contentPath, false, routineTaskReportFlg, taskReportLevel);
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 = "";
boolean sendTaskReportDataFlg = false;
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate, taskReportLevel);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if (routineTaskTaskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} else {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey, taskReportLevel);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey, taskReportLevel);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey);
if (taskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
}
if (sendTaskReportDataFlg) {
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
deleteReportTaskSendFiles(operationId, taskKey, taskReportSendId, taskReportLevel);
} else if (reportUpdateType == Constant.OperationUpdateType.HISTORY_UPDATE) {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
}
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
} else {
mFinishCallback.callback(false);
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:
......@@ -278,7 +267,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// #32782 指示者テーブル関連削除 start
// TODO Delete mothod
Logger.d(TAG, "[sendTaskDirectionsData] operationId=%s, taskKey=%s", operationId, taskKey);
//作業指示送信時には「reportUpdateType」値が必要ではないので、「-1」に設定
//作業指示送信時には「enableReportHistory」値が必要ではないので、「-1」に設定
sendTaskData(context, operationId, taskKey, -1, true);
// #32782 指示者テーブル関連削除 end
}
......@@ -293,9 +282,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// #32782 指示者テーブル関連削除 start
// TODO change
/*
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirection) {
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, reportUpdateType, isDirection);
sendTaskData(context, operationId, taskKey, enableReportHistory, isDirection);
}
*/
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType) {
......@@ -313,78 +302,79 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param isDirections 作業指示:true, 作業報告:false
*/
private void sendTaskData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirections) {
// ネットワーク通信チェック
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 {
if (isDirections) {
// #32782 指示者テーブル関連削除 start
// TODO change
// mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
mOperationLogic.sendTaskDirectionsData(operationId, taskKey, progressCallback);
// #32782 指示者テーブル関連削除 end
mOperationLogic.updateSyncOperation(operationId, true);
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationId);
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (mOperationLogic.sendRoutineTaskReportSendData(operationId, taskKey, progressCallback) > 0){
context.handleErrorMessageToast(R.string.P005);
}
} else {
mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
}
if (reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
mOperationLogic.updateSyncOperation(operationId, true);
}
}
} catch (ABVException ex) {
Logger.e(TAG, "sendTaskData", ex);
if (isDirections) {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
} else {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_report_data);
}
} catch (Exception e) {
Logger.e(TAG, e);
if (isDirections) {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
} else {
context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_report_data);
}
isError = true;
} finally {
mFinishCallback.callback(isError);
context.closeProgressPopup();
}
}
});
// 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 {
// if (isDirections) {
// // #32782 指示者テーブル関連削除 start
// // TODO change
//// mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
// mOperationLogic.sendTaskDirectionsData(operationId, taskKey, progressCallback);
// // #32782 指示者テーブル関連削除 end
// mOperationLogic.updateSyncOperation(operationId, true);
// } else {
// OperationDto operationDto = mOperationLogic.getOperation(operationId);
// if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
// if (mOperationLogic.sendRoutineTaskReportSendData(operationId, taskKey, progressCallback) > 0){
// context.handleErrorMessageToast(R.string.P005);
// }
// } else {
// mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
// }
// if (enableReportHistory != Constant.OperationUpdateType.HISTORY_ADD) {
// mOperationLogic.updateSyncOperation(operationId, true);
// }
// }
// } catch (ABVException ex) {
// Logger.e(TAG, "sendTaskData", ex);
// if (isDirections) {
// context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
// } else {
// context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_report_data);
// }
// } catch (Exception e) {
// Logger.e(TAG, e);
// if (isDirections) {
// context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_directions_data);
// } else {
// context.showSimpleAlertDialog(R.string.app_name, R.string.msg_send_error_task_report_data);
// }
// isError = true;
// } finally {
// mFinishCallback.callback(isError);
// context.closeProgressPopup();
// }
// }
// });
}
public void doABookCheckParamPdf(long operationId, OperationTaskDto operationTaskDto, String contentPath) {
try {
mOperationLogic.updateTaskHotspot(operationTaskDto.taskKey, operationTaskDto.pdfX, operationTaskDto.pdfY);
mOperationLogic.updateTaskHotspot(operationTaskDto.taskKey, operationTaskDto.pdfX, operationTaskDto.pdfY, Constant.TaskReportLevel.ReportType);
mOperationLogic.createHopSpotJson(operationId, contentPath);
} catch(IOException e){
e.printStackTrace();
......@@ -471,11 +461,13 @@ public class ABookCheckWebViewHelper extends ABookHelper {
JSONObject taskDirectionsJson = new JSONObject(taskDirections);
String taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) {
mOperationLogic.insertTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
mOperationLogic.insertTaskReportLevel(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, true);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
} else {
mOperationLogic.updateTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
mOperationLogic.updateTaskReportLevel(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, true);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
}
// #32782 指示者テーブル関連削除 end
}
......@@ -483,7 +475,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// #32782 指示者テーブル関連削除 start
// TODO change
/*
private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg) throws IOException {
private void insertOrUpdateTaskReport(String taskKey, int enableReportHistory, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg) throws IOException {
int taskReportSendId = 0;
// #32782 指示者テーブル関連削除 start
// 指示者か報告者か判断
......@@ -508,11 +500,11 @@ public class ABookCheckWebViewHelper extends ABookHelper {
// 指示者の場合下記の処理を行わない
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.insertTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
}
} else {
if (routineTaskReportFlg) {
......@@ -527,28 +519,28 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mOperationLogic.updateRoutineTaskReport(operationId, contentId, routineTaskTaskReportDto, attachedChangeFlag, true, insertFlg, true);
} else {
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.insertTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.updateTaskReportReplyLevel(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
}
}
if (routineTaskReportFlg) {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
} else {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, enableReportHistory, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
if (enableReportHistory == Constant.OperationUpdateType.HISTORY_NO) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
} else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
if (enableReportHistory == Constant.OperationUpdateType.HISTORY_ADD) {
if (routineTaskReportFlg) {
mOperationLogic.initialRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createRoutineTaskReportJson(operationId, contentPath);
......@@ -560,7 +552,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, routineTaskReportFlg, taskReportId, reportStartDate);
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
if (enableReportHistory == Constant.OperationUpdateType.HISTORY_ADD) {
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false));
......@@ -589,47 +581,39 @@ public class ABookCheckWebViewHelper extends ABookHelper {
} else {
if (insertFlg) {
// #32926 作業報告画面改善 start
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskReportLevel);
mOperationLogic.insertTaskReportReplyLevel(taskKey, operationId, taskReportLevel, contentId, taskReportJson, null, attachedChangeFlag, true);
// #32926 作業報告画面改善 end
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskReportLevel);
mOperationLogic.updateTaskReportReplyLevel(taskKey, taskReportLevel, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
}
}
if (routineTaskReportFlg) {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate, taskReportLevel);
} else {
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, String.valueOf(taskReportLevel));
// mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
mOperationLogic.createJsonForOperationContent(operationId, contentPath);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
if (reportUpdateType == Constant.EnableReportHistory.Invalid) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
if (routineTaskReportFlg) {
mOperationLogic.initialRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createRoutineTaskReportJson(operationId, contentPath);
} else {
mOperationLogic.initialTaskReport(operationId, contentId, taskKey);
mOperationLogic.createTaskReportJson(operationId, contentPath);
}
}
// #32926 作業報告画面改善 start
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, routineTaskReportFlg, taskReportId, reportStartDate, taskReportLevel);
// #32926 作業報告画面改善 end
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_ADD) {
if (reportUpdateType == Constant.EnableReportHistory.Enable) {
// 作業報告のディレクトリ削除
// #32926 作業報告画面改善 start
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, String.valueOf(taskReportLevel)));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel));
// #32926 作業報告画面改善 end
}
}
......@@ -640,14 +624,14 @@ public class ABookCheckWebViewHelper extends ABookHelper {
try {
List<TaskDto> taskDtoList = mOperationLogic.getOperationTask(operationId);
for (TaskDto taskDto : taskDtoList) {
if (operationDto.operationReportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
List<RoutineTaskReportDto> listRoutineTaskReport = mOperationLogic.getRoutineTaskReportByTaskKey(taskDto.taskKey);
for (RoutineTaskReportDto routineTaskDto : listRoutineTaskReport) {
copyRoutineTaskReportAttachedMovie(operationId, contentId, routineTaskDto.taskKey, routineTaskDto.taskReportId, routineTaskDto.reportStartDate, 0);
}
} else {
// #32926 作業報告画面改善 start
copyTaskAttachedMovie(operationId, contentId, taskDto.taskKey, String.valueOf(taskDto.taskReportLevel));
copyTaskAttachedMovie(operationId, contentId, taskDto.taskKey, taskDto.taskReportLevel);
// #32926 作業報告画面改善 end
}
}
......@@ -701,7 +685,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param contentId
*/
// #32926 作業報告画面改善 start
public void copyTaskAttachedMovie(long operationId, long contentId, String taskKey, String taskReportLevel) throws IOException {
public void copyTaskAttachedMovie(long operationId, long contentId, String taskKey, int taskReportLevel) throws IOException {
// 作業指示書の添付ファイル(mp4,mov拡張子のみ)コピー
String taskKeyPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
// #32926 作業報告画面改善 end
......@@ -756,7 +740,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
taskAttachedPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, sReportStartDate, taskReportLevel);
} else {
// #32926 作業報告画面改善 start
taskAttachedPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, String.valueOf(taskReportLevel));
taskAttachedPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
// #32926 作業報告画面改善 end
}
File taskAttachedFiles = new File(taskAttachedPath);
......
......@@ -63,8 +63,8 @@ public class OperationListHelper {
private List<OperationDto> filterOperationList() {
try {
String operationReportTypeStr = PreferenceUtil.getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
operationDtoList = mOperationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, operationReportTypeStr);
String reportTypeStr = PreferenceUtil.getUserPref(mAppActivity, AppDefType.UserPrefKey.OPERATION_REPORT_TYPES, null);
operationDtoList = mOperationLogic.getRefreshOperation(mAppActivity.mSearchWord, mAppActivity.mStartDateStr, mAppActivity.mEndDateStr, reportTypeStr);
} catch (Exception e) {
Logger.e(TAG, "findOperationList", e);
ErrorMessage.showErrorMessageToast(mAppActivity.getApplicationContext(), ErrorCode.E107);
......
......@@ -5245,7 +5245,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
}
public int getOperationReportUpdateType() {
return reportUpdateType;
return enableReportHistory;
}
/**
......
......@@ -272,11 +272,7 @@ public class OperationTaskLayout extends RelativeLayout {
}
private boolean isTaskFinished(String taskKey) {
if(mContext.getOperationReportUpdateType() == Constant.OperationUpdateType.HISTORY_ADD) {
return false;
} else {
return mTaskDao.getTaskByTaskKey(taskKey).taskStatus == FINISHED_STATUS;
}
return mTaskDao.getTaskByTaskKey(taskKey).taskStatus == FINISHED_STATUS;
}
public void showTaskList(int pageNum, boolean isNormalSize) {
......
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