瀏覽代碼

update

add_mode
DengBiao 1 年之前
父節點
當前提交
2b6aa1d55f
共有 6 個檔案被更改,包括 144 行新增15 行删除
  1. +66
    -0
      app/admin/hdl/hdl_data_statistics.go
  2. +51
    -0
      app/admin/hdl/hdl_enterprise.go
  3. +9
    -0
      app/admin/md/md_enterprise.go
  4. +2
    -2
      app/admin/md/md_enterprise_manage.go
  5. +9
    -13
      app/db/model/central_kitchen_for_school_with_spec_for_system.go
  6. +7
    -0
      app/router/admin_router.go

+ 66
- 0
app/admin/hdl/hdl_data_statistics.go 查看文件

@@ -0,0 +1,66 @@
package hdl

import (
"applet/app/admin/lib/validate"
"applet/app/admin/md"
"applet/app/admin/svc"
"applet/app/e"
"applet/app/enum"
"github.com/gin-gonic/gin"
)

func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) {
var req md.EnterpriseListReq
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
}
enterprises, total, err := svc.EnterpriseList(req)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

e.OutSuc(c, map[string]interface{}{
"list": enterprises,
"total": total,
"state": []map[string]interface{}{
{
"name": enum.EnterpriseState(enum.EnterpriseStateForNormal).String(),
"value": enum.EnterpriseStateForNormal,
},
{
"name": enum.EnterpriseState(enum.EnterpriseStateForFreeze).String(),
"value": enum.EnterpriseStateForFreeze,
},
},
"kind": []map[string]interface{}{
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(),
"value": enum.EnterprisePvdByCentralKitchenForSchool,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(),
"value": enum.EnterprisePvdByCentralKitchenForFactory,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(),
"value": enum.EnterprisePvdBySelfSupportForSchool,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
"value": enum.EnterprisePvdBySelfSupportForFactory,
},
},
}, nil)
return
}

+ 51
- 0
app/admin/hdl/hdl_enterprise.go 查看文件

@@ -446,6 +446,57 @@ func ListCentralKitchenForSchoolPackageForSystem(c *gin.Context) {
return
}

func SetCentralKitchenForSchoolWithSpecForSystem(c *gin.Context) {
var req md.SetCentralKitchenForSchoolWithSpecForSystemReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

centralKitchenForSchoolWithSpecForSystemDb := db.CentralKitchenForSchoolWithSpecForSystem{}
centralKitchenForSchoolWithSpecForSystemDb.Set()
system, err := centralKitchenForSchoolWithSpecForSystemDb.GetCentralKitchenForSchoolWithSpecForSystem()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
system.BreakfastUnitPrice = req.BreakfastUnitPrice
system.LunchUnitPrice = req.LunchUnitPrice
system.DinnerUnitPrice = req.DinnerUnitPrice
system.BreakfastUnitPriceForTeacher = req.BreakfastUnitPriceForTeacher
system.LunchUnitPriceForTeacher = req.LunchUnitPriceForTeacher
system.DinnerUnitPriceForTeacher = req.DinnerUnitPriceForTeacher
system.UpdateAt = time.Now().Format("2006-01-02 15:04:05")
updateAffected, err := centralKitchenForSchoolWithSpecForSystemDb.CentralKitchenForSchoolWithSpecForSystemUpdate(system.Id, system)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if updateAffected <= 0 {
e.OutErr(c, e.ERR, "更新数据失败")
return
}
e.OutSuc(c, "success", nil)
return
}

func GetCentralKitchenForSchoolWithSpecForSystem(c *gin.Context) {
centralKitchenForSchoolWithSpecForSystemDb := db.CentralKitchenForSchoolWithSpecForSystem{}
centralKitchenForSchoolWithSpecForSystemDb.Set()
system, err := centralKitchenForSchoolWithSpecForSystemDb.GetCentralKitchenForSchoolWithSpecForSystem()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"data": system,
}, nil)
return
}

func SaveCentralKitchenForSchoolPackageForSystem(c *gin.Context) {
var req md.SaveCentralKitchenForSchoolPackageForSystemReq
err := c.ShouldBindJSON(&req)


+ 9
- 0
app/admin/md/md_enterprise.go 查看文件

@@ -54,6 +54,15 @@ type GradeListStruct struct {
ClassList []model.Class `json:"class_list"`
}

type SetCentralKitchenForSchoolWithSpecForSystemReq struct {
BreakfastUnitPrice string `json:"breakfast_unit_price" binding:"required" label:"早餐-单价"`
BreakfastUnitPriceForTeacher string `json:"breakfast_unit_price_for_teacher" binding:"required" label:"教师-早餐-单价"`
LunchUnitPrice string `json:"lunch_unit_price" binding:"required" label:"午餐-单价"`
LunchUnitPriceForTeacher string `json:"lunch_unit_price_for_teacher" binding:"required" label:"教师-午餐-单价"`
DinnerUnitPrice string `json:"dinner_unit_price" binding:"required" label:"晚餐-单价"`
DinnerUnitPriceForTeacher string `json:"dinner_unit_price_for_teacher" binding:"required" label:"教师-晚餐-单价"`
}

type ListCentralKitchenForSchoolPackageForSystemReq struct {
Page int `json:"page" label:"页码"`
Limit int `json:"limit" label:"每页数量"`


+ 2
- 2
app/admin/md/md_enterprise_manage.go 查看文件

@@ -117,7 +117,7 @@ type CentralKitchenForSchoolTeacherDeleteReq struct {

type CentralKitchenForSchoolStudentAdmissionReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
ClassId int `json:"class_id" binding:"required" label:"班级id"`
ClassId int `json:"class_id" label:"班级id"`
GradeId int `json:"grade_id" binding:"required" label:"年级id"`
}

@@ -322,7 +322,7 @@ type SelfSupportForSchoolStudentDeleteReq struct {

type SelfSupportForSchoolStudentAdmissionReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
ClassId int `json:"class_id" binding:"required" label:"班级id"`
ClassId int `json:"class_id" label:"班级id"`
GradeId int `json:"grade_id" binding:"required" label:"年级id"`
}



+ 9
- 13
app/db/model/central_kitchen_for_school_with_spec_for_system.go 查看文件

@@ -1,17 +1,13 @@
package model

import (
"time"
)

type CentralKitchenForSchoolWithSpecForSystem struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
BreakfastUnitPrice string `json:"breakfast_unit_price" xorm:"not null default 0.00 comment('早餐-单价') DECIMAL(4,2)"`
LunchUnitPrice string `json:"lunch_unit_price" xorm:"not null default 0.00 comment('午餐-单价') DECIMAL(4,2)"`
DinnerUnitPrice string `json:"dinner_unit_price" xorm:"not null default 0.00 comment('晚餐-单价') DECIMAL(4,2)"`
BreakfastUnitPriceForTeacher string `json:"breakfast_unit_price_for_teacher" xorm:"not null default 0.00 comment('教师-早餐-单价') DECIMAL(4,2)"`
LunchUnitPriceForTeacher string `json:"lunch_unit_price_for_teacher" xorm:"not null default 0.00 comment('教师-午餐-单价') DECIMAL(4,2)"`
DinnerUnitPriceForTeacher string `json:"dinner_unit_price_for_teacher" xorm:"not null default 0.00 comment('教师-晚餐-单价') DECIMAL(4,2)"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
BreakfastUnitPrice string `json:"breakfast_unit_price" xorm:"not null default 0.00 comment('早餐-单价') DECIMAL(4,2)"`
LunchUnitPrice string `json:"lunch_unit_price" xorm:"not null default 0.00 comment('午餐-单价') DECIMAL(4,2)"`
DinnerUnitPrice string `json:"dinner_unit_price" xorm:"not null default 0.00 comment('晚餐-单价') DECIMAL(4,2)"`
BreakfastUnitPriceForTeacher string `json:"breakfast_unit_price_for_teacher" xorm:"not null default 0.00 comment('教师-早餐-单价') DECIMAL(4,2)"`
LunchUnitPriceForTeacher string `json:"lunch_unit_price_for_teacher" xorm:"not null default 0.00 comment('教师-午餐-单价') DECIMAL(4,2)"`
DinnerUnitPriceForTeacher string `json:"dinner_unit_price_for_teacher" xorm:"not null default 0.00 comment('教师-晚餐-单价') DECIMAL(4,2)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 7
- 0
app/router/admin_router.go 查看文件

@@ -85,6 +85,10 @@ func rFinanceManage(r *gin.RouterGroup) {
r.GET("/centralKitchenForSchool/ordDetail", hdl.CentralKitchenForSchoolOrdDetail) //财务管理-(央厨-学校)订单详情
r.POST("/centralKitchenForSchool/ordRefund", hdl.CentralKitchenForSchoolOrdRefund) //财务管理-(央厨-学校)订单退款
r.POST("/selfSupportForSchool/ordList", hdl.SelfSupportForSchoolOrdList) //财务管理-(自营-学校)订单列表
}

func rDataStatistics(r *gin.RouterGroup) {
r.POST("/centralKitchenForSchool/list", hdl2.CentralKitchenForSchoolDataStatisticsList) //数据统计-(央厨-学校)-列表

}

@@ -104,6 +108,8 @@ func rEnterprise(r *gin.RouterGroup) {
r.GET("/detail", hdl2.Detail)
r.GET("/schoolBelowGrade", hdl2.SchoolBelowGrade) //"学校"下年级
r.GET("/schoolGradeBelowClass", hdl2.SchoolGradeBelowClass) //"学校"年级下班级
r.POST("/setCentralKitchenForSchoolWithSpecForSystem", hdl2.SetCentralKitchenForSchoolWithSpecForSystem) //"央厨-学校-套餐-系统" 价格设置
r.GET("/getCentralKitchenForSchoolWithSpecForSystem", hdl2.GetCentralKitchenForSchoolWithSpecForSystem) //"央厨-学校-套餐-系统" 价格获取
r.POST("/listCentralKitchenForSchoolPackageForSystem", hdl2.ListCentralKitchenForSchoolPackageForSystem) //"央厨-学校-套餐-系统" 列表
r.POST("/saveCentralKitchenForSchoolPackage", hdl2.SaveCentralKitchenForSchoolPackageForSystem) //新增/编辑 "央厨-学校-套餐-系统"
r.DELETE("/deleteCentralKitchenForSchoolPackage/:id", hdl2.DeleteCentralKitchenForSchoolPackageForSystem) //删除 "央厨-学校-套餐-系统"
@@ -208,4 +214,5 @@ func AdminRoute(r *gin.RouterGroup) {
rUser(r.Group("/user")) //用户管理
rAuditCenter(r.Group("/auditCenter")) //审核中心
rFinanceManage(r.Group("/financeManage")) //财务管理
rDataStatistics(r.Group("/dataStatistics")) //数据统计
}

Loading…
取消
儲存