|
@@ -369,82 +369,27 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
clueUpdateData := map[string]interface{}{}
|
|
|
if old_name != name && name != "" {
|
|
|
clueUpdateData["name"] = name
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "name",
|
|
|
- "position_id": 0,
|
|
|
- "seatNumber": nil,
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_name != "", old_name, "/"),
|
|
|
- "new_value": common.If(name != "", name, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "name", "基本信息变更", gconv.String(common.If(name != "", name, "/")), gconv.String(common.If(old_name != "", old_name, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if old_position != position && position != "" {
|
|
|
clueUpdateData["position"] = position
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "position",
|
|
|
- "position_id": 0,
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_position != "", old_position, "/"),
|
|
|
- "new_value": common.If(position != "", position, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "position", "基本信息变更", gconv.String(common.If(position != "", position, "/")), gconv.String(common.If(old_position != "", old_position, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if old_department != department && department != "" {
|
|
|
clueUpdateData["department"] = department
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "department",
|
|
|
- "position_id": 0,
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_department != "", old_department, "/"),
|
|
|
- "new_value": common.If(department != "", department, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "department", "基本信息变更", gconv.String(common.If(department != "", department, "/")), gconv.String(common.If(old_department != "", old_department, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if old_follow_project_area != follow_project_area && follow_project_area != "" {
|
|
|
clueUpdateData["follow_project_area"] = follow_project_area
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "follow_project_area",
|
|
|
- "position_id": 0,
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_follow_project_area != "", old_follow_project_area, "/"),
|
|
|
- "new_value": common.If(follow_project_area != "", follow_project_area, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "follow_project_area", "基本信息变更", gconv.String(common.If(follow_project_area != "", follow_project_area, "/")), gconv.String(common.If(old_follow_project_area != "", old_follow_project_area, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if old_role != role && role != "" {
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "role",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_role != "", old_role, "/"),
|
|
|
- "new_value": common.If(role != "", role, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "position_id": 0,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "role", "基本信息变更", gconv.String(common.If(role != "", role, "/")), gconv.String(common.If(old_role != "", old_role, "/")), nowTime, BCPCID, -1)
|
|
|
clueUpdateData["role"] = role
|
|
|
}
|
|
|
if old_cluename != cluename && cluename != "" {
|
|
|
clueUpdateData["cluename"] = cluename //新的线索名不为空才替换
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "cluename",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_cluename != "", old_cluename, "/"),
|
|
|
- "new_value": common.If(cluename != "", cluename, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "position_id": 0,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "cluename", "基本信息变更", gconv.String(common.If(cluename != "", cluename, "/")), gconv.String(common.If(old_cluename != "", old_cluename, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
old_topname := ""
|
|
|
old_subname := ""
|
|
@@ -462,29 +407,11 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
}
|
|
|
if old_top_cluetype != top_cluetype && top_cluetype != "" {
|
|
|
clueUpdateData["top_cluetype"] = top_cluetype //新的线索名不为空才替换
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "top_cluetype",
|
|
|
- "position_id": 0,
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_topname != "", old_topname, "/"),
|
|
|
- "new_value": common.If(topname != "", topname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "top_cluetype", "基本信息变更", gconv.String(common.If(old_topname != "", old_topname, "/")), gconv.String(common.If(old_topname != "", old_topname, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if old_sub_cluetype != sub_cluetype && sub_cluetype != "" {
|
|
|
clueUpdateData["sub_cluetype"] = sub_cluetype //新的线索名不为空才替换
|
|
|
- TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "change_field": "sub_cluetype", //111
|
|
|
- "position_id": 0,
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_subname != "", old_subname, "/"),
|
|
|
- "new_value": common.If(subname != "", subname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ AddChangeRecord(nil, clueId, position_id, "sub_cluetype", "基本信息变更", gconv.String(common.If(old_subname != "", old_subname, "/")), gconv.String(common.If(old_subname != "", old_subname, "/")), nowTime, BCPCID, -1)
|
|
|
//标签处理
|
|
|
LabelHandel(nil, label, 2, uId, level, trailstatusCode, gconv.String(clueUpdateData["trailstatus"]), 1)
|
|
|
}
|
|
@@ -505,7 +432,7 @@ func SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, c
|
|
|
log.Println("线索修改前", item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, positionId, source, sourceCode, remark)
|
|
|
nowTime := time.Now().Format("2006-01-02 15:04:05")
|
|
|
nowTimes := time.Unix(time.Now().Unix()+3600*12, 0).Format("2006-01-02 15:04:05")
|
|
|
- clueId, uodateId1, uodateId2, uodateId3, uodateId4, uodateId5, uodateId6 := int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0)
|
|
|
+ clueId, updateId1, updateId2, updateId3, updateId4, updateId5, updateId6 := int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0)
|
|
|
if TiDb.ExecTx("保存线索", func(tx *sql.Tx) bool {
|
|
|
keywords := ""
|
|
|
if sourceCode == "app_xzcyh" {
|
|
@@ -551,70 +478,14 @@ func SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, c
|
|
|
"label": 1,
|
|
|
"labelChangeTime": time.Now().Format("2006-01-02"),
|
|
|
})
|
|
|
- uodateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_type": "创建线索",
|
|
|
- "new_value": "系统自动创建",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- uodateId2 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": "/",
|
|
|
- "new_value": saleName,
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- uodateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "商机线索",
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- uodateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_type": "加入任务车",
|
|
|
- "new_value": "线索自动分配" + "-" + topname + "-" + subname,
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- uodateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "top_cluetype",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "/",
|
|
|
- "new_value": topname,
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- uodateId6 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "sub_cluetype", //222
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "/",
|
|
|
- "new_value": subname,
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(tx, clueId, clueId, "", "创建线索", "系统自动创建", "", nowTime, "", -1)
|
|
|
+ updateId2 = AddChangeRecord(tx, clueId, clueId, "position_id", "所属人变更", saleName, "/", nowTime, "", -1)
|
|
|
+ updateId3 = AddChangeRecord(tx, clueId, clueId, "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, "", -1)
|
|
|
+ updateId4 = AddChangeRecord(tx, clueId, clueId, "", "加入任务车", "线索自动分配"+"-"+topname+"-"+subname, "", nowTime, "", -1)
|
|
|
+ updateId5 = AddChangeRecord(tx, clueId, clueId, "top_cluetype", "基本信息变更", "/", topname, nowTime, "", -1)
|
|
|
+ updateId6 = AddChangeRecord(tx, clueId, clueId, "sub_cluetype", "基本信息变更", "/", subname, nowTime, "", -1)
|
|
|
//冻结处理
|
|
|
- return clueId > -1 && uodateId1 > -1 && uodateId2 > -1 && uodateId3 > -1 && uodateId4 > -1 && uodateId5 > -1 && uodateId6 > -1
|
|
|
+ return clueId > -1 && updateId1 > -1 && updateId2 > -1 && updateId3 > -1 && updateId4 > -1 && updateId5 > -1 && updateId6 > -1
|
|
|
}) {
|
|
|
log.Println("线索分配成功")
|
|
|
if TiDb.Count("dwd_f_userbase_contacts", map[string]interface{}{"phone": phone}) == 0 {
|
|
@@ -630,7 +501,7 @@ func SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, c
|
|
|
}
|
|
|
return true
|
|
|
} else {
|
|
|
- log.Println("线索分配失败!!!", clueId, uodateId1, uodateId2, uodateId3, uodateId4, uodateId5, uodateId6, " 用户信息 ", item, position, seatNumber, uId, userId, phone)
|
|
|
+ log.Println("线索分配失败!!!", clueId, updateId1, updateId2, updateId3, updateId4, updateId5, updateId6, " 用户信息 ", item, position, seatNumber, uId, userId, phone)
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
@@ -676,37 +547,9 @@ func SaveClue0(item, userId, uId, top_cluetype, sub_cluetype, topname, subname,
|
|
|
"label": 1,
|
|
|
"labelChangeTime": time.Now().Format("2006-01-02"),
|
|
|
})
|
|
|
- uodateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_type": "创建线索",
|
|
|
- "new_value": "系统自动创建",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- uodateId2 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": "",
|
|
|
- "new_value": "/",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- uodateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "商机线索",
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ uodateId1 = AddChangeRecord(nil, clueId, positionId, "", "创建线索", "系统自动创建", "", nowTime, "", -1)
|
|
|
+ uodateId2 = AddChangeRecord(nil, clueId, positionId, "position_id", "所属人变更", "/", "", nowTime, "", -1)
|
|
|
+ uodateId3 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, "", -1)
|
|
|
return clueId > -1 && uodateId1 > -1 && uodateId2 > -1 && uodateId3 > -1
|
|
|
}) {
|
|
|
log.Println("线索分配成功")
|
|
@@ -958,162 +801,33 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
if (trailstatus == "00" || old_position_id == 0 || (pIsOk && old_cluename != cluename && cluename != "")) && is_assign == 1 {
|
|
|
if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
|
|
|
} else if old_position_id == 0 {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": CodeTrail[trailstatus],
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(nil, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
+ updateId2 = AddChangeRecord(nil, clueId, positionId, "", "创建线索", "系统自动创建", "", nowTime, "", -1)
|
|
|
+ updateId3 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "新增", CodeTrail[trailstatus], nowTime, "", -1)
|
|
|
} else {
|
|
|
if pIsOk && old_cluename != cluename && cluename != "" {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(nil, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
} else {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId2 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.Int64All(data["position_id"]),
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "无意向客户",
|
|
|
- "new_value": "流失",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "商机线索",
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "无意向客户",
|
|
|
- "new_value": "商机线索",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(nil, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
+ updateId2 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "流失", "无意向客户", nowTime, "", -1)
|
|
|
+ updateId3 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, "", -1)
|
|
|
+ updateId4 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "商机线索", "无意向客户", nowTime, "", -1)
|
|
|
}
|
|
|
}
|
|
|
} else if is_assign == 0 {
|
|
|
if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
|
|
|
} else {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(nil, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
if trailstatus != "01" {
|
|
|
- updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": CodeTrail[trailstatus],
|
|
|
- "new_value": "商机线索",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId4 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "商机线索", CodeTrail[trailstatus], nowTime, "", -1)
|
|
|
}
|
|
|
- updateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "商机线索",
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId3 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, "", -1)
|
|
|
}
|
|
|
} else if is_assign == -1 {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": CodeTrail[trailstatus],
|
|
|
- "new_value": "商机线索",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(nil, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
+ updateId4 = AddChangeRecord(nil, clueId, positionId, "trailstatus", "基本信息变更", "商机线索", CodeTrail[trailstatus], nowTime, "", -1)
|
|
|
} else if (pIsOk && old_cluename == cluename && cluename != "") && is_assign == 1 && positionId != old_position_id {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(nil, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if recordCount <= 0 || is_assign == 0 {
|
|
|
if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
|
|
@@ -1125,15 +839,8 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
kcpositionId := common.Int64All((*cdata)["position_id"])
|
|
|
tasksource := gconv.String((*cdata)["tasksource"])
|
|
|
taskstatus := common.IntAll((*cdata)["taskstatus"])
|
|
|
- updateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": kcpositionId,
|
|
|
- "change_type": "加入任务车",
|
|
|
- "new_value": "线上主动留资",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId5 = AddChangeRecord(tx, clueId, kcpositionId, "", "加入任务车",
|
|
|
+ "线上主动留资", "", nowTime, "", -1)
|
|
|
if taskstatus == 1 {
|
|
|
tasksource = "10"
|
|
|
} else {
|
|
@@ -1154,15 +861,7 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
}
|
|
|
}
|
|
|
} else if !is_ok {
|
|
|
- updateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" || is_assign == 0 || is_assign == -1, positionId, common.Int64All(data["position_id"])),
|
|
|
- "change_type": "加入任务车",
|
|
|
- "new_value": gconv.String(common.If(gconv.Int64(data["position_id"]) == 0, "线索自动分配", "线索来源自动更新")) + "-" + topname + "-" + subname,
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId5 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" || is_assign == 0 || is_assign == -1, positionId, common.Int64All(data["position_id"]))), "", "加入任务车", gconv.String(common.If(gconv.Int64(data["position_id"]) == 0, "线索自动分配", "线索来源自动更新"))+"-"+topname+"-"+subname, "", nowTime, "", -1)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1180,46 +879,20 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
}
|
|
|
if item != "orders" {
|
|
|
if old_name != name && name != "" {
|
|
|
- updateId6 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"])))),
|
|
|
- "change_field": "name",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_name != "", old_name, "/"),
|
|
|
- "new_value": common.If(name != "", name, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId6 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "trailstatus", "基本信息变更", gconv.String(common.If(name != "", name, "/")), gconv.String(common.If(old_name != "", old_name, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_position != position && position != "" {
|
|
|
- updateId7 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"])))),
|
|
|
- "change_field": "position",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_position != "", old_position, "/"),
|
|
|
- "new_value": common.If(position != "", position, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId7 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "position", "基本信息变更", gconv.String(common.If(position != "", position, "/")), gconv.String(common.If(old_position != "", old_position, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_department != department && department != "" {
|
|
|
- updateId8 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"])))),
|
|
|
- "change_field": "department",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_department != "", old_department, "/"),
|
|
|
- "new_value": common.If(department != "", department, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId8 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "department", "基本信息变更", gconv.String(common.If(department != "", department, "/")), gconv.String(common.If(old_department != "", old_department, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_role != role && role != "" {
|
|
|
- updateId9 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{"clue_id": clueId, "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"])))), "change_field": "role", "change_type": "基本信息变更", "old_value": common.If(old_role != "", old_role, "/"), "new_value": common.If(role != "", role, "/"), "createtime": nowTime, "BCPCID": BCPCID, "operator_id": -1})
|
|
|
+ updateId9 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "role", "基本信息变更", gconv.String(common.If(role != "", role, "/")), gconv.String(common.If(old_role != "", old_role, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_follow_project_area != follow_project_area && follow_project_area != "" {
|
|
|
old_area, old_area_arr := "", []string{}
|
|
@@ -1232,58 +905,24 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
}
|
|
|
old_area = strings.Join(old_area_arr, ",")
|
|
|
new_area = strings.Join(new_area_arr, ",")
|
|
|
- updateId10 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"])))),
|
|
|
- "change_field": "follow_project_area",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_area != "", old_area, "/"),
|
|
|
- "new_value": common.If(new_area != "", new_area, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId10 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "follow_project_area", "基本信息变更", gconv.String(common.If(new_area != "", new_area, "/")), gconv.String(common.If(old_area != "", old_area, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_cluename != cluename && cluename != "" {
|
|
|
- updateId11 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"])))),
|
|
|
- "change_field": "cluename",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_cluename != "", old_cluename, "/"),
|
|
|
- "new_value": common.If(cluename != "", cluename, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId11 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "cluename", "基本信息变更", gconv.String(common.If(cluename != "", cluename, "/")), gconv.String(common.If(old_cluename != "", old_cluename, "/")), nowTime, "", -1)
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if old_top_cluetype != top_cluetype {
|
|
|
- updateId12 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"])))),
|
|
|
- "change_field": "top_cluetype",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_topname != "", old_topname, "/"),
|
|
|
- "new_value": common.If(topname != "", topname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId12 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "top_cluetype", "基本信息变更", gconv.String(common.If(topname != "", topname, "/")), gconv.String(common.If(old_topname != "", old_topname, "/")), nowTime, "", -1)
|
|
|
+
|
|
|
}
|
|
|
newPositionId := gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))))
|
|
|
if old_sub_cluetype != sub_cluetype {
|
|
|
- updateId13 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
- "change_field": "sub_cluetype", //333
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_subname != "", old_subname, "/"),
|
|
|
- "new_value": common.If(subname != "", subname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId12 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.If(is_assign == 1, positionId, common.Int64All(data["position_id"]))))),
|
|
|
+ "sub_cluetype", "基本信息变更", gconv.String(common.If(subname != "", subname, "/")), gconv.String(common.If(old_subname != "", old_subname, "/")), nowTime, "", -1)
|
|
|
//标签处理
|
|
|
if old_position_id != positionId && newPositionId > 0 {
|
|
|
LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
|
|
@@ -1589,86 +1228,17 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
positionId = 0
|
|
|
seatNumber = ""
|
|
|
} else if old_position_id == 0 {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": CodeTrail[trailstatus],
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(tx, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
+ updateId3 = AddChangeRecord(tx, clueId, positionId, "trailstatus", "基本信息变更", "新增", CodeTrail[trailstatus], nowTime, "", -1)
|
|
|
} else {
|
|
|
if pIsOk && old_cluename != cluename && cluename != "" {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(tx, clueId, positionId, "position_id", "所属人变更", gconv.String(
|
|
|
+ common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
} else {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId2 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.Int64All(data["position_id"]),
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "无意向客户",
|
|
|
- "new_value": "流失",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "商机线索",
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "无意向客户",
|
|
|
- "new_value": "商机线索",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(tx, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
+ updateId2 = AddChangeRecord(tx, clueId, common.Int64All(data["position_id"]), "trailstatus", "基本信息变更", "流失", "无意向客户", nowTime, "", -1)
|
|
|
+ updateId3 = AddChangeRecord(tx, clueId, common.Int64All(data["position_id"]), "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, "", -1)
|
|
|
+ updateId4 = AddChangeRecord(tx, clueId, positionId, "trailstatus", "基本信息变更", "商机线索", "无意向客户", nowTime, "", -1)
|
|
|
}
|
|
|
}
|
|
|
} else if is_assign == 0 {
|
|
@@ -1677,65 +1247,15 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
positionId = 0
|
|
|
seatNumber = ""
|
|
|
} else {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(tx, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
if trailstatus != "01" {
|
|
|
- updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": CodeTrail[trailstatus],
|
|
|
- "new_value": "商机线索",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId4 = AddChangeRecord(tx, clueId, positionId, "trailstatus", "基本信息变更", "商机线索", CodeTrail[trailstatus], nowTime, "", -1)
|
|
|
}
|
|
|
- updateId3 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": "商机线索",
|
|
|
- "new_value": "新增",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId3 = AddChangeRecord(tx, clueId, positionId, "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, "", -1)
|
|
|
}
|
|
|
} else if is_assign == -1 {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(saleName != "", saleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
- updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": positionId,
|
|
|
- "change_field": "trailstatus",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": CodeTrail[trailstatus],
|
|
|
- "new_value": "商机线索",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId1 = AddChangeRecord(tx, clueId, positionId, "position_id", "所属人变更", gconv.String(common.If(saleName != "", saleName, "/")), gconv.String(common.If(oldsaleName != "", oldsaleName, "/")), nowTime, "", -1)
|
|
|
+ updateId4 = AddChangeRecord(tx, clueId, positionId, "trailstatus", "基本信息变更", "商机线索", CodeTrail[trailstatus], nowTime, "", -1)
|
|
|
}
|
|
|
if recordCount <= 0 || is_assign == 0 {
|
|
|
if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
|
|
@@ -1750,15 +1270,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
kcpositionId := common.Int64All((*cdata)["position_id"])
|
|
|
tasksource := gconv.String((*cdata)["tasksource"])
|
|
|
taskstatus := common.IntAll((*cdata)["taskstatus"])
|
|
|
- updateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": kcpositionId,
|
|
|
- "change_type": "加入任务车",
|
|
|
- "new_value": "线上主动留资",
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId5 = AddChangeRecord(tx, clueId, kcpositionId, "", "加入任务车", "线上主动留资", "", nowTime, "", -1)
|
|
|
if taskstatus == 1 {
|
|
|
tasksource = "10"
|
|
|
} else {
|
|
@@ -1779,15 +1291,8 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
}
|
|
|
}
|
|
|
} else if !is_ok {
|
|
|
- updateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" || is_assign == 0 || is_assign == -1, positionId, common.Int64All(data["position_id"])),
|
|
|
- "change_type": "加入任务车",
|
|
|
- "new_value": gconv.String(common.If(gconv.Int64(data["position_id"]) == 0, "线索自动分配", "线索来源自动更新")) + "-" + topname + "-" + subname,
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId5 = AddChangeRecord(tx, clueId, gconv.String(common.If(trailstatus == "00" || is_assign == 0 || is_assign == -1, positionId, common.Int64All(data["position_id"]))), "", "加入任务车",
|
|
|
+ gconv.String(gconv.String(common.If(gconv.Int64(data["position_id"]) == 0, "线索自动分配", "线索来源自动更新"))+"-"+topname+"-"+subname), "", nowTime, "", -1)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1805,55 +1310,21 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
}
|
|
|
if item != "orders" {
|
|
|
if old_name != name && name != "" {
|
|
|
- updateId6 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "name",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_name != "", old_name, "/"),
|
|
|
- "new_value": common.If(name != "", name, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId6 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "name", "基本信息变更",
|
|
|
+ gconv.String(common.If(name != "", name, "/")), gconv.String(common.If(old_name != "", old_name, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_position != position && position != "" {
|
|
|
- updateId7 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "position",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_position != "", old_position, "/"),
|
|
|
- "new_value": common.If(position != "", position, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId7 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "position", "基本信息变更",
|
|
|
+ gconv.String(common.If(position != "", position, "/")), gconv.String(common.If(old_position != "", old_position, "/")), nowTime, "", -1)
|
|
|
+
|
|
|
}
|
|
|
if old_department != department && department != "" {
|
|
|
- updateId8 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "department",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_department != "", old_department, "/"),
|
|
|
- "new_value": common.If(department != "", department, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId8 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "department", "基本信息变更",
|
|
|
+ gconv.String(common.If(department != "", department, "/")), gconv.String(common.If(department != "", department, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_role != role && role != "" {
|
|
|
- updateId9 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "role",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_role != "", old_role, "/"),
|
|
|
- "new_value": common.If(role != "", role, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ updateId8 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "role", "基本信息变更",
|
|
|
+ gconv.String(common.If(role != "", role, "/")), gconv.String(common.If(old_role != "", old_role, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_follow_project_area != follow_project_area && follow_project_area != "" {
|
|
|
old_area, old_area_arr := "", []string{}
|
|
@@ -1866,58 +1337,22 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
}
|
|
|
old_area = strings.Join(old_area_arr, ",")
|
|
|
new_area = strings.Join(new_area_arr, ",")
|
|
|
- updateId10 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "follow_project_area",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_area != "", old_area, "/"),
|
|
|
- "new_value": common.If(new_area != "", new_area, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId10 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "follow_project_area", "基本信息变更",
|
|
|
+ gconv.String(common.If(new_area != "", new_area, "/")), gconv.String(common.If(old_area != "", old_area, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if old_cluename != cluename && cluename != "" {
|
|
|
- updateId11 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "cluename",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_cluename != "", old_cluename, "/"),
|
|
|
- "new_value": common.If(cluename != "", cluename, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId11 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "cluename", "基本信息变更",
|
|
|
+ gconv.String(common.If(cluename != "", cluename, "/")), gconv.String(common.If(old_cluename != "", old_cluename, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
}
|
|
|
if old_top_cluetype != top_cluetype {
|
|
|
- updateId12 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "top_cluetype",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_topname != "", old_topname, "/"),
|
|
|
- "new_value": common.If(topname != "", topname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId12 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "top_cluetype", "基本信息变更",
|
|
|
+ gconv.String(common.If(topname != "", topname, "/")), gconv.String(common.If(old_topname != "", old_topname, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
newPositionId := gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))))
|
|
|
if old_sub_cluetype != sub_cluetype {
|
|
|
- updateId13 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"]))),
|
|
|
- "change_field": "sub_cluetype", //444
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_subname != "", old_subname, "/"),
|
|
|
- "new_value": common.If(subname != "", subname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId12 = AddChangeRecord(tx, clueId, gconv.Int64(common.If(trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400, -1, common.If(trailstatus == "00" || is_assign == 0, positionId, common.Int64All(data["position_id"])))), "sub_cluetype", "基本信息变更",
|
|
|
+ gconv.String(common.If(subname != "", subname, "/")), gconv.String(common.If(old_subname != "", old_subname, "/")), nowTime, "", -1)
|
|
|
if old_position_id != newPositionId && newPositionId > 0 {
|
|
|
LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
|
|
|
} else {
|
|
@@ -2012,55 +1447,19 @@ func clueInfoUpdate(data ClueMapEntity) bool {
|
|
|
}
|
|
|
if data.Item != "orders" {
|
|
|
if data.OldName != data.NewName && data.NewName != "" {
|
|
|
- updateId6 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "name",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(data.OldName != "", data.OldName, "/"),
|
|
|
- "new_value": common.If(data.NewName != "", data.NewName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId6 = AddChangeRecord(tx, data.ClueId, data.PositionId, "name", "基本信息变更",
|
|
|
+ gconv.String(common.If(data.NewName != "", data.NewName, "/")), gconv.String(common.If(data.OldName != "", data.OldName, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if data.OldPosition != data.NewPosition && data.NewPosition != "" {
|
|
|
- updateId7 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "position",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(data.OldPosition != "", data.OldPosition, "/"),
|
|
|
- "new_value": common.If(data.NewPosition != "", data.NewPosition, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId7 = AddChangeRecord(tx, data.ClueId, data.PositionId, "position", "基本信息变更",
|
|
|
+ gconv.String(common.If(data.NewPosition != "", data.NewPosition, "/")), gconv.String(common.If(data.OldPosition != "", data.OldPosition, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if data.OldDepartment != data.NewDepartment && data.NewDepartment != "" {
|
|
|
- updateId8 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "department",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(data.OldDepartment != "", data.OldDepartment, "/"),
|
|
|
- "new_value": common.If(data.NewDepartment != "", data.NewDepartment, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId8 = AddChangeRecord(tx, data.ClueId, data.PositionId, "department", "基本信息变更",
|
|
|
+ gconv.String(common.If(data.NewDepartment != "", data.NewDepartment, "/")), gconv.String(common.If(data.OldDepartment != "", data.OldDepartment, "/")), nowTime, "", -1)
|
|
|
}
|
|
|
if data.OldRole != data.NewRole && data.NewRole != "" {
|
|
|
- updateId9 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "role",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(data.OldRole != "", data.OldRole, "/"),
|
|
|
- "new_value": common.If(data.NewRole != "", data.NewRole, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1})
|
|
|
+ updateId9 = AddChangeRecord(nil, data.ClueId, data.PositionId, "role", "基本信息变更", gconv.String(common.If(data.NewRole != "", data.NewRole, "/")), gconv.String(common.If(data.OldRole != "", data.OldRole, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if data.OldFollowProjectArea != data.NewFollowProjectArea && data.NewFollowProjectArea != "" {
|
|
|
old_area, old_area_arr := "", []string{}
|
|
@@ -2073,57 +1472,17 @@ func clueInfoUpdate(data ClueMapEntity) bool {
|
|
|
}
|
|
|
old_area = strings.Join(old_area_arr, ",")
|
|
|
new_area = strings.Join(new_area_arr, ",")
|
|
|
- updateId10 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "follow_project_area",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_area != "", old_area, "/"),
|
|
|
- "new_value": common.If(new_area != "", new_area, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId10 = AddChangeRecord(nil, data.ClueId, data.PositionId, "follow_project_area", "基本信息变更", gconv.String(common.If(new_area != "", new_area, "/")), gconv.String(common.If(old_area != "", old_area, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if data.OldCluename != data.NewCluename && data.NewCluename != "" {
|
|
|
- updateId11 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "cluename",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(data.OldCluename != "", data.OldCluename, "/"),
|
|
|
- "new_value": common.If(data.NewCluename != "", data.NewCluename, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId11 = AddChangeRecord(nil, data.ClueId, data.PositionId, "cluename", "基本信息变更", gconv.String(common.If(data.NewCluename != "", data.NewCluename, "/")), gconv.String(common.If(data.OldCluename != "", data.OldCluename, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
}
|
|
|
if data.OldTopCluetype != data.NewTopCluetype {
|
|
|
- updateId12 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "top_cluetype",
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_topname != "", old_topname, "/"),
|
|
|
- "new_value": common.If(data.Topname != "", data.Topname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId12 = AddChangeRecord(nil, data.ClueId, data.PositionId, "top_cluetype", "基本信息变更", gconv.String(common.If(data.Topname != "", data.Topname, "/")), gconv.String(common.If(old_topname != "", old_topname, "/")), nowTime, BCPCID, -1)
|
|
|
}
|
|
|
if data.OldSubCluetype != data.OldSubCluetype {
|
|
|
- updateId13 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": data.ClueId,
|
|
|
- "position_id": data.PositionId,
|
|
|
- "change_field": "sub_cluetype", //555
|
|
|
- "change_type": "基本信息变更",
|
|
|
- "old_value": common.If(old_subname != "", old_subname, "/"),
|
|
|
- "new_value": common.If(data.Subname != "", data.Subname, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": BCPCID,
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ updateId13 = AddChangeRecord(nil, data.ClueId, data.PositionId, "sub_cluetype", "基本信息变更", gconv.String(common.If(data.Subname != "", data.Subname, "/")), gconv.String(common.If(old_subname != "", old_subname, "/")), nowTime, BCPCID, -1)
|
|
|
LabelHandel(tx, data.Label, 1, data.UId, data.Level, data.Trailstatus, data.Trailstatus, 0)
|
|
|
}
|
|
|
return ok && updateId1 > -1 && updateId2 > -1 && updateId3 > -1 && updateId4 > -1 && updateId5 > -1 && updateId6 > -1 && updateId7 > -1 && updateId8 > -1 && updateId9 > -1 && updateId10 > -1 && updateId11 > -1 && updateId12 > -1 && updateId13 > -1
|