Browse Source

1数据大屏提醒

master
huangjiajun 7 months ago
parent
commit
54f2242b07
5 changed files with 62 additions and 7 deletions
  1. +1
    -0
      app/admin/svc/order/svc_order_pay.go
  2. +52
    -0
      app/bigData/hdl/hdl_making_data.go
  3. +1
    -0
      app/db/model/order_goods.go
  4. +5
    -4
      app/router/big_data_router.go
  5. +3
    -3
      etc/cfg.yml

+ 1
- 0
app/admin/svc/order/svc_order_pay.go View File

@@ -81,6 +81,7 @@ func GoodsPayCreate(c *gin.Context) {
Price: skuPrice[v.SkuId],
EnterpriseId: utils.StrToInt(req.EnterpriseId),
State: 1,
IsNew: 1,
}
goodsTotal[tmp.GoodsId] += tmp.Num
orderGoods = append(orderGoods, tmp)


+ 52
- 0
app/bigData/hdl/hdl_making_data.go View File

@@ -1,10 +1,15 @@
package hdl

import (
"applet/app/admin/md"
"applet/app/bigData/svc"
"applet/app/db"
"applet/app/db/model"
"applet/app/e"
"applet/app/utils"
"encoding/json"
"github.com/gin-gonic/gin"
"strings"
)

func MakingData(c *gin.Context) {
@@ -43,3 +48,50 @@ func NewOrderNotice(c *gin.Context) {
e.OutSuc(c, res, nil)
return
}
func NewOrderInfoNotice(c *gin.Context) {
var data []model.OrderGoods
db.Db.Where("is_new=1").Find(&data)
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
cfg, _ := sysCfgDb.SysCfgGetOne("new_order_notice")
str := ""
if cfg != nil {
str = cfg.Val
}
skuDatas := make(map[int64]map[string]string, 0)
for _, v := range data {
_, ok := skuDatas[v.SkuId]
if ok == false {
skuDatas[v.SkuId] = make(map[string]string)
}
skuDatas[v.SkuId]["goods_title"] = v.GoodsTitle
skuDatas[v.SkuId]["sku"] = v.Sku
skuDatas[v.SkuId]["count"] = utils.IntToStr(utils.StrToInt(skuDatas[v.SkuId]["count"]) + v.Num)
}
res := make([]map[string]string, 0)
for _, v := range skuDatas {
skuData := make([]md.Sku, 0)
json.Unmarshal([]byte(v["sku"]), &skuData)
skuStr := ""
for _, v1 := range skuData {
if skuStr != "" {
skuStr += ";"
}
skuStr += v1.Value
}
tip := str
tip = strings.ReplaceAll(tip, "[商品名称]", v["goods_title"])
tip = strings.ReplaceAll(tip, "[规格]", skuStr)
tip = strings.ReplaceAll(tip, "[数量]", v["count"])
tmp := map[string]string{
"str": tip,
}
res = append(res, tmp)
}
for _, v := range data {
v.IsNew = 0
db.Db.Where("id=?", v.Id).Cols("is_new").Update(&v)
}
e.OutSuc(c, res, nil)
return
}

+ 1
- 0
app/db/model/order_goods.go View File

@@ -9,6 +9,7 @@ type OrderGoods struct {
SkuId int64 `json:"sku_id" xorm:"default 0 comment('sku') BIGINT(20)"`
Num int `json:"num" xorm:"default 0 comment('购买数量') INT(11)"`
OldNum int `json:"old_num" xorm:"default 0 comment('购买数量') INT(11)"`
IsNew int `json:"is_new" xorm:"default 0 comment('购买数量') INT(11)"`
Price string `json:"price" xorm:"default 0.00 comment('单价') DECIMAL(20,2)"`
State int `json:"state" xorm:"default 0 comment('状态 0待制作 1制作中 2烘焙中 3分拣中 4已完成 ') INT(11)"`
SkuCode string `json:"sku_code" xorm:"VARCHAR(255)"`


+ 5
- 4
app/router/big_data_router.go View File

@@ -19,9 +19,10 @@ func rData(r *gin.RouterGroup) {
r.GET("/leftData", hdl.LeftData) //左侧数据
r.POST("/rightData", hdl.RightData) //右侧数据

r.GET("/making_data", hdl.MakingData) //制作区数据
r.GET("/baking_data", hdl.BakingData) //烘焙区数据
r.GET("/sorting_data", hdl.SortingData) //分拣区数据
r.GET("/new_order_notice", hdl.NewOrderNotice) //新订单提醒
r.GET("/making_data", hdl.MakingData) //制作区数据
r.GET("/baking_data", hdl.BakingData) //烘焙区数据
r.GET("/sorting_data", hdl.SortingData) //分拣区数据
r.GET("/new_order_notice", hdl.NewOrderNotice) //新订单提醒
r.GET("/new_order_info_notice", hdl.NewOrderInfoNotice) //新订单提醒

}

+ 3
- 3
etc/cfg.yml View File

@@ -11,10 +11,10 @@ redis_password: ''

# 连接官网数据库获取db mapping
db:
host: 'zhios123.rwlb.rds.aliyuncs.com:3306'
host: '119.23.182.117:3306'
name: 'bakery'
user: 'canal'
psw: 'canal'
user: 'root'
psw: 'Fnuo123com@'
show_log: true
max_lifetime: 30
max_open_conns: 100


Loading…
Cancel
Save