فهرست منبع

feature(OMS):钉钉提示消息类型修改

yanglingling 1 سال پیش
والد
کامیت
2192ed299d

+ 13 - 3
opms_admin/app/service/sys_send_message.go

@@ -114,12 +114,22 @@ func (c *contextService) BatchSendUserDingTalkTextMsg(userIds []string, msgType,
 	dingtalkSendMsgReq := new(corpconversation.SendCorpConversationRequest)
 	// 文件处理
 	if msgType != "40" {
+		//dingtalkSendMsgReq = &corpconversation.SendCorpConversationRequest{
+		//	UseridList: strings.Join(dingtalkUids, ","),
+		//	Msg: corpconversation.Msg{
+		//		Msgtype: "text",
+		//		Text: corpconversation.TextMsg{
+		//			Content: msgContent,
+		//		},
+		//	},
+		//}
 		dingtalkSendMsgReq = &corpconversation.SendCorpConversationRequest{
 			UseridList: strings.Join(dingtalkUids, ","),
 			Msg: corpconversation.Msg{
-				Msgtype: "text",
-				Text: corpconversation.TextMsg{
-					Content: msgContent,
+				Msgtype: "markdown",
+				Markdown: corpconversation.MarkdownMsg{
+					Title: "notice",
+					Text:  msgContent,
 				},
 			},
 		}

+ 28 - 28
opms_parent/app/model/train/train_sale_apply.go

@@ -43,35 +43,35 @@ type TrainSaleApplyRes struct {
 }
 
 type TrainSaleApplyCreateReq struct {
-	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道ID不能为空"`  // 渠道ID
-	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`         // 渠道名称
-	MainProduct       string      `json:"mainProduct" v:"required#主营产品不能为空"`         // 主营产品
-	MainCustomer      string      `json:"mainCustomer" v:"required#主要客户不能为空"`        // 主要客户
-	Trainees          string      `json:"trainees" v:"required#参训人员不能为空"`            // 参训人员
-	ExpectTrainDate   *gtime.Time `json:"expectTrainDate" v:"required#期望培训日期不能为空"` // 期望培训日期
-	ExpectStartTime   *gtime.Time `json:"expectStartTime" v:"required#期望开始时间不能为空"` // 期望开始时间
-	ExpectEndTime     *gtime.Time `json:"expectEndTime" v:"required#期望结束时间不能为空"`   // 期望结束时间
-	TrainTitle        string      `json:"trainTitle" v:"required#培训主题不能为空"`          // 培训主题
-	InstructorRequire string      `json:"instructorRequire" v:"required#讲师要求不能为空"`   // 讲师要求
-	FocusPoint        string      `json:"focusPoint" v:"required#关注要点不能为空"`          // 关注要点
+	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道ID不能为空"` // 渠道ID
+	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`        // 渠道名称
+	MainProduct       string      `json:"mainProduct" v:"required#主营产品不能为空"`          // 主营产品
+	MainCustomer      string      `json:"mainCustomer" v:"required#主要客户不能为空"`         // 主要客户
+	Trainees          string      `json:"trainees" v:"required#参训人员不能为空"`             // 参训人员
+	ExpectTrainDate   *gtime.Time `json:"expectTrainDate" v:"required#期望培训日期不能为空"`    // 期望培训日期
+	ExpectStartTime   *gtime.Time `json:"expectStartTime" v:"required#期望开始时间不能为空"`    // 期望开始时间
+	ExpectEndTime     *gtime.Time `json:"expectEndTime" v:"required#期望结束时间不能为空"`      // 期望结束时间
+	TrainTitle        string      `json:"trainTitle" v:"required#培训主题不能为空"`           // 培训主题
+	InstructorRequire string      `json:"instructorRequire" v:"required#讲师要求不能为空"`    // 讲师要求
+	FocusPoint        string      `json:"focusPoint" v:"required#关注要点不能为空"`           // 关注要点
 }
 
 type TrainSaleApplyUpdateReq struct {
-	Id                int         `json:"id" v:"required|min:1#|主ID不能为空"`               // 主键
-	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道ID不能为空"`  // 渠道ID
-	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`         // 渠道名称
-	MainProduct       string      `json:"mainProduct" v:"required#主营产品不能为空"`         // 主营产品
-	MainCustomer      string      `json:"mainCustomer" v:"required#主要客户不能为空"`        // 主要客户
-	Trainees          string      `json:"trainees" v:"required#参训人员不能为空"`            // 参训人员
-	ExpectTrainDate   *gtime.Time `json:"expectTrainDate" v:"required#期望培训日期不能为空"` // 期望培训日期
-	ExpectStartTime   *gtime.Time `json:"expectStartTime" v:"required#期望开始时间不能为空"` // 期望开始时间
-	ExpectEndTime     *gtime.Time `json:"expectEndTime" v:"required#期望结束时间不能为空"`   // 期望结束时间
-	TrainTitle        string      `json:"trainTitle" v:"required#培训主题不能为空"`          // 培训主题
-	InstructorRequire string      `json:"instructorRequire" v:"required#讲师要求不能为空"`   // 讲师要求
-	FocusPoint        string      `json:"focusPoint" v:"required#关注要点不能为空"`          // 关注要点
-	TrainInstructor   string      `json:"trainInstructor" v:"required#培训讲师不能为空"`     // 培训讲师
-	TrainDate         *gtime.Time `json:"trainDate" v:"required#培训日期不能为空"`           // 培训日期
-	SpecificStartTime *gtime.Time `json:"specificStartTime" v:"required#开始时间不能为空"`   // 开始时间
-	SpecificEndTime   *gtime.Time `json:"specificEndTime" v:"required#结束时间不能为空"`     // 结束时间
-	ApplyType         string      `json:"applyType" v:"required#申请状态不能为空"`           // 申请状态(10 已提交 20 已确认 30 总结完成)
+	Id                int         `json:"id" v:"required|min:1#|主ID不能为空"`             // 主键
+	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道ID不能为空"` // 渠道ID
+	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`        // 渠道名称
+	MainProduct       string      `json:"mainProduct" v:"required#主营产品不能为空"`          // 主营产品
+	MainCustomer      string      `json:"mainCustomer" v:"required#主要客户不能为空"`         // 主要客户
+	Trainees          string      `json:"trainees" v:"required#参训人员不能为空"`             // 参训人员
+	ExpectTrainDate   *gtime.Time `json:"expectTrainDate" v:"required#期望培训日期不能为空"`    // 期望培训日期
+	ExpectStartTime   *gtime.Time `json:"expectStartTime" v:"required#期望开始时间不能为空"`    // 期望开始时间
+	ExpectEndTime     *gtime.Time `json:"expectEndTime" v:"required#期望结束时间不能为空"`      // 期望结束时间
+	TrainTitle        string      `json:"trainTitle" v:"required#培训主题不能为空"`           // 培训主题
+	InstructorRequire string      `json:"instructorRequire" v:"required#讲师要求不能为空"`    // 讲师要求
+	FocusPoint        string      `json:"focusPoint" v:"required#关注要点不能为空"`           // 关注要点
+	TrainInstructor   string      `json:"trainInstructor" v:"required#培训讲师不能为空"`      // 培训讲师
+	TrainDate         *gtime.Time `json:"trainDate" v:"required#培训日期不能为空"`            // 培训日期
+	SpecificStartTime *gtime.Time `json:"specificStartTime" v:"required#开始时间不能为空"`    // 开始时间
+	SpecificEndTime   *gtime.Time `json:"specificEndTime" v:"required#结束时间不能为空"`      // 结束时间
+	ApplyType         string      `json:"applyType" v:"required#申请状态不能为空"`            // 申请状态(10 已提交 20 已确认 30 总结完成)
 }

+ 97 - 27
opms_parent/app/service/proj/business_cron.go

@@ -103,13 +103,19 @@ func businessFollowOverdueSalesDirector(tenant string, userIds []string) {
 	}
 	var msg string
 	if businessA.Count > 0 {
-		msg += fmt.Sprintf("您有超期3天未跟进A类项目%v个,项目名称分别为 %v,", businessA.Count, businessA.BusNames)
+		msg += fmt.Sprintf("**您有超期3天未跟进A类项目%v个:** %v   \n\n", businessA.Count, "\n1. "+strings.Replace(businessA.BusNames, ",", "\n1. ", -1))
 	}
 	if businessB.Count > 0 {
-		msg += fmt.Sprintf("您有超期3天未跟进B类项目%v个,项目名称分别为 %v,", businessB.Count, businessB.BusNames)
+		if msg != "" {
+			msg = "\n" + msg
+		}
+		msg += fmt.Sprintf("**您有超期3天未跟进B类项目%v个:** %v   \n\n", businessB.Count, "\n1. "+strings.Replace(businessB.BusNames, ",", "\n1. ", -1))
 	}
 	if businessC.Count > 0 {
-		msg += fmt.Sprintf("您有超期3天未跟进C类项目%v个,项目名称分别为 %v,", businessC.Count, businessC.BusNames)
+		if msg != "" {
+			msg = "\n" + msg
+		}
+		msg += fmt.Sprintf("**您有超期3天未跟进C类项目%v个:** %v   \n\n", businessC.Count, "\n1. "+strings.Replace(businessC.BusNames, ",", "\n1. ", -1))
 	}
 	if msg != "" {
 		businessNotifyMessage(userIds, gstr.TrimRightStr(msg, ","))
@@ -169,22 +175,37 @@ func businessFollowOverdueSalesAssociate(tenant string, userIds []string) {
 	}
 	var msg string
 	if businessATrid.Count > 0 {
-		msg += fmt.Sprintf("您有超期3天未跟进A类项目%v个,项目名称分别为 %v,", businessATrid.Count, businessATrid.BusNames)
+		msg += fmt.Sprintf("**您有超期3天未跟进A类项目%v个:** %v   \n\n", businessATrid.Count, "\n1. "+strings.Replace(businessATrid.BusNames, ",", "\n1. ", -1))
 	}
 	if businessBTrid.Count > 0 {
-		msg += fmt.Sprintf("您有超期3天未跟进B类项目%v个,项目名称分别为 %v,", businessBTrid.Count, businessBTrid.BusNames)
+		if msg != "" {
+			msg = "\n " + msg
+		}
+		msg += fmt.Sprintf("**您有超期3天未跟进B类项目%v个:** %v   \n\n", businessBTrid.Count, "\n1. "+strings.Replace(businessATrid.BusNames, ",", "\n1. ", -1))
 	}
 	if businessCTrid.Count > 0 {
-		msg += fmt.Sprintf("您有超期3天未跟进C类项目%v个,项目名称分别为 %v,", businessCTrid.Count, businessCTrid.BusNames)
+		if msg != "" {
+			msg = "\n " + msg
+		}
+		msg += fmt.Sprintf("**您有超期3天未跟进C类项目%v个:** %v   \n\n", businessCTrid.Count, "\n1. "+strings.Replace(businessCTrid.BusNames, ",", "\n1. ", -1))
 	}
 	if businessA.Count > 0 {
-		msg += fmt.Sprintf("您有超期1天未跟进A类项目%v个,项目名称分别为 %v,", businessA.Count, businessA.BusNames)
+		if msg != "" {
+			msg = "\n " + msg
+		}
+		msg += fmt.Sprintf("**您有超期1天未跟进A类项目%v个:** %v   \n\n", businessA.Count, "\n1. "+strings.Replace(businessA.BusNames, ",", "\n1. ", -1))
 	}
 	if businessB.Count > 0 {
-		msg += fmt.Sprintf("您有超期1天未跟进B类项目%v个,项目名称分别为 %v,", businessB.Count, businessB.BusNames)
+		if msg != "" {
+			msg = "\n " + msg
+		}
+		msg += fmt.Sprintf("**您有超期1天未跟进B类项目%v个:** %v   \n\n", businessB.Count, "\n1. "+strings.Replace(businessB.BusNames, ",", "\n1. ", -1))
 	}
 	if businessC.Count > 0 {
-		msg += fmt.Sprintf("您有超期1天未跟进C类项目%v个,项目名称分别为 %v,", businessC.Count, businessC.BusNames)
+		if msg != "" {
+			msg = "\n " + msg
+		}
+		msg += fmt.Sprintf("**您有超期1天未跟进C类项目%v个:** %v   \n\n", businessC.Count, "\n1. "+strings.Replace(businessC.BusNames, ",", "\n1. ", -1))
 	}
 	if msg != "" {
 		businessNotifyMessage(userIds, gstr.TrimRightStr(msg, ","))
@@ -284,31 +305,55 @@ func businessFollowOverdueProductLineManager(tenant string, userIds []string) {
 
 		var msg string
 		if LastWeekOne.Count != 0 {
-			msg += fmt.Sprintf("您有超期1天未跟进A类项目%v个,项目名称分别为 %v,", LastWeekOne.Count, LastWeekOne.BusNames)
+			msg += fmt.Sprintf("**您有超期1天未跟进A类项目%v个:** %v   \n\n", LastWeekOne.Count, "\n1. "+strings.Replace(LastWeekOne.BusNames, ",", "\n1. ", -1))
 		}
 		if LastTwoWeekOne.Count != 0 {
-			msg += fmt.Sprintf("您有超期1天未跟进B类项目%v个,项目名称分别为 %v,", LastTwoWeekOne.Count, LastTwoWeekOne.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您有超期1天未跟进B类项目%v个:** %v   \n\n", LastTwoWeekOne.Count, "\n1. "+strings.Replace(LastTwoWeekOne.BusNames, ",", "\n1. ", -1))
 		}
 		if LastMonthOne.Count != 0 {
-			msg += fmt.Sprintf("您有超期1天未跟进C类项目%v个,项目名称分别为 %v,", LastMonthOne.Count, LastMonthOne.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您有超期1天未跟进C类项目%v个:** %v   \n\n", LastMonthOne.Count, "\n1. "+strings.Replace(LastMonthOne.BusNames, ",", "\n1. ", -1))
 		}
 		if LastWeekCurrent.Count != 0 {
-			msg += fmt.Sprintf("您今天有超期未跟进A类项目%v个,项目名称分别为 %v,", LastWeekCurrent.Count, LastWeekCurrent.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您今天有超期未跟进A类项目%v个:** %v   \n\n", LastWeekCurrent.Count, "\n1. "+strings.Replace(LastWeekCurrent.BusNames, ",", "\n1. ", -1))
 		}
 		if LastTwoWeekCurrent.Count != 0 {
-			msg += fmt.Sprintf("您今天有超期未跟进B类项目%v个,项目名称分别为 %v,", LastTwoWeekCurrent.Count, LastTwoWeekCurrent.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您今天有超期未跟进B类项目%v个:** %v   \n\n", LastTwoWeekCurrent.Count, "\n1. "+strings.Replace(LastTwoWeekCurrent.BusNames, ",", "\n1. ", -1))
 		}
 		if LastMonthCurrent.Count != 0 {
-			msg += fmt.Sprintf("您今天有超期未跟进C类项目%v个,项目名称分别为 %v,", LastMonthCurrent.Count, LastMonthCurrent.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您今天有超期未跟进C类项目%v个:** %v   \n\n", LastMonthCurrent.Count, "\n1. "+strings.Replace(LastMonthCurrent.BusNames, ",", "\n1. ", -1))
 		}
 		if LastWeekBeforeTrid.Count != 0 {
-			msg += fmt.Sprintf("您3天后有超期未跟进A类项目%v个,项目名称分别为 %v,", LastWeekBeforeTrid.Count, LastWeekBeforeTrid.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您3天后有超期未跟进A类项目%v个:** %v   \n\n", LastWeekBeforeTrid.Count, "\n1. "+strings.Replace(LastWeekBeforeTrid.BusNames, ",", "\n1. ", -1))
 		}
 		if LastTwoWeekBeforeTrid.Count != 0 {
-			msg += fmt.Sprintf("您3天后有超期未跟进B类项目%v个,项目名称分别为 %v,", LastTwoWeekBeforeTrid.Count, LastTwoWeekBeforeTrid.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您3天后有超期未跟进B类项目%v个:** %v   \n\n", LastTwoWeekBeforeTrid.Count, "\n1. "+strings.Replace(LastTwoWeekBeforeTrid.BusNames, ",", "\n1. ", -1))
 		}
 		if LastMonthBeforeTrid.Count != 0 {
-			msg += fmt.Sprintf("您3天后有超期未跟进C类项目%v个,项目名称分别为 %v,", LastMonthBeforeTrid.Count, LastMonthBeforeTrid.BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您3天后有超期未跟进C类项目%v个:** %v   \n\n", LastMonthBeforeTrid.Count, "\n1. "+strings.Replace(LastMonthBeforeTrid.BusNames, ",", "\n1. ", -1))
 		}
 		if msg != "" {
 			businessNotifyMessage([]string{userId}, gstr.TrimRightStr(msg, ","))
@@ -420,31 +465,56 @@ func businessFollowOverdueSalesEngineer(tenant string) {
 	for _, saleId := range allSaleIds.Slice() {
 		var msg string
 		if LastWeekOneCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您有超期1天未跟进A类项目%v个,项目名称分别为 %v,", LastWeekOneCountMap[saleId].Count, LastWeekOneCountMap[saleId].BusNames)
+			msg += fmt.Sprintf("**您有超期1天未跟进A类项目%v个:** %v   \n\n", LastWeekOneCountMap[saleId].Count, "\n1. "+strings.Replace(LastWeekOneCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastTwoWeekOneCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您有超期1天未跟进B类项目%v个,项目名称分别为 %v,", LastTwoWeekOneCountMap[saleId].Count, LastTwoWeekOneCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您有超期1天未跟进B类项目%v个:** %v   \n\n", LastTwoWeekOneCountMap[saleId].Count, "\n1. "+strings.Replace(LastTwoWeekOneCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastMonthOneCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您有超期1天未跟进C类项目%v个,项目名称分别为 %v,", LastMonthOneCountMap[saleId].Count, LastMonthOneCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+
+			msg += fmt.Sprintf("**您有超期1天未跟进C类项目%v个:** %v   \n\n", LastMonthOneCountMap[saleId].Count, "\n1. "+strings.Replace(LastMonthOneCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastWeekCurrentCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您今天有超期未跟进A类项目%v个,项目名称分别为 %v,", LastWeekCurrentCountMap[saleId].Count, LastWeekCurrentCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您今天有超期未跟进A类项目%v个:** %v   \n\n", LastWeekCurrentCountMap[saleId].Count, "\n1. "+strings.Replace(LastWeekCurrentCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastTwoWeekCurrentCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您今天有超期未跟进B类项目%v个,项目名称分别为 %v,", LastTwoWeekCurrentCountMap[saleId].Count, LastTwoWeekCurrentCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您今天有超期未跟进B类项目%v个:** %v   \n\n", LastTwoWeekCurrentCountMap[saleId].Count, "\n1. "+strings.Replace(LastTwoWeekCurrentCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastMonthCurrentCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您今天有超期未跟进C类项目%v个,项目名称分别为 %v,", LastMonthCurrentCountMap[saleId].Count, LastMonthCurrentCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您今天有超期未跟进C类项目%v个:** %v   \n\n", LastMonthCurrentCountMap[saleId].Count, "\n1. "+strings.Replace(LastMonthCurrentCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastWeekBeforeTridCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您3天后有超期未跟进A类项目%v个,项目名称分别为 %v,", LastWeekBeforeTridCountMap[saleId].Count, LastWeekBeforeTridCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您3天后有超期未跟进A类项目%v个:** %v   \n\n", LastWeekBeforeTridCountMap[saleId].Count, "\n1. "+strings.Replace(LastWeekBeforeTridCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastTwoWeekBeforeTridCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您3天后有超期未跟进B类项目%v个,项目名称分别为 %v,", LastTwoWeekBeforeTridCountMap[saleId].Count, LastTwoWeekBeforeTridCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您3天后有超期未跟进B类项目%v个:** %v   \n\n", LastTwoWeekBeforeTridCountMap[saleId].Count, "\n1. "+strings.Replace(LastTwoWeekBeforeTridCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if LastMonthBeforeTridCountMap[saleId].Count != 0 {
-			msg += fmt.Sprintf("您3天后有超期未跟进C类项目%v个,项目名称分别为 %v,", LastMonthBeforeTridCountMap[saleId].Count, LastMonthBeforeTridCountMap[saleId].BusNames)
+			if msg != "" {
+				msg = "\n" + msg
+			}
+			msg += fmt.Sprintf("**您3天后有超期未跟进C类项目%v个:** %v   \n\n", LastMonthBeforeTridCountMap[saleId].Count, "\n1. "+strings.Replace(LastMonthBeforeTridCountMap[saleId].BusNames, ",", "\n1. ", -1))
 		}
 		if msg != "" {
 			businessNotifyMessage([]string{gconv.String(saleId)}, gstr.TrimRightStr(msg, ","))