|
|
|
@ -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)
|
|
|
|
|