|
|
1
|
+package service_gateway
|
|
|
2
|
+
|
|
|
3
|
+import (
|
|
|
4
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/constant"
|
|
|
5
|
+ "strings"
|
|
|
6
|
+ "time"
|
|
|
7
|
+)
|
|
|
8
|
+
|
|
|
9
|
+type HttplibBasicServiceGateway struct {
|
|
|
10
|
+ httplibBaseServiceGateway
|
|
|
11
|
+}
|
|
|
12
|
+
|
|
|
13
|
+// AgreeCooperationApplication 同意共创申请
|
|
|
14
|
+func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() (map[string]interface{}, error) {
|
|
|
15
|
+ url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/agree-join-creation-project"}, "/")
|
|
|
16
|
+ request := serviceGateway.createRequest(url, "post")
|
|
|
17
|
+ request.Header("companyId", "")
|
|
|
18
|
+ request.Header("userId", "")
|
|
|
19
|
+ request.Header("orgId", "")
|
|
|
20
|
+ request.Header("userBasic", "")
|
|
|
21
|
+ options := map[string]interface{}{}
|
|
|
22
|
+ _, err := request.JSONBody(options)
|
|
|
23
|
+ if err != nil {
|
|
|
24
|
+ return nil, err
|
|
|
25
|
+ }
|
|
|
26
|
+ response := make(map[string]interface{})
|
|
|
27
|
+ err2 := request.ToJSON(&response)
|
|
|
28
|
+ if err2 != nil {
|
|
|
29
|
+ return nil, err2
|
|
|
30
|
+ }
|
|
|
31
|
+ data, err := serviceGateway.responseHandle(response)
|
|
|
32
|
+ return data, err
|
|
|
33
|
+}
|
|
|
34
|
+
|
|
|
35
|
+// RejectCooperationApplication 拒绝共创申请
|
|
|
36
|
+func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() (map[string]interface{}, error) {
|
|
|
37
|
+ url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/refuse-join-creation-project"}, "/")
|
|
|
38
|
+ request := serviceGateway.createRequest(url, "post")
|
|
|
39
|
+ request.Header("companyId", "")
|
|
|
40
|
+ request.Header("userId", "")
|
|
|
41
|
+ request.Header("orgId", "")
|
|
|
42
|
+ request.Header("userBasic", "")
|
|
|
43
|
+ options := make(map[string]interface{})
|
|
|
44
|
+ _, err2 := request.JSONBody(options)
|
|
|
45
|
+ if err2 != nil {
|
|
|
46
|
+ return nil, err2
|
|
|
47
|
+ }
|
|
|
48
|
+ response := make(map[string]interface{})
|
|
|
49
|
+ err := request.ToJSON(&response)
|
|
|
50
|
+ if err != nil {
|
|
|
51
|
+ return nil, err
|
|
|
52
|
+ }
|
|
|
53
|
+ data, err := serviceGateway.responseHandle(response)
|
|
|
54
|
+ return data, err
|
|
|
55
|
+}
|
|
|
56
|
+
|
|
|
57
|
+// InformExpectedDividends 分红预算消息
|
|
|
58
|
+func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map[string]interface{}, error) {
|
|
|
59
|
+ url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/")
|
|
|
60
|
+ request := serviceGateway.createRequest(url, "post")
|
|
|
61
|
+ request.Header("companyId", "")
|
|
|
62
|
+ request.Header("userId", "")
|
|
|
63
|
+ request.Header("orgId", "")
|
|
|
64
|
+ request.Header("userBasic", "")
|
|
|
65
|
+ options := make(map[string]interface{})
|
|
|
66
|
+ _, err2 := request.JSONBody(options)
|
|
|
67
|
+ if err2 != nil {
|
|
|
68
|
+ return nil, err2
|
|
|
69
|
+ }
|
|
|
70
|
+ response := make(map[string]interface{})
|
|
|
71
|
+ err := request.ToJSON(&response)
|
|
|
72
|
+ if err != nil {
|
|
|
73
|
+ return nil, err
|
|
|
74
|
+ }
|
|
|
75
|
+ data, err := serviceGateway.responseHandle(response)
|
|
|
76
|
+ return data, err
|
|
|
77
|
+}
|
|
|
78
|
+
|
|
|
79
|
+// InformJoinCreationContract 确认共创
|
|
|
80
|
+func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() (map[string]interface{}, error) {
|
|
|
81
|
+ url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/")
|
|
|
82
|
+ request := serviceGateway.createRequest(url, "post")
|
|
|
83
|
+ options := make(map[string]interface{})
|
|
|
84
|
+ _, err2 := request.JSONBody(options)
|
|
|
85
|
+ if err2 != nil {
|
|
|
86
|
+ return nil, err2
|
|
|
87
|
+ }
|
|
|
88
|
+ response := make(map[string]interface{})
|
|
|
89
|
+ err := request.ToJSON(&response)
|
|
|
90
|
+ if err != nil {
|
|
|
91
|
+ return nil, err
|
|
|
92
|
+ }
|
|
|
93
|
+ data, err := serviceGateway.responseHandle(response)
|
|
|
94
|
+ return data, err
|
|
|
95
|
+}
|
|
|
96
|
+
|
|
|
97
|
+// PayCreditAccount 账期支付
|
|
|
98
|
+func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string]interface{}, error) {
|
|
|
99
|
+ url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/")
|
|
|
100
|
+ request := serviceGateway.createRequest(url, "post")
|
|
|
101
|
+ request.Header("companyId", "")
|
|
|
102
|
+ request.Header("userId", "")
|
|
|
103
|
+ request.Header("orgId", "")
|
|
|
104
|
+ request.Header("userBasic", "")
|
|
|
105
|
+ options := make(map[string]interface{})
|
|
|
106
|
+ _, err2 := request.JSONBody(options)
|
|
|
107
|
+ if err2 != nil {
|
|
|
108
|
+ return nil, err2
|
|
|
109
|
+ }
|
|
|
110
|
+ response := make(map[string]interface{})
|
|
|
111
|
+ err := request.ToJSON(&response)
|
|
|
112
|
+ if err != nil {
|
|
|
113
|
+ return nil, err
|
|
|
114
|
+ }
|
|
|
115
|
+ data, err := serviceGateway.responseHandle(response)
|
|
|
116
|
+ return data, err
|
|
|
117
|
+}
|
|
|
118
|
+
|
|
|
119
|
+// DividendsEstimate 分红预算
|
|
|
120
|
+func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate() (map[string]interface{}, error) {
|
|
|
121
|
+ url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/")
|
|
|
122
|
+ request := serviceGateway.createRequest(url, "post")
|
|
|
123
|
+ request.Header("companyId", "")
|
|
|
124
|
+ request.Header("userId", "")
|
|
|
125
|
+ request.Header("orgId", "")
|
|
|
126
|
+ request.Header("userBasic", "")
|
|
|
127
|
+ options := make(map[string]interface{})
|
|
|
128
|
+ _, err2 := request.JSONBody(options)
|
|
|
129
|
+ if err2 != nil {
|
|
|
130
|
+ return nil, err2
|
|
|
131
|
+ }
|
|
|
132
|
+ response := make(map[string]interface{})
|
|
|
133
|
+ err := request.ToJSON(&response)
|
|
|
134
|
+ if err != nil {
|
|
|
135
|
+ return nil, err
|
|
|
136
|
+ }
|
|
|
137
|
+ data, err := serviceGateway.responseHandle(response)
|
|
|
138
|
+ return data, err
|
|
|
139
|
+}
|
|
|
140
|
+
|
|
|
141
|
+func NewHttplibMessageServiceGateway() *HttplibBasicServiceGateway {
|
|
|
142
|
+ return &HttplibBasicServiceGateway{
|
|
|
143
|
+ httplibBaseServiceGateway: httplibBaseServiceGateway{
|
|
|
144
|
+ baseURL: constant.BASIC_MODULE_HOST,
|
|
|
145
|
+ connectTimeout: 100 * time.Second,
|
|
|
146
|
+ readWriteTimeout: 30 * time.Second,
|
|
|
147
|
+ },
|
|
|
148
|
+ }
|
|
|
149
|
+} |