|
@@ -54,7 +54,7 @@ func (this *CustomService) Add(ctx context.Context) int64 {
|
|
|
//判断处理方式
|
|
|
//转办
|
|
|
baseUserIdArr := []int64{}
|
|
|
- customId := int64(-1)
|
|
|
+ customId, taskId := int64(-1), int64(-1)
|
|
|
|
|
|
if this.Types == 2 {
|
|
|
transferArr := []int64{}
|
|
@@ -79,19 +79,19 @@ func (this *CustomService) Add(ctx context.Context) int64 {
|
|
|
//任务
|
|
|
argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime))
|
|
|
|
|
|
- customId = SaveCustom(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.EmployCustomId, this.PositionId, this.CreateName, transferArr)
|
|
|
+ customId, taskId = SaveCustom(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.EmployCustomId, this.PositionId, this.CreateName, transferArr)
|
|
|
if customId < 0 {
|
|
|
return -1
|
|
|
}
|
|
|
} else if this.Types == 1 {
|
|
|
//客户
|
|
|
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))
|
|
|
//任务团队
|
|
|
argsTaskTeam = append(argsTaskTeam, this.PositionId, this.EntUserId, this.CreateName, 1, nowtime)
|
|
|
//存库
|
|
|
- customId = SaveCustom(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.EmployCustomId, this.PositionId, this.CreateName, []int64{})
|
|
|
+ customId, taskId = SaveCustom(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.EmployCustomId, this.PositionId, this.CreateName, []int64{})
|
|
|
if customId < 0 {
|
|
|
return -1
|
|
|
}
|
|
@@ -106,7 +106,7 @@ func (this *CustomService) Add(ctx context.Context) int64 {
|
|
|
vb.WriteString(gconv.String(v) + ",")
|
|
|
userId := strings.TrimRight(kb.String(), ",")
|
|
|
positionId := strings.TrimRight(vb.String(), ",")
|
|
|
- StationMailPush(userId, positionId, cm.Push.Custom.Create.Title, fmt.Sprintf(cm.Push.Custom.Create.Content, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), strings.Replace(time.Unix(this.NextfollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)), fmt.Sprintf(cm.Push.Custom.Create.PcHref, customId), cm.Push.Custom.Create.MobileHref)
|
|
|
+ StationMailPush(userId, positionId, cm.Push.Custom.Create.Title, fmt.Sprintf(cm.Push.Custom.Create.Content, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), strings.Replace(time.Unix(this.NextfollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)), fmt.Sprintf(cm.Push.Custom.Create.PcHref, positionId, taskId, customId), cm.Push.Custom.Create.MobileHref)
|
|
|
}
|
|
|
|
|
|
return 1
|
|
@@ -136,8 +136,9 @@ func EmployUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64
|
|
|
return cm.CrmMysql.UpdateByTx(tx, tablename, map[string]interface{}{"id": id, "position_id": positionId}, map[string]interface{}{key: 1})
|
|
|
}
|
|
|
|
|
|
-func SaveCustom(ctx context.Context, argsCustom, argsTask, argsTaskTeam []interface{}, employ_info_id, employ_custom_id, positionId int64, createPerson string, transferArr []int64) int64 {
|
|
|
+func SaveCustom(ctx context.Context, argsCustom, argsTask, argsTaskTeam []interface{}, employ_info_id, employ_custom_id, positionId int64, createPerson string, transferArr []int64) (int64, int64) {
|
|
|
customId := int64(-1)
|
|
|
+ taskId := int64(-1)
|
|
|
//存库
|
|
|
cm.CrmMysql.ExecTx("创建客户", func(tx *sql.Tx) bool {
|
|
|
//插入客户
|
|
@@ -145,7 +146,7 @@ func SaveCustom(ctx context.Context, argsCustom, argsTask, argsTaskTeam []interf
|
|
|
//传过来的argTask没有来源id,需要append
|
|
|
argsTask = append(argsTask, customId)
|
|
|
//任务车存储
|
|
|
- taskId := TaskAdd(tx, argsTask, argsTaskTeam, transferArr, positionId)
|
|
|
+ taskId = TaskAdd(tx, argsTask, argsTaskTeam, transferArr, positionId)
|
|
|
ok := EmployUpdate(tx, employ_info_id, employ_custom_id, positionId, "is_create_custom")
|
|
|
//插入台账
|
|
|
ok2 := SaveLedger(ctx, positionId, customId, taskId, "创建客户", fmt.Sprintf("%s创建了客户", createPerson), createPerson)
|
|
@@ -155,7 +156,7 @@ func SaveCustom(ctx context.Context, argsCustom, argsTask, argsTaskTeam []interf
|
|
|
log.Println("SaveCustom err:", customId, taskId, ok)
|
|
|
return false
|
|
|
})
|
|
|
- return customId
|
|
|
+ return customId, taskId
|
|
|
}
|
|
|
|
|
|
//SaveLedger 操作台帐相关
|