|
@@ -1096,7 +1096,8 @@ func GetLzSurveyProductData(cont context.Context) (err error) {
|
|
existList, err := data_manage.GetLzSurveyDataExistByTradeCode(v.SurveyProductId)
|
|
existList, err := data_manage.GetLzSurveyDataExistByTradeCode(v.SurveyProductId)
|
|
existMap := make(map[string]*data_manage.LongzhongSurveyData)
|
|
existMap := make(map[string]*data_manage.LongzhongSurveyData)
|
|
for _, v := range existList {
|
|
for _, v := range existList {
|
|
- existMap[v.DataTime] = v
|
|
+ key := strconv.Itoa(int(v.QuotaSampleId)) + v.DataTime
|
|
|
|
+ existMap[key] = v
|
|
}
|
|
}
|
|
fmt.Println(existMap)
|
|
fmt.Println(existMap)
|
|
pageIndex := 1
|
|
pageIndex := 1
|
|
@@ -1156,12 +1157,14 @@ func GetLzSurveyProductData(cont context.Context) (err error) {
|
|
shouldDateTimeStr := shouldDateTime.Format(utils.FormatDate)
|
|
shouldDateTimeStr := shouldDateTime.Format(utils.FormatDate)
|
|
|
|
|
|
|
|
|
|
-
|
|
+ count, err := models.GetLzSurveyDataCount(v.SurveyProductId, int(v.QuotaSampleId), shouldDateTimeStr)
|
|
-
|
|
+ if err != nil {
|
|
-
|
|
+ msg = "获取隆众调研指标数据失败:err " + err.Error()
|
|
-
|
|
+ return err
|
|
-
|
|
+ }
|
|
- if findItem, ok := existMap[shouldDateTimeStr]; !ok && n.InputValue != "0" {
|
|
+ key := strconv.Itoa(int(v.QuotaSampleId)) + shouldDateTimeStr
|
|
|
|
+ if count <= 0 {
|
|
|
|
+ fmt.Println("not exist:" + key)
|
|
item := new(models.LongzhongSurveyData)
|
|
item := new(models.LongzhongSurveyData)
|
|
item.SurveyProductId = v.SurveyProductId
|
|
item.SurveyProductId = v.SurveyProductId
|
|
item.ProjectQuotaId = n.ProjectQuotaID
|
|
item.ProjectQuotaId = n.ProjectQuotaID
|
|
@@ -1199,11 +1202,58 @@ func GetLzSurveyProductData(cont context.Context) (err error) {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if findItem != nil && findItem.InputValue != n.InputValue && n.InputValue != "0" {
|
|
+ fmt.Println("exist:" + key)
|
|
- models.ModifyLzSurveyData(n.InputValue, findItem.SurveyDataId)
|
|
+ err = models.ModifyLzSurveyDataV1(n.InputValue, int(n.QuotaSampleID), shouldDateTimeStr)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println("ModifyLzSurveyDataV1 Err:" + err.Error())
|
|
}
|
|
}
|
|
- fmt.Println("exist:", shouldDateTimeStr)
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
pageIndex = pageIndex + 1
|
|
pageIndex = pageIndex + 1
|
|
totalPage := utils.PageCount(int(dataList.Response.Total), 100)
|
|
totalPage := utils.PageCount(int(dataList.Response.Total), 100)
|