From 3fe00ae3171ac30deef9ec9c020192fde36e2271 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期二, 11 二月 2025 15:15:41 +0800
Subject: [PATCH] 修复托管条件
---
models/accessRegularity.go | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/models/accessRegularity.go b/models/accessRegularity.go
index 26c021d..dfb3986 100644
--- a/models/accessRegularity.go
+++ b/models/accessRegularity.go
@@ -106,11 +106,14 @@
// 鏌ユ壘鎸囧畾鏃堕棿鑼冨洿鍐呭嚭琛岃繃鐨勬。妗堢紪鍙�
now := time.Now()
startDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()).AddDate(0, 0, -m.Duration)
+ endDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
+
err := db.GetDB().Raw(`
SELECT
document_number,
frequent_address,
- community_id
+ community_id,
+ org_id
FROM
snapshot_count_summary
WHERE
@@ -125,10 +128,11 @@
logger.Debugf("task %s base filter result %d", m.Task.Name, len(baseFilter))
esCli := db.GetEsClient()
+ // 璋冪敤es鍒嗘瀽姝や汉鐨勫嚭琛岃寰嬫槸鍚︾鍚堟潯浠讹紝 杩斿洖绗﹀悎鏉′欢鐨勬鏁板拰鏈�鍚庝竴娆$鍚堟潯浠剁殑鏃堕棿
+ sTime := startDate.Format(time.DateTime)
+ eTime := endDate.Format(time.DateTime)
+
for _, p := range baseFilter {
- // 璋冪敤es鍒嗘瀽姝や汉鐨勫嚭琛岃寰嬫槸鍚︾鍚堟潯浠讹紝 杩斿洖绗﹀悎鏉′欢鐨勬鏁板拰鏈�鍚庝竴娆$鍚堟潯浠剁殑鏃堕棿
- sTime := startDate.Format(time.DateTime)
- eTime := time.Now().Format(time.DateTime)
captures, err := service.QueryEsRecord(esCli, sTime, eTime, nil, []interface{}{p.CommunityId}, []string{p.DocumentNumber})
//logger.Debugf("task %s person %s captures %d", m.Task.Name, p.DocumentNumber, len(captures))
@@ -144,7 +148,7 @@
// 鍐欐暟鎹簱
result := &db.ModelTaskResults{
Title: m.Task.Name,
- Event: fmt.Sprintf("%s %d娆�", m.Task.Name, hitCount),
+ Event: fmt.Sprintf("%s - %s 鏃堕棿娈靛唴, %s %d娆�", sTime, eTime, m.Task.Name, hitCount),
ModelID: m.Task.ModelID,
ModelTaskID: m.Task.ID,
CommunityId: p.CommunityId,
@@ -170,7 +174,7 @@
func (m *RegularityModel) Shutdown() error {
// 娓呯悊璧勬簮
- fmt.Println("Shutting down LocationModel Model")
+ fmt.Println("Shutting down accessRegularityS Model")
return nil
}
@@ -192,7 +196,7 @@
for _, record := range records {
// 瑙f瀽鏃堕棿
- t, err := time.Parse(layout, record.PicDate)
+ t, err := time.ParseInLocation(layout, record.PicDate, time.Local)
if err != nil {
fmt.Println("瑙f瀽鏃堕棿澶辫触:", err)
continue
--
Gitblit v1.8.0