1
0

merge: 合并代码

This commit is contained in:
TsMask
2024-04-30 20:37:27 +08:00
parent 78bd110b03
commit 3cc193f57d
95 changed files with 3028 additions and 1519 deletions

View File

@@ -39,6 +39,7 @@ type SysJobLogController struct {
//
// GET /list
func (s *SysJobLogController) List(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询参数转换map
querys := ctx.QueryMap(c)
// 任务ID优先级更高
@@ -47,11 +48,15 @@ func (s *SysJobLogController) List(c *gin.Context) {
querys["jobName"] = jobInfo.JobName
querys["jobGroup"] = jobInfo.JobGroup
}
data := s.sysJobLogService.SelectJobLogPage(querys)
// 多语言值转key查询
if v, ok := querys["jobName"]; ok && v != "" {
querys["jobName"] = i18n.TFindKeyPrefix(language, "job", v.(string))
}
data := s.sysJobLogService.SelectJobLogPage(querys)
rows := data["rows"].([]model.SysJobLog)
// 闭包函数处理多语言
language := ctx.AcceptLanguage(c)
converI18n := func(language string, arr *[]model.SysJobLog) {
for i := range *arr {
(*arr)[i].JobName = i18n.TKey(language, (*arr)[i].JobName)
@@ -124,17 +129,24 @@ func (s *SysJobLogController) Clean(c *gin.Context) {
//
// POST /export
func (s *SysJobLogController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
querys := ctx.BodyJSONMap(c)
data := s.sysJobLogService.SelectJobLogPage(querys)
if data["total"].(int64) == 0 {
c.JSON(200, result.ErrMsg("Export data record is empty"))
// querys := ctx.BodyJSONMap(c)
// data := s.sysJobLogService.SelectJobLogPage(querys)
// if data["total"].(int64) == 0 {
// c.JSON(200, result.ErrMsg("Export data record is empty"))
// return
// }
// rows := data["rows"].([]model.SysJobLog)
rows := s.sysJobLogService.SelectJobLogList(model.SysJobLog{})
if len(rows) <= 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return
}
rows := data["rows"].([]model.SysJobLog)
// 闭包函数处理多语言
language := ctx.AcceptLanguage(c)
converI18n := func(language string, arr *[]model.SysJobLog) {
for i := range *arr {
(*arr)[i].JobName = i18n.TKey(language, (*arr)[i].JobName)
@@ -150,10 +162,11 @@ func (s *SysJobLogController) Export(c *gin.Context) {
"B1": i18n.TKey(language, "job.export.jobName"),
"C1": i18n.TKey(language, "job.export.jobGroupName"),
"D1": i18n.TKey(language, "job.export.invokeTarget"),
"E1": i18n.TKey(language, "job.export.targetParams"),
"F1": i18n.TKey(language, "job.export.jobID"),
"G1": i18n.TKey(language, "job.export.jobLogStatus"),
"H1": i18n.TKey(language, "job.export.jobLogTime"),
// "E1": i18n.TKey(language, "job.export.targetParams"),
// "F1": i18n.TKey(language, "job.export.jobID"),
"E1": i18n.TKey(language, "job.export.jobLogStatus"),
"F1": i18n.TKey(language, "job.export.jobLogTime"),
"G1": i18n.TKey(language, "log.operate.export.costTime"),
}
// 读取任务组名字典数据
dictSysJobGroup := s.sysDictDataService.SelectDictDataByType("sys_job_group")
@@ -179,10 +192,11 @@ func (s *SysJobLogController) Export(c *gin.Context) {
"B" + idx: row.JobName,
"C" + idx: sysJobGroup,
"D" + idx: row.InvokeTarget,
"E" + idx: row.TargetParams,
"F" + idx: row.JobMsg,
"G" + idx: statusValue,
"H" + idx: date.ParseDateToStr(row.CreateTime, date.YYYY_MM_DD_HH_MM_SS),
// "E" + idx: row.TargetParams,
// "F" + idx: row.JobMsg,
"E" + idx: statusValue,
"F" + idx: date.ParseDateToStr(row.CreateTime, date.YYYY_MM_DD_HH_MM_SS),
"G" + idx: row.CostTime,
})
}