LingxinMeng 11 månader sedan
förälder
incheckning
79c5d1ea6e
2 ändrade filer med 11 tillägg och 4 borttagningar
  1. 5 4
      amd64/score_server/handler/h_collect_limit.go
  2. 6 0
      common/util/u_string.go

+ 5 - 4
amd64/score_server/handler/h_collect_limit.go

@@ -4,6 +4,7 @@ import (
 	"cicv-data-closedloop/amd64/score_server/dao/mapper"
 	"cicv-data-closedloop/common/config/c_log"
 	commonEntity "cicv-data-closedloop/common/entity"
+	"cicv-data-closedloop/common/util"
 	"github.com/gin-gonic/gin"
 	"net/http"
 	"sync"
@@ -35,10 +36,10 @@ func TriggerCollect(c *gin.Context) {
 	collectLimitPo := mapper.SelectFromCollectLimitBySnCode(param.SnCode)
 	c_log.GlobalLogger.Info("数据库记录为:", collectLimitPo)
 	// 2 将查出的数据与参数中的限额数进行对比,判断是否允许采集,如果允许,则返回 code 200
-	if collectLimitPo.YearCollectedNumber < param.CollectLimitYear {
-		if collectLimitPo.MonthCollectedNumber < param.CollectLimitMonth {
-			if collectLimitPo.WeekCollectedNumber < param.CollectLimitWeek {
-				if collectLimitPo.DayCollectedNumber < param.CollectLimitDay {
+	if util.StringToInt(collectLimitPo.YearCollectedNumber) < util.StringToInt(param.CollectLimitYear) {
+		if util.StringToInt(collectLimitPo.MonthCollectedNumber) < util.StringToInt(param.CollectLimitMonth) {
+			if util.StringToInt(collectLimitPo.WeekCollectedNumber) < util.StringToInt(param.CollectLimitWeek) {
+				if util.StringToInt(collectLimitPo.DayCollectedNumber) < util.StringToInt(param.CollectLimitDay) {
 					// 所有值添加一
 					mapper.UpdateCollectLimit(param.SnCode)
 					// 返回允许信号

+ 6 - 0
common/util/u_string.go

@@ -3,6 +3,7 @@ package util
 import (
 	"fmt"
 	"github.com/google/uuid"
+	"strconv"
 )
 
 func ToString(value interface{}) string {
@@ -15,3 +16,8 @@ func NewUUID() string {
 func NewShortUUID() string {
 	return uuid.New().String()[:8]
 }
+
+func StringToInt(str string) int {
+	intVal, _ := strconv.Atoi(str)
+	return intVal
+}