Commit fc60ecba by Jeong Gilmo

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

# Conflicts:
#	ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookCheckWebViewHelper.java
parents c751c115 4da293d2
......@@ -192,7 +192,6 @@ public class AcmsClient implements AcmsClientResponseListener {
dto.memberName = json.userName;
dto.requiredPasswordChange = json.requirePasswordChange;
dto.userId = json.userId;
dto.operationAuthLevel = json.operationAuthLevel;
dto.workerCode = json.workerCode;
if (json.result) {
......@@ -540,10 +539,10 @@ public class AcmsClient implements AcmsClientResponseListener {
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_HOT_SPOT_INFO, taskReportDto.taskHotSpotInfo));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_INFO, taskReportDto.jsonData));
HttpMultipartList.add(new HttpMultipart(ABookKeys.ATTACHED_CHANGE_FLAG, taskReportDto.attachedFileSendFlg ? "1" : "0"));
HttpMultipartList.add(new HttpMultipart(ABookKeys.ROUTINE_TASK_FLAG, reportType == Constant.ReportType.Routine ? "1" : "0"));
HttpMultipartList.add(new HttpMultipart(ABookKeys.ROUTINE_TASK_FLAG, reportType == Constant.ReportType.RoutineTask ? "1" : "0"));
// 定期点検用
if (reportType == Constant.ReportType.Routine) {
if (reportType == Constant.ReportType.RoutineTask) {
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_ID, StringUtil.toString(taskReportDto.taskReportId)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.TASK_REPORT_INFO_ID, StringUtil.toString(taskReportDto.taskReportInfoId)));
HttpMultipartList.add(new HttpMultipart(ABookKeys.REPORT_START_DATE, DateTimeUtil.toStringForCmsGMT(taskReportDto.reportStartDate)));
......
......@@ -11,14 +11,12 @@ public class NewAppStoreLoginJSON extends AcmsBooleanResultJSON {
public static final String Sid = "sid";
public static final String UserName = "userName";
public static final String UserId = "userId";
public static final String OperationAuthLevel = "projectAuthLevel";
public static final String WorkerCode = "workerCode";
public String sid;
public RequirePasswordChangeCode requirePasswordChange;
public String userName;
public int userId;
public Integer operationAuthLevel;
public String workerCode;
public NewAppStoreLoginJSON(String jsonString) throws AcmsException {
......@@ -35,9 +33,6 @@ public class NewAppStoreLoginJSON extends AcmsBooleanResultJSON {
if (json.has(UserId)) {
userId = getInt(json,UserId);
}
if (json.has(OperationAuthLevel)) {
operationAuthLevel = getInt(json, OperationAuthLevel);
}
if (json.has(WorkerCode)) {
workerCode = getString(json, WorkerCode, StringUtil.Empty);
}
......
......@@ -59,8 +59,12 @@ public class OperationDataJSON extends AcmsCommonJSON {
dto.operationId = taskJson.getLong(OperationId);
dto.taskId = taskJson.getLong(TaskId);
dto.taskKey = taskJson.getString(TaskKey);
dto.taskCode = taskJson.getString(TaskCode);
dto.taskStatus = taskJson.getInt(TaskStatus);
if (taskJson.has(TaskCode)) {
dto.taskCode = taskJson.getString(TaskCode);
}
if (taskJson.has(TaskStatus)) {
dto.taskStatus = taskJson.getInt(TaskStatus);
}
dto.taskHotSpotInfo = taskJson.getJSONObject(TaskHotspotInfo).toString();
......@@ -73,7 +77,16 @@ public class OperationDataJSON extends AcmsCommonJSON {
JSONObject taskReportJson = taskReportList.getJSONObject(j);
taskReportDto.taskKey = dto.taskKey;
taskReportDto.taskReportLevel = taskReportJson.getInt(TaskReportLevel);
taskReportDto.enableReport = taskReportJson.getInt(EnableReport);
// 報告可能区分
if (taskReportJson.has(EnableReport)) {
taskReportDto.enableReport = taskReportJson.getInt(EnableReport);
}
if (taskJson.has(TaskReportId)) {
// taskListの中にtaskReportIdキーが存在
taskReportDto.taskReportId = taskJson.getInt(TaskReportId);
}
if (taskReportJson.has(TaskReportInfoId)) {
// 定期点検の場合
......@@ -93,10 +106,14 @@ public class OperationDataJSON extends AcmsCommonJSON {
if (taskReportJson.has(TaskReportInfo)) {
Object object = taskReportJson.get(TaskReportInfo);
if (object instanceof String) {
taskReportDto.jsonData = null;
taskReportDto.jsonData = (String)object;
} else if (object instanceof JSONObject) {
taskReportDto.jsonData = object.toString();
} else {
taskReportDto.jsonData = taskReportJson.getJSONObject(TaskReportInfo).toString();
taskReportDto.jsonData = "";
}
} else {
taskReportDto.jsonData = "";
}
dto.taskReportDtoList.add(taskReportDto);
}
......
......@@ -36,7 +36,6 @@ public class TaskHotspotJSON extends AbstractJSON {
taskHotspot = new OperationTaskDto();
taskHotspot.pageNum = obj.getInt(PAGE_NUM);
taskHotspot.seqId = obj.getInt(SEQ_ID);
//taskHotspot.taskKey = obj.getLong(TASK_ID);
taskHotspot.taskKey = obj.getString(TASK_KEY);
taskHotspot.taskCode = obj.getString(TASK_CODE);
taskHotspot.pdfX = (float) obj.getDouble(VIEW_X);
......
......@@ -140,8 +140,6 @@ public class AcmsApis {
public static final String ApiSendTaskData = "taskData";
// 作業データ取得
public static final String ApiGetOperationData = "getOperationData";
// 定期点検データ取得
public static final String ApiGetRoutineTaskData = "getProjectInspectData";
// 作業ファイル取得
public static final String ApiGetTaskFile = "getTaskFile";
// コンテンツ登録
......@@ -198,7 +196,7 @@ public class AcmsApis {
apiValue = Constant.ApiValue.nuapi;
} else if (methodName.equals(ApiOperationList) || methodName.equals(ApiWorkingGroupList) || methodName.equals(ApiSendTaskData) || methodName.equals(ApiGetOperationData) ||
methodName.equals(ApiGetTaskFile) || methodName.equals(ApiSceneEntry) || methodName.equals(ApiTaskContentEntry) ||
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiGetRoutineTaskData) || methodName.equals(ApiSendRoutineTaskData)) {
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiSendRoutineTaskData)) {
apiValue = Constant.ApiValue.checkapi;
}
......
......@@ -109,8 +109,8 @@ public class ABVEnvironment {
public static final String CommonDirectoryFormat = "%s/ABook/common";
public static final String OperationDirFormat = "%s/ABook/projects/%d";
public static final String OperationTaskKeyDirFormat = "%s/ABook/projects/%d/%s";
public static final String OperationDirFormat = "%s/ABook/operation/%d";
public static final String OperationTaskKeyDirFormat = "%s/ABook/operation/%d/%s";
public static final String PanoImageDirFormat = "%s/panoImage";
public static final String PanoImageFileFormat = "%s/panoImage.zip";
public static final String TaskPdfDirFormat = "%s/taskPdf";
......@@ -128,7 +128,7 @@ public class ABVEnvironment {
public static final String TempTaskFileFormat = TempTaskKeyDirFormat + "/%s";
public static final String AttachedMoviesDirFormat = "%s/%d/attachedMovie";
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";
......@@ -137,10 +137,8 @@ public class ABVEnvironment {
public static final String TaskReportLevelDir = "/%s";
public static final String SavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir;
public static final String RoutineTaskSavedOzFileFormat = OperationDirectionOrReportDirFormat + TaskReportLevelDir + "/%d/%s/%s";
public static final String OperationTaskKeyReportSendDirFormat = OperationTaskKeyDirFormat + TaskReportLevelDir + "/reportSend/%d";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormat = OperationTaskKeyDirFormat + "/reportSend/%d/%s/%d";
public static final String OperationTaskKeyRoutineTaskReportSendDirFormatForDelete = OperationTaskKeyDirFormat + "/reportSend/%d/%s";
public static final String OperationTaskKeyRoutineTaskReportDirFormat = OperationTaskKeyDirFormat + "/report/%d/%s";
public static final String OperationTaskKeyReportSendDirFormat = OperationTaskKeyDirFormat + "/reportSend/%d";
public static final String OperationTaskKeyRoutineTaskReportDirFormat = OperationTaskKeyDirFormat + "/%d/%s/%s";
// #32926 作業報告画面改善 end
/**
......@@ -667,7 +665,7 @@ public class ABVEnvironment {
/**
* プロジェクトの作業ディレクトリパス
* 例)root/files/ABook/projects/[project_id]/[task_key]
* 例)root/files/ABook/operation/[operation_id]/[task_key]
* @param operationId
* @param taskKey
* @return
......@@ -677,30 +675,48 @@ public class ABVEnvironment {
}
/**
* 報告送信ディレクトリパス
* 例)root/files/ABook/operation/[operation_id]/[task_key]/reportSend/{taskReportSendId}
* @param operationId
* @param taskKey
* @param taskReportSendId
* @return
*/
// taskReportLevelの値によってディレクトリを構成
public String getOperationTaskReportSendDirFilePath(long operationId, String taskKey, int taskReportLevel, int taskReportSendId) {
return String.format(OperationTaskKeyReportSendDirFormat, rootDirectory, operationId, taskKey, taskReportLevel, taskReportSendId);
public String getOperationTaskReportSendDirFilePath(long operationId, String taskKey, int 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) {
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) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel));
}
/**
* 作業報告レベルのディレクトリパス
* 例)root/files/ABook/projects/[project_id]/[task_key]/[taskReportLevel]
* 例)root/files/ABook/operation/[operation_id]/[task_key]/[taskReportLevel]
* @param operationId
* @param taskKey
* @param taskReportLevel
......@@ -710,14 +726,12 @@ public class ABVEnvironment {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, String.valueOf(taskReportLevel));
}
public String getOperationTaskReportDirPath(long operationId, String taskKey) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey);
}
public String getOperationReportSendDirPath(long operationId, String taskKey) {
return String.format(OperationDirectionOrReportDirFormat, rootDirectory, operationId, taskKey, REPORT_SEND);
}
/**
* 添付動画の臨時保存パス
* 例)root/cache/{contentId}/attachedMovie
* @param contentId
* @return
*/
public String getAttachedMoviesFilePath(long contentId) {
Logger.d(TAG, "cacheDirectory : " + cacheDirectory);
return String.format(AttachedMoviesDirFormat, cacheDirectory, contentId);
......@@ -730,14 +744,18 @@ public class ABVEnvironment {
}
// #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) {
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() {
return String.format(CacheTempAttachedImageFormat, cacheDirectory);
}
......
......@@ -88,12 +88,6 @@ public class Constant {
String REPORT_GPS = "reportGps";
}
public interface OperationReportType {
int REPORT_TYPE = 0;
int ROUTINE_TASK = 1;
int REPORT_RESPONSE_TYPE = 2;
}
public interface PushMessageSendType {
int InGroup = 0;
int AllOperation = 1;
......@@ -141,7 +135,7 @@ public class Constant {
public interface ReportType {
int Report = 0; // 報告
int Routine = 1; // 定期点検
int RoutineTask = 1; // 定期点検
int ReportReply = 2; // 報告(回答)
}
......
......@@ -117,4 +117,5 @@ public class ABookKeys {
// #32926 作業報告画面改善 start
public static final String HAS_AUTHORITY = "hasAuthority";
// #32926 作業報告画面改善 end
public static final String CLOSE_TASK_REPORT = "closeTaskReport";
}
......@@ -257,6 +257,36 @@ public class AbstractDao {
}
/**
* クエリを実行し、最初の行の最初の列の値をlong型で返します。
*
* stmt.simpleQueryForLong()と同じ
*
* @param sql
* @param bindArgs
* @return
* @throws Exception
*/
public long rawQueryGetLong(String sql, String[] bindArgs) {
SQLiteDatabase db = dbConn.getDatabase();
Cursor cursor = null;
try {
if (Logger.isVerboseEnabled()) {
Logger.v(TAG, "%s [%s]", sql, join(bindArgs));
}
cursor = db.rawQuery(sql, bindArgs);
if (cursor.moveToNext()) {
return cursor.getLong(0);
}
return 0;
}
finally {
if (cursor != null) {
cursor.close();
}
}
}
/**
* クエリを実行し、最初の行の最初の列の値をInteger型リストで返します。
*
* @param sql
......
......@@ -72,10 +72,6 @@ public class MemberInfoDao extends AbstractDao {
if (column != -1) {
dto.lastUpdateInfor = cursor.getString(column);
}
column = cursor.getColumnIndex("operation_auth_level");
if (column != -1) {
dto.operationAuthLevel = cursor.getInt(column);
}
column = cursor.getColumnIndex("worker_code");
if (column != -1) {
dto.workerCode = cursor.getString(column);
......@@ -108,11 +104,11 @@ public class MemberInfoDao extends AbstractDao {
}
public void insertMemberInfo(MemberInfoDto dto) {
insert("insert into m_member_info (login_id, password, member_name, sid, login_status, invalid_password_count, last_login_date, last_change_password_date, last_cms_access_date, user_id, last_update_infor, operation_auth_level, worker_code) values (?,?,?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
insert("insert into m_member_info (login_id, password, member_name, sid, login_status, invalid_password_count, last_login_date, last_change_password_date, last_cms_access_date, user_id, last_update_infor, worker_code) values (?,?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public boolean updateMemberInfo(MemberInfoDto dto) {
long count = update("update m_member_info set password=?, member_name=?, sid=?, login_status=?, invalid_password_count=?, last_login_date=?, last_change_password_date=?, last_cms_access_date=?, last_update_infor = ?, operation_auth_level = ?, worker_code = ? where login_id=?", dto.getUpdateValues());
long count = update("update m_member_info set password=?, member_name=?, sid=?, login_status=?, invalid_password_count=?, last_login_date=?, last_change_password_date=?, last_cms_access_date=?, last_update_infor = ?, worker_code = ? where login_id=?", dto.getUpdateValues());
return count > 0;
}
......
......@@ -243,6 +243,7 @@ public class OperationDao extends AbstractDao {
sql.append(" top.report_type, ");
sql.append(" top.report_cycle, ");
sql.append(" top.enable_report_update, ");
sql.append(" top.enable_report_edit, ");
sql.append(" CASE ");
sql.append(" WHEN report_type = 1 THEN ( ");
sql.append(" SELECT strftime('%Y/%m/%d %H:%M', datetime(ttr.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ttr.report_end_date, 'localtime')) ");
......
......@@ -105,6 +105,7 @@ public class TaskDao extends AbstractDao {
delete("t_task", "task_key=?", keyValues);
delete("t_task_report", "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 {
delete("t_task", "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_send", "task_key=?", dto.getKeyValues());
}
}
\ No newline at end of file
......@@ -56,10 +56,6 @@ public class TaskReportDao extends AbstractDao {
if (column != -1) {
dto.delFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("reported_flag");
if (column != -1) {
dto.reportedFlag = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("enable_report");
if (column != -1) {
......@@ -70,10 +66,39 @@ public class TaskReportDao extends AbstractDao {
if (column != -1) {
dto.taskReportLevel = cursor.getInt(column);
}
column = cursor.getColumnIndex("task_report_id");
if (column != -1) {
dto.taskReportId = cursor.getInt(column);
}
column = cursor.getColumnIndex("task_report_info_id");
if (column != -1) {
dto.taskReportInfoId = cursor.getInt(column);
}
column = cursor.getColumnIndex("report_start_date");
if (column != -1) {
dto.reportStartDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
column = cursor.getColumnIndex("report_end_date");
if (column != -1) {
dto.reportEndDate = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
column = cursor.getColumnIndex("local_saved_flg");
if (column != -1) {
dto.localSavedFlg = toBool(cursor.getInt(column));
}
return dto;
}
/**
* 報告登録処理
* @param dto
*/
public void insert(TaskReportDto dto) {
insert("insert into t_task_report "
+ "(task_key, "
......@@ -87,14 +112,45 @@ public class TaskReportDao extends AbstractDao {
+ "report_start_date, "
+ "report_end_date, "
+ "enable_report, "
+ "reported_flg, "
+ "task_report_level) "
+ "task_report_level, "
+ "local_saved_flg ) "
+ "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
}
/**
* 報告更新処理
* @param dto
* @return
*/
public boolean update(TaskReportDto dto) {
Object[] objects;
StringBuffer sql = new StringBuffer();
sql.append("UPDATE t_task_report SET ");
sql.append("json_data=?, ");
sql.append("attached_file_name=?, ");
sql.append("local_attached_file_name=?, ");
sql.append("attached_file_send_flg=?, ");
sql.append("data_send_flg=?, ");
sql.append("report_end_date=?, ");
sql.append("enable_report=?, ");
sql.append("task_report_level=?, ");
sql.append("local_saved_flg=? ");
sql.append("WHERE task_key=? AND task_report_level=?");
if (dto.reportStartDate != null) {
sql.append(" AND datetime(report_start_date)=datetime(?)");
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.taskKey, dto.taskReportLevel, dto.reportStartDate};
} else {
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.taskKey, dto.taskReportLevel};
}
return update(sql.toString(), objects) > 0;
}
/**
* 作業IDで報告取得
* (作業報告タイプ 昇順、作業報告ID 昇順、報告開始日 昇順)
* @param operationId
......@@ -113,7 +169,6 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetDtoList(sb.toString(), new String[]{"" + operationId}, TaskReportDto.class);
}
/**
* 作業キーと作業報告タイプで作業報告データ取得
* @param taskKey
......@@ -133,26 +188,6 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetDtoList("select * from t_task_report where task_key=? ORDER BY task_report_id, report_start_date", new String[]{ "" + taskKey }, TaskReportDto.class);
}
public boolean update(TaskReportDto dto) {
long count = update("update t_task_report "
+ "set "
+ "json_data=?, "
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "attached_file_send_flg=?, "
+ "data_send_flg=?, "
+ "task_report_id=?, "
+ "task_report_info_id=?, "
+ "report_start_date=?, "
+ "report_end_date=?, "
+ "enable_report=?, "
+ "reported_flg=?, "
+ "task_report_level=? "
+ "where task_key=? AND task_report_level=?",
dto.getUpdateValues());
return count > 0;
}
/**
* 送信フラグのあるデータが存在するか
*
......@@ -208,8 +243,14 @@ public class TaskReportDao extends AbstractDao {
return rawQueryGetString("select local_attached_file_name from t_task_report where task_key=? AND task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel});
}
public List<TaskReportDto> selectByTaskKey(String taskKey, int taskReportLevel) {
return rawQueryGetDtoList("select * from t_task_report where task_key=? and task_report_level=?", new String[]{ "" + taskKey, "" + taskReportLevel }, TaskReportDto.class);
/**
* 報告キー、報告担当レベルでt_task_Reportデータ取得
* @param taskKey
* @param taskReportLevel
* @return
*/
public TaskReportDto selectByTaskKey(String taskKey, int taskReportLevel) {
return rawQueryGetDto("select * from t_task_report where task_key=? and task_report_level=?", new String[]{ "" + taskKey, "" + taskReportLevel }, TaskReportDto.class);
}
public List<TaskReportDto> selectAll() {
......@@ -227,26 +268,6 @@ public class TaskReportDao extends AbstractDao {
}
/**
* 定期点検用の報告更新
* @param dto
* @return
*/
public boolean updateRoutineTask(TaskReportDto dto) {
long count = update("update t_task_report "
+ "set "
+ "report_end_date=?, "
+ "attached_file_name=?, "
+ "local_attached_file_name=?, "
+ "json_data=?, "
+ "data_send_flag=?, "
+ "attached_file_send_flag=? "
+ "reported_flag=? "
+ "where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)",
new Object[]{dto.reportEndDate, dto.attachedFileName, dto.localAttachedFileName, dto.jsonData, dto.dataSendFlg, dto.attachedFileSendFlg, dto.reportedFlag, dto.taskKey, dto.taskReportId, dto.reportStartDate});
return count > 0;
}
/**
* テーブル物理削除
* @param dto
*/
......@@ -259,7 +280,7 @@ public class TaskReportDao extends AbstractDao {
* @param dto
*/
public void deleteRoutineTaskReport(TaskReportDto dto) {
delete("t_task_report", "task_key=? and task_report_level=? task_report_id=? and datetime(report_start_date)=datetime(?, 'utc')", new String[] { dto.taskKey, "" + dto.taskReportLevel, "" + dto.taskReportId, DateTimeUtil.toString(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen) });
delete("t_task_report", "task_key=? AND task_report_level=? AND task_report_id=? AND datetime(report_start_date)=datetime(?, 'utc')", new String[] { dto.taskKey, "" + dto.taskReportLevel, "" + dto.taskReportId, DateTimeUtil.toString(dto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen) });
}
/**
......@@ -329,11 +350,13 @@ public class TaskReportDao extends AbstractDao {
}
/**
* 作業キーで作業時間が存在する作業報告データ取得(定期点検)
* 定期点検報告のデータ取得
* @param taskKey
* @param taskReportId
* @param reportStartDate
* @return
*/
public List<TaskReportDto> getNotNullStartDateTaskReportByTaskKey(String taskKey) {
return rawQueryGetDtoList("select * from t_task_report where task_key=? AND report_start_date IS NOT NULL", new String[]{ taskKey }, TaskReportDto.class);
public TaskReportDto getRoutineTaskReport(String taskKey, int taskReportId, String reportStartDate) {
return rawQueryGetDto("select * from t_task_report where task_key=? and task_report_id=? and datetime(report_start_date)=datetime(?)", new String[]{ taskKey, "" + taskReportId, reportStartDate }, TaskReportDto.class);
}
}
......@@ -48,6 +48,17 @@ public class TaskReportItemsDao extends AbstractDao {
return rawQueryGetDtoList("select * from t_task_report_items where task_key=? and task_report_level=?", new String[]{"" + taskKey, "" + taskReportLevel}, TaskReportItemsDto.class);
}
/**
* 報告キー、報告担当レベル、itemKeyでデータ取得
* @param taskKey
* @param taskReportLevel
* @param itemKey
* @return
*/
public TaskReportItemsDto getTaskReportItem(String taskKey, int taskReportLevel, String itemKey) {
return rawQueryGetDto("SELECT * FROM t_task_report_items WHERE task_key=? AND task_report_level=? AND item_key=?", new String[]{"" + taskKey, "" + taskReportLevel, "" + itemKey}, TaskReportItemsDto.class);
}
public List<TaskReportItemsDto> getTaskReportItemByOperationId(Long operationId) {
StringBuilder sb = new StringBuilder();
sb.append(" select distinct ttri.* ");
......
......@@ -32,7 +32,6 @@ public class MMemberInfo extends SQLiteTableScript {
sql.append(" , password_expiry_date DATETIME ");
sql.append(" , user_id INTEGER");
sql.append(" , last_update_infor VARCHAR(64)");
sql.append(" , operation_auth_level INTEGER");
sql.append(" , worker_code TEXT");
sql.append(" , PRIMARY KEY (login_id) ");
sql.append(" ) ");
......
......@@ -23,7 +23,7 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" CREATE TABLE t_task_report ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , json_data TEXT NOT NULL ");
sql.append(" , json_data TEXT NOT NULL");
sql.append(" , attached_file_name TEXT ");
sql.append(" , local_attached_file_name TEXT ");
sql.append(" , attached_file_send_flg BOOLEAN DEFAULT 0 ");
......@@ -34,7 +34,7 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" , task_report_info_id INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , enable_report SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , task_report_level SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , reported_flg BOOLEAN DEFAULT 0 ");
sql.append(" , local_saved_flg BOOLEAN DEFAULT 0 ");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -24,6 +24,7 @@ public class TTaskReportItems extends SQLiteTableScript {
sql.append(" CREATE TABLE t_task_report_items ( ");
sql.append(" task_key TEXT NOT NULL ");
sql.append(" , task_report_level INTEGER default 0 ");
sql.append(" , item_key VARCHAR(64) ");
sql.append(" , input_value VARCHAR(64) ");
sql.append(" ) ");
......
......@@ -25,19 +25,18 @@ public class MemberInfoDto extends AbstractDto {
public Date lastCMSAccessDate;
public Date passwordExpiryDate;
public String lastUpdateInfor; //ABookSee 1.8.1
public Integer operationAuthLevel;
public String workerCode;
public RequirePasswordChangeCode requiredPasswordChange;
@Override
public Object[] getInsertValues() {
return new Object[]{loginId, password, memberName, sid, loginStatus, invalidPasswordCount, lastLoginDate, lastChangePasswordDate, lastCMSAccessDate, userId, lastUpdateInfor, operationAuthLevel, workerCode};
return new Object[]{loginId, password, memberName, sid, loginStatus, invalidPasswordCount, lastLoginDate, lastChangePasswordDate, lastCMSAccessDate, userId, lastUpdateInfor, workerCode};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{password, memberName, sid, loginStatus, invalidPasswordCount, lastLoginDate, lastChangePasswordDate, lastCMSAccessDate, lastUpdateInfor, operationAuthLevel, workerCode, loginId};
return new Object[]{password, memberName, sid, loginStatus, invalidPasswordCount, lastLoginDate, lastChangePasswordDate, lastCMSAccessDate, lastUpdateInfor, workerCode, loginId};
}
@Override
......
......@@ -23,7 +23,7 @@ public class OperationDto extends AbstractDto {
public List<OperationContentDto> operationContentDtoList;
public List<TaskDto> taskDtoList;
public List<PushMessageDto> pushMessageList;
public int reportType; //0:通常 1:定期点検
public int reportType; // 報告タイプ 0 : 報告 1 : 定期点検 2 : 報告(回答)
public int reportCycle; //0:日次 1:月次 2:年次
public int enableReportUpdate; //0:不可 1:可
public String reportPeriod; //定期点検、2018/12/20 08:10:00 ~ 2018/12/21 18:10:00
......
......@@ -24,17 +24,16 @@ public class TaskReportDto extends AbstractDto {
public Date reportEndDate; // 作業終了日
public int enableReport; // 報告可能区分
public String attachedFileName;
public String taskReportInfo;
public boolean reportedFlag; // 定期点検用
public boolean localSavedFlg; // 一時保存用
@Override
public Object[] getInsertValues() {
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, enableReport, reportedFlag, taskReportLevel};
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, enableReport, taskReportLevel, localSavedFlg};
}
@Override
public Object[] getUpdateValues() {
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, enableReport, reportedFlag, taskReportLevel, taskKey, taskReportLevel };
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reportEndDate, enableReport, taskReportLevel, localSavedFlg, taskKey, taskReportLevel , reportStartDate };
}
@Override
......
......@@ -244,78 +244,68 @@ public class OperationLogic extends AbstractLogic {
}
/**
* 作業指示の登録
*
* 報告データ登録
* @param taskKey
* @param operationId
* @param contentId
* @param taskDirectionsJson
* @param hotSpotInfo
* @param reportLevel
* @param enableReport
* @param taskReportJson
* @param localAttachedFileName
* @param attachedChangeFlag
* @param dataSendFlg
* @param localSavedFlg
* @throws IOException
*/
public void insertTaskReport(String taskKey, long operationId, long contentId, int enableReport, JSONObject taskDirectionsJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
public void insertTaskReport(String taskKey, long operationId, long contentId, int reportLevel, int enableReport, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, boolean localSavedFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
//TODO error
return;
}
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;
taskReportItemsDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
taskReportDto.taskKey = taskKey;
taskReportDto.jsonData = taskDirectionsJson.toString();
if (taskReportJson != null) {
// suggest登録・更新処理
registTaskReportItem(taskKey, reportLevel, taskReportJson.getJSONObject("suggest"));
taskReportDto.jsonData = taskReportJson.toString();
} else {
// taskJsonがnullの場合、jsonDataに空でセット
taskReportDto.jsonData = "";
}
// 一時保存のフラグ
taskReportDto.localSavedFlg = localSavedFlg;
// 送信フラグ
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
// 作業報告
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
taskReportDto.taskReportLevel = reportLevel;
// 報告可能区分
taskReportDto.enableReport = enableReport;
if (localAttachedFileName != null) {
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskDirectionsJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskDirectionsJson.getInt(ABookKeys.TASK_STATUS);
}
mTaskReportDao.insert(taskReportDto);
mTaskDao.insert(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
if (taskReportJson != null) {
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskDirectionsJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportType);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, reportLevel);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
}
}
......@@ -324,48 +314,35 @@ public class OperationLogic extends AbstractLogic {
* @param taskKey
* @param operationId
* @param contentId
* @param taskReportLevel
* @param enableReport
* @param taskReportJson
* @param hotSpotInfo
* @param localAttachedFileName
* @param attachedChangeFlag
* @param dataSendFlg
* @param localSavedFlg
* @throws IOException
*/
public void updateTaskReport(String taskKey, long operationId, long contentId, int enableReport, JSONObject taskReportJson, String hotSpotInfo, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
// ignore
Logger.w(TAG, "taskDto is null");
public void updateTaskReport(String taskKey, long operationId, long contentId, int taskReportLevel, int enableReport, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg, boolean localSavedFlg) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel);
if (taskReportDto == null) {
//TODO error?
return;
}
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportType);
taskDto.operationId = operationId;
taskDto.taskHotSpotInfo = hotSpotInfo;
JSONObject taskJson = taskReportJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys();
List<TaskReportItemsDto> taskReportItemsDtoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey, Constant.TaskReportLevel.ReportType);
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;
}
if (taskReportJson != null) {
// suggest登録・更新処理
registTaskReportItem(taskKey, taskReportLevel, taskReportJson.getJSONObject("suggest"));
taskReportDto.jsonData = taskReportJson.toString();
} else {
taskReportDto.jsonData = "";
}
taskReportDto.jsonData = taskReportJson.toString();
// 一時保存のフラグ
taskReportDto.localSavedFlg = localSavedFlg;
// 送信フラグ
taskReportDto.dataSendFlg = dataSendFlg;
// 作業報告階層
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportType;
taskReportDto.taskReportLevel = taskReportLevel;
// 報告可能区分
taskReportDto.enableReport = enableReport;
......@@ -377,15 +354,11 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.localAttachedFileName = localAttachedFileName;
}
if (taskReportJson.has(ABookKeys.TASK_STATUS)) {
taskDto.taskStatus = taskReportJson.getInt(ABookKeys.TASK_STATUS);
}
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportType);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationDirectionOrReportDirPath(operationId, taskKey, taskReportLevel);
if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
......@@ -405,110 +378,40 @@ public class OperationLogic extends AbstractLogic {
}
/**
* 作業報告の削除
* 作業報告/作業報告(回答)の削除
*
* @param operationId
* @param contentId
* @param taskKey
*/
public void deleteTaskReport(long operationId, long contentId, String taskKey) {
public void deleteTaskReport(long operationId, long contentId, String taskKey, int taskReportLevel) {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
return;
}
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportType);
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskDto.delFlg = true;
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
// プロジェクトの作業データディレクトリ削除
deleteTaskFileData(operationId, contentId, taskKey);
}
/**
* 作業報告(回答)の登録
* @param taskKey
* @param operationId
* @param contentId
* @param taskReportJson
* @param localAttachedFileName
* @param attachedChangeFlag
* @param dataSendFlg
* @throws IOException
*/
public void insertTaskReportReply(String taskKey, long operationId, long contentId, int enableReport, JSONObject taskReportJson, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto == null) {
//TODO error
return;
}
TaskReportDto taskReportDto = new TaskReportDto();
// taskReportJsonがnullではない場合のみ以下の処理を行う
if (taskReportJson != null) {
JSONObject taskJson = taskReportJson.getJSONObject("task");
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_3_")) {
taskDto.taskStatus = taskJson.getInt(itemKey);
}
taskReportItemsDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey;
try {
taskReportItemsDto.inputValue = taskJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, taskReportLevel);
if (taskReportDto != null) {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
// 報告
taskDto.delFlg = true;
} else {
// 報告(回答)
taskReportDto.jsonData = "";
taskDto.taskStatus = 0;
}
taskReportDto.jsonData = taskReportJson.toString();
} else {
taskReportDto.jsonData = "";
}
taskReportDto.taskKey = taskKey;
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportReplyType;
taskReportDto.enableReport = enableReport;
// 削除の時、deleteではなく、jsonDataを空にして、データが残っているので、updateする
List<TaskReportDto> taskReport = mTaskReportDao.selectByTaskKey(taskReportDto.taskKey, Constant.TaskReportLevel.ReportReplyType);
if (taskReport.size() > 0) {
mTaskReportDao.update(taskReportDto);
} else {
mTaskReportDao.insert(taskReportDto);
}
mTaskDao.update(taskDto);
if (taskReportJson != null) {
//添付ファイル変更の場合、以下の処理を行う
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType);
JSONObject attachedListJson = taskReportJson.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
mTaskDao.update(taskDto);
// プロジェクトの作業データディレクトリ削除
deleteTaskFileData(operationId, contentId, taskKey, taskReportLevel);
}
}
/**
* 定期点検データ新規
* @param operationId
* @param contentId
* @param taskReportDto
* @param attachedChangeFlag
* @param dataSendFlg
......@@ -540,6 +443,7 @@ public class OperationLogic extends AbstractLogic {
//添付ファイル変更の場合、以下の処理を行う
String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(taskReportDto.reportStartDate);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskReportDto.taskKey);
String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskReportDto.taskKey, taskReportDto.taskReportId, strReportStartDate);
......@@ -557,70 +461,6 @@ public class OperationLogic extends AbstractLogic {
}
}
public void updateTaskReportReply(String taskKey, long operationId, long contentId, int enableReport, JSONObject taskReport, String localAttachedFileName, boolean attachedChangeFlag, boolean dataSendFlg) throws IOException {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportReplyType);
if (taskReportDto == null) {
Logger.w(TAG, "taskReportDto is null");
// #32926 作業報告画面改善 start
insertTaskReportReply(taskKey, operationId, contentId, enableReport, taskReport, localAttachedFileName, attachedChangeFlag, dataSendFlg);
// #32926 作業報告画面改善 end
return;
}
JSONObject taskJson = taskReport.getJSONObject("task");
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskKey, Constant.TaskReportLevel.ReportReplyType);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskReportItemsDto.inputValue = newValue;
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
if (taskReportItemsDto.itemKey.startsWith("q_3_")) {
// 値が異なるため、作業コードの入力値を変更する
taskDto.taskStatus = Integer.parseInt(taskReportItemsDto.inputValue);
}
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
}
taskReportDto.jsonData = taskReport.toString();
taskReportDto.dataSendFlg = dataSendFlg;
// attachedFileSendFlgがtrueの場合は、更新しない
if (!taskReportDto.attachedFileSendFlg) {
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
}
// 作業報告階層
taskReportDto.taskReportLevel = Constant.TaskReportLevel.ReportReplyType;
// 報告可能区分
taskReportDto.enableReport = enableReport;
mTaskReportDao.update(taskReportDto);
mTaskDao.update(taskDto);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey);
// #32926 作業報告画面改善 start
String operationDrectionOrReportDirPath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType);
// #32926 作業報告画面改善 end
if (taskReportDto.attachedFileSendFlg) {
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = taskReport.getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
// 同じファイル名が存在すれば、コピー先ファイルを削除
deleteDifferentialFile(operationDrectionOrReportDirPath, attachedFileNames);
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, operationDrectionOrReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
}
}
/**
* 定期点検データ更新
* @param operationId
......@@ -628,21 +468,37 @@ public class OperationLogic extends AbstractLogic {
* @param taskReportDto
* @param attachedChangeFlag
* @param dataSendFlg
* @param insertFlg
* @param reportedFlg
* @param localSavedFlg
* @throws IOException
*/
public void updateRoutineTaskReport(long operationId, long contentId, TaskReportDto taskReportDto, boolean attachedChangeFlag, boolean dataSendFlg, boolean insertFlg, boolean reportedFlg) throws IOException {
public void updateRoutineTaskReport(long operationId, long contentId, TaskReportDto taskReportDto, boolean attachedChangeFlag, boolean dataSendFlg, boolean localSavedFlg) throws IOException {
taskReportDto.attachedFileSendFlg = attachedChangeFlag;
taskReportDto.dataSendFlg = dataSendFlg;
taskReportDto.reportedFlag = reportedFlg;
mTaskReportDao.updateRoutineTask(taskReportDto);
taskReportDto.localSavedFlg = localSavedFlg;
mTaskReportDao.update(taskReportDto);
if (!StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
JSONObject taskReportJson = new JSONObject(taskReportDto.jsonData);
JSONObject taskJson = taskReportJson.getJSONObject("task");
if (insertFlg) {
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskReportDto.taskKey, Constant.TaskReportLevel.ReportType);
if (taskReportItemsDaoList.size() > 0) {
// 更新
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskReportItemsDto.inputValue = newValue;
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
}
} else {
// 登録
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
TaskReportItemsDto taskReportItemsDto = new TaskReportItemsDto();
......@@ -658,47 +514,15 @@ public class OperationLogic extends AbstractLogic {
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
} else {
List<TaskReportItemsDto> taskReportItemsDaoList = mTaskReportItemsDao.getTaskReportItemByTaskKey(taskReportDto.taskKey, Constant.TaskReportLevel.ReportType);
for (TaskReportItemsDto taskReportItemsDto : taskReportItemsDaoList) {
try {
String newValue = taskJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskReportItemsDto.inputValue = newValue;
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
}
}
}
String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(taskReportDto.reportStartDate);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskReportDto.taskKey);
String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskReportDto.taskKey, taskReportDto.taskReportId, strReportStartDate);
String strReportStartDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(taskReportDto.reportStartDate);
String tempDirPath = ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskReportDto.taskKey);
String routineTaskReportDirPath = ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskReportDto.taskKey, taskReportDto.taskReportId, strReportStartDate);
if (insertFlg) {
if (!StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
JSONObject attachedListJson = (new JSONObject(taskReportDto.jsonData)).getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
// コピー元のファイルで、添付ファイルとして使用しないファイル削除
deleteDifferentialFile(tempDirPath, attachedFileNames);
}
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, routineTaskReportDirPath, true);
if(result) {
FileUtil.delete(tempDirPath);
}
} else {
if (taskReportDto.attachedFileSendFlg) {
if (StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
if (!StringUtil.isNullOrEmpty(taskReportDto.jsonData)) {
//添付ファイル変更の場合、以下の処理を行う
JSONObject attachedListJson = (new JSONObject(taskReportDto.jsonData)).getJSONObject("attached");
List<String> attachedFileNames = JSONObject.getValues(attachedListJson);
......@@ -707,12 +531,11 @@ public class OperationLogic extends AbstractLogic {
// 同じファイル名が存在すれば、コピー先ファイルを削除
deleteDifferentialFile(routineTaskReportDirPath, attachedFileNames);
}
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, routineTaskReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
}
// 添付ディレクトリの移動
boolean result = FileUtil.copy(tempDirPath, routineTaskReportDirPath, true);
if (result) {
FileUtil.delete(tempDirPath);
}
}
}
......@@ -793,31 +616,6 @@ public class OperationLogic extends AbstractLogic {
}
/**
* 報告回答を削除
* @param operationId
* @param contentId
* @param taskKey
*/
public void deleteTaskReportReply(long operationId, long contentId, String taskKey) {
TaskReportDto taskReportDto = mTaskReportDao.getTaskReport(taskKey, Constant.TaskReportLevel.ReportReplyType);
if(taskReportDto != null) {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskReportDto.jsonData = "";
mTaskReportDao.update(taskReportDto);
}
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
if (taskDto != null) {
taskDto.taskStatus = 0;
mTaskDao.update(taskDto);
}
// 作業報告のディレクトリ削除
deleteTaskReportReplyFileData(operationId, contentId, taskKey);
}
/**
* 定期点検用、作業削除
* @param operationId
* @param contentId
......@@ -834,9 +632,6 @@ public class OperationLogic extends AbstractLogic {
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, dto.taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate));
// 作業報告送信のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, dto.taskKey, dto.taskReportId, reportStartDate));
}
/**
......@@ -853,8 +648,7 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.dataSendFlg = true;
taskReportDto.attachedFileSendFlg = false;
taskReportDto.jsonData = "";
taskReportDto.reportedFlag = false;
mTaskReportDao.updateRoutineTask(taskReportDto);
mTaskReportDao.update(taskReportDto);
}
TaskDto taskDto = mTaskDao.getTaskByTaskKey(taskKey);
......@@ -978,7 +772,7 @@ public class OperationLogic extends AbstractLogic {
jsonObject.put("workerCode", ABVDataCache.getInstance().getMemberInfo().workerCode);
// データディレクトリへの相対パス
jsonObject.put("attachedPath", "../../../../files/ABook/projects/" + operationId);
jsonObject.put("attachedPath", "../../../../files/ABook/operation/" + operationId);
jsonObject.put("attachedMoviePath", ABVEnvironment.getInstance().getAttachedMoviesFilePath(contentId));
FileUtil.createFile(contentPath + "/content.json", jsonObject.toString());
......@@ -1058,6 +852,7 @@ public class OperationLogic extends AbstractLogic {
public void createTaskReportJson(Long operationId, String contentPath) throws IOException {
List<JSONObject> taskReportJsonList = new ArrayList<JSONObject>();
JSONObject taskReportJson = new JSONObject();
OperationDto operationDto = mOperationDao.getOperation(operationId);
List<TaskReportDto> taskReportDtoList = mTaskReportDao.getTaskReportByOperationId(operationId);
int level = 0;
......@@ -1071,11 +866,17 @@ public class OperationLogic extends AbstractLogic {
}
if(dto.jsonData != null && dto.jsonData.length() > 0) {
taskReportJsonList.add(new JSONObject(dto.jsonData).put(ABookKeys.HAS_AUTHORITY, dto.enableReport));
if (operationDto.reportType == Constant.ReportType.ReportReply) {
taskReportJsonList.add(new JSONObject(dto.jsonData).put(ABookKeys.HAS_AUTHORITY, dto.enableReport));
} else {
taskReportJsonList.add(new JSONObject(dto.jsonData));
}
} else {
JSONObject emptyTaskReportJson = new JSONObject();
emptyTaskReportJson.put(ABookKeys.TASK_KEY, dto.taskKey);
emptyTaskReportJson.put(ABookKeys.HAS_AUTHORITY, dto.enableReport);
if (operationDto.reportType == Constant.ReportType.ReportReply) {
emptyTaskReportJson.put(ABookKeys.HAS_AUTHORITY, dto.enableReport);
}
taskReportJsonList.add(emptyTaskReportJson);
}
......@@ -1096,33 +897,36 @@ public class OperationLogic extends AbstractLogic {
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_REPORT + ".json", taskReportJson.toString());
}
/**
* 定期点検用のJSON作成
* @param operationId
* @param contentPath
* @throws IOException
*/
public void createRoutineTaskReportJson(Long operationId, String contentPath) throws IOException {
List<JSONObject> taskReportJsonList = new ArrayList<JSONObject>();
JSONObject taskReportJsonRoot = new JSONObject();
JSONObject taskReportJsonRow;
int taskReportLevel = 0;
int taskReportId = 0;
List<TaskReportDto> routineTaskReportDtoList = mTaskReportDao.getTaskReportByOperationId(operationId);
// 現在の作業タイプは定期点検の場合
for (TaskReportDto dto : routineTaskReportDtoList) {
taskReportJsonRow = new JSONObject();
taskReportLevel = dto.taskReportLevel;
taskReportId = dto.taskReportId;
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_END_DATE, DateTimeUtil.toStringInTimeZone(dto.reportEndDate, DateTimeFormat.yyyyMMddHHmmss_hyphen, DateTimeUtil.getLocalTimeZone()));
taskReportJsonRow.put(ABookKeys.REPORTED, dto.reportedFlag ? 1 : 0);
List<JSONObject> taskReportInfoList = new ArrayList<JSONObject>();
if (!StringUtil.isNullOrEmpty(dto.jsonData)) {
taskReportInfoList.add(new JSONObject(dto.jsonData).put(ABookKeys.HAS_AUTHORITY, dto.enableReport));
taskReportInfoList.add(new JSONObject(dto.jsonData));
}
taskReportJsonRow.put(ABookKeys.TASK_REPORT_INFO, taskReportInfoList);
taskReportJsonList.add(taskReportJsonRow);
}
taskReportJsonRoot.put(ABookKeys.ENABLE_REPORT_UPDATE, mOperationDao.getOperation(operationId).enableReportUpdate);
taskReportJsonRoot.put(ABookKeys.TASK_REPORT_ID, taskReportId);
taskReportJsonRoot.put(String.format("taskReport_%d", taskReportLevel), taskReportJsonList);
// 最後のtaskReportId
TaskReportDto lastRoutineTaskReportDto = mTaskReportDao.getLastRoutineTaskReportData(operationId);
taskReportJsonRoot.put(ABookKeys.TASK_REPORT_ID, lastRoutineTaskReportDto.taskReportId);
taskReportJsonRoot.put("taskReport_0", taskReportJsonList);
Logger.d(TAG, "createRoutineTaskReportJson : " + taskReportJsonRoot.toString());
Logger.d(TAG,contentPath + "/" + ABookKeys.TASK_REPORT + ".json");
FileUtil.createFile(contentPath + "/" + ABookKeys.TASK_REPORT + ".json", taskReportJsonRoot.toString());
......@@ -1330,12 +1134,15 @@ public class OperationLogic extends AbstractLogic {
if (taskReportDtoList != null && taskReportDtoList.size() > 0) {
int allSendCount = mTaskReportSendDao.getSendableTaskReportSendDataCount(operationId, taskKey);
int progress = maxProgress / allSendCount;
int progress = maxProgress / allSendCount == 0 ? 1 : allSendCount;
// 送信済みsendIdをまとめて削除するため、リストに追加して最後に削除
List<Integer> removeTaskReportSendIds = new ArrayList<Integer>();
for (TaskReportDto taskReportDto : taskReportDtoList) {
List<TaskReportSendDto> taskReportSendDtoList;
int lastTaskReportSendId;
if (operationDto.reportType == Constant.ReportType.Routine) {
if (operationDto.reportType == Constant.ReportType.RoutineTask) {
// 定期点検
String reportStartDateStr = DateTimeUtil.toString(taskReportDto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
taskReportSendDtoList = mTaskReportSendDao.getSendableTaskReportSendData(taskReportDto.taskKey, taskReportDto.taskReportId, reportStartDateStr);
......@@ -1357,7 +1164,7 @@ public class OperationLogic extends AbstractLogic {
if (taskReportDto.attachedFileSendFlg) {
String fileName = null;
zipFile = createAttachedFileForSend(operationId, taskReportDto.taskKey, taskReportSendDto.taskReportSendId, operationDto.reportType == Constant.ReportType.Routine, taskReportDto.taskReportId, strReportStartDate, taskReportDto.taskReportLevel);
zipFile = createAttachedFileForSend(operationId, taskReportDto.taskKey, taskReportSendDto.taskReportSendId, operationDto.reportType == Constant.ReportType.RoutineTask, taskReportDto.taskReportId, strReportStartDate, taskReportDto.taskReportLevel);
if (zipFile != null) {
fileName = FileUtil.getFilenameWithoutExt(zipFile.getName());
}
......@@ -1374,18 +1181,13 @@ public class OperationLogic extends AbstractLogic {
operationDto.reportType
);
progressCallback.callback(new Integer(progress));
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId);
if (operationDto.reportType == Constant.ReportType.Routine) {
// 定期点検
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));
}
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
} catch (ABVException ex) {
if (ex.getCode() == ABVExceptionCode.P_E_ACMS_P005) {
mTaskReportSendDao.deleteBySendId(taskReportSendDto.taskReportSendId);
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportId, strReportStartDate, taskReportSendDto.taskReportSendId));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
return true;
}
throw ex;
......@@ -1405,6 +1207,10 @@ public class OperationLogic extends AbstractLogic {
taskReportDto.dataSendFlg = false;
taskReportDto.attachedFileSendFlg = false;
mTaskReportDao.update(taskReportDto);
// 削除
for (Integer removeTaskReportSendId : removeTaskReportSendIds) {
mTaskReportSendDao.deleteBySendId(removeTaskReportSendId);
}
}
}
}
......@@ -1418,20 +1224,15 @@ public class OperationLogic extends AbstractLogic {
* @param contentId
* @param taskKey
*/
public void deleteTaskFileData(long operationId, long contentId, String taskKey) {
public void deleteTaskFileData(long operationId, long contentId, String taskKey, int taskReportLevel) {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskDirFilePath(operationId, taskKey));
}
/**
* 作業報告(回答)関連ディレクトリ削除
* @param operationId
* @param contentId
* @param taskKey
*/
public void deleteTaskReportReplyFileData(long operationId, long contentId, String taskKey) {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, Constant.TaskReportLevel.ReportReplyType));
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
// 報告
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskDirFilePath(operationId, taskKey));
} else {
// 報告(回答)
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel));
}
}
/**
......@@ -1487,7 +1288,7 @@ public class OperationLogic extends AbstractLogic {
* @throws 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";
AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getTaskFile(parameters, operationId, outputFilePath);
return outputFilePath;
......@@ -1528,10 +1329,6 @@ public class OperationLogic extends AbstractLogic {
mOperationDao.updateContentCreatingFlg(operationId, true);
}
public TaskReportDto getLastRoutineTaskReportData(long operationId) {
return mTaskReportDao.getLastRoutineTaskReportData(operationId);
}
/**
* 作業の添付ファイルのzip生成
* @param operationId
......@@ -1593,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 {
File zipFile;
String filePath;
if (routineFlag) {
filePath = ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskKey, reportId, reportStartDate, taskReportSendId);
} else {
filePath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId);
}
String filePath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId);
File fileDir = new File(filePath);
if (!fileDir.exists()) {
......@@ -1673,4 +1464,93 @@ public class OperationLogic extends AbstractLogic {
public TaskReportDto getTaskReport(String taskKey, int taskReportlevel) {
return mTaskReportDao.getTaskReport(taskKey, taskReportlevel);
}
/**
* suggestJsonデータをtaskReportItemテーブルに登録
* @param taskKey
* @param reportLevel
* @param suggestJson
*/
public void registTaskReportItem(String taskKey, int reportLevel, JSONObject suggestJson) {
if (suggestJson == null) {
// suggestJsonがnullの場合、return
return;
}
Iterator itemKeys = suggestJson.keys();
while (itemKeys.hasNext()) {
String itemKey = (String) itemKeys.next();
TaskReportItemsDto taskReportItemsDto = mTaskReportItemsDao.getTaskReportItem(taskKey, reportLevel, itemKey);
if (taskReportItemsDto != null) {
// 更新
String newValue = suggestJson.getString(taskReportItemsDto.itemKey);
if (!newValue.equals(taskReportItemsDto.inputValue)) {
// 値が異なる場合のみ、更新する
taskReportItemsDto.inputValue = newValue;
mTaskReportItemsDao.updateTaskReportItems(taskReportItemsDto);
}
} else {
// 登録
taskReportItemsDto = new TaskReportItemsDto();
taskReportItemsDto.taskKey = taskKey;
taskReportItemsDto.itemKey = itemKey;
taskReportItemsDto.taskReportLevel = reportLevel;
try {
taskReportItemsDto.inputValue = suggestJson.getString(itemKey);
} catch (JSONException e) {
// 値がStringではない場合、無視する
continue;
}
mTaskReportItemsDao.insertTaskReportItems(taskReportItemsDto);
}
}
}
/**
* t_taskテーブルに登録(報告データ)
* データが存在しないと登録する
* @param taskKey
* @param operationId
* @param hotSpotInfo
* @param taskStatus
*/
public void registTaskData(String taskKey, Long operationId, String hotSpotInfo, Integer taskStatus, JSONObject taskJson) {
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) {
// 更新
taskDto.taskCode = taskCode;
if (hotSpotInfo != null) {
taskDto.taskHotSpotInfo = hotSpotInfo;
}
if (taskStatus != null) {
taskDto.taskStatus = taskStatus;
}
mTaskDao.update(taskDto);
} else {
// 登録
taskDto = new TaskDto();
taskDto.taskCode = taskCode;
taskDto.taskKey = taskKey;
taskDto.operationId = operationId;
if (hotSpotInfo != null) {
taskDto.taskHotSpotInfo = hotSpotInfo;
}
if (taskStatus != null) {
taskDto.taskStatus = taskStatus;
}
mTaskDao.insert(taskDto);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_infomation_update_on" android:state_enabled="true" />
<item android:drawable="@drawable/icon_infomation_update_off" android:state_enabled="false" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_pano_edit_on" android:state_enabled="true"/>
<item android:drawable="@drawable/icon_pano_edit_off" android:state_enabled="false" />
</selector>
\ No newline at end of file
......@@ -82,10 +82,10 @@
<color name="operation_date">#37648C</color>
<color name="operation_color">#095395</color>
<color name="operation_disable_color">#CCCCCC</color>
<color name="operation_search_background">#FFFFFF</color>
<color name="operation_search_header">#CCCCCC</color>
<color name="operation_search_button_color">#0068CB</color>
<color name="operation_search_label_color">#555555</color>
<color name="operation_related_content_new_mark">#ff0000</color>
<color name="operation_bg">#FFFFFF</color>
</resources>
\ No newline at end of file
......@@ -68,6 +68,9 @@
<style name="content_list_bg">
<item name="android:background">@color/background</item>
</style>
<style name="operation_list_bg">
<item name="android:background">@color/operation_bg</item>
</style>
<style name="Theme.MyTheme.ModalDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowCloseOnTouchOutside">false</item>
......
......@@ -120,7 +120,7 @@
<FrameLayout
android:id="@+id/operation_list_layout"
style="@style/content_list_bg"
style="@style/operation_list_bg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
......@@ -4,111 +4,94 @@
android:layout_height="wrap_content"
android:background="@drawable/list_selector_holo_light"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
android:padding="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:orientation="vertical">
android:orientation="horizontal">
<TextView
android:id="@+id/operation_date"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_date"
android:textColor="@color/operation_date"
android:textSize="@dimen/operation_normal_text_size" />
android:layout_height="match_parent"
android:gravity="left"
android:orientation="horizontal">
<TextView
android:id="@+id/operation_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_str"
android:textColor="@color/operation_name"
android:textSize="@dimen/app_large_text_size"
android:textStyle="bold"
android:visibility="visible" />
<ImageView
android:id="@+id/report_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"/>
</LinearLayout>
<ImageView
android:id="@+id/operation_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_gravity="bottom">
android:orientation="vertical">
<TextView
android:id="@+id/description"
android:id="@+id/operation_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/operation_description"
android:textSize="@dimen/operation_normal_text_size"/>
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_str"
android:textColor="@color/operation_name"
android:textSize="@dimen/app_large_text_size"
android:textStyle="bold"
android:visibility="visible" />
<TextView
android:id="@+id/operation_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_date"
android:textColor="@color/operation_date"
android:textSize="@dimen/operation_normal_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="3dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_pano_edit"
<ImageButton
android:id="@+id/btn_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical"
android:visibility="invisible">
android:background="@drawable/ic_edit_list"
android:visibility="invisible" />
<ImageView
android:id="@+id/btn_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_pano_edit" />
<TextView
android:id="@+id/txt_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/ProjectIconText"
android:text="@string/pano_edit" />
</LinearLayout>
<LinearLayout
<ImageButton
android:id="@+id/btn_sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<ImageButton
android:id="@+id/btn_information_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_information_update"/>
<TextView
android:id="@+id/txt_information_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/ProjectIconText"
android:text="@string/information_update" />
</LinearLayout>
android:layout_marginLeft="10dp"
android:background="@drawable/ic_reload_list" />
</LinearLayout>
<ImageView
android:id="@+id/item_nextLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_alignParentRight="true"
android:src="@drawable/ic_navigation_next_item"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/list_selector_holo_light"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
......@@ -10,24 +10,34 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:gravity="left"
android:orientation="horizontal">
<TextView
android:id="@+id/operation_date"
<ImageButton
android:id="@+id/operation_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/dummy_date"
android:textColor="@color/operation_date"
android:textSize="@dimen/operation_normal_text_size" />
android:layout_marginRight="10dp" />
<ImageButton
android:id="@+id/report_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/operation_name"
......@@ -42,74 +52,46 @@
android:textStyle="bold"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/description"
android:id="@+id/operation_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="4"
android:textColor="@color/operation_description"
android:maxLines="2"
android:text="@string/dummy_date"
android:textColor="@color/operation_date"
android:textSize="@dimen/operation_normal_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="3dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_pano_edit"
<ImageView
android:id="@+id/btn_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical"
android:visibility="invisible">
<ImageView
android:id="@+id/btn_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_pano_edit" />
android:layout_weight="1"
android:background="@drawable/ic_edit_list" />
<TextView
android:id="@+id/txt_pano_edit"
style="@style/ProjectIconText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pano_edit" />
</LinearLayout>
<LinearLayout
<ImageButton
android:id="@+id/btn_sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<ImageButton
android:id="@+id/btn_information_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_information_update" />
<TextView
android:id="@+id/txt_information_update"
style="@style/ProjectIconText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/information_update" />
</LinearLayout>
android:layout_weight="1"
android:background="@drawable/ic_reload_list" />
</LinearLayout>
<ImageView
android:id="@+id/item_nextLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:src="@drawable/ic_navigation_next_item"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="300dp"
android:minHeight="200dp"
android:background="@color/operation_search_background"
android:background="@color/operation_bg"
android:orientation="vertical">
<RelativeLayout
......
......@@ -5,162 +5,97 @@
android:layout_height="wrap_content"
android:background="@drawable/list_selector_holo_light"
android:descendantFocusability="blocksDescendants"
android:padding="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="200dp"
android:background="@drawable/panel_frame"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/operation_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_str"
android:textColor="@color/operation_name"
android:textSize="@dimen/app_large_text_size"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<RelativeLayout
android:id="@+id/content_thumbnail_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:layout_gravity="center">
<ImageButton
android:id="@+id/btn_information_update1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@drawable/btn_information_update" />
</RelativeLayout>
<LinearLayout
android:id="@+id/operation_date_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_weight="1"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/content_thumbnail_layout"
android:background="#dce6e6"
android:orientation="vertical"
android:padding="3dp"
android:paddingBottom="10dp">
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="@+id/operation_date"
<ImageView
android:id="@+id/report_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_date"
android:textColor="@color/operation_date"
android:textSize="@dimen/operation_normal_text_size" />
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp" />
</LinearLayout>
<ImageView
android:id="@+id/operation_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/button_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/operation_border"
android:orientation="horizontal"
android:padding="5dp"
android:visibility="visible">
</LinearLayout>
<LinearLayout
android:id="@+id/edit_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp"
android:visibility="visible">
android:gravity="right"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_pano_edit"
<ImageButton
android:id="@+id/btn_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical"
android:visibility="visible">
<ImageView
android:id="@+id/btn_pano_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_pano_edit" />
android:background="@drawable/ic_edit_panel"
android:visibility="invisible" />
<TextView
android:id="@+id/txt_pano_edit"
style="@style/ProjectIconText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pano_edit" />
</LinearLayout>
<ImageButton
android:id="@+id/btn_sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/ic_reload_panel" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/update_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp"
android:visibility="visible">
<View
android:id="@+id/view3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/line_side" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<ImageButton
android:id="@+id/btn_information_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_information_update" />
<TextView
android:id="@+id/operation_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/dummy_str"
android:textColor="@color/operation_name"
android:textSize="@dimen/app_large_text_size"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_information_update"
style="@style/ProjectIconText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/information_update" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/operation_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/dummy_date"
android:textColor="@color/operation_date"
android:textSize="@dimen/operation_normal_text_size" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -4,7 +4,7 @@
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/operation_search_background"
android:background="@color/operation_bg"
android:orientation="vertical"
android:weightSum="1">
......
......@@ -3,7 +3,7 @@
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/operation_search_background"
android:background="@color/operation_bg"
android:minWidth="500dp"
android:orientation="vertical">
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="420dp"
android:minHeight="300dp"
android:background="@color/operation_search_background"
android:background="@color/operation_bg"
android:orientation="vertical">
<RelativeLayout
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="420dp"
android:minHeight="300dp"
android:background="@color/operation_search_background"
android:background="@color/operation_bg"
android:orientation="vertical">
<RelativeLayout
......
......@@ -3,7 +3,7 @@
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="420dp"
android:background="@color/operation_search_background"
android:background="@color/operation_bg"
android:minWidth="500dp"
android:orientation="vertical">
......
......@@ -2,7 +2,7 @@ package jp.agentec.abook.abv.launcher.android;
import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.Constant.OperationReportType;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -22,7 +22,7 @@ public class ABVUIDataCache {
// ホーム画面項目
private int viewMode; // パンネル、リスト形式
private ArrayList<Integer> mOperationReportTypes;
private ArrayList<Integer> mReportTypes;
public long lastUpdateTime = -1;
public String searchText;
......@@ -112,7 +112,7 @@ public class ABVUIDataCache {
}
public void setOperationReportTypes(ArrayList<Integer> operationReportTypes) {
this.mOperationReportTypes = operationReportTypes;
this.mReportTypes = operationReportTypes;
String val = null;
if (operationReportTypes.size() > 0) {
// カンマ区切りで保存
......@@ -137,14 +137,14 @@ public class ABVUIDataCache {
operationReportTypes.add(Integer.parseInt(contentType));
}
}
mOperationReportTypes = operationReportTypes;
mReportTypes = operationReportTypes;
} else {
mOperationReportTypes = new ArrayList<Integer>();
mOperationReportTypes.add(OperationReportType.REPORT_TYPE);
mOperationReportTypes.add(OperationReportType.ROUTINE_TASK);
mOperationReportTypes.add(OperationReportType.REPORT_RESPONSE_TYPE);
mReportTypes = new ArrayList<Integer>();
mReportTypes.add(ReportType.Report);
mReportTypes.add(ReportType.RoutineTask);
mReportTypes.add(ReportType.ReportReply);
}
return mOperationReportTypes;
return mReportTypes;
}
}
......@@ -137,7 +137,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public int mButtonStatus; // 保存ボタンチェック
protected boolean mAddReport; // 作業追加区分
protected int mTaskReportLevel; // 作業報告レベル
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -801,7 +800,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
helpViewType = Constant.HelpViewType.ListOperationDirector;
break;
case Constant.XWalkOpenType.TASK_REPORT:
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.ReportType.RoutineTask) {
helpViewType = Constant.HelpViewType.RoutineTaskOperation;
} else {
helpViewType = Constant.HelpViewType.ListOperationReporter;
......@@ -838,7 +837,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) {
helpViewType = Constant.HelpViewType.DirectorTask;
} else if (mXWalkOpenType == Constant.XWalkOpenType.TASK_REPORT) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.ReportType.RoutineTask) {
helpViewType = Constant.HelpViewType.RoutineTaskOperationReport;
} else {
helpViewType = Constant.HelpViewType.ReportTask;
......@@ -869,25 +868,27 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
mCmd = abookCheckParam.get(ABookKeys.CMD);
mTaskKey = abookCheckParam.get(ABookKeys.TASK_KEY);
mTaskReportLevel = 0; // 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答))
int taskReportLevel = 0; // 作業報告レベル(0:報告、1:報告(回答)、2:報告(回答))
if (abookCheckParam.containsKey(ABookKeys.TASK_REPORT_LEVEL)) {
mTaskReportLevel = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_LEVEL)); // 作業報告レベル
taskReportLevel = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_LEVEL)); // 作業報告レベル
}
int taskReportId = 0;
String reportStartDate = "";
// 作業追加区分の値を取得する
mAddReport = true;
if (abookCheckParam.containsKey(ABookKeys.ADD_REPORT)) {
// 定期点検の場合、以下のフラグを変更しない(mAddReport trueのみ)
if (abookCheckParam.containsKey(ABookKeys.ADD_REPORT) && operationDto.reportType != Constant.ReportType.RoutineTask) {
mAddReport = Integer.parseInt(abookCheckParam.get(ABookKeys.ADD_REPORT)) > 0 ? true : false;
}
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
taskReportId = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE);
}
int taskReportId = 0;
String reportStartDate = "";
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
if (operationDto.reportType == Constant.ReportType.RoutineTask && abookCheckParam.get(ABookKeys.TASK_REPORT_ID) != null && abookCheckParam.get(ABookKeys.REPORT_START_DATE) != null) {
taskReportId = Integer.parseInt(abookCheckParam.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = abookCheckParam.get(ABookKeys.REPORT_START_DATE);
}
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_MOVE_HOT_SPOT, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT,
ABookKeys.CMD_DELETE_TASK_REPORT, ABookKeys.CMD_CANCEL_TASK_REPORT, ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
try {
......@@ -898,39 +899,39 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
}
if (isOperationPdf && operationTaskDto != null && StringUtil.equalsAny(mCmd,
if (isOperationPdf && operationTaskDto != null && StringUtil.equalsAny(mCmd,
ABookKeys.CMD_INSERT_TASK_REPORT,
ABookKeys.CMD_UPDATE_TASK_REPORT,
ABookKeys.CMD_MOVE_HOT_SPOT,
ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT)) {
String taskCode = "";
if (abookCheckParam.get(ABookKeys.TASK_REPORT) != null) {
JSONObject tastReportJson = new JSONObject(abookCheckParam.get(ABookKeys.TASK_REPORT));
JSONObject taskJson = tastReportJson.getJSONObject(ABookKeys.TASK);
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_1_")) {
taskCode = taskJson.getString(itemKey);
}
}
}
String taskCode = "";
if (abookCheckParam.get(ABookKeys.TASK_REPORT) != null) {
JSONObject tastReportJson = new JSONObject(abookCheckParam.get(ABookKeys.TASK_REPORT));
JSONObject taskJson = tastReportJson.getJSONObject(ABookKeys.TASK);
Iterator taskKeys = taskJson.keys();
while (taskKeys.hasNext()) {
String itemKey = (String) taskKeys.next();
if (itemKey.startsWith("q_1_")) {
taskCode = taskJson.getString(itemKey);
}
}
}
if (abookCheckParam.get(ABookKeys.HOT_SPOT) != null) {
JSONObject hotSpot = new JSONObject(abookCheckParam.get(ABookKeys.HOT_SPOT));
hotSpot.put(ABookKeys.SCENE_ID, mCurrentPageNumber + 1);
if (abookCheckParam.get(ABookKeys.HOT_SPOT) != null) {
JSONObject hotSpot = new JSONObject(abookCheckParam.get(ABookKeys.HOT_SPOT));
hotSpot.put(ABookKeys.SCENE_ID, mCurrentPageNumber + 1);
hotSpot.put(ABookKeys.PDF_X, operationTaskDto.pdfX);
hotSpot.put(ABookKeys.PDF_Y, operationTaskDto.pdfY);
hotSpot.put(ABookKeys.PDF_X, operationTaskDto.pdfX);
hotSpot.put(ABookKeys.PDF_Y, operationTaskDto.pdfY);
if (!StringUtil.isNullOrEmpty(taskCode)) {
hotSpot.put(ABookKeys.TASK_CODE, taskCode);
}
if (!StringUtil.isNullOrEmpty(taskCode)) {
hotSpot.put(ABookKeys.TASK_CODE, taskCode);
}
abookCheckParam.put(ABookKeys.HOT_SPOT, hotSpot.toString());
}
}
abookCheckParam.put(ABookKeys.HOT_SPOT, hotSpot.toString());
}
}
final Callback finishCallback = new Callback() {
@Override
......@@ -955,32 +956,30 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 画面遷移処理
closeCurrentScreen(mOperationType);
}
return null;
}
};
ABookCheckWebViewHelper.getInstance().doABookCheckParam(ABVContentViewActivity.this,
mCmd, mTaskKey, mEnableReportHistory, abookCheckParam, mOperationId, mContentPath, getContentId(),
operationDto.reportType, finishCallback,
mTaskReportLevel);
operationDto.reportType, finishCallback, taskReportLevel);
} catch(Exception e) {
Logger.e(TAG, "doABookCheckParam error", e);
}
if(isOperationPdf) {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
}
} catch(Exception e) {
Logger.e(TAG, "doABookCheckParam error", e);
}
if(isOperationPdf) {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
}
} else if (mCmd.equals(ABookKeys.CMD_CHANGE_DISPLAY_STATUS)) {
mStatusCode = Integer.valueOf(abookCheckParam.get(ABookKeys.STATUS_CODE));
commonConfigureHeader();
if(isOperationPdf) {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
}
} else if (mCmd.equals(ABookKeys.CMD_SAVE_ATTACHED)) {
mAttachedFileName = abookCheckParam.get(ABookKeys.FILE_NAME);
getAttachedDataUrl();
} else if (mCmd.equals(ABookKeys.CMD_SHOW_DIRECTION_OZD)) {
mStatusCode = Integer.valueOf(abookCheckParam.get(ABookKeys.STATUS_CODE));
commonConfigureHeader();
if(isOperationPdf) {
onActionOperationPdfWebView(abookCheckParam, operationTaskDto);
}
} else if (mCmd.equals(ABookKeys.CMD_SAVE_ATTACHED)) {
mAttachedFileName = abookCheckParam.get(ABookKeys.FILE_NAME);
getAttachedDataUrl();
} else if (mCmd.equals(ABookKeys.CMD_SHOW_DIRECTION_OZD)) {
mReportFileName = abookCheckParam.get(ABookKeys.REPORT_FILE_NAME);
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, false, true, mReportFileName);
} else if (mCmd.equals(ABookKeys.CMD_PREVIEW_DIRECTION_OZD)) {
......@@ -988,18 +987,16 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, true, true, mReportFileName);
} else if (mCmd.equals(ABookKeys.CMD_SHOW_REPORT_OZD)) {
mReportFileName = abookCheckParam.get(ABookKeys.REPORT_FILE_NAME);
// #32926 作業報告画面改善 start
// 作業報告画面改善
boolean mLocalSave = false; // 一時保存情報
if (abookCheckParam.containsKey(ABookKeys.LOCAL_SAVE)) {
mLocalSave = Integer.parseInt(abookCheckParam.get(ABookKeys.LOCAL_SAVE)) > 0 ? true : false;
}
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, false, taskReportId, reportStartDate, mReportFileName, mLocalSave, mAddReport, mTaskReportLevel);
// #32926 作業報告画面改善 end
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, false, taskReportId, reportStartDate, mReportFileName, mLocalSave, mAddReport, taskReportLevel);
} else if (mCmd.equals(ABookKeys.CMD_PREVIEW_REPORT_OZD)) {
mReportFileName = abookCheckParam.get(ABookKeys.REPORT_FILE_NAME);
// #32926 作業報告画面改善 start
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, true, taskReportId, reportStartDate, mReportFileName, false, false, mTaskReportLevel);
// #32926 作業報告画面改善 end
// 作業報告画面改善
ActivityHandlingHelper.getInstance().startOZViewerActivity(this, mOperationId, getContentId(), mTaskKey, true, taskReportId, reportStartDate, mReportFileName, false, false, taskReportLevel);
} else if (mCmd.equals(ABookKeys.CMD_CONTENT_EDIT_CLOSE)) {
showProgressPopup();
handler.postDelayed(new Runnable() {
......@@ -1011,7 +1008,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}, 5000);
} else if (mCmd.equals(ABookKeys.CMD_GET_GPS_INFO)) {
// #32926 作業報告画面改善 start
setLocation((Integer.valueOf(abookCheckParam.get(ABookKeys.GPS_TYPE)) != 1), mTaskReportLevel);
setLocation((Integer.valueOf(abookCheckParam.get(ABookKeys.GPS_TYPE)) != 1), taskReportLevel);
// #32926 作業報告画面改善 end
} else if (mCmd.equals(ABookKeys.CMD_SCENE_REGIST)) {
String successFlg = abookCheckParam.get(ABookKeys.SUCCESS_FLG);
......
......@@ -331,7 +331,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
isNeedCheck = true;
}
}
if (isNeedCheck) {
final ABVDataCache dataCache = ABVDataCache.getInstance();
final ABVEnvironment abvEnvironment = ABVEnvironment.getInstance();
......
......@@ -133,9 +133,7 @@ public interface AppDefType {
interface PushMessageKey {
String message = "message";
String data = "data";
// TODO
// サーバ作業後、対応必要「project」→「operation」
String operationId = "projectId";
String operationId = "operationId";
}
interface UrlPattern {
......
......@@ -57,13 +57,14 @@ import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.OperationReportType;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.common.Constant.TaskReportLevel;
import jp.agentec.abook.abv.bl.common.Constant.PushMessageSendType;
import jp.agentec.abook.abv.bl.common.constant.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
......@@ -157,7 +158,6 @@ public class OperationListActivity extends ABVUIActivity {
private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
private PushMessageLogic mPushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private Integer mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
private ImageView mPanoCotnentImageView;
private TextView mPanoContentNameTextView;
......@@ -637,21 +637,15 @@ public class OperationListActivity extends ABVUIActivity {
// プロジェクトの指示/報告表示時、必要なJSONファイル作成
mOperationLogic.createJsonForOpenABookCheckPano(operationDto.operationId, operationDto.contentId, contentPath);
mOperationLogic.createJsonForOperationContent(operationDto.operationId, contentPath, operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK);
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
mOperationLogic.createJsonForRoutineTaskReport(operationDto.reportCycle, operationDto.enableReportUpdate, mOperationLogic.getLastRoutineTaskReportData(operationDto.operationId).taskReportId, contentPath);
}
mOperationLogic.createJsonForOperationContent(operationDto.operationId, contentPath, operationDto.reportType == ReportType.RoutineTask);
// サーバ作業後、対応必要
StringBuffer path = new StringBuffer();
path.append(contentPath);
// #32926 作業報告画面改善 start
path.append("/index.html?app=android");
path.append("&view_mode=" + mOperationAuthLevel);
path.append("&report_type=" + operationDto.reportType); // 作業報告タイプ : 0:報告 1:定期点検 2:報告(回答)
path.append("&mobile_flg=" + (isNormalSize() ? "1" : "0")); // ScreenType
path.append("&operation_type=" + operationDto.operationType); // 作業タイプ : 0:リスト、1:図面、2:360°
Logger.d(TAG, "path : " + path);
// #32926 作業報告画面改善 end
......@@ -748,7 +742,7 @@ public class OperationListActivity extends ABVUIActivity {
// 報告受信
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, buttonEventFlag);
if (reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (reportType == ReportType.RoutineTask) {
if (buttonEventFlag) {
String dialogMsg = null;
// 定期点検プロジェクトの利用可能日付を取得
......@@ -822,11 +816,11 @@ public class OperationListActivity extends ABVUIActivity {
}
public void onClickShowHelpView(View v) {
if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
// if (mOperationAuthLevel == OperationAuthLevel.OPERATION_INSTRUCTOR) {
showHelpViewDialog(Constant.HelpViewType.OperationListDirector);
} else {
// } else {
showHelpViewDialog(Constant.HelpViewType.OperationListReporter);
}
// }
}
/**
......@@ -884,131 +878,100 @@ public class OperationListActivity extends ABVUIActivity {
progress = 40 / json.taskDtoList.size();
}
boolean isRoutineTask = operationDto.reportType == Constant.ReportType.Routine;
boolean isRoutineTask = operationDto.reportType == ReportType.RoutineTask;
JSONObject taskReportJson;
JSONObject taskReportJson = null;
for (TaskDto serverTaskDto : json.taskDtoList) {
List<TaskReportDto> localRemove = new ArrayList();
List<TaskReportDto> localTaskReportList = mTaskReportDao.getTaskReportListByTaskKey(serverTaskDto.taskKey);
for (TaskReportDto localTaskReportDto : localTaskReportList) {
if (!isExistsTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto, isRoutineTask)) {
if (isRoutineTask) {
mOperationLogic.deleteRoutineTaskReport(operationId, operationContentDto.contentId, localTaskReportDto);
} else {
// taskDtoが存在するとtaskReportLevel 0 (作業報告)が存在しないことはないので、報告(回答)のみチェックして削除
if (localTaskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportReplyType) {
// 作業報告のディレクトリ削除
mOperationLogic.deleteTaskReportReplyFileData(operationId, operationContentDto.contentId, serverTaskDto.taskKey);
mTaskReportDao.delete(localTaskReportDto);
// 定期点検のみ、時間が変更になった場合、差分の削除が必要なため、以下の処理を行う
// 定期点検以外の場合は、taskが存在しないので、削除処理は必要なし
if (operationDto.reportType == ReportType.RoutineTask) {
List<TaskReportDto> localTaskReportList = mTaskReportDao.getTaskReportListByTaskKey(serverTaskDto.taskKey);
for (TaskReportDto localTaskReportDto : localTaskReportList) {
if (!isExistsTaskReportInList(serverTaskDto.taskReportDtoList, localTaskReportDto)) {
if (isRoutineTask) {
mOperationLogic.deleteRoutineTaskReport(operationId, operationContentDto.contentId, localTaskReportDto);
}
}
localTaskReportList.remove(localTaskReportDto);
}
}
if (operationDto.reportType == Constant.ReportType.Routine) {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
// 作業の報告更新
mTaskDao.update(serverTaskDto);
localTaskList.remove(serverTaskDto);
} else {
// 作業の報告登録
mTaskDao.insert(serverTaskDto);
}
// サーバーからの情報で更新
for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String reportAttachedFileName = taskReportDto.attachedFileName;
taskReportDto.taskKey = serverTaskDto.taskKey;
// 添付ファイルが存在する場合、取得して解凍する。
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.taskReportId, taskReportDto.taskReportInfoId, taskReportDto.reportStartDate, reportAttachedFileName);
if (isSyncGetTaskFileError) {
return null;
}
if (isExistsTaskReportInList(localTaskReportList, taskReportDto, true)) {
// 報告データが存在すると作業報告を更新する
if (taskReportDto.jsonData != null) {
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false, false, false);
}
// サーバーからの情報で更新
for (TaskReportDto serverTaskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = serverTaskReportDto.attachedFileName;
TaskReportDto localTaskReportDto;
if (operationDto.reportType == ReportType.RoutineTask) {
localTaskReportDto = mTaskReportDao.getRoutineTaskReport(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportId, DateTimeUtil.toString(serverTaskReportDto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen));
} else {
if (taskReportDto.jsonData != null) {
mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, taskReportDto, false, false);
}
localTaskReportDto = mTaskReportDao.selectByTaskKey(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportLevel);
}
}
} else {
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
// 更新
for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName;
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) {
return null;
}
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
// 作業報告を更新
// update
mOperationLogic.updateTaskReport(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
} else {
// 作業報告(回答)
if (taskReportDto.jsonData != null) {
// データの更新
mOperationLogic.updateTaskReportReply(serverTaskDto.taskKey, serverTaskDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
} else {
// jsonDataがない場合
mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
null, attachedFileName, false, false);
}
}
// 更新済みの場合、localTaskListから削除
localTaskList.remove(serverTaskDto);
if (localTaskReportDto != null && localTaskReportDto.localSavedFlg) {
// 一時保存フラグがtureだと何もしない
continue;
}
} else {
// 登録
for (TaskReportDto taskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = taskReportDto.attachedFileName;
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshTaskFile(operationId, taskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, taskReportDto.attachedFileName);
} catch (Exception e) {
return null;
}
if (taskReportDto.taskReportLevel == Constant.TaskReportLevel.ReportType) {
taskReportJson = new JSONObject(taskReportDto.jsonData);
taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
if (operationDto.reportType == ReportType.RoutineTask) {
mOperationLogic.insertTaskReport(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
taskReportJson, serverTaskDto.taskHotSpotInfo, attachedFileName, false, false);
serverTaskReportDto.taskKey = serverTaskDto.taskKey;
// 添付ファイルが存在する場合、取得して解凍する。
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.taskReportInfoId, serverTaskReportDto.reportStartDate, attachedFileName);
if (isSyncGetTaskFileError) {
return null;
}
if (localTaskReportDto != null) {
// 報告データが存在すると作業報告を更新する
mOperationLogic.updateRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false, localTaskReportDto.localSavedFlg);
} else {
mOperationLogic.insertRoutineTaskReport(serverTaskDto.operationId, operationContentDto.contentId, serverTaskReportDto, false, false);
}
} else {
if (taskReportDto.jsonData != null) {
mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
new JSONObject(taskReportDto.jsonData), attachedFileName, false, false);
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshTaskFile(operationId, serverTaskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.attachedFileName);
} catch (Exception e) {
return null;
}
if (!serverTaskReportDto.jsonData.isEmpty()) {
taskReportJson = new JSONObject(serverTaskReportDto.jsonData);
if (serverTaskReportDto.taskReportLevel == TaskReportLevel.ReportType) {
taskReportJson.put(ABookKeys.TASK_STATUS, serverTaskDto.taskStatus);
}
}
if (localTaskReportDto == null) {
// 登録
mOperationLogic.insertTaskReport(serverTaskDto.taskKey, operationId, operationContentDto.contentId,
serverTaskReportDto.taskReportLevel, serverTaskReportDto.enableReport,
taskReportJson, attachedFileName, false, false, false);
} else {
// jsonDataがない場合
mOperationLogic.insertTaskReportReply(serverTaskDto.taskKey, operationContentDto.operationId, operationContentDto.contentId, taskReportDto.enableReport,
null, attachedFileName, false, false);
// 更新
// jsonDataが空で入る場合、taskReportJsonをnullで登録
mOperationLogic.updateTaskReport(serverTaskDto.taskKey, operationId, operationContentDto.contentId,
serverTaskReportDto.taskReportLevel, serverTaskReportDto.enableReport,
taskReportJson, attachedFileName, false, false, localTaskReportDto.localSavedFlg);
}
}
}
}
}
progressCallback.callback(new Integer(progress));
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey);
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey, TaskReportLevel.ReportType);
mTaskDao.delete(taskDto);
}
lastEditDate = json.lastEditDate;
......@@ -1509,9 +1472,9 @@ public class OperationListActivity extends ABVUIActivity {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.in_gourp) {
mSendType = Constant.PushMessageSendType.InGroup;
mSendType = PushMessageSendType.InGroup;
} else {
mSendType = Constant.PushMessageSendType.AllOperation;
mSendType = PushMessageSendType.AllOperation;
}
}
});
......@@ -1692,22 +1655,15 @@ public class OperationListActivity extends ABVUIActivity {
* @param rDto
* @return
*/
private boolean isExistsTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto, boolean isRoutineTask) {
private boolean isExistsTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto) {
for (TaskReportDto lDto : listDto) {
if (isRoutineTask) {
// 定期点検の場合、taskKey,taskReportId,reportStartDateで判定
if (lDto.taskKey.equals(rDto.taskKey) &&
lDto.taskReportId == rDto.taskReportId &&
lDto.reportStartDate.equals(rDto.reportStartDate)) {
return true;
}
} else {
// taskKeyと作業報告階層で判定
if (lDto.taskKey.equals(rDto.taskKey) &&
lDto.taskReportLevel == rDto.taskReportLevel) {
return true;
}
// 定期点検の場合、taskKey,taskReportId,reportStartDateで判定
if (lDto.taskKey.equals(rDto.taskKey) &&
lDto.taskReportId == rDto.taskReportId &&
lDto.reportStartDate.equals(rDto.reportStartDate)) {
return true;
}
}
return false;
}
......@@ -1926,9 +1882,9 @@ public class OperationListActivity extends ABVUIActivity {
private ArrayList<Integer> getOperationReportTypeList(boolean isAll) {
ArrayList<Integer> operationReportTypes = new ArrayList<>();
if (isAll) {
operationReportTypes.add(OperationReportType.REPORT_TYPE);
operationReportTypes.add(OperationReportType.ROUTINE_TASK);
operationReportTypes.add(OperationReportType.REPORT_RESPONSE_TYPE);
operationReportTypes.add(ReportType.Report);
operationReportTypes.add(ReportType.RoutineTask);
operationReportTypes.add(ReportType.ReportReply);
} else {
operationReportTypes = getABVUIDataCache().getOperationReportTypes();
}
......
......@@ -21,7 +21,6 @@ import jp.agentec.abook.abv.launcher.android.R;
public abstract class AbstractOperationAdapter extends BaseAdapter {
protected AbstractOperationListAdapterListener listener;
protected List<OperationDto> listItem = new ArrayList<>(); // NullPointException防止
protected Integer mOperationAuthLevel = ABVDataCache.getInstance().getMemberInfo().operationAuthLevel;
protected ContentDao mContentDao = AbstractDao.getDao(ContentDao.class);
public interface AbstractOperationListAdapterListener {
......
......@@ -5,16 +5,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
import jp.agentec.abook.abv.bl.acms.type.OperationButtonType;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -35,31 +33,27 @@ public class OperationListAdapter extends AbstractOperationAdapter {
private static final String TAG = "OperationListAdapter";
private Context mContext;
private LayoutInflater mInflater;
private List<OperationDto> mListItem = new ArrayList<>();
private boolean mNormalSizeFlg;
public OperationListAdapter(Context context, List<OperationDto> listItem) {
mContext = context;
mListItem = listItem;
this.listItem = listItem;
mNormalSizeFlg = ((OperationListActivity)context).isNormalSize();
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public List<OperationDto> getData() {
return mListItem;
}
@Override
public int getCount() {
return mListItem.size();
return listItem.size();
}
@Override
public OperationDto getItem(int position) {
return mListItem.get(position);
return listItem.get(position);
}
@Override
public long getItemId(int position) {
return mListItem.get(position).operationId;
return listItem.get(position).operationId;
}
@Override
......@@ -68,18 +62,19 @@ public class OperationListAdapter extends AbstractOperationAdapter {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_operation_list, parent, false);
holder = new ViewHolder();
holder.tvOperationName = (TextView) convertView.findViewById(R.id.operation_name);
holder.tvDate = (TextView) convertView.findViewById(R.id.operation_date);
holder.tvDescription = (TextView) convertView.findViewById(R.id.description);
holder.tvOperationName = convertView.findViewById(R.id.operation_name);
holder.tvDate = convertView.findViewById(R.id.operation_date);
// 報告タイプ
holder.ivReportType = convertView.findViewById(R.id.report_type);
// 作業ベースタイプ
holder.ivOperationType = convertView.findViewById(R.id.operation_type);
// 360編集関連
holder.lyPanoEditLayout = (LinearLayout) convertView.findViewById(R.id.layout_pano_edit);
holder.ivPanoEdit = (ImageView) convertView.findViewById(R.id.btn_pano_edit);
holder.tvPanoEditText = (TextView) convertView.findViewById(R.id.txt_pano_edit);
holder.ivPanoEdit = convertView.findViewById(R.id.btn_pano_edit);
// 情報更新関連
holder.ivInformationUpdate = (ImageView) convertView.findViewById(R.id.btn_information_update);
holder.tvInformationUpdateText = (TextView) convertView.findViewById(R.id.txt_information_update);
holder.ivSync = convertView.findViewById(R.id.btn_sync);
convertView.setTag(holder);
} else {
......@@ -89,9 +84,13 @@ public class OperationListAdapter extends AbstractOperationAdapter {
final OperationDto operationDto = getItem(position);
if (operationDto != null) {
boolean noRoutineTaskAll = (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
// タイプによってイメージのセット
setImageReportType(holder, operationDto.reportType);
setImageOperationType(holder, operationDto.operationType);
boolean noRoutineTaskAll = (operationDto.reportType == ReportType.RoutineTask && operationDto.reportCount == 0);
holder.tvOperationName.setText(operationDto.operationName);
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == ReportType.RoutineTask) {
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod)) {
// リソースパターンの適用
holder.tvDate.setText(PatternStringUtil.patternToString(mContext,
......@@ -112,54 +111,55 @@ public class OperationListAdapter extends AbstractOperationAdapter {
R.string.date_label,
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)) + " : " + DateTimeUtil.toString(operationDto.operationStartDate, DateTimeFormat.yyyyMMdd_slash) + " ~ " + DateTimeUtil.toString(operationDto.operationEndDate, DateTimeFormat.yyyyMMdd_slash));
}
holder.tvDescription.setText(operationDto.operationDescriptions);
// 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) {
if ((operationDto.needSyncFlg)) {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
holder.ivSync.setVisibility(View.VISIBLE);
} else {
// needSyncFlgがfalseの場合
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == ReportType.RoutineTask) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
holder.ivSync.setVisibility(View.VISIBLE);
} else {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
holder.ivSync.setVisibility(View.INVISIBLE);
}
} else {
// 定期点検プロジェクトではない場合、同期ボタンを非活性化する
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
holder.ivSync.setVisibility(View.INVISIBLE);
}
}
} else {
// プロジェクトのコンテンツが存在しない場合は、同期ボタンを非活性化する
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
holder.ivSync.setVisibility(View.INVISIBLE);
}
if(operationDto.operationType == OperationType.PANO) {
// 360タイプのみ360編集ボタン表示
holder.lyPanoEditLayout.setVisibility(View.VISIBLE);
if (operationDto.contentCreatingFlg) { //Panoコンテンツ作成中の状態
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
if (operationDto.enableReportEdit == Constant.EnableReportEdit.NO) {
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
} else {
if (operationDto.contentId == null || operationDto.contentId != 0) {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, true);
// 360タイプのみ360編集ボタン表示
holder.ivPanoEdit.setVisibility(View.VISIBLE);
if (operationDto.contentCreatingFlg) { //Panoコンテンツ作成中の状態
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
holder.ivSync.setVisibility(View.INVISIBLE);
} else {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
if (operationDto.contentId == null || operationDto.contentId != 0) {
holder.ivPanoEdit.setVisibility(View.VISIBLE);
} else {
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
}
}
}
} else {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
}
if(operationDto.enableReportEdit == Constant.EnableReportEdit.NO) {
holder.lyPanoEditLayout.setVisibility(View.GONE);
}
holder.ivPanoEdit.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -168,7 +168,7 @@ public class OperationListAdapter extends AbstractOperationAdapter {
}
});
holder.ivInformationUpdate.setOnClickListener(new View.OnClickListener() {
holder.ivSync.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onSyncOperation(operationDto);
......@@ -182,32 +182,49 @@ public class OperationListAdapter extends AbstractOperationAdapter {
private static class ViewHolder {
TextView tvOperationName;
TextView tvDate;
TextView tvDescription;
ImageView ivReportType;
ImageView ivOperationType;
// 360編集関連
LinearLayout lyPanoEditLayout;
ImageView ivPanoEdit;
TextView tvPanoEditText;
// 情報更新関連
ImageView ivInformationUpdate;
TextView tvInformationUpdateText;
ImageView ivSync;
}
/**
* 作業一覧の各ボタンの活性化、非活性化に変更する
* @param holder
* @param buttonType
* @param isEnabled
*/
private void setButtonEnabled(ViewHolder holder, int buttonType, boolean isEnabled) {
switch (buttonType) {
case OperationButtonType.PANO_EDIT :
holder.ivPanoEdit.setEnabled(isEnabled);
holder.tvPanoEditText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
// ReportTypeで画像の設定
private void setImageReportType(ViewHolder holder, int reportType) {
switch (reportType) {
case Constant.ReportType.Report :
// 報告タイプ
holder.ivReportType.setBackgroundResource(R.drawable.ic_list_type1);
break;
case Constant.ReportType.RoutineTask :
// 定期点検タイプ
holder.ivReportType.setBackgroundResource(R.drawable.ic_list_type2);
break;
case Constant.ReportType.ReportReply :
// 報告(回答)タイプ
holder.ivReportType.setBackgroundResource(R.drawable.ic_list_type3);
break;
}
}
// OperationTypeで画像の設定
private void setImageOperationType(ViewHolder holder, int operationType) {
switch (operationType) {
case OperationType.LIST :
// リスト
holder.ivOperationType.setBackgroundResource(R.drawable.ic_list);
break;
case OperationType.PANO :
// 360
holder.ivOperationType.setBackgroundResource(R.drawable.ic_list_360);
break;
case OperationButtonType.INFORMATION_UPDATE:
holder.ivInformationUpdate.setEnabled(isEnabled);
holder.tvInformationUpdateText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
case OperationType.PDF :
// PDF
holder.ivOperationType.setBackgroundResource(R.drawable.ic_list_draw);
break;
}
}
......
......@@ -5,15 +5,13 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.type.OperationAuthLevel;
import jp.agentec.abook.abv.bl.acms.type.OperationButtonType;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.Constant.ReportType;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -72,25 +70,21 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
@Override
public long getItemId(int position) {
return listItem.get(position).contentId;
}
public List<OperationDto> getListItem() {
return listItem;
return listItem.get(position).operationId;
}
private static class ViewHolder {
TextView tvOperationName;
TextView tvDate;
TextView tvDescription;
ImageView ivReportType;
ImageView ivOperationType;
// 360編集関連
LinearLayout lyPanoEditLayout;
ImageView ivPanoEdit;
TextView tvPanoEditText;
// 情報更新関連
ImageView ivInformationUpdate;
TextView tvInformationUpdateText;
// 同期関連
ImageView ivSync;
}
@Override
......@@ -99,18 +93,19 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item_operation_panel, parent, false);
holder = new OperationPanelAdapter.ViewHolder();
holder.tvOperationName = (TextView) convertView.findViewById(R.id.operation_name);
holder.tvDate = (TextView) convertView.findViewById(R.id.operation_date);
// holder.tvDescription = (TextView) convertView.findViewById(R.id.description);
holder.tvOperationName = convertView.findViewById(R.id.operation_name);
holder.tvDate = convertView.findViewById(R.id.operation_date);
// 報告タイプ
holder.ivReportType = convertView.findViewById(R.id.report_type);
// 作業ベースタイプ
holder.ivOperationType = convertView.findViewById(R.id.operation_type);
// 360編集関連
holder.lyPanoEditLayout = (LinearLayout) convertView.findViewById(R.id.layout_pano_edit);
holder.ivPanoEdit = (ImageView) convertView.findViewById(R.id.btn_pano_edit);
holder.tvPanoEditText = (TextView) convertView.findViewById(R.id.txt_pano_edit);
holder.ivPanoEdit = convertView.findViewById(R.id.btn_pano_edit);
// 情報更新関連
holder.ivInformationUpdate = (ImageView) convertView.findViewById(R.id.btn_information_update);
holder.tvInformationUpdateText = (TextView) convertView.findViewById(R.id.txt_information_update);
// 同期関連
holder.ivSync = convertView.findViewById(R.id.btn_sync);
convertView.setTag(holder);
} else {
......@@ -120,9 +115,13 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
final OperationDto operationDto = getItem(position);
if (operationDto != null) {
boolean noRoutineTaskAll = (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK && operationDto.reportCount == 0);
setImageReportType(holder, operationDto.reportType);
setImageOperationType(holder, operationDto.operationType);
boolean noRoutineTaskAll = (operationDto.reportType == ReportType.RoutineTask && operationDto.reportCount == 0);
holder.tvOperationName.setText(operationDto.operationName);
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == ReportType.RoutineTask) {
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod)) {
// リソースパターンの適用
holder.tvDate.setText(PatternStringUtil.patternToString(mContext,
......@@ -143,50 +142,48 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
// 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) {
if ((operationDto.needSyncFlg)) {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
holder.ivSync.setVisibility(View.VISIBLE);
} else {
// needSyncFlgがfalseの場合
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == ReportType.RoutineTask) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, true);
holder.ivSync.setVisibility(View.VISIBLE);
} else {
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
holder.ivSync.setVisibility(View.INVISIBLE);
}
} else {
// 定期点検プロジェクトではない場合、同期ボタンを非活性化する
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
holder.ivSync.setVisibility(View.INVISIBLE);
}
}
} else {
// プロジェクトのコンテンツが存在しない場合は、同期ボタンを非活性化する
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
holder.ivSync.setVisibility(View.INVISIBLE);
}
if(operationDto.operationType == OperationType.PANO) {
// 360タイプのみ360編集ボタン表示
holder.lyPanoEditLayout.setVisibility(View.VISIBLE);
if (operationDto.contentCreatingFlg) { //Panoコンテンツ作成中の状態
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
setButtonEnabled(holder, OperationButtonType.INFORMATION_UPDATE, false);
if (operationDto.enableReportEdit == Constant.EnableReportEdit.NO) {
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
} else {
if (operationDto.contentId != null && operationDto.contentId != 0) {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, true);
if (operationDto.contentCreatingFlg) { //Panoコンテンツ作成中の状態
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
holder.ivSync.setVisibility(View.INVISIBLE);
} else {
setButtonEnabled(holder, OperationButtonType.PANO_EDIT, false);
if (operationDto.contentId != null && operationDto.contentId != 0) {
holder.ivPanoEdit.setVisibility(View.VISIBLE);
} else {
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
}
}
}
} else {
holder.lyPanoEditLayout.setVisibility(View.INVISIBLE);
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
}
// if(mOperationAuthLevel.equals(OperationAuthLevel.WORKER)) {
holder.lyPanoEditLayout.setVisibility(View.GONE);
// }
holder.ivPanoEdit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -194,7 +191,7 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
}
});
holder.ivInformationUpdate.setOnClickListener(new View.OnClickListener() {
holder.ivSync.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onSyncOperation(operationDto);
......@@ -205,15 +202,38 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
return convertView;
}
private void setButtonEnabled(OperationPanelAdapter.ViewHolder holder, int buttonType, boolean isEnabled) {
switch (buttonType) {
case OperationButtonType.PANO_EDIT :
holder.ivPanoEdit.setEnabled(isEnabled);
holder.tvPanoEditText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
// ReportTypeで画像の設定
private void setImageReportType(ViewHolder holder, int reportType) {
switch (reportType) {
case ReportType.Report :
// 報告タイプ
holder.ivReportType.setBackgroundResource(R.drawable.ic_panel_type1);
break;
case ReportType.RoutineTask :
// 定期点検タイプ
holder.ivReportType.setBackgroundResource(R.drawable.ic_panel_type2);
break;
case ReportType.ReportReply :
// 報告(回答)タイプ
holder.ivReportType.setBackgroundResource(R.drawable.ic_panel_type3);
break;
}
}
// OperationTypeで画像の設定
private void setImageOperationType(OperationPanelAdapter.ViewHolder holder, int operationType) {
switch (operationType) {
case OperationType.LIST :
// リスト
holder.ivOperationType.setBackgroundResource(R.drawable.ic_panel_list);
break;
case OperationType.PANO :
// 360
holder.ivOperationType.setBackgroundResource(R.drawable.ic_panel_360);
break;
case OperationButtonType.INFORMATION_UPDATE:
holder.ivInformationUpdate.setEnabled(isEnabled);
holder.tvInformationUpdateText.setTextColor(mContext.getResources().getColor(isEnabled ? R.color.operation_color : R.color.operation_disable_color));
case OperationType.PDF :
// PDF
holder.ivOperationType.setBackgroundResource(R.drawable.ic_panel_draw);
break;
}
}
......
......@@ -7,6 +7,7 @@ import android.graphics.Matrix;
import android.media.ExifInterface;
import android.os.AsyncTask;
import android.util.Base64;
import android.widget.Toast;
import org.json.adf.JSONObject;
......@@ -36,6 +37,7 @@ import jp.agentec.abook.abv.ui.common.activity.ABVContentViewActivity;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.viewer.activity.CheckOZDViewActivity;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
......@@ -86,32 +88,30 @@ public class ABookCheckWebViewHelper extends ABookHelper {
switch (cmd) {
case ABookKeys.CMD_INSERT_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, true, reportType, taskReportLevel);
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
sendTaskData(context, operationId, taskKey, taskReportLevel);
break;
case ABookKeys.CMD_UPDATE_TASK_REPORT:
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, false, reportType, taskReportLevel);
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
insertOrUpdateTaskReport(taskKey, enableReportHistory, operationId, contentId, param, contentPath, reportType, taskReportLevel, true);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
sendTaskData(context, operationId, taskKey, taskReportLevel);
ABVToastUtil.showMakeText(context, R.string.msg_temp_save_result, Toast.LENGTH_SHORT);
mFinishCallback.callback(false);
break;
case ABookKeys.CMD_DELETE_TASK_REPORT:
int taskReportId = 0;
String reportStartDate = "";
boolean sendTaskReportDataFlg = false;
if (reportType == Constant.ReportType.Routine) {
if (reportType == Constant.ReportType.RoutineTask) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE).replace("T", " ");
mOperationLogic.deleteRoutineTaskReport(operationId, contentId, taskKey, taskReportId, reportStartDate);
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
} else {
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey);
} else {
mOperationLogic.deleteTaskReportReply(operationId, contentId, taskKey);
}
mOperationLogic.deleteTaskReport(operationId, contentId, taskKey, taskReportLevel);
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
}
......@@ -136,7 +136,6 @@ public class ABookCheckWebViewHelper extends ABookHelper {
mFinishCallback.callback(false);
break;
}
}
/**
......@@ -300,12 +299,11 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* @param contentId
* @param param
* @param contentPath
* @param insertFlg
* @param reportType
* @param taskReportLevel
* @throws IOException
*/
private void insertOrUpdateTaskReport(String taskKey, int enableReportHistory, long operationId, long contentId, Map<String, String> param, String contentPath, boolean insertFlg, int reportType, int taskReportLevel) throws IOException {
private void insertOrUpdateTaskReport(String taskKey, int enableReportHistory, long operationId, long contentId, Map<String, String> param, String contentPath, int reportType, int taskReportLevel, boolean localSavedFlg) throws IOException {
int taskReportSendId = 0;
boolean attachedChangeFlag = param.get(ABookKeys.ATTACHED_CHANGE_FLAG).equals("1") ? true : false;
String taskReport = param.get(ABookKeys.TASK_REPORT);
......@@ -313,46 +311,52 @@ public class ABookCheckWebViewHelper extends ABookHelper {
int taskReportId = 0;
String reportStartDate = "";
if (reportType == Constant.ReportType.Routine) {
if (reportType == Constant.ReportType.RoutineTask) {
taskReportId = Integer.valueOf(param.get(ABookKeys.TASK_REPORT_ID));
reportStartDate = param.get(ABookKeys.REPORT_START_DATE);
reportStartDate = reportStartDate.replace("T", " ");
TaskReportDto taskReportDto = mOperationLogic.getRoutineTaskReportUtc(taskKey, taskReportId, reportStartDate);
taskReportDto.jsonData = taskReport;
mOperationLogic.updateRoutineTaskReport(operationId, contentId, taskReportDto, attachedChangeFlag, true, localSavedFlg);
mOperationLogic.updateRoutineTaskReport(operationId, contentId, taskReportDto, attachedChangeFlag, true, insertFlg, true);
mOperationLogic.createJsonForOperationContent(operationId, contentPath, true);
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskKey, taskReportId, reportStartDate);
} else {
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
String hotSpotInfo = param.get(ABookKeys.HOT_SPOT);
if (insertFlg) {
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, Constant.EnableReport.YES, taskReportJson, hotSpotInfo, null, attachedChangeFlag, true);
} else {
mOperationLogic.updateTaskReport(taskKey, operationId, contentId, Constant.EnableReport.YES, taskReportJson, hotSpotInfo, null, attachedChangeFlag, true);
}
} else {
if (insertFlg) {
mOperationLogic.insertTaskReportReply(taskKey, operationId, contentId, Constant.EnableReport.YES, taskReportJson, null, attachedChangeFlag, true);
} else {
mOperationLogic.updateTaskReportReply(taskKey, operationId, contentId, Constant.EnableReport.YES, taskReportJson, null, attachedChangeFlag, true);
}
}
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;
// 報告情報のjson取得後、登録・更新時に使用
JSONObject taskJson = null;
if (taskReportJson.has("task")) {
taskJson = taskReportJson.getJSONObject("task");
}
// task登録・更新処理
mOperationLogic.registTaskData(taskKey, operationId, hotSpotInfo, taskStatus, taskJson);
TaskReportDto taskReportDto = mOperationLogic.getTaskReport(taskKey, taskReportLevel);
if (taskReportDto != null) {
// 更新
mOperationLogic.updateTaskReport(taskReportDto.taskKey, operationId, contentId, taskReportLevel, Constant.EnableReport.YES, taskReportJson, null, attachedChangeFlag, localSavedFlg ? false : true, localSavedFlg);
} else {
// 登録
mOperationLogic.insertTaskReport(taskKey, operationId, contentId, taskReportLevel, Constant.EnableReport.YES, taskReportJson, null, attachedChangeFlag, localSavedFlg ? false : true, localSavedFlg);
}
mOperationLogic.createJsonForOperationContent(operationId, contentPath, false);
copyTaskAttachedMovie(operationId, contentId, taskKey, taskReportLevel);
}
if (enableReportHistory == Constant.EnableReportHistory.Invalid) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
} else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
if (!localSavedFlg) {
if (enableReportHistory == Constant.EnableReportHistory.Invalid) {
//データ無い場合は中でinsertされる
taskReportSendId = mOperationLogic.updateTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
} else {
taskReportSendId = mOperationLogic.insertTaskReportSend(taskKey, taskReportId, reportStartDate, taskReportJson, false);
}
// #32926 作業報告画面改善 start
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, reportType == Constant.ReportType.RoutineTask, taskReportId, reportStartDate, taskReportLevel);
// #32926 作業報告画面改善 end
}
// #32926 作業報告画面改善 start
copyReportTaskSendFiles(operationId, taskKey, taskReportSendId, reportType == Constant.ReportType.Routine, taskReportId, reportStartDate, taskReportLevel);
// #32926 作業報告画面改善 end
}
// xwalkで動画ファイルにアクセスするため、../files/..の以下のパスのディレクトりを../cache/..以下のパスに変更
......@@ -362,7 +366,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
for (TaskDto taskDto : taskDtoList) {
List<TaskReportDto> taskReportDtoList = mOperationLogic.getTaskReportByTaskKey(taskDto.taskKey);
for (TaskReportDto taskReportDto : taskReportDtoList) {
if (operationDto.reportType == Constant.OperationReportType.ROUTINE_TASK) {
if (operationDto.reportType == Constant.ReportType.RoutineTask) {
copyRoutineTaskReportAttachedMovie(operationId, contentId, taskReportDto.taskKey, taskReportDto.taskReportId, taskReportDto.reportStartDate);
} else {
copyTaskAttachedMovie(operationId, contentId, taskDto.taskKey, taskReportDto.taskReportLevel);
......@@ -377,7 +381,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
/**
* 定期点検
* /.../files/ABook/project/{projectId}/{taskKey}/report/{taskReportId}/{reportStartDate}/*.(mov,mp4)を
* /.../files/ABook/operation/{operationId}/{taskKey}/report/{taskReportId}/{reportStartDate}/*.(mov,mp4)を
* /.../cache/{contentId}/attachedMovie/{taskKey}/report/{taskReportId}/{reportStartDate}/*.(mov,mp4)にコピー
* @param operationId
* @param contentId
......@@ -413,7 +417,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
}
/**
* /.../files/ABook/project/{projectId}/{taskKey}/{taskType}/{taskReportLevel}/*.(mov,mp4)を
* /.../files/ABook/operation/{operationId}/{taskKey}/{taskType}/{taskReportLevel}/*.(mov,mp4)を
* /.../cache/{contentId}/attachedMovie/{taskKey}/{taskType}/{taskReportLevel}/*.(mov,mp4)にコピー
*
* @param operationId
......@@ -464,12 +468,8 @@ public class ABookCheckWebViewHelper extends ABookHelper {
File taskAttachedFiles = new File(taskAttachedPath);
if (taskAttachedFiles.exists()) {
String taskReportSendPath;
if (routineTaskReportFlg) {
taskReportSendPath = ABVEnvironment.getInstance().getRoutineTaskReportSendDirFilePath(operationId, taskKey, taskReportId, sReportStartDate, taskReportSendId);
} else {
taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId);
}
String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId);
FileUtil.delete(taskReportSendPath);
FileUtil.createNewDirectory(taskReportSendPath);
......@@ -493,7 +493,7 @@ public class ABookCheckWebViewHelper extends ABookHelper {
@Override
protected Void doInBackground(Void... params) {
try {
String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportLevel, taskReportSendId);
String taskReportSendPath = ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskKey, taskReportSendId);
FileUtil.delete(taskReportSendPath);
} catch (Exception ex) {
Logger.e(String.format("%s.deleteReportTaskSendFiles(%d, %s)", TAG, operationId, taskKey), ex);
......
......@@ -585,7 +585,7 @@ public class CheckOZDViewActivity extends ABVContentViewActivity {
param.append("export.mode=silent#");
param.append("export.filename=" + FileUtil.getFilenameWithoutExt(mSaveOzdTempFileName) + "#");
// #32926 作業報告画面改善 start
param.append("export.path=" + OzdFileHelper.getTempTaskDirPath(contentId, mTaskKey) + "#"); //OzdFileHelper.getTempTaskDirPath(contentId, mTaskKey) + "/" + mTaskReportLevel + "#");
param.append("export.path=" + OzdFileHelper.getTempTaskDirPath(contentId, mTaskKey) + "#");
// #32926 作業報告画面改善 end
param.append("export.confirmsave=false#");
param.append("export.format=ozd");
......
......@@ -4985,6 +4985,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
case ABookKeys.CMD_INSERT_TASK_REPORT: // 作業報告の登録
case ABookKeys.CMD_UPDATE_TASK_REPORT: // 作業報告の更新
case ABookKeys.CMD_DELETE_TASK_REPORT: // 作業報告の削除
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
getTaskHotspotJSON();
case ABookKeys.CMD_CANCEL_TASK_REPORT: // 作業報告のキャンセル
if(operationTaskDto != null) {
......@@ -5212,6 +5213,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
// #32782 指示者テーブル関連削除 start
case ABookKeys.CMD_INSERT_TASK_REPORT:
case ABookKeys.CMD_UPDATE_TASK_REPORT:
case ABookKeys.CMD_LOCAL_SAVE_TASK_REPORT: // 一時保存
if (taskReportLevel == Constant.TaskReportLevel.ReportType) {
JSONObject hotspot = new JSONObject(checkParam.get(ABookKeys.HOT_SPOT));
......
......@@ -97,7 +97,7 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
boolean isUpdate = intent.getBooleanExtra("isUpdate", false);
final String url = intent.getStringExtra("LINKURL"); // LinkURL
mOperationId = intent.getLongExtra(ABookKeys.OPERATION_ID, -1); // ProjectId
mOperationId = intent.getLongExtra(ABookKeys.OPERATION_ID, -1); // OperationId
// ***** WebViewセット
......
......@@ -260,7 +260,7 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.setProgress(20);
progressDialogHorizontal.setProgress(20);
webViewLoadUrl(String.format("javascript:CHK_E.checkResourceEntry('%s')", resourceId));
}
});
......@@ -268,21 +268,21 @@ public class ParentWebViewActivity extends ABVContentViewActivity {
handler.post(new Runnable() {
@Override
public void run() {
int progress = progressDialog.getProgress();
int progress = progressDialogHorizontal.getProgress();
if (progress == 0) {
return;
} else if (progress == 100) {
progressDialog.setProgress(0);
progressDialogHorizontal.setProgress(0);
closeProgressPopup();
} else if (progress < 100 && progress > 80) {
progressDialog.setProgress(progress + 1);
progressDialogHorizontal.setProgress(progress + 1);
handler.postDelayed(this, 2000);
} else if (progress <= 80 && progress >= 60) {
progressDialog.setProgress(progress + 2);
progressDialogHorizontal.setProgress(progress + 2);
handler.postDelayed(this, 1000);
} else if (progress < 60) {
progressDialog.setProgress(progress + 4);
progressDialogHorizontal.setProgress(progress + 4);
handler.postDelayed(this, 1000);
}
}
......
......@@ -44,8 +44,7 @@ public class OperationTaskLayout extends RelativeLayout {
private static final String TAG = "OperationTaskLayout";
private static final String TEMP_TASK_KEY = "00000000-0000-0000-0000-000000000000";
private static final String SCRIPT_SHOW_TASK_LIST = "javascript:CHK_P.updateTaskListForApp(%d)";//CHK.updateTaskListForApp(pageNum)
private static final String SCRIPT_SHOW_TASK_DIRECT = "javascript:CHK.showTaskForm('%s')";//CHK.showTaskForm(taskKey)
private static final String SCRIPT_SHOW_TASK_REPORT = "javascript:CHK.showTaskReportForm('%s')";//CHK.showTaskReportForm(name, taskKey, lookto)
private static final String SCRIPT_SHOW_TASK_REPORT = "javascript:CHK.showReportForm('%s')";//CHK.showTaskReportForm(name, taskKey, lookto)
private static final int ICON_WIDTH = 32;
private static final int ICON_HEIGHT = 32;
......@@ -279,15 +278,15 @@ public class OperationTaskLayout extends RelativeLayout {
final String script = String.format(SCRIPT_SHOW_TASK_LIST, pageNum + 1);
RelativeLayout.LayoutParams params;
if (isNormalSize) {
// if (isNormalSize) {
params = createParam(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} else {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int halfWidth = (int) (displayMetrics.density * OperationTaskLayout.HALF_WIDTH);
int screenWidth = displayMetrics.widthPixels;
params = createParam(halfWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
}
// } else {
// DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
// int halfWidth = (int) (displayMetrics.density * OperationTaskLayout.HALF_WIDTH);
// int screenWidth = displayMetrics.widthPixels;
// params = createParam(halfWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
// params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
// }
setLayoutParams(params);
......@@ -309,11 +308,7 @@ public class OperationTaskLayout extends RelativeLayout {
final String script;
if (mXWalkOpenType == Constant.XWalkOpenType.TASK_DERECTION) {
script = String.format(SCRIPT_SHOW_TASK_DIRECT, operationTaskDto.taskKey.equals(TEMP_TASK_KEY) ? "" : operationTaskDto.taskKey);
} else {
script = String.format(SCRIPT_SHOW_TASK_REPORT, operationTaskDto.taskKey.equals(TEMP_TASK_KEY) ? "" : operationTaskDto.taskKey);
}
script = String.format(SCRIPT_SHOW_TASK_REPORT, operationTaskDto.taskKey.equals(TEMP_TASK_KEY) ? "" : operationTaskDto.taskKey);
runOnUiThread(new Runnable() {
@Override
......@@ -340,20 +335,20 @@ public class OperationTaskLayout extends RelativeLayout {
public void setTaskFormPosition(float screenX, boolean isNormalSize) {
RelativeLayout.LayoutParams params;
if (isNormalSize) {
// if (isNormalSize) {
params = createParam(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
} else {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int halfWidth = (int) (displayMetrics.density * OperationTaskLayout.HALF_WIDTH);
int screenWidth = displayMetrics.widthPixels;
params = createParam(halfWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
if (screenX < screenWidth / 2) {
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
} else {
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
}
}
// } else {
// DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
// int halfWidth = (int) (displayMetrics.density * OperationTaskLayout.HALF_WIDTH);
// int screenWidth = displayMetrics.widthPixels;
// params = createParam(halfWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
//
// if (screenX < screenWidth / 2) {
// params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
// } else {
// params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
// }
// }
setLayoutParams(params);
}
......
......@@ -51,13 +51,13 @@ public class PageView extends ImageView {
protected GestureDetector mGestureDetector;
protected ScaleGestureDetector mScaleDetector = null;
private boolean isProjectPdf;
private boolean isOperationPdf;
public PageView(Context context) {
super(context);
}
public PageView(Context context, Size pageSize, int pageNumber, int displayWidth, int displayHeight, RelativeLayout pageLayout, boolean isProjectPdf) {
public PageView(Context context, Size pageSize, int pageNumber, int displayWidth, int displayHeight, RelativeLayout pageLayout, boolean isOperationPdf) {
super(context);
Logger.i(TAG, "[PageView]: page=" + pageNumber);
......@@ -71,9 +71,9 @@ public class PageView extends ImageView {
mGestureDetector = new GestureDetector(context, mGestureListener);
this.isProjectPdf = isProjectPdf;
this.isOperationPdf = isOperationPdf;
// ABook Check : doubletap = 新作業指示
if (!isProjectPdf) {
if (!isOperationPdf) {
mGestureDetector.setOnDoubleTapListener(mDoubleTapListener);
}
mScaleDetector = new ScaleGestureDetector(context, onScaleGestureListener);
......
......@@ -38,8 +38,8 @@ app_versioncode=1
# abvEnvironments.xml
#cms server
acms_address=https://abook188-1.abook.bz/acms
download_server_address=https://abook188-1.abook.bz/acms
acms_address=https://abook189.abook.bz/acms
download_server_address=https://abook189.abook.bz/acms
#syncview server
websocket_server_http_url=https://abookplus.agentec.jp/v1
......
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