Commit 4da293d2 by Lee Jaebin

・添付ファイルの保存先のパス修正

・t_task_reportのreported_flgカラム削除
・送信中にサーバーエラー後、同期できないバグ修正
parent 5a3875f9
...@@ -36,7 +36,6 @@ public class TaskHotspotJSON extends AbstractJSON { ...@@ -36,7 +36,6 @@ public class TaskHotspotJSON extends AbstractJSON {
taskHotspot = new OperationTaskDto(); taskHotspot = new OperationTaskDto();
taskHotspot.pageNum = obj.getInt(PAGE_NUM); taskHotspot.pageNum = obj.getInt(PAGE_NUM);
taskHotspot.seqId = obj.getInt(SEQ_ID); taskHotspot.seqId = obj.getInt(SEQ_ID);
//taskHotspot.taskKey = obj.getLong(TASK_ID);
taskHotspot.taskKey = obj.getString(TASK_KEY); taskHotspot.taskKey = obj.getString(TASK_KEY);
taskHotspot.taskCode = obj.getString(TASK_CODE); taskHotspot.taskCode = obj.getString(TASK_CODE);
taskHotspot.pdfX = (float) obj.getDouble(VIEW_X); taskHotspot.pdfX = (float) obj.getDouble(VIEW_X);
......
...@@ -125,7 +125,7 @@ public class ABVEnvironment { ...@@ -125,7 +125,7 @@ public class ABVEnvironment {
public static final String TempTaskFileFormat = TempTaskKeyDirFormat + "/%s"; public static final String TempTaskFileFormat = TempTaskKeyDirFormat + "/%s";
public static final String AttachedMoviesDirFormat = "%s/%d/attachedMovie"; public static final String AttachedMoviesDirFormat = "%s/%d/attachedMovie";
public static final String AttachedMoviesTaskTypeDir = AttachedMoviesDirFormat + "/%s/%s"; public static final String AttachedMoviesTaskTypeDir = AttachedMoviesDirFormat + "/%s/%s";
public static final String AttachedMoviesRoutineTaskTypeDir = AttachedMoviesDirFormat + "/%s/report/%d/%s"; public static final String AttachedMoviesRoutineTaskTypeDir = AttachedMoviesDirFormat + "/%s/%s/%d/%s";
public static final String CacheTempAttachedImageFormat = "%s/temp/attachedImage"; public static final String CacheTempAttachedImageFormat = "%s/temp/attachedImage";
...@@ -134,10 +134,8 @@ public class ABVEnvironment { ...@@ -134,10 +134,8 @@ public class ABVEnvironment {
public static final String TaskReportLevelDir = "/%s"; public static final String TaskReportLevelDir = "/%s";
public static final String SavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir; public static final String SavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir;
public static final String RoutineTaskSavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%d/%s/%s"; public static final String RoutineTaskSavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%d/%s/%s";
public static final String OperationTaskKeyReportSendDirFormat = OperationTaskKeyDirFormat + TaskReportLevelDir + "/reportSend/%d"; public static final String OperationTaskKeyReportSendDirFormat = OperationTaskKeyDirFormat + "/reportSend/%d";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormat = OperationTaskKeyDirFormat + "/reportSend/%d/%s/%d"; public static final String OperationTaskKeyRoutineTaskReportDirFormat = OperationTaskKeyDirFormat + "/%d/%s/%s";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormatForDelete = OperationTaskKeyDirFormat + "/reportSend/%d/%s";
public static final String OperationTaskKeyRoutineTaskReportDirFormat = OperationTaskKeyDirFormat + "/report/%d/%s";
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
/** /**
...@@ -674,23 +672,41 @@ public class ABVEnvironment { ...@@ -674,23 +672,41 @@ public class ABVEnvironment {
} }
/**
* 報告送信ディレクトリパス
* 例)root/files/ABook/operation/[operation_id]/[task_key]/reportSend/{taskReportSendId}
* @param operationId
* @param taskKey
* @param taskReportSendId
* @return
*/
// taskReportLevelの値によってディレクトリを構成 // taskReportLevelの値によってディレクトリを構成
public String getOperationTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportLevel, int taskReportSendId) { public String getOperationTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportSendId) {
return String.format(OperationTaskKeyReportSendDirFormat, rootDirectory, operationId, taskKey, taskReportLevel, taskReportSendId); return String.format(OperationTaskKeyReportSendDirFormat, rootDirectory, operationId, taskKey, taskReportSendId);
} }
public String getRoutineTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate) {
return String.format(OperationTaskKeyRoutineTaskReportSendDirFormatForDelete, rootDirectory, operationId, taskKey, taskReportId, getReportDate(reportStartDate));
}
public String getRoutineTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate, int taskReportSendId) {
return String.format(OperationTaskKeyRoutineTaskReportSendDirFormat, rootDirectory, operationId, taskKey, taskReportId, getReportDate(reportStartDate), taskReportSendId);
}
/**
* 定期点検で添付ファイルのパス
* 例)root/files/ABook/operation/[operation_id]/[task_key]/0/{taskReportId}/{reportStartDate}
* @param operationId
* @param taskKey
* @param taskReportId
* @param reportStartDate
* @return
*/
public String getRoutineTaskReportDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate) { public String getRoutineTaskReportDirFilePath(long operationId, String taskKey, int taskReportId, String reportStartDate) {
return String.format(OperationTaskKeyRoutineTaskReportDirFormat, rootDirectory, operationId, taskKey, taskReportId, getReportDate(reportStartDate)); return String.format(OperationTaskKeyRoutineTaskReportDirFormat, rootDirectory, operationId, taskKey, Constant.TaskReportLevel.ReportType, taskReportId, getReportDate(reportStartDate));
} }
/**
* 添付ファイル管理パス
* 例)root/files/ABook/operation/[operation_id]/[task_key]/{task_report_level}
* @param operationId
* @param taskKey
* @param taskReportLevel
* @return
*/
public String getOperationDirectionOrReportDirPath(long operationId, String taskKey, int taskReportLevel) { public String getOperationDirectionOrReportDirPath(long operationId, String taskKey, int taskReportLevel) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel)); return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel));
} }
...@@ -707,14 +723,12 @@ public class ABVEnvironment { ...@@ -707,14 +723,12 @@ public class ABVEnvironment {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel)); return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel));
} }
public String getOperationTaskReportDirPath(long operationId, String taskKey) { /**
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey); * 添付動画の臨時保存パス
} * 例)root/cache/{contentId}/attachedMovie
* @param contentId
public String getOperationReportSendDirPath(long operationId, String taskKey) { * @return
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, REPORT_SEND); */
}
public String getAttachedMoviesFilePath(long contentId) { public String getAttachedMoviesFilePath(long contentId) {
Logger.d(TAG, "cacheDirectory : " + cacheDirectory); Logger.d(TAG, "cacheDirectory : " + cacheDirectory);
return String.format(AttachedMoviesDirFormat, cacheDirectory, contentId); return String.format(AttachedMoviesDirFormat, cacheDirectory, contentId);
...@@ -727,12 +741,16 @@ public class ABVEnvironment { ...@@ -727,12 +741,16 @@ public class ABVEnvironment {
} }
// #32926 作業報告画面改善 end // #32926 作業報告画面改善 end
/**
* 例)root/cache/{contentId}/attachedMovie/[task_key]/{task_report_level}/{task_report_id}/{report_start_date}
* @param contentId
* @param taskKey
* @param taskReportId
* @param reportStartDate
* @return
*/
public String getAttachedRoutineTaskReportDirPath(long contentId, String taskKey, int taskReportId, String reportStartDate) { public String getAttachedRoutineTaskReportDirPath(long contentId, String taskKey, int taskReportId, String reportStartDate) {
return String.format(AttachedMoviesRoutineTaskTypeDir, cacheDirectory, contentId, taskKey, taskReportId, getReportDate(reportStartDate)); return String.format(AttachedMoviesRoutineTaskTypeDir, cacheDirectory, contentId, taskKey, Constant.TaskReportLevel.ReportType, taskReportId, getReportDate(reportStartDate));
}
public String getCacheTempDirPath() {
return String.format(CacheTempFormat, cacheDirectory);
} }
public String getCacheTempAttachedImageDirPath() { public String getCacheTempAttachedImageDirPath() {
......
...@@ -105,6 +105,7 @@ public class TaskDao extends AbstractDao { ...@@ -105,6 +105,7 @@ public class TaskDao extends AbstractDao {
delete("t_task", "task_key=?", keyValues); delete("t_task", "task_key=?", keyValues);
delete("t_task_report", "task_key=?", keyValues); delete("t_task_report", "task_key=?", keyValues);
delete("t_task_report_items", "task_key=?", keyValues); delete("t_task_report_items", "task_key=?", keyValues);
delete("t_task_report_send", "task_key=?", keyValues);
} }
/** /**
...@@ -115,5 +116,6 @@ public class TaskDao extends AbstractDao { ...@@ -115,5 +116,6 @@ public class TaskDao extends AbstractDao {
delete("t_task", "task_key=?", dto.getKeyValues()); delete("t_task", "task_key=?", dto.getKeyValues());
delete("t_task_report", "task_key=?", dto.getKeyValues()); delete("t_task_report", "task_key=?", dto.getKeyValues());
delete("t_task_report_items", "task_key=?", dto.getKeyValues()); delete("t_task_report_items", "task_key=?", dto.getKeyValues());
delete("t_task_report_send", "task_key=?", dto.getKeyValues());
} }
} }
\ No newline at end of file
...@@ -56,10 +56,6 @@ public class TaskReportDao extends AbstractDao { ...@@ -56,10 +56,6 @@ public class TaskReportDao extends AbstractDao {
if (column != -1) { if (column != -1) {
dto.delFlg = toBool(cursor.getInt(column)); dto.delFlg = toBool(cursor.getInt(column));
} }
column = cursor.getColumnIndex("reported_flg");
if (column != -1) {
dto.reportedFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("enable_report"); column = cursor.getColumnIndex("enable_report");
if (column != -1) { if (column != -1) {
...@@ -116,11 +112,10 @@ public class TaskReportDao extends AbstractDao { ...@@ -116,11 +112,10 @@ public class TaskReportDao extends AbstractDao {
+ "report_start_date, " + "report_start_date, "
+ "report_end_date, " + "report_end_date, "
+ "enable_report, " + "enable_report, "
+ "reported_flg, "
+ "task_report_level, " + "task_report_level, "
+ "local_saved_flg ) " + "local_saved_flg ) "
+ "values " + "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", + "(?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues()); dto.getInsertValues());
} }
...@@ -140,17 +135,16 @@ public class TaskReportDao extends AbstractDao { ...@@ -140,17 +135,16 @@ public class TaskReportDao extends AbstractDao {
sql.append("data_send_flg=?, "); sql.append("data_send_flg=?, ");
sql.append("report_end_date=?, "); sql.append("report_end_date=?, ");
sql.append("enable_report=?, "); sql.append("enable_report=?, ");
sql.append("reported_flg=?, ");
sql.append("task_report_level=?, "); sql.append("task_report_level=?, ");
sql.append("local_saved_flg=? "); sql.append("local_saved_flg=? ");
sql.append("WHERE task_key=? AND task_report_level=?"); sql.append("WHERE task_key=? AND task_report_level=?");
if (dto.reportStartDate != null) { if (dto.reportStartDate != null) {
sql.append(" AND datetime(report_start_date)=datetime(?)"); sql.append(" AND datetime(report_start_date)=datetime(?)");
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg, objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.reportedFlg, dto.taskReportLevel, dto.localSavedFlg, dto.taskKey, dto.taskReportLevel, dto.reportStartDate}; dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.taskKey, dto.taskReportLevel, dto.reportStartDate};
} else { } else {
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg, objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.reportedFlg, dto.taskReportLevel, dto.localSavedFlg, dto.taskKey, dto.taskReportLevel}; dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.taskKey, dto.taskReportLevel};
} }
return update(sql.toString(), objects) > 0; return update(sql.toString(), objects) > 0;
......
...@@ -34,7 +34,6 @@ public class TTaskReport extends SQLiteTableScript { ...@@ -34,7 +34,6 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" , task_report_info_id INTEGER NOT NULL DEFAULT 0 "); sql.append(" , task_report_info_id INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report SMALLINT NOT NULL DEFAULT 0 "); sql.append(" , enable_report SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , task_report_level SMALLINT NOT NULL DEFAULT 0 "); sql.append(" , task_report_level SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , reported_flg BOOLEAN DEFAULT 0 ");
sql.append(" , local_saved_flg BOOLEAN DEFAULT 0 "); sql.append(" , local_saved_flg BOOLEAN DEFAULT 0 ");
sql.append(" ) "); sql.append(" ) ");
ddl.add(sql.toString()); ddl.add(sql.toString());
......
...@@ -24,17 +24,16 @@ public class TaskReportDto extends AbstractDto { ...@@ -24,17 +24,16 @@ public class TaskReportDto extends AbstractDto {
public Date reportEndDate; // 作業終了日 public Date reportEndDate; // 作業終了日
public int enableReport; // 報告可能区分 public int enableReport; // 報告可能区分
public String attachedFileName; public String attachedFileName;
public boolean reportedFlg; // 定期点検用
public boolean localSavedFlg; // 一時保存用 public boolean localSavedFlg; // 一時保存用
@Override @Override
public Object[] getInsertValues() { public Object[] getInsertValues() {
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, enableReport, reportedFlg, taskReportLevel, localSavedFlg}; return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, enableReport, taskReportLevel, localSavedFlg};
} }
@Override @Override
public Object[] getUpdateValues() { public Object[] getUpdateValues() {
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reportEndDate, enableReport, reportedFlg, taskReportLevel, localSavedFlg, taskKey, taskReportLevel , reportStartDate }; return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reportEndDate, enableReport, taskReportLevel, localSavedFlg, taskKey, taskReportLevel , reportStartDate };
} }
@Override @Override
......
...@@ -464,16 +464,16 @@ public class OperationLogic extends AbstractLogic { ...@@ -464,16 +464,16 @@ public class OperationLogic extends AbstractLogic {
/** /**
* 定期点検データ更新 * 定期点検データ更新
* @param operationId * @param operationId
* @param contentId
* @param taskReportDto * @param taskReportDto
* @param attachedChangeFlag * @param attachedChangeFlag
* @param dataSendFlg * @param dataSendFlg
* @param reportedFlg * @param localSavedFlg
* @throws IOException * @throws IOException
*/ */
public void updateRoutineTaskReport(long operationId, long contentId, TaskReportDto taskReportDto, boolean attachedChangeFlag, boolean dataSendFlg, boolean reportedFlg, boolean localSavedFlg) throws IOException { public void updateRoutineTaskReport(long operationId, long contentId, TaskReportDto taskReportDto, boolean attachedChangeFlag, boolean dataSendFlg, boolean localSavedFlg) throws IOException {
taskReportDto.attachedFileSendFlg = attachedChangeFlag; taskReportDto.attachedFileSendFlg = attachedChangeFlag;
taskReportDto.dataSendFlg = dataSendFlg; taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.reportedFlg = reportedFlg;
taskReportDto.localSavedFlg = localSavedFlg; taskReportDto.localSavedFlg = localSavedFlg;
mTaskReportDao.update(taskReportDto); mTaskReportDao.update(taskReportDto);
...@@ -632,9 +632,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -632,9 +632,6 @@ public class OperationLogic extends AbstractLogic {
// 作業報告のディレクトリ削除 // 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, dto.taskKey)); FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, dto.taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate)); FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate));
// 作業報告送信のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate));
} }
/** /**
...@@ -651,7 +648,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -651,7 +648,6 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.dataSendFlg = true; taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false; taskReportDto.attachedFileSendFlg = false;
taskReportDto.jsonData = ""; taskReportDto.jsonData = "";
taskReportDto.reportedFlg = false;
mTaskReportDao.update(taskReportDto); mTaskReportDao.update(taskReportDto);
} }
...@@ -918,7 +914,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -918,7 +914,6 @@ public class OperationLogic extends AbstractLogic {
taskReportJsonRow.put(ABookKeys.TASK_REPORT_INFO_ID, dto.taskReportInfoId); taskReportJsonRow.put(ABookKeys.TASK_REPORT_INFO_ID, dto.taskReportInfoId);
taskReportJsonRow.put(ABookKeys.REPORT_START_DATE, DateTimeUtil.toStringInTimeZone(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, DateTimeUtil.getLocalTimeZone())); taskReportJsonRow.put(ABookKeys.REPORT_START_DATE, DateTimeUtil.toStringInTimeZone(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, DateTimeUtil.getLocalTimeZone()));
taskReportJsonRow.put(ABookKeys.REPORT_END_DATE, DateTimeUtil.toStringInTimeZone(dto.reportEndDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, DateTimeUtil.getLocalTimeZone())); taskReportJsonRow.put(ABookKeys.REPORT_END_DATE, DateTimeUtil.toStringInTimeZone(dto.reportEndDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, DateTimeUtil.getLocalTimeZone()));
taskReportJsonRow.put(ABookKeys.REPORTED, dto.reportedFlg ? 1 : 0);
List<JSONObject> taskReportInfoList = new ArrayList<JSONObject>(); List<JSONObject> taskReportInfoList = new ArrayList<JSONObject>();
if (!StringUtil.isNullOrEmpty(dto.jsonData)) { if (!StringUtil.isNullOrEmpty(dto.jsonData)) {
...@@ -928,9 +923,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -928,9 +923,9 @@ public class OperationLogic extends AbstractLogic {
taskReportJsonList.add(taskReportJsonRow); taskReportJsonList.add(taskReportJsonRow);
} }
taskReportJsonRoot.put(ABookKeys.ENABLE_REPORT_UPDATE, mOperationDao.getOperation(operationId).enableReportUpdate); taskReportJsonRoot.put(ABookKeys.ENABLE_REPORT_UPDATE, mOperationDao.getOperation(operationId).enableReportUpdate);
TaskReportDto taskReportDto = mTaskReportDao.getLastRoutineTaskReportData(operationId);
// 最後のtaskReportId // 最後のtaskReportId
taskReportJsonRoot.put(ABookKeys.TASK_REPORT_ID, taskReportDto.taskReportId); TaskReportDto lastRoutineTaskReportDto = mTaskReportDao.getLastRoutineTaskReportData(operationId);
taskReportJsonRoot.put(ABookKeys.TASK_REPORT_ID, lastRoutineTaskReportDto.taskReportId);
taskReportJsonRoot.put("taskReport_0", taskReportJsonList); taskReportJsonRoot.put("taskReport_0", taskReportJsonList);
Logger.d(TAG, "createRoutineTaskReportJson : " + taskReportJsonRoot.toString()); Logger.d(TAG, "createRoutineTaskReportJson : " + taskReportJsonRoot.toString());
Logger.d(TAG,contentPath + "/" + ABookKeys.TASK_REPORT + ".json"); Logger.d(TAG,contentPath + "/" + ABookKeys.TASK_REPORT + ".json");
...@@ -1139,7 +1134,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -1139,7 +1134,7 @@ public class OperationLogic extends AbstractLogic {
if (taskReportDtoList != null && taskReportDtoList.size() > 0) { if (taskReportDtoList != null && taskReportDtoList.size() > 0) {
int allSendCount = mTaskReportSendDao.getSendableTaskReportSendDataCount(operationId, taskKey); int allSendCount = mTaskReportSendDao.getSendableTaskReportSendDataCount(operationId, taskKey);
int progress = maxProgress / allSendCount; int progress = maxProgress / allSendCount == 0 ? 1 : allSendCount;
// 送信済みsendIdをまとめて削除するため、リストに追加して最後に削除 // 送信済みsendIdをまとめて削除するため、リストに追加して最後に削除
List<Integer> removeTaskReportSendIds = new ArrayList<Integer>(); List<Integer> removeTaskReportSendIds = new ArrayList<Integer>();
...@@ -1188,16 +1183,11 @@ public class OperationLogic extends AbstractLogic { ...@@ -1188,16 +1183,11 @@ public class OperationLogic extends AbstractLogic {
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId); removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId);
if (operationDto.reportType == Constant.ReportType.RoutineTask) { FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
// 定期点検
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId));
} else {
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportDto.taskReportLevel, taskReportSendDto.taskReportSendId));
}
} catch (ABVException ex) { } catch (ABVException ex) {
if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P005) { if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P005) {
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId); mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId)); FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
return true; return true;
} }
throw ex; throw ex;
...@@ -1298,7 +1288,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -1298,7 +1288,7 @@ public class OperationLogic extends AbstractLogic {
* @throws InterruptedException * @throws InterruptedException
*/ */
public String getRoutineTaskReportFile(long operationId, String taskKey, long taskId, int taskReportId, int taskReportInfoId, String reportStartDate, String attachedFileName) throws ABVException, InterruptedException { public String getRoutineTaskReportFile(long operationId, String taskKey, long taskId, int taskReportId, int taskReportInfoId, String reportStartDate, String attachedFileName) throws ABVException, InterruptedException {
GetTaskFileParameters parameters = new GetTaskFileParameters(cache.getMemberInfo().sid, taskId, 1, taskReportInfoId); GetTaskFileParameters parameters = new GetTaskFileParameters(cache.getMemberInfo().sid, taskId, Constant.ReportType.Report, taskReportInfoId);
String outputFilePath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDate) + "/" + attachedFileName + ".zip"; String outputFilePath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDate) + "/" + attachedFileName + ".zip";
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getTaskFile(parameters, operationId, outputFilePath); AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getTaskFile(parameters, operationId, outputFilePath);
return outputFilePath; return outputFilePath;
...@@ -1400,13 +1390,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -1400,13 +1390,7 @@ public class OperationLogic extends AbstractLogic {
*/ */
private File createAttachedFileForSend(Long operationId, String taskKey, int taskReportSendId, boolean routineFlag, int reportId, String reportStartDate, int taskReportLevel) throws ZipException, NoSuchAlgorithmException, IOException { private File createAttachedFileForSend(Long operationId, String taskKey, int taskReportSendId, boolean routineFlag, int reportId, String reportStartDate, int taskReportLevel) throws ZipException, NoSuchAlgorithmException, IOException {
File zipFile; File zipFile;
String filePath; String filePath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId);
if (routineFlag) {
filePath = ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskKey, reportId, reportStartDate, taskReportSendId);
} else {
filePath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId);
}
File fileDir = new File(filePath); File fileDir = new File(filePath);
if (!fileDir.exists()) { if (!fileDir.exists()) {
...@@ -1529,10 +1513,24 @@ public class OperationLogic extends AbstractLogic { ...@@ -1529,10 +1513,24 @@ public class OperationLogic extends AbstractLogic {
* @param hotSpotInfo * @param hotSpotInfo
* @param taskStatus * @param taskStatus
*/ */
public void registTaskData(String taskKey, Long operationId, String hotSpotInfo, Integer taskStatus) { public void registTaskData(String taskKey, Long operationId, String hotSpotInfo, Integer taskStatus, JSONObject taskJson) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey); TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
String taskCode = null;
if (taskJson != null) {
// 作業コード取得
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_1_")) {
taskCode = taskJson.getString(itemKey);
}
}
}
if (taskDto != null) { if (taskDto != null) {
// 更新 // 更新
taskDto.taskCode = taskCode;
if (hotSpotInfo != null) { if (hotSpotInfo != null) {
taskDto.taskHotSpotInfo = hotSpotInfo; taskDto.taskHotSpotInfo = hotSpotInfo;
} }
...@@ -1543,6 +1541,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -1543,6 +1541,7 @@ public class OperationLogic extends AbstractLogic {
} else { } else {
// 登録 // 登録
taskDto = new TaskDto(); taskDto = new TaskDto();
taskDto.taskCode = taskCode;
taskDto.taskKey = taskKey; taskDto.taskKey = taskKey;
taskDto.operationId = operationId; taskDto.operationId = operationId;
if (hotSpotInfo != null) { if (hotSpotInfo != null) {
......
...@@ -885,7 +885,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -885,7 +885,7 @@ public class OperationListActivity extends ABVUIActivity {
} }
if (localTaskReportDto != null) { if (localTaskReportDto != null) {
// 報告データが存在すると作業報告を更新する // 報告データが存在すると作業報告を更新する
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false, false, localTaskReportDto.localSavedFlg); mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false, localTaskReportDto.localSavedFlg);
} else { } else {
mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false); mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false);
} }
......
...@@ -88,11 +88,11 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -88,11 +88,11 @@ public class ABookCheckWebViewHelper extends ABookHelper {
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel); copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
sendTaskData(context, operationId, taskKey, taskReportLevel); sendTaskData(context, operationId, taskKey, taskReportLevel);
break; break;
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, true); insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, true);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel); copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
ABVToastUtil.showMakeText(context, R.string.msg_temp_save_result, Toast.LENGTH_SHORT); ABVToastUtil.showMakeText(context, R.string.msg_temp_save_result, Toast.LENGTH_SHORT);
mFinishCallback.callback(true); mFinishCallback.callback(false);
break; break;
case ABookKeys.CMD_DELETE_TASK_REPORT: case ABookKeys.CMD_DELETE_TASK_REPORT:
int taskReportId = 0; int taskReportId = 0;
...@@ -295,7 +295,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -295,7 +295,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
TaskReportDto taskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate); TaskReportDto taskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
taskReportDto.jsonData = taskReport; taskReportDto.jsonData = taskReport;
mOperationLogic.updateRoutineTaskReport(operationId, contentId, taskReportDto, attachedChangeFlag, true, true, localSavedFlg); mOperationLogic.updateRoutineTaskReport(operationId, contentId, taskReportDto, attachedChangeFlag, true, localSavedFlg);
mOperationLogic.createJsonForOperationContent(operationId, contentPath, true); mOperationLogic.createJsonForOperationContent(operationId, contentPath, true);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate); copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
...@@ -303,8 +303,13 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -303,8 +303,13 @@ public class ABookCheckWebViewHelper extends ABookHelper {
String hotSpotInfo = param.containsKey(ABookKeys.HOT_SPOT) ? param.get(ABookKeys.HOT_SPOT) : null; String hotSpotInfo = param.containsKey(ABookKeys.HOT_SPOT) ? param.get(ABookKeys.HOT_SPOT) : null;
Integer taskStatus = taskReportJson.has(ABookKeys.TASK_STATUS) ? taskReportJson.getInt(ABookKeys.TASK_STATUS) : null; Integer taskStatus = taskReportJson.has(ABookKeys.TASK_STATUS) ? taskReportJson.getInt(ABookKeys.TASK_STATUS) : null;
// 報告情報のjson取得後、登録・更新時に使用
JSONObject taskJson = null;
if (taskReportJson.has("task")) {
taskJson = taskReportJson.getJSONObject("task");
}
// task登録・更新処理 // task登録・更新処理
mOperationLogic.registTaskData(taskKey, operationId, hotSpotInfo, taskStatus); mOperationLogic.registTaskData(taskKey, operationId, hotSpotInfo, taskStatus, taskJson);
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey, taskReportLevel); TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey, taskReportLevel);
if (taskReportDto != null) { if (taskReportDto != null) {
...@@ -440,12 +445,8 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -440,12 +445,8 @@ public class ABookCheckWebViewHelper extends ABookHelper {
File taskAttachedFiles = new File(taskAttachedPath); File taskAttachedFiles = new File(taskAttachedPath);
if (taskAttachedFiles.exists()) { if (taskAttachedFiles.exists()) {
String taskReportSendPath; String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId);
if (routineTaskReportFlg) {
taskReportSendPath = ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskKey, taskReportId, sReportStartDate, taskReportSendId);
} else {
taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId);
}
FileUtil.delete(taskReportSendPath); FileUtil.delete(taskReportSendPath);
FileUtil.createNewDirectory(taskReportSendPath); FileUtil.createNewDirectory(taskReportSendPath);
...@@ -469,7 +470,7 @@ public class ABookCheckWebViewHelper extends ABookHelper { ...@@ -469,7 +470,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
try { try {
String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId); String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId);
FileUtil.delete(taskReportSendPath); FileUtil.delete(taskReportSendPath);
} catch (Exception ex) { } catch (Exception ex) {
Logger.e(String.format("%s.deleteReportTaskSendFiles(%d, %s)", TAG, operationId, taskKey), ex); Logger.e(String.format("%s.deleteReportTaskSendFiles(%d, %s)", TAG, operationId, taskKey), ex);
......
...@@ -4955,6 +4955,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -4955,6 +4955,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
case ABookKeys.CMD_INSERT_TASK_REPORT: // 作業報告の登録 case ABookKeys.CMD_INSERT_TASK_REPORT: // 作業報告の登録
case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新 case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新
case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除 case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
getTaskHotspotJSON(); getTaskHotspotJSON();
case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル
if(operationTaskDto != null) { if(operationTaskDto != null) {
...@@ -5182,6 +5183,7 @@ public class ContentViewActivity extends ABVContentViewActivity { ...@@ -5182,6 +5183,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
// #32782 指示者テーブル関連削除 start // #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_INSERT_TASK_REPORT: case ABookKeys.CMD_INSERT_TASK_REPORT:
case ABookKeys.CMD_UPDATE_TASK_REPORT: case ABookKeys.CMD_UPDATE_TASK_REPORT:
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
if (taskReportLevel == Constant.TaskReportLevel.ReportType) { if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
JSONObject hotspot = new JSONObject(checkParam.get(ABookKeys.HOT_SPOT)); JSONObject hotspot = new JSONObject(checkParam.get(ABookKeys.HOT_SPOT));
......
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