作者 yangfu

fix: 配置修改

... ... @@ -97,7 +97,7 @@ spec:
- name: HTTP_PORT
value: "8082"
- name: SERVICE_ENV
value: "dev"
value: "test"
- name: SUPLUS_ADMIN_BASE_HOST
value: "http://suplus-admin-base-dev.fjmaimaimai.com"
- name: ALLIED_CREATION_GATEWAY_HOST
... ...
... ... @@ -79,30 +79,30 @@ func (deviceCollectionService *DeviceCollectionService) CreateDeviceCollection(c
}
//处理设备数据
switch deviceCollection.DeviceType {
case domain.DeviceTypeBaoXianJi, domain.DeviceTypeChuanChuanJi, domain.DeviceTypeFengKouJi, domain.DeviceTypeFengXiangJi:
if v, ok := deviceCollection.Values["count"]; ok {
curCount, errCurCount := strconv.Atoi(fmt.Sprintf("%v", v))
v, ok = lastDeviceCollectionRecord.Values["count"]
if ok {
lastCount, errLastCount := strconv.Atoi(fmt.Sprintf("%v", v))
if errLastCount == nil && errCurCount == nil && lastCount <= curCount {
deviceCollection.Values["count"] = curCount - lastCount
} else {
deviceCollection.Values["count"] = 0
/*
设备统计的数量超过一定范围会重置为0,特殊处理0操作
*/
if lastCount > 10000000 && curCount < 1000 {
deviceCollection.Values["count"] = curCount
}
}
//switch deviceCollection.DeviceType {
//case domain.DeviceTypeBaoXianJi, domain.DeviceTypeChuanChuanJi, domain.DeviceTypeFengKouJi, domain.DeviceTypeFengXiangJi:
if v, ok := deviceCollection.Values["count"]; ok {
curCount, errCurCount := strconv.Atoi(fmt.Sprintf("%v", v))
v, ok = lastDeviceCollectionRecord.Values["count"]
if ok {
lastCount, errLastCount := strconv.Atoi(fmt.Sprintf("%v", v))
if errLastCount == nil && errCurCount == nil && lastCount <= curCount {
deviceCollection.Values["count"] = curCount - lastCount
} else {
deviceCollection.Values["count"] = 0
/*
设备统计的数量超过一定范围会重置为0,特殊处理0操作
*/
if lastCount > 10000000 && curCount < 1000 {
deviceCollection.Values["count"] = curCount
}
}
} else {
deviceCollection.Values["count"] = 0
}
break
}
// break
//}
err = domainService.SendWorkshopDeviceData(deviceCollection)
if err != nil {
log.Logger.Error("车间设备数据加入redis失败:" + err.Error())
... ...