|
@@ -5,6 +5,7 @@ import ( |
|
@@ -5,6 +5,7 @@ import ( |
5
|
"github.com/linmadan/egglib-go/core/application"
|
5
|
"github.com/linmadan/egglib-go/core/application"
|
6
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
6
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
7
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/command"
|
7
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/command"
|
|
|
8
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/dto"
|
8
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/query"
|
9
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/query"
|
9
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
|
10
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
|
10
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
|
11
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
|
|
@@ -119,13 +120,15 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
@@ -119,13 +120,15 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
119
|
}
|
120
|
}
|
120
|
|
121
|
|
121
|
newCooperationProject := &domain.CooperationProject{
|
122
|
newCooperationProject := &domain.CooperationProject{
|
122
|
- CooperationProjectNumber: "",
|
123
|
+ CooperationProjectNumber: createCooperationProjectCommand.CooperationModeNumber,
|
123
|
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
|
124
|
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
|
124
|
CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes,
|
125
|
CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes,
|
125
|
CooperationProjectSponsor: sponsor,
|
126
|
CooperationProjectSponsor: sponsor,
|
126
|
CooperationProjectPublisher: publisher,
|
127
|
CooperationProjectPublisher: publisher,
|
127
|
CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription,
|
128
|
CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription,
|
|
|
129
|
+ CooperationProjectPublishTime: time.Now(),
|
128
|
Company: company,
|
130
|
Company: company,
|
|
|
131
|
+ Department: organization.ToDepartment(),
|
129
|
Org: organization,
|
132
|
Org: organization,
|
130
|
Operator: operator,
|
133
|
Operator: operator,
|
131
|
OperateTime: time.Now(),
|
134
|
OperateTime: time.Now(),
|
|
@@ -215,13 +218,40 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje |
|
@@ -215,13 +218,40 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje |
215
|
if count, cooperationProjects, err := cooperationProjectRepository.Find(tool_funs.SimpleStructToMap(listCooperationProjectQuery)); err != nil {
|
218
|
if count, cooperationProjects, err := cooperationProjectRepository.Find(tool_funs.SimpleStructToMap(listCooperationProjectQuery)); err != nil {
|
216
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
219
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
217
|
} else {
|
220
|
} else {
|
|
|
221
|
+
|
|
|
222
|
+ //var cooperationModeRepository domain.CooperationModeRepository
|
|
|
223
|
+ //if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
|
|
|
224
|
+ // "transactionContext": transactionContext,
|
|
|
225
|
+ //}); err != nil {
|
|
|
226
|
+ // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
227
|
+ //} else {
|
|
|
228
|
+ // cooperationProjectRepository = value
|
|
|
229
|
+ //}
|
|
|
230
|
+ //var modeMap = make(map[string]*domain.CooperationMode)
|
|
|
231
|
+ //if _, cooperationProjects, err := cooperationModeRepository.Find(map[string]interface{}{"companyId":listCooperationProjectQuery.CompanyId,"orgId":listCooperationProjectQuery.OrgId}); err != nil {
|
|
|
232
|
+ // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
233
|
+ //}else{
|
|
|
234
|
+ // for i:=range cooperationProjects{
|
|
|
235
|
+ // p :=cooperationProjects[i]
|
|
|
236
|
+ // modeMap[p.CooperationModeNumber]=p
|
|
|
237
|
+ // }
|
|
|
238
|
+ //}
|
|
|
239
|
+ //
|
|
|
240
|
+ var res []*dto.CooperationProjectsDto
|
|
|
241
|
+ for i := range cooperationProjects {
|
|
|
242
|
+ p := cooperationProjects[i]
|
|
|
243
|
+ tp := &dto.CooperationProjectsDto{}
|
|
|
244
|
+ tp.LoadDto(p, &domain.CooperationMode{})
|
|
|
245
|
+ res = append(res, tp)
|
|
|
246
|
+ }
|
|
|
247
|
+
|
218
|
if err := transactionContext.CommitTransaction(); err != nil {
|
248
|
if err := transactionContext.CommitTransaction(); err != nil {
|
219
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
249
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
220
|
}
|
250
|
}
|
221
|
return map[string]interface{}{
|
251
|
return map[string]interface{}{
|
222
|
//"grid": map[string]interface{}{
|
252
|
//"grid": map[string]interface{}{
|
223
|
"total": count,
|
253
|
"total": count,
|
224
|
- "list": cooperationProjects,
|
254
|
+ "list": res,
|
225
|
//},
|
255
|
//},
|
226
|
}, nil
|
256
|
}, nil
|
227
|
}
|
257
|
}
|