|
@@ -8,6 +8,7 @@ import (
|
|
|
"cicv-data-closedloop/common/config/c_log"
|
|
|
commonEntity "cicv-data-closedloop/common/entity"
|
|
|
"cicv-data-closedloop/common/util"
|
|
|
+ "database/sql"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"github.com/gin-gonic/gin"
|
|
@@ -332,7 +333,7 @@ func Report(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
// 查询打分详情
|
|
|
- var detailsResult []string
|
|
|
+ var detailsResult []sql.NullString
|
|
|
selectSql, err := util.ReadFile(c_db.SqlFilesMap["exam-select-details-by-id.sql"])
|
|
|
if err != nil {
|
|
|
c_log.GlobalLogger.Error("读取sql文件报错:", err)
|
|
@@ -352,9 +353,17 @@ func Report(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
details := detailsResult[0]
|
|
|
+ if !details.Valid {
|
|
|
+ c_log.GlobalLogger.Error("未评分完成,无法下载pdf报告:", err)
|
|
|
+ c.JSON(http.StatusBadRequest, commonEntity.Response{
|
|
|
+ Code: 500,
|
|
|
+ Msg: "未评分完成,无法下载pdf报告。",
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
// 解析详情为数组
|
|
|
var detailsDtos []webServerEntity.DetailsDto
|
|
|
- _ = json.Unmarshal([]byte(details), &detailsDtos)
|
|
|
+ _ = json.Unmarshal([]byte(details.String), &detailsDtos)
|
|
|
|
|
|
layout := "2006-01-02 15:04:05"
|
|
|
beginTime, _ := time.Parse(layout, param.BeginTime)
|