Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
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
youjj
cloud-platform
Commits
f194dfcb
Commit
f194dfcb
authored
Nov 02, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改分账
parent
ed08c194
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
380 additions
and
45 deletions
+380
-45
BaseOrderAcceptDetailed.java
...xiaoqi/security/admin/entity/BaseOrderAcceptDetailed.java
+6
-1
BaseOrderAcceptDetailedBiz.java
...xiaoqi/security/admin/biz/BaseOrderAcceptDetailedBiz.java
+92
-42
OrderFeign.java
...c/main/java/com/xxfc/platform/order/feign/OrderFeign.java
+6
-2
OrderDetailDTO.java
...java/com/xxfc/platform/order/pojo/dto/OrderDetailDTO.java
+91
-0
OrderDetailBiz.java
...main/java/com/xxfc/platform/order/biz/OrderDetailBiz.java
+155
-0
AppOrderDetailController.java
...om/xxfc/platform/order/rest/AppOrderDetailController.java
+30
-0
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/BaseOrderAcceptDetailed.java
View file @
f194dfcb
...
...
@@ -53,10 +53,15 @@ public class BaseOrderAcceptDetailed implements Serializable {
@Column
(
name
=
"division_type"
)
@ApiModelProperty
(
value
=
"类型 1=>平台抽成;2-上级用户拥金;3-上级商家拥金;4-推荐入驻拥金"
)
@ApiModelProperty
(
value
=
"类型 1=>平台抽成;2-上级用户拥金;3-上级商家拥金;4-推荐入驻拥金
;5-商家订单;6-商家定损;7-商家违章
"
)
private
Integer
divisionType
;
@Column
(
name
=
"entry_type"
)
@ApiModelProperty
(
value
=
"入账类型:1-线上;2-线下"
)
private
Integer
entryType
;
@Column
(
name
=
"division_amount"
)
@ApiModelProperty
(
value
=
"分账金额"
)
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseOrderAcceptDetailedBiz.java
View file @
f194dfcb
This diff is collapsed.
Click to expand it.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/feign/OrderFeign.java
View file @
f194dfcb
package
com
.
xxfc
.
platform
.
order
.
feign
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.order.entity.OrderInvoice
;
import
com.xxfc.platform.order.pojo.dto.OrderDTO
;
import
com.xxfc.platform.order.pojo.dto.OrderDetailDTO
;
import
com.xxfc.platform.order.pojo.order.OrderPageVO
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -34,4 +34,8 @@ public interface OrderFeign {
@PostMapping
(
value
=
"/count/basebase/findOrdersByorderIdV2"
)
ObjectRestResponse
<
List
<
OrderDTO
>>
findOrdersByorderIdV2
(
@RequestBody
List
<
Integer
>
orderIds
);
@RequestMapping
(
value
=
"chw/orderDetail/app/unauth/getOrderDetail"
,
method
=
RequestMethod
.
GET
)
ObjectRestResponse
<
OrderDetailDTO
>
getOrderDetail
(
@RequestParam
(
"orderNo"
)
String
orderNo
,
@RequestParam
(
"type"
)
Integer
type
);
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/dto/OrderDetailDTO.java
0 → 100644
View file @
f194dfcb
package
com
.
xxfc
.
platform
.
order
.
pojo
.
dto
;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
/**
* 门店收支明细DTO
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 14:53
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
OrderDetailDTO
{
public
static
final
Integer
PAY
=
1
;
//支付
public
static
final
Integer
CANEL
=
2
;
//取消
public
static
final
Integer
ADVANCE
=
3
;
//提前还车
public
static
final
Integer
DELAY
=
4
;
//延迟还车
public
static
final
Integer
FINISH
=
5
;
//正常完成
@ApiModelProperty
(
"租车订单详情"
)
private
OrderRentVehicleDetail
rentVehicleDetail
;
@ApiModelProperty
(
"订单号"
)
private
String
orderNo
;
@ApiModelProperty
(
"订单状态"
)
private
Integer
orderStatus
=
PAY
;
@ApiModelProperty
(
"商品实付金额"
)
private
BigDecimal
goodsAmount
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"消费金额"
)
private
BigDecimal
orderAmount
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"不计免赔费"
)
private
BigDecimal
damageSafeAmount
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"其他费用-延迟用车不记免赔"
)
private
BigDecimal
damageSafeAmount2
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"定损费"
)
private
BigDecimal
lossSpecifiedAmount
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"违章费"
)
private
BigDecimal
breakRulesRegulation
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"违约金"
)
private
BigDecimal
violateAmount
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"更换还车公司费用"
)
private
BigDecimal
chageAmount
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"分账金额"
)
private
BigDecimal
acceptAmount
;
public
BigDecimal
getAcceptAmount
(){
return
goodsAmount
.
subtract
(
orderAmount
).
subtract
(
violateAmount
);
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderDetailBiz.java
0 → 100644
View file @
f194dfcb
package
com
.
xxfc
.
platform
.
order
.
biz
;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;;
import
com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderStatusEnum
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.dto.OrderDetailDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
@Service
@Slf4j
public
class
OrderDetailBiz
{
@Autowired
BaseOrderBiz
orderBiz
;
@Autowired
OrderRentVehicleBiz
orderRentVehicleBiz
;
@Autowired
OrderItemBiz
orderItemBiz
;
@Autowired
CompanyWalletBiz
companyWalletBiz
;
@Autowired
OrderAccountBiz
orderAccountBiz
;
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
//type1-支付;2-退款;3-完成
public
OrderDetailDTO
getOrderDetail
(
String
orderNo
,
Integer
type
){
if
(
StringUtils
.
isBlank
(
orderNo
)){
throw
new
BaseException
(
"订单号不存在"
,
ResultCode
.
FAILED_CODE
);
}
log
.
info
(
"---orderNo==="
+
orderNo
);
//获取订单相关信息
BaseOrder
baseOrder
=
new
BaseOrder
();
baseOrder
.
setNo
(
orderNo
);
baseOrder
=
orderBiz
.
selectOne
(
baseOrder
);
if
(
baseOrder
==
null
||(
type
==
1
&&
!
baseOrder
.
getStatus
()
.
equals
(
OrderStatusEnum
.
ORDER_TOSTART
.
getCode
()))
||(
(
type
==
2
||
type
==
3
)
&&
!
baseOrder
.
getStatus
().
equals
(
OrderStatusEnum
.
ORDER_FINISH
.
getCode
()))){
throw
new
BaseException
(
"订单不存在或状态不是已完成"
,
ResultCode
.
FAILED_CODE
);
}
BigDecimal
goodsAmount
=
baseOrder
.
getGoodsAmount
().
subtract
(
baseOrder
.
getCouponAmount
());
List
<
OrderRentVehicleDetail
>
orderRentVehicleDetails
=
orderRentVehicleBiz
.
listByOrderId
(
baseOrder
.
getId
());
if
(
orderRentVehicleDetails
==
null
||
orderRentVehicleDetails
.
size
()
==
0
){
throw
new
BaseException
(
"订单详情不存在"
,
ResultCode
.
FAILED_CODE
);
}
List
<
Integer
>
types
=
new
ArrayList
<>();
if
(
type
==
2
){
types
.
add
(
201
);
types
.
add
(
202
);
types
.
add
(
203
);
}
else
if
(
type
==
3
)
{
types
.
add
(
204
);
}
OrderAccountDetail
accountDetail
=
null
;
if
(
types
.
size
()
>
0
){
accountDetail
=
getAccountDetail
(
types
,
baseOrder
.
getId
());
if
(
accountDetail
==
null
){
throw
new
BaseException
(
"费用明细不存在"
,
ResultCode
.
FAILED_CODE
);
}
}
OrderItem
orderItem
=
new
OrderItem
();
orderItem
.
setOrderId
(
baseOrder
.
getId
());
List
<
OrderItem
>
orderItems
=
orderItemBiz
.
selectList
(
orderItem
);
//不计免赔
BigDecimal
damageSafeAmount
=
orderItems
.
stream
().
filter
(
x
->
x
.
getType
()==
102
).
map
(
OrderItem:
:
getRealAmount
).
reduce
(
BigDecimal
.
ZERO
,
(
x
,
y
)
->
x
.
add
(
y
));
OrderRentVehicleDetail
vehicleDetail
=
orderRentVehicleDetails
.
get
(
0
);
//获取营收明细dto
OrderDetailDTO
orderDetailDTO
=
new
OrderDetailDTO
();
orderDetailDTO
.
setRentVehicleDetail
(
vehicleDetail
);
orderDetailDTO
.
setDamageSafeAmount
(
damageSafeAmount
);
orderDetailDTO
.
setGoodsAmount
(
goodsAmount
);
if
(
accountDetail
!=
null
){
List
<
OrderAccountDeduction
>
deductions
=
accountDetail
.
getDeductions
();
if
(
CollectionUtils
.
isNotEmpty
(
deductions
)){
setDeductionDetail
(
deductions
,
orderDetailDTO
);
}
}
return
orderDetailDTO
;
}
public
OrderAccountDetail
getAccountDetail
(
List
<
Integer
>
types
,
Integer
orderId
)
{
Example
example
=
new
Example
(
OrderAccount
.
class
);
example
.
createCriteria
().
andEqualTo
(
"orderId"
,
orderId
).
andIn
(
"accountType"
,
types
);
List
<
OrderAccount
>
orderAccounts
=
orderAccountBiz
.
selectByExample
(
example
);
if
(
orderAccounts
.
size
()
>
0
){
OrderAccount
orderAccount
=
orderAccounts
.
get
(
0
);
return
org
.
springframework
.
util
.
StringUtils
.
hasText
(
orderAccount
.
getAccountDetail
())
?
JSON
.
parseObject
(
orderAccount
.
getAccountDetail
(),
OrderAccountDetail
.
class
)
:
null
;
}
return
null
;
}
public
void
setDeductionDetail
(
List
<
OrderAccountDeduction
>
deductions
,
OrderDetailDTO
orderDetailDTO
){
Integer
orderStatus
=
0
;
for
(
OrderAccountDeduction
orderAccountDeduction:
deductions
){
Integer
type
=
orderAccountDeduction
.
getType
()
==
null
?
0
:
orderAccountDeduction
.
getType
();
BigDecimal
amount
=
orderAccountDeduction
.
getAmount
()
==
null
?
BigDecimal
.
ZERO
:
orderAccountDeduction
.
getAmount
();
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_CANCEL
.
getCode
(),
type
)){
orderStatus
=
OrderDetailDTO
.
CANEL
;
orderDetailDTO
.
setViolateAmount
(
amount
);
}
else
{
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_ADVANCE
.
getCode
(),
type
)){
orderStatus
=
OrderDetailDTO
.
ADVANCE
;
orderDetailDTO
.
setViolateAmount
(
amount
);
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_DELAY
.
getCode
(),
type
)){
orderStatus
=
OrderDetailDTO
.
DELAY
;
orderDetailDTO
.
setViolateAmount
(
amount
);
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_CHANGE_C
.
getCode
(),
type
)){
orderDetailDTO
.
setChageAmount
(
amount
);
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
CONSUME
.
getCode
(),
type
)){
orderDetailDTO
.
setOrderAmount
(
amount
);
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
DAMAGES
.
getCode
(),
type
)){
orderDetailDTO
.
setLossSpecifiedAmount
(
amount
);
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_TRAFFIC_DEDUCT
.
getCode
(),
type
)){
orderDetailDTO
.
setBreakRulesRegulation
(
amount
);
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
OTHER_DELAY_SAFE
.
getCode
(),
type
)){
orderDetailDTO
.
setDamageSafeAmount2
(
amount
);
}
}
}
orderDetailDTO
.
setOrderStatus
(
orderStatus
);
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/AppOrderDetailController.java
0 → 100644
View file @
f194dfcb
package
com
.
xxfc
.
platform
.
order
.
rest
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.order.biz.OrderDetailBiz
;
import
com.xxfc.platform.order.pojo.dto.OrderDetailDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RequestMapping
(
"chw/orderDetail"
)
@Slf4j
public
class
AppOrderDetailController
{
@Autowired
OrderDetailBiz
orderDetailBiz
;
@RequestMapping
(
value
=
"app/unauth/getOrderDetail"
,
method
=
RequestMethod
.
GET
)
@IgnoreUserToken
public
ObjectRestResponse
<
List
<
OrderDetailDTO
>>
getOrderDetail
(
@RequestParam
(
"orderNo"
)
String
orderNo
,
@RequestParam
(
"type"
)
Integer
type
)
{
return
ObjectRestResponse
.
succ
(
orderDetailBiz
.
getOrderDetail
(
orderNo
,
type
));
}
}
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