confirm_dividends_incentives_estimate.go
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package service
import (
"fmt"
coreDomain "github.com/linmadan/egglib-go/core/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"time"
)
type DividendsEstimateDetail struct {
DividendsUser *domain.User `json:"dividendsUser"` // 共创参与(分红用户)
DividendsParticipateType int32 `json:"dividendsParticipateType"` // 参与类型
DividendsStage int32 `json:"dividendsStage"` // 分红阶段
DividendsAmount float64 `json:"dividendsAmount"` // 分红金额
}
// GenerateSpecificDividendsEstimateNumber 批量生成自定义分红预算单号
func (DividendsEstimateDetail *DividendsEstimateDetail) GenerateSpecificDividendsEstimateNumber(count int64, index int64) (string, error) {
currentTime := time.Now()
if count+index < 1000 {
countStr := fmt.Sprintf("%03d", count+index+1)
timestamp := currentTime.Unix()
timeNow := time.Unix(timestamp, 0)
timeString := timeNow.Format("20060102")
timeString = timeString[2:len(timeString)]
dividendsEstimateNumber := "FH" + timeString + "#" + countStr
return dividendsEstimateNumber, nil
} else {
countStr := fmt.Sprintf("%d", count+index+1)
timestamp := currentTime.Unix()
timeNow := time.Unix(timestamp, 0)
timeString := timeNow.Format("20060102")
timeString = timeString[2:len(timeString)]
dividendsEstimateNumber := "FH" + timeString + "#" + countStr
return dividendsEstimateNumber, nil
}
}
type ConfirmDividendsIncentivesEstimateService interface {
coreDomain.DomainEventPublisher
Confirm(orderGoods []*domain.OrderGood) ([]*DividendsEstimateDetail, error)
}