作者 tangxuhui

增加 业务模块 gateway

... ... @@ -12,6 +12,9 @@ var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
//天联共创用户模块
var ALLIED_CREATION_USER_HOST = "http://localhost:8081"
//天联共创业务模块
var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8081"
//通用模块短信服务
var SMS_SERVE_HOST = "http://localhost:8081"
... ...
package allied_creation_cooperation
import (
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
type HttplibAlliedCreationCooperation struct {
service_gateway.BaseServiceGateway
baseUrL string
}
func NewHttplibAlliedCreationCooperation(operator domain.Operator) *HttplibAlliedCreationCooperation {
return &HttplibAlliedCreationCooperation{
BaseServiceGateway: service_gateway.BaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 30 * time.Second,
CompanyId: operator.CompanyId,
OrgId: operator.OrgId,
UserId: operator.UserId,
UserBaseId: operator.UserBaseId,
},
baseUrL: constant.ALLIED_CREATION_USER_HOST,
}
}
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
// CooperationApplicationUpdaet 更新共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationUpdaet(param ReqCooperationApplicationUpdate) (*DataCooperationApplicationUpdate, error) {
url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId)
method := "PUT"
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 DataCooperationApplicationUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationsBatchApproval 共创申请一键审核
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsBatchApproval(param ReqCooperationApplicationBatchApproval) (*DataCooperationApplicationBatchApproval, error) {
url := gateway.baseUrL + "/cooperation-applications/batch-approval"
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 DataCooperationApplicationBatchApproval
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationCancel 取消共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationCancel(param ReqCooperationApplicationCancel) (*DataCooperationApplicationCancel, error) {
url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId) + "/cancel-application"
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 DataCooperationApplicationCancel
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationsAgree 审核-同意共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsAgree(param ReqCooperationApplicationAgree) (*DataCooperationApplicationAgree, error) {
url := gateway.baseUrL + "/cooperation-applications/agree-cooperation-application"
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 DataCooperationApplicationAgree
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationsReject审核-拒绝共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationReject(param ReqCooperationApplicationReject) (*DataCooperationApplicationReject, error) {
url := gateway.baseUrL + "/cooperation-applications/reject-cooperation-application"
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 DataCooperationApplicationReject
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationAdd 创建共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationAdd(param ReqCooperationApplicationAdd) (*DataCooperationApplicationAdd, error) {
url := gateway.baseUrL + "/cooperation-applications"
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 DataCooperationApplicationAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Cooperation-applicationsSearch 查询共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsSearch(param ReqCooperationApplicationSearch) (*DataCooperationApplicationSearch, error) {
url := gateway.baseUrL + "/cooperation-applications/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 DataCooperationApplicationSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationsApply 申请共创
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsApply(param ReqCooperationApplicationApply) (*DataCooperationApplicationApply, error) {
url := gateway.baseUrL + "/cooperation-applications/apply-for-cooperation"
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 DataCooperationApplicationApply
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationRemove 移除共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationRemove(param ReqCooperationApplicationRemove) (*DataCooperationApplicationRemove, error) {
url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId)
method := "DELETE"
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 DataCooperationApplicationRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationList 返回共创申请列表
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationList(param ReqCooperationApplicationList) (*DataCooperationApplicationList, error) {
url := gateway.baseUrL + "/cooperation-applications"
method := "GET"
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 DataCooperationApplicationList
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationApplicationGet 返回共创申请详情
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationGet(param ReqCooperationApplicationGet) (*DataCooperationApplicationGet, error) {
url := gateway.baseUrL + "/cooperation-applications/{cooperationApplicationId}"
method := "GET"
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 DataCooperationApplicationGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
// CooperationContractAdd 创建共创合约
func (gateway HttplibAlliedCreationCooperation) CooperationContractAdd(param ReqCooperationContractAdd) (*DataCooperationContractAdd, error) {
url := gateway.baseUrL + "/cooperation-contracts"
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 DataCooperationContractAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationContractUpdate 更新共创合约
func (gateway HttplibAlliedCreationCooperation) CooperationContractUpdate(param ReqCooperationContractUpdate) (*DataCooperationContractUpdate, error) {
url := gateway.baseUrL + "/cooperation-contracts/" + strconv.Itoa(param.CooperationContractId)
method := "PUT"
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 DataCooperationContractUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationContractSearch 查询共创合约
func (gateway HttplibAlliedCreationCooperation) CooperationContractSearch(param ReqCooperationContractSearch) (*DataCooperationContractSearch, error) {
url := gateway.baseUrL + "/cooperation-contracts/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 DataCooperationContractSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationContractsSearchByUndertaker 根据承接人查询并返回共创项目合约
func (gateway HttplibAlliedCreationCooperation) CooperationContractsSearchByUndertaker(param ReqCooperationContractSearchByUndertaker) (*DataCooperationContractSearchByUndertaker, error) {
url := gateway.baseUrL + "/cooperation-contracts/search-by-undertaker"
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 DataCooperationContractSearchByUndertaker
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationContractRemove 移除共创合约
func (gateway HttplibAlliedCreationCooperation) CooperationContractRemove(param ReqCooperationContractRemove) (*DataCooperationContractRemove, error) {
url := gateway.baseUrL + "/cooperation-contracts/" + strconv.Itoa(param.CooperationContractId)
method := "DELETE"
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 DataCooperationContractRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationContractList 返回共创合约列表
func (gateway HttplibAlliedCreationCooperation) CooperationContractList(param ReqCooperationContractList) (*DataCooperationContractList, error) {
url := gateway.baseUrL + "/cooperation-contracts"
method := "GET"
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 DataCooperationContractList
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationContractGet 返回共创合约详情
func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param ReqCooperationContractGet) (*DataCooperationContractGet, error) {
url := gateway.baseUrL + "/cooperation-contracts/" + strconv.Itoa(param.CooperationContractId)
method := "GET"
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 DataCooperationContractGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
// ReqCooperationModeAdd 创建共创模式
func (gateway HttplibAlliedCreationCooperation) CooperationModeAdd(param ReqCooperationModeAdd) (*DataCooperationModeAdd, error) {
url := gateway.baseUrL + "/cooperation-modes"
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 DataCooperationModeAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationModeList 返回共创模式列表
func (gateway HttplibAlliedCreationCooperation) CooperationModeList(param ReqCooperationModeList) (*DataCooperationModeList, error) {
url := gateway.baseUrL + "/cooperation-modes"
method := "get"
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 DataCooperationModeList
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationModeGet 返回共创模式详情
func (gateway HttplibAlliedCreationCooperation) CooperationModeGet(param ReqCooperationModeGet) (*DataCooperationModeGet, error) {
url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.ModeId)
method := "get"
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 DataCooperationModeGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationModeUpdate 更新共创模式
func (gateway HttplibAlliedCreationCooperation) CooperationModeUpdate(param ReqCooperationModeUpdate) (*DataCooperationModeUpdate, error) {
url := gateway.baseUrL + "/cooperation-modes" + strconv.Itoa(param.ModeId)
method := "put"
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 DataCooperationModeUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
//CooperationModeRemove 移除共创模式
func (gateway HttplibAlliedCreationCooperation) CooperationModeRemove(param ReqCooperationModeRemove) (*DataCooperationModeRemove, error) {
url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.ModeId)
method := "delete"
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 DataCooperationModeRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationModesSearch查询共创模式
func (gateway HttplibAlliedCreationCooperation) CooperationModesSearch(param ReqCooperationModesSearch) (*DataCooperationModesSearch, error) {
url := gateway.baseUrL + "/cooperation-modes/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 DataCooperationModesSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
// CooperationProjectAdd 创建共创项目
func (gateway HttplibAlliedCreationCooperation) CooperationProjectAdd(param ReqCooperationProjectAdd) (*DataCooperationProjectAdd, error) {
url := gateway.baseUrL + "/cooperation-projects"
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 DataCooperationProjectAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationProjectList 返回共创项目列表
func (gateway HttplibAlliedCreationCooperation) CooperationProjectList(param ReqCooperationProjectList) (*DataCooperationProjectList, error) {
url := gateway.baseUrL + "/cooperation-projects"
method := "GET"
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 DataCooperationProjectList
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Cooperation-projects[cooperationProjectId} 返回共创项目详情
func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqCooperationProjectGet) (*DataCooperationProjectGet, error) {
url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId)
method := "GET"
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 DataCooperationProjectGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationProjectUpdate 更新共创项目
func (gateway HttplibAlliedCreationCooperation) CooperationProjectUpdate(param ReqCooperationProjectUpdate) (*DataCooperationProjectUpdate, error) {
url := gateway.baseUrL + "/cooperation-projects/{cooperationProjectId}"
method := "PUT"
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 DataCooperationProjectUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
//CooperationProjectRemove 移除共创项目
func (gateway HttplibAlliedCreationCooperation) CooperationProjectRemove(param ReqCooperationProjectRemove) (*DataCooperationProjectRemove, error) {
url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId)
method := "DELETE"
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 DataCooperationProjectRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationProjectsRelease发布共创项目
func (gateway HttplibAlliedCreationCooperation) CooperationProjectsRelease(param ReqCooperationProjectsRelease) (*DataCooperationProjectsRelease, error) {
url := gateway.baseUrL + "/cooperation-projects/release-cooperation-project"
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 DataCooperationProjectsRelease
err = gateway.GetResponseData(result, &data)
return &data, err
}
//CooperationProjectsSearch 查询共创项目
func (gateway HttplibAlliedCreationCooperation) CooperationProjectsSearch(param ReqCooperationProjectSearch) (*DataCooperationProjectSearch, error) {
url := gateway.baseUrL + "/cooperation-projects/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 DataCooperationProjectSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationProjectsCheck 判断当前勾选的承接对象是否存在用户
func (gateway HttplibAlliedCreationCooperation) CooperationProjectsCheck(param ReqCooperationProjectsCheck) (*DataCooperationProjectsCheck, error) {
url := gateway.baseUrL + "/cooperation-projects/check"
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 DataCooperationProjectsCheck
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
// DividendsOrderAdd 创建分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDividendsOrderAdd) (*DataDividendsOrderAdd, error) {
url := gateway.baseUrL + "/dividends-orders"
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 DataDividendsOrderAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsOrderUpdate 更新分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderUpdate(param ReqDividendsOrderUpdate) (*DataDividendsOrderUpdate, error) {
url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
method := "PUT"
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 DataDividendsOrderUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsOrderSearch 查询分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderSearch(param ReqDividendsOrderSearch) (*DataDividendsOrderSearch, error) {
url := gateway.baseUrL + "/dividends-orders/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 DataDividendsOrderSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
// SearchOrderNumber 模糊查询分红订单号
func (gateway HttplibAlliedCreationCooperation) SearchOrderNumber(param ReqSearchOrderNumber) (*DataSearchOrderNumber, error) {
url := gateway.baseUrL + "/search-order-number"
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 DataSearchOrderNumber
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsOrderRemove 移除分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderRemove(param ReqDividendsOrderRemove) (*DataDividendsOrderRemove, error) {
url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
method := "DELETE"
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 DataDividendsOrderRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
//DividendsOrderList 返回分红订单列表
func (gateway HttplibAlliedCreationCooperation) DividendsOrderList(param ReqDividendsOrderList) (*DataDividendsOrderList, error) {
url := gateway.baseUrL + "/dividends-orders"
method := "GET"
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 DataDividendsOrderList
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsOrderGet 返回分红订单详情
func (gateway HttplibAlliedCreationCooperation) DividendsOrderGet(param ReqDividendsOrderGet) (*DataDividendsOrderGet, error) {
url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
method := "GET"
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 DataDividendsOrderGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
// DividendsEstimateIncentive 确定预算分红激励
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateIncentive(param ReqDividendsEstimateIncentive) (*DataDividendsEstimateIncentive, error) {
url := gateway.baseUrL + "/dividends-estimates/estimate-dividends-incentives"
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 DataDividendsEstimateIncentive
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimateAdd 创建分红预算
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateAdd(param ReqDividendsEstimateAdd) (*DataDividendsEstimateAdd, error) {
url := gateway.baseUrL + "/dividends-estimates"
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 DataDividendsEstimateAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimateUpdate 更新分红预算
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateUpdate(param ReqDividendsEstimateUpdate) (*DataDividendsEstimateUpdate, error) {
url := gateway.baseUrL + "/dividends-estimates/{dividendsEstimateId}"
method := "PUT"
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 DataDividendsEstimateUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimatesSearch-dividends-incentives 查询业绩分红
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateSearchDividends(param ReqDividendsEstimateSearchDividend) (*DataDividendsEstimateSearchDividend,error) {
url := gateway.baseUrL + "/dividends-estimates/search-dividends-incentives"
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 DataDividendsEstimateSearchDividend
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimatesSearch查询分红预算单
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesSearch(param ReqDividendsEstimatesSearch) (*DataDividendsEstimatesSearch, error) {
url := gateway.baseUrL + "/dividends-estimates/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 DataDividendsEstimatesSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimatesSearchMoney 查询金额激励分红
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesSearchMoney(param ReqDividendsEstimateSearchMoney) (*DataDividendsEstimateSearchMoney, error) {
url := gateway.baseUrL + "/dividends-estimates/search-money-incentives"
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 DataDividendsEstimateSearchMoney
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimates[dividendsEstimateId}Cancel 取消分红预算
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesCancel(param ReqDividendsEstimateCancel) (*DataDividendsEstimatesCancel, error) {
url := gateway.baseUrL + "/dividends-estimates/"+strconv.ItoA(param.DividendsEstimateId)+"/cancel"
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 DataDividendsEstimatesCancel
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimatesEstimate-money-incentives 确定预算金额激励分红
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesEstimateMoneys(param ReqDividendsEestimatesEstimateMoney) (*DataDividendsEstimatesEstimateMoney, error) {
url := gateway.baseUrL + "/dividends-estimates/estimate-money-incentives"
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 DataDividendsEstimatesEstimateMoney
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimates[dividendsEstimateId} 移除分红预算
func (gateway HttplibAlliedCreationCooperation) DividendAestimatesdivDidendsEstimat(param ReqDividendsEstimateRemove) (
*DataDividendsEstimateRemove, error) {
url := gateway.baseUrL + "/dividends-estimates/"+strconv.Itoa(param.DividendsEstimateId)
method := "DELETE"
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 DataDividendsEstimateRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimatesList-dividends-incentives 返回业绩激励分红详情
func (gateway HttplibAlliedCreationCooperation) Dividends-estimatesList-dividends-incentives(param ReqDividends-estimatesList-dividends-incentives) (*DataDividends-estimatesList-dividends-incentives, error) {
url := gateway.baseUrL + "/dividends-estimates/list-dividends-incentives"
method := "GET"
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 DataDividends-estimatesList-dividends-incentives
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimates 返回分红预算列表
func (gateway HttplibAlliedCreationCooperation) Dividends-estimates(param ReqDividends-estimates) (*DataDividends-estimates, error) {
url := gateway.baseUrL + "/dividends-estimates"
method := "GET"
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 DataDividends-estimates
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimates[dividendsEstimateId} 返回分红预算详情
func (gateway HttplibAlliedCreationCooperation) Dividends-estimates[dividendsEstimateId}(param ReqDividends-estimates[dividendsEstimateId}) (*DataDividends-estimates[dividendsEstimateId}, error) {
url := gateway.baseUrL + "/dividends-estimates/{dividendsEstimateId}"
method := "GET"
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 DataDividends-estimates[dividendsEstimateId}
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Dividends-estimatesList-money-incentives 返回金额激励分红列表
func (gateway HttplibAlliedCreationCooperation) Dividends-estimatesList-money-incentives(param ReqDividends-estimatesList-money-incentives) (*DataDividends-estimatesList-money-incentives, error) {
url := gateway.baseUrL + "/dividends-estimates/list-money-incentives"
method := "GET"
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 DataDividends-estimatesList-money-incentives
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
package allied_creation_cooperation
//更新共创申请
type (
ReqCooperationApplicationUpdate struct {
ApplicationId int
}
DataCooperationApplicationUpdate struct {
}
)
//共创申请一键审核
type (
ReqCooperationApplicationBatchApproval struct {
}
DataCooperationApplicationBatchApproval struct {
}
)
//取消共创申请
type (
ReqCooperationApplicationCancel struct {
ApplicationId int
}
DataCooperationApplicationCancel struct {
}
)
//审核-同意共创申请
type (
ReqCooperationApplicationAgree struct {
ApplicationId int
}
DataCooperationApplicationAgree struct {
}
)
//审核-拒绝共创申请
type (
ReqCooperationApplicationReject struct {
ApplicationId int
}
DataCooperationApplicationReject struct {
}
)
//创建共创申请
type (
ReqCooperationApplicationAdd struct {
}
DataCooperationApplicationAdd struct {
}
)
//查询共创申请
type (
ReqCooperationApplicationSearch struct {
}
DataCooperationApplicationSearch struct {
}
)
//申请共创
type (
ReqCooperationApplicationApply struct {
}
DataCooperationApplicationApply struct {
}
)
//移除共创申请
type (
ReqCooperationApplicationRemove struct {
ApplicationId int
}
DataCooperationApplicationRemove struct {
}
)
//返回共创申请列表
type (
ReqCooperationApplicationList struct {
}
DataCooperationApplicationList struct {
}
)
//返回共创申请详情
type (
ReqCooperationApplicationGet struct {
ApplicationId int
}
DataCooperationApplicationGet struct {
}
)
... ...
package allied_creation_cooperation
//创建共创合约
type (
ReqCooperationContractAdd struct {
}
DataCooperationContractAdd struct {
}
)
//更新共创合约
type (
ReqCooperationContractUpdate struct {
CooperationContractId int
}
DataCooperationContractUpdate struct {
}
)
//查询共创合约
type (
ReqCooperationContractSearch struct {
}
DataCooperationContractSearch struct {
}
)
//根据承接人查询并返回共创项目合约
type (
ReqCooperationContractSearchByUndertaker struct {
}
DataCooperationContractSearchByUndertaker struct {
}
)
//移除共创合约
type (
ReqCooperationContractRemove struct {
CooperationContractId int
}
DataCooperationContractRemove struct {
}
)
//返回共创合约列表
type (
ReqCooperationContractList struct {
}
DataCooperationContractList struct {
}
)
//返回共创合约详情
type (
ReqCooperationContractGet struct {
CooperationContractId int
}
DataCooperationContractGet struct {
}
)
... ...
package allied_creation_cooperation
//创建共创模式
type (
ReqCooperationModeAdd struct {
}
DataCooperationModeAdd struct {
}
)
//返回共创模式列表
type (
ReqCooperationModeList struct {
}
DataCooperationModeList struct {
}
)
//返回共创模式详情
type (
ReqCooperationModeGet struct {
ModeId int `json:"modeId"`
}
DataCooperationModeGet struct {
}
)
//更新共创模式
type (
ReqCooperationModeUpdate struct {
ModeId int `json:"modeId"`
}
DataCooperationModeUpdate struct {
}
)
//移除共创模式
type (
ReqCooperationModeRemove struct {
ModeId int `json:"modeId"`
}
DataCooperationModeRemove struct {
}
)
//查询共创模式
type (
ReqCooperationModesSearch struct {
}
DataCooperationModesSearch struct {
}
)
... ...
package allied_creation_cooperation
//创建共创项目
type (
ReqCooperationProjectAdd struct {
}
DataCooperationProjectAdd struct {
}
)
//返回共创项目列表
type (
ReqCooperationProjectList struct {
}
DataCooperationProjectList struct {
}
)
//返回共创项目详情
type (
ReqCooperationProjectGet struct {
ProjectId int
}
DataCooperationProjectGet struct {
}
)
//更新共创项目
type (
ReqCooperationProjectUpdate struct {
ProjectId int
}
DataCooperationProjectUpdate struct {
}
)
//移除共创项目
type (
ReqCooperationProjectRemove struct {
ProjectId int
}
DataCooperationProjectRemove struct {
}
)
//发布共创项目
type (
ReqCooperationProjectsRelease struct {
}
DataCooperationProjectsRelease struct {
}
)
//查询共创项目
type (
ReqCooperationProjectSearch struct {
}
DataCooperationProjectSearch struct {
}
)
//判断当前勾选的承接对象是否存在用户
type (
ReqCooperationProjectsCheck struct {
}
DataCooperationProjectsCheck struct {
}
)
... ...
package allied_creation_cooperation
//确定预算分红激励
type (
ReqDividendsEstimateIncentive struct {
}
DataDividendsEstimateIncentive struct {
}
)
//创建分红预算
type (
ReqDividendsEstimateAdd struct {
}
DataDividendsEstimateAdd struct {
}
)
//更新分红预算
type (
ReqDividendsEstimateUpdate struct {
}
DataDividendsEstimateUpdate struct {
}
)
//查询业绩分红
type (
ReqDividendsEstimateSearchDividend struct {
}
DataDividendsEstimateSearchDividend struct {
}
)
//查询分红预算单
type (
ReqDividendsEstimateSearch struct {
}
DataDividendsEstimateSearch struct {
}
)
//查询金额激励分红
type (
ReqDividendsEstimateSearchMoney struct {
}
DataDividendsEstimateSearchMoney struct {
}
)
//取消分红预算
type (
ReqDividendsEstimateCancel struct {
DividendsEstimateId int
}
DataDividendsEstimateCancel struct {
}
)
//确定预算金额激励分红
type (
ReqDividendsEstimateMoneyIncentives struct {
}
DataDividendsEstimateMoneyIncentives struct {
}
)
//移除分红预算
type (
ReqDividendsEstimateRemove struct {
DividendsEstimateId int
}
DataDividendsEstimateRemove struct {
}
)
//返回业绩激励分红详情
type (
ReqDividendsEstimateListDividend struct {
}
DataDividendsEstimateListDividend struct {
}
)
//返回分红预算列表
type (
ReqDividendsEstimateList struct {
}
DataDividendsEstimateList struct {
}
)
//返回分红预算详情
type (
ReqDividendsEstimateGet struct {
}
DataDividendsEstimateGet struct {
}
)
//返回金额激励分红列表
type (
ReqDividendsEstimatesListMoney struct {
}
DataDividendsEstimatesListMoney struct {
}
)
... ...
package allied_creation_cooperation
//创建分红订单
type (
ReqDividendsOrderAdd struct {
}
DataDividendsOrderAdd struct {
DividendsOrderId int
}
)
//更新分红订单
type (
ReqDividendsOrderUpdate struct {
DividendsOrderId int
}
DataDividendsOrderUpdate struct {
}
)
//查询分红订单
type (
ReqDividendsOrderSearch struct {
}
DataDividendsOrderSearch struct {
}
)
//模糊查询分红订单号
type (
ReqSearchOrderNumber struct {
}
DataSearchOrderNumber struct {
}
)
//移除分红订单
type (
ReqDividendsOrderRemove struct {
DividendsOrderId int
}
DataDividendsOrderRemove struct {
}
)
//返回分红订单列表
type (
ReqDividendsOrderList struct {
}
DataDividendsOrderList struct {
}
)
//返回分红订单详情
type (
ReqDividendsOrderGet struct {
DividendsOrderId int
}
DataDividendsOrderGet struct {
}
)
... ...
... ... @@ -32,15 +32,15 @@ type BaseServiceGateway struct {
func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest {
var request *httplib.BeegoHTTPRequest
switch method {
case "get":
case "get", "GET":
request = httplib.Get(url)
case "post":
case "post", "POST":
request = httplib.Post(url)
case "put":
case "put", "PUT":
request = httplib.Put(url)
case "delete":
case "delete", "DELETE":
request = httplib.Delete(url)
case "head":
case "head", "HEADER":
request = httplib.Head(url)
default:
request = httplib.Get(url)
... ...