sync: 同步 v1.0.4 并脱敏配置与镜像
This commit is contained in:
@@ -3,6 +3,7 @@ package batchimport
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/batchmetadata"
|
||||
@@ -12,7 +13,6 @@ import (
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/hash"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/iot_excelize"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -255,6 +255,9 @@ func saveBatchAndExecute(ctx context.Context, req *SubmitRequest, p Processor, r
|
||||
if failReason == "" && result.ErrorRows > 0 {
|
||||
failReason = "存在校验失败数据,本次未写入"
|
||||
}
|
||||
if result.ImportStatus == consts.ImportStatusFailed && result.ErrorRows > 0 {
|
||||
markValidRowsNotExecuted(rows)
|
||||
}
|
||||
|
||||
batchType := batchTypeByImportStatus(req, p, result.ImportStatus)
|
||||
result.BatchType = batchType
|
||||
@@ -575,7 +578,29 @@ func batchTypeByImportStatus(req *SubmitRequest, p Processor, importStatus strin
|
||||
return p.Config().BatchType
|
||||
}
|
||||
|
||||
const NotExecutedReasonPrefix = "\u672c\u6279\u5b58\u5728\u6821\u9a8c\u5931\u8d25\uff0c\u6574\u6279\u672a\u6267\u884c\uff1a"
|
||||
|
||||
func markValidRowsNotExecuted(rows []Row) {
|
||||
for _, row := range rows {
|
||||
if row != nil && len(row.GetErrorReasons()) == 0 {
|
||||
row.AddErrorReason(NotExecutedReasonPrefix + "\u672c\u5361\u6821\u9a8c\u901a\u8fc7")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func IsNotExecuted(row Row) bool {
|
||||
for _, reason := range row.GetErrorReasons() {
|
||||
if strings.HasPrefix(reason, NotExecutedReasonPrefix) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func detailStatus(row Row) int {
|
||||
if IsNotExecuted(row) {
|
||||
return consts.BatchDetailStatusNotExecuted
|
||||
}
|
||||
if len(row.GetErrorReasons()) > 0 {
|
||||
return consts.BatchDetailStatusFailed
|
||||
}
|
||||
@@ -583,6 +608,9 @@ func detailStatus(row Row) int {
|
||||
}
|
||||
|
||||
func displayRowStatus(row Row) string {
|
||||
if IsNotExecuted(row) {
|
||||
return "未执行"
|
||||
}
|
||||
if len(row.GetErrorReasons()) > 0 {
|
||||
return "失败"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user