作者 yangfu
... ... @@ -93,7 +93,8 @@ type DividendsEstimateItem struct {
DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段
CooperationContractNumber string `json:"cooperationContractNumber"` // 共创项目合约编号,
DividendsIncentivesStage int `json:"dividendsIncentivesStage"` //分红阶段
IsCanceled bool `json:"isCanceled"` // 取消状态
DividendsUser struct {
UsersId int `json:"usersId,string,"` // 用户ID,
... ...
... ... @@ -93,6 +93,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
DividendsType: v.DividendsType,
OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum,
CooperationProjectNumber: v.CooperationProjectNumber,
CooperationContractNumber: v.CooperationContractNumber,
DividendsIncentivesStage: v.DividendsIncentivesStage,
IsCanceled: v.IsCanceled,
}
... ...
... ... @@ -6,6 +6,6 @@ import (
type RemoveDividendsReturnedOrderCommand struct {
//操作人
Operator domain.Operator `json:"-"`
DividendsReturnedOrderID []string `json:"dividendsReturnedOrderId"` //分红退货单记录id
Operator domain.Operator `json:"-"`
ReturnedOrderId []string `json:"returnedOrderId"` //分红退货单记录id
}
... ...
... ... @@ -17,6 +17,7 @@ type DividendsReturnedOrderInfo struct {
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户姓名
DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
OrderTime int64 `json:"orderTime"` //订单时间
DividendsReturnedOrderID string `json:"dividendsReturnedOrderId"` //分红退货单记录id
DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` //分红退货单号
DividendsReturnedOrderRefund float64 `json:"dividendsReturnedOrderRefund"` //退货金额
... ... @@ -36,8 +37,12 @@ type DividendsReturnedOrderInfo struct {
}
func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsReturnedOrder) *DividendsReturnedOrderInfo {
goods := param.Goods
if len(param.Goods) == 0 {
goods = []allied_creation_cooperation.DividendsReturnedOrderGoods{}
}
data := DividendsReturnedOrderInfo{
Goods: param.Goods,
Goods: goods,
Org: param.Org,
Region: param.Region,
Company: param.Company,
... ... @@ -47,6 +52,7 @@ func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsRe
DividendsOrderNumber: param.DividendsOrderNumber,
DividendsReturnedCustomerName: param.DividendsReturnedCustomerName,
DividendsReturnedDate: param.DividendsReturnedDate.UnixNano() / 1e6,
OrderTime: param.OrderTime.UnixNano() / 1e6,
DividendsReturnedOrderID: param.DividendsReturnedOrderID,
DividendsReturnedOrderNumber: param.DividendsReturnedOrderNumber,
DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund,
... ...
... ... @@ -65,7 +65,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends
func (dividendsReturnedOrderService *DividendsReturnedOrderService) RemoveDividendsReturnedOrder(removeDividendsReturnedOrderCommand *command.RemoveDividendsReturnedOrderCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsReturnedOrderCommand.Operator)
_, err := creationCooperationGateway.DividendsReturnedOrderBatchRemove(allied_creation_cooperation.ReqDividendsReturnedOrderBatchRemove{
DividendsReturnedOrderIDs: removeDividendsReturnedOrderCommand.DividendsReturnedOrderID,
DividendsReturnedOrderIDs: removeDividendsReturnedOrderCommand.ReturnedOrderId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
... ... @@ -27,20 +24,20 @@ type CooperationUserAddCommand struct {
Phone string `json:"phone" valid:"Required"`
}
func (cooperationUserAddCommand *CooperationUserAddCommand) Valid(validation *validation.Validation) {
// func (cooperationUserAddCommand *CooperationUserAddCommand) Valid(validation *validation.Validation) {
}
// }
func (cooperationUserAddCommand *CooperationUserAddCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cooperationUserAddCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
// func (cooperationUserAddCommand *CooperationUserAddCommand) ValidateCommand() error {
// valid := validation.Validation{}
// b, err := valid.Valid(cooperationUserAddCommand)
// 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"
)
... ... @@ -16,20 +13,20 @@ type CooperationUserEnableCommand struct {
EnableStatus int `json:"enableStatus,omitempty"`
}
func (cooperationUserEnableCommand *CooperationUserEnableCommand) Valid(validation *validation.Validation) {
// func (cooperationUserEnableCommand *CooperationUserEnableCommand) Valid(validation *validation.Validation) {
}
// }
func (cooperationUserEnableCommand *CooperationUserEnableCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cooperationUserEnableCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
// func (cooperationUserEnableCommand *CooperationUserEnableCommand) ValidateCommand() error {
// valid := validation.Validation{}
// b, err := valid.Valid(cooperationUserEnableCommand)
// if err != nil {
// return err
// }
// if !b {
// for _, validErr := range valid.Errors {
// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
// }
// }
// return nil
// }
... ...
... ... @@ -3,11 +3,12 @@ package service
import (
"crypto/sha1"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"strconv"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
... ... @@ -286,10 +287,15 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
cooperationDeadline := time.Time{}
if cooperationUserAddCommand.CooperationDeadline > 0 {
cooperationDeadline = time.Unix(cooperationUserAddCommand.CooperationDeadline/1e3, 0)
}
result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
CompanyId: cooperationUserAddCommand.Operator.CompanyId,
CooperationCompany: cooperationUserAddCommand.CooperationCompany,
CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline/1000, 0),
CooperationDeadline: cooperationDeadline,
Email: cooperationUserAddCommand.Email,
EnableStatus: cooperationUserAddCommand.EnableStatus,
UserCode: cooperationUserAddCommand.UsersCode,
... ... @@ -342,7 +348,10 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
deadline := result.CooperationInfo.CooperationDeadline.Unix()
var deadline int64
if !result.CooperationInfo.CooperationDeadline.IsZero() {
deadline = result.CooperationInfo.CooperationDeadline.Unix()
}
userInfo := dto.CooperationUserInfo{
UserId: strconv.Itoa(result.UserId),
UserCode: result.UserCode,
... ... @@ -382,7 +391,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
item = dto.CooperationUserItem{
CooperationCompany: v.CooperationInfo.CooperationCompany,
UserId: strconv.Itoa(v.UserId),
CooperationDeadline: v.CooperationInfo.CooperationDeadline.Format("2006-01-02"),
CooperationDeadline: "",
Phone: v.UserInfo.Phone,
EnableStatus: v.EnableStatus,
UserCode: v.UserCode,
... ... @@ -390,6 +399,10 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
OrgName: v.Org.OrgName,
OrgId: strconv.Itoa(v.Org.OrgId),
}
if !v.CooperationInfo.CooperationDeadline.IsZero() {
item.CooperationDeadline = v.CooperationInfo.CooperationDeadline.Format("2006-01-02")
}
listData = append(listData, item)
}
return cnt, listData, err
... ...
... ... @@ -63,6 +63,7 @@ type (
DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
CooperationContractNumber string `json:"cooperationContractNumber"` // 共创项目合约编号,
DividendsIncentivesStage int `json:"DividendsIncentivesStage"` // 分红阶段
IsCanceled bool `json:"isCanceled"` // 取消状态
DividendsUser struct {
... ...
... ... @@ -26,6 +26,7 @@ type (
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户姓名
DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` //退货日期
OrderTime time.Time `json:"orderTime"` // 订单日期
DividendsReturnedOrderID string `json:"dividendsReturnedOrderId"` //分红退货单记录id
DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` //分红退货单号
DividendsReturnedOrderRefund float64 `json:"dividendsReturnedOrderRefund"` //退货金额
... ... @@ -127,7 +128,7 @@ type (
DividendsReturnedOrderIDs []string `json:"dividendsReturnedOrderIds"` //分红退货单记录id
}
DataDividendsReturnedOrderBatchRemove struct {
DataDividendsReturnedOrderBatchRemove []struct {
}
)
... ...