作者 yangfu

共创项目详情功能修改

  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type SearchCooperationProjectContractQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 查询偏离量
  14 + PageNumber int `json:"pageNumber"`
  15 + // 查询限制
  16 + PageSize int `json:"pageSize" valid:"Required"`
  17 + //项目ID
  18 + CooperationProjectId int64 `json:"cooperationProjectId"`
  19 +}
  20 +
  21 +func (listCooperationProjectQuery *SearchCooperationProjectContractQuery) Valid(validation *validation.Validation) {
  22 +
  23 +}
  24 +
  25 +func (listCooperationProjectQuery *SearchCooperationProjectContractQuery) ValidateQuery() error {
  26 + valid := validation.Validation{}
  27 + b, err := valid.Valid(listCooperationProjectQuery)
  28 + if err != nil {
  29 + return err
  30 + }
  31 + if !b {
  32 + for _, validErr := range valid.Errors {
  33 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  34 + }
  35 + }
  36 + return nil
  37 +}
  1 +package dto
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  4 +
  5 +type CooperationProjectSearchItem struct {
  6 + allied_creation_cooperation.DataCooperationProjectSearchItem
  7 + // 共创项目关联的合约数量
  8 + //ContractCount int `json:"contractCount"`
  9 +}
  1 +package dto
  2 +
  3 +// 共创项目详情
  4 +type CooperationProjectItemSharedInfo struct {
  5 + Project *CooperationProjectInfo
  6 +}
@@ -97,10 +97,35 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm @@ -97,10 +97,35 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm
97 Status: int(projectQuery.Status), 97 Status: int(projectQuery.Status),
98 OrgId: projectQuery.Operator.OrgId, 98 OrgId: projectQuery.Operator.OrgId,
99 }) 99 })
  100 + var projects []dto.CooperationProjectSearchItem
100 if err != nil { 101 if err != nil {
101 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 102 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
102 } 103 }
103 - return int(result.Total), result.List, nil 104 +
  105 + for i := range result.List {
  106 + projects = append(projects, dto.CooperationProjectSearchItem{
  107 + result.List[i],
  108 + })
  109 + }
  110 + return int(result.Total), projects, nil
  111 +}
  112 +
  113 +// SearchCooperationProject 企业获取共创项目列表
  114 +func (srv CooperationProjectService) SearchCooperationProjectContracts(projectQuery *command.SearchCooperationProjectContractQuery) (int, interface{}, error) {
  115 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  116 + projectQuery.Operator)
  117 + result, err := creationCooperationGateway.CooperationStatistics(
  118 + allied_creation_cooperation.CompanyCooperationProjectContracts,
  119 + map[string]interface{}{
  120 + "offset": projectQuery.PageSize * (projectQuery.PageNumber - 1),
  121 + "limit": projectQuery.PageSize,
  122 + "projectId": projectQuery.CooperationProjectId,
  123 + },
  124 + )
  125 + if err != nil {
  126 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  127 + }
  128 + return int(0), result, nil
104 } 129 }
105 130
106 // PersonSearchCooperationProject 共创用户获取共创项目列表 131 // PersonSearchCooperationProject 共创用户获取共创项目列表
@@ -179,3 +204,18 @@ func extQuires(operator domain.Operator) []*allied_creation_cooperation.SearchCo @@ -179,3 +204,18 @@ func extQuires(operator domain.Operator) []*allied_creation_cooperation.SearchCo
179 // } 204 // }
180 // return int(result.Total), result.List, nil 205 // return int(result.Total), result.List, nil
181 //} 206 //}
  207 +
  208 +func (srv CooperationProjectService) PersonSearchCooperationProjectShareInfo(projectQuery *command.GetCooperationProjectQuery) (interface{}, error) {
  209 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  210 + projectQuery.Operator)
  211 + result, err := creationCooperationGateway.CooperationStatistics(
  212 + allied_creation_cooperation.PersonCooperationProjectSharedInfo,
  213 + map[string]interface{}{
  214 + "projectId": projectQuery.CooperationProjectId,
  215 + },
  216 + )
  217 + if err != nil {
  218 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  219 + }
  220 + return result, nil
  221 +}
@@ -30,6 +30,8 @@ const ( @@ -30,6 +30,8 @@ const (
30 CooperationUserModeStatistics = "CooperationUserModeStatistics" 30 CooperationUserModeStatistics = "CooperationUserModeStatistics"
31 // 公司 - 共创用户分红支付统计 31 // 公司 - 共创用户分红支付统计
32 CompanyPaymentHistoryStatistics = "CompanyPaymentHistoryStatistics" 32 CompanyPaymentHistoryStatistics = "CompanyPaymentHistoryStatistics"
  33 + // 企业共创项目 - 合约列表
  34 + CompanyCooperationProjectContracts = "CompanyCooperationProjectContracts"
33 35
34 // 个人 - 共创企业统计 36 // 个人 - 共创企业统计
35 CooperationCompanyStatistics = "CooperationCompanyStatistics" 37 CooperationCompanyStatistics = "CooperationCompanyStatistics"
@@ -37,6 +39,8 @@ const ( @@ -37,6 +39,8 @@ const (
37 PersonCooperationContractStatistics = "PersonCooperationContractStatistics" 39 PersonCooperationContractStatistics = "PersonCooperationContractStatistics"
38 // 个人 - 企业支付统计 40 // 个人 - 企业支付统计
39 PersonCompanyPaymentHistoryStatistics = "PersonCompanyPaymentHistoryStatistics" 41 PersonCompanyPaymentHistoryStatistics = "PersonCompanyPaymentHistoryStatistics"
  42 + // 个人 - 共创项目共享信息数据
  43 + PersonCooperationProjectSharedInfo = "PersonCooperationProjectSharedInfo"
40 44
41 // 账期结算单统计 45 // 账期结算单统计
42 CreditAccountStatistics = "CreditAccountStatistics" 46 CreditAccountStatistics = "CreditAccountStatistics"
@@ -282,6 +282,8 @@ type ( @@ -282,6 +282,8 @@ type (
282 //OperateTime time.Time `json:"operateTime"` 282 //OperateTime time.Time `json:"operateTime"`
283 Status int `json:"status"` 283 Status int `json:"status"`
284 ApplicantCount int `json:"applicantCount"` // 共创申请人计数 284 ApplicantCount int `json:"applicantCount"` // 共创申请人计数
  285 + // 合约计数
  286 + ContractCount int32 `json:"contractCount"`
285 } 287 }
286 DataCooperationProjectSearch struct { 288 DataCooperationProjectSearch struct {
287 List []DataCooperationProjectSearchItem `json:"list"` 289 List []DataCooperationProjectSearchItem `json:"list"`
@@ -214,6 +214,19 @@ func (controller *CooperationController) SearchCooperationProject() { @@ -214,6 +214,19 @@ func (controller *CooperationController) SearchCooperationProject() {
214 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber) 214 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
215 } 215 }
216 216
  217 +func (controller *CooperationController) SearchCooperationProjectContracts() {
  218 + svr := service.CooperationProjectService{}
  219 + cmd := &command.SearchCooperationProjectContractQuery{}
  220 + err := controller.Unmarshal(cmd)
  221 + if err != nil {
  222 + controller.Response(nil, err)
  223 + return
  224 + }
  225 + cmd.Operator = controller.GetOperator()
  226 + total, data, err := svr.SearchCooperationProjectContracts(cmd)
  227 + controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
  228 +}
  229 +
217 func (controller *CooperationController) PersonSearchCooperationProject() { 230 func (controller *CooperationController) PersonSearchCooperationProject() {
218 svr := service.CooperationProjectService{} 231 svr := service.CooperationProjectService{}
219 cmd := &command.PersonSearchCooperationProjectQuery{} 232 cmd := &command.PersonSearchCooperationProjectQuery{}
@@ -227,6 +240,32 @@ func (controller *CooperationController) PersonSearchCooperationProject() { @@ -227,6 +240,32 @@ func (controller *CooperationController) PersonSearchCooperationProject() {
227 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber) 240 controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
228 } 241 }
229 242
  243 +func (controller *CooperationController) PersonSearchCooperationProjectStarred() {
  244 + svr := service.CooperationProjectService{}
  245 + cmd := &command.PersonSearchCooperationProjectQuery{}
  246 + err := controller.Unmarshal(cmd)
  247 + if err != nil {
  248 + controller.Response(nil, err)
  249 + return
  250 + }
  251 + cmd.Operator = controller.GetOperator()
  252 + total, data, err := svr.PersonSearchCooperationProject(cmd)
  253 + controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
  254 +}
  255 +
  256 +func (controller *CooperationController) PersonCooperationProjectSharedInfo() {
  257 + svr := service.CooperationProjectService{}
  258 + cmd := &command.PersonSearchCooperationProjectQuery{}
  259 + err := controller.Unmarshal(cmd)
  260 + if err != nil {
  261 + controller.Response(nil, err)
  262 + return
  263 + }
  264 + cmd.Operator = controller.GetOperator()
  265 + total, data, err := svr.PersonSearchCooperationProject(cmd)
  266 + controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
  267 +}
  268 +
230 //func (controller *CooperationController) PersonRecommendCooperationProject() { 269 //func (controller *CooperationController) PersonRecommendCooperationProject() {
231 // svr := service.CooperationProjectService{} 270 // svr := service.CooperationProjectService{}
232 // cmd := &command.PersonSearchCooperationProjectQuery{} 271 // cmd := &command.PersonSearchCooperationProjectQuery{}
@@ -145,3 +145,16 @@ func (controller *UserController) CooperationOrg() { @@ -145,3 +145,16 @@ func (controller *UserController) CooperationOrg() {
145 data, err := svr.CooperationOrg(operator) 145 data, err := svr.CooperationOrg(operator)
146 controller.Response(data, err) 146 controller.Response(data, err)
147 } 147 }
  148 +
  149 +func (controller *UserController) UpdateOrgFavorite() {
  150 + svr := service.UserService{}
  151 + cmd := &command.MenuFavoriteCommand{}
  152 + err := controller.Unmarshal(cmd)
  153 + if err != nil {
  154 + controller.Response(nil, err)
  155 + return
  156 + }
  157 + cmd.Operator = controller.GetOperator()
  158 + data, err := svr.UpdateMenuFavorite(cmd)
  159 + controller.Response(data, err)
  160 +}
@@ -32,10 +32,13 @@ func init() { @@ -32,10 +32,13 @@ func init() {
32 web.Router("/v1/app/cooperation-projects/:projectId", &mobile_client.CooperationController{}, "Put:UpdateCooperationProject") 32 web.Router("/v1/app/cooperation-projects/:projectId", &mobile_client.CooperationController{}, "Put:UpdateCooperationProject")
33 web.Router("/v1/app/cooperation-projects/end", &mobile_client.CooperationController{}, "Post:EndCooperationProject") 33 web.Router("/v1/app/cooperation-projects/end", &mobile_client.CooperationController{}, "Post:EndCooperationProject")
34 web.Router("/v1/app/cooperation-projects/search", &mobile_client.CooperationController{}, "Post:SearchCooperationProject") 34 web.Router("/v1/app/cooperation-projects/search", &mobile_client.CooperationController{}, "Post:SearchCooperationProject")
  35 + web.Router("/v1/app/cooperation-projects/contracts", &mobile_client.CooperationController{}, "Post:SearchCooperationProjectContracts")
35 web.Router("/v1/app/cooperation-modes", &web_client.CooperationModeController{}, "Get:ListCooperationMode") 36 web.Router("/v1/app/cooperation-modes", &web_client.CooperationModeController{}, "Get:ListCooperationMode")
36 web.Router("/v1/common/cooperation/mode", &web_client.CooperationModeController{}, "Get:ListCooperationMode") 37 web.Router("/v1/common/cooperation/mode", &web_client.CooperationModeController{}, "Get:ListCooperationMode")
37 38
38 web.Router("/v1/app/cooperation-projects/person/search", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProject") 39 web.Router("/v1/app/cooperation-projects/person/search", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProject")
  40 + web.Router("/v1/app/cooperation-projects/person/search-starred", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProjectStarred")
  41 + web.Router("/v1/app/cooperation-projects/person/shared-info", &mobile_client.CooperationController{}, "Post:PersonCooperationProjectSharedInfo")
39 42
40 /***** CompanyDividends 账期结算 *****/ 43 /***** CompanyDividends 账期结算 *****/
41 web.Router("/v1/app/company/credit-accounts/search", &mobile_client.CooperationController{}, "Post:CreditAccountSearch") 44 web.Router("/v1/app/company/credit-accounts/search", &mobile_client.CooperationController{}, "Post:CreditAccountSearch")
@@ -15,6 +15,7 @@ func init() { @@ -15,6 +15,7 @@ func init() {
15 web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus") 15 web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus")
16 web.Router("/v1/user/favorite-menus", &controllers.AuthController{}, "Get:GetFavoriteMenus") 16 web.Router("/v1/user/favorite-menus", &controllers.AuthController{}, "Get:GetFavoriteMenus")
17 web.Router("/v1/user/favorite-menus", &mobile_client.UserController{}, "Post:UpdateMenuFavorite") 17 web.Router("/v1/user/favorite-menus", &mobile_client.UserController{}, "Post:UpdateMenuFavorite")
  18 + web.Router("/v1/user/favorite-org", &mobile_client.UserController{}, "Post:UpdateOrgFavorite")
18 19
19 web.Router("/v1/user/change-password", &mobile_client.UserController{}, "Post:ChangePassword") 20 web.Router("/v1/user/change-password", &mobile_client.UserController{}, "Post:ChangePassword")
20 web.Router("/v1/user/change-phone", &mobile_client.UserController{}, "Post:ChangePhone") 21 web.Router("/v1/user/change-phone", &mobile_client.UserController{}, "Post:ChangePhone")