作者 tangxuhui

增加 业务模块 gateway

@@ -12,6 +12,9 @@ var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" @@ -12,6 +12,9 @@ var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
12 //天联共创用户模块 12 //天联共创用户模块
13 var ALLIED_CREATION_USER_HOST = "http://localhost:8081" 13 var ALLIED_CREATION_USER_HOST = "http://localhost:8081"
14 14
  15 +//天联共创业务模块
  16 +var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8081"
  17 +
15 //通用模块短信服务 18 //通用模块短信服务
16 var SMS_SERVE_HOST = "http://localhost:8081" 19 var SMS_SERVE_HOST = "http://localhost:8081"
17 20
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "time"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  9 +)
  10 +
  11 +type HttplibAlliedCreationCooperation struct {
  12 + service_gateway.BaseServiceGateway
  13 + baseUrL string
  14 +}
  15 +
  16 +func NewHttplibAlliedCreationCooperation(operator domain.Operator) *HttplibAlliedCreationCooperation {
  17 + return &HttplibAlliedCreationCooperation{
  18 + BaseServiceGateway: service_gateway.BaseServiceGateway{
  19 + ConnectTimeout: 100 * time.Second,
  20 + ReadWriteTimeout: 30 * time.Second,
  21 + CompanyId: operator.CompanyId,
  22 + OrgId: operator.OrgId,
  23 + UserId: operator.UserId,
  24 + UserBaseId: operator.UserBaseId,
  25 + },
  26 + baseUrL: constant.ALLIED_CREATION_USER_HOST,
  27 + }
  28 +}
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "strconv"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  9 +
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  11 +)
  12 +
  13 +// CooperationApplicationUpdaet 更新共创申请
  14 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationUpdaet(param ReqCooperationApplicationUpdate) (*DataCooperationApplicationUpdate, error) {
  15 + url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId)
  16 + method := "PUT"
  17 + req := gateway.CreateRequest(url, method)
  18 + log.Logger.Debug("向基础模块请求数据:更新共创申请。", map[string]interface{}{
  19 + "api": method + ":" + url,
  20 + "param": param,
  21 + })
  22 + req, err := req.JSONBody(param)
  23 + if err != nil {
  24 + return nil, fmt.Errorf("请求更新共创申请失败:%w", err)
  25 + }
  26 +
  27 + byteResult, err := req.Bytes()
  28 + if err != nil {
  29 + return nil, fmt.Errorf("获取更新共创申请失败:%w", err)
  30 + }
  31 + log.Logger.Debug("获取基础模块请求数据:更新共创申请。", map[string]interface{}{
  32 + "result": string(byteResult),
  33 + })
  34 + var result service_gateway.GatewayResponse
  35 + err = json.Unmarshal(byteResult, &result)
  36 + if err != nil {
  37 + return nil, fmt.Errorf("解析更新共创申请:%w", err)
  38 + }
  39 + var data DataCooperationApplicationUpdate
  40 + err = gateway.GetResponseData(result, &data)
  41 + return &data, err
  42 +}
  43 +
  44 +// CooperationApplicationsBatchApproval 共创申请一键审核
  45 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsBatchApproval(param ReqCooperationApplicationBatchApproval) (*DataCooperationApplicationBatchApproval, error) {
  46 + url := gateway.baseUrL + "/cooperation-applications/batch-approval"
  47 + method := "POST"
  48 + req := gateway.CreateRequest(url, method)
  49 + log.Logger.Debug("向基础模块请求数据:共创申请一键审核。", map[string]interface{}{
  50 + "api": method + ":" + url,
  51 + "param": param,
  52 + })
  53 + req, err := req.JSONBody(param)
  54 + if err != nil {
  55 + return nil, fmt.Errorf("请求共创申请一键审核失败:%w", err)
  56 + }
  57 +
  58 + byteResult, err := req.Bytes()
  59 + if err != nil {
  60 + return nil, fmt.Errorf("获取共创申请一键审核失败:%w", err)
  61 + }
  62 + log.Logger.Debug("获取基础模块请求数据:共创申请一键审核。", map[string]interface{}{
  63 + "result": string(byteResult),
  64 + })
  65 + var result service_gateway.GatewayResponse
  66 + err = json.Unmarshal(byteResult, &result)
  67 + if err != nil {
  68 + return nil, fmt.Errorf("解析共创申请一键审核:%w", err)
  69 + }
  70 + var data DataCooperationApplicationBatchApproval
  71 + err = gateway.GetResponseData(result, &data)
  72 + return &data, err
  73 +}
  74 +
  75 +// CooperationApplicationCancel 取消共创申请
  76 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationCancel(param ReqCooperationApplicationCancel) (*DataCooperationApplicationCancel, error) {
  77 + url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId) + "/cancel-application"
  78 + method := "POST"
  79 + req := gateway.CreateRequest(url, method)
  80 + log.Logger.Debug("向基础模块请求数据:取消共创申请。", map[string]interface{}{
  81 + "api": method + ":" + url,
  82 + "param": param,
  83 + })
  84 + req, err := req.JSONBody(param)
  85 + if err != nil {
  86 + return nil, fmt.Errorf("请求取消共创申请失败:%w", err)
  87 + }
  88 +
  89 + byteResult, err := req.Bytes()
  90 + if err != nil {
  91 + return nil, fmt.Errorf("获取取消共创申请失败:%w", err)
  92 + }
  93 + log.Logger.Debug("获取基础模块请求数据:取消共创申请。", map[string]interface{}{
  94 + "result": string(byteResult),
  95 + })
  96 + var result service_gateway.GatewayResponse
  97 + err = json.Unmarshal(byteResult, &result)
  98 + if err != nil {
  99 + return nil, fmt.Errorf("解析取消共创申请:%w", err)
  100 + }
  101 + var data DataCooperationApplicationCancel
  102 + err = gateway.GetResponseData(result, &data)
  103 + return &data, err
  104 +}
  105 +
  106 +// CooperationApplicationsAgree 审核-同意共创申请
  107 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsAgree(param ReqCooperationApplicationAgree) (*DataCooperationApplicationAgree, error) {
  108 + url := gateway.baseUrL + "/cooperation-applications/agree-cooperation-application"
  109 + method := "POST"
  110 + req := gateway.CreateRequest(url, method)
  111 + log.Logger.Debug("向基础模块请求数据:审核-同意共创申请。", map[string]interface{}{
  112 + "api": method + ":" + url,
  113 + "param": param,
  114 + })
  115 + req, err := req.JSONBody(param)
  116 + if err != nil {
  117 + return nil, fmt.Errorf("请求审核-同意共创申请失败:%w", err)
  118 + }
  119 +
  120 + byteResult, err := req.Bytes()
  121 + if err != nil {
  122 + return nil, fmt.Errorf("获取审核-同意共创申请失败:%w", err)
  123 + }
  124 + log.Logger.Debug("获取基础模块请求数据:审核-同意共创申请。", map[string]interface{}{
  125 + "result": string(byteResult),
  126 + })
  127 + var result service_gateway.GatewayResponse
  128 + err = json.Unmarshal(byteResult, &result)
  129 + if err != nil {
  130 + return nil, fmt.Errorf("解析审核-同意共创申请:%w", err)
  131 + }
  132 + var data DataCooperationApplicationAgree
  133 + err = gateway.GetResponseData(result, &data)
  134 + return &data, err
  135 +}
  136 +
  137 +// CooperationApplicationsReject审核-拒绝共创申请
  138 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationReject(param ReqCooperationApplicationReject) (*DataCooperationApplicationReject, error) {
  139 + url := gateway.baseUrL + "/cooperation-applications/reject-cooperation-application"
  140 + method := "POST"
  141 + req := gateway.CreateRequest(url, method)
  142 + log.Logger.Debug("向基础模块请求数据:审核-拒绝共创申请。", map[string]interface{}{
  143 + "api": method + ":" + url,
  144 + "param": param,
  145 + })
  146 + req, err := req.JSONBody(param)
  147 + if err != nil {
  148 + return nil, fmt.Errorf("请求审核-拒绝共创申请失败:%w", err)
  149 + }
  150 +
  151 + byteResult, err := req.Bytes()
  152 + if err != nil {
  153 + return nil, fmt.Errorf("获取审核-拒绝共创申请失败:%w", err)
  154 + }
  155 + log.Logger.Debug("获取基础模块请求数据:审核-拒绝共创申请。", map[string]interface{}{
  156 + "result": string(byteResult),
  157 + })
  158 + var result service_gateway.GatewayResponse
  159 + err = json.Unmarshal(byteResult, &result)
  160 + if err != nil {
  161 + return nil, fmt.Errorf("解析审核-拒绝共创申请:%w", err)
  162 + }
  163 + var data DataCooperationApplicationReject
  164 + err = gateway.GetResponseData(result, &data)
  165 + return &data, err
  166 +}
  167 +
  168 +// CooperationApplicationAdd 创建共创申请
  169 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationAdd(param ReqCooperationApplicationAdd) (*DataCooperationApplicationAdd, error) {
  170 + url := gateway.baseUrL + "/cooperation-applications"
  171 + method := "POST"
  172 + req := gateway.CreateRequest(url, method)
  173 + log.Logger.Debug("向基础模块请求数据:创建共创申请。", map[string]interface{}{
  174 + "api": method + ":" + url,
  175 + "param": param,
  176 + })
  177 + req, err := req.JSONBody(param)
  178 + if err != nil {
  179 + return nil, fmt.Errorf("请求创建共创申请失败:%w", err)
  180 + }
  181 +
  182 + byteResult, err := req.Bytes()
  183 + if err != nil {
  184 + return nil, fmt.Errorf("获取创建共创申请失败:%w", err)
  185 + }
  186 + log.Logger.Debug("获取基础模块请求数据:创建共创申请。", map[string]interface{}{
  187 + "result": string(byteResult),
  188 + })
  189 + var result service_gateway.GatewayResponse
  190 + err = json.Unmarshal(byteResult, &result)
  191 + if err != nil {
  192 + return nil, fmt.Errorf("解析创建共创申请:%w", err)
  193 + }
  194 + var data DataCooperationApplicationAdd
  195 + err = gateway.GetResponseData(result, &data)
  196 + return &data, err
  197 +}
  198 +
  199 +// Cooperation-applicationsSearch 查询共创申请
  200 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsSearch(param ReqCooperationApplicationSearch) (*DataCooperationApplicationSearch, error) {
  201 + url := gateway.baseUrL + "/cooperation-applications/search"
  202 + method := "POST"
  203 + req := gateway.CreateRequest(url, method)
  204 + log.Logger.Debug("向基础模块请求数据:查询共创申请。", map[string]interface{}{
  205 + "api": method + ":" + url,
  206 + "param": param,
  207 + })
  208 + req, err := req.JSONBody(param)
  209 + if err != nil {
  210 + return nil, fmt.Errorf("请求查询共创申请失败:%w", err)
  211 + }
  212 +
  213 + byteResult, err := req.Bytes()
  214 + if err != nil {
  215 + return nil, fmt.Errorf("获取查询共创申请失败:%w", err)
  216 + }
  217 + log.Logger.Debug("获取基础模块请求数据:查询共创申请。", map[string]interface{}{
  218 + "result": string(byteResult),
  219 + })
  220 + var result service_gateway.GatewayResponse
  221 + err = json.Unmarshal(byteResult, &result)
  222 + if err != nil {
  223 + return nil, fmt.Errorf("解析查询共创申请:%w", err)
  224 + }
  225 + var data DataCooperationApplicationSearch
  226 + err = gateway.GetResponseData(result, &data)
  227 + return &data, err
  228 +}
  229 +
  230 +// CooperationApplicationsApply 申请共创
  231 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsApply(param ReqCooperationApplicationApply) (*DataCooperationApplicationApply, error) {
  232 + url := gateway.baseUrL + "/cooperation-applications/apply-for-cooperation"
  233 + method := "POST"
  234 + req := gateway.CreateRequest(url, method)
  235 + log.Logger.Debug("向基础模块请求数据:申请共创。", map[string]interface{}{
  236 + "api": method + ":" + url,
  237 + "param": param,
  238 + })
  239 + req, err := req.JSONBody(param)
  240 + if err != nil {
  241 + return nil, fmt.Errorf("请求申请共创失败:%w", err)
  242 + }
  243 +
  244 + byteResult, err := req.Bytes()
  245 + if err != nil {
  246 + return nil, fmt.Errorf("获取申请共创失败:%w", err)
  247 + }
  248 + log.Logger.Debug("获取基础模块请求数据:申请共创。", map[string]interface{}{
  249 + "result": string(byteResult),
  250 + })
  251 + var result service_gateway.GatewayResponse
  252 + err = json.Unmarshal(byteResult, &result)
  253 + if err != nil {
  254 + return nil, fmt.Errorf("解析申请共创:%w", err)
  255 + }
  256 + var data DataCooperationApplicationApply
  257 + err = gateway.GetResponseData(result, &data)
  258 + return &data, err
  259 +}
  260 +
  261 +// CooperationApplicationRemove 移除共创申请
  262 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationRemove(param ReqCooperationApplicationRemove) (*DataCooperationApplicationRemove, error) {
  263 + url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId)
  264 + method := "DELETE"
  265 + req := gateway.CreateRequest(url, method)
  266 + log.Logger.Debug("向基础模块请求数据:移除共创申请。", map[string]interface{}{
  267 + "api": method + ":" + url,
  268 + "param": param,
  269 + })
  270 + req, err := req.JSONBody(param)
  271 + if err != nil {
  272 + return nil, fmt.Errorf("请求移除共创申请失败:%w", err)
  273 + }
  274 +
  275 + byteResult, err := req.Bytes()
  276 + if err != nil {
  277 + return nil, fmt.Errorf("获取移除共创申请失败:%w", err)
  278 + }
  279 + log.Logger.Debug("获取基础模块请求数据:移除共创申请。", map[string]interface{}{
  280 + "result": string(byteResult),
  281 + })
  282 + var result service_gateway.GatewayResponse
  283 + err = json.Unmarshal(byteResult, &result)
  284 + if err != nil {
  285 + return nil, fmt.Errorf("解析移除共创申请:%w", err)
  286 + }
  287 + var data DataCooperationApplicationRemove
  288 + err = gateway.GetResponseData(result, &data)
  289 + return &data, err
  290 +}
  291 +
  292 +// CooperationApplicationList 返回共创申请列表
  293 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationList(param ReqCooperationApplicationList) (*DataCooperationApplicationList, error) {
  294 + url := gateway.baseUrL + "/cooperation-applications"
  295 + method := "GET"
  296 + req := gateway.CreateRequest(url, method)
  297 + log.Logger.Debug("向基础模块请求数据:返回共创申请列表。", map[string]interface{}{
  298 + "api": method + ":" + url,
  299 + "param": param,
  300 + })
  301 + req, err := req.JSONBody(param)
  302 + if err != nil {
  303 + return nil, fmt.Errorf("请求返回共创申请列表失败:%w", err)
  304 + }
  305 +
  306 + byteResult, err := req.Bytes()
  307 + if err != nil {
  308 + return nil, fmt.Errorf("获取返回共创申请列表失败:%w", err)
  309 + }
  310 + log.Logger.Debug("获取基础模块请求数据:返回共创申请列表。", map[string]interface{}{
  311 + "result": string(byteResult),
  312 + })
  313 + var result service_gateway.GatewayResponse
  314 + err = json.Unmarshal(byteResult, &result)
  315 + if err != nil {
  316 + return nil, fmt.Errorf("解析返回共创申请列表:%w", err)
  317 + }
  318 + var data DataCooperationApplicationList
  319 + err = gateway.GetResponseData(result, &data)
  320 + return &data, err
  321 +}
  322 +
  323 +// CooperationApplicationGet 返回共创申请详情
  324 +func (gateway HttplibAlliedCreationCooperation) CooperationApplicationGet(param ReqCooperationApplicationGet) (*DataCooperationApplicationGet, error) {
  325 + url := gateway.baseUrL + "/cooperation-applications/{cooperationApplicationId}"
  326 + method := "GET"
  327 + req := gateway.CreateRequest(url, method)
  328 + log.Logger.Debug("向基础模块请求数据:返回共创申请详情。", map[string]interface{}{
  329 + "api": method + ":" + url,
  330 + "param": param,
  331 + })
  332 + req, err := req.JSONBody(param)
  333 + if err != nil {
  334 + return nil, fmt.Errorf("请求返回共创申请详情失败:%w", err)
  335 + }
  336 +
  337 + byteResult, err := req.Bytes()
  338 + if err != nil {
  339 + return nil, fmt.Errorf("获取返回共创申请详情失败:%w", err)
  340 + }
  341 + log.Logger.Debug("获取基础模块请求数据:返回共创申请详情。", map[string]interface{}{
  342 + "result": string(byteResult),
  343 + })
  344 + var result service_gateway.GatewayResponse
  345 + err = json.Unmarshal(byteResult, &result)
  346 + if err != nil {
  347 + return nil, fmt.Errorf("解析返回共创申请详情:%w", err)
  348 + }
  349 + var data DataCooperationApplicationGet
  350 + err = gateway.GetResponseData(result, &data)
  351 + return &data, err
  352 +}
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "strconv"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  9 +
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  11 +)
  12 +
  13 +// CooperationContractAdd 创建共创合约
  14 +func (gateway HttplibAlliedCreationCooperation) CooperationContractAdd(param ReqCooperationContractAdd) (*DataCooperationContractAdd, error) {
  15 + url := gateway.baseUrL + "/cooperation-contracts"
  16 + method := "POST"
  17 + req := gateway.CreateRequest(url, method)
  18 + log.Logger.Debug("向基础模块请求数据:创建共创合约。", map[string]interface{}{
  19 + "api": method + ":" + url,
  20 + "param": param,
  21 + })
  22 + req, err := req.JSONBody(param)
  23 + if err != nil {
  24 + return nil, fmt.Errorf("请求创建共创合约失败:%w", err)
  25 + }
  26 +
  27 + byteResult, err := req.Bytes()
  28 + if err != nil {
  29 + return nil, fmt.Errorf("获取创建共创合约失败:%w", err)
  30 + }
  31 + log.Logger.Debug("获取基础模块请求数据:创建共创合约。", map[string]interface{}{
  32 + "result": string(byteResult),
  33 + })
  34 + var result service_gateway.GatewayResponse
  35 + err = json.Unmarshal(byteResult, &result)
  36 + if err != nil {
  37 + return nil, fmt.Errorf("解析创建共创合约:%w", err)
  38 + }
  39 + var data DataCooperationContractAdd
  40 + err = gateway.GetResponseData(result, &data)
  41 + return &data, err
  42 +}
  43 +
  44 +// CooperationContractUpdate 更新共创合约
  45 +func (gateway HttplibAlliedCreationCooperation) CooperationContractUpdate(param ReqCooperationContractUpdate) (*DataCooperationContractUpdate, error) {
  46 + url := gateway.baseUrL + "/cooperation-contracts/" + strconv.Itoa(param.CooperationContractId)
  47 + method := "PUT"
  48 + req := gateway.CreateRequest(url, method)
  49 + log.Logger.Debug("向基础模块请求数据:更新共创合约。", map[string]interface{}{
  50 + "api": method + ":" + url,
  51 + "param": param,
  52 + })
  53 + req, err := req.JSONBody(param)
  54 + if err != nil {
  55 + return nil, fmt.Errorf("请求更新共创合约失败:%w", err)
  56 + }
  57 +
  58 + byteResult, err := req.Bytes()
  59 + if err != nil {
  60 + return nil, fmt.Errorf("获取更新共创合约失败:%w", err)
  61 + }
  62 + log.Logger.Debug("获取基础模块请求数据:更新共创合约。", map[string]interface{}{
  63 + "result": string(byteResult),
  64 + })
  65 + var result service_gateway.GatewayResponse
  66 + err = json.Unmarshal(byteResult, &result)
  67 + if err != nil {
  68 + return nil, fmt.Errorf("解析更新共创合约:%w", err)
  69 + }
  70 + var data DataCooperationContractUpdate
  71 + err = gateway.GetResponseData(result, &data)
  72 + return &data, err
  73 +}
  74 +
  75 +// CooperationContractSearch 查询共创合约
  76 +func (gateway HttplibAlliedCreationCooperation) CooperationContractSearch(param ReqCooperationContractSearch) (*DataCooperationContractSearch, error) {
  77 + url := gateway.baseUrL + "/cooperation-contracts/search"
  78 + method := "POST"
  79 + req := gateway.CreateRequest(url, method)
  80 + log.Logger.Debug("向基础模块请求数据:查询共创合约。", map[string]interface{}{
  81 + "api": method + ":" + url,
  82 + "param": param,
  83 + })
  84 + req, err := req.JSONBody(param)
  85 + if err != nil {
  86 + return nil, fmt.Errorf("请求查询共创合约失败:%w", err)
  87 + }
  88 +
  89 + byteResult, err := req.Bytes()
  90 + if err != nil {
  91 + return nil, fmt.Errorf("获取查询共创合约失败:%w", err)
  92 + }
  93 + log.Logger.Debug("获取基础模块请求数据:查询共创合约。", map[string]interface{}{
  94 + "result": string(byteResult),
  95 + })
  96 + var result service_gateway.GatewayResponse
  97 + err = json.Unmarshal(byteResult, &result)
  98 + if err != nil {
  99 + return nil, fmt.Errorf("解析查询共创合约:%w", err)
  100 + }
  101 + var data DataCooperationContractSearch
  102 + err = gateway.GetResponseData(result, &data)
  103 + return &data, err
  104 +}
  105 +
  106 +// CooperationContractsSearchByUndertaker 根据承接人查询并返回共创项目合约
  107 +func (gateway HttplibAlliedCreationCooperation) CooperationContractsSearchByUndertaker(param ReqCooperationContractSearchByUndertaker) (*DataCooperationContractSearchByUndertaker, error) {
  108 + url := gateway.baseUrL + "/cooperation-contracts/search-by-undertaker"
  109 + method := "POST"
  110 + req := gateway.CreateRequest(url, method)
  111 + log.Logger.Debug("向基础模块请求数据:根据承接人查询并返回共创项目合约。", map[string]interface{}{
  112 + "api": method + ":" + url,
  113 + "param": param,
  114 + })
  115 + req, err := req.JSONBody(param)
  116 + if err != nil {
  117 + return nil, fmt.Errorf("请求根据承接人查询并返回共创项目合约失败:%w", err)
  118 + }
  119 +
  120 + byteResult, err := req.Bytes()
  121 + if err != nil {
  122 + return nil, fmt.Errorf("获取根据承接人查询并返回共创项目合约失败:%w", err)
  123 + }
  124 + log.Logger.Debug("获取基础模块请求数据:根据承接人查询并返回共创项目合约。", map[string]interface{}{
  125 + "result": string(byteResult),
  126 + })
  127 + var result service_gateway.GatewayResponse
  128 + err = json.Unmarshal(byteResult, &result)
  129 + if err != nil {
  130 + return nil, fmt.Errorf("解析根据承接人查询并返回共创项目合约:%w", err)
  131 + }
  132 + var data DataCooperationContractSearchByUndertaker
  133 + err = gateway.GetResponseData(result, &data)
  134 + return &data, err
  135 +}
  136 +
  137 +// CooperationContractRemove 移除共创合约
  138 +func (gateway HttplibAlliedCreationCooperation) CooperationContractRemove(param ReqCooperationContractRemove) (*DataCooperationContractRemove, error) {
  139 + url := gateway.baseUrL + "/cooperation-contracts/" + strconv.Itoa(param.CooperationContractId)
  140 + method := "DELETE"
  141 + req := gateway.CreateRequest(url, method)
  142 + log.Logger.Debug("向基础模块请求数据:移除共创合约。", map[string]interface{}{
  143 + "api": method + ":" + url,
  144 + "param": param,
  145 + })
  146 + req, err := req.JSONBody(param)
  147 + if err != nil {
  148 + return nil, fmt.Errorf("请求移除共创合约失败:%w", err)
  149 + }
  150 +
  151 + byteResult, err := req.Bytes()
  152 + if err != nil {
  153 + return nil, fmt.Errorf("获取移除共创合约失败:%w", err)
  154 + }
  155 + log.Logger.Debug("获取基础模块请求数据:移除共创合约。", map[string]interface{}{
  156 + "result": string(byteResult),
  157 + })
  158 + var result service_gateway.GatewayResponse
  159 + err = json.Unmarshal(byteResult, &result)
  160 + if err != nil {
  161 + return nil, fmt.Errorf("解析移除共创合约:%w", err)
  162 + }
  163 + var data DataCooperationContractRemove
  164 + err = gateway.GetResponseData(result, &data)
  165 + return &data, err
  166 +}
  167 +
  168 +// CooperationContractList 返回共创合约列表
  169 +func (gateway HttplibAlliedCreationCooperation) CooperationContractList(param ReqCooperationContractList) (*DataCooperationContractList, error) {
  170 + url := gateway.baseUrL + "/cooperation-contracts"
  171 + method := "GET"
  172 + req := gateway.CreateRequest(url, method)
  173 + log.Logger.Debug("向基础模块请求数据:返回共创合约列表。", map[string]interface{}{
  174 + "api": method + ":" + url,
  175 + "param": param,
  176 + })
  177 + req, err := req.JSONBody(param)
  178 + if err != nil {
  179 + return nil, fmt.Errorf("请求返回共创合约列表失败:%w", err)
  180 + }
  181 +
  182 + byteResult, err := req.Bytes()
  183 + if err != nil {
  184 + return nil, fmt.Errorf("获取返回共创合约列表失败:%w", err)
  185 + }
  186 + log.Logger.Debug("获取基础模块请求数据:返回共创合约列表。", map[string]interface{}{
  187 + "result": string(byteResult),
  188 + })
  189 + var result service_gateway.GatewayResponse
  190 + err = json.Unmarshal(byteResult, &result)
  191 + if err != nil {
  192 + return nil, fmt.Errorf("解析返回共创合约列表:%w", err)
  193 + }
  194 + var data DataCooperationContractList
  195 + err = gateway.GetResponseData(result, &data)
  196 + return &data, err
  197 +}
  198 +
  199 +// CooperationContractGet 返回共创合约详情
  200 +func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param ReqCooperationContractGet) (*DataCooperationContractGet, error) {
  201 + url := gateway.baseUrL + "/cooperation-contracts/" + strconv.Itoa(param.CooperationContractId)
  202 + method := "GET"
  203 + req := gateway.CreateRequest(url, method)
  204 + log.Logger.Debug("向基础模块请求数据:返回共创合约详情。", map[string]interface{}{
  205 + "api": method + ":" + url,
  206 + "param": param,
  207 + })
  208 + req, err := req.JSONBody(param)
  209 + if err != nil {
  210 + return nil, fmt.Errorf("请求返回共创合约详情失败:%w", err)
  211 + }
  212 +
  213 + byteResult, err := req.Bytes()
  214 + if err != nil {
  215 + return nil, fmt.Errorf("获取返回共创合约详情失败:%w", err)
  216 + }
  217 + log.Logger.Debug("获取基础模块请求数据:返回共创合约详情。", map[string]interface{}{
  218 + "result": string(byteResult),
  219 + })
  220 + var result service_gateway.GatewayResponse
  221 + err = json.Unmarshal(byteResult, &result)
  222 + if err != nil {
  223 + return nil, fmt.Errorf("解析返回共创合约详情:%w", err)
  224 + }
  225 + var data DataCooperationContractGet
  226 + err = gateway.GetResponseData(result, &data)
  227 + return &data, err
  228 +}
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "strconv"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  9 +
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  11 +)
  12 +
  13 +// ReqCooperationModeAdd 创建共创模式
  14 +func (gateway HttplibAlliedCreationCooperation) CooperationModeAdd(param ReqCooperationModeAdd) (*DataCooperationModeAdd, error) {
  15 + url := gateway.baseUrL + "/cooperation-modes"
  16 + method := "post"
  17 + req := gateway.CreateRequest(url, method)
  18 + log.Logger.Debug("向基础模块请求数据:创建共创模式。", map[string]interface{}{
  19 + "api": method + ":" + url,
  20 + "param": param,
  21 + })
  22 + req, err := req.JSONBody(param)
  23 + if err != nil {
  24 + return nil, fmt.Errorf("请求创建共创模式失败:%w", err)
  25 + }
  26 +
  27 + byteResult, err := req.Bytes()
  28 + if err != nil {
  29 + return nil, fmt.Errorf("获取创建共创模式失败:%w", err)
  30 + }
  31 + log.Logger.Debug("获取基础模块请求数据:创建共创模式。", map[string]interface{}{
  32 + "result": string(byteResult),
  33 + })
  34 + var result service_gateway.GatewayResponse
  35 + err = json.Unmarshal(byteResult, &result)
  36 + if err != nil {
  37 + return nil, fmt.Errorf("解析创建共创模式:%w", err)
  38 + }
  39 + var data DataCooperationModeAdd
  40 + err = gateway.GetResponseData(result, &data)
  41 + return &data, err
  42 +}
  43 +
  44 +// CooperationModeList 返回共创模式列表
  45 +func (gateway HttplibAlliedCreationCooperation) CooperationModeList(param ReqCooperationModeList) (*DataCooperationModeList, error) {
  46 + url := gateway.baseUrL + "/cooperation-modes"
  47 + method := "get"
  48 + req := gateway.CreateRequest(url, method)
  49 + log.Logger.Debug("向基础模块请求数据:返回共创模式列表。", map[string]interface{}{
  50 + "api": method + ":" + url,
  51 + "param": param,
  52 + })
  53 + req, err := req.JSONBody(param)
  54 + if err != nil {
  55 + return nil, fmt.Errorf("请求返回共创模式列表失败:%w", err)
  56 + }
  57 +
  58 + byteResult, err := req.Bytes()
  59 + if err != nil {
  60 + return nil, fmt.Errorf("获取返回共创模式列表失败:%w", err)
  61 + }
  62 + log.Logger.Debug("获取基础模块请求数据:返回共创模式列表。", map[string]interface{}{
  63 + "result": string(byteResult),
  64 + })
  65 + var result service_gateway.GatewayResponse
  66 + err = json.Unmarshal(byteResult, &result)
  67 + if err != nil {
  68 + return nil, fmt.Errorf("解析返回共创模式列表:%w", err)
  69 + }
  70 + var data DataCooperationModeList
  71 + err = gateway.GetResponseData(result, &data)
  72 + return &data, err
  73 +}
  74 +
  75 +// CooperationModeGet 返回共创模式详情
  76 +func (gateway HttplibAlliedCreationCooperation) CooperationModeGet(param ReqCooperationModeGet) (*DataCooperationModeGet, error) {
  77 + url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.ModeId)
  78 + method := "get"
  79 + req := gateway.CreateRequest(url, method)
  80 + log.Logger.Debug("向基础模块请求数据:返回共创模式详情。", map[string]interface{}{
  81 + "api": method + ":" + url,
  82 + "param": param,
  83 + })
  84 + req, err := req.JSONBody(param)
  85 + if err != nil {
  86 + return nil, fmt.Errorf("请求返回共创模式详情失败:%w", err)
  87 + }
  88 +
  89 + byteResult, err := req.Bytes()
  90 + if err != nil {
  91 + return nil, fmt.Errorf("获取返回共创模式详情失败:%w", err)
  92 + }
  93 + log.Logger.Debug("获取基础模块请求数据:返回共创模式详情。", map[string]interface{}{
  94 + "result": string(byteResult),
  95 + })
  96 + var result service_gateway.GatewayResponse
  97 + err = json.Unmarshal(byteResult, &result)
  98 + if err != nil {
  99 + return nil, fmt.Errorf("解析返回共创模式详情:%w", err)
  100 + }
  101 + var data DataCooperationModeGet
  102 + err = gateway.GetResponseData(result, &data)
  103 + return &data, err
  104 +}
  105 +
  106 +// CooperationModeUpdate 更新共创模式
  107 +func (gateway HttplibAlliedCreationCooperation) CooperationModeUpdate(param ReqCooperationModeUpdate) (*DataCooperationModeUpdate, error) {
  108 + url := gateway.baseUrL + "/cooperation-modes" + strconv.Itoa(param.ModeId)
  109 + method := "put"
  110 + req := gateway.CreateRequest(url, method)
  111 + log.Logger.Debug("向基础模块请求数据:更新共创模式。", map[string]interface{}{
  112 + "api": method + ":" + url,
  113 + "param": param,
  114 + })
  115 + req, err := req.JSONBody(param)
  116 + if err != nil {
  117 + return nil, fmt.Errorf("请求更新共创模式失败:%w", err)
  118 + }
  119 +
  120 + byteResult, err := req.Bytes()
  121 + if err != nil {
  122 + return nil, fmt.Errorf("获取更新共创模式失败:%w", err)
  123 + }
  124 + log.Logger.Debug("获取基础模块请求数据:更新共创模式。", map[string]interface{}{
  125 + "result": string(byteResult),
  126 + })
  127 + var result service_gateway.GatewayResponse
  128 + err = json.Unmarshal(byteResult, &result)
  129 + if err != nil {
  130 + return nil, fmt.Errorf("解析更新共创模式:%w", err)
  131 + }
  132 + var data DataCooperationModeUpdate
  133 + err = gateway.GetResponseData(result, &data)
  134 + return &data, err
  135 +}
  136 +
  137 +//CooperationModeRemove 移除共创模式
  138 +func (gateway HttplibAlliedCreationCooperation) CooperationModeRemove(param ReqCooperationModeRemove) (*DataCooperationModeRemove, error) {
  139 + url := gateway.baseUrL + "/cooperation-modes/" + strconv.Itoa(param.ModeId)
  140 + method := "delete"
  141 + req := gateway.CreateRequest(url, method)
  142 + log.Logger.Debug("向基础模块请求数据:移除共创模式。", map[string]interface{}{
  143 + "api": method + ":" + url,
  144 + "param": param,
  145 + })
  146 + req, err := req.JSONBody(param)
  147 + if err != nil {
  148 + return nil, fmt.Errorf("请求移除共创模式失败:%w", err)
  149 + }
  150 +
  151 + byteResult, err := req.Bytes()
  152 + if err != nil {
  153 + return nil, fmt.Errorf("获取移除共创模式失败:%w", err)
  154 + }
  155 + log.Logger.Debug("获取基础模块请求数据:移除共创模式。", map[string]interface{}{
  156 + "result": string(byteResult),
  157 + })
  158 + var result service_gateway.GatewayResponse
  159 + err = json.Unmarshal(byteResult, &result)
  160 + if err != nil {
  161 + return nil, fmt.Errorf("解析移除共创模式:%w", err)
  162 + }
  163 + var data DataCooperationModeRemove
  164 + err = gateway.GetResponseData(result, &data)
  165 + return &data, err
  166 +}
  167 +
  168 +// CooperationModesSearch查询共创模式
  169 +func (gateway HttplibAlliedCreationCooperation) CooperationModesSearch(param ReqCooperationModesSearch) (*DataCooperationModesSearch, error) {
  170 + url := gateway.baseUrL + "/cooperation-modes/search"
  171 + method := "post"
  172 + req := gateway.CreateRequest(url, method)
  173 + log.Logger.Debug("向基础模块请求数据:查询共创模式。", map[string]interface{}{
  174 + "api": method + ":" + url,
  175 + "param": param,
  176 + })
  177 + req, err := req.JSONBody(param)
  178 + if err != nil {
  179 + return nil, fmt.Errorf("请求查询共创模式失败:%w", err)
  180 + }
  181 +
  182 + byteResult, err := req.Bytes()
  183 + if err != nil {
  184 + return nil, fmt.Errorf("获取查询共创模式失败:%w", err)
  185 + }
  186 + log.Logger.Debug("获取基础模块请求数据:查询共创模式。", map[string]interface{}{
  187 + "result": string(byteResult),
  188 + })
  189 + var result service_gateway.GatewayResponse
  190 + err = json.Unmarshal(byteResult, &result)
  191 + if err != nil {
  192 + return nil, fmt.Errorf("解析查询共创模式:%w", err)
  193 + }
  194 + var data DataCooperationModesSearch
  195 + err = gateway.GetResponseData(result, &data)
  196 + return &data, err
  197 +}
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "strconv"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  10 +)
  11 +
  12 +// CooperationProjectAdd 创建共创项目
  13 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectAdd(param ReqCooperationProjectAdd) (*DataCooperationProjectAdd, error) {
  14 + url := gateway.baseUrL + "/cooperation-projects"
  15 + method := "POST"
  16 + req := gateway.CreateRequest(url, method)
  17 + log.Logger.Debug("向基础模块请求数据:创建共创项目。", map[string]interface{}{
  18 + "api": method + ":" + url,
  19 + "param": param,
  20 + })
  21 + req, err := req.JSONBody(param)
  22 + if err != nil {
  23 + return nil, fmt.Errorf("请求创建共创项目失败:%w", err)
  24 + }
  25 +
  26 + byteResult, err := req.Bytes()
  27 + if err != nil {
  28 + return nil, fmt.Errorf("获取创建共创项目失败:%w", err)
  29 + }
  30 + log.Logger.Debug("获取基础模块请求数据:创建共创项目。", map[string]interface{}{
  31 + "result": string(byteResult),
  32 + })
  33 + var result service_gateway.GatewayResponse
  34 + err = json.Unmarshal(byteResult, &result)
  35 + if err != nil {
  36 + return nil, fmt.Errorf("解析创建共创项目:%w", err)
  37 + }
  38 + var data DataCooperationProjectAdd
  39 + err = gateway.GetResponseData(result, &data)
  40 + return &data, err
  41 +}
  42 +
  43 +// CooperationProjectList 返回共创项目列表
  44 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectList(param ReqCooperationProjectList) (*DataCooperationProjectList, error) {
  45 + url := gateway.baseUrL + "/cooperation-projects"
  46 + method := "GET"
  47 + req := gateway.CreateRequest(url, method)
  48 + log.Logger.Debug("向基础模块请求数据:返回共创项目列表。", map[string]interface{}{
  49 + "api": method + ":" + url,
  50 + "param": param,
  51 + })
  52 + req, err := req.JSONBody(param)
  53 + if err != nil {
  54 + return nil, fmt.Errorf("请求返回共创项目列表失败:%w", err)
  55 + }
  56 +
  57 + byteResult, err := req.Bytes()
  58 + if err != nil {
  59 + return nil, fmt.Errorf("获取返回共创项目列表失败:%w", err)
  60 + }
  61 + log.Logger.Debug("获取基础模块请求数据:返回共创项目列表。", map[string]interface{}{
  62 + "result": string(byteResult),
  63 + })
  64 + var result service_gateway.GatewayResponse
  65 + err = json.Unmarshal(byteResult, &result)
  66 + if err != nil {
  67 + return nil, fmt.Errorf("解析返回共创项目列表:%w", err)
  68 + }
  69 + var data DataCooperationProjectList
  70 + err = gateway.GetResponseData(result, &data)
  71 + return &data, err
  72 +}
  73 +
  74 +// Cooperation-projects[cooperationProjectId} 返回共创项目详情
  75 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqCooperationProjectGet) (*DataCooperationProjectGet, error) {
  76 + url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId)
  77 + method := "GET"
  78 + req := gateway.CreateRequest(url, method)
  79 + log.Logger.Debug("向基础模块请求数据:返回共创项目详情。", map[string]interface{}{
  80 + "api": method + ":" + url,
  81 + "param": param,
  82 + })
  83 + req, err := req.JSONBody(param)
  84 + if err != nil {
  85 + return nil, fmt.Errorf("请求返回共创项目详情失败:%w", err)
  86 + }
  87 +
  88 + byteResult, err := req.Bytes()
  89 + if err != nil {
  90 + return nil, fmt.Errorf("获取返回共创项目详情失败:%w", err)
  91 + }
  92 + log.Logger.Debug("获取基础模块请求数据:返回共创项目详情。", map[string]interface{}{
  93 + "result": string(byteResult),
  94 + })
  95 + var result service_gateway.GatewayResponse
  96 + err = json.Unmarshal(byteResult, &result)
  97 + if err != nil {
  98 + return nil, fmt.Errorf("解析返回共创项目详情:%w", err)
  99 + }
  100 + var data DataCooperationProjectGet
  101 + err = gateway.GetResponseData(result, &data)
  102 + return &data, err
  103 +}
  104 +
  105 +// CooperationProjectUpdate 更新共创项目
  106 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectUpdate(param ReqCooperationProjectUpdate) (*DataCooperationProjectUpdate, error) {
  107 + url := gateway.baseUrL + "/cooperation-projects/{cooperationProjectId}"
  108 + method := "PUT"
  109 + req := gateway.CreateRequest(url, method)
  110 + log.Logger.Debug("向基础模块请求数据:更新共创项目。", map[string]interface{}{
  111 + "api": method + ":" + url,
  112 + "param": param,
  113 + })
  114 + req, err := req.JSONBody(param)
  115 + if err != nil {
  116 + return nil, fmt.Errorf("请求更新共创项目失败:%w", err)
  117 + }
  118 +
  119 + byteResult, err := req.Bytes()
  120 + if err != nil {
  121 + return nil, fmt.Errorf("获取更新共创项目失败:%w", err)
  122 + }
  123 + log.Logger.Debug("获取基础模块请求数据:更新共创项目。", map[string]interface{}{
  124 + "result": string(byteResult),
  125 + })
  126 + var result service_gateway.GatewayResponse
  127 + err = json.Unmarshal(byteResult, &result)
  128 + if err != nil {
  129 + return nil, fmt.Errorf("解析更新共创项目:%w", err)
  130 + }
  131 + var data DataCooperationProjectUpdate
  132 + err = gateway.GetResponseData(result, &data)
  133 + return &data, err
  134 +}
  135 +
  136 +//CooperationProjectRemove 移除共创项目
  137 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectRemove(param ReqCooperationProjectRemove) (*DataCooperationProjectRemove, error) {
  138 + url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId)
  139 + method := "DELETE"
  140 + req := gateway.CreateRequest(url, method)
  141 + log.Logger.Debug("向基础模块请求数据:移除共创项目。", map[string]interface{}{
  142 + "api": method + ":" + url,
  143 + "param": param,
  144 + })
  145 + req, err := req.JSONBody(param)
  146 + if err != nil {
  147 + return nil, fmt.Errorf("请求移除共创项目失败:%w", err)
  148 + }
  149 +
  150 + byteResult, err := req.Bytes()
  151 + if err != nil {
  152 + return nil, fmt.Errorf("获取移除共创项目失败:%w", err)
  153 + }
  154 + log.Logger.Debug("获取基础模块请求数据:移除共创项目。", map[string]interface{}{
  155 + "result": string(byteResult),
  156 + })
  157 + var result service_gateway.GatewayResponse
  158 + err = json.Unmarshal(byteResult, &result)
  159 + if err != nil {
  160 + return nil, fmt.Errorf("解析移除共创项目:%w", err)
  161 + }
  162 + var data DataCooperationProjectRemove
  163 + err = gateway.GetResponseData(result, &data)
  164 + return &data, err
  165 +}
  166 +
  167 +// CooperationProjectsRelease发布共创项目
  168 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectsRelease(param ReqCooperationProjectsRelease) (*DataCooperationProjectsRelease, error) {
  169 + url := gateway.baseUrL + "/cooperation-projects/release-cooperation-project"
  170 + method := "POST"
  171 + req := gateway.CreateRequest(url, method)
  172 + log.Logger.Debug("向基础模块请求数据:发布共创项目。", map[string]interface{}{
  173 + "api": method + ":" + url,
  174 + "param": param,
  175 + })
  176 + req, err := req.JSONBody(param)
  177 + if err != nil {
  178 + return nil, fmt.Errorf("请求发布共创项目失败:%w", err)
  179 + }
  180 +
  181 + byteResult, err := req.Bytes()
  182 + if err != nil {
  183 + return nil, fmt.Errorf("获取发布共创项目失败:%w", err)
  184 + }
  185 + log.Logger.Debug("获取基础模块请求数据:发布共创项目。", map[string]interface{}{
  186 + "result": string(byteResult),
  187 + })
  188 + var result service_gateway.GatewayResponse
  189 + err = json.Unmarshal(byteResult, &result)
  190 + if err != nil {
  191 + return nil, fmt.Errorf("解析发布共创项目:%w", err)
  192 + }
  193 + var data DataCooperationProjectsRelease
  194 + err = gateway.GetResponseData(result, &data)
  195 + return &data, err
  196 +}
  197 +
  198 +//CooperationProjectsSearch 查询共创项目
  199 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectsSearch(param ReqCooperationProjectSearch) (*DataCooperationProjectSearch, error) {
  200 + url := gateway.baseUrL + "/cooperation-projects/search"
  201 + method := "POST"
  202 + req := gateway.CreateRequest(url, method)
  203 + log.Logger.Debug("向基础模块请求数据:查询共创项目。", map[string]interface{}{
  204 + "api": method + ":" + url,
  205 + "param": param,
  206 + })
  207 + req, err := req.JSONBody(param)
  208 + if err != nil {
  209 + return nil, fmt.Errorf("请求查询共创项目失败:%w", err)
  210 + }
  211 +
  212 + byteResult, err := req.Bytes()
  213 + if err != nil {
  214 + return nil, fmt.Errorf("获取查询共创项目失败:%w", err)
  215 + }
  216 + log.Logger.Debug("获取基础模块请求数据:查询共创项目。", map[string]interface{}{
  217 + "result": string(byteResult),
  218 + })
  219 + var result service_gateway.GatewayResponse
  220 + err = json.Unmarshal(byteResult, &result)
  221 + if err != nil {
  222 + return nil, fmt.Errorf("解析查询共创项目:%w", err)
  223 + }
  224 + var data DataCooperationProjectSearch
  225 + err = gateway.GetResponseData(result, &data)
  226 + return &data, err
  227 +}
  228 +
  229 +// CooperationProjectsCheck 判断当前勾选的承接对象是否存在用户
  230 +func (gateway HttplibAlliedCreationCooperation) CooperationProjectsCheck(param ReqCooperationProjectsCheck) (*DataCooperationProjectsCheck, error) {
  231 + url := gateway.baseUrL + "/cooperation-projects/check"
  232 + method := "POST"
  233 + req := gateway.CreateRequest(url, method)
  234 + log.Logger.Debug("向基础模块请求数据:判断当前勾选的承接对象是否存在用户。", map[string]interface{}{
  235 + "api": method + ":" + url,
  236 + "param": param,
  237 + })
  238 + req, err := req.JSONBody(param)
  239 + if err != nil {
  240 + return nil, fmt.Errorf("请求判断当前勾选的承接对象是否存在用户失败:%w", err)
  241 + }
  242 +
  243 + byteResult, err := req.Bytes()
  244 + if err != nil {
  245 + return nil, fmt.Errorf("获取判断当前勾选的承接对象是否存在用户失败:%w", err)
  246 + }
  247 + log.Logger.Debug("获取基础模块请求数据:判断当前勾选的承接对象是否存在用户。", map[string]interface{}{
  248 + "result": string(byteResult),
  249 + })
  250 + var result service_gateway.GatewayResponse
  251 + err = json.Unmarshal(byteResult, &result)
  252 + if err != nil {
  253 + return nil, fmt.Errorf("解析判断当前勾选的承接对象是否存在用户:%w", err)
  254 + }
  255 + var data DataCooperationProjectsCheck
  256 + err = gateway.GetResponseData(result, &data)
  257 + return &data, err
  258 +}
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "strconv"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  9 +
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  11 +)
  12 +
  13 +// DividendsOrderAdd 创建分红订单
  14 +func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDividendsOrderAdd) (*DataDividendsOrderAdd, error) {
  15 + url := gateway.baseUrL + "/dividends-orders"
  16 + method := "POST"
  17 + req := gateway.CreateRequest(url, method)
  18 + log.Logger.Debug("向基础模块请求数据:创建分红订单。", map[string]interface{}{
  19 + "api": method + ":" + url,
  20 + "param": param,
  21 + })
  22 + req, err := req.JSONBody(param)
  23 + if err != nil {
  24 + return nil, fmt.Errorf("请求创建分红订单失败:%w", err)
  25 + }
  26 +
  27 + byteResult, err := req.Bytes()
  28 + if err != nil {
  29 + return nil, fmt.Errorf("获取创建分红订单失败:%w", err)
  30 + }
  31 + log.Logger.Debug("获取基础模块请求数据:创建分红订单。", map[string]interface{}{
  32 + "result": string(byteResult),
  33 + })
  34 + var result service_gateway.GatewayResponse
  35 + err = json.Unmarshal(byteResult, &result)
  36 + if err != nil {
  37 + return nil, fmt.Errorf("解析创建分红订单:%w", err)
  38 + }
  39 + var data DataDividendsOrderAdd
  40 + err = gateway.GetResponseData(result, &data)
  41 + return &data, err
  42 +}
  43 +
  44 +// DividendsOrderUpdate 更新分红订单
  45 +func (gateway HttplibAlliedCreationCooperation) DividendsOrderUpdate(param ReqDividendsOrderUpdate) (*DataDividendsOrderUpdate, error) {
  46 + url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
  47 + method := "PUT"
  48 + req := gateway.CreateRequest(url, method)
  49 + log.Logger.Debug("向基础模块请求数据:更新分红订单。", map[string]interface{}{
  50 + "api": method + ":" + url,
  51 + "param": param,
  52 + })
  53 + req, err := req.JSONBody(param)
  54 + if err != nil {
  55 + return nil, fmt.Errorf("请求更新分红订单失败:%w", err)
  56 + }
  57 +
  58 + byteResult, err := req.Bytes()
  59 + if err != nil {
  60 + return nil, fmt.Errorf("获取更新分红订单失败:%w", err)
  61 + }
  62 + log.Logger.Debug("获取基础模块请求数据:更新分红订单。", map[string]interface{}{
  63 + "result": string(byteResult),
  64 + })
  65 + var result service_gateway.GatewayResponse
  66 + err = json.Unmarshal(byteResult, &result)
  67 + if err != nil {
  68 + return nil, fmt.Errorf("解析更新分红订单:%w", err)
  69 + }
  70 + var data DataDividendsOrderUpdate
  71 + err = gateway.GetResponseData(result, &data)
  72 + return &data, err
  73 +}
  74 +
  75 +// DividendsOrderSearch 查询分红订单
  76 +func (gateway HttplibAlliedCreationCooperation) DividendsOrderSearch(param ReqDividendsOrderSearch) (*DataDividendsOrderSearch, error) {
  77 + url := gateway.baseUrL + "/dividends-orders/search"
  78 + method := "POST"
  79 + req := gateway.CreateRequest(url, method)
  80 + log.Logger.Debug("向基础模块请求数据:查询分红订单。", map[string]interface{}{
  81 + "api": method + ":" + url,
  82 + "param": param,
  83 + })
  84 + req, err := req.JSONBody(param)
  85 + if err != nil {
  86 + return nil, fmt.Errorf("请求查询分红订单失败:%w", err)
  87 + }
  88 +
  89 + byteResult, err := req.Bytes()
  90 + if err != nil {
  91 + return nil, fmt.Errorf("获取查询分红订单失败:%w", err)
  92 + }
  93 + log.Logger.Debug("获取基础模块请求数据:查询分红订单。", map[string]interface{}{
  94 + "result": string(byteResult),
  95 + })
  96 + var result service_gateway.GatewayResponse
  97 + err = json.Unmarshal(byteResult, &result)
  98 + if err != nil {
  99 + return nil, fmt.Errorf("解析查询分红订单:%w", err)
  100 + }
  101 + var data DataDividendsOrderSearch
  102 + err = gateway.GetResponseData(result, &data)
  103 + return &data, err
  104 +}
  105 +
  106 +// SearchOrderNumber 模糊查询分红订单号
  107 +func (gateway HttplibAlliedCreationCooperation) SearchOrderNumber(param ReqSearchOrderNumber) (*DataSearchOrderNumber, error) {
  108 + url := gateway.baseUrL + "/search-order-number"
  109 + method := "POST"
  110 + req := gateway.CreateRequest(url, method)
  111 + log.Logger.Debug("向基础模块请求数据:模糊查询分红订单号。", map[string]interface{}{
  112 + "api": method + ":" + url,
  113 + "param": param,
  114 + })
  115 + req, err := req.JSONBody(param)
  116 + if err != nil {
  117 + return nil, fmt.Errorf("请求模糊查询分红订单号失败:%w", err)
  118 + }
  119 +
  120 + byteResult, err := req.Bytes()
  121 + if err != nil {
  122 + return nil, fmt.Errorf("获取模糊查询分红订单号失败:%w", err)
  123 + }
  124 + log.Logger.Debug("获取基础模块请求数据:模糊查询分红订单号。", map[string]interface{}{
  125 + "result": string(byteResult),
  126 + })
  127 + var result service_gateway.GatewayResponse
  128 + err = json.Unmarshal(byteResult, &result)
  129 + if err != nil {
  130 + return nil, fmt.Errorf("解析模糊查询分红订单号:%w", err)
  131 + }
  132 + var data DataSearchOrderNumber
  133 + err = gateway.GetResponseData(result, &data)
  134 + return &data, err
  135 +}
  136 +
  137 +// DividendsOrderRemove 移除分红订单
  138 +func (gateway HttplibAlliedCreationCooperation) DividendsOrderRemove(param ReqDividendsOrderRemove) (*DataDividendsOrderRemove, error) {
  139 + url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
  140 + method := "DELETE"
  141 + req := gateway.CreateRequest(url, method)
  142 + log.Logger.Debug("向基础模块请求数据:移除分红订单。", map[string]interface{}{
  143 + "api": method + ":" + url,
  144 + "param": param,
  145 + })
  146 + req, err := req.JSONBody(param)
  147 + if err != nil {
  148 + return nil, fmt.Errorf("请求移除分红订单失败:%w", err)
  149 + }
  150 +
  151 + byteResult, err := req.Bytes()
  152 + if err != nil {
  153 + return nil, fmt.Errorf("获取移除分红订单失败:%w", err)
  154 + }
  155 + log.Logger.Debug("获取基础模块请求数据:移除分红订单。", map[string]interface{}{
  156 + "result": string(byteResult),
  157 + })
  158 + var result service_gateway.GatewayResponse
  159 + err = json.Unmarshal(byteResult, &result)
  160 + if err != nil {
  161 + return nil, fmt.Errorf("解析移除分红订单:%w", err)
  162 + }
  163 + var data DataDividendsOrderRemove
  164 + err = gateway.GetResponseData(result, &data)
  165 + return &data, err
  166 +}
  167 +
  168 +//DividendsOrderList 返回分红订单列表
  169 +func (gateway HttplibAlliedCreationCooperation) DividendsOrderList(param ReqDividendsOrderList) (*DataDividendsOrderList, error) {
  170 + url := gateway.baseUrL + "/dividends-orders"
  171 + method := "GET"
  172 + req := gateway.CreateRequest(url, method)
  173 + log.Logger.Debug("向基础模块请求数据:返回分红订单列表。", map[string]interface{}{
  174 + "api": method + ":" + url,
  175 + "param": param,
  176 + })
  177 + req, err := req.JSONBody(param)
  178 + if err != nil {
  179 + return nil, fmt.Errorf("请求返回分红订单列表失败:%w", err)
  180 + }
  181 +
  182 + byteResult, err := req.Bytes()
  183 + if err != nil {
  184 + return nil, fmt.Errorf("获取返回分红订单列表失败:%w", err)
  185 + }
  186 + log.Logger.Debug("获取基础模块请求数据:返回分红订单列表。", map[string]interface{}{
  187 + "result": string(byteResult),
  188 + })
  189 + var result service_gateway.GatewayResponse
  190 + err = json.Unmarshal(byteResult, &result)
  191 + if err != nil {
  192 + return nil, fmt.Errorf("解析返回分红订单列表:%w", err)
  193 + }
  194 + var data DataDividendsOrderList
  195 + err = gateway.GetResponseData(result, &data)
  196 + return &data, err
  197 +}
  198 +
  199 +// DividendsOrderGet 返回分红订单详情
  200 +func (gateway HttplibAlliedCreationCooperation) DividendsOrderGet(param ReqDividendsOrderGet) (*DataDividendsOrderGet, error) {
  201 + url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
  202 + method := "GET"
  203 + req := gateway.CreateRequest(url, method)
  204 + log.Logger.Debug("向基础模块请求数据:返回分红订单详情。", map[string]interface{}{
  205 + "api": method + ":" + url,
  206 + "param": param,
  207 + })
  208 + req, err := req.JSONBody(param)
  209 + if err != nil {
  210 + return nil, fmt.Errorf("请求返回分红订单详情失败:%w", err)
  211 + }
  212 +
  213 + byteResult, err := req.Bytes()
  214 + if err != nil {
  215 + return nil, fmt.Errorf("获取返回分红订单详情失败:%w", err)
  216 + }
  217 + log.Logger.Debug("获取基础模块请求数据:返回分红订单详情。", map[string]interface{}{
  218 + "result": string(byteResult),
  219 + })
  220 + var result service_gateway.GatewayResponse
  221 + err = json.Unmarshal(byteResult, &result)
  222 + if err != nil {
  223 + return nil, fmt.Errorf("解析返回分红订单详情:%w", err)
  224 + }
  225 + var data DataDividendsOrderGet
  226 + err = gateway.GetResponseData(result, &data)
  227 + return &data, err
  228 +}
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "strconv"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  10 +)
  11 +
  12 +// DividendsEstimateIncentive 确定预算分红激励
  13 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimateIncentive(param ReqDividendsEstimateIncentive) (*DataDividendsEstimateIncentive, error) {
  14 + url := gateway.baseUrL + "/dividends-estimates/estimate-dividends-incentives"
  15 + method := "POST"
  16 + req := gateway.CreateRequest(url, method)
  17 + log.Logger.Debug("向基础模块请求数据:确定预算分红激励。", map[string]interface{}{
  18 + "api": method + ":" + url,
  19 + "param": param,
  20 + })
  21 + req, err := req.JSONBody(param)
  22 + if err != nil {
  23 + return nil, fmt.Errorf("请求确定预算分红激励失败:%w", err)
  24 + }
  25 +
  26 + byteResult, err := req.Bytes()
  27 + if err != nil {
  28 + return nil, fmt.Errorf("获取确定预算分红激励失败:%w", err)
  29 + }
  30 + log.Logger.Debug("获取基础模块请求数据:确定预算分红激励。", map[string]interface{}{
  31 + "result": string(byteResult),
  32 + })
  33 + var result service_gateway.GatewayResponse
  34 + err = json.Unmarshal(byteResult, &result)
  35 + if err != nil {
  36 + return nil, fmt.Errorf("解析确定预算分红激励:%w", err)
  37 + }
  38 + var data DataDividendsEstimateIncentive
  39 + err = gateway.GetResponseData(result, &data)
  40 + return &data, err
  41 +}
  42 +
  43 +// DividendsEstimateAdd 创建分红预算
  44 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimateAdd(param ReqDividendsEstimateAdd) (*DataDividendsEstimateAdd, error) {
  45 + url := gateway.baseUrL + "/dividends-estimates"
  46 + method := "POST"
  47 + req := gateway.CreateRequest(url, method)
  48 + log.Logger.Debug("向基础模块请求数据:创建分红预算。", map[string]interface{}{
  49 + "api": method + ":" + url,
  50 + "param": param,
  51 + })
  52 + req, err := req.JSONBody(param)
  53 + if err != nil {
  54 + return nil, fmt.Errorf("请求创建分红预算失败:%w", err)
  55 + }
  56 +
  57 + byteResult, err := req.Bytes()
  58 + if err != nil {
  59 + return nil, fmt.Errorf("获取创建分红预算失败:%w", err)
  60 + }
  61 + log.Logger.Debug("获取基础模块请求数据:创建分红预算。", map[string]interface{}{
  62 + "result": string(byteResult),
  63 + })
  64 + var result service_gateway.GatewayResponse
  65 + err = json.Unmarshal(byteResult, &result)
  66 + if err != nil {
  67 + return nil, fmt.Errorf("解析创建分红预算:%w", err)
  68 + }
  69 + var data DataDividendsEstimateAdd
  70 + err = gateway.GetResponseData(result, &data)
  71 + return &data, err
  72 +}
  73 +
  74 +// DividendsEstimateUpdate 更新分红预算
  75 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimateUpdate(param ReqDividendsEstimateUpdate) (*DataDividendsEstimateUpdate, error) {
  76 + url := gateway.baseUrL + "/dividends-estimates/{dividendsEstimateId}"
  77 + method := "PUT"
  78 + req := gateway.CreateRequest(url, method)
  79 + log.Logger.Debug("向基础模块请求数据:更新分红预算。", map[string]interface{}{
  80 + "api": method + ":" + url,
  81 + "param": param,
  82 + })
  83 + req, err := req.JSONBody(param)
  84 + if err != nil {
  85 + return nil, fmt.Errorf("请求更新分红预算失败:%w", err)
  86 + }
  87 +
  88 + byteResult, err := req.Bytes()
  89 + if err != nil {
  90 + return nil, fmt.Errorf("获取更新分红预算失败:%w", err)
  91 + }
  92 + log.Logger.Debug("获取基础模块请求数据:更新分红预算。", map[string]interface{}{
  93 + "result": string(byteResult),
  94 + })
  95 + var result service_gateway.GatewayResponse
  96 + err = json.Unmarshal(byteResult, &result)
  97 + if err != nil {
  98 + return nil, fmt.Errorf("解析更新分红预算:%w", err)
  99 + }
  100 + var data DataDividendsEstimateUpdate
  101 + err = gateway.GetResponseData(result, &data)
  102 + return &data, err
  103 +}
  104 +
  105 +// Dividends-estimatesSearch-dividends-incentives 查询业绩分红
  106 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimateSearchDividends(param ReqDividendsEstimateSearchDividend) (*DataDividendsEstimateSearchDividend,error) {
  107 + url := gateway.baseUrL + "/dividends-estimates/search-dividends-incentives"
  108 + method := "POST"
  109 + req := gateway.CreateRequest(url, method)
  110 + log.Logger.Debug("向基础模块请求数据:查询业绩分红。", map[string]interface{}{
  111 + "api": method + ":" + url,
  112 + "param": param,
  113 + })
  114 + req, err := req.JSONBody(param)
  115 + if err != nil {
  116 + return nil, fmt.Errorf("请求查询业绩分红失败:%w", err)
  117 + }
  118 +
  119 + byteResult, err := req.Bytes()
  120 + if err != nil {
  121 + return nil, fmt.Errorf("获取查询业绩分红失败:%w", err)
  122 + }
  123 + log.Logger.Debug("获取基础模块请求数据:查询业绩分红。", map[string]interface{}{
  124 + "result": string(byteResult),
  125 + })
  126 + var result service_gateway.GatewayResponse
  127 + err = json.Unmarshal(byteResult, &result)
  128 + if err != nil {
  129 + return nil, fmt.Errorf("解析查询业绩分红:%w", err)
  130 + }
  131 + var data DataDividendsEstimateSearchDividend
  132 + err = gateway.GetResponseData(result, &data)
  133 + return &data, err
  134 +}
  135 +
  136 +// DividendsEstimatesSearch查询分红预算单
  137 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesSearch(param ReqDividendsEstimatesSearch) (*DataDividendsEstimatesSearch, error) {
  138 + url := gateway.baseUrL + "/dividends-estimates/search"
  139 + method := "POST"
  140 + req := gateway.CreateRequest(url, method)
  141 + log.Logger.Debug("向基础模块请求数据:查询分红预算单。", map[string]interface{}{
  142 + "api": method + ":" + url,
  143 + "param": param,
  144 + })
  145 + req, err := req.JSONBody(param)
  146 + if err != nil {
  147 + return nil, fmt.Errorf("请求查询分红预算单失败:%w", err)
  148 + }
  149 +
  150 + byteResult, err := req.Bytes()
  151 + if err != nil {
  152 + return nil, fmt.Errorf("获取查询分红预算单失败:%w", err)
  153 + }
  154 + log.Logger.Debug("获取基础模块请求数据:查询分红预算单。", map[string]interface{}{
  155 + "result": string(byteResult),
  156 + })
  157 + var result service_gateway.GatewayResponse
  158 + err = json.Unmarshal(byteResult, &result)
  159 + if err != nil {
  160 + return nil, fmt.Errorf("解析查询分红预算单:%w", err)
  161 + }
  162 + var data DataDividendsEstimatesSearch
  163 + err = gateway.GetResponseData(result, &data)
  164 + return &data, err
  165 +}
  166 +
  167 +// DividendsEstimatesSearchMoney 查询金额激励分红
  168 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesSearchMoney(param ReqDividendsEstimateSearchMoney) (*DataDividendsEstimateSearchMoney, error) {
  169 + url := gateway.baseUrL + "/dividends-estimates/search-money-incentives"
  170 + method := "POST"
  171 + req := gateway.CreateRequest(url, method)
  172 + log.Logger.Debug("向基础模块请求数据:查询金额激励分红。", map[string]interface{}{
  173 + "api": method + ":" + url,
  174 + "param": param,
  175 + })
  176 + req, err := req.JSONBody(param)
  177 + if err != nil {
  178 + return nil, fmt.Errorf("请求查询金额激励分红失败:%w", err)
  179 + }
  180 +
  181 + byteResult, err := req.Bytes()
  182 + if err != nil {
  183 + return nil, fmt.Errorf("获取查询金额激励分红失败:%w", err)
  184 + }
  185 + log.Logger.Debug("获取基础模块请求数据:查询金额激励分红。", map[string]interface{}{
  186 + "result": string(byteResult),
  187 + })
  188 + var result service_gateway.GatewayResponse
  189 + err = json.Unmarshal(byteResult, &result)
  190 + if err != nil {
  191 + return nil, fmt.Errorf("解析查询金额激励分红:%w", err)
  192 + }
  193 + var data DataDividendsEstimateSearchMoney
  194 + err = gateway.GetResponseData(result, &data)
  195 + return &data, err
  196 +}
  197 +
  198 +// Dividends-estimates[dividendsEstimateId}Cancel 取消分红预算
  199 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesCancel(param ReqDividendsEstimateCancel) (*DataDividendsEstimatesCancel, error) {
  200 + url := gateway.baseUrL + "/dividends-estimates/"+strconv.ItoA(param.DividendsEstimateId)+"/cancel"
  201 + method := "POST"
  202 + req := gateway.CreateRequest(url, method)
  203 + log.Logger.Debug("向基础模块请求数据:取消分红预算。", map[string]interface{}{
  204 + "api": method + ":" + url,
  205 + "param": param,
  206 + })
  207 + req, err := req.JSONBody(param)
  208 + if err != nil {
  209 + return nil, fmt.Errorf("请求取消分红预算失败:%w", err)
  210 + }
  211 +
  212 + byteResult, err := req.Bytes()
  213 + if err != nil {
  214 + return nil, fmt.Errorf("获取取消分红预算失败:%w", err)
  215 + }
  216 + log.Logger.Debug("获取基础模块请求数据:取消分红预算。", map[string]interface{}{
  217 + "result": string(byteResult),
  218 + })
  219 + var result service_gateway.GatewayResponse
  220 + err = json.Unmarshal(byteResult, &result)
  221 + if err != nil {
  222 + return nil, fmt.Errorf("解析取消分红预算:%w", err)
  223 + }
  224 + var data DataDividendsEstimatesCancel
  225 + err = gateway.GetResponseData(result, &data)
  226 + return &data, err
  227 +}
  228 +
  229 +// Dividends-estimatesEstimate-money-incentives 确定预算金额激励分红
  230 +func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesEstimateMoneys(param ReqDividendsEestimatesEstimateMoney) (*DataDividendsEstimatesEstimateMoney, error) {
  231 + url := gateway.baseUrL + "/dividends-estimates/estimate-money-incentives"
  232 + method := "POST"
  233 + req := gateway.CreateRequest(url, method)
  234 + log.Logger.Debug("向基础模块请求数据:确定预算金额激励分红。", map[string]interface{}{
  235 + "api": method + ":" + url,
  236 + "param": param,
  237 + })
  238 + req, err := req.JSONBody(param)
  239 + if err != nil {
  240 + return nil, fmt.Errorf("请求确定预算金额激励分红失败:%w", err)
  241 + }
  242 +
  243 + byteResult, err := req.Bytes()
  244 + if err != nil {
  245 + return nil, fmt.Errorf("获取确定预算金额激励分红失败:%w", err)
  246 + }
  247 + log.Logger.Debug("获取基础模块请求数据:确定预算金额激励分红。", map[string]interface{}{
  248 + "result": string(byteResult),
  249 + })
  250 + var result service_gateway.GatewayResponse
  251 + err = json.Unmarshal(byteResult, &result)
  252 + if err != nil {
  253 + return nil, fmt.Errorf("解析确定预算金额激励分红:%w", err)
  254 + }
  255 + var data DataDividendsEstimatesEstimateMoney
  256 + err = gateway.GetResponseData(result, &data)
  257 + return &data, err
  258 +}
  259 +
  260 +// Dividends-estimates[dividendsEstimateId} 移除分红预算
  261 +func (gateway HttplibAlliedCreationCooperation) DividendAestimatesdivDidendsEstimat(param ReqDividendsEstimateRemove) (
  262 + *DataDividendsEstimateRemove, error) {
  263 + url := gateway.baseUrL + "/dividends-estimates/"+strconv.Itoa(param.DividendsEstimateId)
  264 + method := "DELETE"
  265 + req := gateway.CreateRequest(url, method)
  266 + log.Logger.Debug("向基础模块请求数据:移除分红预算。", map[string]interface{}{
  267 + "api": method + ":" + url,
  268 + "param": param,
  269 + })
  270 + req, err := req.JSONBody(param)
  271 + if err != nil {
  272 + return nil, fmt.Errorf("请求移除分红预算失败:%w", err)
  273 + }
  274 +
  275 + byteResult, err := req.Bytes()
  276 + if err != nil {
  277 + return nil, fmt.Errorf("获取移除分红预算失败:%w", err)
  278 + }
  279 + log.Logger.Debug("获取基础模块请求数据:移除分红预算。", map[string]interface{}{
  280 + "result": string(byteResult),
  281 + })
  282 + var result service_gateway.GatewayResponse
  283 + err = json.Unmarshal(byteResult, &result)
  284 + if err != nil {
  285 + return nil, fmt.Errorf("解析移除分红预算:%w", err)
  286 + }
  287 + var data DataDividendsEstimateRemove
  288 + err = gateway.GetResponseData(result, &data)
  289 + return &data, err
  290 +}
  291 +
  292 +// Dividends-estimatesList-dividends-incentives 返回业绩激励分红详情
  293 +func (gateway HttplibAlliedCreationCooperation) Dividends-estimatesList-dividends-incentives(param ReqDividends-estimatesList-dividends-incentives) (*DataDividends-estimatesList-dividends-incentives, error) {
  294 + url := gateway.baseUrL + "/dividends-estimates/list-dividends-incentives"
  295 + method := "GET"
  296 + req := gateway.CreateRequest(url, method)
  297 + log.Logger.Debug("向基础模块请求数据:返回业绩激励分红详情。", map[string]interface{}{
  298 + "api": method + ":" + url,
  299 + "param": param,
  300 + })
  301 + req, err := req.JSONBody(param)
  302 + if err != nil {
  303 + return nil, fmt.Errorf("请求返回业绩激励分红详情失败:%w", err)
  304 + }
  305 +
  306 + byteResult, err := req.Bytes()
  307 + if err != nil {
  308 + return nil, fmt.Errorf("获取返回业绩激励分红详情失败:%w", err)
  309 + }
  310 + log.Logger.Debug("获取基础模块请求数据:返回业绩激励分红详情。", map[string]interface{}{
  311 + "result": string(byteResult),
  312 + })
  313 + var result service_gateway.GatewayResponse
  314 + err = json.Unmarshal(byteResult, &result)
  315 + if err != nil {
  316 + return nil, fmt.Errorf("解析返回业绩激励分红详情:%w", err)
  317 + }
  318 + var data DataDividends-estimatesList-dividends-incentives
  319 + err = gateway.GetResponseData(result, &data)
  320 + return &data, err
  321 +}
  322 +
  323 +// Dividends-estimates 返回分红预算列表
  324 +func (gateway HttplibAlliedCreationCooperation) Dividends-estimates(param ReqDividends-estimates) (*DataDividends-estimates, error) {
  325 + url := gateway.baseUrL + "/dividends-estimates"
  326 + method := "GET"
  327 + req := gateway.CreateRequest(url, method)
  328 + log.Logger.Debug("向基础模块请求数据:返回分红预算列表。", map[string]interface{}{
  329 + "api": method + ":" + url,
  330 + "param": param,
  331 + })
  332 + req, err := req.JSONBody(param)
  333 + if err != nil {
  334 + return nil, fmt.Errorf("请求返回分红预算列表失败:%w", err)
  335 + }
  336 +
  337 + byteResult, err := req.Bytes()
  338 + if err != nil {
  339 + return nil, fmt.Errorf("获取返回分红预算列表失败:%w", err)
  340 + }
  341 + log.Logger.Debug("获取基础模块请求数据:返回分红预算列表。", map[string]interface{}{
  342 + "result": string(byteResult),
  343 + })
  344 + var result service_gateway.GatewayResponse
  345 + err = json.Unmarshal(byteResult, &result)
  346 + if err != nil {
  347 + return nil, fmt.Errorf("解析返回分红预算列表:%w", err)
  348 + }
  349 + var data DataDividends-estimates
  350 + err = gateway.GetResponseData(result, &data)
  351 + return &data, err
  352 +}
  353 +
  354 +// Dividends-estimates[dividendsEstimateId} 返回分红预算详情
  355 +func (gateway HttplibAlliedCreationCooperation) Dividends-estimates[dividendsEstimateId}(param ReqDividends-estimates[dividendsEstimateId}) (*DataDividends-estimates[dividendsEstimateId}, error) {
  356 + url := gateway.baseUrL + "/dividends-estimates/{dividendsEstimateId}"
  357 + method := "GET"
  358 + req := gateway.CreateRequest(url, method)
  359 + log.Logger.Debug("向基础模块请求数据:返回分红预算详情。", map[string]interface{}{
  360 + "api": method + ":" + url,
  361 + "param": param,
  362 + })
  363 + req, err := req.JSONBody(param)
  364 + if err != nil {
  365 + return nil, fmt.Errorf("请求返回分红预算详情失败:%w", err)
  366 + }
  367 +
  368 + byteResult, err := req.Bytes()
  369 + if err != nil {
  370 + return nil, fmt.Errorf("获取返回分红预算详情失败:%w", err)
  371 + }
  372 + log.Logger.Debug("获取基础模块请求数据:返回分红预算详情。", map[string]interface{}{
  373 + "result": string(byteResult),
  374 + })
  375 + var result service_gateway.GatewayResponse
  376 + err = json.Unmarshal(byteResult, &result)
  377 + if err != nil {
  378 + return nil, fmt.Errorf("解析返回分红预算详情:%w", err)
  379 + }
  380 + var data DataDividends-estimates[dividendsEstimateId}
  381 + err = gateway.GetResponseData(result, &data)
  382 + return &data, err
  383 +}
  384 +
  385 +// Dividends-estimatesList-money-incentives 返回金额激励分红列表
  386 +func (gateway HttplibAlliedCreationCooperation) Dividends-estimatesList-money-incentives(param ReqDividends-estimatesList-money-incentives) (*DataDividends-estimatesList-money-incentives, error) {
  387 + url := gateway.baseUrL + "/dividends-estimates/list-money-incentives"
  388 + method := "GET"
  389 + req := gateway.CreateRequest(url, method)
  390 + log.Logger.Debug("向基础模块请求数据:返回金额激励分红列表。", map[string]interface{}{
  391 + "api": method + ":" + url,
  392 + "param": param,
  393 + })
  394 + req, err := req.JSONBody(param)
  395 + if err != nil {
  396 + return nil, fmt.Errorf("请求返回金额激励分红列表失败:%w", err)
  397 + }
  398 +
  399 + byteResult, err := req.Bytes()
  400 + if err != nil {
  401 + return nil, fmt.Errorf("获取返回金额激励分红列表失败:%w", err)
  402 + }
  403 + log.Logger.Debug("获取基础模块请求数据:返回金额激励分红列表。", map[string]interface{}{
  404 + "result": string(byteResult),
  405 + })
  406 + var result service_gateway.GatewayResponse
  407 + err = json.Unmarshal(byteResult, &result)
  408 + if err != nil {
  409 + return nil, fmt.Errorf("解析返回金额激励分红列表:%w", err)
  410 + }
  411 + var data DataDividends-estimatesList-money-incentives
  412 + err = gateway.GetResponseData(result, &data)
  413 + return &data, err
  414 +}
  415 +
  1 +package allied_creation_cooperation
  2 +
  3 +//更新共创申请
  4 +type (
  5 + ReqCooperationApplicationUpdate struct {
  6 + ApplicationId int
  7 + }
  8 +
  9 + DataCooperationApplicationUpdate struct {
  10 + }
  11 +)
  12 +
  13 +//共创申请一键审核
  14 +type (
  15 + ReqCooperationApplicationBatchApproval struct {
  16 + }
  17 +
  18 + DataCooperationApplicationBatchApproval struct {
  19 + }
  20 +)
  21 +
  22 +//取消共创申请
  23 +type (
  24 + ReqCooperationApplicationCancel struct {
  25 + ApplicationId int
  26 + }
  27 +
  28 + DataCooperationApplicationCancel struct {
  29 + }
  30 +)
  31 +
  32 +//审核-同意共创申请
  33 +type (
  34 + ReqCooperationApplicationAgree struct {
  35 + ApplicationId int
  36 + }
  37 +
  38 + DataCooperationApplicationAgree struct {
  39 + }
  40 +)
  41 +
  42 +//审核-拒绝共创申请
  43 +type (
  44 + ReqCooperationApplicationReject struct {
  45 + ApplicationId int
  46 + }
  47 +
  48 + DataCooperationApplicationReject struct {
  49 + }
  50 +)
  51 +
  52 +//创建共创申请
  53 +type (
  54 + ReqCooperationApplicationAdd struct {
  55 + }
  56 +
  57 + DataCooperationApplicationAdd struct {
  58 + }
  59 +)
  60 +
  61 +//查询共创申请
  62 +type (
  63 + ReqCooperationApplicationSearch struct {
  64 + }
  65 +
  66 + DataCooperationApplicationSearch struct {
  67 + }
  68 +)
  69 +
  70 +//申请共创
  71 +type (
  72 + ReqCooperationApplicationApply struct {
  73 + }
  74 +
  75 + DataCooperationApplicationApply struct {
  76 + }
  77 +)
  78 +
  79 +//移除共创申请
  80 +type (
  81 + ReqCooperationApplicationRemove struct {
  82 + ApplicationId int
  83 + }
  84 +
  85 + DataCooperationApplicationRemove struct {
  86 + }
  87 +)
  88 +
  89 +//返回共创申请列表
  90 +type (
  91 + ReqCooperationApplicationList struct {
  92 + }
  93 +
  94 + DataCooperationApplicationList struct {
  95 + }
  96 +)
  97 +
  98 +//返回共创申请详情
  99 +type (
  100 + ReqCooperationApplicationGet struct {
  101 + ApplicationId int
  102 + }
  103 +
  104 + DataCooperationApplicationGet struct {
  105 + }
  106 +)
  1 +package allied_creation_cooperation
  2 +
  3 +//创建共创合约
  4 +type (
  5 + ReqCooperationContractAdd struct {
  6 + }
  7 +
  8 + DataCooperationContractAdd struct {
  9 + }
  10 +)
  11 +
  12 +//更新共创合约
  13 +type (
  14 + ReqCooperationContractUpdate struct {
  15 + CooperationContractId int
  16 + }
  17 +
  18 + DataCooperationContractUpdate struct {
  19 + }
  20 +)
  21 +
  22 +//查询共创合约
  23 +type (
  24 + ReqCooperationContractSearch struct {
  25 + }
  26 +
  27 + DataCooperationContractSearch struct {
  28 + }
  29 +)
  30 +
  31 +//根据承接人查询并返回共创项目合约
  32 +type (
  33 + ReqCooperationContractSearchByUndertaker struct {
  34 + }
  35 +
  36 + DataCooperationContractSearchByUndertaker struct {
  37 + }
  38 +)
  39 +
  40 +//移除共创合约
  41 +type (
  42 + ReqCooperationContractRemove struct {
  43 + CooperationContractId int
  44 + }
  45 +
  46 + DataCooperationContractRemove struct {
  47 + }
  48 +)
  49 +
  50 +//返回共创合约列表
  51 +type (
  52 + ReqCooperationContractList struct {
  53 + }
  54 +
  55 + DataCooperationContractList struct {
  56 + }
  57 +)
  58 +
  59 +//返回共创合约详情
  60 +type (
  61 + ReqCooperationContractGet struct {
  62 + CooperationContractId int
  63 + }
  64 +
  65 + DataCooperationContractGet struct {
  66 + }
  67 +)
  1 +package allied_creation_cooperation
  2 +
  3 +//创建共创模式
  4 +type (
  5 + ReqCooperationModeAdd struct {
  6 + }
  7 +
  8 + DataCooperationModeAdd struct {
  9 + }
  10 +)
  11 +
  12 +//返回共创模式列表
  13 +type (
  14 + ReqCooperationModeList struct {
  15 + }
  16 +
  17 + DataCooperationModeList struct {
  18 + }
  19 +)
  20 +
  21 +//返回共创模式详情
  22 +type (
  23 + ReqCooperationModeGet struct {
  24 + ModeId int `json:"modeId"`
  25 + }
  26 +
  27 + DataCooperationModeGet struct {
  28 + }
  29 +)
  30 +
  31 +//更新共创模式
  32 +type (
  33 + ReqCooperationModeUpdate struct {
  34 + ModeId int `json:"modeId"`
  35 + }
  36 +
  37 + DataCooperationModeUpdate struct {
  38 + }
  39 +)
  40 +
  41 +//移除共创模式
  42 +type (
  43 + ReqCooperationModeRemove struct {
  44 + ModeId int `json:"modeId"`
  45 + }
  46 +
  47 + DataCooperationModeRemove struct {
  48 + }
  49 +)
  50 +
  51 +//查询共创模式
  52 +type (
  53 + ReqCooperationModesSearch struct {
  54 + }
  55 +
  56 + DataCooperationModesSearch struct {
  57 + }
  58 +)
  1 +package allied_creation_cooperation
  2 +
  3 +//创建共创项目
  4 +type (
  5 + ReqCooperationProjectAdd struct {
  6 + }
  7 +
  8 + DataCooperationProjectAdd struct {
  9 + }
  10 +)
  11 +
  12 +//返回共创项目列表
  13 +type (
  14 + ReqCooperationProjectList struct {
  15 + }
  16 +
  17 + DataCooperationProjectList struct {
  18 + }
  19 +)
  20 +
  21 +//返回共创项目详情
  22 +type (
  23 + ReqCooperationProjectGet struct {
  24 + ProjectId int
  25 + }
  26 +
  27 + DataCooperationProjectGet struct {
  28 + }
  29 +)
  30 +
  31 +//更新共创项目
  32 +type (
  33 + ReqCooperationProjectUpdate struct {
  34 + ProjectId int
  35 + }
  36 +
  37 + DataCooperationProjectUpdate struct {
  38 + }
  39 +)
  40 +
  41 +//移除共创项目
  42 +type (
  43 + ReqCooperationProjectRemove struct {
  44 + ProjectId int
  45 + }
  46 +
  47 + DataCooperationProjectRemove struct {
  48 + }
  49 +)
  50 +
  51 +//发布共创项目
  52 +type (
  53 + ReqCooperationProjectsRelease struct {
  54 + }
  55 +
  56 + DataCooperationProjectsRelease struct {
  57 + }
  58 +)
  59 +
  60 +//查询共创项目
  61 +type (
  62 + ReqCooperationProjectSearch struct {
  63 + }
  64 +
  65 + DataCooperationProjectSearch struct {
  66 + }
  67 +)
  68 +
  69 +//判断当前勾选的承接对象是否存在用户
  70 +type (
  71 + ReqCooperationProjectsCheck struct {
  72 + }
  73 +
  74 + DataCooperationProjectsCheck struct {
  75 + }
  76 +)
  1 +package allied_creation_cooperation
  2 +
  3 +//确定预算分红激励
  4 +type (
  5 + ReqDividendsEstimateIncentive struct {
  6 + }
  7 +
  8 + DataDividendsEstimateIncentive struct {
  9 + }
  10 +)
  11 +
  12 +//创建分红预算
  13 +type (
  14 + ReqDividendsEstimateAdd struct {
  15 + }
  16 +
  17 + DataDividendsEstimateAdd struct {
  18 + }
  19 +)
  20 +
  21 +//更新分红预算
  22 +type (
  23 + ReqDividendsEstimateUpdate struct {
  24 + }
  25 +
  26 + DataDividendsEstimateUpdate struct {
  27 + }
  28 +)
  29 +
  30 +//查询业绩分红
  31 +type (
  32 + ReqDividendsEstimateSearchDividend struct {
  33 + }
  34 +
  35 + DataDividendsEstimateSearchDividend struct {
  36 + }
  37 +)
  38 +
  39 +//查询分红预算单
  40 +type (
  41 + ReqDividendsEstimateSearch struct {
  42 + }
  43 +
  44 + DataDividendsEstimateSearch struct {
  45 + }
  46 +)
  47 +
  48 +//查询金额激励分红
  49 +type (
  50 + ReqDividendsEstimateSearchMoney struct {
  51 + }
  52 +
  53 + DataDividendsEstimateSearchMoney struct {
  54 + }
  55 +)
  56 +
  57 +//取消分红预算
  58 +type (
  59 + ReqDividendsEstimateCancel struct {
  60 + DividendsEstimateId int
  61 + }
  62 +
  63 + DataDividendsEstimateCancel struct {
  64 + }
  65 +)
  66 +
  67 +//确定预算金额激励分红
  68 +type (
  69 + ReqDividendsEstimateMoneyIncentives struct {
  70 + }
  71 +
  72 + DataDividendsEstimateMoneyIncentives struct {
  73 + }
  74 +)
  75 +
  76 +//移除分红预算
  77 +type (
  78 + ReqDividendsEstimateRemove struct {
  79 + DividendsEstimateId int
  80 + }
  81 +
  82 + DataDividendsEstimateRemove struct {
  83 + }
  84 +)
  85 +
  86 +//返回业绩激励分红详情
  87 +type (
  88 + ReqDividendsEstimateListDividend struct {
  89 + }
  90 +
  91 + DataDividendsEstimateListDividend struct {
  92 + }
  93 +)
  94 +
  95 +//返回分红预算列表
  96 +type (
  97 + ReqDividendsEstimateList struct {
  98 + }
  99 +
  100 + DataDividendsEstimateList struct {
  101 + }
  102 +)
  103 +
  104 +//返回分红预算详情
  105 +type (
  106 + ReqDividendsEstimateGet struct {
  107 + }
  108 +
  109 + DataDividendsEstimateGet struct {
  110 + }
  111 +)
  112 +
  113 +//返回金额激励分红列表
  114 +type (
  115 + ReqDividendsEstimatesListMoney struct {
  116 + }
  117 +
  118 + DataDividendsEstimatesListMoney struct {
  119 + }
  120 +)
  1 +package allied_creation_cooperation
  2 +
  3 +//创建分红订单
  4 +type (
  5 + ReqDividendsOrderAdd struct {
  6 + }
  7 +
  8 + DataDividendsOrderAdd struct {
  9 + DividendsOrderId int
  10 + }
  11 +)
  12 +
  13 +//更新分红订单
  14 +type (
  15 + ReqDividendsOrderUpdate struct {
  16 + DividendsOrderId int
  17 + }
  18 +
  19 + DataDividendsOrderUpdate struct {
  20 + }
  21 +)
  22 +
  23 +//查询分红订单
  24 +type (
  25 + ReqDividendsOrderSearch struct {
  26 + }
  27 +
  28 + DataDividendsOrderSearch struct {
  29 + }
  30 +)
  31 +
  32 +//模糊查询分红订单号
  33 +type (
  34 + ReqSearchOrderNumber struct {
  35 + }
  36 +
  37 + DataSearchOrderNumber struct {
  38 + }
  39 +)
  40 +
  41 +//移除分红订单
  42 +type (
  43 + ReqDividendsOrderRemove struct {
  44 + DividendsOrderId int
  45 + }
  46 +
  47 + DataDividendsOrderRemove struct {
  48 + }
  49 +)
  50 +
  51 +//返回分红订单列表
  52 +type (
  53 + ReqDividendsOrderList struct {
  54 + }
  55 +
  56 + DataDividendsOrderList struct {
  57 + }
  58 +)
  59 +
  60 +//返回分红订单详情
  61 +type (
  62 + ReqDividendsOrderGet struct {
  63 + DividendsOrderId int
  64 + }
  65 +
  66 + DataDividendsOrderGet struct {
  67 + }
  68 +)
@@ -32,15 +32,15 @@ type BaseServiceGateway struct { @@ -32,15 +32,15 @@ type BaseServiceGateway struct {
32 func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest { 32 func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest {
33 var request *httplib.BeegoHTTPRequest 33 var request *httplib.BeegoHTTPRequest
34 switch method { 34 switch method {
35 - case "get": 35 + case "get", "GET":
36 request = httplib.Get(url) 36 request = httplib.Get(url)
37 - case "post": 37 + case "post", "POST":
38 request = httplib.Post(url) 38 request = httplib.Post(url)
39 - case "put": 39 + case "put", "PUT":
40 request = httplib.Put(url) 40 request = httplib.Put(url)
41 - case "delete": 41 + case "delete", "DELETE":
42 request = httplib.Delete(url) 42 request = httplib.Delete(url)
43 - case "head": 43 + case "head", "HEADER":
44 request = httplib.Head(url) 44 request = httplib.Head(url)
45 default: 45 default:
46 request = httplib.Get(url) 46 request = httplib.Get(url)