|
|
@@ -2,6 +2,11 @@ package home
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "database/sql"
|
|
|
+ "fmt"
|
|
|
+ "math"
|
|
|
+ "time"
|
|
|
+
|
|
|
contDao "dashoo.cn/micro/app/dao/contract"
|
|
|
platDao "dashoo.cn/micro/app/dao/plat"
|
|
|
projDao "dashoo.cn/micro/app/dao/proj"
|
|
|
@@ -13,14 +18,10 @@ import (
|
|
|
projSrv "dashoo.cn/micro/app/service/proj"
|
|
|
"dashoo.cn/opms_libary/micro_srv"
|
|
|
"dashoo.cn/opms_libary/myerrors"
|
|
|
- "database/sql"
|
|
|
- "fmt"
|
|
|
"github.com/gogf/gf/database/gdb"
|
|
|
"github.com/gogf/gf/frame/g"
|
|
|
"github.com/gogf/gf/os/gtime"
|
|
|
"github.com/gogf/gf/util/gconv"
|
|
|
- "math"
|
|
|
- "time"
|
|
|
)
|
|
|
|
|
|
// getPersonalContractReportData 获取个人数据
|
|
|
@@ -516,7 +517,19 @@ func (s *HomeService) getNewAndConvertBusiness(productLine []string, params *map
|
|
|
}
|
|
|
currentTime := gtime.Now()
|
|
|
weekStart, weekEnd := currentTime.StartOfWeek(), currentTime.EndOfWeek()
|
|
|
- monthStart, monthEnd := currentTime.StartOfMonth(), currentTime.EndOfMonth()
|
|
|
+ // monthStart, monthEnd := currentTime.StartOfMonth(), currentTime.EndOfMonth()
|
|
|
+
|
|
|
+ monthStr, ok := (*params)["month"]
|
|
|
+ if !ok {
|
|
|
+ return nil, myerrors.TipsError("请求查询类型参数传递错误")
|
|
|
+ }
|
|
|
+ m := gconv.Int(monthStr)
|
|
|
+ now := time.Now()
|
|
|
+ firstOfMonth := time.Date(now.Year(), time.Month(m), 1, 0, 0, 0, 0, now.Location()) // 获取本月的第一天
|
|
|
+ lastOfMonth := firstOfMonth.AddDate(0, 1, -1) // 获取本月的最后一天
|
|
|
+ l, _ := time.LoadLocation("Asia/Shanghai")
|
|
|
+ startTime, _ := time.ParseInLocation("2006-01-02", firstOfMonth.Format("2006-01-02"), l)
|
|
|
+ endTime, _ := time.ParseInLocation("2006-01-02", lastOfMonth.Format("2006-01-02"), l)
|
|
|
|
|
|
businessDao := projDao.NewProjBusinessDao(s.Tenant)
|
|
|
busDynamicsDao := projDao.NewProjBusinessDynamicsDao(s.Tenant)
|
|
|
@@ -530,7 +543,7 @@ func (s *HomeService) getNewAndConvertBusiness(productLine []string, params *map
|
|
|
err = commonDb.WhereGTE(businessDao.C.FilingTime, weekStart).WhereLTE(businessDao.C.FilingTime, weekEnd).Scan(&addCount)
|
|
|
}
|
|
|
if searchType == "month" {
|
|
|
- err = commonDb.WhereGTE(businessDao.C.FilingTime, monthStart).WhereLTE(businessDao.C.FilingTime, monthEnd).Scan(&addCount)
|
|
|
+ err = commonDb.WhereGTE(businessDao.C.FilingTime, startTime).WhereLTE(businessDao.C.FilingTime, endTime).Scan(&addCount)
|
|
|
}
|
|
|
return addCount, err
|
|
|
}
|
|
|
@@ -548,7 +561,7 @@ func (s *HomeService) getNewAndConvertBusiness(productLine []string, params *map
|
|
|
err = commonDb.WhereGTE("contract."+contractDao.C.CreatedTime, weekStart).WhereLTE("contract."+contractDao.C.CreatedTime, weekEnd).Scan(&signCount)
|
|
|
}
|
|
|
if searchType == "month" {
|
|
|
- err = commonDb.WhereGTE("contract."+contractDao.C.CreatedTime, monthStart).WhereLTE("contract."+contractDao.C.CreatedTime, monthEnd).Scan(&signCount)
|
|
|
+ err = commonDb.WhereGTE("contract."+contractDao.C.CreatedTime, startTime).WhereLTE("contract."+contractDao.C.CreatedTime, endTime).Scan(&signCount)
|
|
|
}
|
|
|
return signCount, err
|
|
|
}
|
|
|
@@ -566,7 +579,7 @@ func (s *HomeService) getNewAndConvertBusiness(productLine []string, params *map
|
|
|
err = commonDb.WhereGTE("dy."+busDynamicsDao.C.CreatedTime, weekStart).WhereLTE("dy."+busDynamicsDao.C.CreatedTime, weekEnd).Scan(&convertData)
|
|
|
}
|
|
|
if searchType == "month" {
|
|
|
- err = commonDb.WhereGTE("dy."+busDynamicsDao.C.CreatedTime, monthStart).WhereLTE("dy."+busDynamicsDao.C.CreatedTime, monthEnd).Scan(&convertData)
|
|
|
+ err = commonDb.WhereGTE("dy."+busDynamicsDao.C.CreatedTime, startTime).WhereLTE("dy."+busDynamicsDao.C.CreatedTime, endTime).Scan(&convertData)
|
|
|
}
|
|
|
return convertData, err
|
|
|
}
|