作者 yangfu
package query
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CooperationProjectSelectorQuery struct {
//操作人
Operator domain.Operator `json:"-"`
MatchCooperationProjectNumber string `json:"matchCooperationProjectNumber"` //匹配项目编号
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
... ... @@ -20,23 +17,5 @@ type ListCooperationProjectQuery struct {
DepartmentName string `json:"departmentName"`
//项目名称
CooperationProjectName string `json:"cooperationProjectName"`
CooperationProjectNumberLike string `json:"cooperationProjectNumberLike"`
}
func (listCooperationProjectQuery *ListCooperationProjectQuery) Valid(validation *validation.Validation) {
}
func (listCooperationProjectQuery *ListCooperationProjectQuery) 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
CooperationProjectNumberLike string `json:"cooperationProjectNumberLike"` //匹配项目编号
}
... ...
... ... @@ -143,20 +143,19 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
}
// 返回共创项目管理列表下拉选择框
func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.ListCooperationProjectQuery) (int64, interface{}, error) {
listCooperationProjectQuery.PageSize = 999
if err := listCooperationProjectQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.CooperationProjectSelectorQuery) (int64, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator)
orgIds := []string{}
for _, v := range listCooperationProjectQuery.Operator.OrgIds {
idStr := strconv.Itoa(int(v))
orgIds = append(orgIds, idStr)
}
result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: listCooperationProjectQuery.PageNumber,
PageSize: listCooperationProjectQuery.PageSize,
//发起部门名称
DepartmentName: listCooperationProjectQuery.DepartmentName,
//项目名
CooperationProjectName: listCooperationProjectQuery.CooperationProjectName,
CooperationProjectNumberLike: listCooperationProjectQuery.CooperationProjectNumberLike,
PageSize: 999,
CooperationProjectNumber: listCooperationProjectQuery.MatchCooperationProjectNumber,
CompanyId: listCooperationProjectQuery.Operator.CompanyId,
OrgIds: orgIds,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -86,6 +86,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
CustomerName: searchDividendsOrderQuery.CustomerName,
DividendsOrderNumber: searchDividendsOrderQuery.DividendsOrderNumber,
OrgIds: searchDividendsOrderQuery.Operator.OrgIds,
CompanyId: int(searchDividendsOrderQuery.Operator.CompanyId),
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -18,7 +18,7 @@ type (
RegionName string `json:"regionName"` //订单区域名称
OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
Expense string `json:"expense"` //费用
Expense string `json:"expense"` //费用
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
}
// ReqImportDividendsOrder 请求参数
... ... @@ -30,9 +30,29 @@ type (
DataImportDividendsOrder struct {
SuccessCount int `json:"successCount"`
Fail struct {
Header struct {
Header struct { //
FailReason string `json:"failReason"` //'失败原因',
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
DividendsCustomerName string `json:"dividendsCustomerName"` //订单客户名称
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderTime string `json:"orderTime"` //订单日期
RegionName string `json:"regionName"` //订单区域名称
OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
Expense string `json:"expense"` //费用
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
} `json:"header"`
Body []struct {
FailReason string `json:"failReason"`
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
DividendsCustomerName string `json:"dividendsCustomerName"` //订单客户名称
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderTime string `json:"orderTime"` //订单日期
RegionName string `json:"regionName"` //订单区域名称
OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
Expense string `json:"expense"` //费用
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
} `json:"body"`
} `json:"fail"`
}
... ... @@ -61,8 +81,28 @@ type (
SuccessCount int `json:"successCount"`
Fail struct {
Header struct {
FailReason string `json:"failReason"`
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
OrderGoodName string `json:"orderGoodName"` //订单产品名称
DividendsReturnedDate string `json:"dividendsReturnedDate"` //退货日期
RegionName string `json:"regionName"` //退货区域名称
OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
OrderTime string `json:"orderTime"` //订单日期
} `json:"header"`
Body []struct {
FailReason string `json:"failReason"`
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
OrderGoodName string `json:"orderGoodName"` //订单产品名称
DividendsReturnedDate string `json:"dividendsReturnedDate"` //退货日期
RegionName string `json:"regionName"` //退货区域名称
OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
OrderTime string `json:"orderTime"` //订单日期
} `json:"body"`
} `json:"fail"`
}
... ...
... ... @@ -157,10 +157,10 @@ type (
// 共创项目状态,1招标中,2结束 0 全部
Status int `json:"status"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
OrgIds []string `json:"orgIds"`
CompanyId int64 `json:"companyId"`
CooperationProjectNumberLike string `json:"cooperationProjectNumberLike"`
OrgId int64 `cname:"组织机构ID" json:"orgId"`
OrgIds []string `json:"orgIds"`
CompanyId int64 `json:"companyId"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
//OffsetLimitFlag bool `json:"offsetLimitFlag"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
... ...
... ... @@ -69,7 +69,7 @@ func (controller *CooperationProjectController) ListCooperationProject() {
func (controller *CooperationProjectController) SelectorCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
listCooperationProjectQuery := &query.ListCooperationProjectQuery{}
listCooperationProjectQuery := &query.CooperationProjectSelectorQuery{}
err := controller.Unmarshal(listCooperationProjectQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
... ...