DengBiao пре 1 година
родитељ
комит
9aaea09b8b
3 измењених фајлова са 80 додато и 72 уклоњено
  1. +3
    -1
      app/customer/hdl/hdl_enterprise.go
  2. +72
    -70
      app/customer/hdl/hdl_user.go
  3. +5
    -1
      app/customer/svc/svc_enterprise.go

+ 3
- 1
app/customer/hdl/hdl_enterprise.go Прегледај датотеку

@@ -26,7 +26,9 @@ func EnterpriseList(c *gin.Context) {
if req.Page == 0 {
req.Page = 10
}
enterprises, total, err := svc.EnterpriseList(req)

platform := c.GetHeader("platform")
enterprises, total, err := svc.EnterpriseList(req, platform)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


+ 72
- 70
app/customer/hdl/hdl_user.go Прегледај датотеку

@@ -48,87 +48,89 @@ func UserInfo(c *gin.Context) {
}

now := time.Now()
if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool {
//TODO:: 自营-学生 or 自营-教职员工
sMDate := utils.GetFirstDateOfMonth(now).Format("2006-01-02 15:04:05")
eMDate := utils.GetLastDateOfMonth(now).Format("2006-01-02 15:04:05")
sTDate, eTDate := utils.GetDateTimeRangeStr("today")
monthStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sMDate, eMDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
dayStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sTDate, eTDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
tmp["month_statistic"] = monthStatistic
tmp["day_statistic"] = dayStatistic

//统计是否存在欠费
arrearsStatistic, err2 := svc2.SupportUserIdentityOrderStatisticForArrears(v.UserIdentity.Id)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
tmp["arrears_statistic"] = arrearsStatistic

//查询支付宝扣款账户
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(v.UserIdentity.Id)
info, err2 := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}

if info == nil {
selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
selfSupportForSchoolInfoDb.Set(v.UserIdentity.EnterpriseId)
selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
if err1 != nil {
if c.GetHeader("platform") != "wx_applet" && v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool {
if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker {
//TODO::自营-工作人员
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(0)
tmp["school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePassStatus(v.EnterpriseId, "open")
tmp["school_face_payment_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePaymentStatus(v.EnterpriseId, "open")
tmp["concentrate_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 2)
tmp["single_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 1)
} else {
//TODO:: 自营-学生 or 自营-教职员工
sMDate := utils.GetFirstDateOfMonth(now).Format("2006-01-02 15:04:05")
eMDate := utils.GetLastDateOfMonth(now).Format("2006-01-02 15:04:05")
sTDate, eTDate := utils.GetDateTimeRangeStr("today")
monthStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sMDate, eMDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
if selfSupportForSchoolInfo == nil {
e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》")
dayStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sTDate, eTDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
tmp["month_statistic"] = monthStatistic
tmp["day_statistic"] = dayStatistic

info = &model.SelfSupportForUserFaceInfo{
EnterpriseId: v.UserIdentity.EnterpriseId,
UserIdentityId: v.UserIdentity.Id,
CollectFaceType: 1, //默认个采
SchoolCode: selfSupportForSchoolInfo.SchoolCode,
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
ParentUserId: "",
ParentLogonId: "",
UserId: "",
SchoolFacePassStatus: "CLOSE",
SchoolFacePaymentStatus: "CLOSE",
ConcentrateSchoolFacePassStatus: 1,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
//统计是否存在欠费
arrearsStatistic, err2 := svc2.SupportUserIdentityOrderStatisticForArrears(v.UserIdentity.Id)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
_, err3 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info)
if err3 != nil {
e.OutErr(c, e.ERR, err3.Error())
tmp["arrears_statistic"] = arrearsStatistic

//查询支付宝扣款账户
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(v.UserIdentity.Id)
info, err2 := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}

if info == nil {
selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
selfSupportForSchoolInfoDb.Set(v.UserIdentity.EnterpriseId)
selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
if err1 != nil {
return
}
if selfSupportForSchoolInfo == nil {
e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》")
return
}

info = &model.SelfSupportForUserFaceInfo{
EnterpriseId: v.UserIdentity.EnterpriseId,
UserIdentityId: v.UserIdentity.Id,
CollectFaceType: 1, //默认个采
SchoolCode: selfSupportForSchoolInfo.SchoolCode,
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
ParentUserId: "",
ParentLogonId: "",
UserId: "",
SchoolFacePassStatus: "CLOSE",
SchoolFacePaymentStatus: "CLOSE",
ConcentrateSchoolFacePassStatus: 1,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
_, err3 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info)
if err3 != nil {
e.OutErr(c, e.ERR, err3.Error())
return
}
}
tmp["parent_logon_id"] = info.ParentLogonId
tmp["collect_face_type"] = info.CollectFaceType
tmp["concentrate_school_face_pass_status"] = info.ConcentrateSchoolFacePassStatus
}
tmp["parent_logon_id"] = info.ParentLogonId
tmp["collect_face_type"] = info.CollectFaceType
tmp["concentrate_school_face_pass_status"] = info.ConcentrateSchoolFacePassStatus
}

if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker {
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(0)
tmp["school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePassStatus(v.EnterpriseId, "open")
tmp["school_face_payment_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePaymentStatus(v.EnterpriseId, "open")
tmp["concentrate_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 2)
tmp["single_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 1)
}
identityList = append(identityList, tmp)
}



+ 5
- 1
app/customer/svc/svc_enterprise.go Прегледај датотеку

@@ -4,10 +4,14 @@ import (
"applet/app/customer/md"
"applet/app/db"
"applet/app/db/model"
"applet/app/enum"
)

func EnterpriseList(req md.EnterpriseListReq) (m []model.Enterprise, total int64, err error) {
func EnterpriseList(req md.EnterpriseListReq, platform string) (m []model.Enterprise, total int64, err error) {
eg := db.Db.Where("1=1")
if platform == "wx_applet" {
eg.And("pvd != ? and mode != ?", enum.EnterprisePvdForFaceScanPayment, enum.EnterpriseModeForSchool)
}
if req.Name != "" {
eg.And("name like ?", "%"+req.Name+"%")
}


Loading…
Откажи
Сачувај