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
949f94c5
Commit
949f94c5
authored
Dec 17, 2020
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
2326e516
9eb99111
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
6 deletions
+74
-6
OrderInfoBiz.java
...java/com/upyuns/platform/rs/website/biz/OrderInfoBiz.java
+21
-1
ShoppingCartInfoBiz.java
...m/upyuns/platform/rs/website/biz/ShoppingCartInfoBiz.java
+37
-4
ConfirmOrderService.java
...yuns/platform/rs/website/service/ConfirmOrderService.java
+16
-1
No files found.
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/biz/OrderInfoBiz.java
View file @
949f94c5
...
...
@@ -10,6 +10,8 @@ import com.github.wxiaoqi.security.common.util.OrderUtil;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.upyuns.platform.rs.datacenter.fegin.DatacenterFeign
;
import
com.upyuns.platform.rs.datacenter.pojo.ImageDataVO
;
import
com.upyuns.platform.rs.universal.constant.DictionaryKey
;
import
com.upyuns.platform.rs.universal.entity.Dictionary
;
import
com.upyuns.platform.rs.universal.feign.ThirdFeign
;
...
...
@@ -80,6 +82,9 @@ public class OrderInfoBiz extends BaseBiz<OrderInfoMapper, OrderInfo> {
@Autowired
UserInvoiceBiz
userInvoiceBiz
;
@Autowired
DatacenterFeign
datacenterFeign
;
/**
* 添加订单
* @param orderInfo
...
...
@@ -253,7 +258,22 @@ public class OrderInfoBiz extends BaseBiz<OrderInfoMapper, OrderInfo> {
switch
(
OrderTypeEnum
.
getByCode
(
itemInfoDto
.
getType
()))
{
//标准数据
case
STANDARD_DATA:
List
<
ImageDataVO
>
imageDataVOList
=
datacenterFeign
.
queryByIds
(
orderInfoDto
.
getDetailId
()
+
""
).
getData
();
if
(
imageDataVOList
!=
null
&&
imageDataVOList
.
size
()
>
0
)
{
ImageDataVO
imageDataVO
=
imageDataVOList
.
get
(
0
);
OrderItem
orderItem
=
new
OrderItem
();
orderItem
.
setType
(
itemInfoDto
.
getType
());
orderItem
.
setTotalAmount
(
imageDataVO
.
getPrice
().
multiply
(
new
BigDecimal
(
itemInfoDto
.
getNumber
())));
orderItem
.
setPrice
(
imageDataVO
.
getPrice
());
orderItem
.
setNumber
(
itemInfoDto
.
getNumber
());
orderItem
.
setDetailJson
(
JSONObject
.
toJSONString
(
imageDataVO
));
orderItem
.
setDetailId
(
Long
.
valueOf
(
imageDataVO
.
getId
()));
orderItemList
.
add
(
orderItem
);
//总数量
number
.
updateAndGet
(
v
->
v
+
itemInfoDto
.
getNumber
());
BigDecimal
totalAmount
=
imageDataVO
.
getPrice
().
multiply
(
new
BigDecimal
(
itemInfoDto
.
getNumber
()));
amount
.
updateAndGet
(
v
->
new
Double
((
double
)
(
v
+
totalAmount
.
doubleValue
())));
}
break
;
//行业应用
case
INDUSTRY_INFO:
...
...
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/biz/ShoppingCartInfoBiz.java
View file @
949f94c5
...
...
@@ -9,10 +9,13 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.upyuns.platform.rs.datacenter.fegin.DatacenterFeign
;
import
com.upyuns.platform.rs.datacenter.pojo.ImageDataVO
;
import
com.upyuns.platform.rs.website.dto.CartOrderDto
;
import
com.upyuns.platform.rs.website.dto.OrderInfoDto
;
import
com.upyuns.platform.rs.website.entity.*
;
import
com.upyuns.platform.rs.website.type.OrderTypeEnum
;
import
com.upyuns.platform.rs.website.vo.ItemInfoVo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -56,6 +59,9 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
@Autowired
HttpServletRequest
request
;
@Autowired
DatacenterFeign
datacenterFeign
;
/**
* 添加购物车
*
...
...
@@ -112,14 +118,41 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
//标准数据
if
(
OrderTypeEnum
.
STANDARD_DATA
.
getType
().
equals
(
orderInfoDto
.
getType
()))
{
List
<
ImageDataVO
>
imageDataVOList
=
datacenterFeign
.
queryByIds
(
orderInfoDto
.
getDetailId
()
+
""
).
getData
();
if
(
imageDataVOList
!=
null
&&
imageDataVOList
.
size
()
>
0
)
{
ImageDataVO
imageDataVO
=
imageDataVOList
.
get
(
0
);
ShoppingCartInfo
old
=
selectByUser
(
appUserDTO
.
getUserid
(),
Long
.
valueOf
(
imageDataVO
.
getId
()));
if
(
old
!=
null
)
{
old
.
setNumber
(
old
.
getNumber
()
+
orderInfoDto
.
getNumber
());
old
.
setTotalAmount
(
old
.
getPrice
().
multiply
(
new
BigDecimal
(
old
.
getNumber
())));
updateSelectiveByIdRe
(
old
);
}
else
{
ShoppingCartInfo
shoppingCartInfo
=
new
ShoppingCartInfo
();
shoppingCartInfo
.
setDetailId
(
Long
.
valueOf
(
imageDataVO
.
getId
()));
shoppingCartInfo
.
setDetailJson
(
JSONObject
.
toJSONString
(
imageDataVO
));
shoppingCartInfo
.
setPrice
(
orderInfoDto
.
getPrice
());
shoppingCartInfo
.
setFilePath
(
orderInfoDto
.
getFilePath
());
shoppingCartInfo
.
setNumber
(
orderInfoDto
.
getNumber
());
shoppingCartInfo
.
setTotalAmount
(
orderInfoDto
.
getPrice
().
multiply
(
new
BigDecimal
(
orderInfoDto
.
getNumber
())));
shoppingCartInfo
.
setType
(
orderInfoDto
.
getType
());
//添加用户信息
shoppingCartInfo
.
setRealName
(
appUserDTO
.
getRealname
());
shoppingCartInfo
.
setNickname
(
appUserDTO
.
getNickname
());
shoppingCartInfo
.
setHeadImg
(
appUserDTO
.
getHeadimgurl
());
shoppingCartInfo
.
setPhone
(
appUserDTO
.
getUsername
());
shoppingCartInfo
.
setUserId
(
appUserDTO
.
getUserid
());
addUpdate
(
shoppingCartInfo
);
}
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
NOTEXIST_CODE
));
}
}
//影像图库
if
(
OrderTypeEnum
.
IMAGE_STORAGE
.
getType
().
equals
(
orderInfoDto
.
getType
()))
{
ImageImgStorage
imageImgStorage
=
imageImgStorageBiz
.
selectById
(
orderInfoDto
.
getDetailId
());
if
(
imageImgStorage
!=
null
)
{
ShoppingCartInfo
old
=
selectByUser
(
appUserDTO
.
getUserid
(),
imageImgStorage
.
getId
(
));
ShoppingCartInfo
old
=
selectByUser
(
appUserDTO
.
getUserid
(),
Long
.
valueOf
(
imageImgStorage
.
getId
()
));
if
(
old
!=
null
)
{
old
.
setNumber
(
old
.
getNumber
()
+
orderInfoDto
.
getNumber
());
old
.
setTotalAmount
(
old
.
getPrice
().
multiply
(
new
BigDecimal
(
old
.
getNumber
())));
...
...
@@ -152,7 +185,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
if
(
OrderTypeEnum
.
INDUSTRY_INFO
.
getType
().
equals
(
orderInfoDto
.
getType
()))
{
IndustryApplicationInfo
industryApplicationInfo
=
industryApplicationInfoBiz
.
selectById
(
orderInfoDto
.
getDetailId
());
if
(
industryApplicationInfo
!=
null
)
{
ShoppingCartInfo
old
=
selectByUser
(
appUserDTO
.
getUserid
(),
industryApplicationInfo
.
getId
(
));
ShoppingCartInfo
old
=
selectByUser
(
appUserDTO
.
getUserid
(),
Long
.
valueOf
(
industryApplicationInfo
.
getId
()
));
if
(
old
!=
null
)
{
old
.
setNumber
(
old
.
getNumber
()
+
orderInfoDto
.
getNumber
());
old
.
setTotalAmount
(
old
.
getPrice
().
multiply
(
new
BigDecimal
(
old
.
getNumber
())));
...
...
@@ -184,7 +217,7 @@ public class ShoppingCartInfoBiz extends BaseBiz<ShoppingCartInfoMapper, Shoppin
return
ObjectRestResponse
.
succ
();
}
public
ShoppingCartInfo
selectByUser
(
Integer
userId
,
Integer
detailId
)
{
public
ShoppingCartInfo
selectByUser
(
Integer
userId
,
Long
detailId
)
{
Example
example
=
new
Example
(
ShoppingCartInfo
.
class
);
example
.
createCriteria
().
andEqualTo
(
"detailId"
,
detailId
).
andEqualTo
(
"userId"
,
userId
);
return
mapper
.
selectOneByExample
(
example
);
...
...
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/service/ConfirmOrderService.java
View file @
949f94c5
...
...
@@ -3,6 +3,7 @@ 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.datacenter.fegin.DatacenterFeign
;
import
com.upyuns.platform.rs.datacenter.pojo.ImageDataVO
;
import
com.upyuns.platform.rs.universal.constant.DictionaryKey
;
import
com.upyuns.platform.rs.universal.entity.Dictionary
;
import
com.upyuns.platform.rs.universal.feign.ThirdFeign
;
...
...
@@ -70,7 +71,21 @@ public class ConfirmOrderService {
switch
(
OrderTypeEnum
.
getByCode
(
itemInfoDto
.
getType
()))
{
//标准数据
case
STANDARD_DATA:
List
<
ImageDataVO
>
imageDataVOList
=
datacenterFeign
.
queryByIds
(
itemInfoDto
.
getId
()
+
""
).
getData
();
if
(
imageDataVOList
!=
null
&&
imageDataVOList
.
size
()
>
0
)
{
ImageDataVO
imageDataVO
=
imageDataVOList
.
get
(
0
);
ItemInfoVo
itemInfoVo
=
new
ItemInfoVo
();
itemInfoVo
.
setId
(
Long
.
valueOf
(
imageDataVO
.
getId
()));
itemInfoVo
.
setDetailJson
(
JSONObject
.
toJSONString
(
imageDataVO
));
itemInfoVo
.
setNumber
(
itemInfoDto
.
getNumber
());
itemInfoVo
.
setType
(
itemInfoDto
.
getType
());
itemInfoVo
.
setPrice
(
imageDataVO
.
getPrice
());
itemInfoVoList
.
add
(
itemInfoVo
);
//总数量
number
.
updateAndGet
(
v
->
v
+
itemInfoDto
.
getNumber
());
BigDecimal
totalAmount
=
imageDataVO
.
getPrice
().
multiply
(
new
BigDecimal
(
itemInfoDto
.
getNumber
()));
amount
.
updateAndGet
(
v
->
new
Double
((
double
)
(
v
+
totalAmount
.
doubleValue
())));
}
break
;
//行业应用
case
INDUSTRY_INFO:
...
...
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