浏览代码

Merge branch 'CRM6.1' into debug

longyu 3 年之前
父节点
当前提交
c760f3dea9
共有 4 个文件被更改,包括 71 次插入23 次删除
  1. 32 1
      models/roadshow/calendar.go
  2. 20 16
      services/data/edb_info.go
  3. 2 1
      services/data_source_longzhong.go
  4. 17 5
      services/roadshow/calendar.go

+ 32 - 1
models/roadshow/calendar.go

@@ -25,7 +25,7 @@ type RsCalendarResearcher struct {
 }
 
 func GetRsCalendarResearcher(endDate, endTime string) (list []*RsCalendarResearcher, err error) {
-	sql := `SELECT * FROM rs_calendar_researcher WHERE status<>6 AND end_date=? AND end_time<=? `
+	sql := `SELECT * FROM rs_calendar_researcher WHERE status=1 AND status<>6 AND end_date=? AND end_time<=? `
 	o := orm.NewOrm()
 	_, err = o.Raw(sql, endDate, endTime).QueryRows(&list)
 	return
@@ -37,3 +37,34 @@ func ModifyRsCalendarResearcherStatus(rsCalendarResearcherId int) (err error) {
 	_, err = o.Raw(sql, rsCalendarResearcherId).Exec()
 	return
 }
+
+type RsMatters struct {
+	RsMattersId     int       `orm:"column(rs_matters_id);pk"`
+	SysUserId       int       `description:"添加事项人id"`
+	SysUserRealName string    `description:"创建人姓名"`
+	StartDate       string    `description:"开始日期"`
+	EndDate         string    `description:"结束日期"`
+	StartTime       string    `description:"开始时间"`
+	EndTime         string    `description:"结束时间"`
+	StartWeek       string    `description:"开始日期周"`
+	EndWeek         string    `description:"结束日期周"`
+	MatterContent   string    `description:"事项内容"`
+	Status          int8      `description:"状态:1:进行中,6:已结束"`
+	CreateTime      time.Time `description:"创建时间"`
+	ModifyTime      time.Time `description:"修改时间"`
+	IsSynced        int       `description:"是否与上海同步 0:未同步 1:已同步"`
+}
+
+func GetRsMatters(endDate, endTime string) (list []*RsMatters, err error) {
+	sql := `SELECT * FROM rs_matters WHERE status<>6 AND end_date=? AND end_time<=? `
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, endDate, endTime).QueryRows(&list)
+	return
+}
+
+func ModifyRsMattersStatus(rsMattersId int) (err error) {
+	sql := ` UPDATE rs_matters SET status=6,modify_time=NOW() WHERE rs_matters_id=? `
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, rsMattersId).Exec()
+	return
+}

+ 20 - 16
services/data/edb_info.go

@@ -195,10 +195,11 @@ func CheckDataInterface(cont context.Context) (err error) {
 			body, err := http.Get(checkUrl)
 			if err != nil {
 				go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "CheckDataInterface ErrMsg:"+err.Error(), utils.EmailSendToUsers)
-			}
-			result := string(body)
-			if result != "1" {
-				go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "CheckDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+			} else {
+				result := string(body)
+				if result != "1" {
+					go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "CheckDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+				}
 			}
 		}
 
@@ -208,10 +209,11 @@ func CheckDataInterface(cont context.Context) (err error) {
 			body, err := http.Get(checkUrl2)
 			if err != nil {
 				go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测服务器数据接口:失败提醒", "CheckDataInterface ErrMsg:"+err.Error(), utils.EmailSendToUsers)
-			}
-			result := string(body)
-			if result != "1" {
-				go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测服务器数据接口:失败提醒", "CheckDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+			} else {
+				result := string(body)
+				if result != "1" {
+					go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测服务器数据接口:失败提醒", "CheckDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+				}
 			}
 		}
 	}()
@@ -224,10 +226,11 @@ func CheckPbDataInterface(cont context.Context) (err error) {
 		body, err := http.Get(checkUrl)
 		if err != nil {
 			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "CheckPbDataInterface ErrMsg:"+err.Error(), utils.EmailSendToUsers)
-		}
-		result := string(body)
-		if result != "1" {
-			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "CheckPbDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+		} else {
+			result := string(body)
+			if result != "1" {
+				go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "CheckPbDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+			}
 		}
 	}()
 	return
@@ -240,10 +243,11 @@ func CheckLtDataInterface(cont context.Context) (err error) {
 		body, err := http.Get(checkUrl)
 		if err != nil {
 			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:"+err.Error(), utils.EmailSendToUsers)
-		}
-		result := string(body)
-		if result != `"ek true"` {
-			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+		} else {
+			result := string(body)
+			if result != `"ek true"` {
+				go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+			}
 		}
 	}()
 	return

+ 2 - 1
services/data_source_longzhong.go

@@ -1122,8 +1122,9 @@ func GetLzSurveyProductData(cont context.Context) (err error) {
 				msg = "获取隆众调研指标数据失败:Err" + err.Error()
 				return err
 			}
+			utils.FileLogLz.Info("GetLzSurveyProductData:" + string(body))
+			fmt.Println("result:"+string(body))
 			if !strings.Contains(string(body), "<html>") {
-				utils.FileLogLz.Info("GetLzSurveyProductData:" + string(body))
 				dataList := new(models.LzSurveyData)
 				err = json.Unmarshal(body, &dataList)
 				if err != nil {

+ 17 - 5
services/roadshow/calendar.go

@@ -2,27 +2,39 @@ package roadshow
 
 import (
 	"context"
-	"fmt"
 	"hongze/hongze_task/models/roadshow"
 	"hongze/hongze_task/utils"
+	"sync"
 	"time"
 )
 
+var lock sync.Mutex
+
 func ModifyRsCalendarResearcherStatus(cont context.Context) (err error) {
+	lock.Lock()
 	nowDate := time.Now().Format(utils.FormatDate)
 	nowTime := time.Now().Format(utils.FormatTime)
-	fmt.Println(nowDate,nowTime)
 	list, err := roadshow.GetRsCalendarResearcher(nowDate, nowTime)
 	if err != nil {
-		fmt.Println("GetRsCalendarResearcher Err:" + err.Error())
 		return err
 	}
 	for _, v := range list {
 		err = roadshow.ModifyRsCalendarResearcherStatus(v.RsCalendarResearcherId)
 		if err != nil {
-			fmt.Println("GetRsCalendarResearcher Err:" + err.Error())
 			return err
 		}
 	}
+
+	mattersList, err := roadshow.GetRsMatters(nowDate, nowTime)
+	if err != nil {
+		return err
+	}
+	for _, v := range mattersList {
+		err = roadshow.ModifyRsMattersStatus(v.RsMattersId)
+		if err != nil {
+			return err
+		}
+	}
+	lock.Unlock()
 	return err
-}
+}