作者 tangxuhui

添加 账期结算gateway

... ... @@ -198,7 +198,6 @@ func (cooperationContractService *CooperationContractService) SearchCooperationC
allied_creation_cooperation.ReqCooperationContractSearchByUndertaker{
CooperationContractName: queryParam.CooperationContractName,
SponsorName: queryParam.ContractSponsor,
UserId: 0,
PageNumber: queryParam.PageNumber,
PageIndex: queryParam.PageSize,
})
... ...
package dto
//MoneyIncentivesItem 金额激励分红列表
type MoneyIncentivesItem struct {
}
... ...
... ... @@ -13,7 +13,9 @@ type ListMoneyIncentivesQuery struct {
// 查询偏离量
PageNumber int `json:"pageNumber" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
PageSize int `json:"pageSize" valid:"Required"`
CooperationContractName string `json:"cooperationContractName"` //合约名称
DepartmentName string `json:"department"`
}
func (listMoneyIncentivesQuery *ListMoneyIncentivesQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -13,7 +13,9 @@ type SearchDividendsEstimateQuery struct {
// 承接人分红预算单号
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
// 分红类型,1订单分红,2退货冲销,3金额激励
DividendsType int `json:"dividendsType" valid:"Required"`
DividendsType int `json:"dividendsType"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
func (searchDividendsEstimateQuery *SearchDividendsEstimateQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -11,13 +11,15 @@ type SearchDividendsIncentivesQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 合约编号
CooperationContractNumber string `json:"cooperationContractNumber,omitempty"`
CooperationContractNumber string `json:"cooperationContractNumber"`
// 分红订单号/退货单号
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum,omitempty"`
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
func (searchDividendsIncentivesQuery *SearchDividendsIncentivesQuery) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (searchDividendsIncentivesQuery *SearchDividendsIncentivesQuery) ValidateQuery() error {
... ...
... ... @@ -9,13 +9,17 @@ import (
type SearchMoneyIncentivesQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创合约名称
CooperationContractName string `json:"cooperationContractName,omitempty"`
Operator domain.Operator `json:"-"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
//共创合约名称
CooperationContractName string `json:"cooperationContractName"`
//发起部门名称
DepartmentName string `json:"departmentName"`
}
func (searchMoneyIncentivesQuery *SearchMoneyIncentivesQuery) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (searchMoneyIncentivesQuery *SearchMoneyIncentivesQuery) ValidateQuery() error {
... ...
... ... @@ -38,68 +38,55 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive
return nil, nil
}
// 返回分红预算服务
func (dividendsEstimateService *DividendsEstimateService) GetDividendsEstimate(getDividendsEstimateQuery *query.GetDividendsEstimateQuery) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// getDividendsEstimateQuery.Operator)
return nil, nil
}
// 返回分红预算服务列表
func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate(listDividendsEstimateQuery *query.ListDividendsEstimateQuery) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// listDividendsEstimateQuery.Operator)
return nil, nil
}
// 返回业绩激励分红
func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentives(listDividendsIncentivesQuery *query.ListDividendsIncentivesQuery) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// listDividendsIncentivesQuery.Operator)
return nil, nil
}
// 返回金额激励分红
func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentives(listMoneyIncentivesQue *query.ListMoneyIncentivesQuery) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// listMoneyIncentivesQue.Operator)
return nil, nil
}
// 移除分红预算服务
func (dividendsEstimateService *DividendsEstimateService) RemoveDividendsEstimate(removeDividendsEstimateCommand *command.RemoveDividendsEstimateCommand) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// removeDividendsEstimateCommand.Operator)
return nil, nil
}
// 查询分红预算单
// 查询分红预算单列表
func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimate(searchDividendsEstimateQuery *query.SearchDividendsEstimateQuery) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// searchDividendsEstimateQuery.Operator)
return nil, nil
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
searchDividendsEstimateQuery.Operator)
result, err := creationCooperationGateway.DividendsEstimatesSearch(allied_creation_cooperation.ReqDividendsEstimateSearch{
//承接人分红预算单号
DividendsEstimateOrderNumber: searchDividendsEstimateQuery.DividendsEstimateOrderNumber,
//分红类型,1订单分红,2退货冲销,3金额激励
DividendsType: searchDividendsEstimateQuery.DividendsType,
PageNumber: searchDividendsEstimateQuery.PageNumber,
PageSize: searchDividendsEstimateQuery.PageSize,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
// 查询业绩分红
func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncentives(searchDividendsIncentivesQuery *query.SearchDividendsIncentivesQuery) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// searchDividendsIncentivesQuery.Operator)
return nil, nil
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
searchDividendsIncentivesQuery.Operator)
result, err := creationCooperationGateway.DividendsEstimateSearchDividends(
allied_creation_cooperation.ReqDividendsEstimateSearchDividend{
PageNumber: searchDividendsIncentivesQuery.PageNumber,
PageSize: searchDividendsIncentivesQuery.PageSize,
CooperationContractNumber: searchDividendsIncentivesQuery.CooperationContractNumber,
OrderOrReturnedOrderNum: searchDividendsIncentivesQuery.OrderOrReturnedOrderNum,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
// 查询金额激励分红
func (dividendsEmmateService *DividendsEstimateService) SearchMoneyIncentives(searchMoneyIncentivesQuery *query.SearchMoneyIncentivesQuery) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// searchMoneyIncentivesQuery.Operator)
return nil, nil
}
// 更新分红预算服务
func (dividendsEstimateService *DividendsEstimateService) UpdateDividendsEstimate(updateDividendsEstimateCommand *command.UpdateDividendsEstimateCommand) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// updateDividendsEstimateCommand.Operator)
return nil, nil
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
searchMoneyIncentivesQuery.Operator)
result, err := creationCooperationGateway.DividendsEstimatesSearchMoney(allied_creation_cooperation.ReqDividendsEstimateSearchMoney{
PageNumber: searchMoneyIncentivesQuery.PageNumber,
PageSize: searchMoneyIncentivesQuery.PageSize,
CooperationContractName: searchMoneyIncentivesQuery.CooperationContractName,
DepartmentName: searchMoneyIncentivesQuery.DepartmentName,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
func NewDividendsEstimateService(options map[string]interface{}) *DividendsEstimateService {
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
// CreditAccountCreate 创建账期结算单
func (gateway HttplibAlliedCreationCooperation) CreditAccountCreate(param ReqCreditAccountCreate) (*DataCreditAccountCreate, error) {
url := gateway.baseUrL + "/credit-accounts"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:创建账期结算单。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求创建账期结算单失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取创建账期结算单失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:创建账期结算单。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析创建账期结算单:%w", err)
}
var data DataCreditAccountCreate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Credit-accountsPay 支付账期结算
func (gateway HttplibAlliedCreationCooperation) CreditAccountsPay(param ReqCreditAccountsPay) (*DataCreditAccountsPay, error) {
url := gateway.baseUrL + "/credit-accounts/pay"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:支付账期结算。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求支付账期结算失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取支付账期结算失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:支付账期结算。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析支付账期结算:%w", err)
}
var data DataCreditAccountsPay
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Credit-accounts[creditAccountId} 更新账期结算单
func (gateway HttplibAlliedCreationCooperation) CreditAccountUpdate(param ReqCreditAccountUpdate) (*DataCreditAccountUpdate, error) {
url := gateway.baseUrL + "/credit-accounts/{creditAccountId}"
method := "PUT"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:更新账期结算单。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求更新账期结算单失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取更新账期结算单失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:更新账期结算单。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析更新账期结算单:%w", err)
}
var data DataCreditAccountUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// Credit-accountsSearch 查询账期结算单
func (gateway HttplibAlliedCreationCooperation) CreditAccountsSearch(param ReqCreditAccountsSearch) (*DataCreditAccountsSearch, error) {
url := gateway.baseUrL + "/credit-accounts/search"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:查询账期结算单。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求查询账期结算单失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取查询账期结算单失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:查询账期结算单。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析查询账期结算单:%w", err)
}
var data DataCreditAccountsSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CreditAccountRemove 移除账期结算单
func (gateway HttplibAlliedCreationCooperation) CreditAccountRemove(param ReqCreditAccountRemove) (*DataCreditAccountRemove, error) {
url := gateway.baseUrL + "/credit-accounts/" + strconv.Itoa(param.CreditAccountId)
method := "DELETE"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:移除账期结算单。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求移除账期结算单失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取移除账期结算单失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:移除账期结算单。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析移除账期结算单:%w", err)
}
var data DataCreditAccountRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CreditAccountList 返回账期结算单列表
func (gateway HttplibAlliedCreationCooperation) CreditAccountList(param ReqCreditAccountList) (*DataCreditAccountList, error) {
url := gateway.baseUrL + "/credit-accounts"
method := "GET"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:返回账期结算单列表。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求返回账期结算单列表失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取返回账期结算单列表失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:返回账期结算单列表。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析返回账期结算单列表:%w", err)
}
var data DataCreditAccountList
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CreditAccountGet 返回账期结算单详情
func (gateway HttplibAlliedCreationCooperation) CreditAccountGet(param ReqCreditAccountGet) (*DataCreditAccountGet, error) {
url := gateway.baseUrL + "/credit-accounts/" + strconv.Itoa(param.CreditAccountId)
method := "GET"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:返回账期结算单详情。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求返回账期结算单详情失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取返回账期结算单详情失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:返回账期结算单详情。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析返回账期结算单详情:%w", err)
}
var data DataCreditAccountGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -195,38 +195,6 @@ func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesEstimateMoneys
return &data, err
}
// DividendAestimatesdivDidendsEstimat 移除分红预算
func (gateway HttplibAlliedCreationCooperation) DividendAestimatesdivDidendsEstimat(param ReqDividendsEstimateRemove) (
*DataDividendsEstimateRemove, error) {
url := gateway.baseUrL + "/dividends-estimates/" + strconv.Itoa(param.DividendsEstimateId)
method := "DELETE"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:移除分红预算。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求移除分红预算失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取移除分红预算失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:移除分红预算。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析移除分红预算:%w", err)
}
var data DataDividendsEstimateRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimateListDividend 返回业绩激励分红详情
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateListDividend(param ReqDividendsEstimateListDividend) (*DataDividendsEstimateListDividend, error) {
url := gateway.baseUrL + "/dividends-estimates/list-dividends-incentives"
... ... @@ -351,7 +319,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesListMoney(para
return &data, err
}
// DividendsEstimatesBatchCancel 取消分红预算
// DividendsEstimatesBatchCancel 批量取消分红预算
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesBatchCancel(param ReqDividendsEstimateBatchCancel) (*DataDividendsEstimateBatchCancel, error) {
url := gateway.baseUrL + "/dividends-estimates/batch-cancel"
method := "POST"
... ...
... ... @@ -215,7 +215,6 @@ type (
ReqCooperationContractSearchByUndertaker struct {
CooperationContractName string `json:"cooperationContractName"` //合约名称
SponsorName string `json:"sponsorName"` //项目发起人姓名
UserId int `json:"userId"` //合约发起人
PageNumber int `json:"pageNumber"`
PageIndex int `json:"pageIndex"`
}
... ...
package allied_creation_cooperation
//创建账期结算单
type (
ReqCreditAccountCreate struct {
}
DataCreditAccountCreate struct {
}
)
//支付账期结算
type (
ReqCreditAccountsPay struct {
}
DataCreditAccountsPay struct {
}
)
//更新账期结算单
type (
ReqCreditAccountUpdate struct {
}
DataCreditAccountUpdate struct {
}
)
//查询账期结算单
type (
ReqCreditAccountsSearch struct {
}
DataCreditAccountsSearch struct {
}
)
//移除账期结算单
type (
ReqCreditAccountRemove struct {
CreditAccountId int
}
DataCreditAccountRemove struct {
}
)
//返回账期结算单列表
type (
ReqCreditAccountList struct {
}
DataCreditAccountList struct {
}
)
//返回账期结算单详情
type (
ReqCreditAccountGet struct {
CreditAccountId int
}
DataCreditAccountGet struct {
}
)
... ...
... ... @@ -14,6 +14,10 @@ type (
}
DataDividendsEstimateSearchDividend struct {
Grid struct {
Total int `json:"total"`
List []struct{} `json:"list"`
} `json:"grid"`
}
)
... ... @@ -75,10 +79,31 @@ type (
DataDividendsEstimateSearchMoney struct {
Grid struct {
Total int
Total int `json:"total"`
List []struct {
}
}
CooperationContractName string `json:"cooperationContractName"` //合约名称
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码
CooperationMode struct {
CooperationModeId int `json:"cooperationModeId"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
} `json:"cooperationMode"` //共创模式
CreatedAt time.Time `json:"createdAt"` //合约建立时间
Department struct {
DepartmentId int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
} `json:"department"` //发起部门
CooperationContractSponsor struct {
UserId int `json:"userId"`
UserInfo struct {
UsersName string `json:"userName"`
Phone string `json:"phone"`
UsersId int `json:"userId,string"`
UserCode string `json:"userCode"`
} `json:"userInfo"`
} `json:"cooperationContractSponsor"` //合约发起人
} `json:"list"`
} `json:"grid"`
}
)
... ... @@ -95,22 +120,15 @@ type (
//确定预算金额激励分红
type (
ReqDividendsEstimateMoneyIncentives struct {
//合约编码
CooperationContractNumber string
//
}
DataDividendsEstimateMoneyIncentives struct {
}
)
//移除分红预算
type (
ReqDividendsEstimateRemove struct {
DividendsEstimateId int `json:"dividendsEstimateId"`
}
DataDividendsEstimateRemove struct {
}
)
//返回业绩激励分红详情
type (
ReqDividendsEstimateListDividend struct {
... ... @@ -126,6 +144,10 @@ type (
}
DataDividendsEstimateList struct {
Grid struct {
Total int
List []struct{}
}
}
)
... ... @@ -170,6 +192,10 @@ type (
}
DataDividendsEstimatesListMoney struct {
Grid struct {
Total int `json:"total"`
List []struct{} `json:"list"`
} `json:"grid"`
}
)
... ...