Selaa lähdekoodia

feat: 线索任务新增tpl字段

zhangxinlei1996 1 vuosi sitten
vanhempi
commit
875c803ecc
4 muutettua tiedostoa jossa 13 lisäystä ja 8 poistoa
  1. 1 1
      api/internal/logic/pushmsglogic.go
  2. 2 2
      service/custom.go
  3. 6 2
      service/sale_chance.go
  4. 4 3
      service/sale_clue.go

+ 1 - 1
api/internal/logic/pushmsglogic.go

@@ -46,7 +46,7 @@ func (l *PushMsgLogic) PushMsg(req *types.PushMsgReq) (resp *types.Reply, err er
 		baseUserIdArr = append(baseUserIdArr, resp.UserId)
 		//查询mgo
 	}
-	u := &service.User{ 
+	u := &service.User{ 	
 		BaseUserIds: baseUserIdArr,
 	}
 	m := u.GetUserId(req.EntId)

+ 2 - 2
service/custom.go

@@ -78,7 +78,7 @@ func (this *CustomService) Add(ctx context.Context) int64 {
 		//客户
 		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.EmployCustomId, this.CustomType, this.CustomAllName, this.CustomAbbreviation, this.Summary, qu.If(this.CustomLevel == 0, nil, this.CustomLevel), this.CustomIndustry, this.CustomDetailIndustry, qu.If(this.Province == "", nil, this.Province), qu.If(this.City == "", nil, this.City), qu.If(this.District == "", nil, this.District), qu.If(this.Address == "", nil, this.Address), qu.If(this.CompanyPhone == "", nil, this.CompanyPhone), qu.If(this.Remarks == "", nil, this.Remarks), this.CreateName, nowtime)
 		//任务
-		argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime))
+		argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), nil, nil)
 
 		customId, taskId = SaveCustom(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.EmployCustomId, this.PositionId, this.CreateName, transferArr)
 		if customId < 0 {
@@ -88,7 +88,7 @@ func (this *CustomService) Add(ctx context.Context) int64 {
 		//客户
 		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.EmployCustomId, this.CustomType, this.CustomAllName, this.CustomAbbreviation, this.Summary, qu.If(this.CustomLevel == 0, nil, this.CustomLevel), this.CustomIndustry, this.CustomDetailIndustry, qu.If(this.Province == "", nil, this.Province), qu.If(this.City == "", nil, this.City), qu.If(this.District == "", nil, this.District), qu.If(this.Address == "", nil, this.Address), qu.If(this.CompanyPhone == "", nil, this.CompanyPhone), qu.If(this.Remarks == "", nil, this.Remarks), this.CreateName, nowtime)
 		//任务s
-		argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 2, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime))
+		argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 2, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), nil, nil)
 		//任务团队
 		argsTaskTeam = append(argsTaskTeam, this.PositionId, this.EntUserId, this.CreateName, 1, nowtime)
 		//存库

+ 6 - 2
service/sale_chance.go

@@ -54,6 +54,10 @@ func (this *SaleChanceService) Add(ctx context.Context) int64 {
 	baseUserIdArr := []int64{}
 	chanceId, taskId := int64(-1), int64(-1)
 	//判断处理方式
+	stageId := 0
+	if stageData := cm.CrmMysql.SelectBySql("select id from  config_tpl_stage where tpl_id =? order by `order` limit 1", this.BusinessType); stageData != nil && len(*stageData) > 0 {
+		stageId = gconv.Int((*stageData)[0]["id"])
+	}
 	//转办
 	if this.Types == 2 {
 		transferArr := []int64{}
@@ -75,7 +79,7 @@ func (this *SaleChanceService) Add(ctx context.Context) int64 {
 
 		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.CustomId, this.BusinessType, this.ChanceName, this.Summary, this.ChanceClassify, qu.If(this.ExpectedOrderTime == 0, nil, expect_deal_time), qu.If(this.ExpectedMoney == 0, nil, this.ExpectedMoney), qu.If(this.Remarks == "", nil, this.Remarks), nowtime, this.CreateName)
 		//任务
-		argsTask = append(argsTask, this.EntId, this.ChanceName+"的跟进任务", 2, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime))
+		argsTask = append(argsTask, this.EntId, this.ChanceName+"的跟进任务", 2, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), this.BusinessType, stageId)
 
 		chanceId, taskId = SaveChange(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.CustomId, this.PositionId, this.BusinessType, this.CreateName, transferArr)
 
@@ -86,7 +90,7 @@ func (this *SaleChanceService) Add(ctx context.Context) int64 {
 		//线索机会
 		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.CustomId, this.BusinessType, this.ChanceName, this.Summary, this.ChanceClassify, qu.If(this.ExpectedOrderTime == 0, nil, expect_deal_time), qu.If(this.ExpectedMoney == 0, nil, this.ExpectedMoney), qu.If(this.Remarks == "", nil, this.Remarks), nowtime, this.CreateName)
 		//任务
-		argsTask = append(argsTask, this.EntId, this.ChanceName+"的跟进任务", 2, this.PositionId, 2, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime))
+		argsTask = append(argsTask, this.EntId, this.ChanceName+"的跟进任务", 2, this.PositionId, 2, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), this.BusinessType, stageId)
 		//任务团队
 		argsTaskTeam = append(argsTaskTeam, this.PositionId, this.EntUserId, this.CreateName, 1, nowtime)
 		//存库

+ 4 - 3
service/sale_clue.go

@@ -70,7 +70,7 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
 		//线索
 		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, nowtime, this.CreateName)
 		//任务
-		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 1, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime))
+		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 1, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime), nil, nil)
 		clueId, taskId = Save(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, 0, this.PositionId, this.CreateName, transferArr)
 		if clueId < 0 {
 			return -1
@@ -79,7 +79,8 @@ func (this *SaleClueService) Add(ctx context.Context) int64 {
 		//线索
 		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, time.Now().Format(date.Date_Full_Layout), this.CreateName)
 		//任务
-		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 2, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime))
+
+		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 2, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime), nil, nil)
 		//任务团队
 		argsTaskTeam = append(argsTaskTeam, this.PositionId, this.EntUserId, this.CreateName, 1, nowtime)
 		//存库
@@ -117,7 +118,7 @@ taskTransferMap 自办的map
 transferArr 转办的用户职位id
 */
 func TaskAdd(tx *sql.Tx, args, taskTeamArgs []interface{}, transferArr []int64, positionId int64) int64 {
-	fields := []string{"ent_id", "name", "source", "create_person", "status", "create_time", "create_way", "join_task_vehicle", "next_follow_time", "source_id"}
+	fields := []string{"ent_id", "name", "source", "create_person", "status", "create_time", "create_way", "join_task_vehicle", "next_follow_time", "tpl_id", "current_stage", "source_id"}
 	_, id := cm.CrmMysql.InsertBatchByTx(tx, entity.TASK, fields, args)
 	teamId, transferId := int64(0), int64(0)
 	if len(taskTeamArgs) > 0 {