作者 tangxuhui

时间判断0值

@@ -93,7 +93,8 @@ type DividendsEstimateItem struct { @@ -93,7 +93,8 @@ type DividendsEstimateItem struct {
93 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励 93 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
94 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号 94 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
95 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号, 95 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
96 - DividendsIncentivesStage int `json:"DividendsIncentivesStage"` //分红阶段 96 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创项目合约编号,
  97 + DividendsIncentivesStage int `json:"dividendsIncentivesStage"` //分红阶段
97 IsCanceled bool `json:"isCanceled"` // 取消状态 98 IsCanceled bool `json:"isCanceled"` // 取消状态
98 DividendsUser struct { 99 DividendsUser struct {
99 UsersId int `json:"usersId,string,"` // 用户ID, 100 UsersId int `json:"usersId,string,"` // 用户ID,
@@ -93,6 +93,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat @@ -93,6 +93,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
93 DividendsType: v.DividendsType, 93 DividendsType: v.DividendsType,
94 OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum, 94 OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum,
95 CooperationProjectNumber: v.CooperationProjectNumber, 95 CooperationProjectNumber: v.CooperationProjectNumber,
  96 + CooperationContractNumber: v.CooperationContractNumber,
96 DividendsIncentivesStage: v.DividendsIncentivesStage, 97 DividendsIncentivesStage: v.DividendsIncentivesStage,
97 IsCanceled: v.IsCanceled, 98 IsCanceled: v.IsCanceled,
98 } 99 }
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -27,20 +24,20 @@ type CooperationUserAddCommand struct { @@ -27,20 +24,20 @@ type CooperationUserAddCommand struct {
27 Phone string `json:"phone" valid:"Required"` 24 Phone string `json:"phone" valid:"Required"`
28 } 25 }
29 26
30 -func (cooperationUserAddCommand *CooperationUserAddCommand) Valid(validation *validation.Validation) { 27 +// func (cooperationUserAddCommand *CooperationUserAddCommand) Valid(validation *validation.Validation) {
31 28
32 -} 29 +// }
33 30
34 -func (cooperationUserAddCommand *CooperationUserAddCommand) ValidateCommand() error {  
35 - valid := validation.Validation{}  
36 - b, err := valid.Valid(cooperationUserAddCommand)  
37 - if err != nil {  
38 - return err  
39 - }  
40 - if !b {  
41 - for _, validErr := range valid.Errors {  
42 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
43 - }  
44 - }  
45 - return nil  
46 -} 31 +// func (cooperationUserAddCommand *CooperationUserAddCommand) ValidateCommand() error {
  32 +// valid := validation.Validation{}
  33 +// b, err := valid.Valid(cooperationUserAddCommand)
  34 +// if err != nil {
  35 +// return err
  36 +// }
  37 +// if !b {
  38 +// for _, validErr := range valid.Errors {
  39 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  40 +// }
  41 +// }
  42 +// return nil
  43 +// }
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -16,20 +13,20 @@ type CooperationUserEnableCommand struct { @@ -16,20 +13,20 @@ type CooperationUserEnableCommand struct {
16 EnableStatus int `json:"enableStatus,omitempty"` 13 EnableStatus int `json:"enableStatus,omitempty"`
17 } 14 }
18 15
19 -func (cooperationUserEnableCommand *CooperationUserEnableCommand) Valid(validation *validation.Validation) { 16 +// func (cooperationUserEnableCommand *CooperationUserEnableCommand) Valid(validation *validation.Validation) {
20 17
21 -} 18 +// }
22 19
23 -func (cooperationUserEnableCommand *CooperationUserEnableCommand) ValidateCommand() error {  
24 - valid := validation.Validation{}  
25 - b, err := valid.Valid(cooperationUserEnableCommand)  
26 - if err != nil {  
27 - return err  
28 - }  
29 - if !b {  
30 - for _, validErr := range valid.Errors {  
31 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
32 - }  
33 - }  
34 - return nil  
35 -} 20 +// func (cooperationUserEnableCommand *CooperationUserEnableCommand) ValidateCommand() error {
  21 +// valid := validation.Validation{}
  22 +// b, err := valid.Valid(cooperationUserEnableCommand)
  23 +// if err != nil {
  24 +// return err
  25 +// }
  26 +// if !b {
  27 +// for _, validErr := range valid.Errors {
  28 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  29 +// }
  30 +// }
  31 +// return nil
  32 +// }
@@ -3,11 +3,12 @@ package service @@ -3,11 +3,12 @@ package service
3 import ( 3 import (
4 "crypto/sha1" 4 "crypto/sha1"
5 "fmt" 5 "fmt"
6 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"  
8 "strconv" 6 "strconv"
9 "time" 7 "time"
10 8
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  11 +
11 "github.com/linmadan/egglib-go/core/application" 12 "github.com/linmadan/egglib-go/core/application"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command" 13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto" 14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
@@ -286,10 +287,15 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * @@ -286,10 +287,15 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *
286 if err != nil { 287 if err != nil {
287 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 288 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
288 } 289 }
  290 + cooperationDeadline := time.Time{}
  291 + if cooperationUserAddCommand.CooperationDeadline > 0 {
  292 + cooperationDeadline = time.Unix(cooperationUserAddCommand.CooperationDeadline/1e3, 0)
  293 + }
  294 +
289 result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{ 295 result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
290 CompanyId: cooperationUserAddCommand.Operator.CompanyId, 296 CompanyId: cooperationUserAddCommand.Operator.CompanyId,
291 CooperationCompany: cooperationUserAddCommand.CooperationCompany, 297 CooperationCompany: cooperationUserAddCommand.CooperationCompany,
292 - CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline/1000, 0), 298 + CooperationDeadline: cooperationDeadline,
293 Email: cooperationUserAddCommand.Email, 299 Email: cooperationUserAddCommand.Email,
294 EnableStatus: cooperationUserAddCommand.EnableStatus, 300 EnableStatus: cooperationUserAddCommand.EnableStatus,
295 UserCode: cooperationUserAddCommand.UsersCode, 301 UserCode: cooperationUserAddCommand.UsersCode,
@@ -342,7 +348,10 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu @@ -342,7 +348,10 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
342 if err != nil { 348 if err != nil {
343 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 349 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
344 } 350 }
345 - deadline := result.CooperationInfo.CooperationDeadline.Unix() 351 + var deadline int64
  352 + if !result.CooperationInfo.CooperationDeadline.IsZero() {
  353 + deadline = result.CooperationInfo.CooperationDeadline.Unix()
  354 + }
346 userInfo := dto.CooperationUserInfo{ 355 userInfo := dto.CooperationUserInfo{
347 UserId: strconv.Itoa(result.UserId), 356 UserId: strconv.Itoa(result.UserId),
348 UserCode: result.UserCode, 357 UserCode: result.UserCode,
@@ -382,7 +391,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -382,7 +391,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
382 item = dto.CooperationUserItem{ 391 item = dto.CooperationUserItem{
383 CooperationCompany: v.CooperationInfo.CooperationCompany, 392 CooperationCompany: v.CooperationInfo.CooperationCompany,
384 UserId: strconv.Itoa(v.UserId), 393 UserId: strconv.Itoa(v.UserId),
385 - CooperationDeadline: v.CooperationInfo.CooperationDeadline.Format("2006-01-02"), 394 + CooperationDeadline: "",
386 Phone: v.UserInfo.Phone, 395 Phone: v.UserInfo.Phone,
387 EnableStatus: v.EnableStatus, 396 EnableStatus: v.EnableStatus,
388 UserCode: v.UserCode, 397 UserCode: v.UserCode,
@@ -390,6 +399,10 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -390,6 +399,10 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
390 OrgName: v.Org.OrgName, 399 OrgName: v.Org.OrgName,
391 OrgId: strconv.Itoa(v.Org.OrgId), 400 OrgId: strconv.Itoa(v.Org.OrgId),
392 } 401 }
  402 + if !v.CooperationInfo.CooperationDeadline.IsZero() {
  403 + item.CooperationDeadline = v.CooperationInfo.CooperationDeadline.Format("2006-01-02")
  404 + }
  405 +
393 listData = append(listData, item) 406 listData = append(listData, item)
394 } 407 }
395 return cnt, listData, err 408 return cnt, listData, err
@@ -63,6 +63,7 @@ type ( @@ -63,6 +63,7 @@ type (
63 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励 63 DividendsType int `json:"dividendsType"` // 分红类型,1订单分红,2退货冲销,3金额激励
64 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号 64 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` // 分红订单号或退货单号
65 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号, 65 CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
  66 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创项目合约编号,
66 DividendsIncentivesStage int `json:"DividendsIncentivesStage"` // 分红阶段 67 DividendsIncentivesStage int `json:"DividendsIncentivesStage"` // 分红阶段
67 IsCanceled bool `json:"isCanceled"` // 取消状态 68 IsCanceled bool `json:"isCanceled"` // 取消状态
68 DividendsUser struct { 69 DividendsUser struct {