作者 tangxuhui

分红单修改

... ... @@ -6,42 +6,20 @@ import (
type DividendsOrder struct {
Company struct {
CompanyID int `json:"companyId"`
CompanyID int `json:"companyId,string"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
CustomerName string `json:"customerName"` //客户名字
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime int64 `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId"` //分红订单
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderSalesman struct { //订单业务员
Department struct {
DepartmentID int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
IsOrganization bool `json:"isOrganization"`
} `json:"department"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType int `json:"userType"`
} `json:"orderSalesman"`
OrderTime int64 `json:"orderTime"`
Org struct {
OrgID int `json:"orgId"`
CustomerName string `json:"customerName"` //客户名字
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime int64 `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId"` //分红订单
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderTime int64 `json:"orderTime"`
Org struct {
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
} `json:"org"`
Region struct {
... ... @@ -60,7 +38,6 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
DividendsOrderID: param.DividendsOrderID,
DividendsOrderNumber: param.DividendsOrderNumber,
DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
OrderSalesman: param.OrderSalesman,
OrderTime: param.OrderTime.Unix(),
Org: param.Org,
Region: param.Region,
... ...
package service
import (
"time"
"strconv"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/command"
... ... @@ -32,14 +32,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
}
orderGoods = append(orderGoods, good)
}
t := time.Unix(createDividendsOrderCommand.OrderTime, 0)
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator)
result, err := creationCooperationGateway.DividendsOrderAdd(allied_creation_cooperation.ReqDividendsOrderAdd{
CompanyId: int(createDividendsOrderCommand.Operator.CompanyId),
UserId: int(createDividendsOrderCommand.Operator.UserId),
CustomerName: createDividendsOrderCommand.CustomerName,
DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum,
OperatorUid: int(createDividendsOrderCommand.Operator.UserId),
OrderTime: t,
OrderTime: strconv.Itoa(int(createDividendsOrderCommand.OrderTime * 1000)),
Remarks: createDividendsOrderCommand.Remarks,
RegionName: createDividendsOrderCommand.RegionName,
OrderGoods: orderGoods,
... ... @@ -129,7 +129,6 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
}
orderGoods = append(orderGoods, good)
}
t := time.Unix(updateDividendsOrderCommand.OrderTime, 0)
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator)
_, err := creationCooperationGateway.DividendsOrderUpdate(allied_creation_cooperation.ReqDividendsOrderUpdate{
DividendsOrderId: updateDividendsOrderCommand.DividendsOrderID,
... ... @@ -138,7 +137,7 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount,
DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum,
OperatorUid: int(updateDividendsOrderCommand.Operator.UserId),
OrderTime: t,
OrderTime: strconv.Itoa(int(updateDividendsOrderCommand.OrderTime * 1000)),
Remarks: updateDividendsOrderCommand.Remarks,
RegionName: updateDividendsOrderCommand.RegionName,
OrderGoods: orderGoods,
... ...
... ... @@ -12,6 +12,7 @@ import (
// DividendsOrderAdd 创建分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDividendsOrderAdd) (*DataDividendsOrderAdd, error) {
param.SalesmanUid = "1" //TODO 调试用删除
url := gateway.baseUrL + "/dividends-orders"
method := "POST"
req := gateway.CreateRequest(url, method)
... ... @@ -43,6 +44,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderAdd(param ReqDivid
// DividendsOrderUpdate 更新分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderUpdate(param ReqDividendsOrderUpdate) (*DataDividendsOrderUpdate, error) {
param.SalesmanUid = "1" //TODO 调试用删除
url := gateway.baseUrL + "/dividends-orders/" + strconv.Itoa(param.DividendsOrderId)
method := "PUT"
req := gateway.CreateRequest(url, method)
... ...
... ... @@ -6,7 +6,7 @@ import "time"
type DividendsOrder struct {
Company struct {
CompanyID int `json:"companyId"`
CompanyID int `json:"companyId,string"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
... ... @@ -14,22 +14,22 @@ type DividendsOrder struct {
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime time.Time `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId"` //分红订单
DividendsOrderID int `json:"dividendsOrderId,string"` //分红订单
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderSalesman struct { //订单业务员
Department struct {
DepartmentID int `json:"departmentId"`
DepartmentID int `json:"departmentId,string"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
IsOrganization bool `json:"isOrganization"`
} `json:"department"`
Org struct {
OrgID int `json:"orgId"`
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserBaseID int `json:"userBaseId,string"`
UserID int `json:"userId,string"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
... ... @@ -41,7 +41,7 @@ type DividendsOrder struct {
} `json:"orderSalesman"`
OrderTime time.Time `json:"orderTime"`
Org struct {
OrgID int `json:"orgId"`
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
} `json:"org"`
Region struct {
... ... @@ -62,14 +62,15 @@ type (
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
}
ReqDividendsOrderAdd struct {
CompanyId int `json:"companyId"`
CompanyId int `json:"companyId,string"`
CustomerName string `json:"customerName"` //客户名称
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OperatorUid int `json:"operatorUid"` //订单操作人id
OperatorUid int `json:"operatorUid,string"` //订单操作人id
OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表
OrderTime time.Time `json:"orderTime"` //订单产生时间
OrderTime string `json:"orderTime"` //订单日期,13位长度字符串类型时间戳
Remarks string `json:"remarks"` //备注
UserId int `json:"userId"` //
UserId int `json:"userId,string"` //
SalesmanUid string `json:"salesmanUid"` //订单业务员uid
RegionName string `json:"regionName"` //区域名称
}
... ... @@ -81,18 +82,18 @@ type (
//更新分红订单
type (
ReqDividendsOrderUpdate struct {
DividendsOrderId int `json:"dividendsOrderId"`
CompanyId int `json:"companyId"`
DividendsOrderId int `json:"dividendsOrderId,string"`
CompanyId int `json:"companyId,string"`
CustomerName string `json:"customerName"` //客户名称
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OperatorUid int `json:"operatorUid"` //订单操作人id
OperatorUid int `json:"operatorUid,string"` //订单操作人id
OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表
OrderTime time.Time `json:"orderTime"` //订单产生时间
OrderTime string `json:"orderTime"` //订单日期,13位长度字符串类型时间戳
Remarks string `json:"remarks"` //备注
SalesmanUid string `json:"salesmanUid"` //订单业务员uid
UserId int `json:"userId"` //
UserId int `json:"userId,string"` //
RegionName string `json:"regionName"` //区域名称
}
... ...
... ... @@ -18,6 +18,7 @@ func (controller *DividendsOrderController) CreateDividendsOrder() {
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
createDividendsOrderCommand.Operator = controller.GetOperator()
data, err := dividendsOrderService.CreateDividendsOrder(createDividendsOrderCommand)
controller.Response(data, err)
}
... ... @@ -30,6 +31,7 @@ func (controller *DividendsOrderController) UpdateDividendsOrder() {
log.Logger.Debug("json err:" + err.Error())
}
orderId, _ := controller.GetInt(":orderId")
updateDividendsOrderCommand.Operator = controller.GetOperator()
updateDividendsOrderCommand.DividendsOrderID = orderId
data, err := dividendsOrderService.UpdateDividendsOrder(updateDividendsOrderCommand)
controller.Response(data, err)
... ... @@ -43,6 +45,7 @@ func (controller *DividendsOrderController) RemoveDividendsOrder() {
log.Logger.Debug("json err:" + err.Error())
}
removeDividendsOrderCommand.Operator = controller.GetOperator()
data, err := dividendsOrderService.RemoveDividendsOrder(removeDividendsOrderCommand)
controller.Response(data, err)
}
... ...