|
|
|
@ -38,6 +38,7 @@ var IncrSqlDict = []tableStruct{
|
|
|
|
|
{TableName: "t_base_class", PrimaryKey: "class_id", DataSource: "org_class"},
|
|
|
|
|
{TableName: "t_base_teacher", PrimaryKey: "teacher_id", DataSource: "user_teacher"},
|
|
|
|
|
{TableName: "t_base_student", PrimaryKey: "student_id", DataSource: "user_student"},
|
|
|
|
|
{TableName: "t_sys_loginperson_log", PrimaryKey: "id", DataSource: "log_login"},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 全量数据上报
|
|
|
|
@ -89,11 +90,11 @@ func InitFull() {
|
|
|
|
|
//判断文件是不是存在
|
|
|
|
|
if !FileUtil.PathExists(logName) {
|
|
|
|
|
//SQL内容
|
|
|
|
|
sql := FileUtil.ReadFileContent("./Sql/"+FullSqlDict[i].TableName+".sql")
|
|
|
|
|
sql := FileUtil.ReadFileContent("./Sql/" + FullSqlDict[i].TableName + ".sql")
|
|
|
|
|
|
|
|
|
|
var list []map[string]interface{}
|
|
|
|
|
//如果是组织机构表,那么需要变更一下查询的排序条件
|
|
|
|
|
if FullSqlDict[i].TableName=="t_base_organization"{
|
|
|
|
|
if FullSqlDict[i].TableName == "t_base_organization" {
|
|
|
|
|
//组织机构是需要按org_type,area_code排序
|
|
|
|
|
sql = sql + " order by t1.org_type,t1.area_code"
|
|
|
|
|
}
|
|
|
|
@ -123,10 +124,10 @@ func InitFull() {
|
|
|
|
|
} else {
|
|
|
|
|
isFinish = true
|
|
|
|
|
}
|
|
|
|
|
fmt.Println(CommonUtil.GetCurrentTime() + " 同步:成功完成"+FullSqlDict[i].TableName+"初始化上报,本次完成" + CommonUtil.ConvertIntToString(count) + "条!")
|
|
|
|
|
fmt.Println(CommonUtil.GetCurrentTime() + " 同步:成功完成" + FullSqlDict[i].TableName + "初始化上报,本次完成" + CommonUtil.ConvertIntToString(count) + "条!")
|
|
|
|
|
}
|
|
|
|
|
//对于组织机构进行特殊处理
|
|
|
|
|
if FullSqlDict[i].TableName=="t_base_organization"{
|
|
|
|
|
if FullSqlDict[i].TableName == "t_base_organization" {
|
|
|
|
|
//记录日志
|
|
|
|
|
maxSql := sql + " order by t1.last_updated_time desc,t1.id_int desc limit 1"
|
|
|
|
|
var l logStruct
|
|
|
|
@ -143,7 +144,7 @@ func InitFull() {
|
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
|
}
|
|
|
|
|
FileUtil.WriteContent(logName, string(jsonBytes))
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
FileUtil.WriteContent(logName, "is finished!")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -248,13 +249,13 @@ func PostToServer(t tableStruct, list []map[string]interface{}) bool {
|
|
|
|
|
for k := range list {
|
|
|
|
|
var ds dataStruct
|
|
|
|
|
ds.Data, _ = CommonUtil.MapToJson(list[k])
|
|
|
|
|
switch list[k][t.PrimaryKey].(type){
|
|
|
|
|
case int64:
|
|
|
|
|
ds.DataId = CommonUtil.ConvertInt64ToString(list[k][t.PrimaryKey].(int64))
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
ds.DataId = list[k][t.PrimaryKey].(string)
|
|
|
|
|
break
|
|
|
|
|
switch list[k][t.PrimaryKey].(type) {
|
|
|
|
|
case int64:
|
|
|
|
|
ds.DataId = CommonUtil.ConvertInt64ToString(list[k][t.PrimaryKey].(int64))
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
ds.DataId = list[k][t.PrimaryKey].(string)
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
ds.DelFlag = list[k]["del_flag"].(int64)
|
|
|
|
|
ds.OrgId = list[k]["bureau_id"].(string)
|
|
|
|
|