Browse Source

Merge branch 'dm' of http://8.136.199.33:3000/eta_server/eta_api into dm

kobe6258 1 month ago
parent
commit
ce31ef9ead

+ 6 - 1
controllers/data_manage/edb_info_calculate.go

@@ -1476,7 +1476,12 @@ func (this *EdbInfoController) QueryEdbDataTable() {
 	if edbInfo.Source == utils.DATA_SOURCE_BUSINESS && utils.UseMongo {
 		templateStr = fmt.Sprintf("# 查询条件\nquery = {\"edb_code\": \"%s\"}\n# 排序\nsort = [(\"data_time\", -1)]  # -1 表示降序排列,对应 SQL 的 DESC\nprojection = {\"data_time\": 1, \"value\": 1, \"_id\": 0}  # 只选择data_time和value字段,忽略_id字段\n# 使用 find() 方法获取数据,然后使用 aggregate() 转换为列表\nraw_data = list(collection.find(query, projection).sort(sort))\n# 将结果转换为 DataFrame\nraw = pd.DataFrame(raw_data)\n# 转换data_time字段为本地时区时间\nraw['data_time'] = raw['data_time'].apply(lambda x: x.replace(tzinfo=utc_tz)).dt.tz_convert(local_tz).dt.strftime('%s')", edbInfo.EdbCode, "%Y-%m-%d")
 	} else {
-		templateStr = fmt.Sprintf("sql1 = f\"\"\"SELECT data_time,`value` FROM %s WHERE edb_code = '%s' ORDER BY data_time DESC;\"\"\"\nraw = pandas_fetch_all(sql1, db)", tableName, edbInfo.EdbCode)
+		switch utils.DbDriverName {
+		case `dm`:
+			templateStr = fmt.Sprintf("sql1 = f\"\"\"SELECT data_time,\"value\" FROM %s WHERE edb_code = '%s' ORDER BY data_time DESC;\"\"\"\nraw = pandas_fetch_all(sql1, db)", tableName, edbInfo.EdbCode)
+		default:
+			templateStr = fmt.Sprintf("sql1 = f\"\"\"SELECT data_time,`value` FROM %s WHERE edb_code = '%s' ORDER BY data_time DESC;\"\"\"\nraw = pandas_fetch_all(sql1, db)", tableName, edbInfo.EdbCode)
+		}
 	}
 	info := data_manage.TableInfoResp{
 		ColumnList:  columnList,

+ 5 - 3
models/data_manage/manual_classify.go

@@ -39,8 +39,8 @@ type ManualClassifyList struct {
 	ClassifyId   int
 	ClassifyName string
 	ParentId     int
-	CheckList    []int
-	Child        []*ManualClassifyList
+	CheckList    []int                 `gorm:"-"`
+	Child        []*ManualClassifyList `gorm:"-"`
 }
 
 func GetManualClassifyAll(adminId int) (items []*ManualClassifyList, err error) {
@@ -114,7 +114,9 @@ func GetManualClassifyAllV2() (items []*ManualClassifyList, err error) {
 		if err != nil {
 			return
 		}
-		newItems[i].Child = childItems
+		if childItems != nil && len(childItems) > 0 {
+			newItems[i].Child = childItems
+		}
 	}
 
 	for _, v := range newItems {

+ 2 - 2
models/english_company.go

@@ -33,7 +33,7 @@ type EnglishCompany struct {
 type EnglishCompanyListItem struct {
 	EnglishCompany
 	TodoStatusStr string
-	TodoEndTime   time.Time
+	TodoEndTime   string
 	TodoSellerId  int
 }
 
@@ -145,7 +145,7 @@ IF
 	( ct.status IS NULL, '无任务', ct.status ) AS todo_status_str,
 	ct.seller_id as todo_seller_id,
 IF
-	( ct.end_time IS NULL or ct.status !="进行中", "9999-01-01", ct.end_time) AS todo_end_time
+	( ct.end_time IS NULL or ct.status != '进行中', '9999-01-01', ct.end_time) AS todo_end_time
 FROM
 	english_company AS c
 	LEFT JOIN (

+ 3 - 3
models/english_company_todo.go

@@ -98,7 +98,7 @@ func GetEnglishCompanyTodoById(id int) (item *EnglishCompanyTodo, err error) {
 // GetCountDoingEnglishCompanyTodo 获取正在进行中的任务数量
 func GetCountDoingEnglishCompanyTodo(companyId int) (total int, err error) {
 	var totalNull sql2.NullInt64
-	sql := `SELECT count(1) AS total FROM english_company_todo WHERE status = "进行中" AND company_id = ? AND is_delete = 0 `
+	sql := `SELECT count(1) AS total FROM english_company_todo WHERE status = '进行中' AND company_id = ? AND is_delete = 0 `
 	err = global.DbMap[utils.DbNameReport].Raw(sql, companyId).Scan(&totalNull).Error
 	if err != nil {
 		return
@@ -152,7 +152,7 @@ func GetDoingEnglishCompanyTodoList(companyId int) (items []*EnglishCompanyTodo,
 				english_company_todo a
 			JOIN english_company b ON a.company_id = b.company_id
 			WHERE
-				a.company_id = ? AND a.status = "进行中" AND a.is_delete = 0
+				a.company_id = ? AND a.status = '进行中' AND a.is_delete = 0
 			ORDER BY
 				a.create_time ASC`
 	err = global.DbMap[utils.DbNameReport].Raw(sql, companyId).Find(&items).Error
@@ -237,7 +237,7 @@ func GetEnglishCompanyTodoDoingList(startSize, pageSize int, order string) (tota
 				english_company_todo a
 			JOIN english_company b ON a.company_id = b.company_id
 			WHERE
-				a.status = "进行中" AND a.is_delete = 0 `
+				a.status = '进行中' AND a.is_delete = 0 `
 	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z`
 	var totalNull sql2.NullInt64
 	err = global.DbMap[utils.DbNameReport].Raw(totalSql).Scan(&totalNull).Error

+ 1 - 1
models/report/report_chapter_permission_mapping.go

@@ -9,7 +9,7 @@ import (
 // ReportChapterPermissionMapping
 // @Description: 报告章节的权限关系表
 type ReportChapterPermissionMapping struct {
-	ReportChapterPermissionMappingId int `orm:"column:report_chapter_permission_mapping_id;primaryKey"`
+	ReportChapterPermissionMappingId int `gorm:"column:report_chapter_permission_mapping_id;primaryKey"`
 	ReportChapterId                  int `description:"报告章节的id"` // 报告章节的id
 	ChartPermissionId                int `description:"权限id"`    // 权限id
 	CreateTime                       time.Time

+ 4 - 2
services/english_company_todo.go

@@ -90,9 +90,11 @@ func GetEnglishCompanyListTodoMap(companyList []*models.EnglishCompanyListItem,
 				v.TodoStatus = true
 				v.TodoButtonColor = TodoButtonColorDoing
 				//v.TodoEndTime = td.EndTime
-				v.TodoEndTimeStr = c.TodoEndTime.Format(utils.FormatDate)
+				//v.TodoEndTimeStr = c.TodoEndTime.Format(utils.FormatDate)
+				v.TodoEndTimeStr = c.TodoEndTime
+				currTodoEndTime, _ := time.ParseInLocation(utils.FormatDateTime, c.TodoEndTime, time.Local)
 				// 截止目前还剩余的天数
-				todoEndTime := time.Date(c.TodoEndTime.Year(), c.TodoEndTime.Month(), c.TodoEndTime.Day(), 0, 0, 0, 0, time.Local)
+				todoEndTime := time.Date(currTodoEndTime.Year(), currTodoEndTime.Month(), currTodoEndTime.Day(), 0, 0, 0, 0, time.Local)
 				deadline := int(todoEndTime.Sub(todayTime).Hours() / 24)
 				v.Deadline = strconv.Itoa(deadline)
 			}