|
|
|
@ -73,7 +73,7 @@ func init() {
|
|
|
|
|
func DataExchange() {
|
|
|
|
|
//是不是进行过首次上报,如果没有话,需要执行一次组织机构上报
|
|
|
|
|
//日志文件位置
|
|
|
|
|
logName := progressFilePath + "orgInit.log"
|
|
|
|
|
logName := progressFilePath + "t_base_organization.log"
|
|
|
|
|
//判断文件是不是存在
|
|
|
|
|
if !FileUtil.PathExists(logName) {
|
|
|
|
|
//上报组织机构,读取t_base_organization的SQL脚本
|
|
|
|
@ -82,7 +82,13 @@ func DataExchange() {
|
|
|
|
|
//组织机构是需要按org_type,area_code排序
|
|
|
|
|
orgSql := sql + " order by t1.org_type,t1.area_code"
|
|
|
|
|
list, _ := db.SQL(orgSql).Query().List()
|
|
|
|
|
|
|
|
|
|
var l logStruct
|
|
|
|
|
l.IdInt = 0
|
|
|
|
|
l.StartUpdateTs = "1970-01-01 00:00:00"
|
|
|
|
|
if len(list)>0{
|
|
|
|
|
l.StartUpdateTs = list[len(list)-1]["last_updated_time"].(string)
|
|
|
|
|
l.IdInt = list[len(list)-1]["id_int"].(int64)
|
|
|
|
|
}
|
|
|
|
|
var t tableStruct
|
|
|
|
|
for i := range sqlDict {
|
|
|
|
|
if sqlDict[i].TableName == "t_base_organization" {
|
|
|
|
@ -116,8 +122,12 @@ func DataExchange() {
|
|
|
|
|
}
|
|
|
|
|
fmt.Println(CommonUtil.GetCurrentTime() + " 同步:成功完成组织机构初始化上报,本次完成" + CommonUtil.ConvertIntToString(count) + "条!")
|
|
|
|
|
}
|
|
|
|
|
//记录日志,内容为1,表示组织机构初始化上报过了~
|
|
|
|
|
FileUtil.WriteContent(logName, "ok")
|
|
|
|
|
//记录日志
|
|
|
|
|
jsonBytes, err := json.Marshal(l)
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
|
}
|
|
|
|
|
FileUtil.WriteContent(logName, string(jsonBytes))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
|