|
@@ -48,87 +48,89 @@ func UserInfo(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
now := time.Now() |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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) |
|
|
identityList = append(identityList, tmp) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|