|
@@ -17,17 +17,16 @@ type InvoiceController struct {
|
|
|
|
|
|
var (
|
|
var (
|
|
InvoiceService = &service.InvoiceService{}
|
|
InvoiceService = &service.InvoiceService{}
|
|
-
|
|
|
|
)
|
|
)
|
|
|
|
|
|
func (u *InvoiceController) Router(router *gin.Engine) {
|
|
func (u *InvoiceController) Router(router *gin.Engine) {
|
|
eleGroup := router.Group("/Invoice")
|
|
eleGroup := router.Group("/Invoice")
|
|
{
|
|
{
|
|
- eleGroup.POST("/Add", InvoiceAdd) // 发票开具
|
|
|
|
|
|
+ eleGroup.POST("/Add", InvoiceAdd) // 发票开具
|
|
eleGroup.POST("/Download", InvoiceDownload) // 发票下载
|
|
eleGroup.POST("/Download", InvoiceDownload) // 发票下载
|
|
- eleGroup.GET("/See", InvoiceSee) // 查看发票
|
|
|
|
- eleGroup.POST("/RedSubmit", InvoiceRedSubmit) // 退票
|
|
|
|
- eleGroup.POST("/Replace", InvoiceReplace) // 换票
|
|
|
|
|
|
+ eleGroup.GET("/See", InvoiceSee) // 查看发票
|
|
|
|
+ eleGroup.POST("/RedSubmit", InvoiceRedSubmit) // 退票
|
|
|
|
+ eleGroup.POST("/Replace", InvoiceReplace) // 换票
|
|
}
|
|
}
|
|
}
|
|
}
|
|
func InvoiceAdd(context *gin.Context) {
|
|
func InvoiceAdd(context *gin.Context) {
|
|
@@ -37,15 +36,15 @@ func InvoiceAdd(context *gin.Context) {
|
|
if err := json.Unmarshal([]byte(data), &dat); err == nil {
|
|
if err := json.Unmarshal([]byte(data), &dat); err == nil {
|
|
fmt.Println("==============json str 转map=======================")
|
|
fmt.Println("==============json str 转map=======================")
|
|
}
|
|
}
|
|
- msg,code,dataMap:= InvoiceService.InvoiceAdd(dat,"",0,"false")
|
|
|
|
- result.Msg=msg
|
|
|
|
- if(code==3){
|
|
|
|
- result.Code=2
|
|
|
|
- }else{
|
|
|
|
- result.Code=code
|
|
|
|
|
|
+ msg, code, dataMap := InvoiceService.InvoiceAdd(dat, "", 0, "false")
|
|
|
|
+ result.Msg = msg
|
|
|
|
+ if code == 3 {
|
|
|
|
+ result.Code = 2
|
|
|
|
+ } else {
|
|
|
|
+ result.Code = code
|
|
}
|
|
}
|
|
|
|
|
|
- result.Data=dataMap
|
|
|
|
|
|
+ result.Data = dataMap
|
|
context.JSON(http.StatusOK, result)
|
|
context.JSON(http.StatusOK, result)
|
|
}
|
|
}
|
|
func InvoiceDownload(context *gin.Context) {
|
|
func InvoiceDownload(context *gin.Context) {
|
|
@@ -68,12 +67,13 @@ func InvoiceSee(context *gin.Context) {
|
|
result := &model.BaseResult{}
|
|
result := &model.BaseResult{}
|
|
swno := context.Request.FormValue("swno")
|
|
swno := context.Request.FormValue("swno")
|
|
model := context.Request.FormValue("model")
|
|
model := context.Request.FormValue("model")
|
|
- code,path,msg:=InvoiceService.InvoiceSee(swno,entity.SaleTax,model)
|
|
|
|
- result.Data=path
|
|
|
|
- result.Msg=msg
|
|
|
|
- result.Code=code
|
|
|
|
|
|
+ code, path, msg := InvoiceService.InvoiceSee(swno, entity.SaleTax, model)
|
|
|
|
+ result.Data = path
|
|
|
|
+ result.Msg = msg
|
|
|
|
+ result.Code = code
|
|
context.JSON(http.StatusOK, result)
|
|
context.JSON(http.StatusOK, result)
|
|
}
|
|
}
|
|
|
|
+
|
|
//退票
|
|
//退票
|
|
func InvoiceRedSubmit(context *gin.Context) {
|
|
func InvoiceRedSubmit(context *gin.Context) {
|
|
result := &model.BaseResult{}
|
|
result := &model.BaseResult{}
|
|
@@ -82,18 +82,19 @@ func InvoiceRedSubmit(context *gin.Context) {
|
|
if err := json.Unmarshal([]byte(data), &dat); err == nil {
|
|
if err := json.Unmarshal([]byte(data), &dat); err == nil {
|
|
fmt.Println("==============json str 转map=======================")
|
|
fmt.Println("==============json str 转map=======================")
|
|
}
|
|
}
|
|
- solgan:=entity.Invoice{
|
|
|
|
- Yfphm:dat.Fphm,
|
|
|
|
- Yfpdm:dat.Fpdm,
|
|
|
|
- OrderCode:dat.OrderCode,
|
|
|
|
-
|
|
|
|
|
|
+ solgan := entity.Invoice{
|
|
|
|
+ Yfphm: dat.Fphm,
|
|
|
|
+ Yfpdm: dat.Fpdm,
|
|
|
|
+ OrderCode: dat.OrderCode,
|
|
|
|
+ Redcode: dat.Redcode,
|
|
}
|
|
}
|
|
- msg,code,dataMap:=InvoiceService.InvoiceRedSubmit(dat.Fpdm,dat.Fphm,dat.OrderCode,"refund","0",0,&solgan)
|
|
|
|
- result.Data=dataMap
|
|
|
|
- result.Msg=msg
|
|
|
|
- result.Code=code
|
|
|
|
|
|
+ msg, code, dataMap := InvoiceService.InvoiceRedSubmit(dat.Fpdm, dat.Fphm, dat.OrderCode, "refund", "0", 0, &solgan)
|
|
|
|
+ result.Data = dataMap
|
|
|
|
+ result.Msg = msg
|
|
|
|
+ result.Code = code
|
|
context.JSON(http.StatusOK, result)
|
|
context.JSON(http.StatusOK, result)
|
|
}
|
|
}
|
|
|
|
+
|
|
//换票
|
|
//换票
|
|
func InvoiceReplace(context *gin.Context) {
|
|
func InvoiceReplace(context *gin.Context) {
|
|
result := &model.BaseResult{}
|
|
result := &model.BaseResult{}
|
|
@@ -102,12 +103,9 @@ func InvoiceReplace(context *gin.Context) {
|
|
if err := json.Unmarshal([]byte(data), &dat); err == nil {
|
|
if err := json.Unmarshal([]byte(data), &dat); err == nil {
|
|
fmt.Println("==============json str 转map=======================")
|
|
fmt.Println("==============json str 转map=======================")
|
|
}
|
|
}
|
|
- msg,code,dataMap:=InvoiceService.InvoiceReplace(dat,"changed")
|
|
|
|
- result.Data=dataMap
|
|
|
|
- result.Msg=msg
|
|
|
|
- result.Code=code
|
|
|
|
|
|
+ msg, code, dataMap := InvoiceService.InvoiceReplace(dat, "changed")
|
|
|
|
+ result.Data = dataMap
|
|
|
|
+ result.Msg = msg
|
|
|
|
+ result.Code = code
|
|
context.JSON(http.StatusOK, result)
|
|
context.JSON(http.StatusOK, result)
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|