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
89ef4069
Commit
89ef4069
authored
Jan 08, 2020
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发票
parent
754b5937
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
21 deletions
+48
-21
OrderInvoiceBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderInvoiceBiz.java
+48
-21
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderInvoiceBiz.java
View file @
89ef4069
...
@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.util.Query;
...
@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.util.Query;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.BaseOrder
;
import
com.xxfc.platform.order.entity.BaseOrder
;
import
com.xxfc.platform.order.entity.OrderInvoice
;
import
com.xxfc.platform.order.entity.OrderInvoice
;
import
com.xxfc.platform.order.mapper.OrderInvoiceMapper
;
import
com.xxfc.platform.order.mapper.OrderInvoiceMapper
;
...
@@ -75,11 +76,30 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
...
@@ -75,11 +76,30 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
//查询是否已开票
//查询是否已开票
OrderInvoice
oldValue
=
selectByUserIdAndOrderId
(
appUserDTO
.
getUserid
(),
Integer
.
parseInt
(
orderId
)).
getData
();
OrderInvoice
oldValue
=
selectByUserIdAndOrderId
(
appUserDTO
.
getUserid
(),
Integer
.
parseInt
(
orderId
)).
getData
();
if
(
oldValue
==
null
)
{
//不存在就添加
if
(
oldValue
==
null
)
{
//不存在就添加
OrderData
orderData
=
new
OrderData
();
if
(
baseOrder
.
getType
()
==
OrderTypeEnum
.
RENT_VEHICLE
.
getCode
())
{
orderData
.
setOrderName
(
OrderTypeEnum
.
RENT_VEHICLE
.
getDesc
());
}
if
(
baseOrder
.
getType
()
==
OrderTypeEnum
.
TOUR
.
getCode
())
{
orderData
.
setOrderName
(
OrderTypeEnum
.
TOUR
.
getDesc
());
}
if
(
baseOrder
.
getType
()
==
OrderTypeEnum
.
MEMBER
.
getCode
())
{
orderData
.
setOrderName
(
OrderTypeEnum
.
MEMBER
.
getDesc
());
}
orderData
.
setPrice
(
baseOrder
.
getRealAmount
());
list
.
add
(
orderData
);
continue
;
}
else
{
//已开票
log
.
info
(
"该订单已经开票, {}"
,
orderId
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"该订单已经开票: orderId = "
+
orderId
);
}
}
orderInvoice
.
setUserId
(
appUserDTO
.
getUserid
());
orderInvoice
.
setUserId
(
appUserDTO
.
getUserid
());
insertSelectiveRe
(
orderInvoice
);
insertSelectiveRe
(
orderInvoice
);
log
.
info
(
"添加发票记录成功: {}"
,
orderInvoice
);
log
.
info
(
"添加发票记录成功: {}"
,
orderInvoice
);
OrderInvoice
newValue
=
selectByUserIdAndOrderId
(
appUserDTO
.
getUserid
(),
Integer
.
parseInt
(
orderId
)).
getData
();
List
<
OrderInvoice
>
invoiceList
=
selectByIds
(
orderInvoice
.
getOrderIds
()).
getData
();
if
(
newValue
!=
null
)
{
if
(
invoiceList
!=
null
&&
invoiceList
.
size
()
>
0
)
{
OrderInvoice
newValue
=
invoiceList
.
get
(
0
);
//调用第三方开票接口
//调用第三方开票接口
InvoiceVo
invoiceVo
=
new
InvoiceVo
();
InvoiceVo
invoiceVo
=
new
InvoiceVo
();
invoiceVo
.
setContent
(
newValue
.
getContentTitle
());
invoiceVo
.
setContent
(
newValue
.
getContentTitle
());
...
@@ -90,22 +110,29 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
...
@@ -90,22 +110,29 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
invoiceVo
.
setPurchaserName
(
newValue
.
getTitleName
());
invoiceVo
.
setPurchaserName
(
newValue
.
getTitleName
());
invoiceVo
.
setPurchaserTaxCode
(
newValue
.
getTaxCode
());
invoiceVo
.
setPurchaserTaxCode
(
newValue
.
getTaxCode
());
invoiceVo
.
setRemark
(
newValue
.
getContentRemark
());
invoiceVo
.
setRemark
(
newValue
.
getContentRemark
());
invoiceVo
.
setOrderInvoiceId
(
newValue
.
getId
());
thirdFeign
.
invoicing
(
invoiceVo
);
thirdFeign
.
invoicing
(
invoiceVo
);
//更新订单状态
for
(
int
a
=
0
;
a
<=
orderIdArray
.
length
-
1
;
a
++)
{
String
orderId
=
StringUtils
.
isBlank
(
orderIdArray
[
a
])
?
"0"
:
orderIdArray
[
a
];
BaseOrder
baseOrder
=
baseOrderBiz
.
selectById
(
Integer
.
parseInt
(
orderId
));
if
(
baseOrder
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
ORDER_IS_NOT_EXIST
.
getCode
(),
ResCode
.
ORDER_IS_NOT_EXIST
.
getDesc
()
+
", 订单Id = "
+
orderId
);
}
baseOrder
.
setInvoiceStatus
(
1
);
baseOrder
.
setInvoiceStatus
(
1
);
baseOrder
.
setInvoiceId
(
newValue
.
getId
());
baseOrder
.
setInvoiceId
(
newValue
.
getId
());
baseOrderBiz
.
updateBaseOrder
(
baseOrder
);
baseOrderBiz
.
updateBaseOrder
(
baseOrder
);
}
}
else
{
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
DB_OPERATION_FAIL_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
DB_OPERATION_FAIL_CODE
));
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
DB_OPERATION_FAIL_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
DB_OPERATION_FAIL_CODE
));
}
}
}
else
{
//已开票
log
.
info
(
"该订单已经开票, {}"
,
orderId
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"该订单已经开票: orderId = "
+
orderId
);
}
}
}
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
/**
/**
* 根据orderIds字符串查询对应的发票记录
* 根据orderIds字符串查询对应的发票记录
* @param orderIds
* @param orderIds
...
...
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