Parcourir la source

启动工作流增加驳回后的提交判断

baichengfei il y a 5 ans
Parent
commit
63c8519ed6

+ 6 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -893,14 +893,16 @@ func (this *AnnualAuditController) CompanyAuditEntity() {
 
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
-	businessKey := annualId + "-" + strconv.Itoa(annualEntity.AuditIndex)
+	businessKey := annualEntity.BusinessKey
 	processInstanceId := annualEntity.WorkflowId
 	// 如果被驳回,不再新启工作流
 	if processInstanceId == "" {
+		businessKey = annualId + "-" + strconv.Itoa(annualEntity.AuditIndex)
 		processInstanceId = svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, "1", annualEntity.SupplierTypeName, supplierEntity.SupplierName)
 		if len(processInstanceId) <= 0 {
 			panic("工作流启动失败!")
 		}
+		annualEntity.AuditIndex += 1
 	}
 	// 将启动和工作流,选择的初审和复审人员保存下来
 	cols := []string{
@@ -915,7 +917,6 @@ func (this *AnnualAuditController) CompanyAuditEntity() {
 	annualEntity.BusinessKey = businessKey
 	annualEntity.WorkflowId = processInstanceId
 	annualEntity.CommitComId = unitId
-	annualEntity.AuditIndex += 1
 	srv.UpdateEntityByIdCols(annualId, annualEntity, cols)
 
 	var ActiComplete workflow.ActiCompleteVM
@@ -972,14 +973,16 @@ func (this *AnnualAuditController) SeparateUnitSubmitAuditEntity() {
 
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
-	businessKey := annualId + "-" + strconv.Itoa(auditEntity.AuditIndex)
+	businessKey := auditEntity.BusinessKey
 	processInstanceId := auditEntity.WorkflowId
 	// 如果被驳回,不再新启工作流
 	if processInstanceId == "" {
+		businessKey = annualId + "-" + strconv.Itoa(auditEntity.AuditIndex)
 		processInstanceId = svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, "1", auditEntity.SupplierTypeName, supplierEntity.SupplierName)
 		if len(processInstanceId) <= 0 {
 			panic("工作流启动失败!")
 		}
+		auditEntity.AuditIndex += 1
 	}
 
 	// 将启动和工作流,选择的初审和复审人员保存下来
@@ -999,7 +1002,6 @@ func (this *AnnualAuditController) SeparateUnitSubmitAuditEntity() {
 	auditEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
 	auditEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
 	auditEntity.CommitComId = strconv.Itoa(unitId)
-	auditEntity.AuditIndex += 1
 	svc.UpdateEntityByIdCols(annualId, auditEntity, cols)
 
 	var ActiComplete workflow.ActiCompleteVM

+ 6 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -1583,14 +1583,16 @@ func (this *InfoChangeController) CompanyAuditEntity() {
 
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
-	businessKey := infoId + "-" + strconv.Itoa(infoChangeEntity.AuditIndex)
+	businessKey := infoChangeEntity.BusinessKey
 	processInstanceId := infoChangeEntity.WorkFlowId
 	// 如果被驳回,不再新启工作流
 	if processInstanceId == "" {
+		businessKey = infoId + "-" + strconv.Itoa(infoChangeEntity.AuditIndex)
 		processInstanceId = svcActiviti.StartProcess2(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id, "1", infoChangeEntity.SupplierTypeCode, supplierEntity.SupplierName)
 		if len(processInstanceId) <= 0 {
 			panic("工作流启动失败!")
 		}
+		infoChangeEntity.AuditIndex += 1
 	}
 	// 将启动和工作流,选择的分办单位id记录下来
 	cols := []string{
@@ -1605,7 +1607,6 @@ func (this *InfoChangeController) CompanyAuditEntity() {
 	infoChangeEntity.BusinessKey = businessKey
 	infoChangeEntity.WorkFlowId = processInstanceId
 	infoChangeEntity.CommitComId = unitId
-	infoChangeEntity.AuditIndex += 1
 	infoSrv.UpdateEntityByIdCols(infoId, infoChangeEntity, cols)
 
 	var ActiComplete workflow.ActiCompleteVM
@@ -1666,14 +1667,16 @@ func (this *InfoChangeController) UnitAuditEntity() {
 
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
-	businessKey := infoId + "-" + strconv.Itoa(infoChangeEntity.AuditIndex)
+	businessKey := infoChangeEntity.BusinessKey
 	processInstanceId := infoChangeEntity.WorkFlowId
 	// 如果被驳回,不再新启工作流
 	if processInstanceId == "" {
+		businessKey = infoId + "-" + strconv.Itoa(infoChangeEntity.AuditIndex)
 		processInstanceId = svcActiviti.StartProcess2(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id, "1", infoChangeEntity.SupplierTypeCode, supplierEntity.SupplierName)
 		if len(processInstanceId) <= 0 {
 			panic("工作流启动失败!")
 		}
+		infoChangeEntity.AuditIndex += 1
 	}
 	// 将启动和工作流,选择的初审和复审人员保存下来
 	cols := []string{
@@ -1693,7 +1696,6 @@ func (this *InfoChangeController) UnitAuditEntity() {
 	infoChangeEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
 	infoChangeEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
 	infoChangeEntity.CommitComId = strconv.Itoa(unitId)
-	infoChangeEntity.AuditIndex += 1
 	svc.UpdateEntityByIdCols(infoId, infoChangeEntity, cols)
 
 	var ActiComplete workflow.ActiCompleteVM

+ 6 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -722,14 +722,16 @@ func (this *OilSupplierCertAppendController) CompanySubmitAuditEntity() {
 
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
-	businessKey := certAppendId + "-" + strconv.Itoa(supplierCertAppendEntity.AuditIndex)
+	businessKey := supplierCertAppendEntity.BusinessKey
 	processInstanceId := supplierCertAppendEntity.WorkFlowId
 	// 如果被驳回,不再新启工作流
 	if processInstanceId == "" {
+		businessKey = certAppendId + "-" + strconv.Itoa(supplierCertAppendEntity.AuditIndex)
 		processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_APPEND_APPLY, businessKey, this.User.Id, "1", supplierCertAppendEntity.AppendType, supplierEntity.SupplierName)
 		if len(processInstanceId) <= 0 {
 			panic("工作流启动失败!")
 		}
+		supplierCertAppendEntity.AuditIndex += 1
 	}
 	// 将启动和工作流,选择的初审和复审人员保存下来
 	cols := []string{
@@ -744,7 +746,6 @@ func (this *OilSupplierCertAppendController) CompanySubmitAuditEntity() {
 	supplierCertAppendEntity.BusinessKey = businessKey
 	supplierCertAppendEntity.WorkFlowId = processInstanceId
 	supplierCertAppendEntity.CommitComId = unitId
-	supplierCertAppendEntity.AuditIndex += 1
 	certSrv.UpdateEntityByIdCols(certAppendId, supplierCertAppendEntity, cols)
 
 	var ActiComplete workflow.ActiCompleteVM
@@ -802,14 +803,16 @@ func (this *OilSupplierCertAppendController) SeparateUnitSubmitAuditEntity() {
 
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	//启动工作流
-	businessKey := certAppendId + "-" + strconv.Itoa(supplierCertAppendEntity.AuditIndex)
+	businessKey := supplierCertAppendEntity.BusinessKey
 	processInstanceId := supplierCertAppendEntity.WorkFlowId
 	// 如果被驳回,不再新启工作流
 	if processInstanceId == "" {
+		businessKey := certAppendId + "-" + strconv.Itoa(supplierCertAppendEntity.AuditIndex)
 		processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_APPEND_APPLY, businessKey, this.User.Id, "1", supplierCertAppendEntity.AppendType, supplierEntity.SupplierName)
 		if len(processInstanceId) <= 0 {
 			panic("工作流启动失败!")
 		}
+		supplierCertAppendEntity.AuditIndex += 1
 	}
 
 	// 将启动和工作流,选择的初审和复审人员保存下来
@@ -831,7 +834,6 @@ func (this *OilSupplierCertAppendController) SeparateUnitSubmitAuditEntity() {
 	supplierCertAppendEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
 	supplierCertAppendEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
 	supplierCertAppendEntity.CommitComId = strconv.Itoa(unitId)
-	supplierCertAppendEntity.AuditIndex += 1
 	certSrv.UpdateEntityByIdCols(certAppendId, supplierCertAppendEntity, cols)
 
 	var ActiComplete workflow.ActiCompleteVM