Sfoglia il codice sorgente

交费后银行回调的处理以及相应的工作流处理

baichengfei 5 anni fa
parent
commit
b76b772cb8

+ 9 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/annualListener.go

@@ -294,9 +294,17 @@ func (this *OilAnnualListenerController) WorkflowEndAudit() {
 		"Status",
 	}
 	//进入此步骤,记录在数据库中
-	annualEntity.Status = suppliercert.STORE_STATUS //已入库
+	annualEntity.Status = suppliercert.ALL_PASE_STATUS //审核完成
+	annualEntity.ApplyTime = annualEntity.ApplyTime.AddDate(1, 0, 0) //更新年审表时间
 	srv.UpdateEntityByIdCols(annualId, annualEntity, cols)
 
+	//更新准入表时间
+	paymentInfoSvc := paymentinfo.GetPaymentService(utils.DBE)
+	var certModel suppliercert.OilSupplierCert
+	certModel.ApplyTime = annualEntity.ApplyTime.AddDate(1, 0, 0)
+	certModel.InFlag = "1"
+	paymentInfoSvc.UpdateEntityByIdCols(strconv.Itoa(annualEntity.CerId), &certModel, []string{"ApplyTime", "InFlag"})
+
 	this.Data["json"] = 1
 	this.ServeJSON()
 }

+ 36 - 50
src/dashoo.cn/backend/api/controllers/oilsupplier/paymentinfo.go

@@ -625,45 +625,47 @@ func (this *PaymentInfoController) ReceiveMoneyBillList() {
 				//panic("工作流异常,请联系管理员!" + res)
 			}
 		} else if payItem.PayType == "2" { //年审
-			//TODO: 修改年审时间
-			annualSvc := annualaudit.GetOilAnnualAuditService(utils.DBE)
-			var annualEntities []annualaudit.OilAnnualAudit
-			annWhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and CerId = " + utils.ToStr(payItem.SupplierCertId) + " and Status = '6'"
-			svc.GetEntitysByWhere(OilAnnualAuditName, annWhere, &annualEntities)
-			if len(annualEntities) > 0 {
-				//更新年审表时间
-				var annModel annualaudit.OilAnnualAudit
-				annModel.Status = suppliercert.ALL_PASE_STATUS
-				annModel.ApplyTime = annualEntities[0].ApplyTime.AddDate(1, 0, 0)
-				annualSvc.UpdateEntityBywheretbl(OilAnnualAuditName, &annModel, []string{"ApplyTime", "Status"}, annWhere)
-				//更新准入表时间
-				var certmodel suppliercert.OilSupplierCert
-				certmodel.ApplyTime = annualEntities[0].ApplyTime.AddDate(1, 0, 0)
-				certmodel.InFlag = "1"
-				svc.UpdateEntityByIdCols(strconv.Itoa(payItem.SupplierCertId), &certmodel, []string{"ApplyTime", "InFlag"})
+			//取出年审表信息
+			annualSrv := annualaudit.GetOilAnnualAuditService(utils.DBE)
+			var annualEntity annualaudit.OilAnnualAudit
+			annualSrv.GetEntityById(payItem.SrcId, &annualEntity)
+
+			var ActiComplete workflow.ActiCompleteVM
+			ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
+			ActiComplete.BusinessKey = annualEntity.BusinessKey
+			ActiComplete.UserId = this.User.Id
+			ActiComplete.Result = "1"
+			ActiComplete.Remarks = "交费成功。"
+			ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
+
+			res := svcActiviti.TaskComplete(ActiComplete)
+			if res != "true" {
+				fmt.Println("工作流异常,请联系管理员!" + res)
+				//panic("工作流异常,请联系管理员!" + res)
 			}
 		} else if payItem.PayType == "3" { //增项
-			appSvc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
-			//更新准入项表
-			accessWhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and SupplierCertId = " + utils.ToStr(payItem.SupplierCertId) + " and Type = '2'"
-			var appendSubModel suppliercertsub.OilSupplierCertSub
-			appendSubModel.Type = "3"
-			appSvc.UpdateEntityBywheretbl(OilSupplierCertSubName, &appendSubModel, []string{"Type"}, accessWhere)
-			//更新资质表
-			appendFileWhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and SupType = 2"
-			var appendSubFileModel supplierfile.OilSupplierFile
-			appendSubFileModel.SupType = 3
-			appSvc.UpdateEntityBywheretbl(OilSupplierCertSubName, &appendSubFileModel, []string{"SupType"}, appendFileWhere)
-			//更新增项表
-			appendWhere := " SupplierId = " + utils.ToStr(payItem.SupplierId) + " and SupplierCertId = " + utils.ToStr(payItem.SupplierCertId) + " and Status = '6'"
-			var appendModel suppliercertappend.OilSupplierCertAppend
-			appendModel.Status = suppliercert.ALL_PASE_STATUS
-			appSvc.UpdateEntityBywheretbl(OilSupplierCertAppendName, &appendModel, []string{"Status"}, appendWhere)
+			//取出增项表信息
+			appendSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
+			var appendEntity suppliercertappend.OilSupplierCertAppend
+			appendSrv.GetEntityById(payItem.SrcId, &appendEntity)
+
+			var ActiComplete workflow.ActiCompleteVM
+			ActiComplete.ProcessKey = workflow.OIL_ENUSER_APPEND_APPLY
+			ActiComplete.BusinessKey = appendEntity.BusinessKey
+			ActiComplete.UserId = this.User.Id
+			ActiComplete.Result = "1"
+			ActiComplete.Remarks = "交费成功。"
+			ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
+
+			res := svcActiviti.TaskComplete(ActiComplete)
+			if res != "true" {
+				fmt.Println("工作流异常,请联系管理员!" + res)
+				//panic("工作流异常,请联系管理员!" + res)
+			}
 		}
 	}
 
-	// 待开发票
-
+	// 待开发票记录
 	var suppentity supplier.OilSupplier
 	where := "Id=" + strconv.Itoa(supplierId)
 	svc.GetEntity(&suppentity, where)
@@ -684,22 +686,6 @@ func (this *PaymentInfoController) ReceiveMoneyBillList() {
 
 	svc.InsertEntity(&invoiceInfo)
 
-	userSvc := userRole.GetUserService(utils.DBE)
-	paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
-	financeRoleId := paramSvc.GetBaseparameterMessage("", "paramset", "FinanceRoleId")
-	ids := userSvc.GetUserIdsByRoleId(financeRoleId)
-	tempStr := strings.Join(ids, ",")
-	uids := strings.Replace(tempStr, "uid_", "", -1)
-	uids = strings.Trim(uids, ",")
-
-	businessKey := strconv.Itoa(invoiceInfo.Id)
-	result := "1"
-	processInstanceId := svcActiviti.StartProcess2(workflow.OIL_SUPPLIER_VERIFY, businessKey, uids, result, "04", suppentity.SupplierName)
-	invoiceInfo.WorkflowId = processInstanceId
-	cols := []string{"WorkflowId"}
-	svc.UpdateEntityByIdCols(invoiceInfo.Id, &invoiceInfo, cols)
-
-
 	//记录对账日志
 	paymentBankInfo := new(paymentbankinfo.OilPaymentBankInfo)
 	paymentBankInfo.BillIds = billParams.Ids

+ 20 - 6
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertAppendListener.go

@@ -4,6 +4,8 @@ import (
 	msg2 "dashoo.cn/backend/api/business/msg"
 	"dashoo.cn/backend/api/business/oilsupplier/oilcostmanage"
 	"dashoo.cn/backend/api/business/oilsupplier/supplier"
+	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
+	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
 	"dashoo.cn/backend/api/business/paymentinfo"
 	"encoding/json"
 	"strconv"
@@ -270,16 +272,16 @@ func (this *OilSupplierCertAppendListenerController) GetStorageAuditor() {
 	json.Unmarshal(jsonBlob, &listenerApprove)
 	supplierCertAppendId := strings.Split(listenerApprove.BusinessKey, "-")[0]
 
-	certSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
+	certAppendSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
 	var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
-	certSrv.GetEntityById(supplierCertAppendId, &supplierCertAppendEntity)
+	certAppendSrv.GetEntityById(supplierCertAppendId, &supplierCertAppendEntity)
 	cols := []string{
 		"Id",
 		"Status",
 	}
 	//进入此步骤,记录在数据库中
 	supplierCertAppendEntity.Status = suppliercert.STOREING_STATUS //待入库
-	certSrv.UpdateEntityByIdCols(supplierCertAppendId, supplierCertAppendEntity, cols)
+	certAppendSrv.UpdateEntityByIdCols(supplierCertAppendId, supplierCertAppendEntity, cols)
 
 	//查出入库审批的人员
 	stepCode := workflow.PROF_REGULATION //待入库(企业法规处)
@@ -298,9 +300,9 @@ func (this *OilSupplierCertAppendListenerController) GetStorageAuditor() {
 func (this *OilSupplierCertAppendListenerController) WorkflowEndAudit() {
 	businessKey := this.GetString("businessKey")
 	supplierCertAppendId := strings.Split(businessKey, "-")[0]
-	certSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
+	certAppendSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
 	var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
-	certSrv.GetEntityById(supplierCertAppendId, &supplierCertAppendEntity)
+	certAppendSrv.GetEntityById(supplierCertAppendId, &supplierCertAppendEntity)
 
 	cols := []string{
 		"Id",
@@ -308,7 +310,19 @@ func (this *OilSupplierCertAppendListenerController) WorkflowEndAudit() {
 	}
 	//进入此步骤,记录在数据库中
 	supplierCertAppendEntity.Status = suppliercert.STORE_STATUS //已入库
-	certSrv.UpdateEntityByIdCols(supplierCertAppendId, supplierCertAppendEntity, cols)
+	certAppendSrv.UpdateEntityByIdCols(supplierCertAppendId, supplierCertAppendEntity, cols)
+
+	// 增项审批完成, 更新资质
+	//更新准入项表
+	appendWhere := " SupplierId = " + utils.ToStr(supplierCertAppendEntity.SupplierId) + " and SupplierCertId = " + utils.ToStr(supplierCertAppendEntity.SupplierCertId) + " and Type = '2'"
+	var appendSubModel suppliercertsub.OilSupplierCertSub
+	appendSubModel.Type = "3"
+	certAppendSrv.UpdateEntityBywheretbl(OilSupplierCertSubName, &appendSubModel, []string{"Type"}, appendWhere)
+	//更新资质表
+	appendFileWhere := " SupplierId = " + utils.ToStr(supplierCertAppendEntity.SupplierId) + " and SupType = 2"
+	var appendSubFileModel supplierfile.OilSupplierFile
+	appendSubFileModel.SupType = 3
+	certAppendSrv.UpdateEntityBywheretbl(OilSupplierCertSubName, &appendSubFileModel, []string{"SupType"}, appendFileWhere)
 
 	this.Data["json"] = 1
 	this.ServeJSON()

+ 3 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertListener.go

@@ -376,9 +376,12 @@ func (this *OilSupplierCertListenerController) GetStorageAuditor() {
 	cols := []string{
 		"Id",
 		"Status",
+		"IsPay",
 	}
+	// TODO  Step字段的更新
 	//进入此步骤,记录在数据库中
 	supplierCertEntity.Status = suppliercert.STOREING_STATUS //待入库
+	supplierCertEntity.IsPay = 1
 	certSrv.UpdateEntityByIdCols(supplierCertId, supplierCertEntity, cols)
 
 	//查出入库审批的人员