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
deaec583
Commit
deaec583
authored
Jan 09, 2020
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开票
parent
497c724e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
22 deletions
+31
-22
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
+13
-12
No files found.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/OrderData.java
View file @
deaec583
...
...
@@ -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 @
deaec583
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.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
...
...
@@ -14,6 +16,7 @@ import java.util.Map;
/**
* 发票接口
*
* @Auther: Administrator
* @Date: 2019/12/31 09:57
* @Description:
...
...
@@ -26,54 +29,59 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
/**
* 根据开票代码获取税号
*
* @param code
* @return
*/
@GetMapping
(
"/dutyParagraph"
)
public
ObjectRestResponse
getDutyParagraphByCode
(
@RequestParam
(
"code"
)
String
code
)
{
public
ObjectRestResponse
getDutyParagraphByCode
(
@RequestParam
(
"code"
)
String
code
)
{
String
dutyParagraph
=
baseBiz
.
getDutyParagraphByCode
(
code
);
return
ObjectRestResponse
.
succ
(
dutyParagraph
);
}
/**
* 模糊查询获取公司全名和开票代码
*
* @param name
* @return
*/
@GetMapping
(
"/corporateName"
)
public
ObjectRestResponse
corporateName
(
@RequestParam
(
"name"
)
String
name
)
{
public
ObjectRestResponse
corporateName
(
@RequestParam
(
"name"
)
String
name
)
{
List
<
Map
<
String
,
String
>>
mapList
=
baseBiz
.
corporateName
(
name
);
return
ObjectRestResponse
.
succ
(
mapList
);
}
/**
* 开票接口
*
* @param invoiceVo
* @return
* @throws Exception
*/
@PostMapping
(
"/invoicing"
)
public
ObjectRestResponse
invoicing
(
@RequestBody
InvoiceVo
invoiceVo
)
{
public
ObjectRestResponse
invoicing
(
@RequestBody
InvoiceVo
invoiceVo
)
{
String
invoicing
=
null
;
try
{
invoicing
=
baseBiz
.
Invoicing
(
invoiceVo
);
String
invoicing
=
baseBiz
.
Invoicing
(
invoiceVo
);
return
ObjectRestResponse
.
succ
(
invoicing
);
}
catch
(
JSONException
e
)
{
log
.
error
(
"开票错误信息={}"
,
e
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"开票错误信息={}"
,
e
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"开票失败"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"开票失败"
);
}
}
/**
* 查询开票结果
*
* @param invoiceSerialNum
* @return
*/
@GetMapping
(
"/result"
)
public
ObjectRestResponse
invoiceResult
(
@RequestParam
(
"invoiceSerialNum"
)
String
invoiceSerialNum
)
{
List
<
Map
<
String
,
Object
>>
result
=
baseBiz
.
invoiceResult
(
invoiceSerialNum
);
public
ObjectRestResponse
invoiceResult
(
@RequestParam
(
"invoiceSerialNum"
)
String
invoiceSerialNum
)
{
List
<
Map
<
String
,
Object
>>
result
=
baseBiz
.
invoiceResult
(
invoiceSerialNum
);
return
ObjectRestResponse
.
succ
(
result
);
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/invoice/impl/InvoiceDaoImpl.java
View file @
deaec583
...
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.invoice.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONException
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.google.common.collect.Lists
;
...
...
@@ -54,11 +55,9 @@ public class InvoiceDaoImpl implements InvoiceDao {
private
String
appSecret2
;
@Value
(
"${invoice.nuonuo.queryUrl}"
)
private
String
queryUrl
;
private
String
queryUrl
;
@Value
(
"${invoice.nuonuo.invoiceUrl}"
)
private
String
invoiceUrl
;
private
String
invoiceUrl
;
/**
...
...
@@ -117,6 +116,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
/**
* 调用第三方开票接口进行开票
*
* @param invoice
* @param orders
* @return
...
...
@@ -177,16 +177,17 @@ public class InvoiceDaoImpl implements InvoiceDao {
String
jsonString
=
JSON
.
toJSONString
(
orderMap
);
//调用第三方接口
String
result
=
sdk
.
sendPostSyncRequest
(
invoiceUrl
,
senid
,
appKey2
,
appSecret2
,
token
,
taxnum2
,
method
,
jsonString
);
log
.
info
(
"result={}"
,
result
);
//把字符串json数据转换为map
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
Map
<
String
,
String
>
data
=
(
Map
<
String
,
String
>)
jsonObject
.
get
(
"result"
);
String
invoiceSerialNum
=
data
.
get
(
"invoiceSerialNum"
);
if
(
StringUtils
.
isBlank
(
invoiceSerialNum
))
{
try
{
Map
<
String
,
String
>
data
=
(
Map
<
String
,
String
>)
jsonObject
.
get
(
"result"
);
String
invoiceSerialNum
=
data
.
get
(
"invoiceSerialNum"
);
return
invoiceSerialNum
;
}
catch
(
JSONException
e
)
{
log
.
error
(
"失败原因={}"
,
result
);
throw
new
BaseException
(
"开票失败"
);
throw
new
JSONException
(
result
);
}
return
invoiceSerialNum
;
}
@Override
...
...
@@ -209,7 +210,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
e
.
printStackTrace
();
}
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
data
);
List
<
Map
<
String
,
Object
>>
mapList
=
(
List
<
Map
<
String
,
Object
>>)
jsonObject
.
get
(
"result"
);
...
...
@@ -218,7 +219,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
throw
new
BaseException
(
"发票请求流水号错误"
);
}
}
return
null
;
return
null
;
}
...
...
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