|
|
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"
|
|
|
)
|
|
|
|
|
|
// ContractUndertakerFeedbackAdd 创建共创合约反馈信息
|
|
|
func (gateway HttplibAlliedCreationCooperation) ContractUndertakerFeedbackAdd(param ReqContractUndertakerFeedbackAdd) (*DataContractUndertakerFeedbackAdd, error) {
|
|
|
url := gateway.baseUrL + "/contract-undertaker-feedbacks"
|
|
|
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 DataContractUndertakerFeedbackAdd
|
|
|
err = gateway.GetResponseData(result, &data)
|
|
|
return &data, err
|
|
|
}
|
|
|
|
|
|
// ContractUndertakerFeedbackUpdate 更新共创合约反馈信息
|
|
|
func (gateway HttplibAlliedCreationCooperation) ContractUndertakerFeedbackUpdate(param ReqContractUndertakerFeedbackUpdate) (
|
|
|
*DataContractUndertakerFeedbackUpdate, error) {
|
|
|
url := gateway.baseUrL + "/contract-undertaker-feedbacks/" + strconv.Itoa(param.ContractUndertakerFeedbackId)
|
|
|
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 DataContractUndertakerFeedbackUpdate
|
|
|
err = gateway.GetResponseData(result, &data)
|
|
|
return &data, err
|
|
|
}
|
|
|
|
|
|
// ContractUndertakerFeedbackSearch 查询共创承接方反馈信息
|
|
|
func (gateway HttplibAlliedCreationCooperation) ContractUndertakerFeedbackSearch(param ReqContractUndertakerFeedbackSearch) (
|
|
|
*DataContractUndertakerFeedbackSearch, error) {
|
|
|
url := gateway.baseUrL + "/contract-undertaker-feedbacks/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 DataContractUndertakerFeedbackSearch
|
|
|
err = gateway.GetResponseData(result, &data)
|
|
|
return &data, err
|
|
|
}
|
|
|
|
|
|
// ContractUndertakerFeedbackRemove 移除共创合约反馈信息
|
|
|
func (gateway HttplibAlliedCreationCooperation) ContractUndertakerFeedbackRemove(param ReqContractUndertakerFeedbackRemove) (
|
|
|
*DataContractUndertakerFeedbackRemove, error) {
|
|
|
url := gateway.baseUrL + "/contract-undertaker-feedbacks/" + strconv.Itoa(param.ContractUndertakerFeedbackId)
|
|
|
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 DataContractUndertakerFeedbackRemove
|
|
|
err = gateway.GetResponseData(result, &data)
|
|
|
return &data, err
|
|
|
}
|
|
|
|
|
|
// ContractUndertakerFeedbackList 返回共创合约反馈信息列表
|
|
|
func (gateway HttplibAlliedCreationCooperation) ContractUndertakerFeedbackList(param ReqContractUndertakerFeedbackList) (
|
|
|
*DataContractUndertakerFeedbackList, error) {
|
|
|
url := gateway.baseUrL + "/contract-undertaker-feedbacks"
|
|
|
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 DataContractUndertakerFeedbackList
|
|
|
err = gateway.GetResponseData(result, &data)
|
|
|
return &data, err
|
|
|
}
|
|
|
|
|
|
// ContractUndertakerFeedbackGet 返回共创合约反馈信息详情
|
|
|
func (gateway HttplibAlliedCreationCooperation) ContractUndertakerFeedbackGet(param ReqContractUndertakerFeedbackGet) (*DataContractUndertakerFeedbackGet, error) {
|
|
|
url := gateway.baseUrL + "/contract-undertaker-feedbacks/" + strconv.Itoa(param.ContractUndertakerFeedbackId)
|
|
|
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 DataContractUndertakerFeedbackGet
|
|
|
err = gateway.GetResponseData(result, &data)
|
|
|
return &data, err
|
|
|
} |
...
|
...
|
|