From 006da15a364784dfa70539a3ddbcdcd63bb74569 Mon Sep 17 00:00:00 2001 From: yehongyang Date: Wed, 10 Nov 2021 17:17:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=8D=E5=8E=86=E6=AF=8F=E6=AC=A1=E7=BC=B4?= =?UTF-8?q?=E8=B4=B9=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/models/chargetab.go | 122 ++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 60 deletions(-) diff --git a/web/models/chargetab.go b/web/models/chargetab.go index d9b70c0..afad126 100644 --- a/web/models/chargetab.go +++ b/web/models/chargetab.go @@ -2804,9 +2804,15 @@ func (t *Chargetab) ChargeTotalPage(pageSize int, pageIndex int, startDate strin feeMap := make(map[int]Chargetab) begDate := make(map[string]time.Time) endDate := make(map[string]time.Time) + chargetimeMap := make(map[string]string) for _, v := range feeLog { feeID = append(feeID, v.Chargenr) feeMap[v.Chargenr] = v + if _, ok := chargetimeMap[v.Propertyid]; ok { + chargetimeMap[v.Propertyid] += ";" + v.Chargetime + } else { + chargetimeMap[v.Propertyid] = v.Chargetime + } if info, ok := begDate[v.Propertyid]; ok { if _info, _ := time.Parse("2006-01-02", v.Chargestartdate); _info.Before(info) { begDate[v.Propertyid] = _info @@ -2863,28 +2869,29 @@ func (t *Chargetab) ChargeTotalPage(pageSize int, pageIndex int, startDate strin //如果等于查询年 为当前 if v.Allocateyear == nowEndDate.Year() { nowMoney[info.Propertyid] += v.Allocateexpense - _year := utils.ValueToString(v.Allocateyear, "") - _month := utils.ValueToString(v.Allocatemonth, "") - if len(_month) == 1 { - _month = "0" + _month - } - //记录档期时间 - _date, _ := time.Parse("2006-01-02", _year+"-"+_month+"-01") - _dateEnd := _date.AddDate(0, 1, -1) - if _info, ok := nowStartDateMap[info.Propertyid]; ok { - if _date.Before(_info) { - nowStartDateMap[info.Propertyid] = _date - } - } else { + } + //_year := utils.ValueToString(v.Allocateyear, "") + //_month := utils.ValueToString(v.Allocatemonth, "") + //if len(_month) == 1 { + // _month = "0" + _month + //} + //记录档期时间 + _date, _ := time.Parse("2006-01-02", info.Chargestartdate) + //_dateEnd := _date.AddDate(0, 1, -1) + _dateEnd, _ := time.Parse("2006-01-02", info.Chargeenddate) + if _info, ok := nowStartDateMap[info.Propertyid]; ok { + if _date.Before(_info) { nowStartDateMap[info.Propertyid] = _date } - if _info, ok := nowEndDateMap[info.Propertyid]; ok { - if _dateEnd.After(_info) { - nowStartDateMap[info.Propertyid] = _dateEnd - } - } else { - nowEndDateMap[info.Propertyid] = _dateEnd + } else { + nowStartDateMap[info.Propertyid] = _date + } + if _info, ok := nowEndDateMap[info.Propertyid]; ok { + if _dateEnd.After(_info) { + nowStartDateMap[info.Propertyid] = _dateEnd } + } else { + nowEndDateMap[info.Propertyid] = _dateEnd } } @@ -2914,7 +2921,10 @@ func (t *Chargetab) ChargeTotalPage(pageSize int, pageIndex int, startDate strin if info, ok := lengthDate[v.Propertyid]; ok { data[k].Lengthdate = utils.ValueToString(info, "") } - data[k].Chargetime = startDate + /** + 需要加载每天时间 + */ + data[k].Chargetime = chargetimeMap[v.Propertyid] data[k].StatisticalDate = startDate //加载开始时间 //data[k].Begdate = utils.ValueToString(begDate[v.Propertyid], "") @@ -3068,28 +3078,24 @@ func (t *Chargetab) ChargeTotalPage(pageSize int, pageIndex int, startDate strin //如果等于查询年 为当前 if v.Allocateyear == nowEndDate.Year() { nowMoney[info.Accesscardid] += v.Allocateexpense - _year := utils.ValueToString(v.Allocateyear, "") - _month := utils.ValueToString(v.Allocatemonth, "") - if len(_month) == 1 { - _month = "0" + _month - } - //记录档期时间 - _date, _ := time.Parse("2006-01-02", _year+"-"+_month+"-01") - _dateEnd := _date.AddDate(0, 1, -1) - if _info, ok := nowStartDateMap[info.Accesscardid]; ok { - if _date.Before(_info) { - nowStartDateMap[info.Accesscardid] = _date - } - } else { - nowStartDateMap[info.Accesscardid] = _date + } + //记录档期时间 + _date, _ := time.Parse("2006-01-02", info.Chargestartdate) + //_dateEnd := _date.AddDate(0, 1, -1) + _dateEnd, _ := time.Parse("2006-01-02", info.Chargeenddate) + if _info, ok := nowStartDateMap[info.Propertyid]; ok { + if _date.Before(_info) { + nowStartDateMap[info.Propertyid] = _date } - if _info, ok := nowEndDateMap[info.Accesscardid]; ok { - if _dateEnd.After(_info) { - nowStartDateMap[info.Accesscardid] = _dateEnd - } - } else { - nowEndDateMap[info.Accesscardid] = _dateEnd + } else { + nowStartDateMap[info.Propertyid] = _date + } + if _info, ok := nowEndDateMap[info.Propertyid]; ok { + if _dateEnd.After(_info) { + nowStartDateMap[info.Propertyid] = _dateEnd } + } else { + nowEndDateMap[info.Propertyid] = _dateEnd } } @@ -3273,28 +3279,24 @@ func (t *Chargetab) ChargeTotalPage(pageSize int, pageIndex int, startDate strin //如果等于查询年 为当前 if v.Allocateyear == nowEndDate.Year() { nowMoney[info.Carportid] += v.Allocateexpense - _year := utils.ValueToString(v.Allocateyear, "") - _month := utils.ValueToString(v.Allocatemonth, "") - if len(_month) == 1 { - _month = "0" + _month - } - //记录档期时间 - _date, _ := time.Parse("2006-01-02", _year+"-"+_month+"-01") - _dateEnd := _date.AddDate(0, 1, -1) - if _info, ok := nowStartDateMap[info.Carportid]; ok { - if _date.Before(_info) { - nowStartDateMap[info.Carportid] = _date - } - } else { - nowStartDateMap[info.Carportid] = _date + } + //记录档期时间 + _date, _ := time.Parse("2006-01-02", info.Chargestartdate) + //_dateEnd := _date.AddDate(0, 1, -1) + _dateEnd, _ := time.Parse("2006-01-02", info.Chargeenddate) + if _info, ok := nowStartDateMap[info.Propertyid]; ok { + if _date.Before(_info) { + nowStartDateMap[info.Propertyid] = _date } - if _info, ok := nowEndDateMap[info.Carportid]; ok { - if _dateEnd.After(_info) { - nowStartDateMap[info.Carportid] = _dateEnd - } - } else { - nowEndDateMap[info.Carportid] = _dateEnd + } else { + nowStartDateMap[info.Propertyid] = _date + } + if _info, ok := nowEndDateMap[info.Propertyid]; ok { + if _dateEnd.After(_info) { + nowStartDateMap[info.Propertyid] = _dateEnd } + } else { + nowEndDateMap[info.Propertyid] = _dateEnd } }