Commit 449adba4 authored by 赵鹏翔's avatar 赵鹏翔

类位置整理并调整

parent 33fe602c
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
apply from: '../versions.gradle'
......@@ -68,6 +69,8 @@ android {
dependencies {
implementation project(':lib_common')
kapt 'androidx.room:room-compiler:2.4.0'
implementation 'androidx.room:room-runtime:2.4.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.github.GrenderG:Toasty:1.5.2'
......
package com.miya.fastcashier.beans
import com.google.gson.annotations.SerializedName
data class LoginRequest(@SerializedName("username") val username: String,
@SerializedName("password") val password: String,
@SerializedName("serialNo") val serialNo: String)
package com.miya.fastcashier.dao
import androidx.room.*
import com.miya.fastcashier.beans.ViewPayOrderData
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
@Dao
......
......@@ -2,20 +2,17 @@ package com.miya.fastcashier.dao
import androidx.room.Database
import androidx.room.RoomDatabase
import com.miya.fastcashier.beans.ViewPayOrderData
import androidx.room.Room
import com.miya.fastcashier.utils.ContextUtils
import androidx.sqlite.db.SupportSQLiteDatabase
import androidx.room.migration.Migration
@Database(entities = [ViewPayOrderData::class], exportSchema = false, version = 2)
abstract class PayDatabase : RoomDatabase() {
abstract fun payDataDao(): PayDataDao
}
class DatabaseKeeper {
companion object {
......
package com.miya.fastcashier.beans
package com.miya.fastcashier.dao
import android.text.TextUtils
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.fastcashier.lib_common.util.isEmpty
import com.miya.fastcashier.dao.DatabaseKeeper
import com.miya.fastcashier.service.AccountService
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import java.lang.RuntimeException
......
......@@ -18,8 +18,7 @@ import com.blankj.utilcode.util.StringUtils;
import com.fastcashier.lib_common.BuildConfig;
import com.fastcashier.lib_common.net.CommonCallback;
import com.miya.fastcashier.R;
import com.miya.fastcashier.beans.SelfCashierTerminalConfig;
import com.miya.fastcashier.net.ApiConfig;
import com.miya.fastcashier.net.bean.SelfCashierTerminalConfig;
import com.miya.fastcashier.net.ApiRequest;
import com.miya.fastcashier.net.ApiService;
import com.miya.fastcashier.service.AccountService;
......@@ -269,7 +268,7 @@ public class LFilePickerActivity extends BaseActivity {
File file = new File(path);
RequestBody requestBody = RequestBody.create(MediaType.parse(""), file);
MultipartBody.Part part = MultipartBody.Part.createFormData("logFile", file.getName(), requestBody);
String ip = ApiConfig.INSTANCE.getDataSourceIp(selfCashierTerminalConfig, equType);
String ip = ApiRequest.Companion.getInstance().getDataSourceIp(selfCashierTerminalConfig, equType);
if (!TextUtils.isEmpty(selfCashierTerminalConfig.getScoRuntimeConfig().getPlatformUrl())) {
ip = selfCashierTerminalConfig.getScoRuntimeConfig().getPlatformUrl()
+ ApiService.Companion.getUPLOAD_LOG_FILE();
......
......@@ -7,12 +7,12 @@ import android.view.View
import android.view.WindowManager
import android.widget.TextView
import com.fastcashier.lib_common.BuildConfig
import com.fastcashier.lib_common.net.ApiConfig.baseUrl
import com.fastcashier.lib_common.util.getVersion
import com.fastcashier.lib_common.util.getVersionCode
import com.fastcashier.lib_common.util.getWifyName
import com.miya.fastcashier.R
import com.miya.fastcashier.databinding.DialogSystemParameterBinding
import com.miya.fastcashier.net.ApiConfig.baseUrl
import com.miya.fastcashier.service.AccountService.getAccountInfo
import com.miya.fastcashier.utils.*
import com.miya.print.PrinterManager
......
package com.miya.fastcashier.net
import android.text.TextUtils
import android.util.Log
import com.fastcashier.lib_common.BaseApplication
import com.fastcashier.lib_common.net.ApiConfig
import com.fastcashier.lib_common.net.CommonCallback
import com.miya.fastcashier.MiyaApplication
import com.miya.fastcashier.beans.LoginRequest
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.fastcashier.lib_common.net.MiyaHttpLoggingInterceptor
import com.fastcashier.lib_common.net.SSLCertificatesInit
import com.miya.fastcashier.net.param.LoginParams
import com.miya.fastcashier.net.bean.SelfCashierAccountInfo
import com.miya.fastcashier.net.bean.SelfCashierTerminalConfig
import com.miya.fastcashier.utils.LogFileUtils
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
......@@ -65,10 +69,10 @@ class ApiRequest private constructor() {
}
fun login(
loginRequest: LoginRequest,
loginParams: LoginParams,
commonCallback: CommonCallback<SelfCashierAccountInfo>
) {
getApiService().login(loginRequest).enqueue(commonCallback)
getApiService().login(loginParams).enqueue(commonCallback)
}
fun uploadFile(
......@@ -78,4 +82,18 @@ class ApiRequest private constructor() {
) {
getApiService().uploadFile(url, part).enqueue(commonCallback)
}
fun getDataSourceIp(
selfCashierTerminalConfig: SelfCashierTerminalConfig,
equType: String
): String? {
if (selfCashierTerminalConfig?.scoRuntimeConfig == null) {
throw RuntimeException("DataSourceIpUtils SelfCashierTerminalConfig is null")
}
val path = "${ApiService.UPLOAD_LOG_FILE}?equType=$equType"
return if (TextUtils.isEmpty(selfCashierTerminalConfig.scoRuntimeConfig.erpIp)) (ApiConfig.baseUrl + path)
else selfCashierTerminalConfig.scoRuntimeConfig.erpIp + path
}
}
\ No newline at end of file
package com.miya.fastcashier.net
import com.fastcashier.lib_common.net.ApiConfig
import com.fastcashier.lib_common.net.BaseResponse
import com.miya.fastcashier.beans.LoginRequest
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.net.param.LoginParams
import com.miya.fastcashier.net.bean.SelfCashierAccountInfo
import okhttp3.MultipartBody
import retrofit2.Call
import retrofit2.http.*
......@@ -31,7 +32,7 @@ interface ApiService {
}
@POST(LOGIN)
fun login(@Body loginRequestCall: LoginRequest): Call<BaseResponse<SelfCashierAccountInfo>>
fun login(@Body loginParams: LoginParams): Call<BaseResponse<SelfCashierAccountInfo>>
@Multipart
@POST
......
package com.miya.fastcashier.net
import com.miya.fastcashier.net.ApiConfig.getAuthorization
import com.fastcashier.lib_common.net.ApiConfig.getAuthorization
import com.miya.fastcashier.net.ApiService.Companion.wrapUrl
import com.miya.fastcashier.service.AccountService.getAccountInfo
import okhttp3.Interceptor
......
package com.miya.fastcashier.beans;
package com.miya.fastcashier.net.bean;
import java.io.Serializable;
......@@ -7,7 +7,7 @@ import java.io.Serializable;
* 基础DO类,提供toString快方法
* Created by fys on 2016/3/31.
*/
public class BaseDO implements Serializable {
public class BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
......
package com.miya.fastcashier.beans;
package com.miya.fastcashier.net.bean;
import android.text.TextUtils;
......@@ -11,7 +11,7 @@ import java.util.List;
* 非米雅渠道 自助结算终端用户信息类
* Created by fengyu on 2018/4/8.
*/
public class SelfCashierAccountInfo extends BaseDO {
public class SelfCashierAccountInfo extends BaseBean {
@SerializedName("store")
private SelfCashierAccountInfo.ShopInfo shopInfo;
......
package com.miya.fastcashier.beans;
package com.miya.fastcashier.net.bean;
import java.util.Date;
import java.util.List;
......@@ -7,7 +7,7 @@ import java.util.List;
* 自助收银终端 应用配置信息
* Created by fengyu on 2018/6/28.
*/
public class SelfCashierTerminalConfig extends BaseDO {
public class SelfCashierTerminalConfig extends BaseBean {
private String shopDiyParams;
......
package com.miya.fastcashier.beans;
package com.miya.fastcashier.net.bean;
import android.text.TextUtils;
......@@ -9,7 +9,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class ViewOrderStatisticsInfo extends BaseDO {
public class ViewOrderStatisticsInfo extends BaseBean {
private String beginDate;
private String endDate;
......
package com.miya.fastcashier.beans
package com.miya.fastcashier.net.param
/**
* Data validation state of the login form.
......
package com.miya.fastcashier.net.param
import com.google.gson.annotations.SerializedName
data class LoginParams(@SerializedName("username") val username: String,
@SerializedName("password") val password: String,
@SerializedName("serialNo") val serialNo: String)
package com.miya.fastcashier.service
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.sdy.miya.moblie.component.pay.platform.bean.MiyaOrderRefundResponse
import com.miya.fastcashier.net.bean.SelfCashierAccountInfo
object AccountService {
......
......@@ -2,8 +2,8 @@ package com.miya.fastcashier.service
import android.text.TextUtils
import com.fastcashier.lib_common.util.isEmpty
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.beans.ViewOrderStatisticsInfo
import com.miya.fastcashier.net.bean.SelfCashierAccountInfo
import com.miya.fastcashier.net.bean.ViewOrderStatisticsInfo
import com.miya.fastcashier.utils.DateUtils
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import com.miya.fastcashier.utils.StringPriceFormat
......
......@@ -7,7 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.miya.fastcashier.config.IntentExtra
import com.fastcashier.lib_common.config.IntentExtra
import com.miya.fastcashier.databinding.ActivityAliPayCodeBinding
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.StringPriceFormat
......
......@@ -5,7 +5,7 @@ import android.os.Bundle
import android.view.KeyEvent
import android.widget.Toast
import androidx.lifecycle.ViewModelProvider
import com.miya.fastcashier.config.IntentExtra
import com.fastcashier.lib_common.config.IntentExtra
import com.miya.fastcashier.databinding.ActivityPayBinding
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.ScanGunKeyEventHelper
......
......@@ -7,10 +7,10 @@ import androidx.appcompat.content.res.AppCompatResources
import androidx.lifecycle.ViewModelProvider
import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.fastcashier.lib_common.config.IntentExtra
import com.miya.fastcashier.R
import com.miya.fastcashier.R.mipmap.ic_alipay
import com.miya.fastcashier.R.mipmap.ic_wxpay
import com.miya.fastcashier.config.IntentExtra
import com.miya.fastcashier.databinding.ActivityPayCodeBinding
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.StringPriceFormat
......
......@@ -3,12 +3,10 @@ package com.miya.fastcashier.ui
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import com.miya.fastcashier.config.IntentExtra
import com.fastcashier.lib_common.config.IntentExtra
import com.miya.fastcashier.databinding.ActivityPayResultBinding
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.utils.clickWithTrigger
......
......@@ -6,8 +6,8 @@ import android.text.TextUtils
import android.view.View
import android.widget.Toast
import androidx.lifecycle.ViewModelProvider
import com.fastcashier.lib_common.config.IntentExtra
import com.miya.fastcashier.R
import com.miya.fastcashier.config.IntentExtra
import com.miya.fastcashier.databinding.ActivityPriceInputBinding
import com.miya.fastcashier.ui.dialog.CommonDialog
import com.miya.fastcashier.ui.dialog.PayChooseDialog
......
......@@ -5,16 +5,13 @@ import android.os.Bundle
import android.view.KeyEvent
import android.widget.Toast
import androidx.lifecycle.ViewModelProvider
import com.miya.fastcashier.config.IntentExtra
import com.miya.fastcashier.databinding.ActivityRefundBinding
import com.miya.fastcashier.ui.dialog.MessageDialog
import com.miya.fastcashier.ui.dialog.NumberManualDialog
import com.miya.fastcashier.ui.dialog.NumberManualDialog.NumberInputListener
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.ScanGunKeyEventHelper
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.PayViewModel
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
class RefundActivity : BaseActivity() {
......
......@@ -18,7 +18,7 @@ import com.elvishew.xlog.XLog
import com.fastcashier.lib_common.util.dp2px
import com.google.android.material.tabs.TabLayoutMediator
import com.miya.fastcashier.R
import com.miya.fastcashier.beans.ViewPayOrderData
import com.miya.fastcashier.dao.ViewPayOrderData
import com.miya.fastcashier.dao.PayDataDao
import com.miya.fastcashier.databinding.ActivitySearchOrderBinding
import com.miya.fastcashier.databinding.FragmentSearchOrderBinding
......
......@@ -7,7 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.miya.fastcashier.config.IntentExtra
import com.fastcashier.lib_common.config.IntentExtra
import com.miya.fastcashier.databinding.ActivityWxPayCodeBinding
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.StringPriceFormat
......
......@@ -6,9 +6,9 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.fastcashier.lib_common.net.CommonCallback
import com.miya.fastcashier.R
import com.miya.fastcashier.beans.LoginFormState
import com.miya.fastcashier.beans.LoginRequest
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.net.param.LoginFormState
import com.miya.fastcashier.net.param.LoginParams
import com.miya.fastcashier.net.bean.SelfCashierAccountInfo
import com.miya.fastcashier.net.ApiRequest
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
......@@ -23,7 +23,8 @@ class LoginViewModel : ViewModel() {
viewModelScope.launch(Dispatchers.IO) {
ApiRequest.getInstance().login(LoginRequest(userName, passWord, ""),
ApiRequest.getInstance().login(
LoginParams(userName, passWord, ""),
object : CommonCallback<SelfCashierAccountInfo>(){
override fun onSuccess(data: SelfCashierAccountInfo) {
loginLiveData.postValue(Result.success(data))
......
......@@ -3,7 +3,7 @@ package com.miya.fastcashier.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.miya.fastcashier.beans.ViewOrderStatisticsInfo
import com.miya.fastcashier.net.bean.ViewOrderStatisticsInfo
import com.miya.fastcashier.repository.PayRepository
import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.service.PrintService
......
......@@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.alibaba.fastjson.JSON
import com.elvishew.xlog.XLog
import com.miya.fastcashier.beans.ViewPayOrderData
import com.miya.fastcashier.dao.ViewPayOrderData
import com.miya.fastcashier.repository.PayRepository
import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.service.PrintService
......
......@@ -10,7 +10,7 @@ import com.miya.fastcashier.utils.DateUtils
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import com.miya.fastcashier.beans.ViewPayOrderData as ViewPayOrderData1
import com.miya.fastcashier.dao.ViewPayOrderData as ViewPayOrderData1
class SearchOrderViewModel : ViewModel() {
......
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
......@@ -60,8 +59,6 @@ dependencies {
api 'com.guolindev.permissionx:permissionx:1.6.1'
debugApi 'com.squareup.leakcanary:leakcanary-android:2.7'
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
kapt 'androidx.room:room-compiler:2.4.0'
api 'androidx.room:room-runtime:2.4.0'
api 'com.blankj:utilcode:1.30.0'
api 'androidx.multidex:multidex:2.0.0@aar'
......
package com.miya.fastcashier.config
package com.fastcashier.lib_common.config
interface IntentExtra {
companion object {
......
package com.miya.fastcashier.net
package com.fastcashier.lib_common.net
import android.text.TextUtils
import com.fastcashier.lib_common.BuildConfig
import com.miya.fastcashier.beans.SelfCashierTerminalConfig
object ApiConfig {
private const val BASE_URL = "https://hhms.miyapay.com/"
private const val BASE_URL_4_TEST = "https://hhmspre.miyapay.com/"
private const val BASE_URL_4_TEST = "https://hhmspre.miyapay.com/" //未使用
@JvmStatic
val baseUrl: String
......@@ -17,18 +15,4 @@ object ApiConfig {
fun getAuthorization(token: String): String {
return "bearer $token"
}
fun getDataSourceIp(
selfCashierTerminalConfig: SelfCashierTerminalConfig,
equType: String
): String? {
if (selfCashierTerminalConfig?.scoRuntimeConfig == null) {
throw RuntimeException("DataSourceIpUtils SelfCashierTerminalConfig is null")
}
val path = "${ApiService.UPLOAD_LOG_FILE}?equType=$equType"
return if (TextUtils.isEmpty(selfCashierTerminalConfig.scoRuntimeConfig.erpIp)) (baseUrl + path)
else selfCashierTerminalConfig.scoRuntimeConfig.erpIp + path
}
}
\ No newline at end of file
package com.miya.fastcashier.net;
package com.fastcashier.lib_common.net;
import java.io.EOFException;
import java.io.IOException;
......@@ -22,7 +22,6 @@ import okio.BufferedSource;
/**
* 基于原本的MiyaHttpLoggingInterceptor,本类做了如下改动:
* <p>
* 1. 请求整体写入,响应整体写入。但是请求和响应本身并不同时整体写入
*/
public final class MiyaHttpLoggingInterceptor implements Interceptor {
......
package com.miya.fastcashier.net;
package com.fastcashier.lib_common.net;
import java.io.IOException;
import java.io.InputStream;
......
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