|
@@ -861,6 +861,7 @@ func refundAuto() {
|
|
|
if saleId > 0 {
|
|
|
saleData := TiDb.FindOne("dwd_f_crm_personnel_management", map[string]interface{}{"position_id": saleId, "resign": 0}, "", "")
|
|
|
if saleData != nil && len(*saleData) > 0 {
|
|
|
+ //查看一下当前人是否在职
|
|
|
if FindUpperLimit(gconv.String(saleId), "", false) {
|
|
|
TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_unfollow=0,updatetime=?,trailstatus="01",is_task=1,tasktime=?,top_cluetype="532",sub_cluetype="537",taskstatus=0,tasksource="其他-成交客户续约失败",is_transfer=0,is_assign=-3,FREEZE_TIME=? WHERE id = ?`, nowTime, nowTime, nowTime, clueId)
|
|
|
} else {
|
|
@@ -900,7 +901,26 @@ func refundAuto() {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- sdata := TiDb.SelectBySql(`SELECT b.name,b.position_id,b.seat_number from dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b on a.position_id = b.position_id where a.bi_pcode = (SELECT bi_pcode from dwd_d_crm_department_level_succbi where position_id = ?) and b.role_id = 3`, saleId)
|
|
|
+ sdata := &[]map[string]interface{}{}
|
|
|
+ //查看当前是否属于一部三部
|
|
|
+ userData := TiDb.SelectBySql(`SELECT
|
|
|
+ b.NAME,
|
|
|
+ b.position_id,
|
|
|
+ b.seat_number,
|
|
|
+ b.role_id,
|
|
|
+ a.dept_name
|
|
|
+ FROM
|
|
|
+ dwd_d_crm_department_level_succbi a
|
|
|
+ INNER JOIN dwd_f_crm_personnel_management b ON a.position_id = ?
|
|
|
+ AND a.position_id = b.position_id`, saleId)
|
|
|
+ if userData != nil && len(*userData) > 0 {
|
|
|
+ deptName := gconv.String((*userData)[0]["dept_name"])
|
|
|
+ if strings.Contains(deptName, "一部") {
|
|
|
+ sdata = TiDb.SelectBySql(`SELECT b.name,b.position_id,b.seat_number from dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b on a.position_id = b.position_id where a.bi_pcode = (SELECT bi_pcode from dwd_d_crm_department_level_succbi where position_id = ?) and b.role_id = 3`, saleId)
|
|
|
+ } else if strings.Contains(deptName, "三部") {
|
|
|
+ sdata = TiDb.SelectBySql(`SELECT b.name,b.position_id,b.seat_number from dwd_d_crm_department_level_succbi a INNER JOIN dwd_f_crm_personnel_management b on a.position_id = b.position_id where a.bi_pcode = (SELECT bi_pcode from dwd_d_crm_department_level_succbi where position_id = ?) and b.role_id = 8`, saleId)
|
|
|
+ }
|
|
|
+ }
|
|
|
if sdata != nil && len(*sdata) > 0 {
|
|
|
saleId = common.Int64All((*sdata)[0]["position_id"])
|
|
|
seatNumber := common.ObjToString((*sdata)[0]["seat_number"])
|