|
@@ -308,24 +308,17 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
if oldTaskTime != "" {
|
|
if oldTaskTime != "" {
|
|
t1, err := time.Parse("2006-01-02 15:04:05", oldTaskTime)
|
|
t1, err := time.Parse("2006-01-02 15:04:05", oldTaskTime)
|
|
if err == nil && time.Now().Before(t1) {
|
|
if err == nil && time.Now().Before(t1) {
|
|
- taskTime = oldTaskTime
|
|
|
|
- } else {
|
|
|
|
taskTime = nowTime
|
|
taskTime = nowTime
|
|
|
|
+ } else {
|
|
|
|
+ taskTime = oldTaskTime
|
|
}
|
|
}
|
|
}
|
|
}
|
|
clueUpdateData := map[string]interface{}{
|
|
clueUpdateData := map[string]interface{}{
|
|
- "is_assign": 1,
|
|
|
|
- "updatetime": nowTime,
|
|
|
|
- "cluename": cluename,
|
|
|
|
- "top_cluetype": top_cluetype,
|
|
|
|
- "sub_cluetype": sub_cluetype,
|
|
|
|
- "name": name,
|
|
|
|
- "position": position,
|
|
|
|
- "department": department,
|
|
|
|
- "industry": industry,
|
|
|
|
- "follow_project_area": follow_project_area,
|
|
|
|
- "role": role,
|
|
|
|
- "userid": userId,
|
|
|
|
|
|
+ "is_assign": 1,
|
|
|
|
+ "updatetime": nowTime,
|
|
|
|
+ "top_cluetype": top_cluetype,
|
|
|
|
+ "sub_cluetype": sub_cluetype,
|
|
|
|
+ "userid": userId,
|
|
}
|
|
}
|
|
seaUpdateData := map[string]interface{}{
|
|
seaUpdateData := map[string]interface{}{
|
|
"comeinsource": 2,
|
|
"comeinsource": 2,
|
|
@@ -345,6 +338,15 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
"taskstatus": 0,
|
|
"taskstatus": 0,
|
|
"tasksource": "线索来源自动更新" + "-" + topname + "-" + subname,
|
|
"tasksource": "线索来源自动更新" + "-" + topname + "-" + subname,
|
|
}
|
|
}
|
|
|
|
+ if item != "orders" {
|
|
|
|
+ clueUpdateData["name"] = name
|
|
|
|
+ clueUpdateData["position"] = position
|
|
|
|
+ clueUpdateData["department"] = department
|
|
|
|
+ clueUpdateData["industry"] = industry
|
|
|
|
+ clueUpdateData["follow_project_area"] = follow_project_area
|
|
|
|
+ clueUpdateData["role"] = role
|
|
|
|
+ clueUpdateData["cluename"] = cluename
|
|
|
|
+ }
|
|
if trailstatus == "00" || trailstatus == "01" {
|
|
if trailstatus == "00" || trailstatus == "01" {
|
|
clueUpdateData["seatNumber"] = seatNumber
|
|
clueUpdateData["seatNumber"] = seatNumber
|
|
clueUpdateData["position_id"] = positionId
|
|
clueUpdateData["position_id"] = positionId
|
|
@@ -477,83 +479,85 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
old_subname = common.ObjToString((*pcodeData)["name"])
|
|
old_subname = common.ObjToString((*pcodeData)["name"])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if old_name != name {
|
|
|
|
- updateId6 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
- "clue_id": clueId,
|
|
|
|
- "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if old_position != position {
|
|
|
|
- updateId7 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
- "clue_id": clueId,
|
|
|
|
- "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if old_department != department {
|
|
|
|
- updateId8 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
- "clue_id": clueId,
|
|
|
|
- "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if old_role != role {
|
|
|
|
- updateId9 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
- "clue_id": clueId,
|
|
|
|
- "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if old_follow_project_area != follow_project_area {
|
|
|
|
- updateId10 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
- "clue_id": clueId,
|
|
|
|
- "position_id": common.If(trailstatus == "00" || trailstatus == "01", positionId, common.Int64All(data["position_id"])),
|
|
|
|
- "change_field": "follow_project_area",
|
|
|
|
- "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,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if old_cluename != cluename {
|
|
|
|
- updateId11 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
- "clue_id": clueId,
|
|
|
|
- "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
- })
|
|
|
|
|
|
+ if item != "orders" {
|
|
|
|
+ if old_name != name {
|
|
|
|
+ updateId6 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if old_position != position {
|
|
|
|
+ updateId7 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if old_department != department {
|
|
|
|
+ updateId8 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if old_role != role {
|
|
|
|
+ updateId9 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if old_follow_project_area != follow_project_area {
|
|
|
|
+ updateId10 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": common.If(trailstatus == "00" || trailstatus == "01", positionId, common.Int64All(data["position_id"])),
|
|
|
|
+ "change_field": "follow_project_area",
|
|
|
|
+ "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,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if old_cluename != cluename {
|
|
|
|
+ updateId11 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "position_id": common.If(trailstatus == "00" || trailstatus == "01", 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,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if old_top_cluetype != top_cluetype {
|
|
if old_top_cluetype != top_cluetype {
|
|
updateId12 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
updateId12 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|