Browse Source

wip:回调修改

wangkaiyue 1 year ago
parent
commit
c70102076e

+ 16 - 6
config.yaml

@@ -20,7 +20,8 @@ database:
 #发票三方系统配置
 # 测试
 tripartite:
-  service: http://tongyutec.com.cn:18008
+  #service: http://tongyutec.com.cn:18008
+  service: http://127.0.0.1:18008
   clientId: e05e103340b4e0c5
   clientSecret: 1e805800c5eacd3e4ae835ab465a74c7
 
@@ -38,18 +39,27 @@ company:
   tel: "13733157437"
   password: "13733157437Ph"
   hfr: "贺鹏飞" #发票复核人
-  taxCode: "0fccdac71c36a8552ba662e7a2f42726" #开票项
+  taxCode: "65658fde58ab3c2b6e5132a39fae7cb9" #开票项
+
+taxCodeList: #开票项
+  - name: "技术服务费"
+    code: "65658fde58ab3c2b6e5132a39fae7cb9"
+  - name: "会员费"
+    code: "65658fde58ab3c2b6e5132a39fae7cb9"
+  - name: "招投标数据服务"
+    code: "65658fde58ab3c2b6e5132a39fae7cb9"
+
 
 # 发票三方系统配置-接口回调
 callBack:
   #flush: true #是否同步回调地址 默认false
-  action: "https://wky.jydev.jianyu360.com/Invoice/callback"
+  action: "https://www.jianyu360.cn/Invoice/callback"
 
 
 # 开票任务
 invoiceJob:
-  stop: true # 是否停止任务(临时停止任务)
-  cron: "# */3 9-18 * * *"
+  #stop: true # 是否停止任务(临时停止任务)
+  cron: "# */2 9-18 * * *"
 
 # 登录相关配置
 loginType: 1 # 税务系统登录方式【0 短信登录 1 扫码登录】
@@ -57,7 +67,7 @@ qwxRobotUrl: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e7792e7a-159d
 
 pdfFilePathRootDir: "./out"
 pdfFilePathPrefix: "jyInvoice" #即请求路径前缀,需要nginx配置location指向生成的pdf文件
-pdfFilePathDomain: "https://jianyu360.cn"
+pdfFilePathDomain: "https://wky.jydev.jianyu360.com"
 
 
 mailConfig:

+ 2 - 2
docs/mockService/config.yaml

@@ -1,5 +1,5 @@
 server:
-  address: ":4041"
+  address: ":18008"
   dumpRouterMap: false # 是否在Server启动时打印所有的路由列表。默认为true
   graceful: true # 是否开启平滑重启特性,开启时将会在本地增加10000的本地TCP端口用于进程间通信。默认false
   gracefulTimeout: 10 # 平滑重启父进程最大存活时间。默认2秒
@@ -10,5 +10,5 @@ logger:
   file: "{Y-m-d}.log" # 日志文件格式。默认为"{Y-m-d}.log"
 
  #回调地址接口
-callBackAction: "https://www.jianyu360.cn/Invoice/callback"
+callBackAction: "http://127.0.0.1:4040/Invoice/callback"
 

+ 4 - 0
internal/service/invoiceCallback_blue.go

@@ -93,6 +93,10 @@ func updateOrderInvoiceStatus(ctx context.Context, callBackId, invoiceNum string
 			isBackInvoice  = strings.HasPrefix(gconv.String(record["only_Identifying"]), "xx") //是否是管理后台的开票
 		)
 
+		if queryItem == "" || queryValue == "" {
+			return gerror.Wrap(err, "updateOrderInvoiceStatus 回调字段异常")
+		}
+
 		//更新发票内容
 		_, err = tx.Update("invoice", g.Map{
 			"invoice_number": invoiceNum,

+ 4 - 1
internal/service/invoiceCallback_red.go

@@ -58,6 +58,9 @@ func InvoicingMakeRedCallBackLogic(r *ghttp.Request) error {
 				InvoiceStatus:    "1",
 				BillingTime:      invoiceTime.Unix(),
 			})
+			if num == "" {
+				return gerror.Wrap(err, "InvoicingMakeRedCallBackLogic 蓝票号异常")
+			}
 
 			//旧蓝票状态修改已红冲
 			res1, sqlErr1 := tx.Update("invoice", g.Map{
@@ -77,7 +80,7 @@ func InvoicingMakeRedCallBackLogic(r *ghttp.Request) error {
 			// 蓝票数量=红冲数量
 			num1, _ := res1.RowsAffected()
 			num2, _ := res2.RowsAffected()
-			if !(num1 == num2 && num1 > 1) {
+			if !(num1 == num2 && num1 >= 1) {
 				return gerror.Newf("更新校验异常 蓝(旧%d) 蓝(新%d)", num1, num2)
 			}
 			return nil

+ 5 - 0
internal/service/invoiceMake.go

@@ -119,6 +119,11 @@ func (im *InvoiceManager) multipleOrdersMakeInvoice(ctx context.Context) (total,
 			invoiceVariety  = gconv.String(m["invoice_variety"])
 			invoiceContent  = gconv.String(m["invoice_content"])
 		)
+
+		if onlyIdentifying == "" {
+			continue
+		}
+
 		c := MakeInvoiceData{
 			Type:  "2",
 			Id:    fmt.Sprintf("only_Identifying:%s", onlyIdentifying),

+ 3 - 2
internal/service/sendMail.go

@@ -198,11 +198,12 @@ func (ir *invoiceRecord) GetMailHtmlContext() string {
 	if strings.Contains(ir.InvoiceVariety, "专用") {
 		tType = "电子专用发票"
 	}
+	g.Dump(ir, strings.Contains(ir.InvoiceVariety, "专用"))
 	switch ir.InvoiceType {
 	case "单位":
-		return fmt.Sprintf(emailHtml_header+emailHtml_gs, ir.OrderCode, tType, fmt.Sprintf("<a href=\"%s\" download class=\"download\">下载发票</a>", ir.Url), "电子普通发票", ir.CompanyName, ir.TaxpayerIdentnum, ir.Phone, ir.Mail)
+		return fmt.Sprintf(emailHtml_header+emailHtml_gs, ir.OrderCode, tType, fmt.Sprintf("<a href=\"%s\" download class=\"download\">下载发票</a>", ir.Url), tType, ir.CompanyName, ir.TaxpayerIdentnum, ir.Phone, ir.Mail)
 	case "个人":
-		return fmt.Sprintf(emailHtml_header+emailHtml_gr, ir.OrderCode, tType, fmt.Sprintf("<a href=\"%s\" download class=\"download\">下载发票</a>", ir.Url), "电子普通发票", ir.Phone, ir.Mail)
+		return fmt.Sprintf(emailHtml_header+emailHtml_gr, ir.OrderCode, tType, fmt.Sprintf("<a href=\"%s\" download class=\"download\">下载发票</a>", ir.Url), tType, ir.Phone, ir.Mail)
 	}
 	return ""
 }