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
89502599
Commit
89502599
authored
Jan 09, 2020
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
86b8a5f2
cb917d0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
18 deletions
+51
-18
InvoiceVo.java
...java/com/xxfc/platform/universal/entity/vo/InvoiceVo.java
+1
-0
InvoiceController.java
...xxfc/platform/universal/controller/InvoiceController.java
+17
-6
InvoiceDaoImpl.java
...atform/universal/service/invoice/impl/InvoiceDaoImpl.java
+33
-12
No files found.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/vo/InvoiceVo.java
View file @
89502599
...
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.entity.vo;
import
com.xxfc.platform.universal.entity.OrderData
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.List
;
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/InvoiceController.java
View file @
89502599
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
;
...
...
@@ -35,8 +34,14 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
*/
@GetMapping
(
"/dutyParagraph"
)
public
ObjectRestResponse
getDutyParagraphByCode
(
@RequestParam
(
"code"
)
String
code
)
{
String
dutyParagraph
=
baseBiz
.
getDutyParagraphByCode
(
code
);
return
ObjectRestResponse
.
succ
(
dutyParagraph
);
try
{
String
dutyParagraph
=
baseBiz
.
getDutyParagraphByCode
(
code
);
return
ObjectRestResponse
.
succ
(
dutyParagraph
);
}
catch
(
BaseException
e
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"获取公司全名失败"
);
}
}
/**
...
...
@@ -47,8 +52,14 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
*/
@GetMapping
(
"/corporateName"
)
public
ObjectRestResponse
corporateName
(
@RequestParam
(
"name"
)
String
name
)
{
List
<
Map
<
String
,
String
>>
mapList
=
baseBiz
.
corporateName
(
name
);
return
ObjectRestResponse
.
succ
(
mapList
);
try
{
List
<
Map
<
String
,
String
>>
mapList
=
baseBiz
.
corporateName
(
name
);
return
ObjectRestResponse
.
succ
(
mapList
);
}
catch
(
BaseException
e
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"获取公司全名失败"
);
}
}
/**
...
...
@@ -60,7 +71,7 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
*/
@PostMapping
(
"/invoicing"
)
public
ObjectRestResponse
invoicing
(
@RequestBody
InvoiceVo
invoiceVo
)
{
log
.
info
(
"开票信息={}"
,
invoiceVo
);
try
{
String
invoicing
=
baseBiz
.
Invoicing
(
invoiceVo
);
return
ObjectRestResponse
.
succ
(
invoicing
);
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/invoice/impl/InvoiceDaoImpl.java
View file @
89502599
...
...
@@ -4,6 +4,7 @@ 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.constant.RestCode
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.universal.entity.Invoice
;
...
...
@@ -18,6 +19,7 @@ import org.springframework.context.annotation.Primary;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -80,12 +82,17 @@ public class InvoiceDaoImpl implements InvoiceDao {
// 唯一标识,由企业自己生成32位随机码
String
senid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
result
=
sdk
.
sendPostSyncRequest
(
url
,
senid
,
appKey
,
appSecret
,
getTokenJS
(),
taxnum
,
method
,
content
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
List
<
Map
<
String
,
String
>>
mapList
=
(
List
<
Map
<
String
,
String
>>)
jsonObject
.
get
(
"result"
);
if
(
CollectionUtil
.
isNotEmpty
(
mapList
))
{
return
mapList
;
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
List
<
Map
<
String
,
String
>>
mapList
=
(
List
<
Map
<
String
,
String
>>)
jsonObject
.
get
(
"result"
);
if
(
CollectionUtil
.
isNotEmpty
(
mapList
))
{
return
mapList
;
}
throw
new
BaseException
(
result
);
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
result
);
}
return
new
ArrayList
<>();
}
/**
...
...
@@ -108,9 +115,13 @@ public class InvoiceDaoImpl implements InvoiceDao {
// 唯一标识,由企业自己生成32位随机码
String
senid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
result
=
sdk
.
sendPostSyncRequest
(
url
,
senid
,
appKey
,
appSecret
,
getTokenJS
(),
taxnum
,
method
,
content
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
Map
<
String
,
String
>
resultMap
=
(
Map
<
String
,
String
>)
jsonObject
.
get
(
"result"
);
return
resultMap
.
get
(
"kpCode"
);
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
Map
<
String
,
String
>
resultMap
=
(
Map
<
String
,
String
>)
jsonObject
.
get
(
"result"
);
return
resultMap
.
get
(
"kpCode"
);
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
result
);
}
}
...
...
@@ -178,8 +189,6 @@ public class InvoiceDaoImpl implements InvoiceDao {
//调用第三方接口
String
result
=
sdk
.
sendPostSyncRequest
(
invoiceUrl
,
senid
,
appKey2
,
appSecret2
,
token
,
taxnum2
,
method
,
jsonString
);
//把字符串json数据转换为map
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
Map
<
String
,
String
>
data
=
(
Map
<
String
,
String
>)
jsonObject
.
get
(
"result"
);
...
...
@@ -217,7 +226,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
List
<
Map
<
String
,
Object
>>
mapList
=
(
List
<
Map
<
String
,
Object
>>)
jsonObject
.
get
(
"result"
);
return
mapList
;
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
"发票请求流水号错误"
);
throw
new
BaseException
(
"发票请求流水号错误
-
"
);
}
}
return
null
;
...
...
@@ -235,7 +244,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
/**
* 获取诺诺发票token
*/
p
ublic
String
getTokenFP
()
{
p
rivate
String
getTokenFP
()
{
return
getToken
(
appKey2
,
appSecret2
);
}
...
...
@@ -253,8 +262,20 @@ public class InvoiceDaoImpl implements InvoiceDao {
redisTemplate
.
opsForValue
().
set
(
appKey
,
token
,
23
,
TimeUnit
.
HOURS
);
}
return
token
;
}
@PostConstruct
public
void
deleteTokenJS
(){
System
.
out
.
println
(
"deleteTokenJS"
);
setToken
(
appKey
);
setToken
(
appKey2
);
}
private
void
setToken
(
String
appKey
)
{
redisTemplate
.
delete
(
appKey
);
}
}
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