Merge branch 'master' of 10.10.14.250:huanghai/dsMin

master
zhangjun 5 years ago
commit 1bd4fd8cf5

@ -0,0 +1,38 @@
package DataEx
import (
"dsBaseRpc/Const"
"dsBaseRpc/Utils/DbUtil"
"dsBaseRpc/Utils/LogUtil"
"fmt"
)
var db = DbUtil.Engine
//有同步哪些表
var sqlDict = []string{"t_base_organization", "t_base_class"}
/**
2020-07-16
*/
func DataExchange() {
for {
//本轮上报的数量如果是0休息10秒后再继续上传
count:=0
//遍历所有的配置节,进行循环
for i := range sqlDict {
//判断日志目录下的记录是不是存在?
//存在则读取last_updated_time+id_int进行分页获取
paramMap := map[string]interface{}{"last_updated_time": "2020-07-15 00:00:00"}
list, err := db.SqlMapClient(sqlDict[i], &paramMap).Query().List()
if err != nil {
LogUtil.Error(Const.DataBaseActionError, "数据上报时发生了严重错误:"+err.Error())
break
}
fmt.Println(list)
}
}
}

@ -0,0 +1,79 @@
<sqlMap>
<sql id="t_base_organization">
SELECT
cast( `t_base_organization`.`org_id` AS CHAR ( 36 ) charset utf8 ) AS `org_id`,
`t_base_organization`.`id_int` AS `id_int`,
`t_base_organization`.`org_code` AS `org_code`,
`t_base_organization`.`org_name` AS `org_name`,
cast( `t_base_organization`.`parent_id` AS CHAR ( 36 ) charset utf8 ) AS `parent_id`,
cast( `t_base_organization`.`bureau_id` AS CHAR ( 36 ) charset utf8 ) AS `bureau_id`,
`t_base_organization`.`org_type` AS `org_type`,
`t_base_organization`.`edu_assist_type` AS `edu_assist_type`,
`t_base_organization`.`main_school_type` AS `main_school_type`,
cast( `t_base_organization`.`main_school_id` AS CHAR ( 36 ) charset utf8 ) AS `main_school_id`,
cast( `t_base_organization`.`manage_org_id` AS CHAR ( 36 ) charset utf8 ) AS `manage_org_id`,
`t_base_organization`.`directly_under_type` AS `directly_under_type`,
`t_base_organization`.`xxbbm` AS `xxbbm`,
`t_base_organization`.`xxbxlxm` AS `xxbxlxm`,
`t_base_organization`.`szdcxlxm` AS `szdcxlxm`,
`t_base_organization`.`xxjbzm` AS `xxjbzm`,
cast( `t_base_organization`.`fzr` AS CHAR ( 36 ) charset utf8 ) AS `fzr`,
`t_base_organization`.`fddbr` AS `fddbr`,
`t_base_organization`.`fddbrdh` AS `fddbrdh`,
`t_base_organization`.`address` AS `address`,
`t_base_organization`.`lxdh` AS `lxdh`,
`t_base_organization`.`org_lng` AS `org_lng`,
`t_base_organization`.`org_lat` AS `org_lat`,
`t_base_organization`.`sort_id` AS `sort_id`,
cast( `t_base_organization`.`b_use` AS signed ) AS `b_use`,
`t_base_organization`.`province_code` AS `province_code`,
`t_base_organization`.`city_code` AS `city_code`,
`t_base_organization`.`district_code` AS `district_code`,
`t_base_organization`.`area_code` AS `area_code`,
`t_base_organization`.`last_updated_time` AS `last_updated_time`,
DATE_FORMAT(`t_base_organization`.`create_time`,'%Y/%m/%d %H:%i:%s') AS `create_time`,
case `t_base_organization`.`b_use` when -1 then 1 else 0 end AS `del_flag`
FROM
`t_base_organization`
WHERE
`t_base_organization`.`last_updated_time`>?last_updated_time
ORDER BY
`t_base_organization`.`last_updated_time`
</sql>
<sql id="t_base_class">
SELECT
cast( `t_base_class`.`class_id` AS CHAR ( 36 ) charset utf8 ) AS `class_id`,
`t_base_class`.`id_int` AS `id_int`,
`t_base_class`.`bh` AS `bh`,
`t_base_class`.`class_code` AS `class_code`,
`t_base_class`.`class_name` AS `class_name`,
`t_base_class`.`class_alias` AS `class_alias`,
`t_base_class`.`rxnf` AS `rxnf`,
`t_base_class`.`rxjj` AS `rxjj`,
`t_base_class`.`schooling_length` AS `schooling_length`,
`t_base_class`.`stage_id` AS `stage_id`,
cast( `t_base_class`.`teacher_id` AS CHAR ( 36 ) charset utf8 ) AS `teacher_id`,
cast( `t_base_class`.`org_id` AS CHAR ( 36 ) charset utf8 ) AS `org_id`,
cast( `t_base_class`.`bureau_id` AS CHAR ( 36 ) charset utf8 ) AS `bureau_id`,
cast( `t_base_class`.`b_use` AS signed ) AS `b_use`,
`t_base_class`.`province_code` AS `province_code`,
`t_base_class`.`city_code` AS `city_code`,
`t_base_class`.`district_code` AS `district_code`,
cast( `t_base_class`.`main_school_id` AS CHAR ( 36 ) charset utf8 ) AS `main_school_id`,
DATE_FORMAT(`t_base_class`.`create_time`,'%Y/%m/%d %H:%i:%s') AS `create_time`,
`t_base_class`.`last_updated_time` AS `last_updated_time`,
`t_dm_stage`.`stage_name` AS `stage_name`,
`t_base_organization`.`org_name` AS `org_name` ,
case `t_base_class`.`b_use` when -1 then 1 else 0 end AS `del_flag`
FROM
((
`t_base_class`
JOIN `t_dm_stage` ON ( `t_base_class`.`stage_id` = `t_dm_stage`.`stage_id` ))
JOIN `t_base_organization` ON ( `t_base_class`.`bureau_id` = `t_base_organization`.`org_id` ))
WHERE
`t_base_class`.`last_updated_time`>?last_updated_time
ORDER BY
`t_base_class`.`last_updated_time`
</sql>
</sqlMap>

@ -26,6 +26,12 @@ func init() {
if err != nil {
fmt.Println(err)
}
//注册SqlMap配置可选功能如应用中无需使用SqlMap可无需初始化
err =Engine.RegisterSqlMap(xorm.Xml("./Sql", ".xml"))
if err != nil {
fmt.Println(err)
}
//设置数据库连接池
Engine.SetMaxOpenConns(100) //设置打开数据库的最大连接数,包含正在使用的连接和连接池的连接。
Engine.SetMaxIdleConns(10) //设置连接池中的保持连接的最大连接数。

@ -1,6 +1,7 @@
package main
import (
"dsBaseRpc/DataEx"
"dsBaseRpc/RpcService/BaseClass/BaseClassProto"
"dsBaseRpc/RpcService/BaseClass/BaseClassService"
"dsBaseRpc/RpcService/BaseGlobal/BaseGlobalProto"
@ -96,9 +97,13 @@ func main() {
//人员角色
BaseRolePersonProto.RegisterBaseRolePersonManageServer(s, &BaseRolePersonService.Rpc{})
//五、 注册反射服务 这个服务是CLI使用的 跟服务本身没有关系
//五、开启一个数据上报的协程
go func() {
DataEx.DataExchange()
}()
//六、 注册反射服务 这个服务是CLI使用的 跟服务本身没有关系
reflection.Register(s)
//六、启动
//、启动
fmt.Printf("服务发布成功,端口:%s", ConfigUtil.RpcServerPort)
if err := s.Serve(lis); err != nil {
fmt.Printf("failed to serve: %v\n", err)

@ -1,21 +1,22 @@
:: 创建Windows发布版本 -ldflags "-s -w"
go build -o ./WinBuild/Distribute.exe ./Tools/Distribute.go
:: .\Tools\upx.exe -9 ./WinBuild/Distribute.exe
:: 创建Linux发布版本
SET GOOS=linux
SET GOARCH=amd64
go build -o ./build/dsBaseRpc main.go
:: 压缩一下
:: .\Tools\upx.exe -9 ./build/dsBaseRpc
:: 拷贝资源文件
xcopy .\Shell\* .\build\ /y /e /i /q
xcopy .\Config\* .\build\Config /y /e /i /q
xcopy .\Xml\* .\build\Xml /y /e /i /q
:: 上传文件
.\WinBuild\Distribute.exe
:: 创建Windows发布版本 -ldflags "-s -w"
go build -o ./WinBuild/Distribute.exe ./Tools/Distribute.go
:: .\Tools\upx.exe -9 ./WinBuild/Distribute.exe
:: 创建Linux发布版本
SET GOOS=linux
SET GOARCH=amd64
go build -o ./build/dsBaseRpc main.go
:: 压缩一下
:: .\Tools\upx.exe -9 ./build/dsBaseRpc
:: 拷贝资源文件
xcopy .\Shell\* .\build\ /y /e /i /q
xcopy .\Config\* .\build\Config /y /e /i /q
xcopy .\Xml\* .\build\Xml /y /e /i /q
xcopy .\Sql\* .\build\Sql /y /e /i /q
:: 上传文件
.\WinBuild\Distribute.exe
pause

@ -316,10 +316,19 @@ func authorizePost(context *gin.Context) {
if !success {
context.JSON(http.StatusOK, Model.Res{
Code: http.StatusNotImplemented,
Msg: "用户名密码不正确",
Msg: "用户名密码不正确或已禁用",
})
return
}
if CommonUtil.ConvertStringToInt(identityId)>1{
context.JSON(http.StatusOK, Model.Res{
Code: http.StatusNotImplemented,
Msg: "非管理员用户暂不能登录,敬请期待!!",
})
return
}
} else {
context.JSON(http.StatusOK, Model.Res{
Code: http.StatusNotImplemented,

Loading…
Cancel
Save