作者 陈志颖

feat:添加分红预算接口

... ... @@ -9,6 +9,8 @@ import (
)
type CancelDividendsEstimateCommand struct {
// 承接人分红预算记录ID
DividendsEstimateId string `cname:"承接人分红预算记录ID" json:"dividendsEstimateId" valid:"Required"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"`
// 组织机构ID
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/service"
)
type DividendsEstimateController struct {
beego.BaseController
}
func (controller *DividendsEstimateController) CreateDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
createDividendsEstimateCommand := &command.CreateDividendsEstimateCommand{}
controller.Unmarshal(createDividendsEstimateCommand)
data, err := dividendsEstimateService.CreateDividendsEstimate(createDividendsEstimateCommand)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) UpdateDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
updateDividendsEstimateCommand := &command.UpdateDividendsEstimateCommand{}
controller.Unmarshal(updateDividendsEstimateCommand)
dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
updateDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
data, err := dividendsEstimateService.UpdateDividendsEstimate(updateDividendsEstimateCommand)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) GetDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
getDividendsEstimateQuery := &query.GetDividendsEstimateQuery{}
dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
getDividendsEstimateQuery.DividendsEstimateId = dividendsEstimateId
data, err := dividendsEstimateService.GetDividendsEstimate(getDividendsEstimateQuery)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) RemoveDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
removeDividendsEstimateCommand := &command.RemoveDividendsEstimateCommand{}
controller.Unmarshal(removeDividendsEstimateCommand)
dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
removeDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
data, err := dividendsEstimateService.RemoveDividendsEstimate(removeDividendsEstimateCommand)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) CancelDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
cancelDividendsEstimateCommand := &command.CancelDividendsEstimateCommand{}
controller.Unmarshal(cancelDividendsEstimateCommand)
dividendsEstimateId := controller.GetString(":dividendsEstimateId")
cancelDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
data, err := dividendsEstimateService.CancelDividendsEstimate(cancelDividendsEstimateCommand)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) SearchDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
searchDividendsEstimateQuery := &query.SearchDividendsEstimateQuery{}
data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) EstimateDividendsIncentives() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
estimateDividendsIncentivesCommand := &command.EstimateDividendsIncentivesCommand{}
controller.Unmarshal(estimateDividendsIncentivesCommand)
data, err := dividendsEstimateService.EstimateDividendsIncentives(estimateDividendsIncentivesCommand)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) EstimateMoneyIncentives() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
estimateMoneyIncentivesCommand := &command.EstimateMoneyIncentivesCommand{}
controller.Unmarshal(estimateMoneyIncentivesCommand)
data, err := dividendsEstimateService.EstimateMoneyIncentives(estimateMoneyIncentivesCommand)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) ListMoneyIncentives() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
listMoneyIncentivesQuery := &query.ListMoneyIncentivesQuery{}
data, err := dividendsEstimateService.ListMoneyIncentives(listMoneyIncentivesQuery)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) SearchMoneyIncentives() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
searchMoneyIncentivesQuery := &query.SearchMoneyIncentivesQuery{}
data, err := dividendsEstimateService.SearchMoneyIncentives(searchMoneyIncentivesQuery)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) ListDividendsIncentives() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
listDividendsIncentivesQuery := &query.ListDividendsIncentivesQuery{}
data, err := dividendsEstimateService.ListDividendsIncentives(listDividendsIncentivesQuery)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) SearchDividendsIncentives() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
searchDividendsIncentivesQuery := &query.SearchDividendsIncentivesQuery{}
data, err := dividendsEstimateService.SearchDividendsIncentives(searchDividendsIncentivesQuery)
controller.Response(data, err)
}
func (controller *DividendsEstimateController) ListDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
listDividendsEstimateQuery := &query.ListDividendsEstimateQuery{}
offset, _ := controller.GetInt("offset")
listDividendsEstimateQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listDividendsEstimateQuery.Limit = limit
data, err := dividendsEstimateService.ListDividendsEstimate(listDividendsEstimateQuery)
controller.Response(data, err)
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/port/beego/controllers"
)
func init() {
web.Router("/dividends-estimates/", &controllers.DividendsEstimateController{}, "Post:CreateDividendsEstimate")
web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Put:UpdateDividendsEstimate")
web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Get:GetDividendsEstimate")
web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Delete:RemoveDividendsEstimate")
web.Router("/dividends-estimates/:dividendsEstimateId/cancel", &controllers.DividendsEstimateController{}, "Post:CancelDividendsEstimate")
web.Router("/dividends-estimates/search", &controllers.DividendsEstimateController{}, "Post:SearchDividendsEstimate")
web.Router("/dividends-estimates/estimate-dividends-incentives", &controllers.DividendsEstimateController{}, "Post:EstimateDividendsIncentives")
web.Router("/dividends-estimates/estimate-money-incentives", &controllers.DividendsEstimateController{}, "Post:EstimateMoneyIncentives")
web.Router("/dividends-estimates/list-money-incentives", &controllers.DividendsEstimateController{}, "Get:ListMoneyIncentives")
web.Router("/dividends-estimates/search-money-incentives", &controllers.DividendsEstimateController{}, "Post:SearchMoneyIncentives")
web.Router("/dividends-estimates/list-dividends-incentives", &controllers.DividendsEstimateController{}, "Get:ListDividendsIncentives")
web.Router("/dividends-estimates/search-dividends-incentives", &controllers.DividendsEstimateController{}, "Post:SearchDividendsIncentives")
web.Router("/dividends-estimates/", &controllers.DividendsEstimateController{}, "Get:ListDividendsEstimate")
}
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("取消分红预算", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("取消分红预算", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.POST("/dividends-estimates/{dividendsEstimateId}/cancel").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("创建分红预算服务", func() {
Describe("提交数据创建分红预算服务", func() {
Context("提交正确的新分红预算实体数据", func() {
It("返回分红预算实体数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.POST("/dividends-estimates/").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("dividendsEstimateId").ValueNotEqual("dividendsEstimateId", BeZero())
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/port/beego"
)
func TestDividendsEstimate(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Beego Port DividendsEstimate Correlations Test Case Suite")
}
var handler http.Handler
var server *httptest.Server
var _ = BeforeSuite(func() {
handler = web.BeeApp.Handlers
server = httptest.NewServer(handler)
})
var _ = AfterSuite(func() {
server.Close()
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("确定预算分红激励", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("确定预算分红激励", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"orderOrReturnedOrderNum": "string",
"cooperationContractNumber": "string",
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.POST("/dividends-estimates/estimate-dividends-incentives").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("确定预算金额激励分红", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("确定预算金额激励分红", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"cooperationContractNumber": "string",
"dividendsIncentivesStage": "int64",
"undertakerUid": "string",
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.POST("/dividends-estimates/estimate-money-incentives").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("返回分红预算服务", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据dividendsEstimateId参数返回分红预算实体", func() {
Context("传入有效的dividendsEstimateId", func() {
It("返回分红预算实体数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/dividends-estimates/{dividendsEstimateId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("返回分红预算服务列表", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数返回分红预算实体列表", func() {
Context("传入有效的参数", func() {
It("返回分红预算实体数据列表", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/dividends-estimates/").
WithQuery("offset", "int").
WithQuery("limit", "int").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("count").ValueEqual("count", 1).
ContainsKey("dividendsEstimates").Value("dividendsEstimates").Array()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("返回业绩激励分红", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("返回业绩激励分红", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/dividends-estimates/list-dividends-incentives").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("返回金额激励分红", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("返回金额激励分红", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.GET("/dividends-estimates/list-money-incentives").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("移除分红预算服务", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("根据参数移除分红预算服务", func() {
Context("传入有效的dividendsEstimateId", func() {
It("返回被移除分红预算实体的数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.DELETE("/dividends-estimates/{dividendsEstimateId}").
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("查询分红预算单", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("查询分红预算单", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"dividendsEstimateOrderNumber": "string",
"dividendsType": "int32",
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.POST("/dividends-estimates/search").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("查询业绩分红", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("查询业绩分红", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"cooperationContractNumber": "string",
"orderOrReturnedOrderNum": "string",
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.POST("/dividends-estimates/search-dividends-incentives").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("查询金额激励分红", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("查询金额激励分红", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"cooperationContractName": "string",
"departmentName": "string",
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.POST("/dividends-estimates/search-money-incentives").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...
package dividends_estimate
import (
"net/http"
"github.com/gavv/httpexpect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
)
var _ = Describe("更新分红预算服务", func() {
var dividendsEstimateId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&dividendsEstimateId),
"INSERT INTO dividends_estimates (dividends_estimate_id, dividends_account_status, dividends_amount, dividends_estimate_order_number, dividends_estimate_time, dividends_participate_type, dividends_type, order_or_returned_order_num, cooperation_project_number, dividends_user, org, company, operator, operate_time, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING dividends_estimate_id",
"testDividendsEstimateId", "testDividendsAccountStatus", "testDividendsAmount", "testDividendsEstimateOrderNumber", "testDividendsEstimateTime", "testDividendsParticipateType", "testDividendsType", "testOrderOrReturnedOrderNum", "testCooperationProjectNumber", "testDividendsUser", "testOrg", "testCompany", "testOperator", "testOperateTime", "testCreatedAt", "testDeletedAt", "testUpdatedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("提交数据更新分红预算服务", func() {
Context("提交正确的分红预算实体数据", func() {
It("返回更新后的分红预算实体数据", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"companyId": "int64",
"orgId": "int64",
"userId": "int64",
}
httpExpect.PUT("/dividends-estimates/{dividendsEstimateId}").
WithJSON(body).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object().
ContainsKey("dividendsEstimateId").ValueEqual("dividendsEstimateId", dividendsEstimateId)
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM dividends_estimates WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...