瀏覽代碼

update

add_mode
DengBiao 1 年之前
父節點
當前提交
829e553a0a
共有 3 個文件被更改,包括 78 次插入0 次删除
  1. +76
    -0
      app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go
  2. +2
    -0
      app/router/admin_router.go
  3. 二進制
     

+ 76
- 0
app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go 查看文件

@@ -11,7 +11,9 @@ import (
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"github.com/360EntSecGroup-Skylar/excelize"
"github.com/gin-gonic/gin"
"path"
"time"
)

@@ -683,6 +685,80 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) {
return
}

func SelfSupportForSchoolImportTeacher(c *gin.Context) {
enterpriseIdStr := c.DefaultQuery("enterprise_id", "")
enterpriseId := utils.StrToInt(enterpriseIdStr)
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if enterprise == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}
files, _ := c.FormFile("file")
dst := path.Join("./static/upload", files.Filename)
err = c.SaveUploadedFile(files, dst)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
xlsx, err := excelize.OpenFile(dst)
rows := xlsx.GetRows("Sheet" + "1")
for key, row := range rows {
if key > 0 && (row[0] != "" && row[1] != "") {
idNo := row[0]
name := row[1]
//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(enterpriseId, idNo)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if isHasUserIdentity != nil {
continue
}

now := time.Now()
//2、新增身份信息
userIdentity := &model.UserIdentity{
Uid: 0,
Name: name,
IdNo: idNo,
Kind: enum.UserIdentityKindForCommon,
Identity: enum.UserIdentityForSelfSupportForTeacher,
EnterpriseId: 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 SelfSupportForSchoolDownloadTemplateExcel(c *gin.Context) {
e.OutSuc(c, "/", nil)
return
}

func SelfSupportForSchoolOrdList(c *gin.Context) {
var req md.SelfSupportForSchoolOrdListReq
err := c.ShouldBindJSON(&req)


+ 2
- 0
app/router/admin_router.go 查看文件

@@ -204,6 +204,8 @@ func rEnterpriseManage(r *gin.RouterGroup) {
r.DELETE("/selfSupportForSchool/classDelete/:id", hdl.SelfSupportForSchoolClassDelete) //"自营-学校"班级删除
r.POST("/selfSupportForSchool/addWorker", hdl.SelfSupportForSchoolAddWorker) //"自营-学校"添加工作人员
r.POST("/selfSupportForSchool/addTeacher", hdl.SelfSupportForSchoolAddTeacher) //"自营-学校"添加老师
r.POST("/selfSupportForSchool/importTeacher", hdl.SelfSupportForSchoolImportTeacher) //"自营-学校"导入老师
r.GET("/selfSupportForSchool/downloadTemplateExcel", hdl.SelfSupportForSchoolDownloadTemplateExcel) //"自营-学校"下载表格模板
r.POST("/selfSupportForSchool/ordList", hdl.SelfSupportForSchoolOrdList) //"自营-学校"订单列表
r.POST("/selfSupportForSchool/arrearsOrdList", hdl.SelfSupportForSchoolArrearsOrdList) //"自营-学校"订单欠费列表
r.POST("/selfSupportForSchool/arrearsOrdDebtRepay", hdl.SelfSupportForSchoolArrearsOrdDebtRepay) //"自营-学校"订单欠费催缴


二進制
查看文件


Loading…
取消
儲存