|
@@ -40,6 +40,7 @@ func (im *InvoiceManager) simpleMakeInvoice(ctx context.Context) (total, okNum i
|
|
|
invoiceVariety = gconv.String(m["invoice_variety"])
|
|
|
invoiceContent = gconv.String(m["invoice_content"])
|
|
|
prices = gconv.Float64(m["invoice_money"]) / float64(100)
|
|
|
+ id = gconv.Int64(m["id"])
|
|
|
)
|
|
|
|
|
|
if prices == 0 { //开票金额为空,取支付金额
|
|
@@ -48,7 +49,7 @@ func (im *InvoiceManager) simpleMakeInvoice(ctx context.Context) (total, okNum i
|
|
|
|
|
|
c := MakeInvoiceData{
|
|
|
Type: "2",
|
|
|
- Id: fmt.Sprintf("id:%d", gconv.Int64(m["id"])), //因为orderCode不唯一,此处禁止使用orderCode
|
|
|
+ Id: fmt.Sprintf("id:%d", id), //因为orderCode不唯一,此处禁止使用orderCode
|
|
|
Notes: remark,
|
|
|
Fhr: g.Cfg().MustGet(ctx, "company.hfr", "贺鹏飞").String(),
|
|
|
InvoiceArr: []MakeInvoiceItems{{
|
|
@@ -78,11 +79,15 @@ func (im *InvoiceManager) simpleMakeInvoice(ctx context.Context) (total, okNum i
|
|
|
end = true
|
|
|
g.Log().Infof(ctx, "simpleMakeInvoice-身份过期,需要重新登录")
|
|
|
return
|
|
|
+ } else if strings.Contains(err.Error(), "税号有误") { //发票状态改为-1
|
|
|
+ invoiceErr(ctx, g.Map{"id": id})
|
|
|
+ g.Log().Infof(ctx, "simpleMakeInvoice-开票异常-税号异常")
|
|
|
+ } else {
|
|
|
+ g.Log().Errorf(ctx, "simpleMakeInvoice-开票接口调用异常 %v", err)
|
|
|
}
|
|
|
- g.Log().Errorf(ctx, "simpleMakeInvoice-开票接口调用异常 %v", err)
|
|
|
- continue
|
|
|
+ } else {
|
|
|
+ okNum++
|
|
|
}
|
|
|
- okNum++
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -145,11 +150,15 @@ func (im *InvoiceManager) multipleOrdersMakeInvoice(ctx context.Context) (total,
|
|
|
g.Log().Infof(ctx, "multipleOrdersMakeInvoice-身份过期,需要重新登录")
|
|
|
end = true
|
|
|
return
|
|
|
+ } else if strings.Contains(err.Error(), "税号有误") { //发票状态改为-1
|
|
|
+ invoiceErr(ctx, g.Map{"only_Identifying": onlyIdentifying})
|
|
|
+ g.Log().Infof(ctx, "multipleOrdersMakeInvoice-开票异常-税号异常")
|
|
|
+ } else {
|
|
|
+ g.Log().Errorf(ctx, "multipleOrdersMakeInvoice-开票接口调用异常 %v", err)
|
|
|
}
|
|
|
- g.Log().Errorf(ctx, "multipleOrdersMakeInvoice-开票接口调用异常 %v", err)
|
|
|
- continue
|
|
|
+ } else {
|
|
|
+ okNum++
|
|
|
}
|
|
|
- okNum++
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -188,8 +197,9 @@ func (im *InvoiceManager) makeRedInvoice(ctx context.Context) (total, okNum int,
|
|
|
end = true
|
|
|
return
|
|
|
}
|
|
|
+ } else {
|
|
|
+ okNum++
|
|
|
}
|
|
|
- okNum++
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -228,8 +238,19 @@ func (im *InvoiceManager) multipleOrdersMakeRedInvoice(ctx context.Context) (tot
|
|
|
end = true
|
|
|
return
|
|
|
}
|
|
|
+ } else {
|
|
|
+ okNum++
|
|
|
}
|
|
|
- okNum++
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// invoiceErr 开票异常
|
|
|
+func invoiceErr(ctx context.Context, query map[string]interface{}) {
|
|
|
+ _, err := g.DB().Update(ctx, "invoice", g.Map{
|
|
|
+ "invoice_status": -1,
|
|
|
+ }, query)
|
|
|
+ if err != nil {
|
|
|
+ g.Log().Errorf(ctx, "更改开票失败-状态异常 %+v", query)
|
|
|
+ }
|
|
|
+}
|