作者 tangxuhui

添加合约变更

@@ -4,7 +4,9 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domai @@ -4,7 +4,9 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domai
4 4
5 type ListContractChangeLogQuery struct { 5 type ListContractChangeLogQuery struct {
6 //操作人 6 //操作人
7 - Operator domain.Operator `json:"-"`  
8 - PageNumber int ` json:"pageNumber,omitempty"` // 页码  
9 - PageSize int `json:"pageSize,omitempty"` // 页面大小 7 + Operator domain.Operator `json:"-"`
  8 + PageNumber int `json:"pageNumber,omitempty"` // 页码
  9 + PageSize int `json:"pageSize,omitempty"` // 页面大小
  10 + OperationType int `json:"operationType,"` // 合约变更操作类型,1编辑、2暂停、3恢复
  11 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
10 } 12 }
@@ -2,13 +2,23 @@ package service @@ -2,13 +2,23 @@ package service
2 2
3 import ( 3 import (
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
5 ) 6 )
6 7
7 type ContractChangeLogService struct{} 8 type ContractChangeLogService struct{}
8 9
  10 +func NewContractChangeLogService(options map[string]interface{}) *ContractChangeLogService {
  11 + newContractChangeLogService := &ContractChangeLogService{}
  12 + return newContractChangeLogService
  13 +}
  14 +
9 func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (interface{}, error) { 15 func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (interface{}, error) {
10 - //creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)  
11 - // _, err := creationCooperationGateway.CooperationContractsSearchByUndertaker(  
12 - // allied_creation_cooperation.ContractChangeLogsSearch{})  
13 - return nil, nil 16 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
  17 + result, err := creationCooperationGateway.CooperationContractChangeLogsSearch(allied_creation_cooperation.ReqContractChangeLogsSearch{
  18 + PageNumber: queryParam.PageNumber,
  19 + PageSize: queryParam.PageSize,
  20 + CooperationContractNumber: queryParam.CooperationContractNumber,
  21 + OperationType: queryParam.OperationType,
  22 + })
  23 + return result, err
14 } 24 }
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 +
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  9 +)
  10 +
  11 +// CooperationContractChangeLogsSearch 共创合约变更记录搜索
  12 +func (gateway HttplibAlliedCreationCooperation) CooperationContractChangeLogsSearch(param ReqContractChangeLogsSearch) (*DataContractChangeLogsSearch, error) {
  13 + url := gateway.baseUrL + "/cooperation-contract-change-logs/search"
  14 + method := "POST"
  15 + req := gateway.CreateRequest(url, method)
  16 + log.Logger.Debug("向业务模块请求数据:共创合约变更记录搜索。", map[string]interface{}{
  17 + "api": method + ":" + url,
  18 + "param": param,
  19 + })
  20 + req, err := req.JSONBody(param)
  21 + if err != nil {
  22 + return nil, fmt.Errorf("请求共创合约变更记录搜索失败:%w", err)
  23 + }
  24 +
  25 + byteResult, err := req.Bytes()
  26 + if err != nil {
  27 + return nil, fmt.Errorf("获取共创合约变更记录搜索失败:%w", err)
  28 + }
  29 + log.Logger.Debug("获取业务模块请求数据:共创合约变更记录搜索。", map[string]interface{}{
  30 + "result": string(byteResult),
  31 + })
  32 + var result service_gateway.GatewayResponse
  33 + err = json.Unmarshal(byteResult, &result)
  34 + if err != nil {
  35 + return nil, fmt.Errorf("解析共创合约变更记录搜索:%w", err)
  36 + }
  37 + var data DataContractChangeLogsSearch
  38 + err = gateway.GetResponseData(result, &data)
  39 + return &data, err
  40 +}
@@ -5,13 +5,15 @@ import "time" @@ -5,13 +5,15 @@ import "time"
5 //共创合约变更记录搜索 5 //共创合约变更记录搜索
6 type ( 6 type (
7 ReqContractChangeLogsSearch struct { 7 ReqContractChangeLogsSearch struct {
8 - PageNumber int ` json:"pageNumber,omitempty"` // 页码  
9 - PageSize int `json:"pageSize,omitempty"` // 页面大小  
10 - CompanyId int `json:"companyId"` //公司ID  
11 - OrgId int64 `json:"orgId"` // 组织机构ID  
12 - OrgIds []int64 `json:"orgIds"` // 关联的组织机构ID列表  
13 - UserId int64 ` json:"userId"` // 用户ID,  
14 - UserBaseId int64 `json:"userBaseId"` // 用户基础数据id 8 + OperationType int `json:"operationType,"` // 合约变更操作类型,1编辑、2暂停、3恢复
  9 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
  10 + PageNumber int ` json:"pageNumber,"` // 页码
  11 + PageSize int `json:"pageSize,"` // 页面大小
  12 + CompanyId int `json:"companyId"` //公司ID
  13 + OrgId int64 `json:"orgId"` // 组织机构ID
  14 + OrgIds []int64 `json:"orgIds"` // 关联的组织机构ID列表
  15 + UserId int64 ` json:"userId"` // 用户ID,
  16 + UserBaseId int64 `json:"userBaseId"` // 用户基础数据id
15 } 17 }
16 18
17 DataContractChangeLogsSearch struct { 19 DataContractChangeLogsSearch struct {
  1 +package web_client
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/service"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  7 +)
  8 +
  9 +type ContractChangeLogController struct {
  10 + baseController
  11 +}
  12 +
  13 +func (controller *ContractChangeLogController) ContractChangeLogSearch() {
  14 + cooperationContractService := service.NewContractChangeLogService(nil)
  15 + listContractChangeLogQuery := &query.ListContractChangeLogQuery{}
  16 + err := controller.Unmarshal(listContractChangeLogQuery)
  17 + if err != nil {
  18 + log.Logger.Debug("json err:" + err.Error())
  19 + controller.Response(nil, err)
  20 + return
  21 + }
  22 + listContractChangeLogQuery.Operator = controller.GetOperator()
  23 + data, err := cooperationContractService.ContractChangeLogSearch(listContractChangeLogQuery)
  24 + controller.Response(data, err)
  25 +}
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/contract-change-logs/search", &web_client.ContractChangeLogController{}, "Put:ContractChangeLogSearch")
  10 +}