Просмотр исходного кода

Merge branch 'feature/v4.9.21' into dev/v4.9.21_rjj

renjiaojiao 1 год назад
Родитель
Сommit
950be0e6e1
1 измененных файлов с 14 добавлено и 8 удалено
  1. 14 8
      src/jfw/modules/subscribepay/src/service/invoice.go

+ 14 - 8
src/jfw/modules/subscribepay/src/service/invoice.go

@@ -1727,7 +1727,7 @@ func (this *Invoice) InvoiceQuery() {
 	}
 	invoiceOne := util.Mysql.FindOne("invoice", map[string]interface{}{
 		"only_Identifying": onlyIdentifying,
-	}, "id,invoice_changed,order_code, bank_account, company_phone,company_name, phone, mail,company_phone, invoice_type, invoice_content, url, invoice_status, invoice_serialnum, taxpayer_identnum,    operator, operable_time, invoicing_entity, remark, invoice_variety, logistics_code, company_address, bank_name, recipient, delivery_address", " create_time   DESC")
+	}, "id,invoice_changed,order_code, bank_account,invoice_code, create_time,invoice_number,company_phone,company_name, phone, mail,company_phone, invoice_type, invoice_content, url, invoice_status, invoice_serialnum, taxpayer_identnum,    operator, operable_time, invoicing_entity, remark, invoice_variety, logistics_code, company_address, bank_name, recipient, delivery_address", " create_time   DESC")
 	companyName := ""
 	if invoiceOne == nil {
 		//查询公司名称
@@ -1737,20 +1737,26 @@ func (this *Invoice) InvoiceQuery() {
 			companyName = qutil.ObjToString((*orderArr)[0]["company_name"])
 		}
 	} else {
+		(*invoiceOne)["id"] = encrypt.SE.Encode2Hex(qutil.InterfaceToStr((*invoiceOne)["id"]))
+		timeLimit := qutil.Int64All((*invoiceOne)["create_time"]) <= config.InvoiceConfig.Order_createtime //24年之前的发票不让换票
 		switch qutil.IntAll((*invoiceOne)["invoice_status"]) {
 		case 1:
-			//是否换
-			isJyInvoice := !strings.Contains(qutil.InterfaceToStr((*invoiceOne)["url"]), "/jyInvoice/") //非数电票
+			isJyInvoice := !(qutil.InterfaceToStr((*invoiceOne)["invoice_number"]) != "" && qutil.InterfaceToStr((*invoiceOne)["invoice_code"]) == "") //非数电
+			isJyEntity := (*invoiceOne)["invoicing_entity"] != nil && qutil.InterfaceToStr((*invoiceOne)["invoicing_entity"]) != config.InvoiceConfig.SigningSubject
 			isChanged := util.Mysql.Count("invoice", map[string]interface{}{
 				"only_Identifying": onlyIdentifying,
 				"order_code":       (*invoiceOne)["order_code"],
 			}) > 1
-			(*invoiceOne)["changed"] = qutil.If(isJyInvoice || isChanged, true, false)
+			(*invoiceOne)["changed"] = qutil.If(isJyInvoice || isChanged || isJyEntity || timeLimit, true, false)
 		case -1: //失败支持重新提交否
-			(*invoiceOne)["isReopen"] = util.Mysql.Count("invoice_fail_record", map[string]interface{}{
-				"only_Identifying": (*invoiceOne)["only_Identifying"],
-				"order_code":       (*invoiceOne)["order_code"],
-			})+1 >= config.InvoiceConfig.SubmitNum
+			if !timeLimit {
+				(*invoiceOne)["isReopen"] = util.Mysql.Count("invoice_fail_record", map[string]interface{}{
+					"only_Identifying": (*invoiceOne)["only_Identifying"],
+					"order_code":       (*invoiceOne)["order_code"],
+				})+1 >= config.InvoiceConfig.SubmitNum
+			} else {
+				(*invoiceOne)["isReopen"] = false
+			}
 		}
 	}
 	this.ServeJson(NewResult(map[string]interface{}{