|
|
@ -24,20 +24,20 @@ select ifnull(A0184,'')IDNumber, |
|
|
|
ifnull(substr(a0134, 1, 6),'') WorkStartDate, |
|
|
|
ifnull((select min(code_name) from code_value where A0141=code_value and code_type='GB4762'),'') PoliticalStatus, |
|
|
|
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end |
|
|
|
from A08 where A0831=1 and A01.A0000=A08.A0000), '') FullTimeEducation, |
|
|
|
from A08 where A0831=1 and A01.A0000=A08.A0000 limit 1), '') FullTimeEducation, |
|
|
|
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end |
|
|
|
from A08 where A0834=1 and A01.A0000=A08.A0000), '') HighestEducation, |
|
|
|
ifnull((select case when A0901B like '3%' then '硕士' when A0901B like '4%' then '学士' else '博士' end from A08 where A0835=1 and A01.A0000=A08.A0000), '') HighestDegree, |
|
|
|
from A08 where A0834=1 and A01.A0000=A08.A0000 limit 1), '') HighestEducation, |
|
|
|
ifnull((select case when A0901B like '3%' then '硕士' when A0901B like '4%' then '学士' else '博士' end from A08 where A0835=1 and A01.A0000=A08.A0000 limit 1), '') HighestDegree, |
|
|
|
ifnull((select min(code_name) from code_value where A0123=code_value and code_type='XZ93'),'') JobCategory, |
|
|
|
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB09' and A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') CurrentPositionLevel, |
|
|
|
ifnull((select substr(A0504, 1, 6) from A05 where A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') CurrentPositionStartDate, |
|
|
|
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB148' and A0531=1 and A0524=1 and A01.A0000=A05.A0000), '') CurrentRankLevel, |
|
|
|
ifnull((select ifnull(DATE_FORMAT(DATE_ADD(concat(substr(A0530, 1, 4),'-',substr(A0530, 5, 2),'-01'), INTERVAL ifnull(A0532, 0) MONTH), '%Y%m'), |
|
|
|
ifnull(substr(A0504, 1, 6), '')) from A05 where A0531=1 and A0524=1 and A01.A0000=A05.A0000), '') CurrentRankStartDate, |
|
|
|
ifnull(substr(A0504, 1, 6), '')) from A05 where A0531=1 and A0524=1 and A01.A0000=A05.A0000 limit 1), '') CurrentRankStartDate, |
|
|
|
IF(A0197 = 1, '是', '否') Has2YearsGrassrootsExp, |
|
|
|
ifnull((select min(code_name) from A15, code_value where A1517=code_value and code_type='ZB18' and A1521='2023' and A01.A0000=A15.A0000), '') AnnualAssessment2023, |
|
|
|
ifnull((select min(code_name) from code_value where A0160=code_value and code_type='ZB125'),'') PersonCategory, |
|
|
|
ifnull((select '是' from A99Z1 where A99Z101=1 and A99Z103=1 and A99Z102 like '2024%' and A01.A0000=A99Z1.A0000), '否') SelectedFor2024 |
|
|
|
ifnull((select '是' from A99Z1 where A99Z101=1 and A99Z103=1 and A99Z102 like '2024%' and A01.A0000=A99Z1.A0000 limit 1), '否') SelectedFor2024 |
|
|
|
from A01 |
|
|
|
where A0163 = '1' |
|
|
|
` |
|
|
@ -306,62 +306,96 @@ func queryByCzSQL(db *sql.DB, SQLCz string) []CzPerson { |
|
|
|
mergeResults 基础人员对比 |
|
|
|
*/ |
|
|
|
func mergeResults(peoplesJck, peoplesZjk, peoplesGzk []Person) []Diff { |
|
|
|
jckMap := mapPersonToDiff(peoplesJck, "基础库") |
|
|
|
zjkMap := mapPersonToDiff(peoplesZjk, "中间库") |
|
|
|
gzkMap := mapPersonToDiff(peoplesGzk, "工资库") |
|
|
|
jckMap := mapPersonToDiff(peoplesJck) |
|
|
|
zjkMap := mapPersonToDiff(peoplesZjk) |
|
|
|
gzkMap := mapPersonToDiff(peoplesGzk) |
|
|
|
|
|
|
|
var diffs []Diff |
|
|
|
|
|
|
|
// 遍历所有可能的键
|
|
|
|
allKeys := make(map[string]bool) |
|
|
|
allKeys, nl := make(map[string]int), make(map[string]map[string]string) |
|
|
|
for key := range jckMap { |
|
|
|
allKeys[key] = true |
|
|
|
allKeys[key] += 4 |
|
|
|
} |
|
|
|
for key := range zjkMap { |
|
|
|
allKeys[key] = true |
|
|
|
allKeys[key] += 2 |
|
|
|
} |
|
|
|
for key := range gzkMap { |
|
|
|
allKeys[key] = true |
|
|
|
allKeys[key] += 1 |
|
|
|
} |
|
|
|
|
|
|
|
for key := range allKeys { |
|
|
|
idNumber := strings.Split(key, "_")[0] |
|
|
|
name := strings.Split(key, "_")[1] |
|
|
|
|
|
|
|
// 获取每个属性的值
|
|
|
|
for colName := range jckMap[key] { |
|
|
|
if colName == "身份证号" || colName == "姓名" { |
|
|
|
continue |
|
|
|
} |
|
|
|
var diff Diff |
|
|
|
if gzMap[colName] { |
|
|
|
// 指定需要注意工资部分
|
|
|
|
if jckMap[key][colName] != zjkMap[key][colName] || |
|
|
|
jckMap[key][colName] != gzkMap[key][colName] || |
|
|
|
zjkMap[key][colName] != gzkMap[key][colName] { |
|
|
|
diff = Diff{ |
|
|
|
IDNumber: idNumber, |
|
|
|
Name: name, |
|
|
|
ColName: colName, |
|
|
|
Jck: jckMap[key][colName], |
|
|
|
Zjk: zjkMap[key][colName], |
|
|
|
Gzk: gzkMap[key][colName], |
|
|
|
} |
|
|
|
diffs = append(diffs, diff) |
|
|
|
if allKeys[key] == 1 { |
|
|
|
// 全部存在 基础
|
|
|
|
diffs = setDiffs(gzkMap, key, nl, nl, gzkMap, idNumber, name, diffs) |
|
|
|
} else if allKeys[key] == 2 { |
|
|
|
// 全部存在 中间
|
|
|
|
diffs = setDiffs(zjkMap, key, nl, zjkMap, nl, idNumber, name, diffs) |
|
|
|
} else if allKeys[key] == 3 { |
|
|
|
// 全部存在 中间 + 工资
|
|
|
|
diffs = setDiffs(zjkMap, key, nl, zjkMap, gzkMap, idNumber, name, diffs) |
|
|
|
} else if allKeys[key] == 4 { |
|
|
|
// 全部存在 基础
|
|
|
|
diffs = setDiffs(jckMap, key, jckMap, nl, nl, idNumber, name, diffs) |
|
|
|
} else if allKeys[key] == 5 { |
|
|
|
// 全部存在 基础 + 工资
|
|
|
|
diffs = setDiffs(jckMap, key, jckMap, nl, gzkMap, idNumber, name, diffs) |
|
|
|
} else if allKeys[key] == 6 { |
|
|
|
// 全部存在 基础 + 中间
|
|
|
|
diffs = setDiffs(zjkMap, key, jckMap, zjkMap, nl, idNumber, name, diffs) |
|
|
|
} else { |
|
|
|
// 全部存在 基础 + 中间 + 工资
|
|
|
|
diffs = setDiffs(jckMap, key, jckMap, zjkMap, gzkMap, idNumber, name, diffs) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return diffs |
|
|
|
} |
|
|
|
|
|
|
|
func setDiffs( |
|
|
|
oneMap map[string]map[string]string, |
|
|
|
key string, |
|
|
|
jckMap map[string]map[string]string, |
|
|
|
zjkMap map[string]map[string]string, |
|
|
|
gzkMap map[string]map[string]string, |
|
|
|
idNumber string, |
|
|
|
name string, |
|
|
|
diffs []Diff) []Diff { |
|
|
|
for colName := range oneMap[key] { |
|
|
|
if colName == "身份证号" || colName == "姓名" { |
|
|
|
continue |
|
|
|
} |
|
|
|
var diff Diff |
|
|
|
if gzMap[colName] { |
|
|
|
// 指定需要注意工资部分
|
|
|
|
if jckMap[key][colName] != zjkMap[key][colName] || |
|
|
|
jckMap[key][colName] != gzkMap[key][colName] || |
|
|
|
zjkMap[key][colName] != gzkMap[key][colName] { |
|
|
|
diff = Diff{ |
|
|
|
IDNumber: idNumber, |
|
|
|
Name: name, |
|
|
|
ColName: colName, |
|
|
|
Jck: jckMap[key][colName], |
|
|
|
Zjk: zjkMap[key][colName], |
|
|
|
Gzk: gzkMap[key][colName], |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 需要公共比较
|
|
|
|
if jckMap[key][colName] != zjkMap[key][colName] { |
|
|
|
diff = Diff{ |
|
|
|
IDNumber: idNumber, |
|
|
|
Name: name, |
|
|
|
ColName: colName, |
|
|
|
Jck: jckMap[key][colName], |
|
|
|
Zjk: zjkMap[key][colName], |
|
|
|
Gzk: gzkMap[key][colName], |
|
|
|
} |
|
|
|
diffs = append(diffs, diff) |
|
|
|
diffs = append(diffs, diff) |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 需要公共比较
|
|
|
|
if jckMap[key][colName] != zjkMap[key][colName] { |
|
|
|
diff = Diff{ |
|
|
|
IDNumber: idNumber, |
|
|
|
Name: name, |
|
|
|
ColName: colName, |
|
|
|
Jck: jckMap[key][colName], |
|
|
|
Zjk: zjkMap[key][colName], |
|
|
|
Gzk: gzkMap[key][colName], |
|
|
|
} |
|
|
|
diffs = append(diffs, diff) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -373,8 +407,8 @@ func mergeResults(peoplesJck, peoplesZjk, peoplesGzk []Person) []Diff { |
|
|
|
mergeCzResults 辞职人员对比 |
|
|
|
*/ |
|
|
|
func mergeCzResults(peoplesCzk, peoplesBhb []CzPerson) []Diff { |
|
|
|
jckMap := mapCzPersonToDiff(peoplesCzk, "辞职库") |
|
|
|
zjkMap := mapCzPersonToDiff(peoplesBhb, "辞职表") |
|
|
|
jckMap := mapCzPersonToDiff(peoplesCzk) |
|
|
|
zjkMap := mapCzPersonToDiff(peoplesBhb) |
|
|
|
|
|
|
|
var diffs []Diff |
|
|
|
|
|
|
@ -436,7 +470,7 @@ func init() { |
|
|
|
/* |
|
|
|
mapPersonToDiff 基础查询对比 |
|
|
|
*/ |
|
|
|
func mapPersonToDiff(people []Person, source string) map[string]map[string]string { |
|
|
|
func mapPersonToDiff(people []Person) map[string]map[string]string { |
|
|
|
result := make(map[string]map[string]string) |
|
|
|
for _, person := range people { |
|
|
|
key := person.IDNumber + "_" + person.Name |
|
|
@ -469,7 +503,7 @@ func mapPersonToDiff(people []Person, source string) map[string]map[string]strin |
|
|
|
/* |
|
|
|
mapCzPersonToDiff 辞职查询对比 |
|
|
|
*/ |
|
|
|
func mapCzPersonToDiff(people []CzPerson, source string) map[string]map[string]string { |
|
|
|
func mapCzPersonToDiff(people []CzPerson) map[string]map[string]string { |
|
|
|
result := make(map[string]map[string]string) |
|
|
|
for _, person := range people { |
|
|
|
key := person.IDNumber + "_" + person.Name |
|
|
@ -485,6 +519,16 @@ func mapCzPersonToDiff(people []CzPerson, source string) map[string]map[string]s |
|
|
|
return result |
|
|
|
} |
|
|
|
|
|
|
|
func Eq(a, b *string) bool { |
|
|
|
if *a == "" { |
|
|
|
a = nil |
|
|
|
} |
|
|
|
if *b == "" { |
|
|
|
a = nil |
|
|
|
} |
|
|
|
return a == b |
|
|
|
} |
|
|
|
|
|
|
|
type Person struct { |
|
|
|
IDNumber string // 身份证号
|
|
|
|
Name string // 姓名
|
|
|
|