浏览代码

报表统计

xyxie 1 天之前
父节点
当前提交
6b86d20073
共有 2 个文件被更改,包括 12 次插入3 次删除
  1. 10 1
      services/data/base_edb_lib.go
  2. 2 2
      services/edb_inspection.go

+ 10 - 1
services/data/base_edb_lib.go

@@ -143,7 +143,16 @@ func postRefreshEdbData(param map[string]interface{}, urlStr string) (resp *mode
 
 
 // SetEdbSourceStat 指标终端更新情况定时汇总
 // SetEdbSourceStat 指标终端更新情况定时汇总
 func SetEdbSourceStat() (resp *models.BaseResponse, err error) {
 func SetEdbSourceStat() (resp *models.BaseResponse, err error) {
-	postUrl := utils.EDB_LIB_URL + "edb_stat/source_update"
+	var postUrl string
+	edbLibUrlListLen := len(utils.EDB_LIB_URL_LIST)
+	if edbLibUrlListLen <= 0 {
+		postUrl = utils.EDB_LIB_URL
+	} else {
+		rn := step % edbLibUrlListLen
+		postUrl = utils.EDB_LIB_URL_LIST[rn].Url
+	}
+	postUrl = postUrl + "edb_stat/source_update"
+	step++
 	result, err := HttpPost(postUrl, "", "application/json")
 	result, err := HttpPost(postUrl, "", "application/json")
 	if err != nil {
 	if err != nil {
 		return
 		return

+ 2 - 2
services/edb_inspection.go

@@ -221,7 +221,7 @@ func AddEdbInspectionRecord(cont context.Context) (err error) {
 				config.Source, config.TerminalCode, err))
 				config.Source, config.TerminalCode, err))
 			continue
 			continue
 		}
 		}
-		if dashboard == nil {
+		if tempErr != nil && utils.IsErrNoRow(tempErr) {
 			dashboard = &edb_inspection.EdbInspectionDashboard{
 			dashboard = &edb_inspection.EdbInspectionDashboard{
 				Source:             config.Source,
 				Source:             config.Source,
 				TerminalCode:       config.TerminalCode,
 				TerminalCode:       config.TerminalCode,
@@ -238,7 +238,7 @@ func AddEdbInspectionRecord(cont context.Context) (err error) {
 					record.InspectionRecordId, err))
 					record.InspectionRecordId, err))
 				continue
 				continue
 			}
 			}
-		} else {
+		} else if tempErr == nil && dashboard.DashboardId > 0 {
 			dashboard.InspectionRecordId = record.InspectionRecordId
 			dashboard.InspectionRecordId = record.InspectionRecordId
 			dashboard.InspectionTime = now
 			dashboard.InspectionTime = now
 			dashboard.InspectionResult = record.InspectionResult
 			dashboard.InspectionResult = record.InspectionResult