作者 tangxuhui

添加承接反馈

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
}
... ...
... ... @@ -74,7 +74,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationModeList(param ReqCoo
// CooperationModeGet 返回共创模式详情
func (gateway HttplibAlliedCreationCooperation) CooperationModeGet(param ReqCooperationModeGet) (*DataCooperationModeGet, error) {
url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.ModeId)
url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.CooperationModeId)
method := "get"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:返回共创模式详情。", map[string]interface{}{
... ... @@ -105,7 +105,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationModeGet(param ReqCoop
// CooperationModeUpdate 更新共创模式
func (gateway HttplibAlliedCreationCooperation) CooperationModeUpdate(param ReqCooperationModeUpdate) (*DataCooperationModeUpdate, error) {
url := gateway.baseUrL + "/cooperation-modes" + strconv.Itoa(param.ModeId)
url := gateway.baseUrL + "/cooperation-modes" + strconv.Itoa(param.CooperationModeId)
method := "put"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:更新共创模式。", map[string]interface{}{
... ... @@ -136,7 +136,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationModeUpdate(param ReqC
//CooperationModeRemove 移除共创模式
func (gateway HttplibAlliedCreationCooperation) CooperationModeRemove(param ReqCooperationModeRemove) (*DataCooperationModeRemove, error) {
url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.ModeId)
url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.CooperationModeId)
method := "delete"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:移除共创模式。", map[string]interface{}{
... ...
package allied_creation_cooperation
//创建共创合约反馈信息
type (
ReqContractUndertakerFeedbackAdd struct {
}
DataContractUndertakerFeedbackAdd struct {
}
)
//更新共创合约反馈信息
type (
ReqContractUndertakerFeedbackUpdate struct {
ContractUndertakerFeedbackId int
}
DataContractUndertakerFeedbackUpdate struct {
}
)
//查询共创承接方反馈信息
type (
ReqContractUndertakerFeedbackSearch struct {
}
DataContractUndertakerFeedbackSearch struct {
}
)
//移除共创合约反馈信息
type (
ReqContractUndertakerFeedbackRemove struct {
ContractUndertakerFeedbackId int
}
DataContractUndertakerFeedbackRemove struct {
}
)
//返回共创合约反馈信息列表
type (
ReqContractUndertakerFeedbackList struct {
}
DataContractUndertakerFeedbackList struct {
}
)
//返回共创合约反馈信息详情
type (
ReqContractUndertakerFeedbackGet struct {
ContractUndertakerFeedbackId int
}
DataContractUndertakerFeedbackGet struct {
}
)
... ...
... ... @@ -3,6 +3,9 @@ package allied_creation_cooperation
//创建共创模式
type (
ReqCooperationModeAdd struct {
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
Remarks string `json:"remarks"`
}
DataCooperationModeAdd struct {
... ... @@ -12,26 +15,86 @@ type (
//返回共创模式列表
type (
ReqCooperationModeList struct {
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
}
DataCooperationModeList struct {
Total int `json:"total"`
List []struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,
CooperationModeName string `json:"cooperationModeName"`
// 共创模式状态,1启用,2禁用
Status int `json:"status"`
// 备注
Remarks string `json:"remarks"`
Company struct {
// 公司ID,
CompanyId int `json:"companyId"`
// 公司logo
CompanyLogo string `json:"companyLogo"`
// 公司名称
CompanyName string `json:"companyName"`
} `json:"company"`
// 数据所属组织机构
Org struct {
// 组织机构ID
OrgId int `json:"orgId"`
// 组织名称
OrgName string `json:"orgName"`
} `json:"org"`
} `json:"list"`
}
)
//返回共创模式详情
type (
ReqCooperationModeGet struct {
ModeId int `json:"modeId"`
CooperationModeId int `json:"modeId"`
}
DataCooperationModeGet struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,
CooperationModeName string `json:"cooperationModeName"`
// 共创模式状态,1启用,2禁用
Status int `json:"status"`
// 备注
Remarks string `json:"remarks"`
Company struct {
// 公司ID,
CompanyId int `json:"companyId,string"`
// 公司logo
CompanyLogo string `json:"companyLogo"`
// 公司名称
CompanyName string `json:"companyName"`
} `json:"company"`
// 数据所属组织机构
Org struct {
// 组织机构ID
OrgId int `json:"orgId,string"`
// 组织名称
OrgName string `json:"orgName"`
} `json:"org"`
}
)
//更新共创模式
type (
ReqCooperationModeUpdate struct {
ModeId int `json:"modeId"`
// 共创模式ID
CooperationModeId int `json:"cooperationModeId"`
CooperationModeName string `json:"cooperationModeName"`
Remarks string `json:"remarks"`
// 共创模式状态,1启用,2禁用
Status int `json:"status"`
}
DataCooperationModeUpdate struct {
... ... @@ -41,7 +104,7 @@ type (
//移除共创模式
type (
ReqCooperationModeRemove struct {
ModeId int `json:"modeId"`
CooperationModeId int `json:"modeId"`
}
DataCooperationModeRemove struct {
... ...