作者 yangfu
正在显示 23 个修改的文件 包含 956 行增加143 行删除
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628752601441259500}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628818869330120900}
\ No newline at end of file
... ...
... ... @@ -112,7 +112,6 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
DepartmentName: v.Department.DepartmentName,
}}
relevants = append(relevants, r)
}
for _, v := range param.DividendsIncentivesRules {
... ...
... ... @@ -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 command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CancelDividendsEstimateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
DividendsEstimateId []string `json:"dividendsEstimateId"`
}
func (cancelDividendsEstimateCommand *CancelDividendsEstimateCommand) Valid(validation *validation.Validation) {
}
func (cancelDividendsEstimateCommand *CancelDividendsEstimateCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cancelDividendsEstimateCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type EstimateDividendsIncentivesCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 分红订单号/退货单号
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum" valid:"Required"`
// 合约编号
CooperationContractNumber string `json:"cooperationContractNumber" valid:"Required"`
}
func (estimateDividendsIncentivesCommand *EstimateDividendsIncentivesCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (estimateDividendsIncentivesCommand *EstimateDividendsIncentivesCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(estimateDividendsIncentivesCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type EstimateMoneyIncentivesCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目合约编号
CooperationContractNumber string `json:"cooperationContractNumber" valid:"Required"`
// 承接人UID
UndertakerUid string `json:"undertakerUid,omitempty"`
}
func (estimateMoneyIncentivesCommand *EstimateMoneyIncentivesCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (estimateMoneyIncentivesCommand *EstimateMoneyIncentivesCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(estimateMoneyIncentivesCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type RemoveDividendsEstimateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 承接人分红预算记录ID
DividendsEstimateId int64 `json:"dividendsEstimateId" valid:"Required"`
}
func (removeDividendsEstimateCommand *RemoveDividendsEstimateCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (removeDividendsEstimateCommand *RemoveDividendsEstimateCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(removeDividendsEstimateCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type UpdateDividendsEstimateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 承接人分红预算记录ID
DividendsEstimateId int64 `json:"dividendsEstimateId" valid:"Required"`
}
func (updateDividendsEstimateCommand *UpdateDividendsEstimateCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (updateDividendsEstimateCommand *UpdateDividendsEstimateCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateDividendsEstimateCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package dto
//MoneyIncentivesItem 金额激励分红列表
type MoneyIncentivesItem struct {
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type GetDividendsEstimateQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 承接人分红预算记录ID
DividendsEstimateId int64 `json:"dividendsEstimateId" valid:"Required"`
}
func (getDividendsEstimateQuery *GetDividendsEstimateQuery) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (getDividendsEstimateQuery *GetDividendsEstimateQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(getDividendsEstimateQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ListDividendsEstimateQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber" `
// 查询限制
PageSize int `json:"pageSize"`
}
func (listDividendsEstimateQuery *ListDividendsEstimateQuery) Valid(validation *validation.Validation) {
}
func (listDividendsEstimateQuery *ListDividendsEstimateQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listDividendsEstimateQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ListDividendsIncentivesQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber" `
// 查询限制
PageSize int `json:"pageSize" `
}
func (listDividendsIncentivesQuery *ListDividendsIncentivesQuery) Valid(validation *validation.Validation) {
}
func (listDividendsIncentivesQuery *ListDividendsIncentivesQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listDividendsIncentivesQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ListMoneyIncentivesQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
CooperationContractName string `json:"cooperationContractName"` //合约名称
DepartmentName string `json:"department"`
}
func (listMoneyIncentivesQuery *ListMoneyIncentivesQuery) Valid(validation *validation.Validation) {
}
func (listMoneyIncentivesQuery *ListMoneyIncentivesQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listMoneyIncentivesQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type SearchDividendsEstimateQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 承接人分红预算单号
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
// 分红类型,1订单分红,2退货冲销,3金额激励
DividendsType int `json:"dividendsType"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
func (searchDividendsEstimateQuery *SearchDividendsEstimateQuery) Valid(validation *validation.Validation) {
}
func (searchDividendsEstimateQuery *SearchDividendsEstimateQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(searchDividendsEstimateQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type SearchDividendsIncentivesQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 分红订单号/退货单号
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
func (searchDividendsIncentivesQuery *SearchDividendsIncentivesQuery) Valid(validation *validation.Validation) {
}
func (searchDividendsIncentivesQuery *SearchDividendsIncentivesQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(searchDividendsIncentivesQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type SearchMoneyIncentivesQuery struct {
//操作人
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) {
}
func (searchMoneyIncentivesQuery *SearchMoneyIncentivesQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(searchMoneyIncentivesQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsEstimate/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsEstimate/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
// 分红预算管理
type DividendsEstimateService struct {
}
//piliao 取消分红预算
func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimate(cancelDividendsEstimateCommand *command.CancelDividendsEstimateCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(cancelDividendsEstimateCommand.Operator)
_, err := creationCooperationGateway.DividendsEstimatesBatchCancel(allied_creation_cooperation.ReqDividendsEstimateBatchCancel{
DividendsEstimateIds: cancelDividendsEstimateCommand.DividendsEstimateId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return cancelDividendsEstimateCommand, nil
}
// 确定预算分红激励
func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncentives(estimateDividendsIncentivesCommand *command.EstimateDividendsIncentivesCommand) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// estimateDividendsIncentivesCommand.Operator)
return nil, nil
}
// 确定预算金额激励分红
func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentives(estimateMoneyIncentivesCommand *command.EstimateMoneyIncentivesCommand) (interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// estimateMoneyIncentivesCommand.Operator)
return nil, nil
}
// 查询分红预算单列表
func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimate(searchDividendsEstimateQuery *query.SearchDividendsEstimateQuery) (interface{}, error) {
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)
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)
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 {
newDividendsEstimateService := &DividendsEstimateService{}
return newDividendsEstimateService
}
... ...
... ... @@ -15,10 +15,10 @@ var HTTP_PORT int = 8083
var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
//天联共创用户模块
var ALLIED_CREATION_USER_HOST = "http://localhost:8081"
var ALLIED_CREATION_USER_HOST = "http://allied-creation-user-dev.fjmaimaimai.com"
//天联共创业务模块
var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082"
var ALLIED_CREATION_COOPERATION_HOST = "http://allied-creation-cooperation-dev.fjmaimaimai.com"
//通用模块短信服务
var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897"
... ...
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
}
... ...
... ... @@ -9,67 +9,36 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
// DividendsEstimateIncentive 确定预算分红激励
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateIncentive(param ReqDividendsEstimateIncentive) (*DataDividendsEstimateIncentive, error) {
url := gateway.baseUrL + "/dividends-estimates/estimate-dividends-incentives"
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 DataDividendsEstimateIncentive
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimateUpdate 更新分红预算
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateUpdate(param ReqDividendsEstimateUpdate) (*DataDividendsEstimateUpdate, error) {
url := gateway.baseUrL + "/dividends-estimates/{dividendsEstimateId}"
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)
}
// func (gateway HttplibAlliedCreationCooperation) DividendsEstimateUpdate(param ReqDividendsEstimateUpdate) (*DataDividendsEstimateUpdate, error) {
// url := gateway.baseUrL + "/dividends-estimates/{dividendsEstimateId}"
// 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 DataDividendsEstimateUpdate
err = gateway.GetResponseData(result, &data)
return &data, 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 DataDividendsEstimateUpdate
// err = gateway.GetResponseData(result, &data)
// return &data, err
// }
// Dividends-estimatesSearch-dividends-incentives 查询业绩分红
func (gateway HttplibAlliedCreationCooperation) DividendsEstimateSearchDividends(param ReqDividendsEstimateSearchDividend) (*DataDividendsEstimateSearchDividend, error) {
... ... @@ -226,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"
... ... @@ -381,3 +318,34 @@ func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesListMoney(para
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsEstimatesBatchCancel 批量取消分红预算
func (gateway HttplibAlliedCreationCooperation) DividendsEstimatesBatchCancel(param ReqDividendsEstimateBatchCancel) (*DataDividendsEstimateBatchCancel, error) {
url := gateway.baseUrL + "/dividends-estimates/batch-cancel"
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 DataDividendsEstimateBatchCancel
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -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 {
}
)
... ...
... ... @@ -2,91 +2,115 @@ package allied_creation_cooperation
import "time"
//确定预算分红激励
type (
ReqDividendsEstimateIncentive struct {
CooperationContractNumber string //合约编号
OrderOrReturnedOrderNum string //分红订单号/退货单号
}
DataDividendsEstimateIncentive struct {
}
)
//更新分红预算
type (
ReqDividendsEstimateUpdate struct {
}
DataDividendsEstimateUpdate struct {
}
)
//查询业绩分红
type (
ReqDividendsEstimateSearchDividend struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
//合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
//分红订单号/退货单号
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
}
DataDividendsEstimateSearchDividend struct {
Grid struct {
Total int `json:"total"`
List []struct{} `json:"list"`
} `json:"grid"`
}
)
//查询分红预算单
type (
ReqDividendsEstimateSearch struct {
//承接人分红预算单号
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
//分红类型,1订单分红,2退货冲销,3金额激励
DividendsType int `json:"dividendsType"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
DataDividendsEstimateSearch struct {
Grid struct {
Total int
Total int `json:"total"`
List []struct {
DividendsEstimateId int64 `json:"dividendsEstimateId,string"` // 承接人分红预算记录ID
DividendsAccountStatus int32 `json:"dividendsAccountStatus"` // 分红结算状态
DividendsEstimateId int `json:"dividendsEstimateId,string,"` // 承接人分红预算记录ID
DividendsAccountStatus int `json:"dividendsAccountStatus"` // 分红结算状态
DividendsAmount float64 `json:"dividendsAmount"` // 分红金额
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` // 承接人分红预算单号
DividendsEstimateTime time.Time `json:"dividendsEstimateTime"` // 分红预算时间
DividendsParticipateType int32 `json:"dividendsParticipateType"` // 参与分红类型,1承接人,2推荐人,3关联业务员
DividendsType int32 `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
DividendsParticipateType int `json:"dividendsParticipateType"` // 参与分红类型,1承接人,2推荐人,3关联业务员
DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
DividendsUser struct {
UserId int64 `json:"userId,string"` // 用户ID,
UserBaseId int64 `json:"userBaseId,string"` // 用户基本id
UserType int32 `json:"userType"` // 用户类型
UserId int `json:"userId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
UserType int `json:"userType"` // 用户类型
} `json:"dividendsUser"` // 分红用户
Org struct {
OrgId int64 `json:"orgId,string"` // 组织机构ID
OrgId int `json:"orgId,string,"` // 组织机构ID
OrgName string `json:"orgName"` // 组织名称
} `json:"org"` // 数据所属组织机构
Company struct {
CompanyId int64 `json:"companyId,string"` // 公司ID,
CompanyId int `json:"companyId,string,"` // 公司ID,
CompanyLogo string `json:"companyLogo"` // 公司logo
CompanyName string `json:"companyName"` // 公司名称
} `json:"company"` // 公司
CreatedAt time.Time `json:"createdAt"` // 创建时间
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
}
}
} `json:"list"`
} `json:"grid"`
}
)
//查询金额激励分红
type (
ReqDividendsEstimateSearchMoney struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
//共创合约名称
CooperationContractName string `json:"cooperationContractName"`
//发起部门名称
DepartmentName string `json:"departmentName"`
}
DataDividendsEstimateSearchMoney struct {
Grid struct {
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"`
}
)
//取消分红预算
type (
ReqDividendsEstimateCancel struct {
DividendsEstimateId int
DividendsEstimateId int `json:"dividendsEstimateId"`
}
DataDividendsEstimateCancel struct {
... ... @@ -96,22 +120,15 @@ type (
//确定预算金额激励分红
type (
ReqDividendsEstimateMoneyIncentives struct {
//合约编码
CooperationContractNumber string
//
}
DataDividendsEstimateMoneyIncentives struct {
}
)
//移除分红预算
type (
ReqDividendsEstimateRemove struct {
DividendsEstimateId int
}
DataDividendsEstimateRemove struct {
}
)
//返回业绩激励分红详情
type (
ReqDividendsEstimateListDividend struct {
... ... @@ -127,13 +144,17 @@ type (
}
DataDividendsEstimateList struct {
Grid struct {
Total int
List []struct{}
}
}
)
//返回分红预算详情
type (
ReqDividendsEstimateGet struct {
DividendsEstimateId int
DividendsEstimateId int `json:"dividendsEstimateId"`
}
DataDividendsEstimateGet struct {
... ... @@ -171,5 +192,19 @@ type (
}
DataDividendsEstimatesListMoney struct {
Grid struct {
Total int `json:"total"`
List []struct{} `json:"list"`
} `json:"grid"`
}
)
//取消分红预算
type (
ReqDividendsEstimateBatchCancel struct {
DividendsEstimateIds []string `json:"dividendsEstimateIds"`
}
DataDividendsEstimateBatchCancel struct {
}
)
... ...