作者 yangfu

共创项目详情功能修改

package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type SearchCooperationProjectContractQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//项目ID
CooperationProjectId int64 `json:"cooperationProjectId"`
}
func (listCooperationProjectQuery *SearchCooperationProjectContractQuery) Valid(validation *validation.Validation) {
}
func (listCooperationProjectQuery *SearchCooperationProjectContractQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listCooperationProjectQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package dto
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
type CooperationProjectSearchItem struct {
allied_creation_cooperation.DataCooperationProjectSearchItem
// 共创项目关联的合约数量
//ContractCount int `json:"contractCount"`
}
... ...
package dto
// 共创项目详情
type CooperationProjectItemSharedInfo struct {
Project *CooperationProjectInfo
}
... ...
... ... @@ -97,10 +97,35 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm
Status: int(projectQuery.Status),
OrgId: projectQuery.Operator.OrgId,
})
var projects []dto.CooperationProjectSearchItem
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return int(result.Total), result.List, nil
for i := range result.List {
projects = append(projects, dto.CooperationProjectSearchItem{
result.List[i],
})
}
return int(result.Total), projects, nil
}
// SearchCooperationProject 企业获取共创项目列表
func (srv CooperationProjectService) SearchCooperationProjectContracts(projectQuery *command.SearchCooperationProjectContractQuery) (int, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
projectQuery.Operator)
result, err := creationCooperationGateway.CooperationStatistics(
allied_creation_cooperation.CompanyCooperationProjectContracts,
map[string]interface{}{
"offset": projectQuery.PageSize * (projectQuery.PageNumber - 1),
"limit": projectQuery.PageSize,
"projectId": projectQuery.CooperationProjectId,
},
)
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return int(0), result, nil
}
// PersonSearchCooperationProject 共创用户获取共创项目列表
... ... @@ -179,3 +204,18 @@ func extQuires(operator domain.Operator) []*allied_creation_cooperation.SearchCo
// }
// return int(result.Total), result.List, nil
//}
func (srv CooperationProjectService) PersonSearchCooperationProjectShareInfo(projectQuery *command.GetCooperationProjectQuery) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
projectQuery.Operator)
result, err := creationCooperationGateway.CooperationStatistics(
allied_creation_cooperation.PersonCooperationProjectSharedInfo,
map[string]interface{}{
"projectId": projectQuery.CooperationProjectId,
},
)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result, nil
}
... ...
... ... @@ -30,6 +30,8 @@ const (
CooperationUserModeStatistics = "CooperationUserModeStatistics"
// 公司 - 共创用户分红支付统计
CompanyPaymentHistoryStatistics = "CompanyPaymentHistoryStatistics"
// 企业共创项目 - 合约列表
CompanyCooperationProjectContracts = "CompanyCooperationProjectContracts"
// 个人 - 共创企业统计
CooperationCompanyStatistics = "CooperationCompanyStatistics"
... ... @@ -37,6 +39,8 @@ const (
PersonCooperationContractStatistics = "PersonCooperationContractStatistics"
// 个人 - 企业支付统计
PersonCompanyPaymentHistoryStatistics = "PersonCompanyPaymentHistoryStatistics"
// 个人 - 共创项目共享信息数据
PersonCooperationProjectSharedInfo = "PersonCooperationProjectSharedInfo"
// 账期结算单统计
CreditAccountStatistics = "CreditAccountStatistics"
... ...
... ... @@ -282,6 +282,8 @@ type (
//OperateTime time.Time `json:"operateTime"`
Status int `json:"status"`
ApplicantCount int `json:"applicantCount"` // 共创申请人计数
// 合约计数
ContractCount int32 `json:"contractCount"`
}
DataCooperationProjectSearch struct {
List []DataCooperationProjectSearchItem `json:"list"`
... ...
... ... @@ -214,6 +214,19 @@ func (controller *CooperationController) SearchCooperationProject() {
controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
}
func (controller *CooperationController) SearchCooperationProjectContracts() {
svr := service.CooperationProjectService{}
cmd := &command.SearchCooperationProjectContractQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
total, data, err := svr.SearchCooperationProjectContracts(cmd)
controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
}
func (controller *CooperationController) PersonSearchCooperationProject() {
svr := service.CooperationProjectService{}
cmd := &command.PersonSearchCooperationProjectQuery{}
... ... @@ -227,6 +240,32 @@ func (controller *CooperationController) PersonSearchCooperationProject() {
controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
}
func (controller *CooperationController) PersonSearchCooperationProjectStarred() {
svr := service.CooperationProjectService{}
cmd := &command.PersonSearchCooperationProjectQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
total, data, err := svr.PersonSearchCooperationProject(cmd)
controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
}
func (controller *CooperationController) PersonCooperationProjectSharedInfo() {
svr := service.CooperationProjectService{}
cmd := &command.PersonSearchCooperationProjectQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
total, data, err := svr.PersonSearchCooperationProject(cmd)
controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
}
//func (controller *CooperationController) PersonRecommendCooperationProject() {
// svr := service.CooperationProjectService{}
// cmd := &command.PersonSearchCooperationProjectQuery{}
... ...
... ... @@ -145,3 +145,16 @@ func (controller *UserController) CooperationOrg() {
data, err := svr.CooperationOrg(operator)
controller.Response(data, err)
}
func (controller *UserController) UpdateOrgFavorite() {
svr := service.UserService{}
cmd := &command.MenuFavoriteCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.UpdateMenuFavorite(cmd)
controller.Response(data, err)
}
... ...
... ... @@ -32,10 +32,13 @@ func init() {
web.Router("/v1/app/cooperation-projects/:projectId", &mobile_client.CooperationController{}, "Put:UpdateCooperationProject")
web.Router("/v1/app/cooperation-projects/end", &mobile_client.CooperationController{}, "Post:EndCooperationProject")
web.Router("/v1/app/cooperation-projects/search", &mobile_client.CooperationController{}, "Post:SearchCooperationProject")
web.Router("/v1/app/cooperation-projects/contracts", &mobile_client.CooperationController{}, "Post:SearchCooperationProjectContracts")
web.Router("/v1/app/cooperation-modes", &web_client.CooperationModeController{}, "Get:ListCooperationMode")
web.Router("/v1/common/cooperation/mode", &web_client.CooperationModeController{}, "Get:ListCooperationMode")
web.Router("/v1/app/cooperation-projects/person/search", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProject")
web.Router("/v1/app/cooperation-projects/person/search-starred", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProjectStarred")
web.Router("/v1/app/cooperation-projects/person/shared-info", &mobile_client.CooperationController{}, "Post:PersonCooperationProjectSharedInfo")
/***** CompanyDividends 账期结算 *****/
web.Router("/v1/app/company/credit-accounts/search", &mobile_client.CooperationController{}, "Post:CreditAccountSearch")
... ...
... ... @@ -15,6 +15,7 @@ func init() {
web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus")
web.Router("/v1/user/favorite-menus", &controllers.AuthController{}, "Get:GetFavoriteMenus")
web.Router("/v1/user/favorite-menus", &mobile_client.UserController{}, "Post:UpdateMenuFavorite")
web.Router("/v1/user/favorite-org", &mobile_client.UserController{}, "Post:UpdateOrgFavorite")
web.Router("/v1/user/change-password", &mobile_client.UserController{}, "Post:ChangePassword")
web.Router("/v1/user/change-phone", &mobile_client.UserController{}, "Post:ChangePhone")
... ...