|
@@ -1048,17 +1048,19 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
if (trailstatus == "00" || old_position_id == 0 || (inData.PIsOk && old_cluename != inData.Cluename && inData.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": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.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": inData.PositionId,
|
|
@@ -1084,17 +1086,19 @@ func WorkUpdateClue(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": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.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"]),
|
|
@@ -1133,17 +1137,19 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
} 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": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
+ "createtime": nowTime,
|
|
|
+ "BCPCID": common.GetRandom(32),
|
|
|
+ "operator_id": -1,
|
|
|
+ })
|
|
|
+ }
|
|
|
if trailstatus != "01" {
|
|
|
updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
"clue_id": clueId,
|
|
@@ -1170,17 +1176,19 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
})
|
|
|
}
|
|
|
} else if is_assign == -1 {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.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": inData.PositionId,
|
|
@@ -1192,7 +1200,7 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
"BCPCID": common.GetRandom(32),
|
|
|
"operator_id": -1,
|
|
|
})
|
|
|
- } else if (inData.PIsOk && old_cluename == inData.Cluename && inData.Cluename != "") && is_assign == 1 && inData.PositionId != old_position_id {
|
|
|
+ } else if inData.PIsOk && old_cluename == inData.Cluename && inData.Cluename != "" && is_assign == 1 && inData.PositionId != old_position_id {
|
|
|
updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
"clue_id": clueId,
|
|
|
"position_id": inData.PositionId,
|
|
@@ -1681,17 +1689,19 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
inData.PositionId = 0
|
|
|
inData.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": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.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": inData.PositionId,
|
|
@@ -1717,17 +1727,19 @@ 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": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.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"]),
|
|
@@ -1769,17 +1781,19 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
inData.PositionId = 0
|
|
|
inData.SeatNumber = ""
|
|
|
} else {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
+ "createtime": nowTime,
|
|
|
+ "BCPCID": common.GetRandom(32),
|
|
|
+ "operator_id": -1,
|
|
|
+ })
|
|
|
+ }
|
|
|
if trailstatus != "01" {
|
|
|
updateId4 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
"clue_id": clueId,
|
|
@@ -1806,17 +1820,19 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
})
|
|
|
}
|
|
|
} else if is_assign == -1 {
|
|
|
- updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
- "clue_id": clueId,
|
|
|
- "position_id": inData.PositionId,
|
|
|
- "change_field": "position_id",
|
|
|
- "change_type": "所属人变更",
|
|
|
- "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
- "new_value": common.If(inData.SaleName != "", inData.SaleName, "/"),
|
|
|
- "createtime": nowTime,
|
|
|
- "BCPCID": common.GetRandom(32),
|
|
|
- "operator_id": -1,
|
|
|
- })
|
|
|
+ if oldsaleName != inData.SaleName {
|
|
|
+ updateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
+ "clue_id": clueId,
|
|
|
+ "position_id": inData.PositionId,
|
|
|
+ "change_field": "position_id",
|
|
|
+ "change_type": "所属人变更",
|
|
|
+ "old_value": common.If(oldsaleName != "", oldsaleName, "/"),
|
|
|
+ "new_value": common.If(inData.SaleName != "", inData.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": inData.PositionId,
|