作者 tangxuhui

去除 不必要的校验

... ... @@ -14,9 +14,6 @@ type CooperationApplicationService struct {
// 审核共创申请
func (cooperationApplicationService *CooperationApplicationService) AuditCooperationApplication(
auditCooperationApplicationCommand *command.AuditCooperationApplicationCommand) (interface{}, error) {
if err := auditCooperationApplicationCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
auditCooperationApplicationCommand.Operator)
... ... @@ -35,9 +32,7 @@ func (cooperationApplicationService *CooperationApplicationService) AuditCoopera
// 返回共创申请管理
func (cooperationApplicationService *CooperationApplicationService) GetCooperationApplication(getCooperationApplicationQuery *query.GetCooperationApplicationQuery) (interface{}, error) {
if err := getCooperationApplicationQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationApplicationQuery.Operator)
applicationResult, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
CooperationApplicationId: getCooperationApplicationQuery.CooperationApplicationId,
... ...
... ... @@ -16,9 +16,7 @@ type CooperationContractService struct {
// 创建共创合约管理
func (cooperationContractService *CooperationContractService) CreateCooperationContract(createCooperationContractCommand *command.CreateCooperationContractCommand) (interface{}, error) {
if err := createCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationContractCommand.Operator)
rules1 := []allied_creation_cooperation.DividendsIncentivesRule{}
for _, v := range createCooperationContractCommand.DividendsIncentivesRules {
... ... @@ -84,9 +82,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
// 暂停恢复共创合约
func (cooperationContractService *CooperationContractService) EnableCooperationContract(enableCooperationContractCommand *command.EnableCooperationContractCommand) (interface{}, error) {
if err := enableCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(enableCooperationContractCommand.Operator)
_, err := creationCooperationGateway.CooperationContractsBatchOperate(allied_creation_cooperation.ReqCooperationContractsBatchOperate{
CooperationContractIds: enableCooperationContractCommand.CooperationContractId,
... ... @@ -100,9 +96,7 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC
// 返回共创合约详情
func (cooperationContractService *CooperationContractService) GetCooperationContract(getCooperationContractQuery *query.GetCooperationContractQuery) (interface{}, error) {
if err := getCooperationContractQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationContractQuery.Operator)
result, err := creationCooperationGateway.CooperationContractGet(allied_creation_cooperation.ReqCooperationContractGet{
CooperationContractId: getCooperationContractQuery.CooperationContractId,
... ... @@ -117,9 +111,7 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont
// 返回共创合约管理列表
func (cooperationContractService *CooperationContractService) ListCooperationContract(
listCooperationContractQuery *query.ListCooperationContractQuery) (int, interface{}, error) {
if err := listCooperationContractQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
PageNumber: listCooperationContractQuery.PageNumber,
... ... @@ -141,9 +133,7 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon
// 更新共创合约管理
func (cooperationContractService *CooperationContractService) UpdateCooperationContract(updateCooperationContractCommand *command.UpdateCooperationContractCommand) (interface{}, error) {
if err := updateCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationContractCommand.Operator)
rules1 := []allied_creation_cooperation.DividendsIncentivesRule{}
for _, v := range updateCooperationContractCommand.DividendsIncentivesRules {
... ...
... ... @@ -14,9 +14,7 @@ type CooperationModeService struct {
//CreateCooperationMode 创建共创模式服务
func (cooperationModeService *CooperationModeService) CreateCooperationMode(createCooperationModeCommand *command.CreateCooperationModeCommand) (interface{}, error) {
if err := createCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationModeCommand.Operator)
result, err := creationCooperationGateway.CooperationModeAdd(allied_creation_cooperation.ReqCooperationModeAdd{
CooperationModeName: createCooperationModeCommand.CooperationModeName,
... ... @@ -38,9 +36,6 @@ func (cooperationModeService *CooperationModeService) CreateCooperationMode(crea
//GetCooperationMode 返回共创模式服务
func (cooperationModeService *CooperationModeService) GetCooperationMode(getCooperationModeQuery *query.GetCooperationModeQuery) (interface{}, error) {
if err := getCooperationModeQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationModeQuery.Operator)
result, err := creationCooperationGateway.CooperationModeGet(allied_creation_cooperation.ReqCooperationModeGet{
... ... @@ -62,9 +57,7 @@ func (cooperationModeService *CooperationModeService) GetCooperationMode(getCoop
//ListCooperationMode 返回共创模式服务列表
func (cooperationModeService *CooperationModeService) ListCooperationMode(listCooperationModeQuery *query.ListCooperationModeQuery) (int64, interface{}, error) {
if err := listCooperationModeQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationModeQuery.Operator)
result, err := creationCooperationGateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{
PageNumber: listCooperationModeQuery.PageNumber,
... ... @@ -99,9 +92,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo
//RemoveCooperationMode 移除共创模式服务
func (cooperationModeService *CooperationModeService) RemoveCooperationMode(removeCooperationModeCommand *command.RemoveCooperationModeCommand) (interface{}, error) {
if err := removeCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeCooperationModeCommand.Operator)
_, err := creationCooperationGateway.CooperationModeBatchRemove(allied_creation_cooperation.ReqCooperationModeBatchRemove{
CooperationModeIds: removeCooperationModeCommand.CooperationModeId,
... ... @@ -114,9 +105,7 @@ func (cooperationModeService *CooperationModeService) RemoveCooperationMode(remo
//UpdateCooperationMode 更新共创模式
func (cooperationModeService *CooperationModeService) UpdateCooperationMode(updateCooperationModeCommand *command.UpdateCooperationModeCommand) (interface{}, error) {
if err := updateCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationModeCommand.Operator)
_, err := creationCooperationGateway.CooperationModeUpdate(allied_creation_cooperation.ReqCooperationModeUpdate{
CooperationModeId: updateCooperationModeCommand.CooperationModeId,
... ... @@ -132,9 +121,7 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda
// EnableCooperationMode 禁用启用共创模式
func (cooperationModeService *CooperationModeService) EnableCooperationMode(updateCooperationModeCommand *command.OperateCooperationModeCommand) (interface{}, error) {
if err := updateCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationModeCommand.Operator)
_, err := creationCooperationGateway.CooperationModeOperate(allied_creation_cooperation.ReqOperateCooperationMode{
CooperationModeId: updateCooperationModeCommand.CooperationModeId,
... ...
... ... @@ -16,9 +16,7 @@ type CooperationProjectService struct {
// 创建共创项目管理
func (cooperationProjectService *CooperationProjectService) CreateCooperationProject(createCooperationProjectCommand *command.CreateCooperationProjectCommand) (interface{}, error) {
if err := createCooperationProjectCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationProjectCommand.Operator)
result, err := creationCooperationGateway.CooperationProjectAdd(allied_creation_cooperation.ReqCooperationProjectAdd{
... ... @@ -47,9 +45,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
// 结束共创项目管理
func (cooperationProjectService *CooperationProjectService) EndCooperationProject(endCooperationProjectCommand *command.EndCooperationProjectCommand) (interface{}, error) {
if err := endCooperationProjectCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator)
_, err := creationCooperationGateway.CooperationProjectBatchEnd(allied_creation_cooperation.ReqCooperationProjectBatchEnd{
CooperationProjectIds: endCooperationProjectCommand.CooperationProjectId,
... ... @@ -62,9 +58,7 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec
// 返回共创项目管理
func (cooperationProjectService *CooperationProjectService) GetCooperationProject(getCooperationProjectQuery *query.GetCooperationProjectQuery) (interface{}, error) {
if err := getCooperationProjectQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationProjectQuery.Operator)
resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: getCooperationProjectQuery.CooperationProjectId,
... ... @@ -98,9 +92,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
// 返回共创项目管理列表
func (cooperationProjectService *CooperationProjectService) ListCooperationProject(listCooperationProjectQuery *query.ListCooperationProjectQuery) (int64, interface{}, error) {
if err := listCooperationProjectQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator)
result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: listCooperationProjectQuery.PageNumber,
... ... @@ -130,9 +122,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
// 更新共创项目管理
func (cooperationProjectService *CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) {
if err := updateCooperationProjectCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator)
_, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{
CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId,
... ...
... ... @@ -16,9 +16,7 @@ type DividendsOrderService struct {
// 创建分红订单实体对象
func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createDividendsOrderCommand *command.CreateDividendsOrderCommand) (interface{}, error) {
// if err := createDividendsOrderCommand.ValidateCommand(); err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, err.Error())
// }
orderGoods := []allied_creation_cooperation.DividendsOrderGoodAdd{}
for _, v := range createDividendsOrderCommand.OrderGoods {
good := allied_creation_cooperation.DividendsOrderGoodAdd{
... ... @@ -68,9 +66,6 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen
// 移除分红订单实体对象
func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeDividendsOrderCommand *command.RemoveDividendsOrderCommand) (interface{}, error) {
// if err := removeDividendsOrderCommand.ValidateCommand(); err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, err.Error())
// }
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsOrderCommand.Operator)
_, err := creationCooperationGateway.DividendsOrderBatchRemove(allied_creation_cooperation.ReqDividendsOrderBatchRemove{
... ... @@ -105,9 +100,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
// 更新分红订单实体对象
func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateDividendsOrderCommand *command.UpdateDividendsOrderCommand) (interface{}, error) {
// if err := updateDividendsOrderCommand.ValidateCommand(); err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, err.Error())
// }
orderGoods := []allied_creation_cooperation.DividendsOrderGoodAdd{}
for _, v := range updateDividendsOrderCommand.OrderGoods {
good := allied_creation_cooperation.DividendsOrderGoodAdd{
... ...
... ... @@ -17,9 +17,7 @@ type NoticeSettingService struct {
//NoticeSettingList 推送消息配置列表
func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettingListQuery *query.NoticeSettingListQuery) (int64, interface{}, error) {
if err := noticeSettingListQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
noticeSettingListQuery.Operator,
)
... ... @@ -73,9 +71,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin
//NoticeSettingProfile 推送消息配置需求的参数候选项
func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSettingProfileQuery *query.NoticeSettingProfileQuery) (interface{}, error) {
if err := noticeSettingProfileQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
noticeSettingProfileQuery.Operator,
)
... ... @@ -110,9 +106,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSett
// NoticeSettingUpdate 添加配置
func (noticeSettingService *NoticeSettingService) NoticeSettingAdd(noticeSettingAddCommand *command.NoticeSettingAddCommand) (interface{}, error) {
if err := noticeSettingAddCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
noticeSettingAddCommand.Operator,
)
... ... @@ -139,9 +133,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingAdd(noticeSetting
// NoticeSettingGet 获取配置
func (noticeSettingService *NoticeSettingService) NoticeSettingGet(noticeSettingGetQuery *query.NoticeSettingGetQuery) (interface{}, error) {
if err := noticeSettingGetQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
noticeSettingGetQuery.Operator,
)
... ...