作者 yangfu
正在显示 28 个修改的文件 包含 2643 行增加28 行删除
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type SettingUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
SettingCode string `json:"settingCode" valid:"Required"`
// 设定的值
Value string `json:"value" valid:"Required"`
}
func (settingUpdate *SettingUpdateCommand) Valid(validation *validation.Validation) {
}
func (settingUpdate *SettingUpdateCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(settingUpdate)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type SettingGetQuery struct {
//操作人
Operator domain.Operator `json:"-"`
SettingCode string `json:"settingCode"`
}
func (settingGetQuery *SettingGetQuery) Valid(validation *validation.Validation) {
}
func (settingGetQuery *SettingGetQuery) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(settingGetQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
type SettingListQuery struct {
//操作人
Operator domain.Operator `json:"-"`
}
... ...
package service
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/systemsetting/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/systemsetting/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
)
// 用户信息
type SystemSettingService struct {
}
func NewSystemSettingService(options map[string]interface{}) *SystemSettingService {
newUsersService := &SystemSettingService{}
return newUsersService
}
func (srv SystemSettingService) GetSystemSettingList(systemSettingListQuery *query.SettingListQuery) (interface{}, error) {
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
systemSettingListQuery.Operator,
)
result, err := creationBasicGateway.SystemSettingSearch(allied_creation_basic.ReqSystemSettingSearch{})
return result, err
}
func (srv SystemSettingService) GetSystemSetting(systemSettingGetQuery *query.SettingGetQuery) (interface{}, error) {
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
systemSettingGetQuery.Operator,
)
result, err := creationBasicGateway.SystemSettingGet(allied_creation_basic.ReqSystemSettingGet{
SettingCode: systemSettingGetQuery.SettingCode,
})
return result, err
}
func (srv SystemSettingService) SystemSettingUpdate(systemSettingUpdate *command.SettingUpdateCommand) (interface{}, error) {
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
systemSettingUpdate.Operator,
)
result, err := creationBasicGateway.SystemSettingUpdate(allied_creation_basic.ReqSystemSettingUpdate{
SettingCode: systemSettingUpdate.SettingCode,
Value: systemSettingUpdate.Value,
CompanyId: systemSettingUpdate.Operator.CompanyId,
})
return result, err
}
... ...
... ... @@ -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_basic
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"
)
// SystemSetting 更新系统设置
func (gateway HttplibAlliedCreationBasic) SystemSettingUpdate(param ReqSystemSettingUpdate) (*DataSystemSettingUpdate, error) {
url := gateway.baseUrL + "/system-setting"
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 DataSystemSettingUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// System-settingSearch 获取企业的系统设置列表
func (gateway HttplibAlliedCreationBasic) SystemSettingSearch(param ReqSystemSettingSearch) (*DataSystemSettingSearch, error) {
url := gateway.baseUrL + "/system-setting/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 DataSystemSettingSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
// SystemSettingGet 获取企业的系统设置项
func (gateway HttplibAlliedCreationBasic) SystemSettingGet(param ReqSystemSettingGet) (*DataSystemSettingGet, error) {
url := gateway.baseUrL + "/system-setting/get"
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 DataSystemSettingGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -90,15 +90,15 @@ type (
}
DataNoticeSettingProfile struct {
Module []struct {
ModuleList []struct {
ModuleCode string `json:"Code"`
Name string `json:"name"`
} `json:"module"`
ModuleAction []struct {
} `json:"moduleList"`
ModuleActionList []struct {
ModuleCode string `json:"module_code"`
ActionCode string `json:"action_Code"`
Name string `json:"name"`
} `json:"moduleAction"`
} `json:"moduleActionList"`
ParamList []struct {
// 变量的代码标识
ParamCode string `json:"paramCode"`
... ...
package allied_creation_basic
//更新系统设置
type (
ReqSystemSettingUpdate struct {
// 公司id
CompanyId int64 `json:"companyId"`
// 设定的值
Value string `json:"value"`
// 设置对应的编码
SettingCode string `json:"settingCode"`
}
DataSystemSettingUpdate struct {
}
)
//获取企业的系统设置列表
type (
ReqSystemSettingSearch struct {
}
DataSystemSettingSearch struct {
SystemSetting []struct {
// 公司id
CompanyId int64 `json:"companyId"`
// 管控层级
ControlLevel string `json:"controlLevel"`
// 描述
Description string `json:"description"`
// 设置对应的编码
SettingCode string `json:"settingCode"`
// 设置对应的名称
SettingName string `json:"settingName"`
// 数据id
SystemSettingId int64 `json:"systemSettingId"`
// 设定的值
Value string `json:"value"`
// 值类型
ValueType string `json:"valueType"`
}
}
)
//获取企业的系统设置项
type (
ReqSystemSettingGet struct {
SettingCode string `json:"settingCode"`
}
DataSystemSettingGet struct {
// 公司id
CompanyId int64 `json:"companyId"`
// 管控层级
ControlLevel string `json:"controlLevel"`
// 描述
Description string `json:"description"`
// 设置对应的编码
SettingCode string `json:"settingCode"`
// 设置对应的名称
SettingName string `json:"settingName"`
// 数据id
SystemSettingId int64 `json:"systemSettingId"`
// 设定的值
Value string `json:"value"`
// 值类型
ValueType string `json:"valueType"`
}
)
... ...
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 ReqDividendsEstimateSearch) (*DataDividendsEstimateSearch, 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 DataDividendsEstimateSearch
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) (*DataDividendsEstimateCancel, 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 DataDividendsEstimateCancel
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimatesEstimateMoneys 确定预算金额激励分红
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesEstimateMoneys(param ReqDividendsEstimateMoneyIncentives) (*DataDividendsEstimateMoneyIncentives, 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 DataDividendsEstimateMoneyIncentives
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendAestimatesdivDidendsEstimat 移除分红预算
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
}
// DividendsEstimateListDividend 返回业绩激励分红详情
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateListDividend(param ReqDividendsEstimateListDividend) (*DataDividendsEstimateListDividend, 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 DataDividendsEstimateListDividend
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimateList 返回分红预算列表
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateList(param ReqDividendsEstimateList) (*DataDividendsEstimateList, 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 DataDividendsEstimateList
err = gateway.GetResponseData(result, &data)
return &data, err
}
//DividendsEstimateGet 返回分红预算详情
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateGet(param ReqDividendsEstimateGet) (*DataDividendsEstimateGet, error) {
url := gateway.baseUrL + "/dividends-estimates/" + strconv.Itoa(param.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 DataDividendsEstimateGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimatesListMoney 返回金额激励分红列表
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesListMoney(param ReqDividendsEstimatesListMoney) (*DataDividendsEstimatesListMoney, 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 DataDividendsEstimatesListMoney
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 {
DividendsEstimateId int
}
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)
... ... @@ -48,6 +48,7 @@ func (gateway BaseServiceGateway) CreateRequest(url string, method string) *http
request.Header("companyId", strconv.FormatInt(gateway.CompanyId, 10))
request.Header("orgId", strconv.FormatInt(gateway.OrgId, 10))
request.Header("userId", strconv.FormatInt(gateway.UserId, 10))
request.Header("userBaseId", strconv.FormatInt(gateway.UserBaseId, 10))
return request.SetTimeout(gateway.ConnectTimeout, gateway.ReadWriteTimeout)
}
... ...
... ... @@ -4,6 +4,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/custommenu/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type MenuController struct {
... ... @@ -13,7 +14,10 @@ type MenuController struct {
func (controller *MenuController) MenuList() {
menuService := service.NewMenuService(nil)
menuListQuery := &query.MenuListQuery{}
controller.Unmarshal(menuListQuery)
err := controller.Unmarshal(menuListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
menuListQuery.Operator = controller.GetOperator()
data, err := menuService.MenuList(menuListQuery)
controller.Response(data, err)
... ... @@ -22,7 +26,10 @@ func (controller *MenuController) MenuList() {
func (controller *MenuController) MenuUpdate() {
menuService := service.NewMenuService(nil)
menuUpdateQuery := &command.MenuUpdateCommand{}
controller.Unmarshal(menuUpdateQuery)
err := controller.Unmarshal(menuUpdateQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
menuUpdateQuery.Operator = controller.GetOperator()
data, err := menuService.MenuUpdate(menuUpdateQuery)
controller.Response(data, err)
... ... @@ -31,7 +38,10 @@ func (controller *MenuController) MenuUpdate() {
func (controller *MenuController) MenuFavorite() {
menuService := service.NewMenuService(nil)
menuFavoriteCommand := &command.MenuFavoriteCommand{}
controller.Unmarshal(menuFavoriteCommand)
err := controller.Unmarshal(menuFavoriteCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
menuFavoriteCommand.Operator = controller.GetOperator()
data, err := menuService.MenuFavorite(menuFavoriteCommand)
controller.Response(data, err)
... ...
... ... @@ -4,6 +4,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type NoticeSettingController struct {
... ... @@ -13,7 +14,10 @@ type NoticeSettingController struct {
func (controller *NoticeSettingController) NoticeSettingList() {
noticeSettingService := service.NewNoticeSettingService(nil)
noticeSettingListQuery := &query.NoticeSettingListQuery{}
controller.Unmarshal(noticeSettingListQuery)
err := controller.Unmarshal(noticeSettingListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
noticeSettingListQuery.Operator = controller.GetOperator()
cnt, data, err := noticeSettingService.NoticeSettingList(noticeSettingListQuery)
controller.returnPageListData(cnt, data, err, noticeSettingListQuery.PageNumber)
... ... @@ -23,7 +27,10 @@ func (controller *NoticeSettingController) NoticeSettingUpdate() {
noticeSettingService := service.NewNoticeSettingService(nil)
noticeSettingUpdateCommand := &command.NoticeSettingUpdateCommand{}
settingId := controller.GetString(":settingId")
controller.Unmarshal(noticeSettingUpdateCommand)
err := controller.Unmarshal(noticeSettingUpdateCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
noticeSettingUpdateCommand.Operator = controller.GetOperator()
noticeSettingUpdateCommand.NoticeSettingId = settingId
data, err := noticeSettingService.NoticeSettingUpdate(noticeSettingUpdateCommand)
... ... @@ -33,7 +40,10 @@ func (controller *NoticeSettingController) NoticeSettingUpdate() {
func (controller *NoticeSettingController) NoticeSettingAdd() {
noticeSettingService := service.NewNoticeSettingService(nil)
noticeSettingAddCommand := &command.NoticeSettingAddCommand{}
controller.Unmarshal(noticeSettingAddCommand)
err := controller.Unmarshal(noticeSettingAddCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
noticeSettingAddCommand.Operator = controller.GetOperator()
data, err := noticeSettingService.NoticeSettingAdd(noticeSettingAddCommand)
controller.Response(data, err)
... ...
... ... @@ -4,6 +4,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type OrgsController struct {
... ... @@ -13,7 +14,10 @@ type OrgsController struct {
func (controller *OrgsController) OrgAdd() {
orgsService := service.NewOrgsService(nil)
orgAddCommand := &command.OrgAddCommand{}
controller.Unmarshal(orgAddCommand)
err := controller.Unmarshal(orgAddCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
orgAddCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgAdd(orgAddCommand)
controller.Response(data, err)
... ... @@ -22,7 +26,10 @@ func (controller *OrgsController) OrgAdd() {
func (controller *OrgsController) OrgUpdate() {
orgsService := service.NewOrgsService(nil)
orgUpdateCommand := &command.OrgUpdateCommand{}
controller.Unmarshal(orgUpdateCommand)
err := controller.Unmarshal(orgUpdateCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
orgId := controller.GetString(":orgId")
orgUpdateCommand.OrgId = orgId
orgUpdateCommand.Operator = controller.GetOperator()
... ... @@ -33,7 +40,10 @@ func (controller *OrgsController) OrgUpdate() {
func (controller *OrgsController) OrgList() {
orgsService := service.NewOrgsService(nil)
orgListQuery := &query.OrgListQuery{}
controller.Unmarshal(orgListQuery)
err := controller.Unmarshal(orgListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
orgListQuery.Operator = controller.GetOperator()
data, err := orgsService.OrgList(orgListQuery)
controller.Response(data, err)
... ... @@ -52,7 +62,10 @@ func (controller *OrgsController) OrgGet() {
func (controller *OrgsController) OrgEnable() {
orgsService := service.NewOrgsService(nil)
orgEnableCommand := &command.OrgEnableCommand{}
controller.Unmarshal(orgEnableCommand)
err := controller.Unmarshal(orgEnableCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
orgEnableCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgEnable(orgEnableCommand)
controller.Response(data, err)
... ... @@ -61,7 +74,10 @@ func (controller *OrgsController) OrgEnable() {
func (controller *OrgsController) OrgGetSubDepartment() {
orgsService := service.NewOrgsService(nil)
orgGetSubDepartmentQuery := &query.OrgGetSubDepartmentQuery{}
controller.Unmarshal(orgGetSubDepartmentQuery)
err := controller.Unmarshal(orgGetSubDepartmentQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
orgGetSubDepartmentQuery.Operator = controller.GetOperator()
data, err := orgsService.OrgGetSubDepartment(orgGetSubDepartmentQuery)
controller.Response(data, err)
... ...
... ... @@ -4,6 +4,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type RolesController struct {
... ... @@ -13,7 +14,10 @@ type RolesController struct {
func (controller *RolesController) RoleAdd() {
rolesService := service.NewRolesService(nil)
roleAddCommand := &command.RoleAddCommand{}
controller.Unmarshal(roleAddCommand)
err := controller.Unmarshal(roleAddCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleAddCommand.Operator = controller.GetOperator()
data, err := rolesService.RoleAdd(roleAddCommand)
controller.Response(data, err)
... ... @@ -22,7 +26,10 @@ func (controller *RolesController) RoleAdd() {
func (controller *RolesController) RoleUpdate() {
rolesService := service.NewRolesService(nil)
roleUpdateCommand := &command.RoleUpdateCommand{}
controller.Unmarshal(roleUpdateCommand)
err := controller.Unmarshal(roleUpdateCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleId := controller.GetString(":roleId")
roleUpdateCommand.RoleId = roleId
roleUpdateCommand.Operator = controller.GetOperator()
... ... @@ -33,7 +40,10 @@ func (controller *RolesController) RoleUpdate() {
func (controller *RolesController) RoleList() {
rolesService := service.NewRolesService(nil)
roleListQuery := &query.RoleListQuery{}
controller.Unmarshal(roleListQuery)
err := controller.Unmarshal(roleListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleListQuery.Operator = controller.GetOperator()
cnt, data, err := rolesService.RoleList(roleListQuery)
controller.returnPageListData(cnt, data, err, roleListQuery.PageNumber)
... ... @@ -62,7 +72,10 @@ func (controller *RolesController) RoleUserInfo() {
func (controller *RolesController) RoleUserAdd() {
rolesService := service.NewRolesService(nil)
roleUserAddQuery := &command.RoleUserAddCommand{}
controller.Unmarshal(roleUserAddQuery)
err := controller.Unmarshal(roleUserAddQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleUserAddQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleUserAdd(roleUserAddQuery)
controller.Response(data, err)
... ... @@ -71,7 +84,10 @@ func (controller *RolesController) RoleUserAdd() {
func (controller *RolesController) RoleUserDelete() {
rolesService := service.NewRolesService(nil)
roleUserDeleteQuery := &command.RoleUserDeleteCommand{}
controller.Unmarshal(roleUserDeleteQuery)
err := controller.Unmarshal(roleUserDeleteQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleUserDeleteQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleUserDelete(roleUserDeleteQuery)
controller.Response(data, err)
... ... @@ -91,7 +107,10 @@ func (controller *RolesController) RoleMenuBeforeEdit() {
rolesService := service.NewRolesService(nil)
roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{}
roleMenuBeforeEditQuery.Operator = controller.GetOperator()
controller.Unmarshal(roleMenuBeforeEditQuery)
err := controller.Unmarshal(roleMenuBeforeEditQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleId := controller.GetString(":roleId")
roleMenuBeforeEditQuery.RoleId = roleId
data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
... ... @@ -101,7 +120,10 @@ func (controller *RolesController) RoleMenuBeforeEdit() {
func (controller *RolesController) RoleMenuEdit() {
rolesService := service.NewRolesService(nil)
roleMenuEditQuery := &command.RoleMenuEditCommand{}
controller.Unmarshal(roleMenuEditQuery)
err := controller.Unmarshal(roleMenuEditQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleId := controller.GetString(":roleId")
roleMenuEditQuery.RoleId = roleId
roleMenuEditQuery.Operator = controller.GetOperator()
... ... @@ -112,7 +134,10 @@ func (controller *RolesController) RoleMenuEdit() {
func (controller *RolesController) RoleDelete() {
rolesService := service.NewRolesService(nil)
roleRemoveCommand := &command.RoleRemoveCommand{}
controller.Unmarshal(roleRemoveCommand)
err := controller.Unmarshal(roleRemoveCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleRemoveCommand.Operator = controller.GetOperator()
data, err := rolesService.RoleRemove(roleRemoveCommand)
controller.Response(data, err)
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/systemsetting/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/systemsetting/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/systemsetting/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type SystemSettingController struct {
baseController
}
func (controller SystemSettingController) SystemSettingSearch() {
systemSettingService := service.NewSystemSettingService(nil)
settingListQuery := &query.SettingListQuery{
Operator: controller.GetOperator(),
}
data, err := systemSettingService.GetSystemSettingList(settingListQuery)
controller.Response(data, err)
}
func (controller SystemSettingController) SystemSettingGet() {
systemSettingService := service.NewSystemSettingService(nil)
q := &query.SettingGetQuery{}
err := controller.Unmarshal(q)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
q.Operator = controller.GetOperator()
data, err := systemSettingService.GetSystemSetting(q)
controller.Response(data, err)
}
func (controller SystemSettingController) SystemSettingUpdate() {
systemSettingService := service.NewSystemSettingService(nil)
q := &command.SettingUpdateCommand{}
err := controller.Unmarshal(q)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
q.Operator = controller.GetOperator()
data, err := systemSettingService.SystemSettingUpdate(q)
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/system-setting/search", &web_client.SystemSettingController{}, "Post:SystemSettingSearch")
web.Router("/v1/web/syetem-setting/:settingId", &web_client.SystemSettingController{}, "Get:SystemSettingGet")
web.Router("/v1/web/syetem-setting", &web_client.SystemSettingController{}, "Put:SystemSettingUpdate")
}
... ...