diff --git a/app/admin/apis/decision/month_end_closing.go b/app/admin/apis/decision/month_end_closing.go new file mode 100644 index 0000000..848bc51 --- /dev/null +++ b/app/admin/apis/decision/month_end_closing.go @@ -0,0 +1,276 @@ +package decision + +import ( + "errors" + "github.com/gin-gonic/gin" + model "go-admin/app/admin/models" + orm "go-admin/common/global" + "go-admin/logger" + "go-admin/tools" + "go-admin/tools/app" + "gorm.io/gorm" + "net/http" + "time" +) + +// ErpMonthEndClosingList 财务月结-列表 +// @Summary 财务月结-列表 +// @Tags 决策中心,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ErpMonthEndClosingListReq true "财务月结-列表模型" +// @Success 200 {object} models.ErpMonthEndClosingListResp +// @Router /api/v1/decision/month_end_closing/list [post] +func ErpMonthEndClosingList(c *gin.Context) { + req := new(model.ErpMonthEndClosingListReq) + if err := c.ShouldBindJSON(&req); err != nil { + logger.Error("ShouldBindJSON err:", logger.Field("err", err)) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误"+err.Error()) + return + } + + resp, err := req.List() + if err != nil { + logger.Error("ErpPurchaseList err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "获取失败"+err.Error()) + return + } + + app.OK(c, resp, "success") + return +} + +// ErpMonthEndClosingCreate 财务月结-新增 +// @Summary 财务月结-新增 +// @Tags 决策中心,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ErpMonthEndClosingCreateReq true "财务月结-新增模型" +// @Success 200 {object} app.Response +// @Router /api/v1/decision/month_end_closing/create [post] +func ErpMonthEndClosingCreate(c *gin.Context) { + req := new(model.ErpMonthEndClosingCreateReq) + if err := c.ShouldBindJSON(&req); err != nil { + logger.Error("ShouldBindJSON err:", logger.Field("err", err)) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误"+err.Error()) + return + } + + err := tools.Validate(req) //必填参数校验 + if err != nil { + app.Error(c, http.StatusBadRequest, err, err.Error()) + return + } + + err = model.CreateErpMonthEndClosing(req, c) + if err != nil { + logger.Error("CreateErpMarketingCoupon err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, err.Error()) + return + } + + app.OK(c, nil, "新增成功") + return +} + +// ErpMonthEndClosingAudit 财务月结-审核 +// @Summary 财务月结-审核 +// @Tags 决策中心,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ErpMonthEndClosingAuditReq true "财务月结-审核模型" +// @Success 200 {object} app.Response +// @Router /api/v1/decision/month_end_closing/audit [post] +func ErpMonthEndClosingAudit(c *gin.Context) { + req := new(model.ErpMonthEndClosingAuditReq) + if err := c.ShouldBindJSON(&req); err != nil { + logger.Error("ShouldBindJSON err:", logger.Field("err", err)) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误"+err.Error()) + return + } + + err := tools.Validate(req) //必填参数校验 + if err != nil { + app.Error(c, http.StatusBadRequest, err, err.Error()) + return + } + + sysUser, err := model.GetSysUserByCtx(c) + if err != nil { + logger.Error("sys user err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "操作失败") + return + } + + var erpMonthEndOrder model.ErpMonthEndClosing + err = orm.Eloquent.Table("erp_month_end_closing").Where("serial_number = ?", req.SerialNumber). + Find(&erpMonthEndOrder).Error + if err != nil { + logger.Error("order err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "审核失败:"+err.Error()) + return + } + + // 判断入参state:1-审核,2-取消审核 + orderState := 0 + switch req.State { + case 1: // 1-审核:待审核状态可以审核 + if erpMonthEndOrder.State == model.ErpMonthEndClosingUnAudit { + orderState = model.ErpMonthEndClosingAudited + } else { + app.OK(c, nil, "订单已审核") + return + } + case 2: // 2-取消审核:不能跨月取消,如:2024/08,2024/09都已经审核,则2024/08不能取消审核,除非2024/09先取消审核 + if erpMonthEndOrder.State == model.ErpMonthEndClosingUnAudit { + app.OK(c, nil, "订单已取消审核") + return + } + + // 检查是否存在跨月已审核记录 + var laterAuditCount int64 + err = orm.Eloquent.Table("erp_month_end_closing"). + Where("state = ? AND closing_start_date > ?", model.ErpMonthEndClosingAudited, erpMonthEndOrder.ClosingEndDate). + Count(&laterAuditCount).Error + if err != nil { + logger.Error("check later audits err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "取消审核失败:"+err.Error()) + return + } + if laterAuditCount > 0 { + app.Error(c, http.StatusForbidden, nil, "存在更晚月份已审核记录,无法取消审核") + return + } + + orderState = model.ErpMonthEndClosingUnAudit + default: + logger.Error("order err, req.State is:", logger.Field("req.State", req.State)) + app.Error(c, http.StatusInternalServerError, err, "审核失败:参数有误") + return + } + + err = orm.Eloquent.Table("erp_month_end_closing").Where("id = ?", erpMonthEndOrder.ID).Updates(map[string]interface{}{ + "state": orderState, + "auditor_id": sysUser.UserId, + "audit_time": time.Now(), + "auditor_name": sysUser.NickName, + }).Error + if err != nil { + logger.Error("update erp_month_end_closing err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "审核失败:"+err.Error()) + return + } + + app.OK(c, nil, "操作成功") + return +} + +// ErpMonthEndClosingEdit 财务月结-编辑 +// @Summary 财务月结-编辑 +// @Tags 决策中心,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ErpMonthEndClosingEditReq true "财务月结-编辑模型" +// @Success 200 {object} models.ErpMonthEndClosing +// @Router /api/v1/decision/month_end_closing/edit [post] +func ErpMonthEndClosingEdit(c *gin.Context) { + req := new(model.ErpMonthEndClosingEditReq) + if err := c.ShouldBindJSON(&req); err != nil { + logger.Error("ShouldBindJSON err:", logger.Field("err", err)) + app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误"+err.Error()) + return + } + + err := tools.Validate(req) //必填参数校验 + if err != nil { + app.Error(c, http.StatusBadRequest, err, err.Error()) + return + } + + sysUser, err := model.GetSysUserByCtx(c) + if err != nil { + logger.Error("sys user err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "操作失败") + return + } + + // 更新订单信息 + monthEndClosingOrder, err := model.EditErpMonthEndClosing(req, sysUser) + if err != nil { + logger.Error("EditErpPurchaseOrder err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "编辑失败:"+err.Error()) + return + } + + app.OK(c, monthEndClosingOrder, "success") +} + +// ErpMonthEndClosingDelete 财务月结-删除 +// @Summary 财务月结-删除 +// @Tags 决策中心,V1.4.0 +// @Produce json +// @Accept json +// @Param request body models.ErpMonthEndClosingDeleteReq true "财务月结-删除模型" +// @Success 200 {object} app.Response +// @Router /api/v1/decision/month_end_closing/delete [post] +func ErpMonthEndClosingDelete(c *gin.Context) { + var req = new(model.ErpMonthEndClosingDeleteReq) + if err := c.ShouldBindJSON(&req); err != nil { + logger.Error("ShouldBindJSON err:", logger.Field("err", err)) + app.Error(c, http.StatusBadRequest, err, "参数错误:"+err.Error()) + return + } + + err := tools.Validate(req) //必填参数校验 + if err != nil { + app.Error(c, http.StatusBadRequest, err, err.Error()) + return + } + + err = model.DeleteErpMonthEndClosing(req) + if err != nil { + logger.Error("DeleteErpMonthEndClosing err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, err.Error()) + return + } + + app.OK(c, nil, "删除成功") + return +} + +// ErpMonthEndClosingDate 财务月结-获取开始日期 +// @Summary 财务月结-获取开始日期 +// @Tags 决策中心,V1.4.0 +// @Produce json +// @Accept json +// @Success 200 {object} models.ErpMonthEndClosingDateResp +// @Router /api/v1/decision/month_end_closing/start_date [get] +func ErpMonthEndClosingDate(c *gin.Context) { + var latestClosing model.ErpMonthEndClosing + err := orm.Eloquent.Table("erp_month_end_closing"). + Where("state = ?", model.ErpMonthEndClosingAudited). + Order("closing_end_date DESC"). + First(&latestClosing).Error + + var startDate *time.Time + if errors.Is(err, gorm.ErrRecordNotFound) { + // 如果没有已审核记录,startDate 返回 nil + startDate = nil + } else if err != nil { + // 数据库查询出错,返回错误响应 + logger.Error("query latest closing err:", logger.Field("err", err)) + app.Error(c, http.StatusInternalServerError, err, "获取开始日期失败") + return + } else { + // 如果存在已审核记录,则取最晚的 ClosingEndDate 加 1 天 + nextDate := latestClosing.ClosingEndDate.AddDate(0, 0, 1) + startDate = &nextDate + } + + resp := model.ErpMonthEndClosingDateResp{ + StartDate: startDate.Format(model.DateTimeFormat), + } + + app.OK(c, resp, "获取成功") + return +} diff --git a/app/admin/models/erp_order.go b/app/admin/models/erp_order.go index 6cd694e..8d91a43 100644 --- a/app/admin/models/erp_order.go +++ b/app/admin/models/erp_order.go @@ -5734,9 +5734,14 @@ func QueryReceiptData(req *ErpOrderDeleteReq, c *gin.Context) (*ErpOrderReceiptD } } - if orders[0].PayStatus != HavePaid { - logger.Error("订单未支付") - return nil, errors.New("该订单未支付,不支持打印小票") + // add 2024-12-25 方便领取厂家激励;操作路径:开单不审核,然后打印小票 + if !(tools.GetRoleName(c) == "admin" || tools.GetRoleName(c) == "系统管理员" || + tools.GetRoleName(c) == "manager" || tools.GetRoleName(c) == "经理" || + tools.GetRoleName(c) == "yunying" || tools.GetRoleName(c) == "运营") { + if orders[0].PayStatus != HavePaid { + logger.Error("订单未支付") + return nil, errors.New("该订单未支付,不支持打印小票") + } } // 添加付款、销售员、商品信息 diff --git a/app/admin/models/month_end_closing.go b/app/admin/models/month_end_closing.go new file mode 100644 index 0000000..dcbc6c7 --- /dev/null +++ b/app/admin/models/month_end_closing.go @@ -0,0 +1,306 @@ +package models + +import ( + "errors" + "fmt" + "github.com/gin-gonic/gin" + orm "go-admin/common/global" + "go-admin/logger" + "math/rand" + "time" +) + +const ( + ErpMonthEndClosingUnAudit = 1 // 待审核 + ErpMonthEndClosingAudited = 2 // 已审核 +) + +// ErpMonthEndClosing 财务月结订单表 +type ErpMonthEndClosing struct { + Model + + SerialNumber string `json:"serial_number" gorm:"index"` // 单据编号 + ClosingStartDate time.Time `json:"closing_start_date" gorm:"type:date"` // 月结开始时间,精确到天 + ClosingEndDate time.Time `json:"closing_end_date" gorm:"type:date"` // 月结结束时间,精确到天 + MakerId uint32 `json:"maker_id" gorm:"index"` // 制单人 ID + MakerName string `json:"maker_name"` // 制单人名称 + MakerTime *time.Time `json:"maker_time"` // 制单时间 + AuditorId uint32 `json:"auditor_id" gorm:"index"` // 审核人 ID + AuditorName string `json:"auditor_name"` // 审核人姓名 + AuditTime *time.Time `json:"audit_time"` // 审核时间 + State uint32 `json:"state"` // 订单状态:1-待审核;2-已审核 +} + +// ErpMonthEndClosingListReq 月结列表-入参 +type ErpMonthEndClosingListReq struct { + SerialNumber string `json:"serial_number"` // 单据编号 + ClosingStartDate string `json:"closing_start_date"` // 月结开始时间 + ClosingEndDate string `json:"closing_end_date"` // 月结结束时间 + State uint32 `json:"state"` // 订单状态:1-待审核;2-已审核 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 页面条数 +} + +type ErpMonthEndOrder struct { + Model + + SerialNumber string `json:"serial_number"` // 单据编号 + ClosingStartDate string `json:"closing_start_date"` // 月结开始时间,精确到天 + ClosingEndDate string `json:"closing_end_date"` // 月结结束时间,精确到天 + MakerId uint32 `json:"maker_id"` // 制单人 ID + MakerName string `json:"maker_name"` // 制单人名称 + MakerTime *time.Time `json:"maker_time"` // 制单时间 + AuditorId uint32 `json:"auditor_id"` // 审核人 ID + AuditorName string `json:"auditor_name"` // 审核人姓名 + AuditTime *time.Time `json:"audit_time"` // 审核时间 + State uint32 `json:"state"` // 订单状态:1-待审核;2-已审核 +} + +// ErpMonthEndClosingListResp 月结列表-出参 +type ErpMonthEndClosingListResp struct { + List []ErpMonthEndOrder `json:"list"` + Total int `json:"total"` // 总条数 + PageIndex int `json:"pageIndex"` // 页码 + PageSize int `json:"pageSize"` // 每页展示条数 +} + +// List 查询采购订单列表 +func (m *ErpMonthEndClosingListReq) List() (*ErpMonthEndClosingListResp, error) { + resp := &ErpMonthEndClosingListResp{ + PageIndex: m.PageIndex, + PageSize: m.PageSize, + } + page := m.PageIndex - 1 + if page < 0 { + page = 0 + } + if m.PageSize == 0 { + m.PageSize = 10 + } + qs := orm.Eloquent.Table("erp_month_end_closing") + + if m.SerialNumber != "" { + qs = qs.Where("serial_number=?", m.SerialNumber) + } + if m.State != 0 { + qs = qs.Where("state=?", m.State) + } + + if m.ClosingStartDate != "" { + parse, err := time.Parse(QueryTimeFormat, m.ClosingStartDate) + if err != nil { + logger.Errorf("ErpMonthEndClosingList err:", err) + return nil, err + } + qs = qs.Where("closing_end_date > ?", parse) + } + if m.ClosingEndDate != "" { + parse, err := time.Parse(QueryTimeFormat, m.ClosingEndDate) + if err != nil { + logger.Errorf("ErpMonthEndClosingList err:", err) + return nil, err + } + qs = qs.Where("closing_start_date < ?", parse) + } + + var count int64 + err := qs.Count(&count).Error + if err != nil { + logger.Error("count err:", logger.Field("err", err)) + return resp, err + } + resp.Total = int(count) + var orders []ErpMonthEndClosing + err = qs.Order("id DESC").Offset(page * m.PageSize).Limit(m.PageSize).Find(&orders).Error + if err != nil && err != RecordNotFound { + logger.Error("erp commodity list err:", logger.Field("err", err)) + return resp, err + } + + var orderList []ErpMonthEndOrder + // 校验时间 + for i, v := range orders { + if v.MakerTime != nil && v.MakerTime.IsZero() { + orders[i].MakerTime = nil + } + + if v.AuditTime != nil && v.AuditTime.IsZero() { + orders[i].AuditTime = nil + } + + var orderInfo ErpMonthEndOrder + orderInfo.Model = v.Model + orderInfo.SerialNumber = v.SerialNumber + orderInfo.ClosingStartDate = v.ClosingStartDate.Format(DateTimeFormat) + orderInfo.ClosingEndDate = v.ClosingEndDate.Format(DateTimeFormat) + orderInfo.MakerId = v.MakerId + orderInfo.MakerName = v.MakerName + orderInfo.MakerTime = orders[i].MakerTime + orderInfo.AuditorId = v.AuditorId + orderInfo.AuditorName = v.AuditorName + orderInfo.AuditTime = orders[i].AuditTime + orderInfo.State = v.State + + orderList = append(orderList, orderInfo) + } + + resp.List = orderList + return resp, nil +} + +// ErpMonthEndClosingCreateReq 新增月结订单-入参 +type ErpMonthEndClosingCreateReq struct { + ClosingStartDate string `json:"closing_start_date" validate:"required"` // 月结开始时间,精确到天 + ClosingEndDate string `json:"closing_end_date" validate:"required"` // 月结结束时间,精确到天 +} + +// CreateErpMonthEndClosing 新增月结 +func CreateErpMonthEndClosing(req *ErpMonthEndClosingCreateReq, c *gin.Context) error { + sysUser, err := GetSysUserByCtx(c) + if err != nil { + return errors.New("操作失败:" + err.Error()) + } + + startDate, err := time.Parse(DateTimeFormat, req.ClosingStartDate) + if err != nil { + return err + } + + endDate, err := time.Parse(DateTimeFormat, req.ClosingEndDate) + if err != nil { + return err + } + + nowTime := time.Now() + erpMonthEndClosing := &ErpMonthEndClosing{ + SerialNumber: NewErpMonthEndClosingSerialNumber(), + ClosingStartDate: startDate, + ClosingEndDate: endDate, + MakerId: uint32(sysUser.UserId), + MakerName: sysUser.NickName, + MakerTime: &nowTime, + State: ErpMonthEndClosingUnAudit, + } + + err = orm.Eloquent.Create(erpMonthEndClosing).Error + if err != nil { + logger.Error("create purchase order err:", logger.Field("err", err)) + return err + } + + return nil +} + +// NewErpMonthEndClosingSerialNumber 生成月结订单号 +func NewErpMonthEndClosingSerialNumber() string { + prefix := "YJ" + + nowTime := time.Now() + rand.Seed(nowTime.UnixNano()) + max := 1 + for { + if max > 5 { + logger.Error("create sn err") + return "" + } + random := rand.Intn(9000) + 1000 + sn := fmt.Sprintf("%s%d", nowTime.Format("060102"), random) + exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_month_end_closing WHERE "+ + "serial_number='%s'", prefix+sn)) + if err != nil { + logger.Error("exist sn err") + } + if !exist { + return prefix + sn + } + + max++ + } +} + +// ErpMonthEndClosingDeleteReq 删除月结订单-入参 +type ErpMonthEndClosingDeleteReq struct { + SerialNumber string `json:"serial_number" validate:"required"` // 单据编号 +} + +// DeleteErpMonthEndClosing 删除月结订单 +func DeleteErpMonthEndClosing(req *ErpMonthEndClosingDeleteReq) error { + var orderInfo ErpMonthEndClosing + err := orm.Eloquent.Table("erp_month_end_closing").Where("serial_number = ?", req.SerialNumber).Find(&orderInfo).Error + if err != nil { + logger.Error("erp_month_end_closing delete err:", logger.Field("err", err)) + return errors.New("未查询到订单") + } + + if orderInfo.State == ErpMonthEndClosingAudited { + logger.Errorf("erp_month_end_closing delete err, state is:", orderInfo.State) + return errors.New("已审核订单不能删除") + } + + err = orm.Eloquent.Delete(orderInfo).Error + if err != nil { + logger.Error("erp_month_end_closing delete2 err:", logger.Field("err", err)) + return err + } + + return nil +} + +// ErpMonthEndClosingEditReq 编辑月结订单-入参 +type ErpMonthEndClosingEditReq struct { + SerialNumber string `json:"serial_number" validate:"required"` // 单据编号 + ClosingStartDate string `json:"closing_start_date" validate:"required"` // 月结开始时间,精确到天 + ClosingEndDate string `json:"closing_end_date" validate:"required"` // 月结结束时间,精确到天 +} + +// EditErpMonthEndClosing 编辑月结订单 +func EditErpMonthEndClosing(req *ErpMonthEndClosingEditReq, sysUser *SysUser) (*ErpMonthEndClosing, error) { + // 查询订单信息 + var endOrder ErpMonthEndClosing + err := orm.Eloquent.Table("erp_month_end_closing").Where("serial_number=?", req.SerialNumber). + Find(&endOrder).Error + if err != nil { + logger.Error("erp_month_end_closing order err:", logger.Field("err", err)) + return nil, err + } + + if endOrder.State != ErpMonthEndClosingUnAudit { // 只有待审核的订单才能编辑 + return nil, errors.New("订单不是待审核状态") + } + + startDate, err := time.Parse(DateTimeFormat, req.ClosingStartDate) + if err != nil { + return nil, err + } + + endDate, err := time.Parse(DateTimeFormat, req.ClosingEndDate) + if err != nil { + return nil, err + } + + // 1-更新采购订单信息 + endOrder.ClosingStartDate = startDate + endOrder.ClosingEndDate = endDate + endOrder.MakerId = uint32(sysUser.UserId) + endOrder.MakerName = sysUser.NickName + + err = orm.Eloquent.Model(&ErpMonthEndClosing{}).Where("serial_number = ?", req.SerialNumber). + Omit("created_at").Save(endOrder).Error + if err != nil { + logger.Error("update erp_month_end_closing err:", logger.Field("err", err)) + return nil, err + } + + return &endOrder, nil +} + +// ErpMonthEndClosingAuditReq 审核月结订单-入参 +type ErpMonthEndClosingAuditReq struct { + SerialNumber string `json:"serial_number" validate:"required"` // 单据编号 + State int `json:"state" validate:"required"` // 审核操作: 1-审核 2-取消审核 +} + +// ErpMonthEndClosingDateResp 获取月结日期-出参 +type ErpMonthEndClosingDateResp struct { + StartDate string `json:"start_date"` // 月结开始时间 +} diff --git a/app/admin/router/decision.go b/app/admin/router/decision.go index 8bc2594..ab82d14 100644 --- a/app/admin/router/decision.go +++ b/app/admin/router/decision.go @@ -12,4 +12,12 @@ func registerErpDecisionRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi r.POST("report", decision.ErpDecisionReport) // 进销存报表 r.POST("store_sales_report", decision.ErpStoreSalesData) // 进销存报表 + + r1 := v1.Group("/decision/month_end_closing").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + r1.POST("list", decision.ErpMonthEndClosingList) // 财务月结-列表 + r1.POST("create", decision.ErpMonthEndClosingCreate) // 财务月结-新增 + r1.POST("audit", decision.ErpMonthEndClosingAudit) // 财务月结-审核 + r1.POST("edit", decision.ErpMonthEndClosingEdit) // 财务月结-编辑 + r1.POST("delete", decision.ErpMonthEndClosingDelete) // 财务月结-删除 + r1.GET("start_date", decision.ErpMonthEndClosingDate) // 财务月结-获取开始日期 } diff --git a/docs/docs.go b/docs/docs.go index 24fcdce..0d69044 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1142,6 +1142,193 @@ const docTemplate = `{ } } }, + "/api/v1/decision/month_end_closing/audit": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-审核", + "parameters": [ + { + "description": "财务月结-审核模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingAuditReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/create": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-新增", + "parameters": [ + { + "description": "财务月结-新增模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingCreateReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/delete": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-删除", + "parameters": [ + { + "description": "财务月结-删除模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingDeleteReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/edit": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-编辑", + "parameters": [ + { + "description": "财务月结-编辑模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingEditReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosing" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/list": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-列表", + "parameters": [ + { + "description": "财务月结-列表模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingListResp" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/start_date": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-获取开始日期", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingDateResp" + } + } + } + } + }, "/api/v1/decision/report": { "post": { "consumes": [ @@ -9986,6 +10173,249 @@ const docTemplate = `{ } } }, + "models.ErpMonthEndClosing": { + "type": "object", + "properties": { + "audit_time": { + "description": "审核时间", + "type": "string" + }, + "auditor_id": { + "description": "审核人 ID", + "type": "integer" + }, + "auditor_name": { + "description": "审核人姓名", + "type": "string" + }, + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "id": { + "description": "数据库记录编号", + "type": "integer" + }, + "maker_id": { + "description": "制单人 ID", + "type": "integer" + }, + "maker_name": { + "description": "制单人名称", + "type": "string" + }, + "maker_time": { + "description": "制单时间", + "type": "string" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "订单状态:1-待审核;2-已审核", + "type": "integer" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingAuditReq": { + "type": "object", + "required": [ + "serial_number", + "state" + ], + "properties": { + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "审核操作: 1-审核 2-取消审核", + "type": "integer" + } + } + }, + "models.ErpMonthEndClosingCreateReq": { + "type": "object", + "required": [ + "closing_end_date", + "closing_start_date" + ], + "properties": { + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingDateResp": { + "type": "object", + "properties": { + "start_date": { + "description": "月结开始时间", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingDeleteReq": { + "type": "object", + "required": [ + "serial_number" + ], + "properties": { + "serial_number": { + "description": "单据编号", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingEditReq": { + "type": "object", + "required": [ + "closing_end_date", + "closing_start_date", + "serial_number" + ], + "properties": { + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingListReq": { + "type": "object", + "properties": { + "closing_end_date": { + "description": "月结结束时间", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间", + "type": "string" + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "页面条数", + "type": "integer" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "订单状态:1-待审核;2-已审核", + "type": "integer" + } + } + }, + "models.ErpMonthEndClosingListResp": { + "type": "object", + "properties": { + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/models.ErpMonthEndOrder" + } + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "每页展示条数", + "type": "integer" + }, + "total": { + "description": "总条数", + "type": "integer" + } + } + }, + "models.ErpMonthEndOrder": { + "type": "object", + "properties": { + "audit_time": { + "description": "审核时间", + "type": "string" + }, + "auditor_id": { + "description": "审核人 ID", + "type": "integer" + }, + "auditor_name": { + "description": "审核人姓名", + "type": "string" + }, + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "id": { + "description": "数据库记录编号", + "type": "integer" + }, + "maker_id": { + "description": "制单人 ID", + "type": "integer" + }, + "maker_name": { + "description": "制单人名称", + "type": "string" + }, + "maker_time": { + "description": "制单时间", + "type": "string" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "订单状态:1-待审核;2-已审核", + "type": "integer" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, "models.ErpOrder": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 17aaf93..bdc266f 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1131,6 +1131,193 @@ } } }, + "/api/v1/decision/month_end_closing/audit": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-审核", + "parameters": [ + { + "description": "财务月结-审核模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingAuditReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/create": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-新增", + "parameters": [ + { + "description": "财务月结-新增模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingCreateReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/delete": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-删除", + "parameters": [ + { + "description": "财务月结-删除模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingDeleteReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/edit": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-编辑", + "parameters": [ + { + "description": "财务月结-编辑模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingEditReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosing" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/list": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-列表", + "parameters": [ + { + "description": "财务月结-列表模型", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingListReq" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingListResp" + } + } + } + } + }, + "/api/v1/decision/month_end_closing/start_date": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "决策中心,V1.4.0" + ], + "summary": "财务月结-获取开始日期", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/models.ErpMonthEndClosingDateResp" + } + } + } + } + }, "/api/v1/decision/report": { "post": { "consumes": [ @@ -9975,6 +10162,249 @@ } } }, + "models.ErpMonthEndClosing": { + "type": "object", + "properties": { + "audit_time": { + "description": "审核时间", + "type": "string" + }, + "auditor_id": { + "description": "审核人 ID", + "type": "integer" + }, + "auditor_name": { + "description": "审核人姓名", + "type": "string" + }, + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "id": { + "description": "数据库记录编号", + "type": "integer" + }, + "maker_id": { + "description": "制单人 ID", + "type": "integer" + }, + "maker_name": { + "description": "制单人名称", + "type": "string" + }, + "maker_time": { + "description": "制单时间", + "type": "string" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "订单状态:1-待审核;2-已审核", + "type": "integer" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingAuditReq": { + "type": "object", + "required": [ + "serial_number", + "state" + ], + "properties": { + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "审核操作: 1-审核 2-取消审核", + "type": "integer" + } + } + }, + "models.ErpMonthEndClosingCreateReq": { + "type": "object", + "required": [ + "closing_end_date", + "closing_start_date" + ], + "properties": { + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingDateResp": { + "type": "object", + "properties": { + "start_date": { + "description": "月结开始时间", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingDeleteReq": { + "type": "object", + "required": [ + "serial_number" + ], + "properties": { + "serial_number": { + "description": "单据编号", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingEditReq": { + "type": "object", + "required": [ + "closing_end_date", + "closing_start_date", + "serial_number" + ], + "properties": { + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + } + } + }, + "models.ErpMonthEndClosingListReq": { + "type": "object", + "properties": { + "closing_end_date": { + "description": "月结结束时间", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间", + "type": "string" + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "页面条数", + "type": "integer" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "订单状态:1-待审核;2-已审核", + "type": "integer" + } + } + }, + "models.ErpMonthEndClosingListResp": { + "type": "object", + "properties": { + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/models.ErpMonthEndOrder" + } + }, + "pageIndex": { + "description": "页码", + "type": "integer" + }, + "pageSize": { + "description": "每页展示条数", + "type": "integer" + }, + "total": { + "description": "总条数", + "type": "integer" + } + } + }, + "models.ErpMonthEndOrder": { + "type": "object", + "properties": { + "audit_time": { + "description": "审核时间", + "type": "string" + }, + "auditor_id": { + "description": "审核人 ID", + "type": "integer" + }, + "auditor_name": { + "description": "审核人姓名", + "type": "string" + }, + "closing_end_date": { + "description": "月结结束时间,精确到天", + "type": "string" + }, + "closing_start_date": { + "description": "月结开始时间,精确到天", + "type": "string" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "id": { + "description": "数据库记录编号", + "type": "integer" + }, + "maker_id": { + "description": "制单人 ID", + "type": "integer" + }, + "maker_name": { + "description": "制单人名称", + "type": "string" + }, + "maker_time": { + "description": "制单时间", + "type": "string" + }, + "serial_number": { + "description": "单据编号", + "type": "string" + }, + "state": { + "description": "订单状态:1-待审核;2-已审核", + "type": "integer" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, "models.ErpOrder": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index e5fc5c6..45a46b4 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -2390,6 +2390,181 @@ definitions: - remark - sms_content type: object + models.ErpMonthEndClosing: + properties: + audit_time: + description: 审核时间 + type: string + auditor_id: + description: 审核人 ID + type: integer + auditor_name: + description: 审核人姓名 + type: string + closing_end_date: + description: 月结结束时间,精确到天 + type: string + closing_start_date: + description: 月结开始时间,精确到天 + type: string + createdAt: + description: 创建时间 + type: string + id: + description: 数据库记录编号 + type: integer + maker_id: + description: 制单人 ID + type: integer + maker_name: + description: 制单人名称 + type: string + maker_time: + description: 制单时间 + type: string + serial_number: + description: 单据编号 + type: string + state: + description: 订单状态:1-待审核;2-已审核 + type: integer + updatedAt: + description: 更新时间 + type: string + type: object + models.ErpMonthEndClosingAuditReq: + properties: + serial_number: + description: 单据编号 + type: string + state: + description: '审核操作: 1-审核 2-取消审核' + type: integer + required: + - serial_number + - state + type: object + models.ErpMonthEndClosingCreateReq: + properties: + closing_end_date: + description: 月结结束时间,精确到天 + type: string + closing_start_date: + description: 月结开始时间,精确到天 + type: string + required: + - closing_end_date + - closing_start_date + type: object + models.ErpMonthEndClosingDateResp: + properties: + start_date: + description: 月结开始时间 + type: string + type: object + models.ErpMonthEndClosingDeleteReq: + properties: + serial_number: + description: 单据编号 + type: string + required: + - serial_number + type: object + models.ErpMonthEndClosingEditReq: + properties: + closing_end_date: + description: 月结结束时间,精确到天 + type: string + closing_start_date: + description: 月结开始时间,精确到天 + type: string + serial_number: + description: 单据编号 + type: string + required: + - closing_end_date + - closing_start_date + - serial_number + type: object + models.ErpMonthEndClosingListReq: + properties: + closing_end_date: + description: 月结结束时间 + type: string + closing_start_date: + description: 月结开始时间 + type: string + pageIndex: + description: 页码 + type: integer + pageSize: + description: 页面条数 + type: integer + serial_number: + description: 单据编号 + type: string + state: + description: 订单状态:1-待审核;2-已审核 + type: integer + type: object + models.ErpMonthEndClosingListResp: + properties: + list: + items: + $ref: '#/definitions/models.ErpMonthEndOrder' + type: array + pageIndex: + description: 页码 + type: integer + pageSize: + description: 每页展示条数 + type: integer + total: + description: 总条数 + type: integer + type: object + models.ErpMonthEndOrder: + properties: + audit_time: + description: 审核时间 + type: string + auditor_id: + description: 审核人 ID + type: integer + auditor_name: + description: 审核人姓名 + type: string + closing_end_date: + description: 月结结束时间,精确到天 + type: string + closing_start_date: + description: 月结开始时间,精确到天 + type: string + createdAt: + description: 创建时间 + type: string + id: + description: 数据库记录编号 + type: integer + maker_id: + description: 制单人 ID + type: integer + maker_name: + description: 制单人名称 + type: string + maker_time: + description: 制单时间 + type: string + serial_number: + description: 单据编号 + type: string + state: + description: 订单状态:1-待审核;2-已审核 + type: integer + updatedAt: + description: 更新时间 + type: string + type: object models.ErpOrder: properties: audit_time: @@ -9767,6 +9942,125 @@ paths: summary: 分页列表数据 / page list data tags: - system/工具 + /api/v1/decision/month_end_closing/audit: + post: + consumes: + - application/json + parameters: + - description: 财务月结-审核模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.ErpMonthEndClosingAuditReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/app.Response' + summary: 财务月结-审核 + tags: + - 决策中心,V1.4.0 + /api/v1/decision/month_end_closing/create: + post: + consumes: + - application/json + parameters: + - description: 财务月结-新增模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.ErpMonthEndClosingCreateReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/app.Response' + summary: 财务月结-新增 + tags: + - 决策中心,V1.4.0 + /api/v1/decision/month_end_closing/delete: + post: + consumes: + - application/json + parameters: + - description: 财务月结-删除模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.ErpMonthEndClosingDeleteReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/app.Response' + summary: 财务月结-删除 + tags: + - 决策中心,V1.4.0 + /api/v1/decision/month_end_closing/edit: + post: + consumes: + - application/json + parameters: + - description: 财务月结-编辑模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.ErpMonthEndClosingEditReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.ErpMonthEndClosing' + summary: 财务月结-编辑 + tags: + - 决策中心,V1.4.0 + /api/v1/decision/month_end_closing/list: + post: + consumes: + - application/json + parameters: + - description: 财务月结-列表模型 + in: body + name: request + required: true + schema: + $ref: '#/definitions/models.ErpMonthEndClosingListReq' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.ErpMonthEndClosingListResp' + summary: 财务月结-列表 + tags: + - 决策中心,V1.4.0 + /api/v1/decision/month_end_closing/start_date: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/models.ErpMonthEndClosingDateResp' + summary: 财务月结-获取开始日期 + tags: + - 决策中心,V1.4.0 /api/v1/decision/report: post: consumes: