|
@@ -1230,11 +1230,23 @@ func (this *StatisticCompanyMergerController) CompanyContractPercentageList() {
|
|
|
contractDataType := this.GetString("ContractDataType")
|
|
|
startDate := this.GetString("StartDate")
|
|
|
endDate := this.GetString("EndDate")
|
|
|
+ initendDate := this.GetString("EndDate")
|
|
|
if startDate == "" || endDate == "" {
|
|
|
br.Msg = "开始时间或结束时间不能为空"
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ //如果传的查询方式是今年,那么就以当前时间作为截止时间
|
|
|
+ //if endDate == strconv.Itoa(time.Now().Year())+"-12-31" {
|
|
|
+ // endDate = time.Now().Format(utils.FormatDate)
|
|
|
+ //}
|
|
|
+
|
|
|
+ //判断结束时间是否晚于当前时间,如果晚于当前时间,那么就把当前时间作为截止时间。
|
|
|
+ endDateTime, _ := time.Parse(utils.FormatDate, endDate)
|
|
|
+ if endDateTime.After(time.Now()) {
|
|
|
+ endDate = time.Now().Format(utils.FormatDate)
|
|
|
+ }
|
|
|
+ //fmt.Println("endDate", endDate)
|
|
|
if contractDataType == "" {
|
|
|
contractDataType = "续约合同"
|
|
|
}
|
|
@@ -1339,7 +1351,7 @@ func (this *StatisticCompanyMergerController) CompanyContractPercentageList() {
|
|
|
renewalRateMoney = fmt.Sprint(utils.SubFloatToString(float64(totalMoneyRenewal)/float64(totalMoneyNew+totalMoneyRenewalEnd)*100, 2), "%")
|
|
|
renewalRateTotal = fmt.Sprint(utils.SubFloatToString(float64(totalRenewal)/float64(totalNew+totalRenewalEnd)*100, 2), "%")
|
|
|
}
|
|
|
- renewalRateTotalContent = fmt.Sprint(totalMoneyRenewal/10000, "万元/", (totalMoneyNew+totalMoneyRenewalEnd)/10000, "万元")
|
|
|
+ renewalRateTotalContent = fmt.Sprint(totalMoneyRenewal, (totalMoneyNew + totalMoneyRenewalEnd))
|
|
|
renewalRateMoneyContent = fmt.Sprint(totalRenewal, "份/", totalNew+totalRenewalEnd, "份")
|
|
|
|
|
|
if contractDataType == "续约合同" {
|
|
@@ -1381,15 +1393,16 @@ func (this *StatisticCompanyMergerController) CompanyContractPercentageList() {
|
|
|
condition1 := condition
|
|
|
pars1 := pars
|
|
|
|
|
|
- ////判断结束时间是否晚于当前时间,如果晚于当前时间,那么就把当前时间作为截止时间。并且当前这天的到期的合同,不查询
|
|
|
- //endDateTime, _ := time.Parse(utils.FormatDate, endDate)
|
|
|
- //if endDateTime.After(time.Now()) {
|
|
|
- // endDate = time.Now().Format(utils.FormatDate)
|
|
|
- // condition1 += ` AND a.end_date >= ? AND a.end_date < ? `
|
|
|
- //} else {
|
|
|
- // condition1 += ` AND a.end_date >= ? AND a.end_date <= ? `
|
|
|
- //}
|
|
|
- condition1 += ` AND a.end_date >= ? AND a.end_date <= ? `
|
|
|
+ //判断结束时间是否晚于当前时间,如果晚于当前时间,那么就把当前时间作为截止时间。并且当前这天的到期的合同,不查询
|
|
|
+ endDateTime, _ := time.Parse(utils.FormatDate, initendDate)
|
|
|
+ if endDateTime.After(time.Now()) {
|
|
|
+ endDate = time.Now().Format(utils.FormatDate)
|
|
|
+ condition1 += ` AND a.end_date >= ? AND a.end_date < ? `
|
|
|
+ } else {
|
|
|
+ condition1 += ` AND a.end_date >= ? AND a.end_date <= ? `
|
|
|
+ }
|
|
|
+
|
|
|
+ //condition1 += ` AND a.end_date >= ? AND a.end_date <= ? `
|
|
|
pars1 = append(pars1, startDate, endDate)
|
|
|
|
|
|
total, err := company.GetIncrementalRenewalCompanyProductMergeCount(condition1, pars1)
|
|
@@ -1457,6 +1470,36 @@ func (this *StatisticCompanyMergerController) CompanyContractPercentageList() {
|
|
|
br.Data = resp
|
|
|
}
|
|
|
|
|
|
+// @Title 权益客户续约率统计所能查询的年份
|
|
|
+// @Description权益客户续约率统计所能查询的年份接口
|
|
|
+// @Success 200 {object} response.IncrementalCompanyListResp
|
|
|
+// @router /merge_company/get_year_list [get]
|
|
|
+func (this *StatisticCompanyMergerController) GetYearList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ thisYear := time.Now().Year()
|
|
|
+ startYear := 2021 //初始查询年份
|
|
|
+
|
|
|
+ var resp []int
|
|
|
+ for i := startYear; i <= thisYear; i++ {
|
|
|
+ resp = append(resp, i)
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
func init213() {
|
|
|
var condition string
|
|
|
var pars []interface{}
|