|
@@ -13,6 +13,144 @@ import (
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+/*// 电销工单生成
|
|
|
|
+func rderAcceptance() {
|
|
|
|
+ sql := fmt.Sprintf(`select * from order_acceptance where is_clue=2 order by propose_time `)
|
|
|
|
+ data := Mysql.SelectBySql(sql)
|
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
|
+ for _, v := range *data {
|
|
|
|
+ acceptance_no := gconv.String(v["acceptance_no"])
|
|
|
|
+ childrenArr := WorkOrder.Find("order_acceptance_children", map[string]interface{}{
|
|
|
|
+ "acceptance_no": acceptance_no,
|
|
|
|
+ }, "", "", -1, -1)
|
|
|
|
+ if childrenArr != nil && len(*childrenArr) > 0 {
|
|
|
|
+ company := ""
|
|
|
|
+ phone := ""
|
|
|
|
+ demand := ""
|
|
|
|
+ for _, v1 := range *childrenArr {
|
|
|
|
+ if gconv.String(v1["file_name"]) == "公司名称" {
|
|
|
|
+ company = gconv.String(v1["file_value"])
|
|
|
|
+ }
|
|
|
|
+ if gconv.String(v1["file_name"]) == "联系方式" {
|
|
|
|
+ phone = gconv.String(v1["file_value"])
|
|
|
|
+ }
|
|
|
|
+ if gconv.String(v1["file_name"]) == "客户需求" {
|
|
|
|
+ demand = gconv.String(v1["file_value"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ WorkDataHandle(company, phone, demand)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}*/
|
|
|
|
+/*func WorkDataHandle(company, phone, demand string) bool {
|
|
|
|
+ positionId, seatNumber, saleNam := AutoDrawPerson(company, phone, demand)
|
|
|
|
+ uId := ""
|
|
|
|
+ query := map[string]interface{}{}
|
|
|
|
+ contactsData := TiDb.SelectBySql("select * from dwd_f_userbase_contacts where phone = ? and is_delete = 1", phone)
|
|
|
|
+ if contactsData != nil && len(*contactsData) > 0 {
|
|
|
|
+ if common.ObjToString((*contactsData)[0]["baseinfo_id"]) != "" {
|
|
|
|
+ uId = common.ObjToString((*contactsData)[0]["baseinfo_id"])
|
|
|
|
+ query["uid"] = uId
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if uId == "" {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ uCount, _ := TiDb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, "", ""), true //查当前线索是否已存在
|
|
|
|
+ if uCount != nil && len(*uCount) > 0 {
|
|
|
|
+ positionId := gconv.Int64((*uCount)["position_id"])
|
|
|
|
+ if positionId == 0 {
|
|
|
|
+ //线索变更
|
|
|
|
+ } else {
|
|
|
|
+ trailstatusl := gconv.String((*uCount)["trailstatusl"])
|
|
|
|
+ if trailstatusl == "" {
|
|
|
|
+ //变更销售员
|
|
|
|
+ } else {
|
|
|
|
+ //线索变更
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //新增线索
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return true
|
|
|
|
+}
|
|
|
|
+func FindPosition(positionId int64) int64 {
|
|
|
|
+ //查询两个部门高级管理员
|
|
|
|
+ //查询两个部门所有人员标识
|
|
|
|
+ //电销三部
|
|
|
|
+ userData1 := TiDb.SelectBySql(`SELECT
|
|
|
|
+ a.position_id,
|
|
|
|
+ a.name,
|
|
|
|
+ b.seat_number
|
|
|
|
+FROM
|
|
|
|
+ dwd_d_crm_department_level_succbi a
|
|
|
|
+ INNER JOIN dwd_f_crm_personnel_management b ON a.resign = 0
|
|
|
|
+ AND a.ent_id = 25917
|
|
|
|
+ AND a.resign = 0
|
|
|
|
+ AND a.dept_name LIKE "%销售一部/电销部%"
|
|
|
|
+ AND a.position_id = b.position_id`)
|
|
|
|
+ userData3 := TiDb.SelectBySql(`SELECT
|
|
|
|
+ a.position_id,
|
|
|
|
+ a.name,
|
|
|
|
+ b.seat_number
|
|
|
|
+FROM
|
|
|
|
+ dwd_d_crm_department_level_succbi a
|
|
|
|
+ INNER JOIN dwd_f_crm_personnel_management b ON a.resign = 0
|
|
|
|
+ AND a.ent_id = 25917
|
|
|
|
+ AND a.resign = 0
|
|
|
|
+ AND a.dept_name LIKE "%销售三部"
|
|
|
|
+ AND a.position_id = b.position_id`)
|
|
|
|
+ if userData3 == nil || len(*userData3) == 0 || userData1 == nil || len(*userData1) == 0 {
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
|
|
+ administrators1 := map[string]interface{}{}
|
|
|
|
+ administrators3 := map[string]interface{}{}
|
|
|
|
+ administrators := map[string]interface{}{}
|
|
|
|
+ //电销一部
|
|
|
|
+ positionIdArr1 := []int64{}
|
|
|
|
+ positionIdArr3 := []int64{}
|
|
|
|
+ for _, v := range *userData3 {
|
|
|
|
+ v["type"] = 3
|
|
|
|
+ personName := gconv.String(v["name"])
|
|
|
|
+ id := gconv.Int64(v["position_id"])
|
|
|
|
+ if personName == "孙鹏" {
|
|
|
|
+ administrators3 = v
|
|
|
|
+ administrators = v
|
|
|
|
+ }
|
|
|
|
+ if id == positionId {
|
|
|
|
+ administrators = v
|
|
|
|
+ }
|
|
|
|
+ positionIdArr3 = append(positionIdArr3, id)
|
|
|
|
+ }
|
|
|
|
+ for _, v := range *userData1 {
|
|
|
|
+ v["type"] = 1
|
|
|
|
+ personName := gconv.String(v["name"])
|
|
|
|
+ id := gconv.Int64(v["position_id"])
|
|
|
|
+ if personName == "沈炳毅" {
|
|
|
|
+ administrators1 = v
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ positionIdArr1 = append(positionIdArr1, id)
|
|
|
|
+ }
|
|
|
|
+ if positionId != 0 {
|
|
|
|
+ positiontype := gconv.Int64(administrators["type"])
|
|
|
|
+ isBool := false
|
|
|
|
+ if FindUpperLimit(gconv.String(positionId), "", false) {
|
|
|
|
+ if positiontype == 1 {
|
|
|
|
+ administrators1
|
|
|
|
+ } else {
|
|
|
|
+ administrators1
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+*/
|
|
// 未支付订单 30分钟一次
|
|
// 未支付订单 30分钟一次
|
|
func orders() {
|
|
func orders() {
|
|
//一个小时未支付进入线索 A
|
|
//一个小时未支付进入线索 A
|