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
70037a12
Commit
70037a12
authored
Jan 03, 2020
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发票
parent
22fd011a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
219 additions
and
68 deletions
+219
-68
Invoice.java
...main/java/com/xxfc/platform/universal/entity/Invoice.java
+20
-9
OrderData.java
...in/java/com/xxfc/platform/universal/entity/OrderData.java
+38
-0
InvoiceVo.java
...java/com/xxfc/platform/universal/entity/vo/InvoiceVo.java
+85
-0
InvoiceController.java
...xxfc/platform/universal/controller/InvoiceController.java
+5
-3
InvoiceDaoImpl.java
...atform/universal/service/Invoice/impl/InvoiceDaoImpl.java
+46
-55
InvoiceService.java
...a/com/xxfc/platform/universal/service/InvoiceService.java
+25
-1
No files found.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/Invoice.java
View file @
70037a12
package
com
.
xxfc
.
platform
.
universal
.
entity
;
package
com
.
xxfc
.
platform
.
universal
.
entity
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.*
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Data
@Data
@Table
(
name
=
"invoice"
)
@Table
(
name
=
"invoice"
)
@ApiModel
public
class
Invoice
{
public
class
Invoice
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
@@ -54,7 +54,7 @@ public class Invoice {
...
@@ -54,7 +54,7 @@ public class Invoice {
* 发票分类:01 专票,02 货物运输业增值税专用发票,03 机动车销售统一发票,
* 发票分类:01 专票,02 货物运输业增值税专用发票,03 机动车销售统一发票,
* 04 增值税普通发票,10 增值税普通发票(电子),11 增值税普通发票(卷票),14 增值税普通发票(卷票)
* 04 增值税普通发票,10 增值税普通发票(电子),11 增值税普通发票(卷票),14 增值税普通发票(卷票)
*/
*/
private
String
invoiceCategory
;
private
Integer
invoiceCategory
;
/**
/**
* 合计金额
* 合计金额
...
@@ -183,12 +183,23 @@ public class Invoice {
...
@@ -183,12 +183,23 @@ public class Invoice {
* 发票图片链接
* 发票图片链接
*/
*/
private
String
pictureUrl
;
private
String
pictureUrl
;
/**
* 开票类型:1-正票;2-红票
*/
private
Integer
invoiceType
=
0
;
/**
* 开票内容
*/
private
String
content
;
/**
* 推送方式:-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机
*/
private
Integer
pushMode
=
2
;
private
String
createBy
;
private
String
createBy
;
private
String
updateBy
;
private
String
updateBy
;
private
Date
createTime
;
private
Date
createTime
;
private
Date
updateTime
;
private
Date
updateTime
;
@Column
(
insertable
=
false
,
updatable
=
false
)
private
List
<
OrderData
>
orders
;
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/OrderData.java
0 → 100644
View file @
70037a12
package
com
.
xxfc
.
platform
.
universal
.
entity
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* @Auther: Administrator
* @Date: 2020/1/3 11:20
* @Description:
*/
@Data
public
class
OrderData
{
/**
* 产品名称
*/
private
String
orderName
;
/**
* 产品数量
*/
private
Integer
num
;
/**
* 是否含税价格
*/
private
Integer
withTaxFlag
=
1
;
/**
* 产品单价
*/
private
BigDecimal
price
;
/**
* 税率
*/
private
Double
taxRate
;
/**
* 单位
*/
private
String
unit
=
"次"
;
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/vo/InvoiceVo.java
0 → 100644
View file @
70037a12
package
com
.
xxfc
.
platform
.
universal
.
entity
.
vo
;
import
com.xxfc.platform.universal.entity.OrderData
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* @Auther: Administrator
* @Date: 2020/1/3 14:43
* @Description:
*/
@Data
public
class
InvoiceVo
{
/**
* 订单id :多个以逗号隔开
*/
private
String
orderId
;
/**
* 发票分类:01 专票,02 货物运输业增值税专用发票,03 机动车销售统一发票,
* 04 增值税普通发票,10 增值税普通发票(电子),11 增值税普通发票(卷票),14 增值税普通发票(卷票)
*/
private
Integer
invoiceCategory
=
10
;
/**
* 合计金额
*/
private
BigDecimal
invoiceAmount
;
/**
* 合计税额
*/
private
BigDecimal
taxAmount
;
/**
* 价税合计总额
*/
private
BigDecimal
invoiceSummaryAmount
;
/**
* 价税合计总额大写
*/
private
String
invoiceSummaryAmountText
;
/**
* 备注
*/
private
String
remark
;
/**
* 购买方名称
*/
private
String
purchaserName
;
/**
* 购买方纳税人识别号
*/
private
String
purchaserTaxCode
;
/**
* 购方邮箱
*/
private
String
purchaserEmail
;
/**
* 购买方地址电话
*/
private
String
purchaserAddressPhone
;
/**
* 购买方银行账号
*/
private
String
purchaserAccountBank
;
/**
* 开票内容
*/
private
String
content
;
/**
* 推送方式:-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机
*/
private
Integer
pushMode
=
2
;
private
List
<
OrderData
>
orders
;
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/InvoiceController.java
View file @
70037a12
package
com
.
xxfc
.
platform
.
universal
.
controller
;
package
com
.
xxfc
.
platform
.
universal
.
controller
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.universal.entity.
Invoice
;
import
com.xxfc.platform.universal.entity.
vo.InvoiceVo
;
import
com.xxfc.platform.universal.service.InvoiceService
;
import
com.xxfc.platform.universal.service.InvoiceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -16,6 +17,7 @@ import java.util.Map;
...
@@ -16,6 +17,7 @@ import java.util.Map;
* @Description:
* @Description:
*/
*/
@RestController
@RestController
@IgnoreUserToken
@RequestMapping
(
"/invoice"
)
@RequestMapping
(
"/invoice"
)
public
class
InvoiceController
{
public
class
InvoiceController
{
...
@@ -45,8 +47,8 @@ public class InvoiceController {
...
@@ -45,8 +47,8 @@ public class InvoiceController {
}
}
@PostMapping
@PostMapping
public
ObjectRestResponse
Invoicing
(
@RequestBody
Invoice
invoice
){
public
ObjectRestResponse
Invoicing
(
@RequestBody
Invoice
Vo
invoiceVo
){
invoiceService
.
Invoicing
(
invoice
);
invoiceService
.
Invoicing
(
invoice
Vo
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/Invoice/impl/InvoiceDaoImpl.java
View file @
70037a12
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -6,6 +6,7 @@ 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
;
import
com.xxfc.platform.universal.entity.Invoice
;
import
com.xxfc.platform.universal.entity.Invoice
;
import
com.xxfc.platform.universal.entity.OrderData
;
import
com.xxfc.platform.universal.service.Invoice.InvoiceDao
;
import
com.xxfc.platform.universal.service.Invoice.InvoiceDao
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
nuonuo.open.sdk.NNOpenSDK
;
import
nuonuo.open.sdk.NNOpenSDK
;
...
@@ -45,6 +46,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -45,6 +46,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
private
static
final
String
appSecret2
=
"901B543442BF41A1"
;
private
static
final
String
appSecret2
=
"901B543442BF41A1"
;
/**
/**
* 给定的部分名获取税号
* 给定的部分名获取税号
* @param name
* @param name
...
@@ -54,7 +56,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -54,7 +56,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
public
List
<
Map
<
String
,
String
>>
corporateName
(
String
name
)
{
public
List
<
Map
<
String
,
String
>>
corporateName
(
String
name
)
{
NNOpenSDK
sdk
=
NNOpenSDK
.
getIntance
();
NNOpenSDK
sdk
=
NNOpenSDK
.
getIntance
();
HashMap
<
String
,
String
>
map
=
new
HashMap
();
HashMap
<
String
,
String
>
map
=
new
HashMap
();
map
.
put
(
"q"
,
"name"
);
map
.
put
(
"q"
,
name
);
String
content
=
JSON
.
toJSONString
(
map
);
String
content
=
JSON
.
toJSONString
(
map
);
//方法名
//方法名
...
@@ -96,6 +98,8 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -96,6 +98,8 @@ public class InvoiceDaoImpl implements InvoiceDao {
return
resultMap
.
get
(
"kpCode"
);
return
resultMap
.
get
(
"kpCode"
);
}
}
@Override
@Override
public
void
Invoicing
(
Invoice
invoice
)
{
public
void
Invoicing
(
Invoice
invoice
)
{
...
@@ -104,64 +108,52 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -104,64 +108,52 @@ public class InvoiceDaoImpl implements InvoiceDao {
String
method
=
"nuonuo.electronInvoice.requestBilling"
;
String
method
=
"nuonuo.electronInvoice.requestBilling"
;
// SDK请求地址
// SDK请求地址
String
url
=
"https://sandbox.nuonuocs.cn/open/v1/services"
;
String
url
=
"https://sandbox.nuonuocs.cn/open/v1/services"
;
// 唯一标识,由企业自己生成32位随机码
String
senid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
senid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
HashMap
<
String
,
Map
<
String
,
Object
>>
orderMap
=
new
HashMap
<>();
HashMap
<
String
,
Map
<
String
,
Object
>>
orderMap
=
new
HashMap
<>();
orderMap
.
put
(
"order"
,
map
);
orderMap
.
put
(
"order"
,
map
);
map
.
put
(
"buyerName"
,
"欣新房车网络科技(广东)股份有限公司"
);
//购方信息
map
.
put
(
"buyerTaxNum"
,
"91441900MA53C6713X"
);
map
.
put
(
"buyerName"
,
invoice
.
getPurchaserName
());
map
.
put
(
"buyerTel"
,
"13926892766"
);
map
.
put
(
"buyerTaxNum"
,
invoice
.
getPurchaserTaxCode
());
map
.
put
(
"buyerAddress"
,
"广东省东莞市松山湖园区科汇路1号1栋801室"
);
map
.
put
(
"buyerTel"
,
invoice
.
getPurchaserPhone
());
map
.
put
(
"buyerAccount"
,
"中国建设银行股份有限公司东莞虎门连升支行44050110140900000777"
);
map
.
put
(
"buyerAddress"
,
invoice
.
getPurchaserAddressPhone
());
map
.
put
(
"buyerAccount"
,
invoice
.
getPurchaserAccountBank
());
map
.
put
(
"orderNo"
,
"20190611094711010009"
);
map
.
put
(
"buyerPhone"
,
invoice
.
getPurchaserPhone
());
map
.
put
(
"invoiceDate"
,
"2019-12-27 14:30:00"
);
map
.
put
(
"email"
,
invoice
.
getPurchaserEmail
());
map
.
put
(
"clerk"
,
"小弟"
);
map
.
put
(
"remark"
,
invoice
.
getRemark
());
//销方信息
map
.
put
(
"salerName"
,
"欣新房车网络科技(广东)股份有限公司"
);
map
.
put
(
"orderNo"
,
invoice
.
getOrderId
());
map
.
put
(
"salerTaxNum"
,
"339901999999142"
);
map
.
put
(
"invoiceDate"
,
new
Date
());
map
.
put
(
"salerTel"
,
"13926892766"
);
map
.
put
(
"salerName"
,
invoice
.
getSalerName
());
map
.
put
(
"salerAddress"
,
"广东省东莞市松山湖园区科汇路1号1栋801室"
);
map
.
put
(
"salerTaxNum"
,
invoice
.
getSalerTaxCode
());
map
.
put
(
"salerAccount"
,
"中国建设银行股份有限公司东莞虎门连升支行44050110140900000777"
);
map
.
put
(
"salerAddress"
,
invoice
.
getSalerAddressPhone
());
map
.
put
(
"invoiceType"
,
"1"
);
map
.
put
(
"salerAccount"
,
invoice
.
getSalerAccountBank
());
map
.
put
(
"remark"
,
"出差路费"
);
map
.
put
(
"clerk"
,
invoice
.
getIssuer
());
map
.
put
(
"payee"
,
"老老大"
);
map
.
put
(
"payee"
,
invoice
.
getPayee
());
map
.
put
(
"checker"
,
"老大"
);
map
.
put
(
"checker"
,
invoice
.
getReviewer
());
map
.
put
(
"pushMode"
,
"2"
);
map
.
put
(
"buyerPhone"
,
"13691751141"
);
//其他设置
map
.
put
(
"email"
,
"1208472890@qq.com"
);
map
.
put
(
"pushMode"
,
String
.
valueOf
(
invoice
.
getPushMode
()));
map
.
put
(
"listFlag"
,
"0"
);
map
.
put
(
"invoiceType"
,
String
.
valueOf
(
invoice
.
getInvoiceType
()));
map
.
put
(
"listName"
,
"房车租赁"
);
map
.
put
(
"proxyInvoiceFlag"
,
"0"
);
//订单信息
ArrayList
<
Map
<
String
,
String
>>
arrayList
=
Lists
.
newArrayList
();
ArrayList
<
Map
<
String
,
String
>>
arrayList
=
Lists
.
newArrayList
();
map
.
put
(
"invoiceDetail"
,
arrayList
);
map
.
put
(
"invoiceDetail"
,
arrayList
);
HashMap
<
String
,
String
>
mx
=
new
HashMap
<>();
List
<
OrderData
>
orders
=
invoice
.
getOrders
();
mx
.
put
(
"goodsName"
,
"房车租赁"
);
for
(
OrderData
order
:
orders
)
{
mx
.
put
(
"num"
,
"1"
);
HashMap
<
String
,
String
>
mx
=
new
HashMap
<>();
mx
.
put
(
"withTaxFlag"
,
"0"
);
mx
.
put
(
"goodsName"
,
invoice
.
getContent
());
mx
.
put
(
"price"
,
"100"
);
mx
.
put
(
"num"
,
String
.
valueOf
(
order
.
getNum
())
);
mx
.
put
(
"taxRate"
,
"0.13"
);
//单价含税标志,0:不含税,1:含税
mx
.
put
(
"unit"
,
"次"
);
mx
.
put
(
"withTaxFlag"
,
String
.
valueOf
(
order
.
getWithTaxFlag
()));
arrayList
.
add
(
mx
);
mx
.
put
(
"price"
,
String
.
valueOf
(
order
.
getPrice
()));
map
.
put
(
"invoiceDetail"
,
arrayList
);
mx
.
put
(
"taxRate"
,
String
.
valueOf
(
order
.
getTaxRate
()));
HashMap
<
String
,
String
>
mx2
=
new
HashMap
<>();
mx
.
put
(
"unit"
,
order
.
getUnit
());
mx2
.
put
(
"goodsName"
,
"房车租赁"
);
arrayList
.
add
(
mx
);
mx2
.
put
(
"num"
,
"1"
);
}
mx2
.
put
(
"withTaxFlag"
,
"1"
);
mx2
.
put
(
"price"
,
"100"
);
mx2
.
put
(
"taxRate"
,
"0.13"
);
mx2
.
put
(
"unit"
,
"次"
);
arrayList
.
add
(
mx2
);
HashMap
<
String
,
String
>
mx3
=
new
HashMap
<>();
mx3
.
put
(
"goodsName"
,
"房车租赁"
);
mx3
.
put
(
"num"
,
"1"
);
mx3
.
put
(
"withTaxFlag"
,
"1"
);
mx3
.
put
(
"price"
,
"100"
);
mx3
.
put
(
"taxRate"
,
"0.13"
);
mx3
.
put
(
"unit"
,
"次"
);
arrayList
.
add
(
mx3
);
String
jsonString
=
JSON
.
toJSONString
(
orderMap
);
String
jsonString
=
JSON
.
toJSONString
(
orderMap
);
String
result
=
sdk
.
sendPostSyncRequest
(
url
,
senid
,
appKey2
,
appSecret2
,
getTokenFP
(),
taxnum2
,
method
,
jsonString
);
String
result
=
sdk
.
sendPostSyncRequest
(
url
,
senid
,
appKey2
,
appSecret2
,
getTokenFP
(),
taxnum2
,
method
,
jsonString
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
...
@@ -182,7 +174,6 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -182,7 +174,6 @@ public class InvoiceDaoImpl implements InvoiceDao {
/**
/**
* 获取诺诺发票token
* 获取诺诺发票token
*/
*/
public
String
getTokenFP
()
{
public
String
getTokenFP
()
{
return
getToken
(
appKey2
,
appSecret2
);
return
getToken
(
appKey2
,
appSecret2
);
}
}
...
@@ -199,7 +190,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
...
@@ -199,7 +190,7 @@ public class InvoiceDaoImpl implements InvoiceDao {
if
(
StringUtils
.
isBlank
(
token
))
{
if
(
StringUtils
.
isBlank
(
token
))
{
throw
new
BaseException
(
"获取极速开票token失败"
);
throw
new
BaseException
(
"获取极速开票token失败"
);
}
}
redisTemplate
.
opsForValue
().
set
(
appKey
,
token
,
2
4
,
TimeUnit
.
HOURS
);
redisTemplate
.
opsForValue
().
set
(
appKey
,
token
,
2
3
,
TimeUnit
.
HOURS
);
}
}
return
token
;
return
token
;
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/InvoiceService.java
View file @
70037a12
package
com
.
xxfc
.
platform
.
universal
.
service
;
package
com
.
xxfc
.
platform
.
universal
.
service
;
import
com.xxfc.platform.universal.entity.Invoice
;
import
com.xxfc.platform.universal.entity.Invoice
;
import
com.xxfc.platform.universal.entity.vo.InvoiceVo
;
import
com.xxfc.platform.universal.service.Invoice.InvoiceDao
;
import
com.xxfc.platform.universal.service.Invoice.InvoiceDao
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -19,6 +21,19 @@ public class InvoiceService {
...
@@ -19,6 +21,19 @@ public class InvoiceService {
@Autowired
@Autowired
private
InvoiceDao
invoiceDao
;
private
InvoiceDao
invoiceDao
;
private
static
final
String
salerName
=
"欣新房车网络科技(广东)股份有限公司"
;
private
static
final
String
salerTaxNum
=
"91441900MA53C6713X"
;
private
static
final
String
salerTel
=
"13926892766"
;
private
static
final
String
salerAddress
=
"广东省东莞市松山湖园区科汇路1号1栋801室13926892766"
;
private
static
final
String
salerAccount
=
"中国建设银行股份有限公司东莞虎门连升支行44050110140900000777"
;
//收款人
private
static
final
String
payee
=
"郑超"
;
//复核人
private
static
final
String
checker
=
"邹冬梅"
;
//开票人
private
static
final
String
clerk
=
"郑超"
;
public
String
getDutyParagraphByCode
(
String
code
)
{
public
String
getDutyParagraphByCode
(
String
code
)
{
return
invoiceDao
.
getDutyParagraphByCode
(
code
);
return
invoiceDao
.
getDutyParagraphByCode
(
code
);
}
}
...
@@ -27,7 +42,16 @@ public class InvoiceService {
...
@@ -27,7 +42,16 @@ public class InvoiceService {
return
invoiceDao
.
corporateName
(
name
);
return
invoiceDao
.
corporateName
(
name
);
}
}
public
void
Invoicing
(
Invoice
invoice
)
{
public
void
Invoicing
(
InvoiceVo
invoiceVo
)
{
Invoice
invoice
=
new
Invoice
();
BeanUtils
.
copyProperties
(
invoice
,
invoiceVo
);
invoice
.
setSalerName
(
salerName
);
invoice
.
setSalerTaxCode
(
salerTaxNum
);
invoice
.
setSalerAddressPhone
(
salerAddress
);
invoice
.
setSalerAccountBank
(
salerAccount
);
invoice
.
setPayee
(
payee
);
invoice
.
setReviewer
(
checker
);
invoice
.
setIssuer
(
clerk
);
invoiceDao
.
Invoicing
(
invoice
);
invoiceDao
.
Invoicing
(
invoice
);
}
}
}
}
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