|
|
@ -93,8 +93,8 @@ func GetChargetabByYear(ctx iris.Context) { |
|
|
|
beginyear := ctx.URLParam("startYear") |
|
|
|
endyear := ctx.URLParam("endYear") |
|
|
|
accountMonth := ctx.URLParam("accountMonth") |
|
|
|
settledate := utils.ValueToInt(accountMonth,0) |
|
|
|
result, count, err := me.ChargeTotalByYear(beginyear, endyear,settledate) |
|
|
|
settledate := utils.ValueToInt(accountMonth, 0) |
|
|
|
result, count, err := me.ChargeTotalByYear(beginyear, endyear, settledate) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
@ -119,9 +119,9 @@ func GetChargetabByBuilding(ctx iris.Context) { |
|
|
|
buildingid := ctx.URLParam("building") |
|
|
|
beginyear := ctx.URLParam("startYear") |
|
|
|
accountMonth := ctx.URLParam("accountMonth") |
|
|
|
settledate := utils.ValueToInt(accountMonth,0) |
|
|
|
endyear := utils.ValueToInt(beginyear,0) +1 |
|
|
|
result, count,rate, err := me.ChargeTotalByBuilding(buildingid, beginyear,utils.ValueToString(endyear,""),settledate) |
|
|
|
settledate := utils.ValueToInt(accountMonth, 0) |
|
|
|
endyear := utils.ValueToInt(beginyear, 0) + 1 |
|
|
|
result, count, rate, err := me.ChargeTotalByBuilding(buildingid, beginyear, utils.ValueToString(endyear, ""), settledate) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
@ -174,7 +174,7 @@ func GetChargetabListPage(ctx iris.Context) { |
|
|
|
} |
|
|
|
searchtime := ctx.URLParam("expireDate") |
|
|
|
startDate := ctx.URLParam("startDate") |
|
|
|
result, count,total, err := data.ListPage(pageSize, pageIndex, startDate,searchtime) |
|
|
|
result, count, total, err := data.ListPage(pageSize, pageIndex, startDate, searchtime) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
@ -211,7 +211,7 @@ func GetChargetabReadExcel(ctx iris.Context) { |
|
|
|
data.Chargetype = chargetype |
|
|
|
searchtime := ctx.URLParam("expireDate") |
|
|
|
startDate := ctx.URLParam("startDate") |
|
|
|
_, filename, err := data.ReadExcel(startDate,searchtime) |
|
|
|
_, filename, err := data.ReadExcel(startDate, searchtime) |
|
|
|
if err != nil { |
|
|
|
fmt.Printf("错误err : %v", err) |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil) |
|
|
@ -234,9 +234,9 @@ func GetChargetabReadBuildingExcel(ctx iris.Context) { |
|
|
|
buildingid := ctx.URLParam("building") |
|
|
|
beginyear := ctx.URLParam("startYear") |
|
|
|
accountMonth := ctx.URLParam("accountMonth") |
|
|
|
settledate := utils.ValueToInt(accountMonth,0) |
|
|
|
endyear := utils.ValueToInt(beginyear,0) +1 |
|
|
|
_, filename, err := data.ReadBuildExcel(buildingid, beginyear,utils.ValueToString(endyear,""),settledate) |
|
|
|
settledate := utils.ValueToInt(accountMonth, 0) |
|
|
|
endyear := utils.ValueToInt(beginyear, 0) + 1 |
|
|
|
_, filename, err := data.ReadBuildExcel(buildingid, beginyear, utils.ValueToString(endyear, ""), settledate) |
|
|
|
if err != nil { |
|
|
|
fmt.Printf("错误err : %v", err) |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil) |
|
|
@ -259,8 +259,8 @@ func GetChargetabReadYearExcel(ctx iris.Context) { |
|
|
|
beginyear := ctx.URLParam("startYear") |
|
|
|
endyear := ctx.URLParam("endYear") |
|
|
|
accountMonth := ctx.URLParam("accountMonth") |
|
|
|
settledate := utils.ValueToInt(accountMonth,0) |
|
|
|
_, filename, err := me.ReadYearExcel(beginyear, endyear,settledate) |
|
|
|
settledate := utils.ValueToInt(accountMonth, 0) |
|
|
|
_, filename, err := me.ReadYearExcel(beginyear, endyear, settledate) |
|
|
|
if err != nil { |
|
|
|
fmt.Printf("错误err : %v", err) |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil) |
|
|
@ -313,12 +313,12 @@ func DelChargetab(ctx iris.Context) { |
|
|
|
logs.InsertRecord() |
|
|
|
data := new(models.Chargetab) |
|
|
|
data.Cid = user.Pid |
|
|
|
data.Chargenr,_ = ctx.URLParamInt("chargenr") |
|
|
|
data.Chargenr, _ = ctx.URLParamInt("chargenr") |
|
|
|
data.Lastmodifyby = user.Userid |
|
|
|
data.Serialnumber = ctx.URLParam("serialnumber") |
|
|
|
err := data.Del() |
|
|
|
if err != nil { |
|
|
|
glog.InfoExt("删除缴费记录","错误原因:",err) |
|
|
|
glog.InfoExt("删除缴费记录", "错误原因:", err) |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "删除失败", nil) |
|
|
|
return |
|
|
|
} |
|
|
@ -328,7 +328,7 @@ func DelChargetab(ctx iris.Context) { |
|
|
|
|
|
|
|
func GetRecordLogList(ctx iris.Context) { |
|
|
|
user, ok := jwts.ParseToken(ctx) |
|
|
|
utils.TrimStruct(user,*user) |
|
|
|
utils.TrimStruct(user, *user) |
|
|
|
if !ok { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) |
|
|
|
return |
|
|
@ -340,7 +340,7 @@ func GetRecordLogList(ctx iris.Context) { |
|
|
|
logs.Function = "GetRecordLogList" |
|
|
|
logs.Message = "删除记录列表查看" |
|
|
|
logs.Operator = user.Userid |
|
|
|
logs.TimeStamp = utils.TimeFormat(time.Now(),"yyyyMMddHHmmss") |
|
|
|
logs.TimeStamp = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
logs.InsertRecord() |
|
|
|
var data models.RecordLog |
|
|
|
var err error |
|
|
@ -359,7 +359,7 @@ func GetRecordLogList(ctx iris.Context) { |
|
|
|
startdate := ctx.URLParam("startdate") |
|
|
|
enddate := ctx.URLParam("enddate") |
|
|
|
|
|
|
|
result, count, err := data.GetPage(pageSize, pageIndex,startdate,enddate) |
|
|
|
result, count, err := data.GetPage(pageSize, pageIndex, startdate, enddate) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
@ -370,4 +370,96 @@ func GetRecordLogList(ctx iris.Context) { |
|
|
|
res["pageIndex"] = pageIndex |
|
|
|
res["pageSize"] = pageSize |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, res) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 获取当前和陈欠的缴费统计数据
|
|
|
|
func GetChargeStatisticData(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 = "GetChargeStatisticData" |
|
|
|
logs.Message = "当年及陈欠缴费统计查看" |
|
|
|
logs.Operator = user.Userid |
|
|
|
logs.TimeStamp = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
logs.InsertRecord() |
|
|
|
|
|
|
|
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 |
|
|
|
} |
|
|
|
var chargeTab models.Chargeallocationtab |
|
|
|
chargeTab.Cid = user.Pid |
|
|
|
year := time.Now().Year() |
|
|
|
result, err := chargeTab.GetChargeStatisticData(cid, year) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusInternalServerError, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
|
} |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, result) |
|
|
|
} |
|
|
|
|
|
|
|
// 按日期和缴费类型获取缴费统计数据
|
|
|
|
func GetChargeTypeStatisticData(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 = "GetChargeTypeStatisticData" |
|
|
|
logs.Message = "按日期和收款类型查看缴费统计" |
|
|
|
logs.Operator = user.Userid |
|
|
|
logs.TimeStamp = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
logs.InsertRecord() |
|
|
|
|
|
|
|
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 |
|
|
|
} |
|
|
|
startDateStr := ctx.URLParam("start") |
|
|
|
endDateStr := ctx.URLParam("end") |
|
|
|
startDate, err1 := utils.TimeParseyyyyMMdd(startDateStr) |
|
|
|
endDate, err2 := utils.TimeParseyyyyMMdd(endDateStr) |
|
|
|
if err1 != nil || err2 != 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") |
|
|
|
var charge models.Chargetab |
|
|
|
result, err := charge.GetChargeTypeStatisticData(cid, chargeType, start, end) |
|
|
|
if err != nil { |
|
|
|
supports.Error(ctx, iris.StatusInternalServerError, "抱歉未找到相关信息", nil) |
|
|
|
return |
|
|
|
} |
|
|
|
supports.Ok(ctx, supports.OptionSuccess, result) |
|
|
|
|
|
|
|
} |