作者 yangfu

个人端-企业统计修改

@@ -119,6 +119,9 @@ func (dao *DividendsEstimateDao) CountDividendsEstimateDividendsAmount(queryOpti @@ -119,6 +119,9 @@ func (dao *DividendsEstimateDao) CountDividendsEstimateDividendsAmount(queryOpti
119 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 119 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
120 query = query.Where(`dividends_estimate.org @> '{"orgId":"?"}'`, orgId) 120 query = query.Where(`dividends_estimate.org @> '{"orgId":"?"}'`, orgId)
121 } 121 }
  122 + if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
  123 + query = query.Where(`dividends_user->>'userBaseId'='?'`, userBaseId)
  124 + }
122 if _, ok := queryOptions["beginTime"]; ok { 125 if _, ok := queryOptions["beginTime"]; ok {
123 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))) 126 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)))
124 } 127 }
@@ -59,18 +59,25 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId @@ -59,18 +59,25 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId
59 } 59 }
60 60
61 // 3.个人分红统计 61 // 3.个人分红统计
62 - creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)  
63 - var allDividends = &CreditAccountStatisticsResponse{}  
64 - if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil { 62 + //creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
  63 + //var allDividends = &CreditAccountStatisticsResponse{}
  64 + //if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil {
  65 + // return nil, err
  66 + //}
  67 + //allDividends.Accounting = allDividends.Total - allDividends.Accounted
  68 +
  69 + creditAccountDao, _ := dao.NewDividendsEstimateDao(ptr.transactionContext)
  70 + var allDividends float64
  71 + if allDividends, err = creditAccountDao.CountDividendsEstimateDividendsAmount(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}); err != nil {
65 return nil, err 72 return nil, err
66 } 73 }
67 - allDividends.Accounting = allDividends.Total - allDividends.Accounted 74 + //allDividends.Accounting = allDividends.Total - allDividends.Accounted
68 75
69 var ret = &cooperationCompanyStatisticsResponse{ 76 var ret = &cooperationCompanyStatisticsResponse{
70 OrgId: orgId, 77 OrgId: orgId,
71 CooperationProjectCount: cooperationProjectCount, 78 CooperationProjectCount: cooperationProjectCount,
72 CooperationContractCount: cooperationContractCount, 79 CooperationContractCount: cooperationContractCount,
73 - DividendsIncome: utils.Round(allDividends.Accounted, 2), 80 + DividendsIncome: utils.Round(allDividends, 2),
74 } 81 }
75 return ret, nil 82 return ret, nil
76 } 83 }
@@ -36,6 +36,12 @@ func init() { @@ -36,6 +36,12 @@ func init() {
36 web.BConfig.Listen.HTTPSPort = 443 36 web.BConfig.Listen.HTTPSPort = 443
37 web.BConfig.Listen.HTTPSCertFile = "./config/fjmaimaimai.com_bundle.crt" 37 web.BConfig.Listen.HTTPSCertFile = "./config/fjmaimaimai.com_bundle.crt"
38 web.BConfig.Listen.HTTPSKeyFile = "./config/fjmaimaimai.com.key" 38 web.BConfig.Listen.HTTPSKeyFile = "./config/fjmaimaimai.com.key"
  39 + if os.Getenv("HTTPS_PORT") != "" {
  40 + portStr := os.Getenv("HTTPS_PORT")
  41 + if port, err := strconv.Atoi(portStr); err == nil {
  42 + web.BConfig.Listen.HTTPSPort = port
  43 + }
  44 + }
39 web.InsertFilter("/*", web.BeforeRouter, AllowCors()) 45 web.InsertFilter("/*", web.BeforeRouter, AllowCors())
40 web.InsertFilter("/*", web.BeforeExec, filters.AllowCors()) 46 web.InsertFilter("/*", web.BeforeExec, filters.AllowCors())
41 web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(Logger)) 47 web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(Logger))