|
@@ -245,18 +245,8 @@ func (service *DeduplicationService) DataDeduplicateAndSave(data *deduplication.
|
|
|
infoIdList := strings.Split(data.InfoId, ",")
|
|
|
totalInfoCount := len(infoIdList)
|
|
|
err := orm.Table(tableName).Cols("info_id").Where(selectSql, valueList...).Find(&rs)
|
|
|
- existIdList := []string{}
|
|
|
- existIdMap := map[string]bool{}
|
|
|
- for _, v := range rs {
|
|
|
- existIdMap[v.InfoId] = true
|
|
|
- if existIdMap[v.InfoId] {
|
|
|
- continue
|
|
|
- }else {
|
|
|
- existIdList = append(existIdList,v.InfoId)
|
|
|
- }
|
|
|
- }
|
|
|
- count := len(existIdList)
|
|
|
- log.Println(count, "已存在数据量")
|
|
|
+ //existIdList := []string{}
|
|
|
+
|
|
|
if err != nil {
|
|
|
log.Println(err, "判重查询失败")
|
|
|
return &deduplication.Info{
|
|
@@ -266,10 +256,15 @@ func (service *DeduplicationService) DataDeduplicateAndSave(data *deduplication.
|
|
|
}, "判重查询失败"
|
|
|
}
|
|
|
|
|
|
- //
|
|
|
- //for _, v := range rs {
|
|
|
- //
|
|
|
- //}
|
|
|
+
|
|
|
+ existIdMap := map[string]bool{}
|
|
|
+ for _, v := range rs {
|
|
|
+ existIdMap[v.InfoId] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ count := len(existIdMap)
|
|
|
+ log.Println(count, "已存在数据量")
|
|
|
+
|
|
|
// 新增
|
|
|
var insertList []entity.Deduplication
|
|
|
for _, id := range infoIdList {
|
|
@@ -288,6 +283,8 @@ func (service *DeduplicationService) DataDeduplicateAndSave(data *deduplication.
|
|
|
insertList = append(insertList, temData)
|
|
|
|
|
|
}
|
|
|
+ log.Println(totalInfoCount,count,"88888888")
|
|
|
+ log.Println(len(insertList))
|
|
|
go SaveMysql(tableName,insertList)
|
|
|
return &deduplication.Info{
|
|
|
TotalCount: int64(totalInfoCount),
|