作者 tangxuhui

添加合约查询

@@ -180,3 +180,36 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon @@ -180,3 +180,36 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
180 return &data 180 return &data
181 181
182 } 182 }
  183 +
  184 +type CooperationContractUndertake struct {
  185 + Undertaker struct {
  186 + UsersName string `json:"userName"`
  187 + Phone string `json:"phone"`
  188 + UserId int `json:"userId,string,"`
  189 + UserCode string `json:"userCode"`
  190 + } `json:"undertaker"`
  191 + CooperationContractDescription string `json:"cooperationContractDescription"`
  192 + CooperationContractId int `json:"cooperationContractId,string,"`
  193 + CooperationContractName string `json:"cooperationContractName"`
  194 + CooperationContractNumber string `json:"cooperationContractNumber"`
  195 + CooperationContractSponsor struct {
  196 + UsersName string `json:"userName"`
  197 + Phone string `json:"phone"`
  198 + UserId int `json:"userId,string,"`
  199 + UserCode string `json:"userCode"`
  200 + } `json:"cooperationContractSponsor"`
  201 + CooperationMode struct {
  202 + CooperationModeId int `json:"cooperationModeId,string"`
  203 + CooperationModeName string `json:"cooperationModeName"`
  204 + CooperationModeNumber string `json:"cooperationModeNumber"`
  205 + } `json:"cooperationMode"`
  206 + Org struct {
  207 + OrgName string `json:"orgName"`
  208 + } `json:"org"`
  209 + Attachment []domain.Attachment `json:"attachment"`
  210 +}
  211 +
  212 +func ToCooperationContractUndertake(allied_creation_cooperation.DataCooperationContractSearchByUndertaker) *CooperationContractUndertake {
  213 + data := CooperationContractUndertake{}
  214 + return &data
  215 +}
@@ -201,14 +201,16 @@ func NewCooperationContractService(options map[string]interface{}) *CooperationC @@ -201,14 +201,16 @@ func NewCooperationContractService(options map[string]interface{}) *CooperationC
201 return newCooperationContractService 201 return newCooperationContractService
202 } 202 }
203 203
204 -func (cooperationContractService *CooperationContractService) SearchCooperationContractsByUndertake(queryParam query.SearchCooperationContractsByUndertake) (interface{}, error) { 204 +func (cooperationContractService *CooperationContractService) SearchCooperationContractsByUndertake(queryParam *query.SearchCooperationContractsByUndertake) (
  205 + int, interface{}, error) {
205 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator) 206 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
206 - result, err := creationCooperationGateway.CooperationContractsSearchByUndertaker( 207 + _, err := creationCooperationGateway.CooperationContractsSearchByUndertaker(
207 allied_creation_cooperation.ReqCooperationContractSearchByUndertaker{ 208 allied_creation_cooperation.ReqCooperationContractSearchByUndertaker{
208 CooperationContractName: queryParam.CooperationContractName, 209 CooperationContractName: queryParam.CooperationContractName,
209 SponsorName: queryParam.ContractSponsor, 210 SponsorName: queryParam.ContractSponsor,
210 PageNumber: queryParam.PageNumber, 211 PageNumber: queryParam.PageNumber,
211 PageIndex: queryParam.PageSize, 212 PageIndex: queryParam.PageSize,
212 }) 213 })
213 - return result, err 214 + data := []dto.CooperationContractUndertake{{}}
  215 + return 10, data, err
214 } 216 }
@@ -79,11 +79,11 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide @@ -79,11 +79,11 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
79 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 79 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
80 } 80 }
81 dataList := []dto.DividendsReturnedOrderInfo{} 81 dataList := []dto.DividendsReturnedOrderInfo{}
82 - for i := range result.List {  
83 - item := dto.ToDividendsReturnedOrderInfo(&result.List[i]) 82 + for i := range result.Grid.List {
  83 + item := dto.ToDividendsReturnedOrderInfo(&result.Grid.List[i])
84 dataList = append(dataList, *item) 84 dataList = append(dataList, *item)
85 } 85 }
86 - return result.Total, dataList, nil 86 + return result.Grid.Total, dataList, nil
87 } 87 }
88 88
89 // 更新分红退货单服务 89 // 更新分红退货单服务
@@ -96,8 +96,10 @@ type ( @@ -96,8 +96,10 @@ type (
96 } 96 }
97 97
98 DataDividendsReturnedOrderSearch struct { 98 DataDividendsReturnedOrderSearch struct {
99 - Total int `json:"total"`  
100 - List []DividendsReturnedOrder `json:"list"` 99 + Grid struct {
  100 + Total int `json:"total"`
  101 + List []DividendsReturnedOrder `json:"list"`
  102 + } `json:"grid"`
101 } 103 }
102 ) 104 )
103 105
@@ -69,3 +69,15 @@ func (controller *CooperationContractController) EnableCooperationContract() { @@ -69,3 +69,15 @@ func (controller *CooperationContractController) EnableCooperationContract() {
69 data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand) 69 data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand)
70 controller.Response(data, err) 70 controller.Response(data, err)
71 } 71 }
  72 +
  73 +func (controller *CooperationContractController) SearchCooperationContractsByUndertake() {
  74 + cooperationContractService := service.NewCooperationContractService(nil)
  75 + listCooperationContractQuery := &query.SearchCooperationContractsByUndertake{}
  76 + err := controller.Unmarshal(listCooperationContractQuery)
  77 + if err != nil {
  78 + log.Logger.Debug("json err:" + err.Error())
  79 + }
  80 + listCooperationContractQuery.Operator = controller.GetOperator()
  81 + cnt, data, err := cooperationContractService.SearchCooperationContractsByUndertake(listCooperationContractQuery)
  82 + controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
  83 +}
@@ -11,4 +11,5 @@ func init() { @@ -11,4 +11,5 @@ func init() {
11 web.Router("/v1/web/cooperation-contracts/:contractId", &web_client.CooperationContractController{}, "Get:GetCooperationContract") 11 web.Router("/v1/web/cooperation-contracts/:contractId", &web_client.CooperationContractController{}, "Get:GetCooperationContract")
12 web.Router("/v1/web/cooperation-contracts/search", &web_client.CooperationContractController{}, "Post:ListCooperationContract") 12 web.Router("/v1/web/cooperation-contracts/search", &web_client.CooperationContractController{}, "Post:ListCooperationContract")
13 web.Router("/v1/web/cooperation-contracts/enable", &web_client.CooperationContractController{}, "Put:EnableCooperationContract") 13 web.Router("/v1/web/cooperation-contracts/enable", &web_client.CooperationContractController{}, "Put:EnableCooperationContract")
  14 + web.Router("/v1/web/cooperation-contracts/undertaker", &web_client.CooperationContractController{}, "Post:SearchCooperationContractsByUndertake")
14 } 15 }