feslib

package
v0.0.0-...-85027f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

* Created by 丁德鑫 on 2017/10/9 10:22:07 * ============================================== * 包说明:string、byte之间转换等公共函数 * ============================================== * 南京德睿能源研究院版权所有 * ==============================================

Index

Constants

View Source
const (
	LenVin = 17
)

Variables

This section is empty.

Functions

func ByteToChargeBowStr

func ByteToChargeBowStr(byteBuffer []byte) string

byte格式的充电弓地址解析为字符串,并将结尾连续的空白符去掉

func ByteToCtrlStr

func ByteToCtrlStr(byteBuffer []byte) string

byte格式的站地址解析为字符串,并将结尾连续的空白符去掉

func ByteToUint

func ByteToUint(byteBuffer []byte) uint32

4字节大头byte转为uint32

func ByteToUint16

func ByteToUint16(byteBuffer []byte) uint16

2字节大头byte转为uint16

func ByteToUint16Little

func ByteToUint16Little(byteBuffer []byte) uint16

func CheckCtrlAddrErr

func CheckCtrlAddrErr(ctrladdr string) bool

判断集控地址是否含有非法字符

func CheckCtrladdrValid

func CheckCtrladdrValid(ctrladdr string) bool

func CheckFileIsExist

func CheckFileIsExist(filename string) bool

*

  • 判断文件是否存在 存在返回 true 不存在返回false

func FormatDateTime

func FormatDateTime(timeStr string) string

将2006-01-02T15:04:05.*格式的时间 或者 将2006-01-02 15:04:05.*格式的时间 转为 2006-01-02 15:04:05.000 原因是因为平台返回的时间格式不固定,有的没有毫秒,有的毫秒位数不是3

func FourPrecision

func FourPrecision(i int32) float64

FourPrecision 得到精度为4的double值

func GetCMTimeStrBySec

func GetCMTimeStrBySec(timeInt int64) string

将1970年以来的秒数时间转成直到分的字符串格式 201810241330

func GetCurrentDayStr

func GetCurrentDayStr() string

获取当天的字符串格式

func GetCurrentTimeStr

func GetCurrentTimeStr() string

将获得当前时间转的字符串格式

func GetCurrentTimeStrNoSpace

func GetCurrentTimeStrNoSpace() string

将获得当前时间转的字符串格式,没有空格,因为工作组通知如果有空格,就推不出来

func GetFileSize

func GetFileSize(fileWithPath string) int64

获取单个文件的大小

func GetOffLineDesc

func GetOffLineDesc(exitReason byte) string

GetOffLineDesc 返回退出的原因描述

func GetShortTimeStrBysec

func GetShortTimeStrBysec(timeInt int64) string

获取小时与分 HHMM

func GetSimpleTimeStrByMillsec

func GetSimpleTimeStrByMillsec(timeInt int64) string

将1970年以来的带毫秒的时间转成字符串格式

func GetTimeByMillsec

func GetTimeByMillsec(timeInt int64) time.Time

将1970年以来的带毫秒的时间转成Time类型

func GetTimeByTimeStr

func GetTimeByTimeStr(timeStr string) time.Time

将固定格式的字符串转成对应的Time类型,例如:"2018-07-11 15:45:12"

func GetTimeByTimeStrWithMillsec

func GetTimeByTimeStrWithMillsec(timeStr string) time.Time

将固定格式的字符串(带毫秒)转成对应的Time类型,例如:"2018-07-11 15:45:12.062"

func GetTimeByTimeStrWithMin

func GetTimeByTimeStrWithMin(timeStr string) (time.Time, error)

将固定格式的字符串转成对应的Time类型,例如:"201810231040"

func GetTimeStrByMillsec

func GetTimeStrByMillsec(timeInt int64) string

将1970年以来的带毫秒的时间转成字符串格式

func GetTimeStrBySec

func GetTimeStrBySec(timeInt int64) string

将1970年以来的秒数时间转成字符串格式

func Int64Abs

func Int64Abs(n *int64)

计算绝对值

func IntTo2Bytes

func IntTo2Bytes(n int) []byte

整形转换成2字节

func IntTo2LillteBytes

func IntTo2LillteBytes(n int) []byte

整形转换成小端2字节

func IntToBytes

func IntToBytes(n int) []byte

整形转换成4字节

func IntToBytesLittle

func IntToBytesLittle(n int) []byte

整形转换成4字节

func IsDirExists

func IsDirExists(path string) bool

判断目录是否存在 返回值:true 存在 ; false 不存在

func Log

func Log(v ...interface{})

带时间的打印函数

func Mkdir

func Mkdir(path string) bool

判断目录是否存在 返回值:true 存在 ; false 不存在

func ParseVinValue

func ParseVinValue(data interface{}) error

func SendWorkGroupNotify

func SendWorkGroupNotify(url string, userId string, msg string)

func TwoPrecision

func TwoPrecision(i int32) float64

TwoPrecision 得到精度为2的double值

func UintToByte

func UintToByte(num uint32) []byte

uint32转为4字节小头byte

func VinValidRepair0

func VinValidRepair0(vin string) string

对VIN中非法字符进行替换0处理,位数不足的也补0;空VIN除外

Types

type CtrlInfo

type CtrlInfo struct {
	CtrlAddress  string
	StaID        string //所属电站编号
	StaName      string //所属电站名称
	OperMaintain string //所属运维公司编号
	YWID         string //运维负责人ID
	YWName       string //所属运维公司名称
	YWTel        string //运维负责人电话
	YW           string //运维负责人名称
}

func GetYwTelByCtrlAddr

func GetYwTelByCtrlAddr(url string, ctrList string) ([]CtrlInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL