1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package handler
- import (
- "github.com/gin-gonic/gin"
- "youngee_b_api/model/http_model"
- "youngee_b_api/service"
- )
- func WrapCreateSupplierInvoiceHandler(ctx *gin.Context) {
- handler := newCreateSupplierInvoiceHandler(ctx)
- baseRun(handler)
- }
- func newCreateSupplierInvoiceHandler(ctx *gin.Context) *CreateSupplierInvoiceHandler {
- return &CreateSupplierInvoiceHandler{
- req: http_model.NewCreateSupplierInvoiceRequest(),
- resp: http_model.NewCreateSupplierInvoiceResponse(),
- ctx: ctx,
- }
- }
- type CreateSupplierInvoiceHandler struct {
- req *http_model.CreateSupplierInvoiceRequest
- resp *http_model.CommonResponse
- ctx *gin.Context
- }
- func (h *CreateSupplierInvoiceHandler) getRequest() interface{} {
- return h.req
- }
- func (h *CreateSupplierInvoiceHandler) getContext() *gin.Context {
- return h.ctx
- }
- func (h *CreateSupplierInvoiceHandler) getResponse() interface{} {
- return h.resp
- }
- func (h *CreateSupplierInvoiceHandler) run() {
- // 1. 合并收入回票
- err := service.Supplier.CreateSupplierInvoice(h.ctx, h.req)
- if err != nil {
- h.resp.Data = err.Error()
- h.resp.Message = "合并失败"
- }
- // 2. 修改收入状态
- incomeErr := service.Supplier.UpdateSupplierIncomeStatus(h.ctx, h.req.IncomeIds, 2)
- if incomeErr != nil {
- h.resp.Data = incomeErr.Error()
- h.resp.Message = "修改收入状态失败"
- }
- h.resp.Message = "合并修改成功"
- }
- func (h *CreateSupplierInvoiceHandler) checkParam() error {
- return nil
- }
|