Commit b46fc80c by Kazuyuki Hida

割り込みの仕事が入ったので、いったんコミット

parent bca9e56d
......@@ -20,6 +20,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.CategoriesJSON;
import jp.agentec.abook.abv.bl.acms.client.json.ContentCheckDeliverableJSON;
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.LockReportJSON;
import jp.agentec.abook.abv.bl.acms.client.json.LogSendFlagJSON;
import jp.agentec.abook.abv.bl.acms.client.json.MasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.NewAppStoreLoginJSON;
......@@ -32,6 +33,7 @@ import jp.agentec.abook.abv.bl.acms.client.json.FixPushMessageJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationListJSON;
import jp.agentec.abook.abv.bl.acms.client.json.SceneEntryJSON;
import jp.agentec.abook.abv.bl.acms.client.json.UnlockReportJSON;
import jp.agentec.abook.abv.bl.acms.client.json.WorkerGroupJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.AbstractAcmsLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.AcmsContentParameters;
......@@ -47,11 +49,13 @@ 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;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetTaskFileParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.NewAppStoreLoginParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PasswordChangeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.PostEnqueteReplyParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.SendPushMessageParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.ServerTimeParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UpdateDeviceTokenParameters;
import jp.agentec.abook.abv.bl.acms.type.AcmsApis;
import jp.agentec.abook.abv.bl.acms.type.LoginStatus;
......@@ -719,6 +723,18 @@ public class AcmsClient implements AcmsClientResponseListener {
return json;
}
public LockReportJSON sendLockReport(LockReportParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiLockReport, param);
String json = response.httpResponseBody;
return new LockReportJSON(json);
}
public UnlockReportJSON sendUnlockReport(UnlockReportParameters param) throws NetworkDisconnectedException, AcmsException {
HttpResponse response = send(AcmsApis.ApiUnlockReport, param);
String json = response.httpResponseBody;
return new UnlockReportJSON(json);
}
/**********************************************************************************************/
/** 以下、共用メソッド---------------------------------------------------------------------- **/
/**********************************************************************************************/
......@@ -922,7 +938,9 @@ public class AcmsClient implements AcmsClientResponseListener {
AcmsApis.ApiUrlNewAppStoreLogin,
AcmsApis.ApiUrlAppStoreNewLogin,
AcmsApis.ApiGetPushMessages,
AcmsApis.ApiSendPushMessage
AcmsApis.ApiSendPushMessage,
AcmsApis.ApiLockReport,
AcmsApis.ApiUnlockReport
};
public HttpTaskWorker(String methodName, String apiUrl, T param) {
......
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONObject;
import java.util.Date;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/**
* checkapi/lockReport/のレスポンスを変換するクラス
*/
public class LockReportJSON extends AcmsCommonJSON {
private Date presentTimeUTC;
private int reportStatus;
private String reportLockUserId;
private String reportLockUserName;
private Date reportLockTime;
public LockReportJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) {
presentTimeUTC = dateOrNull(json, "presentTimeUTC");
reportStatus = intOrDef(json, "reportStatus", 999);
reportLockUserId = stringOrNull(json, "reportLockUserId");
reportLockUserName = stringOrNull(json, "reportLockUserName");
reportLockTime = dateOrNull(json, "reportLockTime");
}
int getHttpStatus() {
return httpStatus;
}
Date getPresentTime() {
return presentTime;
}
public Date getPresentTimeUTC() {
return presentTimeUTC;
}
public int getReportStatus() {
return reportStatus;
}
public String getReportLockUserId() {
return reportLockUserId;
}
public String getReportLockUserName() {
return reportLockUserName;
}
public Date getReportLockTime() {
return reportLockTime;
}
private int intOrDef(JSONObject json, String key, int def) {
if (json.has(key)) {
return json.getInt(key);
} else {
return def;
}
}
private String stringOrNull(JSONObject json, String key) {
if (json.has(key)) {
return json.getString(key);
} else {
return null;
}
}
private Date dateOrNull(JSONObject json, String key) {
if (json.has(key)) {
return DateTimeUtil.toDate(json.getString(key), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} else {
return null;
}
}
}
package jp.agentec.abook.abv.bl.acms.client.json;
import org.json.adf.JSONObject;
import java.util.Date;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class UnlockReportJSON extends AcmsCommonJSON {
private Date presentTimeUTC;
public UnlockReportJSON(String jsonString) throws AcmsException {
super(jsonString);
}
@Override
protected void parse(JSONObject json) {
presentTimeUTC = dateOrNull(json, "presentTimeUTC");
}
int getHttpStatus() {
return httpStatus;
}
Date getPresentTime() {
return presentTime;
}
Date getPresentTimeUTC() {
return presentTimeUTC;
}
private Date dateOrNull(JSONObject json, String key) {
if (json.has(key)) {
return DateTimeUtil.toDate(json.getString(key), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} else {
return null;
}
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.util.Date;
/**
* checkapi/lockReport/のリクエストに使うパラメータ
*/
public class LockReportParameters extends AcmsParameters {
private String sid;
private String taskKey;
private Long taskReportId;
private Date reportStartDate;
private String userId;
private String userName;
public LockReportParameters(
String sid,
String taskKey,
Long taskReportId,
Date reportStartDate,
String userId,
String userName
) {
super(sid);
this.taskKey = taskKey;
this.taskReportId = taskReportId;
this.reportStartDate = reportStartDate;
this.userId = userId;
this.userName = userName;
}
public String getTaskKey() {
return taskKey;
}
public Long getTaskReportId() {
return taskReportId;
}
public Date getReportStartDate() {
return reportStartDate;
}
public String getUserId() {
return userId;
}
public String getUserName() {
return userName;
}
}
package jp.agentec.abook.abv.bl.acms.client.parameters;
import java.util.Date;
/**
* checkapi/unlockReport/のリクエストに使うパラメータ
*/
public class UnlockReportParameters extends AcmsParameters {
private String taskKey;
private Long taskReportId;
private Date reportStartDate;
public UnlockReportParameters(
String sid,
String taskKey,
Long taskReportId,
Date reportStartDate
) {
super(sid);
this.taskKey = taskKey;
this.taskReportId = taskReportId;
this.reportStartDate = reportStartDate;
}
String getTaskKey() {
return taskKey;
}
Long getTaskReportId() {
return taskReportId;
}
Date getReportStartDate() {
return reportStartDate;
}
}
......@@ -160,6 +160,11 @@ public class AcmsApis {
public static final String ApiQuickReportSearch = "quickReportSearch";
// 簡易帳票リビジョン一覧取得
public static final String ApiQuickReportRevision = "quickReportRevision";
// 報告・点検のロック
public static final String ApiLockReport = "lockReport";
// 報告・点検のロック解除
public static final String ApiUnlockReport = "unlockReport";
// download
/**
* コンテンツのZIPファイルを取得<br>
......@@ -182,6 +187,7 @@ public class AcmsApis {
public static final String GetTaskFileUrlFormat = "%s/%s/checkapi/getTaskFile";
/**
* APIのURLを完成します。
* @param host ACMSのFQDNです。
......
......@@ -34,6 +34,8 @@ public class ABookKeys {
public static final String CMD_MOVE_PAGE = "movePage";
public static final String CMD_SHOW_RELATED_CONTENT = "showRelatedContent";
public static final String CMD_PAGE_NUM = "pageNum";
public static final String CMD_LOCK_REPORT = "lockReport";
public static final String CMD_UNLOCK_REPORT = "unlockReport";
public static final String GPS_TYPE = "gpsType";
public static final String STATUS_CODE = "statusCode";
......
package jp.agentec.abook.abv.bl.logic;
import jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters;
public class LockReportLogic extends AbstractLogic {
public static LockReportLogic newInstance() {
return new LockReportLogic();
}
public void lock(LockReportParameters param) {
}
public void unlock(UnlockReportParameters param) {
}
}
......@@ -19,15 +19,19 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.parameters.LockReportParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.UnlockReportParameters;
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.ABookKeys;
import jp.agentec.abook.abv.bl.common.exception.ABVException;
import jp.agentec.abook.abv.bl.common.exception.ABVExceptionCode;
import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.common.nw.NetworkAdapter;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.dto.OperationTaskDto;
import jp.agentec.abook.abv.bl.dto.TaskDto;
......@@ -37,7 +41,6 @@ import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.abook.abv.launcher.android.R;
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.constant.ErrorCode;
import jp.agentec.abook.abv.ui.common.constant.ErrorMessage;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
......@@ -70,15 +73,15 @@ public class ABookCheckWebViewHelper extends ABookHelper {
* parameterによって処理を分ける
*
* @param context ABVContentViewActivity
* @param cmd
* @param cmd コマンド
* @param taskKey タスクキー
* @param enableReportHistory
* @param param
* @param enableReportHistory 履歴を残すかどうか
* @param param パラメータ
* @param operationId プロジェクトID
* @param contentPath
* @param reportType
* @param finishCallback
* @param taskReportLevel
* @param contentPath 添付資料のパス
* @param reportType 報告タイプ
* @param finishCallback 最後に呼ぶコールバック
* @param taskReportLevel 作業の報告レベル
*/
public void doABookCheckParam(ABVContentViewActivity context, String cmd, String taskKey, int enableReportHistory, Map<String, String> param, long operationId, String contentPath, long contentId, int reportType, Callback finishCallback, int taskReportLevel) throws IOException {
int taskReportSendId = 0;
......@@ -139,6 +142,12 @@ public class ABookCheckWebViewHelper extends ABookHelper {
FileUtil.delete(ABVEnvironment.getInstance().getTempTaskDirPath(contentId, taskKey));
mFinishCallback.callback(false);
break;
case ABookKeys.CMD_LOCK_REPORT:
sendLockReport(param);
break;
case ABookKeys.CMD_UNLOCK_REPORT:
sendUnlockReport(param);
break;
}
}
......@@ -550,4 +559,88 @@ public class ABookCheckWebViewHelper extends ABookHelper {
return rotationAngle;
}
private void sendLockReport(Map<String, String> param) {
sendLockReport(
param.get("sid"),
param.get("taskKey"),
longOrNull(param.get("taskReportId")),
dateOrNull(param.get("reportStartDate")),
param.get("userId"),
param.get("userName")
);
}
private void sendLockReport(
String sid,
String taskKey,
Long taskReportId,
Date reportStartDate,
String userId,
String userName
) {
ABVDataCache cache = ABVDataCache.getInstance();
NetworkAdapter adapter = ABVEnvironment.getInstance().networkAdapter;
AcmsClient client = AcmsClient.getInstance(cache.getUrlPath(), adapter);
LockReportParameters param = new LockReportParameters(
sid,
taskKey,
taskReportId,
reportStartDate,
userId,
userName
);
try {
client.sendLockReport(param);
} catch (Exception e) {
// todo
}
}
private void sendUnlockReport(Map<String, String> param) {
sendUnlockReport(
param.get("sid"),
param.get("taskKey"),
longOrNull(param.get("taskReportId")),
dateOrNull(param.get("reportStartDate"))
);
}
private void sendUnlockReport(
String sid,
String taskKey,
Long taskReportId,
Date reportStartDate
) {
ABVDataCache cache = ABVDataCache.getInstance();
NetworkAdapter adapter = ABVEnvironment.getInstance().networkAdapter;
AcmsClient client = AcmsClient.getInstance(cache.getUrlPath(), adapter);
UnlockReportParameters param = new UnlockReportParameters(
sid,
taskKey,
taskReportId,
reportStartDate
);
try {
client.sendUnlockReport(param);
} catch (Exception e) {
// todo
}
}
private Long longOrNull(String s) {
try {
return Long.valueOf(s);
} catch (Exception e) {
return null;
}
}
private Date dateOrNull(String s) {
try {
return DateTimeUtil.toDate(s, "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} catch (Exception e) {
return null;
}
}
}
......@@ -39,8 +39,10 @@ app_versioncode=1
#cms server
#acms_address=https://check.abookcloud.com/acms
#download_server_address=https://check.abookcloud.com/acms
acms_address=https://abook188-1.abook.bz/acms
download_server_address=https://abook188-1.abook.bz/acms
#acms_address=https://abook188-1.abook.bz/acms
#download_server_address=https://abook188-1.abook.bz/acms
acms_address=http://10.0.2.2:8080/acms
download_server_address=http://10.0.2.2:8080/acms
#syncview server
websocket_server_http_url=https://abook188-1.abook.bz/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