Commit 2044e9c0 by Lee Munkyeong

Merge branch 'features/1.4.100_develop_mk' into 'features/1.4.201'

課題票75,110対応

See merge request !238
parents 47084337 1e9de99e
......@@ -130,7 +130,7 @@ public class OperationDao extends AbstractDao {
dto.permitCodeRequiredFlg = cursor.getInt(column);
}
column = cursor.getColumnIndex("display_permission_flg ");
column = cursor.getColumnIndex("display_permission_flg");
if (column != -1) {
dto.displayPermissionFlg = cursor.getInt(column);
}
......
Subproject commit 89f7f804a54cf4890189864d9384f6b3de21ccb4
Subproject commit 4b07d503bb21575b86ecea757fd8ca4323806371
......@@ -2,6 +2,7 @@ package jp.agentec.abook.abv.ui.common.activity;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
......@@ -28,17 +29,28 @@ import android.widget.Toast;
import com.google.firebase.iid.FirebaseInstanceId;
import net.lingala.zip4j.exception.ZipException;
import org.json.adf.JSONObject;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.DownloadedContentInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.ContentJSON;
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.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.AlertMessageLevel;
......@@ -54,20 +66,29 @@ import jp.agentec.abook.abv.bl.common.util.ContentFileUtil;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.download.ContentDownloadListener;
import jp.agentec.abook.abv.bl.download.ContentDownloader;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
import jp.agentec.abook.abv.bl.download.ContentRefresher;
import jp.agentec.abook.abv.bl.download.ContentZipDownloadNotification;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.FixPushMessageDto;
import jp.agentec.abook.abv.bl.dto.OperationContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.PushMessageDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
import jp.agentec.abook.abv.bl.dto.TaskReportDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.BookmarkLogic;
import jp.agentec.abook.abv.bl.logic.CommunicationLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.MemoLogic;
import jp.agentec.abook.abv.bl.logic.OperationGroupMasterLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.bl.logic.PushMessageLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
......@@ -105,13 +126,13 @@ import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
import jp.agentec.adf.net.http.HttpDownloadSimpleNotification;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil;
public abstract class ABVAuthenticatedActivity extends ABVActivity implements ContentDownloadListener {
private final static String TAG = "ABVAuthenticatedActivity";
public static final String FILEPATH = "FILEPATH";
//連続タップ防止用のボタン活性化するタイム
protected static final int BUTTON_ENABLE_DELAY_MILLIS = 500;
......@@ -148,6 +169,14 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected int mSendType;
protected PushMessageLogic pushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
protected TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
protected OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
protected OperationGroupMasterLogic mOperationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
protected PushMessageLogic mPushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
protected Date mOperationLastEditDate;
protected OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
protected OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
protected TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
/**
* メッセージ表示タイプ
*/
......@@ -165,6 +194,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
int CHANGED_META_INFO = 2;
int PAYMENT = 3;
}
private int DEFAULT_VALUE_ZERO = 0;
private boolean DEFAULT_VALUE_FALSE = false;
// 遷移元のアクティビティ名
// PushMessage受信時に直接ChatRoomへ行かずに、ひとつまえのActivityに戻る為に使用する。
......@@ -180,7 +211,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
private void sendRegistrationIdToCMS() {
// Tokenが更新されたか確認
if (!PreferenceUtil.getUserPref(this, UserPrefKey.NEED_SEND_TOKEN, false)){
if (!PreferenceUtil.getUserPref(this, UserPrefKey.NEED_SEND_TOKEN, DEFAULT_VALUE_FALSE)){
// 更新されてない
return;
}
......@@ -940,7 +971,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
TextView operationSelect = (TextView) mOperationSelectDialog.findViewById(R.id.tv_toolbar_title);
operationSelect.setText(PatternStringUtil.patternToInt(getApplicationContext(),
R.string.operation_select,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)));
mOperationSelectDialog.findViewById(R.id.close_btn).setOnClickListener(new View.OnClickListener() {
@Override
......@@ -1039,7 +1070,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
titleTextView.setText(PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_list,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)));
} else {
mPushMessageListView.setVisibility(View.GONE);
mPushMessageListDialog.findViewById(R.id.close_btn).setVisibility(View.VISIBLE);
......@@ -1048,7 +1079,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
titleTextView.setText(PatternStringUtil.patternToString(getApplicationContext(),
R.string.title_message_detail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)));
}
}
......@@ -1112,7 +1143,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
messageTitleTextView.setText(PatternStringUtil.patternToString(getApplicationContext(),
R.string.free_input,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)) + " > ");
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)) + " > ");
TextView tvOperationName = (TextView) mPushMessageSendDialog.findViewById(R.id.operation_name);
tvOperationName.setText(operationDto.operationName);
......@@ -1157,7 +1188,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_input_null,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)), Toast.LENGTH_SHORT);
return;
}
byte[] messageByte = message.getBytes(StandardCharsets.UTF_8);
......@@ -1165,14 +1196,14 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_input_over,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)), Toast.LENGTH_SHORT);
return;
}
// リソースパターンの適用
ProgressDialogHelper.showProgressPopup(this, true, PatternStringUtil.patternToString(getApplicationContext(),
R.string.file_initialization,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)));
try {
boolean result = pushMessageLogic.sendPushMessageRequest(mSendType, message, operationId);
if (result) {
......@@ -1180,19 +1211,19 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_send_success,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)), Toast.LENGTH_SHORT);
} else {
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_send_fail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)), Toast.LENGTH_SHORT);
}
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.push_message_send_fail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)), Toast.LENGTH_SHORT);
} finally {
ProgressDialogHelper.closeProgressPopup();
}
......@@ -1209,14 +1240,14 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
ProgressDialogHelper.showProgressPopup(this, true, PatternStringUtil.patternToString(getApplicationContext(),
R.string.file_initialization,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)));
try {
List<FixPushMessageDto> fixPushMessageList = pushMessageLogic.getFixPushMessage();
FixPushMessageDto dto = new FixPushMessageDto();
// リソースパターンの適用
dto.name = PatternStringUtil.patternToString(getApplicationContext(),
R.string.free_input,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO));
fixPushMessageList.add(0, dto);
mFixPushMessageListView.setAdapter(new FixPushMessageAdapter(this, fixPushMessageList, mSelectedFixPuchMessagePosition));
mFixPushMessageListView.invalidate();
......@@ -1243,7 +1274,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
// リソースパターンの適用
ABVToastUtil.showMakeText(this, PatternStringUtil.patternToString(getApplicationContext(),
R.string.respons_fix_push_message_fail,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_SHORT);
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)), Toast.LENGTH_SHORT);
} finally {
ProgressDialogHelper.closeProgressPopup();
}
......@@ -1273,6 +1304,292 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
/**
* 作業データ更新処理
* @param operationId 作業ID
* @param reportType 作業タイプ
* @param buttonEventFlag ボタンイベントフラグ
* @return エラー文言
*/
public String syncOperation(final long operationId, int reportType, boolean buttonEventFlag) {
final StringBuilder errorMsg = new StringBuilder();
try {
//コンテンツダウンロード関連プログレスバー値設定
progressDialogHorizontal.setProgress(20);
final Callback progressCallback = new Callback() {
@Override
public Object callback(Object ret) {
final int progress = (int)ret;
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialogHorizontal.setProgress(progressDialogHorizontal.getProgress() + progress);
}
});
return null;
}
};
// 報告送信
mOperationLogic.sendTaskReportSendData(operationId, progressCallback);
//工程全削除の送信(連続作業)
if (reportType == Constant.ReportType.ReportContinuous) {
if (!mOperationLogic.deleteProcess(operationId)) { //工程全削除送信失敗時
return PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_error_all_process_delete,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO));
}
}
progressDialogHorizontal.setProgress(60);
// 報告受信
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, errorMsg);
//連続作業のみ承認データ取得
if (reportType == Constant.ReportType.ReportContinuous) {
mOperationLogic.getProcessData(operationId);
}
// mOperationLastEditDateがnullの場合、エラーと見做す
if (mOperationLastEditDate != null && reportType == Constant.ReportType.RoutineTask) {
if (buttonEventFlag) {
String dialogMsg = null;
// 定期点検の利用可能日付を取得
String avilableDateStr = mOperationLogic.getRoutineTaskOperationAvailableDateStr(operationId);
if (!StringUtil.isNullOrEmpty(avilableDateStr)) {
// 利用可能メッセージ
// リソースパターンの適用
dialogMsg = String.format(PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_routineTask_report_available_from,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO)), avilableDateStr);
} else if (!mTaskReportDao.existsToDoRoutineTaskReportData(operationId)) {
// 作業データが存在しないメッセージ
dialogMsg = PatternStringUtil.patternToString(getApplicationContext(),
R.string.msg_no_report_data,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO));
}
if (!StringUtil.isNullOrEmpty(dialogMsg)) {
errorMsg.append(dialogMsg);
}
}
putUserPref(String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationId), DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none));
}
} catch (AcmsException e) {
//noinspection EnumSwitchStatementWhichMissesCases
switch (e.getCode()) {
case P_E_ACMS_P003:
// リソースパターンを適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P003, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO))));
break;
case P_E_ACMS_P004:
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P004, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO))));
break;
case P_E_ACMS_P005:
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P005, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO))));
break;
case P_E_ACMS_P006:
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P006, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO))));
break;
default:
Logger.e(TAG, "syncOperation", e);
errorMsg.append(ErrorMessage.getErrorMessage(this, ErrorMessage.getErrorCode(e)));
break;
}
mOperationLastEditDate = null;
} catch (Exception e) {
Logger.e(TAG, e);
errorMsg.append(ErrorMessage.getErrorMessage(this, ABVExceptionCode.C_E_SYSTEM_0001));
mOperationLastEditDate = null;
} finally {
handler.post(new Runnable() {
@Override
public void run() {
if (mOperationLastEditDate != null) {
mOperationLogic.finishedSyncOperation(operationId, mOperationLastEditDate);
progressDialogHorizontal.setProgress(100);
}
mOperationLastEditDate = null;
//screenRefresh();
closeProgressPopup();
}
});
}
return errorMsg.length() > 0 ? errorMsg.toString() : null;
}
/**
* 作業データ受信
* @param operationId
* @param progressCallback
* @return
* @throws NetworkDisconnectedException
* @throws ABVException
* @throws IOException
* @throws InterruptedException
* @throws NoSuchAlgorithmException
* @throws ZipException
*/
public Date receptionTaskData(long operationId, Callback progressCallback, StringBuilder errorMsg) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
GetOperationDataParameters param = new GetOperationDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId);
OperationDto operationDto = mOperationLogic.getOperation(operationId);
OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId);
List<TaskDto> localTaskList = mTaskDao.selectAllTaskByOperationId(operationId);
Date lastEditDate;
OperationDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getOpereationData(param);
//プログレスを40%進行させるための計算
int progress = 0;
if (json.taskDtoList.size() != 0) {
progress = 40 / json.taskDtoList.size();
}
boolean isRoutineTask = operationDto.reportType == Constant.ReportType.RoutineTask;
for (TaskDto serverTaskDto : json.taskDtoList) {
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.ReportType) {
// 作業報告のディレクトリ削除
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, serverTaskDto.taskKey, localTaskReportDto.taskReportLevel);
mTaskReportDao.delete(localTaskReportDto);
}
}
}
}
if (isExistsTaskInList(localTaskList, serverTaskDto)) {
// 作業の報告更新
mTaskDao.update(serverTaskDto);
localTaskList.remove(serverTaskDto);
} else {
// 作業の報告登録
mTaskDao.insert(serverTaskDto);
}
// サーバーからの情報で更新
for (TaskReportDto serverTaskReportDto : serverTaskDto.taskReportDtoList) {
String attachedFileName = serverTaskReportDto.attachedFileName;
TaskReportDto localTaskReportDto;
if (operationDto.reportType == Constant.ReportType.RoutineTask) {
localTaskReportDto = mTaskReportDao.getRoutineTaskReportUtc(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportId, DateTimeUtil.toString(serverTaskReportDto.reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen));
} else {
localTaskReportDto = mTaskReportDao.selectByTaskKey(serverTaskReportDto.taskKey, serverTaskReportDto.taskReportLevel);
}
if (localTaskReportDto != null && localTaskReportDto.localSavedFlg) {
// 一時保存フラグがtrueで定期点検且つ点検後修正不可の場合、添付ファイル(作業報告のディレクトリ)を削除して、localSavedFlgをfalseに変更
if (operationDto.reportType == Constant.ReportType.RoutineTask && operationDto.enableReportUpdate == Constant.EnableReportUpdate.NO) {
// 作業報告のディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(operationContentDto.contentId, localTaskReportDto.taskKey));
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, localTaskReportDto.taskKey, localTaskReportDto.taskReportId, DateTimeUtil.toString_yyyyMMddHHmmss_none(localTaskReportDto.reportStartDate)));
localTaskReportDto.localSavedFlg = false;
} else {
// 一時保存フラグがtureだと何もしない
continue;
}
}
if (operationDto.reportType == Constant.ReportType.RoutineTask) {
serverTaskReportDto.taskKey = serverTaskDto.taskKey;
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.taskReportInfoId, serverTaskReportDto.reportStartDate, attachedFileName);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO))));
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 {
JSONObject taskReportJson = null;
// 添付ファイルが存在する場合、取得して解凍する。
try {
refreshTaskFile(operationId, serverTaskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.attachedFileName, serverTaskDto.processKey, serverTaskDto.phaseNo);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, DEFAULT_VALUE_ZERO))));
return null;
}
if (!serverTaskReportDto.jsonData.isEmpty()) {
taskReportJson = new JSONObject(serverTaskReportDto.jsonData);
if (serverTaskReportDto.taskReportLevel == Constant.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, serverTaskDto.processKey, serverTaskDto.phaseNo);
} else {
// 更新
// jsonDataが空で入る場合、taskReportJsonをnullで登録
mOperationLogic.updateTaskReport(serverTaskDto.taskKey, operationId, operationContentDto.contentId,
serverTaskReportDto.taskReportLevel, serverTaskReportDto.enableReport,
taskReportJson, attachedFileName, false, false, localTaskReportDto.localSavedFlg, serverTaskDto.processKey, serverTaskDto.phaseNo);
}
}
}
if (progressCallback != null) {
progressCallback.callback(new Integer(progress));
}
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey, Constant.TaskReportLevel.ReportType);
mTaskDao.delete(taskDto);
}
lastEditDate = json.lastEditDate;
if (progressCallback != null) {
progressCallback.callback(new Integer(40));
}
return lastEditDate;
}
/**
* 報告存在チェック
* @param listDto
* @param rDto
* @return
*/
protected boolean isExistsTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto, boolean isRoutineTask) {
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;
}
}
}
return false;
}
/**
* プッシュメッセージがあるので、チャットルームに遷移する。
*/
public boolean goChatRoom(final Intent intent, final String targetActivityName, final String baseActivityName) {
......@@ -1307,6 +1624,96 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
/**
* listDtoの中に第2引数のdtoが存在するかチェックメソッド
* @param listDto リストDto
* @param dto ターゲットDto
* @return
*/
protected boolean isExistsTaskInList(List<TaskDto> listDto, TaskDto dto) {
for (TaskDto lDto : listDto) {
if (lDto.taskKey.equals(dto.taskKey)) {
return true;
}
}
return false;
}
/**
* 定期点検用ファイル更新
* @param operationId
* @param contentId
* @param taskId
* @param taskKey
* @param taskReportId
* @param reportStartDate
* @param reportAttachedFileName
* @throws ABVException
* @throws InterruptedException
* @throws ZipException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public void refreshRoutineTaskFile(final long operationId, final long contentId, final long taskId, final String taskKey, final int taskReportId, final int taskReportInfoId, final Date reportStartDate, final String reportAttachedFileName) throws Exception {
String reportStartDateHypn = DateTimeUtil.toString(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
final String reportStartDateNone = DateTimeUtil.toString_yyyyMMddHHmmss_none(reportStartDate);
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
String reportLocalAttachedFileName = mTaskReportDao.getRoutineTaskReportAttachedFileName(taskKey, taskReportId, reportStartDateHypn);
boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName);
if (getReportFileFlg) {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName);
// #32926 start
int taskReportLevel = 0;
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone));
// #32926 end
String outputFilePath = mOperationLogic.getRoutineTaskReportFile(operationId, taskKey, taskId, taskReportId, taskReportInfoId, reportStartDateNone, reportAttachedFileName);
// #32926 start
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone), null, true);
// #32926 end
}
}
/**
* 添付ファイルが存在する場合、取得して解凍する。
* @param operationId
* @param taskReportLevel
* @param contentId
* @param taskId
* @param taskKey
* @param attachedFileName
* @param processKey 固定キー
* @param phaseNo 固定NO
* @throws ABVException
* @throws InterruptedException
* @throws ZipException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
protected void refreshTaskFile(final long operationId, final int taskReportLevel, long contentId,
final long taskId, final String taskKey, final String attachedFileName,
final String processKey, final Integer phaseNo) throws Exception {
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey, taskReportLevel);
if (attachedFileName != null && !attachedFileName.equals(reportLocalAttachedFileName)) {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, attachedFileName);
// #32926 start
String saveAttacedFilePath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
if (processKey != null && phaseNo != 0) {
saveAttacedFilePath = ABVEnvironment.getInstance().getOperationDirectionOrContinuousReportDirPath(operationId, taskKey, taskReportLevel, processKey, phaseNo);
}
FileUtil.delete(saveAttacedFilePath);
// #32926 end
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, attachedFileName, taskReportLevel);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, saveAttacedFilePath,null, true);
}
}
/**
* プッシュメッセージ受信後のダイアログを表示する。
* @param context コンテキスト
* @param messageMap プッシュメッセージ
......
......@@ -959,6 +959,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
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, ABookKeys.CMD_CHANGE_TASK_REPORT, ABookKeys.CMD_DELETE_PROCESS)) {
try {
if (StringUtil.equalsAny(mCmd, ABookKeys.CMD_INSERT_TASK_REPORT, ABookKeys.CMD_UPDATE_TASK_REPORT)) {
// リソースパターンの適用
......@@ -1012,6 +1013,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
public Object callback(Object ret) {
final boolean isError = (boolean)ret;
closeProgressPopup();
syncOperation(mOperationId, mOperationType, false);
// 報告・報告(回答)の切り替えボタンタップ、連続作業の全削除ボタンタップ
if (mCmd.equals(ABookKeys.CMD_CHANGE_TASK_REPORT) || mCmd.equals(ABookKeys.CMD_DELETE_PROCESS)) {
afterABookCheckApi(mCmd, mTaskKey, 0, "", null, isOperationPdf());
......
......@@ -240,6 +240,35 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
// ログ送信可否を確認
LogUtil.checkSendLogFlag();
}
} catch (ABVException e) {
stopUpdateAnimation();
switch (e.getCode()) {
case C_I_CONTENT_0001:
handleErrorMessageToast(ABVExceptionCode.C_I_CONTENT_0001);
break;
case S_E_ACMS_1403:
// 再ログイン
onAuthenticationFailed();
break;
case C_I_CONTENT_0002:
// コンテンツダウンロード中は自動更新を行わない。
if (!isAutoRefresh) {
handleErrorMessageToast(ABVExceptionCode.C_I_CONTENT_0002);
}
break;
case S_E_ACMS_0500:
handleErrorMessageToast(ABVExceptionCode.S_E_ACMS_0500);
break;
case S_E_ACMS_INVALID_RESPONSE:
// サーバー通信エラー時、エラーメッセージ表示
handleErrorMessageToast(ABVExceptionCode.S_E_ACMS_INVALID_RESPONSE);
break;
default:
Logger.e(TAG, "Exception DataRefresh", e);
handleErrorMessageToast(ErrorCode.E107);
break;
}
throw e;
} catch (Exception e) {
stopUpdateAnimation();
if (startRefresh) {
......
......@@ -54,6 +54,7 @@ public enum ErrorCode {
L121(R.string.L121),
L122(R.string.L122),
L124(R.string.L124),
L125(R.string.L125),
C_E_SYSTEM_0001(R.string.C_E_SYSTEM_0001),
C_E_SYSTEM_0002(R.string.C_E_SYSTEM_0002),
......
......@@ -133,17 +133,6 @@ public class OperationListActivity extends ABVUIActivity {
private TextView mEndDate; // 検索画面の作業終了日
private Dialog mSearchDialog;
private Date mOperationLastEditDate;
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
private OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
private OperationGroupMasterLogic mOperationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
private PushMessageLogic mPushMessageLogic = AbstractLogic.getLogic(PushMessageLogic.class);
private TaskDao mTaskDao = AbstractDao.getDao(TaskDao.class);
private boolean activityResultFlg;
......@@ -922,6 +911,7 @@ public class OperationListActivity extends ABVUIActivity {
* @param buttonEventFlag
* @return result errorMessage
*/
@Override
public String syncOperation(final long operationId, int reportType, boolean buttonEventFlag) {
final StringBuilder errorMsg = new StringBuilder();
Logger.i(TAG, "---sync start");
......@@ -1082,6 +1072,7 @@ public class OperationListActivity extends ABVUIActivity {
* @throws NoSuchAlgorithmException
* @throws ZipException
*/
@Override
public Date receptionTaskData(long operationId, Callback progressCallback, StringBuilder errorMsg) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
GetOperationDataParameters param = new GetOperationDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId);
OperationDto operationDto = mOperationLogic.getOperation(operationId);
......@@ -1216,80 +1207,9 @@ public class OperationListActivity extends ABVUIActivity {
return lastEditDate;
}
/**
* 添付ファイルが存在する場合、取得して解凍する。
* @param operationId
* @param taskReportLevel
* @param contentId
* @param taskId
* @param taskKey
* @param attachedFileName
* @param processKey 固定キー
* @param phaseNo 固定NO
* @throws ABVException
* @throws InterruptedException
* @throws ZipException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public void refreshTaskFile(final long operationId, final int taskReportLevel, long contentId,
final long taskId, final String taskKey, final String attachedFileName,
final String processKey, final Integer phaseNo) throws Exception {
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey, taskReportLevel);
if (attachedFileName != null && !attachedFileName.equals(reportLocalAttachedFileName)) {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, attachedFileName);
// #32926 start
String saveAttacedFilePath = ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel);
if (processKey != null && phaseNo != 0) {
saveAttacedFilePath = ABVEnvironment.getInstance().getOperationDirectionOrContinuousReportDirPath(operationId, taskKey, taskReportLevel, processKey, phaseNo);
}
FileUtil.delete(saveAttacedFilePath);
// #32926 end
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, attachedFileName, taskReportLevel);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, saveAttacedFilePath,null, true);
}
}
/**
* 定期点検用ファイル更新
* @param operationId
* @param contentId
* @param taskId
* @param taskKey
* @param taskReportId
* @param reportStartDate
* @param reportAttachedFileName
* @throws ABVException
* @throws InterruptedException
* @throws ZipException
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public void refreshRoutineTaskFile(final long operationId, final long contentId, final long taskId, final String taskKey, final int taskReportId, final int taskReportInfoId, final Date reportStartDate, final String reportAttachedFileName) throws Exception {
String reportStartDateHypn = DateTimeUtil.toString(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
final String reportStartDateNone = DateTimeUtil.toString_yyyyMMddHHmmss_none(reportStartDate);
// 既存の添付ディレクトリ削除
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
String reportLocalAttachedFileName = mTaskReportDao.getRoutineTaskReportAttachedFileName(taskKey, taskReportId, reportStartDateHypn);
boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName);
if (getReportFileFlg) {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName);
// #32926 start
int taskReportLevel = 0;
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone));
// #32926 end
String outputFilePath = mOperationLogic.getRoutineTaskReportFile(operationId, taskKey, taskId, taskReportId, taskReportInfoId, reportStartDateNone, reportAttachedFileName);
// #32926 start
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone), null, true);
// #32926 end
}
}
/**
* 360コンテンツ登録ダイアログ
......@@ -1373,47 +1293,6 @@ public class OperationListActivity extends ABVUIActivity {
}
/**
* listDtoの中に第2引数のdtoが存在するかチェックメソッド
* @param listDto リストDto
* @param dto ターゲットDto
* @return
*/
private boolean isExistsTaskInList(List<TaskDto> listDto, TaskDto dto) {
for (TaskDto lDto : listDto) {
if (lDto.taskKey.equals(dto.taskKey)) {
return true;
}
}
return false;
}
/**
* 報告存在チェック
* @param listDto
* @param rDto
* @return
*/
private boolean isExistsTaskReportInList(List<TaskReportDto> listDto, TaskReportDto rDto, boolean isRoutineTask) {
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;
}
}
}
return false;
}
/**
* 作業報告画面に移動
* @param operationDto
*/
......
......@@ -4957,7 +4957,7 @@ public class ContentViewActivity extends ABVContentViewActivity {
// 空き容量が足りない
handleErrorMessageToast(ErrorCode.STORAGE_ERROR);
} else {
handleErrorMessageToast(ErrorCode.L120);
handleErrorMessageToast(ErrorCode.L125);
}
}
});
......
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