作者 tangxuhui

数据结构适配更新

@@ -26,6 +26,13 @@ type UserInfo struct { @@ -26,6 +26,13 @@ type UserInfo struct {
26 UsersId int `json:"userId,string"` 26 UsersId int `json:"userId,string"`
27 } 27 }
28 28
  29 +//公司
  30 +type CompanyData struct {
  31 + CompanyID int `json:"companyId"`
  32 + CompanyLogo string `json:"companyLogo"`
  33 + CompanyName string `json:"companyName"`
  34 +}
  35 +
29 //CooperationProjectItem 返回共创项目列表项 36 //CooperationProjectItem 返回共创项目列表项
30 type CooperationProjectItem struct { 37 type CooperationProjectItem struct {
31 CooperationMode CooperationMode `json:"cooperationMode"` //项目模式 38 CooperationMode CooperationMode `json:"cooperationMode"` //项目模式
@@ -95,11 +102,11 @@ func ToCooperationProjectInfo(projecetParam *allied_creation_cooperation.Coopera @@ -95,11 +102,11 @@ func ToCooperationProjectInfo(projecetParam *allied_creation_cooperation.Coopera
95 data.CooperationProjectSponsor.UserInfo.UsersId = projecetParam.CooperationProjectSponsor.UsersId 102 data.CooperationProjectSponsor.UserInfo.UsersId = projecetParam.CooperationProjectSponsor.UsersId
96 data.CooperationProjectSponsor.UserInfo.Phone = projecetParam.CooperationProjectSponsor.UserInfo.Phone 103 data.CooperationProjectSponsor.UserInfo.Phone = projecetParam.CooperationProjectSponsor.UserInfo.Phone
97 data.CooperationProjectSponsor.UserInfo.UsersName = projecetParam.CooperationProjectSponsor.UserInfo.UsersName 104 data.CooperationProjectSponsor.UserInfo.UsersName = projecetParam.CooperationProjectSponsor.UserInfo.UsersName
98 -  
99 return &data 105 return &data
100 } 106 }
101 107
102 type CooperationApplication struct { 108 type CooperationApplication struct {
  109 + Company CompanyData `json:"company"`
103 CooperationApplicationApplicant struct { 110 CooperationApplicationApplicant struct {
104 UserId int `json:"userId"` 111 UserId int `json:"userId"`
105 UserInfo UserInfo `json:"userInfo"` 112 UserInfo UserInfo `json:"userInfo"`
@@ -128,7 +135,6 @@ func ToCooperationApplication(applicationParam *allied_creation_cooperation.Coop @@ -128,7 +135,6 @@ func ToCooperationApplication(applicationParam *allied_creation_cooperation.Coop
128 CooperationProjectNumber: applicationParam.CooperationProject.CooperationProjectNumber, 135 CooperationProjectNumber: applicationParam.CooperationProject.CooperationProjectNumber,
129 CooperationApplicationVerifyDescription: applicationParam.CooperationApplicationVerifyDescription, 136 CooperationApplicationVerifyDescription: applicationParam.CooperationApplicationVerifyDescription,
130 } 137 }
131 -  
132 data.CooperationApplicationApplicant.UserId = applicationParam.CooperationApplicationApplicant.UserID 138 data.CooperationApplicationApplicant.UserId = applicationParam.CooperationApplicationApplicant.UserID
133 data.CooperationApplicationApplicant.UserInfo.Phone = applicationParam.CooperationApplicationApplicant.UserInfo.UserPhone 139 data.CooperationApplicationApplicant.UserInfo.Phone = applicationParam.CooperationApplicationApplicant.UserInfo.UserPhone
134 data.CooperationApplicationApplicant.UserInfo.UsersName = applicationParam.CooperationApplicationApplicant.UserInfo.UserName 140 data.CooperationApplicationApplicant.UserInfo.UsersName = applicationParam.CooperationApplicationApplicant.UserInfo.UserName
@@ -136,6 +142,7 @@ func ToCooperationApplication(applicationParam *allied_creation_cooperation.Coop @@ -136,6 +142,7 @@ func ToCooperationApplication(applicationParam *allied_creation_cooperation.Coop
136 data.CooperationApplicationApplicant.Department.DepartmentId = applicationParam.CooperationApplicationApplicant.Department.DepartmentID 142 data.CooperationApplicationApplicant.Department.DepartmentId = applicationParam.CooperationApplicationApplicant.Department.DepartmentID
137 data.CooperationApplicationApplicant.Department.DepartmentName = applicationParam.CooperationApplicationApplicant.Department.DepartmentName 143 data.CooperationApplicationApplicant.Department.DepartmentName = applicationParam.CooperationApplicationApplicant.Department.DepartmentName
138 data.CooperationApplicationApplicant.Department.DepartmentNumber = applicationParam.CooperationApplicationApplicant.Department.DepartmentNumber 144 data.CooperationApplicationApplicant.Department.DepartmentNumber = applicationParam.CooperationApplicationApplicant.Department.DepartmentNumber
  145 + data.Company.CompanyID = applicationParam.Company.CompanyID
  146 + data.Company.CompanyName = applicationParam.Company.CompanyName
139 return &data 147 return &data
140 -  
141 } 148 }
@@ -19,13 +19,22 @@ type CooperationApplicationsService struct { @@ -19,13 +19,22 @@ type CooperationApplicationsService struct {
19 func (srv CooperationApplicationsService) GetCooperationApplications(applicationQuery *command.GetCooperationApplicationQuery) (interface{}, error) { 19 func (srv CooperationApplicationsService) GetCooperationApplications(applicationQuery *command.GetCooperationApplicationQuery) (interface{}, error) {
20 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 20 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
21 applicationQuery.Operator) 21 applicationQuery.Operator)
22 - result, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{ 22 + resultApplication, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
23 CooperationApplicationId: applicationQuery.CooperationApplicationId, 23 CooperationApplicationId: applicationQuery.CooperationApplicationId,
24 }) 24 })
25 if err != nil { 25 if err != nil {
26 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 26 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
27 } 27 }
28 - data := dto.ToCooperationApplication(&result.CooperationApplication) 28 + resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
  29 + CooperationProjectId: resultApplication.CooperationProject.CooperationProjectID,
  30 + })
  31 + if err != nil {
  32 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  33 + }
  34 + data := map[string]interface{}{
  35 + "cooperationApplication": dto.ToCooperationApplication(&resultApplication.CooperationApplication),
  36 + "cooperationProject": dto.ToCooperationProjectInfo(&resultProject.CooperationProject),
  37 + }
29 return data, nil 38 return data, nil
30 } 39 }
31 40
@@ -91,8 +100,26 @@ func (srv CooperationApplicationsService) CreateCooperationApplications(createAp @@ -91,8 +100,26 @@ func (srv CooperationApplicationsService) CreateCooperationApplications(createAp
91 } 100 }
92 101
93 //PersonGetCooperationApplications 共创用户获取共创申请详情 102 //PersonGetCooperationApplications 共创用户获取共创申请详情
94 -func (srv CooperationApplicationsService) PersonGetCooperationApplications(userMenusCommand *command.GetCooperationApplicationQuery) (interface{}, error) {  
95 - return nil, nil 103 +func (srv CooperationApplicationsService) PersonGetCooperationApplications(applicationQuery *command.GetCooperationApplicationQuery) (interface{}, error) {
  104 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  105 + applicationQuery.Operator)
  106 + resultApplication, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
  107 + CooperationApplicationId: applicationQuery.CooperationApplicationId,
  108 + })
  109 + if err != nil {
  110 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  111 + }
  112 + resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
  113 + CooperationProjectId: resultApplication.CooperationProject.CooperationProjectID,
  114 + })
  115 + if err != nil {
  116 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  117 + }
  118 + data := map[string]interface{}{
  119 + "cooperationApplication": dto.ToCooperationApplication(&resultApplication.CooperationApplication),
  120 + "cooperationProject": dto.ToCooperationProjectInfo(&resultProject.CooperationProject),
  121 + }
  122 + return data, nil
96 } 123 }
97 124
98 // PersonCancelCooperationApplications 共创用户取消共创申请 125 // PersonCancelCooperationApplications 共创用户取消共创申请
@@ -101,6 +128,23 @@ func (srv CooperationApplicationsService) PersonCancelCooperationApplications(us @@ -101,6 +128,23 @@ func (srv CooperationApplicationsService) PersonCancelCooperationApplications(us
101 } 128 }
102 129
103 // PersonSearchCooperationApplications 共创用户获取共创申请列表 130 // PersonSearchCooperationApplications 共创用户获取共创申请列表
104 -func (srv CooperationApplicationsService) PersonSearchCooperationApplications(userMenusCommand *command.ListCooperationApplicationQuery) (interface{}, error) {  
105 - return nil, nil 131 +func (srv CooperationApplicationsService) PersonSearchCooperationApplications(applicationQuery *command.ListCooperationApplicationQuery) (interface{}, error) {
  132 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  133 + applicationQuery.Operator)
  134 + resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
  135 + PageNumber: applicationQuery.PageNumber,
  136 + PageSize: applicationQuery.PageSize,
  137 + CompanyId: int(applicationQuery.Operator.CompanyId),
  138 + CooperationApplicationStatus: applicationQuery.Status,
  139 + })
  140 + if err != nil {
  141 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  142 + }
  143 + // var dataList []dto.CooperationApplication
  144 +
  145 + // for i := range resultApplications.Gride.List {
  146 + // item := dto.ToCooperationApplication(&resultApplications.Gride.List[i])
  147 + // dataList = append(dataList, *item)
  148 + // }
  149 + return resultApplications, nil
106 } 150 }
@@ -62,7 +62,7 @@ func (srv CooperationProjectService) GetCooperationProject(projectQuery *command @@ -62,7 +62,7 @@ func (srv CooperationProjectService) GetCooperationProject(projectQuery *command
62 return dto.ToCooperationProjectInfo(&result.CooperationProject), nil 62 return dto.ToCooperationProjectInfo(&result.CooperationProject), nil
63 } 63 }
64 64
65 -// UpdateCooperationProject 65 +// UpdateCooperationProject 更新项目
66 func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) { 66 func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) {
67 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator) 67 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator)
68 var images []domain.Attachment 68 var images []domain.Attachment
@@ -34,7 +34,6 @@ type CooperationApplicationItem struct { @@ -34,7 +34,6 @@ type CooperationApplicationItem struct {
34 34
35 func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem { 35 func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem {
36 data := CooperationApplicationItem{ 36 data := CooperationApplicationItem{
37 -  
38 CooperationApplicationAttachment: param.CooperationApplicationAttachment, 37 CooperationApplicationAttachment: param.CooperationApplicationAttachment,
39 CooperationApplicationDescription: param.CooperationApplicationDescription, 38 CooperationApplicationDescription: param.CooperationApplicationDescription,
40 CooperationApplicationID: param.CooperationApplicationID, 39 CooperationApplicationID: param.CooperationApplicationID,
@@ -47,7 +47,6 @@ type CooperationProjectInfo struct { @@ -47,7 +47,6 @@ type CooperationProjectInfo struct {
47 DepartmentName string `json:"departmentName"` 47 DepartmentName string `json:"departmentName"`
48 } `json:"department"` //项目发起部门 48 } `json:"department"` //项目发起部门
49 Status int `json:"status"` // 共创项目状态,1招标中,2结束 49 Status int `json:"status"` // 共创项目状态,1招标中,2结束
50 -  
51 } 50 }
52 51
53 func ToCooperationProjectInfo(param *allied_creation_cooperation.CooperationProject) *CooperationProjectInfo { 52 func ToCooperationProjectInfo(param *allied_creation_cooperation.CooperationProject) *CooperationProjectInfo {