|
@@ -1213,7 +1213,7 @@ func CustomerChangeHandle(data map[string]interface{}) map[string]interface{} {
|
|
|
func FindPositionIdClueId(clueId int64) (int64, string) {
|
|
|
querySql := `
|
|
|
SELECT
|
|
|
- b.salesperson,c.position_id
|
|
|
+ e.username as salesperson ,c.position_id
|
|
|
FROM
|
|
|
dwd_f_crm_clue_info a
|
|
|
INNER JOIN dwd_f_userbase_order_info b ON a.id = ?
|
|
@@ -1229,9 +1229,11 @@ func FindPositionIdClueId(clueId int64) (int64, string) {
|
|
|
AND b.vip_starttime < "2099-01-01"
|
|
|
AND b.product_type IN ( "大会员", "企业商机管理" )
|
|
|
AND ( b.order_change = 0 OR ( b.order_change = 0 AND DATEDIFF( b.vip_endtime, b.vip_starttime )> 90 ) )
|
|
|
- INNER JOIN dwd_f_crm_personnel_management c on c.ent_id =? and b.salesperson=c.name
|
|
|
+ inner JOIN jianyu.order_sale_record d on b.order_code=d.ordercode and d.state=1
|
|
|
+ INNER JOIN cadmin.admin_user e on d.saler_Id = e.id
|
|
|
+ INNER JOIN dwd_f_crm_personnel_management c on c.ent_id =? and e.username=c.name
|
|
|
ORDER BY
|
|
|
- b.create_time,b.payable_money DESC limit 1`
|
|
|
+ b.vip_endtime desc ,b.payable_money DESC limit 1`
|
|
|
clueData := TiDb.SelectBySql(querySql, clueId, db.EntId)
|
|
|
if clueData == nil || len(*clueData) == 0 {
|
|
|
return 0, ""
|