Commit b365f57a by Jeong Gilmo

#32782 指示者テーブル関連削除

parent fc9484dd
......@@ -28,9 +28,15 @@ public class OperationDataJSON extends AcmsCommonJSON {
public static final String TaskCode = "taskCode";
public static final String TaskStatus = "taskStatus";
public static final String TaskHotspotInfo = "taskHotspotInfo";
public static final String TaskDirectionsInfo = "taskDirectionsInfo";
// #32782 指示者テーブル関連削除 start
// TODO Delete TaskDirections
public static final String TaskDirectionsInfo = "taskReportInfo";
// #32782 指示者テーブル関連削除 end
public static final String TaskReportInfo = "taskReportInfo";
public static final String TaskDirectionsKey = "taskDirectionsKey";
// #32782 指示者テーブル関連削除 start
// TODO Delete TaskDirections
public static final String TaskDirectionsKey = "taskReportKey";
// #32782 指示者テーブル関連削除 end
public static final String TaskReportKey = "taskReportKey";
public static final String Task = "task";
......@@ -50,10 +56,9 @@ public class OperationDataJSON extends AcmsCommonJSON {
for (int i = 0; i < taskList.length(); i++) {
JSONObject taskJson = taskList.getJSONObject(i);
TaskDto dto = new TaskDto();
// 0305 start
// dto.taskDirectionsDto = new TaskDirectionsDto();
// #32782 指示者テーブル関連削除 start
dto.taskDirectionsDto = new TaskReportDto();
// 0305 end
// #32782 指示者テーブル関連削除 end
dto.taskReportDto = new TaskReportDto();
dto.operationId = taskJson.getLong(OperationId);
......
......@@ -41,10 +41,9 @@ public class RoutineTaskDataJSON extends OperationDataJSON {
for (int i = 0; i < taskList.length(); i++) {
JSONObject taskJson = taskList.getJSONObject(i);
TaskDto dto = new TaskDto();
// 0305 start
// dto.taskDirectionsDto = new TaskDirectionsDto();
// #32782 指示者テーブル関連削除 start
dto.taskDirectionsDto = new TaskReportDto();
// 0305 end
// #32782 指示者テーブル関連削除 end
dto.taskReportDto = new TaskReportDto();
dto.operationId = taskJson.getLong(OperationId);
......
......@@ -17,10 +17,13 @@ public class ABookKeys {
// ABOOKCHECK SCHEME
public static final String ABOOK_CHECK_API = "abookcheck-api";
// #32782 指示者テーブル関連削除 start
// TODO TaskDirections 削除処理が必要
public static final String CMD_INSERT_TASK_DIRECTIONS = "insertTaskDirections";
public static final String CMD_UPDATE_TASK_DIRECTIONS = "updateTaskDirections";
public static final String CMD_DELETE_TASK_DIRECTIONS = "deleteTaskDirections";
public static final String CMD_CANCEL_TASK_DIRECTIONS = "cancelTaskDirections";
// #32782 指示者テーブル関連削除 end
public static final String CMD_MOVE_HOT_SPOT = "moveHotspot";
public static final String CMD_SHOW_DIRECTION_OZD = "showDirectionOzd";
public static final String CMD_PREVIEW_DIRECTION_OZD = "previewDirectionOzd";
......@@ -47,8 +50,11 @@ public class ABookKeys {
public static final String READ_ONLY_FLG = "readOnlyFlg";
public static final String DIRECTION_FLG = "directionFlg";
public static final String ATTACHED_CHANGE_FLAG = "attachedChangeFlag";
public static final String TASK_DIRECTIONS = "taskDirections";
public static final String TASK_DIRECTIONS_SUGGEST = "taskDirectionsSuggest";
// #32782 指示者テーブル関連削除 start
// TODO TASK_DIRECTIONS 削除が必要
public static final String TASK_DIRECTIONS = "taskReport";
public static final String TASK_DIRECTIONS_SUGGEST = "taskReportSuggest";
// #32782 指示者テーブル関連削除 end
public static final String TASK_HOTSPOT = "taskHotspot";
public static final String TASK_REPORT = "taskReport";
public static final String TASK_REPORT_SUGGEST = "taskReportSuggest";
......
......@@ -91,10 +91,10 @@ public class ABVDataOpenHelper {
iTableScripts.add(new TOperation());
iTableScripts.add(new ROperationContent());
iTableScripts.add(new TTask());
// 0305 start
// #32782 指示者テーブル関連削除 start
// iTableScripts.add(new TTaskDirections());
// iTableScripts.add(new TTaskDirectionsItems());
// 0305 end
// #32782 指示者テーブル関連削除 end
iTableScripts.add(new TTaskReport());
iTableScripts.add(new TTaskReportSend());
iTableScripts.add(new TTaskReportItems());
......
......@@ -204,10 +204,10 @@ public class OperationDao extends AbstractDao {
delete("r_project_content", null, null);
delete("t_project", null, null);
delete("t_task", null, null);
// 0305 start
// #32782 指示者テーブル関連削除 start
// delete("t_task_directions", null, null);
// delete("t_task_directions_items", null, null);
// 0305 end
// #32782 指示者テーブル関連削除 end
delete("t_task_report", null, null);
delete("t_task_report_send", null, null);
delete("t_task_report_items", null, null);
......
......@@ -100,12 +100,9 @@ public class TaskDao extends AbstractDao {
if (directionFlg) {
delete("t_task", "task_key=?", keyValues);
// 0305 start
// delete("t_task_directions", "task_key=?", keyValues);
// delete("t_task_directions_items", "task_key=?", keyValues);
// #32782 指示者テーブル関連削除
delete("t_task_report", "task_key=?", keyValues);
delete("t_task_report_items", "task_key=?", keyValues);
// 0305 end
} else {
delete("t_task_report", "task_key=?", keyValues);
delete("t_task_report_items", "task_key=?", keyValues);
......@@ -118,10 +115,7 @@ public class TaskDao extends AbstractDao {
*/
public void delete(TaskDto dto) {
delete("t_task", "task_key=?", dto.getKeyValues());
// 0305 start
// delete("t_task_directions", "task_key=?", dto.getKeyValues());
// delete("t_task_directions_items", "task_key=?", dto.getKeyValues());
// 0305 end
// #32782 指示者テーブル関連削除
delete("t_task_report", "task_key=?", dto.getKeyValues());
delete("t_task_report_items", "task_key=?", dto.getKeyValues());
delete("t_inspect_task_report", "task_key=?", new String[] { dto.taskKey });
......
......@@ -53,12 +53,12 @@ public class TaskReportDao extends AbstractDao {
if (column != -1) {
dto.delFlg = toBool(cursor.getInt(column));
}
// 0305 start
// #32782 指示者テーブル関連削除 start
column = cursor.getColumnIndex("reportor_flag");
if (column != -1) {
dto.reportorFlag = toBool(cursor.getInt(column));
dto.reporterFlag = toBool(cursor.getInt(column));
}
// 0305 end
// #32782 指示者テーブル関連削除 end
return dto;
}
......@@ -70,12 +70,12 @@ public class TaskReportDao extends AbstractDao {
+ "attached_file_name, "
+ "local_attached_file_name, "
+ "attached_file_send_flg, "
// 0301 start
+ "reportor_flag, "
// 0301 end
+ "data_send_flg) "
+ "data_send_flg, "
// #32782 指示者テーブル関連削除 start
+ "reporter_flag) "
// #32782 指示者テーブル関連削除 end
+ "values "
+ "(?,?,?,?,?,?)",
+ "(?,?,?,?,?,?,?)",
dto.getInsertValues());
}
......@@ -103,9 +103,9 @@ public class TaskReportDao extends AbstractDao {
+ "local_attached_file_name=?, "
+ "attached_file_send_flg=?, "
+ "data_send_flg=?, "
// 0301 start
+ "reportor_flag=? "
// 0301 end
// #32782 指示者テーブル関連削除 start
+ "reporter_flag=? "
// #32782 指示者テーブル関連削除 end
+ "where task_key=?",
dto.getUpdateValues());
return count > 0;
......@@ -133,7 +133,7 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
}
public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey, boolean reportorFlag) {
public List<TaskReportDto> getSendableTaskData(Long operationId, String taskKey, boolean reporterFlag) {
StringBuilder sb = new StringBuilder();
sb.append(" select * ");
sb.append(" from t_task_report ttr ");
......@@ -143,10 +143,10 @@ public class TaskReportDao extends AbstractDao {
sb.append(" WHERE ttr.data_send_flg = 1");
sb.append(" AND tt.project_id = ?");
sb.append(" AND tt.task_key = ?");
// 0305 start
sb.append(" AND ttr.reportor_flag = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey, "" + reportorFlag}, TaskReportDto.class);
// 0305 end
// #32782 指示者テーブル関連削除 start
sb.append(" AND ttr.repertor_flag = ?");
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId, "" + taskKey, "" + reporterFlag}, TaskReportDto.class);
// #32782 指示者テーブル関連削除 end
}
public String getTaskReportAttachedFileName(String taskKey) {
......
......@@ -28,9 +28,9 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" , local_attached_file_name TEXT ");
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 ");
sql.append(" , data_send_flg BOOLEAN DEFAULT 0 ");
// 0305 start
sql.append(" , reportor_flag BOOLEAN DEFAULT 0 ");
// 0305 end
// #32782 指示者テーブル関連削除 start
sql.append(" , reporter_flag BOOLEAN DEFAULT 0 ");
// #32782 指示者テーブル関連削除 end
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -16,11 +16,11 @@ public class TaskDto extends AbstractDto {
public String taskHotSpotInfo;
public boolean delFlg;
// 0305 start
// public TaskDirectionsDto taskDirectionsDto;
// #32782 指示者テーブル関連削除 start
// TODO TaskDirectionDto から TaskReportDto に変更、taskDirectionsDto 名を変更必要
public TaskReportDto taskDirectionsDto;
// #32782 指示者テーブル関連削除 end
public TaskReportDto taskReportDto;
// 0305 end
public int taskReportId;
public List<RoutineTaskReportDto> RoutineTaskReportList;
......
......@@ -15,24 +15,22 @@ public class TaskReportDto extends AbstractDto {
public String taskHotSpotInfo;
public boolean delFlg;
// 0301 start
public boolean reportorFlag;
// 0301 end
// #32782 指示者テーブル関連削除 start
public boolean reporterFlag;
// #32782 指示者テーブル関連削除 end
@Override
public Object[] getInsertValues() {
// 0301 start
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reportorFlag };
// return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg };
// 0301 end
// #32782 指示者テーブル関連削除 start
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag };
// #32782 指示者テーブル関連削除 end
}
@Override
public Object[] getUpdateValues() {
// 0301 start
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reportorFlag, taskKey };
// return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskKey };
// 0301 end
// #32782 指示者テーブル関連削除 start
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reporterFlag, taskKey };
// #32782 指示者テーブル関連削除 end
}
@Override
......
......@@ -78,10 +78,10 @@ public class OperationLogic extends AbstractLogic {
private WorkerGroupDao mWorkerGroupDao = AbstractDao.getDao(WorkerGroupDao.class);
private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
// 0301 start
// #32782 指示者テーブル関連削除 start
// private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
// private TaskDirectionsItemsDao mTaskDirectionsItemsDao = AbstractDao.getDao(TaskDirectionsItemsDao.class);
// 0301 end
// #32782 指示者テーブル関連削除 end
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private TaskReportSendDao mTaskReportSendDao = AbstractDao.getDao(TaskReportSendDao.class);
private TaskReportItemsDao mTaskReportItemsDao = AbstractDao.getDao(TaskReportItemsDao.class);
......@@ -228,124 +228,10 @@ public class OperationLogic extends AbstractLogic {
* @throws IOException
*/
public void insertTaskDirections( String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
// 0305 start
// TaskDto taskDto = new TaskDto();
// TaskDirectionsDto taskDirectionsDto = new TaskDirectionsDto();
// JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
// taskDto.taskKey = taskKey;
// taskDto.operationId = operationId;
// taskDto.taskHotSpotInfo = hotSpotInfo;
//
//
// Iterator taskKeys = taskJson.keys();
// while (taskKeys.hasNext()) {
// TaskDirectionsItemsDto taskDirectionsItemsDto = new TaskDirectionsItemsDto();
// String itemKey = (String) taskKeys.next();
// if (itemKey.startsWith("q_1_")) {
// taskDto.taskCode = taskJson.getString(itemKey);
// }
// taskDirectionsItemsDto.taskKey = taskKey;
// taskDirectionsItemsDto.itemKey = itemKey;
// try {
// taskDirectionsItemsDto.inputValue = taskJson.getString(itemKey);
// } catch (JSONException e) {
// // 値がStringではない場合、無視する
// continue;
// }
// mTaskDirectionsItemsDao.insertTaskDirectionsItems(taskDirectionsItemsDto);
// }
// taskDirectionsDto.taskKey = taskKey;
// taskDirectionsDto.jsonData = taskDirectionsJson.toString();
// taskDirectionsDto.dataSendFlg = dataSendFlg;
// taskDirectionsDto.attachedFileSendFlg = attachedChangeFlag;
// if (localAttachedFileName != null) {
// taskDirectionsDto.localAttachedFileName = localAttachedFileName;
// }
//
// if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
// taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
// }
//
// mTaskDirectionsDao.insert(taskDirectionsDto);
// mTaskDao.insert(taskDto);
//
// String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
//
// //添付ファイル変更の場合、以下の処理を行う
// JSONObject attachedListJson = taskDirectionsJson.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);
// }
TaskDto taskDto = new TaskDto();
TaskReportDto taskReportDto = new TaskReportDto();
JSONObject taskJson = taskDirectionsJson.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 = taskDirectionsJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
if (localAttachedFileName != null) {
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
}
// 0305 start
// 指示の場合
taskReportDto.reportorFlag = false;
// 0305 end
mTaskReportDao.insert(taskReportDto);
mTaskDao.insert(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskDirectionsJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, true);
// #32782 指示者テーブル関連削除 start
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
// 0305 end
// TODO Delete method
// #32782 指示者テーブル関連削除 end
}
/**
......@@ -362,137 +248,9 @@ public class OperationLogic extends AbstractLogic {
* @throws IOException
*/
public void updateTaskDirections(String taskKey, long operationId, long contentId, JSONObject taskDirectionsJson, 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;
}
// 0305 start
// TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
// taskDto.operationId = operationId;
// taskDto.taskHotSpotInfo = hotSpotInfo;
// JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
//
// Iterator taskKeys = taskJson.keys();
// List<TaskDirectionsItemsDto> taskDirectionsItemsDtoList = mTaskDirectionsItemsDao.getTaskDirectionsItemByTaskKey(taskKey);
// for (TaskDirectionsItemsDto taskDirectionsItemsDto : taskDirectionsItemsDtoList) {
// try {
// String newValue = taskJson.getString(taskDirectionsItemsDto.itemKey);
// if (!newValue.equals(taskDirectionsItemsDto.inputValue)) {
// // 値が異なる場合のみ、更新する
// taskDirectionsItemsDto.inputValue = newValue;
// if (taskDirectionsItemsDto.itemKey.startsWith("q_1_")) {
// // 値が異なるため、作業コードの入力値を変更する
// taskDto.taskCode = taskDirectionsItemsDto.inputValue;
// }
// mTaskDirectionsItemsDao.updateTaskDirectionsItems(taskDirectionsItemsDto);
// }
// } catch (JSONException e) {
// // 値がStringではない場合、無視する
// continue;
// }
// }
// taskDirectionsDto.jsonData = taskDirectionsJson.toString();
// taskDirectionsDto.dataSendFlg = dataSendFlg;
//
// // attachedFileSendFlgがtrueの場合は、更新しない
// if (!taskDirectionsDto.attachedFileSendFlg) {
// taskDirectionsDto.attachedFileSendFlg = attachedChangeFlag;
// }
// if (localAttachedFileName != null) {
// taskDirectionsDto.localAttachedFileName = localAttachedFileName;
// }
//
// if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
// taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
// }
//
// mTaskDirectionsDao.update(taskDirectionsDto);
// mTaskDao.update(taskDto);
// String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, true);
// if (taskDirectionsDto.attachedFileSendFlg) {
// //添付ファイル変更の場合、以下の処理を行う
// JSONObject attachedListJson = taskDirectionsJson.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);
// }
// }
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
taskDto.operationId = operationId;
taskDto.taskHotSpotInfo = hotSpotInfo;
JSONObject taskJson = taskDirectionsJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys();
List<TaskReportItemsDto> taskReportItemsDtoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDtoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskReportItemsDto.inputValue = newValue;
if (taskReportItemsDto.itemKey.startsWith("q_1_")) {
// 値が異なるため、作業コードの入力値を変更する
taskDto.taskCode = taskReportItemsDto.inputValue;
}
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
}
taskReportDto.jsonData = taskDirectionsJson.toString();
taskReportDto.dataSendFlg = dataSendFlg;
// attachedFileSendFlgがtrueの場合は、更新しない
if (!taskReportDto.attachedFileSendFlg) {
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
}
if (localAttachedFileName != null) {
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
}
// 0305 start
taskReportDto.reportorFlag = false;
// 0305 end
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, true);
if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskDirectionsJson.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);
}
}
// 0305 end
// #32782 指示者テーブル関連削除 start
// TODO Delete method
// #32782 指示者テーブル関連削除 end
}
// TODO
......@@ -505,33 +263,9 @@ public class OperationLogic extends AbstractLogic {
* @param taskKey
*/
public void deleteTaskDirections(long operationId, long contentId, String taskKey) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
return;
}
// 0305 start
// TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
// taskDirectionsDto.dataSendFlg = true;
// taskDirectionsDto.attachedFileSendFlg = false;
// taskDto.delFlg = true;
// mTaskDirectionsDao.update(taskDirectionsDto);
// mTaskDao.update(taskDto);
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskDto.delFlg = true;
// 0305 start
taskReportDto.reportorFlag = false;
// 0305 end
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
// プロジェクトの作業データディレクトリ削除
deleteTaskFileData(operationId, contentId, taskKey);
// 0305 end
// #32782 指示者テーブル関連削除 start
// TODO Delete method
// #32782 指示者テーブル関連削除 end
}
/**
......@@ -540,16 +274,29 @@ public class OperationLogic extends AbstractLogic {
* @param taskKey
* @param operationId
* @param contentId
* @param taskReportJson
* @param localAttachedFileName
* @param attachedChangeFlag
* @param dataSendFlg
* @param hotSpotInfo
* @throws IOException
*/
public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
public void insertTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, String hotSpotInfo) throws IOException {
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");
......@@ -557,9 +304,17 @@ public class OperationLogic extends AbstractLogic {
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 {
......@@ -575,10 +330,19 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
// 0305 start
// #32782 指示者テーブル関連削除 start
// 報告者の場合
taskReportDto.reportorFlag = true;
// 0305 end
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);
......@@ -587,7 +351,12 @@ public class OperationLogic extends AbstractLogic {
} else {
mTaskReportDao.insert(taskReportDto);
}
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
mTaskDao.insert(taskDto);
} else {
mTaskDao.update(taskDto);
}
//添付ファイル変更の場合、以下の処理を行う
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
......@@ -665,17 +434,30 @@ public class OperationLogic extends AbstractLogic {
* @param taskReport
* @param attachedChangeFlag
* @param dataSendFlg
* @param hotSpotInfo
* @throws IOException
*/
public void updateTaskReport(String taskKey, long operationId, long contentId, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
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");
insertTaskReport(taskKey, operationId, contentId, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg);
// 指示者の場合
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 {
......@@ -685,10 +467,18 @@ public class OperationLogic extends AbstractLogic {
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;
......@@ -700,10 +490,20 @@ public class OperationLogic extends AbstractLogic {
if (!taskReportDto.attachedFileSendFlg) {
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
}
// #32782 指示者テーブル関連削除 start
taskReportDto.reporterFlag = true;
// #32782 指示者テーブル関連削除 end
// 指示者の場合
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (localAttachedFileName != null) {
taskReportDto.localAttachedFileName = localAttachedFileName;
}
// 0305 start
taskReportDto.reportorFlag = true;
// 0305 end
if (taskReport.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskReport.getInt(ABookKeys.TASK_STATUS);
}
}
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
......@@ -901,7 +701,26 @@ public class OperationLogic extends AbstractLogic {
* @param taskKey
*/
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;
......@@ -909,16 +728,13 @@ public class OperationLogic extends AbstractLogic {
mTaskReportDao.update(taskReportDto);
}
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto != null) {
taskDto.taskStatus = 0;
mTaskDao.update(taskDto);
}
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false));
}
// #32782 指示者テーブル関連削除 end
}
/**
* 定期点検用、作業削除
......@@ -1028,17 +844,12 @@ public class OperationLogic extends AbstractLogic {
*/
public void updateTaskHotspot(String taskKey, Map<String, String> param) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// 0305 start
// TaskDirectionsDto taskDirectionsDto = mTaskDirectionsDao.getTaskDirections(taskKey);
// taskDirectionsDto.dataSendFlg = true;
// taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
// mTaskDirectionsDao.update(taskDirectionsDto);
// #32782 指示者テーブル関連削除 start
TaskReportDto taskReportDao = mTaskReportDao.getTaskReport(taskKey);
taskReportDao.dataSendFlg = true;
taskDto.taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
mTaskReportDao.update(taskReportDao);
// 0305 end
// #32782 指示者テーブル関連削除 end
mTaskDao.update(taskDto);
}
......@@ -1051,15 +862,7 @@ public class OperationLogic extends AbstractLogic {
*/
public void updateTaskHotspot(String taskKey, float newX, float newY) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
// 0305 start
// 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);
// #32782 指示者テーブル関連削除 start
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey);
taskReportDto.dataSendFlg = true;
JSONObject hotSpot = new JSONObject(taskDto.taskHotSpotInfo);
......@@ -1067,13 +870,13 @@ public class OperationLogic extends AbstractLogic {
hotSpot.put("y", newY);
taskDto.taskHotSpotInfo = hotSpot.toString();
mTaskReportDao.update(taskReportDto);
// 0305 end
// #32782 指示者テーブル関連削除 end
mTaskDao.update(taskDto);
}
/**
* 作業指示、作業報告用のjsonファイル
* taskDirections.jsonとtaskDirectionsSuggest.jsonとhotspot.jsonを作成
* taskReport.jsonとtaskReportSuggest.jsonとhotspot.jsonを作成
*
* @param operationId
* @param reportUpdateType
......@@ -1087,7 +890,7 @@ public class OperationLogic extends AbstractLogic {
/**
* 作業指示、作業報告用のjsonファイル
* taskDirections.jsonとtaskDirectionsSuggest.jsonとhotspot.jsonを作成
* taskReport.jsonとtaskReportSuggest.jsonとhotspot.jsonを作成
*
* @param operationId
* @param reportUpdateType
......@@ -1098,22 +901,15 @@ public class OperationLogic extends AbstractLogic {
*/
public void createJsonForOperationContent(Long operationId, int reportUpdateType, String contentPath, boolean directionsFlg, boolean routineTaskReportFlg) throws IOException {
try {
// 0305 start
createTaskDirectionsJson(operationId, contentPath);
createTaskDirectionsSuggestJson(operationId, contentPath);
// #32782 指示者テーブル関連削除 start
createTaskReportJson(operationId, contentPath);
createTaskReportSuggestJson(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);
}
// 0305 end
// #32782 指示者テーブル関連削除 end
createHopSpotJson(operationId, contentPath);
} catch (IOException e) {
......@@ -1223,27 +1019,9 @@ public class OperationLogic extends AbstractLogic {
* @throws IOException
*/
private void createTaskDirectionsJson(Long operationId, String contentPath) throws IOException {
// 0305 start
// 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());
List<JSONObject> taskReportJsonList = new ArrayList<JSONObject>();
JSONObject taskReportJson = new JSONObject();
List<TaskReportDto> taskReportDtoList = mTaskReportDao.getTaskReportByOperationId(operationId);
for (TaskReportDto dto : taskReportDtoList) {
taskReportJsonList.add(new JSONObject(dto.jsonData));
}
taskReportJson.put(ABookKeys.TASK_DIRECTIONS, taskReportJsonList);
Logger.d(TAG, "createTaskDirectionsJson : " + taskReportJson.toString());
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_DIRECTIONS + ".json", taskReportJson.toString());
// 0305 end
// #32782 指示者テーブル関連削除 start
// TODO Delete method
// #32782 指示者テーブル関連削除 end
}
/**
......@@ -1254,59 +1032,9 @@ public class OperationLogic extends AbstractLogic {
* @throws IOException
*/
private void createTaskDirectionsSuggestJson(Long operationId, String contentPath) throws IOException {
// 0305 start
// 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());
JSONObject itemJson = new JSONObject();
JSONObject taskReportSuggestJson = new JSONObject();
List<TaskReportItemsDto> taskReportItemsDtoList = mTaskReportItemsDao.getTaskReportItemByOperationId(operationId);
for (TaskReportItemsDto dto : taskReportItemsDtoList) {
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);
}
}
taskReportSuggestJson.put(ABookKeys.TASK_DIRECTIONS_SUGGEST, itemJson);
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_DIRECTIONS_SUGGEST + ".json", taskReportSuggestJson.toString());
// 0305 end
// #32782 指示者テーブル関連削除 start
// TODO Delete mothod
// #32782 指示者テーブル関連削除 end
}
......@@ -1414,10 +1142,9 @@ public class OperationLogic extends AbstractLogic {
// プロジェクト毎に作業の送信フラグがあるかチェックし、存在する場合プロジェクトのデータ同期必要区分をtrueにセット
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// 作業指示者
// 0305 start
// if (mTaskDirectionsDao.isExistSendTaskData(operationDto.operationId)) {
// #32782 指示者テーブル関連削除 start
if (mTaskReportDao.isExistSendTaskData(operationDto.operationId)) {
// 0305 end
// #32782 指示者テーブル関連削除 end
mOperationDao.updateNeedSyncFlg(operationDto.operationId, true);
}
} else {
......@@ -1534,52 +1261,9 @@ public class OperationLogic extends AbstractLogic {
* @return
* @throws Exception
*/
// TODO sendTaskDirectionsData 名を変更必要
public void sendTaskDirectionsData(long operationId, String taskKey, Callback progressCallback) throws ABVException, NetworkDisconnectedException, IOException, ZipException, NoSuchAlgorithmException {
// 0305 start
// 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);
// 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 指示者テーブル関連削除 start
List<TaskReportDto> taskReportDtoList = null;
int maxProgress = 0;
if (taskKey == null) {
......@@ -1617,15 +1301,15 @@ public class OperationLogic extends AbstractLogic {
} else {
dto.dataSendFlg = false;
dto.attachedFileSendFlg = false;
// 0305 start
dto.reportorFlag = false;
// 0305 end
// #32782 指示者テーブル関連削除 start
dto.reporterFlag = false;
// #32782 指示者テーブル関連削除 end
mTaskReportDao.update(dto);
}
progressCallback.callback(new Integer(progress));
}
}
// 0305 end
// #32782 指示者テーブル関連削除 end
}
/**
......@@ -1645,6 +1329,40 @@ public class OperationLogic extends AbstractLogic {
maxProgress = 100;
}
if (taskReportDtoList != null && taskReportDtoList.size() > 0) {
// #32782 指示者テーブル関連削除 start
// 指示者の場合
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
//プログレスを40%進行させるための計算
int progress = maxProgress / taskReportDtoList.size();
for (TaskReportDto dto : taskReportDtoList) {
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;
mTaskReportDao.update(dto);
}
progressCallback.callback(new Integer(progress));
}
} else {
OperationDto operationDto = mOperationDao.getOperation(operationId);
int allSendCount = mTaskReportSendDao.getSendableTaskReportSendDataCount(operationId, taskKey);
......@@ -1707,13 +1425,15 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.dataSendFlg = false;
taskReportDto.attachedFileSendFlg = false;
// 0305 start
taskReportDto.reportorFlag = true;
// 0305 end
// #32782 指示者テーブル関連削除 start
taskReportDto.reporterFlag = true;
// #32782 指示者テーブル関連削除 end
mTaskReportDao.update(taskReportDto);
}
}
}
// #32782 指示者テーブル関連削除 end
}
}
/**
......
......@@ -143,9 +143,9 @@ public class OperationListActivity extends ABVUIActivity {
private Dialog mPanoEntryDialog;
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
// 0301 start
// #32782 指示者テーブル関連削除 start
// private TaskDirectionsDao mTaskDirectionsDao = AbstractDao.getDao(TaskDirectionsDao.class);
// 0301 end
// #32782 指示者テーブル関連削除 end
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private RoutineTaskReportDao mRoutineTaskReportDao = AbstractDao.getDao(RoutineTaskReportDao.class);
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
......@@ -1044,17 +1044,16 @@ public class OperationListActivity extends ABVUIActivity {
progress = 40 / json.taskDtoList.size();
}
// 0305 start
// JSONObject taskDirectionJson;
// #32782 指示者テーブル関連削除 start
JSONObject taskReportJson;
for (TaskDto taskDto : json.taskDtoList) {
String directionsAttachedFileName = taskDto.taskDirectionsDto.attachedFileName;
String reportAttachedFileName = taskDto.taskReportDto.attachedFileName;
// 0305 start
// #32782 指示者テーブル関連削除 start
taskReportJson = new JSONObject(taskDto.taskDirectionsDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, taskDto.taskStatus);
// 0305 end
// #32782 指示者テーブル関連削除 end
int localTaskIndex = localTaskList.indexOf(taskDto);
if (localTaskIndex >= 0) {
......@@ -1065,17 +1064,17 @@ public class OperationListActivity extends ABVUIActivity {
return null;
}
// 0305 start
// #32782 指示者テーブル関連削除 start
// 作業更新
mOperationLogic.updateTaskDirections(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
taskReportJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
// 0305 end
mOperationLogic.updateTaskReport(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
taskReportJson, directionsAttachedFileName, false, false, taskDto.taskHotSpotInfo);
localTaskList.remove(taskDto);
// 報告データが存在すると作業報告を更新する
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.updateTaskReport(taskDto.taskKey, taskDto.operationId, operationContentDto.contentId,
new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false);
taskReportJson, reportAttachedFileName, false, false, taskDto.taskHotSpotInfo);
}
// #32782 指示者テーブル関連削除 end
} else {
// 添付ファイルが存在する場合、取得して解凍する。
refreshTaskFile(operationId, operationContentDto.contentId, taskDto.taskId, taskDto.taskKey, directionsAttachedFileName, reportAttachedFileName);
......@@ -1083,19 +1082,19 @@ public class OperationListActivity extends ABVUIActivity {
return null;
}
// 0301 start
// #32782 指示者テーブル関連削除 start
// 作業登録
mOperationLogic.insertTaskDirections(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskReportJson, taskDto.taskHotSpotInfo, directionsAttachedFileName, false, false);
// 0305 end
mOperationLogic.insertTaskReport(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
taskReportJson, directionsAttachedFileName, false, false, taskDto.taskHotSpotInfo);
if (taskDto.taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReport(taskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId,
new JSONObject(taskDto.taskReportDto.jsonData), reportAttachedFileName, false, false);
taskReportJson, reportAttachedFileName, false, false, taskDto.taskHotSpotInfo);
}
// #32782 指示者テーブル関連削除 end
}
progressCallback.callback(new Integer(progress));
}
// 0305 end
// #32782 指示者テーブル関連削除 end
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
......@@ -1115,10 +1114,9 @@ public class OperationListActivity extends ABVUIActivity {
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
// 0305 start
// String directionsLocalAttachedFileName = mTaskDirectionsDao.getTaskDirectionsAttachedFileName(taskKey);
// #32782 指示者テーブル関連削除 start
String directionsLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey);
// 0305 end
// #32782 指示者テーブル関連削除 end
String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey);
int count = 0;
boolean getDirectionsFileFlg = directionsAttachedFileName != null && !directionsAttachedFileName.equals(directionsLocalAttachedFileName);
......
......@@ -66,41 +66,49 @@ public class ABookCheckWebViewHelper extends ABookHelper {
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) throws IOException {
int taskReportSendId = 0;
mFinishCallback = finishCallback;
int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, true);
copyTaskAttachedMovie(operationId, contentId, taskKey);
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
insertOrUpdateTaskDirections(taskKey, operationId, contentId, param, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, 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);
sendTaskDirectionsData(context, operationId, taskKey);
break;
case ABookKeys.CMD_MOVE_HOT_SPOT:
mOperationLogic.updateTaskHotspot(taskKey, param);
mOperationLogic.createHopSpotJson(operationId, contentPath);
break;
// #32782 指示者テーブル関連削除 start
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, reportUpdateType, operationId, contentId, param, contentPath, true, routineTaskReportFlg);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
copyTaskAttachedMovie(operationId, contentId, taskKey);
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, reportUpdateType, 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);
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
copyTaskAttachedMovie(operationId, contentId, taskKey);
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
}
break;
// #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
// TODO TASK_DIRECTIONS の削除
case ABookKeys.CMD_DELETE_TASK_REPORT:
int taskReportId = 0;
String reportStartDate = "";
boolean sendTaskReportDataFlg = false;
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey);
sendTaskReportData(context, operationId, taskKey, -1, true);
} else {
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
......@@ -110,7 +118,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
RoutineTaskReportDto routineTaskTaskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
if(routineTaskTaskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
if (routineTaskTaskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
} else {
......@@ -119,12 +127,12 @@ public class ABookCheckWebViewHelper extends ABookHelper {
copyTaskAttachedMovie(operationId, contentId, taskKey);
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey);
if(taskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
if (taskReportDto != null && reportUpdateType != Constant.OperationUpdateType.HISTORY_ADD) {
sendTaskReportDataFlg = true;
}
}
if(sendTaskReportDataFlg) {
if (sendTaskReportDataFlg) {
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
taskReportSendId = mOperationLogic.getLastTaskReportSendId(taskKey);
mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
......@@ -133,10 +141,16 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, null, true);
}
sendTaskReportData(context, operationId, taskKey, reportUpdateType);
sendTaskReportData(context, operationId, taskKey, reportUpdateType, false);
} else {
mFinishCallback.callback(false);
}
}
break;
// #32782 指示者テーブル関連削除 end
case ABookKeys.CMD_MOVE_HOT_SPOT:
mOperationLogic.updateTaskHotspot(taskKey, param);
mOperationLogic.createHopSpotJson(operationId, contentPath);
break;
case ABookKeys.CMD_CANCEL_TASK_DIRECTIONS:
case ABookKeys.CMD_CANCEL_TASK_REPORT:
......@@ -154,9 +168,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param taskKey タスクキー
*/
private void sendTaskDirectionsData(final ABVContentViewActivity context, final long operationId, final String taskKey) {
Logger.d(TAG, "[sendTaskDirectionsData] operationId=%s, taskKey=%s", operationId, taskKey);
//作業指示送信時には「reportUpdateType」値が必要ではないので、「-1」に設定
sendTaskData(context, operationId, taskKey, -1, true);
// #32782 指示者テーブル関連削除 start
// TODO Delete mothod
// #32782 指示者テーブル関連削除 end
}
/**
......@@ -166,9 +180,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param taskKey タスクキー
* @param reportUpdateType 作業履歴タイプ
*/
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType) {
private void sendTaskReportData(final ABVContentViewActivity context, final long operationId, final String taskKey, final int reportUpdateType, final boolean isDirection) {
Logger.d(TAG, "[sendTaskReportData] operationId=%s, taskKey=%s", operationId, taskKey);
sendTaskData(context, operationId, taskKey, reportUpdateType, false);
sendTaskData(context, operationId, taskKey, reportUpdateType, isDirection);
}
/**
......@@ -207,7 +221,9 @@ public class ABookCheckWebViewHelper extends ABookHelper {
boolean isError = false;
try {
if (isDirections) {
mOperationLogic.sendTaskDirectionsData(operationId, taskKey, progressCallback);
// #32782 指示者テーブル関連削除 start
mOperationLogic.sendTaskReportSendData(operationId, taskKey, progressCallback);
// #32782 指示者テーブル関連削除 end
mOperationLogic.updateSyncOperation(operationId, true);
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationId);
......@@ -327,27 +343,43 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @throws IOException
*/
private void insertOrUpdateTaskDirections(String taskKey, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg) throws IOException {
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskDirections = param.get(ABookKeys.TASK_DIRECTIONS);
JSONObject taskDirectionsJson = new JSONObject(taskDirections);
String taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) {
mOperationLogic.insertTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
} else {
mOperationLogic.updateTaskDirections(taskKey, operationId, contentId, taskDirectionsJson, taskHotSpotInfo, null, attachedChangeFlag, true);
mOperationLogic.createJsonForOperationContent(operationId, 0, contentPath, true);
}
// #32782 指示者テーブル関連削除 start
// TODO Delete method
// #32782 指示者テーブル関連削除 end
}
private void insertOrUpdateTaskReport(String taskKey, int reportUpdateType, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, boolean routineTaskReportFlg) throws IOException {
int taskReportSendId = 0;
// #32782 指示者テーブル関連削除 start
// 指示者か報告者か判断
int mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskReport = param.get(ABookKeys.TASK_REPORT);
// TODO この処理後、削除
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
taskReport = param.get(ABookKeys.TASK_DIRECTIONS);
}
JSONObject taskReportJson = new JSONObject(taskReport);
String taskHotSpotInfo = null;
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
taskHotSpotInfo = param.get(ABookKeys.HOT_SPOT);
}
// #32782 指示者テーブル関連削除 end
int taskReportId = 0;
String reportStartDate = "";
// 指示者の場合下記の処理を行わない
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
mOperationLogic.createJsonForOperationContent(operationId, reportUpdateType, contentPath, false);
}
} else {
if (routineTaskReportFlg) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
......@@ -360,9 +392,9 @@ 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);
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true);
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, taskReportJson, null, attachedChangeFlag, true, taskHotSpotInfo);
}
}
......@@ -377,7 +409,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
if (reportUpdateType == Constant.OperationUpdateType.HISTORY_NO) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}else {
} else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
......@@ -399,6 +431,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
FileUtil.delete(ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, false));
}
}
}
// xwalkで動画ファイルにアクセスするため、../files/..の以下のパスのディレクトりを../cache/..以下のパスに変更
public void allCopyTaskAttachedMovieFileToCache(long operationId, long contentId, OperationDto operationDto) {
......
......@@ -89,6 +89,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.content.PageInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.PageInfoJSON.PageInfoJSONData;
import jp.agentec.abook.abv.bl.acms.client.json.content.PageObjectJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.TaskHotspotJSON;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
......@@ -5184,7 +5185,13 @@ public class ContentViewActivity extends ABVContentViewActivity {
switch(cmd){
case ABookKeys.CMD_INSERT_TASK_DIRECTIONS:
case ABookKeys.CMD_UPDATE_TASK_DIRECTIONS:
// #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_INSERT_TASK_REPORT:
case ABookKeys.CMD_UPDATE_TASK_REPORT:
case ABookKeys.CMD_DELETE_TASK_REPORT:
if (ABVDataCache.getInstance().getMemberInfo().operationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
JSONObject hotspot = new JSONObject(checkParam.get(ABookKeys.HOT_SPOT));
taskCode = hotspot.getString(ABookKeys.TASK_CODE);
operationTaskLayout.setIconStatus(taskKey, true);
......@@ -5192,17 +5199,16 @@ public class ContentViewActivity extends ABVContentViewActivity {
operationTaskLayout.currentTaskDto.taskCode = taskCode;
operationTaskLayout.addOperationTaskIcon(operationTaskLayout.currentLayout, operationTaskLayout.currentTaskDto);
//hideOperationTaskLayout();
} else {
operationTaskLayout.setIconStatus(taskKey, false);
}
// #32782 指示者テーブル関連削除 end
break;
case ABookKeys.CMD_DELETE_TASK_DIRECTIONS:
operationTaskLayout.setIconStatus(taskKey, true);
//hideOperationTaskLayout();
break;
case ABookKeys.CMD_INSERT_TASK_REPORT:
case ABookKeys.CMD_UPDATE_TASK_REPORT:
case ABookKeys.CMD_DELETE_TASK_REPORT:
operationTaskLayout.setIconStatus(taskKey, false);
//hideOperationTaskLayout();
break;
default:
operationTaskLayout.setIconStatus(taskKey, false);
break;
......
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