Browse Source

完成字典替换操作

master
张献维 7 days ago
parent
commit
000be198cf
  1. 55
      golang_learn/data_office/get_hy_jctj/main.go
  2. 1
      golang_learn/go.mod
  3. 2
      golang_learn/go.sum

55
golang_learn/data_office/get_hy_jctj/main.go

@ -491,18 +491,34 @@ func setDiffs(
diffs = append(diffs, diff)
}
} else {
// 需要公共比较
if jckMap[key][colName] != zjkMap[key][colName] {
diff = Diff{
IDNumber: idNumber,
Name: name,
Work: work,
ColName: colName,
Jck: jckMap[key][colName],
Zjk: zjkMap[key][colName],
Gzk: gzkMap[key][colName],
if colName == "上年年度考核结果" {
v, e := khMap[zjkMap[key][colName]]
if !e || jckMap[key][colName] != v {
diff = Diff{
IDNumber: idNumber,
Name: name,
Work: work,
ColName: colName,
Jck: jckMap[key][colName],
Zjk: zjkMap[key][colName],
Gzk: gzkMap[key][colName],
}
diffs = append(diffs, diff)
}
} else {
// 需要公共比较
if jckMap[key][colName] != zjkMap[key][colName] {
diff = Diff{
IDNumber: idNumber,
Name: name,
Work: work,
ColName: colName,
Jck: jckMap[key][colName],
Zjk: zjkMap[key][colName],
Gzk: gzkMap[key][colName],
}
diffs = append(diffs, diff)
}
diffs = append(diffs, diff)
}
}
}
@ -564,8 +580,25 @@ func mergeCzResults(peoplesCzk, peoplesBhb []CzPerson) []Diff {
// 示例数组
var gzMap map[string]bool
var khMap map[string]string
func init() {
// khMap 考核
khMap = make(map[string]string)
khMap["不称职(连续两年)"] = "不称职"
khMap["不称职"] = "不称职"
khMap["不定等次(病事假半年以上)"] = "病、事假累计超过考核年度半年不确定等次"
khMap["不定等次(受处分)"] = "受政务处分期间年度考核不确定等次"
khMap["不定等次(新录用公务员)"] = "新录用人员试用期年度考核不确定等次"
khMap["不定等次(正在接受审查)"] = "被立案调查尚未结案年度考核不确定等次"
khMap["无考核"] = "不进行考核"
khMap["优秀(非连续三年)"] = "优秀"
khMap["优秀(连续三年)"] = "优秀"
khMap["称职"] = "称职"
khMap["不定等次"] = "不定等次"
khMap["基本称职"] = "基本称职"
// ArrGz 不参与比较项
ArrGz := []string{"身份证号", "姓名", "最高学历", "现职务层次", "现职级层次"}
// 将数组转换为 map
gzMap = make(map[string]bool)

1
golang_learn/go.mod

@ -39,6 +39,7 @@ require (
github.com/russross/blackfriday v1.6.0
github.com/shirou/gopsutil v2.20.4+incompatible
github.com/spf13/viper v1.8.1
github.com/tealeg/xlsx v1.0.5
github.com/tidwall/gjson v1.13.0
github.com/tidwall/sjson v1.2.4
github.com/twgh/xcgui v1.3.360

2
golang_learn/go.sum

@ -491,6 +491,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
github.com/temoto/robotstxt v1.1.2 h1:W2pOjSJ6SWvldyEuiFXNxz3xZ8aiWX5LbfDiOFd7Fxg=
github.com/temoto/robotstxt v1.1.2/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo=
github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=

Loading…
Cancel
Save