...
|
...
|
@@ -51,32 +51,31 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId |
|
|
}
|
|
|
|
|
|
// 2.相关合约统计
|
|
|
cooperationContractRelevantRepository, _ := dao.NewCooperationContractUndertakerDao(ptr.transactionContext)
|
|
|
cooperationContractCount, _, err := cooperationContractRelevantRepository.Find(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId,
|
|
|
"limit": 1})
|
|
|
contractInfo, err := ptr.PersonCooperationContractStatistics(map[string]interface{}{
|
|
|
"orgId": orgId,
|
|
|
"userBaseId": userBaseId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
// 3.个人分红统计
|
|
|
//creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
|
|
|
//var allDividends = &CreditAccountStatisticsResponse{}
|
|
|
//if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil {
|
|
|
//cooperationContractRelevantRepository, _ := dao.NewCooperationContractUndertakerDao(ptr.transactionContext)
|
|
|
//cooperationContractCount, _, err := cooperationContractRelevantRepository.Find(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId,
|
|
|
// "limit": 100,"distinctColumnContractNumber":1})
|
|
|
//if err != nil {
|
|
|
// return nil, err
|
|
|
//}
|
|
|
//allDividends.Accounting = allDividends.Total - allDividends.Accounted
|
|
|
|
|
|
// 3.个人分红统计
|
|
|
creditAccountDao, _ := dao.NewDividendsEstimateDao(ptr.transactionContext)
|
|
|
var allDividends float64
|
|
|
if allDividends, err = creditAccountDao.CountDividendsEstimateDividendsAmount(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
//allDividends.Accounting = allDividends.Total - allDividends.Accounted
|
|
|
|
|
|
var ret = &cooperationCompanyStatisticsResponse{
|
|
|
OrgId: orgId,
|
|
|
CooperationProjectCount: cooperationProjectCount,
|
|
|
CooperationContractCount: cooperationContractCount,
|
|
|
CooperationContractCount: int64(contractInfo.ContractSum),
|
|
|
DividendsIncome: utils.Round(allDividends, 2),
|
|
|
}
|
|
|
return ret, nil
|
...
|
...
|
@@ -96,10 +95,11 @@ type cooperationCompanyStatisticsResponse struct { |
|
|
}
|
|
|
|
|
|
// 个人-用户合约统计
|
|
|
func (ptr *CooperationStatisticsService) PersonCooperationContractStatistics(queryOptions map[string]interface{}) (interface{}, error) {
|
|
|
func (ptr *CooperationStatisticsService) PersonCooperationContractStatistics(queryOptions map[string]interface{}) (*ContractSum, error) {
|
|
|
// 参数验证
|
|
|
var request = struct {
|
|
|
UserBaseId int64 `json:"userBaseId" valid:"Required"`
|
|
|
OrgId int64 `json:"orgId"`
|
|
|
}{}
|
|
|
if err := LoadQueryObject(queryOptions, &request); err != nil {
|
|
|
return nil, err
|
...
|
...
|
@@ -112,10 +112,7 @@ func (ptr *CooperationStatisticsService) PersonCooperationContractStatistics(que |
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
var response = struct {
|
|
|
ContractSum int `json:"contractSum"`
|
|
|
ContractStoppedSum int `json:"contractStoppedSum"`
|
|
|
}{}
|
|
|
var response = &ContractSum{}
|
|
|
if len(contractUndertakers) == 0 {
|
|
|
return response, nil
|
|
|
}
|
...
|
...
|
@@ -128,6 +125,11 @@ func (ptr *CooperationStatisticsService) PersonCooperationContractStatistics(que |
|
|
return response, nil
|
|
|
}
|
|
|
|
|
|
type ContractSum struct {
|
|
|
ContractSum int `json:"contractSum"`
|
|
|
ContractStoppedSum int `json:"contractStoppedSum"`
|
|
|
}
|
|
|
|
|
|
func (ptr *CooperationStatisticsService) cooperationContractCount(contractIds []int64, status int) int {
|
|
|
var total int
|
|
|
var contract = new(models.CooperationContract)
|
...
|
...
|
|