Browse Source

后端: 合同评价批量处理走协程前添加延时

baichengfei 4 years ago
parent
commit
d25b96fe0d
1 changed files with 10 additions and 8 deletions
  1. 10 8
      src/dashoo.cn/backend/api/controllers/oilcontract/contractReview.go

+ 10 - 8
src/dashoo.cn/backend/api/controllers/oilcontract/contractReview.go

@@ -571,7 +571,7 @@ func (this *OilContractReviewController) SaveEvaluationItemsBySec() {
 		if v.Id == 0 {
 			panic("操作失败!请求信息Id不完整")
 		}
-		cols := []string{"Score","Value","Remark","ModifiedOn","ModifiedBy","ModifiedUserId"}
+		cols := []string{"Score", "Value", "Remark", "ModifiedOn", "ModifiedBy", "ModifiedUserId"}
 		var temp contractEvaluationItems.OilContractEvaluationItems
 		temp.Score = v.Score
 		temp.Value = v.Value
@@ -579,7 +579,7 @@ func (this *OilContractReviewController) SaveEvaluationItemsBySec() {
 		temp.ModifiedOn = time.Now()
 		temp.ModifiedBy = this.User.Realname
 		temp.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
-		err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp, cols, "Category = 1 and ContentReviewId = " + id + " and ItemId = " + strconv.Itoa(v.Id))
+		err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp, cols, "Category = 1 and ContentReviewId = "+id+" and ItemId = "+strconv.Itoa(v.Id))
 		if err != nil {
 			panic("修改失败!" + utils.AlertProcess(err.Error()))
 		}
@@ -630,7 +630,7 @@ func (this *OilContractReviewController) ProfUpdateSecEvaEntity() {
 		if v.Id == 0 {
 			panic("操作失败!请求信息Id不完整")
 		}
-		cols := []string{"Score","Value","Remark","ModifiedOn","ModifiedBy","ModifiedUserId"}
+		cols := []string{"Score", "Value", "Remark", "ModifiedOn", "ModifiedBy", "ModifiedUserId"}
 		var temp contractEvaluationItems.OilContractEvaluationItems
 		temp.Score = v.Score
 		temp.Value = v.Value
@@ -638,7 +638,7 @@ func (this *OilContractReviewController) ProfUpdateSecEvaEntity() {
 		temp.ModifiedOn = time.Now()
 		temp.ModifiedBy = this.User.Realname
 		temp.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
-		err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp, cols, "Category = 0 and ContentReviewId = " + id + " and ItemId = " + strconv.Itoa(v.Id))
+		err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp, cols, "Category = 0 and ContentReviewId = "+id+" and ItemId = "+strconv.Itoa(v.Id))
 		if err != nil {
 			panic("修改失败!" + utils.AlertProcess(err.Error()))
 		}
@@ -720,7 +720,7 @@ func (this *OilContractReviewController) UpdateEntity() {
 		panic("修改失败!" + utils.AlertProcess(err.Error()))
 	}
 
-	cols = []string{"Score","Value","Remark","ModifiedOn","ModifiedBy","ModifiedUserId"}
+	cols = []string{"Score", "Value", "Remark", "ModifiedOn", "ModifiedBy", "ModifiedUserId"}
 	if modeVO.IsBusiness == 0 {
 		//where := "ContentReviewId=" + id + " AND Category = 0 "
 		// 清除掉之前的
@@ -738,7 +738,7 @@ func (this *OilContractReviewController) UpdateEntity() {
 			temp.ModifiedOn = time.Now()
 			temp.ModifiedBy = this.User.Realname
 			temp.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
-			err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp, cols, "Category = 0 and ContentReviewId = " + id + " and ItemId = " + strconv.Itoa(v.Id))
+			err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp, cols, "Category = 0 and ContentReviewId = "+id+" and ItemId = "+strconv.Itoa(v.Id))
 			if err != nil {
 				panic("修改失败!" + utils.AlertProcess(err.Error()))
 			}
@@ -757,7 +757,7 @@ func (this *OilContractReviewController) UpdateEntity() {
 			temp2.Score = v.Score
 			temp2.Value = v.Value
 			temp2.Remark = v.Remark
-			err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp2, cols, "Category = 1 and ContentReviewId = " + id + " and ItemId = " + strconv.Itoa(v.Id))
+			err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp2, cols, "Category = 1 and ContentReviewId = "+id+" and ItemId = "+strconv.Itoa(v.Id))
 			if err != nil {
 				panic("修改失败!" + utils.AlertProcess(err.Error()))
 			}
@@ -780,7 +780,7 @@ func (this *OilContractReviewController) UpdateEntity() {
 			temp3.ModifiedOn = time.Now()
 			temp3.ModifiedBy = this.User.Realname
 			temp3.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
-			err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp3, cols, "Category = 2 and ContentReviewId = " + id + " and ItemId = " + strconv.Itoa(v.Id))
+			err := itemSvc.UpdateEntityBywheretbl(OilContractEvaluationItemsName, &temp3, cols, "Category = 2 and ContentReviewId = "+id+" and ItemId = "+strconv.Itoa(v.Id))
 			if err != nil {
 				panic("修改失败!" + utils.AlertProcess(err.Error()))
 			}
@@ -1025,6 +1025,7 @@ func (this *OilContractReviewController) CommonAuditEntity() {
 					log.Print("日常评价 工作流异常,业务ID:" + contractReviewEntity.BusinessKey + ",工作流信息:" + receiveVal)
 				}
 			}()
+			time.Sleep(time.Duration(200) * time.Millisecond) // 休眠200毫秒
 		} else {
 			receiveVal := svcActiviti.TaskComplete(ActiComplete)
 			if receiveVal != "true" {
@@ -1122,6 +1123,7 @@ func (this *OilContractReviewController) BusinessOfficeSeparateAuditEntity() {
 					}
 				}
 			}()
+			time.Sleep(time.Duration(200) * time.Millisecond) // 休眠200毫秒
 		} else {
 			receiveVal := svcActiviti.TaskComplete(ActiComplete)
 			if receiveVal != "true" {