Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
5b4ed42e
Commit
5b4ed42e
authored
Jul 18, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道配置暂由本地资源文件来处理
parent
f3a7046d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
19 deletions
+45
-19
channel.json
app/src/main/assets/channel.json
+2
-2
MiyaApplication.kt
app/src/main/java/com/miya/fastcashier/MiyaApplication.kt
+2
-0
ChannelInfoBean.java
.../main/java/com/miya/fastcashier/bean/ChannelInfoBean.java
+1
-1
LoginActivity.kt
app/src/main/java/com/miya/fastcashier/ui/LoginActivity.kt
+14
-6
SystemParameterDialog.kt
...a/com/miya/fastcashier/ui/dialog/SystemParameterDialog.kt
+2
-1
ChannelManageKit.java
...va/com/miya/fastcashier/util/manage/ChannelManageKit.java
+24
-9
No files found.
app/src/main/assets/channel.json
View file @
5b4ed42e
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
"ChannelId"
:
-1
,
"ChannelId"
:
-1
,
"ChannelName"
:
"通用"
,
"ChannelName"
:
"通用"
,
"ChannelNameEn"
:
"common"
,
"ChannelNameEn"
:
"common"
,
"ChannelAccountArray"
:
[]
"ChannelAccountArray"
:
[
"6038001"
]
},
},
{
{
"ChannelId"
:
1
,
"ChannelId"
:
1
,
"ChannelName"
:
"匡威"
,
"ChannelName"
:
"匡威"
,
"ChannelNameEn"
:
"converse"
,
"ChannelNameEn"
:
"converse"
,
"ChannelAccountArray"
:
[
"6011
"
,
"6013"
,
"6014"
,
"6017"
,
"602
1"
]
"ChannelAccountArray"
:
[
"6011
001"
,
"6013001"
,
"6014001"
,
"6017001"
,
"602100
1"
]
}
}
]
]
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/MiyaApplication.kt
View file @
5b4ed42e
...
@@ -43,6 +43,8 @@ class MiyaApplication : BaseApplication() {
...
@@ -43,6 +43,8 @@ class MiyaApplication : BaseApplication() {
instance
=
this
instance
=
this
ContextUtils
.
init
(
this
)
ContextUtils
.
init
(
this
)
//初始化账号数据
ChannelManageKit
.
initChannelRes
(
this
)
//打印机初始化
//打印机初始化
PrinterManager
.
getInstance
().
init
(
this
)
PrinterManager
.
getInstance
().
init
(
this
)
//屏幕适配
//屏幕适配
...
...
app/src/main/java/com/miya/fastcashier/bean/ChannelInfoBean.java
View file @
5b4ed42e
...
@@ -16,7 +16,7 @@ public class ChannelInfoBean extends BaseBean {
...
@@ -16,7 +16,7 @@ public class ChannelInfoBean extends BaseBean {
/**
/**
* ChannelId : 1
* ChannelId : 1
* ChannelName : 匡威
* ChannelName : 匡威
* ChannelName
Desc
: converse
* ChannelName
En
: converse
* ChannelAccountArray : ["6011","6013","6014","6017","6021"]
* ChannelAccountArray : ["6011","6013","6014","6017","6021"]
*/
*/
...
...
app/src/main/java/com/miya/fastcashier/ui/LoginActivity.kt
View file @
5b4ed42e
...
@@ -17,6 +17,8 @@ import com.blankj.utilcode.util.ToastUtils
...
@@ -17,6 +17,8 @@ import com.blankj.utilcode.util.ToastUtils
import
com.fastcashier.lib_common.function.account.AccountService
import
com.fastcashier.lib_common.function.account.AccountService
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityLoginBinding
import
com.miya.fastcashier.databinding.ActivityLoginBinding
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.manage.ChannelManageKit
import
com.miya.fastcashier.util.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.util.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.viewmodel.LoginViewModel
import
com.miya.fastcashier.viewmodel.LoginViewModel
import
com.permissionx.guolindev.PermissionX
import
com.permissionx.guolindev.PermissionX
...
@@ -112,7 +114,7 @@ class LoginActivity : AppCompatActivity() {
...
@@ -112,7 +114,7 @@ class LoginActivity : AppCompatActivity() {
setOnEditorActionListener
{
_
,
actionId
,
_
->
setOnEditorActionListener
{
_
,
actionId
,
_
->
when
(
actionId
)
{
when
(
actionId
)
{
EditorInfo
.
IME_ACTION_DONE
->
{
EditorInfo
.
IME_ACTION_DONE
->
{
if
(!
TextUtils
.
isEmpty
(
binding
.
etUsername
.
text
.
toString
())){
if
(!
TextUtils
.
isEmpty
(
binding
.
etUsername
.
text
.
toString
()))
{
checkPermissions
()
checkPermissions
()
}
}
}
}
...
@@ -152,12 +154,18 @@ class LoginActivity : AppCompatActivity() {
...
@@ -152,12 +154,18 @@ class LoginActivity : AppCompatActivity() {
}
}
}
}
private
fun
login
(){
private
fun
login
()
{
binding
.
vLoading
.
visibility
=
View
.
VISIBLE
binding
.
vLoading
.
visibility
=
View
.
VISIBLE
loginViewModel
.
login
(
val
userName
=
binding
.
etUsername
.
text
.
toString
()
binding
.
etUsername
.
text
.
toString
(),
if
(
ChannelManageKit
.
containsAccount
(
this
,
userName
))
{
binding
.
etPassword
.
text
.
toString
()
loginViewModel
.
login
(
)
userName
,
binding
.
etPassword
.
text
.
toString
()
)
}
else
{
binding
.
vLoading
.
visibility
=
View
.
GONE
CenterToasty
.
error
(
this
,
"账号有误,请检查后重试"
).
show
()
}
}
}
/**
/**
...
...
app/src/main/java/com/miya/fastcashier/ui/dialog/SystemParameterDialog.kt
View file @
5b4ed42e
...
@@ -15,6 +15,7 @@ import com.fastcashier.lib_common.util.getVersionCode
...
@@ -15,6 +15,7 @@ import com.fastcashier.lib_common.util.getVersionCode
import
com.fastcashier.lib_common.util.getWifyName
import
com.fastcashier.lib_common.util.getWifyName
import
com.miya.fastcashier.R
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.DialogSystemParameterBinding
import
com.miya.fastcashier.databinding.DialogSystemParameterBinding
import
com.miya.fastcashier.util.manage.ChannelManageKit
import
com.miya.print.PrinterManager
import
com.miya.print.PrinterManager
import
java.util.*
import
java.util.*
...
@@ -52,7 +53,7 @@ class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDi
...
@@ -52,7 +53,7 @@ class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDi
viewBinding
.
tvPrintType
,
viewBinding
.
tvPrintType
,
if
(
PrinterManager
.
getInstance
().
printer
==
null
)
context
.
resources
.
getString
(
R
.
string
.
app_unkown
)
else
PrinterManager
.
getInstance
().
printer
.
printerName
if
(
PrinterManager
.
getInstance
().
printer
==
null
)
context
.
resources
.
getString
(
R
.
string
.
app_unkown
)
else
PrinterManager
.
getInstance
().
printer
.
printerName
)
)
setInfo
(
viewBinding
.
tvChannel
,
BuildConfig
.
CHANNEL
)
setInfo
(
viewBinding
.
tvChannel
,
ChannelManageKit
.
getAppChannelName
(
context
)
)
viewBinding
.
ivClose
.
setOnClickListener
(
View
.
OnClickListener
{
dismiss
()
})
viewBinding
.
ivClose
.
setOnClickListener
(
View
.
OnClickListener
{
dismiss
()
})
resize
()
resize
()
}
}
...
...
app/src/main/java/com/miya/fastcashier/util/manage/ChannelManageKit.java
View file @
5b4ed42e
...
@@ -27,9 +27,10 @@ import java.util.Map;
...
@@ -27,9 +27,10 @@ import java.util.Map;
*/
*/
public
class
ChannelManageKit
{
public
class
ChannelManageKit
{
private
static
Map
<
String
,
ChannelInfoBean
>
channelMap
;
private
static
Map
<
String
,
ChannelInfoBean
>
channelMap
;
//key为账号,value为所属的品牌信息
private
static
final
String
CHANNEL_OFFICIAL_ACCOUNT
=
"-1"
;
private
static
final
String
CHANNEL_OFFICIAL_ACCOUNT
=
"-1"
;
private
static
final
String
CHANNEL_OFFICIAL_CHANNELNAME
=
"通用"
;
private
static
final
String
CHANNEL_OFFICIAL_CHANNELNAME
=
"通用"
;
private
static
final
String
CHANNEL_OFFICIAL_CHANNELNAME_EN
=
"common"
;
/**
/**
* 初始化本地渠道数据
* 初始化本地渠道数据
...
@@ -46,32 +47,46 @@ public class ChannelManageKit {
...
@@ -46,32 +47,46 @@ public class ChannelManageKit {
initDefaultChannelRes
();
initDefaultChannelRes
();
return
;
return
;
}
}
ArrayList
<
ChannelInfoBean
>
channelInfoList
=
GsonUtils
.
fromJson
(
assetsJson
,
new
TypeToken
<
List
<
ChannelInfoBean
>>()
{}.
getType
());
ArrayList
<
ChannelInfoBean
>
channelInfoList
=
GsonUtils
.
fromJson
(
assetsJson
,
new
TypeToken
<
List
<
ChannelInfoBean
>>()
{
}.
getType
());
channelMap
=
new
HashMap
<>();
channelMap
=
new
HashMap
<>();
if
(!
channelInfoList
.
isEmpty
())
{
if
(!
channelInfoList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
channelInfoList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
channelInfoList
.
size
();
i
++)
{
ChannelInfoBean
channelInfoBean
=
channelInfoList
.
get
(
i
);
ChannelInfoBean
channelInfoBean
=
channelInfoList
.
get
(
i
);
List
<
String
>
channelAccountArray
=
channelInfoBean
.
getChannelAccountArray
();
List
<
String
>
channelAccountArray
=
channelInfoBean
.
getChannelAccountArray
();
if
(
channelAccountArray
.
isEmpty
()){
if
(
channelAccountArray
.
isEmpty
())
{
initDefaultChannelRes
();
initDefaultChannelRes
();
return
;
continue
;
}
}
for
(
int
j
=
0
;
j
<
channelAccountArray
.
size
();
i
++)
{
for
(
int
j
=
0
;
j
<
channelAccountArray
.
size
();
j
++)
{
String
account
=
channelAccountArray
.
get
(
j
);
String
account
=
channelAccountArray
.
get
(
j
);
channelMap
.
put
(
account
,
channelInfoBean
);
channelMap
.
put
(
account
,
channelInfoBean
);
}
}
}
}
}
}
}
}
private
static
void
initDefaultChannelRes
()
{
private
static
void
initDefaultChannelRes
()
{
channelMap
=
new
HashMap
<>();
if
(
channelMap
==
null
){
channelMap
=
new
HashMap
<>();
}
ChannelInfoBean
commonChannel
=
new
ChannelInfoBean
();
ChannelInfoBean
commonChannel
=
new
ChannelInfoBean
();
commonChannel
.
setChannelId
(
"-1"
);
commonChannel
.
setChannelId
(
"-1"
);
commonChannel
.
setChannelName
(
CHANNEL_OFFICIAL_CHANNELNAME
);
commonChannel
.
setChannelName
(
CHANNEL_OFFICIAL_CHANNELNAME
);
commonChannel
.
setChannelNameEn
(
CHANNEL_OFFICIAL_CHANNELNAME
);
commonChannel
.
setChannelNameEn
(
CHANNEL_OFFICIAL_CHANNELNAME_EN
);
channelMap
.
put
(
CHANNEL_OFFICIAL_ACCOUNT
,
commonChannel
);
channelMap
.
put
(
CHANNEL_OFFICIAL_ACCOUNT
,
commonChannel
);
}
/**
* 判断本地是否包含本品牌账户,此处暂时用来处理区别大屏和手持账号
*/
public
static
boolean
containsAccount
(
Context
context
,
String
account
)
{
if
(
channelMap
==
null
||
channelMap
.
isEmpty
())
{
initChannelRes
(
context
);
}
return
channelMap
.
containsKey
(
account
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment