作者 陈志颖

feat:新增共创合约变更记录接口

@@ -11,7 +11,7 @@ import ( @@ -11,7 +11,7 @@ import (
11 11
12 type CreateContractUndertakerFeedbackCommand struct { 12 type CreateContractUndertakerFeedbackCommand struct {
13 // 合约承接方反馈内容附件 13 // 合约承接方反馈内容附件
14 - FeedbackAttachment []*domain.Attachment `cname:"合约承接方反馈内容附件" json:"feedbackAttachment"` 14 + FeedbackAttachment []*domain.Attachment `cname:"合约承接方反馈内容附件" json:"feedbackAttachment,omitempty"`
15 // 合约承接方反馈内容 15 // 合约承接方反馈内容
16 FeedbackContent string `cname:"合约承接方反馈内容" json:"feedbackContent" valid:"Required"` 16 FeedbackContent string `cname:"合约承接方反馈内容" json:"feedbackContent" valid:"Required"`
17 // 共创合约编号 17 // 共创合约编号
@@ -10,7 +10,7 @@ import ( @@ -10,7 +10,7 @@ import (
10 10
11 type UpdateCooperationContractChangeLogCommand struct { 11 type UpdateCooperationContractChangeLogCommand struct {
12 // 共创合约修改记录id 12 // 共创合约修改记录id
13 - CooperationContractChangeLogId string `cname:"共创合约修改记录ID" json:"cooperationContractChangeLogId" valid:"Required"` 13 + CooperationContractChangeLogId int64 `cname:"共创合约修改记录ID" json:"cooperationContractChangeLogId" valid:"Required"`
14 // 激励规则 14 // 激励规则
15 IncentivesRule string `cname:"激励规则" json:"incentivesRule" valid:"Required"` 15 IncentivesRule string `cname:"激励规则" json:"incentivesRule" valid:"Required"`
16 // 激励规则明细 16 // 激励规则明细
  1 +package controllers
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContractChangeLog/command"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContractChangeLog/query"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContractChangeLog/service"
  7 +)
  8 +
  9 +type CooperationContractChangeLogController struct {
  10 + BaseController
  11 +}
  12 +
  13 +func (controller *CooperationContractChangeLogController) CreateCooperationContractChangeLog() {
  14 + cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
  15 + createCooperationContractChangeLogCommand := &command.CreateCooperationContractChangeLogCommand{}
  16 + _ = controller.Unmarshal(createCooperationContractChangeLogCommand)
  17 + header := controller.GetRequestHeader(controller.Ctx)
  18 + createCooperationContractChangeLogCommand.CompanyId = header.CompanyId
  19 + createCooperationContractChangeLogCommand.OrgId = header.OrgId
  20 + createCooperationContractChangeLogCommand.UserId = header.UserId
  21 + createCooperationContractChangeLogCommand.UserBaseId = header.UserBaseId
  22 + data, err := cooperationContractChangeLogService.CreateCooperationContractChangeLog(createCooperationContractChangeLogCommand)
  23 + controller.Response(data, err)
  24 +}
  25 +
  26 +func (controller *CooperationContractChangeLogController) UpdateCooperationContractChangeLog() {
  27 + cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
  28 + updateCooperationContractChangeLogCommand := &command.UpdateCooperationContractChangeLogCommand{}
  29 + _ = controller.Unmarshal(updateCooperationContractChangeLogCommand)
  30 + header := controller.GetRequestHeader(controller.Ctx)
  31 + updateCooperationContractChangeLogCommand.CompanyId = header.CompanyId
  32 + updateCooperationContractChangeLogCommand.OrgId = header.OrgId
  33 + updateCooperationContractChangeLogCommand.UserId = header.UserId
  34 + updateCooperationContractChangeLogCommand.UserBaseId = header.UserBaseId
  35 + cooperationContractChangeLogId, _ := controller.GetInt64(":cooperationContractChangeLogId")
  36 + updateCooperationContractChangeLogCommand.CooperationContractChangeLogId = cooperationContractChangeLogId
  37 + data, err := cooperationContractChangeLogService.UpdateCooperationContractChangeLog(updateCooperationContractChangeLogCommand)
  38 + controller.Response(data, err)
  39 +}
  40 +
  41 +func (controller *CooperationContractChangeLogController) GetCooperationContractChangeLog() {
  42 + cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
  43 + getCooperationContractChangeLogQuery := &query.GetCooperationContractChangeLogQuery{}
  44 + header := controller.GetRequestHeader(controller.Ctx)
  45 + getCooperationContractChangeLogQuery.CompanyId = header.CompanyId
  46 + getCooperationContractChangeLogQuery.OrgId = header.OrgId
  47 + getCooperationContractChangeLogQuery.UserId = header.UserId
  48 + getCooperationContractChangeLogQuery.UserBaseId = header.UserBaseId
  49 + cooperationContractChangeLogId, _ := controller.GetInt64(":cooperationContractChangeLogId")
  50 + getCooperationContractChangeLogQuery.CooperationContractChangeLogId = cooperationContractChangeLogId
  51 + data, err := cooperationContractChangeLogService.GetCooperationContractChangeLog(getCooperationContractChangeLogQuery)
  52 + controller.Response(data, err)
  53 +}
  54 +
  55 +func (controller *CooperationContractChangeLogController) RemoveCooperationContractChangeLog() {
  56 + cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
  57 + removeCooperationContractChangeLogCommand := &command.RemoveCooperationContractChangeLogCommand{}
  58 + _ = controller.Unmarshal(removeCooperationContractChangeLogCommand)
  59 + header := controller.GetRequestHeader(controller.Ctx)
  60 + removeCooperationContractChangeLogCommand.CompanyId = header.CompanyId
  61 + removeCooperationContractChangeLogCommand.OrgId = header.OrgId
  62 + removeCooperationContractChangeLogCommand.UserId = header.UserId
  63 + removeCooperationContractChangeLogCommand.UserBaseId = header.UserBaseId
  64 + cooperationContractChangeLogId, _ := controller.GetInt64(":cooperationContractChangeLogId")
  65 + removeCooperationContractChangeLogCommand.CooperationContractChangeLogId = cooperationContractChangeLogId
  66 + data, err := cooperationContractChangeLogService.RemoveCooperationContractChangeLog(removeCooperationContractChangeLogCommand)
  67 + controller.Response(data, err)
  68 +}
  69 +
  70 +func (controller *CooperationContractChangeLogController) ListCooperationContractChangeLog() {
  71 + cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
  72 + listCooperationContractChangeLogQuery := &query.ListCooperationContractChangeLogQuery{}
  73 + header := controller.GetRequestHeader(controller.Ctx)
  74 + listCooperationContractChangeLogQuery.CompanyId = header.CompanyId
  75 + listCooperationContractChangeLogQuery.OrgId = header.OrgId
  76 + listCooperationContractChangeLogQuery.UserId = header.UserId
  77 + listCooperationContractChangeLogQuery.UserBaseId = header.UserBaseId
  78 + pageSize, _ := controller.GetInt64("pageSize")
  79 + listCooperationContractChangeLogQuery.PageSize = pageSize
  80 + pageNumber, _ := controller.GetInt64("pageNumber")
  81 + listCooperationContractChangeLogQuery.PageNumber = pageNumber
  82 + data, err := cooperationContractChangeLogService.ListCooperationContractChangeLog(listCooperationContractChangeLogQuery)
  83 + controller.Response(data, err)
  84 +}
  85 +
  86 +func (controller *CooperationContractChangeLogController) SearchCooperationContractChangeLog() {
  87 + cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
  88 + searchCooperationContractChangeLogQuery := &query.SearchCooperationContractChangeLogQuery{}
  89 + _ = controller.Unmarshal(searchCooperationContractChangeLogQuery)
  90 + header := controller.GetRequestHeader(controller.Ctx)
  91 + searchCooperationContractChangeLogQuery.CompanyId = header.CompanyId
  92 + searchCooperationContractChangeLogQuery.OrgId = header.OrgId
  93 + searchCooperationContractChangeLogQuery.UserId = header.UserId
  94 + searchCooperationContractChangeLogQuery.UserBaseId = header.UserBaseId
  95 + data, err := cooperationContractChangeLogService.SearchCooperationContractChangeLog(searchCooperationContractChangeLogQuery)
  96 + controller.Response(data, err)
  97 +}
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/port/beego/controllers"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/cooperation-contract-change-logs/", &controllers.CooperationContractChangeLogController{}, "Post:CreateCooperationContractChangeLog") // 新增共创合约变更记录(预留)
  10 + web.Router("/cooperation-contract-change-logs/:cooperationContractChangeLogId", &controllers.CooperationContractChangeLogController{}, "Put:UpdateCooperationContractChangeLog") // 编辑共创合约变更记录(预留)
  11 + web.Router("/cooperation-contract-change-logs/:cooperationContractChangeLogId", &controllers.CooperationContractChangeLogController{}, "Get:GetCooperationContractChangeLog") // 获取共创合约变更记录详情(预留)
  12 + web.Router("/cooperation-contract-change-logs/:cooperationContractChangeLogId", &controllers.CooperationContractChangeLogController{}, "Delete:RemoveCooperationContractChangeLog") // 移除共创合约变更记录(预留)
  13 + web.Router("/cooperation-contract-change-logs/", &controllers.CooperationContractChangeLogController{}, "Get:ListCooperationContractChangeLog") // 返回共创合约变更记录列表
  14 + web.Router("/cooperation-contract-change-logs/search", &controllers.CooperationContractChangeLogController{}, "Post:SearchCooperationContractChangeLog") // 查询共创合约变更记录
  15 +}
  1 +package cooperation_contract_change_log
  2 +
  3 +import (
  4 + "net/http"
  5 + "net/http/httptest"
  6 + "testing"
  7 +
  8 + "github.com/beego/beego/v2/server/web"
  9 + . "github.com/onsi/ginkgo"
  10 + . "github.com/onsi/gomega"
  11 + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application"
  12 + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
  13 + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/port/beego"
  14 +)
  15 +
  16 +func TestCooperationContractChangeLog(t *testing.T) {
  17 + RegisterFailHandler(Fail)
  18 + RunSpecs(t, "Beego Port CooperationContractChangeLog Correlations Test Case Suite")
  19 +}
  20 +
  21 +var handler http.Handler
  22 +var server *httptest.Server
  23 +
  24 +var _ = BeforeSuite(func() {
  25 + handler = web.BeeApp.Handlers
  26 + server = httptest.NewServer(handler)
  27 +})
  28 +
  29 +var _ = AfterSuite(func() {
  30 + server.Close()
  31 +})
  1 +package cooperation_contract_change_log
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 + . "github.com/onsi/gomega"
  9 + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
  10 +)
  11 +
  12 +var _ = Describe("创建共创合约变更日志", func() {
  13 + Describe("提交数据创建共创合约变更日志", func() {
  14 + Context("提交正确的新共创合约变更日志数据", func() {
  15 + It("返回共创合约变更日志数据", func() {
  16 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  17 + body := map[string]interface{}{
  18 + "incentivesRule": "string",
  19 + "incentivesRuleDetail": "string",
  20 + "operationType": "int32",
  21 + "undertakers": "string",
  22 + "cooperationContractNumber": "string",
  23 + "companyId": "int64",
  24 + "orgId": "int64",
  25 + "userId": "int64",
  26 + }
  27 + httpExpect.POST("/cooperation-contract-change-logs/").
  28 + WithJSON(body).
  29 + Expect().
  30 + Status(http.StatusOK).
  31 + JSON().
  32 + Object().
  33 + ContainsKey("code").ValueEqual("code", 0).
  34 + ContainsKey("msg").ValueEqual("msg", "ok").
  35 + ContainsKey("data").Value("data").Object().
  36 + ContainsKey("cooperationContractChangeLogId").ValueNotEqual("cooperationContractChangeLogId", BeZero())
  37 + })
  38 + })
  39 + })
  40 + AfterEach(func() {
  41 + _, err := pG.DB.Exec("DELETE FROM cooperation_contract_change_logs WHERE true")
  42 + Expect(err).NotTo(HaveOccurred())
  43 + })
  44 +})
  1 +package cooperation_contract_change_log
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 + . "github.com/onsi/gomega"
  9 + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
  10 +)
  11 +
  12 +var _ = Describe("返回共创合约变更日志", func() {
  13 + var cooperationContractChangeLogId int64
  14 + BeforeEach(func() {
  15 + _, err := pG.DB.QueryOne(
  16 + pg.Scan(&cooperationContractChangeLogId),
  17 + "INSERT INTO cooperation_contract_change_logs (cooperation_contract_change_log_id, incentives_rule, incentives_rule_detail, operation_type, cooperation_contract_number, undertakers, company, operator, updated_at, deleted_at, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING cooperation_contract_change_log_id",
  18 + "testCooperationContractChangeLogId", "testIncentivesRule", "testIncentivesRuleDetail", "testOperationType", "testCooperationContractNumber", "testUndertakers", "testCompany", "testOperator", "testUpdatedAt", "testDeletedAt", "testCreatedAt")
  19 + Expect(err).NotTo(HaveOccurred())
  20 + })
  21 + Describe("根据cooperationContractChangeLogId参数返回共创合约变更日志", func() {
  22 + Context("传入有效的cooperationContractChangeLogId", func() {
  23 + It("返回共创合约变更日志数据", func() {
  24 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  25 + httpExpect.GET("/cooperation-contract-change-logs/{cooperationContractChangeLogId}").
  26 + Expect().
  27 + Status(http.StatusOK).
  28 + JSON().
  29 + Object().
  30 + ContainsKey("code").ValueEqual("code", 0).
  31 + ContainsKey("msg").ValueEqual("msg", "ok").
  32 + ContainsKey("data").Value("data").Object()
  33 + })
  34 + })
  35 + })
  36 + AfterEach(func() {
  37 + _, err := pG.DB.Exec("DELETE FROM cooperation_contract_change_logs WHERE true")
  38 + Expect(err).NotTo(HaveOccurred())
  39 + })
  40 +})
  1 +package cooperation_contract_change_log
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 + . "github.com/onsi/gomega"
  9 + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
  10 +)
  11 +
  12 +var _ = Describe("返回共创合约变更日志列表", func() {
  13 + var cooperationContractChangeLogId int64
  14 + BeforeEach(func() {
  15 + _, err := pG.DB.QueryOne(
  16 + pg.Scan(&cooperationContractChangeLogId),
  17 + "INSERT INTO cooperation_contract_change_logs (cooperation_contract_change_log_id, incentives_rule, incentives_rule_detail, operation_type, cooperation_contract_number, undertakers, company, operator, updated_at, deleted_at, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING cooperation_contract_change_log_id",
  18 + "testCooperationContractChangeLogId", "testIncentivesRule", "testIncentivesRuleDetail", "testOperationType", "testCooperationContractNumber", "testUndertakers", "testCompany", "testOperator", "testUpdatedAt", "testDeletedAt", "testCreatedAt")
  19 + Expect(err).NotTo(HaveOccurred())
  20 + })
  21 + Describe("根据参数返回共创合约变更日志列表", func() {
  22 + Context("传入有效的参数", func() {
  23 + It("返回共创合约变更日志数据列表", func() {
  24 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  25 + httpExpect.GET("/cooperation-contract-change-logs/").
  26 + WithQuery("offset", "int").
  27 + WithQuery("limit", "int").
  28 + Expect().
  29 + Status(http.StatusOK).
  30 + JSON().
  31 + Object().
  32 + ContainsKey("code").ValueEqual("code", 0).
  33 + ContainsKey("msg").ValueEqual("msg", "ok").
  34 + ContainsKey("data").Value("data").Object().
  35 + ContainsKey("count").ValueEqual("count", 1).
  36 + ContainsKey("cooperationContractChangeLogs").Value("cooperationContractChangeLogs").Array()
  37 + })
  38 + })
  39 + })
  40 + AfterEach(func() {
  41 + _, err := pG.DB.Exec("DELETE FROM cooperation_contract_change_logs WHERE true")
  42 + Expect(err).NotTo(HaveOccurred())
  43 + })
  44 +})
  1 +package cooperation_contract_change_log
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 + . "github.com/onsi/gomega"
  9 + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
  10 +)
  11 +
  12 +var _ = Describe("移除共创合约变更日志", func() {
  13 + var cooperationContractChangeLogId int64
  14 + BeforeEach(func() {
  15 + _, err := pG.DB.QueryOne(
  16 + pg.Scan(&cooperationContractChangeLogId),
  17 + "INSERT INTO cooperation_contract_change_logs (cooperation_contract_change_log_id, incentives_rule, incentives_rule_detail, operation_type, cooperation_contract_number, undertakers, company, operator, updated_at, deleted_at, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING cooperation_contract_change_log_id",
  18 + "testCooperationContractChangeLogId", "testIncentivesRule", "testIncentivesRuleDetail", "testOperationType", "testCooperationContractNumber", "testUndertakers", "testCompany", "testOperator", "testUpdatedAt", "testDeletedAt", "testCreatedAt")
  19 + Expect(err).NotTo(HaveOccurred())
  20 + })
  21 + Describe("根据参数移除共创合约变更日志", func() {
  22 + Context("传入有效的cooperationContractChangeLogId", func() {
  23 + It("返回被移除共创合约变更日志的数据", func() {
  24 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  25 + httpExpect.DELETE("/cooperation-contract-change-logs/{cooperationContractChangeLogId}").
  26 + Expect().
  27 + Status(http.StatusOK).
  28 + JSON().
  29 + Object().
  30 + ContainsKey("code").ValueEqual("code", 0).
  31 + ContainsKey("msg").ValueEqual("msg", "ok").
  32 + ContainsKey("data").Value("data").Object()
  33 + })
  34 + })
  35 + })
  36 + AfterEach(func() {
  37 + _, err := pG.DB.Exec("DELETE FROM cooperation_contract_change_logs WHERE true")
  38 + Expect(err).NotTo(HaveOccurred())
  39 + })
  40 +})
  1 +package cooperation_contract_change_log
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 + . "github.com/onsi/gomega"
  9 + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
  10 +)
  11 +
  12 +var _ = Describe("共创合约变更记录搜索", func() {
  13 + var cooperationContractChangeLogId int64
  14 + BeforeEach(func() {
  15 + _, err := pG.DB.QueryOne(
  16 + pg.Scan(&cooperationContractChangeLogId),
  17 + "INSERT INTO cooperation_contract_change_logs (cooperation_contract_change_log_id, incentives_rule, incentives_rule_detail, operation_type, cooperation_contract_number, undertakers, company, operator, updated_at, deleted_at, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING cooperation_contract_change_log_id",
  18 + "testCooperationContractChangeLogId", "testIncentivesRule", "testIncentivesRuleDetail", "testOperationType", "testCooperationContractNumber", "testUndertakers", "testCompany", "testOperator", "testUpdatedAt", "testDeletedAt", "testCreatedAt")
  19 + Expect(err).NotTo(HaveOccurred())
  20 + })
  21 + Describe("共创合约变更记录搜索", func() {
  22 + Context("", func() {
  23 + It("", func() {
  24 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  25 + body := map[string]interface{}{
  26 + "operationType": "int32",
  27 + "cooperationContractNumber": "string",
  28 + "pageSize": "int32",
  29 + "pageNumber": "int32",
  30 + "companyId": "int64",
  31 + "orgId": "int64",
  32 + "userId": "int64",
  33 + }
  34 + httpExpect.POST("/cooperation-contract-change-logs/search").
  35 + WithJSON(body).
  36 + Expect().
  37 + Status(http.StatusOK).
  38 + JSON().
  39 + Object().
  40 + ContainsKey("code").ValueEqual("code", 0).
  41 + ContainsKey("msg").ValueEqual("msg", "ok").
  42 + ContainsKey("data").Value("data").Object()
  43 + })
  44 + })
  45 + })
  46 + AfterEach(func() {
  47 + _, err := pG.DB.Exec("DELETE FROM cooperation_contract_change_logs WHERE true")
  48 + Expect(err).NotTo(HaveOccurred())
  49 + })
  50 +})
  1 +package cooperation_contract_change_log
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/gavv/httpexpect"
  7 + . "github.com/onsi/ginkgo"
  8 + . "github.com/onsi/gomega"
  9 + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg"
  10 +)
  11 +
  12 +var _ = Describe("更新共创合约变更日志", func() {
  13 + var cooperationContractChangeLogId int64
  14 + BeforeEach(func() {
  15 + _, err := pG.DB.QueryOne(
  16 + pg.Scan(&cooperationContractChangeLogId),
  17 + "INSERT INTO cooperation_contract_change_logs (cooperation_contract_change_log_id, incentives_rule, incentives_rule_detail, operation_type, cooperation_contract_number, undertakers, company, operator, updated_at, deleted_at, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING cooperation_contract_change_log_id",
  18 + "testCooperationContractChangeLogId", "testIncentivesRule", "testIncentivesRuleDetail", "testOperationType", "testCooperationContractNumber", "testUndertakers", "testCompany", "testOperator", "testUpdatedAt", "testDeletedAt", "testCreatedAt")
  19 + Expect(err).NotTo(HaveOccurred())
  20 + })
  21 + Describe("提交数据更新共创合约变更日志", func() {
  22 + Context("提交正确的共创合约变更日志数据", func() {
  23 + It("返回更新后的共创合约变更日志数据", func() {
  24 + httpExpect := httpexpect.New(GinkgoT(), server.URL)
  25 + body := map[string]interface{}{
  26 + "incentivesRule": "string",
  27 + "incentivesRuleDetail": "string",
  28 + "operationType": "int32",
  29 + "undertakers": "string",
  30 + "cooperationContractNumber": "string",
  31 + "companyId": "int64",
  32 + "orgId": "int64",
  33 + "userId": "int64",
  34 + }
  35 + httpExpect.PUT("/cooperation-contract-change-logs/{cooperationContractChangeLogId}").
  36 + WithJSON(body).
  37 + Expect().
  38 + Status(http.StatusOK).
  39 + JSON().
  40 + Object().
  41 + ContainsKey("code").ValueEqual("code", 0).
  42 + ContainsKey("msg").ValueEqual("msg", "ok").
  43 + ContainsKey("data").Value("data").Object().
  44 + ContainsKey("cooperationContractChangeLogId").ValueEqual("cooperationContractChangeLogId", cooperationContractChangeLogId)
  45 + })
  46 + })
  47 + })
  48 + AfterEach(func() {
  49 + _, err := pG.DB.Exec("DELETE FROM cooperation_contract_change_logs WHERE true")
  50 + Expect(err).NotTo(HaveOccurred())
  51 + })
  52 +})