1、增加多模态数据融合功能
This commit is contained in:
parent
e5c0984c00
commit
7451a0cc62
|
@ -206,6 +206,29 @@ func (s HandlerService) GetProjectResult(c *gin.Context) (data interface{}, err
|
||||||
go s.SaveLog("获取项目检测结果", "Manage", "", "", "", fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
go s.SaveLog("获取项目检测结果", "Manage", "", "", "", fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func (s HandlerService) GetProjectData(c *gin.Context) (data interface{}, err error) {
|
||||||
|
repo := service.NewManageService(s.AppConfig, s.Engine, s.Logger)
|
||||||
|
us, _ := c.Get("operatorUser")
|
||||||
|
userInfo := us.(*model.SystemUser)
|
||||||
|
var req proto.ProjectDataRequest
|
||||||
|
err = c.ShouldBindJSON(&req)
|
||||||
|
if err != nil {
|
||||||
|
go s.SaveLog("GetProjectData", "Manage", "", "", ToString(req), fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
||||||
|
return nil, e.NewValidErr(err)
|
||||||
|
}
|
||||||
|
if req.Size < 1 {
|
||||||
|
req.Size = 20
|
||||||
|
}
|
||||||
|
if req.Size > 100 {
|
||||||
|
req.Size = 100
|
||||||
|
}
|
||||||
|
if req.Page < 1 {
|
||||||
|
req.Page = 1
|
||||||
|
}
|
||||||
|
data, err = repo.GetProjectData(c, req)
|
||||||
|
go s.SaveLog("获取项目数据", "Manage", "", "", "", fmt.Sprintf("%d", userInfo.UserId), c.Request.RemoteAddr, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (s HandlerService) ProductList(c *gin.Context) (data interface{}, err error) {
|
func (s HandlerService) ProductList(c *gin.Context) (data interface{}, err error) {
|
||||||
repo := service.NewManageService(s.AppConfig, s.Engine, s.Logger)
|
repo := service.NewManageService(s.AppConfig, s.Engine, s.Logger)
|
||||||
|
|
|
@ -131,6 +131,15 @@ func (p ProjectRequest) ToString() string {
|
||||||
return string(data)
|
return string(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProjectDataRequest struct {
|
||||||
|
ProjectId int64 `json:"projectId"`
|
||||||
|
LineNum int `json:"lineNum"`
|
||||||
|
KPileStart string `json:"kPileStart"`
|
||||||
|
KPileEnd string `json:"kPileEnd"`
|
||||||
|
FileType int `json:"fileType"`
|
||||||
|
BasePageList
|
||||||
|
}
|
||||||
|
|
||||||
type ProjectItemRequest struct {
|
type ProjectItemRequest struct {
|
||||||
ProjectId int64 `json:"projectId"`
|
ProjectId int64 `json:"projectId"`
|
||||||
ProjectName string `json:"projectName"`
|
ProjectName string `json:"projectName"`
|
||||||
|
|
|
@ -273,3 +273,18 @@ type TrainTaskInfoItem struct {
|
||||||
CreateAt int64 `json:"createAt"`
|
CreateAt int64 `json:"createAt"`
|
||||||
UpdateAt int64 `json:"updateAt"`
|
UpdateAt int64 `json:"updateAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProjectSrcFile struct {
|
||||||
|
FileId int64 `json:"fileId"`
|
||||||
|
FileName string `json:"fileName"`
|
||||||
|
FileType int `json:"fileType"`
|
||||||
|
MilepostNumber string `json:"milepostNumber"`
|
||||||
|
AccessUrl string `json:"accessUrl"`
|
||||||
|
UpDown string `json:"upDown"`
|
||||||
|
LineNum int `json:"lineNum"`
|
||||||
|
Longitude float64 `json:"longitude"`
|
||||||
|
Latitude float64 `json:"latitude"`
|
||||||
|
SrcImg string `json:"srcImg"`
|
||||||
|
CreateAt int64 `json:"createAt"`
|
||||||
|
UpdateAt int64 `json:"updateAt"`
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ func InitRouter(cfg *config.WebConfig, logger *logging.Logger, engine *xorm.Engi
|
||||||
project.POST("/edit", e.ErrorWrapper(hs.EditProject))
|
project.POST("/edit", e.ErrorWrapper(hs.EditProject))
|
||||||
project.POST("/delete", e.ErrorWrapper(hs.DelProject))
|
project.POST("/delete", e.ErrorWrapper(hs.DelProject))
|
||||||
project.POST("/result", e.ErrorWrapper(hs.GetProjectResult))
|
project.POST("/result", e.ErrorWrapper(hs.GetProjectResult))
|
||||||
|
project.POST("/data", e.ErrorWrapper(hs.GetProjectData))
|
||||||
|
|
||||||
}
|
}
|
||||||
product := manage.Group("/product")
|
product := manage.Group("/product")
|
||||||
|
|
|
@ -29,6 +29,7 @@ type ManageService interface {
|
||||||
EditProject(ctx context.Context, req proto.ProjectItemRequest) (rsp *proto.BaseResponse, err error)
|
EditProject(ctx context.Context, req proto.ProjectItemRequest) (rsp *proto.BaseResponse, err error)
|
||||||
DelProject(ctx context.Context, req proto.ProjectItemRequest) (rsp *proto.BaseResponse, err error)
|
DelProject(ctx context.Context, req proto.ProjectItemRequest) (rsp *proto.BaseResponse, err error)
|
||||||
GetProjectResult(ctx context.Context, req proto.ProjectRequest) (rsp *proto.BaseResponse, err error)
|
GetProjectResult(ctx context.Context, req proto.ProjectRequest) (rsp *proto.BaseResponse, err error)
|
||||||
|
GetProjectData(ctx context.Context, req proto.ProjectDataRequest) (rsp *proto.BaseResponse, err error)
|
||||||
|
|
||||||
ProductList(ctx context.Context, req proto.ProductRequest) (rsp *proto.BaseResponse, err error)
|
ProductList(ctx context.Context, req proto.ProductRequest) (rsp *proto.BaseResponse, err error)
|
||||||
GetProductInfo(ctx context.Context, req proto.ProductItemRequest) (rsp *proto.BaseResponse, err error)
|
GetProductInfo(ctx context.Context, req proto.ProductItemRequest) (rsp *proto.BaseResponse, err error)
|
||||||
|
@ -645,7 +646,78 @@ ReturnPoint:
|
||||||
}
|
}
|
||||||
return rsp, err
|
return rsp, err
|
||||||
}
|
}
|
||||||
|
func (rp *repo) GetProjectData(ctx context.Context, req proto.ProjectDataRequest) (rsp *proto.BaseResponse, err error) {
|
||||||
|
rsp = new(proto.BaseResponse)
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
err = fmt.Errorf("超时/取消")
|
||||||
|
rsp.Code = http.StatusInternalServerError
|
||||||
|
rsp.Status = http.StatusText(http.StatusInternalServerError)
|
||||||
|
rsp.Message = "超时/取消"
|
||||||
|
rsp.Err = ctx.Err()
|
||||||
|
return rsp, ctx.Err()
|
||||||
|
default:
|
||||||
|
var (
|
||||||
|
count int64
|
||||||
|
)
|
||||||
|
srcList := make([]model.FileManager, 0)
|
||||||
|
dataset := make([]int64, 0)
|
||||||
|
err = rp.engine.SQL("select dataset_id from dataset where project_id = ?", req.ProjectId).Find(&dataset)
|
||||||
|
if err != nil {
|
||||||
|
goto ReturnPoint
|
||||||
|
}
|
||||||
|
sess := rp.engine.In("dataset_id", dataset)
|
||||||
|
if len(req.KPileStart) > 0 {
|
||||||
|
sess = sess.And("milepost_number >= ?", req.KPileStart)
|
||||||
|
}
|
||||||
|
if len(req.KPileEnd) > 0 {
|
||||||
|
sess = sess.And("milepost_number <= ?", req.KPileEnd)
|
||||||
|
}
|
||||||
|
if req.FileType > 0 {
|
||||||
|
sess = sess.And("file_type = ?", req.FileType)
|
||||||
|
}
|
||||||
|
count, err = sess.Limit(int(req.Size), int(((req.Page)-1)*req.Size)).Asc("create_at").
|
||||||
|
FindAndCount(&srcList)
|
||||||
|
if err != nil {
|
||||||
|
goto ReturnPoint
|
||||||
|
}
|
||||||
|
list := make([]proto.ProjectSrcFile, len(srcList))
|
||||||
|
for k, v := range srcList {
|
||||||
|
upDown := "上行"
|
||||||
|
if v.UpDown == 1 {
|
||||||
|
upDown = "下行"
|
||||||
|
}
|
||||||
|
list[k] = proto.ProjectSrcFile{
|
||||||
|
FileId: v.FileId,
|
||||||
|
FileName: v.FileName,
|
||||||
|
FileType: v.FileType,
|
||||||
|
MilepostNumber: v.MilepostNumber,
|
||||||
|
AccessUrl: v.AccessUrl,
|
||||||
|
UpDown: upDown,
|
||||||
|
LineNum: v.LineNum,
|
||||||
|
Longitude: v.Longitude,
|
||||||
|
Latitude: v.Latitude,
|
||||||
|
CreateAt: v.CreateAt,
|
||||||
|
UpdateAt: v.UpdateAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rsp.Code = http.StatusOK
|
||||||
|
rsp.Status = http.StatusText(http.StatusOK)
|
||||||
|
rsp.Message = "成功"
|
||||||
|
rsp = FillPaging(count, req.Page, req.Size, list, rsp)
|
||||||
|
rsp.Err = err
|
||||||
|
return rsp, err
|
||||||
|
}
|
||||||
|
ReturnPoint:
|
||||||
|
if err != nil {
|
||||||
|
rsp.Code = http.StatusInternalServerError
|
||||||
|
rsp.Status = http.StatusText(http.StatusInternalServerError)
|
||||||
|
rsp.Err = err
|
||||||
|
rsp.Message = "失败"
|
||||||
|
}
|
||||||
|
return rsp, err
|
||||||
|
}
|
||||||
func (rp *repo) ProductList(ctx context.Context, req proto.ProductRequest) (rsp *proto.BaseResponse, err error) {
|
func (rp *repo) ProductList(ctx context.Context, req proto.ProductRequest) (rsp *proto.BaseResponse, err error) {
|
||||||
rsp = new(proto.BaseResponse)
|
rsp = new(proto.BaseResponse)
|
||||||
select {
|
select {
|
||||||
|
|
|
@ -13,4 +13,10 @@ type FileManager struct {
|
||||||
Creator int64 `xorm:"INT(11) index" json:"creator"` //上传人
|
Creator int64 `xorm:"INT(11) index" json:"creator"` //上传人
|
||||||
CreateAt int64 `xorm:"created" json:"createAt"` //上传时间
|
CreateAt int64 `xorm:"created" json:"createAt"` //上传时间
|
||||||
UpdateAt int64 `xorm:"updated" json:"updateAt"` //更新时间
|
UpdateAt int64 `xorm:"updated" json:"updateAt"` //更新时间
|
||||||
|
MilepostNumber string `xorm:"VARCHAR(64)" json:"milepostNumber"` //里程桩号
|
||||||
|
FileType int `xorm:"SMALLINT default 1" json:"fileType"` //文件类型 1:图片 2: 视频 3:雷达图谱
|
||||||
|
LineNum int `xorm:"SMALLINT default 0" json:"lineNum"` //车道号
|
||||||
|
UpDown int `xorm:"TINYINT default 0" json:"upDown"` //上下行, 0:上行;1:下行
|
||||||
|
Longitude float64 `xorm:"decimal(18,6)" json:"longitude"` //经度
|
||||||
|
Latitude float64 `xorm:"decimal(18,6)" json:"latitude"` //纬度
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,11 @@ import (
|
||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,3 +42,29 @@ func GetUserSha1Pass(pass, salt string) string {
|
||||||
res := base64.StdEncoding.EncodeToString(mac.Sum(nil))
|
res := base64.StdEncoding.EncodeToString(mac.Sum(nil))
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetMilepost 里程桩加减里程,返回里程桩
|
||||||
|
func GetMilepost(start, num, upDown string) string {
|
||||||
|
arr := strings.Split(start, "+")
|
||||||
|
var (
|
||||||
|
kilometre, meter, milepost, counter, res, resMilepost, resMeter float64
|
||||||
|
)
|
||||||
|
if len(arr) == 1 {
|
||||||
|
meter = 0
|
||||||
|
} else {
|
||||||
|
meter, _ = strconv.ParseFloat(arr[1], 64)
|
||||||
|
}
|
||||||
|
str := strings.Replace(arr[0], "k", "", -1)
|
||||||
|
str = strings.Replace(str, "K", "", -1)
|
||||||
|
kilometre, _ = strconv.ParseFloat(str, 64)
|
||||||
|
milepost = kilometre + meter/1000
|
||||||
|
counter, _ = strconv.ParseFloat(num, 64)
|
||||||
|
if upDown == "D" {
|
||||||
|
res = milepost - counter
|
||||||
|
} else {
|
||||||
|
res = milepost + counter
|
||||||
|
}
|
||||||
|
resMilepost = math.Floor(res)
|
||||||
|
resMeter = (res - resMilepost) * 100
|
||||||
|
return fmt.Sprintf("K%d+%.2f", int(resMilepost), resMeter)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue