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
eec3144d
Commit
eec3144d
authored
May 31, 2022
by
wjg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改购物车数据格式
parent
7d83dd71
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
304 additions
and
208 deletions
+304
-208
app/src/main/java/com/ihaoin/hooloo/device/adapter/TrolleyAdapter.java
+14
-9
app/src/main/java/com/ihaoin/hooloo/device/data/TrolleyGoods.java
+156
-140
app/src/main/java/com/ihaoin/hooloo/device/data/po/ConfirmGoods.java
+90
-9
app/src/main/java/com/ihaoin/hooloo/device/view/ConfirmOrderDialog.java
+28
-36
app/src/main/java/com/ihaoin/hooloo/device/view/TrolleyView.java
+16
-14
No files found.
app/src/main/java/com/ihaoin/hooloo/device/adapter/TrolleyAdapter.java
View file @
eec3144d
...
...
@@ -12,6 +12,8 @@ import android.widget.ToggleButton;
import
com.ihaoin.hooloo.device.R
;
import
com.ihaoin.hooloo.device.data.TrolleyGoods
;
import
com.ihaoin.hooloo.device.data.vo.Goods
;
import
com.ihaoin.hooloo.device.data.vo.Sku
;
import
com.ihaoin.hooloo.device.util.CollectionUtils
;
import
com.ihaoin.hooloo.device.util.StringAppend
;
import
com.ihaoin.hooloo.device.util.Utils
;
...
...
@@ -31,7 +33,10 @@ public class TrolleyAdapter extends BaseAdapter {
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
TrolleyGoods
goods
=
(
TrolleyGoods
)
this
.
getItem
(
position
);
TrolleyGoods
trolleyGoods
=
(
TrolleyGoods
)
this
.
getItem
(
position
);
Goods
goods
=
trolleyGoods
.
getGoods
();
Sku
sku
=
trolleyGoods
.
getSku
();
convertView
=
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
item_trolley
,
null
);
ToggleButton
butnState
=
convertView
.
findViewById
(
R
.
id
.
butn_state
);
ImageView
imgThumbnail
=
convertView
.
findViewById
(
R
.
id
.
img_thumbnail
);
...
...
@@ -44,12 +49,12 @@ public class TrolleyAdapter extends BaseAdapter {
TextView
txtCount
=
convertView
.
findViewById
(
R
.
id
.
txt_count
);
View
butnAdd
=
convertView
.
findViewById
(
R
.
id
.
butn_add
);
butnState
.
setChecked
(
g
oods
.
getChecked
());
butnState
.
setChecked
(
trolleyG
oods
.
getChecked
());
butnState
.
setOnCheckedChangeListener
((
buttonView
,
isChecked
)
->
{
g
oods
.
setChecked
(
isChecked
);
trolleyG
oods
.
setChecked
(
isChecked
);
if
(
isChecked
)
{
if
(!
trolleyView
.
checkGoodsCount
())
{
// 购物车选中数量超过阈值,不允许选中
g
oods
.
setChecked
(
false
);
trolleyG
oods
.
setChecked
(
false
);
butnState
.
setChecked
(
false
);
return
;
}
...
...
@@ -57,21 +62,21 @@ public class TrolleyAdapter extends BaseAdapter {
trolleyView
.
goodsChanged
();
});
txtName
.
setText
(
goods
.
getName
());
if
(!
CollectionUtils
.
isEmpty
(
goods
.
getRules
()))
{
if
(!
CollectionUtils
.
isEmpty
(
sku
.
getRules
()))
{
StringAppend
stringAppend
=
new
StringAppend
(
"/"
);
goods
.
getRules
().
forEach
(
x
->
stringAppend
.
append
(
x
.
getRuleName
()));
sku
.
getRules
().
forEach
(
x
->
stringAppend
.
append
(
x
.
getRuleName
()));
txtOptions
.
setText
(
stringAppend
.
toString
());
txtOptions
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
txtOptions
.
setVisibility
(
View
.
GONE
);
}
txtPrice
.
setText
(
Utils
.
toString
(
goods
.
getPrice
()));
txtDiscount
.
setText
(
Utils
.
toString
(
goods
.
getDiscount
()));
txtPrice
.
setText
(
Utils
.
toString
(
sku
.
getPrice
()));
txtDiscount
.
setText
(
Utils
.
toString
(
sku
.
getDiscount
()));
icoPrice
.
setPaintFlags
(
icoPrice
.
getPaintFlags
()
|
Paint
.
STRIKE_THRU_TEXT_FLAG
);
txtPrice
.
setPaintFlags
(
txtPrice
.
getPaintFlags
()
|
Paint
.
STRIKE_THRU_TEXT_FLAG
);
txtCount
.
setText
(
g
oods
.
getCount
().
toString
());
txtCount
.
setText
(
trolleyG
oods
.
getCount
().
toString
());
butnSubtract
.
setOnClickListener
(
v
->
trolleyView
.
subtractGoods
(
position
));
butnAdd
.
setOnClickListener
(
v
->
trolleyView
.
addGoods
(
position
));
Utils
.
getGlide
(
mContext
).
load
(
goods
.
getPics
().
getThumbnail
()).
into
(
imgThumbnail
);
...
...
app/src/main/java/com/ihaoin/hooloo/device/data/TrolleyGoods.java
View file @
eec3144d
package
com
.
ihaoin
.
hooloo
.
device
.
data
;
import
com.ihaoin.hooloo.device.data.vo.
Pic
s
;
import
com.ihaoin.hooloo.device.data.vo.Sku
Rule
;
import
com.ihaoin.hooloo.device.data.vo.
Good
s
;
import
com.ihaoin.hooloo.device.data.vo.Sku
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
TrolleyGoods
implements
Serializable
{
/**
...
...
@@ -16,60 +14,78 @@ public class TrolleyGoods implements Serializable {
* 是否选中
*/
private
Boolean
checked
=
true
;
/** 商品信息 */
/**
* 商品id
*/
private
Integer
goodId
;
/**
* 名称
*/
private
String
name
;
/**
* 介绍
*/
private
String
desc
;
/**
* 图片信息
*/
private
Pics
pics
;
/**
* 标签
*/
private
List
<
String
>
tags
;
/** 购买sku信息 */
/**
* sku id
*/
private
Integer
skuId
;
/**
* 状态:1-可售、2-不可售
*/
private
Integer
state
;
/**
* 默认状态:0-否,1-是
*/
private
Integer
isDefault
;
/**
* 原价
*/
private
BigDecimal
price
;
/**
* 折扣价
*/
private
BigDecimal
discount
;
/**
* SKU规格
*/
private
List
<
SkuRule
>
rules
;
/**
* 数量
*/
private
Integer
count
;
private
Goods
goods
;
private
Sku
sku
;
public
Goods
getGoods
()
{
return
goods
;
}
public
void
setGoods
(
Goods
goods
)
{
this
.
goods
=
goods
;
}
public
Sku
getSku
()
{
return
sku
;
}
public
void
setSku
(
Sku
sku
)
{
this
.
sku
=
sku
;
}
// /** 商品信息 */
// /**
// * 商品id
// */
// private Integer goodId;
// /**
// * 名称
// */
// private String name;
// /**
// * 介绍
// */
// private String desc;
// /**
// * 图片信息
// */
// private Pics pics;
// /**
// * 标签
// */
// private List<String> tags;
//
// /** 购买sku信息 */
// /**
// * sku id
// */
// private Integer skuId;
// /**
// * 状态:1-可售、2-不可售
// */
// private Integer state;
// /**
// * 默认状态:0-否,1-是
// */
// private Integer isDefault;
// /**
// * 原价
// */
// private BigDecimal price;
// /**
// * 折扣价
// */
// private BigDecimal discount;
// /**
// * SKU规格
// */
// private List<SkuRule> rules;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
o
==
null
)
{
...
...
@@ -97,93 +113,93 @@ public class TrolleyGoods implements Serializable {
this
.
checked
=
checked
;
}
public
Integer
getGoodId
()
{
return
goodId
;
}
public
void
setGoodId
(
Integer
goodId
)
{
this
.
goodId
=
goodId
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
Pics
getPics
()
{
return
pics
;
}
public
void
setPics
(
Pics
pics
)
{
this
.
pics
=
pics
;
}
public
List
<
String
>
getTags
()
{
return
tags
;
}
public
void
setTags
(
List
<
String
>
tags
)
{
this
.
tags
=
tags
;
}
public
Integer
getSkuId
()
{
return
skuId
;
}
public
void
setSkuId
(
Integer
skuId
)
{
this
.
skuId
=
skuId
;
}
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
public
Integer
getIsDefault
()
{
return
isDefault
;
}
public
void
setIsDefault
(
Integer
isDefault
)
{
this
.
isDefault
=
isDefault
;
}
public
BigDecimal
getPrice
()
{
return
price
;
}
public
void
setPrice
(
BigDecimal
price
)
{
this
.
price
=
price
;
}
public
BigDecimal
getDiscount
()
{
return
discount
;
}
public
void
setDiscount
(
BigDecimal
discount
)
{
this
.
discount
=
discount
;
}
public
List
<
SkuRule
>
getRules
()
{
return
rules
;
}
public
void
setRules
(
List
<
SkuRule
>
rules
)
{
this
.
rules
=
rules
;
}
//
public Integer getGoodId() {
//
return goodId;
//
}
//
//
public void setGoodId(Integer goodId) {
//
this.goodId = goodId;
//
}
//
//
public String getName() {
//
return name;
//
}
//
//
public void setName(String name) {
//
this.name = name;
//
}
//
//
public String getDesc() {
//
return desc;
//
}
//
//
public void setDesc(String desc) {
//
this.desc = desc;
//
}
//
//
public Pics getPics() {
//
return pics;
//
}
//
//
public void setPics(Pics pics) {
//
this.pics = pics;
//
}
//
//
public List<String> getTags() {
//
return tags;
//
}
//
//
public void setTags(List<String> tags) {
//
this.tags = tags;
//
}
//
//
public Integer getSkuId() {
//
return skuId;
//
}
//
//
public void setSkuId(Integer skuId) {
//
this.skuId = skuId;
//
}
//
//
public Integer getState() {
//
return state;
//
}
//
//
public void setState(Integer state) {
//
this.state = state;
//
}
//
//
public Integer getIsDefault() {
//
return isDefault;
//
}
//
//
public void setIsDefault(Integer isDefault) {
//
this.isDefault = isDefault;
//
}
//
//
public BigDecimal getPrice() {
//
return price;
//
}
//
//
public void setPrice(BigDecimal price) {
//
this.price = price;
//
}
//
//
public BigDecimal getDiscount() {
//
return discount;
//
}
//
//
public void setDiscount(BigDecimal discount) {
//
this.discount = discount;
//
}
//
//
public List<SkuRule> getRules() {
//
return rules;
//
}
//
//
public void setRules(List<SkuRule> rules) {
//
this.rules = rules;
//
}
public
Integer
getCount
()
{
return
count
;
...
...
app/src/main/java/com/ihaoin/hooloo/device/data/po/ConfirmGoods.java
View file @
eec3144d
package
com
.
ihaoin
.
hooloo
.
device
.
data
.
po
;
import
com.ihaoin.hooloo.device.data.vo.Pics
;
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
{
...
...
@@ -9,11 +13,24 @@ public class ConfirmGoods implements Serializable {
* 商品id
*/
private
Integer
goodsId
;
/**
* sku列表
*/
private
List
<
ConfirmSku
>
skus
;
/** 名称 */
private
String
name
;
/** 原价 */
private
BigDecimal
price
;
/** 折扣价 */
private
BigDecimal
discount
;
/** 介绍 */
private
String
desc
;
/** 备注 */
private
String
remarks
;
/** 图片信息 */
private
Pics
pics
;
/** 标签 */
private
List
<
String
>
tags
;
/** 数量 */
private
Integer
count
;
/** sku */
private
Sku
sku
;
public
Integer
getGoodsId
()
{
return
goodsId
;
...
...
@@ -23,11 +40,75 @@ public class ConfirmGoods implements Serializable {
this
.
goodsId
=
goodsId
;
}
public
List
<
ConfirmSku
>
getSkus
()
{
return
skus
;
public
Integer
getCount
()
{
return
count
;
}
public
void
setCount
(
Integer
count
)
{
this
.
count
=
count
;
}
public
Sku
getSku
()
{
return
sku
;
}
public
void
setSku
(
Sku
sku
)
{
this
.
sku
=
sku
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
BigDecimal
getPrice
()
{
return
price
;
}
public
void
setPrice
(
BigDecimal
price
)
{
this
.
price
=
price
;
}
public
BigDecimal
getDiscount
()
{
return
discount
;
}
public
void
setDiscount
(
BigDecimal
discount
)
{
this
.
discount
=
discount
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getRemarks
()
{
return
remarks
;
}
public
void
setRemarks
(
String
remarks
)
{
this
.
remarks
=
remarks
;
}
public
Pics
getPics
()
{
return
pics
;
}
public
void
setPics
(
Pics
pics
)
{
this
.
pics
=
pics
;
}
public
List
<
String
>
getTags
()
{
return
tags
;
}
public
void
set
Skus
(
List
<
ConfirmSku
>
sku
s
)
{
this
.
skus
=
sku
s
;
public
void
set
Tags
(
List
<
String
>
tag
s
)
{
this
.
tags
=
tag
s
;
}
}
app/src/main/java/com/ihaoin/hooloo/device/view/ConfirmOrderDialog.java
View file @
eec3144d
...
...
@@ -30,7 +30,6 @@ import com.ihaoin.hooloo.device.config.Base;
import
com.ihaoin.hooloo.device.data.TrolleyGoods
;
import
com.ihaoin.hooloo.device.data.po.ConfirmGoods
;
import
com.ihaoin.hooloo.device.data.po.ConfirmOrder
;
import
com.ihaoin.hooloo.device.data.po.ConfirmSku
;
import
com.ihaoin.hooloo.device.data.vo.Goods
;
import
com.ihaoin.hooloo.device.data.vo.Sku
;
import
com.ihaoin.hooloo.device.network.HttpUtil
;
...
...
@@ -44,13 +43,11 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
public
class
ConfirmOrderDialog
extends
Dialog
{
private
List
<
ConfirmGoods
>
g
oods
=
new
ArrayList
<>();
private
List
<
ConfirmGoods
>
confirmG
oods
=
new
ArrayList
<>();
private
UIHandler
uiHandler
;
private
ConfirmOrderHandler
confirmOrderHandler
;
private
Thread
expireThread
;
...
...
@@ -72,11 +69,11 @@ public class ConfirmOrderDialog extends Dialog {
}
public
void
setGoods
(
List
<
TrolleyGoods
>
trolleyGoods
)
{
this
.
g
oods
=
translate
(
trolleyGoods
);
this
.
confirmG
oods
=
translate
(
trolleyGoods
);
}
public
void
setGoods
(
Goods
goods
,
Sku
sku
,
Integer
count
)
{
this
.
g
oods
=
translate
(
goods
,
sku
,
count
);
this
.
confirmG
oods
=
translate
(
goods
,
sku
,
count
);
}
@Override
...
...
@@ -155,7 +152,7 @@ public class ConfirmOrderDialog extends Dialog {
confirmOrder
.
setMachineCode
(
AppConfig
.
MACHINE_CODE
);
confirmOrder
.
setScreenNo
(
SharedPreferencesUtils
.
getScreenNo
(
getContext
()));
confirmOrder
.
setSeqNo
(
genSeqNo
());
confirmOrder
.
setGoods
(
g
oods
);
confirmOrder
.
setGoods
(
confirmG
oods
);
String
json
=
JsonUtils
.
getMapper
().
writeValueAsString
(
confirmOrder
);
Log
.
d
(
AppConfig
.
DEBUG_TAG
,
json
);
return
json
;
...
...
@@ -340,29 +337,16 @@ public class ConfirmOrderDialog extends Dialog {
if
(
CollectionUtils
.
isEmpty
(
trolleyGoods
))
{
return
null
;
}
Map
<
Integer
,
List
<
TrolleyGoods
>>
map
=
trolleyGoods
.
stream
().
collect
(
Collectors
.
groupingBy
(
TrolleyGoods:
:
getGoodId
));
if
(
CollectionUtils
.
isEmpty
(
map
))
{
return
null
;
}
List
<
ConfirmGoods
>
confirmGoods
=
new
ArrayList
<>();
Iterator
<
Integer
>
iterator
=
map
.
keySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Integer
goodsId
=
iterator
.
next
();
List
<
TrolleyGoods
>
goods
=
map
.
get
(
goodsId
);
List
<
ConfirmSku
>
skus
=
goods
.
stream
().
map
(
x
->
{
ConfirmSku
confirmSku
=
new
ConfirmSku
();
confirmSku
.
setSkuId
(
x
.
getSkuId
());
confirmSku
.
setCount
(
x
.
getCount
());
return
confirmSku
;
}).
collect
(
Collectors
.
toList
());
ConfirmGoods
g
=
new
ConfirmGoods
();
g
.
setGoodsId
(
goodsId
);
g
.
setSkus
(
skus
);
confirmGoods
.
add
(
g
);
}
return
confirmGoods
;
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
;
}
public
List
<
ConfirmGoods
>
translate
(
Goods
goods
,
Sku
sku
,
Integer
count
)
{
...
...
@@ -370,14 +354,22 @@ public class ConfirmOrderDialog extends Dialog {
return
null
;
}
ConfirmSku
confirmSku
=
new
ConfirmSku
();
confirmSku
.
setSkuId
(
sku
.
getSkuId
());
confirmSku
.
setCount
(
count
);
List
<
ConfirmSku
>
skus
=
Arrays
.
asList
(
confirmSku
);
ConfirmGoods
confirmGoods
=
new
ConfirmGoods
();
confirmGoods
.
setGoodsId
(
goods
.
getGoodsId
());
confirmGoods
.
setSkus
(
skus
);
confirmGoods
=
copyGoodsAttr
(
goods
,
confirmGoods
);
confirmGoods
.
setSku
(
sku
);
confirmGoods
.
setCount
(
count
);
return
Arrays
.
asList
(
confirmGoods
);
}
private
ConfirmGoods
copyGoodsAttr
(
Goods
goods
,
ConfirmGoods
confirmGoods
)
{
confirmGoods
.
setGoodsId
(
goods
.
getGoodsId
());
confirmGoods
.
setName
(
goods
.
getName
());
confirmGoods
.
setPrice
(
goods
.
getPrice
());
confirmGoods
.
setDiscount
(
goods
.
getDiscount
());
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/TrolleyView.java
View file @
eec3144d
...
...
@@ -118,7 +118,7 @@ public class TrolleyView extends RelativeLayout {
Toast
.
makeText
(
this
.
getContext
(),
getContext
().
getString
(
R
.
string
.
count_limit
,
getCountOfOrder
().
toString
()),
Toast
.
LENGTH_SHORT
).
show
();
return
;
}
Optional
<
TrolleyGoods
>
optional
=
this
.
trolleyGoods
.
stream
().
filter
(
x
->
x
.
getGood
Id
().
equals
(
goods
.
getGoodsId
())
&&
x
.
getSkuId
().
equals
(
sku
.
getSkuId
())).
findAny
();
Optional
<
TrolleyGoods
>
optional
=
this
.
trolleyGoods
.
stream
().
filter
(
x
->
x
.
getGood
s
().
getGoodsId
().
equals
(
goods
.
getGoodsId
())
&&
x
.
getSku
()
.
getSkuId
().
equals
(
sku
.
getSkuId
())).
findAny
();
// 判断是否在购物车里存在同样规格的产品
if
(
optional
.
isPresent
())
{
TrolleyGoods
g
=
optional
.
get
();
...
...
@@ -127,17 +127,19 @@ public class TrolleyView extends RelativeLayout {
TrolleyGoods
g
=
new
TrolleyGoods
();
g
.
setId
(
RandomUtils
.
nextLong
(
trolleyGoods
.
stream
().
map
(
TrolleyGoods:
:
getId
).
collect
(
Collectors
.
toList
())));
g
.
setChecked
(
true
);
g
.
setGoodId
(
goods
.
getGoodsId
());
g
.
setName
(
goods
.
getName
());
g
.
setDesc
(
goods
.
getDesc
());
g
.
setPics
(
goods
.
getPics
());
g
.
setTags
(
goods
.
getTags
());
g
.
setSkuId
(
sku
.
getSkuId
());
g
.
setState
(
sku
.
getState
());
g
.
setIsDefault
(
sku
.
getIsDefault
());
g
.
setPrice
(
sku
.
getPrice
());
g
.
setDiscount
(
sku
.
getDiscount
());
g
.
setRules
(
sku
.
getRules
());
g
.
setGoods
(
goods
);
g
.
setSku
(
sku
);
// g.setGoodId(goods.getGoodsId());
// g.setName(goods.getName());
// g.setDesc(goods.getDesc());
// g.setPics(goods.getPics());
// g.setTags(goods.getTags());
// g.setSkuId(sku.getSkuId());
// g.setState(sku.getState());
// g.setIsDefault(sku.getIsDefault());
// g.setPrice(sku.getPrice());
// g.setDiscount(sku.getDiscount());
// g.setRules(sku.getRules());
g
.
setCount
(
count
);
this
.
trolleyGoods
.
add
(
g
);
}
...
...
@@ -196,11 +198,11 @@ public class TrolleyView extends RelativeLayout {
}
private
BigDecimal
getTotal
()
{
return
this
.
getTrolleyGoods
().
stream
().
map
(
x
->
x
.
getDiscount
().
multiply
(
new
BigDecimal
(
x
.
getCount
()))).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
return
this
.
getTrolleyGoods
().
stream
().
map
(
x
->
x
.
get
Sku
().
get
Discount
().
multiply
(
new
BigDecimal
(
x
.
getCount
()))).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
}
private
BigDecimal
getCheckedTotal
()
{
return
this
.
getTrolleyGoods
().
stream
().
filter
(
TrolleyGoods:
:
getChecked
).
map
(
x
->
x
.
getDiscount
().
multiply
(
new
BigDecimal
(
x
.
getCount
()))).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
return
this
.
getTrolleyGoods
().
stream
().
filter
(
TrolleyGoods:
:
getChecked
).
map
(
x
->
x
.
get
Sku
().
get
Discount
().
multiply
(
new
BigDecimal
(
x
.
getCount
()))).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
}
private
void
setView
()
{
...
...
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