|
@@ -525,37 +525,50 @@ func (e *EmPloyService) DistributePerson(in *types.EmployDistributeReq) bool {
|
|
|
//分发数据处理
|
|
|
infoMap := map[string]map[string]interface{}{}
|
|
|
onlyMap := map[string]interface{}{}
|
|
|
+ topMap := map[string]string{}
|
|
|
+ topEnt := 0
|
|
|
//标讯数据处理
|
|
|
for _, v := range strings.Split(in.EmployIdArr, ",") {
|
|
|
- if onlyMap[v] == nil {
|
|
|
- //查询信息
|
|
|
- infoDataList := MC.CrmMysql.SelectBySqlByTx(tx, "SELECT * FROM employ_info WHERE id=?", v)
|
|
|
- if infoDataList != nil && len(*infoDataList) > 0 {
|
|
|
- source_id := common.InterfaceToStr((*infoDataList)[0]["source_id"])
|
|
|
- if onlyMap[source_id] == nil {
|
|
|
- (*infoDataList)[0]["dis_id"] = v
|
|
|
- (*infoDataList)[0]["is_handle"] = 0
|
|
|
- (*infoDataList)[0]["is_ignore"] = 0
|
|
|
- (*infoDataList)[0]["is_dis"] = 0
|
|
|
- (*infoDataList)[0]["is_create_clue"] = 0
|
|
|
- (*infoDataList)[0]["is_create_chance"] = 0
|
|
|
- (*infoDataList)[0]["is_create_custom"] = 0
|
|
|
- (*infoDataList)[0]["create_time"] = time.Now().Format(date.Date_Full_Layout)
|
|
|
- delete((*infoDataList)[0], "id")
|
|
|
- if common.IntAll((*infoDataList)[0]["is_dis"]) != 1 {
|
|
|
- MC.CrmMysql.UpdateByTx(tx, entity.EMPLOY_INFO, map[string]interface{}{
|
|
|
- "id": v,
|
|
|
- }, map[string]interface{}{
|
|
|
- "is_dis": 1,
|
|
|
- "is_handle": 1,
|
|
|
- })
|
|
|
- }
|
|
|
- infoMap[source_id] = (*infoDataList)[0]
|
|
|
- onlyMap[source_id] = v
|
|
|
- } else {
|
|
|
- log.Println(v, "查询不到改收录信息")
|
|
|
- continue
|
|
|
- }
|
|
|
+ //查询信息
|
|
|
+ infoDataList := MC.CrmMysql.SelectBySqlByTx(tx, "SELECT * FROM employ_info WHERE id=?", v)
|
|
|
+ if infoDataList != nil && len(*infoDataList) > 0 {
|
|
|
+ source_id := common.InterfaceToStr((*infoDataList)[0]["source_id"])
|
|
|
+ isOut := common.IntAll((*infoDataList)[0]["is_timeout"]) // 拓普 超时未处理标签
|
|
|
+ //if onlyMap[source_id] == nil {
|
|
|
+ (*infoDataList)[0]["dis_id"] = v
|
|
|
+ (*infoDataList)[0]["is_handle"] = 0
|
|
|
+ (*infoDataList)[0]["is_ignore"] = 0
|
|
|
+ (*infoDataList)[0]["is_dis"] = 0
|
|
|
+ (*infoDataList)[0]["is_create_clue"] = 0
|
|
|
+ (*infoDataList)[0]["is_create_chance"] = 0
|
|
|
+ (*infoDataList)[0]["is_create_custom"] = 0
|
|
|
+ (*infoDataList)[0]["create_time"] = time.Now().Format(date.Date_Full_Layout)
|
|
|
+ delete((*infoDataList)[0], "id")
|
|
|
+ MC.CrmMysql.UpdateByTx(tx, entity.EMPLOY_INFO, map[string]interface{}{
|
|
|
+ "id": v,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "is_dis": 1,
|
|
|
+ "is_handle": 1,
|
|
|
+ "is_timeout": 0,
|
|
|
+ })
|
|
|
+ infoMap[source_id] = (*infoDataList)[0]
|
|
|
+ onlyMap[source_id] = v
|
|
|
+ if isOut == 1 {
|
|
|
+ topMap[source_id] = v
|
|
|
+ topEnt = common.IntAll((*infoDataList)[0]["ent_id"])
|
|
|
+ }
|
|
|
+ //} else {
|
|
|
+ // log.Println(v, "查询不到改收录信息")
|
|
|
+ // continue
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 修改 topnet_info is_timeout
|
|
|
+ if topEnt > 0 && len(topMap) > 0 {
|
|
|
+ for k, _ := range topMap {
|
|
|
+ c := MC.CrmMysql.Count(entity.EMPLOY_INFO, map[string]interface{}{"source_id": k, "is_timeout": 1, "ent_id": topEnt})
|
|
|
+ if c <= 0 {
|
|
|
+ MC.CrmMysql.ExecBySql("UPDATE crm.topnet_info SET is_timeout = 1 WHERE info_id = ?", k)
|
|
|
}
|
|
|
}
|
|
|
}
|