refactor(network): 移除设备认证和登录相关API接口
- 注释掉设备获取token的API接口和服务端点 - 移除设备信息查询相关的API接口和服务端点 - 删除登录功能的API接口和服务端点 - 移除部分收货功能的API接口和服务端点 - 注释掉添加物品采购单位的API接口和服务端点 - 相应移除ViewModel中的设备认证和登录逻辑 - 删除Repository中对应的网络请求方法
This commit is contained in:
@@ -39,31 +39,30 @@ interface ApiService {
|
|||||||
/**
|
/**
|
||||||
* device获取token
|
* device获取token
|
||||||
*/
|
*/
|
||||||
@GET("sys/getEquipmentToken")
|
// @GET("sys/getEquipmentToken")
|
||||||
suspend fun getDeviceToken(
|
// suspend fun getDeviceToken(
|
||||||
@Query("qrcodeId") qrcodeId: String,
|
// @Query("qrcodeId") qrcodeId: String,
|
||||||
@Query("appVersion") appVersion: String = GlobalData.appVersion
|
// @Query("appVersion") appVersion: String = GlobalData.appVersion
|
||||||
): ApiResponse<String>
|
// ): ApiResponse<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*获取配置信息
|
*获取配置信息
|
||||||
*/
|
*/
|
||||||
@GET("equipment/stEquipment/queryByEquipmentCode")
|
// @GET("equipment/stEquipment/queryByEquipmentCode")
|
||||||
suspend fun getDeviceInfo(
|
// suspend fun getDeviceInfo(
|
||||||
@Query("equipmentCode") equipmentCode: String,
|
// @Query("equipmentCode") equipmentCode: String,
|
||||||
@Query("appVersion") appVersion: String = GlobalData.appVersion,
|
// @Query("appVersion") appVersion: String = GlobalData.appVersion,
|
||||||
@Header("X-Access-Token") token: String
|
// @Header("X-Access-Token") token: String
|
||||||
): ApiResponse<EquipmentInfo>
|
// ): ApiResponse<EquipmentInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*/
|
*/
|
||||||
@POST//("sys/loginPad")
|
// @POST//("sys/loginPad")
|
||||||
suspend fun login(
|
// suspend fun login(
|
||||||
@Url url: String = "${GlobalData.appBaseUrl}/sys/loginPad",
|
// @Url url: String = "${GlobalData.appBaseUrl}/sys/loginPad",
|
||||||
@Body body: LoginParam,
|
// @Body body: LoginParam,
|
||||||
|
// ): ApiResponse<User>
|
||||||
): ApiResponse<User>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购单入库-列表
|
* 采购单入库-列表
|
||||||
@@ -94,11 +93,11 @@ interface ApiService {
|
|||||||
/**
|
/**
|
||||||
* 部分收货
|
* 部分收货
|
||||||
*/
|
*/
|
||||||
@POST//("pad/partialReceiptGoods")
|
// @POST//("pad/partialReceiptGoods")
|
||||||
suspend fun partialReceipt(
|
// suspend fun partialReceipt(
|
||||||
@Url url: String = "${GlobalData.appBaseUrl}${apiPrefix}/pad/partialReceiptGoods",
|
// @Url url: String = "${GlobalData.appBaseUrl}${apiPrefix}/pad/partialReceiptGoods",
|
||||||
@Body uploadInfo: UploadInfo
|
// @Body uploadInfo: UploadInfo
|
||||||
): ApiResponse<Boolean>
|
// ): ApiResponse<Boolean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认收货
|
* 确认收货
|
||||||
@@ -195,11 +194,11 @@ interface ApiService {
|
|||||||
/**
|
/**
|
||||||
* 添加物品采购单位
|
* 添加物品采购单位
|
||||||
*/
|
*/
|
||||||
@POST//("pad/goodsAddUnit")
|
// @POST//("pad/goodsAddUnit")
|
||||||
suspend fun goodsAddUnit(
|
// suspend fun goodsAddUnit(
|
||||||
@Url url: String = "${GlobalData.appBaseUrl}${apiPrefix}/pad/goodsAddUnit",
|
// @Url url: String = "${GlobalData.appBaseUrl}${apiPrefix}/pad/goodsAddUnit",
|
||||||
@Body purchaseUnitParam: GoodsPurchaseUnitParam,
|
// @Body purchaseUnitParam: GoodsPurchaseUnitParam,
|
||||||
): ApiResponse<Boolean>
|
// ): ApiResponse<Boolean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自采入库
|
* 自采入库
|
||||||
|
|||||||
@@ -38,29 +38,29 @@ class RemoteRepository @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 生成token
|
* 生成token
|
||||||
*/
|
*/
|
||||||
suspend fun getDeviceToken(qrcodeId: String): ApiResponse<String> {
|
// suspend fun getDeviceToken(qrcodeId: String): ApiResponse<String> {
|
||||||
return safeApiCall {
|
// return safeApiCall {
|
||||||
apiService.getDeviceToken(
|
// apiService.getDeviceToken(
|
||||||
qrcodeId
|
// qrcodeId
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设备信息
|
* 获取设备信息
|
||||||
*/
|
*/
|
||||||
suspend fun getDeviceInfo(equipmentCode: String, token: String): ApiResponse<EquipmentInfo> {
|
// suspend fun getDeviceInfo(equipmentCode: String, token: String): ApiResponse<EquipmentInfo> {
|
||||||
return safeApiCall {
|
// return safeApiCall {
|
||||||
apiService.getDeviceInfo(
|
// apiService.getDeviceInfo(
|
||||||
equipmentCode = equipmentCode,
|
// equipmentCode = equipmentCode,
|
||||||
token = token
|
// token = token
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
suspend fun login(loginParam: LoginParam): ApiResponse<User> {
|
// suspend fun login(loginParam: LoginParam): ApiResponse<User> {
|
||||||
return safeApiCall { apiService.login(body = loginParam) }
|
// return safeApiCall { apiService.login(body = loginParam) }
|
||||||
}
|
// }
|
||||||
|
|
||||||
suspend fun getReceiveList(pageNum: Int, pageSize: Int): ApiResponse<List<SupplierInfo>?> {
|
suspend fun getReceiveList(pageNum: Int, pageSize: Int): ApiResponse<List<SupplierInfo>?> {
|
||||||
return safeApiCall {
|
return safeApiCall {
|
||||||
@@ -153,11 +153,11 @@ class RemoteRepository @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 部分收货
|
* 部分收货
|
||||||
*/
|
*/
|
||||||
suspend fun partialReceipt(uploadInfo: UploadInfo): ApiResponse<Boolean> {
|
// suspend fun partialReceipt(uploadInfo: UploadInfo): ApiResponse<Boolean> {
|
||||||
return safeApiCall {
|
// return safeApiCall {
|
||||||
apiService.partialReceipt(uploadInfo = uploadInfo)
|
// apiService.partialReceipt(uploadInfo = uploadInfo)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全部收货
|
* 全部收货
|
||||||
@@ -198,11 +198,11 @@ class RemoteRepository @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun selfPurchaseGoodsAddUnit(addParam: GoodsPurchaseUnitParam): ApiResponse<Boolean> {
|
// suspend fun selfPurchaseGoodsAddUnit(addParam: GoodsPurchaseUnitParam): ApiResponse<Boolean> {
|
||||||
return safeApiCall {
|
// return safeApiCall {
|
||||||
apiService.goodsAddUnit(purchaseUnitParam = addParam)
|
// apiService.goodsAddUnit(purchaseUnitParam = addParam)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自采购-入库
|
* 自采购-入库
|
||||||
|
|||||||
@@ -27,29 +27,29 @@ class DeviceViewModel @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 获取token
|
* 获取token
|
||||||
*/
|
*/
|
||||||
fun getDeviceToken(deviceId: String = GlobalData.deviceId) {
|
// fun getDeviceToken(deviceId: String = GlobalData.deviceId) {
|
||||||
launchWithLoading {
|
// launchWithLoading {
|
||||||
val response = repository.getDeviceToken(deviceId)
|
// val response = repository.getDeviceToken(deviceId)
|
||||||
if (parseResponse(response)) {
|
// if (parseResponse(response)) {
|
||||||
val response1 = repository.getDeviceInfo(deviceId, response.result!!)
|
// val response1 = repository.getDeviceInfo(deviceId, response.result!!)
|
||||||
|
//
|
||||||
if (parseResponse(response1)) {
|
// if (parseResponse(response1)) {
|
||||||
val equipmentInfo = response1.result
|
// val equipmentInfo = response1.result
|
||||||
if (equipmentInfo == null) return@launchWithLoading
|
// if (equipmentInfo == null) return@launchWithLoading
|
||||||
try {
|
// try {
|
||||||
parseEquipmentInfo(equipmentInfo)
|
// parseEquipmentInfo(equipmentInfo)
|
||||||
SPUtil.getInstance()
|
// SPUtil.getInstance()
|
||||||
.put(GlobalKey.KEY_EQUIPMENT_INFO, GsonUtils.toJson(equipmentInfo))
|
// .put(GlobalKey.KEY_EQUIPMENT_INFO, GsonUtils.toJson(equipmentInfo))
|
||||||
_deviceInfoResult.value = true
|
// _deviceInfoResult.value = true
|
||||||
} catch (e: Exception) {
|
// } catch (e: Exception) {
|
||||||
Timber.e(e)
|
// Timber.e(e)
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
//ToastUtils.showToast("获取设备信息失败")
|
// //ToastUtils.showToast("获取设备信息失败")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查缓存数据
|
* 检查缓存数据
|
||||||
|
|||||||
@@ -39,16 +39,16 @@ class UserViewModel @Inject constructor(
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun login(userName: String, password: String) = launchWithLoading {
|
// fun login(userName: String, password: String) = launchWithLoading {
|
||||||
val loginParam = LoginParam(userName = userName, password = password)
|
// val loginParam = LoginParam(userName = userName, password = password)
|
||||||
val response = repo.login(loginParam)
|
// val response = repo.login(loginParam)
|
||||||
if (parseResponse(response)) {
|
// if (parseResponse(response)) {
|
||||||
SPUtil.getInstance().put(GlobalKey.KEY_USER_NAME, userName)
|
// SPUtil.getInstance().put(GlobalKey.KEY_USER_NAME, userName)
|
||||||
_user.value = response.result
|
// _user.value = response.result
|
||||||
saveToken(response.result)
|
// saveToken(response.result)
|
||||||
response.result?.token
|
// response.result?.token
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fun getUserInfo() {
|
fun getUserInfo() {
|
||||||
val userInfo = SPUtil.getInstance().get(GlobalKey.KEY_USER_INFO, "")
|
val userInfo = SPUtil.getInstance().get(GlobalKey.KEY_USER_INFO, "")
|
||||||
|
|||||||
Reference in New Issue
Block a user