Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
machine
Overview
Overview
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
hooloo
android
machine
Commits
235a6e22
Commit
235a6e22
authored
May 31, 2022
by
wjg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改购物车数据格式
parent
eec3144d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
52 additions
and
78 deletions
+52
-78
app/src/main/java/com/ihaoin/hooloo/device/HLApplication.java
+3
-4
app/src/main/java/com/ihaoin/hooloo/device/component/NetworkHandler.java
+1
-2
app/src/main/java/com/ihaoin/hooloo/device/component/PushMessageReceiver.java
+18
-30
app/src/main/java/com/ihaoin/hooloo/device/config/AppConfig.java
+8
-1
app/src/main/java/com/ihaoin/hooloo/device/data/po/ConfirmGoods.java
+5
-16
app/src/main/java/com/ihaoin/hooloo/device/network/HttpUtil.java
+2
-4
app/src/main/java/com/ihaoin/hooloo/device/view/ConfirmOrderDialog.java
+12
-15
app/src/main/java/com/ihaoin/hooloo/device/view/GoodsDetailDialog.java
+0
-2
app/src/main/java/com/ihaoin/hooloo/device/view/LauncherActivity.java
+0
-0
todo.md
+3
-4
No files found.
app/src/main/java/com/ihaoin/hooloo/device/HLApplication.java
View file @
235a6e22
...
...
@@ -3,7 +3,6 @@ package com.ihaoin.hooloo.device;
import
android.app.Application
;
import
android.util.Log
;
import
com.ihaoin.hooloo.device.component.PushMessageReceiver
;
import
com.ihaoin.hooloo.device.config.AppConfig
;
import
com.ihaoin.hooloo.device.data.MainData
;
import
com.ihaoin.hooloo.device.network.HttpUtil
;
...
...
@@ -27,8 +26,8 @@ public class HLApplication extends Application {
@Override
public
void
onCreate
()
{
super
.
onCreate
();
UMConfigure
.
preInit
(
this
,
"6294708905844627b598aa78"
,
"device_order"
);
UMConfigure
.
init
(
this
,
"6294708905844627b598aa78"
,
"device_order"
,
0
,
null
);
UMConfigure
.
preInit
(
this
,
AppConfig
.
UMENG_APPKEY
,
AppConfig
.
UMENG_CHANNEL
);
UMConfigure
.
init
(
this
,
AppConfig
.
UMENG_APPKEY
,
AppConfig
.
UMENG_CHANNEL
,
0
,
null
);
AppConfig
.
MACHINE_CODE
=
SharedPreferencesUtils
.
getMachineCode
(
this
);
...
...
@@ -36,7 +35,7 @@ public class HLApplication extends Application {
JPushInterface
.
init
(
this
);
String
registrationId
=
JPushInterface
.
getRegistrationID
(
this
);
Log
.
d
(
PushMessageReceiver
.
TAG
,
registrationId
);
Log
.
d
(
AppConfig
.
TAG_PUSH
,
registrationId
);
if
(!
StringUtils
.
isEmpty
(
registrationId
))
{
HttpUtil
.
postRegistrationId
(
registrationId
,
null
);
}
...
...
app/src/main/java/com/ihaoin/hooloo/device/component/NetworkHandler.java
View file @
235a6e22
...
...
@@ -12,7 +12,6 @@ import com.ihaoin.hooloo.device.config.AppConfig;
* 所有网络请求处理父类
*/
public
abstract
class
NetworkHandler
extends
Handler
{
private
static
final
String
TAG
=
"HL_Network"
;
@Override
public
void
handleMessage
(
@NonNull
Message
msg
)
{
...
...
@@ -20,7 +19,7 @@ public abstract class NetworkHandler extends Handler {
if
(
AppConfig
.
DEBUG
)
{
String
url
=
msg
.
getData
().
getString
(
"url"
);
String
msgText
=
String
.
format
(
"请求:%s, 返回状态:%s, 返回内容:%s"
,
url
,
msg
.
what
,
msg
.
obj
);
Log
.
d
(
TAG
,
msgText
);
Log
.
d
(
AppConfig
.
TAG_NETWORK
,
msgText
);
}
if
(
msg
==
null
||
msg
.
what
==
0
)
{
return
;
...
...
app/src/main/java/com/ihaoin/hooloo/device/component/PushMessageReceiver.java
View file @
235a6e22
...
...
@@ -8,6 +8,7 @@ import android.util.Log;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ihaoin.hooloo.device.config.AppConfig
;
import
com.ihaoin.hooloo.device.network.HttpUtil
;
import
com.ihaoin.hooloo.device.util.StringUtils
;
...
...
@@ -22,7 +23,6 @@ import cn.jpush.android.api.NotificationMessage;
import
cn.jpush.android.service.JPushMessageReceiver
;
public
class
PushMessageReceiver
extends
JPushMessageReceiver
{
public
static
final
String
TAG
=
"HL_PushMessageReceiver"
;
private
static
Map
<
String
,
Handler
>
subscribers
=
new
HashMap
<>();
public
static
void
subscribe
(
String
key
,
Handler
handler
)
{
...
...
@@ -35,24 +35,24 @@ public class PushMessageReceiver extends JPushMessageReceiver {
@Override
public
void
onMessage
(
Context
context
,
CustomMessage
customMessage
)
{
Log
.
e
(
TAG
,
"[onMessage] "
+
customMessage
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onMessage] "
+
customMessage
);
dispatchMsg
(
customMessage
);
}
private
void
dispatchMsg
(
CustomMessage
customMessage
)
{
// if (CollectionUtils.isEmpty(subscribers)) {
// Log.e(
TAG,
"msg subscribers is empty");
// Log.e(
AppConfig.DEBUG_TAG_PUSH,
"msg subscribers is empty");
// return;
// }
JSONObject
jsonObject
=
JSON
.
parseObject
(
customMessage
.
message
);
String
action
=
jsonObject
.
getString
(
"action"
);
if
(
StringUtils
.
isEmpty
(
action
))
{
Log
.
e
(
TAG
,
"msg action is empty"
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"msg action is empty"
);
return
;
}
Handler
handler
=
subscribers
.
get
(
action
);
if
(
handler
==
null
)
{
Log
.
e
(
TAG
,
String
.
format
(
"msg action[%s] subscribers is empty"
,
action
));
Log
.
e
(
AppConfig
.
TAG_PUSH
,
String
.
format
(
"msg action[%s] subscribers is empty"
,
action
));
return
;
}
JSONObject
data
=
jsonObject
.
getJSONObject
(
"data"
);
...
...
@@ -62,66 +62,54 @@ public class PushMessageReceiver extends JPushMessageReceiver {
@Override
public
void
onNotifyMessageOpened
(
Context
context
,
NotificationMessage
message
)
{
Log
.
e
(
TAG
,
"[onNotifyMessageOpened] "
+
message
);
try
{
//打开自定义的Activity
// Intent i = new Intent(context, TestActivity.class);
// Bundle bundle = new Bundle();
// bundle.putString(JPushInterface.EXTRA_NOTIFICATION_TITLE,message.notificationTitle);
// bundle.putString(JPushInterface.EXTRA_ALERT,message.notificationContent);
// i.putExtras(bundle);
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
// context.startActivity(i);
}
catch
(
Throwable
throwable
)
{
}
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onNotifyMessageOpened] "
+
message
);
}
@Override
public
void
onMultiActionClicked
(
Context
context
,
Intent
intent
)
{
Log
.
e
(
TAG
,
"[onMultiActionClicked] 用户点击了通知栏按钮"
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onMultiActionClicked] 用户点击了通知栏按钮"
);
String
nActionExtra
=
intent
.
getExtras
().
getString
(
JPushInterface
.
EXTRA_NOTIFICATION_ACTION_EXTRA
);
//开发者根据不同 Action 携带的 extra 字段来分配不同的动作。
if
(
nActionExtra
==
null
)
{
Log
.
d
(
TAG
,
"ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null"
);
Log
.
d
(
AppConfig
.
TAG_PUSH
,
"ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null"
);
return
;
}
if
(
nActionExtra
.
equals
(
"my_extra1"
))
{
Log
.
e
(
TAG
,
"[onMultiActionClicked] 用户点击通知栏按钮一"
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onMultiActionClicked] 用户点击通知栏按钮一"
);
}
else
if
(
nActionExtra
.
equals
(
"my_extra2"
))
{
Log
.
e
(
TAG
,
"[onMultiActionClicked] 用户点击通知栏按钮二"
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onMultiActionClicked] 用户点击通知栏按钮二"
);
}
else
if
(
nActionExtra
.
equals
(
"my_extra3"
))
{
Log
.
e
(
TAG
,
"[onMultiActionClicked] 用户点击通知栏按钮三"
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onMultiActionClicked] 用户点击通知栏按钮三"
);
}
else
{
Log
.
e
(
TAG
,
"[onMultiActionClicked] 用户点击通知栏按钮未定义"
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onMultiActionClicked] 用户点击通知栏按钮未定义"
);
}
}
@Override
public
void
onNotifyMessageArrived
(
Context
context
,
NotificationMessage
message
)
{
Log
.
e
(
TAG
,
"[onNotifyMessageArrived] "
+
message
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onNotifyMessageArrived] "
+
message
);
}
@Override
public
void
onNotifyMessageDismiss
(
Context
context
,
NotificationMessage
message
)
{
Log
.
e
(
TAG
,
"[onNotifyMessageDismiss] "
+
message
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onNotifyMessageDismiss] "
+
message
);
}
@Override
public
void
onRegister
(
Context
context
,
String
registrationId
)
{
Log
.
e
(
TAG
,
"[onRegister] "
+
registrationId
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onRegister] "
+
registrationId
);
HttpUtil
.
postRegistrationId
(
registrationId
,
null
);
}
@Override
public
void
onConnected
(
Context
context
,
boolean
isConnected
)
{
Log
.
e
(
TAG
,
"[onConnected] "
+
isConnected
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onConnected] "
+
isConnected
);
}
@Override
public
void
onCommandResult
(
Context
context
,
CmdMessage
cmdMessage
)
{
Log
.
e
(
TAG
,
"[onCommandResult] "
+
cmdMessage
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onCommandResult] "
+
cmdMessage
);
}
@Override
...
...
@@ -151,6 +139,6 @@ public class PushMessageReceiver extends JPushMessageReceiver {
@Override
public
void
onNotificationSettingsCheck
(
Context
context
,
boolean
isOn
,
int
source
)
{
super
.
onNotificationSettingsCheck
(
context
,
isOn
,
source
);
Log
.
e
(
TAG
,
"[onNotificationSettingsCheck] isOn:"
+
isOn
+
",source:"
+
source
);
Log
.
e
(
AppConfig
.
TAG_PUSH
,
"[onNotificationSettingsCheck] isOn:"
+
isOn
+
",source:"
+
source
);
}
}
app/src/main/java/com/ihaoin/hooloo/device/config/AppConfig.java
View file @
235a6e22
...
...
@@ -3,11 +3,18 @@ package com.ihaoin.hooloo.device.config;
public
class
AppConfig
{
public
static
Boolean
DEBUG
=
true
;
// TODO false
public
static
String
DEBUG_TAG
=
"HL_TEST"
;
public
static
String
TAG
=
"HL_TEST"
;
public
static
String
TAG_PUSH
=
TAG
+
"_PUSH"
;
public
static
String
TAG_NETWORK
=
TAG
+
"_NETWORK"
;
/** 点单屏编码 */
public
static
String
DEFAULT_SCREEN_NO
=
"A"
;
/** 机器编码 */
public
static
String
MACHINE_CODE
=
""
;
/** 打开微信网址 */
public
static
String
WX_URL
=
"http://hooloo.gdatac.com/c2?id=%s"
;
public
static
String
UMENG_APPKEY
=
"6294708905844627b598aa78"
;
public
static
String
UMENG_CHANNEL
=
"DEVICE_ORDER"
;
}
app/src/main/java/com/ihaoin/hooloo/device/data/po/ConfirmGoods.java
View file @
235a6e22
...
...
@@ -5,7 +5,6 @@ import com.ihaoin.hooloo.device.data.vo.Sku;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
ConfirmGoods
implements
Serializable
{
...
...
@@ -25,10 +24,8 @@ public class ConfirmGoods implements Serializable {
private
String
remarks
;
/** 图片信息 */
private
Pics
pics
;
/** 标签 */
private
List
<
String
>
tags
;
/** 数量 */
private
Integer
count
;
private
Integer
num
;
/** sku */
private
Sku
sku
;
...
...
@@ -40,12 +37,12 @@ public class ConfirmGoods implements Serializable {
this
.
goodsId
=
goodsId
;
}
public
Integer
get
Count
()
{
return
count
;
public
Integer
get
Num
()
{
return
num
;
}
public
void
set
Count
(
Integer
count
)
{
this
.
count
=
count
;
public
void
set
Num
(
Integer
num
)
{
this
.
num
=
num
;
}
public
Sku
getSku
()
{
...
...
@@ -103,12 +100,4 @@ public class ConfirmGoods implements Serializable {
public
void
setPics
(
Pics
pics
)
{
this
.
pics
=
pics
;
}
public
List
<
String
>
getTags
()
{
return
tags
;
}
public
void
setTags
(
List
<
String
>
tags
)
{
this
.
tags
=
tags
;
}
}
app/src/main/java/com/ihaoin/hooloo/device/network/HttpUtil.java
View file @
235a6e22
...
...
@@ -23,8 +23,6 @@ import okhttp3.RequestBody;
import
okhttp3.Response
;
public
class
HttpUtil
{
private
static
final
String
TAG
=
"HL_Network"
;
public
static
void
post
(
String
url
,
String
body
,
Handler
handler
)
{
if
(
body
==
null
)
{
body
=
""
;
...
...
@@ -65,7 +63,7 @@ public class HttpUtil {
try
{
if
(
handler
==
null
)
{
String
msgText
=
String
.
format
(
"请求:%s, 返回状态:%s, 返回内容:%s"
,
call
.
request
().
url
(),
0
,
e
.
getMessage
());
Log
.
e
(
TAG
,
msgText
);
Log
.
e
(
AppConfig
.
TAG_NETWORK
,
msgText
);
return
;
}
sendHandlerMessage
(
0
,
handler
,
call
,
e
);
...
...
@@ -88,7 +86,7 @@ public class HttpUtil {
}
if
(
handler
==
null
)
{
String
msgText
=
String
.
format
(
"请求:%s, 返回状态:%s, 返回内容:%s"
,
call
.
request
().
url
(),
1
,
responseBody
);
Log
.
i
(
TAG
,
msgText
);
Log
.
i
(
AppConfig
.
TAG_NETWORK
,
msgText
);
return
;
}
sendHandlerMessage
(
1
,
handler
,
call
,
jsonObject
.
get
(
"data"
)
==
null
?
""
:
jsonObject
.
get
(
"data"
).
toString
());
...
...
app/src/main/java/com/ihaoin/hooloo/device/view/ConfirmOrderDialog.java
View file @
235a6e22
...
...
@@ -45,6 +45,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
public
class
ConfirmOrderDialog
extends
Dialog
{
private
List
<
ConfirmGoods
>
confirmGoods
=
new
ArrayList
<>();
...
...
@@ -154,7 +155,7 @@ public class ConfirmOrderDialog extends Dialog {
confirmOrder
.
setSeqNo
(
genSeqNo
());
confirmOrder
.
setGoods
(
confirmGoods
);
String
json
=
JsonUtils
.
getMapper
().
writeValueAsString
(
confirmOrder
);
Log
.
d
(
AppConfig
.
DEBUG_TAG
,
json
);
Log
.
d
(
AppConfig
.
TAG
,
"saveData json: "
+
json
);
return
json
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -338,15 +339,12 @@ public class ConfirmOrderDialog extends Dialog {
return
null
;
}
List
<
ConfirmGoods
>
mConfirmGoods
=
new
ArrayList
<>();
trolleyGoods
.
forEach
(
x
->
{
ConfirmGoods
goods
=
new
ConfirmGoods
();
goods
=
copyGoodsAttr
(
x
.
getGoods
(),
goods
);
goods
.
setSku
(
x
.
getSku
());
goods
.
setCount
(
x
.
getCount
());
mConfirmGoods
.
add
(
goods
);
});
return
mConfirmGoods
;
return
trolleyGoods
.
stream
().
map
(
x
->
{
ConfirmGoods
confirmGoods
=
getConfirmGoods
(
x
.
getGoods
());
confirmGoods
.
setSku
(
x
.
getSku
());
confirmGoods
.
setNum
(
x
.
getCount
());
return
confirmGoods
;
}).
collect
(
Collectors
.
toList
());
}
public
List
<
ConfirmGoods
>
translate
(
Goods
goods
,
Sku
sku
,
Integer
count
)
{
...
...
@@ -354,14 +352,14 @@ public class ConfirmOrderDialog extends Dialog {
return
null
;
}
ConfirmGoods
confirmGoods
=
new
ConfirmGoods
();
confirmGoods
=
copyGoodsAttr
(
goods
,
confirmGoods
);
ConfirmGoods
confirmGoods
=
getConfirmGoods
(
goods
);
confirmGoods
.
setSku
(
sku
);
confirmGoods
.
set
Count
(
count
);
confirmGoods
.
set
Num
(
count
);
return
Arrays
.
asList
(
confirmGoods
);
}
private
ConfirmGoods
copyGoodsAttr
(
Goods
goods
,
ConfirmGoods
confirmGoods
)
{
private
ConfirmGoods
getConfirmGoods
(
Goods
goods
)
{
ConfirmGoods
confirmGoods
=
new
ConfirmGoods
();
confirmGoods
.
setGoodsId
(
goods
.
getGoodsId
());
confirmGoods
.
setName
(
goods
.
getName
());
confirmGoods
.
setPrice
(
goods
.
getPrice
());
...
...
@@ -369,7 +367,6 @@ public class ConfirmOrderDialog extends Dialog {
confirmGoods
.
setDesc
(
goods
.
getDesc
());
confirmGoods
.
setRemarks
(
goods
.
getRemarks
());
confirmGoods
.
setPics
(
goods
.
getPics
());
confirmGoods
.
setTags
(
goods
.
getTags
());
return
confirmGoods
;
}
}
app/src/main/java/com/ihaoin/hooloo/device/view/GoodsDetailDialog.java
View file @
235a6e22
...
...
@@ -98,8 +98,6 @@ public class GoodsDetailDialog extends Dialog {
introViews
=
new
ArrayList
<>();
if
(
goods
.
getPics
()
!=
null
&&
!
CollectionUtils
.
isEmpty
(
goods
.
getPics
().
getIntroImages
()))
{
// goods.getPics().getIntroImages().addAll(goods.getPics().getIntroImages()); // TODO TEST
for
(
int
i
=
0
;
i
<
goods
.
getPics
().
getIntroImages
().
size
();
i
++)
{
String
url
=
goods
.
getPics
().
getIntroImages
().
get
(
i
);
View
imgIntro
=
getIntroImage
(
url
);
...
...
app/src/main/java/com/ihaoin/hooloo/device/view/LauncherActivity.java
View file @
235a6e22
This diff is collapsed.
Click to expand it.
todo.md
View file @
235a6e22
## 未解决事项
*****
1.
菜单屏 订单状态变化推送对接
\ No newline at end of file
## 未解决事项 TODO
*****
\ No newline at end of file
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