Ver código fonte

批量分配处理

WH01243 1 ano atrás
pai
commit
e21d5570a7
1 arquivos alterados com 9 adições e 6 exclusões
  1. 9 6
      service/company.go

+ 9 - 6
service/company.go

@@ -69,7 +69,7 @@ func DistributeClueShow(this *biservice.DistributeClueShowReq, allocationCap int
 		existingCount := JyBiTidb.CountBySql(`select count(1) from dwd_f_crm_clue_info where position_id=? and  is_assign=1 and trailstatus != '08' `, m.PositionId)
 		m.ExistingCount = existingCount
 		if existingCount > allocationCap {
-			m.FullStatus = true
+			continue
 		}
 		if this.DataType == 1 {
 			m.CompanyCount = 0
@@ -80,6 +80,12 @@ func DistributeClueShow(this *biservice.DistributeClueShowReq, allocationCap int
 		rdata = append(rdata, m)
 		pArr = append(pArr, strconv.FormatInt(c.PositionId, 10))
 	}
+	if len(rdata) == 0 {
+		return &biservice.DistributeClueShowResp{
+			ErrorCode: 0,
+			Data:      rdata,
+		}
+	}
 	clueArrs1 := []string{}
 	clueArrs := []string{}
 	clueArrSync := &sync.Mutex{}
@@ -199,7 +205,7 @@ func DistributeClueShow(this *biservice.DistributeClueShowReq, allocationCap int
 					for pa := range ppMap {
 						if pa > 0 {
 							for n, r := range rdata {
-								if r.PositionId == pa {
+								if r.PositionId == pa && !r.FullStatus {
 									if this.DataType == 1 {
 										isOk = true
 										sindex = n
@@ -247,10 +253,7 @@ func DistributeClueShow(this *biservice.DistributeClueShowReq, allocationCap int
 		logx.Info("sql3 ", sql3) //从大到小排列这一列线索名称分组及数量情况
 		cdata := JyBiTidb.SelectBySql(sql3)
 		if cdata != nil && len(*cdata) > 0 {
-			for k1, v := range *cdata {
-				if k1 == 37 {
-					fmt.Println(1111)
-				}
+			for _, v := range *cdata {
 				count := common.IntAll(v["count"])
 				cluename := common.ObjToString(v["cluename"])
 				minCount, minIndex := int64(0), 0