作者 yangfu
... ... @@ -14,7 +14,7 @@ type DividendsOrder struct {
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime int64 `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId"` //分红订单
DividendsOrderID int `json:"dividendsOrderId,string"` //分红订单
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderTime int64 `json:"orderTime"`
... ...
... ... @@ -47,14 +47,8 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
data := struct {
DividendsOrderId int
command.CreateDividendsOrderCommand
}{
DividendsOrderId: result.DividendsOrderID,
CreateDividendsOrderCommand: *createDividendsOrderCommand,
}
return data, nil
return dto.ToDividendsOrder(&result.DividendsOrder), nil
}
// 返回分红订单实体对象
... ... @@ -104,11 +98,11 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
var dataList []dto.DividendsOrder
for i := range result.Gride.List {
item := dto.ToDividendsOrder(&result.Gride.List[i])
for i := range result.Grid.List {
item := dto.ToDividendsOrder(&result.Grid.List[i])
dataList = append(dataList, *item)
}
return result.Gride.Total, dataList, nil
return result.Grid.Total, dataList, nil
}
// 更新分红订单实体对象
... ...
... ... @@ -7,6 +7,15 @@ import (
type CreateDividendsReturnedOrderCommand struct {
//操作人
Operator domain.Operator `json:"-"`
allied_creation_cooperation.ReqDividendsReturnedOrderAdd
Operator domain.Operator `json:"-"`
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"` //源单号
//货品
OrderGoods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"orderGoods"`
DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
OrderDate int64 `json:"orderDate"` //订单日期
Remarks string `json:"remarks"` //
RegionName string `json:"regionName"`
}
... ...
... ... @@ -7,6 +7,17 @@ import (
type UpdateDividendsReturnedOrderCommand struct {
//操作人
Operator domain.Operator `json:"-"`
allied_creation_cooperation.ReqDividendsReturnedOrderUpdate
Operator domain.Operator `json:"-"`
DividendsReturnedOrderID int `json:"dividendsReturnedOrderId,string"` //分红退货单记录id
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"` //源单号
//货品
OrderGoods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"orderGoods"`
DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
OrderDate int64 `json:"orderDate"` //订单日期
Remarks string `json:"remarks"` //
RegionName string `json:"regionName"`
}
... ...
... ... @@ -2,6 +2,7 @@ package service
import (
"strconv"
"time"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/command"
... ... @@ -16,13 +17,24 @@ type DividendsReturnedOrderService struct {
// 创建分红退货单服务
func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDividendsReturnedOrder(createDividendsReturnedOrderCommand *command.CreateDividendsReturnedOrderCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator)
_, err := creationCooperationGateway.DividendsReturnedOrderAdd(createDividendsReturnedOrderCommand.ReqDividendsReturnedOrderAdd)
dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate, 0)
orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate, 0)
result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{
DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber,
OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum,
OrderGoods: createDividendsReturnedOrderCommand.OrderGoods,
DividendsReturnedDate: dividendsReturnedDate,
OrderData: orderDate,
OrgId: int(createDividendsReturnedOrderCommand.Operator.OrgId),
Remarks: createDividendsReturnedOrderCommand.Remarks,
RegionName: createDividendsReturnedOrderCommand.RegionName,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return createDividendsReturnedOrderCommand, nil
return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder), nil
}
// 返回分红退货单服务
... ... @@ -77,7 +89,20 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
// 更新分红退货单服务
func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDividendsReturnedOrder(updateDividendsReturnedOrderCommand *command.UpdateDividendsReturnedOrderCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator)
_, err := creationCooperationGateway.DividendsReturnedOrderUpdate(updateDividendsReturnedOrderCommand.ReqDividendsReturnedOrderUpdate)
dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate, 0)
orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate, 0)
_, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{
DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID,
DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
DividendsOrderNumber: updateDividendsReturnedOrderCommand.DividendsOrderNumber,
OriginalOrderNum: updateDividendsReturnedOrderCommand.OriginalOrderNum,
OrderGoods: updateDividendsReturnedOrderCommand.OrderGoods,
DividendsReturnedDate: dividendsReturnedDate,
OrderData: orderDate,
OrgId: int(updateDividendsReturnedOrderCommand.Operator.OrgId),
Remarks: updateDividendsReturnedOrderCommand.Remarks,
RegionName: updateDividendsReturnedOrderCommand.RegionName,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -97,7 +122,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
listData := []map[string]interface{}{}
for _, v := range result.Gride.List {
for _, v := range result.Grid.List {
m := map[string]interface{}{
"dividendsOrderNumber": v.DividendsOrderNumber,
"dividendsOriginalOrderNum": v.DividendsOriginalOrderNum,
... ... @@ -106,7 +131,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi
}
listData = append(listData, m)
}
return result.Gride.Total, listData, nil
return result.Grid.Total, listData, nil
}
func NewDividendsReturnedOrderService(options map[string]interface{}) *DividendsReturnedOrderService {
... ...
... ... @@ -232,7 +232,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderGet(param ReqDivid
// DividendsOrderBatchRemove 批量移除分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderBatchRemove(param ReqDividendsOrderBatchRemove) (*DataDividendsOrderBatchRemove, error) {
url := gateway.baseUrL + "/dividends-orders/batch-remove"
method := "DELETE"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:移除分红订单。", map[string]interface{}{
"api": method + ":" + url,
... ... @@ -255,7 +255,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderBatchRemove(param
if err != nil {
return nil, fmt.Errorf("解析移除分红订单:%w", err)
}
var data DataDividendsOrderBatchRemove
err = gateway.GetResponseData(result, &data)
return &data, err
// var data []DataDividendsOrderBatchRemove
// err = gateway.GetResponseData(result, &data)
return nil, err
}
... ...
... ... @@ -51,15 +51,26 @@ type (
FeedbackContent string `json:"feedbackContent"`
CooperationContractNumber string `json:"cooperationContractNumber"`
CooperationContractName string `json:"cooperationContractName"`
ContractUndertaker interface{} `json:"contractUndertaker"`
Org interface{} `json:"org"`
Company interface{} `json:"company"`
ContractUndertaker struct {
UserId int `json:"userId,string,"`
UserPhone string `json:"userPhone"`
UserName string `json:"userName"`
UserCode string `json:"userCode"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
UserCode string `json:"userCode"`
} `json:"userInfo"`
} `json:"contractUndertaker"`
Org interface{} `json:"org"`
Company interface{} `json:"company"`
//UpdatedAt time.Time `json:"updatedAt"`
//DeletedAt time.Time `json:"deletedAt"`
CreatedAt jtime.TimeToUnixMsec `json:"createdAt"`
CooperationMode struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId,string"`
CooperationModeId int `json:"cooperationModeId,string,"`
// 共创模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,唯一确定
... ...
... ... @@ -47,12 +47,14 @@ type DividendsOrder struct {
Region struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"`
}
} `json:"region"`
}
type (
//订单产品
DividendsOrderGoods struct {
// 订单产品
OrderGoodId int64 `json:"orderGoodId,string"`
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
... ... @@ -60,6 +62,7 @@ type (
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
OrderGoodDividendsStatus int32 `json:"OrderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
}
ReqDividendsOrderAdd struct {
CompanyId int `json:"companyId,string"`
... ... @@ -115,10 +118,10 @@ type (
}
DataDividendsOrderSearch struct {
Gride struct {
Grid struct {
Total int `json:"total"`
List []DividendsOrder `json:"list"`
} `json:"gride"`
} `json:"grid"`
}
)
... ...
... ... @@ -5,11 +5,13 @@ import "time"
//创建分红退货单
type (
DividendsReturnedOrderGoods struct {
OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
}
DividendsReturnedOrder struct {
... ... @@ -46,39 +48,39 @@ type (
}
ReqDividendsReturnedOrderAdd struct {
CustomerName string `json:"customerName"`
DividendsOrderAmount string `json:"dividendsOrderAmount"`
DividendsOrderNumber string `json:"dividendsOrderNumber"`
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"`
OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"`
OrderTime time.Time `json:"orderTime"`
OrgId int `json:"orgId"`
Remarks string `json:"remarks"`
SalesmanUid string `json:"salesmanUid"`
RegionName string `json:"regionName"`
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"`
OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"`
DividendsReturnedDate time.Time `json:"dividendsReturnedDate"`
OrderData time.Time `json:"orderData"`
OrgId int `json:"orgId"`
Remarks string `json:"remarks"`
RegionName string `json:"regionName"`
}
DataDividendsReturnedOrderAdd struct {
DividendsReturnedOrder
}
)
//更新分红退货单
type (
ReqDividendsReturnedOrderUpdate struct {
DividendsReturnedOrderID int `json:"dividendsReturnedOrderId"` //分红退货单记录id
CustomerName string `json:"customerName"`
DividendsOrderAmount string `json:"dividendsOrderAmount"`
DividendsOrderNumber string `json:"dividendsOrderNumber"`
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"`
OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"`
OrderTime time.Time `json:"orderTime"`
OrgId int `json:"orgId"`
Remarks string `json:"remarks"`
SalesmanUid string `json:"salesmanUid"`
RegionName string `json:"regionName"`
DividendsReturnedOrderID int `json:"dividendsReturnedOrderId,string"` //分红退货单记录id
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"`
OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"`
DividendsReturnedDate time.Time `json:"orderTime"`
OrderData time.Time `json:"orderData"`
OrgId int `json:"orgId"`
Remarks string `json:"remarks"`
RegionName string `json:"regionName"`
}
DataDividendsReturnedOrderUpdate struct {
DividendsReturnedOrder
}
)
... ...