作者 yangfu

Merge branch 'dev' into test

... ... @@ -119,6 +119,9 @@ func (dao *DividendsEstimateDao) CountDividendsEstimateDividendsAmount(queryOpti
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query = query.Where(`dividends_estimate.org @> '{"orgId":"?"}'`, orgId)
}
if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
query = query.Where(`dividends_user->>'userBaseId'='?'`, userBaseId)
}
if _, ok := queryOptions["beginTime"]; ok {
query.Where(fmt.Sprintf("created_at>='%s' and created_at<'%s'", (queryOptions["beginTime"].(time.Time)).Format(time.RFC3339), (queryOptions["endTime"].(time.Time)).Format(time.RFC3339)))
}
... ...
... ... @@ -59,18 +59,25 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId
}
// 3.个人分红统计
creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
var allDividends = &CreditAccountStatisticsResponse{}
if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil {
//creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
//var allDividends = &CreditAccountStatisticsResponse{}
//if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil {
// return nil, err
//}
//allDividends.Accounting = allDividends.Total - allDividends.Accounted
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
//allDividends.Accounting = allDividends.Total - allDividends.Accounted
var ret = &cooperationCompanyStatisticsResponse{
OrgId: orgId,
CooperationProjectCount: cooperationProjectCount,
CooperationContractCount: cooperationContractCount,
DividendsIncome: utils.Round(allDividends.Accounted, 2),
DividendsIncome: utils.Round(allDividends, 2),
}
return ret, nil
}
... ... @@ -128,7 +135,7 @@ func (ptr *CooperationStatisticsService) cooperationContractCount(numbers []stri
query.ColumnExpr("count(*) total")
query.Where("cooperation_contract_number in (?)", pg.In(numbers))
if status > 0 {
query.Where("status =? ")
query.Where("status =? ", status)
}
query.Select(&total)
return total
... ...
... ... @@ -36,6 +36,12 @@ func init() {
web.BConfig.Listen.HTTPSPort = 443
web.BConfig.Listen.HTTPSCertFile = "./config/fjmaimaimai.com_bundle.crt"
web.BConfig.Listen.HTTPSKeyFile = "./config/fjmaimaimai.com.key"
if os.Getenv("HTTPS_PORT") != "" {
portStr := os.Getenv("HTTPS_PORT")
if port, err := strconv.Atoi(portStr); err == nil {
web.BConfig.Listen.HTTPSPort = port
}
}
web.InsertFilter("/*", web.BeforeRouter, AllowCors())
web.InsertFilter("/*", web.BeforeExec, filters.AllowCors())
web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(Logger))
... ...