@@ -7,8 +7,10 @@ import ( | |||||
"applet/app/db" | "applet/app/db" | ||||
"applet/app/db/model" | "applet/app/db/model" | ||||
"applet/app/e" | "applet/app/e" | ||||
"applet/app/enum" | |||||
"applet/app/utils" | "applet/app/utils" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"time" | |||||
) | ) | ||||
func SelfSupportForSchoolUserUpdate(c *gin.Context) { | func SelfSupportForSchoolUserUpdate(c *gin.Context) { | ||||
@@ -541,3 +543,105 @@ func SelfSupportForSchoolClassDelete(c *gin.Context) { | |||||
e.OutSuc(c, "success", nil) | e.OutSuc(c, "success", nil) | ||||
return | return | ||||
} | } | ||||
func SelfSupportForSchoolAddWorker(c *gin.Context) { | |||||
var req md.SelfSupportForSchoolAddWorkerReq | |||||
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.Time{} | |||||
//2、新增身份信息 | |||||
userIdentity := &model.UserIdentity{ | |||||
Uid: 0, | |||||
Name: req.Name, | |||||
IdNo: req.IdNo, | |||||
Kind: enum.UserIdentityKindForWorker, | |||||
Identity: enum.UserIdentityForSelfSupportForWorker, | |||||
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 | |||||
} | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} | |||||
func SelfSupportForSchoolAddTeacher(c *gin.Context) { | |||||
var req md.SelfSupportForSchoolAddTeacherReq | |||||
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.Time{} | |||||
//2、新增身份信息 | |||||
userIdentity := &model.UserIdentity{ | |||||
Uid: 0, | |||||
Name: req.Name, | |||||
IdNo: req.IdNo, | |||||
Kind: enum.UserIdentityKindForCommon, | |||||
Identity: enum.UserIdentityForSelfSupportForTeacher, | |||||
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 | |||||
} | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} |
@@ -356,3 +356,15 @@ type SelfSupportForSchoolClassListReq struct { | |||||
Page int `json:"page" binding:"required"` | Page int `json:"page" binding:"required"` | ||||
Name string `json:"name" label:"名称"` | Name string `json:"name" label:"名称"` | ||||
} | } | ||||
type SelfSupportForSchoolAddWorkerReq struct { | |||||
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` | |||||
Name string `json:"name" label:"名称"` | |||||
IdNo string `json:"id_no" label:"身份证号"` | |||||
} | |||||
type SelfSupportForSchoolAddTeacherReq struct { | |||||
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"` | |||||
Name string `json:"name" label:"名称"` | |||||
IdNo string `json:"id_no" label:"身份证号"` | |||||
} |
@@ -13,6 +13,7 @@ func HandleLoginToken(cacheKey string, admin *model.Admin) (string, error) { | |||||
token, err := cache.GetString(cacheKey) | token, err := cache.GetString(cacheKey) | ||||
if err != nil { | if err != nil { | ||||
_ = logx.Error(err) | _ = logx.Error(err) | ||||
return "", err | |||||
} | } | ||||
// 没有获取到 | // 没有获取到 | ||||
if err != nil || token == "" { | if err != nil || token == "" { | ||||
@@ -220,6 +220,15 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) { | |||||
} | } | ||||
func ConcentrateFacePassStudentList(c *gin.Context) { | func ConcentrateFacePassStudentList(c *gin.Context) { | ||||
userIdentityId := c.DefaultQuery("user_identity_id", "") | |||||
userIdentityDb := db.UserIdentityDb{} | |||||
userIdentityDb.Set(0) | |||||
identity, err := userIdentityDb.GetUserIdentity(utils.StrToInt(userIdentityId)) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||||
return | |||||
} | |||||
page := utils.StrToInt(c.DefaultQuery("page", "1")) | page := utils.StrToInt(c.DefaultQuery("page", "1")) | ||||
if page == 0 { | if page == 0 { | ||||
page = 1 | page = 1 | ||||
@@ -231,7 +240,7 @@ func ConcentrateFacePassStudentList(c *gin.Context) { | |||||
concentrateSchoolFacePassStatus := c.DefaultQuery("concentrate_school_face_pass_status", "") | concentrateSchoolFacePassStatus := c.DefaultQuery("concentrate_school_face_pass_status", "") | ||||
var m []*db.SelfSupportForUserFaceInfoWithUserIdentity | var m []*db.SelfSupportForUserFaceInfoWithUserIdentity | ||||
sess := db.Db.Where("self_support_for_user_face_info.collect_face_type =?", 2) //集采 | |||||
sess := db.Db.Where("self_support_for_user_face_info.enterprise_id =?", identity.EnterpriseId).And("self_support_for_user_face_info.collect_face_type =?", 2) //集采 | |||||
if concentrateSchoolFacePassStatus != "" { | if concentrateSchoolFacePassStatus != "" { | ||||
sess.And("self_support_for_user_face_info.concentrate_school_face_pass_status =?", concentrateSchoolFacePassStatus) | sess.And("self_support_for_user_face_info.concentrate_school_face_pass_status =?", concentrateSchoolFacePassStatus) | ||||
} | } | ||||
@@ -13,6 +13,7 @@ func HandleLoginToken(cacheKey string, user *model.User) (string, error) { | |||||
token, err := cache.GetString(cacheKey) | token, err := cache.GetString(cacheKey) | ||||
if err != nil { | if err != nil { | ||||
_ = logx.Error(err) | _ = logx.Error(err) | ||||
return "", err | |||||
} | } | ||||
// 没有获取到 | // 没有获取到 | ||||
if err != nil || token == "" { | if err != nil || token == "" { | ||||
@@ -154,6 +154,8 @@ func rEnterpriseManage(r *gin.RouterGroup) { | |||||
r.DELETE("/selfSupportForSchool/gradeDelete/:id", hdl.SelfSupportForSchoolGradeDelete) //"自营-学校"年级删除 | r.DELETE("/selfSupportForSchool/gradeDelete/:id", hdl.SelfSupportForSchoolGradeDelete) //"自营-学校"年级删除 | ||||
r.POST("/selfSupportForSchool/classList", hdl.SelfSupportForSchoolClassList) //"自营-学校"班级列表 | r.POST("/selfSupportForSchool/classList", hdl.SelfSupportForSchoolClassList) //"自营-学校"班级列表 | ||||
r.DELETE("/selfSupportForSchool/classDelete/:id", hdl.SelfSupportForSchoolClassDelete) //"自营-学校"班级删除 | r.DELETE("/selfSupportForSchool/classDelete/:id", hdl.SelfSupportForSchoolClassDelete) //"自营-学校"班级删除 | ||||
r.POST("/selfSupportForSchool/addWorker", hdl.SelfSupportForSchoolAddWorker) //"自营-学校"添加工作人员 | |||||
r.POST("/selfSupportForSchool/addTeacher", hdl.SelfSupportForSchoolAddTeacher) //"自营-学校"添加老师 | |||||
} | } | ||||