#17 fix_edit

Merged
louwenzhi merged 5 commits from fix_edit into develop 2 years ago
  1. +1
    -1
      db/db.go
  2. +1
    -0
      web/controllers/accesscardtab_controller.go
  3. +1
    -0
      web/controllers/carporttab_controller.go
  4. +10
    -0
      web/controllers/contracttab_controller.go
  5. +1
    -1
      web/controllers/otherchargetab_controller.go
  6. +19
    -0
      web/controllers/snrtab_controller.go
  7. +6
    -0
      web/models/accesscardtab.go
  8. +4
    -0
      web/models/carporttab.go
  9. +32
    -6
      web/models/chargetab.go
  10. +5
    -1
      web/models/contracttab.go
  11. +6
    -3
      web/models/otherchargetab.go
  12. +1
    -1
      web/models/response/chargeallocationtab.go
  13. +1
    -0
      web/routes/routes.go

+ 1
- 1
db/db.go View File

@ -41,7 +41,7 @@ func MasterEngine() *xorm.Engine {
c.User, c.Pwd, c.Host, c.Port, c.DbName)
engine, err := xorm.NewEngine(conf.DriverName, driveSource)
//开启sql,debug
//engine.ShowSQL(true)
engine.ShowSQL(true)
if err != nil {
log.Fatal("dbhelper.DbinstanceMaster error= ", err)
return nil


+ 1
- 0
web/controllers/accesscardtab_controller.go View File

@ -40,6 +40,7 @@ func GetAccesscardtabList(ctx iris.Context) {
}
data.Cid = user.Pid
data.Descr = ctx.URLParam("descr")
data.Accesscardid = ctx.URLParam("accesscardid")
result, count, err := data.GetPage(pageSize, pageIndex)
if err != nil {
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil)


+ 1
- 0
web/controllers/carporttab_controller.go View File

@ -40,6 +40,7 @@ func GetCarporttabList(ctx iris.Context) {
}
data.Cid = user.Pid
data.Descr = ctx.URLParam("descr")
data.Carportid = ctx.URLParam("carportid")
result, count, err := data.GetPage(pageSize, pageIndex)
if err != nil {
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil)


+ 10
- 0
web/controllers/contracttab_controller.go View File

@ -95,6 +95,14 @@ func InsertContracttab(ctx iris.Context) {
*lengthdate : 缴费时长
**************/
lengthdate := data.Contracttab.Chargedexpense / data.Unitprice
if utils.ValueIsEmpty(data.Propertyid) || data.Propertyid == "--"{
supports.Error(ctx, iris.StatusBadRequest, "房间号录入错误", nil)
return
}
if utils.ValueIsEmpty(data.Accesscardid) {
supports.Error(ctx, iris.StatusBadRequest, "电梯卡号不能为空!", nil)
return
}
//判断是否
access := new(models.Accesscardtab)
access.Cid = user.Pid
@ -354,6 +362,7 @@ func ExcelContracttab(ctx iris.Context) {
me.Chargetime = strings.TrimSpace(tt3)
me.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss")
me.Createby = utils.ValueToString(v[4], "")
me.Enddate = strings.TrimSpace(tt2)
//lengthdays := utils.TimeSub(t2, t1)
//lengthday := utils.ValueToFloat(lengthdays, 0.0) / 30
@ -385,6 +394,7 @@ func ExcelContracttab(ctx iris.Context) {
glog.InfoExtln("导入合同", "lengthdays", lengthdays)
glog.InfoExtln("导入合同", "Lengthdate", me.Lengthdate)
data.Chargetime = me.Chargetime
me.Contractid = infodata.Contractid
if utils.ValueIsEmpty(infodata.Contractid) {
err = me.Add(data)
} else {


+ 1
- 1
web/controllers/otherchargetab_controller.go View File

@ -77,7 +77,6 @@ func InsertOtherchargetab(ctx iris.Context) {
return
}
data.Cid = user.Pid
data.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss")
if utils.ValueIsEmpty(data.Chargestartdate){
data.Chargestartdate = utils.TimeFormat(time.Now(), "yyyyMMdd")
}
@ -105,6 +104,7 @@ func GetOtherchargetab(ctx iris.Context) {
me.Contact = ctx.URLParam("contact")
me.Category = ctx.URLParam("category")
me.Remark = ctx.URLParam("remark")
me.Serialnumber = ctx.URLParam("serialnumber")
result, err := me.SelectOne()
if err != nil {
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil)


+ 19
- 0
web/controllers/snrtab_controller.go View File

@ -167,3 +167,22 @@ func DeleteSnrtab(ctx iris.Context) {
}
supports.Ok(ctx, "删除成功", "")
}
func GetNextSnrtab(ctx iris.Context) {
user, ok := jwts.ParseToken(ctx)
utils.TrimStruct(user, *user)
if !ok {
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
return
}
var me models.Snrtab
snrid:= ctx.URLParam("snrid")
me.Cid = user.Pid
me.Snrid = snrid
result, err := me.GetNextSnr(snrid)
if err !=nil{
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil)
return
}
supports.Ok(ctx, supports.OptionSuccess, result)
}

+ 6
- 0
web/models/accesscardtab.go View File

@ -85,6 +85,12 @@ func (t *Accesscardtab) GetPage(pageSize int, pageIndex int) ([]Accesscardtab, i
query := e.Table("accesscardtab").Where("cid = ? ", t.Cid)
table := e.Table("accesscardtab").Where("cid = ? ", t.Cid)
if !utils.ValueIsEmpty(t.Accesscardid) {
query = query.And("accesscardid = ?", t.Accesscardid)
table = table.And("accesscardid = ?", t.Accesscardid)
}
if !utils.ValueIsEmpty(t.Descr) {
descr := "%" + t.Descr + "%"
query = query.And("descr like ?", descr)


+ 4
- 0
web/models/carporttab.go View File

@ -100,6 +100,10 @@ func (t *Carporttab) GetPage(pageSize int, pageIndex int) ([]Carporttab, int, er
query := e.Table("carporttab").Where("cid = ? ", t.Cid)
table := e.Table("carporttab").Where("cid = ? ", t.Cid)
if !utils.ValueIsEmpty(t.Carportid) {
query = query.And("carportid = ?", t.Carportid)
table = table.And("carportid = ?", t.Carportid)
}
if !utils.ValueIsEmpty(t.Descr) {
descr := "%" + t.Descr + "%"
query = query.And("descr like ?", descr)


+ 32
- 6
web/models/chargetab.go View File

@ -621,7 +621,7 @@ func (t *Chargetab) ReadData(startDate string, searchtime string) ([]ChargeUsers
query = query.And("contracttab.enddate < ?", searchtime)
}
if !utils.ValueIsEmpty(startDate) {
query = query.And("contracttab.enddate > ?", startDate)
query = query.And("contracttab.enddate < ?", startDate)
}
query = query.And("contracttab.chargetype = ?", 1)
err := query.Desc("contracttab.createtime").Find(&data)
@ -642,7 +642,7 @@ func (t *Chargetab) ReadData(startDate string, searchtime string) ([]ChargeUsers
query = query.And("contracttab.enddate < ?", searchtime)
}
if !utils.ValueIsEmpty(startDate) {
query = query.And("contracttab.enddate > ?", startDate)
query = query.And("contracttab.enddate < ?", startDate)
}
query = query.And("contracttab.chargetype = ?", 2)
err := query.Desc("contracttab.createtime").Find(&data)
@ -664,7 +664,7 @@ func (t *Chargetab) ReadData(startDate string, searchtime string) ([]ChargeUsers
query = query.And("contracttab.enddate < ?", searchtime)
}
if !utils.ValueIsEmpty(startDate) {
query = query.And("contracttab.enddate > ?", startDate)
query = query.And("contracttab.enddate < ?", startDate)
}
query = query.And("contracttab.chargetype = ?", 3)
err := query.Desc("contracttab.createtime").Find(&data)
@ -684,7 +684,7 @@ func (t *Chargetab) ReadData(startDate string, searchtime string) ([]ChargeUsers
query = query.And("contracttab.enddate < ?", searchtime)
}
if !utils.ValueIsEmpty(startDate) {
query = query.And("contracttab.enddate > ?", startDate)
query = query.And("contracttab.enddate < ?", startDate)
}
query = query.And("contracttab.chargetype = ?", 1)
err := query.Desc("contracttab.createtime").Find(&data)
@ -729,6 +729,12 @@ func (t *Chargetab) ReadExcel(startDate string, searchtime string) (excelfile st
cell = row.AddCell()
cell.Value = "物业编号"
cell = row.AddCell()
cell.Value = "电梯卡编号"
cell = row.AddCell()
cell.Value = "车位编号"
cell = row.AddCell()
cell.Value = "收费起始日"
@ -767,6 +773,14 @@ func (t *Chargetab) ReadExcel(startDate string, searchtime string) (excelfile st
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Propertyid, "")
//电梯费
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Accesscardid, "")
//车位费
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Carportid, "")
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Begdate, "")
@ -1438,7 +1452,7 @@ func (t *Chargetab) Del() error {
up := new(Propertytab)
up.Contractid = ""
_, err = session.Table("accesscardtab").Cols("contractid").Where("cid = ? and propertyid =?", t.Cid, info.Propertyid).Update(up)
_, err = session.Table("accesscardtab").Cols("contractid").Where("cid = ? and accesscardid =?", t.Cid, info.Accesscardid).Update(up)
if err != nil {
session.Rollback()
return err
@ -1874,7 +1888,7 @@ func (t *Chargetab) GetChargeStatisticData(cid, year int, selectType string, cha
count, err := query.Sum(chargeAllocation, "chargeallocationtab.allocateexpense")
result.Cid = cid
result.Count = utils.Round(count)
result.Count = fmt.Sprintf("%0.2f", count)
result.Type = selectType
return result, nil
}
@ -1990,6 +2004,9 @@ func (t *Chargetab) ExportChargeArrearageExcel(datalist []*ChargeArrearageExcelD
"项目号",
"缴费类型",
"物业编号",
"电梯卡编号",
"车位编号",
"房屋面积",
"业主",
"收费起始日期",
"收费结束日期",
@ -2034,6 +2051,15 @@ func (t *Chargetab) ExportChargeArrearageExcel(datalist []*ChargeArrearageExcelD
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Chargetab.Propertyid, "")
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Chargetab.Accesscardid, "")
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Chargetab.Carportid, "")
cell = row.AddCell()
cell.Value = fmt.Sprintf("%0.3f", val.Propertytab.Constructionarea)
cell = row.AddCell()
cell.Value = utils.ValueToString(val.Propertytab.Contact, "")


+ 5
- 1
web/models/contracttab.go View File

@ -242,11 +242,15 @@ func (t *Contracttab) Update(me *ContractInfo) error {
return err
}
t.Serialnumber = serialnumber
_, err = session.Table("contracttab").Cols("linkman", "mobile", "begdate", "enddate", "createtime", "createby", "lengthdate", "chargableexpense", "chargedexpense", "remake", "chargetime", "chargeway", "serialnumber").Where("cid = ? and contractid = ?", t.Cid, t.Contractid).Update(t)
row, err := session.Table("contracttab").Cols("linkman", "mobile", "begdate", "enddate", "createtime", "createby", "lengthdate", "chargableexpense", "chargedexpense", "remake", "chargetime", "chargeway", "serialnumber").Where("cid = ? and contractid = ?", t.Cid, t.Contractid).Update(t)
if err != nil {
session.Rollback()
return err
}
if row < 1{
session.Rollback()
return err
}
switch t.Chargetype {
case 1:
//物业费


+ 6
- 3
web/models/otherchargetab.go View File

@ -58,7 +58,7 @@ func (t *Otherchargetab) Add() error {
}
t.Serialnumber = serialnumber
t.Otherid = utils.ValueToInt(Otherid, 0)
t.Chargetime = utils.TimeFormat(time.Now(), "yyyy-MM-dd")
t.Createtime = utils.TimeFormat(time.Now(),"yyyyMMddHHmmss")
_, err = session.Table("otherchargetab").Insert(t)
if err != nil {
session.Rollback()
@ -78,8 +78,8 @@ func (t *Otherchargetab) Add() error {
charge.Cid = t.Cid
charge.Chargetype = 4
charge.Info = t.Remark
charge.Createtime = t.Createtime
charge.Lastmodifytime = t.Createtime
charge.Createtime = utils.TimeFormat(time.Now(),"yyyyMMddHHmmss")
charge.Lastmodifytime = utils.TimeFormat(time.Now(),"yyyyMMddHHmmss")
charge.Chargableexpense = t.ChargeMoney
charge.Chargedexpense = t.ChargeMoney
charge.Chargetime = t.Chargetime
@ -120,6 +120,9 @@ func (t *Otherchargetab) SelectOne() (data Otherchargetab,err error) {
if !utils.ValueIsEmpty(t.Category) {
query = query.And("category = ?", t.Category)
}
if !utils.ValueIsEmpty(t.Serialnumber) {
query = query.And("serialnumber = ?", t.Serialnumber)
}
_, err = query.Desc("createtime").Get(&data)
if err != nil {
return data, err


+ 1
- 1
web/models/response/chargeallocationtab.go View File

@ -13,5 +13,5 @@ type ChargeStatisticResponse struct {
Cid int `json:"cid"`
Court string `json:"court"`
Type string `json:"type"`
Count int `json:"count"`
Count string `json:"count"`
}

+ 1
- 0
web/routes/routes.go View File

@ -91,6 +91,7 @@ func Hub(app *iris.Application) {
snrtab.Post("/addinfo", controllers.InsertSnrtab)
snrtab.Delete("/del", controllers.DeleteSnrtab)
snrtab.Put("/upinfo", controllers.UpdateSnrtab)
snrtab.Get("/nextsnr", controllers.GetNextSnrtab)
// 导入表
scripttab := admin.Party("/scripttab")


Loading…
Cancel
Save