소스 검색

Merge commit '5705ae28c49b8a499ed27badc68060458d501630' into feature/v1.5.2

* commit '5705ae28c49b8a499ed27badc68060458d501630':
  配置文件提交

# Conflicts:
#	clueSync/config.json
Jianghan 1 년 전
부모
커밋
33b43effcc
3개의 변경된 파일38개의 추가작업 그리고 40개의 파일을 삭제
  1. 1 0
      clueSync/config.go
  2. 22 22
      clueSync/config.json
  3. 15 18
      clueSync/sendMail.go

+ 1 - 0
clueSync/config.go

@@ -129,6 +129,7 @@ type (
 			Password string `json:"password"`
 		} `json:"es"`
 		AllocationCap int64 `json:"allocationCap"`
+		WarningValue  int64 `json:"warningValue"`
 	}
 )
 

+ 22 - 22
clueSync/config.json

@@ -6,11 +6,11 @@
   "cornexp5": "0 */5 * * * ?",
   "cornexp6": "0 */10 * * * ?",
   "cornexp7": "0 */10 * * * ?",
-  "corn_mail": "0 */10 * * * ?",
+  "corn_mail": "",
   "lastOrderId": 258784,
-  "lastOrderClueId": "",
+  "lastOrderClueId": "2024-05-11 11:12:47",
   "lastUserId": "644101e58b6d74a60a09aec7",
-  "lastId": "6440faf7bd4ea1862af84c56",
+  "lastId": "663d84df38aab24d0bf59e53",
   "lastOrderTime": "2023-04-25 00:00:00",
   "lastUserTime": "2023-04-25 00:00:00",
   "lastSubscribeId": "645470af172d9e8dcc5c507a",
@@ -24,9 +24,9 @@
   "regTimes": 7,
   "redisServer": "192.168.3.206:1712",
   "tiDb": {
-    "host": "127.0.0.1",
-    "port": 4001,
-    "database": "Jianyu_subjectdb",
+    "host": "192.168.3.149",
+    "port": 4000,
+    "database": "jianyu_subjectdb_test",
     "user": "datagroup",
     "password": "Dgrpdb#2024@36",
     "poolsize": 20,
@@ -34,11 +34,11 @@
     "maxleft": 40
   },
   "tiDbData": {
-    "host": "127.0.0.1",
-    "port": 4001,
+    "host": "192.168.3.14",
+    "port": 4000,
     "database": "Call_Accounting",
-    "user": "datagroup",
-    "password": "Dgrpdb#2024@36",
+    "user": "root",
+    "password": "=PDT49#80Z!RVv52_z",
     "poolsize": 20,
     "maxidle": 40,
     "maxleft": 40
@@ -46,7 +46,7 @@
   "tiDbPower": {
     "host": "192.168.3.149",
     "port": 4000,
-    "database": "Jianyu_subjectdb",
+    "database": "jianyu_subjectdb_test",
     "user": "datagroup",
     "password": "Dgrpdb#2024@36",
     "poolsize": 20,
@@ -54,21 +54,21 @@
     "maxleft": 40
   },
   "baseService": {
-    "host": "192.168.3.149",
+    "host": "192.168.3.14",
     "port": 4000,
     "database": "base_service",
-    "user": "datagroup",
-    "password": "Dgrpdb#2024@36",
+    "user": "root",
+    "password": "=PDT49#80Z!RVv52_z",
     "poolsize": 20,
     "maxidle": 40,
     "maxleft": 40
   },
   "thirdParty": {
-    "host": "127.0.0.1",
-    "port": 4001,
+    "host": "192.168.3.14",
+    "port": 4000,
     "database": "thirdparty",
-    "user": "datagroup",
-    "password": "Dgrpdb#2024@36",
+    "user": "root",
+    "password": "=PDT49#80Z!RVv52_z",
     "poolsize": 20,
     "maxidle": 40,
     "maxleft": 40
@@ -84,11 +84,11 @@
     "maxleft": 0
   },
   "mysql": {
-    "host": "192.168.3.149",
+    "host": "192.168.3.14",
     "port": 4000,
     "database": "jianyu",
-    "user": "datagroup",
-    "password": "Dgrpdb#2024@36",
+    "user": "root",
+    "password": "=PDT49#80Z!RVv52_z",
     "poolsize": 20,
     "maxidle": 40,
     "maxleft": 40
@@ -120,5 +120,5 @@
     "password": ""
   },
   "warningValue": 350,
-  "allocationCap": 400
+  "allocationCap": 1
 }

+ 15 - 18
clueSync/sendMail.go

@@ -9,9 +9,6 @@ import (
 )
 
 var (
-	WarningSize = 350
-	LimitSize   = 400
-
 	selfMail = `SELECT b.mail FROM jianyu.entniche_user b WHERE b.id IN (SELECT a.ent_user_id FROM Jianyu_subjectdb_test_test.dwd_d_crm_department_level_succbi a WHERE a.position_id = ?)`
 	infoSelf = `SELECT a.name, a.SZ_PID1, a.SZ_PID2, a.dept_name, b.role_id FROM Jianyu_subjectdb_test_test.dwd_d_crm_department_level_succbi a INNER JOIN Jianyu_subjectdb_test_test.dwd_f_crm_personnel_management b ON b.position_id = a.position_id WHERE a.position_id = ? AND a.resign = 0`
 	topMail  = `SELECT d.mail FROM jianyu.entniche_user d WHERE d.id IN (SELECT b.ent_user_id FROM Jianyu_subjectdb_test.dwd_d_crm_department_level_succbi b INNER JOIN Jianyu_subjectdb_test.dwd_f_crm_personnel_management c
@@ -42,15 +39,15 @@ func WarningPerl() {
 			sendFlag2 := common.IntAll(m["flag_2"]) //上限邮件发送
 			posid := common.Int64All(m["position_id"])
 			count := Mysql.CountBySql(sql, posid)
-			if count >= int64(WarningSize) && sendFlag1 == 0 {
+			if count >= int64(cfg.WarningValue) && sendFlag1 == 0 {
 				WillWarningByPp(posid) // 发预警邮件
 				_, _ = Mysql.ExecBySql(sql1, "send_mail | (1 << 0)", posid)
-			} else if count >= int64(LimitSize) && sendFlag2 == 0 {
+			} else if count >= int64(cfg.AllocationCap) && sendFlag2 == 0 {
 				ExceedLimitByPp(posid) // 发上限邮件
 				_, _ = Mysql.ExecBySql(sql1, "send_mail | (1 << 1)", posid)
-			} else if sendFlag1 == 1 && count < int64(WarningSize) { // 已发邮件
+			} else if sendFlag1 == 1 && count < int64(cfg.WarningValue) { // 已发邮件
 				_, _ = Mysql.ExecBySql(sql1, "send_mail & ~(1 << 0)", posid)
-			} else if sendFlag2 == 1 && count < int64(LimitSize) { // 已发邮件
+			} else if sendFlag2 == 1 && count < int64(cfg.AllocationCap) { // 已发邮件
 				_, _ = Mysql.ExecBySql(sql1, "send_mail & ~(1 << 1)", posid)
 			}
 		}
@@ -67,11 +64,11 @@ func WarningDm() {
 	for _, m := range *dm {
 		d1 := common.ObjToString(m["dept_name"])
 		send1, send2 := true, true // 预警,上限 发送标记
-		info := Mysql.SelectBySql(dmInfoCount, d1, WarningSize)
+		info := Mysql.SelectBySql(dmInfoCount, d1, cfg.WarningValue)
 		if info != nil && len(*info) > 0 {
 			send1 = false
 		}
-		info1 := Mysql.SelectBySql(dmInfoCount, d1, LimitSize)
+		info1 := Mysql.SelectBySql(dmInfoCount, d1, cfg.AllocationCap)
 		if info1 != nil && len(*info1) > 0 {
 			send2 = false
 		}
@@ -139,7 +136,7 @@ func WillWarningByPp(posid int64) {
 		return
 	}
 	toCc = getCc(posid)
-	content = fmt.Sprintf(content, WarningSize, LimitSize)
+	content = fmt.Sprintf(content, cfg.WarningValue, cfg.AllocationCap)
 	sendInfo(toMail, toCc, title, content)
 }
 
@@ -150,7 +147,7 @@ func WillWarningByDm(dname, to string, toCc []string) {
 	title := "“%s”私海线索即将达到上限通知"
 	content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到%d条(不包含成交客户),即将达到私海线索上限%d条(不包含成交客户),请及时通知电销人员将无需跟进的线索退回公海,以避免无法接收新线索。"
 	title = fmt.Sprintf(title, dname)
-	content = fmt.Sprintf(content, dname, WarningSize, LimitSize)
+	content = fmt.Sprintf(content, dname, cfg.WarningValue, cfg.AllocationCap)
 	sendInfo(to, strings.Join(toCc, ","), title, content)
 }
 
@@ -166,7 +163,7 @@ func WillWarningByAll() {
 			to = append(to, m3)
 		}
 	}
-	content = fmt.Sprintf(content, WarningSize)
+	content = fmt.Sprintf(content, cfg.WarningValue)
 	sendInfo(strings.Join(to, ","), "", title, content)
 }
 
@@ -179,7 +176,7 @@ func ExceedLimitByPp(posid int64) {
 
 	toMail := ""
 	toCc := ""
-	content = fmt.Sprintf(content, LimitSize)
+	content = fmt.Sprintf(content, cfg.AllocationCap)
 	info := Mysql.SelectBySql(selfMail, posid)
 	if info != nil && len(*info) > 0 {
 		toMail = common.ObjToString((*info)[0]["mail"])
@@ -199,7 +196,7 @@ func ExceedLimitByDm(dname, to string, toCc []string) {
 	title := "“%s”私海线索已达到上限通知"
 	content := "“%s”的所有参与线索分配的电销人员,私海线索都已达到私海线索上限%d条(不包含成交客户),当前无法接收新线索,请及时通知电销人员将无需跟进的线索退回公海"
 	title = fmt.Sprintf(title, dname)
-	content = fmt.Sprintf(content, dname, LimitSize)
+	content = fmt.Sprintf(content, dname, cfg.AllocationCap)
 	sendInfo(to, strings.Join(toCc, ","), title, content)
 }
 
@@ -228,7 +225,7 @@ func AutoReleaseNots() {
 		}
 	}
 	toCc = append(toCc, "shenbingyi@topnet.net.cn")
-	sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, LimitSize))
+	sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, cfg.AllocationCap))
 }
 
 // @Author jianghan
@@ -256,7 +253,7 @@ func CantBeAssignedNots() {
 		}
 	}
 	toCc = append(toCc, "shenbingyi@topnet.net.cn")
-	sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, LimitSize))
+	sendInfo(strings.Join(to, ","), strings.Join(toCc, ","), title, fmt.Sprintf(content, cfg.AllocationCap))
 }
 
 // @Author jianghan
@@ -280,7 +277,7 @@ func OrderCreateFail(posid int64, bname string) {
 
 	toMail := ""
 	toCc := ""
-	content = fmt.Sprintf(content, LimitSize, LimitSize, bname)
+	content = fmt.Sprintf(content, cfg.AllocationCap, cfg.AllocationCap, bname)
 	info := Mysql.SelectBySql(selfMail, posid)
 	if info != nil && len(*info) > 0 {
 		toMail = common.ObjToString((*info)[0]["mail"])
@@ -302,7 +299,7 @@ func AssFail(posid int64, ent, iname string) {
 
 	toMail := ""
 	toCc := ""
-	content = fmt.Sprintf(content, LimitSize, ent, iname)
+	content = fmt.Sprintf(content, cfg.AllocationCap, ent, iname)
 	info := Mysql.SelectBySql(selfMail, posid)
 	if info != nil && len(*info) > 0 {
 		toMail = common.ObjToString((*info)[0]["mail"])