正在显示
9 个修改的文件
包含
51 行增加
和
64 行删除
@@ -8,53 +8,20 @@ import ( | @@ -8,53 +8,20 @@ import ( | ||
8 | ) | 8 | ) |
9 | 9 | ||
10 | type CooperationApplicationItem struct { | 10 | type CooperationApplicationItem struct { |
11 | - CooperationProject struct { | ||
12 | - CooperationProjectID string `json:"cooperationProjectId"` //共创项目 | ||
13 | - CooperationProjectName string `json:"cooperationProjectName"` //共创名称 | ||
14 | - CooperationProjectNumber string `json:"cooperationProjectNumber"` //共创编号 | ||
15 | - } `json:"cooperationProject"` | ||
16 | - CooperationApplicationApplicant struct { | ||
17 | - UserId int | ||
18 | - UserInfo struct { | ||
19 | - UserAvatar string | ||
20 | - UserEmail string | ||
21 | - UserName string | ||
22 | - UserPhone string | ||
23 | - UserAccount string | ||
24 | - } | ||
25 | - } `json:"cooperationApplicationApplicant"` | ||
26 | - CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件 | ||
27 | - CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述 | ||
28 | - CooperationApplicationID string `json:"cooperationApplicationId"` //id | ||
29 | - IsCanceled bool `json:"isCanceled"` //是否取消 | ||
30 | - CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"` //审核描述 | ||
31 | - CooperationApplicationVerifyTime time.Time `json:"cooperationApplicationVerifyTime"` //审核时间 | ||
32 | - CooperationApplicationStatus int `json:"cooperationApplicationStatus"` // | ||
33 | - Org struct { | ||
34 | - OrgID string `json:"orgId"` | ||
35 | - OrgName string `json:"orgName"` | ||
36 | - } `json:"org"` //组织 | 11 | + allied_creation_cooperation.CooperationApplication |
12 | + AuthFlag bool `json:"authFlag"` | ||
37 | } | 13 | } |
38 | 14 | ||
39 | -func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem { | ||
40 | - //data := CooperationApplicationItem{ | ||
41 | - // CooperationApplicationAttachment: param.CooperationApplicationAttachment, | ||
42 | - // CooperationApplicationDescription: param.CooperationApplicationDescription, | ||
43 | - // CooperationApplicationID: param.CooperationApplicationID, | ||
44 | - // IsCanceled: param.IsCanceled, | ||
45 | - // CooperationApplicationVerifyDescription: param.CooperationApplicationVerifyDescription, | ||
46 | - // CooperationApplicationStatus: param.CooperationApplicationStatus, | ||
47 | - // Org: param.Org, | ||
48 | - //} | ||
49 | - //data.CooperationApplicationApplicant.UserName = param.CooperationApplicationApplicant.UserInfo.UserName | ||
50 | - //data.CooperationApplicationApplicant.Phone = param.CooperationApplicationApplicant.UserInfo.UserPhone | ||
51 | - //data.CooperationApplicationApplicant.UserCode = param.CooperationApplicationApplicant.UserInfo.UserPhone | ||
52 | - //data.CooperationApplicationApplicant.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName | ||
53 | - //data.CooperationProject.CooperationProjectID = param.CooperationProject.CooperationProjectID | ||
54 | - //data.CooperationProject.CooperationProjectName = param.CooperationProject.CooperationProjectName | ||
55 | - //data.CooperationProject.CooperationProjectNumber = param.CooperationProject.CooperationProjectNumber | ||
56 | - //return &data | ||
57 | - return nil | 15 | +func ToCooperationApplicationItem(param []allied_creation_cooperation.CooperationApplication, operatorOrgId int64) []CooperationApplicationItem { |
16 | + listData := []CooperationApplicationItem{} | ||
17 | + for i := range param { | ||
18 | + item := CooperationApplicationItem{ | ||
19 | + CooperationApplication: param[i], | ||
20 | + AuthFlag: param[i].Org.OrgID == int(operatorOrgId), | ||
21 | + } | ||
22 | + listData = append(listData, item) | ||
23 | + } | ||
24 | + return listData | ||
58 | } | 25 | } |
59 | 26 | ||
60 | type CooperationApplicationInfo struct { | 27 | type CooperationApplicationInfo struct { |
@@ -3,6 +3,7 @@ package service | @@ -3,6 +3,7 @@ package service | ||
3 | import ( | 3 | import ( |
4 | "github.com/linmadan/egglib-go/core/application" | 4 | "github.com/linmadan/egglib-go/core/application" |
5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/command" | 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/command" |
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/dto" | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query" |
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" |
8 | ) | 9 | ) |
@@ -73,15 +74,12 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat | @@ -73,15 +74,12 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat | ||
73 | if err != nil { | 74 | if err != nil { |
74 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 75 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
75 | } | 76 | } |
76 | - //var dataList []dto.CooperationApplicationItem | ||
77 | - //for i := range result.Grid.List { | ||
78 | - // item := dto.ToCooperationApplicationItem(&result.Grid.List[i]) | ||
79 | - // dataList = append(dataList, *item) | ||
80 | - //} | 77 | + |
81 | if len(result.Grid.List) == 0 { | 78 | if len(result.Grid.List) == 0 { |
82 | result.Grid.List = []allied_creation_cooperation.CooperationApplication{} | 79 | result.Grid.List = []allied_creation_cooperation.CooperationApplication{} |
83 | } | 80 | } |
84 | - return int64(result.Grid.Total), result.Grid.List, nil | 81 | + listData := dto.ToCooperationApplicationItem(result.Grid.List, listCooperationApplicationQuery.Operator.OrgId) |
82 | + return int64(result.Grid.Total), listData, nil | ||
85 | } | 83 | } |
86 | 84 | ||
87 | func NewCooperationApplicationService(options map[string]interface{}) *CooperationApplicationService { | 85 | func NewCooperationApplicationService(options map[string]interface{}) *CooperationApplicationService { |
@@ -22,9 +22,10 @@ type CooperationContractItem struct { | @@ -22,9 +22,10 @@ type CooperationContractItem struct { | ||
22 | Org domain.Org `json:"org"` //组织结构 | 22 | Org domain.Org `json:"org"` //组织结构 |
23 | CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开 | 23 | CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开 |
24 | CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述 | 24 | CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述 |
25 | + AuthFlag bool `json:"authFlag"` | ||
25 | } | 26 | } |
26 | 27 | ||
27 | -func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem { | 28 | +func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract, operatorOrgId int64) *CooperationContractItem { |
28 | cooperationContractUndertakerType := param.CooperationContractUndertakerTypes | 29 | cooperationContractUndertakerType := param.CooperationContractUndertakerTypes |
29 | if len(cooperationContractUndertakerType) == 0 { | 30 | if len(cooperationContractUndertakerType) == 0 { |
30 | cooperationContractUndertakerType = []int{} | 31 | cooperationContractUndertakerType = []int{} |
@@ -38,6 +39,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon | @@ -38,6 +39,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon | ||
38 | CooperationContractNumber: param.CooperationContractNumber, | 39 | CooperationContractNumber: param.CooperationContractNumber, |
39 | Status: param.Status, | 40 | Status: param.Status, |
40 | CreateTime: int(param.CreatedAt.UnixNano() / 1e6), | 41 | CreateTime: int(param.CreatedAt.UnixNano() / 1e6), |
42 | + AuthFlag: param.Org.OrgId == operatorOrgId, | ||
41 | } | 43 | } |
42 | data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId | 44 | data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId |
43 | data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName | 45 | data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName |
@@ -112,7 +114,7 @@ type CooperationContractInfo struct { | @@ -112,7 +114,7 @@ type CooperationContractInfo struct { | ||
112 | UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` // 可以去除勾选的共创项目承接对象列表 | 114 | UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` // 可以去除勾选的共创项目承接对象列表 |
113 | } | 115 | } |
114 | 116 | ||
115 | -func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract) *CooperationContractInfo { | 117 | +func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract, operatorOrgId int64) *CooperationContractInfo { |
116 | 118 | ||
117 | relevants := []Relevant{} | 119 | relevants := []Relevant{} |
118 | dividendsIncentivesRules := []DividendsIncentivesRule{} | 120 | dividendsIncentivesRules := []DividendsIncentivesRule{} |
@@ -202,7 +204,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | @@ -202,7 +204,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | ||
202 | undertakerTypesUncheckedAvailable = []int{} | 204 | undertakerTypesUncheckedAvailable = []int{} |
203 | } | 205 | } |
204 | data := CooperationContractInfo{ | 206 | data := CooperationContractInfo{ |
205 | - CooperationContract: *ToCooperationContractItem(param), | 207 | + CooperationContract: *ToCooperationContractItem(param, operatorOrgId), |
206 | Relevant: relevants, | 208 | Relevant: relevants, |
207 | DividendsIncentivesRules: dividendsIncentivesRules, | 209 | DividendsIncentivesRules: dividendsIncentivesRules, |
208 | MoneyIncentivesRules: moneyIncentivesRules, | 210 | MoneyIncentivesRules: moneyIncentivesRules, |
@@ -77,7 +77,8 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -77,7 +77,8 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
77 | if err != nil { | 77 | if err != nil { |
78 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 78 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
79 | } | 79 | } |
80 | - return dto.ToCooperationContractInfo(&result.CooperationContract), err | 80 | + return dto.ToCooperationContractInfo(&result.CooperationContract, createCooperationContractCommand.Operator.OrgId), err |
81 | + | ||
81 | } | 82 | } |
82 | 83 | ||
83 | // 暂停恢复共创合约 | 84 | // 暂停恢复共创合约 |
@@ -105,13 +106,12 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont | @@ -105,13 +106,12 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont | ||
105 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 106 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
106 | } | 107 | } |
107 | 108 | ||
108 | - return dto.ToCooperationContractInfo(&result.CooperationContract), nil | 109 | + return dto.ToCooperationContractInfo(&result.CooperationContract, getCooperationContractQuery.Operator.OrgId), nil |
109 | } | 110 | } |
110 | 111 | ||
111 | // 返回共创合约管理列表 | 112 | // 返回共创合约管理列表 |
112 | func (cooperationContractService *CooperationContractService) ListCooperationContract( | 113 | func (cooperationContractService *CooperationContractService) ListCooperationContract( |
113 | listCooperationContractQuery *query.ListCooperationContractQuery) (int, interface{}, error) { | 114 | listCooperationContractQuery *query.ListCooperationContractQuery) (int, interface{}, error) { |
114 | - | ||
115 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator) | 115 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator) |
116 | result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{ | 116 | result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{ |
117 | PageNumber: listCooperationContractQuery.PageNumber, | 117 | PageNumber: listCooperationContractQuery.PageNumber, |
@@ -124,7 +124,7 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon | @@ -124,7 +124,7 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon | ||
124 | } | 124 | } |
125 | data := []dto.CooperationContractItem{} | 125 | data := []dto.CooperationContractItem{} |
126 | for i := range result.Grid.List { | 126 | for i := range result.Grid.List { |
127 | - item := dto.ToCooperationContractItem(&result.Grid.List[i]) | 127 | + item := dto.ToCooperationContractItem(&result.Grid.List[i], listCooperationContractQuery.Operator.OrgId) |
128 | data = append(data, *item) | 128 | data = append(data, *item) |
129 | } | 129 | } |
130 | 130 | ||
@@ -194,7 +194,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -194,7 +194,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
194 | if err != nil { | 194 | if err != nil { |
195 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 195 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
196 | } | 196 | } |
197 | - return dto.ToCooperationContractInfo(&result.CooperationContract), nil | 197 | + return dto.ToCooperationContractInfo(&result.CooperationContract, updateCooperationContractCommand.Operator.OrgId), nil |
198 | } | 198 | } |
199 | 199 | ||
200 | func NewCooperationContractService(options map[string]interface{}) *CooperationContractService { | 200 | func NewCooperationContractService(options map[string]interface{}) *CooperationContractService { |
@@ -51,6 +51,7 @@ func (cooperationModeService *CooperationModeService) GetCooperationMode(getCoop | @@ -51,6 +51,7 @@ func (cooperationModeService *CooperationModeService) GetCooperationMode(getCoop | ||
51 | Status: result.Status, | 51 | Status: result.Status, |
52 | CooperationModeNumber: result.CooperationModeNumber, | 52 | CooperationModeNumber: result.CooperationModeNumber, |
53 | Org: result.Org, | 53 | Org: result.Org, |
54 | + AuthFlag: result.Org.OrgId == int(getCooperationModeQuery.Operator.OrgId), | ||
54 | } | 55 | } |
55 | return data, nil | 56 | return data, nil |
56 | } | 57 | } |
@@ -85,6 +86,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo | @@ -85,6 +86,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo | ||
85 | Status: v.Status, | 86 | Status: v.Status, |
86 | CooperationModeNumber: v.CooperationModeNumber, | 87 | CooperationModeNumber: v.CooperationModeNumber, |
87 | Org: v.Org, | 88 | Org: v.Org, |
89 | + AuthFlag: v.Org.OrgId == int(listCooperationModeQuery.Operator.OrgId), | ||
88 | } | 90 | } |
89 | listData = append(listData, item) | 91 | listData = append(listData, item) |
90 | } | 92 | } |
@@ -169,6 +171,7 @@ func (cooperationModeService *CooperationModeService) CooperationModeSelector(li | @@ -169,6 +171,7 @@ func (cooperationModeService *CooperationModeService) CooperationModeSelector(li | ||
169 | Status: v.Status, | 171 | Status: v.Status, |
170 | CooperationModeNumber: v.CooperationModeNumber, | 172 | CooperationModeNumber: v.CooperationModeNumber, |
171 | Org: v.Org, | 173 | Org: v.Org, |
174 | + AuthFlag: v.Org.OrgId == int(listCooperationModeQuery.Operator.OrgId), | ||
172 | } | 175 | } |
173 | listData = append(listData, item) | 176 | listData = append(listData, item) |
174 | } | 177 | } |
@@ -124,3 +124,22 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation | @@ -124,3 +124,22 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation | ||
124 | return &data | 124 | return &data |
125 | //return nil | 125 | //return nil |
126 | } | 126 | } |
127 | + | ||
128 | +type CooperationProjectSearchItem struct { | ||
129 | + allied_creation_cooperation.DataCooperationProjectSearchItem | ||
130 | + AuthFlag bool `json:"authFlag"` //当前用户是否可以编辑 | ||
131 | +} | ||
132 | + | ||
133 | +func ToCooperationProjectSearchItem(items []allied_creation_cooperation.DataCooperationProjectSearchItem, operatorOrgId int) []CooperationProjectSearchItem { | ||
134 | + listData := []CooperationProjectSearchItem{} | ||
135 | + operatorOrgIdStr := strconv.Itoa(operatorOrgId) | ||
136 | + for i := range items { | ||
137 | + listItem := CooperationProjectSearchItem{ | ||
138 | + DataCooperationProjectSearchItem: items[i], | ||
139 | + AuthFlag: operatorOrgIdStr == items[i].Org.OrgID, | ||
140 | + } | ||
141 | + listData = append(listData, listItem) | ||
142 | + } | ||
143 | + | ||
144 | + return listData | ||
145 | +} |
@@ -118,7 +118,8 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje | @@ -118,7 +118,8 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje | ||
118 | if len(result.List) == 0 { | 118 | if len(result.List) == 0 { |
119 | result.List = []allied_creation_cooperation.DataCooperationProjectSearchItem{} | 119 | result.List = []allied_creation_cooperation.DataCooperationProjectSearchItem{} |
120 | } | 120 | } |
121 | - return int64(result.Total), result.List, nil | 121 | + listData := dto.ToCooperationProjectSearchItem(result.List, int(listCooperationProjectQuery.Operator.OrgId)) |
122 | + return int64(result.Total), listData, nil | ||
122 | } | 123 | } |
123 | 124 | ||
124 | // 更新共创项目管理 | 125 | // 更新共创项目管理 |
@@ -182,10 +182,6 @@ type ( | @@ -182,10 +182,6 @@ type ( | ||
182 | UserPhone string `json:"userPhone"` | 182 | UserPhone string `json:"userPhone"` |
183 | UserAccount string `json:"userAccount"` | 183 | UserAccount string `json:"userAccount"` |
184 | } `json:"userInfo"` | 184 | } `json:"userInfo"` |
185 | - //UserType int `json:"userType"` | ||
186 | - //UserName string `json:"userName"` | ||
187 | - //UserPhone string `json:"userPhone"` | ||
188 | - //Status int `json:"status"` | ||
189 | } `json:"cooperationProjectPublisher"` | 185 | } `json:"cooperationProjectPublisher"` |
190 | CooperationProjectSponsor struct { | 186 | CooperationProjectSponsor struct { |
191 | UserID string `json:"userId"` | 187 | UserID string `json:"userId"` |
-
请 注册 或 登录 后发表评论