Selaa lähdekoodia

发票冲红修改

WH01243 3 vuotta sitten
vanhempi
commit
fa75d582ae
2 muutettua tiedostoa jossa 34 lisäystä ja 33 poistoa
  1. 30 32
      invoice/src/api/InvoiceController.go
  2. 4 1
      invoice/src/entity/invoice.go

+ 30 - 32
invoice/src/api/InvoiceController.go

@@ -17,17 +17,16 @@ type InvoiceController struct {
 
 var (
 	InvoiceService = &service.InvoiceService{}
-
 )
 
 func (u *InvoiceController) Router(router *gin.Engine) {
 	eleGroup := router.Group("/Invoice")
 	{
-		eleGroup.POST("/Add", InvoiceAdd)   // 发票开具
+		eleGroup.POST("/Add", InvoiceAdd)             // 发票开具
 		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) {
@@ -37,15 +36,15 @@ func InvoiceAdd(context *gin.Context) {
 	if err := json.Unmarshal([]byte(data), &dat); err == nil {
 		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)
 }
 func InvoiceDownload(context *gin.Context) {
@@ -68,12 +67,13 @@ func InvoiceSee(context *gin.Context) {
 	result := &model.BaseResult{}
 	swno := context.Request.FormValue("swno")
 	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)
 }
+
 //退票
 func InvoiceRedSubmit(context *gin.Context) {
 	result := &model.BaseResult{}
@@ -82,18 +82,19 @@ func InvoiceRedSubmit(context *gin.Context) {
 	if err := json.Unmarshal([]byte(data), &dat); err == nil {
 		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)
 }
+
 //换票
 func InvoiceReplace(context *gin.Context) {
 	result := &model.BaseResult{}
@@ -102,12 +103,9 @@ func InvoiceReplace(context *gin.Context) {
 	if err := json.Unmarshal([]byte(data), &dat); err == nil {
 		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)
 }
-
-
-

+ 4 - 1
invoice/src/entity/invoice.go

@@ -41,6 +41,7 @@ type Invoice struct {
 	Spare4            string    `json:"spare4"`            //备用4
 	Spare5            string    `json:"spare5"`            //备用5
 	Orders            []*Orders `json:"orders"`
+	Redcode           string    `json:"redcode"` //发票流水号
 }
 type Orders struct {
 	BillNo string   `json:"billNo"` //订单号
@@ -91,6 +92,8 @@ type RedSubmitJson struct {
 	Fpdm      string `json:"fpdm"`      //发票代码
 	Fphm      string `json:"fphm"`      //发票号码
 	OrderCode string `json:"orderCode"` //订单编号
+	Redcode   string `json:"redcode"`   //发票流水号
+
 }
 
 // MailboxConf 邮箱配置
@@ -141,4 +144,4 @@ var WarningEmail string
 var Fhr string
 var Sky string
 var WarningTime int64
-var  NsqUrl string
+var NsqUrl string