|
@@ -572,7 +572,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if trailstatus == "00" || old_position_id == 0 || is_assign != 1 || pIsOk {
|
|
|
+ if trailstatus == "00" || old_position_id == 0 || is_assign != 1 || (pIsOk && old_cluename != cluename) {
|
|
|
if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
|
|
|
} else {
|
|
|
clueUpdateData["seatNumber"] = seatNumber
|
|
@@ -653,7 +653,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
//线索
|
|
|
ok = TiDb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, clueUpdateData)
|
|
|
//变更记录
|
|
|
- if (trailstatus == "00" || old_position_id == 0 || pIsOk) && is_assign == 1 {
|
|
|
+ if (trailstatus == "00" || old_position_id == 0 || (pIsOk && old_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{}{
|
|
@@ -679,50 +679,64 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
"operator_id": -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,
|
|
|
- })
|
|
|
+ if pIsOk && old_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,
|
|
|
+ })
|
|
|
+ } 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,
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
} else if trailstatus != "08" && is_assign == 0 {
|
|
|
if trailstatus == "00" && trailstatusTime != "" && time.Now().Unix()-trailstatusTimes.Unix() < 86400 {
|