作者 Your Name

调整 根据项目编码获取详情 需要的条件

package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
... ... @@ -11,24 +8,7 @@ type GetCooperationProjectQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目ID
CooperationProjectId int `json:"cooperationProjectId"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
}
func (getCooperationProjectQuery *GetCooperationProjectQuery) Valid(validation *validation.Validation) {
}
func (getCooperationProjectQuery *GetCooperationProjectQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(getCooperationProjectQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
CooperationProjectId int `json:"-"`
CooperationProjectNumber string `json:"-"`
OrgId int `json:"-"`
}
... ...
... ... @@ -63,6 +63,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: getCooperationProjectQuery.CooperationProjectId,
CooperationProjectNumber: getCooperationProjectQuery.CooperationProjectNumber,
OrgId: getCooperationProjectQuery.OrgId,
CompanyId: int(getCooperationProjectQuery.Operator.CompanyId),
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -72,6 +74,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
PageNumber: 0,
PageSize: 0,
CompanyId: resultProject.Company.CompanyId,
OrgId: int64(resultProject.Org.OrgId),
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -8,24 +8,7 @@ type GetDividendsOrderQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 分红订单ID
DividendsOrderId int `json:"dividendsOrderId,string" valid:"Required"`
DividendsOrderNumber string `json:"dividendsOrderNumber"`
DividendsOrderId int `json:"-" `
DividendsOrderNumber string `json:"-"`
OrgId int `json:"-"`
}
// func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) {
// }
// func (getDividendsOrderQuery *GetDividendsOrderQuery) ValidateQuery() error {
// valid := validation.Validation{}
// b, err := valid.Valid(getDividendsOrderQuery)
// if err != nil {
// return err
// }
// if !b {
// for _, validErr := range valid.Errors {
// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
// }
// }
// return nil
// }
... ...
... ... @@ -57,6 +57,8 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen
result, err := creationCooperationGateway.DividendsOrderGet(allied_creation_cooperation.ReqDividendsOrderGet{
DividendsOrderId: getDividendsOrderQuery.DividendsOrderId,
DividendsOrderNumber: getDividendsOrderQuery.DividendsOrderNumber,
OrgId: getDividendsOrderQuery.OrgId,
CompanyId: int(getDividendsOrderQuery.Operator.CompanyId),
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -78,7 +78,10 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqC
req := gateway.CreateRequest(url, method)
if len(param.CooperationProjectNumber) > 0 {
req.Param("cooperationProjectNumber", param.CooperationProjectNumber)
req.Param("orgId", strconv.Itoa(param.OrgId))
req.Param("companyId", strconv.Itoa(param.CompanyId))
}
log.Logger.Debug("向业务模块请求数据:返回共创项目详情。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
... ...
... ... @@ -205,6 +205,8 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderGet(param ReqDivid
req := gateway.CreateRequest(url, method)
if len(param.DividendsOrderNumber) > 0 {
req.Param("dividendsOrderNumber", param.DividendsOrderNumber)
req.Param("orgId", strconv.Itoa(param.OrgId))
req.Param("companyId", strconv.Itoa(param.CompanyId))
}
fmt.Printf("=========>param %+v", param)
log.Logger.Debug("向业务模块请求数据:返回分红订单详情。", map[string]interface{}{
... ...
... ... @@ -118,6 +118,8 @@ type (
ReqCooperationProjectGet struct {
CooperationProjectId int
CooperationProjectNumber string
OrgId int
CompanyId int
}
DataCooperationProjectGet struct {
... ...
... ... @@ -173,8 +173,10 @@ type (
//返回分红订单详情
type (
ReqDividendsOrderGet struct {
DividendsOrderId int `json:"dividendsOrderId"`
DividendsOrderNumber string `json:"dividendsOrderNumber"`
DividendsOrderId int
DividendsOrderNumber string
OrgId int
CompanyId int
}
DataDividendsOrderGet struct {
... ...
... ... @@ -46,8 +46,10 @@ func (controller *CooperationProjectController) GetCooperationProject() {
getCooperationProjectQuery := &query.GetCooperationProjectQuery{}
projectId, _ := controller.GetInt(":projectId")
projectNumber := controller.GetString("cooperationProjectNumber")
orgId, _ := controller.GetInt("orgId")
getCooperationProjectQuery.CooperationProjectId = projectId
getCooperationProjectQuery.CooperationProjectNumber = projectNumber
getCooperationProjectQuery.OrgId = orgId
getCooperationProjectQuery.Operator = controller.GetOperator()
data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery)
controller.Response(data, err)
... ...
... ... @@ -61,7 +61,9 @@ func (controller *DividendsOrderController) GetDividendsOrder() {
getDividendsOrderQuery := &query.GetDividendsOrderQuery{}
orderId, _ := controller.GetInt(":orderId")
dividendsOrderNumber := controller.GetString("dividendsOrderNumber")
orgId, _ := controller.GetInt("orgId")
getDividendsOrderQuery.DividendsOrderId = orderId
getDividendsOrderQuery.OrgId = orgId
getDividendsOrderQuery.DividendsOrderNumber = dividendsOrderNumber
getDividendsOrderQuery.Operator = controller.GetOperator()
data, err := dividendsOrderService.GetDividendsOrder(getDividendsOrderQuery)
... ...