正在显示
4 个修改的文件
包含
23 行增加
和
6 行删除
| 1 | package domain | 1 | package domain |
| 2 | 2 | ||
| 3 | -import "time" | 3 | +import ( |
| 4 | + "fmt" | ||
| 5 | + "github.com/linmadan/egglib-go/utils/json" | ||
| 6 | + "time" | ||
| 7 | +) | ||
| 4 | 8 | ||
| 5 | // CreditAccount 账期结算单实体 | 9 | // CreditAccount 账期结算单实体 |
| 6 | type CreditAccount struct { | 10 | type CreditAccount struct { |
| @@ -83,3 +87,13 @@ func (creditAccount *CreditAccount) Update(data map[string]interface{}) error { | @@ -83,3 +87,13 @@ func (creditAccount *CreditAccount) Update(data map[string]interface{}) error { | ||
| 83 | } | 87 | } |
| 84 | return nil | 88 | return nil |
| 85 | } | 89 | } |
| 90 | + | ||
| 91 | +func ConditionInContractNumbers(numbers []string) string { | ||
| 92 | + var response = make([]map[string]string, 0) | ||
| 93 | + for i := range numbers { | ||
| 94 | + response = append(response, map[string]string{ | ||
| 95 | + "cooperationContractNumber": numbers[i], | ||
| 96 | + }) | ||
| 97 | + } | ||
| 98 | + return fmt.Sprintf("account_detail <@'%v'", json.MarshalToString(response)) | ||
| 99 | +} |
| @@ -2,8 +2,8 @@ package dao | @@ -2,8 +2,8 @@ package dao | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | - "github.com/go-pg/pg/v10" | ||
| 6 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 5 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" | ||
| 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" |
| 9 | "time" | 9 | "time" |
| @@ -86,7 +86,8 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa | @@ -86,7 +86,8 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa | ||
| 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["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { | 88 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { |
| 89 | - query.Where("cooperation_contract_number in (?)", pg.In(v)) | 89 | + //query.Where("cooperation_contract_number in (?)", pg.In(v)) |
| 90 | + query.Where(domain.ConditionInContractNumbers(v.([]string))) | ||
| 90 | } | 91 | } |
| 91 | query.Where("deleted_at is null") | 92 | query.Where("deleted_at is null") |
| 92 | err := query.Select(v) | 93 | err := query.Select(v) |
| @@ -123,7 +124,8 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma | @@ -123,7 +124,8 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma | ||
| 123 | query.Where("created_at < ?", v) | 124 | query.Where("created_at < ?", v) |
| 124 | } | 125 | } |
| 125 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { | 126 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { |
| 126 | - query.Where("cooperation_contract_number in (?)", pg.In(v)) | 127 | + //query.Where("cooperation_contract_number in (?)", pg.In(v)) |
| 128 | + query.Where(domain.ConditionInContractNumbers(v.([]string))) | ||
| 127 | } | 129 | } |
| 128 | query.Where("deleted_at is null") | 130 | query.Where("deleted_at is null") |
| 129 | if v, ok := queryOptions["sortByActuallyPaidAmount"]; ok { | 131 | if v, ok := queryOptions["sortByActuallyPaidAmount"]; ok { |
| @@ -207,7 +207,7 @@ group by cooperation_contract_number | @@ -207,7 +207,7 @@ group by cooperation_contract_number | ||
| 207 | return resMap, nil | 207 | return resMap, nil |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | -// getContractsDividendsEstimate 合约分红预算 | 210 | +// getContractsDividendsEstimate 合约分红预算 TODO:合约编号 |
| 211 | func (ptr *CooperationStatisticsService) getContractsCreditAccount(numbers []string) (map[string]*domain.CreditAccount, error) { | 211 | func (ptr *CooperationStatisticsService) getContractsCreditAccount(numbers []string) (map[string]*domain.CreditAccount, error) { |
| 212 | var creditAccounts []*domain.CreditAccount | 212 | var creditAccounts []*domain.CreditAccount |
| 213 | var resMap = make(map[string]*domain.CreditAccount) | 213 | var resMap = make(map[string]*domain.CreditAccount) |
| @@ -209,7 +209,8 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | @@ -209,7 +209,8 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac | ||
| 209 | query.Where(`cooperation_contract_number = ?`, fmt.Sprintf("%s", cooperationContractNumber)) | 209 | query.Where(`cooperation_contract_number = ?`, fmt.Sprintf("%s", cooperationContractNumber)) |
| 210 | } | 210 | } |
| 211 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { | 211 | if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 { |
| 212 | - query.Where("cooperation_contract_number in (?)", pg.In(v)) | 212 | + //query.Where("cooperation_contract_number in (?)", pg.In(v)) |
| 213 | + query.Where(domain.ConditionInContractNumbers(v.([]string))) | ||
| 213 | } | 214 | } |
| 214 | if paymentStatus, ok := queryOptions["paymentStatus"]; ok && paymentStatus.(int32) != 0 { | 215 | if paymentStatus, ok := queryOptions["paymentStatus"]; ok && paymentStatus.(int32) != 0 { |
| 215 | query.Where("payment_status = ?", paymentStatus) | 216 | query.Where("payment_status = ?", paymentStatus) |
-
请 注册 或 登录 后发表评论