From 2b7116d513f13ef8c757d83ee87cc0217c85f746 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Tue, 30 Apr 2024 18:13:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?update=20=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/hdl/hdl_data_statistics.go | 121 ++++++++++++ app/admin/md/md_export_records.go | 62 ++++++ app/admin/svc/svc_data_statisstics.go | 260 ++++++++++++++++++++++++++ app/db/db_export_records.go | 107 +++++++++++ app/db/db_order_list.go | 9 + app/db/model/export_records.go | 11 ++ app/router/admin_router.go | 19 +- k8s/deployment-prd.yaml | 5 +- static/template/对账单.xlsx | Bin 0 -> 9641 bytes 9 files changed, 587 insertions(+), 7 deletions(-) create mode 100644 app/admin/hdl/hdl_data_statistics.go create mode 100644 app/admin/md/md_export_records.go create mode 100644 app/admin/svc/svc_data_statisstics.go create mode 100644 app/db/db_export_records.go create mode 100644 app/db/model/export_records.go create mode 100644 static/template/对账单.xlsx diff --git a/app/admin/hdl/hdl_data_statistics.go b/app/admin/hdl/hdl_data_statistics.go new file mode 100644 index 0000000..fb090c1 --- /dev/null +++ b/app/admin/hdl/hdl_data_statistics.go @@ -0,0 +1,121 @@ +package hdl + +import ( + "applet/app/admin/md" + "applet/app/admin/svc" + "applet/app/bigData/lib/validate" + "applet/app/db" + "applet/app/e" + "fmt" + "github.com/gin-gonic/gin" + "os" +) + +func DataStatisticsList(c *gin.Context) { + var req md.ExportRecordsListReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + if req.Limit == 0 { + req.Limit = 10 + } + if req.Page == 0 { + req.Page = 10 + } + + exportRecordsDb := db.ExportRecordsDb{} + exportRecordsDb.Set() + list, total, err := exportRecordsDb.ExportRecordsExportRecordsList(req) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + e.OutSuc(c, map[string]interface{}{ + "list": list, + "total": total, + "kind": []map[string]interface{}{ + { + "name": "商品销售明细表", + "value": 1, + }, + { + "name": "对账单", + "value": 2, + }, + }, + }, nil) + return +} + +func DataStatisticsDelete(c *gin.Context) { + var req struct { + Ids []int `json:"ids"` + } + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + for _, id := range req.Ids { + exportRecordsDb := db.ExportRecordsDb{} + exportRecordsDb.Set() + exportRecords, err1 := exportRecordsDb.GetExportRecordsExportRecords(id) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + if exportRecords == nil { + e.OutErr(c, e.ERR_NO_DATA, "未查询到相关记录") + return + } + err = os.RemoveAll("./data/export/" + exportRecords.DownloadPath) //移除文件 + if err != nil { + fmt.Println("err>>>>>>>>>>>>>>", err.Error()) + } + _, err2 := exportRecordsDb.ExportRecordsExportRecordsDelete(id) + if err2 != nil { + e.OutErr(c, e.ERR_DB_ORM, err2.Error()) + return + } + } + + e.OutSuc(c, "success", nil) + return +} + +func DataStatisticsExport(c *gin.Context) { + var req md.DataStatisticsExportReq + err := c.ShouldBindJSON(&req) + if err != nil { + err = validate.HandleValidateErr(err) + err1 := err.(e.E) + e.OutErr(c, err1.Code, err1.Error()) + return + } + + if req.EnterpriseId != 0 { + enterpriseDb := db.EnterpriseDb{} + enterpriseDb.Set() + enterprise, err1 := enterpriseDb.GetEnterprise(req.EnterpriseId) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + req.EnterpriseName = enterprise.Name + } + + go svc.DataStatisticsExport(req) + + e.OutSuc(c, map[string]interface{}{ + "msg": "导出成功,请稍后刷新数据列表", + }, nil) + return +} diff --git a/app/admin/md/md_export_records.go b/app/admin/md/md_export_records.go new file mode 100644 index 0000000..904660a --- /dev/null +++ b/app/admin/md/md_export_records.go @@ -0,0 +1,62 @@ +package md + +type CentralKitchenForSchoolExportRecordsListReq struct { + Page int `json:"page" label:"页码"` + Kind int `json:"kind" label:"导出类型"` + Limit int `json:"limit" label:"每页数量"` + StartDate string `json:"start_date" label:"起始时间"` + EndDate string `json:"end_date" label:"截止时间"` +} + +type CentralKitchenForSchoolDataStatisticsExportReq struct { + Kinds []int `json:"kinds" binding:"required" label:"导出类型"` + EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"` + StartDate string `json:"start_date" binding:"required" label:"起始时间"` + EndDate string `json:"end_date" binding:"required" label:"截止时间"` + MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"` + EnterpriseId int `json:"enterprise_id" label:"校企id"` + EnterpriseName string `json:"enterprise_name" label:"校企名称"` +} + +type CentralKitchenForSchoolDataStatisticsContrastReq struct { + Date1 []string `json:"date_1" binding:"required" label:"起始时间"` + Date2 []string `json:"date_2" binding:"required" label:"截止时间"` + MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"` + EnterpriseId int `json:"enterprise_id" label:"校企id"` + EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"` + EnterpriseName string `json:"enterprise_name" label:"校企名称"` +} + +type NursingHomeExportRecordsListReq struct { + Page int `json:"page" label:"页码"` + Kind int `json:"kind" label:"导出类型"` + Limit int `json:"limit" label:"每页数量"` + StartDate string `json:"start_date" label:"起始时间"` + EndDate string `json:"end_date" label:"截止时间"` +} + +type NursingHomeDataStatisticsExportReq struct { + Kind int `json:"kind" binding:"required" label:"导出类型"` + StartDate string `json:"start_date" binding:"required" label:"起始时间"` + EndDate string `json:"end_date" binding:"required" label:"截止时间"` + EnterpriseId int `json:"enterprise_id" label:"校企id"` + EnterpriseName string `json:"enterprise_name" label:"校企名称"` +} + +type ExportRecordsListReq struct { + Page int `json:"page" label:"页码"` + Kind int `json:"kind" label:"导出类型"` + Limit int `json:"limit" label:"每页数量"` + StartDate string `json:"start_date" label:"起始时间"` + EndDate string `json:"end_date" label:"截止时间"` +} + +type DataStatisticsExportReq struct { + Kind int `json:"kind" binding:"required" label:"导出类型"` + StartDate string `json:"start_date" label:"起始时间"` + EndDate string `json:"end_date" label:"截止时间"` + DateForStartDate string `json:"date_for_start_date" label:"送达-起始时间"` + DateForEndDate string `json:"date_for_end_date" label:"送达-截止时间"` + EnterpriseId int `json:"enterprise_id" label:"校企id"` + EnterpriseName string `json:"enterprise_name" label:"校企名称"` +} diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go new file mode 100644 index 0000000..daf6e97 --- /dev/null +++ b/app/admin/svc/svc_data_statisstics.go @@ -0,0 +1,260 @@ +package svc + +import ( + "applet/app/admin/md" + "applet/app/db" + "applet/app/db/model" + "applet/app/utils" + "applet/app/utils/logx" + "encoding/json" + "github.com/360EntSecGroup-Skylar/excelize" + "strconv" + "time" +) + +func DataStatisticsExport(req md.DataStatisticsExportReq) { + var fileName, downloadPath string + var now = time.Now() + switch req.Kind { + case 1: + //商品销售明细表 + fileName = "商品销售明细表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" + downloadPath = "./data/export/" + fileName + + //查询数据 + eg := db.Db + list, _ := db.GetOrderListExport(eg, map[string]string{ + "start_at": req.StartDate, + "end_at": req.EndDate, + "enterprise_id": strconv.Itoa(req.EnterpriseId), + "start_at_for_date": utils.TimeParseStd(req.DateForStartDate).Format("20060102"), + "end_at_for_date": utils.TimeParseStd(req.DateForEndDate).Format("20060102"), + }) + xlsx, _ := excelize.OpenFile("./static/template/商品销售明细表.xlsx") + var data = map[string]map[int64]map[string]string{} + if list != nil { + enterpriseIds := make([]int, 0) + for _, v := range *list { + enterpriseIds = append(enterpriseIds, v.EnterpriseId) + } + enterpriseMap := db.GetEnterpriseMore(eg, enterpriseIds) + + for _, v := range *list { + enterpriseName := "-" + _, ok := enterpriseMap[v.EnterpriseId] + if ok { + enterpriseName = enterpriseMap[v.EnterpriseId].Name + } + if data[enterpriseName] == nil { + data[enterpriseName] = make(map[int64]map[string]string) + } + if data[enterpriseName][v.Oid] == nil { + data[enterpriseName][v.Oid] = make(map[string]string) + } + //TODO:: 查找 `order_goods` + var orderGoods []model.OrderGoods + err := eg.Where("oid = ?", v.Oid).Find(&orderGoods) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + for _, vv := range orderGoods { + data[enterpriseName][v.Oid]["date"] = v.CreateAt.Format("2006-01-02") + data[enterpriseName][v.Oid]["goods_name"] = vv.GoodsTitle + skuData := make([]md.Sku, 0) + json.Unmarshal([]byte(vv.Sku), &skuData) + skuStr := "" + for _, v1 := range skuData { + if skuStr != "" { + skuStr += ";" + } + skuStr += v1.Value + } + data[enterpriseName][v.Oid]["sku_str"] = skuStr + data[enterpriseName][v.Oid]["num"] = utils.IntToStr(vv.Num) + } + } + } + sheetIndex := 2 //第一个表是模板表 + xlsx.NewSheet("Sheet1") //新建表格 + xlsx.CopySheet(1, sheetIndex) + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(2), &[]interface{}{ + "日期:" + utils.TimeParseStd(req.StartDate).Format("2006-01-02") + " ~ " + utils.TimeParseStd(req.EndDate).Format("2006-01-02"), + }) + + j := 4 //表头前三行被占用了,只能从第四行开始 + for k, v := range data { + var total = 0 + for kk, vv := range v { + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{ + vv["date"], + utils.Int64ToStr(kk), + k, + vv["goods_name"], + vv["sku_str"], + vv["num"], + }) + xlsx.SetRowHeight("Sheet1", j, 18) + total += utils.StrToInt(vv["num"]) + j++ + } + + style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFFCC"],"pattern":1}, "alignment":{"horizontal":"center", "vertical": "center"}}`) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + xlsx.MergeCell("Sheet1", "A"+strconv.Itoa(j), "F"+strconv.Itoa(j)) //合并单元格 + xlsx.SetCellStyle("Sheet1", "A"+strconv.Itoa(j), "F"+strconv.Itoa(j), style) + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{ + k + " 汇总: " + utils.IntToStr(total), + }) + xlsx.SetRowHeight("Sheet1", j, 20) + j++ + } + + xlsx.DeleteSheet("template") //删除模板表 + //将文件保存至服务器 + xlsx.SaveAs(downloadPath) + break + case 2: + //对账单 + fileName = "对账单_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" + downloadPath = "./data/export/" + fileName + + //查询数据 + eg := db.Db + list, _ := db.GetOrderListExport(eg, map[string]string{ + "start_at": req.StartDate, + "end_at": req.EndDate, + "enterprise_id": strconv.Itoa(req.EnterpriseId), + "start_at_for_date": utils.TimeParseStd(req.DateForStartDate).Format("20060102"), + "end_at_for_date": utils.TimeParseStd(req.DateForEndDate).Format("20060102"), + }) + xlsx, _ := excelize.OpenFile("./static/template/对账单.xlsx") + var data = map[string]map[int64]map[string]string{} + if list != nil { + enterpriseIds := make([]int, 0) + for _, v := range *list { + enterpriseIds = append(enterpriseIds, v.EnterpriseId) + } + enterpriseMap := db.GetEnterpriseMore(eg, enterpriseIds) + + for _, v := range *list { + enterpriseName := "-" + _, ok := enterpriseMap[v.EnterpriseId] + if ok { + enterpriseName = enterpriseMap[v.EnterpriseId].Name + } + if data[enterpriseName] == nil { + data[enterpriseName] = make(map[int64]map[string]string) + } + if data[enterpriseName][v.Oid] == nil { + data[enterpriseName][v.Oid] = make(map[string]string) + } + //TODO:: 查找 `order_goods` + var orderGoods []model.OrderGoods + err := eg.Where("oid = ?", v.Oid).Find(&orderGoods) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + return + } + for _, vv := range orderGoods { + data[enterpriseName][v.Oid]["date"] = v.CreateAt.Format("2006-01-02") + data[enterpriseName][v.Oid]["goods_name"] = vv.GoodsTitle + skuData := make([]md.Sku, 0) + json.Unmarshal([]byte(vv.Sku), &skuData) + skuStr := "" + for _, v1 := range skuData { + if skuStr != "" { + skuStr += ";" + } + skuStr += v1.Value + } + data[enterpriseName][v.Oid]["sku_str"] = skuStr + data[enterpriseName][v.Oid]["num"] = utils.IntToStr(vv.Num) + data[enterpriseName][v.Oid]["price"] = vv.Price + } + } + } + + sheetIndex := 2 //第一个表是模板表 + for k, v := range data { + xlsx.NewSheet(k) //新建表格 + xlsx.CopySheet(1, sheetIndex) + xlsx.SetSheetRow(k, "A"+strconv.Itoa(2), &[]interface{}{ + "客户: " + k, + }) + xlsx.SetSheetRow(k, "A"+strconv.Itoa(5), &[]interface{}{ + "对账单日期:" + utils.TimeParseStd(req.StartDate).Format("2006-01-02") + " ~ " + utils.TimeParseStd(req.EndDate).Format("2006-01-02"), + }) + j := 7 //表头前三行被占用了,只能从第四行开始 + var total, totalAmount float64 + for kk, vv := range v { + amount := utils.StrToFloat64(vv["num"]) * utils.StrToFloat64(vv["price"]) + xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{ + vv["date"], + utils.Int64ToStr(kk), + k, + vv["goods_name"], + vv["sku_str"], + vv["num"], + vv["price"], + utils.StrToFloat64(vv["num"]) * utils.StrToFloat64(vv["price"]), + }) + xlsx.SetRowHeight("k", j, 18) + total += utils.StrToFloat64(vv["num"]) + totalAmount += amount + style, err := xlsx.NewStyle(`{"alignment":{"horizontal":"center", "vertical": "center"}}`) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + xlsx.SetCellStyle(k, "A"+strconv.Itoa(j), "H"+strconv.Itoa(j), style) + j++ + } + + style1, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFFCC"],"pattern":1}, "alignment":{"horizontal":"center", "vertical": "center"}}`) + if err != nil { + logx.Error(err) + println("<<<>>>>Error:::", err.Error()) + panic(err) + } + xlsx.SetCellStyle(k, "A"+strconv.Itoa(j), "H"+strconv.Itoa(j), style1) + xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{ + "合计", + "", + "", + "", + "", + total, + "", + totalAmount, + }) + xlsx.SetRowHeight("k", j, 20) + sheetIndex++ + } + + xlsx.DeleteSheet("template") //删除模板表 + //将文件保存至服务器 + xlsx.SaveAs(downloadPath) + break + } + + //新增数据 + exportRecordsDb := db.ExportRecordsDb{} + exportRecordsDb.Set() + marshal, _ := json.Marshal(req) + exportRecordsDb.ExportRecordsExportRecordsInsert(&model.ExportRecords{ + Name: fileName, + DownloadPath: downloadPath, + Kind: req.Kind, + ReqContent: string(marshal), + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + }) +} diff --git a/app/db/db_export_records.go b/app/db/db_export_records.go new file mode 100644 index 0000000..66013e2 --- /dev/null +++ b/app/db/db_export_records.go @@ -0,0 +1,107 @@ +package db + +import ( + "applet/app/admin/md" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +type ExportRecordsDb struct { + Db *xorm.Engine `json:"db"` +} + +func (exportRecordsDb *ExportRecordsDb) Set() { // set方法 + exportRecordsDb.Db = Db +} + +func (exportRecordsDb *ExportRecordsDb) GetExportRecordsExportRecords(id int) (m *model.ExportRecords, err error) { + m = new(model.ExportRecords) + has, err := exportRecordsDb.Db.Where("id =?", id).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (exportRecordsDb *ExportRecordsDb) GetExportRecordsExportRecordsByMonth(year, month string) (m *model.ExportRecords, err error) { + m = new(model.ExportRecords) + has, err := exportRecordsDb.Db.Where("year =? and month =?", year, month).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (exportRecordsDb *ExportRecordsDb) FindExportRecordsExportRecords() (*[]model.ExportRecords, error) { + var m []model.ExportRecords + if err := exportRecordsDb.Db.Desc("id").Find(&m); err != nil { + return nil, logx.Error(err) + } + return &m, nil +} + +func (exportRecordsDb *ExportRecordsDb) ExportRecordsExportRecordsInsert(m *model.ExportRecords) (int, error) { + _, err := exportRecordsDb.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (exportRecordsDb *ExportRecordsDb) ExportRecordsExportRecordsInsertBySession(session *xorm.Session, m *model.ExportRecords) (int, error) { + _, err := session.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (exportRecordsDb *ExportRecordsDb) ExportRecordsExportRecordsDelete(id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return Db.In("id", id).Delete(model.ExportRecords{}) + } else { + return Db.Where("id = ?", id).Delete(model.ExportRecords{}) + } +} + +func (exportRecordsDb *ExportRecordsDb) ExportRecordsExportRecordsUpdateBySession(session *xorm.Session, id interface{}, m *model.ExportRecords, forceColums ...string) (int64, error) { + var ( + affected int64 + err error + ) + if forceColums != nil { + affected, err = session.Where("id=?", id).Cols(forceColums...).Update(m) + } else { + affected, err = session.Where("id=?", id).Update(m) + } + if err != nil { + return 0, err + } + return affected, nil +} + +func (exportRecordsDb *ExportRecordsDb) ExportRecordsExportRecordsList(req md.ExportRecordsListReq) (m []model.ExportRecords, total int64, err error) { + sess := exportRecordsDb.Db.Desc("id") + if req.Kind != 0 { + sess.And("kind =?", req.Kind) + } + if req.StartDate != "" { + sess.And("create_at >=?", req.StartDate) + } + if req.EndDate != "" { + sess.And("create_at <=?", req.EndDate) + } + total, err = sess.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m) + if err != nil { + return + } + return +} diff --git a/app/db/db_order_list.go b/app/db/db_order_list.go index 30095a6..c91758a 100644 --- a/app/db/db_order_list.go +++ b/app/db/db_order_list.go @@ -96,6 +96,15 @@ func GetOrderListExport(eg *xorm.Engine, param map[string]string) (*[]model.Orde if param["end_at"] != "" { sess.And("create_at <= ?", param["end_at"]) } + if param["start_at_for_date"] != "" && param["start_at_for_date"] != "00010101" { + sess.And("date >= ?", param["start_at_for_date"]) + } + if param["end_at_for_date"] != "" && param["end_at_for_date"] != "00010101" { + sess.And("date <= ?", param["end_at_for_date"]) + } + if param["enterprise_id"] != "" && param["enterprise_id"] != "0" { + sess.And("enterprise_id = ?", param["enterprise_id"]) + } if param["enterprise_name"] != "" { var enterprise []model.Enterprise eg.Where("name like ?", "%"+param["enterprise_name"]+"%").Find(&enterprise) diff --git a/app/db/model/export_records.go b/app/db/model/export_records.go new file mode 100644 index 0000000..e686aa5 --- /dev/null +++ b/app/db/model/export_records.go @@ -0,0 +1,11 @@ +package model + +type ExportRecords struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + DownloadPath string `json:"download_path" xorm:"not null default '' comment('下载地址') VARCHAR(255)"` + Kind int `json:"kind" xorm:"not null default 0 comment('类型(1:订单列表 2:退款申请表 3:预定统计表)') TINYINT(1)"` + ReqContent string `json:"req_content" xorm:"TEXT"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/app/router/admin_router.go b/app/router/admin_router.go index 22e9a43..ca5d67f 100644 --- a/app/router/admin_router.go +++ b/app/router/admin_router.go @@ -147,6 +147,12 @@ func rOrder(r *gin.RouterGroup) { r.POST("/makeRecord", orderHdl.MarkRecord) //制作记录 } +func rDataStatistics(r *gin.RouterGroup) { + r.POST("/list", hdl.DataStatisticsList) //列表 + r.POST("/export", hdl.DataStatisticsExport) //导出 + r.POST("/delete", hdl.DataStatisticsDelete) //删除 +} + func rFinanceManage(r *gin.RouterGroup) { r.POST("/list", orderHdl.OrderList) //用户订单 r.POST("/export", orderHdl.OrderExport) //用户订单导出 @@ -174,10 +180,11 @@ func AdminRoute(r *gin.RouterGroup) { rCategory(r.Group("/category")) //商品类目 rGoods(r.Group("/goods")) //商品 - rRole(r.Group("/role")) //权限管理 - rSetCenter(r.Group("/setCenter")) //设置中心 - rStaff(r.Group("/staff")) //员工管理 - rGoodsPay(r.Group("/goodsPay")) //商品下单 - rOrder(r.Group("/order")) //用户订单 - rFinanceManage(r.Group("/financeManage")) //财务管理 + rRole(r.Group("/role")) //权限管理 + rSetCenter(r.Group("/setCenter")) //设置中心 + rStaff(r.Group("/staff")) //员工管理 + rGoodsPay(r.Group("/goodsPay")) //商品下单 + rOrder(r.Group("/order")) //用户订单 + rFinanceManage(r.Group("/financeManage")) //财务管理 + rDataStatistics(r.Group("/dataStatistics")) //数据统计 } diff --git a/k8s/deployment-prd.yaml b/k8s/deployment-prd.yaml index e049fe9..b38a6d1 100644 --- a/k8s/deployment-prd.yaml +++ b/k8s/deployment-prd.yaml @@ -50,7 +50,7 @@ spec: # 主容器 - name: bakery # 镜像地址(提前打包好并推送的镜像仓库) - image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/bakery:1.0.0' + image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/bakery:24043014' ports: - name: httpsupply4001 # 容器端口号(注意与golang web server启动的端口一致) @@ -65,6 +65,9 @@ spec: readOnly: true # 挂载到容器的哪个路径 mountPath: /var/zyos + # 存储卷 用于存放前端代码 + - name: bakery # 前面volumes声明的名称 + mountPath: /data imagePullPolicy: Always # Nginx 容器 - name: container-nginx diff --git a/static/template/对账单.xlsx b/static/template/对账单.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..6fa55273321502cda018c3aa6adb7533fe36c3cd GIT binary patch literal 9641 zcma)iWmsIxvNrA-TmuAmC%C%=f(3UAkb%M7U4py226uCN=Mgw{8sVm&n(eh5m;C1JP?irkI)6M$@UnzE0K)bvIf=%@*%g7O{kcQfc7)3Gf)*kx|a;iNlRpDq|{O9ZZ zvK>{b%9V6GAU45Amz+E;qL3wBjWHWTgLo^Weo$>y>C|21)$b_v2D{cS_}*MxvbTs= zFiolFS}up{*S*sm|0K6W#@tr!nOu!$a#8J+ffR+Mm5D^OZU|KC^g~2?%Sy@LCTKSri6;etLVxfSVKGU{#~RFHRdRq_#>8|h zMUJ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(y1Y|1@wW){{;sFU!-tOdaUb1ZDl!ulW`LDB2%c zNLfYeTsdg@WQ71={fq9y>?{l$09NA&P4HB`5|jZfUkz z({kj?F#K)#10X(BC{&|r8y-@VO z+2DVpbL%7v`|z2@#%DTlpTD1--Y>D2s?uMl?k{#fb}=IK9Q(BRjJsJ+gfWSwYWHN! zmb!o#(0G{YLrZHU*QNJms%6;5Ya*okwjEOpE-W=1Pa%_kG+>lBin4w3gT|+*r3!n-Chx)F>bQvd_r;a>B zU>W8dy)(-7cdT!XZdb$`Tk5(^_6CcDee+3!f&!#>>y zg}EgYD5w+Qq>16*E2nLfmvB*fGn{lv%iYQ87Uj$pqJhwzgpi*QK1FmkWK9)mAlm3BHP*j?iox;FaSicOMzmpxeER2xdwosd%iyD?w?>&p`2q zW!$Ps#u-N(QGoQu?Ese+Zu%DK)%S_&i0t@09ZIw^)M=_0E*qrYf+{?pFl$Saf>1)^ zNFo(mZTCFie}ctO-e#NI_2e-0InDO9-*#xPJqpVTQWs>xWNLwvX0Ja3;=2jR`4_b* zhtFM17RCwS!b_tnjn$S2#CnkulOyt{JsC>BUIX6HXV>28uY*O`#j_ye#;I+~+zeP* zh(KJXk)%o-$n>HJQd)pSu}!C49Tnh*v|L8cK>b(}z~mK_vn}-80kqkGsBJ@>4EEmU zU!RYZcU4ne4!|9btnSbWeRC`NzI@plS=&b2eBNCB>2m@{HgR$7xaSprPT93n4d@HzbSh;lfTA` zvX}9XH^@hAMxa{q5Q=<_T3 zH~c@v|Nr*TFD30?~XA%6Os{|5LcO9g~~b5MV7^iNOrqURS&qko6}AHVkJI)8?N zzt{QpTrvB%pzzNX{!FI+USa0BWdE|le^RUe|IeNT^Aq}4Mem=#kUwjBzcqIJ9rnAz z_ve=X47+|Wpo8~Q@84t@!_7e|Id% VOGExVtf Date: Tue, 30 Apr 2024 18:31:37 +0800 Subject: [PATCH 2/3] update --- app/admin/md/md_goods.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/admin/md/md_goods.go b/app/admin/md/md_goods.go index 60cbb23..49617bd 100644 --- a/app/admin/md/md_goods.go +++ b/app/admin/md/md_goods.go @@ -10,17 +10,17 @@ type AddGoodsReq struct { } type MallBaseGoods struct { - GoodsId string `json:"goods_id,omitempty" label:"商品ID"` // 商品id,0或不传为新建 - Title string `json:"title" binding:"required,lte=200" label:"标题"` // 商品标题 - CategoryId int `json:"category_id" binding:"required" label:"商品类目"` // 商品类目id - ImageList []string `json:"image_list" binding:"required,gt=0" label:"商品主图"` // 主图列表 - ImageListUrl []string `json:"image_list_url" ` // 主图列表 - SaleState enum.MallGoodsSaleState `json:"sale_state" label:"开售时间"` // 销售状态 - Spe []Spe `json:"spe" binding:"required,gt=0" label:"商品规格"` // 规格 - Detail []string `json:"detail" label:"商品详情"` // 商品详情 - DetailUrl []string `json:"detail_url" ` // 商品详情 - Price string `json:"price" binding:"required" label:"价格"` // 价格 - Sort int `json:"sort" label:"排序"` // 排序 + GoodsId string `json:"goods_id,omitempty" label:"商品ID"` // 商品id,0或不传为新建 + Title string `json:"title" binding:"required,lte=200" label:"标题"` // 商品标题 + CategoryId int `json:"category_id" binding:"required" label:"商品类目"` // 商品类目id + ImageList []string `json:"image_list" label:"商品主图"` // 主图列表 + ImageListUrl []string `json:"image_list_url" ` // 主图列表 + SaleState enum.MallGoodsSaleState `json:"sale_state" label:"开售时间"` // 销售状态 + Spe []Spe `json:"spe" binding:"required,gt=0" label:"商品规格"` // 规格 + Detail []string `json:"detail" label:"商品详情"` // 商品详情 + DetailUrl []string `json:"detail_url" ` // 商品详情 + Price string `json:"price" binding:"required" label:"价格"` // 价格 + Sort int `json:"sort" label:"排序"` // 排序 } type Spe struct { From 96d28f32deafa2dd25f0f85d8e29a35468144222 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Tue, 30 Apr 2024 19:02:01 +0800 Subject: [PATCH 3/3] 1 --- app/admin/svc/svc_scheme.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/admin/svc/svc_scheme.go b/app/admin/svc/svc_scheme.go index d174a61..ac242ca 100644 --- a/app/admin/svc/svc_scheme.go +++ b/app/admin/svc/svc_scheme.go @@ -47,12 +47,13 @@ func SchemeBindEnterprise(req md.SchemeBindEnterpriseReq) (err error) { EnterpriseId: v, }) } - _, err = schemeEnterpriseDb.BatchAddSchemeEnterpriseBySession(session, mm) - if err != nil { - _ = session.Rollback() - return + if len(mm) > 0 { + _, err = schemeEnterpriseDb.BatchAddSchemeEnterpriseBySession(session, mm) + if err != nil { + _ = session.Rollback() + return + } } - return session.Commit() }