正在显示
7 个修改的文件
包含
41 行增加
和
10 行删除
@@ -36,6 +36,10 @@ type SearchCreditAccountQuery struct { | @@ -36,6 +36,10 @@ type SearchCreditAccountQuery struct { | ||
36 | BeginTime time.Time `json:"beginTime"` | 36 | BeginTime time.Time `json:"beginTime"` |
37 | // 账期创建-结束时间 | 37 | // 账期创建-结束时间 |
38 | EndTime time.Time `json:"endTime"` | 38 | EndTime time.Time `json:"endTime"` |
39 | + // 账期创建-开始时间 | ||
40 | + PaymentBeginTime time.Time `json:"paymentBeginTime"` | ||
41 | + // 账期创建-结束时间 | ||
42 | + PaymentEndTime time.Time `json:"paymentEndTime"` | ||
39 | // 合约编号列表 | 43 | // 合约编号列表 |
40 | CooperationContractNumbers []string `json:"cooperationContractNumbers"` | 44 | CooperationContractNumbers []string `json:"cooperationContractNumbers"` |
41 | } | 45 | } |
@@ -85,6 +85,12 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa | @@ -85,6 +85,12 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa | ||
85 | if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 { | 85 | if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 { |
86 | query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v)) | 86 | query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v)) |
87 | } | 87 | } |
88 | + if v, ok := queryOptions["paymentBeginTime"]; ok && !(v.(time.Time).IsZero()) { | ||
89 | + query.Where(`payment_time>=? `, queryOptions["paymentBeginTime"]) | ||
90 | + } | ||
91 | + if v, ok := queryOptions["paymentEndTime"]; ok && !(v.(time.Time).IsZero()) { | ||
92 | + query.Where(`payment_time<? `, queryOptions["paymentEndTime"]) | ||
93 | + } | ||
88 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { | 94 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { |
89 | //query.Where("cooperation_contract_number in (?)", pg.In(v)) | 95 | //query.Where("cooperation_contract_number in (?)", pg.In(v)) |
90 | query.Where(domain.ConditionInContractNumbers(v.([]string))) | 96 | query.Where(domain.ConditionInContractNumbers(v.([]string))) |
@@ -173,6 +179,12 @@ func (dao *CreditAccountDao) CooperationCompanyDividendsStatistics(queryOptions | @@ -173,6 +179,12 @@ func (dao *CreditAccountDao) CooperationCompanyDividendsStatistics(queryOptions | ||
173 | if v, ok := queryOptions["endTime"]; ok && !v.(time.Time).IsZero() { | 179 | if v, ok := queryOptions["endTime"]; ok && !v.(time.Time).IsZero() { |
174 | query.Where("created_at < ?", v) | 180 | query.Where("created_at < ?", v) |
175 | } | 181 | } |
182 | + if v, ok := queryOptions["paymentBeginTime"]; ok && !(v.(time.Time).IsZero()) { | ||
183 | + query.Where(`payment_time>=? `, queryOptions["paymentBeginTime"]) | ||
184 | + } | ||
185 | + if v, ok := queryOptions["paymentEndTime"]; ok && !(v.(time.Time).IsZero()) { | ||
186 | + query.Where(`payment_time<? `, queryOptions["paymentEndTime"]) | ||
187 | + } | ||
176 | query.Where("deleted_at is null") | 188 | query.Where("deleted_at is null") |
177 | if v, ok := queryOptions["sortByActuallyPaidAmount"]; ok { | 189 | if v, ok := queryOptions["sortByActuallyPaidAmount"]; ok { |
178 | vInt := v.(int) | 190 | vInt := v.(int) |
@@ -668,15 +668,15 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query | @@ -668,15 +668,15 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query | ||
668 | if !request.BeginTime.IsZero() && request.BeginTime.AddDate(0, 3, 0).Before(request.EndTime) { | 668 | if !request.BeginTime.IsZero() && request.BeginTime.AddDate(0, 3, 0).Before(request.EndTime) { |
669 | queryItems, xAxisData = histogramStatisticsByYear(request.BeginTime) | 669 | queryItems, xAxisData = histogramStatisticsByYear(request.BeginTime) |
670 | } else { | 670 | } else { |
671 | - queryItems, xAxisData = histogramStatisticsByMonth() | 671 | + queryItems, xAxisData = histogramStatisticsByMonth(request.BeginTime) |
672 | } | 672 | } |
673 | for i := range queryItems { | 673 | for i := range queryItems { |
674 | item := queryItems[i] | 674 | item := queryItems[i] |
675 | if len(contractNumbers) == 0 && request.UserId > 0 { //没有相关的合约 查看分红预算单为空 | 675 | if len(contractNumbers) == 0 && request.UserId > 0 { //没有相关的合约 查看分红预算单为空 |
676 | continue | 676 | continue |
677 | } | 677 | } |
678 | - queryOptions["beginTime"] = item.BeginTime | ||
679 | - queryOptions["endTime"] = item.EndTime | 678 | + queryOptions["paymentBeginTime"] = item.BeginTime |
679 | + queryOptions["paymentEndTime"] = item.EndTime | ||
680 | if err := creditAccountDao.DividendsStatistics(queryOptions, dividends); err != nil { | 680 | if err := creditAccountDao.DividendsStatistics(queryOptions, dividends); err != nil { |
681 | return nil, err | 681 | return nil, err |
682 | } | 682 | } |
@@ -697,9 +697,9 @@ type queryItem struct { | @@ -697,9 +697,9 @@ type queryItem struct { | ||
697 | EndTime time.Time | 697 | EndTime time.Time |
698 | } | 698 | } |
699 | 699 | ||
700 | -func histogramStatisticsByMonth() ([]queryItem, []string) { | 700 | +func histogramStatisticsByMonth(start time.Time) ([]queryItem, []string) { |
701 | ret := make([]queryItem, 0) | 701 | ret := make([]queryItem, 0) |
702 | - year, month := time.Now().Year(), time.Now().Month() | 702 | + year, month := start.Year(), start.Month() |
703 | var beginTime = time.Date(year, month, 1, 0, 0, 0, 0, time.Local) | 703 | var beginTime = time.Date(year, month, 1, 0, 0, 0, 0, time.Local) |
704 | var endTime time.Time | 704 | var endTime time.Time |
705 | var increaseDay = 5 | 705 | var increaseDay = 5 |
@@ -150,8 +150,8 @@ func (ptr *CooperationStatisticsService) PersonCompanyPaymentHistoryStatistics(q | @@ -150,8 +150,8 @@ func (ptr *CooperationStatisticsService) PersonCompanyPaymentHistoryStatistics(q | ||
150 | UserBaseId int64 `json:"userBaseId" valid:"Required"` | 150 | UserBaseId int64 `json:"userBaseId" valid:"Required"` |
151 | OrgId int64 `json:"orgId" valid:"Required"` | 151 | OrgId int64 `json:"orgId" valid:"Required"` |
152 | SortByActuallyPaidAmount int `json:"sortByActuallyPaidAmount" valid:"Required"` | 152 | SortByActuallyPaidAmount int `json:"sortByActuallyPaidAmount" valid:"Required"` |
153 | - BeginTime time.Time `json:"beginTime"` | ||
154 | - EndTime time.Time `json:"endTime"` | 153 | + BeginTime time.Time `json:"paymentBeginTime"` |
154 | + EndTime time.Time `json:"paymentEndTime"` | ||
155 | }{} | 155 | }{} |
156 | if err := LoadQueryObject(queryOptions, &request); err != nil { | 156 | if err := LoadQueryObject(queryOptions, &request); err != nil { |
157 | return nil, err | 157 | return nil, err |
@@ -583,6 +583,10 @@ func (ptr *CooperationStatisticsService) CreditAccountStatistics(queryOptions ma | @@ -583,6 +583,10 @@ func (ptr *CooperationStatisticsService) CreditAccountStatistics(queryOptions ma | ||
583 | UserBaseId int64 `json:"userBaseId"` | 583 | UserBaseId int64 `json:"userBaseId"` |
584 | BeginTime time.Time `json:"beginTime"` | 584 | BeginTime time.Time `json:"beginTime"` |
585 | EndTime time.Time `json:"endTime"` | 585 | EndTime time.Time `json:"endTime"` |
586 | + // 支付开始时间 | ||
587 | + PaymentBeginTime time.Time `json:"paymentBeginTime"` | ||
588 | + // 支付结束时间 | ||
589 | + PaymentEndTime time.Time `json:"paymentEndTime"` | ||
586 | // 合约编号列表 | 590 | // 合约编号列表 |
587 | CooperationContractNumbers []string `json:"cooperationContractNumbers"` | 591 | CooperationContractNumbers []string `json:"cooperationContractNumbers"` |
588 | }{} | 592 | }{} |
@@ -7,10 +7,10 @@ import ( | @@ -7,10 +7,10 @@ import ( | ||
7 | "github.com/go-pg/pg/v10/orm" | 7 | "github.com/go-pg/pg/v10/orm" |
8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/constant" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/constant" |
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" |
10 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" | ||
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log" |
11 | 12 | ||
12 | - "github.com/linmadan/egglib-go/persistent/pg/comment" | ||
13 | - _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" | 13 | + rawlog "log" |
14 | ) | 14 | ) |
15 | 15 | ||
16 | var DB *pg.DB | 16 | var DB *pg.DB |
@@ -51,7 +51,7 @@ func init() { | @@ -51,7 +51,7 @@ func init() { | ||
51 | if err != nil { | 51 | if err != nil { |
52 | panic(err) | 52 | panic(err) |
53 | } | 53 | } |
54 | - comment.AddComments(DB, model) | 54 | + //comment.AddComments(DB, model) |
55 | } | 55 | } |
56 | } | 56 | } |
57 | } | 57 | } |
@@ -68,6 +68,11 @@ func (hook SqlGeneratePrintHook) AfterQuery(c context.Context, q *pg.QueryEvent) | @@ -68,6 +68,11 @@ func (hook SqlGeneratePrintHook) AfterQuery(c context.Context, q *pg.QueryEvent) | ||
68 | if err != nil { | 68 | if err != nil { |
69 | return err | 69 | return err |
70 | } | 70 | } |
71 | + if constant.LOG_FRAMEWORK == "logrus" { | ||
72 | + rawlog.Println(string(sqlStr)) | ||
73 | + } else { | ||
71 | log.Logger.Debug(string(sqlStr)) | 74 | log.Logger.Debug(string(sqlStr)) |
75 | + } | ||
76 | + | ||
72 | return nil | 77 | return nil |
73 | } | 78 | } |
@@ -234,6 +234,12 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | @@ -234,6 +234,12 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | ||
234 | if v, ok := queryOptions["endTime"]; ok && !(v.(time.Time).IsZero()) { | 234 | if v, ok := queryOptions["endTime"]; ok && !(v.(time.Time).IsZero()) { |
235 | query.Where(`created_at<? `, queryOptions["endTime"]) | 235 | query.Where(`created_at<? `, queryOptions["endTime"]) |
236 | } | 236 | } |
237 | + if v, ok := queryOptions["paymentBeginTime"]; ok && !(v.(time.Time).IsZero()) { | ||
238 | + query.Where(`payment_time>=? `, queryOptions["paymentBeginTime"]) | ||
239 | + } | ||
240 | + if v, ok := queryOptions["paymentEndTime"]; ok && !(v.(time.Time).IsZero()) { | ||
241 | + query.Where(`payment_time<? `, queryOptions["paymentEndTime"]) | ||
242 | + } | ||
237 | offsetLimitFlag := true | 243 | offsetLimitFlag := true |
238 | if offsetLimit, ok := queryOptions["offsetLimit"]; ok { | 244 | if offsetLimit, ok := queryOptions["offsetLimit"]; ok { |
239 | offsetLimitFlag = offsetLimit.(bool) | 245 | offsetLimitFlag = offsetLimit.(bool) |
-
请 注册 或 登录 后发表评论