作者 tangxuhui

添加合约变更

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