Commit 07fe9846 by Jeong Gilmo

#33721 絞り検索のAPIとの連携

 - 絞り検索のマスタデータを受信
 - 受信したデータをJSONファイルの生成
parent bee3942e
......@@ -22,6 +22,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.ContentVersionsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.GroupsJSON;
import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.RequirePasswordChangeJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ResultJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ServerTimeZoneJSON;
......@@ -41,6 +42,7 @@ import jp.agentec.abook.abv.bl.acms.client.parameters.ContentReadingLogParameter
import jp.agentec.abook.abv.bl.acms.client.parameters.EnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.EnterpriseNewLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetContentParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetEnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
......@@ -963,4 +965,17 @@ public class AcmsClient implements AcmsClientResponseListener {
}
}
}
/**
* ACMSから、絞り検索マスタデータ情報を取得します。
* @param param {@link AcmsParameters} オブジェクトです。
* @return 絞り検索マスタデータを格納したリストを返します。
* @throws NetworkDisconnectedException
* @throws AcmsException
*/
public ApertureMasterDataJSON getApertureMasterData(GetApertureMasterDataParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiGetApertureMasterData, param);
ApertureMasterDataJSON json = new ApertureMasterDataJSON(response.httpResponseBody);
return json;
}
}
package jp.agentec.abook.abv.bl.acms.client.json;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.WorkerGroupDto;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import org.json.adf.JSONArray;
import org.json.adf.JSONObject;
/**
* {@link AcmsClient#contentVersion} の戻り値です。
* @author Taejin Hong
* @version 1.0.0
*/
public class ApertureMasterDataJSON extends AcmsCommonJSON {
public static final String operationLastEditDate = "operationLastEditDate";
public static final String ApertureData = "apertureData";
public Date lastEditDate;
public JSONObject apertureJson;
public ApertureMasterDataJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) throws JSONValidationException {
// 絞り検索の日付を取得
if(json.has(operationLastEditDate)) {
lastEditDate = DateTimeUtil.toDate(json.getString(operationLastEditDate), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
// 絞り検索のデータを取得
if (json.has(ApertureData)) {
JSONArray apertureList = json.getJSONArray(ApertureData);
for (int i = 0; i < apertureList.length(); i++) {
apertureJson = apertureList.getJSONObject(i);json.getJSONArray(ApertureData);
Logger.e(apertureJson.toString());
}
}
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
/**
* Created by leej on 2018/09/10.
*/
public class GetApertureMasterDataParameters extends AcmsParameters {
private long operationId;
public GetApertureMasterDataParameters(String sid, long operationId) {
super(sid);
this.operationId = operationId;
}
public long getOperationId() {
return operationId;
}
}
\ No newline at end of file
......@@ -153,6 +153,8 @@ public class AcmsApis {
// 定期点検データ送信
public static final String ApiSendRoutineTaskData = "routineTaskData";
// 絞り検索マスタデータ取得
public static final String ApiGetApertureMasterData = "getApertureMasterData";
// download
/**
......@@ -196,7 +198,8 @@ 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(ApiSendRoutineTaskData)) {
methodName.equals(ApiSendPushMessage) || methodName.equals(ApiGetPushMessages) || methodName.equals(ApiSendRoutineTaskData) ||
methodName.equals(ApiGetApertureMasterData)) { // 絞り検索マスタデータ取得のAPI
apiValue = Constant.ApiValue.checkapi;
}
......
......@@ -39,6 +39,10 @@ public class ABVDataCache {
private Date lastPresentTime = DateTimeUtil.getCurrentDate(); // 最後の通信時に取得したサーバの時間
private static final int SEVER_ALERT_INTERVAL = 30; //システム日付チェック前後期間(分)
// Serverから取得したapertureMasterDataのfetchDateを一時的に保存するための変数
public String tempApertureMasterDataFetchDate = null;
/**
* 未指定ジャンルのID
* @since 1.0.0
......@@ -233,6 +237,8 @@ public class ABVDataCache {
defaultCategoryId = -1;
defaultGroupId = -1;
urlPath = null;
// 絞り検索の取得日付を初期化
tempApertureMasterDataFetchDate = null;
}
public void setLastPresentTime(Date lasttime) {
......
......@@ -1597,4 +1597,22 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.insert(taskDto);
}
}
/**
* 絞り検索のjsonファイル
* apertureMaster.jsonを作成
*
* @param json
* @param contentPath
* @throws IOException
*/
public void createJsonForApertureData(JSONObject json, String contentPath) throws IOException {
try {
FileUtil.createFile(contentPath + "/apertureMaster.json", json.toString());
} catch (IOException e) {
Logger.e(TAG, "createJsonForapertureMaster error : ", e);
throw e;
}
}
}
......@@ -8,7 +8,10 @@ import android.support.multidex.MultiDexApplication;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.cl.helper.ABVUncaughtExceptionHandler;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
import jp.agentec.abook.abv.ui.common.util.Initializer;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.FileUtil;
......@@ -49,6 +52,9 @@ public class ABVApplication extends MultiDexApplication {
//添付ファイル臨時保存場所削除
FileUtil.delete(ABVEnvironment.getInstance().getCacheTempAttachedImageDirPath());
// 絞り検索のfetchDateをローカルに保存された値を取得して設定する
ABVDataCache.getInstance().tempApertureMasterDataFetchDate = PreferenceUtil.getUserPref(this, AppDefType.UserPrefKey.APERTURE_MASTER_DATA_FETCH_DATE, null);
}
@Override
......
......@@ -56,6 +56,8 @@ public interface AppDefType {
String OPERATION_REPORT_TYPES = "operationReportTypes";
String RESOURCE_PATTERN_TYPE = "resourcePatternType"; // 文言リソースパターン
String APERTURE_MASTER_DATA_FETCH_DATE = "apertureMasterDataFetchDate"; // 絞り検索マスタデータのFetchDate
}
/**
......
......@@ -55,7 +55,9 @@ import java.util.Date;
import java.util.List;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters;
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.OperationType;
......@@ -185,6 +187,9 @@ public class OperationListActivity extends ABVUIActivity {
private ArrayList<Integer> mAllOperationReportTypes;
// 絞り検索マスタデータ
private Date mApertureLastEditDate;
// ビューの作成
private class ReloadHandler implements Runnable {
@Override
......@@ -632,6 +637,9 @@ public class OperationListActivity extends ABVUIActivity {
mOperationLogic.createJsonForOpenABookCheckPano(operationDto.operationId, operationDto.contentId, contentPath);
mOperationLogic.createJsonForOperationContent(operationDto.operationId, contentPath, operationDto.reportType == ReportType.RoutineTask);
// 絞り検索マスタデータを受信、JSONファイルを生成
mApertureLastEditDate = receptionApertureMasterData(operationDto.operationId, contentPath);
// サーバ作業後、対応必要
StringBuffer path = new StringBuffer();
path.append(contentPath);
......@@ -1912,4 +1920,30 @@ public class OperationListActivity extends ABVUIActivity {
imgBtn.setImageDrawable(getRDrawable(R.drawable.ic_filter_selected));
}
}
/**
* 絞り検索マスタデータの受信
* @param operationId
* @return
* @throws NetworkDisconnectedException
* @throws ABVException
* @throws IOException
* @throws InterruptedException
* @throws NoSuchAlgorithmException
* @throws ZipException
*/
public Date receptionApertureMasterData(long operationId, String contentPath) throws NetworkDisconnectedException, ABVException, IOException {
// 絞り検索のためparamを設定
GetApertureMasterDataParameters param = new GetApertureMasterDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId);
// 絞り検索した日付の保存
Date lastEditDate;
// JSONデータのparsing
ApertureMasterDataJSON json = AcmsClient.getInstance(ABVDataCache.getInstance().getUrlPath(), ABVEnvironment.getInstance().networkAdapter).getApertureMasterData(param);
// JSONファイルを生成
mOperationLogic.createJsonForApertureData(json.apertureJson, contentPath);
// 絞り検索した日付を取得
lastEditDate = json.lastEditDate;
return lastEditDate;
}
}
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