作者 yangfu
... ... @@ -25,7 +25,7 @@ type CreateCooperationContractCommand struct {
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 共创合约发起人uid
SponsorUid string `json:"sponsorUid"`
SponsorUserId string `json:"sponsorUserId"`
} `json:"cooperationContract"`
// 业绩分红激励规则列表
DividendsIncentivesRules []struct {
... ... @@ -63,9 +63,10 @@ type CreateCooperationContractCommand struct {
} `json:"moneyIncentivesRules"`
// 承接方列表
Undertakers []struct {
UndertakerId string `json:"undertakerId"` //承接人用户id
RerferrerId string `json:"rerferrerId"` //推荐人用户id
SalesmanId string `json:"salesmanId"` //关联业务员id
UndertakerId int `json:"undertakerId,string"` //承接人列表id
UserId int `json:"userId,string"` //用户的id
RerferrerId int `json:"rerferrerId,string"` //推荐人用户id
SalesmanId int `json:"salesmanId,string"` //关联业务员id
Attachment []domain.Attachment `json:"attachment"`
} `json:"undertakers"`
//关联业务员
... ...
... ... @@ -13,7 +13,7 @@ type EnableCooperationContractCommand struct {
// 共创合约ID
CooperationContractId []string `json:"cooperationContractId" valid:"Required"`
// 暂停和恢复的状态
Status int `json:"status,omitempty"`
Status int `json:"status"` //暂停或恢复合约动作,1恢复,2暂停
}
func (enableCooperationContractCommand *EnableCooperationContractCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -27,7 +27,7 @@ type UpdateCooperationContractCommand struct {
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 共创合约发起人uid
SponsorUid string `json:"sponsorUid"`
SponsorUserId string `json:"sponsorUserId"`
} `json:"cooperationContract"`
// 业绩分红激励规则列表
DividendsIncentivesRules []struct {
... ... @@ -38,13 +38,13 @@ type UpdateCooperationContractCommand struct {
// 业务员抽成比例
SalesmanPercentage float64 `json:"salesmanPercentage"`
// 分红规则激励百分点
DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"`
DividendsPercentage float64 `json:"dividendsPercentage"`
// 分红规则激励阶段,
DividendsIncentivesStage int `json:"dividendsIncentivesStage,string,"`
DividendsStage int `json:"dividendsStage"`
// 分红规则激励阶段结束
DividendsIncentivesStageEnd int `json:"dividendsIncentivesStageEnd"`
DividendsStageEnd int `json:"dividendsStageEnd"`
// 分红规则激励阶段开始
DividendsIncentivesStageStart int `json:"dividendsIncentivesStageStart"`
DividendsStageStart int `json:"dividendsStageStart"`
} `json:"dividendsIncentivesRules"`
// 金额激励规则列表
MoneyIncentivesRules []struct {
... ... @@ -65,9 +65,10 @@ type UpdateCooperationContractCommand struct {
} `json:"moneyIncentivesRules"`
// 承接方列表
Undertakers []struct {
UndertakerId string `json:"undertakerId"` //承接人用户id
RerferrerId string `json:"rerferrerId"` //推荐人用户id
SalesmanId string `json:"salesmanId"` //关联业务员id
UndertakerId int `json:"undertakerId,string"` //承接人列表id
UserId int `json:"userId,string"` //用户id
RerferrerId int `json:"rerferrerId,string"` //推荐人用户id
SalesmanId int `json:"salesmanId,string"` //关联业务员id
Attachment []domain.Attachment `json:"attachment"`
} `json:"undertakers"`
//关联业务员
... ...
... ... @@ -9,9 +9,9 @@ type CooperationContractItem struct {
CooperationContractId int `json:"cooperationContractId,string,"`
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationContractName string `json:"CooperationContractName"` //合约名称
CooperationContractName string `json:"cooperationContractName"` //合约名称
Status int `json:"status"` //合约状态
CreateTtime int `json:"createTtime"`
CreateTime int `json:"createTime"`
Department domain.Department `json:"department"`
IncentivesType string `json:"incentivesType"` //Incentives激励方式
CooperationContractSponsor struct {
... ... @@ -20,16 +20,24 @@ type CooperationContractItem struct {
} `json:"cooperationContractSponsor"` //共创发起人
CooperationMode domain.CooperationMode `json:"cooperationMode"` //共创模式
Org domain.Org `json:"org"` //组织结构
CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开
CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述
}
func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem {
cooperationContractUndertakerType := param.CooperationContractUndertakerTypes
if len(cooperationContractUndertakerType) == 0 {
cooperationContractUndertakerType = []int{}
}
data := CooperationContractItem{
CooperationContractUndertakerType: cooperationContractUndertakerType,
CooperationContractDescription: param.CooperationContractDescription,
CooperationContractId: param.CooperationContractId,
CooperationProjectNumber: param.CooperationContractNumber,
CooperationContractName: param.CooperationContractName,
CooperationContractNumber: param.CooperationContractNumber,
Status: param.Status,
CreateTtime: int(param.CreatedAt.Unix()),
CreateTime: int(param.CreatedAt.UnixNano() / 1e6),
}
data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId
data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
... ... @@ -76,6 +84,7 @@ type Relevant struct {
}
type ContractUndertaker struct {
UndertakerId int `json:"undertakerId,string"`
Attachment []domain.Attachment `json:"attachment"`
Department domain.Department `json:"department"`
HasReferrer bool `json:"hasReferrer"`
... ... @@ -90,6 +99,7 @@ type CooperationContractInfo struct {
DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"`
MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
ContractUndertaker []ContractUndertaker `json:"contractUndertaker"`
UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` // 可以去除勾选的共创项目承接对象列表
}
func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract) *CooperationContractInfo {
... ... @@ -122,8 +132,8 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
SalesmanPercentage: v.SalesmanPercentage,
DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,
DividendsIncentivesStage: v.DividendsIncentivesStage,
DividendsIncentivesStageEnd: v.DividendsIncentivesStageEnd.Unix(),
DividendsIncentivesStageStart: v.DividendsIncentivesStageStart.Unix(),
DividendsIncentivesStageEnd: v.DividendsIncentivesStageEnd.UnixNano() / 1e6,
DividendsIncentivesStageStart: v.DividendsIncentivesStageStart.UnixNano() / 1e6,
}
dividendsIncentivesRules = append(dividendsIncentivesRules, r)
}
... ... @@ -134,7 +144,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
CooperationContractNumber: v.CooperationContractNumber,
MoneyIncentivesAmount: v.MoneyIncentivesAmount,
MoneyIncentivesStage: v.MoneyIncentivesStage,
MoneyIncentivesTime: v.MoneyIncentivesTime.Unix(),
MoneyIncentivesTime: v.MoneyIncentivesTime.UnixNano() / 1e6,
ReferrerPercentage: v.ReferrerPercentage,
SalesmanPercentage: v.SalesmanPercentage,
}
... ... @@ -162,6 +172,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
UsersId: v.Salesman.UserId,
Phone: v.Salesman.UserInfo.UserPhone,
},
UndertakerId: v.UndertakerId,
UserInfo: domain.UserInfo{
UsersName: v.UserInfo.UserName,
UsersId: v.UserId,
... ... @@ -170,12 +181,17 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
}
contractUndertaker = append(contractUndertaker, u)
}
undertakerTypesUncheckedAvailable := param.UndertakerTypesUncheckedAvailable
if len(undertakerTypesUncheckedAvailable) == 0 {
undertakerTypesUncheckedAvailable = []int{}
}
data := CooperationContractInfo{
CooperationContract: *ToCooperationContractItem(param),
Relevant: relevants,
DividendsIncentivesRules: dividendsIncentivesRules,
MoneyIncentivesRules: moneyIncentivesRules,
ContractUndertaker: contractUndertaker,
UndertakerTypesUncheckedAvailable: undertakerTypesUncheckedAvailable,
}
return &data
... ...
... ... @@ -50,13 +50,14 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
for _, v := range createCooperationContractCommand.Undertakers {
u := allied_creation_cooperation.Undertaker{
UndertakerId: v.UndertakerId,
RerferrerId: v.RerferrerId,
UserId: v.UserId,
ReferrerId: v.RerferrerId,
SalesmanId: v.SalesmanId,
Attachment: v.Attachment,
}
underTakers = append(underTakers, u)
}
_, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
result, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
MoneyIncentivesRules: rules2,
DividendsIncentivesRules: rules1,
Undertakers: underTakers,
... ... @@ -67,7 +68,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
CooperationContractUndertakerType: createCooperationContractCommand.CooperationContract.CooperationContractUndertakerType,
CooperationContractName: createCooperationContractCommand.CooperationContract.CooperationContractName,
CooperationModeNumber: createCooperationContractCommand.CooperationContract.CooperationModeNumber,
SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUid,
SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUserId,
CompanyId: int(createCooperationContractCommand.Operator.CompanyId),
UserId: int(createCooperationContractCommand.Operator.UserId),
UserBaseId: int(createCooperationContractCommand.Operator.UserBaseId),
... ... @@ -76,7 +77,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return createCooperationContractCommand, err
return dto.ToCooperationContractInfo(&result.CooperationContract), err
}
// 暂停恢复共创合约
... ... @@ -84,8 +85,15 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC
if err := enableCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
return nil, nil
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(enableCooperationContractCommand.Operator)
_, err := creationCooperationGateway.CooperationContractsBatchOperate(allied_creation_cooperation.ReqCooperationContractsBatchOperate{
CooperationContractIds: enableCooperationContractCommand.CooperationContractId,
Action: enableCooperationContractCommand.Status,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return enableCooperationContractCommand, nil
}
// 返回共创合约详情
... ... @@ -141,10 +149,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
CooperationContractNumber: v.CooperationContractNumber,
ReferrerPercentage: v.ReferrerPercentage,
SalesmanPercentage: v.SalesmanPercentage,
DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,
DividendsIncentivesStage: v.DividendsIncentivesStage,
DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsIncentivesStageEnd/1e3), 0),
DividendsIncentivesStageStart: time.Unix(int64(v.DividendsIncentivesStageStart/1e3), 0),
DividendsIncentivesPercentage: v.DividendsPercentage,
DividendsIncentivesStage: v.DividendsStage,
DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsStageEnd/1e3), 0),
DividendsIncentivesStageStart: time.Unix(int64(v.DividendsStageStart/1e3), 0),
}
rules1 = append(rules1, r)
}
... ... @@ -165,13 +173,14 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
for _, v := range updateCooperationContractCommand.Undertakers {
u := allied_creation_cooperation.Undertaker{
UndertakerId: v.UndertakerId,
RerferrerId: v.RerferrerId,
UserId: v.UserId,
ReferrerId: v.RerferrerId,
SalesmanId: v.SalesmanId,
Attachment: v.Attachment,
}
underTakers = append(underTakers, u)
}
_, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
result, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
CooperationContractId: updateCooperationContractCommand.CooperationContract.CooperationContractId,
MoneyIncentivesRules: rules2,
DividendsIncentivesRules: rules1,
... ... @@ -184,7 +193,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
CooperationContractUndertakerType: updateCooperationContractCommand.CooperationContract.CooperationContractUndertakerType,
CooperationContractName: updateCooperationContractCommand.CooperationContract.CooperationContractName,
CooperationModeNumber: updateCooperationContractCommand.CooperationContract.CooperationModeNumber,
SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUid,
SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUserId,
CompanyId: int(updateCooperationContractCommand.Operator.CompanyId),
UserId: int(updateCooperationContractCommand.Operator.UserId),
UserBaseId: int(updateCooperationContractCommand.Operator.UserBaseId),
... ... @@ -193,7 +202,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
return dto.ToCooperationContractInfo(&result.CooperationContract), nil
}
func NewCooperationContractService(options map[string]interface{}) *CooperationContractService {
... ...
... ... @@ -41,7 +41,7 @@ type CooperationProjectInfo struct {
UsersId int `json:"userId,string"`
} `json:"userInfo"`
} `json:"cooperationProjectSponsor"` //项目发起人
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerTypes"` //共创合约承接对象,1员工,2共创用户,3公开
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开
Department struct {
DepartmentNumber string `json:"departmentNumber"`
DepartmentId int `json:"departmentId,string,"`
... ... @@ -79,16 +79,17 @@ type CooperationApplicationItem struct {
Company domain.CompanyData `json:"company"`
Department domain.Department `json:"department"`
Org domain.Org `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserBaseID int `json:"userBaseId,string"`
UserID int `json:"userId,string"`
UserInfo domain.UserInfo `json:"userInfo"`
UserType int `json:"userType"`
} `json:"cooperationApplicationApplicant"` //申请人
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述
CooperationApplicationID int `json:"cooperationApplicationId"` //申请id
CooperationApplicationID int `json:"cooperationApplicationId,string"` //申请id
CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //状态
CooperationApplyTime int `json:"cooperationApplyTime"` //申请时间
CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件
CooperationApplicationVerifyTime int `json:"cooperationApplicationVerifyTime"`
}
func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem {
... ... @@ -97,8 +98,9 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation
CooperationApplicationDescription: param.CooperationApplicationDescription,
CooperationApplicationID: applicationID,
CooperationApplicationStatus: param.CooperationApplicationStatus,
CooperationApplyTime: int(param.CooperationApplyTime),
CooperationApplyTime: param.CooperationApplyTime,
CooperationApplicationAttachment: param.CooperationApplicationAttachment,
CooperationApplicationVerifyTime: param.CooperationApplicationVerifyTime,
}
data.CooperationApplicationApplicant.Company.CompanyID = param.Company.CompanyID
data.CooperationApplicationApplicant.Company.CompanyName = param.Company.CompanyName
... ...
... ... @@ -12,7 +12,7 @@ type MoneyIncentivesItem struct {
type DividendsEstimateDividendItem struct {
CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号
CustomerName string `json:"customerName"` //客户名称
DividendsIncentivesAmount int `json:"dividendsIncentivesAmount"` //业绩激励分红金额
DividendsIncentivesAmount float64 `json:"dividendsIncentivesAmount"` //业绩激励分红金额
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号或退货单号
OrderTime int64 `json:"orderTime"` //订单/退货单日期
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
... ... @@ -21,15 +21,15 @@ type DividendsEstimateDividendItem struct {
func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem {
var listdata []DividendsEstimateDividendItem
for _, v := range param.Grid.List {
for _, v := range param.List {
item := DividendsEstimateDividendItem{
CooperationContractNumber: v.CooperationContractNumber,
CustomerName: v.CustomerName,
DividendsIncentivesAmount: v.DividendsIncentivesAmount,
OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum,
OrderTime: v.OrderTime.Unix(),
DividendsIncentivesAmount: v.OrderAmount,
OrderOrReturnedOrderNum: v.OrderNumber,
OrderTime: v.OrderDate.UnixNano() / 1e6,
OriginalOrderNum: v.OriginalOrderNum,
RegionName: v.Region.RegionName,
RegionName: v.RegionName,
}
listdata = append(listdata, item)
}
... ... @@ -37,6 +37,7 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi
return listdata
}
//金额激励列表
type DividendsEstimateMoneyItem struct {
CooperationContractName string `json:"cooperationContractName"` //合约名称
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码
... ...
... ... @@ -85,7 +85,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
listdata := dto.ToDividendsEstimateDividendItem(result)
return result.Grid.Total, listdata, nil
return result.Total, listdata, nil
}
// 查询金额激励分红
... ...
... ... @@ -28,6 +28,7 @@ type DividendsOrder struct {
} `json:"region"`
Remarks string `json:"remarks"`
Goods []allied_creation_cooperation.DividendsOrderGoods `json:"goods"`
Returned bool `json:"returned"`
}
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
... ... @@ -35,7 +36,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
Company: param.Company,
CustomerName: param.CustomerName,
DividendStatus: param.DividendStatus,
DividendTime: param.DividendTime.Unix(),
DividendTime: param.DividendTime.UnixNano() / 1e6,
DividendsOrderAmount: param.DividendsOrderAmount,
DividendsOrderID: param.DividendsOrderID,
DividendsOrderNumber: param.DividendsOrderNumber,
... ... @@ -45,6 +46,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
Region: param.Region,
Remarks: param.Remarks,
Goods: param.Goods,
Returned: param.Returned,
}
return &data
}
... ...
... ... @@ -41,12 +41,12 @@ func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsRe
Org: param.Org,
Region: param.Region,
Company: param.Company,
CreatedAt: param.CreatedAt.Unix(),
CreatedAt: param.CreatedAt.UnixNano() / 1e6,
DividendStatus: param.DividendStatus,
DividendTime: param.DividendTime.Unix(),
DividendTime: param.DividendTime.UnixNano() / 1e6,
DividendsOrderNumber: param.DividendsOrderNumber,
DividendsReturnedCustomerName: param.DividendsReturnedCustomerName,
DividendsReturnedDate: param.DividendsReturnedDate.Unix(),
DividendsReturnedDate: param.DividendsReturnedDate.UnixNano() / 1e6,
DividendsReturnedOrderID: param.DividendsReturnedOrderID,
DividendsReturnedOrderNumber: param.DividendsReturnedOrderNumber,
DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund,
... ...
... ... @@ -18,8 +18,8 @@ type DividendsReturnedOrderService struct {
// 创建分红退货单服务
func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDividendsReturnedOrder(createDividendsReturnedOrderCommand *command.CreateDividendsReturnedOrderCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator)
dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate, 0)
orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate, 0)
dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0)
orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate/1e3, 0)
result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{
DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber,
... ... @@ -52,13 +52,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends
// 移除分红退货单服务
func (dividendsReturnedOrderService *DividendsReturnedOrderService) RemoveDividendsReturnedOrder(removeDividendsReturnedOrderCommand *command.RemoveDividendsReturnedOrderCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsReturnedOrderCommand.Operator)
ids := []int{}
for _, v := range removeDividendsReturnedOrderCommand.DividendsReturnedOrderID {
id, _ := strconv.Atoi(v)
ids = append(ids, id)
}
_, err := creationCooperationGateway.DividendsReturnedOrderBatchRemove(allied_creation_cooperation.ReqDividendsReturnedOrderBatchRemove{
DividendsReturnedOrderIDs: ids,
DividendsReturnedOrderIDs: removeDividendsReturnedOrderCommand.DividendsReturnedOrderID,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -89,8 +84,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
// 更新分红退货单服务
func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDividendsReturnedOrder(updateDividendsReturnedOrderCommand *command.UpdateDividendsReturnedOrderCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator)
dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate, 0)
orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate, 0)
dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0)
orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate/1e3, 0)
_, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{
DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID,
DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
... ...
... ... @@ -228,3 +228,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param Req
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CooperationContractsBatchOperate 暂停恢复合约
func (gateway HttplibAlliedCreationCooperation) CooperationContractsBatchOperate(param ReqCooperationContractsBatchOperate) (*DataCooperationContractsBatchOperate, error) {
url := gateway.baseUrL + "/cooperation-contracts/batch-operate"
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 DataCooperationContractsBatchOperate
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -31,8 +31,8 @@ type CooperationApplication struct {
Department interface{} `json:"department"`
} `json:"cooperationApplicationVerifier"`
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
CooperationApplicationVerifyTime int64 `json:"cooperationApplicationVerifyTime"`
CooperationApplyTime int64 `json:"cooperationApplyTime"`
CooperationApplicationVerifyTime int `json:"cooperationApplicationVerifyTime"`
CooperationApplyTime int `json:"cooperationApplyTime"`
CooperationProject struct {
CooperationProjectID int `json:"cooperationProjectId"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
... ...
... ... @@ -55,6 +55,7 @@ type CooperationContract struct {
Undertakers []struct {
ContractAttachment []domain.Attachment `json:"contractAttachment"`
UserId int `json:"userId,string"`
UndertakerId int `json:"undertakerId,string"`
UserInfo struct {
UserAvatar string `json:"userAvatar"` // 用户头像
UserEmail string `json:"userEmail"` // 用户邮箱
... ... @@ -114,6 +115,7 @@ type CooperationContract struct {
OperateTime time.Time `json:"operateTime"` // 操作时间
CreatedAt time.Time `json:"createdAt"` // 创建时间
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
}
//创建共创合约
... ... @@ -142,9 +144,10 @@ type (
//合约承接方
Undertaker struct {
UndertakerId string `json:"undertakerId"` //承接人用户id
RerferrerId string `json:"rerferrerId"` //推荐人用户id
SalesmanId string `json:"salesmanId"` //关联业务员id
UndertakerId int `json:"undertakerId,string"`
UserId int `json:"userId,string"` //承接人用户id
ReferrerId int `json:"referrerId,string"` //推荐人用户id
SalesmanId int `json:"salesmanId,string"` //关联业务员id
Attachment []domain.Attachment `json:"attachment"`
}
... ... @@ -188,10 +191,10 @@ type (
MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
Undertakers []Undertaker `json:"undertakers"` // 承接方列表 // 业绩分红激励规则列表
RelevantIds []string `json:"relevantIds"` //关联业务员
CompanyId int `json:"companyId,string"`
OrgId int `json:"orgId,string"` // 组织机构ID
UserId int ` json:"userId,string"` // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserBaseId int `json:"userBaseId,string" ` // 用户基础数据id
CompanyId int `json:"-"`
OrgId int `json:"-"` // 组织机构ID
UserId int ` json:"-"` // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserBaseId int `json:"-" ` // 用户基础数据id
}
DataCooperationContractUpdate struct {
... ... @@ -263,3 +266,12 @@ type (
UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
}
)
//批量恢复或暂停合约
type (
ReqCooperationContractsBatchOperate struct {
CooperationContractIds []string `json:"cooperationContractIds"`
Action int `json:"action"` //暂停或恢复合约动作,1恢复,2暂停
}
DataCooperationContractsBatchOperate []interface{}
)
... ...
... ... @@ -118,12 +118,6 @@ type (
CooperationProjectDescription string `json:"cooperationProjectDescription"`
Attachment []domain.Attachment `json:"attachment"`
DepartmentId int `json:"departmentId,string"`
// 组织机构ID
// OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
//UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
// 用户基础数据id
//UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
}
DataCooperationProjectUpdate struct {
... ...
... ... @@ -12,21 +12,25 @@ type (
}
DataDividendsEstimateSearchDividend struct {
Grid struct {
Total int `json:"total"`
List []struct {
CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号
CustomerName string `json:"customerName"` //客户名称
DividendsIncentivesAmount int `json:"dividendsIncentivesAmount"` //业绩激励分红金额
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号或退货单号
OrderTime time.Time `json:"orderTime"` //订单/退货单日期
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
Region struct {
RegionName string `json:"regionName"` //区域名称
RegionNumber string `json:"regionNumber"` //区域编码
} `json:"region"`
// 分红订单产品ID
OrderGoodId int64 `json:"orderGoodId,string"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 分红订单号或退货单号、
OrderNumber string `json:"orderNumber"`
// 来源单号
OriginalOrderNum string `json:"originalOrderNum"`
// 客户名称
CustomerName string `json:"customerName"`
// 订单区域
RegionName string `json:"region"`
// 订单金额
OrderAmount float64 `json:"orderAmount"`
// 订单/退货单日期
OrderDate time.Time `json:"-"` //TODO 等待数据调整
} `json:"list"`
} `json:"grid"`
}
)
... ...
... ... @@ -50,6 +50,7 @@ type DividendsOrder struct {
} `json:"region"`
Remarks string `json:"remarks"`
Goods []DividendsOrderGoods `json:"goods"`
Returned bool `json:"returned"` //是否有退货记录,true:有退货记录,false:无退货记录
}
type (
... ... @@ -64,7 +65,7 @@ type (
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity,string"` //订单产品数量
OrderGoodDividendsStatus int32 `json:"OrderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
}
ReqDividendsOrderAdd struct {
CompanyId int `json:"companyId,string"`
... ...
... ... @@ -116,7 +116,7 @@ type (
//批量移除分红退货单
type (
ReqDividendsReturnedOrderBatchRemove struct {
DividendsReturnedOrderIDs []int `json:"dividendsReturnedOrderIds"` //分红退货单记录id
DividendsReturnedOrderIDs []string `json:"dividendsReturnedOrderIds"` //分红退货单记录id
}
DataDividendsReturnedOrderBatchRemove struct {
... ...