master
huanghai 5 years ago
parent bdb216a220
commit afe12869d0

@ -457,13 +457,13 @@ func checkExcel(excelPath string, s1 ExcelUtil.TemplateStruct, MapClass map[stri
}
//(7)身份证号
if j == 7 {
if row[j-1] == "居民身份证" && !CommonUtil.IsIdCard(row[j]) {
if row[j-1] == "居民身份证" && !CommonUtil.IsIdCard(CommonUtil.CompressStr(row[j])) {
pass = false
}
if row[j] == "" {
pass = false
}
_idCardMap[row[j]] = append(_idCardMap[row[j]], i+1)
_idCardMap[CommonUtil.CompressStr(row[j])] = append(_idCardMap[CommonUtil.CompressStr(row[j])], i+1)
}
//(8)独生子女
if j == 8 {
@ -580,7 +580,7 @@ func readToTable(excelPath string, s1 ExcelUtil.TemplateStruct, MapClass map[str
//身份证件类型
m.Sfzjlxm = SysDictKit.MapDictKindChineseToCode["sfzjlxm_"+row[6]]
//身份证件号
m.Sfzjh = row[7]
m.Sfzjh = CommonUtil.CompressStr(row[7])
//独生子女
m.Dszybz = int32(CommonUtil.ConvertStringToInt(SysDictKit.MapTrueOrFalseNameToValue[row[8]]))
//随迁子女

@ -448,7 +448,7 @@ func readToTable(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[s
//身份证件类型
m.Sfzjlxm = SysDictKit.MapDictKindChineseToCode["sfzjlxm_"+row[4]]
//身份证件号
m.Sfzjh = row[5]
m.Sfzjh =CommonUtil.CompressStr(row[5])
//学历
m.Xlm = SysDictKit.MapDictKindChineseToCode["xlm_"+row[6]]
//学位
@ -666,13 +666,13 @@ func checkExcel(excelPath string, s1 ExcelUtil.TemplateStruct, MapOrgName map[st
}
//(5)身份证号
if j == 5 {
if row[j-1] == "居民身份证" && !CommonUtil.IsIdCard(row[j]) {
if row[j-1] == "居民身份证" && !CommonUtil.IsIdCard(CommonUtil.CompressStr(row[j])) {
pass = false
}
if row[j] == "" {
pass = false
}
_idCardMap[row[j]] = append(_idCardMap[row[j]], i+1)
_idCardMap[CommonUtil.CompressStr(row[j])] = append(_idCardMap[CommonUtil.CompressStr(row[j])], i+1)
}
//(6)学历
if j == 6 {

@ -654,3 +654,13 @@ func MapToJson(m map[string]interface{}) (string, error) {
}
return string(jsonByte), nil
}
//利用正则表达式压缩字符串,去除空格或制表符
func CompressStr(str string) string {
if str == "" {
return ""
}
//匹配一个或多个空白符的正则表达式
reg := regexp.MustCompile("\\s+")
return reg.ReplaceAllString(str, "")
}

Loading…
Cancel
Save