#16 遍历每次缴费日期

Merged
louwenzhi merged 1 commits from feature_statistics into develop 3 years ago
  1. +62
    -60
      web/models/chargetab.go

+ 62
- 60
web/models/chargetab.go View File

@ -2804,9 +2804,15 @@ func (t *Chargetab) ChargeTotalPage(pageSize int, pageIndex int, startDate strin
feeMap := make(map[int]Chargetab) feeMap := make(map[int]Chargetab)
begDate := make(map[string]time.Time) begDate := make(map[string]time.Time)
endDate := make(map[string]time.Time) endDate := make(map[string]time.Time)
chargetimeMap := make(map[string]string)
for _, v := range feeLog { for _, v := range feeLog {
feeID = append(feeID, v.Chargenr) feeID = append(feeID, v.Chargenr)
feeMap[v.Chargenr] = v 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, ok := begDate[v.Propertyid]; ok {
if _info, _ := time.Parse("2006-01-02", v.Chargestartdate); _info.Before(info) { if _info, _ := time.Parse("2006-01-02", v.Chargestartdate); _info.Before(info) {
begDate[v.Propertyid] = _info begDate[v.Propertyid] = _info
@ -2863,28 +2869,29 @@ func (t *Chargetab) ChargeTotalPage(pageSize int, pageIndex int, startDate strin
//如果等于查询年 为当前 //如果等于查询年 为当前
if v.Allocateyear == nowEndDate.Year() { if v.Allocateyear == nowEndDate.Year() {
nowMoney[info.Propertyid] += v.Allocateexpense 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 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 { if info, ok := lengthDate[v.Propertyid]; ok {
data[k].Lengthdate = utils.ValueToString(info, "") data[k].Lengthdate = utils.ValueToString(info, "")
} }
data[k].Chargetime = startDate
/**
需要加载每天时间
*/
data[k].Chargetime = chargetimeMap[v.Propertyid]
data[k].StatisticalDate = startDate data[k].StatisticalDate = startDate
//加载开始时间 //加载开始时间
//data[k].Begdate = utils.ValueToString(begDate[v.Propertyid], "") //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() { if v.Allocateyear == nowEndDate.Year() {
nowMoney[info.Accesscardid] += v.Allocateexpense 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() { if v.Allocateyear == nowEndDate.Year() {
nowMoney[info.Carportid] += v.Allocateexpense 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
} }
} }


Loading…
Cancel
Save