|
|
@ -402,9 +402,12 @@ func GetChargeStatisticData(ctx iris.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
var chargeTab models.Chargeallocationtab |
|
|
|
chargeTab.Cid = user.Pid |
|
|
|
//chargeTab.Cid = user.Pid
|
|
|
|
year := time.Now().Year() |
|
|
|
result, err := chargeTab.GetChargeStatisticData(cid, year) |
|
|
|
start := fmt.Sprintf("%d0101", year) |
|
|
|
end := fmt.Sprintf("%d1231", year) |
|
|
|
selectType := ctx.URLParam("type") |
|
|
|
result, err := chargeTab.GetChargeStatisticData(cid, year, start, end, selectType) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusInternalServerError, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
@ -412,8 +415,8 @@ func GetChargeStatisticData(ctx iris.Context) { |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, result) |
|
|
|
} |
|
|
|
|
|
|
|
// 按日期和缴费类型获取缴费统计数据
|
|
|
|
func GetChargeTypeStatisticData(ctx iris.Context) { |
|
|
|
// 按日期和缴费类型获取缴费数据
|
|
|
|
func GetChargeTypeData(ctx iris.Context) { |
|
|
|
user, ok := jwts.ParseToken(ctx) |
|
|
|
utils.TrimStruct(user, *user) |
|
|
|
if !ok { |
|
|
@ -423,12 +426,22 @@ func GetChargeTypeStatisticData(ctx iris.Context) { |
|
|
|
logs := new(models.LeitServerLog) |
|
|
|
logs.File = "/controllers/Chargetab_controller.go" |
|
|
|
logs.Level = "info" |
|
|
|
logs.Function = "GetChargeTypeStatisticData" |
|
|
|
logs.Message = "按日期和收款类型查看缴费统计" |
|
|
|
logs.Function = "GetChargeTypeData" |
|
|
|
logs.Message = "按日期和收款类型查看缴费数据" |
|
|
|
logs.Operator = user.Userid |
|
|
|
logs.TimeStamp = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
logs.InsertRecord() |
|
|
|
|
|
|
|
var pageSize = 10 |
|
|
|
var pageIndex = 1 |
|
|
|
if size := ctx.URLParam("size"); size != "" { |
|
|
|
pageSize = utils.ValueToInt(size, 0) |
|
|
|
} |
|
|
|
|
|
|
|
if index := ctx.URLParam("index"); index != "" { |
|
|
|
pageIndex = utils.ValueToInt(index, 0) |
|
|
|
} |
|
|
|
|
|
|
|
var cid int |
|
|
|
// 如果公司机关部门可以搜索cid
|
|
|
|
if user.Pid == 110 { |
|
|
@ -441,21 +454,21 @@ func GetChargeTypeStatisticData(ctx iris.Context) { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
startDateStr := ctx.URLParam("start") |
|
|
|
endDateStr := ctx.URLParam("end") |
|
|
|
startDate, err1 := utils.TimeParseyyyyMMdd(startDateStr) |
|
|
|
endDate, err2 := utils.TimeParseyyyyMMdd(endDateStr) |
|
|
|
if err1 != nil || err2 != nil { |
|
|
|
date := ctx.URLParam("date") |
|
|
|
tDate, err1 := utils.TimeParseyyyyMMdd(date) |
|
|
|
if err1 != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
chargeTypeStr := ctx.URLParam("charge_type") |
|
|
|
// 如为传入或传入的chargeType 不合规则使用-1 进行所有chargeType的分类统计
|
|
|
|
chargeType := utils.ValueToInt(chargeTypeStr, 0) |
|
|
|
start := utils.TimeFormat(startDate, "yyyy-MM-dd") |
|
|
|
end := utils.TimeFormat(endDate, "yyyy-MM-dd") |
|
|
|
date = utils.TimeFormat(tDate, "yyyy-MM-dd") |
|
|
|
chargeWay := ctx.URLParam("charge_way") |
|
|
|
if chargeWay == "" { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
var charge models.Chargetab |
|
|
|
result, err := charge.GetChargeTypeStatisticData(cid, chargeType, start, end) |
|
|
|
result, err := charge.GetChargeTypeData(cid, chargeWay, date, pageIndex, pageSize) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusInternalServerError, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
@ -463,3 +476,61 @@ func GetChargeTypeStatisticData(ctx iris.Context) { |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, result) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 按日期和缴费类型获取缴费统计数据
|
|
|
|
func GetChargeArrearageData(ctx iris.Context) { |
|
|
|
user, ok := jwts.ParseToken(ctx) |
|
|
|
utils.TrimStruct(user, *user) |
|
|
|
if !ok { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
logs := new(models.LeitServerLog) |
|
|
|
logs.File = "/controllers/Chargetab_controller.go" |
|
|
|
logs.Level = "info" |
|
|
|
logs.Function = "GetChargeArrearageData" |
|
|
|
logs.Message = "按日期查看缴费陈欠数据" |
|
|
|
logs.Operator = user.Userid |
|
|
|
logs.TimeStamp = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
logs.InsertRecord() |
|
|
|
|
|
|
|
var pageSize = 10 |
|
|
|
var pageIndex = 1 |
|
|
|
if size := ctx.URLParam("size"); size != "" { |
|
|
|
pageSize = utils.ValueToInt(size, 0) |
|
|
|
} |
|
|
|
|
|
|
|
if index := ctx.URLParam("index"); index != "" { |
|
|
|
pageIndex = utils.ValueToInt(index, 0) |
|
|
|
} |
|
|
|
|
|
|
|
var cid int |
|
|
|
// 如果公司机关部门可以搜索cid
|
|
|
|
if user.Pid == 110 { |
|
|
|
cidStr := ctx.URLParam("cid") |
|
|
|
cid = utils.ValueToInt(cidStr, 0) |
|
|
|
} else { |
|
|
|
cid = user.Pid |
|
|
|
} |
|
|
|
if cid == 0 { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
chargeType, err := ctx.URLParamInt("chargetype") |
|
|
|
if err != nil { |
|
|
|
chargeType = 0 |
|
|
|
} |
|
|
|
buildingId := ctx.URLParam("buildingid") |
|
|
|
propertyId := ctx.URLParam("propertyid") |
|
|
|
year := time.Now().Year() |
|
|
|
selectType := ctx.URLParam("type") |
|
|
|
arrearageDate := fmt.Sprintf("%d-12-31", year-1) |
|
|
|
var charge models.Chargetab |
|
|
|
result, err := charge.GetChargeArrearageData(cid, pageIndex, pageSize, year, arrearageDate, selectType, chargeType, buildingId, propertyId) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("outer error:", err) |
|
|
|
supports.Error(ctx, iris.StatusInternalServerError, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
|
} |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, result) |
|
|
|
} |