切换导航条
此项目
正在载入...
登录
allied-creation
/
allied-creation-cooperation
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
陈志颖
3 years ago
提交
10d3a6d3f8b0e539085ca85619ea977f9add729c
2 个父辈
7601eabf
0832e26b
合并分支 'dev' 到 'test'
Dev 查看合并请求
!41
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
196 行增加
和
39 行删除
pkg/application/cooperationContract/service/cooperation_contract.go
pkg/application/dividendsEstimate/service/dividends_estimate.go
pkg/infrastructure/domain_service/pg_cancel_dividends_estimate_service.go
pkg/infrastructure/domain_service/pg_confirm_dividends_incentives_estimate_service.go
pkg/infrastructure/domain_service/pg_cooperation_statistics_service.go
pkg/infrastructure/pg/models/cooperation_contract_change_log.go
pkg/infrastructure/repository/pg_cooperation_contract_repository.go
pkg/infrastructure/repository/pg_dividends_estimate_repository.go
pkg/application/cooperationContract/service/cooperation_contract.go
查看文件 @
10d3a6d
...
...
@@ -1095,6 +1095,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
UndertakerId
:
undertakerId
,
UserId
:
undertakerDomain
.
UserId
,
CooperationContractNumber
:
cooperationContract
.
CooperationContractNumber
,
CooperationContractId
:
cooperationContract
.
CooperationContractId
,
UserBaseId
:
undertakerDomain
.
UserBaseId
,
Org
:
undertakerDomain
.
Org
,
Orgs
:
undertakerDomain
.
Orgs
,
...
...
pkg/application/dividendsEstimate/service/dividends_estimate.go
查看文件 @
10d3a6d
...
...
@@ -354,12 +354,44 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs
}
// 校验是否能够取消
if
dividendsEstimate
.
DividendsType
==
domain
.
ORDER_DIVIDENDS
||
dividendsEstimate
.
DividendsType
==
domain
.
RETURN_WRITE_OFF
{
// 订单分红、退货冲销
if
countRelativeDividendsEstimates
,
dividendsEstimatesRelative
,
err2
:=
dividendsEstimateRepository
.
Find
(
map
[
string
]
interface
{}{
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
});
err2
!=
nil
{
if
dividendsEstimate
.
DividendsType
==
domain
.
ORDER_DIVIDENDS
||
dividendsEstimate
.
DividendsType
==
domain
.
RETURN_WRITE_OFF
{
// 订单分红/退货冲销
// 自定义查询
queryOptions
:=
make
(
map
[
string
]
interface
{})
//参与分红类型,1承接人,2推荐人,3关联业务员
if
dividendsEstimate
.
DividendsParticipateType
==
1
{
// 当前取消的是承接人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"dividendsParticipateTypes"
:
[]
int32
{
2
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsTypes"
:
[]
int32
{
1
,
2
},
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
2
{
// 当前取消的是推荐人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsTypes"
:
[]
int32
{
1
,
2
},
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
3
{
// 当前取消的是关联业务员的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
2
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsTypes"
:
[]
int32
{
1
,
2
},
}
}
if
countRelativeDividendsEstimates
,
dividendsEstimatesRelative
,
err2
:=
dividendsEstimateRepository
.
Find
(
queryOptions
);
err2
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err2
.
Error
())
}
else
{
if
countRelativeDividendsEstimates
>
0
{
...
...
@@ -371,11 +403,43 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs
}
}
}
else
if
dividendsEstimate
.
DividendsType
==
domain
.
MONEY_INCENTIVES
{
// 金额激励分红
if
countRelativeDividendsEstimates
,
dividendsEstimatesRelative
,
err3
:=
dividendsEstimateRepository
.
Find
(
map
[
string
]
interface
{}{
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
});
err3
!=
nil
{
// 自定义查询
queryOptions
:=
make
(
map
[
string
]
interface
{})
//参与分红类型,1承接人,2推荐人,3关联业务员
if
dividendsEstimate
.
DividendsParticipateType
==
1
{
// 当前取消的是承接人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"dividendsParticipateTypes"
:
[]
int32
{
2
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsType"
:
int32
(
3
),
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
2
{
// 当前取消的是推荐人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsType"
:
int32
(
3
),
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
3
{
// 当前取消的是关联业务员的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
2
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsType"
:
int32
(
3
),
}
}
if
countRelativeDividendsEstimates
,
dividendsEstimatesRelative
,
err3
:=
dividendsEstimateRepository
.
Find
(
queryOptions
);
err3
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err3
.
Error
())
}
else
{
if
countRelativeDividendsEstimates
>
0
{
...
...
@@ -388,12 +452,13 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs
}
}
}
// 批量取消分红预算单
if
dividendsEstimatesCanceled
,
err
:=
cancelDividendsEstimateService
.
CancelEstimate
(
dividendsEstimateIds
,
operator
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
if
dividendsEstimatesCanceled
,
errCancel
:=
cancelDividendsEstimateService
.
CancelEstimate
(
dividendsEstimateIds
,
operator
);
errCancel
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
errCancel
.
Error
())
}
else
{
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
if
errTx
:=
transactionContext
.
CommitTransaction
();
errTx
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
errTx
.
Error
())
}
return
dividendsEstimatesCanceled
,
nil
}
...
...
@@ -651,6 +716,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
else
{
dividendsEstimates
:=
make
([]
*
domain
.
DividendsEstimate
,
0
)
// 统计当前企业分红预算单数
count
,
err
:=
dividendsEstimateDao
.
CountDividendsEstimate
(
map
[
string
]
interface
{}{
"companyId"
:
confirmDividendsIncentivesEstimateCommand
.
CompanyId
,
...
...
@@ -658,6 +724,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
var
countDividendsEstimate
int64
for
_
,
orderGood
:=
range
orderGoods
{
dividendsEstimate
:=
&
domain
.
DividendsEstimate
{}
...
...
@@ -706,6 +773,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
UpdatedAt
:
time
.
Time
{},
OrderGoodId
:
orderGood
.
OrderGoodId
,
OrderGoodAmount
:
orderGood
.
OrderGoodAmount
,
PaymentStatus
:
int32
(
1
),
}
dividendsEstimates
=
append
(
dividendsEstimates
,
dividendsEstimate
)
...
...
@@ -759,6 +827,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
UpdatedAt
:
time
.
Time
{},
OrderGoodId
:
orderGood
.
OrderGoodId
,
OrderGoodAmount
:
orderGood
.
OrderGoodAmount
,
PaymentStatus
:
int32
(
1
),
}
dividendsEstimates
=
append
(
dividendsEstimates
,
dividendsEstimate
)
...
...
@@ -1095,6 +1164,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
CreatedAt
:
time
.
Now
(),
DeletedAt
:
time
.
Time
{},
UpdatedAt
:
time
.
Time
{},
PaymentStatus
:
int32
(
1
),
}
dividendsEstimates
=
append
(
dividendsEstimates
,
dividendsEstimate
)
...
...
pkg/infrastructure/domain_service/pg_cancel_dividends_estimate_service.go
查看文件 @
10d3a6d
...
...
@@ -40,7 +40,6 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
return
nil
,
err
}
else
{
dividendsReturnedOrderRepository
=
repo
}
// 订单产品仓储初始化
...
...
@@ -60,14 +59,45 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
var
dividendsEstimatesCanceled
[]
*
domain
.
DividendsEstimate
var
orderOrReturnOrderNums
[]
string
for
_
,
dividendsEstimate
:=
range
dividendsEstimates
{
if
dividendsEstimate
.
DividendsType
!=
3
{
// 非金额激励分红预算单处理
if
dividendsEstimate
.
DividendsType
==
1
||
dividendsEstimate
.
DividendsType
==
2
{
// 1.订单分红 2.退货冲销
// 自定义查询
queryOptions
:=
make
(
map
[
string
]
interface
{})
//参与分红类型,1承接人,2推荐人,3关联业务员
if
dividendsEstimate
.
DividendsParticipateType
==
1
{
// 当前取消的是承接人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"dividendsParticipateTypes"
:
[]
int32
{
2
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsTypes"
:
[]
int32
{
1
,
2
},
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
2
{
// 当前取消的是推荐人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsTypes"
:
[]
int32
{
1
,
2
},
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
3
{
// 当前取消的是关联业务员的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
2
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsTypes"
:
[]
int32
{
1
,
2
},
}
}
// 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单
if
countRelative
,
dividendsEstimatesRelative
,
err2
:=
dividendsEstimateRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"orderOrReturnedOrderNum"
:
dividendsEstimate
.
OrderOrReturnedOrderNum
,
"offsetLimit"
:
false
,
});
err2
!=
nil
{
if
countRelative
,
dividendsEstimatesRelative
,
err2
:=
dividendsEstimateRepository
.
Find
(
queryOptions
);
err2
!=
nil
{
return
nil
,
err2
}
else
{
if
countRelative
>
0
{
...
...
@@ -84,15 +114,45 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
dividendsEstimatesCanceled
=
append
(
dividendsEstimatesCanceled
,
dividendsEstimatesRelativeCanceled
...
)
}
}
}
else
if
dividendsEstimate
.
DividendsType
==
3
{
}
else
if
dividendsEstimate
.
DividendsType
==
3
{
// 3.金额激励
// 自定义查询
queryOptions
:=
make
(
map
[
string
]
interface
{})
//参与分红类型,1承接人,2推荐人,3关联业务员
if
dividendsEstimate
.
DividendsParticipateType
==
1
{
// 当前取消的是承接人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"dividendsParticipateTypes"
:
[]
int32
{
2
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsType"
:
int32
(
3
),
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
2
{
// 当前取消的是推荐人的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
3
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsType"
:
int32
(
3
),
}
}
else
if
dividendsEstimate
.
DividendsParticipateType
==
3
{
// 当前取消的是关联业务员的分红预算单
queryOptions
=
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"dividendsParticipateTypes"
:
[]
int32
{
1
,
2
},
"offsetLimit"
:
false
,
"dividendsStage"
:
dividendsEstimate
.
DividendsStage
,
"dividendsType"
:
int32
(
3
),
}
}
// 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单
if
countRelative
,
dividendsEstimatesRelative
,
err2
:=
dividendsEstimateRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
dividendsEstimate
.
Company
.
CompanyId
,
"orgId"
:
dividendsEstimate
.
Org
.
OrgId
,
"cooperationContractNumber"
:
dividendsEstimate
.
CooperationContractNumber
,
"dividendsType"
:
int32
(
3
),
"offsetLimit"
:
false
,
});
err2
!=
nil
{
if
countRelative
,
dividendsEstimatesRelative
,
err2
:=
dividendsEstimateRepository
.
Find
(
queryOptions
);
err2
!=
nil
{
return
nil
,
err2
}
else
{
if
countRelative
>
0
{
...
...
@@ -110,18 +170,24 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
}
}
// 分红订单
或分红退货单状态变更
// 分红订单
var
orderNums
[]
string
// 分红退货单
var
returnedOrderNums
[]
string
if
len
(
orderOrReturnOrderNums
)
>
0
{
// 订单/退货单号数组去重
orderOrReturnOrderNumsWithoutDup
:=
utils
.
RemoveDuplication
(
orderOrReturnOrderNums
)
// 分离订单和退货单
for
_
,
orderNullNum
:=
range
orderOrReturnOrderNumsWithoutDup
{
if
orderNullNum
[
:
2
]
==
"RE"
{
// 分红退后单
returnedOrderNums
=
append
(
returnedOrderNums
,
orderNullNum
)
}
else
if
orderNullNum
[
:
2
]
==
"SL"
{
// 分红订单
orderNums
=
append
(
orderNums
,
orderNullNum
)
if
len
(
orderNullNum
)
>
0
{
if
orderNullNum
[
:
2
]
==
"RE"
{
// 分红退后单
returnedOrderNums
=
append
(
returnedOrderNums
,
orderNullNum
)
}
else
if
orderNullNum
[
:
2
]
==
"SL"
{
// 分红订单
orderNums
=
append
(
orderNums
,
orderNullNum
)
}
}
}
...
...
pkg/infrastructure/domain_service/pg_confirm_dividends_incentives_estimate_service.go
查看文件 @
10d3a6d
...
...
@@ -8,6 +8,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/repository"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
)
type
ConfirmDividendsIncentivesEstimateService
struct
{
...
...
@@ -53,6 +54,10 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
// 确认业绩分红预算
var
dividendsEstimateDetails
[]
*
service
.
DividendsEstimateDetail
for
_
,
orderGood
:=
range
orderGoods
{
log
.
Logger
.
Info
(
"业绩分红预算产品"
,
map
[
string
]
interface
{}{
"orderGood"
:
orderGood
,
})
// 获取合约
cooperationContract
,
err
:=
cooperationContractRepository
.
FindOne
(
map
[
string
]
interface
{}{
"cooperationContractNumber"
:
orderGood
.
CooperationContractNumber
,
...
...
@@ -95,6 +100,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
})
continue
}
else
{
log
.
Logger
.
Info
(
"产品相关的合约"
,
map
[
string
]
interface
{}{
"cooperationContract"
:
cooperationContract
,
})
if
cooperationContract
.
Status
==
2
{
var
orderNumber
string
if
orderGood
.
DividendsOrderNumber
!=
""
{
...
...
pkg/infrastructure/domain_service/pg_cooperation_statistics_service.go
查看文件 @
10d3a6d
...
...
@@ -178,7 +178,7 @@ func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64
//getRelevantContracts 获取相关人的合约
func
(
ptr
*
CooperationStatisticsService
)
getRelevantContracts
(
queryOptions
map
[
string
]
interface
{})
([]
string
,
error
)
{
undertakerRepository
,
_
:=
repository
.
NewCooperationContract
Relevant
Repository
(
ptr
.
transactionContext
)
undertakerRepository
,
_
:=
repository
.
NewCooperationContract
Undertaker
Repository
(
ptr
.
transactionContext
)
_
,
undertakers
,
err
:=
undertakerRepository
.
Find
(
queryOptions
)
var
numbers
[]
string
for
i
:=
range
undertakers
{
...
...
pkg/infrastructure/pg/models/cooperation_contract_change_log.go
查看文件 @
10d3a6d
...
...
@@ -30,7 +30,7 @@ type CooperationContractChangeLog struct {
// 更新时间
UpdatedAt
time
.
Time
`comment:"更新时间"`
// 删除时间
DeletedAt
time
.
Time
`comment:"删除时间"`
DeletedAt
time
.
Time
`comment:"删除时间"
pg:",soft_delete"
`
// 创建时间
CreatedAt
time
.
Time
`comment:"创建时间"`
}
...
...
pkg/infrastructure/repository/pg_cooperation_contract_repository.go
查看文件 @
10d3a6d
...
...
@@ -1146,7 +1146,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
if
cooperationContractNumber
,
ok
:=
queryOptions
[
"cooperationContractNumber"
];
ok
&&
cooperationContractNumber
!=
""
{
query
.
Where
(
"cooperation_contract_number ilike ?"
,
fmt
.
Sprintf
(
"%%%s%%"
,
cooperationContractNumber
))
}
if
cooperationContractName
,
ok
:=
queryOptions
[
"cooperationContactName"
];
ok
&&
cooperationContractName
!=
""
{
if
cooperationContractName
,
ok
:=
queryOptions
[
"cooperationCont
r
actName"
];
ok
&&
cooperationContractName
!=
""
{
query
.
Where
(
"cooperation_contract_name like ?"
,
fmt
.
Sprintf
(
"%%%s%%"
,
cooperationContractName
))
}
if
departmentName
,
ok
:=
queryOptions
[
"departmentName"
];
ok
&&
departmentName
!=
""
{
...
...
pkg/infrastructure/repository/pg_dividends_estimate_repository.go
查看文件 @
10d3a6d
...
...
@@ -307,6 +307,9 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
if
dividendsType
,
ok
:=
queryOptions
[
"dividendsType"
];
ok
&&
dividendsType
.
(
int32
)
!=
0
{
query
.
Where
(
"dividends_type = ?"
,
dividendsType
)
}
if
dividendsTypes
,
ok
:=
queryOptions
[
"dividendsTypes"
];
ok
&&
len
(
dividendsTypes
.
([]
int32
))
>
0
{
query
.
Where
(
"dividends_type in (?)"
,
pg
.
In
(
dividendsTypes
.
([]
int32
)))
}
if
dividendsEstimateOrderNumber
,
ok
:=
queryOptions
[
"dividendsEstimateOrderNumber"
];
ok
&&
dividendsEstimateOrderNumber
!=
""
{
query
.
Where
(
"dividends_estimate_order_number ilike ?"
,
fmt
.
Sprintf
(
"%%%s%%"
,
dividendsEstimateOrderNumber
))
}
...
...
@@ -325,12 +328,21 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
if
dividendsParticipateType
,
ok
:=
queryOptions
[
"dividendsParticipateType"
];
ok
&&
dividendsParticipateType
.
(
int32
)
!=
0
{
query
.
Where
(
"dividends_participate_type = ?"
,
dividendsParticipateType
)
}
if
dividendsParticipateTypes
,
ok
:=
queryOptions
[
"dividendsParticipateTypes"
];
ok
&&
len
(
dividendsParticipateTypes
.
([]
int32
))
>
0
{
query
.
Where
(
"dividends_participate_type in (?)"
,
pg
.
In
(
dividendsParticipateTypes
.
([]
int32
)))
}
if
dividendsStage
,
ok
:=
queryOptions
[
"dividendsStage"
];
ok
&&
dividendsStage
.
(
int32
)
>
0
{
query
.
Where
(
"dividends_stage = ?"
,
dividendsStage
)
}
if
cooperationContractNumber
,
ok
:=
queryOptions
[
"cooperationContractNumber"
];
ok
&&
cooperationContractNumber
!=
""
{
query
.
Where
(
"cooperation_contract_number = ?"
,
cooperationContractNumber
)
}
if
dividendsUserId
,
ok
:=
queryOptions
[
"dividendsUserId"
];
ok
&&
dividendsUserId
.
(
int64
)
!=
0
{
query
.
Where
(
`dividends_user @> '{"userId":"?"}'`
,
dividendsUserId
)
}
if
userBaseId
,
ok
:=
queryOptions
[
"userBaseId"
];
ok
&&
userBaseId
.
(
int64
)
!=
0
{
query
.
Where
(
`dividends_user @> '{"userBaseId":"?"}'`
,
userBaseId
)
}
if
companyId
,
ok
:=
queryOptions
[
"companyId"
];
ok
&&
companyId
.
(
int64
)
!=
0
{
query
.
Where
(
"company->>'companyId' = '?'"
,
companyId
)
}
...
...
请
注册
或
登录
后发表评论