Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rs-cloud-platform
Project
Project
Details
Activity
Releases
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
周健威
rs-cloud-platform
Commits
08493dea
Commit
08493dea
authored
Dec 16, 2020
by
unset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改支付信息
parent
d69b1193
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
129 deletions
+107
-129
ConfirmOrderDto.java
...a/com/upyuns/platform/rs/website/dto/ConfirmOrderDto.java
+3
-15
ItemInfoDto.java
.../java/com/upyuns/platform/rs/website/dto/ItemInfoDto.java
+22
-0
ConfirmOrderInfoVo.java
...com/upyuns/platform/rs/website/vo/ConfirmOrderInfoVo.java
+1
-25
ItemInfoVo.java
...in/java/com/upyuns/platform/rs/website/vo/ItemInfoVo.java
+8
-8
ConfirmOrderService.java
...yuns/platform/rs/website/service/ConfirmOrderService.java
+73
-81
No files found.
rs-website/rs-website-api/src/main/java/com/upyuns/platform/rs/website/dto/ConfirmOrderDto.java
View file @
08493dea
...
...
@@ -2,6 +2,8 @@ package com.upyuns.platform.rs.website.dto;
import
lombok.Data
;
import
java.util.List
;
/**
* @ClassName : ConfirmOrderDto
* @Description : 确认订单
...
...
@@ -11,19 +13,5 @@ import lombok.Data;
@Data
public
class
ConfirmOrderDto
{
/**
* 类型: 1、标准数据,2、影像图库,3、行业应用信息, 4、购物车确认订单
*/
private
Integer
type
;
/**
* 购物车或者商品id, 逗号分隔
* 如果是影像图库,传的是图像ID imageRelationInfo
*/
private
String
ids
;
/**
* 数量
*/
private
Integer
number
;
List
<
ItemInfoDto
>
itemInfoDtoList
;
}
rs-website/rs-website-api/src/main/java/com/upyuns/platform/rs/website/dto/ItemInfoDto.java
0 → 100644
View file @
08493dea
package
com
.
upyuns
.
platform
.
rs
.
website
.
dto
;
import
lombok.Data
;
/**
* @ClassName : itemInfoDto
* @Description : 商品信息
* @Author : jiaoruizhen
* @Date: 2020-12-16 16:56
*/
@Data
public
class
ItemInfoDto
{
Integer
id
;
Integer
number
;
/**
* 类型: 1、标准数据,2、影像图库,3、行业应用信息, 4、购物车确认订单
*/
private
Integer
type
;
}
rs-website/rs-website-api/src/main/java/com/upyuns/platform/rs/website/vo/ConfirmOrderInfoVo.java
View file @
08493dea
...
...
@@ -50,30 +50,6 @@ public class ConfirmOrderInfoVo {
*/
private
BigDecimal
fee
;
/**
* 类型: 1、标准数据,2、影像图库,3、行业应用信息, 4、购物车确认订单
*/
private
Integer
type
;
/**
* 购物车或者商品id, 逗号分隔
*/
String
ids
;
/**
* 购物车信息列表
*/
List
<
ShoppingCartInfo
>
shoppingCartInfoList
;
/**
* 行业应用信息列表
*/
List
<
IndustryApplicationInfo
>
industryApplicationInfoList
;
/**
* 影像图库信息列表
*/
List
<
ImageImgStorage
>
imageImgStorageList
;
private
List
<
ItemInfoVo
>
itemInfoVoList
;
}
rs-website/rs-website-api/src/main/java/com/upyuns/platform/rs/website/vo/ItemInfoVo.java
View file @
08493dea
...
...
@@ -2,20 +2,20 @@ package com.upyuns.platform.rs.website.vo;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* @ClassName : ItemInfoVo
* @Description : 商品信息
* @Author : jiaoruizhen
* @Date: 2020-12-16 1
5:0
9
* @Date: 2020-12-16 1
6:5
9
*/
@Data
public
class
ItemInfoVo
{
private
String
name
;
/**
* 商品参数
*/
private
Integer
id
;
private
String
detailJson
;
private
Integer
number
;
private
BigDecimal
price
;
private
Integer
type
;
private
String
img
;
}
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/service/ConfirmOrderService.java
View file @
08493dea
package
com
.
upyuns
.
platform
.
rs
.
website
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.upyuns.platform.rs.universal.constant.DictionaryKey
;
import
com.upyuns.platform.rs.universal.entity.Dictionary
;
import
com.upyuns.platform.rs.universal.feign.ThirdFeign
;
import
com.upyuns.platform.rs.website.biz.*
;
import
com.upyuns.platform.rs.website.dto.ConfirmOrderDto
;
import
com.upyuns.platform.rs.website.dto.UserAddressDto
;
import
com.upyuns.platform.rs.website.dto.UserInvoiceDto
;
import
com.upyuns.platform.rs.website.dto.ItemInfoDto
;
import
com.upyuns.platform.rs.website.entity.*
;
import
com.upyuns.platform.rs.website.type.OrderTypeEnum
;
import
com.upyuns.platform.rs.website.vo.ConfirmOrderInfoVo
;
import
com.upyuns.platform.rs.website.vo.ItemInfoVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -48,98 +47,91 @@ public class ConfirmOrderService {
@Autowired
ThirdFeign
thirdFeign
;
@Autowired
UserAddressBiz
userAddressBiz
;
@Autowired
UserInvoiceBiz
userInvoiceBiz
;
/**
* 确认订单
* @param confirmOrderDto
* @return
*/
public
ObjectRestResponse
confirmOrderInfo
(
ConfirmOrderDto
confirmOrderDto
)
{
if
(
confirmOrderDto
==
null
||
confirmOrderDto
.
get
Type
()
==
null
||
StringUtils
.
isBlank
(
confirmOrderDto
.
getIds
())
)
{
if
(
confirmOrderDto
==
null
||
confirmOrderDto
.
get
ItemInfoDtoList
()
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
String
[]
idArr
=
confirmOrderDto
.
getIds
().
split
(
","
);
Set
<
Integer
>
idList
=
Arrays
.
asList
(
idArr
).
stream
().
map
(
s
->
Integer
.
parseInt
(
s
.
trim
())).
collect
(
Collectors
.
toSet
());
ConfirmOrderInfoVo
confirmOrderInfoVo
=
new
ConfirmOrderInfoVo
();
confirmOrderInfoVo
.
setType
(
confirmOrderDto
.
getType
());
confirmOrderInfoVo
.
setIds
(
confirmOrderDto
.
getIds
());
switch
(
OrderTypeEnum
.
getByCode
(
confirmOrderDto
.
getType
()))
{
//标准数据
case
STANDARD_DATA:
break
;
//行业应用
case
INDUSTRY_INFO:
List
<
IndustryApplicationInfo
>
industryApplicationInfoList
=
industryApplicationInfoBiz
.
getAllByIds
(
idList
);
if
(
industryApplicationInfoList
!=
null
&&
industryApplicationInfoList
.
size
()
>
0
)
{
confirmOrderInfoVo
.
setIndustryApplicationInfoList
(
industryApplicationInfoList
);
//总数量
Double
amount
=
industryApplicationInfoList
.
stream
().
mapToDouble
(
e
->
e
.
getPrice
().
doubleValue
()).
reduce
(
0
,
Double:
:
sum
);
confirmOrderInfoVo
.
setTotalAmount
(
new
BigDecimal
(
amount
));
confirmOrderInfoVo
.
setNumber
(
industryApplicationInfoList
.
size
());
}
break
;
//影像图库
case
IMAGE_STORAGE:
List
<
ImageInfoRelation
>
imageInfoRelationList
=
imageInfoRelationBiz
.
getAllByIds
(
confirmOrderDto
.
getIds
());
if
(
imageInfoRelationList
!=
null
&&
imageInfoRelationList
.
size
()
>
0
)
{
Map
<
Integer
,
List
<
ImageInfoRelation
>>
map
=
imageInfoRelationList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ImageInfoRelation:
:
getRelationId
));
List
<
ImageImgStorage
>
imageImgStorageList
=
imageImgStorageBiz
.
getAllByIds
(
imageInfoRelationList
.
stream
().
map
(
ImageInfoRelation:
:
getRelationId
).
collect
(
Collectors
.
toSet
()));
if
(
imageImgStorageList
!=
null
&&
imageImgStorageList
.
size
()
>
0
)
{
imageImgStorageList
.
parallelStream
().
forEach
(
imageImgStorage
->
{
if
(
map
!=
null
&&
map
.
get
(
imageImgStorage
.
getId
())
!=
null
)
{
imageImgStorage
.
setImageInfoRelationList
(
map
.
get
(
imageImgStorage
.
getId
()));
List
<
ItemInfoDto
>
itemInfoDtoList
=
confirmOrderDto
.
getItemInfoDtoList
();
if
(
itemInfoDtoList
!=
null
&&
itemInfoDtoList
.
size
()
>
0
)
{
List
<
ItemInfoVo
>
itemInfoVoList
=
new
ArrayList
<>();
AtomicReference
<
Integer
>
number
=
new
AtomicReference
<>(
0
);
AtomicReference
<
Double
>
amount
=
new
AtomicReference
<>((
double
)
0
);
itemInfoDtoList
.
parallelStream
().
forEach
(
itemInfoDto
->
{
switch
(
OrderTypeEnum
.
getByCode
(
itemInfoDto
.
getType
()))
{
//标准数据
case
STANDARD_DATA:
break
;
//行业应用
case
INDUSTRY_INFO:
IndustryApplicationInfo
industryApplicationInfo
=
industryApplicationInfoBiz
.
getOneById
(
itemInfoDto
.
getId
()).
getData
();
if
(
industryApplicationInfo
!=
null
)
{
ItemInfoVo
itemInfoVo
=
new
ItemInfoVo
();
itemInfoVo
.
setId
(
industryApplicationInfo
.
getId
());
itemInfoVo
.
setDetailJson
(
JSONObject
.
toJSONString
(
industryApplicationInfo
));
itemInfoVo
.
setImg
(
industryApplicationInfo
.
getCoverImg
());
itemInfoVo
.
setNumber
(
itemInfoDto
.
getNumber
());
itemInfoVo
.
setType
(
itemInfoDto
.
getType
());
itemInfoVo
.
setPrice
(
industryApplicationInfo
.
getPrice
());
itemInfoVoList
.
add
(
itemInfoVo
);
//总数量
number
.
updateAndGet
(
v
->
v
+
itemInfoDto
.
getNumber
());
BigDecimal
totalAmount
=
industryApplicationInfo
.
getPrice
().
multiply
(
new
BigDecimal
(
itemInfoDto
.
getNumber
()));
amount
.
updateAndGet
(
v
->
new
Double
((
double
)
(
v
+
totalAmount
.
doubleValue
())));
}
break
;
//影像图库
case
IMAGE_STORAGE:
ImageInfoRelation
imageInfoRelation
=
imageInfoRelationBiz
.
selectById
(
itemInfoDto
.
getId
());
if
(
imageInfoRelation
!=
null
)
{
ImageImgStorage
imageImgStorage
=
imageImgStorageBiz
.
getDetail
(
itemInfoDto
.
getId
()).
getData
();
if
(
imageImgStorage
!=
null
)
{
List
<
ImageInfoRelation
>
imageInfoRelationList
=
new
ArrayList
<>();
imageInfoRelationList
.
add
(
imageInfoRelation
);
imageImgStorage
.
setImageInfoRelationList
(
imageInfoRelationList
);
ItemInfoVo
itemInfoVo
=
new
ItemInfoVo
();
itemInfoVo
.
setId
(
imageImgStorage
.
getId
());
itemInfoVo
.
setPrice
(
imageInfoRelation
.
getPrice
());
itemInfoVo
.
setType
(
itemInfoDto
.
getType
());
itemInfoVo
.
setNumber
(
itemInfoDto
.
getNumber
());
itemInfoVo
.
setImg
(
imageImgStorage
.
getCoverImg
());
itemInfoVo
.
setDetailJson
(
JSONObject
.
toJSONString
(
imageImgStorage
));
itemInfoVoList
.
add
(
itemInfoVo
);
//总数量
number
.
updateAndGet
(
v
->
v
+
itemInfoDto
.
getNumber
());
BigDecimal
totalAmount
=
imageInfoRelation
.
getPrice
().
multiply
(
new
BigDecimal
(
itemInfoDto
.
getNumber
()));
amount
.
updateAndGet
(
v
->
new
Double
((
double
)
(
v
+
totalAmount
.
doubleValue
())));
}
});
confirmOrderInfoVo
.
setImageImgStorageList
(
imageImgStorageList
);
//总数量
confirmOrderInfoVo
.
setNumber
(
imageInfoRelationList
.
size
());
Double
amount
=
imageInfoRelationList
.
stream
().
mapToDouble
(
e
->
e
.
getPrice
().
doubleValue
()).
reduce
(
0
,
Double:
:
sum
);
confirmOrderInfoVo
.
setTotalAmount
(
new
BigDecimal
(
amount
));
}
}
break
;
//购物车
case
SHOPPING_CART_INFO:
List
<
ShoppingCartInfo
>
shoppingCartInfoList
=
shoppingCartInfoBiz
.
getAllByIds
(
idList
);
if
(
shoppingCartInfoList
!=
null
&&
shoppingCartInfoList
.
size
()
>
0
)
{
confirmOrderInfoVo
.
setShoppingCartInfoList
(
shoppingCartInfoList
);
Double
amount
=
shoppingCartInfoList
.
stream
().
mapToDouble
(
e
->
e
.
getTotalAmount
().
doubleValue
()).
reduce
(
0
,
Double:
:
sum
);
confirmOrderInfoVo
.
setTotalAmount
(
new
BigDecimal
(
amount
));
}
break
;
//购物车
case
SHOPPING_CART_INFO:
ShoppingCartInfo
shoppingCartInfo
=
shoppingCartInfoBiz
.
selectById
(
itemInfoDto
.
getId
());
if
(
shoppingCartInfo
!=
null
)
{
number
.
updateAndGet
(
v
->
v
+
itemInfoDto
.
getNumber
());
BigDecimal
totalAmount
=
shoppingCartInfo
.
getTotalAmount
();
amount
.
updateAndGet
(
v
->
new
Double
((
double
)
(
v
+
totalAmount
.
doubleValue
())));
}
break
;
default
:
break
;
}
break
;
default
:
break
;
})
;
confirmOrderInfoVo
.
setTotalAmount
(
new
BigDecimal
(
amount
.
get
()));
confirmOrderInfoVo
.
setNumber
(
number
.
get
())
;
}
confirmOrderInfoVo
.
setActAmount
(
confirmOrderInfoVo
.
getTotalAmount
());
confirmOrderInfoVo
.
setActAmount
(
confirmOrderInfoVo
.
getTotalAmount
());
Dictionary
dictionary
=
thirdFeign
.
findDictionaryByTypeAndCode
(
DictionaryKey
.
APP_ORDER
,
DictionaryKey
.
SEND_FEE
);
if
(
dictionary
!=
null
&&
StringUtils
.
isBlank
(
dictionary
.
getDetail
()))
{
confirmOrderInfoVo
.
setFee
(
new
BigDecimal
(
dictionary
.
getDetail
()));
}
try
{
List
<
UserAddress
>
userAddressList
=
userAddressBiz
.
getUserAddress
(
new
UserAddressDto
(){{
setPage
(
1
);
setLimit
(
Integer
.
MAX_VALUE
);}}).
getData
().
getData
();
if
(
userAddressList
!=
null
&&
userAddressList
.
size
()
>
0
)
{
confirmOrderInfoVo
.
setUserAddressList
(
userAddressList
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"用户地址信息错误: {}"
,
e
);
}
try
{
List
<
UserInvoice
>
userInvoiceList
=
userInvoiceBiz
.
getUserInvoiceInfo
(
new
UserInvoiceDto
(){{
setPage
(
1
);
setLimit
(
Integer
.
MAX_VALUE
);}}).
getData
().
getData
();
if
(
userInvoiceList
!=
null
&&
userInvoiceList
.
size
()
>
0
)
{
confirmOrderInfoVo
.
setUserInvoiceList
(
userInvoiceList
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"用户发票信息错误: {}"
,
e
);
}
return
ObjectRestResponse
.
succ
(
confirmOrderInfoVo
);
}
...
...
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