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
158fbd29
Commit
158fbd29
authored
Jan 09, 2020
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-invoice-modular' into dev
parents
edbbdd7c
b804ee4a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
25 deletions
+55
-25
BaseOrderController.java
...ava/com/xxfc/platform/order/rest/BaseOrderController.java
+22
-2
OrderData.java
...in/java/com/xxfc/platform/universal/entity/OrderData.java
+1
-1
InvoiceController.java
...xxfc/platform/universal/controller/InvoiceController.java
+17
-9
InvoiceDaoImpl.java
...atform/universal/service/invoice/impl/InvoiceDaoImpl.java
+15
-13
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BaseOrderController.java
View file @
158fbd29
...
@@ -173,12 +173,32 @@ public class BaseOrderController extends CommonBaseController implements UserRes
...
@@ -173,12 +173,32 @@ public class BaseOrderController extends CommonBaseController implements UserRes
PageDataVO
<
OrderPageVO
>
pages
=
PageDataVO
.
pageInfo
(
query
,
()
->
baseOrderBiz
.
pageByParm
(
query
.
getSuper
()));
PageDataVO
<
OrderPageVO
>
pages
=
PageDataVO
.
pageInfo
(
query
,
()
->
baseOrderBiz
.
pageByParm
(
query
.
getSuper
()));
pages
.
getData
().
parallelStream
().
forEach
(
data
->
{
pages
.
getData
().
parallelStream
().
forEach
(
data
->
{
data
.
setQrcodeStr
(
qrcodePrefix
);
data
.
setQrcodeStr
(
qrcodePrefix
);
// data.setOrderRealAmount(data.getRealAmount().subtract(orderAccountBiz.getAllOrderCost(data.getId())));
// log.info("订单实际支付金额,扣除押金违章之后: {}", data.getOrderRealAmount());
});
return
new
ObjectRestResponse
<>().
data
(
pages
);
}
@RequestMapping
(
value
=
"/getInvoiceOrderList"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ApiOperation
(
value
=
"发票订单列表"
)
@IgnoreClientToken
public
ObjectRestResponse
<
PageDataVO
<
OrderPageVO
>>
getInvoiceOrderList
(
QueryOrderDTO
dto
)
{
//查询列表数据
if
(
StringUtils
.
isBlank
(
BaseContextHandler
.
getUserID
()))
{
throw
new
BaseException
(
ResultCode
.
AJAX_WECHAT_NOTEXIST_CODE
);
}
//dto.setCrtUser(Integer.valueOf(BaseContextHandler.getUserID()));
dto
.
setUserId
(
Integer
.
valueOf
(
BaseContextHandler
.
getUserID
()));
Query
query
=
new
Query
(
dto
);
PageDataVO
<
OrderPageVO
>
pages
=
PageDataVO
.
pageInfo
(
query
,
()
->
baseOrderBiz
.
pageByParm
(
query
.
getSuper
()));
pages
.
getData
().
parallelStream
().
forEach
(
data
->
{
data
.
setQrcodeStr
(
qrcodePrefix
);
data
.
setOrderRealAmount
(
data
.
getRealAmount
().
subtract
(
orderAccountBiz
.
getAllOrderCost
(
data
.
getId
())));
data
.
setOrderRealAmount
(
data
.
getRealAmount
().
subtract
(
orderAccountBiz
.
getAllOrderCost
(
data
.
getId
())));
log
.
info
(
"订单实际支付金额,扣除押金违章之后: {}"
,
data
.
getOrderRealAmount
());
log
.
info
(
"订单实际支付金额,扣除押金违章之后: {}"
,
data
.
getOrderRealAmount
());
});
});
return
new
ObjectRestResponse
<>().
data
(
pages
);
return
new
ObjectRestResponse
<>().
data
(
pages
);
}
}
@ApiOperation
(
"查询个数"
)
@ApiOperation
(
"查询个数"
)
@RequestMapping
(
value
=
"/count"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/count"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/OrderData.java
View file @
158fbd29
...
@@ -31,7 +31,7 @@ public class OrderData {
...
@@ -31,7 +31,7 @@ public class OrderData {
/**
/**
* 税率
* 税率
*/
*/
private
BigDecimal
taxRate
=
new
BigDecimal
(
0.03
);
private
BigDecimal
taxRate
=
new
BigDecimal
(
"0.03"
);
/**
/**
* 单位
* 单位
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/InvoiceController.java
View file @
158fbd29
package
com
.
xxfc
.
platform
.
universal
.
controller
;
package
com
.
xxfc
.
platform
.
universal
.
controller
;
import
com.alibaba.fastjson.JSONException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
...
@@ -14,6 +16,7 @@ import java.util.Map;
...
@@ -14,6 +16,7 @@ import java.util.Map;
/**
/**
* 发票接口
* 发票接口
*
* @Auther: Administrator
* @Auther: Administrator
* @Date: 2019/12/31 09:57
* @Date: 2019/12/31 09:57
* @Description:
* @Description:
...
@@ -26,28 +29,31 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
...
@@ -26,28 +29,31 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
/**
/**
* 根据开票代码获取税号
* 根据开票代码获取税号
*
* @param code
* @param code
* @return
* @return
*/
*/
@GetMapping
(
"/dutyParagraph"
)
@GetMapping
(
"/dutyParagraph"
)
public
ObjectRestResponse
getDutyParagraphByCode
(
@RequestParam
(
"code"
)
String
code
)
{
public
ObjectRestResponse
getDutyParagraphByCode
(
@RequestParam
(
"code"
)
String
code
)
{
String
dutyParagraph
=
baseBiz
.
getDutyParagraphByCode
(
code
);
String
dutyParagraph
=
baseBiz
.
getDutyParagraphByCode
(
code
);
return
ObjectRestResponse
.
succ
(
dutyParagraph
);
return
ObjectRestResponse
.
succ
(
dutyParagraph
);
}
}
/**
/**
* 模糊查询获取公司全名和开票代码
* 模糊查询获取公司全名和开票代码
*
* @param name
* @param name
* @return
* @return
*/
*/
@GetMapping
(
"/corporateName"
)
@GetMapping
(
"/corporateName"
)
public
ObjectRestResponse
corporateName
(
@RequestParam
(
"name"
)
String
name
)
{
public
ObjectRestResponse
corporateName
(
@RequestParam
(
"name"
)
String
name
)
{
List
<
Map
<
String
,
String
>>
mapList
=
baseBiz
.
corporateName
(
name
);
List
<
Map
<
String
,
String
>>
mapList
=
baseBiz
.
corporateName
(
name
);
return
ObjectRestResponse
.
succ
(
mapList
);
return
ObjectRestResponse
.
succ
(
mapList
);
}
}
/**
/**
* 开票接口
* 开票接口
*
* @param invoiceVo
* @param invoiceVo
* @return
* @return
* @throws Exception
* @throws Exception
...
@@ -55,25 +61,27 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
...
@@ -55,25 +61,27 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
@PostMapping
(
"/invoicing"
)
@PostMapping
(
"/invoicing"
)
public
ObjectRestResponse
invoicing
(
@RequestBody
InvoiceVo
invoiceVo
)
{
public
ObjectRestResponse
invoicing
(
@RequestBody
InvoiceVo
invoiceVo
)
{
String
invoicing
=
null
;
try
{
try
{
invoicing
=
baseBiz
.
Invoicing
(
invoiceVo
);
String
invoicing
=
baseBiz
.
Invoicing
(
invoiceVo
);
return
ObjectRestResponse
.
succ
(
invoicing
);
return
ObjectRestResponse
.
succ
(
invoicing
);
}
catch
(
BaseException
e
)
{
log
.
error
(
"开票错误信息={}"
,
e
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"开票错误信息={}"
,
e
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"开票失败"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"开票失败"
);
}
}
}
}
/**
/**
* 查询开票结果
* 查询开票结果
*
* @param invoiceSerialNum
* @param invoiceSerialNum
* @return
* @return
*/
*/
@GetMapping
(
"/result"
)
@GetMapping
(
"/result"
)
public
ObjectRestResponse
invoiceResult
(
@RequestParam
(
"invoiceSerialNum"
)
String
invoiceSerialNum
)
{
public
ObjectRestResponse
invoiceResult
(
@RequestParam
(
"invoiceSerialNum"
)
String
invoiceSerialNum
)
{
List
<
Map
<
String
,
Object
>>
result
=
baseBiz
.
invoiceResult
(
invoiceSerialNum
);
List
<
Map
<
String
,
Object
>>
result
=
baseBiz
.
invoiceResult
(
invoiceSerialNum
);
return
ObjectRestResponse
.
succ
(
result
);
return
ObjectRestResponse
.
succ
(
result
);
}
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/invoice/impl/InvoiceDaoImpl.java
View file @
158fbd29
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.invoice.impl;
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.invoice.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONException
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
...
@@ -54,11 +55,9 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -54,11 +55,9 @@ public class InvoiceDaoImpl implements InvoiceDao {
private
String
appSecret2
;
private
String
appSecret2
;
@Value
(
"${invoice.nuonuo.queryUrl}"
)
@Value
(
"${invoice.nuonuo.queryUrl}"
)
private
String
queryUrl
;
private
String
queryUrl
;
@Value
(
"${invoice.nuonuo.invoiceUrl}"
)
@Value
(
"${invoice.nuonuo.invoiceUrl}"
)
private
String
invoiceUrl
;
private
String
invoiceUrl
;
/**
/**
...
@@ -117,6 +116,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -117,6 +116,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
/**
/**
* 调用第三方开票接口进行开票
* 调用第三方开票接口进行开票
*
* @param invoice
* @param invoice
* @param orders
* @param orders
* @return
* @return
...
@@ -177,16 +177,18 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -177,16 +177,18 @@ public class InvoiceDaoImpl implements InvoiceDao {
String
jsonString
=
JSON
.
toJSONString
(
orderMap
);
String
jsonString
=
JSON
.
toJSONString
(
orderMap
);
//调用第三方接口
//调用第三方接口
String
result
=
sdk
.
sendPostSyncRequest
(
invoiceUrl
,
senid
,
appKey2
,
appSecret2
,
token
,
taxnum2
,
method
,
jsonString
);
String
result
=
sdk
.
sendPostSyncRequest
(
invoiceUrl
,
senid
,
appKey2
,
appSecret2
,
token
,
taxnum2
,
method
,
jsonString
);
log
.
info
(
"result={}"
,
result
);
//把字符串json数据转换为map
//把字符串json数据转换为map
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
Map
<
String
,
String
>
data
=
(
Map
<
String
,
String
>)
jsonObject
.
get
(
"result"
);
Map
<
String
,
String
>
data
=
(
Map
<
String
,
String
>)
jsonObject
.
get
(
"result"
);
String
invoiceSerialNum
=
data
.
get
(
"invoiceSerialNum"
);
String
invoiceSerialNum
=
data
.
get
(
"invoiceSerialNum"
);
if
(
StringUtils
.
isBlank
(
invoiceSerialNum
))
{
return
invoiceSerialNum
;
}
catch
(
Exception
e
)
{
log
.
error
(
"失败原因={}"
,
result
);
log
.
error
(
"失败原因={}"
,
result
);
throw
new
BaseException
(
"开票失败"
);
throw
new
BaseException
(
result
);
}
}
return
invoiceSerialNum
;
}
}
@Override
@Override
...
@@ -209,7 +211,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -209,7 +211,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
try
{
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
data
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
data
);
List
<
Map
<
String
,
Object
>>
mapList
=
(
List
<
Map
<
String
,
Object
>>)
jsonObject
.
get
(
"result"
);
List
<
Map
<
String
,
Object
>>
mapList
=
(
List
<
Map
<
String
,
Object
>>)
jsonObject
.
get
(
"result"
);
...
...
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