|
@@ -5,9 +5,7 @@ import (
|
|
|
"GtDataStore/app/cmd/organization/internal/svc"
|
|
|
"GtDataStore/app/model"
|
|
|
"context"
|
|
|
- "fmt"
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
- "strconv"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -33,7 +31,7 @@ func DeviceUf(ctx context.Context, task *job.Task, technologyName string) error
|
|
|
//wg.Wait()
|
|
|
|
|
|
// 3. 转换为存储对象
|
|
|
- workings, err := transDeviceUfData(task.Job.SvcCtx, devices)
|
|
|
+ workings, err := transDeviceUfData(devices)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -58,17 +56,10 @@ func findDeviceUf(svcCtx *svc.ServiceContext, projectId int64) ([]model.DcDevice
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func transDeviceUfData(svcCtx *svc.ServiceContext, datas []model.DcDeviceBind) ([]model.DcWorkingUf, error) {
|
|
|
+func transDeviceUfData(datas []model.DcDeviceBind) ([]model.DcWorkingUf, error) {
|
|
|
ts := make([]model.DcWorkingUf, len(datas))
|
|
|
|
|
|
for i, data := range datas {
|
|
|
- var filterCycleAdjust int64 = 0
|
|
|
-
|
|
|
- key := fmt.Sprintf("events:adjust:%d:%s:%s:%s", data.ProjectId, data.DeviceCode, "filter_cycle", "")
|
|
|
- if adjustString, err := svcCtx.Cache.Get(key); err == nil && adjustString != "" {
|
|
|
- filterCycleAdjust, _ = strconv.ParseInt(adjustString, 10, 64)
|
|
|
- }
|
|
|
-
|
|
|
ts[i] = model.DcWorkingUf{
|
|
|
ProjectId: data.ProjectId,
|
|
|
DeviceCode: data.DeviceCode,
|
|
@@ -99,7 +90,7 @@ func transDeviceUfData(svcCtx *svc.ServiceContext, datas []model.DcDeviceBind) (
|
|
|
ProductWqP: data.Items.GetItemFloat64Value("product_wq_p"),
|
|
|
Step: data.Items.GetItemInt64Value("step"),
|
|
|
FilterTime: data.Items.GetItemFloat64Value("filter_time"),
|
|
|
- FilterCycle: data.Items.GetItemInt64Value("filter_cycle") + filterCycleAdjust,
|
|
|
+ FilterCycle: data.Items.GetItemInt64Value("filter_cycle"),
|
|
|
CTime: time.Now(),
|
|
|
}
|
|
|
}
|