作者 tangxuhui

添加 关联合约选择列表

  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 +)
  6 +
  7 +type ListContractSelectorQuery struct {
  8 + //操作人
  9 + Operator domain.Operator `json:"-"`
  10 + // 查询偏离量
  11 + PageNumber int `json:"pageNumber"`
  12 + // 查询限制
  13 + PageSize int `json:"pageSize" valid:"Required"`
  14 + CooperationContractNumber string `json:"cooperationContractNumber"`
  15 + SponsorName string `json:"sponsorName"`
  16 +}
@@ -233,3 +233,26 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC @@ -233,3 +233,26 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC
233 233
234 return removeCooperationContractCommand, nil 234 return removeCooperationContractCommand, nil
235 } 235 }
  236 +
  237 +// 返回共创合约下拉选择列表表
  238 +func (cooperationContractService *CooperationContractService) ListCooperationContractSelector(
  239 + listCooperationContractQuery *query.ListContractSelectorQuery) (int, interface{}, error) {
  240 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
  241 + result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
  242 + PageNumber: listCooperationContractQuery.PageNumber,
  243 + PageSize: listCooperationContractQuery.PageSize,
  244 + SponsorName: listCooperationContractQuery.SponsorName,
  245 + CooperationContractNumber: listCooperationContractQuery.CooperationContractNumber,
  246 + OrgId: listCooperationContractQuery.Operator.OrgId,
  247 + })
  248 + if err != nil {
  249 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  250 + }
  251 + data := []dto.CooperationContractItem{}
  252 + for i := range result.Grid.List {
  253 + item := dto.ToCooperationContractItem(&result.Grid.List[i], listCooperationContractQuery.Operator.OrgId)
  254 + data = append(data, *item)
  255 + }
  256 +
  257 + return result.Grid.Total, data, nil
  258 +}
@@ -106,3 +106,18 @@ func (controller *CooperationContractController) RemoveCooperationContract() { @@ -106,3 +106,18 @@ func (controller *CooperationContractController) RemoveCooperationContract() {
106 data, err := cooperationContractService.RemoveCooperationContract(removeCooperationContractCommand) 106 data, err := cooperationContractService.RemoveCooperationContract(removeCooperationContractCommand)
107 controller.Response(data, err) 107 controller.Response(data, err)
108 } 108 }
  109 +
  110 +//分红订单,分红退货单获取关联合约选择列表
  111 +func (controller *CooperationContractController) SelectorContract() {
  112 + cooperationContractService := service.NewCooperationContractService(nil)
  113 + listCooperationContractQuery := &query.ListContractSelectorQuery{}
  114 + err := controller.Unmarshal(listCooperationContractQuery)
  115 + if err != nil {
  116 + log.Logger.Debug("json err:" + err.Error())
  117 + controller.Response(nil, err)
  118 + return
  119 + }
  120 + listCooperationContractQuery.Operator = controller.GetOperator()
  121 + cnt, data, err := cooperationContractService.ListCooperationContractSelector(listCooperationContractQuery)
  122 + controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
  123 +}
@@ -11,4 +11,5 @@ func init() { @@ -11,4 +11,5 @@ func init() {
11 web.Router("/v1/web/dividends-order/remove", &web_client.DividendsOrderController{}, "Post:RemoveDividendsOrder") 11 web.Router("/v1/web/dividends-order/remove", &web_client.DividendsOrderController{}, "Post:RemoveDividendsOrder")
12 web.Router("/v1/web/dividends-order/:orderId", &web_client.DividendsOrderController{}, "Get:GetDividendsOrder") 12 web.Router("/v1/web/dividends-order/:orderId", &web_client.DividendsOrderController{}, "Get:GetDividendsOrder")
13 web.Router("/v1/web/dividends-order/search", &web_client.DividendsOrderController{}, "Post:SearchDividendsOrder") 13 web.Router("/v1/web/dividends-order/search", &web_client.DividendsOrderController{}, "Post:SearchDividendsOrder")
  14 + web.Router("/v1/web/dividends-order/selector/contract", &web_client.CooperationContractController{}, "Post:SelectorContract")
14 } 15 }