|
@@ -4,6 +4,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/invoiceinfo"
|
|
"dashoo.cn/backend/api/business/invoiceinfo"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
|
"dashoo.cn/backend/api/business/paymentinfo"
|
|
"dashoo.cn/backend/api/business/paymentinfo"
|
|
|
|
|
+ "dashoo.cn/backend/api/business/register"
|
|
|
"dashoo.cn/backend/api/business/workflow"
|
|
"dashoo.cn/backend/api/business/workflow"
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
"dashoo.cn/backend/api/models"
|
|
"dashoo.cn/backend/api/models"
|
|
@@ -105,8 +106,8 @@ func (this *OilInvoiceController) OpenInvoice() {
|
|
|
invoice.Post2(Url, string(selS), userToken.Token)
|
|
invoice.Post2(Url, string(selS), userToken.Token)
|
|
|
}()
|
|
}()
|
|
|
var errinfo ErrorInfo
|
|
var errinfo ErrorInfo
|
|
|
- errinfo.Code = -1
|
|
|
|
|
- errinfo.Message = "开票中,请勿重复开票!"
|
|
|
|
|
|
|
+ errinfo.Code = 0
|
|
|
|
|
+ errinfo.Message = "开票成功!"
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
}
|
|
}
|
|
@@ -231,7 +232,7 @@ func (this *OilInvoiceController) UpdateIsInvoice() {
|
|
|
paramsOrder.Address = entity.Address
|
|
paramsOrder.Address = entity.Address
|
|
|
paramsOrder.Account = entity.DepositBank + " " + entity.BankAccount
|
|
paramsOrder.Account = entity.DepositBank + " " + entity.BankAccount
|
|
|
paramsOrder.Telephone = supplierEntity.Telphone
|
|
paramsOrder.Telephone = supplierEntity.Telphone
|
|
|
- paramsOrder.Orderno = "dg" + entity.BankSerialNum
|
|
|
|
|
|
|
+ paramsOrder.Orderno = "dg_" + strconv.Itoa(entity.SupplierId) + strconv.Itoa(entity.Id)
|
|
|
paramsOrder.Invoicedate = time.Now().Format("2006-01-02 15:04:05")
|
|
paramsOrder.Invoicedate = time.Now().Format("2006-01-02 15:04:05")
|
|
|
paramsOrder.Clerk = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoicePeople3")
|
|
paramsOrder.Clerk = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoicePeople3")
|
|
|
paramsOrder.Saleaccount = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoiceSaleaccount")
|
|
paramsOrder.Saleaccount = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoiceSaleaccount")
|
|
@@ -241,8 +242,19 @@ func (this *OilInvoiceController) UpdateIsInvoice() {
|
|
|
paramsOrder.Kptype = "1"
|
|
paramsOrder.Kptype = "1"
|
|
|
paramsOrder.Payee = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoicePeople1")
|
|
paramsOrder.Payee = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoicePeople1")
|
|
|
paramsOrder.Checker = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoicePeople2")
|
|
paramsOrder.Checker = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoicePeople2")
|
|
|
- paramsOrder.Tsfs = "2" //-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机
|
|
|
|
|
paramsOrder.Email = entity.Email
|
|
paramsOrder.Email = entity.Email
|
|
|
|
|
+ if entity.Email != "" {
|
|
|
|
|
+ paramsOrder.Tsfs = "2" //-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var corporateInfo register.OilCorporateInfo
|
|
|
|
|
+ sup.GetEntity(&corporateInfo, "CheckStatus = 11 and CommercialNo = '" + entity.CommercialNo + "'")
|
|
|
|
|
+ if corporateInfo.EMail != "" {
|
|
|
|
|
+ paramsOrder.Email = corporateInfo.EMail
|
|
|
|
|
+ paramsOrder.Tsfs = "2" //-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机
|
|
|
|
|
+ } else {
|
|
|
|
|
+ paramsOrder.Tsfs = "1" //-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
paramsOrder.Qdbz = "0"
|
|
paramsOrder.Qdbz = "0"
|
|
|
paramsOrder.Dkbz = "0"
|
|
paramsOrder.Dkbz = "0"
|
|
|
paramsOrder.InvoiceLine = "p"
|
|
paramsOrder.InvoiceLine = "p"
|
|
@@ -269,56 +281,42 @@ func (this *OilInvoiceController) UpdateIsInvoice() {
|
|
|
if invoiceJson.Status != "0000"{
|
|
if invoiceJson.Status != "0000"{
|
|
|
//session.Rollback()
|
|
//session.Rollback()
|
|
|
errinfo.Code = -1
|
|
errinfo.Code = -1
|
|
|
- errinfo.Message = "操作失败!" + invoiceJson.Message
|
|
|
|
|
|
|
+ errinfo.Message = "开票失败!" + invoiceJson.Message
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
} else if invoiceJson.Status == "0000" && invoiceJson.Fpqqlsh != "" {
|
|
} else if invoiceJson.Status == "0000" && invoiceJson.Fpqqlsh != "" {
|
|
|
- var result invoiceinfo.InvoiceNumberJson
|
|
|
|
|
- for i := 0; i < 5; i++ {
|
|
|
|
|
- result = this.SelectInvoice(invoiceJson.Fpqqlsh)
|
|
|
|
|
- if result.Result == "success" && len(result.InvoiceList) > 0 {
|
|
|
|
|
- results := result.InvoiceList[0]
|
|
|
|
|
- if results.Status == "2"{
|
|
|
|
|
- cols := []string{"IsInvoice", "InvoiceOn", "Url", "NuNuSerialNum"}
|
|
|
|
|
- svc := invoiceinfo.GetOilInvoiceInfoSession(session)
|
|
|
|
|
- var info invoiceinfo.OilInvoiceInfo
|
|
|
|
|
- info.IsInvoice = "1"
|
|
|
|
|
- info.InvoiceOn = time.Now()
|
|
|
|
|
- info.Url = results.Url
|
|
|
|
|
- info.NuNuSerialNum = invoiceJson.Fpqqlsh
|
|
|
|
|
- _, err = svc.UpdateEntityByIdCols(invoiceId.Id, &info, cols)
|
|
|
|
|
|
|
+ cols := []string{"IsInvoice", "InvoiceOn", "NuNuSerialNum"}
|
|
|
|
|
+ svc := invoiceinfo.GetOilInvoiceInfoSession(session)
|
|
|
|
|
+ var info invoiceinfo.OilInvoiceInfo
|
|
|
|
|
+ info.IsInvoice = "1"
|
|
|
|
|
+ info.InvoiceOn = time.Now()
|
|
|
|
|
+ info.NuNuSerialNum = invoiceJson.Fpqqlsh
|
|
|
|
|
+ _, err = svc.UpdateEntityByIdCols(invoiceId.Id, &info, cols)
|
|
|
|
|
|
|
|
- var payinfo paymentinfo.OilPaymentInfo
|
|
|
|
|
- payinfo.IsInvoice = "1"
|
|
|
|
|
- paycols := []string{"IsInvoice"}
|
|
|
|
|
- where := "Id in (" + invoiceId.SrcIds + ")"
|
|
|
|
|
- err = svc.UpdateEntityBywheretbl(OilPaymentInfoName, &payinfo, paycols, where)
|
|
|
|
|
|
|
+ var payinfo paymentinfo.OilPaymentInfo
|
|
|
|
|
+ payinfo.IsInvoice = "1"
|
|
|
|
|
+ paycols := []string{"IsInvoice"}
|
|
|
|
|
+ where := "Id in (" + invoiceId.SrcIds + ")"
|
|
|
|
|
+ err = svc.UpdateEntityBywheretbl(OilPaymentInfoName, &payinfo, paycols, where)
|
|
|
|
|
|
|
|
- svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_SUPPLIER_VERIFY
|
|
|
|
|
- ActiComplete.BusinessKey = invoiceId.Id
|
|
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
|
|
- ActiComplete.Remarks = ""
|
|
|
|
|
- ActiComplete.Result = "1"
|
|
|
|
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_SUPPLIER_VERIFY
|
|
|
|
|
+ ActiComplete.BusinessKey = invoiceId.Id
|
|
|
|
|
+ ActiComplete.UserId = this.User.Id
|
|
|
|
|
+ ActiComplete.Remarks = ""
|
|
|
|
|
+ ActiComplete.Result = "1"
|
|
|
|
|
|
|
|
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
|
|
- fmt.Println("receiveVal:" + receiveVal)
|
|
|
|
|
- if receiveVal == "true" && err != nil {
|
|
|
|
|
- session.Commit()
|
|
|
|
|
- } else {
|
|
|
|
|
- session.Rollback()
|
|
|
|
|
- }
|
|
|
|
|
- break
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- fmt.Print("状态i++" + string(i))
|
|
|
|
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
|
|
+ fmt.Println("receiveVal:" + receiveVal)
|
|
|
|
|
+ if receiveVal == "true" && err == nil {
|
|
|
|
|
+ session.Commit()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ session.Rollback()
|
|
|
}
|
|
}
|
|
|
- invoiceStr, _ := json.Marshal(result)
|
|
|
|
|
- fmt.Print("获取正确开票状态" + string(invoiceStr))
|
|
|
|
|
}
|
|
}
|
|
|
errinfo.Code = 0
|
|
errinfo.Code = 0
|
|
|
- errinfo.Message = "开票中,请等待!"
|
|
|
|
|
|
|
+ errinfo.Message = "开票成功!"
|
|
|
this.Data["json"] = &errinfo
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
this.ServeJSON()
|
|
|
}
|
|
}
|
|
@@ -327,9 +325,8 @@ func (this *OilInvoiceController) UpdateIsInvoice() {
|
|
|
// @Description 获取开票状态
|
|
// @Description 获取开票状态
|
|
|
// @Success 200 {object} controllers.Request
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /selectInvoice [get]
|
|
// @router /selectInvoice [get]
|
|
|
-func (this *OilInvoiceController) SelectInvoice(Fpqqlsh string) invoiceinfo.InvoiceNumberJson {
|
|
|
|
|
|
|
+func (this *OilInvoiceController) SelectInvoice(Fpqqlsh string, Id int) invoiceinfo.InvoiceNumberJson {
|
|
|
paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
- time.Sleep(time.Second * 5)
|
|
|
|
|
var sel SelectInvoiceJson
|
|
var sel SelectInvoiceJson
|
|
|
key := paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoiceKey64")
|
|
key := paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoiceKey64")
|
|
|
sel.Identity = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoiceIdentity")
|
|
sel.Identity = paramSvc.GetBaseparameterMessage("INVOICE", "paramset", "InvoiceIdentity")
|
|
@@ -342,7 +339,51 @@ func (this *OilInvoiceController) SelectInvoice(Fpqqlsh string) invoiceinfo.Invo
|
|
|
// 根据流水号查询结果
|
|
// 根据流水号查询结果
|
|
|
//params := "{'identity':'" + identity + "','fpqqlsh':['" + invoiceJson.Fpqqlsh + "']}"
|
|
//params := "{'identity':'" + identity + "','fpqqlsh':['" + invoiceJson.Fpqqlsh + "']}"
|
|
|
//invoiceJson1 := invoice.SerialNumberPost(url, params, key)
|
|
//invoiceJson1 := invoice.SerialNumberPost(url, params, key)
|
|
|
|
|
+ invoiceStr, _ := json.Marshal(invoiceJson1)
|
|
|
|
|
+ fmt.Print("获取开票状态" + string(invoiceStr))
|
|
|
|
|
+ if invoiceJson1.Result == "success" && len(invoiceJson1.InvoiceList) > 0 {
|
|
|
|
|
+ results := invoiceJson1.InvoiceList[0]
|
|
|
|
|
+ if results.Status == "2" {
|
|
|
|
|
+ cols := []string{"Url"}
|
|
|
|
|
+ var info invoiceinfo.OilInvoiceInfo
|
|
|
|
|
+ info.Url = results.Url
|
|
|
|
|
+ _, err := invoice.UpdateEntityByIdCols(Id, &info, cols)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ fmt.Print("修改url失败")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return invoiceJson1
|
|
return invoiceJson1
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// @Title 获取已开发票没有url的
|
|
|
|
|
+// @Description 获取已开发票没有url的
|
|
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
|
|
+// @router /selectInvoiceStatus [get]
|
|
|
|
|
+func (this *OilInvoiceController) SelectInvoiceStatus() {
|
|
|
|
|
+ var invoiceList []invoiceinfo.OilInvoiceInfo
|
|
|
|
|
+ svc := invoiceinfo.GetInvoiceService(utils.DBE)
|
|
|
|
|
+
|
|
|
|
|
+ svc.GetEntitysByWhere("OilInvoiceInfo","NuNuSerialNum != '' and (Url = '' or Url is null)", &invoiceList)
|
|
|
|
|
+ for _, invoice := range invoiceList {
|
|
|
|
|
+ this.SelectInvoice(invoice.NuNuSerialNum, invoice.Id)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+// @Title 走工作流
|
|
|
|
|
+// @Description 走工作流
|
|
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
|
|
+// @router /workflowInvoice/:id [get]
|
|
|
|
|
+func (this *OilInvoiceController) WorkflowInvoice() {
|
|
|
|
|
+ Id := this.Ctx.Input.Param(":id")
|
|
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_SUPPLIER_VERIFY
|
|
|
|
|
+ ActiComplete.BusinessKey = Id
|
|
|
|
|
+ ActiComplete.UserId = this.User.Id
|
|
|
|
|
+ ActiComplete.Remarks = ""
|
|
|
|
|
+ ActiComplete.Result = "1"
|
|
|
|
|
+
|
|
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
|
|
+ fmt.Println("receiveVal:" + receiveVal)
|
|
|
|
|
+}
|