Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
NTMApp
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhang_u
NTMApp
Commits
00519999
Commit
00519999
authored
Jan 02, 2025
by
zhang_u
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单机取号
parent
0e672d81
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
198 additions
and
25 deletions
+198
-25
AIOItemAdapter.java
...m/example/numbertakingmachine/adapter/AIOItemAdapter.java
+9
-2
MSGItemAdapter.java
...m/example/numbertakingmachine/adapter/MSGItemAdapter.java
+5
-4
BasicBean.java
.../java/com/example/numbertakingmachine/bean/BasicBean.java
+29
-1
ConfigListBean.java
.../com/example/numbertakingmachine/bean/ConfigListBean.java
+9
-0
PATBean.java
...in/java/com/example/numbertakingmachine/bean/PATBean.java
+11
-0
Http.java
.../main/java/com/example/numbertakingmachine/http/Http.java
+0
-0
HttpRequest.java
...ava/com/example/numbertakingmachine/http/HttpRequest.java
+46
-1
MyServer.java
...java/com/example/numbertakingmachine/server/MyServer.java
+0
-2
NTMRecordHelper.java
.../com/example/numbertakingmachine/sql/NTMRecordHelper.java
+3
-4
MainActivity.java
...java/com/example/numbertakingmachine/ui/MainActivity.java
+0
-0
SplashActivity.java
...va/com/example/numbertakingmachine/ui/SplashActivity.java
+5
-5
MyApplication.java
.../com/example/numbertakingmachine/utils/MyApplication.java
+8
-0
SystemUtils.java
...va/com/example/numbertakingmachine/utils/SystemUtils.java
+60
-0
HTTPSession.java
...c/main/java/org/nanohttpd/protocols/http/HTTPSession.java
+3
-2
dialog_print_tips.xml
app/src/main/res/layout/dialog_print_tips.xml
+1
-0
msg_item.xml
app/src/main/res/layout/msg_item.xml
+9
-4
No files found.
app/src/main/java/com/example/numbertakingmachine/adapter/AIOItemAdapter.java
View file @
00519999
...
@@ -34,13 +34,20 @@ public class AIOItemAdapter extends RecyclerView.Adapter<AIOItemAdapter.ViewHold
...
@@ -34,13 +34,20 @@ public class AIOItemAdapter extends RecyclerView.Adapter<AIOItemAdapter.ViewHold
private
int
width
=
-
1
;
private
int
width
=
-
1
;
private
Context
context
;
private
Context
context
;
public
AIOItemAdapter
(
Context
context
,
ArrayList
<
ConfigDevsBean
.
DevsBean
>
data
,
int
height
,
int
width
)
{
public
AIOItemAdapter
(
Context
context
,
int
height
,
int
width
)
{
this
.
context
=
context
;
this
.
context
=
context
;
this
.
data
=
data
;
this
.
height
=
height
;
this
.
height
=
height
;
this
.
width
=
width
;
this
.
width
=
width
;
}
}
public
void
setData
(
ArrayList
<
ConfigDevsBean
.
DevsBean
>
data
)
{
this
.
data
=
data
;
}
public
void
notifyAdapter
()
{
notifyDataSetChanged
();
}
public
void
setAiOiItemOnClick
(
AIOitemInterface
aiOitemInterface
)
{
public
void
setAiOiItemOnClick
(
AIOitemInterface
aiOitemInterface
)
{
this
.
aiOitemInterface
=
aiOitemInterface
;
this
.
aiOitemInterface
=
aiOitemInterface
;
}
}
...
...
app/src/main/java/com/example/numbertakingmachine/adapter/MSGItemAdapter.java
View file @
00519999
...
@@ -64,9 +64,6 @@ public class MSGItemAdapter extends RecyclerView.Adapter<MSGItemAdapter.ViewHold
...
@@ -64,9 +64,6 @@ public class MSGItemAdapter extends RecyclerView.Adapter<MSGItemAdapter.ViewHold
@Override
@Override
public
void
onBindViewHolder
(
ViewHolder
holder
,
int
position
)
{
public
void
onBindViewHolder
(
ViewHolder
holder
,
int
position
)
{
// 从数据列表中获取数据并绑定到视图
// 从数据列表中获取数据并绑定到视图
if
(
position
>=
data
.
size
())
{
holder
.
layout
.
setVisibility
(
View
.
INVISIBLE
);
}
initView
(
holder
,
position
);
initView
(
holder
,
position
);
}
}
...
@@ -86,6 +83,9 @@ public class MSGItemAdapter extends RecyclerView.Adapter<MSGItemAdapter.ViewHold
...
@@ -86,6 +83,9 @@ public class MSGItemAdapter extends RecyclerView.Adapter<MSGItemAdapter.ViewHold
}
}
holder
.
itemView
.
setLayoutParams
(
params
);
holder
.
itemView
.
setLayoutParams
(
params
);
if
(
position
<
data
.
size
())
{
if
(
position
<
data
.
size
())
{
if
(
data
.
get
(
position
).
get
(
BaseUtils
.
NTMRecordTable
.
current
).
equals
(
"0"
))
holder
.
layout
.
setVisibility
(
View
.
INVISIBLE
);
else
{
String
queueID
=
data
.
get
(
position
).
get
(
"queueID"
);
String
queueID
=
data
.
get
(
position
).
get
(
"queueID"
);
if
(
queueID
!=
null
&&
!
queueID
.
isEmpty
())
{
if
(
queueID
!=
null
&&
!
queueID
.
isEmpty
())
{
List
<
Map
<
String
,
String
>>
maps
=
recordHelper
.
searchNTMQueueTable
(
BaseUtils
.
NTMRecordTable
.
queueID
,
queueID
);
List
<
Map
<
String
,
String
>>
maps
=
recordHelper
.
searchNTMQueueTable
(
BaseUtils
.
NTMRecordTable
.
queueID
,
queueID
);
...
@@ -95,9 +95,10 @@ public class MSGItemAdapter extends RecyclerView.Adapter<MSGItemAdapter.ViewHold
...
@@ -95,9 +95,10 @@ public class MSGItemAdapter extends RecyclerView.Adapter<MSGItemAdapter.ViewHold
holder
.
num
.
setText
(
map
.
get
(
BaseUtils
.
NTMQueueTable
.
prefix
)
+
data
.
get
(
position
).
get
(
BaseUtils
.
NTMRecordTable
.
current
));
holder
.
num
.
setText
(
map
.
get
(
BaseUtils
.
NTMQueueTable
.
prefix
)
+
data
.
get
(
position
).
get
(
BaseUtils
.
NTMRecordTable
.
current
));
holder
.
num2
.
setText
(
map
.
get
(
BaseUtils
.
NTMQueueTable
.
title
));
holder
.
num2
.
setText
(
map
.
get
(
BaseUtils
.
NTMQueueTable
.
title
));
}
}
}
else
holder
.
layout
.
setVisibility
(
View
.
INVISIBLE
);
}
}
}
}
}
else
holder
.
layout
.
setVisibility
(
View
.
INVISIBLE
);
}
@Override
@Override
public
int
getItemCount
()
{
public
int
getItemCount
()
{
...
...
app/src/main/java/com/example/numbertakingmachine/bean/BasicBean.java
View file @
00519999
...
@@ -18,7 +18,12 @@ public class BasicBean implements Serializable {
...
@@ -18,7 +18,12 @@ public class BasicBean implements Serializable {
private
ModuleBean
module
;
private
ModuleBean
module
;
private
TerminalBean
terminal
;
private
TerminalBean
terminal
;
public
BasicBean
(
String
hosCode
,
String
hosName
,
ModuleBean
module
,
TerminalBean
terminal
)
{
this
.
hosCode
=
hosCode
;
this
.
hosName
=
hosName
;
this
.
module
=
module
;
this
.
terminal
=
terminal
;
}
public
String
getHosCode
()
{
public
String
getHosCode
()
{
return
hosCode
;
return
hosCode
;
...
@@ -65,6 +70,13 @@ public class BasicBean implements Serializable {
...
@@ -65,6 +70,13 @@ public class BasicBean implements Serializable {
private
String
level
;
private
String
level
;
private
List
<
ListBean
>
list
;
private
List
<
ListBean
>
list
;
public
ModuleBean
(
String
moduleCode
,
String
moduleName
,
String
level
,
List
<
ListBean
>
list
)
{
this
.
moduleCode
=
moduleCode
;
this
.
moduleName
=
moduleName
;
this
.
level
=
level
;
this
.
list
=
list
;
}
public
String
getModuleCode
()
{
public
String
getModuleCode
()
{
return
moduleCode
;
return
moduleCode
;
}
}
...
@@ -108,6 +120,12 @@ public class BasicBean implements Serializable {
...
@@ -108,6 +120,12 @@ public class BasicBean implements Serializable {
private
String
moduleName
;
private
String
moduleName
;
private
String
level
;
private
String
level
;
public
ListBean
(
String
moduleCode
,
String
moduleName
,
String
level
)
{
this
.
moduleCode
=
moduleCode
;
this
.
moduleName
=
moduleName
;
this
.
level
=
level
;
}
public
String
getModuleCode
()
{
public
String
getModuleCode
()
{
return
moduleCode
;
return
moduleCode
;
}
}
...
@@ -153,6 +171,16 @@ public class BasicBean implements Serializable {
...
@@ -153,6 +171,16 @@ public class BasicBean implements Serializable {
private
String
opSys
;
private
String
opSys
;
private
String
version
;
private
String
version
;
public
TerminalBean
(
String
terminalCode
,
String
terminalName
,
String
ip
,
String
mac
,
String
resolution
,
String
opSys
,
String
version
)
{
this
.
terminalCode
=
terminalCode
;
this
.
terminalName
=
terminalName
;
this
.
ip
=
ip
;
this
.
mac
=
mac
;
this
.
resolution
=
resolution
;
this
.
opSys
=
opSys
;
this
.
version
=
version
;
}
public
String
getTerminalCode
()
{
public
String
getTerminalCode
()
{
return
terminalCode
;
return
terminalCode
;
}
}
...
...
app/src/main/java/com/example/numbertakingmachine/bean/ConfigListBean.java
View file @
00519999
...
@@ -34,6 +34,15 @@ public class ConfigListBean implements Serializable {
...
@@ -34,6 +34,15 @@ public class ConfigListBean implements Serializable {
private
String
level
;
private
String
level
;
private
String
type
;
private
String
type
;
private
List
<
TimesBean
>
times
;
private
List
<
TimesBean
>
times
;
private
String
tempID
;
public
String
getTempID
()
{
return
tempID
;
}
public
void
setTempID
(
String
tempID
)
{
this
.
tempID
=
tempID
;
}
public
String
getTitle
()
{
public
String
getTitle
()
{
return
title
;
return
title
;
...
...
app/src/main/java/com/example/numbertakingmachine/bean/PATBean.java
View file @
00519999
...
@@ -35,6 +35,17 @@ public class PATBean implements Serializable {
...
@@ -35,6 +35,17 @@ public class PATBean implements Serializable {
private
String
patName
;
private
String
patName
;
private
String
cardCode
;
private
String
cardCode
;
public
PATBean
(
String
hosCode
,
String
terminalCode
,
String
regId
,
String
moduleCode
,
String
moduleName
,
String
regNo
,
String
takeTime
,
String
status
)
{
this
.
hosCode
=
hosCode
;
this
.
terminalCode
=
terminalCode
;
this
.
regId
=
regId
;
this
.
moduleCode
=
moduleCode
;
this
.
moduleName
=
moduleName
;
this
.
regNo
=
regNo
;
this
.
takeTime
=
takeTime
;
this
.
status
=
status
;
}
public
String
getHosCode
()
{
public
String
getHosCode
()
{
return
hosCode
;
return
hosCode
;
}
}
...
...
app/src/main/java/com/example/numbertakingmachine/http/Http.java
View file @
00519999
This diff is collapsed.
Click to expand it.
app/src/main/java/com/example/numbertakingmachine/http/HttpRequest.java
View file @
00519999
package
com
.
example
.
numbertakingmachine
.
http
;
package
com
.
example
.
numbertakingmachine
.
http
;
import
android.util.Log
;
import
com.example.numbertakingmachine.bean.BasicBean
;
import
com.example.numbertakingmachine.bean.HttpResultBean
;
import
com.example.numbertakingmachine.bean.PATBean
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
okhttp3.OkHttpClient
;
import
okhttp3.OkHttpClient
;
import
okhttp3.RequestBody
;
import
okhttp3.RequestBody
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Retrofit
;
import
retrofit2.Retrofit
;
import
retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
;
import
retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
;
import
retrofit2.converter.gson.GsonConverterFactory
;
import
retrofit2.converter.gson.GsonConverterFactory
;
...
@@ -11,7 +18,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
...
@@ -11,7 +18,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
public
class
HttpRequest
{
public
class
HttpRequest
{
private
static
OkHttpClient
okHttpClient
=
null
;
private
static
OkHttpClient
okHttpClient
=
null
;
private
static
String
URL
=
"http
://www.develop
.com/single_server/public/"
;
private
static
String
URL
=
"http
s://bj-jkb.rwjiankang
.com/single_server/public/"
;
public
static
Retrofit
getRetrofit
(
Gson
gson
)
{
public
static
Retrofit
getRetrofit
(
Gson
gson
)
{
Retrofit
retrofit
=
new
Retrofit
.
Builder
()
Retrofit
retrofit
=
new
Retrofit
.
Builder
()
...
@@ -44,4 +51,42 @@ public class HttpRequest {
...
@@ -44,4 +51,42 @@ public class HttpRequest {
return
body
;
return
body
;
}
}
public
static
void
UpdateData
(
Gson
gson
,
BasicBean
basicBean
){
String
json
=
gson
.
toJson
(
basicBean
);
Log
.
d
(
"sssss"
,
json
);
HttpRequest
.
getRetrofit
(
gson
)
.
create
(
API
.
class
)
.
basic
(
HttpRequest
.
getBody
(
json
))
.
enqueue
(
new
Callback
<
HttpResultBean
>()
{
@Override
public
void
onResponse
(
Call
<
HttpResultBean
>
call
,
retrofit2
.
Response
<
HttpResultBean
>
response
)
{
Log
.
d
(
"sss_success"
,
""
+
response
.
message
());
}
@Override
public
void
onFailure
(
Call
<
HttpResultBean
>
call
,
Throwable
t
)
{
Log
.
d
(
"sss_fail"
,
""
+
t
.
getMessage
());
}
});
}
public
static
void
patData
(
Gson
gson
,
PATBean
batBean
){
String
json
=
gson
.
toJson
(
batBean
);
Log
.
d
(
"sssss"
,
json
);
HttpRequest
.
getRetrofit
(
gson
)
.
create
(
API
.
class
)
.
pat
(
HttpRequest
.
getBody
(
json
))
.
enqueue
(
new
Callback
<
HttpResultBean
>()
{
@Override
public
void
onResponse
(
Call
<
HttpResultBean
>
call
,
retrofit2
.
Response
<
HttpResultBean
>
response
)
{
Log
.
d
(
"sss_success"
,
""
+
response
.
message
());
}
@Override
public
void
onFailure
(
Call
<
HttpResultBean
>
call
,
Throwable
t
)
{
Log
.
d
(
"sss_fail"
,
""
+
t
.
getMessage
());
}
});
}
}
}
app/src/main/java/com/example/numbertakingmachine/server/MyServer.java
View file @
00519999
...
@@ -111,12 +111,10 @@ public class MyServer extends Service {
...
@@ -111,12 +111,10 @@ public class MyServer extends Service {
mServiceMessenger
=
new
Messenger
(
handler
);
mServiceMessenger
=
new
Messenger
(
handler
);
// 创建对象,端口我这里设置为8080
// 创建对象,端口我这里设置为8080
if
(
myServer
==
null
)
myServer
=
new
Http
(
getApplicationContext
(),
8080
,
handler
);
myServer
=
new
Http
(
getApplicationContext
(),
8080
,
handler
);
try
{
try
{
// 开启HTTP服务
// 开启HTTP服务
Log
.
d
(
"ssss"
,
"开启http服务"
);
Log
.
d
(
"ssss"
,
"开启http服务"
);
if
(!
myServer
.
isAlive
())
myServer
.
start
();
myServer
.
start
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
app/src/main/java/com/example/numbertakingmachine/sql/NTMRecordHelper.java
View file @
00519999
...
@@ -135,8 +135,7 @@ public class NTMRecordHelper extends SQLiteOpenHelper {
...
@@ -135,8 +135,7 @@ public class NTMRecordHelper extends SQLiteOpenHelper {
List
<
DataBean
>
array
=
new
ArrayList
<>();
List
<
DataBean
>
array
=
new
ArrayList
<>();
SQLiteDatabase
database
=
helper
.
getWritableDatabase
();
SQLiteDatabase
database
=
helper
.
getWritableDatabase
();
try
{
try
{
Cursor
query
=
database
.
query
(
true
,
BaseUtils
.
NTMRecordTable
.
NAME
,
null
,
key
+
" = ?"
,
new
String
[]{
value
},
Cursor
query
=
database
.
rawQuery
(
"select * from "
+
BaseUtils
.
NTMRecordTable
.
NAME
+
" WHERE "
+
key
+
" = ?"
,
new
String
[]{
value
});
null
,
null
,
null
,
null
);
query
.
moveToFirst
();
query
.
moveToFirst
();
for
(
int
i
=
0
;
i
<
query
.
getCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
query
.
getCount
();
i
++)
{
array
.
add
(
new
DataBean
(
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
id
)),
array
.
add
(
new
DataBean
(
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
id
)),
...
@@ -163,8 +162,7 @@ public class NTMRecordHelper extends SQLiteOpenHelper {
...
@@ -163,8 +162,7 @@ public class NTMRecordHelper extends SQLiteOpenHelper {
List
<
DataBean
>
array
=
new
ArrayList
<>();
List
<
DataBean
>
array
=
new
ArrayList
<>();
SQLiteDatabase
database
=
helper
.
getWritableDatabase
();
SQLiteDatabase
database
=
helper
.
getWritableDatabase
();
try
{
try
{
Cursor
query
=
database
.
query
(
true
,
BaseUtils
.
NTMTimesTable
.
NAME
,
null
,
key
+
" = ?"
,
new
String
[]{
value
},
Cursor
query
=
database
.
rawQuery
(
"select * from "
+
BaseUtils
.
NTMTimesTable
.
NAME
+
" WHERE "
+
key
+
" = ?"
,
new
String
[]{
value
});
null
,
null
,
null
,
null
);
query
.
moveToFirst
();
query
.
moveToFirst
();
for
(
int
i
=
0
;
i
<
query
.
getCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
query
.
getCount
();
i
++)
{
array
.
add
(
new
DataBean
(
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMTimesTable
.
id
)),
array
.
add
(
new
DataBean
(
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMTimesTable
.
id
)),
...
@@ -199,6 +197,7 @@ public class NTMRecordHelper extends SQLiteOpenHelper {
...
@@ -199,6 +197,7 @@ public class NTMRecordHelper extends SQLiteOpenHelper {
map
.
put
(
BaseUtils
.
NTMRecordTable
.
all
,
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
all
)));
map
.
put
(
BaseUtils
.
NTMRecordTable
.
all
,
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
all
)));
map
.
put
(
BaseUtils
.
NTMRecordTable
.
last
,
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
last
)));
map
.
put
(
BaseUtils
.
NTMRecordTable
.
last
,
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
last
)));
map
.
put
(
BaseUtils
.
NTMRecordTable
.
current
,
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
current
)));
map
.
put
(
BaseUtils
.
NTMRecordTable
.
current
,
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
current
)));
map
.
put
(
BaseUtils
.
NTMRecordTable
.
queueID
,
query
.
getString
(
query
.
getColumnIndex
(
BaseUtils
.
NTMRecordTable
.
queueID
)));
array
.
add
(
map
);
array
.
add
(
map
);
query
.
moveToNext
();
query
.
moveToNext
();
}
}
...
...
app/src/main/java/com/example/numbertakingmachine/ui/MainActivity.java
View file @
00519999
This diff is collapsed.
Click to expand it.
app/src/main/java/com/example/numbertakingmachine/ui/SplashActivity.java
View file @
00519999
...
@@ -118,7 +118,7 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -118,7 +118,7 @@ public class SplashActivity extends AppCompatActivity {
recordHelper
.
insertNTMQueue
(
"1"
,
"1"
,
"默认"
,
"0"
,
"A"
,
"0"
,
"0"
);
recordHelper
.
insertNTMQueue
(
"1"
,
"1"
,
"默认"
,
"0"
,
"A"
,
"0"
,
"0"
);
recordHelper
.
insertNTMTimes
(
"全天"
,
"1"
,
"100"
,
"8:00"
,
"16:00"
,
"0"
);
recordHelper
.
insertNTMTimes
(
"全天"
,
"1"
,
"100"
,
"8:00"
,
"16:00"
,
"0"
);
recordHelper
.
insertNTMDevs
(
"01"
,
"窗口一"
,
"1"
,
"0"
,
"0"
);
recordHelper
.
insertNTMDevs
(
"01"
,
"窗口一"
,
"1"
,
"0"
,
"0"
);
recordHelper
.
insertNTMRecord
(
SystemUtils
.
getIpAddressString
(),
SystemUtils
.
getDateToString
(
System
.
currentTimeMillis
(),
0
,
"yyyy-MM-dd"
),
"1"
,
"1"
,
"
1
"
,
"01"
,
"1"
,
"100"
);
recordHelper
.
insertNTMRecord
(
SystemUtils
.
getIpAddressString
(),
SystemUtils
.
getDateToString
(
System
.
currentTimeMillis
(),
0
,
"yyyy-MM-dd"
),
"1"
,
"1"
,
"
0
"
,
"01"
,
"1"
,
"100"
);
colorBac
=
"0"
;
colorBac
=
"0"
;
devType
=
"0"
;
devType
=
"0"
;
}
else
{
}
else
{
...
@@ -127,12 +127,12 @@ public class SplashActivity extends AppCompatActivity {
...
@@ -127,12 +127,12 @@ public class SplashActivity extends AppCompatActivity {
devType
=
"0"
;
devType
=
"0"
;
}
}
all
=
recordHelper
.
searchNTMRecordTableAll
();
all
=
recordHelper
.
searchNTMRecordTableAll
();
if
(
all
!=
null
&&
all
.
size
()
>
=
0
)
{
if
(
all
!=
null
&&
all
.
size
()
>
0
)
{
if
(!
all
.
get
(
0
).
get
(
BaseUtils
.
NTMRecordTable
.
ntimes
).
equals
(
SystemUtils
.
getDateToString
(
System
.
currentTimeMillis
(),
0
,
"yyyy-MM-dd"
)))
{
if
(!
all
.
get
(
0
).
get
(
BaseUtils
.
NTMRecordTable
.
ntimes
).
equals
(
SystemUtils
.
getDateToString
(
System
.
currentTimeMillis
(),
0
,
"yyyy-MM-dd"
)))
{
recordHelper
.
updateNTMRecord
(
SystemUtils
.
getIpAddressString
(),
recordHelper
.
deleteTableData
(
BaseUtils
.
NTMRecordTable
.
NAME
);
recordHelper
.
insertNTMRecord
(
SystemUtils
.
getIpAddressString
(),
SystemUtils
.
getDateToString
(
System
.
currentTimeMillis
(),
0
,
"yyyy-MM-dd"
),
SystemUtils
.
getDateToString
(
System
.
currentTimeMillis
(),
0
,
"yyyy-MM-dd"
),
"1"
,
"1"
,
"1"
,
"01"
,
"1"
,
"100"
,
"1"
,
"1"
,
"0"
,
"01"
,
"A"
,
"100"
);
all
.
get
(
0
).
get
(
BaseUtils
.
NTMRecordTable
.
id
),
""
);
}
}
}
}
}
}
...
...
app/src/main/java/com/example/numbertakingmachine/utils/MyApplication.java
View file @
00519999
...
@@ -6,6 +6,7 @@ import android.os.Messenger;
...
@@ -6,6 +6,7 @@ import android.os.Messenger;
import
com.example.numbertakingmachine.http.Http
;
import
com.example.numbertakingmachine.http.Http
;
import
com.example.numbertakingmachine.sql.NTMRecordHelper
;
import
com.example.numbertakingmachine.sql.NTMRecordHelper
;
import
com.google.gson.Gson
;
import
java.io.File
;
import
java.io.File
;
import
java.util.List
;
import
java.util.List
;
...
@@ -30,6 +31,10 @@ public class MyApplication extends Application {
...
@@ -30,6 +31,10 @@ public class MyApplication extends Application {
public
static
String
colorBac
=
"0"
;
public
static
String
colorBac
=
"0"
;
public
static
String
devType
=
"0"
;
public
static
String
devType
=
"0"
;
public
static
int
orientation
=
0
;
public
static
int
orientation
=
0
;
public
static
String
mac
=
""
;
public
static
String
ip
=
""
;
public
static
int
[]
screenReal
;
public
static
Gson
gson
=
new
Gson
();
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
...
@@ -41,6 +46,9 @@ public class MyApplication extends Application {
...
@@ -41,6 +46,9 @@ public class MyApplication extends Application {
if
(!
f
.
exists
())
{
if
(!
f
.
exists
())
{
UtilsCopyFile
.
copyAssetsFiles
(
this
,
"RWconfig"
,
storagePath
);
UtilsCopyFile
.
copyAssetsFiles
(
this
,
"RWconfig"
,
storagePath
);
}
}
mac
=
SystemUtils
.
getMacFromHardware
();
ip
=
SystemUtils
.
getIpAddressString
();
screenReal
=
SystemUtils
.
getScreenReal
(
application
.
getApplicationContext
());
}
}
//初始化数据
//初始化数据
...
...
app/src/main/java/com/example/numbertakingmachine/utils/SystemUtils.java
View file @
00519999
...
@@ -5,9 +5,13 @@ import android.content.BroadcastReceiver;
...
@@ -5,9 +5,13 @@ import android.content.BroadcastReceiver;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.IntentFilter
;
import
android.graphics.Point
;
import
android.hardware.usb.UsbDevice
;
import
android.hardware.usb.UsbDevice
;
import
android.hardware.usb.UsbManager
;
import
android.hardware.usb.UsbManager
;
import
android.os.Build
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.Display
;
import
android.view.WindowManager
;
import
java.net.Inet4Address
;
import
java.net.Inet4Address
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
...
@@ -161,4 +165,60 @@ public class SystemUtils {
...
@@ -161,4 +165,60 @@ public class SystemUtils {
}
}
}
}
/**
* Android 7.0之后获取Mac地址
* 遍历循环所有的网络接口,找到接口是 wlan0
* 必须的权限 <uses-permission android:name="android.permission.INTERNET"></uses-permission>
*
* @return
*/
public
static
String
getMacFromHardware
()
{
/*获取mac地址有一点需要注意的就是android 6.0版本后,以下注释方法不再适用,不管任何手机都会返回"02:00:00:00:00:00"这个默认的mac地址,这是googel官方为了加强权限管理而禁用了getSYstemService(Context.WIFI_SERVICE)方法来获得mac地址。*/
String
macAddress
=
null
;
StringBuffer
buf
=
new
StringBuffer
();
NetworkInterface
networkInterface
=
null
;
try
{
networkInterface
=
NetworkInterface
.
getByName
(
"eth0"
);
if
(
networkInterface
==
null
)
{
networkInterface
=
NetworkInterface
.
getByName
(
"wlan0"
);
}
if
(
networkInterface
==
null
)
{
return
"02:00:00:00:00:02"
;
}
byte
[]
addr
=
networkInterface
.
getHardwareAddress
();
if
(
addr
!=
null
)
for
(
byte
b
:
addr
)
{
buf
.
append
(
String
.
format
(
"%02X:"
,
b
));
}
if
(
buf
.
length
()
>
0
)
{
buf
.
deleteCharAt
(
buf
.
length
()
-
1
);
}
macAddress
=
buf
.
toString
();
}
catch
(
SocketException
|
NullPointerException
e
)
{
e
.
printStackTrace
();
return
"02:00:00:00:00:02"
;
}
return
macAddress
;
}
/**
* 获得屏幕真实宽高高度(包含底部导航栏)
*/
public
static
int
[]
getScreenReal
(
Context
context
)
{
int
[]
screen
=
new
int
[
2
];
WindowManager
windowManager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
final
Display
display
=
windowManager
.
getDefaultDisplay
();
Point
outPoint
=
new
Point
();
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
// 可能有虚拟按键的情况
display
.
getRealSize
(
outPoint
);
}
else
{
// 不可能有虚拟按键
display
.
getSize
(
outPoint
);
}
screen
[
0
]
=
outPoint
.
x
;
//手机屏幕真实宽度
screen
[
1
]
=
outPoint
.
y
;
//手机屏幕真实高度
return
screen
;
}
}
}
app/src/main/java/org/nanohttpd/protocols/http/HTTPSession.java
View file @
00519999
...
@@ -36,6 +36,7 @@ package org.nanohttpd.protocols.http;
...
@@ -36,6 +36,7 @@ package org.nanohttpd.protocols.http;
import
android.util.Log
;
import
android.util.Log
;
import
com.example.numbertakingmachine.utils.MyApplication
;
import
com.example.numbertakingmachine.utils.SystemUtils
;
import
com.example.numbertakingmachine.utils.SystemUtils
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
...
@@ -132,10 +133,10 @@ public class HTTPSession implements IHTTPSession {
...
@@ -132,10 +133,10 @@ public class HTTPSession implements IHTTPSession {
this
.
tempFileManager
=
tempFileManager
;
this
.
tempFileManager
=
tempFileManager
;
this
.
inputStream
=
new
BufferedInputStream
(
inputStream
,
HTTPSession
.
BUFSIZE
);
this
.
inputStream
=
new
BufferedInputStream
(
inputStream
,
HTTPSession
.
BUFSIZE
);
this
.
outputStream
=
outputStream
;
this
.
outputStream
=
outputStream
;
// this.remoteIp = SystemUtils.getIpAddressString()
;
this
.
remoteIp
=
MyApplication
.
ip
;
// this.remoteIp = "localhost";
// this.remoteIp = "localhost";
this
.
remoteHostname
=
"localhost"
;
this
.
remoteHostname
=
"localhost"
;
this
.
remoteIp
=
inetAddress
.
isLoopbackAddress
()
||
inetAddress
.
isAnyLocalAddress
()
?
"127.0.0.1"
:
localhostIP
;
//
this.remoteIp = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "127.0.0.1" : localhostIP;
Log
.
d
(
"ssss获取到的ip"
,
remoteIp
);
Log
.
d
(
"ssss获取到的ip"
,
remoteIp
);
//this.remoteHostname = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "localhost" : inetAddress.getHostName().toString();
//this.remoteHostname = inetAddress.isLoopbackAddress() || inetAddress.isAnyLocalAddress() ? "localhost" : inetAddress.getHostName().toString();
this
.
headers
=
new
HashMap
<
String
,
String
>();
this
.
headers
=
new
HashMap
<
String
,
String
>();
...
...
app/src/main/res/layout/dialog_print_tips.xml
View file @
00519999
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
android:src=
"@drawable/sueecss"
/>
android:src=
"@drawable/sueecss"
/>
<TextView
<TextView
android:id=
"@+id/tips"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_alignParentRight=
"true"
...
...
app/src/main/res/layout/msg_item.xml
View file @
00519999
...
@@ -21,7 +21,8 @@
...
@@ -21,7 +21,8 @@
android:gravity=
"center"
android:gravity=
"center"
android:text=
"请"
android:text=
"请"
android:textColor=
"@color/grey_333"
android:textColor=
"@color/grey_333"
android:textSize=
"50px"
android:textSize=
"45px"
android:singleLine=
"true"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<TextView
<TextView
...
@@ -34,6 +35,7 @@
...
@@ -34,6 +35,7 @@
android:layout_marginRight=
"20px"
android:layout_marginRight=
"20px"
android:textColor=
"@color/blue_0183FF"
android:textColor=
"@color/blue_0183FF"
android:textSize=
"70px"
android:textSize=
"70px"
android:singleLine=
"true"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<TextView
<TextView
...
@@ -43,7 +45,8 @@
...
@@ -43,7 +45,8 @@
android:gravity=
"center"
android:gravity=
"center"
android:text=
"号患者到"
android:text=
"号患者到"
android:textColor=
"@color/grey_333"
android:textColor=
"@color/grey_333"
android:textSize=
"50px"
android:textSize=
"45px"
android:singleLine=
"true"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<TextView
<TextView
...
@@ -56,6 +59,7 @@
...
@@ -56,6 +59,7 @@
android:layout_marginRight=
"20px"
android:layout_marginRight=
"20px"
android:textColor=
"@color/blue_0183FF"
android:textColor=
"@color/blue_0183FF"
android:textSize=
"70px"
android:textSize=
"70px"
android:singleLine=
"true"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<TextView
<TextView
...
@@ -63,9 +67,10 @@
...
@@ -63,9 +67,10 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:gravity=
"center"
android:text=
"
号
窗口办理"
android:text=
"窗口办理"
android:textColor=
"@color/grey_333"
android:textColor=
"@color/grey_333"
android:textSize=
"50px"
android:textSize=
"45px"
android:singleLine=
"true"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
</LinearLayout>
</LinearLayout>
...
...
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