1
|
package cost_structured
|
1
|
package cost_structured
|
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
|
|
4
|
+ "encoding/json"
|
4
|
"fmt"
|
5
|
"fmt"
|
|
|
6
|
+ "strings"
|
5
|
"time"
|
7
|
"time"
|
6
|
|
8
|
|
7
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
|
9
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
|
|
@@ -36,12 +38,30 @@ func (gateway HttpLibCostStructured) BaseUrl() string { |
|
@@ -36,12 +38,30 @@ func (gateway HttpLibCostStructured) BaseUrl() string { |
36
|
}
|
38
|
}
|
37
|
|
39
|
|
38
|
//批量添加成本管理
|
40
|
//批量添加成本管理
|
39
|
-func (gateway HttpLibCostStructured) BatchCreateCostManagemant(param BatchAddCostManagemantRequest) (*BatchAddCostManagemantResponse, error) {
|
41
|
+func (gateway HttpLibCostStructured) BatchCreateCostManagemant(param BatchAddCostManagemantRequest) (*service_gateway.GatewayResponse, error) {
|
40
|
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/cost-managemants/batch-create-cost-managemants")
|
42
|
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/cost-managemants/batch-create-cost-managemants")
|
41
|
method := "post"
|
43
|
method := "post"
|
42
|
- var data BatchAddCostManagemantResponse
|
|
|
43
|
- err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
44
|
- return &data, err
|
44
|
+ //var data BatchAddCostManagemantResponse
|
|
|
45
|
+ //err := gateway.FastDoRequest(url, method, param, &data)
|
|
|
46
|
+
|
|
|
47
|
+ r := gateway.CreateRequest(url, method)
|
|
|
48
|
+ if len(gateway.InOrgIds) > 0 {
|
|
|
49
|
+ r.Header("orgIds", strings.Join(service_gateway.ToArrayString(gateway.InOrgIds), ","))
|
|
|
50
|
+ }
|
|
|
51
|
+ req, err := r.JSONBody(param)
|
|
|
52
|
+ if err != nil {
|
|
|
53
|
+ return nil,err
|
|
|
54
|
+ }
|
|
|
55
|
+ byteResult, err:= req.Bytes()
|
|
|
56
|
+ if err != nil {
|
|
|
57
|
+ return nil,err
|
|
|
58
|
+ }
|
|
|
59
|
+ var result service_gateway.GatewayResponse
|
|
|
60
|
+ err = json.Unmarshal(byteResult, &result)
|
|
|
61
|
+ if err != nil {
|
|
|
62
|
+ return nil,err
|
|
|
63
|
+ }
|
|
|
64
|
+ return &result, nil
|
45
|
}
|
65
|
}
|
46
|
type BatchAddCostManagemantRequest struct {
|
66
|
type BatchAddCostManagemantRequest struct {
|
47
|
*domain.BatchCreateCostManagemant
|
67
|
*domain.BatchCreateCostManagemant
|