diff --git a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go index 302d2e16..4efc4d09 100644 --- a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go +++ b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go @@ -516,26 +516,34 @@ func readToTable(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[s m.OrgName = row[0] //姓名 m.Xm = row[1] + //性别 + if row[2] == "男" { + m.Xbm = "1" + } else { + m.Xbm = "2" + } + //出生日期 + m.Csrq=DateUtil.ConvertDate(row[3]) //民族 - m.Mzm = SysDictKit.MapDictKindChineseToCode["mzm_"+row[2]] + m.Mzm = SysDictKit.MapDictKindChineseToCode["mzm_"+row[4]] //政治面貌 - m.Zzmmm = SysDictKit.MapDictKindChineseToCode["zzmmm_"+row[3]] + m.Zzmmm = SysDictKit.MapDictKindChineseToCode["zzmmm_"+row[5]] //身份证件类型 - m.Sfzjlxm = SysDictKit.MapDictKindChineseToCode["sfzjlxm_"+row[4]] + m.Sfzjlxm = SysDictKit.MapDictKindChineseToCode["sfzjlxm_"+row[6]] //身份证件号 - m.Sfzjh = CommonUtil.CompressStr(row[5]) + m.Sfzjh = CommonUtil.CompressStr(row[7]) //学历 - m.Xlm = SysDictKit.MapDictKindChineseToCode["xlm_"+row[6]] + m.Xlm = SysDictKit.MapDictKindChineseToCode["xlm_"+row[8]] //学位 - m.Xwm = SysDictKit.MapDictKindChineseToCode["xwm_"+row[7]] + m.Xwm = SysDictKit.MapDictKindChineseToCode["xwm_"+row[9]] //职称 - m.Zcm = SysDictKit.MapDictKindChineseToCode["zcm_"+row[8]] + m.Zcm = SysDictKit.MapDictKindChineseToCode["zcm_"+row[10]] //编制 - m.Bzlbm = SysDictKit.MapDictKindChineseToCode["bzlbm_"+row[9]] + m.Bzlbm = SysDictKit.MapDictKindChineseToCode["bzlbm_"+row[11]] //学段 - m.StageId = SysDictKit.MapStageNameToId[row[10]] + m.StageId = SysDictKit.MapStageNameToId[row[12]] //学科 - m.SubjectId = SysDictKit.MapSubjectNameToId[row[11]] + m.SubjectId = SysDictKit.MapSubjectNameToId[row[13]] //部门名称 m.OrgName = row[0] @@ -546,7 +554,7 @@ func readToTable(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[s m.OrgId = MapOrgName[m.OrgName] } //联系电话 - m.Lxdh = row[12] + m.Lxdh = row[14] //批次号 m.BatchId = batchId //第几行的数据 @@ -585,7 +593,7 @@ func checkTempTable(excelPath string, s1 ExcelUtil.TemplateStruct, batchId strin //存在教师身份证号检查重复 for i := range listIdCardTeacher { rowNumber := listIdCardTeacher[i]["row_number"].(int64) - cell := "F" + CommonUtil.ConvertInt64ToString(rowNumber) + cell := "H" + CommonUtil.ConvertInt64ToString(rowNumber) style, _ := f.GetCellStyle(s1.Title, Const.YellowCell) f.SetCellStyle(s1.Title, cell, cell, style) //设计二级检查失败 @@ -603,7 +611,7 @@ func checkTempTable(excelPath string, s1 ExcelUtil.TemplateStruct, batchId strin //存在学生身份证号检查重复 for i := range listIdCardStudent { rowNumber := listIdCardStudent[i]["row_number"].(int64) - cell := "F" + CommonUtil.ConvertInt64ToString(rowNumber) + cell := "H" + CommonUtil.ConvertInt64ToString(rowNumber) style, _ := f.GetCellStyle(s1.Title, Const.YellowCell) f.SetCellStyle(s1.Title, cell, cell, style) //设计二级检查失败 @@ -627,34 +635,6 @@ func checkTempTable(excelPath string, s1 ExcelUtil.TemplateStruct, batchId strin if _, ok := _map[listThisBatchNotEmptyMobileNumber[i]["lxdh"].(string)]; ok { //身份证号一致 if listThisBatchNotEmptyMobileNumber[i]["sfzjh"].(string) != _map[listThisBatchNotEmptyMobileNumber[i]["lxdh"].(string)] { - //不一致 - rowNumber := listThisBatchNotEmptyMobileNumber[i]["row_number"].(int64) - cell := "N" + CommonUtil.ConvertInt64ToString(rowNumber) - style, _ := f.GetCellStyle(s1.Title, Const.YellowCell) - f.SetCellStyle(s1.Title, cell, cell, style) - //设计二级检查失败 - success = false - } - } - } - /****************************************************************************/ - //查出与数据库中重复的非空邮箱 - sql = `select t1.sfzjh,t1.dzxx from t_base_teacher as t1 inner join t_base_teacher_import_excel as t2 - on t1.dzxx=t2.dzxx where t2.batch_id=? and t2.dzxx<>''` - listJoinEmail, _ := db.SQL(sql, batchId).Query().List() - //转成map,方便快速查询 - _map = make(map[string]string) - for i := range listJoinEmail { - _map[listJoinEmail[i]["dzxx"].(string)] = listJoinEmail[i]["sfzjh"].(string) - } - //读取本次导入的所有邮箱不为空的数据 - sql = `select sfzjh,dzxx,row_number from t_base_teacher_import_excel where batch_id=? and dzxx<>''` - listThisBatchNotEmptyEmail, _ := db.SQL(sql, batchId).Query().List() - //遍历每一行数据,看看与系统现有数据的是不是存在冲突 - for i := range listThisBatchNotEmptyEmail { - if _, ok := _map[listThisBatchNotEmptyEmail[i]["dzxx"].(string)]; ok { - //身份证号一致 - if listThisBatchNotEmptyEmail[i]["sfzjh"].(string) != _map[listThisBatchNotEmptyEmail[i]["dzxx"].(string)] { //不一致 rowNumber := listThisBatchNotEmptyMobileNumber[i]["row_number"].(int64) cell := "O" + CommonUtil.ConvertInt64ToString(rowNumber) @@ -665,7 +645,6 @@ func checkTempTable(excelPath string, s1 ExcelUtil.TemplateStruct, batchId strin } } } - /****************************************************************************/ // 根据指定路径保存文件(不管是不是通过,都保存一次) if err := f.SaveAs(excelPath); err != nil { println(err.Error()) @@ -761,13 +740,12 @@ func checkExcel(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[st } //(7)身份证号 if j == 7 { - if row[j-1] == "居民身份证" && !CommonUtil.IsIdCard(CommonUtil.CompressStr(row[j])) { + if row[j-1] == "居民身份证" && row[j] != "" && !CommonUtil.IsIdCard(CommonUtil.CompressStr(row[j])) { pass = false } - if row[j] == "" { - pass = false + if len(row[j]) > 0 { + _idCardMap[CommonUtil.CompressStr(row[j])] = append(_idCardMap[CommonUtil.CompressStr(row[j])], i+1) } - _idCardMap[CommonUtil.CompressStr(row[j])] = append(_idCardMap[CommonUtil.CompressStr(row[j])], i+1) } //(8)学历 if j == 8 { @@ -831,7 +809,7 @@ func checkExcel(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[st //重复 if len(rowArray) > 1 { for i := range rowArray { - cell := "F" + CommonUtil.ConvertIntToString(rowArray[i]) + cell := "H" + CommonUtil.ConvertIntToString(rowArray[i]) //重复 style, _ := f.GetCellStyle(s1.Title, Const.BlueCell) f.SetCellStyle(s1.Title, cell, cell, style) @@ -844,7 +822,7 @@ func checkExcel(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[st //重复 if len(rowArray) > 1 { for i := range rowArray { - cell := "N" + CommonUtil.ConvertIntToString(rowArray[i]) + cell := "O" + CommonUtil.ConvertIntToString(rowArray[i]) //重复 style, _ := f.GetCellStyle(s1.Title, Const.BlueCell) f.SetCellStyle(s1.Title, cell, cell, style) diff --git a/dsBaseRpc/models/t_base_teacher_import_excel.go b/dsBaseRpc/models/t_base_teacher_import_excel.go index e28904e8..943d00d7 100644 --- a/dsBaseRpc/models/t_base_teacher_import_excel.go +++ b/dsBaseRpc/models/t_base_teacher_import_excel.go @@ -1,25 +1,31 @@ package models +import ( + "time" +) + type TBaseTeacherImportExcel struct { - Id string `xorm:"not null pk default ''0'' comment('ID') CHAR(36)"` - Xm string `xorm:"not null default '''' comment('教师姓名') VARCHAR(100)"` - Mzm string `xorm:"not null default '''' comment('民族码') CHAR(2)"` - Zzmmm string `xorm:"not null default '''' comment('政治面貌码') CHAR(2)"` - Sfzjlxm string `xorm:"not null default '''' comment('身份证件类型码') CHAR(1)"` - Sfzjh string `xorm:"not null default '''' comment('身份证件号') index index(sfzjlxm) VARCHAR(100)"` - Xlm string `xorm:"not null default '''' comment('学历码') CHAR(2)"` - Xwm string `xorm:"not null default '''' comment('学位码') CHAR(1)"` - Zcm string `xorm:"not null default '''' comment('职称码') CHAR(1)"` - Bzlbm string `xorm:"not null default '''' comment('编制类型码') CHAR(1)"` - StageId string `xorm:"not null default '''' comment('主要任课学段') CHAR(1)"` - SubjectId string `xorm:"not null default '''' comment('主要任课学科') CHAR(2)"` - Gwzym string `xorm:"not null default '''' comment('岗位') CHAR(2)"` - Lxdh string `xorm:"not null default '''' comment('联系电话') index VARCHAR(100)"` - Dzxx string `xorm:"not null default '''' comment('电子信箱') index VARCHAR(100)"` - OrgId string `xorm:"not null default '''' comment('部门ID') index(org_id) CHAR(36)"` - OrgName string `xorm:"not null default '''' comment('部门名称') index(org_name) VARCHAR(100)"` - BatchId string `xorm:"not null default '''' comment('批次ID') index index(batch_id_2) index(org_id) index(org_name) index index(sfzjlxm) CHAR(36)"` - RowNumber int32 `xorm:"not null default 0 comment('对应的EXCEL是第几行的数据') INT(11)"` - InsertOrUpdate int32 `xorm:"not null default 1 comment('是新增加还是修改,1:新增,2:修改') index(batch_id_2) INT(11)"` - PersonId string `xorm:"not null default '''' comment('人员ID') CHAR(36)"` + Id string `xorm:"not null pk default ''0'' comment('ID') CHAR(36)"` + Xm string `xorm:"not null default '''' comment('教师姓名') VARCHAR(100)"` + Xbm string `xorm:"not null comment('性别码') CHAR(1)"` + Csrq time.Time `xorm:"not null comment('出生日期') DATE"` + Mzm string `xorm:"not null default '''' comment('民族码') CHAR(2)"` + Zzmmm string `xorm:"not null default '''' comment('政治面貌码') CHAR(2)"` + Sfzjlxm string `xorm:"not null default '''' comment('身份证件类型码') CHAR(1)"` + Sfzjh string `xorm:"not null default '''' comment('身份证件号') index index(sfzjlxm) VARCHAR(100)"` + Xlm string `xorm:"not null default '''' comment('学历码') CHAR(2)"` + Xwm string `xorm:"not null default '''' comment('学位码') CHAR(1)"` + Zcm string `xorm:"not null default '''' comment('职称码') CHAR(1)"` + Bzlbm string `xorm:"not null default '''' comment('编制类型码') CHAR(1)"` + StageId string `xorm:"not null default '''' comment('主要任课学段') CHAR(1)"` + SubjectId string `xorm:"not null default '''' comment('主要任课学科') CHAR(2)"` + Gwzym string `xorm:"not null default '''' comment('岗位') CHAR(2)"` + Lxdh string `xorm:"not null default '''' comment('联系电话') index VARCHAR(100)"` + Dzxx string `xorm:"not null default '''' comment('电子信箱') index VARCHAR(100)"` + OrgId string `xorm:"not null default '''' comment('部门ID') index(org_id) CHAR(36)"` + OrgName string `xorm:"not null default '''' comment('部门名称') index(org_name) VARCHAR(100)"` + BatchId string `xorm:"not null default '''' comment('批次ID') index index(batch_id_2) index(org_id) index(org_name) index index(sfzjlxm) CHAR(36)"` + RowNumber int32 `xorm:"not null default 0 comment('对应的EXCEL是第几行的数据') INT(11)"` + InsertOrUpdate int32 `xorm:"not null default 1 comment('是新增加还是修改,1:新增,2:修改') index(batch_id_2) INT(11)"` + PersonId string `xorm:"not null default '''' comment('人员ID') CHAR(36)"` }