瀏覽代碼

wip:开票重试中代码修改

WH01243 3 年之前
父節點
當前提交
10e8c8edd2
共有 3 個文件被更改,包括 9 次插入7 次删除
  1. 1 0
      invoice/src/config.json
  2. 5 4
      invoice/src/main.go
  3. 3 3
      invoice/src/service/InvoiceService.go

+ 1 - 0
invoice/src/config.json

@@ -7,6 +7,7 @@
     "SMTPPort" : 465,
     "SuccessCode": "0000",
     "LineUpCode": "1089",
+    "WaitCode": "20",
     "SealCode":"4002",
     "TimingCron":"0/10 * * * * ?",
     "OpenTimingCron":"0/30 * * * * ?",

+ 5 - 4
invoice/src/main.go

@@ -52,6 +52,7 @@ func Init() {
 
 	entity.Url = fmt.Sprint(Config["Url"])
 	entity.SealCode = fmt.Sprint(Config["SealCode"])
+	entity.WaitCode = fmt.Sprint(Config["WaitCode"])
 	entity.PdfUrl = fmt.Sprint(Config["PdfUrl"])
 	entity.SaleTax = fmt.Sprint(Config["SaleTax"])
 	entity.InvType = fmt.Sprint(Config["InvType"])
@@ -64,15 +65,15 @@ func Init() {
 	entity.Frequency = utils.SafeConvert2Int(Config["Frequency"])
 	entity.OpenFrequency = utils.SafeConvert2Int(Config["OpenFrequency"])
 	entity.WarningEmail = fmt.Sprint(Config["WarningEmail"])
-	entity.Fhr=fmt.Sprint(Config["Fhr"])
-	entity.Sky=fmt.Sprint(Config["Sky"])
+	entity.Fhr = fmt.Sprint(Config["Fhr"])
+	entity.Sky = fmt.Sprint(Config["Sky"])
 	keys := redis.GetKeys(core.GetConfiguration().Redis.Modules, "fp_*")
 	invoiceService := service.InvoiceService{}
 	for numb, _ := range keys {
 		valueInface := redis.Get(core.GetConfiguration().Redis.Modules, string(keys[numb].([]byte)))
 		_rdsVal := valueInface.(map[string]interface{})
 		isfeedback, _ := strconv.Atoi(fmt.Sprint(_rdsVal["isfeedback"]))
-		invoiceService.Timer(_rdsVal["swno"].(string), _rdsVal["saleTax"].(string), fmt.Sprint(_rdsVal["isRed"]), isfeedback, _rdsVal["changed"].(string), fmt.Sprint(_rdsVal["resType"]),fmt.Sprint(_rdsVal["orderCode"]))
+		invoiceService.Timer(_rdsVal["swno"].(string), _rdsVal["saleTax"].(string), fmt.Sprint(_rdsVal["isRed"]), isfeedback, _rdsVal["changed"].(string), fmt.Sprint(_rdsVal["resType"]), fmt.Sprint(_rdsVal["orderCode"]))
 	}
 
 	keyss := redis.GetKeys(core.GetConfiguration().Redis.Modules, "xx_*")
@@ -83,7 +84,7 @@ func Init() {
 		swnoMap := valueInface.(map[string]interface{})
 
 		mapstructure.Decode(valueInface, &invoice)
-		if swnoMap["model"]=="0" || swnoMap["model"]=="3"  {
+		if swnoMap["model"] == "0" || swnoMap["model"] == "3" {
 			orderarr := swnoMap["orders"].([]interface{})
 			var orderlist []*entity.Orders
 			for _, value := range orderarr {

+ 3 - 3
invoice/src/service/InvoiceService.go

@@ -91,7 +91,7 @@ func (u *InvoiceService) InvoiceAdd(solgan *entity.Invoice, resType string, isLo
 	util.Loger.Println("流水号:", solgan.Swno, "开具发票:结果", data)
 	//开票正常时
 	//data["returnCode"] = entity.LineUpCode
-	if data["returnCode"] == entity.LineUpCode || data["returnCode"] == entity.SealCode || data["returnCode"] == entity.SuccessCode {
+	if data["returnCode"] == entity.LineUpCode || data["returnCode"] == entity.SealCode || data["returnCode"] == entity.SuccessCode || data["returnCode"] == entity.WaitCode {
 		pdfData, code, msg := u.InvoiceDownload(solgan.Swno, solgan.SaleTax, isRed, 0, 0, solgan.Changed, resType, solgan.OrderCode)
 		data1 := make(map[string]interface{})
 		data1["fpdm"] = pdfData["fpdm"]
@@ -188,7 +188,7 @@ func (u *InvoiceService) InvoiceDownload(swno string, saleTax string, isRed stri
 		pdfData["fphm"] = "Fphm"*/
 		pdfData["swno"] = swno
 		return pdfData, 0, dat.ReturnMsg.Msg
-	} else if dat.ReturnMsg.MsgCode == entity.LineUpCode || dat.ReturnMsg.MsgCode == entity.SealCode {
+	} else if dat.ReturnMsg.MsgCode == entity.LineUpCode || dat.ReturnMsg.MsgCode == entity.SealCode || dat.ReturnMsg.MsgCode == entity.WaitCode {
 		if isLoop == 0 {
 			u.Timer(swno, saleTax, isRed, isfeedback, changed, resType, orderCode)
 		}
@@ -274,7 +274,7 @@ func (u *InvoiceService) InvoiceRedSubmit(fpdm string, fphm string, orderCode st
 	}
 	util.Loger.Println("冲红:", "发票单号:", fpdm, "发票号码:", fphm, "结果:", data)
 	//data["returnCode"] = entity.LineUpCode
-	if data["returnCode"] == entity.LineUpCode || data["returnCode"] == entity.SealCode || data["returnCode"] == entity.SuccessCode {
+	if data["returnCode"] == entity.LineUpCode || data["returnCode"] == entity.SealCode || data["returnCode"] == entity.SuccessCode || data["returnCode"] == entity.WaitCode {
 		pdfData, code, msg := u.InvoiceDownload(data["redSwno"].(string), data["saleTax"].(string), "true", int(0), int(0), changed, resType, orderCode)
 		if fmt.Sprint(code) == "0" {
 			data1 := map[string]interface{}{