作者 tangxuhui

数据结构适配更新

... ... @@ -26,6 +26,13 @@ type UserInfo struct {
UsersId int `json:"userId,string"`
}
//公司
type CompanyData struct {
CompanyID int `json:"companyId"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
}
//CooperationProjectItem 返回共创项目列表项
type CooperationProjectItem struct {
CooperationMode CooperationMode `json:"cooperationMode"` //项目模式
... ... @@ -95,11 +102,11 @@ func ToCooperationProjectInfo(projecetParam *allied_creation_cooperation.Coopera
data.CooperationProjectSponsor.UserInfo.UsersId = projecetParam.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.Phone = projecetParam.CooperationProjectSponsor.UserInfo.Phone
data.CooperationProjectSponsor.UserInfo.UsersName = projecetParam.CooperationProjectSponsor.UserInfo.UsersName
return &data
}
type CooperationApplication struct {
Company CompanyData `json:"company"`
CooperationApplicationApplicant struct {
UserId int `json:"userId"`
UserInfo UserInfo `json:"userInfo"`
... ... @@ -128,7 +135,6 @@ func ToCooperationApplication(applicationParam *allied_creation_cooperation.Coop
CooperationProjectNumber: applicationParam.CooperationProject.CooperationProjectNumber,
CooperationApplicationVerifyDescription: applicationParam.CooperationApplicationVerifyDescription,
}
data.CooperationApplicationApplicant.UserId = applicationParam.CooperationApplicationApplicant.UserID
data.CooperationApplicationApplicant.UserInfo.Phone = applicationParam.CooperationApplicationApplicant.UserInfo.UserPhone
data.CooperationApplicationApplicant.UserInfo.UsersName = applicationParam.CooperationApplicationApplicant.UserInfo.UserName
... ... @@ -136,6 +142,7 @@ func ToCooperationApplication(applicationParam *allied_creation_cooperation.Coop
data.CooperationApplicationApplicant.Department.DepartmentId = applicationParam.CooperationApplicationApplicant.Department.DepartmentID
data.CooperationApplicationApplicant.Department.DepartmentName = applicationParam.CooperationApplicationApplicant.Department.DepartmentName
data.CooperationApplicationApplicant.Department.DepartmentNumber = applicationParam.CooperationApplicationApplicant.Department.DepartmentNumber
data.Company.CompanyID = applicationParam.Company.CompanyID
data.Company.CompanyName = applicationParam.Company.CompanyName
return &data
}
... ...
... ... @@ -19,13 +19,22 @@ type CooperationApplicationsService struct {
func (srv CooperationApplicationsService) GetCooperationApplications(applicationQuery *command.GetCooperationApplicationQuery) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
applicationQuery.Operator)
result, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
resultApplication, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
CooperationApplicationId: applicationQuery.CooperationApplicationId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
data := dto.ToCooperationApplication(&result.CooperationApplication)
resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: resultApplication.CooperationProject.CooperationProjectID,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
data := map[string]interface{}{
"cooperationApplication": dto.ToCooperationApplication(&resultApplication.CooperationApplication),
"cooperationProject": dto.ToCooperationProjectInfo(&resultProject.CooperationProject),
}
return data, nil
}
... ... @@ -91,8 +100,26 @@ func (srv CooperationApplicationsService) CreateCooperationApplications(createAp
}
//PersonGetCooperationApplications 共创用户获取共创申请详情
func (srv CooperationApplicationsService) PersonGetCooperationApplications(userMenusCommand *command.GetCooperationApplicationQuery) (interface{}, error) {
return nil, nil
func (srv CooperationApplicationsService) PersonGetCooperationApplications(applicationQuery *command.GetCooperationApplicationQuery) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
applicationQuery.Operator)
resultApplication, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
CooperationApplicationId: applicationQuery.CooperationApplicationId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: resultApplication.CooperationProject.CooperationProjectID,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
data := map[string]interface{}{
"cooperationApplication": dto.ToCooperationApplication(&resultApplication.CooperationApplication),
"cooperationProject": dto.ToCooperationProjectInfo(&resultProject.CooperationProject),
}
return data, nil
}
// PersonCancelCooperationApplications 共创用户取消共创申请
... ... @@ -101,6 +128,23 @@ func (srv CooperationApplicationsService) PersonCancelCooperationApplications(us
}
// PersonSearchCooperationApplications 共创用户获取共创申请列表
func (srv CooperationApplicationsService) PersonSearchCooperationApplications(userMenusCommand *command.ListCooperationApplicationQuery) (interface{}, error) {
return nil, nil
func (srv CooperationApplicationsService) PersonSearchCooperationApplications(applicationQuery *command.ListCooperationApplicationQuery) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
applicationQuery.Operator)
resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
PageNumber: applicationQuery.PageNumber,
PageSize: applicationQuery.PageSize,
CompanyId: int(applicationQuery.Operator.CompanyId),
CooperationApplicationStatus: applicationQuery.Status,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// var dataList []dto.CooperationApplication
// for i := range resultApplications.Gride.List {
// item := dto.ToCooperationApplication(&resultApplications.Gride.List[i])
// dataList = append(dataList, *item)
// }
return resultApplications, nil
}
... ...
... ... @@ -62,7 +62,7 @@ func (srv CooperationProjectService) GetCooperationProject(projectQuery *command
return dto.ToCooperationProjectInfo(&result.CooperationProject), nil
}
// UpdateCooperationProject
// UpdateCooperationProject 更新项目
func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator)
var images []domain.Attachment
... ...
... ... @@ -34,7 +34,6 @@ type CooperationApplicationItem struct {
func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem {
data := CooperationApplicationItem{
CooperationApplicationAttachment: param.CooperationApplicationAttachment,
CooperationApplicationDescription: param.CooperationApplicationDescription,
CooperationApplicationID: param.CooperationApplicationID,
... ...
... ... @@ -47,7 +47,6 @@ type CooperationProjectInfo struct {
DepartmentName string `json:"departmentName"`
} `json:"department"` //项目发起部门
Status int `json:"status"` // 共创项目状态,1招标中,2结束
}
func ToCooperationProjectInfo(param *allied_creation_cooperation.CooperationProject) *CooperationProjectInfo {
... ...