作者 yangfu
  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 +)
  6 +
  7 +type CooperationProjectSelectorQuery struct {
  8 + //操作人
  9 + Operator domain.Operator `json:"-"`
  10 + MatchCooperationProjectNumber string `json:"matchCooperationProjectNumber"` //匹配项目编号
  11 +}
1 package query 1 package query
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -20,23 +17,5 @@ type ListCooperationProjectQuery struct { @@ -20,23 +17,5 @@ type ListCooperationProjectQuery struct {
20 DepartmentName string `json:"departmentName"` 17 DepartmentName string `json:"departmentName"`
21 //项目名称 18 //项目名称
22 CooperationProjectName string `json:"cooperationProjectName"` 19 CooperationProjectName string `json:"cooperationProjectName"`
23 - CooperationProjectNumberLike string `json:"cooperationProjectNumberLike"`  
24 -}  
25 -  
26 -func (listCooperationProjectQuery *ListCooperationProjectQuery) Valid(validation *validation.Validation) {  
27 -  
28 -}  
29 -  
30 -func (listCooperationProjectQuery *ListCooperationProjectQuery) ValidateQuery() error {  
31 - valid := validation.Validation{}  
32 - b, err := valid.Valid(listCooperationProjectQuery)  
33 - if err != nil {  
34 - return err  
35 - }  
36 - if !b {  
37 - for _, validErr := range valid.Errors {  
38 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
39 - }  
40 - }  
41 - return nil 20 + CooperationProjectNumberLike string `json:"cooperationProjectNumberLike"` //匹配项目编号
42 } 21 }
@@ -143,20 +143,19 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -143,20 +143,19 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
143 } 143 }
144 144
145 // 返回共创项目管理列表下拉选择框 145 // 返回共创项目管理列表下拉选择框
146 -func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.ListCooperationProjectQuery) (int64, interface{}, error) {  
147 - listCooperationProjectQuery.PageSize = 999  
148 - if err := listCooperationProjectQuery.ValidateQuery(); err != nil {  
149 - return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())  
150 - } 146 +func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.CooperationProjectSelectorQuery) (int64, interface{}, error) {
  147 +
151 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator) 148 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator)
  149 + orgIds := []string{}
  150 + for _, v := range listCooperationProjectQuery.Operator.OrgIds {
  151 + idStr := strconv.Itoa(int(v))
  152 + orgIds = append(orgIds, idStr)
  153 + }
152 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 154 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
153 - PageNumber: listCooperationProjectQuery.PageNumber,  
154 - PageSize: listCooperationProjectQuery.PageSize,  
155 - //发起部门名称  
156 - DepartmentName: listCooperationProjectQuery.DepartmentName,  
157 - //项目名  
158 - CooperationProjectName: listCooperationProjectQuery.CooperationProjectName,  
159 - CooperationProjectNumberLike: listCooperationProjectQuery.CooperationProjectNumberLike, 155 + PageSize: 999,
  156 + CooperationProjectNumber: listCooperationProjectQuery.MatchCooperationProjectNumber,
  157 + CompanyId: listCooperationProjectQuery.Operator.CompanyId,
  158 + OrgIds: orgIds,
160 }) 159 })
161 if err != nil { 160 if err != nil {
162 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 161 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -86,6 +86,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD @@ -86,6 +86,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
86 CustomerName: searchDividendsOrderQuery.CustomerName, 86 CustomerName: searchDividendsOrderQuery.CustomerName,
87 DividendsOrderNumber: searchDividendsOrderQuery.DividendsOrderNumber, 87 DividendsOrderNumber: searchDividendsOrderQuery.DividendsOrderNumber,
88 OrgIds: searchDividendsOrderQuery.Operator.OrgIds, 88 OrgIds: searchDividendsOrderQuery.Operator.OrgIds,
  89 + CompanyId: int(searchDividendsOrderQuery.Operator.CompanyId),
89 }) 90 })
90 if err != nil { 91 if err != nil {
91 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 92 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -18,7 +18,7 @@ type ( @@ -18,7 +18,7 @@ type (
18 RegionName string `json:"regionName"` //订单区域名称 18 RegionName string `json:"regionName"` //订单区域名称
19 OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量 19 OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
20 OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价 20 OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
21 - Expense string `json:"expense"` //费用 21 + Expense string `json:"expense"` //费用
22 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号 22 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
23 } 23 }
24 // ReqImportDividendsOrder 请求参数 24 // ReqImportDividendsOrder 请求参数
@@ -30,9 +30,29 @@ type ( @@ -30,9 +30,29 @@ type (
30 DataImportDividendsOrder struct { 30 DataImportDividendsOrder struct {
31 SuccessCount int `json:"successCount"` 31 SuccessCount int `json:"successCount"`
32 Fail struct { 32 Fail struct {
33 - Header struct { 33 + Header struct { //
  34 + FailReason string `json:"failReason"` //'失败原因',
  35 + OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
  36 + DividendsCustomerName string `json:"dividendsCustomerName"` //订单客户名称
  37 + OrderGoodName string `json:"orderGoodName"` //订单产品名称
  38 + OrderTime string `json:"orderTime"` //订单日期
  39 + RegionName string `json:"regionName"` //订单区域名称
  40 + OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
  41 + OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
  42 + Expense string `json:"expense"` //费用
  43 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
34 } `json:"header"` 44 } `json:"header"`
35 Body []struct { 45 Body []struct {
  46 + FailReason string `json:"failReason"`
  47 + OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
  48 + DividendsCustomerName string `json:"dividendsCustomerName"` //订单客户名称
  49 + OrderGoodName string `json:"orderGoodName"` //订单产品名称
  50 + OrderTime string `json:"orderTime"` //订单日期
  51 + RegionName string `json:"regionName"` //订单区域名称
  52 + OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
  53 + OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
  54 + Expense string `json:"expense"` //费用
  55 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
36 } `json:"body"` 56 } `json:"body"`
37 } `json:"fail"` 57 } `json:"fail"`
38 } 58 }
@@ -61,8 +81,28 @@ type ( @@ -61,8 +81,28 @@ type (
61 SuccessCount int `json:"successCount"` 81 SuccessCount int `json:"successCount"`
62 Fail struct { 82 Fail struct {
63 Header struct { 83 Header struct {
  84 + FailReason string `json:"failReason"`
  85 + OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
  86 + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
  87 + OrderGoodName string `json:"orderGoodName"` //订单产品名称
  88 + DividendsReturnedDate string `json:"dividendsReturnedDate"` //退货日期
  89 + RegionName string `json:"regionName"` //退货区域名称
  90 + OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
  91 + OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
  92 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
  93 + OrderTime string `json:"orderTime"` //订单日期
64 } `json:"header"` 94 } `json:"header"`
65 Body []struct { 95 Body []struct {
  96 + FailReason string `json:"failReason"`
  97 + OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
  98 + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
  99 + OrderGoodName string `json:"orderGoodName"` //订单产品名称
  100 + DividendsReturnedDate string `json:"dividendsReturnedDate"` //退货日期
  101 + RegionName string `json:"regionName"` //退货区域名称
  102 + OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
  103 + OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
  104 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
  105 + OrderTime string `json:"orderTime"` //订单日期
66 } `json:"body"` 106 } `json:"body"`
67 } `json:"fail"` 107 } `json:"fail"`
68 } 108 }
@@ -157,10 +157,10 @@ type ( @@ -157,10 +157,10 @@ type (
157 // 共创项目状态,1招标中,2结束 0 全部 157 // 共创项目状态,1招标中,2结束 0 全部
158 Status int `json:"status"` 158 Status int `json:"status"`
159 // 组织机构ID 159 // 组织机构ID
160 - OrgId int64 `cname:"组织机构ID" json:"orgId"`  
161 - OrgIds []string `json:"orgIds"`  
162 - CompanyId int64 `json:"companyId"`  
163 - CooperationProjectNumberLike string `json:"cooperationProjectNumberLike"` 160 + OrgId int64 `cname:"组织机构ID" json:"orgId"`
  161 + OrgIds []string `json:"orgIds"`
  162 + CompanyId int64 `json:"companyId"`
  163 + CooperationProjectNumber string `json:"cooperationProjectNumber"`
164 //OffsetLimitFlag bool `json:"offsetLimitFlag"` 164 //OffsetLimitFlag bool `json:"offsetLimitFlag"`
165 // 用户基础数据id 165 // 用户基础数据id
166 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` 166 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
@@ -69,7 +69,7 @@ func (controller *CooperationProjectController) ListCooperationProject() { @@ -69,7 +69,7 @@ func (controller *CooperationProjectController) ListCooperationProject() {
69 69
70 func (controller *CooperationProjectController) SelectorCooperationProject() { 70 func (controller *CooperationProjectController) SelectorCooperationProject() {
71 cooperationProjectService := service.NewCooperationProjectService(nil) 71 cooperationProjectService := service.NewCooperationProjectService(nil)
72 - listCooperationProjectQuery := &query.ListCooperationProjectQuery{} 72 + listCooperationProjectQuery := &query.CooperationProjectSelectorQuery{}
73 err := controller.Unmarshal(listCooperationProjectQuery) 73 err := controller.Unmarshal(listCooperationProjectQuery)
74 if err != nil { 74 if err != nil {
75 log.Logger.Debug("json err:" + err.Error()) 75 log.Logger.Debug("json err:" + err.Error())