|
@@ -46,27 +46,43 @@ L:
|
|
|
}
|
|
|
|
|
|
// from 凭安库
|
|
|
-func InjectContactPingAnInfo(tmp map[string]interface{}) {
|
|
|
- //name := qu.ObjToString(tmp["company_name"])
|
|
|
- //phone := qu.ObjToString(tmp["company_phone"])
|
|
|
- //email := qu.ObjToString(tmp["company_email"])
|
|
|
- //createtime := time.Now().Format(ul.TimeLayout_New)
|
|
|
- ////查询当前通讯录是否有数据
|
|
|
- //if phone != "" {
|
|
|
- // if !QueryingEntContact(uid,name,phone) {
|
|
|
- // query := "INSERT INTO information.ent_contact(id,phone,name,email,create_time,update_time) VALUES(?,?,?,?,?,?)"
|
|
|
- // //插入数据
|
|
|
- // err := ul.ClickHouseConn.Exec(context.Background(), query, uid, phone, name, email, createtime, createtime)
|
|
|
- // if err != nil {
|
|
|
- // log.Debug(err)
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
+func InjectContactPingAnInfo(uid string, qyxy_info map[string]interface{}) {
|
|
|
+ //企业信息...
|
|
|
+ qy_id := qu.ObjToString(qyxy_info["_id"])
|
|
|
+ qy_name := qu.ObjToString(qyxy_info["legal_person"])
|
|
|
+ qy_phone := qu.ObjToString(qyxy_info["company_phone"])
|
|
|
+ qy_email := qu.ObjToString(qyxy_info["company_email"])
|
|
|
+ cts := []map[string]interface{}{}
|
|
|
+ if qy_phone != "" {
|
|
|
+ cts = append(cts, map[string]interface{}{
|
|
|
+ "name": qy_name,
|
|
|
+ "phone": qy_phone,
|
|
|
+ "email": qy_email,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ GetAnnualInfo(qy_id, qy_name, &cts)
|
|
|
+ if len(cts) > 0 {
|
|
|
+ msgs := GetEntContacts(uid)
|
|
|
+ for _, v := range cts {
|
|
|
+ c_name := qu.ObjToString(v["name"])
|
|
|
+ c_phone := qu.ObjToString(v["phone"])
|
|
|
+ c_email := qu.ObjToString(v["email"])
|
|
|
+ createtime := time.Now().Format(ul.TimeLayout_New)
|
|
|
+ if !QueryingExists(msgs, c_name, c_phone) {
|
|
|
+ query := "INSERT INTO information.ent_contact(id,phone,name,email,source_type,create_time,update_time) VALUES(?,?,?,?,?,?,?)"
|
|
|
+ //插入数据
|
|
|
+ err := ul.ClickHouseConn.Exec(context.Background(), query, uid, c_phone, c_name, c_email, 2, createtime, createtime)
|
|
|
+ if err != nil {
|
|
|
+ log.Debug(err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// from 马克
|
|
|
func InjectContactMaKeInfo(uid string, tmp map[string]interface{}) {
|
|
|
- name := qu.ObjToString(tmp["company_name"])
|
|
|
+ name := qu.ObjToString(tmp["legal_person"])
|
|
|
phone := qu.ObjToString(tmp["company_phone"])
|
|
|
email := qu.ObjToString(tmp["company_email"])
|
|
|
source_type := 2
|
|
@@ -120,3 +136,32 @@ type Msg struct {
|
|
|
name string
|
|
|
phone string
|
|
|
}
|
|
|
+
|
|
|
+// 创建年报字段~与现有的通讯录
|
|
|
+func GetAnnualInfo(company_id string, legal_person string, contact_arr *[]map[string]interface{}) {
|
|
|
+ keys := map[string]string{}
|
|
|
+ for _, v := range *contact_arr {
|
|
|
+ key := qu.ObjToString(v["name"]) + "~" + qu.ObjToString(v["phone"])
|
|
|
+ keys[key] = key
|
|
|
+ }
|
|
|
+ dataArr, _ := ul.SpiMgo.Find("annual_report_base", map[string]interface{}{"company_id": company_id}, nil, map[string]interface{}{
|
|
|
+ "company_phone": 1,
|
|
|
+ "company_email": 1,
|
|
|
+ })
|
|
|
+ for _, v := range dataArr {
|
|
|
+ company_phone := qu.ObjToString(v["company_phone"])
|
|
|
+ company_email := qu.ObjToString(v["company_email"])
|
|
|
+ if company_phone != "" {
|
|
|
+ key := legal_person + "~" + company_phone
|
|
|
+ if keys[key] == "" {
|
|
|
+ dict := map[string]interface{}{
|
|
|
+ "name": legal_person,
|
|
|
+ "phone": company_phone,
|
|
|
+ "email": company_email,
|
|
|
+ }
|
|
|
+ (*contact_arr) = append((*contact_arr), dict)
|
|
|
+ keys[key] = key
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|