Quellcode durchsuchen

update

add_mode
DengBiao vor 1 Jahr
Ursprung
Commit
64cea3c931
4 geänderte Dateien mit 122 neuen und 1 gelöschten Zeilen
  1. +111
    -0
      app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go
  2. +9
    -0
      app/admin/md/md_enterprise_manage.go
  3. +1
    -1
      app/customer/hdl/hdl_user_identity.go
  4. +1
    -0
      app/router/admin_router.go

+ 111
- 0
app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go Datei anzeigen

@@ -732,6 +732,117 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) {
return
}

func SelfSupportForSchoolAddStudent(c *gin.Context) {
var req md.SelfSupportForSchoolStudentAddReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if isHasUserIdentity != nil {
e.OutErr(c, e.ERR, "当前身份已存在,直接修改身份即可!")
return
}

now := time.Now()
//2、新增身份信息
userIdentity := &model.UserIdentity{
Uid: 0,
Name: req.Name,
IdNo: req.IdNo,
Kind: enum.UserIdentityKindForCommon,
Identity: enum.UserIdentityForSelfSupportForStudent,
EnterpriseId: req.EnterpriseId,
State: enum.UserIdentityStateForNormal,
Memo: "",
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if insertAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败")
return
}

classWithUserDb := db.ClassWithUserDb{}
_, err = classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{
UserIdentityId: insertAffected,
ClassId: req.ClassId,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
//更新 self_support_for_user_face_info
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(insertAffected)
info, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if info == nil {
selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
selfSupportForSchoolInfoDb.Set(req.EnterpriseId)
selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}
if selfSupportForSchoolInfo == nil {
e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》")
return
}
info = &model.SelfSupportForUserFaceInfo{
EnterpriseId: req.EnterpriseId,
UserIdentityId: insertAffected,
CollectFaceType: req.CollectFaceType, //教师都是个采
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"),
}
_, err1 = selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info)
if err1 != nil {
e.OutErr(c, e.ERR, err1.Error())
return
}
} else {
info.CollectFaceType = req.CollectFaceType
_, err = selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoUpdate(info, "collect_face_type")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
}

e.OutSuc(c, "success", nil)
return
}

func SelfSupportForSchoolImportTeacher(c *gin.Context) {
enterpriseIdStr := c.DefaultQuery("enterprise_id", "")
enterpriseId := utils.StrToInt(enterpriseIdStr)


+ 9
- 0
app/admin/md/md_enterprise_manage.go Datei anzeigen

@@ -359,6 +359,15 @@ type SelfSupportForSchoolStudentUpdateReq struct {
CollectFaceType int `json:"collect_face_type" label:"采集人脸方式(1:个采 2:集采)"`
}

type SelfSupportForSchoolStudentAddReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
IdNo string `json:"id_no" label:"身份证号"`
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
CollectFaceType int `json:"collect_face_type" label:"采集人脸方式(1:个采 2:集采)"`
}

type SelfSupportForSchoolStudentDeleteReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
UserIdentityIds []int `json:"user_identity_ids" binding:"required" label:"用户身份id"`


+ 1
- 1
app/customer/hdl/hdl_user_identity.go Datei anzeigen

@@ -231,7 +231,7 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
return
}
} else {
if isHasUserIdentity != nil && isHasUserIdentity.Uid != 0 && isHasUserIdentity.Uid != user.Id {
if isHasUserIdentity.Uid != 0 && isHasUserIdentity.Uid != user.Id {
e.OutErr(c, e.ERR, "当前身份信息已被绑定使用")
return
}


+ 1
- 0
app/router/admin_router.go Datei anzeigen

@@ -207,6 +207,7 @@ func rEnterpriseManage(r *gin.RouterGroup) {
r.DELETE("/selfSupportForSchool/gradeDelete/:id", hdl.SelfSupportForSchoolGradeDelete) //"自营-学校"年级删除
r.POST("/selfSupportForSchool/classList", hdl.SelfSupportForSchoolClassList) //"自营-学校"班级列表
r.DELETE("/selfSupportForSchool/classDelete/:id", hdl.SelfSupportForSchoolClassDelete) //"自营-学校"班级删除
r.POST("/selfSupportForSchool/addStudent", hdl.SelfSupportForSchoolAddStudent) //"自营-学校"添加学生
r.POST("/selfSupportForSchool/addWorker", hdl.SelfSupportForSchoolAddWorker) //"自营-学校"添加工作人员
r.POST("/selfSupportForSchool/addTeacher", hdl.SelfSupportForSchoolAddTeacher) //"自营-学校"添加老师
r.POST("/selfSupportForSchool/importTeacher", hdl.SelfSupportForSchoolImportTeacher) //"自营-学校"导入老师


Laden…
Abbrechen
Speichern